Commit graph

388 commits

Author SHA1 Message Date
Larry Finger 8334ffdc82 rtlwifi: Add explicit values to hw_variables enum
The entries in this enum may be referenced in debug output. Adding explicit
values simplifies the lookup.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-27 18:46:03 +03:00
Larry Finger 1cc49a5b54 rtlwifi: Add HAL_DEF_WOWLAN case to *_get_hw() routines
Only rtl8821ae implements WOWLAN; however, the other drivers may receive
a call requesting information about this mode. The other drivers need to
ignore the request rather than logging that the default branch of the
switch statement has been reached.

Reported by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-27 18:46:03 +03:00
Joe Perches ad5748893b rtlwifi: Add switch variable to 'switch case not processed' messages
Help along debugging by showing what switch/case variable is not
being processed in these messages.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-27 18:44:19 +03:00
Larry Finger b42fbed6b8 rtl8xxxu: Stop log spam from each successful interrupt
As soon as debugging is turned on, the logs are filled with messages
reporting the interrupt status. As this quantity is usually zero, this
output is not needed. In fact, there will be a report if the status is
not zero, thus the debug line in question could probably be deleted.
Rather than taking that action, I have changed it to only be printed
when the newly added RTL8XXXU_DEBUG_INTERRUPT bit is set in the debug
mask.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-26 20:41:37 +03:00
Jes Sorensen 2fc5dd27bf rtl8xxxu: Use a struct rtl8xxxu_fileops * in rtl8xxxu_init_device()
This saves some 217, or about, derefences of priv->fops.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-26 20:41:36 +03:00
Jes Sorensen c0a99bbb1b rtl8xxxu: Clean up llt_init() API
Remove last_tx_page argument from the llt_init() function. The
rtl8xxxu_fileops structure contains the correct TX_TOTAL_PAGE_NUM
value for the device, and rtl8xxxu_auto_llt_table() doesn't need to
know the value in the first place.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-26 20:41:36 +03:00
Jes Sorensen 3a589fae4a rtl8xxxu: Fix off by one error calculating pubq
This was detected tracing the 8188eu driver, but doesn't seem to make
any difference when using it.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-26 20:41:35 +03:00
Jes Sorensen f1785fbf7c rtl8xxxu: Implement 8192e specific power down sequence
This powers down the 8192e correctly, or at least to the point where
the firmware will load again, when reloading the driver module.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-17 18:16:19 +03:00
Julia Lawall d86e647688 rtlwifi: rtl818x: constify local structures
For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-14 20:01:40 +03:00
Colin Ian King 0cd7f70399 rtl8xxxu: fix spelling mistake "firmare" -> "firmware"
Trivial fix to spelling mistakes in dev_dbg message.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-14 20:01:09 +03:00
Jes Sorensen 54cdf5c727 rtl8xxxu: Reset device on module unload if still attached
If the USB dongle is still attached, reset it on module unload to
avoid scans failing when reloading the driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-14 20:01:08 +03:00
Oleg Drokin 5856cd5b8d rtlwifi/rtl8192de: Fix print format string
%ul was likely meant as %lu to print an unsigned long,
not an unsigned with a letter l at the end.
But in fact the value printed is u32 anyway, so just drop
the l completely.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 20:04:26 +03:00
Larry Finger 0c9d349153 rtlwifi: Fix missing country code for Great Britain
Some RTL8821AE devices sold in Great Britain have the country code of
0x25 encoded in their EEPROM. This value is not tested in the routine
that establishes the regulatory info for the chip. The fix is to set
this code to have the same capabilities as the EU countries. In addition,
the channels allowed for COUNTRY_CODE_ETSI were more properly suited
for China and Israel, not the EU. This problem has also been fixed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 20:00:25 +03:00
Hans de Goede 7329dc1310 rtl8xxxu: Make rtl8xxxu_ampdu_action less chatty
On my home network rtl8xxxu is spamming the log with
IEEE80211_AMPDU_RX_START / IEEE80211_AMPDU_RX_STOP every few seconds
turn these messages into debug messages.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
[kvalo@codeaurora.org: fix commit title]
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:58:19 +03:00
Wei Yongjun 77e3980201 rtl8xxxu: gen1: Fix non static symbol warning
Fixes the following sparse warning:

drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:898:1: warning:
 symbol 'rtl8xxxu_gen1_h2c_cmd' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:33 +03:00
Jes Sorensen b59415c2dd rtl8xxxu: Split filling of TX descriptors into separate functions
Split the filling of TX descriptors into a generic portion used on all
devices, and format specific helper functions provided in the fops
structure.

This also cleaned up some mess, even if non harmful, in the handling
of txdesc40 descriptors, where the code randomly would switch between
the pointer to tx_desc and tx_desc40.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:31 +03:00
Jes Sorensen 99afaac427 rtl8xxxu: Determine need for shore preamble before updating TX descriptors
Another patch to move this detection out of the code handling the TX
descriptor update.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:29 +03:00
Jes Sorensen 3972cc5791 rtl8xxxu: Determine the need for SGI before handling specific TX desc formats
In order to be able to split out the TX descriptor handling code,
determine in advance the need to mark SGI.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:24 +03:00
Jes Sorensen be49b1f111 rtl8xxxu: Simplify calculating of hw value used for setting TX rate
Calculating the value in one place rather than using one calculation
in one place and a different one for management frames in another
location makes little sense.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:23 +03:00
Jes Sorensen eed145ab25 rtl8xxxu: Introduce fops bitflag indicating type of thermal meter
Do not rely on TX descriptor size to determine the thermal meter
type.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:22 +03:00
Jes Sorensen ee675cc30e rtl8xxxu: Convert flags in rtl8xxxu_fileops to bitflags
This leaves space for a few more flags within the same space.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:21 +03:00
Jes Sorensen e3ebcd7428 rtl8xxxu: Use flag to indicate whether device has TX report timer support
Use a fileops flag to indicate whether the device has TX report timer
support. This will make it easier to include future devices such as
8188eu to use the TX report timer.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:20 +03:00
Jes Sorensen 0b09628948 rtl8xxxu: Add interrupt bit definitions for gen2 parts
These are primarily needed for SDIO/PCI parts, but the vendor driver
still sets them for some USB devices.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:19 +03:00
Jes Sorensen dce7548fd9 rtl8xxxu: Add bit definitions for REG_FPGA0_TX_INFO
This adds TX antenna selection bit defines for OFDM mode.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:18 +03:00
Jes Sorensen e02aa3eef7 rtl8xxxu: Simplify code setting TX buffer boundary
With all devices now offering fops->total_page_num, get rid of the
if mess for setting the TX buffer boundary.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:17 +03:00
Jes Sorensen efeb8ce7a9 rtl8xxxu: Remove now obsolete rtl8xxxu_old_init_queue_reserved_page()
Switching over the old devices to use the new function allows us to
get rid of this legacy.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:16 +03:00
Jes Sorensen b492940dc1 rtl8xxxu: Switch 8192cu/8188cu devices to use rtl8xxxu_init_queue_reserved_page()
This was the last user of the old
rtl8xxxu_old_init_queue_reserved_page() which can now be removed.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:15 +03:00
Jes Sorensen e366f45d36 rtl8xxxu: Switch 8723a to use new rtl8xxxu_init_queue_reserved_page() routine
This changes the pub-queue value written to REQ_RQPN, however the old
code used a hard coded minimum value assuming there would always be an
active lo-queue, even when no USB EP was found for it.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:14 +03:00
Jes Sorensen 44abaa08d0 rtl8xxxu: Add TX page defines for 8723b
This switches the 8723b driver to use the new
rtl8xxxu_init_queue_reserved_page() function.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:13 +03:00
Jes Sorensen 690a6d268b rtl8xxxu: Add TP-Link TL-WN823N v2 to list of supported devices
This is an rtl8192eu based dongle (the v1 is an rtl8192cu). Reported
and tested by Myckel Habets.

Reported-by: Myckel Habets <myckel@sdf.lonestar.org>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:11 +03:00
Jes Sorensen deb6176e56 rtl8xxxu: Fix error handling if rtl8xxxu_init_device() fails
For some reason we lost the code bailing if rtl8xxxu_init_device()
returned an error.

This catches the error and also cleans up the error handling.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:10 +03:00
Jes Sorensen 76a8e07d49 rtl8xxxu: Mark 0x2001:0x3308 as tested
D-Link DWA-121 is reported as working.

