linux-block.git
7 months agowifi: mwifiex: Drop unused headers
Linus Walleij [Wed, 31 Jan 2024 22:37:23 +0000 (23:37 +0100)]
wifi: mwifiex: Drop unused headers

The mwifiex driver include two legacy GPIO headers but does
not use symbols from any of them.

The driver does contain some "gpio" handling code, but this
is some custom GPIO interface, not the Linux GPIO.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240131-descriptors-wireless-v1-4-e1c7c5d68746@linaro.org
7 months agowifi: brcmsmac: Drop legacy header
Linus Walleij [Wed, 31 Jan 2024 22:37:22 +0000 (23:37 +0100)]
wifi: brcmsmac: Drop legacy header

The driver is using all the modern abstractions to obtain and use
GPIOs and the legacy <linux/gpio.h> header is unused, so drop it.

Fixes: a8e59744e16b ("gpiolib: split linux/gpio/driver.h out of linux/gpio.h")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240131-descriptors-wireless-v1-3-e1c7c5d68746@linaro.org
7 months agowifi: ti: wlcore: sdio: Drop unused include
Linus Walleij [Wed, 31 Jan 2024 22:37:21 +0000 (23:37 +0100)]
wifi: ti: wlcore: sdio: Drop unused include

The file is including the legacy GPIO header <linux/gpio.h> but
is not using any symbols from it, drop the header.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240131-descriptors-wireless-v1-2-e1c7c5d68746@linaro.org
7 months agowifi: cw1200: fix __le16 sparse warnings
Kalle Valo [Tue, 30 Jan 2024 15:15:55 +0000 (17:15 +0200)]
wifi: cw1200: fix __le16 sparse warnings

Sparse warns:

drivers/net/wireless/st/cw1200/cw1200_spi.c:83:17:    got restricted __le16 [usertype]
drivers/net/wireless/st/cw1200/cw1200_spi.c:148:17: warning: incorrect type in assignment (different base types)
drivers/net/wireless/st/cw1200/cw1200_spi.c:148:17:    expected unsigned short [addressable] [assigned] [usertype] regaddr
drivers/net/wireless/st/cw1200/cw1200_spi.c:148:17:    got restricted __le16 [usertype]

These cpu_to_le16() calls are not really making any sense to me. On a big
endian system we first convert regaddr from big to little using cpu_to_le16()
but immediately after we convert them back to big endian? So just remove them.

Compile tested only.

Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240130151556.2315951-4-kvalo@kernel.org
7 months agowifi: rsi: fix restricted __le32 degrades to integer sparse warnings
Kalle Valo [Tue, 30 Jan 2024 15:15:54 +0000 (17:15 +0200)]
wifi: rsi: fix restricted __le32 degrades to integer sparse warnings

drivers/net/wireless/rsi/rsi_91x_usb.c:235:27: warning: restricted __le32 degrades to integer
drivers/net/wireless/rsi/rsi_91x_usb.c:236:27: warning: restricted __le32 degrades to integer
drivers/net/wireless/rsi/rsi_91x_usb.c:237:27: warning: restricted __le32 degrades to integer
drivers/net/wireless/rsi/rsi_91x_usb.c:238:27: warning: restricted __le32 degrades to integer
drivers/net/wireless/rsi/rsi_91x_usb.c:244:36: warning: restricted __le32 degrades to integer
drivers/net/wireless/rsi/rsi_91x_usb.c:245:35: warning: restricted __le32 degrades to integer

These cpu_to_le32() are not making sense. With usb_reg_buf we handle the values
byte at a time to make sure usb_reg_buf is in little endian so no need to
convert anything. And usb_control_msg() expects to have the values in native
endian anyway. So just remove these so they are not spamming our logs.

Compile tested only.

Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240130151556.2315951-3-kvalo@kernel.org
7 months agowifi: zd1211rw: remove __nocast from zd_addr_t
Kalle Valo [Tue, 30 Jan 2024 15:15:53 +0000 (17:15 +0200)]
wifi: zd1211rw: remove __nocast from zd_addr_t

Sparse warns:

drivers/net/wireless/zydas/zd1211rw/zd_usb.c:383:24: warning: implicit cast from nocast type
drivers/net/wireless/zydas/zd1211rw/zd_usb.c:419:24: warning: implicit cast from nocast type

This is an ancient driver which has not have any meaningfuli changes for a long
time and hopefully removed soon. So just remove the __nocast to get rid of the
sparse warnings.

Compile tested only.

Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240130151556.2315951-2-kvalo@kernel.org
7 months agowifi: rtl8xxxu: Add TP-Link TL-WN823N V2
Chun Qiu [Mon, 29 Jan 2024 05:30:30 +0000 (13:30 +0800)]
wifi: rtl8xxxu: Add TP-Link TL-WN823N V2

TP-Link TL-WN823N V2 (2357:0135) is based on rtl8192fu and has been
tested to work with the rtl8xxxu driver.

Signed-off-by: Chun Qiu <cqca@cock.lu>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240129053030.16369-1-cqca@cock.lu
7 months agowifi: libertas: fix some memleaks in lbs_allocate_cmd_buffer()
Zhipeng Lu [Fri, 26 Jan 2024 07:53:34 +0000 (15:53 +0800)]
wifi: libertas: fix some memleaks in lbs_allocate_cmd_buffer()

In the for statement of lbs_allocate_cmd_buffer(), if the allocation of
cmdarray[i].cmdbuf fails, both cmdarray and cmdarray[i].cmdbuf needs to
be freed. Otherwise, there will be memleaks in lbs_allocate_cmd_buffer().

Fixes: 876c9d3aeb98 ("[PATCH] Marvell Libertas 8388 802.11b/g USB driver")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240126075336.2825608-1-alexious@zju.edu.cn
7 months agowifi: cfg80211: fix kunit exports
Johannes Berg [Sun, 4 Feb 2024 10:03:39 +0000 (11:03 +0100)]
wifi: cfg80211: fix kunit exports

These can only be exported if cfg80211's kunit is enabled,
since they're otherwise static. kunit itself can be enabled
even if cfg80211's kunit isn't. Fix that by using the right
macro.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202402040534.6AEKtZ7Y-lkp@intel.com/
Fixes: 45d43937a44c ("wifi: cfg80211: add a kunit test for 6 GHz colocated AP parsing")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: fix warnings from dmi_get_system_info()
Johannes Berg [Sun, 4 Feb 2024 09:56:27 +0000 (10:56 +0100)]
wifi: iwlwifi: mvm: fix warnings from dmi_get_system_info()

dmi_get_system_info() will statically return NULL when the
kernel is compiled without CONFIG_DMI, leading to compiler
warnings. Fix that by printing "<unknown>" in that case.

