platform/kernel/linux-rpi.git
5 years agoiwlwifi: mvm: remove unused conversion table
Emmanuel Grumbach [Mon, 30 Jul 2018 12:57:08 +0000 (15:57 +0300)]
iwlwifi: mvm: remove unused conversion table

chanwidths isn't used now in debugfs-vif.c.  Remove it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg: use helper to check if debug type is set
Sara Sharon [Mon, 30 Jul 2018 06:43:24 +0000 (09:43 +0300)]
iwlwifi: dbg: use helper to check if debug type is set

This enables to incorporate more logic in one place.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: Send non offchannel traffic via AP sta
Andrei Otcheretianski [Tue, 24 Jul 2018 18:57:50 +0000 (21:57 +0300)]
iwlwifi: mvm: Send non offchannel traffic via AP sta

TDLS discovery response frame is a unicast direct frame to the peer.
Since we don't have a STA for this peer, this frame goes through
iwl_tx_skb_non_sta(). As the result aux_sta and some completely
arbitrary queue would be selected for this frame, resulting in a queue
hang.  Fix that by sending such frames through AP sta instead.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: add description to a few generic assert numbers
Naftali Goldstein [Wed, 25 Jul 2018 12:52:20 +0000 (15:52 +0300)]
iwlwifi: mvm: add description to a few generic assert numbers

FW asserts 0x70, 0x71, and 0x73 all just mean that the real error
happened in another MAC, and to look there for the problem. Add their
descriptions to the assert number lookup table so users get a nicer
error message in the logs.
Also, since the 4 most-significant bits of the assert number are
dynamic, and depend on which MAC the assert occurred on, ignore those
bits when looking up the assert name.

Signed-off-by: Naftali Goldstein <naftali.goldstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg: avoid passing trigger around
Sara Sharon [Mon, 23 Jul 2018 10:50:02 +0000 (13:50 +0300)]
iwlwifi: dbg: avoid passing trigger around

The trigger structure is being passed around, when
all we care about is whether to dump only monitor
or not. Pass a bool instead.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: don't reset TXQ write pointer
Sara Sharon [Thu, 19 Jul 2018 06:15:11 +0000 (09:15 +0300)]
iwlwifi: pcie: don't reset TXQ write pointer

Currently code sets the write pointer when getting the TX queue
allocate response. This causes a redundant interrupt with any actual
change in the pointer. Remove this write altogether.

Fixes: 310181ec34e2 ("iwlwifi: move to TVQM mode")
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: toggle tx antenna if tx fails during connection establishment
Avraham Stern [Wed, 11 Jul 2018 07:30:20 +0000 (10:30 +0300)]
iwlwifi: mvm: toggle tx antenna if tx fails during connection establishment

If tx fails during connection establishment, try another antenna for
the next tx. This will increase the chance to establish connection if
one of the antennas is blocked.  Note that the antenna is toggled even
when failing to tx data frames since connection establishment may use
EAPOLs for 802.1X authentication/ 4 way handshake.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: fw: do not set sgi bits for HE connection
Naftali Goldstein [Sun, 15 Jul 2018 12:26:27 +0000 (15:26 +0300)]
iwlwifi: fw: do not set sgi bits for HE connection

If the association supports HE, HT/VHT rates will never be used for Tx
and therefore there's no need to set the sgi-per-channel-width-support
bits, so don't set them in this case.

Fixes: 110b32f065f3 ("iwlwifi: mvm: rs: add basic implementation of the new RS API handlers")
Signed-off-by: Naftali Goldstein <naftali.goldstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: switch management tx antenna only on tx failure
Avraham Stern [Thu, 5 Jul 2018 14:34:03 +0000 (17:34 +0300)]
iwlwifi: mvm: switch management tx antenna only on tx failure

Switch the antenna used for management tx only if previous tx failed.
If previous tx succeeded, there is no reason to switch antennas.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: enable low latency for soft ap
Tova Mussai [Mon, 2 Jul 2018 06:08:29 +0000 (09:08 +0300)]
iwlwifi: mvm: enable low latency for soft ap

Enable low latency for softAP in all modes (standalone, SCM
and DCM).
This is in order to minimize the time the softAP leaves the channel for
other operations

Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: trans: Clear persistence bit when starting the FW
Shahar S Matityahu [Wed, 4 Jul 2018 12:31:36 +0000 (15:31 +0300)]
iwlwifi: trans: Clear persistence bit when starting the FW

In D3 suspend flow in 9260 gen2 HW, the NIC receives two PERST signals.
The first PERST is expected and indicates the device on coming resume flow.
The second PERST causes FW restart FW restart.
In order to avoid this issue, the FW set the persistence bit on.
Once this bit is set, the FW ignores reset attempts.
The problem is when the FW gets assert during D3 and then the persistence
bit is set and causes the FW to ignore reset.
To handle this issue, the FW opens the preg bit which allows access
to the persistence bit, so that the driver clear the persistence bit
and reset the NIC.

The flow is as follows:
the driver checks if the persistence bit is set.
If the bit is set, the driver checks if he can clear the bit.
If the driver can not clear the bit then there is no point to continue
configuring the NIC since it will fail.

The fix was added is in start HW flow instead of the resume flow since in
general, if the persistence bit is set, the driver can not start the FW.
So it is good to check it when we start configuring the NIC.

The driver does not need to close the preg bit since the FW close it
during the start flow.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: remove queue_info_lock
Johannes Berg [Wed, 4 Jul 2018 21:19:13 +0000 (23:19 +0200)]
iwlwifi: mvm: remove queue_info_lock

