platform/kernel/linux-starfive.git
18 months agowifi: mt76: mt7996: enable coredump support
Ryder Lee [Tue, 4 Apr 2023 23:24:39 +0000 (07:24 +0800)]
wifi: mt76: mt7996: enable coredump support

Host triggered and catastrophic event triggered firmware core dumping
for basic firmware issues triage, including state reporting, function
calltrace and MCU memory dump.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7996: add full system reset knobs into debugfs
Ryder Lee [Tue, 4 Apr 2023 23:24:38 +0000 (07:24 +0800)]
wifi: mt76: mt7996: add full system reset knobs into debugfs

Add testing points into debugfs to trigger firmware assert and enable
full system recovery. Also rename knob "fw_ser" to a clear-cut name
"sys_recovery".

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7996: enable full system reset support
Bo Jiao [Tue, 4 Apr 2023 23:24:37 +0000 (07:24 +0800)]
wifi: mt76: mt7996: enable full system reset support

Add mt7996_reset() and refactor mt7996_mac_reset_work() to support
full system recovery.

Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7921: enable p2p support
Sean Wang [Tue, 7 Mar 2023 21:50:59 +0000 (05:50 +0800)]
wifi: mt76: mt7921: enable p2p support

Introduce p2p-go/p2p-client support to mt7921 driver

CONNECTION_P2P_GC/GO is not supported with the current firmware
so we added mt76_dev to mt76_connac_mcu_sta_basic_tlv signature to
use CONNECTION_INFRA_STA/AP instead for p2p-client and p2p-go
respectively to make it work.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7921: Replace fake flex-arrays with flexible-array members
Gustavo A. R. Silva [Fri, 17 Mar 2023 20:56:39 +0000 (14:56 -0600)]
wifi: mt76: mt7921: Replace fake flex-arrays with flexible-array members

Zero-length arrays as fake flexible arrays are deprecated and we are
moving towards adopting C99 flexible-array members instead.

Address the following warnings found with GCC-13 and
-fstrict-flex-arrays=3 enabled:
drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.c:266:25: warning: array subscript 0 is outside array bounds of ‘struct mt7921_asar_dyn_limit_v2[0]’ [-Warray-bounds=]
drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.c:263:25: warning: array subscript 0 is outside array bounds of ‘struct mt7921_asar_dyn_limit[0]’ [-Warray-bounds=]
drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.c:223:28: warning: array subscript <unknown> is outside array bounds of ‘struct mt7921_asar_geo_limit_v2[0]’ [-Warray-bounds=]
drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.c:220:28: warning: array subscript <unknown> is outside array bounds of ‘struct mt7921_asar_geo_limit[0]’ [-Warray-bounds=]
drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.c:334:37: warning: array subscript i is outside array bounds of ‘u8[0]’ {aka ‘unsigned char[]’} [-Warray-bounds=]

Notice that the DECLARE_FLEX_ARRAY() helper allows for flexible-array
members in unions.

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
routines on memcpy() and help us make progress towards globally
enabling -fstrict-flex-arrays=3 [1].

Link: https://github.com/KSPP/linux/issues/21
Link: https://github.com/KSPP/linux/issues/272
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: Replace zero-length array with flexible-array member
Gustavo A. R. Silva [Thu, 6 Apr 2023 14:32:12 +0000 (08:32 -0600)]
wifi: mt76: Replace zero-length array with flexible-array member

Zero-length arrays are deprecated [1] and have to be replaced by C99
flexible-array members.

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines
on memcpy() and help to make progress towards globally enabling
-fstrict-flex-arrays=3 [2]

Link: https://github.com/KSPP/linux/issues/78
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7921: add Netgear AXE3000 (A8000) support
Reese Russell [Tue, 4 Apr 2023 07:35:12 +0000 (00:35 -0700)]
wifi: mt76: mt7921: add Netgear AXE3000 (A8000) support

Issue: Though the Netgear AXE3000 (A8000) is based on the mt7921
chipset because of the unique USB VID:PID combination this device
does not initialize/register. Thus making it not plug and play.

Fix: Adds support for the Netgear AXE3000 (A8000) based on the Mediatek
mt7921au chipset. The method of action is adding the USD VID/PID
pair to the mt7921u_device_table[] array.

Notes: A retail sample of the Netgear AXE3000 (A8000) yeilds the following
from lsusb D 0846:9060 NetGear, Inc. Wireless_Device. This pair
0846:9060 VID:PID has been reported by other users on Github.

Signed-off-by: Reese Russell <git@qrsnap.io>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7915: drop redundant prefix of mt7915_txpower_puts()
Ryder Lee [Thu, 30 Mar 2023 22:10:17 +0000 (06:10 +0800)]
wifi: mt76: mt7915: drop redundant prefix of mt7915_txpower_puts()

Just a cosmetic patch to drop redundant prefix for txpower ouput text.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: fix 6GHz high channel not be scanned
Ming Yen Hsieh [Thu, 23 Mar 2023 13:26:12 +0000 (21:26 +0800)]
wifi: mt76: fix 6GHz high channel not be scanned

mt76 scan command only support 64 channels currently. If the
channel count is larger than 64(for 2+5+6GHz), some channels will
not be scanned. Hence change the scan type to full channel scan
in case of the command cannot include proper list for chip.

Fixes: 399090ef9605 ("mt76: mt76_connac: move hw_scan and sched_scan routine in mt76_connac_mcu module")
Reported-by: Ben Greear <greearb@candelatech.com>
Tested-by: Isaac Konikoff <konikofi@candelatech.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7921e: fix probe timeout after reboot
Quan Zhou [Sat, 18 Mar 2023 07:41:12 +0000 (15:41 +0800)]
wifi: mt76: mt7921e: fix probe timeout after reboot

In system warm reboot scene, due to the polling timeout(now 1000us)
is too short to wait dma idle in time, it may make driver probe fail
with error code -ETIMEDOUT. Meanwhile, we also found the dma may take
around 70ms to enter idle state. Change the polling idle timeout to
100ms to avoid the probabilistic probe fail.

Tested pass with 5000 times warm reboot on x86 platform.

[4.477496] pci 0000:01:00.0: attach allowed to drvr mt7921e [internal device]
[4.478306] mt7921e 0000:01:00.0: ASIC revision: 79610010
[4.480063] mt7921e: probe of 0000:01:00.0 failed with error -110

Fixes: 0a1059d0f060 ("mt76: mt7921: move mt7921_dma_reset in dma.c")
Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: move shared mac definitions in mt76_connac2_mac.h
Lorenzo Bianconi [Mon, 3 Apr 2023 10:34:00 +0000 (12:34 +0200)]
wifi: mt76: move shared mac definitions in mt76_connac2_mac.h