Fixes: c3f40c3e0273 ("iwlwifi: mvm: add US/CA to TAS block list if OEM isn't allowed")
Fixes: 9457077df49e ("wifi: iwlwifi: mvm: Add debugfs to get TAS status")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: fw: fix compiler warning for NULL string print
Johannes Berg [Sun, 4 Feb 2024 09:53:18 +0000 (10:53 +0100)]
wifi: iwlwifi: fw: fix compiler warning for NULL string print

When the system is compiled without CONFIG_DMI, the function
here statically returns NULL, leading to a compiler warning.
Catch that and print "<unknown>" in that case.

While at it, fix some indentation in the function.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202402030641.zUTuACYV-lkp@intel.com/
Fixes: 09059c6764a8 ("wifi: iwlwifi: prepare for reading PPAG table from UEFI")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: fw: fix compile w/o CONFIG_ACPI
Johannes Berg [Sun, 4 Feb 2024 09:48:18 +0000 (10:48 +0100)]
wifi: iwlwifi: fw: fix compile w/o CONFIG_ACPI

The user of this function passes a pointer to a value that
doesn't exist when compiled w/o CONFIG_ACPI. Since we don't
need the value then, make the non-ACPI version a macro to
allow it to still build.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202402031454.syX4cSGN-lkp@intel.com/
Fixes: c4c954547755 ("wifi: iwlwifi: implement WPFC ACPI table loading")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: make functions public
Shaul Triebitz [Thu, 1 Feb 2024 14:17:41 +0000 (16:17 +0200)]
wifi: iwlwifi: mvm: make functions public

In the following patch, iwl_mvm_roc_duration_and_delay and
iwl_mvm_roc_add_cmd will be called also from time-event.c.
Move then there (where they more belong) and make then
public.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240201155157.3edafc4d59aa.Ic68e90758bcad9ae00e0aa602101842dac60e1a1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: bump FW API to 88 for AX/BZ/SC devices
Miri Korenblit [Thu, 1 Feb 2024 14:17:40 +0000 (16:17 +0200)]
wifi: iwlwifi: bump FW API to 88 for AX/BZ/SC devices

Start supporting API version 88 for new devices.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240201155157.e35556d3f956.I6543857041a33e2b35e67eecf648c9cc6972e60a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: don't send BT_COEX_CI command on new devices
Emmanuel Grumbach [Thu, 1 Feb 2024 14:17:38 +0000 (16:17 +0200)]
wifi: iwlwifi: mvm: don't send BT_COEX_CI command on new devices

AX210 and above have this logic offloaded in the firmware and it just
ignores the command coming from the driver.
Stop sending it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240201155157.4e3e0b52f98b.I7e9481050921d95c38f5a21ccc47112b3698e859@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: read DSM functions from UEFI
Miri Korenblit [Thu, 1 Feb 2024 14:17:37 +0000 (16:17 +0200)]
wifi: iwlwifi: read DSM functions from UEFI

For each DSM function, try to first read it from the UEFI.
If the UEFI WIFI GUID is unclocked, or the DSM function in
UEFI is invalid/unavailable - read it from ACPI.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240201155157.27dd626ce2bd.Ib90bab74a9d56deb2362edb712294360e4ddae5b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: prepare for reading DSM from UEFI
Miri Korenblit [Thu, 1 Feb 2024 14:17:36 +0000 (16:17 +0200)]
wifi: iwlwifi: prepare for reading DSM from UEFI

Move all the common items (functions, enumerations and mcaros)
to regulatory.h/c files, and rename it to a common name.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240201155157.eae9bcbc0023.If1175f3143d6369076669ddd5d6ad4df0ee00659@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: simplify getting DSM from ACPI
Miri Korenblit [Thu, 1 Feb 2024 14:17:35 +0000 (16:17 +0200)]
wifi: iwlwifi: simplify getting DSM from ACPI

As DSMs are going to be read from UEFI too, we need a unified API
to get DSMs for both ACPI and UEFI.

The difference in getting DSM in each one of these methods (ACPI, UEFI)
is in the GUID, revision (0 for ACPI, 4 for UEFI), and size of the DSM
values (8 or 32 for ACPI, 32 for UEFI).

Therefore, change the iwl_acpi_get_dsm_x() to iwl_acpi_get_dsm() which
determines the GUID, revision (these two are the same for all WiFi DSMs),
and size (based on a func-to-size mapping) internally.

While at it, fix DSM_FUNC_RFI_CONFIG to expect a 32-bit value
(as defined in Intel BIOS spec) and not a 8-bit one.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240201155157.1bcd7072a7a5.I344ee0a11abbc27da0c693187d1b8bee653aaeef@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: take send-DSM-to-FW flows out of ACPI ifdef
Miri Korenblit [Thu, 1 Feb 2024 14:17:34 +0000 (16:17 +0200)]
wifi: iwlwifi: take send-DSM-to-FW flows out of ACPI ifdef

These functions shouldn't be ACPI_CONFIG dependent, as they don't
access the ACPI. The functions that really access ACPI -
already handle the case that CONFIG_ACPI is not set.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240201155157.1412e6d561f8.I84f67478d01b576457e1bf489fbcb044adfda6fe@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: rfi: use a single DSM function for all RFI configurations
Miri Korenblit [Thu, 1 Feb 2024 14:17:33 +0000 (16:17 +0200)]
wifi: iwlwifi: rfi: use a single DSM function for all RFI configurations

RFI configuration moved from internal guid to the wifi guid, DSM
function 11. Update reading RFI configuration from BIOS.

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240201155157.f4e62435310d.I4f9b6860dd8e3c7ae1f816be5ff8b5967eee266f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: read ECKV table from UEFI
Miri Korenblit [Thu, 1 Feb 2024 14:17:32 +0000 (16:17 +0200)]
wifi: iwlwifi: read ECKV table from UEFI

Try to read the ECKV table from UEFI first,
and if the WIFI UEFI tables are unlocked or the
table doesn't exist - try to read it from ACPI.

Change iwl_acpi_get_eckv() to receive fwrt as argument so
it will be the same as all iwl_acpi_get_x() functions,
so it could  be generated by the macro.

While at it - move the reading of ECKV to INIT stage. There is no
reason to read it each time we load the FW.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240201155157.d4937cc00727.I36e5fc7f7850229b9b377c80b5203aa47137c97c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: read WRDD table from UEFI
Miri Korenblit [Thu, 1 Feb 2024 14:17:31 +0000 (16:17 +0200)]
wifi: iwlwifi: read WRDD table from UEFI

Try to read the WRDD table from UEFI first,
and if the WIFI UEFI tables are unlocked or the
table doesn't exist - try to read it from ACPI.

Change iwl_acpi_get_mcc() to receive fwrt as argument so
it will be the same as all iwl_acpi_get_x() functions,
so it could be generated by the macro.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240201155157.5d52eeb109f7.I4d81700a7ae7fe2dfee14e363de358be59de7823@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: support link command version 2
Shaul Triebitz [Thu, 1 Feb 2024 14:17:29 +0000 (16:17 +0200)]
wifi: iwlwifi: support link command version 2

