aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-04-17wifi: mt76: mt7921: fix missing unwind goto in `mt7921u_probe`Jiefeng Li1-1/+1
`mt7921u_dma_init` can only return zero or negative number according to its definition. When it returns non-zero number, there exists an error and this function should handle this error rather than return directly. Fixes: 0d2afe09fad5 ("mt76: mt7921: add mt7921u driver") Signed-off-by: Jiefeng Li <[email protected]> Reviewed-by: Dongliang Mu <[email protected]> Reviewed-by: Sridhar Samudrala <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17mt76: mt7921: fix kernel panic by accessing unallocated eeprom.dataSean Wang1-20/+0
The MT7921 driver no longer uses eeprom.data, but the relevant code has not been removed completely since commit 16d98b548365 ("mt76: mt7921: rely on mcu_get_nic_capability"). This could result in potential invalid memory access. To fix the kernel panic issue in mt7921, it is necessary to avoid accessing unallocated eeprom.data which can lead to invalid memory access. Furthermore, it is possible to entirely eliminate the mt7921_mcu_parse_eeprom function and solely depend on mt7921_mcu_parse_response to divide the RxD header. [2.702735] BUG: kernel NULL pointer dereference, address: 0000000000000550 [2.702740] #PF: supervisor write access in kernel mode [2.702741] #PF: error_code(0x0002) - not-present page [2.702743] PGD 0 P4D 0 [2.702747] Oops: 0002 [#1] PREEMPT SMP NOPTI [2.702755] RIP: 0010:mt7921_mcu_parse_response+0x147/0x170 [mt7921_common] [2.702758] RSP: 0018:ffffae7c00fef828 EFLAGS: 00010286 [2.702760] RAX: ffffa367f57be024 RBX: ffffa367cc7bf500 RCX: 0000000000000000 [2.702762] RDX: 0000000000000550 RSI: 0000000000000000 RDI: ffffa367cc7bf500 [2.702763] RBP: ffffae7c00fef840 R08: ffffa367cb167000 R09: 0000000000000005 [2.702764] R10: 0000000000000000 R11: ffffffffc04702e4 R12: ffffa367e8329f40 [2.702766] R13: 0000000000000000 R14: 0000000000000001 R15: ffffa367e8329f40 [2.702768] FS: 000079ee6cf20c40(0000) GS:ffffa36b2f940000(0000) knlGS:0000000000000000 [2.702769] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [2.702775] CR2: 0000000000000550 CR3: 00000001233c6004 CR4: 0000000000770ee0 [2.702776] PKRU: 55555554 [2.702777] Call Trace: [2.702782] mt76_mcu_skb_send_and_get_msg+0xc3/0x11e [mt76 <HASH:1bc4 5>] [2.702785] mt7921_run_firmware+0x241/0x853 [mt7921_common <HASH:6a2f 6>] [2.702789] mt7921e_mcu_init+0x2b/0x56 [mt7921e <HASH:d290 7>] [2.702792] mt7921_register_device+0x2eb/0x5a5 [mt7921_common <HASH:6a2f 6>] [2.702795] ? mt7921_irq_tasklet+0x1d4/0x1d4 [mt7921e <HASH:d290 7>] [2.702797] mt7921_pci_probe+0x2d6/0x319 [mt7921e <HASH:d290 7>] [2.702799] pci_device_probe+0x9f/0x12a Fixes: 16d98b548365 ("mt76: mt7921: rely on mcu_get_nic_capability") Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: move mcu_uni_event and mcu_reg_event in common codeLorenzo Bianconi5-30/+19
mcu_uni_event and mcu_reg_event structs are shared between mt7921 and mt7615 drivers, so move them in connac lib. Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7996: enable coredump supportRyder Lee9-2/+496
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 <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7996: add full system reset knobs into debugfsRyder Lee6-30/+178
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 <[email protected]> Signed-off-by: Bo Jiao <[email protected]> Signed-off-by: Ryder Lee <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7996: enable full system reset supportBo Jiao8-71/+365
Add mt7996_reset() and refactor mt7996_mac_reset_work() to support full system recovery. Signed-off-by: Bo Jiao <[email protected]> Signed-off-by: Ryder Lee <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7921: enable p2p supportSean Wang6-13/+18
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 <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7921: Replace fake flex-arrays with flexible-array membersGustavo A. R. Silva1-5/+5
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 [1] Signed-off-by: Gustavo A. R. Silva <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: Replace zero-length array with flexible-array memberGustavo A. R. Silva1-1/+1
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 [1] Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [2] Signed-off-by: Gustavo A. R. Silva <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7921: add Netgear AXE3000 (A8000) supportReese Russell1-0/+3
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 <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7915: drop redundant prefix of mt7915_txpower_puts()Ryder Lee1-18/+18
Just a cosmetic patch to drop redundant prefix for txpower ouput text. Signed-off-by: Ryder Lee <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: fix 6GHz high channel not be scannedMing Yen Hsieh1-3/+10
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 <[email protected]> Tested-by: Isaac Konikoff <[email protected]> Signed-off-by: Ming Yen Hsieh <[email protected]> Signed-off-by: Deren Wu <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7921e: fix probe timeout after rebootQuan Zhou1-3/+3
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 <[email protected]> Signed-off-by: Deren Wu <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: move shared mac definitions in mt76_connac2_mac.hLorenzo Bianconi17-120/+59
Move some mac shared definitions between mt7996, mt7921 and mt7915 in mt76_connac2_mac.h. Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7921: get rid of eeprom.hLorenzo Bianconi5-33/+11
eeprom.h is mostly empty for mt7921, so get rid of it. Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: add mt76_connac_gen_ppe_thresh utility routineLorenzo Bianconi5-66/+25
gen_ppe_thresh routine is shared between mt7615, mt7915, mt7921 and mt7996 so move it in mt76_connac module. Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: get rid of unused sta_ps callbacksLorenzo Bianconi17-31/+2
sta_ps callback is just an empty stub for most of the drivers, so get rid of them. Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: add mt76_connac_irq_enable utility routineLorenzo Bianconi7-30/+20
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 <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: move irq_tasklet in mt76_dev structLorenzo Bianconi15-28/+24
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 <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7921e: Set memory space enable in PCI_COMMAND if unsetMario Limonciello1-0/+6
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 <[email protected]> Signed-off-by: Mario Limonciello <[email protected]> Acked-by: Sean Wang <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7921: use driver flags rather than mac80211 flags to mcuNeil Chen1-1/+16
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 <[email protected]> Signed-off-by: Deren Wu <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7921: introduce mt7921_get_mac80211_ops utility routineLorenzo Bianconi5-55/+35
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 <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7996: fix eeprom tx path bitfieldsStanleyYP Wang1-4/+4
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 <[email protected]> Signed-off-by: Shayne Chen <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7996: remove mt7996_mcu_set_pm()Peter Chiu3-35/+0
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 <[email protected]> Signed-off-by: Shayne Chen <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7996: init mpdu density capPeter Chiu1-2/+7
Init mpdu density based on the hardware capability to prevent rx drop. Signed-off-by: Peter Chiu <[email protected]> Signed-off-by: Shayne Chen <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7996: fix pointer calculation in ie countdown eventPeter Chiu1-1/+2
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 <[email protected]> Signed-off-by: Shayne Chen <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7996: remove unused eeprom band selectionShayne Chen2-5/+0
Tri-band chipsets support one band on each a-die, so remove the unused definition of eeprom band selection. Signed-off-by: Shayne Chen <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7996: let non-bufferable MMPDUs use correct hw queueShayne Chen3-10/+12
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 <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7996: add eht rx rate supportShayne Chen3-11/+27
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 <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7996: remove mt7996_mcu_beacon_check_caps()Ryder Lee3-124/+8
Those capabilities have been added into ieee80211_bss_conf. Signed-off-by: Ryder Lee <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7915: remove mt7915_mcu_beacon_check_caps()Ryder Lee3-110/+12
Those capabilities have been added into ieee80211_bss_conf. Signed-off-by: Ryder Lee <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: connac: refresh tx session timer for WED deviceRyder Lee1-0/+11
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 <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17SUNRPC: Fix failures of checksum Kunit testsChuck Lever1-1/+4
Scott reports that when the new GSS krb5 Kunit tests are built as a separate module and loaded, the RFC 6803 and RFC 8009 checksum tests all fail, even though they pass when run under kunit.py. It appears that passing a buffer backed by static const memory to gss_krb5_checksum() is a problem. A printk in checksum_case() shows the correct plaintext, but by the time the buffer has been converted to a scatterlist and arrives at checksummer(), it contains all zeroes. Replacing this buffer with one that is dynamically allocated fixes the issue. Reported-by: Scott Mayhew <[email protected]> Fixes: 02142b2ca8fc ("SUNRPC: Add checksum KUnit tests for the RFC 6803 encryption types") Tested-by: Scott Mayhew <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
2023-04-17wifi: mt76: add missing locking to protect against concurrent rx/status callsFelix Fietkau5-3/+18
According to the documentation, ieee80211_rx_list must not run concurrently with ieee80211_tx_status (or its variants). Cc: [email protected] Fixes: 88046b2c9f6d ("mt76: add support for reporting tx status with skb") Reported-by: Brian Coverstone <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: handle failure of vzalloc in mt7615_coredump_workKang Chen1-3/+5
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 <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: drop the incorrect scatter and gather framePeter Chiu2-2/+5
The scatter and gather frame may be incorrect because WED and WO may send frames to host driver interleaved. Signed-off-by: Peter Chiu <[email protected]> Signed-off-by: Sujuan Chen <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7915: rework init flow in mt7915_thermal_init()Howard Hsu1-4/+4
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 <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7915: add dev->hif2 support for mt7916 WED deviceSujuan Chen3-8/+16
Enable two PCIe interfaces (dev->hif2) support for mt7916 when WED is enabled. Signed-off-by: Sujuan Chen <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7915: expose device tree match tableLorenz Brun1-0/+2
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 <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: dynamic channel bandwidth changes in AP modeRyder Lee1-1/+2
Allow AP to change channel width for 40Mhz intolerant STA on the 2.4 GHz band. Signed-off-by: Himanshu Goyal <[email protected]> Signed-off-by: Ryder Lee <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7996: fix radiotap bitfieldRyder Lee2-48/+47
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 <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7915: unlock on error in mt7915_thermal_temp_store()Dan Carpenter1-0/+1
Drop the lock before returning -EINVAL. Fixes: ecaccdae7a7e ("wifi: mt76: mt7915: rework mt7915_thermal_temp_store()") Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7996: Remove unneeded semicolonYang Li1-1/+1
./drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:3136:3-4: Unneeded semicolon Reported-by: Abaci Robot <[email protected]> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4059 Signed-off-by: Yang Li <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7921: fix PCI DMA hang after rebootDeren Wu1-11/+1
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 <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: mt7921: fix wrong command to set STA channelDeren Wu1-1/+1
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 <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17dt-bindings: mt76: add active-low property for ledFrank Wunderlich1-0/+5
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 <[email protected]> Acked-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: mt76: remove redundent MCU_UNI_CMD_* definitionsDeren Wu1-3/+0
clear redundent definitions only Fixes: 5b55b6da982c ("wifi: mt76: mt7921: add unified ROC cmd/event support") Signed-off-by: Deren Wu <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17wifi: ath9k: fix per-packet TX-power cap for TPCJonas Jelonek1-6/+24
Fix incorrect usage of plain rate_idx as index into the max (power) per rate lookup table. For transmit power control (TPC), the ath9k driver maintains internal tables (in struct ath_hw) to store the max allowed power level per rate. They are used to limit a given TX-power according to regulatory and user limits in the TX-path per packet. The tables are filled in a predefined order, starting with values for CCK + OFDM rates and followed by the values for MCS rates. Thus, the maximum power levels for MCS do not start at index 0 in the table but are shifted by a fixed value. The TX-power limiting in ath_get_rate_txpower currently does not apply this shift, thus retrieves the incorrect maximum power level for a given rate. In particular for MCS rates, the maximum power levels for CCK/OFDM rates were used, e.g. maximum power for OFDM 0 was used for MCS 0. If STBC is used, the power is mostly limited to 0 because the STBC table is zeroed for legacy CCK/OFDM rates. Encountered this during testing of our work-in-progress TPC per packet for ath9k. This only has an effect when TPC is enabled in ath9k (tpc_enabled in struct ath_hw) which defaults to false. In this case it has a significant impact on the used TX-power, throughput + RSSI. Otherwise the affected code is just skipped and TX-power is limited with the hardware registers only. This patch fixes this table lookup. Tested on OpenWrt (kernel 5.15.98, but backported ath9k driver) with small desk setup using ath9k chips AR9280 and AR9580. Cap of TX-power is working properly for all rates now, throughput and RSSI as expected, equal to as if TPC was disabled. Compile-tested with latest 6.3 kernel + allyesconfig. Signed-off-by: Jonas Jelonek <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2023-04-17wifi: ath11k: fix undefined behavior with __fls in dpHarshitha Prem1-1/+1
"__fls" would have an undefined behavior if the argument is passed as "0". Hence, added changes to handle the same. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 Signed-off-by: Harshitha Prem <[email protected]> Signed-off-by: Nagarajan Maran <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2023-04-17wifi: ath11k: Ignore frags from uninitialized peer in dp.Harshitha Prem3-1/+12
When max virtual ap interfaces are configured in all the bands with ACS and hostapd restart is done every 60s, a crash is observed at random times. In this certain scenario, a fragmented packet is received for self peer, for which rx_tid and rx_frags are not initialized in datapath. While handling this fragment, crash is observed as the rx_frag list is uninitialised and when we walk in ath11k_dp_rx_h_sort_frags, skb null leads to exception. To address this, before processing received fragments we check dp_setup_done flag is set to ensure that peer has completed its dp peer setup for fragment queue, else ignore processing the fragments. Call trace: ath11k_dp_process_rx_err+0x550/0x1084 [ath11k] ath11k_dp_service_srng+0x70/0x370 [ath11k] 0xffffffc009693a04 __napi_poll+0x30/0xa4 net_rx_action+0x118/0x270 __do_softirq+0x10c/0x244 irq_exit+0x64/0xb4 __handle_domain_irq+0x88/0xac gic_handle_irq+0x74/0xbc el1_irq+0xf0/0x1c0 arch_cpu_idle+0x10/0x18 do_idle+0x104/0x248 cpu_startup_entry+0x20/0x64 rest_init+0xd0/0xdc arch_call_rest_init+0xc/0x14 start_kernel+0x480/0x4b8 Code: f9400281 f94066a2 91405021 b94a0023 (f9406401) Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 Signed-off-by: Harshitha Prem <[email protected]> Signed-off-by: Nagarajan Maran <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]