All the queue management code runs under mvm->mutex, so there are
only very few cases of accessing the data structures without it:
 * TX path, which doesn't take any locks anyway
 * iwl_mvm_wake_sw_queue() and iwl_mvm_stop_sw_queue() where we
   just (atomically) read a bitmap, so the lock isn't needed.

Therefore, we can remove the spinlock. This enables some cleanup
in the ugly locking in iwl_mvm_inactivity_check().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: synchronize TID queue removal
Johannes Berg [Wed, 4 Jul 2018 21:12:33 +0000 (23:12 +0200)]
iwlwifi: mvm: synchronize TID queue removal

When we mark a TID as no longer having a queue, there's no
guarantee the TX path isn't using this txq_id right now,
having accessed it just before we reset the value. To fix
this, add synchronize_net() when we change the TIDs from
having a queue to not having one, so that we can then be
sure that the TX path is no longer accessing that queue.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: remove set but not used variable 'he_phy_data'
YueHaibing [Fri, 5 Oct 2018 10:47:01 +0000 (10:47 +0000)]
iwlwifi: mvm: remove set but not used variable 'he_phy_data'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c: In function 'iwl_mvm_rx_mpdu_mq':
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c:1386:7: warning:
 variable 'he_phy_data' set but not used [-Wunused-but-set-variable]
   u64 he_phy_data;

'he_phy_data' never used since be introduce in
commit 18ead597daa1 ("iwlwifi: support new rx_mpdu_desc api")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Fri, 9 Nov 2018 15:15:25 +0000 (17:15 +0200)]
Merge ath-next from git://git./linux/kernel/git/kvalo/ath.git

ath.git patches for 4.21. Major changes:

ath10k

* add support for WCN3990 firmware crash recovery

* add firmware memory dump support for QCA4019

wil6210

* add firmware error recovery while in AP mode

ath9k

* remove experimental notice from dynack feature

5 years agortlwifi: rtl8192de: Fix misleading REG_MCUFWDL information
Shaokun Zhang [Mon, 5 Nov 2018 11:25:30 +0000 (19:25 +0800)]
rtlwifi: rtl8192de: Fix misleading REG_MCUFWDL information

RT_TRACE shows REG_MCUFWDL value as a decimal value with a '0x'
prefix, which is somewhat misleading.

Fix it to print hexadecimal, as was intended.

Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlegacy: fix small typo
Yangtao Li [Thu, 1 Nov 2018 15:40:23 +0000 (11:40 -0400)]
iwlegacy: fix small typo

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agocw1200: fix small typo
Yangtao Li [Thu, 1 Nov 2018 15:33:19 +0000 (11:33 -0400)]
cw1200: fix small typo

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmutil: print invalid chanspec when WARN-ing
Rafał Miłecki [Fri, 26 Oct 2018 11:22:32 +0000 (13:22 +0200)]
brcmutil: print invalid chanspec when WARN-ing

On one of my devices I got WARNINGs when brcmfmac tried to decode
chanspec. I couldn't tell if it was some unsupported format or just a
malformed value passed by a firmware.

Print chanspec value so it's possible to debug a possible problem.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowireless: airo: potential buffer overflow in sprintf()
Dan Carpenter [Wed, 24 Oct 2018 08:33:34 +0000 (11:33 +0300)]
wireless: airo: potential buffer overflow in sprintf()

It looks like we wanted to print a maximum of BSSList_rid.ssidLen bytes
of the ssid, but we accidentally use "%*s" (width) instead of "%.*s"
(precision) so if the ssid doesn't have a NUL terminator this could lead
to an overflow.

Static analysis.  Not tested.

Fixes: e174961ca1a0 ("net: convert print_mac to %pM")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortlwifi: Remove same duplicated includes
zhong jiang [Wed, 24 Oct 2018 06:07:36 +0000 (14:07 +0800)]
rtlwifi: Remove same duplicated includes

Just remove same duplicated includes.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortlwifi: rtl8723ae: Remove set but not used variables and #defines
zhong jiang [Wed, 24 Oct 2018 05:52:09 +0000 (13:52 +0800)]
rtlwifi: rtl8723ae: Remove set but not used variables and #defines

radiob_array_table' and 'radiob_arraylen' are not used after setting its value.
It is safe to remove the unused variable. Meanwhile, radio B array should be
removed as well. because it will no longer be referenced.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmsmac: never log "tid x is not agg'able" by default
Ali MJ Al-Nasrawy [Tue, 23 Oct 2018 16:12:35 +0000 (19:12 +0300)]
brcmsmac: never log "tid x is not agg'able" by default

This message greatly spams the log under heavy Tx of frames with BK access
class which is especially true when operating as AP. It is also not informative
as the "agg'ablity" of TIDs are set once and never change.
Fix this by logging only in debug mode.