In version 2, listen_lmac becomes reserved.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240201155157.df1890aba2fd.Icad9ba10f8bab770adc6a559b2c7bff5cccbffe9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: use fast balance scan in case of an active P2P GO
Ayala Beker [Thu, 1 Feb 2024 14:17:28 +0000 (16:17 +0200)]
wifi: iwlwifi: mvm: use fast balance scan in case of an active P2P GO

Set fast balance scan in case of active P2P GO, regardless of the
BSS DTIM interval.
This will increase the chances of scheduler to successfully schedule
out-of-channel events.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240201155157.310a00388e11.Ib136140dffa8704e68ff14e8fb69d35b97057171@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: don't send NDPs for new tx devices
Emmanuel Grumbach [Thu, 1 Feb 2024 14:17:27 +0000 (16:17 +0200)]
wifi: iwlwifi: mvm: don't send NDPs for new tx devices

New tx devices may have issues sending NDPs from the host.
Send a CQM event instead. If the AP is really gone, we will get a beacon
loss and disconnect.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Reviewed-by: Berg, Johannes <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240201155157.e95d53448e94.I0ec92f1ca56a62cd8c13390b9fe60e9a7e9411c7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: read SPLC from UEFI
Miri Korenblit [Thu, 1 Feb 2024 14:17:26 +0000 (16:17 +0200)]
wifi: iwlwifi: read SPLC from UEFI

Try to read the SPLC table from UEFI first,
and if the WIFI UEFI tables are unlocked or the
table doesn't exist - try to read it from ACPI

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240201155157.3d9d835b6edb.I7ea262df9431ced787b77c87149c6d7bddb7e7d6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: prepare for reading SPLC from UEFI
Miri Korenblit [Thu, 1 Feb 2024 14:17:25 +0000 (16:17 +0200)]
wifi: iwlwifi: prepare for reading SPLC from UEFI

As the iwl_bios_get_x() functions are now generated using a macro,
and this macro requires the all iwl_acpi_get_x() to have the same
prototype, change iwl_acpi_get_pwr_limit() to return a int
and the actuall power limit will be filled in a pointer function
parameter.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240201155157.4cce81198afe.Ice8b1b97a68da9ec7b5a4799ddb668642198e1af@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: api: clean up some kernel-doc/typos
Johannes Berg [Wed, 31 Jan 2024 21:02:27 +0000 (22:02 +0100)]
wifi: iwlwifi: api: clean up some kernel-doc/typos

Add some kernel-doc for a union, and fix a couple of typos
I noticed looking through this.

Link: https://msgid.link/20240131220227.7fd507f09bb1.I278edc9a3d5de7fddcd84009a93c494c42686b68@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: remove unused function prototype
Johannes Berg [Wed, 31 Jan 2024 21:00:39 +0000 (22:00 +0100)]
wifi: iwlwifi: remove unused function prototype

Saw this while going through the code, this function
hasn't existed for a while now; remove it.

Link: https://msgid.link/20240131220039.6fdb8cbf4814.I6c46065b836cafd93df676dd88c99a626a25bf46@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agoiwlwifi: fw: fix more kernel-doc warnings
Emmanuel Grumbach [Wed, 31 Jan 2024 20:38:16 +0000 (21:38 +0100)]
iwlwifi: fw: fix more kernel-doc warnings

Fix some more kernel-doc warnings in FW API definitions.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://msgid.link/20240131213817.9f30c6529216.I69e98612c6c81cf1b7bd480d8041b5d3e25610d3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: mac80211: don't allow deactivation of all links
Miri Korenblit [Mon, 29 Jan 2024 19:00:53 +0000 (20:00 +0100)]
wifi: mac80211: don't allow deactivation of all links

The set_active_links API is intended for link switching, so switching
to no links at all is not supported.
Add a warning to check that.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129200054.e3c113f94508.Ia35f927f914bf98dd8f9350dd4f78b1d901b1c1d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: mac80211_hwsim: enable all links only in MLO
Miri Korenblit [Mon, 29 Jan 2024 19:00:52 +0000 (20:00 +0100)]
wifi: mac80211_hwsim: enable all links only in MLO

The existing code is enabling all usable links when moving to
authorized state, but this should happen only for MLO connections.
Fix this.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129200054.f5459f6c29c8.I397814449e17950fcf882ef44a1e790a71aa1dce@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: nl80211: move WPA version validation to policy
Johannes Berg [Mon, 29 Jan 2024 18:54:21 +0000 (19:54 +0100)]
wifi: nl80211: move WPA version validation to policy

For a contiguous mask (starting with bit 0) of allowed values
in a bitmap, it's equivalent to check "!(val & ~mask)" and
"val âˆˆ [0, mask]". Use that to move the WPA versions check to
the policy, for better error reporting.

Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://msgid.link/20240129195421.e8cae9866ccb.I2539b395e3476307d702c6867e51a937e52e57a0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: mac80211: clean up FILS discovery change flags handling
Johannes Berg [Mon, 29 Jan 2024 18:57:39 +0000 (19:57 +0100)]
wifi: mac80211: clean up FILS discovery change flags handling

It doesn't make sense to return BSS change flags in an int, as
they're a bigger type. For this particular function it still
works OK, but clean it up to avoid future errors (or copying
this code in a broken way.)

Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://msgid.link/20240129195739.e340a7d5e7c6.I1dfcca32d43dce903494a2c474844491682671b4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: mac80211: trace SMPS requests from driver
Johannes Berg [Mon, 29 Jan 2024 18:54:35 +0000 (19:54 +0100)]
wifi: mac80211: trace SMPS requests from driver

Even if there are a lot of possible ways drivers might
call this, at least knowing when they do and with what
settings can be useful. Add tracing for it.

Link: https://msgid.link/20240129195435.b20d2ead2013.I8213e65c274451d523a3397519ac578c3ed2df4d@changeid
[removed link-id contortions as suggested by Jeff]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: mac80211_hwsim: add control to skip beacons
Johannes Berg [Mon, 29 Jan 2024 19:00:02 +0000 (20:00 +0100)]
wifi: mac80211_hwsim: add control to skip beacons

To test certain beacon loss scenarios it can be useful to
simply not send a couple of beacons. Add a simple debugfs
file (per vif) to skip sending the beacons. They're still
fully prepared etc. so their DTIM count etc. will appear
as if they were simply corrupt over the air or otherwise
not received.

Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://msgid.link/20240129200001.a267383709e6.I36f427d17c3478a7df46e205716f5ebc9b35a918@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: read WTAS table from UEFI
Miri Korenblit [Wed, 31 Jan 2024 08:24:47 +0000 (10:24 +0200)]
wifi: iwlwifi: read WTAS table from UEFI

