OSDN Git Service

tomoyo/tomoyo-test1.git
2 years agossb: fix boolreturn.cocci warning
Jing Yangyang [Tue, 24 Aug 2021 06:13:41 +0000 (23:13 -0700)]
ssb: fix boolreturn.cocci warning

./include/linux/ssb/ssb_driver_extif.h:200:8-9:WARNING: return of 0/1 in
function 'ssb_extif_available' with return type bool

Return statements in functions returning bool should use true/false
instead of 1/0.

Generated by: scripts/coccinelle/misc/boolreturn.cocci

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210824061341.59255-1-deng.changcheng@zte.com.cn
2 years agointel: switch from 'pci_' to 'dma_' API
Christophe JAILLET [Sun, 22 Aug 2021 08:03:50 +0000 (10:03 +0200)]
intel: switch from 'pci_' to 'dma_' API

The wrappers in include/linux/pci-dma-compat.h should go away.

The patch has been generated with the coccinelle script below.

It has been hand modified to use 'dma_set_mask_and_coherent()' instead of
'pci_set_dma_mask()/pci_set_consistent_dma_mask()' when applicable.
This is less verbose.

It has been compile tested.

@@
@@
-    PCI_DMA_BIDIRECTIONAL
+    DMA_BIDIRECTIONAL

@@
@@
-    PCI_DMA_TODEVICE
+    DMA_TO_DEVICE

@@
@@
-    PCI_DMA_FROMDEVICE
+    DMA_FROM_DEVICE

@@
@@
-    PCI_DMA_NONE
+    DMA_NONE

@@
expression e1, e2, e3;
@@
-    pci_alloc_consistent(e1, e2, e3)
+    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)

@@
expression e1, e2, e3;
@@
-    pci_zalloc_consistent(e1, e2, e3)
+    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)

