openwrt/staging/blogic.git
6 years agorsi: fix spelling mistake: "thead" -> "thread"
Colin Ian King [Thu, 10 May 2018 14:32:17 +0000 (15:32 +0100)]
rsi: fix spelling mistake: "thead" -> "thread"

Trivial fix to spelling mistake in rsi_dbg debug message text

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76x2: add a polling delay in mt76x2_mac_stop routine
Lorenzo Bianconi [Thu, 10 May 2018 14:06:09 +0000 (16:06 +0200)]
mt76x2: add a polling delay in mt76x2_mac_stop routine

Add a usleep_range in mt76x2_mac_stop routine in order to add
a polling delay checking values of MT_MAC_STATUS and IBI_R12 registers

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agowireless-drivers: Dynamically allocate struct station_info
Toke Høiland-Jørgensen [Thu, 10 May 2018 12:57:35 +0000 (14:57 +0200)]
wireless-drivers: Dynamically allocate struct station_info

Since the addition of the TXQ stats to cfg80211, the station_info struct
has grown to be quite large, which results in warnings when allocated on
the stack. Fix the affected places to do dynamic allocations instead.

Fixes: 52539ca89f36 ("cfg80211: Expose TXQ stats and parameters to userspace")
Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: increase TX threashold to avoid TX timeout during ED MAC test
Ganapathi Bhat [Mon, 7 May 2018 18:40:58 +0000 (00:10 +0530)]
mwifiex: increase TX threashold to avoid TX timeout during ED MAC test

While carrying energy detection(ED) tests, the chip will stop
transmission upon detecting an energy in the connected channel.
As a feedback, driver will stop dequeuing TX packets and due to
which wmm_tx_pending keep incremeting. Once wmm_tx_pending
reaches 100, driver calls netif_tx_stop_queue(). If TX ques is
not restarted within 5(watchdog_timeo) seconds, it will result in
TX timeout.

The ED test is carried out for one minute and the current
threshold of 100 is easily overcome by the traffic, cuasing TX
timeouts. To fix this increase the threshold to 400.

Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: delete unneeded include
Julia Lawall [Sun, 6 May 2018 07:53:53 +0000 (09:53 +0200)]
mwifiex: delete unneeded include

Nothing that is defined in 11ac.h is referenced in cmdevt.c.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Add support for bcm43364 wireless chipset
Sean Lanigan [Fri, 4 May 2018 06:48:23 +0000 (16:48 +1000)]
brcmfmac: Add support for bcm43364 wireless chipset

Add support for the BCM43364 chipset via an SDIO interface, as used in
e.g. the Murata 1FX module.

The BCM43364 uses the same firmware as the BCM43430 (which is already
included), the only difference is the omission of Bluetooth.

However, the SDIO_ID for the BCM43364 is 02D0:A9A4, giving it a MODALIAS
of sdio:c00v02D0dA9A4, which doesn't get recognised and hence doesn't
load the brcmfmac module. Adding the 'A9A4' ID in the appropriate place
triggers the brcmfmac driver to load, and then correctly use the
firmware file 'brcmfmac43430-sdio.bin'.

Signed-off-by: Sean Lanigan <sean@lano.id.au>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: remove duplicate definition of antenna number for btcoex
Ping-Ke Shih [Fri, 4 May 2018 02:42:04 +0000 (10:42 +0800)]
rtlwifi: remove duplicate definition of antenna number for btcoex

Two enumerations bt_total_ant_num and bt_ant_num are identical, so one
can be removed.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76x2: fix avg_rssi estimation
Lorenzo Bianconi [Wed, 2 May 2018 09:46:36 +0000 (11:46 +0200)]
mt76x2: fix avg_rssi estimation

Add leftover filter coefficients in IIR rssi estimation

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoipw2200: fix spelling mistake: "functionalitis" -> "functionalities"
Colin Ian King [Tue, 1 May 2018 09:36:43 +0000 (10:36 +0100)]
ipw2200: fix spelling mistake: "functionalitis" -> "functionalities"

Trivial fix to spelling mistake in module parameter description text

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76x2: remove unnecessary break in mt76x2_mac_process_tx_rate()
Lorenzo Bianconi [Tue, 1 May 2018 08:33:54 +0000 (10:33 +0200)]
mt76x2: remove unnecessary break in mt76x2_mac_process_tx_rate()

Remove unnecessary break statement in the default case of bw switch
block in mt76x2_mac_process_tx_rate routine

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: fix spelling mistake: "dismatch" -> "mismatch"
Colin Ian King [Mon, 30 Apr 2018 13:41:02 +0000 (14:41 +0100)]
rtlwifi: fix spelling mistake: "dismatch" -> "mismatch"

Trivial fix to spelling mistake in RT_TRACE message text.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agort2x00: check against flushing empty queue
Stanislaw Gruszka [Mon, 30 Apr 2018 13:19:17 +0000 (15:19 +0200)]
rt2x00: check against flushing empty queue

We have check if queue is not empty when start flushing queues on
by mac80211 callback, but we also can start flushing queues by internal
driver calls. So move check into rt2x00queue_flush_queue() to assure
we do not flush empty queue anytime.

Additionally add warning if we start to kick empty queue as in such
situation we set wrong index in the HW queue, what can confuse the HW
and have various negative consequences.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agort2x00: call sta_add/remove directly in rt2800
Stanislaw Gruszka [Mon, 30 Apr 2018 13:19:16 +0000 (15:19 +0200)]
rt2x00: call sta_add/remove directly in rt2800

Only rt2800 subdriver of rt2x00 implement sta_add() and sta_remove(),
we do not need generic version of those.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: coarse support for PCIe shared structure rev7
Franky Lin [Thu, 26 Apr 2018 10:16:51 +0000 (12:16 +0200)]
brcmfmac: coarse support for PCIe shared structure rev7

Revision 7 of PCIe dongle interface increases the item size of tx and rx
complete rings to accommodate extra payload for new feature. This patch
simply bump up the size of these two rings without adding the support
for utilizing the new space. This makes brcmfmac compatible with rev7
firmware.

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: add hostready indication
Franky Lin [Thu, 26 Apr 2018 10:16:50 +0000 (12:16 +0200)]
brcmfmac: add hostready indication

A hostready signal is introduced to inform firmware through mailbox
doorbell1 when common ring initialized or D3 exited.

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: constify firmware mapping tables
Arend Van Spriel [Thu, 26 Apr 2018 10:16:49 +0000 (12:16 +0200)]
brcmfmac: constify firmware mapping tables