Move some mac shared definitions between mt7996, mt7921 and mt7915 in
mt76_connac2_mac.h.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7921: get rid of eeprom.h
Lorenzo Bianconi [Mon, 3 Apr 2023 10:33:59 +0000 (12:33 +0200)]
wifi: mt76: mt7921: get rid of eeprom.h

eeprom.h is mostly empty for mt7921, so get rid of it.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: add mt76_connac_gen_ppe_thresh utility routine
Lorenzo Bianconi [Mon, 3 Apr 2023 10:33:58 +0000 (12:33 +0200)]
wifi: mt76: add mt76_connac_gen_ppe_thresh utility routine

gen_ppe_thresh routine is shared between mt7615, mt7915, mt7921 and
mt7996 so move it in mt76_connac module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: get rid of unused sta_ps callbacks
Lorenzo Bianconi [Mon, 3 Apr 2023 10:33:57 +0000 (12:33 +0200)]
wifi: mt76: get rid of unused sta_ps callbacks

sta_ps callback is just an empty stub for most of the drivers,
so get rid of them.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: add mt76_connac_irq_enable utility routine
Lorenzo Bianconi [Mon, 3 Apr 2023 10:33:56 +0000 (12:33 +0200)]
wifi: mt76: add mt76_connac_irq_enable utility routine

Most of connac based drivers (mt7921, mt7615, mt7663) share the same
code to enable interrupts. Move it in mt76_connac module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: move irq_tasklet in mt76_dev struct
Lorenzo Bianconi [Mon, 3 Apr 2023 10:33:55 +0000 (12:33 +0200)]
wifi: mt76: move irq_tasklet in mt76_dev struct

irq_tasklet struct is used by most of the drivers (e.g. mt7915, mt7921,
mt7615, mt7663 and mt7996) so move it in common code.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset
Mario Limonciello [Wed, 29 Mar 2023 19:57:58 +0000 (14:57 -0500)]
wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unset

When the BIOS has been configured for Fast Boot, systems with mt7921e
have non-functional wifi.  Turning on Fast boot caused both bus master
enable and memory space enable bits in PCI_COMMAND not to get configured.

The mt7921 driver already sets bus master enable, but explicitly check
and set memory access enable as well to fix this problem.

Tested-by: Anson Tsao <anson.tsao@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7921: use driver flags rather than mac80211 flags to mcu
Neil Chen [Tue, 7 Mar 2023 11:22:49 +0000 (19:22 +0800)]
wifi: mt76: mt7921: use driver flags rather than mac80211 flags to mcu

FIF_* flags from mac80211 is not ABI. mt7921 should not pass it into mcu
directly. Remap FIF_* to driver defined flags as mcu command input.

Fixes: c222f77fd421 ("wifi: mt76: mt7921: fix rx filter incorrect by drv/fw inconsistent")
Signed-off-by: Neil Chen <yn.chen@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7921: introduce mt7921_get_mac80211_ops utility routine
Lorenzo Bianconi [Mon, 6 Mar 2023 17:50:29 +0000 (18:50 +0100)]
wifi: mt76: mt7921: introduce mt7921_get_mac80211_ops utility routine

Since the fw offload capability check is shared between pci,usb and sdio
devices, move it in common init code and reduce code duplication.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7996: fix eeprom tx path bitfields
StanleyYP Wang [Fri, 3 Mar 2023 08:35:58 +0000 (16:35 +0800)]
wifi: mt76: mt7996: fix eeprom tx path bitfields

Swap the tx path bitfields of band1 and band2 to read correct setting.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7996: remove mt7996_mcu_set_pm()
Peter Chiu [Fri, 3 Mar 2023 08:35:57 +0000 (16:35 +0800)]
wifi: mt76: mt7996: remove mt7996_mcu_set_pm()

Currently using BSS_INFO_PS command will sometimes cause packet drop in
hw rx queue.
Temporarily remove this function until finding the cause.

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7996: init mpdu density cap
Peter Chiu [Fri, 3 Mar 2023 08:35:56 +0000 (16:35 +0800)]
wifi: mt76: mt7996: init mpdu density cap

Init mpdu density based on the hardware capability to prevent rx drop.

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7996: fix pointer calculation in ie countdown event
Peter Chiu [Fri, 3 Mar 2023 08:35:55 +0000 (16:35 +0800)]
wifi: mt76: mt7996: fix pointer calculation in ie countdown event

Fix the tail and data pointers. The rxd->len in mt7996_mcu_rxd does not
include the length of general rxd. It only includes the length of
firmware event rxd. Use skb->length to get the correct length.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7996: remove unused eeprom band selection
Shayne Chen [Fri, 3 Mar 2023 08:35:54 +0000 (16:35 +0800)]
wifi: mt76: mt7996: remove unused eeprom band selection

Tri-band chipsets support one band on each a-die, so remove the unused
definition of eeprom band selection.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7996: let non-bufferable MMPDUs use correct hw queue
Shayne Chen [Fri, 3 Mar 2023 08:35:53 +0000 (16:35 +0800)]
wifi: mt76: mt7996: let non-bufferable MMPDUs use correct hw queue

Pass qid into mt7996_mac_write_txwi() to let the tx descriptor of
non-bufferable MMPDUs be filled with correct hw queue index.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7996: add eht rx rate support
Shayne Chen [Fri, 3 Mar 2023 08:35:52 +0000 (16:35 +0800)]
wifi: mt76: mt7996: add eht rx rate support

Add support to report eht rx rate.
Note that extended fields for eht in mt76_rx_status will make the struct
size exceed the cb size, so make nss and band share the same u8.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7996: remove mt7996_mcu_beacon_check_caps()
Ryder Lee [Thu, 9 Feb 2023 02:23:00 +0000 (10:23 +0800)]
wifi: mt76: mt7996: remove mt7996_mcu_beacon_check_caps()

Those capabilities have been added into ieee80211_bss_conf.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7915: remove mt7915_mcu_beacon_check_caps()
Ryder Lee [Thu, 9 Feb 2023 02:22:59 +0000 (10:22 +0800)]
wifi: mt76: mt7915: remove mt7915_mcu_beacon_check_caps()

Those capabilities have been added into ieee80211_bss_conf.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: connac: refresh tx session timer for WED device
Ryder Lee [Fri, 17 Feb 2023 17:50:38 +0000 (01:50 +0800)]
wifi: mt76: connac: refresh tx session timer for WED device