@@
expression e1, e2, e3, e4;
@@
-    pci_free_consistent(e1, e2, e3, e4)
+    dma_free_coherent(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_map_single(e1, e2, e3, e4)
+    dma_map_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_single(e1, e2, e3, e4)
+    dma_unmap_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4, e5;
@@
-    pci_map_page(e1, e2, e3, e4, e5)
+    dma_map_page(&e1->dev, e2, e3, e4, e5)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_page(e1, e2, e3, e4)
+    dma_unmap_page(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_map_sg(e1, e2, e3, e4)
+    dma_map_sg(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_unmap_sg(e1, e2, e3, e4)
+    dma_unmap_sg(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
+    dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_single_for_device(e1, e2, e3, e4)
+    dma_sync_single_for_device(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
+    dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
-    pci_dma_sync_sg_for_device(e1, e2, e3, e4)
+    dma_sync_sg_for_device(&e1->dev, e2, e3, e4)

@@
expression e1, e2;
@@
-    pci_dma_mapping_error(e1, e2)
+    dma_mapping_error(&e1->dev, e2)

@@
expression e1, e2;
@@
-    pci_set_dma_mask(e1, e2)
+    dma_set_mask(&e1->dev, e2)

@@
expression e1, e2;
@@
-    pci_set_consistent_dma_mask(e1, e2)
+    dma_set_coherent_mask(&e1->dev, e2)

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/f55043d0c847bfae60087707778563cf732a7bf9.1629619229.git.christophe.jaillet@wanadoo.fr
2 years agomwifiex: pcie: add reset_d3cold quirk for Surface gen4+ devices
Tsuchiya Yuto [Fri, 20 Aug 2021 14:20:50 +0000 (16:20 +0200)]
mwifiex: pcie: add reset_d3cold quirk for Surface gen4+ devices

To reset mwifiex on Surface gen4+ (Pro 4 or later gen) devices, it
seems that putting the wifi device into D3cold is required according
to errata.inf file on Windows installation (Windows/INF/errata.inf).

This patch adds a function that performs power-cycle (put into D3cold
then D0) and call the function at the end of reset_prepare().

Note: Need to also reset the parent device (bridge) of wifi on SB1;
it might be because the bridge of wifi always reports it's in D3hot.
When I tried to reset only the wifi device (not touching parent), it gave
the following error and the reset failed:

    acpi device:4b: Cannot transition to power state D0 for parent in D3hot
    mwifiex_pcie 0000:03:00.0: can't change power state from D3cold to D0 (config space inaccessible)

Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Jonas Dreßler <verdre@v0yd.nl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210820142050.35741-3-verdre@v0yd.nl
2 years agomwifiex: pcie: add DMI-based quirk implementation for Surface devices
Jonas Dreßler [Fri, 20 Aug 2021 14:20:49 +0000 (16:20 +0200)]
mwifiex: pcie: add DMI-based quirk implementation for Surface devices

This commit adds the ability to apply device-specific quirks to the
mwifiex driver. It uses DMI matching similar to the quirks brcmfmac uses
with dmi.c. We'll add identifiers to match various MS Surface devices,
which this is primarily meant for, later.

This commit is a slightly modified version of a previous patch sent in
by Tsuchiya Yuto.

Co-developed-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Jonas Dreßler <verdre@v0yd.nl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210820142050.35741-2-verdre@v0yd.nl
2 years agobrcmfmac: pcie: fix oops on failure to resume and reprobe
Ahmad Fatoum [Tue, 17 Aug 2021 06:35:22 +0000 (08:35 +0200)]
brcmfmac: pcie: fix oops on failure to resume and reprobe

When resuming from suspend, brcmf_pcie_pm_leave_D3 will first attempt a
hot resume and then fall back to removing the PCI device and then
reprobing. If this probe fails, the kernel will oops, because brcmf_err,
which is called to report the failure will dereference the stale bus
pointer. Open code and use the default bus-less brcmf_err to avoid this.

Fixes: 8602e62441ab ("brcmfmac: pass bus to the __brcmf_err() in pcie.c")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210817063521.22450-1-a.fatoum@pengutronix.de
2 years agobcma: Drop the unused parameter of bcma_scan_read32()
Zenghui Yu [Tue, 27 Jul 2021 02:52:32 +0000 (10:52 +0800)]
bcma: Drop the unused parameter of bcma_scan_read32()

As it had never been used since the initial commit 8369ae33b705 ("bcma: add
Broadcom specific AMBA bus driver").

Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210727025232.663-3-yuzenghui@huawei.com
2 years agobcma: Fix memory leak for internally-handled cores
Zenghui Yu [Tue, 27 Jul 2021 02:52:31 +0000 (10:52 +0800)]
bcma: Fix memory leak for internally-handled cores

kmemleak reported that dev_name() of internally-handled cores were leaked
on driver unbinding. Let's use device_initialize() to take refcounts for
them and put_device() to properly free the related stuff.

While looking at it, there's another potential issue for those which should
be *registered* into driver core. If device_register() failed, we put
device once and freed bcma_device structures. In bcma_unregister_cores(),
they're treated as unregistered and we hit both UAF and double-free. That
smells not good and has also been fixed now.

Fixes: ab54bc8460b5 ("bcma: fill core details for every device")
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210727025232.663-2-yuzenghui@huawei.com
2 years agoMerge commit 'e257d969f36503b8eb1240f32653a1afb3109f86' of git://git.kernel.org/pub...
Kalle Valo [Sun, 29 Aug 2021 10:20:48 +0000 (13:20 +0300)]
Merge commit 'e257d969f36503b8eb1240f32653a1afb3109f86' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

I think last commits in tag iwlwifi-next-for-kalle-2021-08-26 are not
ready yet so I'm skipping those and pulling an earlier commit. I
modified Luca's description below to not include the skipped commits.

iwlwifi patches for v5.15

* Support scanning hidden 6GHz networks;
* Some improvements in the FW error dumps;
* Add some HE capability flags
* A bunch of janitorial clean-ups;
* Clean-ups in the TX code;
* Small fix for SMPS;
* Support for a new hardware family (Bz);
* Small fix in the scan code;
* A bunch of changes in the D3 code, including new FW API;
* Finalize the refactoring of 6GHz scan;
* Initial changes in the SAR profile code;
* Fix reading one of our ACPI tables (WTAS);
* Support some new ACPI table revisions;
* Support new API of the WoWlan status FW notification;
* Fixes in SAR ACPI tables handling;
* Some debugging improvements;
* Fix in ROC;
* Support for new FW API versions;
* Support new FW command versions;
* Some other small fixes, clean-ups and improvements.

2 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Sun, 29 Aug 2021 08:56:22 +0000 (11:56 +0300)]
Merge ath-next from git://git./linux/kernel/git/kvalo/ath.git

ath.git patches for v5.15. Major changes:

wcn36xx

* allow firmware name to be overridden by DT

2 years agowilc1000: Convert module-global "isinit" to device-specific variable
David Mosberger-Tang [Sat, 28 Aug 2021 15:19:11 +0000 (15:19 +0000)]
wilc1000: Convert module-global "isinit" to device-specific variable

Move static "isinit" variable to wilc_spi structure to allow multiple
WILC1000 devices per machine.

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210828151346.3012697-1-davidm@egauge.net
2 years agobrcmfmac: Add WPA3 Personal with FT to supported cipher suites
Paweł Drewniak [Tue, 24 Aug 2021 22:13:30 +0000 (23:13 +0100)]
brcmfmac: Add WPA3 Personal with FT to supported cipher suites

This allows the driver to connect to BSSIDs supporting SAE with 802.11r.
Tested on Raspberry Pi 4 Model B (STA) and UniFi 6LR/OpenWRT 21.02.0-rc2.
AP was set to 'sae-mixed' (WPA2/3 Personal).

Signed-off-by: Paweł Drewniak <czajernia@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210824221330.3847139-1-czajernia@gmail.com
2 years agossb: Drop legacy header include
Linus Walleij [Sat, 21 Aug 2021 23:58:00 +0000 (01:58 +0200)]
ssb: Drop legacy header include

The SSB header only uses the legacy <linux/gpio.h> header to get
struct gpio_chip so inluce <linux/gpio/driver.h> which is the right
include to deal with gpio_chip.

Cc: Michael Buesch <m@bues.ch>
Cc: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210821235800.138817-1-linus.walleij@linaro.org
2 years agorsi: make array fsm_state static const, makes object smaller
Colin Ian King [Thu, 19 Aug 2021 12:50:18 +0000 (13:50 +0100)]
rsi: make array fsm_state static const, makes object smaller

Don't populate the array fsm_state on the stack but instead it
static const. Makes the object code smaller by 154 bytes:

Before:
   text    data     bss     dec     hex filename
   9213    3904       0   13117    333d .../wireless/rsi/rsi_91x_debugfs.o

After:
   text    data     bss     dec     hex filename
   8995    3968       0   12963    32a3 .../wireless/rsi/rsi_91x_debugfs.o

(gcc version 10.3.0)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210819125018.8577-1-colin.king@canonical.com
2 years agortlwifi: rtl8192de: Fix initialization of place in _rtl92c_phy_get_rightchnlplace()
Nathan Chancellor [Mon, 23 Aug 2021 22:20:14 +0000 (15:20 -0700)]
rtlwifi: rtl8192de: Fix initialization of place in _rtl92c_phy_get_rightchnlplace()

Clang warns:

drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c:901:6: warning:
variable 'place' is used uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
        if (chnl > 14) {
            ^~~~~~~~~
drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c:909:9: note:
uninitialized use occurs here
        return place;
               ^~~~~
drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c:901:2: note: remove
the 'if' if its condition is always true
        if (chnl > 14) {
        ^~~~~~~~~~~~~~~
drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c:899:10: note:
initialize the variable 'place' to silence this warning
        u8 place;
                ^
                 = '\0'
1 warning generated.

Commit 369956ae5720 ("rtlwifi: rtl8192de: Remove redundant variable
initializations") removed the initialization of place but it appears
that this removal was in the wrong function.

_rtl92c_phy_get_rightchnlplace() returns place's value at the end of the
function so now if the if statement is false, place never gets
initialized. Add that initialization back to address the warning.

place's initialization is not necessary in
rtl92d_get_rightchnlplace_for_iqk() as place is only used within the if
statement so it can be removed, which is likely what was intended in the
first place.

Fixes: 369956ae5720 ("rtlwifi: rtl8192de: Remove redundant variable initializations")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210823222014.764557-1-nathan@kernel.org
2 years agortw88: add quirk to disable pci caps on HP Pavilion 14-ce0xxx
Ugo Rémery [Sun, 22 Aug 2021 19:49:32 +0000 (14:49 -0500)]
rtw88: add quirk to disable pci caps on HP Pavilion 14-ce0xxx

8821CE causes random freezes on HP Pavilion 14-ce0019nf. Add a quirk
to disable pci ASPM capability.

Signed-off-by: Ugo Rémery <ugo.remery@gmail.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210822194932.29630-1-Larry.Finger@lwfinger.net
2 years agoath6kl: wmi: fix an error code in ath6kl_wmi_sync_point()
Dan Carpenter [Fri, 13 Aug 2021 11:34:38 +0000 (14:34 +0300)]
ath6kl: wmi: fix an error code in ath6kl_wmi_sync_point()

This error path is unlikely because of it checked for NULL and
returned -ENOMEM earlier in the function.  But it should return
an error code here as well if we ever do hit it because of a
race condition or something.

Fixes: bdcd81707973 ("Add ath6kl cleaned up driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210813113438.GB30697@kili
2 years agoath9k: fix sleeping in atomic context
Miaoqing Pan [Mon, 9 Aug 2021 04:05:16 +0000 (12:05 +0800)]
ath9k: fix sleeping in atomic context

The problem is that gpio_free() can sleep and the cfg_soc() can be
called with spinlocks held. One problematic call tree is:

--> ath_reset_internal() takes &sc->sc_pcu_lock spin lock
   --> ath9k_hw_reset()
      --> ath9k_hw_gpio_request_in()
         --> ath9k_hw_gpio_request()
            --> ath9k_hw_gpio_cfg_soc()

Remove gpio_free(), use error message instead, so we should make sure
there is no GPIO conflict.

Also remove ath9k_hw_gpio_free() from ath9k_hw_apply_gpio_override(),
as gpio_mask will never be set for SOC chips.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1628481916-15030-1-git-send-email-miaoqing@codeaurora.org
2 years agoath9k: fix OOB read ar9300_eeprom_restore_internal
Zekun Shen [Sat, 19 Jun 2021 13:29:14 +0000 (09:29 -0400)]
ath9k: fix OOB read ar9300_eeprom_restore_internal

Bad header can have large length field which can cause OOB.
cptr is the last bytes for read, and the eeprom is parsed
from high to low address. The OOB, triggered by the condition
length > cptr could cause memory error with a read on
negative index.

There are some sanity check around length, but it is not
compared with cptr (the remaining bytes). Here, the
corrupted/bad EEPROM can cause panic.

I was able to reproduce the crash, but I cannot find the
log and the reproducer now. After I applied the patch, the
bug is no longer reproducible.

Signed-off-by: Zekun Shen <bruceshenzk@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/YM3xKsQJ0Hw2hjrc@Zekuns-MBP-16.fios-router.home
2 years agowcn36xx: Fix missing frame timestamp for beacon/probe-resp
Loic Poulain [Thu, 26 Aug 2021 15:46:08 +0000 (17:46 +0200)]
wcn36xx: Fix missing frame timestamp for beacon/probe-resp

When receiving a beacon or probe response, we should update the
boottime_ns field which is the timestamp the frame was received at.
(cf mac80211.h)

This fixes a scanning issue with Android since it relies on this
timestamp to determine when the AP has been seen for the last time
(via the nl80211 BSS_LAST_SEEN_BOOTTIME parameter).

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1629992768-23785-1-git-send-email-loic.poulain@linaro.org
2 years agowcn36xx: Allow firmware name to be overridden by DT
Bjorn Andersson [Tue, 24 Aug 2021 17:12:25 +0000 (10:12 -0700)]
wcn36xx: Allow firmware name to be overridden by DT

The WLAN NV firmware blob differs between platforms, and possibly
devices, so add support in the wcn36xx driver for reading the path of
this file from DT in order to allow these files to live in a generic
file system (or linux-firmware).

For some reason the parent (wcnss_ctrl) also needs to upload this blob,
so rather than specifying the same information in both nodes wcn36xx
reads the string from the parent's of_node.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Tested-by: Aníbal Limón <anibal.limon@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210824171225.686683-1-bjorn.andersson@linaro.org
2 years agowcn36xx: Ensure finish scan is not requested before start scan
Joseph Gates [Wed, 18 Aug 2021 11:31:43 +0000 (13:31 +0200)]
wcn36xx: Ensure finish scan is not requested before start scan

If the operating channel is the first in the scan list, it was seen that
a finish scan request would be sent before a start scan request was
sent, causing the firmware to fail all future scans. Track the current
channel being scanned to avoid requesting the scan finish before it
starts.

Cc: <stable@vger.kernel.org>
Fixes: 5973a2947430 ("wcn36xx: Fix software-driven scan")
Signed-off-by: Joseph Gates <jgates@squareup.com>
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1629286303-13179-1-git-send-email-loic.poulain@linaro.org
2 years agoiwlwifi: mvm: don't use FW key ID in beacon protection
Johannes Berg [Thu, 26 Aug 2021 19:47:43 +0000 (22:47 +0300)]
iwlwifi: mvm: don't use FW key ID in beacon protection

To check beacon protection had a mismatch of the key ID we
currently use the key ID from the firmware, but firmware
side we want to clean up the API to stop reporting this.

Instead, check the IWL_RX_MPDU_STATUS_KEY_VALID bit that
indicates that the firmware used the correct key, and if
that's set but we get invalid MIC/replay use the key ID
from the frame to look up the key and notify mac80211 of
MIC error or replay. Since both keys must have the same
cipher and thus MIC length, we can use either of them to
look up the MIC length.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210826224715.30e665d39b07.I78bf7d304ef5a80cecf5fa1c1fca0b51b956cceb@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: Fix scan channel flags settings
Ilan Peer [Thu, 26 Aug 2021 19:47:42 +0000 (22:47 +0300)]
iwlwifi: mvm: Fix scan channel flags settings

The iwl_mvm_scan_ch_n_aps_flag() is called with a variable
before the value of the variable is set. Fix it.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210826224715.f6f188980a5e.Ie7331a8b94004d308f6cbde44e519155a5be91dd@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: support broadcast TWT alone
Shaul Triebitz [Thu, 26 Aug 2021 19:47:41 +0000 (22:47 +0300)]
iwlwifi: mvm: support broadcast TWT alone

Tell the firmware about broadcast TWT support
even if individual TWT is not supported.
In that case the firmware will negotiate only
a broadcast TWT session.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210826224715.556934ed023a.I843677252be64f4732e434ab9ef72f487625e49e@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: introduce iwl_stored_beacon_notif_v3
Gregory Greenman [Thu, 26 Aug 2021 19:47:40 +0000 (22:47 +0300)]
iwlwifi: mvm: introduce iwl_stored_beacon_notif_v3

The new version sends station id in the notification. It's still not
used, but need to adjust the code since the offset of the data was
changed.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210826224715.87bc9e45c40b.I770493dc4a293ed8bdf059518e94dccf5dd1b3a7@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: move get pnvm file name to a separate function
Dror Moshe [Thu, 26 Aug 2021 19:47:39 +0000 (22:47 +0300)]
iwlwifi: move get pnvm file name to a separate function

Move code that generates the pnvm file name to a separate function,
so that it can be reused.

Signed-off-by: Dror Moshe <drorx.moshe@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210826224715.7d2dd18c75a2.I3652584755b9ab44909ddcd09ff4d80c6690a1ad@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: add support for responder config command version 9
Avraham Stern [Thu, 26 Aug 2021 19:47:38 +0000 (22:47 +0300)]
iwlwifi: mvm: add support for responder config command version 9

This version adds the following configuration options:
1. Enable/disable setting the session id in the FTM frame
2. Set the BSS color for the responder
3. Set the minimum and maximum time between measurements for
   non trigger based NDP ranging.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210826224715.0a10d43f3d7f.Ice4112c1910cf94babd1c2d492a3a3de9f7ee6cb@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: add support for range request command version 13
Avraham Stern [Thu, 26 Aug 2021 19:47:37 +0000 (22:47 +0300)]
iwlwifi: mvm: add support for range request command version 13

This version adds the following configuration options:
1. Set the BSS color for NDP ranging
2. Set the minimum and maximum time between measurements for
   non trigger based NDP ranging.
3. Terminate the session in case the responder requests LMR feedback.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210826224715.9dcd5210b7e5.I76f6977cde852de0f251344e279ad85076eef8d6@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: allow debug init in RF-kill
Johannes Berg [Thu, 19 Aug 2021 15:40:35 +0000 (18:40 +0300)]
iwlwifi: allow debug init in RF-kill

We can send this even if initializing in RF-kill, thus
suppressing a bunch of error messages about it. In fact,
we _want_ to, since we might still want to debug the
firmware even if in RF-kill.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.bcdb076609e2.I2d177c00772510b5338d8aa45af7558138b08448@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: don't schedule the roc_done_wk if it is already running
Avraham Stern [Thu, 19 Aug 2021 15:40:34 +0000 (18:40 +0300)]
iwlwifi: mvm: don't schedule the roc_done_wk if it is already running

When P2P roc is removed, the IWL_MVM_STATUS_NEED_FLUSH_P2P bit is set
to indicate to iwl_mvm_roc_done_wk() that the removed roc is a P2P
one, so it will flush the broadcast station and not the aux station.

However, since setting this bit and scheduling the worker is done
in roc ended flow as well as in case the roc is removed, there is
a race where the worker has already started running (but did not
test this bit yet) and then it is scheduled again. In this case,
the first run of the worker will clear this bit, and thus the second
run will find it already cleared and will try to flush and remove
the aux station by mistake.

Fix it by scheduling the worker only if this bit is not yet set. In
case this bit is already set, the worker is either running or
scheduled, so there is no need to re-schedule it.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.8c147659b331.If5924375e9bfd46214ab8ab81cb9d0f5c82fbcbc@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: yoyo: support for new DBGI_SRAM region
Mukesh Sisodiya [Thu, 19 Aug 2021 15:40:33 +0000 (18:40 +0300)]
iwlwifi: yoyo: support for new DBGI_SRAM region

new region handling is added  for dump collection.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.af9a24b82396.I53c5f82bd2d0f56fd699e3841c922082d99f1c90@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: add 'Rx control frame to MBSSID' HE capability
Shaul Triebitz [Thu, 19 Aug 2021 15:40:32 +0000 (18:40 +0300)]
iwlwifi: add 'Rx control frame to MBSSID' HE capability

'Rx control frame to MBSSID' is supported by HW and FW.
Add the capability to the HE mac capabilities.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.f3d6561dd8ee.I193d5331b43a1ecdae59eaedb37f0190a6d2311d@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: fw: fix debug dump data declarations
Johannes Berg [Thu, 19 Aug 2021 15:40:31 +0000 (18:40 +0300)]
iwlwifi: fw: fix debug dump data declarations

The debug dump ranges aren't just an array of such ranges
since each range has a variable size. Therefore, the use
of a struct array is misleading at best.

Change it to be a u8 data[] instead of the struct array,
the code doesn't significantly change since it's actually
doing things correctly now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.693c9891097d.Idcaab1fd659e8be2f56be647b2534befd61a4460@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: api: remove datamember from struct
Johannes Berg [Thu, 19 Aug 2021 15:40:30 +0000 (18:40 +0300)]
iwlwifi: api: remove datamember from struct

We don't use this, but we embed this struct elsewhere and
having structs with flexible arrays embedded isn't quite
right, with sparse (for example) complaining. Remove the
data[] member in this case.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.72ca1232b27c.I6ec766691b89670e1683f9fc0fbd12648309a574@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: fix __percpu annotation
Johannes Berg [Thu, 19 Aug 2021 15:40:29 +0000 (18:40 +0300)]
iwlwifi: fix __percpu annotation

Sparse warns about some type mismatches, which really is just
because of the strangely placed __percpu annotation. Put it
into the correct place.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.0a292b05fcf4.I7e89dfa6495143585021cb628ebb17d52e4588e5@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: pcie: avoid dma unmap/remap in crash dump
Johannes Berg [Thu, 19 Aug 2021 15:40:28 +0000 (18:40 +0300)]
iwlwifi: pcie: avoid dma unmap/remap in crash dump

DMA-API debug code pointed out that in this code path we
never check the return value of dma_map_page(), which could
fail.

However, we don't really even want to unmap/remap, we just
want to ensure that we can actually access the last version
of the data that the (now-dead) device may have written, so
only need to dma_sync_single_for_cpu() instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.5987f35883a2.I2d9ea5ecc69a5e5947b546fb15f33363a0595651@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: acpi: fill in SAR tables with defaults
Luca Coelho [Thu, 19 Aug 2021 15:40:27 +0000 (18:40 +0300)]
iwlwifi: acpi: fill in SAR tables with defaults

If the tables we get in the iwl_sar_set_profile() is smaller than the
revision we support, we need to fill the values with 0.  Make sure
that's the case.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.7fb9716db7ba.I75541846e0720f80695186ba39398133c8758280@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: acpi: fill in WGDS table with defaults
Luca Coelho [Thu, 19 Aug 2021 15:40:26 +0000 (18:40 +0300)]
iwlwifi: acpi: fill in WGDS table with defaults

The tables we store are the larger of all the revisions, so we need to
fill in the values that we don't get from ACPI when using older
revisions.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.01b12461a30b.I08d1f9154f26eca25c44616efdb5223bcc1935f3@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: bump FW API to 65 for AX devices
Luca Coelho [Thu, 19 Aug 2021 15:40:25 +0000 (18:40 +0300)]
iwlwifi: bump FW API to 65 for AX devices

Start supporting API version 65 for AX devices.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.1cb15b015485.I2818924b772d7518f4d9fc38b4caab3494ab11f9@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: acpi: support reading and storing WGDS revision 2
Luca Coelho [Thu, 5 Aug 2021 11:21:58 +0000 (14:21 +0300)]
iwlwifi: acpi: support reading and storing WGDS revision 2

Revisions 0 and 1 are identical, so we were already supporting that.
But revision 2 has a different size, so we have to try to read them
separately.

Add support for this new revision.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.78e441b16f9c.I2d79492f05624ddd02c533c673811a36eaf8a396@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: load regdomain at INIT stage
Miri Korenblit [Thu, 5 Aug 2021 11:21:57 +0000 (14:21 +0300)]
iwlwifi: mvm: load regdomain at INIT stage

We used to load the regdomain only in the load stage,
this caused the 'iw phy phy0 reg get' command to fail if we
booted a machine with wifi off.
Therefor we should load it in INIT stage already.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.a6077801d7d5.I7d8d5c895bc467efbf81ea055dde366ea01cced1@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: Read the PPAG and SAR tables at INIT stage
Miri Korenblit [Thu, 5 Aug 2021 11:21:56 +0000 (14:21 +0300)]
iwlwifi: mvm: Read the PPAG and SAR tables at INIT stage

We used to read the PPAG, WRDS, EWRD, WGDS tables from ACPI
in the load stage only. This prevented vendor commands from
being executed before bringing the interface up. Move reading those tables
to INIT stage.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.ce3b60f0b426.I3643bf00e714aae930880cc7d6cf390b142eaccb@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: trigger WRT when no beacon heard
Shaul Triebitz [Thu, 5 Aug 2021 11:21:55 +0000 (14:21 +0300)]
iwlwifi: mvm: trigger WRT when no beacon heard

If the session protection ends but no beacon was
heard, the driver triggers a disconnection.
Trigger WRT in that case so it can be debugged.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.7bf71939826b.Id73f1a466929670f5ec54301227d68883afd9207@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: fw: correctly limit to monitor dump
Johannes Berg [Thu, 5 Aug 2021 11:21:54 +0000 (14:21 +0300)]
iwlwifi: fw: correctly limit to monitor dump

In commit 79f033f6f229 ("iwlwifi: dbg: don't limit dump decisions
to all or monitor") we changed the code to pass around a bitmap,
but in the monitor_only case, one place accidentally used the bit
number, not the bit mask, resulting in CSR and FW_INFO getting
dumped instead of monitor data. Fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.774fd8729a33.Ic985a787071d1c0b127ef0ba8367da896ee11f57@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: skip first element in the WTAS ACPI table
Abhishek Naik [Thu, 5 Aug 2021 11:21:53 +0000 (14:21 +0300)]
iwlwifi: skip first element in the WTAS ACPI table

By mistake we were considering the first element of the WTAS wifi
package as part of the data we want to rid, but that element is the wifi
package signature (always 0x07), so it should be skipped.

Change the code to read the data starting from element 1 instead.

Signed-off-by: Abhishek Naik <abhishek.naik@intel.com>
Fixes: 28dd7ccdc56f ("iwlwifi: acpi: read TAS table from ACPI and send it to the FW")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.ff8148197b15.I70636c04e37b2b57a5df3ce611511f62203d27a7@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: support version 11 of wowlan statuses notification
Gregory Greenman [Thu, 5 Aug 2021 11:21:52 +0000 (14:21 +0300)]
iwlwifi: mvm: support version 11 of wowlan statuses notification

The new version of the command has same size and layout as
version 10. It just sends corresponding station id in one
of the reserved fields. It's not used in the driver, so just
be ready to accept version 11.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.0a387598eef1.I3be0bbf603ef95c644218be8a12b329411f11646@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: convert flat GEO profile table to a struct version
Luca Coelho [Thu, 5 Aug 2021 11:21:51 +0000 (14:21 +0300)]
iwlwifi: convert flat GEO profile table to a struct version

The GEO profiles have been stored in single-dimension arrays and the
access has been done via a single index.  We will soon need to support
different revisions of this table, which will make the flat array even
harder to handle.  To prepare for that, convert the single-dimension
array to a struct with substructures.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.56f3506411a2.I600ed3708d19f2263a5a8d143f6711d08499bbb0@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: remove unused ACPI_WGDS_TABLE_SIZE definition
Luca Coelho [Thu, 5 Aug 2021 11:21:50 +0000 (14:21 +0300)]
iwlwifi: remove unused ACPI_WGDS_TABLE_SIZE definition

When we started supporting the new FW API for the geo profiles, we
stopped using this definition, but left it there.  Remove it now.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.91dec6fad3e8.Ica42d5538d83b1407efe0c441c61aa8830e7496d@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: support reading and storing EWRD revisions 1 and 2
Luca Coelho [Thu, 5 Aug 2021 11:21:49 +0000 (14:21 +0300)]
iwlwifi: support reading and storing EWRD revisions 1 and 2

As an extension to the WRDS support for revisions 1 and 2, do the same
for the EWRD tables.  These tables have a very similar format to the
WRDS table, so most of the code is similar.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.2d5494de683c.Ia024b1368873d488906a639e29454cbbdc788d03@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: acpi: support reading and storing WRDS revision 1 and 2
Luca Coelho [Thu, 5 Aug 2021 11:21:48 +0000 (14:21 +0300)]
iwlwifi: acpi: support reading and storing WRDS revision 1 and 2

Change the SAR profile tables storage to revision 2 regardless of the
revision we read from ACPI.  Revision 2 is a superset of revision 1,
which is in turn a superset of revision 0, so they can all be stored
inside revision 2.

Add support for reading and storing also revisions 1 and 2, whose only
difference is the number of chains and number of sub-bands.  So most
of the code revolves around passing different chain and sub-band
sizes.

With this patch we still pass only revision 0 to the firmware, but
that will be changed in a separate patch.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.2edad09415c8.I36297aef90a9ec6a3ea1bf1a151a62f272826d59@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: pass number of chains and sub-bands to iwl_sar_set_profile()
Luca Coelho [Thu, 5 Aug 2021 11:21:47 +0000 (14:21 +0300)]
iwlwifi: pass number of chains and sub-bands to iwl_sar_set_profile()

The number of chains and sub-bands read from the ACPI tables varies
depending on the revision.  Pass these numbers to the
iwl_sar_set_profile() function in order to make using different
revisions easier.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.905b54c398f8.I9bac8c3bc3b1b6bbe813de53746daee33e53fc86@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: remove ACPI_SAR_NUM_TABLES definition
Luca Coelho [Thu, 5 Aug 2021 10:19:34 +0000 (13:19 +0300)]
iwlwifi: remove ACPI_SAR_NUM_TABLES definition

This definition was only used to pass the size of the tables in the FW
API to the iwl_sar_select_profile() function, but we should actually
pass the definition from the FW API file.  We don't have the concept
of tables in the ACPI definition, so we can remove it.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805130823.00b5084be918.I18efb3c45bffacfa9a356c2c8d34e5ffbb3eb423@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: convert flat SAR profile table to a struct version
Luca Coelho [Thu, 5 Aug 2021 10:19:33 +0000 (13:19 +0300)]
iwlwifi: convert flat SAR profile table to a struct version

The SAR profiles have been stored in single-dimension arrays and the
access has been done via a single index.  We will soon need to support
different revisions of this table, which will make the flat array even
harder to handle.  To prepare for that, convert the single-dimension
array to a struct with substructures.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805130823.01530088097f.I903c236a574c7e4c0fc4db101fc39c0f5415ca43@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: rename ACPI_SAR_NUM_CHAIN_LIMITS to ACPI_SAR_NUM_CHAINS
Luca Coelho [Thu, 5 Aug 2021 10:19:32 +0000 (13:19 +0300)]
iwlwifi: rename ACPI_SAR_NUM_CHAIN_LIMITS to ACPI_SAR_NUM_CHAINS

The "LIMITS" in the macro name don't have much meaning, so remove it
to make the macro shorter and better reflect that this is the number
of chains that we have limits for.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805130823.65591c9fa2af.Ie7e4ba94c903ef444cb07df61891394c11c7c864@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: fix access to BSS elements
Johannes Berg [Thu, 5 Aug 2021 10:19:31 +0000 (13:19 +0300)]
iwlwifi: mvm: fix access to BSS elements

BSS elements are protected using RCU, so we need to use
RCU properly to access them, fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805130823.fd8b5791ab44.Iba26800a6301078d3782fb249c476dd8ac2bf3c6@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: Refactor setting of SSIDs for 6GHz scan
Ilan Peer [Thu, 5 Aug 2021 10:19:30 +0000 (13:19 +0300)]
iwlwifi: mvm: Refactor setting of SSIDs for 6GHz scan

- Short SSIDs should always be added for direct SSIDs included
  in the scan request. However, this was not done in case that
  information for collocated APs was included. Fix this.
- With the above fix, if the FW also supports discovery of hidden
  APs over the 6GHz band, also set the corresponding full SSID
  information.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805130823.02512b7a1443.Ibb023b09b86179ed049a195f4e32e887c2f4971d@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: silently drop encrypted frames for unknown station
Avraham Stern [Thu, 5 Aug 2021 10:19:29 +0000 (13:19 +0300)]
iwlwifi: mvm: silently drop encrypted frames for unknown station

When a station is removed, the driver-mac80211 station mapping is removed
before the station is actually deleted from the FW. As a result, it is
reasonable that the FW will continue to pass frames although the driver
doesn't have a station for them anymore. Thus change the message
severity level from ERR to DEBUG_DROP.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805130823.a751177743c6.I5607504dade88ba461508643f58390dd661c05ba@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: d3: implement RSC command version 5
Johannes Berg [Thu, 5 Aug 2021 10:19:28 +0000 (13:19 +0300)]
iwlwifi: mvm: d3: implement RSC command version 5

In later firmware we haven't needed the TSC anyway since
we have it already (and firmware image doesn't change),
but the new version adds the ability to send down replay
counters for more than one GTK. Implement that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805130823.28cd065e8c4a.Ic8406a78ee46b07e0ca1b8199522ef08ec6eef53@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: d3: make key reprogramming iteration optional
Johannes Berg [Thu, 5 Aug 2021 10:19:27 +0000 (13:19 +0300)]
iwlwifi: mvm: d3: make key reprogramming iteration optional

Now that only reprogramming is left in the initial key iteration,
skip it entirely on unified firmware images instead of skipping
only the command sending inside of it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805130823.c6f77325c430.I798ce9d757492a9e3d223c1de5d4e62ebbc00b2c@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: d3: add separate key iteration for GTK type
Johannes Berg [Thu, 5 Aug 2021 10:19:26 +0000 (13:19 +0300)]
iwlwifi: mvm: d3: add separate key iteration for GTK type

If we're sending the KEK/KCK data we also need the GTK and
IGTK type, add a separate key iteration for that so we can
make the configure_key iteration optional later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805130823.c99f86423702.Icf7d4e93be77ea05a80235d01851ad0155593de9@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: d3: refactor TSC/RSC configuration
Johannes Berg [Thu, 5 Aug 2021 10:19:25 +0000 (13:19 +0300)]
iwlwifi: mvm: d3: refactor TSC/RSC configuration

Refactor the TSC/RSC configuration out from the normal wowlan
key iteration so we can replace it later with a different one
adapted to a different firmware API.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805130823.78e431c9aaeb.I5b83b8b30e3e7c04706a1f99b3970e4e5f36af9e@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: d3: remove fixed cmd_flags argument
Johannes Berg [Thu, 5 Aug 2021 10:19:24 +0000 (13:19 +0300)]
iwlwifi: mvm: d3: remove fixed cmd_flags argument

We only ever pass cmd_flags == CMD_ASYNC, so might as well
not have the argument. Remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805130823.9130db608b77.I352cbc35fefd98cc00aa0c69ea43863942aa62f5@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: d3: separate TKIP data from key iteration
Johannes Berg [Thu, 5 Aug 2021 10:19:23 +0000 (13:19 +0300)]
iwlwifi: mvm: d3: separate TKIP data from key iteration

We do a key iteration to program the keys, and while at it
we also collect the data necessary for TKIP. This code has
all kinds of dependencies on the firmware API though, so
take out the TKIP phase 1 key generation and do that in a
separate key iteration only if necessary.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805130823.80721fc0fd61.I5a8fbba4e3a9606f700ee41c7a4244dd5e2af935@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: simplify __iwl_mvm_set_sta_key()
Johannes Berg [Mon, 2 Aug 2021 18:58:56 +0000 (21:58 +0300)]
iwlwifi: mvm: simplify __iwl_mvm_set_sta_key()

There's no need to differentiate identical default and cipher
type cases, nor do we really need to have a 'ret' variable.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802215208.e89178b22fbf.I4d62baad9a9fdfd5c645a3cc5dbffb22feab5033@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: support new station key API
Johannes Berg [Mon, 2 Aug 2021 18:58:55 +0000 (21:58 +0300)]
iwlwifi: mvm: support new station key API

The new version 3 of the station key API has gotten rid of the
strange hole in the sequence counter values, support that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802215208.39a00ca1a1a6.Ifb4adeb4edd2b72232046dd2d59c0b3732f497c2@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: Fix umac scan request probe parameters
Ilan Peer [Mon, 2 Aug 2021 18:58:54 +0000 (21:58 +0300)]
iwlwifi: mvm: Fix umac scan request probe parameters

Both 'iwl_scan_probe_params_v3' and 'iwl_scan_probe_params_v4'
wrongly addressed the 'bssid_array' field which should supposed
to be any array of BSSIDs each of size ETH_ALEN and not the
opposite. Fix it.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802215208.04146f24794f.I90726440ddff75013e9fecbe9fa1a05c69e3f17b@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: pcie: implement Bz reset flow
Johannes Berg [Mon, 2 Aug 2021 18:58:53 +0000 (21:58 +0300)]
iwlwifi: pcie: implement Bz reset flow

Bz device reset flow changed, now the hardware (instead of
firmware) will reset the PCI bus etc., this can take up to
100ms.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802215208.df30875c6ff9.I962ed0f2c3358903dc6ba1abb65726ce5acbbd48@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: implement Bz NMI behaviour
Johannes Berg [Mon, 2 Aug 2021 18:58:52 +0000 (21:58 +0300)]
iwlwifi: implement Bz NMI behaviour

The method to NMI the firmware also changed in Bz devices,
implement the new logic.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802215208.c9bd2034dc05.I983c25caa09c3776c7640fff73fe739362ecc5b6@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: pcie: implement Bz device startup
Johannes Berg [Mon, 2 Aug 2021 18:58:51 +0000 (21:58 +0300)]
iwlwifi: pcie: implement Bz device startup

Device startup changed in Bz, some register bits moved around.
Change the code accordingly.

The new Bz hardware changes also the way we wake it (grab NIC
access) and the way we disable bus mastering, update the driver
code accordingly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802215208.00a137364a95.I059a2abac948965458862941ee7db6a2e1076fa6@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: read MAC address from correct place on Bz
Johannes Berg [Mon, 2 Aug 2021 18:58:50 +0000 (21:58 +0300)]
iwlwifi: read MAC address from correct place on Bz

On Bz devices, the MAC address CSRs changed from 0x380 to 0x30.
Change the boolean configuration "mac_addr_from_csr" to hold the
base address instead, and set it correctly for the different
devices using this feature.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802215208.928c7983f014.Ic5ba92d98946c1b4640280a05dcfd75119c0f0c0@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: give Bz devices their own name
Johannes Berg [Mon, 2 Aug 2021 18:58:49 +0000 (21:58 +0300)]
iwlwifi: give Bz devices their own name

The real name isn't determined yet, but give them a new
name that isn't clashing with older devices.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802215208.46b86c8074b2.I94d58b8e622ca87658dc05b05483fb954d526eab@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: split off Bz devices into their own family
Johannes Berg [Mon, 2 Aug 2021 18:58:48 +0000 (21:58 +0300)]
iwlwifi: split off Bz devices into their own family

These devices have some places with different behaviour
required, so split them off into their own family as they
should be.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802215208.90257303559f.I4c4342229dcb9513099a3152605f0947423e86dc@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: yoyo: cleanup internal buffer allocation in D3
Mukesh Sisodiya [Mon, 2 Aug 2021 18:58:47 +0000 (21:58 +0300)]
iwlwifi: yoyo: cleanup internal buffer allocation in D3

With recent changes in the firmware SRAM debug during D3 is
enabled by default and need not be enabled by driver.
cleaning the code to align the same.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802215208.8535203d0ef7.Ib1695ce5de921b0472d0b1052e729e071573b863@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: treat MMPDUs in iwl_mvm_mac_tx() as bcast
Johannes Berg [Mon, 2 Aug 2021 14:28:29 +0000 (17:28 +0300)]
iwlwifi: mvm: treat MMPDUs in iwl_mvm_mac_tx() as bcast

There's no need for all the complicated conditions here, any
bufferable MMPDUs or MMPDUs for client interfaces are already
coming through the TXQ interface, not iwl_mvm_mac_tx().

Simplify the logic.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802172232.3939f7c5c43a.I1d5cb5262e31a000023d79acbb897b8db50adf0d@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: clean up number of HW queues
Johannes Berg [Mon, 2 Aug 2021 14:28:28 +0000 (17:28 +0300)]
iwlwifi: mvm: clean up number of HW queues

Since switching to mac80211 TXQs, we no longer need to
advertise more hardware queues than ACs, since we don't
even set QUEUE_CONTROL anyway, so the vif->hw_queue[]
mapping array won't be used.

All we need (at least for now) is for hw->queues to
indicate that we have enough queues to handle QoS.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802172232.80611a3c1ee7.I8a3d2b269421b6d8bada8c12cce3e095e6cfaeed@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: avoid static queue number aliasing
Johannes Berg [Mon, 2 Aug 2021 14:28:27 +0000 (17:28 +0300)]
iwlwifi: mvm: avoid static queue number aliasing

When TVQM is enabled (iwl_mvm_has_new_tx_api() is true), then
queue numbers are just sequentially assigned 0, 1, 2, ...
Prior to TVQM, in DQA, there were some statically allocated
queue numbers:
 * IWL_MVM_DQA_AUX_QUEUE == 1,
 * both IWL_MVM_DQA_INJECT_MONITOR_QUEUE and
   IWL_MVM_DQA_P2P_DEVICE_QUEUE == 2, and
 * IWL_MVM_DQA_AP_PROBE_RESP_QUEUE == 9.

Now, these values are assigned to the members mvm->aux_queue,
mvm->snif_queue, mvm->probe_queue and mvm->p2p_dev_queue by
default. Normally, this doesn't really matter, and if TVQM is
in fact available we override them to the real values after
allocating a queue for use there.

However, this allocation doesn't always happen. For example,
for mvm->p2p_dev_queue (== 2) it only happens when the P2P
Device interface is started, if any. If it's not started, the
value in mvm->p2p_dev_queue remains 2. This wouldn't really
matter all that much if it weren't for iwl_mvm_is_static_queue()
which checks a queue number against one of those four static
numbers.

Now, if no P2P Device or monitor interface is added then queue
2 may be dynamically allocated, yet alias mvm->p2p_dev_queue or
mvm->snif_queue, and thus iwl_mvm_is_static_queue() erroneously
returns true for it. If it then gets full, all interface queues
are stopped, instead of just backpressuring against the one TXQ
that's really the only affected one.

This clearly can lead to issues, as everything is stopped even
if just a single TXQ filled its corresponding HW queue, if it
happens to have an appropriate number (2 or 9, AUX is always
reassigned.) Due to a mac80211 bug, this also led to a situation
in which the queues remained stopped across a deauthentication
and then attempts to connect to a new AP started failing, but
that's fixed separately.

Fix all of this by simply initializing the queue numbers to
the invalid value until they're used, if TVQM is enabled, and
also setting them back to that value when the queues are later
freed again.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802172232.2e47e623f9e2.I9b0830dafbb68ef35b7b8f0f46160abec02ac7d0@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: use DEFINE_MUTEX() for mutex lock
Zheng Yongjun [Mon, 2 Aug 2021 14:28:26 +0000 (17:28 +0300)]
iwlwifi: use DEFINE_MUTEX() for mutex lock

mutex lock can be initialized automatically with DEFINE_MUTEX()
rather than explicitly calling mutex_init().

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802172232.2a583d006739.Ia782c08525397b6430b1c877a870d688a7f3f494@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: remove trailing semicolon in macro definition
Tom Rix [Mon, 2 Aug 2021 14:28:25 +0000 (17:28 +0300)]
iwlwifi: remove trailing semicolon in macro definition

The macro use will already have a semicolon.

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802172232.3db450ebbb3c.Ic63f85b85a043256318da49d7b5a63f7dddf3986@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: fix a memory leak in iwl_mvm_mac_ctxt_beacon_changed
Zhang Qilong [Mon, 2 Aug 2021 14:28:24 +0000 (17:28 +0300)]
iwlwifi: mvm: fix a memory leak in iwl_mvm_mac_ctxt_beacon_changed

If beacon_inject_active is true, we will return without freeing
beacon.  Fid that by freeing it before returning.

Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
[reworded the commit message]
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802172232.d16206ca60fc.I9984a9b442c84814c307cee3213044e24d26f38a@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: fix old-style static const declaration
Wei Yongjun [Mon, 2 Aug 2021 14:28:23 +0000 (17:28 +0300)]
iwlwifi: mvm: fix old-style static const declaration

GCC reports warning as follows:

drivers/net/wireless/intel/iwlwifi/mvm/rfi.c:14:1: warning:
 'static' is not at beginning of declaration [-Wold-style-declaration]
   14 | const static struct iwl_rfi_lut_entry iwl_rfi_table[IWL_RFI_LUT_SIZE] = {
      | ^~~~~

Move static to the beginning of declaration.

Fixes: 21254908cbe9 ("iwlwifi: mvm: add RFI-M support")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802172232.f60b39bbb0c0.I8b0ad9105003d13cc4aa64fc957aec9582e8b26d@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: remove check for vif in iwl_mvm_vif_from_mac80211()
Luca Coelho [Mon, 2 Aug 2021 14:28:22 +0000 (17:28 +0300)]
iwlwifi: mvm: remove check for vif in iwl_mvm_vif_from_mac80211()

This check is useless, because we would return NULL in that case and
none of the callers actually check that the return value was not NULL
before accessing it.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802172232.f1c4844a2650.If4dc009e22cda51099a1dc4237d04bf4313055d6@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: pcie: remove spaces from queue names
Luca Coelho [Mon, 2 Aug 2021 14:28:21 +0000 (17:28 +0300)]
iwlwifi: pcie: remove spaces from queue names

If we use spaces in the queue names, we get files with spaces in their
name in procfs, which is ugly.  Remove the spaces.

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802172232.0ef8aedd4f9b.If527b9ae5bf8de8c6877d4b6a21ed8d81b0f877e@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: restrict FW SMPS request
Johannes Berg [Mon, 2 Aug 2021 14:28:20 +0000 (17:28 +0300)]
iwlwifi: mvm: restrict FW SMPS request

The firmware SMPS request should only be honoured if the
connection is currently with HE and on 160 MHz, so check
that and then potentially reapply any request if the BW
changes.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802172232.0cdcac5660da.I9ee7956fd4f48399855d1f97728bc58b36caf112@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: set replay counter on key install
Johannes Berg [Mon, 2 Aug 2021 14:28:19 +0000 (17:28 +0300)]
iwlwifi: mvm: set replay counter on key install

When installing a (new) key, set the replay counter so that
after FW restart the firmware has the correct value of the
replay counters.

This doesn't have a large effect - for frames that reach
the driver, it will do a replay check, and when installing
a new key, the counter is normally zero to start with (not
for GTK though, if joining the BSS for the first time).

Since this only affects frames handled entirely by the FW,
and that's restricted to a few unicast management frames,
the only affect here is for those after a firmware restart.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802172232.1cedf2ca7bb6.I2e609c28eaa301436e6740f4f1beca838f69a96a@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: remove trigger EAPOL time event
Mordechay Goodstein [Mon, 2 Aug 2021 14:28:18 +0000 (17:28 +0300)]
iwlwifi: mvm: remove trigger EAPOL time event

EAPOL failure results in deauthentication with various reasons, not
related to AUTH failure specifically, so we just merge AUTH failure
with failed to assoc to AP.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802172232.2ff350d85eab.I02c5b5d29c0d5c2e014bd1081b07ed33772ae04d@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: iwl-dbg-tlv: add info about loading external dbg bin
Mordechay Goodstein [Mon, 2 Aug 2021 14:09:44 +0000 (17:09 +0300)]
iwlwifi: iwl-dbg-tlv: add info about loading external dbg bin

This helps understand why and what debug capabilities are running.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802170640.98980f8bd17f.Ifcedf415a545a87cb341a4142085b5723d8cac4d@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: Add support for hidden network scan on 6GHz band
Ilan Peer [Mon, 2 Aug 2021 14:09:43 +0000 (17:09 +0300)]
iwlwifi: mvm: Add support for hidden network scan on 6GHz band

Add support for discovery of hidden networks on the 6GHz band,
by including the scan request direct SSIDs in the FW scan request
command:

- In case a short SSID matches one of the direct SSIDs in the scan
  request command, add the matching SSID in the same offset in the
  'direct_ssids' array.
- Otherwise, add the SSID in one of the available slots.

Additionally, as a preparation to handle hidden APs, refactor
iwl_mvm_umac_scan_cfg_channels_v6_6g() the function.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802170640.ffb540a70212.Ia2bb9bc9435b833820bcc7dc30adcedb5a5a9869@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: Do not use full SSIDs in 6GHz scan
Ilan Peer [Mon, 2 Aug 2021 14:09:42 +0000 (17:09 +0300)]
iwlwifi: mvm: Do not use full SSIDs in 6GHz scan

The scan request processing populated the direct SSIDs
in the FW scan request command also for 6GHz scan, which is not
needed and might result in unexpected behavior.

Fix the code to add the direct SSIDs only in case the scan
is not a 6GHz scan.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802170640.f465937c7bbf.Ic11a1659ddda850c3ec1b1afbe9e2b9577ac1800@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: print PNVM complete notification status in hexadecimal
Luca Coelho [Mon, 2 Aug 2021 14:09:41 +0000 (17:09 +0300)]
iwlwifi: print PNVM complete notification status in hexadecimal

This value is not a simple incrementing integer, it contains some
flags as well, so reading it in hexadecimal is easier.  Change the
print to do it in hex instead of decimal.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802170640.5e35f930d0ed.I5f94575a835f060bdc8ed3477871256f8a2cbaaa@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: pcie: dump error on FW reset handshake failures
Johannes Berg [Mon, 2 Aug 2021 14:09:40 +0000 (17:09 +0300)]
iwlwifi: pcie: dump error on FW reset handshake failures

If the firmware crashes while we're waiting for the reset
handshake then it cannot possibly make progress anymore,
and we will just time out the wait. That's pointless, so
just stop waiting at that point.

Additionally, if it never acknowledges the reset handshake,
something went wrong.

Dump an error in both of these cases, but we need to do it
synchronously here since the device will be turned off.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802170640.8b6a33544b4b.I55f97f70f8efa64db064a9207177a094c60ac8f1@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: prepare for synchronous error dumps
Johannes Berg [Mon, 2 Aug 2021 14:09:39 +0000 (17:09 +0300)]
iwlwifi: prepare for synchronous error dumps

In some cases it may be necessary to synchronously create
a firmware error report, add the necessary infrastructure
for this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802170640.481b6642f0fc.I7c9c958408a285e3d19aceed2a5a3341cfc08382@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: pcie: free RBs during configure
Johannes Berg [Mon, 2 Aug 2021 14:09:38 +0000 (17:09 +0300)]
iwlwifi: pcie: free RBs during configure

When switching op-modes, or more generally when reconfiguring,
we might switch the RB size. In _iwl_pcie_rx_init() we have a
comment saying we must free all RBs since we might switch the
size, but this is actually too late: the switch has been done
and we'll free the buffers with the wrong size.

Fix this by always freeing the buffers, if any, at the start
of configure, instead of only after the size may have changed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802170640.42d7c93279c4.I07f74e65aab0e3d965a81206fcb289dc92d74878@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: pcie: optimise struct iwl_rx_mem_buffer layout
Johannes Berg [Mon, 2 Aug 2021 14:09:37 +0000 (17:09 +0300)]
iwlwifi: pcie: optimise struct iwl_rx_mem_buffer layout

On 64-bit machines, struct iwl_rx_mem_buffer has a lot of
padding due to the use of pointers after the small items.
Move the list entry before them, and while at it also add
documentation for it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802170640.6a62255b3df0.I47bb36530a3c2cdbd73454c796ce608ee2a32a6c@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: avoid FW restart while shutting down
Johannes Berg [Mon, 2 Aug 2021 14:09:36 +0000 (17:09 +0300)]
iwlwifi: mvm: avoid FW restart while shutting down

If the firmware crashes while we're already shutting down
the system, there isn't much we can do since the shutdown
process is continuing and we wanted to do that. Don't do
a FW restart, with the implied debug collection, in this
case.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802170640.43a7351ae6bd.I164d48ce4379accf76ea0637983fd946d52dc6f5@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: nvm: enable IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF
Johannes Berg [Mon, 2 Aug 2021 14:09:35 +0000 (17:09 +0300)]
iwlwifi: nvm: enable IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF

The device is capable of receiving MU-MIMO frames with 8 symbols,
enable the bit here that says so.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802170640.90cf2eb42794.I692e6d0fde6e99a1db97d2e678952f043f48f603@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: set BROADCAST_TWT_SUPPORTED in MAC policy
Shaul Triebitz [Mon, 2 Aug 2021 14:09:34 +0000 (17:09 +0300)]
iwlwifi: mvm: set BROADCAST_TWT_SUPPORTED in MAC policy

If broadcast TWT is supported in the BSS, tell the
firmware about it by setting the BROADCAST_TWT_SUPPORTED
in the MAC context command.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802170640.736c3b1bc915.I10583bb6f808aa60954da26106bbc8c26620cbe8@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: iwl-nvm-parse: set STBC flags for HE phy capabilities
Mordechay Goodstein [Mon, 2 Aug 2021 14:09:33 +0000 (17:09 +0300)]
iwlwifi: iwl-nvm-parse: set STBC flags for HE phy capabilities

Our HW supersets STBC for HE but never set it in assoc IE, fix it by
setting it and enable using it.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802170640.0108f3e322b6.Ib25a91b5c48ff1fb2185b86a9e4bf5eec637df90@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoMerge branch 'pktgen-samples-next'
David S. Miller [Wed, 25 Aug 2021 12:44:30 +0000 (13:44 +0100)]
Merge branch 'pktgen-samples-next'

Juhee Kang says:

====================
samples: pktgen: enhance the ability to print the execution results of samples

This patch series improves the ability to print the execution result of pktgen
samples by adding a line which calls the function before termination and adding
trap SIGINT. Also, this series documents the latest pktgen usage options.

Currently, pktgen samples print the execution result when terminated usually.
However, sample03 is not working properly.

This is results of sample04 and sample03:

    # DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample04_many_flows.sh -n 1
    Running... ctrl^C to stop
    Device: eth0@0
    Result: OK: 19(c5+d13) usec, 1 (60byte,0frags)
    51762pps 24Mb/sec (24845760bps) errors: 0

    # DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample03_burst_single_flow.sh -n 1
    Running... ctrl^C to stop

Because sample03 doesn't call the function which prints the execution result
when terminated normally, unlike other samples. So the first commit solves
this issue by adding a line which calls the function before termination.

Also, all pktgen samples are able to send infinite messages per thread by
setting the count option to 0, and pktgen is stopped by Ctrl-C. However,
the sample besides sample{3...5} don't work appropriately because Ctrl-C stops
the script, not just pktgen.

This is results of samples:

    # DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample04_many_flows.sh -n 0
    Running... ctrl^C to stop
    ^CDevice: eth0@0
    Result: OK: 569657(c569538+d118) usec, 84650 (60byte,0frags)
    148597pps 71Mb/sec (71326560bps) errors: 0

    # DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample01_simple.sh -n 0
    Running... ctrl^C to stop
    ^C

    # DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample02_multiqueue.sh -n 0
    Running... ctrl^C to stop
    ^C

    # DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample06_numa_awared_queue_irq_affinity.sh -n 0
    Running... ctrl^C to stop
    ^C

    # DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_bench_xmit_mode_netif_receive.sh -n 0
    Running... ctrl^C to stop
    ^C

    # DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_bench_xmit_mode_queue_xmit.sh -n 0
    Running... ctrl^C to stop
    ^C

So the second commit solves this issue by adding trap SIGINT. Also, changes
control_c function to print_results to maintain consistency with other samples
on the first commit and second commit.

And current pktgen.rst documentation doesn't add the latest pktgen sample
usage options such as count and IPv6, and so on. Also, the old pktgen
sample scripts are still included in the document. The old scripts were removed
by the commit a4b6ade8359f ("samples/pktgen: remove remaining old pktgen
sample scripts").

Thus, the last commit documents the latest pktgen sample usage and removes
old sample scripts. And fixes a minor typo.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agopktgen: document the latest pktgen usage options
Juhee Kang [Wed, 25 Aug 2021 10:57:17 +0000 (19:57 +0900)]
pktgen: document the latest pktgen usage options

Currently, the pktgen.rst documentation doesn't cover the latest pktgen
sample usage options such as count and IPv6, and so on. Also, this
documentation includes the old sample scripts which are no longer use
because it was removed by the commit a4b6ade8359f ("samples/pktgen :
remove remaining old pktgen sample scripts")

Thus, this commit documents pktgen sample usage using the latest options
and removes old sample scripts, and fixes a minor typo.

Signed-off-by: Juhee Kang <claudiajkang@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agosamples: pktgen: add trap SIGINT for printing execution result
Juhee Kang [Wed, 25 Aug 2021 10:57:16 +0000 (19:57 +0900)]
samples: pktgen: add trap SIGINT for printing execution result

All pktgen samples can send indefinitely num messages per thread by
setting the count option to 0(-n 0). If running sample with setting
count 0 and press Ctrl-C to stop this program, the program prints the
result of the execution so far. Currently, the samples besides
sample{3...5} don't work properly. Because Ctrl-C stops the script, not
just pktgen.

This is results of samples:

    # DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample04_many_flows.sh -n 0
    Running... ctrl^C to stop
    ^CDevice: eth0@0
    Result: OK: 569657(c569538+d118) usec, 84650 (60byte,0frags)
    148597pps 71Mb/sec (71326560bps) errors: 0

    # DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample01_simple.sh -n 0
    Running... ctrl^C to stop
    ^C

In order to solve this, this commit adds trap SIGINT. Also, this commit
changes control_c function to print_result to maintain consistency with
other samples.

Signed-off-by: Juhee Kang <claudiajkang@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>