The information in the firmware mapping does not need to be modified
so it can be static const.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: use nl80211_band directly to get ieee80211 channel
Franky Lin [Thu, 26 Apr 2018 10:16:48 +0000 (12:16 +0200)]
brcmfmac: use nl80211_band directly to get ieee80211 channel

The enum nl80211_band used to retrieve wiphy->bands is the same as
wiphy->bands->band which is checked by wiphy_register(). So it can be used
directly as parameter of ieee80211_channel_to_frequency().

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: reports boottime_ns while informing bss
Franky Lin [Thu, 26 Apr 2018 10:18:35 +0000 (12:18 +0200)]
brcmfmac: reports boottime_ns while informing bss

Provides a timestamp in bss information so user space can see when the
bss info was updated. Since tsf is not available from the dongle events
boottime is reported instead.

Reported-by: Dmitry Shmidt <dimitrysh@google.com>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: check p2pdev mac address uniqueness
Arend Van Spriel [Thu, 26 Apr 2018 10:16:47 +0000 (12:16 +0200)]
brcmfmac: check p2pdev mac address uniqueness

The mac address for p2pdev must be different from the primary interface
due to firmware requirement. Add an explicit check for this requirement
if user-space provides a mac address.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoipw2100: fix spelling mistake: "decsribed" -> "described"
Colin Ian King [Sat, 28 Apr 2018 22:31:08 +0000 (23:31 +0100)]
ipw2100: fix spelling mistake: "decsribed" -> "described"

Trivial fix to spelling mistake in comment and in the ord_data text

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agort2x00: fix spelling mistake in various macros, UKNOWN -> UNKNOWN
Colin Ian King [Wed, 18 Apr 2018 11:47:50 +0000 (12:47 +0100)]
rt2x00: fix spelling mistake in various macros, UKNOWN -> UNKNOWN

Rename several macros that contain mispellings of UNKNOWN

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi_91x: fix uninitialized variable
Gustavo A. R. Silva [Thu, 26 Apr 2018 13:13:24 +0000 (08:13 -0500)]
rsi_91x: fix uninitialized variable

There is a potential execution path in which variable ret is returned
without being properly initialized previously.

Fix this by storing the value returned by function
rsi_usb_master_reg_write into _ret_.

Addresses-Coverity-ID: 1468407 ("Uninitialized scalar variable")
Fixes: 16d3bb7b2f37 ("rsi: disable fw watchdog timer during reset")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi_91x: fix structurally dead code
Gustavo A. R. Silva [Thu, 26 Apr 2018 13:01:38 +0000 (08:01 -0500)]
rsi_91x: fix structurally dead code

Function rsi_hal_key_config returns before reaching code at line
922 if (status), hence this code is structurally dead.

Fix this by storing the value returned by rsi_hal_load_key
into _status_ for its further evaluation and use.

Addresses-Coverity-ID: 1468409 ("Structurally dead code")
Fixes: 4fd6c4762f37 ("rsi: roaming enhancements")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agowlcore: sdio: allow pm to handle sdio power
Eyal Reizer [Thu, 26 Apr 2018 05:47:11 +0000 (08:47 +0300)]
wlcore: sdio: allow pm to handle sdio power

pm_runtime handles sdio power on and power off transitions.
An old workaround for trying to control the power explicitly from the
driver was in fact causing failures on suspend/resume as the mmc layer
already power the module on resume.

In case of resume pm_runtime_get sync returns a positive device's usage
count causing the driver to try an re-initialize an already initialized
device. This was causing sdio bus failure on resume.

Remove this manual power on/off sequence as it is in-fact not needed.

Signed-off-by: Eyal Reizer <eyalr@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: fix qtnf_netdev_hard_start_xmit()'s return type
Luc Van Oostenryck [Tue, 24 Apr 2018 13:18:04 +0000 (15:18 +0200)]
qtnfmac: fix qtnf_netdev_hard_start_xmit()'s return type

The method ndo_start_xmit() is defined as returning an 'netdev_tx_t',
which is a typedef for an enum type, but the implementation in this
driver returns an 'int'.

Fix this by returning 'netdev_tx_t' in this driver too.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agonet: wireless: b43legacy: Replace GFP_ATOMIC with GFP_KERNEL in dma_tx_fragment
Jia-Ju Bai [Tue, 10 Apr 2018 13:54:19 +0000 (21:54 +0800)]
net: wireless: b43legacy: Replace GFP_ATOMIC with GFP_KERNEL in dma_tx_fragment

dma_tx_fragment() is never called in atomic context.

dma_tx_fragment() is only called by b43legacy_dma_tx(), which is
only called by b43legacy_tx_work().
b43legacy_tx_work() is only set a parameter of INIT_WORK() in
b43legacy_wireless_init().

Despite never getting called from atomic context,
dma_tx_fragment() calls alloc_skb() with GFP_ATOMIC,
which does not sleep for allocation.
GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL,
which can sleep and improve the possibility of sucessful allocation.

This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: keep user configured mac address during changing virtual interface
Xinming Hu [Wed, 25 Apr 2018 09:38:14 +0000 (17:38 +0800)]
mwifiex: keep user configured mac address during changing virtual interface

During changing virtual interface, keep using previous net device
mac address.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: always configure firmware mac address during changing virtual interface
Xinming Hu [Wed, 25 Apr 2018 09:38:13 +0000 (17:38 +0800)]
mwifiex: always configure firmware mac address during changing virtual interface

When interface type changed, firmware using a new connction pointer.
We need Re-configure the mac address.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: make firmware mac address consistent with host configuration
Xinming Hu [Wed, 25 Apr 2018 09:38:12 +0000 (17:38 +0800)]
mwifiex: make firmware mac address consistent with host configuration

For user configurated mac address, directly set to firmware with no change.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: fix mwifiex_hard_start_xmit()'s return type
Luc Van Oostenryck [Tue, 24 Apr 2018 13:18:02 +0000 (15:18 +0200)]
mwifiex: fix mwifiex_hard_start_xmit()'s return type

The method ndo_start_xmit() is defined as returning an 'netdev_tx_t',
which is a typedef for an enum type, but the implementation in this
driver returns an 'int'.

Fix this by returning 'netdev_tx_t' in this driver too.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76: check for pending reset before attempting to schedule tx
Felix Fietkau [Wed, 25 Apr 2018 09:11:24 +0000 (11:11 +0200)]
mt76: check for pending reset before attempting to schedule tx

The check within mt76_txq_send_burst is not enough, as it happens after
a first frame has already been queued up

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76: add rcu locking around tx scheduling
Felix Fietkau [Wed, 25 Apr 2018 09:11:23 +0000 (11:11 +0200)]
mt76: add rcu locking around tx scheduling

Fixes a reported lockdep error in mac80211:

