platform/kernel/linux-starfive.git
5 years agortlwifi: rtl8723be: Replace old-style license information
Larry Finger [Thu, 14 Feb 2019 19:59:18 +0000 (13:59 -0600)]
rtlwifi: rtl8723be: Replace old-style license information

The traditional license information is replaced by the SPDX form. There
are no code changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortlwifi: rtl8723ae: Replace old-style license information
Larry Finger [Thu, 14 Feb 2019 19:59:17 +0000 (13:59 -0600)]
rtlwifi: rtl8723ae: Replace old-style license information

The traditional license information is replaced by the SPDX form. There
are no code changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortlwifi: rtl8192se: Replace old-style license information
Larry Finger [Thu, 14 Feb 2019 19:59:16 +0000 (13:59 -0600)]
rtlwifi: rtl8192se: Replace old-style license information

The traditional license information is replaced by the SPDX form. There
are no code changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortlwifi: rtl8192ee: Replace old-style license information
Larry Finger [Thu, 14 Feb 2019 19:59:15 +0000 (13:59 -0600)]
rtlwifi: rtl8192ee: Replace old-style license information

The traditional license information is replaced by the SPDX form. There
are no code changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortlwifi: rtl8192de: Replace old-style license information
Larry Finger [Thu, 14 Feb 2019 19:59:14 +0000 (13:59 -0600)]
rtlwifi: rtl8192de: Replace old-style license information

The traditional license information is replaced by the SPDX form. There
are no code changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortlwifi: rtl8192cu: Replace old-style license information
Larry Finger [Thu, 14 Feb 2019 19:59:13 +0000 (13:59 -0600)]
rtlwifi: rtl8192cu: Replace old-style license information

The traditional license information is replaced by the SPDX form. There
are no code changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortlwifi: rtl8192ce: Replace old-style license information
Larry Finger [Thu, 14 Feb 2019 19:59:12 +0000 (13:59 -0600)]
rtlwifi: rtl8192ce: Replace old-style license information

The traditional license information is replaced by the SPDX form. There
are no code changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortlwifi: rtl8192com: Replace old-style license information
Larry Finger [Thu, 14 Feb 2019 19:59:11 +0000 (13:59 -0600)]
rtlwifi: rtl8192com: Replace old-style license information

The traditional license information is replaced by the SPDX form. There
are no code changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortlwifi: rtl8188ee: Replace old-style license information
Larry Finger [Thu, 14 Feb 2019 19:59:10 +0000 (13:59 -0600)]
rtlwifi: rtl8188ee: Replace old-style license information

The traditional license information is replaced by the SPDX form. There
are no code changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortlwifi: btcoex: Replace old-style license information
Larry Finger [Thu, 14 Feb 2019 19:59:09 +0000 (13:59 -0600)]
rtlwifi: btcoex: Replace old-style license information

The old-style license information is replaced by the SPDX form. There
are no code changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agortlwifi: Replace old-style license information
Larry Finger [Thu, 14 Feb 2019 19:59:08 +0000 (13:59 -0600)]
rtlwifi: Replace old-style license information

The traditional license information is replaced by the SPDX form. There
are no code changes.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoMerge tag 'mt76-for-kvalo-2019-02-18' of https://github.com/nbd168/wireless
Kalle Valo [Tue, 19 Feb 2019 14:40:56 +0000 (16:40 +0200)]
Merge tag 'mt76-for-kvalo-2019-02-18' of https://github.com/nbd168/wireless

mt76 patches for 5.1

* beacon support for USB devices (mesh+ad-hoc only)
* mt76x0 tx power fixes
* fixes for encryption, calibration and ED/CCA
* more code unification
* USB fixes
* fix for using the correct hweight8 function

5 years agomt76: mt76x2: simplify per-chain signal strength handling
Felix Fietkau [Mon, 18 Feb 2019 19:29:11 +0000 (20:29 +0100)]
mt76: mt76x2: simplify per-chain signal strength handling

There is no need to use a for loop here, supported chips can only support
up to 2 chains.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: fix resetting software IV flag on key delete
Felix Fietkau [Fri, 25 Jan 2019 17:00:11 +0000 (18:00 +0100)]
mt76: fix resetting software IV flag on key delete

It needs to be unset instead of set

Fixes: 23405236460b9 ("mt76: fix transmission of encrypted management frames")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: fix corrupted software generated tx CCMP PN
Felix Fietkau [Fri, 25 Jan 2019 16:59:06 +0000 (17:59 +0100)]
mt76: fix corrupted software generated tx CCMP PN

Since ccmp_pn is u8 *, the second half needs to start at array index 4
instead of 0. Fixes a connection stall after a certain amount of traffic

Fixes: 23405236460b9 ("mt76: fix transmission of encrypted management frames")
Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: fix tx status timeout processing
Felix Fietkau [Fri, 25 Jan 2019 14:10:52 +0000 (15:10 +0100)]
mt76: fix tx status timeout processing

Remove bogus check for MT_PACKET_ID_NO_ACK in mt76_tx_status_skb_get, which
is already handled in callers and turns timeout calls into no-ops
Do not clean up pending status items on reordering of tx status information
if the timeout is not reached yet

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: Use the correct hweight8() function
Ben Hutchings [Tue, 12 Feb 2019 15:36:24 +0000 (15:36 +0000)]
mt76: Use the correct hweight8() function

mt76_init_stream_cap() and mt76_get_txpower() call __sw_hweight8()
directly, but that's only defined if CONFIG_GENERIC_HWEIGHT is
enabled.  The function that works on all architectures is hweight8().