Try to read the WTAS table from UEFI first,
and if the WIFI UEFI tables are unlocked or the
table doesn't exist - try to read it from ACPI.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131091413.45e6ff7b5063.Id3aec70887e14533b10d564f32c0cf5f2a14b792@changeid
[move uefi_tables_lock_status outside ifdef to fix build errors]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: separate TAS 'read-from-BIOS' and 'send-to-FW' flows
Miri Korenblit [Wed, 31 Jan 2024 08:24:46 +0000 (10:24 +0200)]
wifi: iwlwifi: separate TAS 'read-from-BIOS' and 'send-to-FW' flows

Currently the TAS 'read-from-BIOS' flow receives the command struct
and the version of it as read from FW TLVs, and fills the command
accordingly.
This seems wrong, we should have the 'read-from-BIOS' flow
(iwl_acpi_get_tas in iwlwifi) reading/parsing/validating the table from
BIOS, and the 'send-to-FW' flow (iwl_mvm_tas_init) doing
all the FW versioning checks and cmd filling.
Move the cmd filling to the 'send-to-fw' flow.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131091413.24df27772a71.I57b702af4feb3f38dc21d52593c25de4b1999e4b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: prepare for reading TAS table from UEFI
Miri Korenblit [Wed, 31 Jan 2024 08:24:45 +0000 (10:24 +0200)]
wifi: iwlwifi: prepare for reading TAS table from UEFI

We are going to support reading BIOS tables from UEFI
too, Refactor the TAS table flow:

1. Rename and move the common code to the regulatory.h/c files.
2. Remove the IWL_TAS_BLOCK_LIST_MAX, as we can use IWL_WTAS_BLACK_LIST_MAX
   instead.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131091413.0c2197cf1feb.Ib0e83d5bd3f4d5cfa9c3d2925317ba49377d257f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: don't check TAS block list size twice
Miri Korenblit [Wed, 31 Jan 2024 08:24:44 +0000 (10:24 +0200)]
wifi: iwlwifi: don't check TAS block list size twice

Currenltly we check the validity of this variable twice.
Remove the second check.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131091413.2234490624c4.I6399b652a3c83afff1b0b5f114604d15892ee01e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: read PPAG table from UEFI
Miri Korenblit [Wed, 31 Jan 2024 08:24:43 +0000 (10:24 +0200)]
wifi: iwlwifi: read PPAG table from UEFI

Try to read the PPAG table from UEFI first,
and if the WIFI UEFI tables are unlocked or the
table doesn't exist - try to read it from ACPI

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131091413.6516da09aec1.I0dcaf0b6d8857417ba1318467a28da5d0d7d7f27@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: validate PPAG table when sent to FW
Miri Korenblit [Wed, 31 Jan 2024 08:24:42 +0000 (10:24 +0200)]
wifi: iwlwifi: validate PPAG table when sent to FW

We used to check enablement/validity of the PPAG table while reading
it from BIOS.
For newer FWs this checks were offloaded, and the driver needs
to send the PPAG table anyway.
The desicion whether the table needs to be validated before sending it
is FW related and shouln't be in 'read-from-bios' flow.
Move it to 'send-to-fw' flow instead.
This will also help to avoid code duplication of checking validity in
both ACPI and UEFI caes.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131091413.7043b4087dda.I5a189f9a349556b84a79597fe1e46ffa93664df9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: prepare for reading PPAG table from UEFI
Miri Korenblit [Wed, 31 Jan 2024 08:24:41 +0000 (10:24 +0200)]
wifi: iwlwifi: prepare for reading PPAG table from UEFI

As PPAG table is going to be read from UEFI, there are some
cleanups required:
Move functions/definitions that are common to both UEFI and ACPI to
regulatory.h/c.
In addition, rename the functions/macros names so it will be clear which
one is ACPI specific, and which is common for ACPI and UEFI.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131091413.25623670b422.I8132af7517e4faf0ea8cbeb2efe9651edd319b98@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: small cleanups in PPAG table flows
Miri Korenblit [Wed, 31 Jan 2024 08:24:40 +0000 (10:24 +0200)]
wifi: iwlwifi: small cleanups in PPAG table flows

1. The name of iwl_read_ppag_table is misleading, as this function only
   fills the command structure from the previously read table. Rename it.
2. Don't initialize fwrt::ppag_flags to 0 as the entire fwrt is zeroed
   in the INIT stage anyway.
3. Don't filter out the reserved bits from fwrt::ppag_flags when printing
   it, as it is already done in 'read-from-bios' flow.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131091413.48acf340e817.I810e457b80015c1931d96d3e13c849f0339723c3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: read SAR tables from UEFI
Miri Korenblit [Wed, 31 Jan 2024 08:24:39 +0000 (10:24 +0200)]
wifi: iwlwifi: read SAR tables from UEFI

All the regulatory tables will be read from UEFI, and
only if it doesn't exist - they will be read from ACPI.
Read SAR tables (WRDS, EWRD and WGDS) from UEFI.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131091413.533b687e1efb.Icb316291e593c8d53f41fdea2d083367dc97e3c4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: cleanup sending PER_CHAIN_LIMIT_OFFSET_CMD
Miri Korenblit [Wed, 31 Jan 2024 08:24:38 +0000 (10:24 +0200)]
wifi: iwlwifi: cleanup sending PER_CHAIN_LIMIT_OFFSET_CMD

iwl_geo_tx_power_profiles_cmd::table_revision indicates whether
to use South Korea scheme or not.
We use South Korea scheme if the revision of WGDS table is 1.

We used to read the WGDS table from ACPI inside iwl_sar_geo_fill_table(),
so we had to set table_revision only after the call to it.
This added an extra if...else for each cmd version.

But it has been a while since we moved the BIOS tables reading to
INIT stage, and iwl_sar_geo_fill_table() is now only copying the
previously stored table to the cmd structure.

Set the table_revision before the call to iwl_sar_geo_fill_table()
and avoid that extra if...else.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131091413.17a2384d4535.I306570874f1da0c6345066ebbf74a04b6c8aeb37@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: prepare for reading SAR tables from UEFI
Miri Korenblit [Wed, 31 Jan 2024 08:24:37 +0000 (10:24 +0200)]
wifi: iwlwifi: prepare for reading SAR tables from UEFI

The driver will support reading BIOS tables from UEFI
too. Refactor the SAR tables (WRDS, EWRD, WGDS) flows:

1. Move all the SAR logic/definitions that is common to both
   UEFI and ACPI to a new file - regulatory.h/c.
2. Rename the relevant functions/definitions
   so it will be clear which is ACPI specific and which is
   for both ACPI and UEFI
3. Rename the function that copies the stored tables into the different
   commands structures, so will be clear what these functions do.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131091413.429a9baff34a.I040460348aa1b43609be3a317b86722d6be71c28@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: check AP supports EMLSR
Johannes Berg [Wed, 31 Jan 2024 08:24:36 +0000 (10:24 +0200)]
wifi: iwlwifi: mvm: check AP supports EMLSR