Signed-off-by: Ali MJ Al-Nasrawy <alimjalnasrawy@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agozd1201: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:48:26 +0000 (22:48 +0200)]
zd1201: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortlwifi: rtl8821ae: phy: Mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:47:59 +0000 (22:47 +0200)]
rtlwifi: rtl8821ae: phy: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoray_cs: mark expected switch fall-throughs
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:47:20 +0000 (22:47 +0200)]
ray_cs: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 114948 ("Missing break in switch")
Addresses-Coverity-ID: 114949 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agort2x00: rt61pci: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:46:47 +0000 (22:46 +0200)]
rt2x00: rt61pci: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agort2x00: rt2800lib: mark expected switch fall-throughs
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:46:03 +0000 (22:46 +0200)]
rt2x00: rt2800lib: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 145198 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agort2x00: rt2500pci: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:45:19 +0000 (22:45 +0200)]
rt2x00: rt2500pci: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agort2x00: rt2400pci: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:44:34 +0000 (22:44 +0200)]
rt2x00: rt2400pci: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agomwifiex: Mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:43:55 +0000 (22:43 +0200)]
mwifiex: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoprism54: islpci_dev: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:43:05 +0000 (22:43 +0200)]
prism54: islpci_dev: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 114947 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoprism54: isl_ioctl: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:42:47 +0000 (22:42 +0200)]
prism54: isl_ioctl: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoprism54: isl_38xx: Mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:42:29 +0000 (22:42 +0200)]
prism54: isl_38xx: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 114944 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoorinoco_usb: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:42:04 +0000 (22:42 +0200)]
orinoco_usb: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlegacy: common: mark expected switch fall-throughs
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:41:23 +0000 (22:41 +0200)]
iwlegacy: common: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 201384 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoiwlegacy: 4965-mac: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:40:53 +0000 (22:40 +0200)]
iwlegacy: 4965-mac: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortl8xxxu: Fix missing break in switch
Gustavo A. R. Silva [Mon, 22 Oct 2018 11:51:03 +0000 (13:51 +0200)]
rtl8xxxu: Fix missing break in switch

Add missing break statement in order to prevent the code from falling
through to the default case.

Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortl8xxxu: Mark expected switch fall-throughs
Gustavo A. R. Silva [Mon, 22 Oct 2018 11:50:08 +0000 (13:50 +0200)]
rtl8xxxu: Mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1357355 ("Missing break in switch")
Addresses-Coverity-ID: 1357378 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortlwifi: btcoex: remove set but not used variable 'ppsc'
YueHaibing [Mon, 22 Oct 2018 07:51:15 +0000 (07:51 +0000)]
rtlwifi: btcoex: remove set but not used variable 'ppsc'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c: In function 'halbtc_leave_lps':
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c:295:21: warning:
 variable 'ppsc' set but not used [-Wunused-but-set-variable]

drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c: In function 'halbtc_enter_lps':
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c:318:21: warning:
 variable 'ppsc' set but not used [-Wunused-but-set-variable]

It never used since introduction in
commit aa45a673b291 ("rtlwifi: btcoexist: Add new mini driver")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoqtnfmac: fix error handling in control path
Sergey Matyukevich [Wed, 17 Oct 2018 14:02:47 +0000 (14:02 +0000)]
qtnfmac: fix error handling in control path

This patch fixes the following warnings:

- smatch
drivers/net/wireless/quantenna/qtnfmac/commands.c:132 qtnf_cmd_send_with_reply() warn: variable dereferenced before check 'resp' (see line 117)
drivers/net/wireless/quantenna/qtnfmac/commands.c:716  qtnf_cmd_get_sta_info() error: uninitialized symbol 'var_resp_len'.
drivers/net/wireless/quantenna/qtnfmac/commands.c:1668 qtnf_cmd_get_mac_info() error: uninitialized symbol 'var_data_len'.
drivers/net/wireless/quantenna/qtnfmac/commands.c:1697 qtnf_cmd_get_hw_info() error: uninitialized symbol 'info_len'.
drivers/net/wireless/quantenna/qtnfmac/commands.c:1753 qtnf_cmd_band_info_get() error: uninitialized symbol 'info_len'.
drivers/net/wireless/quantenna/qtnfmac/commands.c:1782 qtnf_cmd_send_get_phy_params() error: uninitialized symbol 'response_size'.
drivers/net/wireless/quantenna/qtnfmac/commands.c:2438 qtnf_cmd_get_chan_stats() error: uninitialized symbol 'var_data_len'.

- gcc-8.2.1
drivers/net/wireless/quantenna/qtnfmac/commands.c: In function 'qtnf_cmd_send_with_reply':
drivers/net/wireless/quantenna/qtnfmac/commands.c:133:54: error: 'resp' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: fix spelling mistake "Retreiving" -> "Retrieving"
Colin Ian King [Tue, 16 Oct 2018 17:43:42 +0000 (18:43 +0100)]
brcmfmac: fix spelling mistake "Retreiving" -> "Retrieving"

Trivial fix to spelling mistake in brcmf_err error message.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoqtnfmac: add support for Topaz chipsets
Sergey Matyukevich [Tue, 16 Oct 2018 10:23:58 +0000 (10:23 +0000)]
qtnfmac: add support for Topaz chipsets

This patch adds support for QSR1000/QSR2000 family of chipsets
to qtnfmac_pcie platform driver.

QSR1000/QSR2000 (aka Topaz) is a family of 80MHz, 11ac Wave2,
4x4/2x4/2x2 chips, including single and dual band devices.
Depending on specific chip model and firmware in use, either
STA or both STA and AP modes are supported.

Patch adds Topaz support to qtnfmac_pcie driver. Proper platform
bus will be selected on probing based on chip ID.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Andrey Shevchenko <ashevchenko@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoqtnfmac_pcie: use single PCIe driver for all platforms
Igor Mitsyanko [Tue, 16 Oct 2018 10:23:56 +0000 (10:23 +0000)]
qtnfmac_pcie: use single PCIe driver for all platforms

Single PCIe driver can identify hardware type by reading CHIP ID at
probe time and invoking a correct initialization sequence.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowlcore: Fix the return value in case of error in 'wlcore_vendor_cmd_smart_config_start()'
Christophe JAILLET [Tue, 16 Oct 2018 07:39:40 +0000 (09:39 +0200)]
wlcore: Fix the return value in case of error in 'wlcore_vendor_cmd_smart_config_start()'