Fixes: 551e1ef4d291 ("mt76: add mt76_init_stream_cap routine")
Fixes: 9313faacbb4e ("mt76: move mt76x02_get_txpower to mt76 core")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02u: remove bogus check and comment padding
Stanislaw Gruszka [Tue, 12 Feb 2019 09:24:42 +0000 (10:24 +0100)]
mt76x02u: remove bogus check and comment padding

In mt76x02u_skb_dma_info() pad is always non-zero. Patch removes
bogus check and add comments to the function.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: usb: use dev_err_ratelimited instead of dev_err in mt76u_complete_rx
Lorenzo Bianconi [Mon, 11 Feb 2019 23:45:55 +0000 (00:45 +0100)]
mt76: usb: use dev_err_ratelimited instead of dev_err in mt76u_complete_rx

During device removal the driver can report multiple error messages.
Use dev_err_ratelimited instead of dev_err to display urb errors

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: usb: introduce disable_usb_sg parameter
Lorenzo Bianconi [Tue, 12 Feb 2019 13:42:42 +0000 (14:42 +0100)]
mt76: usb: introduce disable_usb_sg parameter

Add disable_usb_sg module parameter to disable scatter-gather on demand

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: usb: use a linear buffer for tx/rx datapath if sg is not supported
Lorenzo Bianconi [Tue, 12 Feb 2019 13:42:41 +0000 (14:42 +0100)]
mt76: usb: use a linear buffer for tx/rx datapath if sg is not supported

Use linear fragment and not a single usb scatter-gather buffer in mt76u
{tx,rx} datapath if the usb controller has sg data length constraints

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: usb: do not use sg buffers for mcu messages
Lorenzo Bianconi [Tue, 12 Feb 2019 13:42:40 +0000 (14:42 +0100)]
mt76: usb: do not use sg buffers for mcu messages

Do not use scatter-gather buffers for mcu commands.
Introduce mt76u_buf_alloc and mt76u_buf_alloc_sg routines.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: usb: move mt76u_check_sg in usb.c
Lorenzo Bianconi [Tue, 12 Feb 2019 13:42:39 +0000 (14:42 +0100)]
mt76: usb: move mt76u_check_sg in usb.c

Move mt76u_check_sg routine in usb.c and introduce sg_en variable
in mt76_usb in order to check if scatter-gather is supported by
mt76u layer

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: usb: do not run mt76u_queues_deinit twice
Lorenzo Bianconi [Sun, 10 Feb 2019 21:49:15 +0000 (22:49 +0100)]
mt76: usb: do not run mt76u_queues_deinit twice

Do not call mt76u_queues_deinit routine in mt76u_alloc_queues error path
since it will be run in mt76x0u_register_device or
mt76x2u_register_device error path. Current implementation triggers the
following kernel warning:

[   67.005516] WARNING: CPU: 2 PID: 761 at lib/refcount.c:187 refcount_sub_and_test_checked+0xa4/0xb8
[   67.019513] refcount_t: underflow; use-after-free.
[   67.099872] Hardware name: BCM2835
[   67.106268] Backtrace:
[   67.111584] [<8010c91c>] (dump_backtrace) from [<8010cc00>] (show_stack+0x20/0x24)
[   67.124974]  r6:60000013 r5:ffffffff r4:00000000 r3:a50bade6
[   67.132226] [<8010cbe0>] (show_stack) from [<807ca5f4>] (dump_stack+0xc8/0x114)
[   67.141225] [<807ca52c>] (dump_stack) from [<8011e65c>] (__warn+0xf4/0x120)
[   67.149849]  r9:000000bb r8:804d0138 r7:00000009 r6:8099dc84 r5:00000000 r4:b66c7b58
[   67.160767] [<8011e568>] (__warn) from [<8011e6d0>] (warn_slowpath_fmt+0x48/0x50)
[   67.171436]  r9:7f65e128 r8:80d1419c r7:80c0bac4 r6:b97b3044 r5:b7368e00 r4:00000000
[   67.182433] [<8011e68c>] (warn_slowpath_fmt) from [<804d0138>] (refcount_sub_and_test_checked+0xa4/0xb8)
[   67.195221]  r3:80c91c25 r2:8099dc94
[   67.200370]  r4:00000000
[   67.204397] [<804d0094>] (refcount_sub_and_test_checked) from [<804d0164>] (refcount_dec_and_test_checked+0x18/0x1c)
[   67.218046]  r4:b7368e00 r3:00000001
[   67.223125] [<804d014c>] (refcount_dec_and_test_checked) from [<805db49c>] (usb_free_urb+0x20/0x4c)
[   67.235358] [<805db47c>] (usb_free_urb) from [<7f639804>] (mt76u_buf_free+0x98/0xac [mt76_usb])
[   67.247302]  r4:00000001 r3:00000001
[   67.252468] [<7f63976c>] (mt76u_buf_free [mt76_usb]) from [<7f639ef8>] (mt76u_queues_deinit+0x44/0x100 [mt76_usb])
[   67.266102]  r8:b8fe8600 r7:b5dac480 r6:b5dace20 r5:00000001 r4:00000000 r3:00000080
[   67.277132] [<7f639eb4>] (mt76u_queues_deinit [mt76_usb]) from [<7f65c040>] (mt76x0u_cleanup+0x40/0x4c [mt76x0u])
[   67.290737]  r7:b5dac480 r6:b8fe8600 r5:ffffffea r4:b5dace20
[   67.298069] [<7f65c000>] (mt76x0u_cleanup [mt76x0u]) from [<7f65c564>] (mt76x0u_probe+0x1f0/0x354 [mt76x0u])
[   67.311174]  r4:b5dace20 r3:00000000
[   67.316312] [<7f65c374>] (mt76x0u_probe [mt76x0u]) from [<805e0b6c>] (usb_probe_interface+0x104/0x240)
[   67.328915]  r7:00000000 r6:7f65e034 r5:b6634800 r4:b8fe8620
[   67.336276] [<805e0a68>] (usb_probe_interface) from [<8056a8bc>] (really_probe+0x224/0x2f8)
[   67.347965]  r10:b65f0a00 r9:00000019 r8:7f65e034 r7:80d3e124 r6:00000000 r5:80d3e120
[   67.359175]  r4:b8fe8620 r3:805e0a68
[   67.364384] [<8056a698>] (really_probe) from [<8056ab60>] (driver_probe_device+0x6c/0x180)
[   67.375974]  r10:b65f0a00 r9:7f65e2c0 r8:b8fe8620 r7:00000000 r6:7f65e034 r5:7f65e034
[   67.387170]  r4:b8fe8620 r3:00000000
[   67.392378] [<8056aaf4>] (driver_probe_device) from [<8056ad54>] (__driver_attach+0xe0/0xe4)
[   67.404097]  r9:7f65e2c0 r8:7f65d22c r7:00000000 r6:b8fe8654 r5:7f65e034 r4:b8fe8620
[   67.415122] [<8056ac74>] (__driver_attach) from [<8056880c>] (bus_for_each_dev+0x68/0xa0)
[   67.426628]  r6:8056ac74 r5:7f65e034 r4:00000000 r3:00000027
[   67.434017] [<805687a4>] (bus_for_each_dev) from [<8056a1cc>] (driver_attach+0x28/0x30)
[   67.445394]  r6:80c6ddc8 r5:b7368f80 r4:7f65e034
[   67.451703] [<8056a1a4>] (driver_attach) from [<80569c24>] (bus_add_driver+0x194/0x21c)
[   67.463081] [<80569a90>] (bus_add_driver) from [<8056b504>] (driver_register+0x8c/0x124)
[   67.474560]  r7:80c6ddc8 r6:7f65e034 r5:00000000 r4:7f65e034
[   67.481964] [<8056b478>] (driver_register) from [<805df510>] (usb_register_driver+0x74/0x140)
[   67.493901]  r5:00000000 r4:7f65e000
[   67.499131] [<805df49c>] (usb_register_driver) from [<7f661024>] (mt76x0_driver_init+0x24/0x1000 [mt76x0u])
[   67.512258]  r9:00000001 r8:7f65e308 r7:00000000 r6:80c08d48 r5:7f661000 r4:7f65e2c0
[   67.523404] [<7f661000>] (mt76x0_driver_init [mt76x0u]) from [<80102f6c>] (do_one_initcall+0x4c/0x210)
[   67.536142] [<80102f20>] (do_one_initcall) from [<801ae63c>] (do_init_module+0x6c/0x21c)
[   67.547639]  r8:7f65e308 r7:80c08d48 r6:b65f0ac0 r5:7f65e2c0 r4:7f65e2c0
[   67.556129] [<801ae5d0>] (do_init_module) from [<801ad68c>] (load_module+0x1d10/0x2304)