[  179.867321] =============================
[  179.871510] WARNING: suspicious RCU usage
[  179.875528] 4.14.32 #0 Not tainted
[  179.878924] -----------------------------
[  179.882981] backports-2017-11-01/net/mac80211/tx.c:594 suspicious rcu_dereference_check() usage!
[  179.891785]
[  179.891785] other info that might help us debug this:
[  179.891785]
[  179.899824]
[  179.899824] rcu_scheduler_active = 2, debug_locks = 1
[  179.906343] 2 locks held by ksoftirqd/0/7:
[  179.910479]  #0:  (&(&q->lock)->rlock){+.-.}, at: [<86b207a4>] mt76_dma_tx_cleanup+0x64/0x354 [mt76]
[  179.919734]  #1:  (&(&fq->lock)->rlock){+.-.}, at: [<87238410>] ieee80211_tx_dequeue+0x54/0xc3c [mac80211]
[  179.929890]
[  179.929890] stack backtrace:
[  179.934257] CPU: 0 PID: 7 Comm: ksoftirqd/0 Not tainted 4.14.32 #0
[  179.940421] Stack : 00000000 00000000 00000000 00000000 80e0fce2 00000036 00000000 00000000
[  179.948864]         87c3d24c 80696377 8061039c 00000000 00000007 00000001 87c5db78 6534689d
[  179.957306]         00000000 00000000 80e10000 87c5da74 00000001 0000015a 00000007 00000000
[  179.965748]         00000000 806a0000 000e4171 00000000 00000000 00000000 ffffffff 00000001
[  179.974189]         806c0000 8692b240 86b000d0 87316fe4 00000001 802c9a68 00000000 80700000
[  179.982632]         ...
[  179.985104] Call Trace:
[  179.987582] [<80010a48>] show_stack+0x58/0x100
[  179.992040] [<804c2c58>] dump_stack+0xe8/0x170
[  179.996868] [<87234a04>] ieee80211_tx_h_select_key+0xa8/0x5b8 [mac80211]
[  180.004299] [<87238d44>] ieee80211_tx_dequeue+0x988/0xc3c [mac80211]
[  180.011048] [<86b230dc>] mt76_txq_schedule+0x110/0x3a4 [mt76]
[  180.016821] [<86b209d0>] mt76_dma_tx_cleanup+0x290/0x354 [mt76]
[  180.022777] [<86be2e60>] mt7603_tx_tasklet+0x40/0x6c [mt7603e]
[  180.028637] [<80037058>] tasklet_action+0x110/0x1ec
[  180.033532] [<804e1dac>] __do_softirq+0x164/0x35c
[  180.038235] [<80037174>] run_ksoftirqd+0x40/0x84
[  180.042870] [<800580c8>] smpboot_thread_fn+0x1a8/0x1d8
[  180.048023] [<800542e8>] kthread+0x130/0x144
[  180.052297] [<8000b1f8>] ret_from_kernel_thread+0x14/0x1c

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76: add rcu locking in tid reorder function
Felix Fietkau [Wed, 25 Apr 2018 09:11:22 +0000 (11:11 +0200)]
mt76: add rcu locking in tid reorder function

Avoids having the tid or station entry disappear prematurely.
Also cancel the reorder work earlier to avoid further processing delayed
by waiting for the lock to be released

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76: fix concurrent rx calls on A-MPDU release
Felix Fietkau [Wed, 25 Apr 2018 09:11:21 +0000 (11:11 +0200)]
mt76: fix concurrent rx calls on A-MPDU release

Add a spinlock in mt76_rx_complete. Without this, multiple stats updates
could happen in parallel, which can lead to deadlocks. There are
probably more corner cases fixed by this change.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76x2: fix is_mt7612 routine
Lorenzo Bianconi [Tue, 17 Apr 2018 22:27:18 +0000 (00:27 +0200)]
mt76x2: fix is_mt7612 routine

Fix is_mt7612 routine since asic version is set in mt76_dev revision
field and not in mt76x2_dev one.
Moreover remove mt76x2_dev rev field since it is never used in the
driver