Before using EMLSR check the AP actually advertises
support for it, otherwise reject the link activation.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240131091413.edaac352488d.Ic3533afc6848591e8977391ae39c144d5e794d26@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: d3: implement suspend with MLO
Johannes Berg [Wed, 31 Jan 2024 08:24:35 +0000 (10:24 +0200)]
wifi: iwlwifi: mvm: d3: implement suspend with MLO

When using MLO, we need to have only a single link active
when entering suspend and of course most of the code also
needs to be adjusted to not use deflink, apart from older
code that's not used with MLO-capable firmware. Implement
that.

Note that the link selection currently prefers the "best"
link, which might really not be the best for D3, but that
can be fixed later once we agree.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240131091413.38f0fd4d2db0.I27c7a1d08aecc5da0af2c351212f22e92ed70219@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: read BIOS PNVM only for non-Intel SKU
Miri Korenblit [Wed, 31 Jan 2024 08:24:34 +0000 (10:24 +0200)]
wifi: iwlwifi: read BIOS PNVM only for non-Intel SKU

The driver is supposed to read the PNVM from BIOS only for non-Intel
SKUs. For Intel SKUs the OEM ID will be 0.
Read BIOS PNVM only when a non-Intel SKU is indicated.

Fixes: b99e32cbfdf6 ("wifi: iwlwifi: Take loading and setting of pnvm image out of parsing part")
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131091413.3625cf1223d3.Ieffda5f506713b1c979388dd7a0e1c1a0145cfca@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: cfg80211: tests: verify BSS use flags of NSTR links
Benjamin Berg [Mon, 29 Jan 2024 21:09:20 +0000 (22:09 +0100)]
wifi: cfg80211: tests: verify BSS use flags of NSTR links

Extend the test to pass an RNR appropriate for an NSTR and verify that
use_for as well as cannot_use_reasons are set correctly.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Link: https://msgid.link/20240129220918.b00aee4c4c9f.I942fddf51cabaab761de3865b4e06cce831a46ef@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: cfg80211: add a kunit test for 6 GHz colocated AP parsing
Benjamin Berg [Mon, 29 Jan 2024 21:09:19 +0000 (22:09 +0100)]
wifi: cfg80211: add a kunit test for 6 GHz colocated AP parsing

Test a few things around parsing of 6 GHz colocated APs to e.g. ensure
that we are not going to scan for a disabled (affiliated) AP.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Link: https://msgid.link/20240129220918.079dc50ab43b.Ide898d9f1d4c26d7e774d6fd0ec57766967d6572@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: refactor duplicate chanctx condition
Johannes Berg [Mon, 29 Jan 2024 19:22:03 +0000 (21:22 +0200)]
wifi: iwlwifi: mvm: refactor duplicate chanctx condition

Refactor the check for using a chanctx's def vs. min_def,
to have the same in both places and reuse it later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129211905.6fcde4051adf.I343934874612d21727ed167accaa967958b2c25b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: log dropped packets due to MIC error
Daniel Gabay [Mon, 29 Jan 2024 19:22:02 +0000 (21:22 +0200)]
wifi: iwlwifi: mvm: log dropped packets due to MIC error