Fixes: b40b15e1521f ("mt76: add usb support to mt76 layer")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: usb: fix possible memory leak in mt76u_buf_free
Lorenzo Bianconi [Sun, 10 Feb 2019 21:49:14 +0000 (22:49 +0100)]
mt76: usb: fix possible memory leak in mt76u_buf_free

Move q->ndesc initialization before the for loop in mt76u_alloc_rx
since otherwise allocated urbs will not be freed in mt76u_buf_free
Double-check scatterlist pointer in mt76u_buf_free

Fixes: b40b15e1521f ("mt76: add usb support to mt76 layer")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: usb: fix possible NULL pointer dereference in mt76u_mcu_deinit
Lorenzo Bianconi [Sun, 10 Feb 2019 21:49:13 +0000 (22:49 +0100)]
mt76: usb: fix possible NULL pointer dereference in mt76u_mcu_deinit

Fix possible NULL pointer dereference in mt76u_mcu_deinit routine that
can occur if initialization path fails before calling mt76u_mcu_init_rx

Fixes: ee676cd5017c ("mt76: add driver code for MT76x2u based devices")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02u: use usb_bulk_msg to upload firmware
Stanislaw Gruszka [Mon, 11 Feb 2019 08:16:14 +0000 (09:16 +0100)]
mt76x02u: use usb_bulk_msg to upload firmware

We don't need to send firmware data asynchronously, much simpler is just
use synchronous usb_bulk_msg().

Tested-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x0: init: introduce mt76x0_init_txpower routine
Lorenzo Bianconi [Mon, 28 Jan 2019 09:31:13 +0000 (10:31 +0100)]
mt76x0: init: introduce mt76x0_init_txpower routine

Add mt76x0_init_txpower in order to initialize max_power per channel
at device bootstrap. Modify mt76x0_get_tx_power_per_rate and
mt76x0_get_power_info signature in order to compute tx power for
non-operating channels

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x0: phy: report target_power in debugfs
Lorenzo Bianconi [Mon, 28 Jan 2019 09:31:12 +0000 (10:31 +0100)]
mt76x0: phy: report target_power in debugfs

Initialize target_power variable in mt76x0_phy_set_txpower in order to
report target_power in debugfs

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: change the return type of mt76_dma_attach()
Ryder Lee [Mon, 11 Feb 2019 02:13:41 +0000 (10:13 +0800)]
mt76: change the return type of mt76_dma_attach()

There is no need to retun 0 in mt76_dma_attach(), so switch it to void.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x2: remove mt76x2_alloc_device routine
Lorenzo Bianconi [Thu, 31 Jan 2019 16:55:57 +0000 (17:55 +0100)]
mt76x2: remove mt76x2_alloc_device routine