Fixes: 7bc04215a66b ('mt76: add driver code for MT76x2e')
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoMerge tag 'iwlwifi-next-for-kalle-2018-04-26' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Mon, 30 Apr 2018 10:02:30 +0000 (13:02 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2018-04-26' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

Second batch of iwlwifi patches for 4.18

* Some preparations for new hardware;
* A workaround to rescan the bus for the rare situation when older
  devices become irresponsive,
* Hardening of the firmware loading code to avoid issues with
  corrupted files;
* A few clean-ups and bugfixes.

6 years agoiwlwifi: mvm: set wakeup filters for wowlan "any" configuration
Eliad Peller [Thu, 22 Feb 2018 16:45:49 +0000 (18:45 +0200)]
iwlwifi: mvm: set wakeup filters for wowlan "any" configuration

In case of "any" wowlan trigger is configured, no valid wakeup filter
was configured.

Moreover, the fw assumes there's no connection when there are no configured
wakeup filters.
This leads to the station info not being updated on D3 command, causing
rate_n_flags to be 0 when the offloading code sends tx frame (triggering
SYSASSERT_102C due to invalid antenna param)

Note: "any" trigger is currently assumed to only be used when entering
d0i3 (which has a different flow). However, we still reach this code
when using d3_test.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: remove check for non low latency TIDs
Sara Sharon [Sun, 4 Feb 2018 13:01:37 +0000 (15:01 +0200)]
iwlwifi: mvm: remove check for non low latency TIDs

Firmware will only send non low-latency TIDs in the
bitmap, so the check is now redundant.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: make bitfield a u32 instead of u16
Luca Coelho [Thu, 22 Feb 2018 12:50:06 +0000 (14:50 +0200)]
iwlwifi: make bitfield a u32 instead of u16

The bitfield we use in struct iwl_cfg contains 17 bits, but we declare
it as u16.  The compiler doesn't seem to have any problems with that
(it probably automatically makes it u32), but it's cleaner to use a
type that is long enough for all the flags.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: pcie: remove non-responsive device
Luca Coelho [Tue, 12 Dec 2017 06:58:41 +0000 (08:58 +0200)]
iwlwifi: pcie: remove non-responsive device

If we fail to to grab NIC access because the device is not responding
(i.e. CSR_GP_CNTRL returns 0xFFFFFFFF), remove the device from the PCI
bus, to avoid any further damage, and to let the user space rescan.

In order to inform the userspace that a rescan is needed, we send a
kobject uevent with "INACCESSIBLE".

This functionality is disabled by default, but can be enabled via a
new module parameter called "remove_when_gone".  In the future we may
change this module parameter to include 3 modes instead: do nothing;
auto-rescan or; send uevent.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Rajat Jain <rajatja@google.com>
6 years agoiwlwifi: fw: combine loading of last page block into main copy loop
Luca Coelho [Wed, 14 Feb 2018 06:54:40 +0000 (08:54 +0200)]
iwlwifi: fw: combine loading of last page block into main copy loop

Now that we check and copy only the actual size of the page block,
there is no need to treat the last block separately.  Remove the
mostly duplicate code and make the main copy loop handle also the last
block.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: fw: harden page loading code
Luca Coelho [Tue, 13 Feb 2018 09:09:40 +0000 (11:09 +0200)]
iwlwifi: fw: harden page loading code

The page loading code trusts the data provided in the firmware images
a bit too much and may cause a buffer overflow or copy unknown data if
the block sizes don't match what we expect.

To prevent potential problems, harden the code by checking if the
sizes we are copying are what we expect.

Cc: stable@vger.kernel.org
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: move skb padding reservation earlier
Johannes Berg [Tue, 20 Feb 2018 15:32:36 +0000 (16:32 +0100)]
iwlwifi: mvm: move skb padding reservation earlier

Future changes will require moving the HE radiotap data into
the SKB head, but this means we need to have the alignment
reservation done before that. To prepare, move the alignment
reservation earlier here.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: support new csr addresses for hw address
Golan Ben Ami [Wed, 22 Nov 2017 09:40:15 +0000 (11:40 +0200)]
iwlwifi: support new csr addresses for hw address

In future devices we use different csr addresses for hw addresses.
Update csr addresses to support new and legacy devices.

Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: pcie: allow sending pre-built A-MSDUs
Eliad Peller [Tue, 13 Feb 2018 16:41:46 +0000 (18:41 +0200)]
iwlwifi: pcie: allow sending pre-built A-MSDUs

In case of A-MSDUs, the trans layer is taking care of building
the subframes (out of the given skb), according to the given gso_size.

However, in some testing flows, we want to build the whole A-MSDU
frame in a different place (e.g. userspace), and ask the driver
to send it as-is.

In case of gso_size==0, simply treat the frame as normal-frame,
although the A-MSDU flag is set.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: cfg: remove unnecessary cfg data in non-dvm devices
Luca Coelho [Tue, 13 Feb 2018 11:52:43 +0000 (13:52 +0200)]
iwlwifi: cfg: remove unnecessary cfg data in non-dvm devices

The max_data_size and max_inst_size values are only needed for DVM
devices.  Remove the assignment to those fields in 7000 and newer
families so we can also remove the otherwise unnecessary inclusion of
iwl-agn.h headers.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: introduce Image Loader (IML) - new firmware image
Golan Ben-Ami [Mon, 17 Jul 2017 16:42:35 +0000 (19:42 +0300)]
iwlwifi: introduce Image Loader (IML) - new firmware image

In future devices a new image will be introduced - IML. The IML, image
loader, is loaded by the ROM, and as part of the new self-init flow,
loads the rest of the firmware images to the device.

Store the image, so the ROM can load it to the device.

Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: allow different csr flags for different device families
Golan Ben Ami [Sun, 22 Oct 2017 12:58:26 +0000 (15:58 +0300)]
iwlwifi: allow different csr flags for different device families

Different device families may have different flag values
for passing a message to the fw (i.e. SW_RESET).
In order to keep the code readable, and avoid conditioning
upon the family, store a value for each flag, which indicates
the bit that needs to be enabled.

Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git
Kalle Valo [Thu, 26 Apr 2018 10:26:37 +0000 (13:26 +0300)]
Merge git://git./linux/kernel/git/kvalo/wireless-drivers.git

To fix a conflict reported by Stephen Rothwell <sfr@canb.auug.org.au>:

Today's linux-next merge of the wireless-drivers-next tree got a
conflict in:

  drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c

between commit:

  77e30e10ee28 ("iwlwifi: mvm: query regdb for wmm rule if needed")

from the wireless-drivers tree and commits:

  9c4f7d512740 ("iwlwifi: move all NVM parsing code to the common files")
  4c625c564ba2 ("iwlwifi: get rid of fw/nvm.c")

from the wireless-drivers-next tree.

6 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Wed, 25 Apr 2018 08:30:54 +0000 (11:30 +0300)]
Merge ath-next from git://git./linux/kernel/git/kvalo/ath.git

ath.git patches for 4.18. Major changes:

ath10k

* enable temperature reads for QCA6174 and QCA9377

* add firmware memory dump support for QCA9984

* continue adding WCN3990 support via SNOC bus

6 years agoqtnfmac: pearl: pcie: fix memory leak in qtnf_fw_work_handler
Gustavo A. R. Silva [Thu, 5 Apr 2018 15:49:49 +0000 (10:49 -0500)]
qtnfmac: pearl: pcie: fix memory leak in qtnf_fw_work_handler

In case memory resources for fw were succesfully allocated, release
them before jumping to fw_load_fail.

Addresses-Coverity-ID: 1466092 ("Resource leak")
Fixes: c3b2f7ca4186 ("qtnfmac: implement asynchronous firmware loading")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agort2x00: rt2800: add antenna diversity for RT5370G
Xose Vazquez Perez [Thu, 5 Apr 2018 12:22:32 +0000 (14:22 +0200)]
rt2x00: rt2800: add antenna diversity for RT5370G

RT5370G has hardware RX antenna diversity like RT5390R.
Based on DPO_RT5572_LinuxSTA_2.6.1.3_20121022.tar.bz2 manufacturer driver:
https://d86o2zu8ugzlg.cloudfront.net/mediatek-craft/drivers/DPO_RT5572_LinuxSTA_2.6.1.3_20121022.tar.bz2

Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Helmut Schaa <helmut.schaa@googlemail.com>
Cc: Gertjan van Wingerde <gwingerde@gmail.com>
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: wireless newbie <wnewbie72@gmail.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: linux wireless ml <linux-wireless@vger.kernel.org>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmsmac: phy_lcn: remove duplicate code
Gustavo A. R. Silva [Thu, 5 Apr 2018 00:09:44 +0000 (19:09 -0500)]
brcmsmac: phy_lcn: remove duplicate code

Remove and refactor some code in order to avoid having identical code
for different branches.

Notice that this piece of code hasn't been modified since 2011.

Addresses-Coverity-ID: 1226756 ("Identical code for different branches")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: add support for BCM4366E chipset
Dan Haab [Tue, 3 Apr 2018 08:21:56 +0000 (10:21 +0200)]
brcmfmac: add support for BCM4366E chipset