There's no keep-alive packet being received by mac80211 stack when WED
is enabled, which leads to tx BA session timeout. This patch calls
ieee80211_refresh_tx_agg_session_timer() to refresh timer according
to tx status reporting.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: add missing locking to protect against concurrent rx/status calls
Felix Fietkau [Fri, 14 Apr 2023 12:10:54 +0000 (14:10 +0200)]
wifi: mt76: add missing locking to protect against concurrent rx/status calls

According to the documentation, ieee80211_rx_list must not run concurrently
with ieee80211_tx_status (or its variants).

Cc: stable@vger.kernel.org
Fixes: 88046b2c9f6d ("mt76: add support for reporting tx status with skb")
Reported-by: Brian Coverstone <brian@mainsequence.net>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: handle failure of vzalloc in mt7615_coredump_work
Kang Chen [Mon, 27 Feb 2023 14:48:23 +0000 (22:48 +0800)]
wifi: mt76: handle failure of vzalloc in mt7615_coredump_work

vzalloc may fails, dump might be null and will cause
illegal address access later.

Link: https://lore.kernel.org/all/Y%2Fy5Asxw3T3m4jCw@lore-desk
Fixes: d2bf7959d9c0 ("mt76: mt7663: introduce coredump support")
Signed-off-by: Kang Chen <void0red@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: drop the incorrect scatter and gather frame
Peter Chiu [Wed, 22 Feb 2023 06:27:29 +0000 (14:27 +0800)]
wifi: mt76: drop the incorrect scatter and gather frame

The scatter and gather frame may be incorrect because WED and WO may
send frames to host driver interleaved.

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7915: rework init flow in mt7915_thermal_init()
Howard Hsu [Thu, 23 Feb 2023 06:24:57 +0000 (14:24 +0800)]
wifi: mt76: mt7915: rework init flow in mt7915_thermal_init()

If kernel do not enable CONFIG_HWMON, it may cause thermal
initialization to be done with temperature value 0 and then can not
transmit. This commit fixes it by setting trigger/restore temperature
before checking CONFIG_HWMON.

Fixes: 7d12b38ab6f6 ("wifi: mt76: mt7915: call mt7915_mcu_set_thermal_throttling() only after init_work")
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7915: add dev->hif2 support for mt7916 WED device
Sujuan Chen [Wed, 22 Feb 2023 13:01:35 +0000 (21:01 +0800)]
wifi: mt76: mt7915: add dev->hif2 support for mt7916 WED device

Enable two PCIe interfaces (dev->hif2) support for mt7916 when WED is enabled.

Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7915: expose device tree match table
Lorenz Brun [Sat, 18 Feb 2023 11:29:45 +0000 (12:29 +0100)]
wifi: mt76: mt7915: expose device tree match table

On MT7986 the WiFi driver currently does not get automatically loaded,
requiring manual modprobing because the device tree compatibles are not
exported into metadata.

Add the missing MODULE_DEVICE_TABLE macro to fix this.

Fixes: 99ad32a4ca3a2 ("mt76: mt7915: add support for MT7986")
Signed-off-by: Lorenz Brun <lorenz@brun.one>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: dynamic channel bandwidth changes in AP mode
Ryder Lee [Fri, 17 Feb 2023 17:47:32 +0000 (01:47 +0800)]
wifi: mt76: dynamic channel bandwidth changes in AP mode

Allow AP to change channel width for 40Mhz intolerant STA on the
2.4 GHz band.

Signed-off-by: Himanshu Goyal <himanshu.goyal@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7996: fix radiotap bitfield
Ryder Lee [Fri, 17 Feb 2023 17:46:54 +0000 (01:46 +0800)]
wifi: mt76: mt7996: fix radiotap bitfield

The 11be generation's radiotap bitfields were wrongly copy-and-pasted
from 11ax driver, so fix them accordingly.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7915: unlock on error in mt7915_thermal_temp_store()
Dan Carpenter [Thu, 16 Feb 2023 12:15:05 +0000 (15:15 +0300)]
wifi: mt76: mt7915: unlock on error in mt7915_thermal_temp_store()

Drop the lock before returning -EINVAL.

Fixes: ecaccdae7a7e ("wifi: mt76: mt7915: rework mt7915_thermal_temp_store()")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7996: Remove unneeded semicolon
Yang Li [Wed, 15 Feb 2023 05:56:50 +0000 (13:56 +0800)]
wifi: mt76: mt7996: Remove unneeded semicolon

./drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:3136:3-4: Unneeded semicolon

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4059
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7921: fix PCI DMA hang after reboot
Deren Wu [Tue, 14 Feb 2023 02:49:57 +0000 (10:49 +0800)]
wifi: mt76: mt7921: fix PCI DMA hang after reboot

mt7921 just stop some workers and clean up chip status before reboot.
In stress test, there are working activities still running at the period
of .shutdown callback and that would cause some hosts cannot recover
DMA after reboot. To avoid the floating state in reboot, we use
mt7921_pci_remove() to fully deinit all resources.

Fixes: f23a0cea8bd6 ("wifi: mt76: mt7921e: add pci .shutdown() support")
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: mt7921: fix wrong command to set STA channel
Deren Wu [Sat, 11 Feb 2023 01:01:58 +0000 (09:01 +0800)]
wifi: mt76: mt7921: fix wrong command to set STA channel

Should not use AND operator to check vif type NL80211_IFTYPE_MONITOR, and
that will cause we go into sniffer command for both STA and MONITOR
mode. However, the sniffer command would set channel properly (with some
extra options), the STA mode still works even if using the wrong
command.

Fix vif type check to make sure we using the right command to update
channel.

Fixes: 914189af23b8 ("wifi: mt76: mt7921: fix channel switch fail in monitor mode")
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agodt-bindings: mt76: add active-low property for led
Frank Wunderlich [Tue, 7 Feb 2023 13:35:04 +0000 (14:35 +0100)]
dt-bindings: mt76: add active-low property for led

LEDs can be in low-active mode, driver already supports it, but
documentation is missing. Add documentation for the dt property.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: mt76: remove redundent MCU_UNI_CMD_* definitions
Deren Wu [Sat, 4 Feb 2023 06:53:04 +0000 (14:53 +0800)]
wifi: mt76: remove redundent MCU_UNI_CMD_* definitions

clear redundent definitions only

Fixes: 5b55b6da982c ("wifi: mt76: mt7921: add unified ROC cmd/event support")
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
18 months agowifi: rtw89: add support of concurrent mode
Po-Hao Huang [Sat, 15 Apr 2023 03:50:16 +0000 (11:50 +0800)]
wifi: rtw89: add support of concurrent mode