Remove mt76x2_alloc_device since it just runs mt76_alloc_device.
Move mt76_alloc_device call in mt76x2_probe

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x0: remove mt76x0u_alloc_device routine
Lorenzo Bianconi [Thu, 31 Jan 2019 16:55:56 +0000 (17:55 +0100)]
mt76x0: remove mt76x0u_alloc_device routine

Remove mt76x0u_alloc_device since it just runs mt76_alloc_device.
Move mt76_alloc_device call in mt76x0u_probe and in mt76x0e_probe

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x2u: remove mt76x2u_alloc_device routine
Lorenzo Bianconi [Thu, 31 Jan 2019 16:55:55 +0000 (17:55 +0100)]
mt76x2u: remove mt76x2u_alloc_device routine

Remove mt76x2u_alloc_device since it just runs mt76_alloc_device.
Move mt76_alloc_device call in mt76x2u_probe

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: move alloc_device common code in mt76_alloc_device
Lorenzo Bianconi [Thu, 31 Jan 2019 16:55:54 +0000 (17:55 +0100)]
mt76: move alloc_device common code in mt76_alloc_device

Move mt76x{0,2} alloc_device common code in mt76_alloc_device and
remove duplicated code

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: increase ED/CCA tx block threshold
Felix Fietkau [Sun, 3 Feb 2019 19:35:31 +0000 (20:35 +0100)]
mt76: increase ED/CCA tx block threshold

Block only when the busy time reaches 92%, as lower values can be reached with
heavy 802.11 traffic as well.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: measure the time between mt76x02_edcca_check runs
Felix Fietkau [Sun, 3 Feb 2019 13:41:22 +0000 (14:41 +0100)]
mt76: measure the time between mt76x02_edcca_check runs

Based on system load and time needed by other calibration runs, the time
between dev->mac_work runs can vary quite a bit.
Calculate busy time based on the actual time difference in order to avoid
potentially over-estimating busy time, which could lead to unnecessary tx
blocking.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: clear CCA timer stats in mt76x02_edcca_init
Felix Fietkau [Sun, 3 Feb 2019 13:15:58 +0000 (14:15 +0100)]
mt76: clear CCA timer stats in mt76x02_edcca_init

Avoid triggering too early

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: run MAC work every 100ms
Felix Fietkau [Sun, 3 Feb 2019 13:13:06 +0000 (14:13 +0100)]
mt76: run MAC work every 100ms

ED/CCA Tx blocking checks need to be run every 100 ms in order to avoid
triggering too late and keeping tx blocking on for too long

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: explicitly disable energy detect cca during scan
Felix Fietkau [Sun, 3 Feb 2019 12:59:06 +0000 (13:59 +0100)]
mt76: explicitly disable energy detect cca during scan

Avoid reusing the previous channel's tx blocking state

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: mt76x2: avoid running DPD calibration if tx is blocked
Felix Fietkau [Sun, 3 Feb 2019 12:52:12 +0000 (13:52 +0100)]
mt76: mt76x2: avoid running DPD calibration if tx is blocked

Doing so could lead to hangs

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: fix software encryption issues
Felix Fietkau [Thu, 31 Jan 2019 20:01:24 +0000 (21:01 +0100)]
mt76: fix software encryption issues

Software encrypted packets can be passed not just through the drv_tx callback,
but also through the intermediate tx queue.
In order to deal with that, move the override to mt76x02_mac_write_txwi and
also take care of filling in the per-packet rate information

Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: remove add_buf pointer in mt76_queue_ops
Lorenzo Bianconi [Thu, 7 Feb 2019 10:14:34 +0000 (11:14 +0100)]
mt76: remove add_buf pointer in mt76_queue_ops

Remove add_buf function pointer in mt76_queue_ops data structure since
it is no longer used

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: move mt76_dma_tx_queue_skb_raw in mt76-core module
Lorenzo Bianconi [Thu, 7 Feb 2019 10:10:57 +0000 (11:10 +0100)]
mt76: move mt76_dma_tx_queue_skb_raw in mt76-core module

Move mt76_dma_tx_queue_skb_raw routine in dma.c and add the
corresponding entry in mt76_queue_ops data structure.
mt76_dma_tx_queue_skb_raw  will be reused adding support for
mt7603 driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x0: mcu: remove useless commented configuration
Lorenzo Bianconi [Tue, 5 Feb 2019 15:52:25 +0000 (16:52 +0100)]
mt76x0: mcu: remove useless commented configuration

Remove useless commented out configuration in mt76x0u_load_firmware
routine

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: move mt76_mcu_rx_event in mt76-core
Lorenzo Bianconi [Mon, 4 Feb 2019 16:51:29 +0000 (17:51 +0100)]
mt76: move mt76_mcu_rx_event in mt76-core

Move mt76_mcu_rx_event i mt76-core module and remove duplicated code.
mt76_mcu_rx_event will be reused adding support for mt7603 driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: move mt76_mcu_get_response in mt76-core
Lorenzo Bianconi [Mon, 4 Feb 2019 16:51:28 +0000 (17:51 +0100)]
mt76: move mt76_mcu_get_response in mt76-core

Move mt76_mcu_get_response in mt76-core module and remove duplicated
code. mt76_mcu_get_response will be reused adding support for mt7603
driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: move mt76_mcu_msg_alloc in mt76-core
Lorenzo Bianconi [Mon, 4 Feb 2019 16:51:27 +0000 (17:51 +0100)]
mt76: move mt76_mcu_msg_alloc in mt76-core

Move mt76_mcu_msg_alloc in mt76-core module and remove duplicated code.
mt76_mcu_msg_alloc will be reused adding support for mt7603 driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x0: eeprom: fix VHT mcs{8,9} rate power offset
Lorenzo Bianconi [Tue, 5 Feb 2019 14:06:34 +0000 (15:06 +0100)]
mt76x0: eeprom: fix VHT mcs{8,9} rate power offset