BCM4366E is a wireless chipset with a BCM43664 ChipCommon. It's
supported by the same firmware as 4366c0.

Signed-off-by: Dan Haab <dan.haab@luxul.com>
[arend: rebase patch and remove unnecessary definition]
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: pcie: tighten a check in mwifiex_pcie_process_event_ready()
Dan Carpenter [Thu, 5 Apr 2018 11:17:19 +0000 (14:17 +0300)]
mwifiex: pcie: tighten a check in mwifiex_pcie_process_event_ready()

If "evt_len" is 1 then we try to memcpy() negative 3 bytes and it would
cause memory corruption.

Fixes: d930faee141b ("mwifiex: add support for Marvell pcie8766 chipset")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: uap: support cfg80211 ignore_broadcast_ssid=2
Xinming Hu [Mon, 2 Apr 2018 12:31:23 +0000 (20:31 +0800)]
mwifiex: uap: support cfg80211 ignore_broadcast_ssid=2

Firmware already support hidden ssid and keep ssid length,
Open the capability in driver.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: uap: filter duplicate ERP IE
Xinming Hu [Mon, 2 Apr 2018 12:31:22 +0000 (20:31 +0800)]
mwifiex: uap: filter duplicate ERP IE

Firmware parse and attach ERP IE from bss configuration,
do not set again from tail IE.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76x2: fix TXD_INFO bitmask definition
Lorenzo Bianconi [Mon, 16 Apr 2018 23:05:59 +0000 (01:05 +0200)]
mt76x2: fix TXD_INFO bitmask definition

Despite this issue is not harmful since it is not actually used in
mt76 driver, fix DMA txinfo bitmask definition

Fixes: 7bc04215a66b ('mt76: add driver code for MT76x2e')
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt7601u: run calibration works after finishing scanning
Stanislaw Gruszka [Mon, 16 Apr 2018 11:56:18 +0000 (13:56 +0200)]
mt7601u: run calibration works after finishing scanning

When finishing scanning we switch to operational channel sill with
SCANNING flag. This mean that we never perform calibration works after
scanning. To fix the problem queue calibration works on
.sw_scan_complete() routine.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Jakub Kicinski <kubakici@wp.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt7601u: use EWMA to calculate avg_rssi
Stanislaw Gruszka [Mon, 16 Apr 2018 11:56:17 +0000 (13:56 +0200)]
mt7601u: use EWMA to calculate avg_rssi

avr_rssi is not calculated correctly as we do not divide result
by 256 (mt76 sum avg_rssi1 and avg_rssi2 and divide by 512).
However dividing by 256 will make avg_rssi almost the same as
last rssi value - not really an average. So use EWMA to calculate
avg_rssi. I've chosen weight_rcp=4 to convergence quicker on signal
strength changes.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Jakub Kicinski <kubakici@wp.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76x2: set default values in TX_ALC_CFG_{1, 2} for tempetaure compensation
Lorenzo Bianconi [Wed, 4 Apr 2018 08:38:32 +0000 (10:38 +0200)]
mt76x2: set default values in TX_ALC_CFG_{1, 2} for tempetaure compensation

Initialize default values for temperature compensation in TX_ALC_CFG_{1,2}
if tssi has been enabled

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76x2: fix tx_alc_enabled check
Lorenzo Bianconi [Wed, 4 Apr 2018 08:23:46 +0000 (10:23 +0200)]
mt76x2: fix tx_alc_enabled check

Fix mt76x2_temp_tx_alc_enabled routine since in order to enable tx_alc
temperature compensation it necessary to take into account BIT(15) of
MT_EE_TX_POWER_EXT_PA_5G eeprom info

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76x2: remove unnecessary MT_TX_ALC_CFG_4 configuration
Lorenzo Bianconi [Tue, 3 Apr 2018 20:30:19 +0000 (22:30 +0200)]
mt76x2: remove unnecessary MT_TX_ALC_CFG_4 configuration

Remove unnecessary MT_TX_ALC_CFG_4 configuration since the register value
will be properly set according to the usage of an external power amplifier

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76: check qos ack policy before reordering packets
Felix Fietkau [Tue, 3 Apr 2018 19:52:54 +0000 (21:52 +0200)]
mt76: check qos ack policy before reordering packets

Do not attempt to reorder packets not part of a BA session

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76: set RX_FLAG_DUP_VALIDATED for A-MPDU reordered packets
Felix Fietkau [Tue, 3 Apr 2018 19:52:53 +0000 (21:52 +0200)]
mt76: set RX_FLAG_DUP_VALIDATED for A-MPDU reordered packets

Required for fast-rx and allows mac80211 to skip an unnnecessary check.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76: fix potential sleep in atomic context
Felix Fietkau [Tue, 3 Apr 2018 19:52:52 +0000 (21:52 +0200)]
mt76: fix potential sleep in atomic context

Use cancel_delayed_work instead of cancel_delayed_work_sync

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76: rework tx power handling
Felix Fietkau [Tue, 3 Apr 2018 19:52:51 +0000 (21:52 +0200)]
mt76: rework tx power handling

There were a number of issues in the existing tx power handling code:

1. The EEPROM target power for chain 0 refers to the actual output power
after the channel and bandwidth delta have been added to the initial
channel gain. This means the delta values should not be added/subtracted
for the rate power calculation

2. When power is reduced significantly, the initial channel gain
underflows very quickly, while the per-rate power offsets are high.
This miscalculation causes effective tx power to be increased when it
should actually be lowered.

Fix this by trying to adjust the channel gain to the lowest power from
the rate table. In case of under- or overflow, compensate by adding an
appropriate delta to the rate power values.

This makes power configuration more accurate on a wider range of
configurable values

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76: toggle driver station powersave bit before notifying mac80211
Felix Fietkau [Tue, 3 Apr 2018 19:52:50 +0000 (21:52 +0200)]
mt76: toggle driver station powersave bit before notifying mac80211

Avoids race conditions from mac80211 enqueueing tx packets before the
tx-drop bit is cleared

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76: add missing VHT maximum A-MPDU length capability
Felix Fietkau [Tue, 3 Apr 2018 19:52:49 +0000 (21:52 +0200)]
mt76: add missing VHT maximum A-MPDU length capability

Signficantly improves throughput with some clients

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76: stop tx queues from the driver callback instead of common code
Felix Fietkau [Tue, 3 Apr 2018 19:52:48 +0000 (21:52 +0200)]
mt76: stop tx queues from the driver callback instead of common code

Allows the driver to control whether to send a BlockAckReq after waking
up. MT76x2 needs this set to true, for MT7603 (to be submitted later)
it needs to be false.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76x2: make mt76x2_mac_reset routine static
Lorenzo Bianconi [Tue, 3 Apr 2018 15:01:43 +0000 (17:01 +0200)]
mt76x2: make mt76x2_mac_reset routine static