Add iface_combination declaration to enable concurrent mode. Only two
interfaces under same frequency is supported currently. We limit the
role combination to be STA + P2P or STA + AP only for now until new
feature is requested.

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://lore.kernel.org/r/20230415035016.15788-2-pkshih@realtek.com
18 months agowifi: rtw89: Disallow power save with multiple stations
Po-Hao Huang [Sat, 15 Apr 2023 03:50:15 +0000 (11:50 +0800)]
wifi: rtw89: Disallow power save with multiple stations

Power saving for more than one station is not supported currently.
Disallow entering PS mode when we have more than one associated
stations.

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://lore.kernel.org/r/20230415035016.15788-1-pkshih@realtek.com
18 months agowifi: rtw89: update statistics to FW for fine-tuning performance
Po-Hao Huang [Sat, 15 Apr 2023 03:48:58 +0000 (11:48 +0800)]
wifi: rtw89: update statistics to FW for fine-tuning performance

Since firmware can't have proper statistics, driver update the
statistics periodically to firmware to assist in tuning performance.

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://lore.kernel.org/r/20230415034900.15679-5-pkshih@realtek.com
18 months agowifi: rtw89: use struct instead of macros to set H2C command of hardware scan
Ping-Ke Shih [Sat, 15 Apr 2023 03:48:57 +0000 (11:48 +0800)]
wifi: rtw89: use struct instead of macros to set H2C command of hardware scan

Remove macros that set H2C data. Instead, use struct and
le32_encode_bits() with mask definition to make it clean.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230415034900.15679-4-pkshih@realtek.com
18 months agowifi: rtw89: refine scan function after chanctx
Po-Hao Huang [Sat, 15 Apr 2023 03:48:56 +0000 (11:48 +0800)]
wifi: rtw89: refine scan function after chanctx

Since we can get the current channel definition each interface maps to,
remove store_op function that is no longer required to make things simple.

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://lore.kernel.org/r/20230415034900.15679-3-pkshih@realtek.com
18 months agowifi: rtw89: prohibit enter IPS during HW scan
Chih-Kang Chang [Sat, 15 Apr 2023 03:48:55 +0000 (11:48 +0800)]
wifi: rtw89: prohibit enter IPS during HW scan

Mac80211 core may ask driver to change to idle mode during HW scan,
then H2C command for HW scan will send failed since chip is in idle
mode. Therefore, We check the SCANNING flag before entering IPS to
prevent this behavior.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230415034900.15679-2-pkshih@realtek.com
18 months agowifi: rtw89: coex: send more hardware module info to firmware for 8851B
Ping-Ke Shih [Wed, 12 Apr 2023 01:28:31 +0000 (09:28 +0800)]
wifi: rtw89: coex: send more hardware module info to firmware for 8851B

8851B has various hardware module types, so BT coexistence in firmware
needs these information to make decision. Add them to make 8851B work
well.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230412012831.10519-5-pkshih@realtek.com
18 months agowifi: rtw89: coex: Update function to get BT RSSI and hardware counter
Ching-Te Ku [Wed, 12 Apr 2023 01:28:30 +0000 (09:28 +0800)]
wifi: rtw89: coex: Update function to get BT RSSI and hardware counter

Correct Bluetooth RSSI count method. The 6dB is the gap between hardware
packet sampled value and real RSSI value.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230412012831.10519-4-pkshih@realtek.com
18 months agowifi: rtw89: coex: Add path control register to monitor list
Ching-Te Ku [Wed, 12 Apr 2023 01:28:29 +0000 (09:28 +0800)]
wifi: rtw89: coex: Add path control register to monitor list

Chips use similar hardware for path control, but could different
path/antenna configuration. Add these register to monitor, if there are
wrong settings, these register can help to debug.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230412012831.10519-3-pkshih@realtek.com
18 months agowifi: rtw89: coex: Enable Wi-Fi RX gain control for free run solution
Ching-Te Ku [Wed, 12 Apr 2023 01:28:28 +0000 (09:28 +0800)]
wifi: rtw89: coex: Enable Wi-Fi RX gain control for free run solution

When Wi-Fi & Bluetooth are both busy at the same time, Wi-Fi need to
enable RX gain to protect Wi-Fi RX RF ability. Without this configure
the interference from Bluetooth will bring a big impact to Wi-Fi RX.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230412012831.10519-2-pkshih@realtek.com
18 months agowifi: rtw89: fix power save function in WoWLAN mode
Chih-Kang Chang [Mon, 10 Apr 2023 05:34:38 +0000 (13:34 +0800)]
wifi: rtw89: fix power save function in WoWLAN mode

In WoWLAN Mode, it's expected that WiFi chip could enter power save mode
only after all setting is finished, but current wow_enter_lps function
break the rule and may lead to WoWLAN function fail in low probability,
so fix it.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230410053438.10682-2-pkshih@realtek.com
18 months agowifi: rtw89: support WoWLAN mode for 8852be
Chin-Yen Lee [Mon, 10 Apr 2023 05:34:37 +0000 (13:34 +0800)]
wifi: rtw89: support WoWLAN mode for 8852be

To support WoWLAN mode for 8852be, we add one PLE quota setting and
WoWLAN stub, which shows that supported WLAN events include receiving
magic packet, rekey packet and deauth packet, and disconnecting from AP.

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://lore.kernel.org/r/20230410053438.10682-1-pkshih@realtek.com
18 months agowifi: iwlwifi: move debug buffer allocation failure to info verbosity
Golan Ben Ami [Sun, 16 Apr 2023 12:47:39 +0000 (15:47 +0300)]
wifi: iwlwifi: move debug buffer allocation failure to info verbosity

This is noising the kernel log and customers asked to hush it down.
We can live with this message in "info" verbosity.

Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.0a7f557aa2a0.If9db474b63242b1bfaed659aa174b678ae8dc196@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: make the loop for card preparation effective
Emmanuel Grumbach [Sun, 16 Apr 2023 12:47:38 +0000 (15:47 +0300)]
wifi: iwlwifi: make the loop for card preparation effective

Since we didn't reset t to 0, only the first iteration of the loop
did checked the ready bit several times.
From the second iteration and on, we just tested the bit once and
continued to the next iteration.

Reported-and-tested-by: Lorenzo Zolfanelli <lorenzo@zolfa.nl>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216452
Fixes: 289e5501c314 ("iwlwifi: fix the preparation of the card")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.615b683ab9c8.Ic52c3229d3345b0064fa34263293db095d88daf8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: allow number of beacons from FW
Johannes Berg [Sun, 16 Apr 2023 12:47:37 +0000 (15:47 +0300)]
wifi: iwlwifi: mvm: allow number of beacons from FW