Fix rate power configuration for VHT mcs 8 and 9 in
mt76x0_get_tx_power_per_rate. Moreover use the rate power
offset used for HT/VHT mcs 6 even for HT/VHT mcs 7

Fixes: b37bbc8c8251 ("mt76x0: remove eeprom dependency from mt76x0_set_tx_power_per_rate")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02: enable support for IBSS and MESH
Stanislaw Gruszka [Wed, 30 Jan 2019 16:02:19 +0000 (17:02 +0100)]
mt76x02: enable support for IBSS and MESH

Since we implement beconing on USB now, similar interfaces should be
supported for USB as are for MMIO. Tested only on IBSS mode and
AP mode (not enabled due to lack of PS buffering).

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76: beaconing fixes for USB
Stanislaw Gruszka [Wed, 30 Jan 2019 16:02:18 +0000 (17:02 +0100)]
mt76: beaconing fixes for USB

Configure beaconing on USB devices without PS buffering support.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02: init beacon config for mt76x2u
Stanislaw Gruszka [Wed, 30 Jan 2019 16:02:17 +0000 (17:02 +0100)]
mt76x02: init beacon config for mt76x2u

Initialize beaconing also on mt76x2u.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02: minor beaconing init changes
Stanislaw Gruszka [Wed, 30 Jan 2019 16:02:16 +0000 (17:02 +0100)]
mt76x02: minor beaconing init changes

Disable BEACON timer during init and configure interrupt registers
only for mmio devices.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02: initialize mutli bss mode when set up address
Stanislaw Gruszka [Wed, 30 Jan 2019 16:02:15 +0000 (17:02 +0100)]
mt76x02: initialize mutli bss mode when set up address

BSSID is not strtirct related with beaconing (for example we can have
2 STA vifs) and more related with MAC address, so initaize BSSID when
setting MAC address.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02: use commmon add interface for mt76x2u
Stanislaw Gruszka [Wed, 30 Jan 2019 16:02:14 +0000 (17:02 +0100)]
mt76x02: use commmon add interface for mt76x2u

Since we now support mt76x2u feature to allow set mac address
when creating interface in common code we can use it for
mt76x2u.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agomt76x02: use mask for vifs
Stanislaw Gruszka [Wed, 30 Jan 2019 16:02:13 +0000 (17:02 +0100)]
mt76x02: use mask for vifs

Use vif_mask to count interfaces to allow to set mac address in HW
if there is only one interface and report error if we create
interface with wrong BSSID resulting in already used index.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 years agoMerge tag 'iwlwifi-next-for-kalle-2019-02-14' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Mon, 18 Feb 2019 18:10:46 +0000 (20:10 +0200)]
Merge tag 'iwlwifi-next-for-kalle-2019-02-14' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

Fourth batch of iwlwifi patches intended for v5.1

* Work on the new debugging infrastructure continues;
* FTM (Fine Timing Measurement) initiator and responder implementation;
* Support for a new device family started;
* Bump supported FW API to 46;
* General bugfixes;
* Other cleanups;

5 years agoiwlwifi: mvm: stop static queues correctly
Avraham Stern [Sun, 20 Jan 2019 09:33:57 +0000 (11:33 +0200)]
iwlwifi: mvm: stop static queues correctly

AP interfaces still use some static TX queues (for probes,
broadcast and multicast frames). These queues were not stopped
correctly when the transport layer indicated the queue should be
stopped. As a result, when flushing the queues, new frames from
the overflow queue were tx'd, so the queues still had frames after
flushing. This ended up in an assert since trying to remove a station
with non-empty queues.

Fix it by stopping the static queues correctly when required.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg_ini: add early and after alive apply points to unified images
Shahar S Matityahu [Wed, 16 Jan 2019 08:25:55 +0000 (10:25 +0200)]
iwlwifi: dbg_ini: add early and after alive apply points to unified images

Add IWL_FW_INI_APPLY_EARLY and IWL_FW_INI_APPLY_AFTER_ALIVE apply points
to unified images.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: Do not return an error value on HW restart
Ilan Peer [Mon, 14 Jan 2019 13:57:44 +0000 (15:57 +0200)]
iwlwifi: mvm: Do not return an error value on HW restart

When HW restart is requested but not started yet, commands would not
be sent to the FW, and some function calls would return an error. In
case of iwl_mvm_mac_sta_state() returning an error value when a
station is removed can lead to an unneeded warning in
__sta_info_destroy_part2().

Handle this by setting the return value to 0, in case HW restart is
in progress.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: Don't warn on command failure during restart
Ilan Peer [Thu, 10 Jan 2019 16:07:23 +0000 (18:07 +0200)]
iwlwifi: mvm: Don't warn on command failure during restart

When HW restart is requested but not started yet, commands would not
be sent to the FW, and some function calls return an error. Such cases
can trigger unneeded warning messages, e.g., in iwl_mvm_mac_sta_state()
and iwl_mvm_bss_info_changed_station().

Handle a couple of these cases by also checking in the WARN_ON()
condition that HW restart is not requested.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg: buffer overflow in non_collect_ts_start array
Shahar S Matityahu [Thu, 17 Jan 2019 07:57:27 +0000 (09:57 +0200)]
iwlwifi: dbg: buffer overflow in non_collect_ts_start array

The size of the buffer is IWL_FW_TRIGGER_ID_NUM - 1 which is equal to
IWL_FW_TRIGGER_ID_HOST_CHANNEL_SWITCH_COMPLETE so if the driver receives
this trigger, it will cause a buffer overflow.

Solve this by increasing the buffer size by 1.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: fe1b7d6c2888 ("iwlwifi: add support for triggering ini triggers")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: fix the spatial reuse parsing for HE_TRIG PPDUs
Emmanuel Grumbach [Thu, 17 Jan 2019 03:49:24 +0000 (19:49 -0800)]
iwlwifi: mvm: fix the spatial reuse parsing for HE_TRIG PPDUs