We return 0 unconditionally at the end of
'wlcore_vendor_cmd_smart_config_start()'.
However, 'ret' is set to some error codes in several error handling paths
and we already return some error codes at the beginning of the function.

Return 'ret' instead to propagate the error code.

Fixes: 80ff8063e87c ("wlcore: handle smart config vendor commands")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agolibertas: remove set but not used variable 'int_type'
YueHaibing [Mon, 15 Oct 2018 02:16:35 +0000 (02:16 +0000)]
libertas: remove set but not used variable 'int_type'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/marvell/libertas/if_spi.c: In function 'if_spi_h2c':
drivers/net/wireless/marvell/libertas/if_spi.c:799:6: warning:
 variable 'int_type' set but not used [-Wunused-but-set-variable]

It never used since introduction in
commit d2b21f191753 ("libertas: if_spi, driver for libertas GSPI devices")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agorsi: fix spelling mistake "Initialzing" -> "Initializing"
Colin Ian King [Sat, 13 Oct 2018 15:37:30 +0000 (16:37 +0100)]
rsi: fix spelling mistake "Initialzing" -> "Initializing"

Trivial fix to spelling mistake in rsi_dbg debug message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: Fix ccode from EFI nvram when necessary
Hans de Goede [Thu, 11 Oct 2018 09:51:07 +0000 (11:51 +0200)]
brcmfmac: Fix ccode from EFI nvram when necessary

In some cases the EFI-var stored nvram contains "ccode=ALL" or "ccode=XV"
to specify "worldwide" compatible settings, but these 2 ccode-s do not work
properly.

I've tested the different known "worldwide" ccode-s used in various nvram
sources with the latest firmwares from linux-firmware for various brcmfmac
models, here is a simplified (*) table with what each setting results in:

ALL: 12-14 disab, U-NII-1, U-NII-2 no-IR/radar, U-NII-3
XV:  12-14 no-IR, disables all 5G channels
XY:  12-13 enab, 14 disab, U-NII-1 enab, U-NII-2 no-IR/radar, U-NII-3 disab
X2:  12-13 no-IR, 14 dis, U-NII-1 no-IR, U-NII-2 no-IR/radar, U-NII-3 no-IR

Where 12,13,14 are 2.4G channels 12-14 and U-NII-1/2/3 are the 3 different
5G channel groups. no-IR is no-Initiate-Radiation, we will never send on
these channels without first having received valid wifi traffic there.

This immediately shows that both ALL and XV are not as worldwide as we want
them to be. ALL causes channels 12 and 13 to not be available and XV causes
all 5GHz channels to not be available. Also ALL unconditionally enables the
U-NII-1 and U-NII-3 5G groups, while we really should be using no-IR for
these.

This commit replace XV and ALL with X2, which allows usage of chan 12-13
and 5G channels, but only after receiving valid wifi traffic there first.

Note that this configure the firmware's channel limits, the kernels own
regulatory restrictions based on e.g. regulatory info received from the
access-point, will be applied on top of this.

This fixes channels 12+13 not working on the Asus T200TA and the Lenovo
Mixx 2 8 and 5G channels not working on the Asus T100HA.

This has been tested on the following models: Acer Iconia Tab8 w1-810,
Acer One 10, Asus T100CHI, Asus T100HA, Asus T100TA, Asus T200TA and a
Lenovo Mixx 2 8.

*) There are some exceptions to this table:
1) On really old firmware e.g. linux-firmware's 2011 brcmfmac4330-sdio.bin
   ALL really means all, unconditionally enabling everything
2) The exact meaning might be influenced by setting the regrev nvram var.
   Specifically using ccode=XV + regrev=1 on brcmfmac43241b4 leads to:
   12-14 no-ir, U-NII-1 no-ir, U-NII-2 no-ir/radar, U-NII-3 no-ir
   But only on the brcmfmac43241b4 and not on e.g. the brcmfmac43340

Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: Add support for getting nvram contents from EFI variables
Hans de Goede [Thu, 11 Oct 2018 09:51:06 +0000 (11:51 +0200)]
brcmfmac: Add support for getting nvram contents from EFI variables

Various X86 laptops with a SDIO attached brcmfmac wifi chip, store the
nvram contents in a special EFI variable. This commit adds support for
getting nvram directly from this EFI variable, without the user needing
to manually copy it.

This makes Wifi / Bluetooth work out of the box on these devices instead of
requiring manual setup.

This has been tested on the following models: Acer Iconia Tab8 w1-810,
Acer One 10, Asus T100CHI, Asus T100HA, Asus T100TA, Asus T200TA and a
Lenovo Mixx 2 8.

Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: Cleanup brcmf_fw_request_done()
Hans de Goede [Wed, 10 Oct 2018 11:01:03 +0000 (13:01 +0200)]
brcmfmac: Cleanup brcmf_fw_request_done()

The "cur" variable is now only used for a debug print and we already
print the same info from brcmf_fw_complete_request(), so the debug print
does not provide any extra info and we can remove it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: Set board_type from DMI on x86 based machines
Hans de Goede [Wed, 10 Oct 2018 11:01:02 +0000 (13:01 +0200)]
brcmfmac: Set board_type from DMI on x86 based machines

For x86 based machines, set the board_type used for nvram file selection
based on the DMI sys-vendor and product-name strings.

Since on some models these strings are too generic, this commit also adds
a quirk table overriding the strings for models listed in that table.