Add static qualifier to mt76x2_mac_reset routine and remove the
prototype from mt76x2_mac.h since it is used just in mt76x2_init.c

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76x2: fix tssi initialization for 5GHz band
Lorenzo Bianconi [Tue, 3 Apr 2018 14:45:31 +0000 (16:45 +0200)]
mt76x2: fix tssi initialization for 5GHz band

Fix mcu initial configuration for tssi calibration on 5GHz band

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt7601u: phy: mark expected switch fall-through
Gustavo A. R. Silva [Fri, 30 Mar 2018 21:12:23 +0000 (16:12 -0500)]
mt7601u: 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: Jakub Kicinski <kubakici@wp.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: btcoex: remove identical statements within if-else branches
Ping-Ke Shih [Mon, 9 Apr 2018 07:51:31 +0000 (15:51 +0800)]
rtlwifi: btcoex: remove identical statements within if-else branches

Since the statements are identical, we can safely remove the statements.
The commit 42e74946f016 ("rtlwifi: btcoexist: Fix if == else warnings in
halbtc8821a1ant.c") had fixed the statements, but the commit c6821613e653
("rtlwifi: btcoex: follow linux coding style") that converted coding style
and upgraded btcoex didn't include the fix.

Reported-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: Fix 'invalid vdd' warning in mmc
Siva Rebbagondla [Wed, 11 Apr 2018 06:43:32 +0000 (12:13 +0530)]
rsi: Fix 'invalid vdd' warning in mmc

While performing cleanup, driver is messing with card->ocr
value by not masking rocr against ocr_avail. Below panic
is observed with some of the SDIO host controllers due to
this. Issue is resolved by reverting incorrect modifications
to vdd.

[  927.423821] mmc1: Invalid vdd 0x1f
[  927.423925] Modules linked in: rsi_sdio(+) cmac bnep arc4 rsi_91x
       mac80211 cfg80211 btrsi rfcomm bluetooth ecdh_generic
[  927.424073] CPU: 0 PID: 1624 Comm: insmod Tainted: G W        4.15.0-1000-caracalla #1
[  927.424075] Hardware name: Dell Inc. Edge Gateway 3003/      , BIOS 01.00.06 01/22/2018
[  927.424082] RIP: 0010:sdhci_set_power_noreg+0xdd/0x190[sdhci]
[  927.424085] RSP: 0018:ffffac3fc064b930 EFLAGS:  00010282
[  927.424107] Call Trace:
[  927.424118]  sdhci_set_power+0x5a/0x60 [sdhci]
[  927.424125]  sdhci_set_ios+0x360/0x3b0 [sdhci]
[  927.424133]  mmc_set_initial_state+0x92/0x120
[  927.424137]  mmc_power_up.part.34+0x33/0x1d0
[  927.424141]  mmc_power_up+0x17/0x20
[  927.424147]  mmc_sdio_runtime_resume+0x2d/0x50
[  927.424151]  mmc_runtime_resume+0x17/0x20
[  927.424156]  __rpm_callback+0xc4/0x200
[  927.424161]  ? idr_alloc_cyclic+0x57/0xd0
[  927.424165]  ? mmc_runtime_suspend+0x20/0x20
[  927.424169]  rpm_callback+0x24/0x80
[  927.424172]  ? mmc_runtime_suspend+0x20/0x20
[  927.424176]  rpm_resume+0x4b3/0x6c0
[  927.424181]  __pm_runtime_resume+0x4e/0x80
[  927.424188]  driver_probe_device+0x41/0x490
[  927.424192]  __driver_attach+0xdf/0xf0
[  927.424196]  ? driver_probe_device+0x490/0x490
[  927.424201]  bus_for_each_dev+0x6c/0xc0
[  927.424205]  driver_attach+0x1e/0x20
[  927.424209]  bus_add_driver+0x1f4/0x270
[  927.424217]  ? rsi_sdio_ack_intr+0x50/0x50 [rsi_sdio]
[  927.424221]  driver_register+0x60/0xe0
[  927.424227]  ? rsi_sdio_ack_intr+0x50/0x50 [rsi_sdio]
[  927.424231]  sdio_register_driver+0x20/0x30
[  927.424237]  rsi_module_init+0x16/0x40 [rsi_sdio]

Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: fix nommu_map_sg overflow kernel panic
Siva Rebbagondla [Wed, 11 Apr 2018 06:43:31 +0000 (12:13 +0530)]
rsi: fix nommu_map_sg overflow kernel panic

Following overflow kernel panic is observed on some platforms while
loading the driver. It is fixed if dynamically allocated memory is
passed to SDIO instead of static one

[  927.513963] nommu_map_sg: overflow 17d54064ba7c+20 of device mask ffffffff
[  927.517712] Modules linked in: rsi_sdio(+) cmac bnep arc4 rsi_91x mac80211 cfg80211
       btrsi rfcomm bluetooth ecdh_generic snd_soc_sst_bytcr_rt5660
[  927.517861] CPU: 0 PID: 1624 Comm: insmod Tainted: G W 4.15.0-1000 #1
[  927.517870] RIP: 0010:sdhci_send_command+0x5f0/0xa90 [sdhci]
[  927.517873] RSP: 0000:ffffac3fc064b6d8 EFLAGS: 00010086
[  927.517895] Call Trace:
[  927.517908]  ? __schedule+0x3cd/0x890
[  927.517915]  ? mod_timer+0x17b/0x3c0
[  927.517922]  sdhci_request+0x7c/0xf0 [sdhci]
[  927.517928]  __mmc_start_request+0x5a/0x170
[  927.517932]  mmc_start_request+0x74/0x90
[  927.517936]  mmc_wait_for_req+0x87/0xe0
[  927.517940]  mmc_io_rw_extended+0x2fd/0x330
[  927.517946]  ? mmc_wait_data_done+0x30/0x30
[  927.517951]  sdio_io_rw_ext_helper+0x160/0x210
[  927.517956]  sdio_writesb+0x1d/0x20
[  927.517966] rsi_sdio_write_register_multiple+0x68/0x110 [rsi_sdio]
[  927.517976]  rsi_hal_device_init+0x357/0x910 [rsi_91x]
[  927.517983]  ? rsi_hal_device_init+0x357/0x910 [rsi_91x]
[  927.517990]  rsi_probe+0x2c6/0x450 [rsi_sdio]
[  927.517995]  sdio_bus_probe+0xfc/0x110
[  927.518000]  driver_probe_device+0x2b3/0x490
[  927.518005]  __driver_attach+0xdf/0xf0
[  927.518008]  ? driver_probe_device+0x490/0x490
[  927.518014]  bus_for_each_dev+0x6c/0xc0
[  927.518018]  driver_attach+0x1e/0x20
[  927.518021]  bus_add_driver+0x1f4/0x270
[  927.518028]  ? rsi_sdio_ack_intr+0x50/0x50 [rsi_sdio]
[  927.518031]  driver_register+0x60/0xe0
[  927.518038]  ? rsi_sdio_ack_intr+0x50/0x50 [rsi_sdio]
[  927.518041]  sdio_register_driver+0x20/0x30
[  927.518047]  rsi_module_init+0x16/0x40 [rsi_sdio]

Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: advertise 5GHz support based on device capability
Amitkumar Karwar [Tue, 10 Apr 2018 15:04:17 +0000 (20:34 +0530)]
rsi: advertise 5GHz support based on device capability

Currently 5GHz gets advertised even for the device which supports
only 2.4Ghz band. This patch fixes the issue

Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: enable power save by default for coex
Amitkumar Karwar [Tue, 10 Apr 2018 15:04:16 +0000 (20:34 +0530)]
rsi: enable power save by default for coex

Power save is by default enabled for WLAN and BT coex mode.

Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: parse TID from data frame correctly
Amitkumar Karwar [Tue, 10 Apr 2018 15:04:15 +0000 (20:34 +0530)]
rsi: parse TID from data frame correctly

Currently TID is extracted by checking at specific offset in data frame.
This approach doesn't work for some of the frames. This patch uses mac80211
API and do it correctly

Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: increase max supported aggregation subframes
Amitkumar Karwar [Tue, 10 Apr 2018 15:04:14 +0000 (20:34 +0530)]
rsi: increase max supported aggregation subframes

Maximum number of supported aggregation subframes has been increased
to 8. This is the optimal number for the driver.

Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: use appropriate interface for power save configuration
Amitkumar Karwar [Tue, 10 Apr 2018 15:04:13 +0000 (20:34 +0530)]
rsi: use appropriate interface for power save configuration

Power save request should be sent on station interface. Virtual
interface which is connected should be preferred. This patch
resolves device not entering power save problem in certain
situations

Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: device bootup parameter configuration
Amitkumar Karwar [Tue, 10 Apr 2018 15:04:12 +0000 (20:34 +0530)]
rsi: device bootup parameter configuration

Some device configuration flags need to be enabled while sending 'bootup
params' internal frame to firmware. This patch takes care of it.

Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: disable fw watchdog timer during reset
Amitkumar Karwar [Tue, 10 Apr 2018 15:04:11 +0000 (20:34 +0530)]
rsi: disable fw watchdog timer during reset

Firmware's watchdog timer should be disabled as a part of reset
sequence. This change fixes a firmware hang issue observed during
stress tests.

Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: remove unecessary PTR_ALIGN()s
Dan Carpenter [Fri, 6 Apr 2018 08:37:17 +0000 (11:37 +0300)]
rsi: remove unecessary PTR_ALIGN()s

The issue here is that we allocate "data" and then set
"data = PTR_ALIGN(data, 8);" and then we free the aligned pointer
instead of the original pointer.

kmalloc() pointers are already ARCH_SLAB_MINALIGN aligned which is 8 or
more on everything except certain Xtensa variants.  We decided that if
the Xtensa people ever notice a bug here then we'll tell them the bug is
on their side.  ;)

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: roaming enhancements
Prameela Rani Garnepudi [Thu, 29 Mar 2018 14:14:52 +0000 (19:44 +0530)]
rsi: roaming enhancements