The spatial reuse 4 words fields are fetched from the HE-SIGA
by the firmware and propagated to the driver through the
Rx info. This is useful to populate the radiotap header.

We were looking at the wrong place in the firmware data and
got bogus values. Fix that.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Fixes: bdf180c8d375 ("iwlwifi: mvm: change PHY data RX for HE radiotap")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg_ini: enable ignore consecutive trigger feature
Shahar S Matityahu [Sun, 13 Jan 2019 11:51:57 +0000 (13:51 +0200)]
iwlwifi: dbg_ini: enable ignore consecutive trigger feature

Enable ignore consecutive trigger feature which allows to configure the
driver to skip consecutive triggers from the same type.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: properly use delay option in dump trigger flow
Shahar S Matityahu [Sun, 13 Jan 2019 08:02:15 +0000 (10:02 +0200)]
iwlwifi: properly use delay option in dump trigger flow

Fix several issues related to dump delay:
1. In legacy dump trigger, use stop_delay field instead of trig_dis_ms.
2. ini delay is messured in usec so align both ini and legacy to usec.
3. schedule_delayed_work receives the delay value in jiffies so
translate the dump delay to jiffies.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: ea7cb8293874 ("iwlwifi: dbg: make trigger functions type agnostic")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: start using B-step for some 9000 devices
Luca Coelho [Mon, 14 Jan 2019 12:56:02 +0000 (14:56 +0200)]
iwlwifi: start using B-step for some 9000 devices

We don't support A-step for some device combinations anymore.  So
change them to use B-step, renaming and reorganizing the config
structures.  Additionally, fix one device that was using the wrong
configuration.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: add debug prints for FTM
Avraham Stern [Thu, 10 Jan 2019 15:44:17 +0000 (17:44 +0200)]
iwlwifi: mvm: add debug prints for FTM

Add debug prints for FTM results info. These prints are used by
tests automation.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: fix HE radiotap data4 for HE-TB PPDUs
Johannes Berg [Fri, 11 Jan 2019 09:58:37 +0000 (10:58 +0100)]
iwlwifi: mvm: fix HE radiotap data4 for HE-TB PPDUs

In HE-TB PPDUs (labeled HE-TRIG in radiotap), we were overwriting
the data4.spatial_reuse_1 field with the spatial reuse data that
the firmware gives us for SU/MU PPDUs. Fix that by moving that,
we are already setting the data4.spatial_reuse_{1,2,3,4} fields
in the TB PPDU case.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Fixes: 69f3ca8ed33d ("iwlwifi: mvm: show more HE radiotap data for TB PPDUs")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: add support for new FTM fw API
Avraham Stern [Mon, 7 Jan 2019 08:35:26 +0000 (10:35 +0200)]
iwlwifi: mvm: add support for new FTM fw API

The FTM new API uses API TLV bit 15. The driver mistakenly uses
this bit for beacon filter API, although no TLV was assigned for
the beacon filter API. For now, make beacon filter use bit 16
instead (not set by the fw anyway). Once a TLV is assigned to the
beacon filter API it should be updated.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwiwifi: mvm: Fix FW scan concurrency support assumptions
Ilan Peer [Wed, 9 Jan 2019 12:05:59 +0000 (14:05 +0200)]
iwiwifi: mvm: Fix FW scan concurrency support assumptions

- The FW supports up to 4 concurrent scans, so adjust the definitions
  accordingly.
- Only a single periodic scan is supported, so enforce it in the code.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: add a debug_enable op
Shahar S Matityahu [Tue, 1 Jan 2019 15:38:32 +0000 (17:38 +0200)]
iwlwifi: mvm: add a debug_enable op

D3 debug data is disabled by default. Currently it is done by tampering
the dump mask. Add an operation that will allow this to be changed
without recompilation.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: add force NMI for AX210 devices
Shaul Triebitz [Mon, 7 Jan 2019 14:36:09 +0000 (16:36 +0200)]
iwlwifi: add force NMI for AX210 devices

For AX210 devices, the periphry for forcing NMI
has changed.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: align to new periphery address space for AX210 family
Shaul Triebitz [Tue, 1 Jan 2019 12:03:23 +0000 (14:03 +0200)]
iwlwifi: align to new periphery address space for AX210 family

In AX210 family, UMAC periphery address space moved from
0xA00000 to 0xD00000.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg: temporarily skip periphery dump for AX210 devices
Shaul Triebitz [Tue, 1 Jan 2019 08:11:14 +0000 (10:11 +0200)]
iwlwifi: dbg: temporarily skip periphery dump for AX210 devices

Many periphery addresses have changed in AX210 devices.
Until sorting out which peripheries should be dumped, skip
that step for now.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: add support for 32kHz external clock indication
Haim Dreyfuss [Wed, 2 Jan 2019 10:52:20 +0000 (12:52 +0200)]
iwlwifi: mvm: add support for 32kHz external clock indication

In low power modes, the chip clock source for platform integrated
devices is 32kHz. It is generated internally and supplied by a crystal
oscillator. However using a 32kHz sourced from crystal oscillator
has high power penalty.

There is an option to get an external 32kHz clock from the platform. Past
experience shows that the reliability is platform dependent,
i.e. on some platforms it works good and on other it doesn’t.

Working from external clock will save 0.5 mW in sleep state, from overall
1.8mW that we have today, i.e. almost 30%.

Each OEM can enable or disable the use of the external 32kHz clock by
setting a BIOS configuration. In case the OEM configured to use 32kHz
external clock the driver will pass this indication to the FW.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: fix TX while flushing
Sara Sharon [Tue, 25 Dec 2018 10:16:32 +0000 (12:16 +0200)]
iwlwifi: pcie: fix TX while flushing