The board_type setting is used to load the board-specific nvram file with
a board-specific name so that we can ship files for each supported board
in linux-firmware.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: Set board_type used for nvram file selection to machine-compatible
Hans de Goede [Wed, 10 Oct 2018 11:01:01 +0000 (13:01 +0200)]
brcmfmac: Set board_type used for nvram file selection to machine-compatible

For of/devicetree using machines, set the board_type used for nvram file
selection to the first string listed in the top-level's node compatible
string, aka the machine-compatible as used by of_machine_is_compatible().

The board_type setting is used to load the board-specific nvram file with
a board-specific name so that we can ship files for each supported board
in linux-firmware.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: Add support for first trying to get a board specific nvram file
Hans de Goede [Wed, 10 Oct 2018 11:01:00 +0000 (13:01 +0200)]
brcmfmac: Add support for first trying to get a board specific nvram file

The nvram files which some brcmfmac chips need are board-specific. To be
able to distribute these as part of linux-firmware, so that devices with
such a wifi chip will work OOTB, multiple (one per board) versions must
co-exist under /lib/firmware.

This commit adds support for callers of the brcmfmac/firmware.c code to
pass in a board_type parameter through the request structure.

If that parameter is set then the code will first try to load
chipmodel.board_type.txt before falling back to the old chipmodel.txt name.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: Remove recursion from firmware load error handling
Hans de Goede [Wed, 10 Oct 2018 11:00:59 +0000 (13:00 +0200)]
brcmfmac: Remove recursion from firmware load error handling

Before this commit brcmf_fw_request_done would call
brcmf_fw_request_next_item to load the next item, which on an error would
call brcmf_fw_request_done, which if the error is recoverable (*) will
then continue calling brcmf_fw_request_next_item for the next item again
which on an error will call brcmf_fw_request_done again...

This does not blow up because we only have a limited number of items so
we never recurse too deep. But the recursion is still quite ugly and
frankly is giving me a headache, so lets fix this.

This commit fixes this by removing brcmf_fw_request_next_item and by
making brcmf_fw_get_firmwares and brcmf_fw_request_done directly call
firmware_request_nowait resp. firmware_request themselves.

*) brcmf_fw_request_nvram_done fallback path succeeds or
   BRCMF_FW_REQF_OPTIONAL is set

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agobrcmfmac: Remove firmware-loading code duplication
Hans de Goede [Wed, 10 Oct 2018 11:00:58 +0000 (13:00 +0200)]
brcmfmac: Remove firmware-loading code duplication

brcmf_fw_request_next_item and brcmf_fw_request_done both have identical
code to complete the fw-request depending on the item-type.

This commit adds a new brcmf_fw_complete_request helper removing this code
duplication.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath9k: dynack: remove 'experimental' tag
Lorenzo Bianconi [Fri, 2 Nov 2018 20:49:59 +0000 (21:49 +0100)]
ath9k: dynack: remove 'experimental' tag

Remove experimental tag from dynack Kconfig entry since it has
been tested on outdoor 25Km links

Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath9k: dynack: make ewma estimation faster
Lorenzo Bianconi [Fri, 2 Nov 2018 20:49:58 +0000 (21:49 +0100)]
ath9k: dynack: make ewma estimation faster

In order to make propagation time estimation faster,
use current sample as ewma output value during 'late ack'
tracking

Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath9k: dynack: check da->enabled first in sampling routines
Lorenzo Bianconi [Fri, 2 Nov 2018 20:49:57 +0000 (21:49 +0100)]
ath9k: dynack: check da->enabled first in sampling routines

Check da->enabled flag first in ath_dynack_sample_tx_ts and
ath_dynack_sample_ack_ts routines in order to avoid useless
processing

Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath9k: dynack: move debug log after buffer increments
Lorenzo Bianconi [Fri, 2 Nov 2018 20:49:56 +0000 (21:49 +0100)]
ath9k: dynack: move debug log after buffer increments

Move debug log in ath_dynack_sample_tx_ts and ath_dynack_sample_ack_ts
after timestamp buffer head/tail increments in order to make debugging
more user friendly

Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath9k: dynack: use authentication messages for 'late' ack
Lorenzo Bianconi [Fri, 2 Nov 2018 20:49:55 +0000 (21:49 +0100)]
ath9k: dynack: use authentication messages for 'late' ack

In order to properly support dynack in ad-hoc mode running
wpa_supplicant, take into account authentication frames for
'late ack' detection. This patch has been tested on devices
mounted on offshore high-voltage stations connected through
~24Km link

Reported-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: fix struct init whitespace in SNOC driver
Brian Norris [Fri, 2 Nov 2018 17:17:49 +0000 (10:17 -0700)]
ath10k: fix struct init whitespace in SNOC driver

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: don't assume this is a PCI dev in generic code
Brian Norris [Fri, 2 Nov 2018 17:17:48 +0000 (10:17 -0700)]
ath10k: don't assume this is a PCI dev in generic code

Not all devices using this driver are backed by a PCI device, so it's
not fair to assume 'to_pci_dev()' is valid. Fortunately, we only were
using this to convert straight back to a bare 'device', which means we
were only doing no-op pointer arithmetic, and not actually accessing
potentially out-of-bounds memory. But this is still bad practice.

Just use 'ar->dev' directly, since that's really all we're looking for.

Fixes: 209b2a68de76 ("ath10k: add platform regulatory domain support")
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: assign 'n_cipher_suites' for WCN3990
Brian Norris [Fri, 2 Nov 2018 17:17:47 +0000 (10:17 -0700)]
ath10k: assign 'n_cipher_suites' for WCN3990