Reported-by: Stefano Bravi <stefanobravi69@libero.it>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:09 +03:00
Jes Sorensen b81669b9e0 rtl8xxxu: Mark 0x20f4:0x648b as tested
Successfully tested by Jocelyn Mayer

Reported-by: J. Mayer <l_indien@magic.fr>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:57:07 +03:00
Christian Engelmayer 3eeacaa902 rtlwifi: rtl8723ae: Fix leak in _rtl8723e_read_adapter_info()
In case of (rtlhal->oem_id != RT_CID_DEFAULT), the function directly
returns and leaks the already allocated hwinfo memory. Go through the
correct exit path.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:53:45 +03:00
Christian Engelmayer a0c7858e74 rtlwifi: rtl8192de: Fix leak in _rtl92de_read_adapter_info()
In case rtl_get_hwinfo() fails, the function directly returns and leaks the
already allocated hwinfo memory. Go through the correct exit path.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 19:52:25 +03:00
Heinrich Schuchardt f898005ff9 rtlwifi: remove superfluous condition
If sta == NULL, the changed line will not be reached.
So no need to check that sta != NULL here.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-09-03 13:03:03 +03:00
Wolfram Sang eb36333896 net: wireless: realtek: rtlwifi: usb: don't print error when allocating urb fails
kmalloc will print enough information in case of failure.

Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-08-13 14:53:41 -07:00
Arnd Bergmann 944c07a7aa rtlwifi: don't add include path for rtl8188ee
For rtl8188ee, we pass -Idrivers/net/wireless/rtlwifi/ to gcc,
however that directy no longer exists, so evidently this option
is no longer required here and can be removed to avoid a warning
when building with 'make W=1' or 'gcc -Wmissing-include-dirs'

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-07-19 21:17:41 +03:00
Kalle Valo 8a185006bc Merge git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git
This is to fix some conflicts in iwlwifi.

Conflicts:
	drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
	drivers/net/wireless/intel/iwlwifi/mvm/scan.c
2016-07-10 21:07:29 +03:00
Larry Finger 238ad2ddf3 rtlwifi: rtl8723ae: Clean up the hardware info routine
This driver contains some complicated if ... else if ... else constructions.
These are replaced by switch statements to improve readability.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-07-08 16:50:04 +03:00
Larry Finger a8c9fb2b82 rtlwifi: rtl8192de: Convert driver to use common hardware info routine
The driver for RTL8192DE chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-07-08 16:50:04 +03:00
Larry Finger 2f7b4b8953 rtlwifi: rtl8821ae: Convert driver to use common hardware info routine
The driver for RTL8821AE chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-07-08 16:50:03 +03:00
Larry Finger 9e9c9c247c rtlwifi: rtl8723be: Convert driver to use common hardware info routine
The driver for RTL8723BE chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-07-08 16:50:03 +03:00
Larry Finger 8aaf6916de rtlwifi: rtl8723ae: Convert driver to use common hardware info routine
The driver for RTL8723AE chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-07-08 16:50:02 +03:00
Larry Finger 5c392654ee rtlwifi: rtl8192ee: Convert driver to use common hardware info routine
The driver for RTL8192EE chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-07-08 16:50:02 +03:00
Larry Finger 9468792743 rtlwifi: rtl8188ee: Convert driver to use common hardware info routine
The driver for RTL8188EE chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-07-08 16:50:01 +03:00
Larry Finger c2d9a41145 rtlwifi: rtl8192cu: Convert driver to use common hardware info routine
The driver for RTL8192CU chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-07-08 16:50:01 +03:00
Larry Finger df5cbc697d rtlwifi: rtl8192ce: Convert driver to use common hardware info routine
The driver for RTL8192CE chips is converted to use the common routine
for getting the hardware information.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-07-08 16:50:00 +03:00
Larry Finger edb45b67a0 rtlwifi: Create common routine to get hardware info
All of the rtlwifi family of drivers have a similar routine that acquires
the hardware info from efuse and initializes a number of variables in the
driver's private area. A common routine is created for all drivers to use.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-07-08 16:50:00 +03:00
Masanari Iida 8a1902374f rtlwifi: Fix typo in printk
This patch fix spelling typos found in drivers/net/wireless/realtek.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2016-07-08 16:42:51 +03:00