When we drop frames due to MIC error we want to have something
printed in the logger (this won't be printed by default).

Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129211905.41b0abbf1fd2.Ib6ec6a48ec7bebe769d1e1c1df96380a758a0975@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: support SPP A-MSDUs
Johannes Berg [Mon, 29 Jan 2024 19:22:01 +0000 (21:22 +0200)]
wifi: iwlwifi: mvm: support SPP A-MSDUs

If the firmware has the necessary support, enable SPP A-MSDUs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129211905.15e4570e471f.I87cf284d3b19bb9f5558f0f33afaace6d6492acb@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: pcie: Add the PCI device id for new hardware
Mukesh Sisodiya [Mon, 29 Jan 2024 19:22:00 +0000 (21:22 +0200)]
wifi: iwlwifi: pcie: Add the PCI device id for new hardware

Add the support for a new PCI device id.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129211905.fde32107e0a3.I597cff4f340e4bed12b7568a0ad504bd4b2c1cf8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: fix the TLC command after ADD_STA
Emmanuel Grumbach [Mon, 29 Jan 2024 19:21:59 +0000 (21:21 +0200)]
wifi: iwlwifi: mvm: fix the TLC command after ADD_STA

ADD_STA resets the link quality data inside the firmware. This is not
supposed to happen and has been fixed for newer devices. For older
devices (AX201 and down), this makes us send frames with rates that are
not in the TLC table.

Fixes: 5a86dcb4a908 ("wifi: iwlwifi: mvm: update station's MFP flag after association")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129211905.1deca7eaff14.I597abd7aab36fdab4aa8311a48c98a3d5bd433ba@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: use FW rate for non-data only on new devices
Johannes Berg [Mon, 29 Jan 2024 19:21:58 +0000 (21:21 +0200)]
wifi: iwlwifi: mvm: use FW rate for non-data only on new devices

With MLO connections we need to let the firmware pick the rate
as we don't know the link the frame might be transmitted on
(in some cases we do know, but we'd rather always use the FW
and find bugs.) We _did_ end up finding bugs and fixing them,
but older devices likely won't get fixed as we don't have a
need for this there, they cannot support MLO.

Thus, go back to picking a rate on the host for the relevant
frames on older (pre-Bz) devices.

Fixes: 499d02790495 ("wifi: iwlwifi: Use FW rate for non-data frames")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129211905.e59056d0a8cc.Iccc4c5c1753921d3d85241ede812a150fb05b898@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: remove Gl A-step remnants
Johannes Berg [Mon, 29 Jan 2024 19:21:57 +0000 (21:21 +0200)]
wifi: iwlwifi: remove Gl A-step remnants

The IWL_DEVICE_GL_A macro is no longer used, and couldn't
be, so remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129211905.8929a06c3a55.I3c21305e4b7fa3aba938bc860269e848fe262e88@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: Fix FTM initiator flags
Ilan Peer [Mon, 29 Jan 2024 19:21:55 +0000 (21:21 +0200)]
wifi: iwlwifi: mvm: Fix FTM initiator flags

When secure LTF is used MFP must also be set.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Avraham Stern <avraham.stern@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129211905.6cad71069e87.I7f9fd5239cfd2244f155f88419980e6e91d00ff2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: always have 'uats_enabled'
Johannes Berg [Mon, 29 Jan 2024 19:21:54 +0000 (21:21 +0200)]
wifi: iwlwifi: always have 'uats_enabled'

We check this in code that'd be complicated to put under
ifdef (CONFIG_ACPI), so just always have 'uats_enabled'.

Fixes: 4a9bb5b4d949 ("wifi: iwlwifi: fw: Add support for UATS table in UHB")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129211905.bdc5fb20f00a.I902d801d79873c5c9cd51cef8e8226e2acefe88d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: don't set trigger frame padding in AP mode
Johannes Berg [Mon, 29 Jan 2024 19:21:53 +0000 (21:21 +0200)]
wifi: iwlwifi: mvm: don't set trigger frame padding in AP mode

This field is reserved in AP mode, don't set any bits in it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129211905.f5eeb717212e.I60fa4843a8634922281580b925db2c2699e3a7bc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: Fix spelling mistake "SESION" -> "SESSION"
Colin Ian King [Mon, 29 Jan 2024 19:21:52 +0000 (21:21 +0200)]
wifi: iwlwifi: Fix spelling mistake "SESION" -> "SESSION"

There is a spelling mistake in a WARN message. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129211905.ff31e9385d29.I3a224e6a9294fdec431919fb4ec9315801e77454@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: d3: fix IPN byte order
Johannes Berg [Mon, 29 Jan 2024 19:21:51 +0000 (21:21 +0200)]
wifi: iwlwifi: mvm: d3: fix IPN byte order

The IPN is reported by the firmware in 6 bytes little endian,
but mac80211 expects big endian so it can do memcmp() on it.
We used to store this as a u64 which was filled in the right
way, but never used. When implementing that it's used, we
changed it to just be 6 bytes, but lost the conversion. Add
it back.

Fixes: 04f78e242fff ("wifi: iwlwifi: mvm: Add support for IGTK in D3 resume flow")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129211905.138ed8a698e3.I1b66c386e45b5392696424ec636474bff86fd5ef@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: add support for TID to link mapping neg request
Ayala Beker [Mon, 29 Jan 2024 19:21:50 +0000 (21:21 +0200)]
wifi: iwlwifi: mvm: add support for TID to link mapping neg request

Add support for handling TID to link mapping negotiation
request and decide whether to accept it or not.
Accept the request if all TIDs are mapped to the same link set,
otherwise reject it.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129211905.aab9819c378d.Icf6b79a362763e2e8b85959471f303b586617242@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: fix EWRD table validity check
Miri Korenblit [Mon, 29 Jan 2024 19:21:49 +0000 (21:21 +0200)]
wifi: iwlwifi: fix EWRD table validity check

EWRD ACPI table contains up to 3 additional sar profiles.
According to the BIOS spec, the table contains a n_profile
variable indicating how many additional profiles exist in the
table.
Currently we check that n_profiles is not <= 0.
But according to the BIOS spec, 0 is a valid value,
and it can't be < 0 anyway because we receive that from ACPI as
an unsigned integer.

Fixes: 39c1a9728f93 ("iwlwifi: refactor the SAR tables from mvm to acpi")
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240129211905.448ea2f40814.Iffd2aadf8e8693e6cb599bee0406a800a0c1e081@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: cleanup uefi variables loading
Miri Korenblit [Sun, 28 Jan 2024 06:54:00 +0000 (08:54 +0200)]
wifi: iwlwifi: cleanup uefi variables loading

Extract the logic that is common to all variables loading
to a function.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240128084842.454f32c4bcfe.I4835fe657475ac28ef6aef4d292fac63c6ce9a34@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: implement GLAI ACPI table loading
Miri Korenblit [Sun, 28 Jan 2024 06:53:59 +0000 (08:53 +0200)]
wifi: iwlwifi: implement GLAI ACPI table loading

All the regulatory tables from BIOS are going to be loaded
(preferably) from the UEFI instead of the ACPI.
There is a security issue with the fact that anyone can
add these UEFI variables.
The solution for that is to have a lock for all WIFI GUID UEFI
variables, and only if the UEFI variables are locked then we can
read it.
The status of the lock (unlocked, locked, test mode) is indicated
in a ACPI table: Guid Lock ACPI Indicator.
Load this table so the driver knows whether to read from UEFI or
not

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240128084842.53994809fbdd.I1bd10aafc387bc04f375e386861ee2bcb82f0a61@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: initialize rates in FW earlier
Johannes Berg [Sun, 28 Jan 2024 06:53:58 +0000 (08:53 +0200)]
wifi: iwlwifi: mvm: initialize rates in FW earlier

When connecting to an AP, we currently initialize the rate
control only after associating. Since we now use firmware
to assign rates to auth/assoc frames rather than using the
data in the station and the firmware doesn't know, they're
transmitted using low mandatory rates. However, if the AP
advertised only higher supported rates we want to use them
to be nicer (it still must receive mandatory rates though),
so send the information to the firmware earlier to have it
know about it and be able to use it.

Fixes: 499d02790495 ("wifi: iwlwifi: Use FW rate for non-data frames")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240128084842.ed7ab1c859c2.I4b4d4fc3905c8d8470fc0fee4648f25c950c9bb7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: disconnect station vifs if recovery failed
Emmanuel Grumbach [Sun, 28 Jan 2024 06:53:56 +0000 (08:53 +0200)]
wifi: iwlwifi: mvm: disconnect station vifs if recovery failed

This will allow to reconnect immediately instead of leaving the
connection in a limbo state.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240128084842.e90531cd3a36.Iebdc9483983c0d8497f9dcf9d79ec37332a5fdcc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: acpi: fix WPFC reading
Johannes Berg [Sun, 28 Jan 2024 06:53:55 +0000 (08:53 +0200)]
wifi: iwlwifi: acpi: fix WPFC reading

The code reading the WPFC table needs to take into account
the domain type (first element in the package), shouldn't
leak the memory if it fails, and has a bad comment. Fix all
these issues.

Fixes: c4c954547755 ("wifi: iwlwifi: implement WPFC ACPI table loading")
Reported-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman Gregory <gregory.greenman@intel.com>
Link: https://msgid.link/20240128084842.2afeb476b62d.I200568dc42a277e21c12be99d5aaa39b009d45da@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: fw: dbg: ensure correct config name sizes
Johannes Berg [Sun, 28 Jan 2024 06:53:54 +0000 (08:53 +0200)]
wifi: iwlwifi: fw: dbg: ensure correct config name sizes

This hard-codes the size, but it's not obvious why that's
correct. Use sizeof() and cross-check the two structs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240128084842.58fcdea2ace7.I49cb1d7bdbea12085aada0c96ef42fcbcb3d2b38@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: dbg-tlv: ensure NUL termination
Johannes Berg [Sun, 28 Jan 2024 06:53:53 +0000 (08:53 +0200)]
wifi: iwlwifi: dbg-tlv: ensure NUL termination

The iwl_fw_ini_debug_info_tlv is used as a string, so we must
ensure the string is terminated correctly before using it.

Fixes: a9248de42464 ("iwlwifi: dbg_ini: add TLV allocation new API support")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240128084842.be15e858ee89.Ibff93429cf999eafc7b26f3eef4c055dc84984a0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: dbg-tlv: use struct_size() for allocation
Johannes Berg [Sun, 28 Jan 2024 06:53:52 +0000 (08:53 +0200)]
wifi: iwlwifi: dbg-tlv: use struct_size() for allocation

This is effectively the same since we don't even have a
multiplication, but better captures what happens with
the length.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240128084842.f301641eb916.I66b7b48a526377d682eecef874373bf3a01076c8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: dbg-tlv: avoid extra allocation/copy
Johannes Berg [Sun, 28 Jan 2024 06:53:51 +0000 (08:53 +0200)]
wifi: iwlwifi: dbg-tlv: avoid extra allocation/copy

In iwl_dbg_tlv_alloc_trigger() the code makes a copy just
to modify it and pass it to another function to make a copy
again. Change the API to return the copy so the adjustment
can be done without another copy.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240128084842.075c8b9f7030.Id5a61e1a87a9c6932727fb4e2c9b54ed6070362a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: fix some kernel-doc issues
Johannes Berg [Sun, 28 Jan 2024 06:53:50 +0000 (08:53 +0200)]
wifi: iwlwifi: fix some kernel-doc issues

Add return descriptions, move description contents after
(parameter) sections and fix short descriptions.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240128084842.02ac00f67239.I4ad17097badfcbb82ccdb8c126f61a6f3170798e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: d3: disconnect on GTK rekey failure
Johannes Berg [Sun, 28 Jan 2024 06:53:49 +0000 (08:53 +0200)]
wifi: iwlwifi: mvm: d3: disconnect on GTK rekey failure

If there was a rekey failure during D3 when firmware is
handling the GTK rekeying, and it decided that we should
wake up, then there was an issue in the connection and
we don't necessarily have the right keys, so we should
disconnect.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240128084842.944af193d479.I5ef9f1f0e048d44d7158615d071b793d69eceb75@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: report beacon protection failures
Johannes Berg [Sun, 28 Jan 2024 06:53:48 +0000 (08:53 +0200)]
wifi: iwlwifi: mvm: report beacon protection failures

Andrei reports that we just silently drop beacons after we
report the key counters, but never report to userspace, so
wpa_supplicant cannot send the WNM action frame. Fix that.

Fixes: b1fdc2505abc ("iwlwifi: mvm: advertise BIGTK client support if available")
Reported-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240128084842.7d855442cdce.Iba90b26f893dc8c49bfb8be65373cd0a138af12c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: mvm: Add support for removing responder TKs
Ilan Peer [Wed, 31 Jan 2024 21:08:16 +0000 (23:08 +0200)]
wifi: iwlwifi: mvm: Add support for removing responder TKs

When removing a PASN station, the TK must be removed before
the station is removed as otherwise the FW would assert.

To handle this, store the key configuration, and use it to remove
the key when the station is removed.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240131230734.3e6364730c04.Ia76dc4a9d399f1f68ac6b157d844b63f74d5159f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: iwlwifi: disable eSR when BT is active
Miri Korenblit [Wed, 31 Jan 2024 20:56:32 +0000 (22:56 +0200)]
wifi: iwlwifi: disable eSR when BT is active

eSR should be disabled when BT Coex is active and:
- LB link is the primary link.
- LB link is the secondary link and the predicted BT penalty
  (the wifi loss rate caused by BT interference) is higher
  than a given threshold.
If one of the conditions above is no longer true then re-enable eSR.

In order to implement this, add support for version 5 of
BT_PROFILE_NOTIFICATION, in which the bt penalty is provided
by FW.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131225342.b922b6485af8.I7d808ce535a7372aca9cb85c045755e6788a4904@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 months agowifi: rtl8xxxu: fix error messages
Dan Carpenter [Wed, 31 Jan 2024 07:10:07 +0000 (10:10 +0300)]
wifi: rtl8xxxu: fix error messages

The first parameter of WARN_ONCE() is a condition so this code will end
up printing the function name instead of the proper message.

Fixes: 3ff7a05996f9 ("wifi: rtl8xxxu: support setting bssid register for multiple interfaces")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/7b144531-a8da-4725-8911-9b614a525a35@moroto.mountain
7 months agowifi: rtw89: 8922a: add more fields to beacon H2C command to support multi-links
Po-Hao Huang [Fri, 26 Jan 2024 06:33:56 +0000 (14:33 +0800)]
wifi: rtw89: 8922a: add more fields to beacon H2C command to support multi-links

To support multi-links beacon, it needs more fields. But currently we still
only support legacy AP mode. Only update struct to fit expected size of
firmware.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240126063356.17857-8-pkshih@realtek.com
7 months agowifi: rtw89: update ps_state register for chips with different generation
Chin-Yen Lee [Fri, 26 Jan 2024 06:33:55 +0000 (14:33 +0800)]
wifi: rtw89: update ps_state register for chips with different generation

The ps_state register is used for driver to check if the WiFi chip leave
power save mode successfully. The register is changed for new generation,
so update it.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240126063356.17857-7-pkshih@realtek.com
7 months agowifi: rtw89: add new H2C for PS mode in 802.11be chip
Chin-Yen Lee [Fri, 26 Jan 2024 06:33:54 +0000 (14:33 +0800)]
wifi: rtw89: add new H2C for PS mode in 802.11be chip

Because 802.11be chip support MLO mode, driver needs to send new H2C to
pass more connected channel information to firmware, to ensure PS mode
work fine.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240126063356.17857-6-pkshih@realtek.com
7 months agowifi: rtw89: 8922a: add ieee80211_ops::hw_scan
Po-Hao Huang [Fri, 26 Jan 2024 06:33:53 +0000 (14:33 +0800)]
wifi: rtw89: 8922a: add ieee80211_ops::hw_scan

This adds support for hardware scan after FW version 0.34.35. Currently
we only support scanning on single hardware band and support of dual band
scan will be added in the future. Adjust the current flow to make driver
compatible with different generation ICs.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240126063356.17857-5-pkshih@realtek.com
7 months agowifi: rtw89: prepare scan leaf functions for wifi 7 ICs
Po-Hao Huang [Fri, 26 Jan 2024 06:33:52 +0000 (14:33 +0800)]
wifi: rtw89: prepare scan leaf functions for wifi 7 ICs

The channel field slightly differs between WiFi 6 and WiFi 7.
So we prepare some required functions in advance, this doesn't change
existing wifi 6 ICs behavior. This H2C prepares the channel list
to be scanned for. With layout as the following:

+--------+--------------------+-------------------+-----------------------+
| header | number of channels | channel info size | channel_info * number |
+--------+--------------------+-------------------+-----------------------+

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240126063356.17857-4-pkshih@realtek.com
7 months agowifi: rtw89: debug: add FW log component for scan
Po-Hao Huang [Fri, 26 Jan 2024 06:33:51 +0000 (14:33 +0800)]
wifi: rtw89: debug: add FW log component for scan

This allows scan related logs when FW log debug mode is on.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240126063356.17857-3-pkshih@realtek.com
7 months agowifi: rtw89: update scan C2H messages for wifi 7 IC
Po-Hao Huang [Fri, 26 Jan 2024 06:33:50 +0000 (14:33 +0800)]
wifi: rtw89: update scan C2H messages for wifi 7 IC

Add definition and parsing for wifi 7 extended fields. These fields
include hardware index which is current reporting, timestamp and self
defined sequences for debug purposes.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240126063356.17857-2-pkshih@realtek.com
7 months agowifi: rtw89: 8922a: set chip_ops FEM and GPIO to NULL
Ping-Ke Shih [Wed, 24 Jan 2024 03:38:13 +0000 (11:38 +0800)]
wifi: rtw89: 8922a: set chip_ops FEM and GPIO to NULL

The chip_ops::fem_setup is to get if a hardware module type contains PA
and LNA that will affect how RF calibrations do. The chip_ops::rfe_gpio
is to set GPIO PIN MUX according to hardware module type too. 8922A
doesn't have these special module types yet, so leave them as NULL.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240124033813.12562-1-pkshih@realtek.com
7 months agowifi: rtw89: 8922a: add chip_ops to get thermal value
Ping-Ke Shih [Wed, 24 Jan 2024 03:38:02 +0000 (11:38 +0800)]
wifi: rtw89: 8922a: add chip_ops to get thermal value

Get thermal value as a clue to do RF calibration if the delta is larger
than a threshold, but 8922A doesn't need this, so we only read out the
value when debugging to reduce IO.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240124033802.12508-1-pkshih@realtek.com
7 months agowifi: rtw89: 8922a: add RF read/write v2
Ping-Ke Shih [Wed, 24 Jan 2024 03:36:35 +0000 (11:36 +0800)]
wifi: rtw89: 8922a: add RF read/write v2

Implement indirect interface v2 to read/write RF registers via PHY
registers for 8922A.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240124033637.12330-5-pkshih@realtek.com
7 months agowifi: rtw89: 8922a: add chip_ops::cfg_txrx_path
Ping-Ke Shih [Wed, 24 Jan 2024 03:36:34 +0000 (11:36 +0800)]
wifi: rtw89: 8922a: add chip_ops::cfg_txrx_path

This function is to set TX/RX path. Especially for 1SS rate, it can select
to TX on one or two antenna. Before this operation, stop hardware to
prevent transmitting/receiving unexpected packets. After that, restore
settings and reset hardware to prevent it stays on abnormal state.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240124033637.12330-4-pkshih@realtek.com
7 months agowifi: rtw89: 8922a: implement {stop,resume}_sch_tx and cfg_ppdu
Ping-Ke Shih [Wed, 24 Jan 2024 03:36:33 +0000 (11:36 +0800)]
wifi: rtw89: 8922a: implement {stop,resume}_sch_tx and cfg_ppdu

To set TX/RX path or set channel, we need these helpers to stop TX and
restore settings. The sch_tx stands for scheduler TX channel, and the
cfg_ppdu is to stop reporting PPDU status, so we should stop them during
setting.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240124033637.12330-3-pkshih@realtek.com
7 months agowifi: rtw89: 8922a: hook handlers of TX/RX descriptors to chip_ops
Ping-Ke Shih [Wed, 24 Jan 2024 03:36:32 +0000 (11:36 +0800)]
wifi: rtw89: 8922a: hook handlers of TX/RX descriptors to chip_ops

Hook implemented handlers to chip_ops, and fill packet frequency and signal
strength to RX status from RX PPDU status packet.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240124033637.12330-2-pkshih@realtek.com
7 months agowifi: rtw89: pci: enlarge RX DMA buffer to consider size of RX descriptor
Ping-Ke Shih [Sun, 21 Jan 2024 07:18:26 +0000 (15:18 +0800)]
wifi: rtw89: pci: enlarge RX DMA buffer to consider size of RX descriptor

Hardware puts RX descriptor and packet in RX DMA buffer, so it could be
over one buffer size if packet size is 11454, and then it will be split
into two segments. WiFi 7 chips use larger size of RX descriptor, so
enlarge DMA buffer size according to RX descriptor to have better
performance and simple flow.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240121071826.10159-5-pkshih@realtek.com
7 months agowifi: rtw89: pci: validate RX tag for RXQ and RPQ
Ping-Ke Shih [Sun, 21 Jan 2024 07:18:25 +0000 (15:18 +0800)]
wifi: rtw89: pci: validate RX tag for RXQ and RPQ

PCI RX ring is a kind of read/write index ring, and DMA and ring index are
asynchronous, so suddenly driver gets newer index ahead before DMA. To
resolve this rare situation, we use a RX tag as helpers to make sure DMA
is done.

The RX tag is a 13-bit value, and range is from 1 ~ 0x1FFF, but 0 isn't
used so should be skipped.

Only enable this validation to coming WiFi 7 chips, because existing
chips use different design and don't really meet this situation.

Add missed rx_ring_eq_is_full for 8851BE by the way.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240121071826.10159-4-pkshih@realtek.com
7 months agowifi: rtw89: pci: interrupt v2 refine IMR for SER
Zong-Zhe Yang [Sun, 21 Jan 2024 07:18:24 +0000 (15:18 +0800)]
wifi: rtw89: pci: interrupt v2 refine IMR for SER

During SER (system error recovery), expect to deal with
only ISR related to halt. So, refine IMR configuration.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240121071826.10159-3-pkshih@realtek.com
7 months agowifi: rtw89: pci: update SER timer unit and timeout time
Ping-Ke Shih [Sun, 21 Jan 2024 07:18:23 +0000 (15:18 +0800)]
wifi: rtw89: pci: update SER timer unit and timeout time

Be higher resolution of SER timer unit from 32ms to 16ms to detect
abnormal situation more accurately, and set hardware watchdog timer to 4ms.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240121071826.10159-2-pkshih@realtek.com
7 months agowifi: brcmfmac: fix copyright year mentioned in platform_data header
Arend van Spriel [Sun, 28 Jan 2024 09:30:57 +0000 (10:30 +0100)]
wifi: brcmfmac: fix copyright year mentioned in platform_data header

The driver found its inception a little after the year 201. According
git blame output it was added in 2016 so lets go with that.

Fixes: 4d7928959832 ("brcmfmac: switch to new platform data")
Reported-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240128093057.164791-3-arend.vanspriel@broadcom.com
7 months agowifi: brcmfmac: add linefeed at end of file
Arend van Spriel [Sun, 28 Jan 2024 09:30:56 +0000 (10:30 +0100)]
wifi: brcmfmac: add linefeed at end of file

The following sparse warning was reported:

drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c:432:49:
  warning: no newline at end of file

Fixes: 31343230abb1 ("wifi: brcmfmac: export firmware interface functions")
Reported-by: Jakub Kicinski <kuba@kernel.org>
Closes: https://lore.kernel.org/all/20240125165128.7e43a1f3@kernel.org/
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240128093057.164791-2-arend.vanspriel@broadcom.com