To support roaming below changes are done:
* Station notify frame is send to firmware after sending assoc
  request. This will avoid dropping of first EAPOL frame due to
  delay in creation of station control block in firmware.
* Data queues are unblocked after sending station notify in open
  mode, after configuring key in WEP mode, and after receiving
  EAPOL4 confirm in WPA mode.
* Initial EAPOL frames priority is chaged to MGMT, rekey EAPOL
  frames priority changed to VO.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: enable 80MHz clock by default
Prameela Rani Garnepudi [Thu, 29 Mar 2018 14:14:51 +0000 (19:44 +0530)]
rsi: enable 80MHz clock by default

80MHz clock for device should be enabled by default in
TX command frame radio capabilities.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: move descriptor preparation to core
Prameela Rani Garnepudi [Thu, 29 Mar 2018 14:14:50 +0000 (19:44 +0530)]
rsi: move descriptor preparation to core

Descriptors preparation is moved to core instead of HAL to
avoid synchronization issues in sending TX frames

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agorsi: move xtend_desc structure from rsi_main.h to rsi_mgmt.h
Prameela Rani Garnepudi [Thu, 29 Mar 2018 14:14:49 +0000 (19:44 +0530)]
rsi: move xtend_desc structure from rsi_main.h to rsi_mgmt.h

All descriptor structures are in rsi_mgmt.h except this
extended descriptor structure. Hence moving it to rsi_mgmt.h
and also renaming to rsi_xtend_desc.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agocw1200: fix spelling mistake: "Mailformed" -> "Malformed"
Colin Ian King [Thu, 29 Mar 2018 15:38:18 +0000 (16:38 +0100)]
cw1200: fix spelling mistake: "Mailformed" -> "Malformed"

Trivial fix to spelling mistake in wiphy_warn warning message text

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoqtnfmac: add DFS offload support
Dmitry Lebed [Mon, 26 Mar 2018 13:36:33 +0000 (16:36 +0300)]
qtnfmac: add DFS offload support

DFS offload support implemented:
- DFS_OFFLOAD feature is advertised depending on HW capabilities
- CAC_STARTED event forwarding from HW implemented
- start_radar_detection() callback now returning -ENOTSUPP
  if DFS_OFFLOAD is enabled

Signed-off-by: Dmitry Lebed <dlebed@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: cleanup 8723be ant_sel definition
Ping-Ke Shih [Fri, 20 Apr 2018 02:30:09 +0000 (10:30 +0800)]
rtlwifi: cleanup 8723be ant_sel definition