When flushing TX queues no new TX should go into the system.
However, in the following scenario we get TX:
1. Queues are stopped and there are packets in overflow queue
2. Station is removed and flush begins
3. Flush empties space, and reclaim path TXes SKB from overflow
   queue.

Note that the fact the queues are stopped during the process
doesn't matter - the packet will be TXed since the TX path
doesn't care if TX queues are stopped or not, just if there is
space in the queue, which there is, since we just freed a
packet.

A fix here is rather complicated, since the flow is very racy.

Change code not to warn if we are TXing from overflow TX.
In case there is TX from both overflow TX and TX path we will
miss a warning we optimally had, but we can live with that.

Make sure we don't return before overflow queue is empty, otherwise
we will think queues are empty, but they will be refilled, resulting
with assert.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Fixes: 3955525d5d17 ("iwlwifi: pcie: buffer packets to avoid overflowing Tx queues")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: bump FW API to 46 for 9000 and 22000 series
Johannes Berg [Mon, 10 Dec 2018 08:01:56 +0000 (09:01 +0100)]
iwlwifi: bump FW API to 46 for 9000 and 22000 series

Start supporting API version 46 where applicable.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: support beacon IE injection
Sara Sharon [Thu, 8 Nov 2018 07:53:48 +0000 (09:53 +0200)]
iwlwifi: mvm: support beacon IE injection

This is useful for automated tests.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: Fix possible NULL pointer dereference
Avraham Stern [Mon, 24 Dec 2018 08:59:13 +0000 (10:59 +0200)]
iwlwifi: mvm: Fix possible NULL pointer dereference

iwl_mvm_te_clear_data() is called for cleanup in case sending
the HOT_SPOT_CMD failed. However, in case sending the command
caused a fw error and restart (e.g. if the command is not supported)
then the te_data pointer may no longer be valid, which leads to
a NULL pointer dereference.

Fix it by checking that the te_data pointer is not NULL before
dereferencing it.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: do not fail on large amount of channels
Shaul Triebitz [Sun, 23 Dec 2018 11:09:50 +0000 (13:09 +0200)]
iwlwifi: do not fail on large amount of channels

Until supporting UHB (ultra high band) channels for
devices AX210, do not fail if number of channels reported
by firmware is greater than NL80211_MAX_SUPP_REG_RULES.
The Driver in that case will use only the non-UHB channels.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: add FW recovery flow
Mordechay Goodstein [Thu, 13 Dec 2018 21:04:51 +0000 (23:04 +0200)]
iwlwifi: add FW recovery flow

Add new API and TLV for the ability to send commands in the beginning
and end of reset flow.

The full flow of recovery is:

1. While loading FW, get address (from the TLV) of target buffer
   to read in case of reset
2. If an error/assert happens read the address data from step 1.
3. Reset the HW and load the FW.
4. Send the data read in step 2.
5. Add station keys
6. Send notification to FW that reset flow is done.

The main use of the recovery flow is for support in PN/SN recovery
when offloaded

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: introduce device family AX210
Shaul Triebitz [Mon, 19 Nov 2018 14:44:05 +0000 (16:44 +0200)]
iwlwifi: introduce device family AX210

Add new device family AX210.
Make the needed changes for this family.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg_ini: rewrite trigger flow and align to FW API changes
Shahar S Matityahu [Wed, 21 Nov 2018 08:45:05 +0000 (10:45 +0200)]
iwlwifi: dbg_ini: rewrite trigger flow and align to FW API changes

Trigger field ignore_default was changed to override_trig.
The first byte of the field indicates the driver to override existing
configuration or keep the previous one
The second byte of the field indicated the driver to replace the regions
of the previous trigger or to append new regions to it.

Change the way the active triggers are maintained to support trigger
override in different apply points.
Do this by making a trigger that updates at runtime by the
triggers that are being used in the different apply points.

In case of an assert, the driver does not reconfigure the triggers
and uses the old configuration which leads to undefined behavior.
Solve this by clearing the triggers in assert recovery flow.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: receive umac and lmac error table addresses from TLVs
Shahar S Matityahu [Tue, 24 Apr 2018 10:35:59 +0000 (13:35 +0300)]
iwlwifi: receive umac and lmac error table addresses from TLVs

TLV 54 holds umac debug related addresses.
TLV 55 holds lmac debug related addresses.
These TLVs aim to replace the alive notification data in the future.

Parse and keep error table addresses received from the TLVs
for both lmac and umac and use these addresses instead of the pointer
received from alive notification.

The feature supports only unified image.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: clean up NO_PSDU case
Johannes Berg [Mon, 10 Dec 2018 09:40:45 +0000 (10:40 +0100)]
iwlwifi: mvm: clean up NO_PSDU case

We now no longer have any special code in
iwl_mvm_pass_packet_to_mac80211(), so don't
need to pass NO_PSDU packets through it.
Stop doing so and clean up the code there.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: support FTM initiator
Johannes Berg [Wed, 5 Dec 2018 10:33:34 +0000 (11:33 +0100)]
iwlwifi: mvm: support FTM initiator

Add support for FTM initiator, i.e. peer measurements with FTM
if the firmware supports FTM.

Additionally, add two defines we depend on in
include/linux/ieee80211.h.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: support FTM responder
Johannes Berg [Wed, 5 Dec 2018 10:34:09 +0000 (11:34 +0100)]
iwlwifi: mvm: support FTM responder

Add support for FTM responder for hardware/firmware combinations
that advertise support for it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg_ini: implement monitor dram memory dump
Shahar S Matityahu [Sun, 16 Dec 2018 11:17:03 +0000 (13:17 +0200)]
iwlwifi: dbg_ini: implement monitor dram memory dump