Commit 2ea9f12cefe4 ("ath10k: add new cipher suite support") added a new
n_cipher_suites HW param with a fallback value and a warning log. Commit
03a72288c546 ("ath10k: wmi: add hw params entry for wcn3990") later
added WCN3990 HW entries, but it missed the n_cipher_suites.

Rather than seeing this warning every boot

  ath10k_snoc 18800000.wifi: invalid hw_params.n_cipher_suites 0

let's provide the appropriate value.

Cc: Rakesh Pillai <pillair@qti.qualcomm.com>
Cc: Govind Singh <govinds@qti.qualcomm.com>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: ath10k_snoc_{read,write}32() should be static
Brian Norris [Fri, 2 Nov 2018 18:10:00 +0000 (11:10 -0700)]
ath10k: ath10k_snoc_{read,write}32() should be static

They're provided as callbacks in ath10k_hif_ops and should be accessed
that way, if needed outside of snoc.c, and anyway, they're currently
unused outside snoc.c.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: snoc: fix unbalanced clock error handling
Brian Norris [Mon, 5 Nov 2018 12:35:22 +0000 (14:35 +0200)]
ath10k: snoc: fix unbalanced clock error handling

Similar to regulator error handling, we should only start tearing down
the 'i - 1' clock when clock 'i' fails to enable. Otherwise, we might
end up with an unbalanced clock, where we never successfully enabled the
clock, but we try to disable it anyway.

Fixes: a6a793f98786 ("ath10k: vote for hardware resources for WCN3990")
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: snoc: relax voltage requirements
Brian Norris [Mon, 5 Nov 2018 12:35:09 +0000 (14:35 +0200)]
ath10k: snoc: relax voltage requirements

I rarely see drivers specify precise voltage requirements like this, but
if we really have to...let's at least give a little wiggle room. Board
designs (and accompanying device trees) may not provide exactly the
voltage listed here, and we shouldn't fail to probe just because of
this.

Round these ranges down to the nearest volt, and provide a 0.05V margin.
The regulator should provide its own supported ranges, which will
helpfully intersect with these ranges.

I would just as well remove these ranges entirely, but if I understand
correctly, there's some reason that QCOM SoC's like to set zero /
non-zero voltages.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: snoc: fix unabalanced regulator error handling
Brian Norris [Mon, 5 Nov 2018 12:34:57 +0000 (14:34 +0200)]
ath10k: snoc: fix unabalanced regulator error handling

If a regulator fails to set its voltage, we end up with an unbalanced
call to regulator_disable(), because the error path starts with the
current regulator (which was never enabled).

Factor out the "on" function to perform (and unwind if failed) a single
regulator at a time, and then main loop (ath10k_snoc_vreg_on()) can just
worry about unwinding the regulators that were already enabled.

It also helps to factor out the "off" function, to avoid repeating some
code here.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: snoc: remove 'wcn3990' from generic resource handling
Brian Norris [Mon, 5 Nov 2018 12:34:46 +0000 (14:34 +0200)]
ath10k: snoc: remove 'wcn3990' from generic resource handling

ath10k_wcn3990_clk_info and ath10k_wcn3990_vreg_info are not
WCN3990-specific structures. They hold generic data. So don't name them
with wcn3990 specifics.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: fix locking in wmi_call
Lior David [Wed, 31 Oct 2018 08:52:24 +0000 (10:52 +0200)]
wil6210: fix locking in wmi_call

Switch from spin_lock to spin_lock_irqsave, because
wmi_ev_lock is used inside interrupt handler.

Signed-off-by: Lior David <liord@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: fix freeing of rx buffers in EDMA mode
Ahmad Masri [Wed, 31 Oct 2018 08:52:23 +0000 (10:52 +0200)]
wil6210: fix freeing of rx buffers in EDMA mode

After being associated with some EDMA rx traffic, upon "down" driver
doesn't free all skbs in the rx ring.
Modify wil_move_all_rx_buff_to_free_list to loop on active list of rx
buffers, unmap the physical memory and free the skb.

Signed-off-by: Ahmad Masri <amasri@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: remove unnecessary alignment code from rx flow
Ahmad Masri [Wed, 31 Oct 2018 08:52:22 +0000 (10:52 +0200)]
wil6210: remove unnecessary alignment code from rx flow

Rx buffers in EDMA mode are initialized to 4 bytes aligned size.
Remove the unnecessary alignment code applied on rx buffer size.

Signed-off-by: Ahmad Masri <amasri@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: fix RGF_CAF_ICR address for Talyn-MB
Maya Erez [Wed, 31 Oct 2018 08:52:20 +0000 (10:52 +0200)]
wil6210: fix RGF_CAF_ICR address for Talyn-MB

RGF_CAF_ICR register location has changed in Talyn-MB.
Add RGF_CAF_ICR_TALYN_MB to support the new address.

Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: fix L2 RX status handling
Maya Erez [Wed, 31 Oct 2018 08:52:19 +0000 (10:52 +0200)]
wil6210: fix L2 RX status handling

L2 RX status errors should not be treated as a bitmap and the actual
error values should be checked.
Print L2 errors as wil_err_ratelimited for easier debugging
when such errors occurs.

Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: fix debugfs memory access alignment
Ahmad Masri [Wed, 31 Oct 2018 08:52:18 +0000 (10:52 +0200)]
wil6210: fix debugfs memory access alignment

All wil6210 device memory access should be 4 bytes aligned. In io
blob wil6210 did not force alignment for read function, this caused
alignment fault on some platforms.
Fixing that by accessing all 4 lower bytes and return to host the
requested data.

