Howard Hsu [Tue, 14 Jan 2025 10:10:26 +0000 (18:10 +0800)]
wifi: mt76: mt7996: add implicit beamforming support for mt7992
The configuration of mt7992 iBF has some differences to mt7996, rework
related code to make it work.
Also, most of our chipsets support iBF only on HT and VHT mode, except
mt7992 variant that has 5T on 5GHz band also supports iBF on HE and EHT
mode.
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Link: https://patch.msgid.link/20250114101026.3587702-9-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Michael-CY Lee [Tue, 14 Jan 2025 10:10:25 +0000 (18:10 +0800)]
wifi: mt76: mt7996: fix beacon command during disabling
When stopping AP, mac80211 frees beacon template before it calls
driver's stop_ap operation. In other words, on the path of stopping
AP, ieee80211_beacon_get_template() must returns NULL in
mt7996_mcu_add_beacon(). In such case mt7996 immediately returns
-EINVAL without telling FW to disable the beacon.
This commit refactors mt7996_mcu_add_beacon() so that FW can be
correctly informed when disabling AP interface.
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
Link: https://patch.msgid.link/20250114101026.3587702-8-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Peter Chiu [Tue, 14 Jan 2025 10:10:24 +0000 (18:10 +0800)]
wifi: mt76: mt7996: fix ldpc setting
The non-AP interfaces would not use conf->vht_ldpc so they never set
STA_CAP_VHT_LDPC even if peer-station support LDPC.
Check conf->vht_ldpc only for AP interface.
Without this patch, station only uses BCC to transmit packet in VHT mode.
Fixes:
dda423dd65c3 ("wifi: mt76: mt7996: remove mt7996_mcu_beacon_check_caps()")
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20250114101026.3587702-7-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Benjamin Lin [Tue, 14 Jan 2025 10:10:23 +0000 (18:10 +0800)]
wifi: mt76: mt7996: fix definition of tx descriptor
For mt7992 chipsets, the definition of TXD.DW6.BIT10~15 has different
interpretations on different frame types. Driver only needs to fill
MSDU_CNT for non-management frames.
Fixes:
408566db8cad ("wifi: mt76: connac: add new definition of tx descriptor")
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Link: https://patch.msgid.link/20250114101026.3587702-6-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Howard Hsu [Tue, 14 Jan 2025 10:10:22 +0000 (18:10 +0800)]
wifi: mt76: connac: adjust phy capabilities based on band constraints
Adjust HE and EHT phy capabilities based on the band constraints.
For 2g band, we shall not enable the capabilities above 40MHz.
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20250114101026.3587702-5-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Benjamin Lin [Tue, 14 Jan 2025 10:10:21 +0000 (18:10 +0800)]
wifi: mt76: mt7996: fix incorrect indexing of MIB FW event
Fix wrong calculation of the channel times due to incorrect
interpretation from the FW event.
Fixes:
98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20250114101026.3587702-4-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Howard Hsu [Tue, 14 Jan 2025 10:10:20 +0000 (18:10 +0800)]
wifi: mt76: mt7996: fix HE Phy capability
Set HE SU PPDU And HE MU PPDU With 4x HE-LTF And 0.8 us GI within HE PHY
Capabilities element as 1 since hardware can support.
Fixes:
98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20250114101026.3587702-3-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Howard Hsu [Tue, 14 Jan 2025 10:10:19 +0000 (18:10 +0800)]
wifi: mt76: mt7996: fix the capability of reception of EHT MU PPDU
This commit includes two changes. First, enable "EHT MU PPDU With 4x
EHT-LTF And 0.8us GI" in EHT Phy capabilities element since hardware
can support. Second, fix the value of "Maximum number of supported
EHT LTFs" in the same element, where the previous setting of 3 in
Bit 3-4 was incorrect.
Fixes:
348533eb968d ("wifi: mt76: mt7996: add EHT capability init")
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20250114101026.3587702-2-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Peter Chiu [Tue, 14 Jan 2025 10:10:18 +0000 (18:10 +0800)]
wifi: mt76: mt7996: add max mpdu len capability
Set max mpdu len to 11454 according to hardware capability.
Without this patch, the max ampdu length would be 3895 and count not get
expected performance.
Fixes:
348533eb968d ("wifi: mt76: mt7996: add EHT capability init")
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20250114101026.3587702-1-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Leon Yen [Fri, 12 Apr 2024 08:53:57 +0000 (16:53 +0800)]
wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain
Some countries have strict RF restrictions where changing the regulatory
domain dynamically based on the connected AP is not acceptable.
This patch disables Beacon country IE hinting when a valid country code
is set from usersland (e.g., by system using iw or CRDA).
Signed-off-by: Leon Yen <leon.yen@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Tested-by: David Ruth <druth@chromium.org>
Link: https://patch.msgid.link/20240412085357.13756-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Quan Zhou [Fri, 3 Jan 2025 13:53:50 +0000 (21:53 +0800)]
wifi: mt76: mt7925e: fix too long of wifi resume time
The mt7925e takes a long time to resume in platform resume
scenarios. This is due to the mt7925 reconfiguring the tx
power for each wifi channel during resume. By streamlining
the process and removing redundant power configurations,
the resume time for the mt7925 can be shortened.
Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Link: https://patch.msgid.link/f075d43d87a5eefa5869baf755e9986edf735860.1735910836.git.quan.zhou@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Quan Zhou [Fri, 3 Jan 2025 13:44:54 +0000 (21:44 +0800)]
wifi: mt76: mt7925: add handler to hif suspend/resume event
When the system suspend or resume, the WiFi driver sends
an hif_ctrl command to the firmware and waits for an event.
Due to changes in the event format reported by the chip, the
current mt7925's driver does not account for these changes,
resulting in command timeout. Add flow to handle hif_ctrl
event to avoid command timeout. We also exented API
mt76_connac_mcu_set_hif_suspend for connac3 this time.
Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Link: https://patch.msgid.link/3a0844ff5162142c4a9f3cf7104f75076ddd3b87.1735910562.git.quan.zhou@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Quan Zhou [Fri, 3 Jan 2025 13:39:43 +0000 (21:39 +0800)]
wifi: mt76: mt7925: fix CLC command timeout when suspend/resume
When enter suspend/resume while in a connected state, the upper layer
will trigger disconnection before entering suspend, and at the same time,
it will trigger regd_notifier() and update CLC, causing the CLC event to
not be received due to suspend, resulting in a command timeout.
Therefore, the update of CLC is postponed until resume, to ensure data
consistency and avoid the occurrence of command timeout.
Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Link: https://patch.msgid.link/bab00a2805d0533fd8beaa059222659858a9dcb5.1735910455.git.quan.zhou@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Quan Zhou [Fri, 3 Jan 2025 13:35:59 +0000 (21:35 +0800)]
wifi: mt76: mt7925: fix the unfinished command of regd_notifier before suspend
Before entering suspend, we need to ensure that all MCU command are
completed. In some cases, such as with regd_notifier, there is a
chance that CLC commands, will be executed before suspend.
Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Link: https://patch.msgid.link/3af7b4e5bf7437832b016e32743657d1d55b1f9d.1735910288.git.quan.zhou@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Peter Chiu [Thu, 9 Jan 2025 11:04:36 +0000 (19:04 +0800)]
wifi: mt76: mt7996: fix register mapping
Bypass the entry when ofs is equal to dev->reg.map[i].size.
Without this patch, it would get incorrect register mapping when the CR
address is located at the boundary of an entry.
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: Shengyu Qu <wiagn233@outlook.com>
Link: https://patch.msgid.link/OSZPR01MB84344FEFF53004B5CF40BCC198132@OSZPR01MB8434.jpnprd01.prod.outlook.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Peter Chiu [Thu, 9 Jan 2025 11:04:35 +0000 (19:04 +0800)]
wifi: mt76: mt7915: fix register mapping
Bypass the entry when ofs is equal to dev->reg.map[i].size.
Without this patch, it would get incorrect register mapping when the CR
address is located at the boundary of an entry.
Fixes:
cd4c314a65d3 ("mt76: mt7915: refine register definition")
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shengyu Qu <wiagn233@outlook.com>
Link: https://patch.msgid.link/OSZPR01MB843401EAA1DA6BD7AEF356F298132@OSZPR01MB8434.jpnprd01.prod.outlook.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:35:08 +0000 (17:35 +0100)]
wifi: mt76: mt7996: fix monitor mode
Enable sniffer mode via MCU command in order to properly enable promiscuous
mode on the device.
Link: https://patch.msgid.link/20250102163508.52945-24-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:35:07 +0000 (17:35 +0100)]
wifi: mt76: mt7996: switch to single multi-radio wiphy
Use generic mt76 chanctx functions and look up phy from vif link.
The driver now uses only a single phy to handle multiple interfaces on
different channels. This is preparation for full MLO support.
Link: https://patch.msgid.link/20250102163508.52945-23-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:35:06 +0000 (17:35 +0100)]
wifi: mt76: mt7996: move all debugfs files to the primary phy
Preparation for single-wiphy support
Link: https://patch.msgid.link/20250102163508.52945-22-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Shayne Chen [Thu, 2 Jan 2025 16:35:05 +0000 (17:35 +0100)]
wifi: mt76: connac: rework connac helpers
Rework connac helpers related to rate and phymode.
This is a preliminary patch to add MLO support for mt7996 chipsets.
Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20250102163508.52945-21-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:35:04 +0000 (17:35 +0100)]
wifi: mt76: mt7996: prepare mt7996_mcu_update_bss_color for MLO support
Pass in struct mt76_vif_link in order to update the correct link.
Link: https://patch.msgid.link/20250102163508.52945-20-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:35:03 +0000 (17:35 +0100)]
wifi: mt76: connac: prepare mt76_connac_mcu_sta_basic_tlv for MLO support
Pass in struct ieee80211_bss_conf in order to use link specific data.
Link: https://patch.msgid.link/20250102163508.52945-19-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:35:02 +0000 (17:35 +0100)]
wifi: mt76: mt7996: prepare mt7996_mcu_set_timing for MLO support
Pass in struct ieee80211_bss_conf in order to use link specific data.
Link: https://patch.msgid.link/20250102163508.52945-18-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:35:01 +0000 (17:35 +0100)]
wifi: mt76: mt7996: prepare mt7996_mcu_set_tx for MLO support
Pass in struct ieee80211_bss_conf in order to use link specific data.
Link: https://patch.msgid.link/20250102163508.52945-17-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:35:00 +0000 (17:35 +0100)]
wifi: mt76: mt7996: prepare mt7996_mcu_add_beacon for MLO support
Pass in struct ieee80211_bss_conf.
Link: https://patch.msgid.link/20250102163508.52945-16-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:59 +0000 (17:34 +0100)]
wifi: mt76: mt7996: prepare mt7996_mcu_add_dev/bss_info for MLO support
Add extra arguments for struct ieee80211_bss_conf and mt76_vif_link.
Link: https://patch.msgid.link/20250102163508.52945-15-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:58 +0000 (17:34 +0100)]
wifi: mt76: mt7996: pass wcid to mt7996_mcu_sta_hdr_trans_tlv
Preparation for MLO support.
Link: https://patch.msgid.link/20250102163508.52945-14-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:57 +0000 (17:34 +0100)]
wifi: mt76: mt7996: use emulated hardware scan support
Preparation for supporting multiple radios on a single wiphy
Link: https://patch.msgid.link/20250102163508.52945-13-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:56 +0000 (17:34 +0100)]
wifi: mt76: add multi-radio remain_on_channel functions
This allows a driver using the generic channel context functions to
temporarily switch to another channel for off-channel rx/tx.
Link: https://patch.msgid.link/20250102163508.52945-12-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:55 +0000 (17:34 +0100)]
wifi: mt76: add multi-radio support to scanning code
When scanning on a phy/vif combination that does not have an active link,
create a temporary link in order to ensure that we have a valid wcid.
Link: https://patch.msgid.link/20250102163508.52945-11-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:54 +0000 (17:34 +0100)]
wifi: mt76: add multi-radio support to tx scheduling
Look up the phy for each scheduled txq. Only run one scheduling loop per hw.
Link: https://patch.msgid.link/20250102163508.52945-10-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:53 +0000 (17:34 +0100)]
wifi: mt76: add multi-radio support to a few core hw ops
Iterate over all phys if multi-radio is supported by the driver
Link: https://patch.msgid.link/20250102163508.52945-9-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:52 +0000 (17:34 +0100)]
wifi: mt76: remove dev->wcid_phy_mask
Explicitly check wcid->phy_idx instead. Reduces allocated data size.
Link: https://patch.msgid.link/20250102163508.52945-8-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:51 +0000 (17:34 +0100)]
wifi: mt76: add chanctx functions for multi-channel phy support
This adds an implementation for the chanctx functions, which can be used
by multi-channel capable drivers. Preparation for adding MLO support.
Link: https://patch.msgid.link/20250102163508.52945-7-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:50 +0000 (17:34 +0100)]
wifi: mt76: initialize more wcid fields mt76_wcid_init
Reduces code duplication and ensures that the phy index is always set.
Link: https://patch.msgid.link/20250102163508.52945-6-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:49 +0000 (17:34 +0100)]
wifi: mt76: mt7996: split link specific data from struct mt7996_vif
Preparation for MLO support.
Link: https://patch.msgid.link/20250102163508.52945-5-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:48 +0000 (17:34 +0100)]
wifi: mt76: add vif link specific data structure
Preparation for splitting link data from vif data for MLO support.
Link: https://patch.msgid.link/20250102163508.52945-4-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:47 +0000 (17:34 +0100)]
wifi: mt76: rename struct mt76_vif to mt76_vif_link
Preparation to use it for private bss link data instead of the full vif
on MLO capable devices.
Link: https://patch.msgid.link/20250102163508.52945-3-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:46 +0000 (17:34 +0100)]
wifi: mt76: add support for allocating a phy without hw
Preparation for supporting a single hw with multiple radios
Link: https://patch.msgid.link/20250102163508.52945-2-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 2 Jan 2025 16:34:45 +0000 (17:34 +0100)]
wifi: mt76: add code for emulating hardware scanning
Preparation for supporting multiple radios on a single wiphy on devices
where firmware does not support actual hardware scanning.
This is also a prerequisite for full MLO support
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20250102163508.52945-1-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 30 Dec 2024 19:42:02 +0000 (20:42 +0100)]
wifi: mt76: do not add wcid entries to sta poll list during MCU reset
Fixes linked list management issues during restart, where sta entries
can be recreated and reinitialized while still in the poll list, triggering
kernel warnings.
Link: https://patch.msgid.link/20241230194202.95065-14-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 30 Dec 2024 19:42:01 +0000 (20:42 +0100)]
wifi: mt76: mt7996: use mac80211 .sta_state op
Allows adding stations before assoc, though they are not passed to the
firmware yet at that point.
Link: https://patch.msgid.link/20241230194202.95065-13-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 30 Dec 2024 19:42:00 +0000 (20:42 +0100)]
wifi: mt76: mt7915: fix omac index assignment after hardware reset
Reset per-phy mac address slot mask in order to avoid leaking entries.
Fixes:
8a55712d124f ("wifi: mt76: mt7915: enable full system reset support")
Link: https://patch.msgid.link/20241230194202.95065-12-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 30 Dec 2024 19:41:59 +0000 (20:41 +0100)]
wifi: mt76: mt7915: firmware restart on devices with a second pcie link
It seems that the firmware checks the register used for detecting matching
PCIe links in order to figure out if a secondary PCIe link is enabled.
Write the register again just before starting the firmware on hw reset,
in order to fix an issue that left the second band unusable after restart.
Fixes:
9093cfff72e3 ("mt76: mt7915: add support for using a secondary PCIe link for gen1")
Link: https://patch.msgid.link/20241230194202.95065-11-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 30 Dec 2024 19:41:58 +0000 (20:41 +0100)]
wifi: mt76: mt7915: hold dev->mutex while interacting with the thermal state
Avoid issuing MCU calls during a hardware restart
Link: https://patch.msgid.link/20241230194202.95065-10-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 30 Dec 2024 19:41:57 +0000 (20:41 +0100)]
wifi: mt76: mt7915: ensure that only one sta entry is active per mac address
When a client is roaming to a different AP interface, a duplicate wtbl entry
can be created. This can lead to lost packets or aggregation issues until
the old entry expires.
In order to fix this issue, delete any conflicting entries from WTBL
whenever a station is authorized.
Link: https://patch.msgid.link/20241230194202.95065-9-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 30 Dec 2024 19:41:56 +0000 (20:41 +0100)]
wifi: mt76: only enable tx worker after setting the channel
Avoids sending packets too early
Fixes:
0b3be9d1d34e ("wifi: mt76: add separate tx scheduling queue for off-channel tx")
Link: https://patch.msgid.link/20241230194202.95065-8-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 30 Dec 2024 19:41:55 +0000 (20:41 +0100)]
wifi: mt76: mt7915: decrease timeout for commonly issued MCU commands
This allows faster recovery from firmware issues
Link: https://patch.msgid.link/20241230194202.95065-7-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 30 Dec 2024 19:41:54 +0000 (20:41 +0100)]
wifi: mt76: mt7915: reduce the number of command retries
The need to retry a command is really uncommon. Reduce the retries to 1 to
speed up recovery from firmware issues.
Link: https://patch.msgid.link/20241230194202.95065-6-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 30 Dec 2024 19:41:53 +0000 (20:41 +0100)]
wifi: mt76: mt7996: fix rx filter setting for bfee functionality
Fix rx filter setting to prevent dropping NDPA frames. Without this
change, bfee functionality may behave abnormally.
Fixes:
98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Link: https://patch.msgid.link/20241230194202.95065-5-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 30 Dec 2024 19:41:52 +0000 (20:41 +0100)]
wifi: mt76: mt7915: fix eifs value on older chipsets
Use the default firmware values
Link: https://patch.msgid.link/20241230194202.95065-4-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 30 Dec 2024 19:41:51 +0000 (20:41 +0100)]
wifi: mt76: mt7915: fix slot time for 5/6GHz
It should only be set to 20 for long slot time on 2.4 GHz
Link: https://patch.msgid.link/20241230194202.95065-3-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 30 Dec 2024 19:41:50 +0000 (20:41 +0100)]
wifi: mt76: mt7996: remove phy->monitor_vif
It is unused
Link: https://patch.msgid.link/20241230194202.95065-2-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 30 Dec 2024 19:41:49 +0000 (20:41 +0100)]
wifi: mt76: remove mt76_calculate_default_rate()
It is only used in mt76_connac2_mac_tx_rate_val, inline it there.
Link: https://patch.msgid.link/20241230194202.95065-1-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Nick Morrow [Thu, 19 Dec 2024 14:12:14 +0000 (08:12 -0600)]
wifi: mt76: mt7921u: Add VID/PID for TP-Link TXE50UH
Add VID/PID 35bc/0107 for recently released TP-Link TXE50UH USB WiFi adapter.
Tested-by: Shang Chieh Tseng <shangchieh.tseng@tsengsy.com>
Signed-off-by: Nick Morrow <usbwifi2024@gmail.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/e797f105-9ca8-41e9-96de-7d25dec09943@gmail.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Zhang Kunbo [Wed, 18 Dec 2024 07:45:52 +0000 (07:45 +0000)]
wifi: mt76: mt7925: replace zero-length array with flexible-array member
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1],
introduced in C99:
struct foo {
int stuff;
struct boo array[];
};
By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last, which is beneficial
to cultivate a high-quality code.[2]
This issue was found with the help of Coccinelle.
[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] commit
76497732932f ("cxgb3/l2t: Fix undefined behaviour")
Signed-off-by: Zhang Kunbo <zhangkunbo@huawei.com>
Link: https://patch.msgid.link/20241218074552.3271542-1-zhangkunbo@huawei.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Allan Wang [Mon, 9 Dec 2024 07:09:22 +0000 (15:09 +0800)]
wifi: mt76: mt7921: add rfkill_poll for hardware rfkill
Add mac80211 rfkill_poll ops to monitor hardware rfkill state
and state change will be updated.
Signed-off-by: Allan Wang <allan.wang@mediatek.com>
Link: https://patch.msgid.link/20241209070922.28106-1-allan.wang@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Leon Yen [Thu, 7 Nov 2024 06:14:40 +0000 (14:14 +0800)]
wifi: mt76: mt7921: introduce CSA support
Add CSA (Channel Switch Announcement) related implementation
in collaboration with mac80211 to deal with dynamic channel
switching.
Signed-off-by: Leon Yen <leon.yen@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20241107061440.6545-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Michael Lo [Wed, 6 Nov 2024 01:32:21 +0000 (09:32 +0800)]
wifi: mt76: mt7925: config the dwell time by firmware
To optimize the scan time of mt7925, remove the dwell time
setting for the scan command and let it be controlled by
the firmware as mt7921.
Signed-off-by: Michael Lo <michael.lo@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20241106013221.18101-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Quan Zhou [Fri, 8 Nov 2024 12:59:40 +0000 (20:59 +0800)]
wifi: mt76: do not hold queue lock during initial rx buffer alloc
In dma init or reset scene, full buffer is needed for all rx rings. Since
this is very time consuming, split the function to perform initial
allocation without holding the spinlock. This avoids causing excessive
scheduler latency.
Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Reviewed-by: Shayne Chen <shayne.chen@mediatek.com>
Reviewed-by: Deren Wu <deren.wu@mediatek.com>
Link: https://patch.msgid.link/57c68a7ce1dd9022fa5e06af2c53d6313f30ec83.1731069062.git.quan.zhou@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Wed, 11 Dec 2024 01:19:26 +0000 (17:19 -0800)]
wifi: mt76: mt7925: Properly handle responses for commands with events
Properly retrieve the response for commands with events. Ensure accurate
handling of event-driven commands.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-17-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Wed, 11 Dec 2024 01:19:25 +0000 (17:19 -0800)]
wifi: mt76: mt7925: Cleanup MLO settings post-disconnection
Clean up MLO settings after disconnection.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-16-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Wed, 11 Dec 2024 01:19:24 +0000 (17:19 -0800)]
wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO
Update mt7925_mcu_uni_[tx,rx]_ba for MLO support in firmware.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-15-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Wed, 11 Dec 2024 01:19:23 +0000 (17:19 -0800)]
wifi: mt76: mt7925: Init secondary link PM state
Initialize secondary link PM state.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-14-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Wed, 11 Dec 2024 01:19:22 +0000 (17:19 -0800)]
wifi: mt76: mt7925: Update secondary link PS flow
Update the power-saving flow for secondary links.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-13-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Wed, 11 Dec 2024 01:19:21 +0000 (17:19 -0800)]
wifi: mt76: mt7925: Update mt7925_unassign_vif_chanctx for per-link BSS
Update mt7925_unassign_vif_chanctx to support per-link BSS.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-12-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Wed, 11 Dec 2024 01:19:20 +0000 (17:19 -0800)]
wifi: mt76: mt7925: Update mt792x_rx_get_wcid for per-link STA
Update mt792x_rx_get_wcid to support per-link STA.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-11-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Wed, 11 Dec 2024 01:19:19 +0000 (17:19 -0800)]
wifi: mt76: mt7925: Update mt7925_mcu_sta_update for BC in ASSOC state
Update mt7925_mcu_sta_update for broadcast (BC) in the ASSOC state.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-10-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Wed, 11 Dec 2024 01:19:18 +0000 (17:19 -0800)]
wifi: mt76: Enhance mt7925_mac_link_sta_add to support MLO
Enhance mt7925_mac_link_sta_add to support MLO.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-9-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Wed, 11 Dec 2024 01:19:17 +0000 (17:19 -0800)]
wifi: mt76: mt7925: Enhance mt7925_mac_link_bss_add to support MLO
In mt7925_mac_link_bss_add(), the mt76_connac_mcu_uni_add_dev() function
must be executed only after all parameters have been properly initialized.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-8-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Leon Yen [Wed, 11 Dec 2024 01:19:16 +0000 (17:19 -0800)]
wifi: mt76: mt7925: Fix CNM Timeout with Single Active Link in MLO
Fix CNM command timeout issue when only a single active link is available
during MLO connection to fix the following kernel log error.
[ 741.931030] wlan0: [link 1] local address be:90:e0:22:c4:22, AP link address 08:0c:43:7a:19:2a
[ 741.931042] wlan0: [link 1] determined AP 08:0c:43:7a:19:2a to be EHT
[ 741.931052] wlan0: [link 1] connecting with EHT mode, max bandwidth 160 MHz
[ 741.931071] wlan0: WMM AC=0 acm=0 aifs=2 cWmin=3 cWmax=7 txop=47 uapsd=0, downgraded=0
[ 741.931076] wlan0: WMM AC=1 acm=0 aifs=2 cWmin=7 cWmax=15 txop=94 uapsd=0, downgraded=0
[ 741.931080] wlan0: WMM AC=2 acm=0 aifs=3 cWmin=15 cWmax=1023 txop=0 uapsd=0, downgraded=0
[ 741.931085] wlan0: WMM AC=3 acm=0 aifs=7 cWmin=15 cWmax=1023 txop=0 uapsd=0, downgraded=0
[ 741.931095] wlan0: moving STA 22:0c:43:7a:19:2a to state 3
[ 749.090928] mt7925e 0000:2b:00.0: Message
00020002 (seq 15) timeout
[ 752.162972] mt7925e 0000:2b:00.0: Message
00020003 (seq 1) timeout
[ 755.234975] mt7925e 0000:2b:00.0: Message
00020002 (seq 2) timeout
[ 758.306971] mt7925e 0000:2b:00.0: Message
00020004 (seq 3) timeout
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Leon Yen <leon.yen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-7-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Wed, 11 Dec 2024 01:19:15 +0000 (17:19 -0800)]
wifi: mt76: mt7925: fix wrong parameter for related cmd of chan info
Fix incorrect parameters for the related channel information command.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-6-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
allan.wang [Wed, 11 Dec 2024 01:19:14 +0000 (17:19 -0800)]
wifi: mt76: mt7925: Fix incorrect WCID phy_idx assignment
Fix incorrect WCID phy_idx assignment.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: allan.wang <allan.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-5-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Wed, 11 Dec 2024 01:19:12 +0000 (17:19 -0800)]
wifi: mt76: mt7925: Fix incorrect WCID assignment for MLO
For MLO, each link must have a corresponding WCID.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-3-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Wed, 11 Dec 2024 01:19:11 +0000 (17:19 -0800)]
wifi: mt76: mt7925: Fix incorrect MLD address in bss_mld_tlv for MLO support
For this TLV, the address should be set to the MLD address rather than
the link address.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-2-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Sean Wang [Wed, 11 Dec 2024 01:19:10 +0000 (17:19 -0800)]
wifi: mt76: connac: Extend mt76_connac_mcu_uni_add_dev for MLO
This commit extends the `mt76_connac_mcu_uni_add_dev` function to include
support for Multi-Link Operation (MLO). Additionally, backward
compatibility for MT7921 is preserved, enabling seamless integration with
existing setups.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20241211011926.5002-1-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Chad Monroe [Tue, 26 Nov 2024 20:40:49 +0000 (20:40 +0000)]
wifi: mt76: mt7996: exclude tx backoff time from airtime
This helps to make STA airtime counters more accurate.
Signed-off-by: Chad Monroe <chad@monroe.io>
Suggested-by: Ryder Lee <ryder.lee@mediatek.com>
Link: https://patch.msgid.link/88821d8f08e2715927939b35e630a06171962636.1732653612.git.chad@monroe.io
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Chad Monroe [Tue, 26 Nov 2024 04:52:58 +0000 (04:52 +0000)]
wifi: mt76: mt7915: exclude tx backoff time from airtime
This helps to make STA airtime counters more accurate.
Signed-off-by: Chad Monroe <chad@monroe.io>
Suggested-by: Ryder Lee <ryder.lee@mediatek.com>
Link: https://patch.msgid.link/026380cec180261956b983cbdb009605867bcd8d.1732596478.git.chad@monroe.io
Signed-off-by: Felix Fietkau <nbd@nbd.name>
xueqin Luo [Mon, 2 Dec 2024 03:19:17 +0000 (11:19 +0800)]
wifi: mt76: mt7915: fix overflows seen when writing limit attributes
DIV_ROUND_CLOSEST() after kstrtoul() results in an overflow if a large
number such as
18446744073709551615 is provided by the user.
Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations.
This commit was inspired by commit:
57ee12b6c514.
Fixes:
02ee68b95d81 ("mt76: mt7915: add control knobs for thermal throttling")
Signed-off-by: xueqin Luo <luoxueqin@kylinos.cn>
Link: https://patch.msgid.link/20241202031917.23741-3-luoxueqin@kylinos.cn
Signed-off-by: Felix Fietkau <nbd@nbd.name>
xueqin Luo [Mon, 2 Dec 2024 03:19:16 +0000 (11:19 +0800)]
wifi: mt76: mt7996: fix overflows seen when writing limit attributes
DIV_ROUND_CLOSEST() after kstrtoul() results in an overflow if a large
number such as
18446744073709551615 is provided by the user.
Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations.
This commit was inspired by commit:
57ee12b6c514.
Fixes:
6879b2e94172 ("wifi: mt76: mt7996: add thermal sensor device support")
Signed-off-by: xueqin Luo <luoxueqin@kylinos.cn>
Link: https://patch.msgid.link/20241202031917.23741-2-luoxueqin@kylinos.cn
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Thu, 7 Nov 2024 05:30:05 +0000 (13:30 +0800)]
wifi: mt76: mt7925: fix the invalid ip address for arp offload
The wrong ieee80211_vif will lead to get invalid ip address and
the correct ieee80211_vif can be obtained from ieee80211_bss_conf.
Fixes:
147324292979 ("wifi: mt76: mt7925: add link handling in the BSS_CHANGED_ARP_FILTER handler")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20241107053005.10558-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ming Yen Hsieh [Mon, 4 Nov 2024 05:14:47 +0000 (13:14 +0800)]
wifi: mt76: mt7925: fix get wrong chip cap from incorrect pointer
Use tlv instead of skb, because using skb will get valid data
with wrong offset.
Fixes:
86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20241104051447.4286-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Eric-SY Chang [Fri, 1 Nov 2024 07:43:40 +0000 (15:43 +0800)]
wifi: mt76: mt7925: fix wrong band_idx setting when enable sniffer mode
Currently, sniffer mode does not support band auto,
so set band_idx to the default 0.
Fixes:
0cb349d742d1 ("wifi: mt76: mt7925: update mt7925_mac_link_bss_add for MLO")
Signed-off-by: Eric-SY Chang <eric-sy.chang@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20241101074340.26176-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Charles Han [Fri, 25 Oct 2024 07:55:54 +0000 (15:55 +0800)]
wifi: mt76: mt7925: fix NULL deref check in mt7925_change_vif_links
In mt7925_change_vif_links() devm_kzalloc() may return NULL but this
returned value is not checked.
Fixes:
69acd6d910b0 ("wifi: mt76: mt7925: add mt7925_change_vif_links")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Link: https://patch.msgid.link/20241025075554.181572-1-hanchunchao@inspur.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Allan Wang [Wed, 16 Oct 2024 10:10:17 +0000 (18:10 +0800)]
wifi: mt76: introduce mt792x_config_mac_addr_list routine
Add mt792x_config_mac_addr_list routine in order to set
the mac address list supported by the driver. Initialize
wiphy->addresses/n_addresses for mt792x driver
Signed-off-by: Hao Zhang <hao.zhang@mediatek.com>
Signed-off-by: Leon Yen <Leon.Yen@mediatek.com>
Signed-off-by: Allan Wang <allan.wang@mediatek.com>
Link: https://patch.msgid.link/20241016101017.19598-1-allan.wang@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Shayne Chen [Thu, 10 Oct 2024 08:38:16 +0000 (10:38 +0200)]
wifi: mt76: mt7915: add module param to select 5 GHz or 6 GHz on MT7916
Due to a limitation in available memory, the MT7916 firmware can only
handle either 5 GHz or 6 GHz at a time. It does not support runtime
switching without a full restart.
On older firmware, this accidentally worked to some degree due to missing
checks, but couldn't be supported properly, because it left the 6 GHz
channels uncalibrated.
Newer firmware refuses to start on either band if the passed EEPROM
data indicates support for both.
Deal with this limitation by using a module parameter to specify the
preferred band in case both are supported.
Fixes:
b4d093e321bd ("mt76: mt7915: add 6 GHz support")
Cc: stable@vger.kernel.org
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20241010083816.51880-1-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Christophe JAILLET [Sun, 29 Sep 2024 19:53:40 +0000 (21:53 +0200)]
wifi: mt76: mt7915: Fix an error handling path in mt7915_add_interface()
If mt76_wcid_alloc() fails, the "mt76.mutex" mutex needs to be released as
done in the other error handling paths of mt7915_add_interface().
Fixes:
f3049b88b2b3 ("wifi: mt76: mt7915: allocate vif wcid in the same range as stations")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/b9d8fbfc19360bfe60b9cea1cb0f735ab3b4bc26.1727639596.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Michael Lo [Thu, 1 Aug 2024 02:43:35 +0000 (10:43 +0800)]
wifi: mt76: mt7921: fix using incorrect group cipher after disconnection.
To avoid incorrect cipher after disconnection, we should
do the key deletion process in this case.
Fixes:
e6db67fa871d ("wifi: mt76: ignore key disable commands")
Signed-off-by: Michael Lo <michael.lo@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Tested-by: David Ruth <druth@chromium.org>
Reviewed-by: David Ruth <druth@chromium.org>
Link: https://patch.msgid.link/20240801024335.12981-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
WangYuli [Mon, 13 Jan 2025 07:02:41 +0000 (15:02 +0800)]
wifi: mt76: mt76u_vendor_request: Do not print error messages when -EPROTO
When initializing the network card, unplugging the device will
trigger an -EPROTO error, resulting in a flood of error messages
being printed frantically.
The exception is printed as follows:
mt76x2u 2-2.4:1.0: vendor request req:47 off:9018 failed:-71
mt76x2u 2-2.4:1.0: vendor request req:47 off:9018 failed:-71
...
It will continue to print more than 2000 times for about 5 minutes,
causing the usb device to be unable to be disconnected. During this
period, the usb port cannot recognize the new device because the old
device has not disconnected.
There may be other operating methods that cause -EPROTO, but -EPROTO is
a low-level hardware error. It is unwise to repeat vendor requests
expecting to read correct data. It is a better choice to treat -EPROTO
and -ENODEV the same way.
Similar to commit
9b0f100c1970 ("mt76: usb: process URBs with status
EPROTO properly") do no schedule rx_worker for urb marked with status
set -EPROTO. I also reproduced this situation when plugging and
unplugging the device, and this patch is effective.
Just do not vendor request again for urb marked with status set -EPROTO.
Link: https://lore.kernel.org/all/531681bd-30f5-4a70-a156-bf8754b8e072@intel.com/
Link: https://lore.kernel.org/all/D4B9CC1FFC0CBAC3+20250105040607.154706-1-wangyuli@uniontech.com/
Fixes:
b40b15e1521f ("mt76: add usb support to mt76 layer")
Co-developed-by: Xu Rao <raoxu@uniontech.com>
Signed-off-by: Xu Rao <raoxu@uniontech.com>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
Link: https://patch.msgid.link/9DD7DE7AAB497CB7+20250113070241.63590-1-wangyuli@uniontech.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Quan Zhou [Thu, 18 Jul 2024 13:49:09 +0000 (21:49 +0800)]
wifi: mt76: mt7921: fix a potential scan no APs
In multi-channel scenarios, the granted channel must be aborted before
station remove. Otherwise, the firmware will be put into a wrong state,
resulting in have chance to make subsequence scan no APs.
With this patch, the granted channel will be always aborted before
station remove.
Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Tested-by: David Ruth <druth@chromium.org>
Reviewed-by: David Ruth <druth@chromium.org>
Link: https://patch.msgid.link/1ac1ae779db86d4012199a24ea2ca74050ed4af6.1721300411.git.quan.zhou@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ben Greear [Mon, 9 Sep 2024 21:12:38 +0000 (14:12 -0700)]
wifi: mt76: Fix EHT NSS radiotap reporting.
Wireshark and iwlwifi use zero-based NSS reporting, adjust
mt76 to do the same.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Link: https://patch.msgid.link/20240909211238.3237111-2-greearb@candelatech.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ben Greear [Mon, 9 Sep 2024 21:12:37 +0000 (14:12 -0700)]
wifi: mt76: mt7996: Add eht radiotap tlv
This duplicates what the 7925 driver is doing, wireshark seems to
at least mostly decode it as expected.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Link: https://patch.msgid.link/20240909211238.3237111-1-greearb@candelatech.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Nicolas Cavallari [Fri, 27 Sep 2024 08:53:17 +0000 (10:53 +0200)]
wifi: mt76: mt7915: Fix mesh scan on MT7916 DBDC
commit
c4f075582304 ("wifi: mt76: mt7915: fix command timeout in AP stop
period") changes the behavior of mt7915_bss_info_changed() in mesh mode
when enable_beacon becomes false: it calls mt7915_mcu_add_bss_info(...,
false) and mt7915_mcu_add_sta(..., false) while the previous code
didn't. These sends mcu commands that apparently confuse the firmware.
This breaks scanning while in mesh mode on AsiaRF MT7916 DBDC-based cards:
scanning works but no mesh frames get sent afterwards and the firmware
seems to be hosed. It breaks on MT7916 DBDC but not on MT7915 DBDC.
Fixes:
c4f075582304 ("wifi: mt76: mt7915: fix command timeout in AP stop period")
Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
Link: https://patch.msgid.link/20240927085350.4594-1-nicolas.cavallari@green-communications.fr
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Shen Lichuan [Wed, 11 Sep 2024 03:42:43 +0000 (11:42 +0800)]
wifi: mt76: mt7615: Convert comma to semicolon
To ensure code clarity and prevent potential errors, it's advisable
to employ the ';' as a statement separator, except when ',' are
intentionally used for specific purposes.
Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patch.msgid.link/20240911034243.31596-1-shenlichuan@vivo.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Dan Carpenter [Wed, 11 Sep 2024 07:43:03 +0000 (10:43 +0300)]
wifi: mt76: mt7925: fix off by one in mt7925_load_clc()
This comparison should be >= instead of > to prevent an out of bounds
read and write.
Fixes:
9679ca7326e5 ("wifi: mt76: mt7925: fix a potential array-index-out-of-bounds issue for clc")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/84bf5dd2-2fe3-4410-a7af-ae841e41082a@stanley.mountain
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Leon Yen [Mon, 16 Sep 2024 06:01:57 +0000 (14:01 +0800)]
wifi: mt76: mt7921s: fix a potential firmware freeze during startup
The maximum command quota of the firmware may be exceeded because the
command to retrieve the quota setting has not been taken into account.
This patch considers not only the quota usage of the command retrieving
quota settings but also limits the total quota usage.
Signed-off-by: Leon Yen <leon.yen@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20240916060157.10157-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Hao Zhang [Thu, 19 Sep 2024 08:17:13 +0000 (16:17 +0800)]
wifi: mt76: mt792x: add P2P_DEVICE support
Regist the NL80211_IFTYPE_P2P_DEVICE to support p2p device
for mt792x chips
Signed-off-by: Hao Zhang <hao.zhang.mediatek@gmail.com>
Signed-off-by: allan.wang <allan.wang@mediatek.com>
Signed-off-by: Ming Yen Hsieh <MingYen.Hsieh@mediatek.com>
Link: https://patch.msgid.link/20240919081713.23787-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
StanleyYP Wang [Thu, 26 Sep 2024 03:24:40 +0000 (11:24 +0800)]
wifi: mt76: mt7996: set correct background radar capability
Some of the variants do not support background radar, so add a helper
to report background radar capability.
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Tested-by: Daniel Golle <daniel@makrotopia.org>
Link: https://patch.msgid.link/20240926032440.15978-3-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Shayne Chen [Thu, 26 Sep 2024 03:24:39 +0000 (11:24 +0800)]
wifi: mt76: mt7996: add support for more variants
Current varaints supported:
- mt7996 chipset: tri-band, 4+4+4 NSS, eFEM
- mt7992 chipset: dual-band, 4+4 NSS, eFEM
This patch adds support for the following variants:
- mt7996 chipset:
- tri-band, 4+4+4 NSS, iFEM
- tri-band, 2+3+3 NSS, eFEM
- tri-band, 2+3+3 NSS, iFEM
- mt7992 chipset:
- dual-band, 4+4 NSS, iFEM
- dual-band, 4+4 NSS, with band0 iFEM and band1 eFEM
- dual-band, 2+3 NSS, eFEM
- dual-band, 2+3 NSS, iFEM
Co-developed-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Tested-by: Daniel Golle <daniel@makrotopia.org>
Link: https://patch.msgid.link/20240926032440.15978-2-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Shayne Chen [Thu, 26 Sep 2024 03:24:38 +0000 (11:24 +0800)]
wifi: mt76: mt7996: extend flexibility of mt7996_mcu_get_eeprom()
Support passing customized buffer pointer and length to
mt7996_mcu_get_eeprom().
This is the preparation for adding more variants support which needs to
prefetch FEM module from efuse, and also fixes potential OOB issue when
reading the last efuse block.
Co-developed-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Tested-by: Daniel Golle <daniel@makrotopia.org>
Link: https://patch.msgid.link/20240926032440.15978-1-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>