Implement monitor dram memory dump in the new dump mechanism.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: mvm: don't require WOWLAN images when unified
Ido Yariv [Mon, 17 Dec 2018 14:35:20 +0000 (09:35 -0500)]
iwlwifi: mvm: don't require WOWLAN images when unified

WOWLAN images in unified firmwares should not be used, so don't require
them to support wowlan. This will allow to reduce the firmware's file
size.

Signed-off-by: Ido Yariv <idox.yariv@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dbg_ini: implement monitor sram memory dump
Shahar S Matityahu [Sun, 16 Dec 2018 12:02:29 +0000 (14:02 +0200)]
iwlwifi: dbg_ini: implement monitor sram memory dump

Implement monitor sram memory dump in the new dump mechanism.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: add TPT oriented prints
Sara Sharon [Mon, 17 Dec 2018 09:39:42 +0000 (11:39 +0200)]
iwlwifi: pcie: add TPT oriented prints

Currently there is no way to debug RX/TX paths using prints
without harming tpt. Add prints to debug RX allocation path.
We can still get 1.9 gbps with those on.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: dvm: don't use IWL_DL_FW_ERRORS
Sara Sharon [Mon, 17 Dec 2018 09:38:03 +0000 (11:38 +0200)]
iwlwifi: dvm: don't use IWL_DL_FW_ERRORS

Use IWL_DL_FW instead. This will free a bit for more
needed prints in newer devices.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: pcie: fix emergency path
Sara Sharon [Thu, 13 Dec 2018 12:47:40 +0000 (14:47 +0200)]
iwlwifi: pcie: fix emergency path

Allocator swaps the pending requests with 0 when it starts
working. This means that relying on it n RX path to decide if
to move to emergency is not always a good idea, since it may
be zero, but there are still a lot of unallocated RBs in the
system. Change allocator to decrement the pending requests on
real time. It is more expensive since it accesses the atomic
variable more times, but it gives the RX path a better idea
of the system's status.

Reported-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Fixes: 868a1e863f95 ("iwlwifi: pcie: avoid empty free RB queue")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agoiwlwifi: bump FW API to 45 for 9000 and 22000 series
Luca Coelho [Wed, 31 Oct 2018 09:15:30 +0000 (11:15 +0200)]
iwlwifi: bump FW API to 45 for 9000 and 22000 series

Start supporting API version 45 where applicable.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
5 years agorsi: fix indentation issue with a code block
Colin Ian King [Thu, 7 Feb 2019 12:11:41 +0000 (12:11 +0000)]
rsi: fix indentation issue with a code block

There is a block of code that is indented at the wrong level. Fix this
with extra tabbing.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoqtnfmac: enable WPA3 SAE support
Sergey Matyukevich [Tue, 5 Feb 2019 09:48:57 +0000 (09:48 +0000)]
qtnfmac: enable WPA3 SAE support

In the case of SAE AP, drivers offload authentication to user-space
software, e.g. hostapd. For FullMAC drivers the procedure is as follows.
If auth_type is SAE and user space indicates external authentication
capability, then driver requests authentication offload to user-space
software using cfg80211_external_auth_request call. From that point,
auth frame exchange is performed transparently for driver: user-space
software sends/receives mgmt frames using mgmt_tx/mgmt_frame_register
cfg80211 callbacks. As soon as authenitcation is completed, user-space
software notifies driver about its status using external_auth cfg80211
callback.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agoqtnfmac: enable WPA3 OWE support
Sergey Matyukevich [Tue, 5 Feb 2019 09:48:55 +0000 (09:48 +0000)]
qtnfmac: enable WPA3 OWE support

In the case of OWE, STA should be able to pass DH IEs from AP assoc
responses to wpa_s for processing. For this purpose DH IEs are
received from firmware in BSS_JOIN events and passed to wireless
core and then to wpa_s as additional optional rsp_ies parameter
for cfg80211_connect_result.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agorsi: fix for wowlan wakeup failure
Siva Rebbagondla [Mon, 4 Feb 2019 06:33:29 +0000 (12:03 +0530)]
rsi: fix for wowlan wakeup failure

During wowlan regression tests, sometimes radio is not waking up for wowlan
packet in coex mode. This is because of power save is enabled by default
in case of coex mode greater than one. Hence, disable power save in coex
mode to avoid radio loss.

Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agorsi: resolve power save issue after S4 resume
Siva Rebbagondla [Mon, 4 Feb 2019 06:33:28 +0000 (12:03 +0530)]
rsi: resolve power save issue after S4 resume

We are redownloading the firmware after S4 restore and observed in
stress test that mac80211 sometimes gives power save request after
resume which causes the firmware in bad state. mac_ops_resumed flag
is added to skip that request until initialisation is done and Keeping
power save state is NONE.

Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agorsi: fix wowlan wakeup issue for hibernate(S4)
Siva Rebbagondla [Mon, 4 Feb 2019 06:33:27 +0000 (12:03 +0530)]
rsi: fix wowlan wakeup issue for hibernate(S4)

At SDIO restore ieee80211_restart_hw() is getting called to restart all
MAC operations. This step is not required.
Returning 1 from mac80211_resume() will serve this purpose.

Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
5 years agorsi: add hci detach for hibernation and poweroff
Siva Rebbagondla [Mon, 4 Feb 2019 06:33:26 +0000 (12:03 +0530)]
rsi: add hci detach for hibernation and poweroff

As we missed to detach HCI, while entering power off or hibernation,
an extra hci interface gets created whenever system is woken up, to
avoid this we added hci_detach() in rsi_disconnect(), rsi_freeze(),
and rsi_shutdown() functions which are invoked for these tests.
This patch fixes the issue

Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>