Newer firmware images have a TLV advertising how many
beacons they support, use that to permit adding more
links in AP mode (FW needs to support at least as many
links as beacons).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.0d7522533557.Ic6b5992e94446c35cb0f3add019defa6e7aded2a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: implement key link switching
Johannes Berg [Sun, 16 Apr 2023 12:47:36 +0000 (15:47 +0300)]
wifi: iwlwifi: mvm: implement key link switching

Implement switching keys from one set of firmware station IDs
to another set, during link switch.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.c6a777dd5e47.I693f7fd7c52fe8b51a58af69d45488511367f49e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: implement BAID link switching
Johannes Berg [Sun, 16 Apr 2023 12:47:35 +0000 (15:47 +0300)]
wifi: iwlwifi: mvm: implement BAID link switching

When we switch station links, also add the code to switch
BAIDs from one station mask to the new one.

To do so, refactor the switching code a bit to have common
code for all the needed switches; will add keys next.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.40654afce24f.I0e35151f69e7513be53ddb8f008e9ab48278c352@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: track station mask for BAIDs
Johannes Berg [Sun, 16 Apr 2023 12:47:34 +0000 (15:47 +0300)]
wifi: iwlwifi: mvm: track station mask for BAIDs

When we have MLO connections, a BAID applies to multiple
firmware stations. Track the station mask instead of the
station ID, getting rid of a few more deflink cases and
preparing for handling link switching for BAIDs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.c08523808c34.I719b7bba499648d1495ed3e3a90889d4732ef15d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: bump FW API to 77 for AX devices
Gregory Greenman [Sun, 16 Apr 2023 12:47:33 +0000 (15:47 +0300)]
wifi: iwlwifi: bump FW API to 77 for AX devices

Start supporting API version 77 for AX devices.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.e522ccefe354.If7628363fafeb7687163103e734206915c445197@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: use correct sta mask to remove queue
Johannes Berg [Sun, 16 Apr 2023 12:47:32 +0000 (15:47 +0300)]
wifi: iwlwifi: mvm: use correct sta mask to remove queue

When we remove a queue we need to use the currently active
firmware stations in the mask, not the deflink one. Fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.01cdd2153418.I176d54f2d869f51b3707d056adb96455cf885f93@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: avoid iterating over an un-initialized list
Avraham Stern [Sun, 16 Apr 2023 12:47:31 +0000 (15:47 +0300)]
wifi: iwlwifi: mvm: avoid iterating over an un-initialized list

The initiator smooth list is initialized only in iwl_mvm_up(), but is
cleared in iwl_mvm_mac_stop. This may result in iterating over the
list before it was initialized in case iwl_mvm_up() failed early.
Fix it by moving the list initialization to an earlier stage.

Fixes: b68bd2e3143a ("iwlwifi: mvm: Add FTM initiator RTT smoothing logic")
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.b50b1fe9a576.Ie348ffae110612d2e252ac120a3ba0aea063b1b6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: factor out iwl_mvm_sta_fw_id_mask()
Johannes Berg [Sun, 16 Apr 2023 12:47:30 +0000 (15:47 +0300)]
wifi: iwlwifi: mvm: factor out iwl_mvm_sta_fw_id_mask()

We are going to need this in more places than just the
key code, so factor out the functionality of getting
the FW station ID mask (filtered to a specific link if
needed) to a separate function that can now be called
both under RCU and mvm->mutex protection.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.eff92b93025d.I2c50290a0537d5db3d3460f4d57c78a4712ffb75@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: properly implement HE AP support
Johannes Berg [Sun, 16 Apr 2023 12:47:29 +0000 (15:47 +0300)]
wifi: iwlwifi: mvm: properly implement HE AP support

The firmware split the HE support field into HE and "pseudo HE",
the latter is really for AP and doesn't implement trigger frame
handling for example.

Use the new field for AP mode.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.34dbfefe2a49.I0e39cd35dbe03ff9209b26733746479eae1c8966@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: Fix _iwl_mvm_get_scan_type()
Ilan Peer [Sun, 16 Apr 2023 12:47:28 +0000 (15:47 +0300)]
wifi: iwlwifi: mvm: Fix _iwl_mvm_get_scan_type()

The usage of the 'dtim_period' value was wrong, as it is only
a multiplier of the beacon interval, and thus, beacon interval should
also be considered. Fix it.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.e08293d6cace.I25f8cea3189472bd714676ca38b121d7c60fb9d9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: fix getting lowest TX rate for MLO
Johannes Berg [Sun, 16 Apr 2023 12:47:27 +0000 (15:47 +0300)]
wifi: iwlwifi: mvm: fix getting lowest TX rate for MLO

In iwl_mvm_mac_ctxt_get_lowest_rate() we were still accessing
vif->bss_conf without any multi-link provisions, and also the
info->band, both of which isn't valid in MLO.

Fix the code to look at the correct link. In case of EAPOL
transmissions for the initial 4-way-HS, look up the correct
link here as well, and warn if multiple are active.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.d892f68d3bcd.I7d6927abeea5c3899db225391dbc6a5c77805e80@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: call napi_synchronize() before freeing rx/tx queues
Gregory Greenman [Sun, 16 Apr 2023 12:47:26 +0000 (15:47 +0300)]
wifi: iwlwifi: call napi_synchronize() before freeing rx/tx queues

When rx/tx queues are being freed, on a different CPU there could be
still rx flow running. Call napi_synchronize() to prevent such a race.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Co-developed-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Link: https://lore.kernel.org/r/20230416154301.5171ee44dcc1.Iff18718540da412e084e7d8266447d40730600ed@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: nvm-parse: add full BW UL MU-MIMO support
Johannes Berg [Sun, 16 Apr 2023 12:47:25 +0000 (15:47 +0300)]
wifi: iwlwifi: nvm-parse: add full BW UL MU-MIMO support

For some devices, in client mode, we support full bandwidth
uplink multi-user MIMO. Add the necessary capability.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.88b6aac6c876.Ibf2a7a38d7a172c371c347c9d4441e8c656cefe3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agobcma: Add explicit of_device.h include
Rob Herring [Mon, 10 Apr 2023 23:27:01 +0000 (18:27 -0500)]
bcma: Add explicit of_device.h include