Signed-off-by: Ahmad Masri <amasri@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: add general initialization/size checks
Alexei Avshalom Lazar [Wed, 31 Oct 2018 08:52:17 +0000 (10:52 +0200)]
wil6210: add general initialization/size checks

Initialize unset variable, and verify that mid is valid.

Signed-off-by: Alexei Avshalom Lazar <ailizaro@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: notify cqm packet loss on disable_ap_sme
Ahmad Masri [Wed, 31 Oct 2018 08:52:16 +0000 (10:52 +0200)]
wil6210: notify cqm packet loss on disable_ap_sme

wil6210 used to notify cfg80211_del_sta on every fw disconnect event.
In disable_ap_sme mode the userspace manages the protocol SME and
FW sends disconnect event only due to link loss.

In disable_ap_sme mode, indicate CQM packet loss to let the host
control the connection and disconnect the link if needed.

Signed-off-by: Ahmad Masri <amasri@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: refactor disconnect flow
Ahmad Masri [Wed, 31 Oct 2018 08:52:15 +0000 (10:52 +0200)]
wil6210: refactor disconnect flow

Separate sending command to the fw from the event handling function to
simplify the disconnect flow and track the from_event flag correctly.

Signed-off-by: Ahmad Masri <amasri@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: fix memory leak in wil_find_tx_bcast_2
Lior David [Wed, 31 Oct 2018 08:52:14 +0000 (10:52 +0200)]
wil6210: fix memory leak in wil_find_tx_bcast_2

A successful call to wil_tx_ring takes skb reference so
it will only be freed in wil_tx_complete. Consume the skb
in wil_find_tx_bcast_2 to prevent memory leak.

Signed-off-by: Lior David <liord@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: add recovery for FW error while in AP mode
Dedy Lansky [Wed, 31 Oct 2018 08:52:13 +0000 (10:52 +0200)]
wil6210: add recovery for FW error while in AP mode

AP configuration is stored by the driver. Upon FW error, disconnect
notification is sent to user space for any associated stations. AP is
then internally restarted with the stored configuration.

Signed-off-by: Dedy Lansky <dlansky@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: make sure Rx ring sizes are correlated
Dedy Lansky [Wed, 31 Oct 2018 08:52:12 +0000 (10:52 +0200)]
wil6210: make sure Rx ring sizes are correlated

When enlarging rx_ring_order module param, wil6210 fails to load
because there are not enough Rx buffers.
Fix this by enlarging number of Rx buffers at startup, if needed based
on rx_ring_order.

Signed-off-by: Dedy Lansky <dlansky@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: increase RX rings and RX buff array size
Maya Erez [Wed, 31 Oct 2018 08:52:11 +0000 (10:52 +0200)]
wil6210: increase RX rings and RX buff array size

In Talyn-MB, the 11ad throughput is higher and performance drops
may occur in the current RX configuration due to unavailability
of Rx buffers.
Increase the RX descriptor ring, RX status ring and number of RX
buffers to stabilize the performance in high throughput.

Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: fix reset flow for Talyn-mb
Alexei Avshalom Lazar [Wed, 31 Oct 2018 08:52:10 +0000 (10:52 +0200)]
wil6210: fix reset flow for Talyn-mb

With current reset flow, Talyn sometimes get stuck causing PCIe
enumeration to fail. Fix this by removing some reset flow operations
that are not relevant for Talyn.
Setting bit 15 in RGF_HP_CTRL is WBE specific and is not in use for
all wil6210 devices.
For Sparrow, BIT_HPAL_PERST_FROM_PAD and BIT_CAR_PERST_RST were set
as a WA an HW issue.

Signed-off-by: Alexei Avshalom Lazar <ailizaro@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agowil6210: remove fake support for RXHASH
Hamad Kadmany [Wed, 31 Oct 2018 08:52:09 +0000 (10:52 +0200)]
wil6210: remove fake support for RXHASH

Setting the same fake hash to all skbs prevents
distributing different flows to different CPU cores.

Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
Signed-off-by: Lior David <liord@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: fix some typo
Yangtao Li [Thu, 1 Nov 2018 15:29:32 +0000 (11:29 -0400)]
ath10k: fix some typo

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agocarl9170: tx: mark expected switch fall-throughs
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:40:24 +0000 (22:40 +0200)]
carl9170: tx: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agocarl9170: rx: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:39:59 +0000 (22:39 +0200)]
carl9170: rx: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1056534 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath6kl: Mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:37:31 +0000 (22:37 +0200)]
ath6kl: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 201383 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Steve deRosier <derosier@cal-sierra.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath9k: remove set but not used variable 'new_flags'
zhong jiang [Tue, 23 Oct 2018 03:27:14 +0000 (11:27 +0800)]
ath9k: remove set but not used variable 'new_flags'

new_flags is not used after setting its value. It is safe to remove
the unused variable.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath9k: hw: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:39:15 +0000 (22:39 +0200)]
ath9k: hw: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1056532 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath9k: ar9002_phy: mark expected switch fall-throughs
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:38:11 +0000 (22:38 +0200)]
ath9k: ar9002_phy: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1056532 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath9k: ar5008_phy: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 22 Oct 2018 20:37:38 +0000 (22:37 +0200)]
ath9k: ar5008_phy: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1056532 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: remove set but not used variable 'tlv_len'
YueHaibing [Fri, 19 Oct 2018 12:20:26 +0000 (12:20 +0000)]
ath10k: remove set but not used variable 'tlv_len'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/ath/ath10k/wmi-tlv.c: In function 'ath10k_wmi_tlv_op_gen_config_pno_start':
drivers/net/wireless/ath/ath10k/wmi-tlv.c:3455:6: warning:
 variable 'tlv_len' set but not used [-Wunused-but-set-variable]