Some HP laptops have only a single wifi antenna. This would not be a
problem except that they were shipped with an incorrectly encoded
EFUSE. It should have been possible to open the computer and transfer
the antenna connection to the other terminal except that such action
might void the warranty, and moving the antenna broke the Windows
driver. The fix was to add a module option that would override the
EFUSE encoding. That was done with commit c18d8f509571 ("rtlwifi:
rtl8723be: Add antenna select module parameter"). There was still a
problem with Bluetooth coexistence, which was addressed with commit
baa170229095 ("rtlwifi: btcoexist: Implement antenna selection").
There were still problems, thus there were commit 0ff78adeef11
("rtlwifi: rtl8723be: fix ant_sel code") and commit 6d6226928369
("rtlwifi: btcoexist: Fix antenna selection code"). Despite all these
attempts at fixing the problem, the code is not yet right. A proper
fix is important as there are now instances of laptops having
RTL8723DE chips with the same problem.

The module parameter ant_sel is used to control antenna number and path.
At present enum ANT_{X2,X1} is used to define the antenna number, but
this choice is not intuitive, thus change to a new enum ANT_{MAIN,AUX}
to make it more readable. This change showed examples where incorrect
values were used. It was also possible to remove a workaround in
halbtcoutsrc.c.

The experimental results with single antenna connected to specific path
are now as follows:
  ant_sel  ANT_MAIN(#1)  ANT_AUX(#2)
     0        -8            -62
     1        -62           -10
     2        -6            -60

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Fixes: c18d8f509571 ("rtlwifi: rtl8723be: Add antenna select module parameter")
Fixes: baa170229095 ("rtlwifi: btcoexist: Implement antenna selection")
Fixes: 0ff78adeef11 ("rtlwifi: rtl8723be: fix ant_sel code")
Fixes: 6d6226928369 ("rtlwifi: btcoexist: Fix antenna selection code")
Cc: Stable <stable@vger.kernel.org> # 4.7+
Reviewed-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoiwlwifi: mvm: fix old scan version sizes
Luca Coelho [Mon, 23 Apr 2018 13:01:31 +0000 (16:01 +0300)]
iwlwifi: mvm: fix old scan version sizes

When version 8 of the scan command API was introduced, only the size
of version 7 was updated, causing older versions of the firmware to
throw BAD_COMMAND errors.

Calculating the old version based on the size of the latest version
got too complicated and the size of the older versions will never
change anyway, so it's better to just hardcoded the sizes.

Fixes: 66fa2424df16 ("iwlwifi: fw api: support the new scan request FW API version")
Reported-by: Scott Register <sreg@sreg.io>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoMerge tag 'iwlwifi-next-for-kalle-2018-04-20' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Tue, 24 Apr 2018 10:00:03 +0000 (13:00 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2018-04-20' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

iwlwifi patches for 4.18

* implement Traffic Condition Monitor;
* use TCM for scan and BT coex;
* use TCM to detect when the AP doesn't support UAPSD properly;
* some more work for the 22000 family of devices;
* introduce AMSDU rate control offload;
* a couple of clean-ups and bugfixes.

6 years agowcn36xx: pass information elements in scan requests
Daniel Mack [Tue, 17 Apr 2018 13:23:37 +0000 (15:23 +0200)]
wcn36xx: pass information elements in scan requests

When the wifi driver core passes IE elements in the scan request, append
them to the firmware message. The driver currently tells the core that
it is capable of attaching up to WCN36XX_MAX_SCAN_IE_LEN octets, but
doesn't actually pass them to the the hardware.

Note that this patch doesn't fix a bug that was observed. The change is
merely done for the sake of completeness as the hardware supports
appending IEs in scans. Tests show that network scans work fine with
this patch applied.

Some defines were moved around to avoid cyclic include dependencies.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agowcn36xx: send bss_type in scan requests
Daniel Mack [Tue, 17 Apr 2018 13:23:36 +0000 (15:23 +0200)]
wcn36xx: send bss_type in scan requests

Pass the bss_type of the currently configured BSS in the message for the
scan request. Therefore, that setting needs to be kept in struct
wcn36xx_vif.

This seems to be only interesting when scanning for a specific SSID
and doesn't matter for regular wildcard scans.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agowcn36xx: handle scan cancellation when firmware support is missing
Daniel Mack [Tue, 17 Apr 2018 13:23:35 +0000 (15:23 +0200)]
wcn36xx: handle scan cancellation when firmware support is missing

For firmwares that don't have the SCAN_OFFLOAD feature bit set, do
not call into wcn36xx_smd_stop_hw_scan(). Instead, stop the asynchronous
work and call into ieee80211_scan_completed() immediately.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agowcn36xx: cancel pending scan request when interface goes down
Daniel Mack [Tue, 17 Apr 2018 13:23:34 +0000 (15:23 +0200)]
wcn36xx: cancel pending scan request when interface goes down

When the network interface goes down while a scan request is still
pending that can't be stopped due to firmware hickups, wcn->scan_req
remains set, even though the hardware is deinitialized. This results
in -EBUSY for all scan requests after the interface was brought up
again.

Fix this by explicitly completing pending scan requests in
wcn36xx_stop().

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agowcn36xx: abort scan request when 'dequeued' indicator is sent
Daniel Mack [Tue, 17 Apr 2018 13:23:33 +0000 (15:23 +0200)]
wcn36xx: abort scan request when 'dequeued' indicator is sent

When the firmware sends a WCN36XX_HAL_SCAN_IND_DEQUEUED indication,
the request is apparently no longer valid. Attempts to stop the hardware
scan request subsequently will lead to the following error message, and
the hardware is no longer able to communicate with any AP:

[   57.917186] wcn36xx: ERROR hal_stop_scan_offload response failed err=5

Interpreting this indicator message as scan abortion fixes this.

While at it, add a newline to a debug print.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoath10k: enable sta idle power save
Govind Singh [Tue, 17 Apr 2018 12:07:01 +0000 (17:37 +0530)]
ath10k: enable sta idle power save

Enable sta power save in fw for the targets that
supports idle power save. The idle ps enable command
will be ignored by the firmware which does not support
this feature.

Signed-off-by: Govind Singh <govinds@codeaurora.org>
Signed-off-by: Rakesh Pillai <pillair@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoath10k: enable SRRI/DRRI support on ddr for WCN3990
Govind Singh [Tue, 17 Apr 2018 12:07:00 +0000 (17:37 +0530)]
ath10k: enable SRRI/DRRI support on ddr for WCN3990

SRRI/DRRI are not mapped in the HW Shadow block and can lead
to un-clocked access if common subsystem in the target is
powered down due to idle mode.

To mitigate this problem SRRI/DRRI can be read from
DDR instead of doing an actual hardware read.
Host allocates non cached memory on ddr and configures
the physical address of this memory to the CE hardware.
The hardware updates the RRI on this particular location.
Read SRRI/DRRI from DDR location instead of
direct target read.

Enable retention restore on ddr using hw params to enable
in specific targets.

Signed-off-by: Govind Singh <govinds@codeaurora.org>
Signed-off-by: Rakesh Pillai <pillair@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>