bcma/main.c uses of_dma_configure() which is declared in of_device.h.
of_device.h gets implicitly included by of_platform.h, but that is going
to be removed soon.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230410232701.1561613-1-robh@kernel.org
18 months agowifi: rtl8xxxu: Support devices with 5-6 out endpoints
Bitterblue Smith [Mon, 10 Apr 2023 15:36:48 +0000 (18:36 +0300)]
wifi: rtl8xxxu: Support devices with 5-6 out endpoints

Handle them the same way as the devices with 3-4 USB out endpoints.
This is needed for the RTL8192FU.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/ef4bc66d-84f5-4021-efd7-1787d097519c@gmail.com
18 months agowifi: rtl8xxxu: Clean up some messy ifs
Bitterblue Smith [Mon, 10 Apr 2023 15:35:45 +0000 (18:35 +0300)]
wifi: rtl8xxxu: Clean up some messy ifs

Add some new members to rtl8xxxu_fileops and use them instead of
checking priv->rtl_chip.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/e24a5534-6e33-cfb9-0634-0caf4646513f@gmail.com
18 months agowifi: brcmfmac: add Cypress 43439 SDIO ids
Marek Vasut [Fri, 7 Apr 2023 20:37:52 +0000 (22:37 +0200)]
wifi: brcmfmac: add Cypress 43439 SDIO ids

Add SDIO ids for use with the muRata 1YN (Cypress CYW43439).
The odd thing about this is that the previous 1YN populated
on M.2 card for evaluation purposes had BRCM SDIO vendor ID,
while the chip populated on real hardware has a Cypress one.
The device ID also differs between the two devices. But they
are both 43439 otherwise, so add the IDs for both.

On-device 1YN (43439), the new one, chip label reads "1YN":
```
/sys/.../mmc_host/mmc2/mmc2:0001 # cat vendor device
0x04b4
0xbd3d
```

EA M.2 evaluation board 1YN (43439), the old one, chip label reads "1YN ES1.4":
```
/sys/.../mmc_host/mmc0/mmc0:0001/# cat vendor device
0x02d0
0xa9a6
```

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230407203752.128539-1-marex@denx.de
18 months agowifi: rtw89: fix crash due to null pointer of sta in AP mode
Ping-Ke Shih [Thu, 6 Apr 2023 09:30:09 +0000 (17:30 +0800)]
wifi: rtw89: fix crash due to null pointer of sta in AP mode