It never used since inroduction in commit
ce834e280f2f ("ath10k: support NET_DETECT WoWLAN feature")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: fix some spelling mistakes
Colin Ian King [Thu, 18 Oct 2018 21:51:04 +0000 (22:51 +0100)]
ath10k: fix some spelling mistakes

Trivial fix to some spelling mistakes in ath10k_err and ath10k_dbg
messages:
"capablity" -> "capability"
"registed" -> "registered"

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: fixup extended per sta tx statistics
Dan Carpenter [Thu, 18 Oct 2018 07:36:19 +0000 (10:36 +0300)]
ath10k: fixup extended per sta tx statistics

I had a couple concerns with this code.  First, we definitely need to
set the error code if the kzalloc() fails.  Secondly, I was worried that
if we didn't set "arsta->tx_stats" to NULL after freeing it, then it
looks to me like it might lead to a use after free.  I can't test that,
but it's harmless to set it to NULL so I did.

Fixes: a904417fc876 ("ath10k: add extended per sta tx statistics support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: fill the channel survey results for WCN3990 correctly
Rakesh Pillai [Wed, 17 Oct 2018 11:20:03 +0000 (16:50 +0530)]
ath10k: fill the channel survey results for WCN3990 correctly

The host driver currently expects the channel info event to be
received in pairs for all the channels, i.e. the first
chan_info event for a particular channel will not have the
COMPLETE flag set and the second chan_info event for the
same channel will have the COMPLETE flag set.

The HL2.0 firmware sends only one channel info event per channel
which is scanned without the COMPLETE flag set. After sending the
chan_info_event for all the channels, the HL2.0 firmware sends a
chan_info_event with COMPLETE flag set to indicate the completion
of the channel info event.

The firmware does not indicate this behavior with any service bitmap
and hence a new firmware feature flag is used to handle the modified
parsing of the channel info events, in the host driver, for the
firmware which sends single channel info event per scanned channel.

Tested HW: WCN3990
Tested FW: WLAN.HL.2.0-01188-QCAHLSWMTPLZ-1

Co-developed-by: Surabhi Vishnoi <svishnoi@codeaurora.org>
Signed-off-by: Surabhi Vishnoi <svishnoi@codeaurora.org>
Signed-off-by: Rakesh Pillai <pillair@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: fix copy-paste error in ath10k_qmi_setup_msa_resources()
Wei Yongjun [Tue, 16 Oct 2018 02:35:16 +0000 (02:35 +0000)]
ath10k: fix copy-paste error in ath10k_qmi_setup_msa_resources()

The return value from devm_memremap() is not checked correctly.
The test is done against a wrong variable. This patch fix it.

Fixes: ba94c753ccb4 ("ath10k: add QMI message handshake for wcn3990 client")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: assign proper firmware crash dump structure
Anilkumar Kolli [Fri, 12 Oct 2018 06:06:37 +0000 (11:36 +0530)]
ath10k: assign proper firmware crash dump structure

ar->target_version is same for QCA99x0, QCA4019, QCA9888
and QCA9984, this ended up in assigning the wrong hw_mem_layouts.
This patch adds additional hw_rev check to assign correct
hw_mem_layouts.

Tested on:
QCA4019 firmware 10.4-3.2.1.1-00017
QCA9984 firmware 10.4-3.5.3-00057

Signed-off-by: Anilkumar Kolli <akolli@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: add memory dump support for QCA4019
Anilkumar Kolli [Fri, 12 Oct 2018 06:06:36 +0000 (11:36 +0530)]
ath10k: add memory dump support for QCA4019

This patch adds firmware crash memory dump support for QCA4019.

Tested on:

QCA4019 firmware 10.4-3.2.1.1-00017

Signed-off-by: Anilkumar Kolli <akolli@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: dump tx stats in rate table format
Anilkumar Kolli [Fri, 12 Oct 2018 06:03:28 +0000 (11:33 +0530)]
ath10k: dump tx stats in rate table format

This patch adds the tx statistics pkts/bytes dump
in rate table format.

Dump format table is similar to http://mcsindex.com/

Tested on QCA9984/QCA4019/QCA988x
Firmware: 10.4-3.5.3-00057
  10.2.4-1.0-00037
command:
cat /sys/kernel/debug/ieee80211/phy0/netdev\:wlan0/
    stations/<MACADDR>/tx_stats

Signed-off-by: Anilkumar Kolli <akolli@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoath10k: add support for WCN3990 firmware crash recovery
Surabhi Vishnoi [Fri, 12 Oct 2018 05:53:39 +0000 (11:23 +0530)]
ath10k: add support for WCN3990 firmware crash recovery

Whenever the WCN3990 firmware becomes unavailable,
the host driver receives a FW down indication, post
which all the direct hardware register access should
be avoided, in order to prevent improper behavior in
the host driver.

Set the crash_flush flag when the host driver receives
a FW_DOWN_IND via qmi, in order to stop the untimely
hardware register access. Also handle the case, where
we need to do core register only for the first FW_READY
indication, which is when we initialize the host driver.
All the subsequent FW_READY indication will be received
in subsystem recovery case and we only need to do the
restart work. The state of driver is maintained using
flags to distinguish between first and subsequent FW_READY
indication received.

Tested HW: WCN3990
Tested FW: WLAN.HL.2.0-01188-QCAHLSWMTPLZ-1

Signed-off-by: Surabhi Vishnoi <svishnoi@codeaurora.org>
Signed-off-by: Rakesh Pillai <pillair@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>