In AP mode, 'sta' could be NULL if sending broadcast/multicast packets,
so we should check before accessing, or it causes crash:

  BUG: kernel NULL pointer dereference, address: 0000000000000004
  #PF: supervisor read access in kernel mode
  #PF: error_code(0x0000) - not-present page
  PGD 0 P4D 0
  Oops: 0000 [#1] PREEMPT SMP PTI
  CPU: 2 PID: 92 Comm: kworker/u33:0 Tainted: G           OE
  Workqueue: rtw89_tx_wq rtw89_core_txq_work [rtw89_core]
  RIP: 0010:rtw89_core_tx_update_desc_info+0x2cc/0x7d0 [rtw89_core]
  Code: e2 01 41 be 04 00 00 00 41 8b 84 c4 0c 01 00 00 75 0d 45 31 f6 ...
  RSP: 0018:ffffb4cf807afce0 EFLAGS: 00010297
  RAX: 0000000000000001 RBX: ffffb4cf807afd48 RCX: 0000000000000000
  RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001
  RBP: ffffb4cf807afd30 R08: ffff9b28c1e59808 R09: ffff9b28c0297100
  R10: 00000000052cf7c4 R11: 00000000052cf7c4 R12: ffff9b28c1602040
  R13: ffff9b28c07b3000 R14: 0000000000000004 R15: 0000000000000000
  FS:  0000000000000000(0000) GS:ffff9b2a73280000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000000000004 CR3: 00000001ca410003 CR4: 00000000000606e0
  Call Trace:
   <TASK>
   rtw89_core_tx_write+0x7c/0x100 [rtw89_core]
   rtw89_core_txq_work+0x1b4/0x530 [rtw89_core]
   process_one_work+0x222/0x3f0
   worker_thread+0x50/0x3f0
   kthread+0x16b/0x190
   ? rescuer_thread+0x3a0/0x3a0
   ? set_kthread_struct+0x50/0x50
   ret_from_fork+0x22/0x30
   </TASK>

Fixes: e5307c9cd7ee ("wifi: rtw89: set data lowest rate according to AP supported rate")
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230406093009.5869-1-pkshih@realtek.com
18 months agowifi: rtw89: correct 5 MHz mask setting
Eric Huang [Thu, 6 Apr 2023 07:28:41 +0000 (15:28 +0800)]
wifi: rtw89: correct 5 MHz mask setting

Use primary channel index to determine which 5 MHz mask should be enable.
This mask is used to prevent noise from channel edge to effect CCA
threshold in wide bandwidth (>= 40 MHZ).

Fixes: 1b00e9236a71 ("rtw89: 8852c: add set channel of BB part")
Fixes: 6b0698984eb0 ("wifi: rtw89: 8852b: add chip_ops::set_channel")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Huang <echuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230406072841.8308-1-pkshih@realtek.com
18 months agowifi: rtw89: 8851b: add tables for RFK
Ping-Ke Shih [Sat, 1 Apr 2023 14:25:48 +0000 (22:25 +0800)]
wifi: rtw89: 8851b: add tables for RFK

These tables are used by RF calibrations to assist to configure PHY and
RF registers.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230401142548.55466-4-pkshih@realtek.com
18 months agowifi: rtw89: 8851b: add BB and RF tables (2 of 2)
Ping-Ke Shih [Sat, 1 Apr 2023 14:25:47 +0000 (22:25 +0800)]
wifi: rtw89: 8851b: add BB and RF tables (2 of 2)

These tables contain BB and RF parameters that driver will load them into
registers. It also contains TX power according to country, band, rate and
so on. Increasing thermal can cause TX power degraded, so power tracking
tables are defined to compensate TX power.

Internal version of these tables:
 - HALBB_029_106_15 (V17)
 - HALRF_029_00_089
   * Radio A 0x22
   * NCTL 0x5

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230401142548.55466-3-pkshih@realtek.com
18 months agowifi: rtw89: 8851b: add BB and RF tables (1 of 2)
Ping-Ke Shih [Sat, 1 Apr 2023 14:25:46 +0000 (22:25 +0800)]
wifi: rtw89: 8851b: add BB and RF tables (1 of 2)

These tables contain BB and RF parameters that driver will load them into
registers. It also contains TX power according to country, band, rate and
so on. Increasing thermal can cause TX power degraded, so power tracking
tables are defined to compensate TX power.

Internal version of these tables:
 - HALBB_029_106_15 (V17)
 - HALRF_029_00_089
   * Radio A 0x22
   * NCTL 0x5

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230401142548.55466-2-pkshih@realtek.com
18 months agowifi: rtw89: pci: update PCI related settings to support 8851B
Ping-Ke Shih [Thu, 30 Mar 2023 13:33:24 +0000 (21:33 +0800)]
wifi: rtw89: pci: update PCI related settings to support 8851B

Many settings of 8851B are like 8852A or 8852B. Change them to proper
settings as hardware design.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230330133324.19538-5-pkshih@realtek.com
18 months agowifi: rtw89: mac: update MAC settings to support 8851b
Ping-Ke Shih [Thu, 30 Mar 2023 13:33:23 +0000 (21:33 +0800)]
wifi: rtw89: mac: update MAC settings to support 8851b

Many settings of 8851B are the same as 8852B or 8852A, like DLE (Data link
engine), security engine and so on. Update them according to hardware
design.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230330133324.19538-4-pkshih@realtek.com
18 months agowifi: rtw89: 8851b: fix TX path to path A for one RF path chip
Ping-Ke Shih [Thu, 30 Mar 2023 13:33:22 +0000 (21:33 +0800)]
wifi: rtw89: 8851b: fix TX path to path A for one RF path chip

For two RF paths chips, we normally set path B as main path by default.
8851B has single one RF path, so set TX path to A and set mapping of
path B to 0.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230330133324.19538-3-pkshih@realtek.com
18 months agowifi: rtw89: read version of analog hardware
Ping-Ke Shih [Thu, 30 Mar 2023 13:33:21 +0000 (21:33 +0800)]
wifi: rtw89: read version of analog hardware

The chip contains digital and analog parts, and each of them has its own
version number. This is used by BT coexistence mechanism to make strategy
decision for different analog version.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230330133324.19538-2-pkshih@realtek.com
18 months agowifi: rtw89: use hardware CFO to improve performance
Eric Huang [Thu, 30 Mar 2023 13:23:52 +0000 (21:23 +0800)]
wifi: rtw89: use hardware CFO to improve performance

Turn on hardware CFO (central frequency offset) compensation based on IC
capability, and improve digital CFO compensation accuracy by using
more fixed points number.

Signed-off-by: Eric Huang <echuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230330132352.13647-1-pkshih@realtek.com
18 months agowifi: rtw89: support parameter tables by RFE type
Zong-Zhe Yang [Thu, 30 Mar 2023 08:03:31 +0000 (16:03 +0800)]
wifi: rtw89: support parameter tables by RFE type

One chip can have different RFE (RF front end) types which we will judge
at runtime. And, different RFE types may use different RF parameter tables.
Though we didn't really meet this case previously, we are going to meet it
on upcoming chip RTL8851B. So, this commit handles parameter tables for
runtime RFE type.

We now encapsulate rtw89_txpwr_rule_<2/5/6>ghz tables into rtw89_rfe_parms.
Then, each chip defines its default parameter tables, and if needed, it can
configure extra parameter tables by RFE type. Finally we determine runtime
parameter tables by RFE type if one is configured. Otherwise, we use the
default parameter tables.

For now, we just move all settings under default parameter tables. We will
configure parameter tables by RFE types in separate commits afterwards.

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://lore.kernel.org/r/20230330080331.37155-1-pkshih@realtek.com
18 months agowifi: rtw89: add firmware format version to backward compatible with older drivers
Ping-Ke Shih [Mon, 20 Mar 2023 13:06:06 +0000 (21:06 +0800)]
wifi: rtw89: add firmware format version to backward compatible with older drivers

In the discuss threads [1] [2], new firmware format break user space
because older drivers can't recognize new firmware format. To avoid this,
the new format will be named rtw89/rtw8852b_fw-1.bin and only new driver
try to load it. Old drivers only load original and understandable firmware
rtw89/rtw8852b_fw.bin.

More, new driver will be still backward compatible with old firmware, so
original firmware can be used by new driver.

If there is newer firmware format is introduced, rtw89/rtw8852b_fw-2.bin
will be given. The same rules will be applied like above. So, we will have
firmware like below in linux-firmware in the future.

  rtw89/rtw8852b_fw-2.bin
  rtw89/rtw8852b_fw-1.bin
  rtw89/rtw8852b_fw.bin

After this patch, MODULE_FIRMWARE() of 8852A/B/C become
  rtw89/rtw8852a_fw.bin
  rtw89/rtw8852b_fw-1.bin
  rtw89/rtw8852c_fw.bin

[1] https://lore.kernel.org/linux-wireless/df1ce994-3368-a57e-7078-8bdcccf4a1fd@gmail.com/T/#m24cb43be31a762d0ea70bf07f27ae96c59f6931b
[2] https://bugzilla.kernel.org/show_bug.cgi?id=217207

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230320130606.20777-4-pkshih@realtek.com
18 months agowifi: rtw89: use schedule_work to request firmware
Ping-Ke Shih [Mon, 20 Mar 2023 13:06:05 +0000 (21:06 +0800)]
wifi: rtw89: use schedule_work to request firmware

Since we are going to load more than one firmware and some are not
presented or optional, using asynchronous API request_firmware_nowait()
will become complicated. Also, we want to use firmware_request_nowarn()
to avoid warning messages when loading optional files. So, use
schedule_work to be simpler.

To abstract loading a firmware or file, define a struct rtw89_fw_req_info
containing a struct firmware and a completion to ensure this firmware is
loaded completely.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230320130606.20777-3-pkshih@realtek.com
18 months agowifi: rtw89: fw: use generic flow to set/check features
Zong-Zhe Yang [Mon, 20 Mar 2023 13:06:04 +0000 (21:06 +0800)]
wifi: rtw89: fw: use generic flow to set/check features

In early feature bitmap obtained from rtw89_early_fw_feature_recognize(),
the bits needed to check get increased. It's more friendly to work with
RTW89_CHK_FW_FEATURE(). So, we concentrate the flow of iterating FW feature
configures and calling RTW89_SET_FW_FEATURE() for various uses. And then,
we adjust rtw89_early_fw_feature_recognize() for RTW89_CHK_FW_FEATURE().

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://lore.kernel.org/r/20230320130606.20777-2-pkshih@realtek.com
18 months agowifi: rtw89: fix authentication fail during scan
Po-Hao Huang [Tue, 11 Apr 2023 12:48:32 +0000 (20:48 +0800)]
wifi: rtw89: fix authentication fail during scan

We used to store operating channel info after associated. However, scan
might happen before that. Without switching back to operating channel,
authentication or association might fail. Therefore, we switch back to
operating channel when the scanning vif's BSSID is non-zero, which
implies connected or during attempt to connect.

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://lore.kernel.org/r/20230411124832.14965-6-pkshih@realtek.com
18 months agowifi: rtw89: add flag check for power state
Po-Hao Huang [Tue, 11 Apr 2023 12:48:31 +0000 (20:48 +0800)]
wifi: rtw89: add flag check for power state

Use POWER_ON flag to make sure power on/off is symmetric. Since both
remain_on_channel and hw_scan both alter the power state, this makes
sure that we don't enter/leave IPS mode twice.
Also, replace IPS related functions with inline function that does
similar logic so we can track it more easily.

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://lore.kernel.org/r/20230411124832.14965-5-pkshih@realtek.com
18 months agowifi: rtw89: add ieee80211::remain_on_channel ops
Po-Hao Huang [Tue, 11 Apr 2023 12:48:30 +0000 (20:48 +0800)]
wifi: rtw89: add ieee80211::remain_on_channel ops

Add support of remain on channel ops. Since channel context is
required to enable multi-channel concurrent(MCC) and the current
ROC in mac80211 don't support more than 1 channel context, add this
to let P2P and other protocols relying on this work as expected.
The off-channel duration and cancel timing is purely controlled by
upper layers.

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://lore.kernel.org/r/20230411124832.14965-4-pkshih@realtek.com
18 months agowifi: rtw89: add function to wait for completion of TX skbs
Po-Hao Huang [Tue, 11 Apr 2023 12:48:29 +0000 (20:48 +0800)]
wifi: rtw89: add function to wait for completion of TX skbs

Allocate a per-skb completion to track those skbs we are interested in
and wait for them to complete transmission with TX status.

Normally, the completion object is freed by wait side, but it could be
timeout result that complete side should free the object instead. Add a
owner field with RCU to determine which side should free the object.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
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://lore.kernel.org/r/20230411124832.14965-3-pkshih@realtek.com
18 months agowifi: rtw89: 8852c: add beacon filter and CQM support
Po-Hao Huang [Tue, 11 Apr 2023 12:48:28 +0000 (20:48 +0800)]
wifi: rtw89: 8852c: add beacon filter and CQM support

Adding this supports beacon filter and connection quality monitor.
To make host CPU wake up less, let firmware perform signal
monitoring and beacon processing, then notify driver upon signal
changes or beacon loss.

This feature needs firmware 0.27.56 or newer to support it.

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://lore.kernel.org/r/20230411124832.14965-2-pkshih@realtek.com
18 months agowifi: iwlwifi: mvm: tx: remove misleading if statement
Johannes Berg [Fri, 14 Apr 2023 10:12:06 +0000 (13:12 +0300)]
wifi: iwlwifi: mvm: tx: remove misleading if statement

The if statement here is misleading, we return zero anyway
since we just checked the 'ret' variable, simplify the code
to remove the condition entirely.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230414130637.57c1eb58e655.I1b47a7771cd66306931089c150c6b5b240bdcba5@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: Fix setting the rate for non station cases
Ilan Peer [Fri, 14 Apr 2023 10:12:05 +0000 (13:12 +0300)]
wifi: iwlwifi: mvm: Fix setting the rate for non station cases

The setting of the rate used for non station cases did not take into
consideration the interface type etc., thus when probe responses
are transmitted on P2P Device interface etc. CCK rates were used
which is not allowed.

Modify the code so the non station case would consider the
interface type etc. For HWs/FWs that do not support rate control,
preserve the previous behavior, i.e., take the rate from the
skb metadata and adjust as needed.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230414130637.fa0e4d42205d.Iab4784560c77b965fec070d4d0a1ec84171d94ff@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: validate station properly in flush
Johannes Berg [Fri, 14 Apr 2023 10:12:04 +0000 (13:12 +0300)]
wifi: iwlwifi: mvm: validate station properly in flush

If we have MLO, then the deflink.ap_sta_id cannot be used.
However, we can use the new mvmvif->ap_sta pointer for the
validation instead.

Also don't do it multiple times for different FW instances
of the same AP STA (TDLS STAs are only on a single link).

Note that this isn't really working right yet since the
underlying flush code hasn't been updated yet to know of
multiple link STAs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230414130637.7d747df44d65.Ie5392859fab4cfb73c20b49bfee2caadef5fd8ec@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: set STA mask for keys in MLO
Johannes Berg [Fri, 14 Apr 2023 10:12:03 +0000 (13:12 +0300)]
wifi: iwlwifi: mvm: set STA mask for keys in MLO

Implement the full STA mask and selecting the correct link
for key installation.

While at it, catch errors if this function returns a bad
zero station mask, rather than waiting for the firmware to
crash on it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230414130637.cedae2f21829.Iae07b736c3109d085ad5b74ec8282ce45020da39@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: fix ptk_pn memory leak
Johannes Berg [Fri, 14 Apr 2023 10:12:02 +0000 (13:12 +0300)]
wifi: iwlwifi: mvm: fix ptk_pn memory leak

If adding a key to firmware fails we leak the allocated ptk_pn.
This shouldn't happen in practice, but we should still fix it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230414130637.99446ffd02bc.I82a2ad6ec1395f188e0a1677cc619e3fcb1feac9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: make iwl_mvm_mac_ctxt_send_beacon() static
Johannes Berg [Fri, 14 Apr 2023 10:12:01 +0000 (13:12 +0300)]
wifi: iwlwifi: mvm: make iwl_mvm_mac_ctxt_send_beacon() static

We never needed this to be non-static, that was just an
artifact of the development process. Make it static.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230414130637.3c018c15f948.I87fd1aee288f33312a7206492608002d4e8e213e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 months agowifi: iwlwifi: mvm: track AP STA pointer and use it for MFP
Johannes Berg [Fri, 14 Apr 2023 10:12:00 +0000 (13:12 +0300)]
wifi: iwlwifi: mvm: track AP STA pointer and use it for MFP

Instead of relying on the AP STA ID and dereferencing our
firmware -> mac80211 STA array when we really only need
the STA, not the per-link information (and might not have
it, e.g. for a pairwise key installation where this is
relevant), keep track of the AP STA as a pointer to the
mac80211 STA, protected by the mutex. Then use it here in
the key code instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230414130637.7db01b1508de.I88e6d252cdb0a6e4581d7c5fd7cbc037b4fd40ae@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>