Quan Zhou
0e19942e6d
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 >
2025-01-14 13:42:30 +01:00
Quan Zhou
8f6571ad47
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 >
2025-01-14 13:42:30 +01:00
Quan Zhou
a0f721b8d9
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 >
2025-01-14 13:42:30 +01:00
Quan Zhou
1b97fc8443
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 >
2025-01-14 13:42:30 +01:00
Peter Chiu
d07ecb4f70
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: 98686cd216 ("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 >
2025-01-14 13:42:30 +01:00
Peter Chiu
dd1649ef96
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: cd4c314a65 ("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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
e48da5c9ca
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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
69d54ce749
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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
1f8dd5686e
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 >
2025-01-14 13:42:29 +01:00
Shayne Chen
a0facfc80e
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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
4b98d4aec7
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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
96fcecd9ba
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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
97a1beb84c
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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
c0df2f0caa
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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
747fe94450
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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
34a41bfbcb
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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
0b57e944ce
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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
c56d6edebc
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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
a8f424c128
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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
e411b8190f
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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
716cc146d5
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 >
2025-01-14 13:42:29 +01:00
Felix Fietkau
955e823102
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 >
2025-01-14 13:42:28 +01:00
Felix Fietkau
38a45bead2
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 >
2025-01-14 13:42:28 +01:00
Felix Fietkau
82334623af
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 >
2025-01-14 13:42:28 +01:00
Felix Fietkau
cbf5e61da6
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 >
2025-01-14 13:34:37 +01:00
Felix Fietkau
36e02101f8
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 >
2025-01-14 13:34:37 +01:00
Felix Fietkau
e24646ef7e
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 >
2025-01-14 13:34:37 +01:00
Felix Fietkau
bf18f7172a
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 >
2025-01-14 13:34:37 +01:00
Felix Fietkau
a24f891a2f
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 >
2025-01-14 13:34:37 +01:00
Felix Fietkau
31083e3854
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 >
2025-01-14 13:34:37 +01:00
Felix Fietkau
387ab042ac
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 >
2025-01-14 13:34:37 +01:00
Felix Fietkau
13e2e9c6b3
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 >
2025-01-14 13:34:37 +01:00
Felix Fietkau
cd043bbba6
wifi: mt76: mt7915: fix omac index assignment after hardware reset
...
Reset per-phy mac address slot mask in order to avoid leaking entries.
Fixes: 8a55712d12 ("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 >
2025-01-14 13:34:36 +01:00
Felix Fietkau
9b60e2ae51
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: 9093cfff72 ("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 >
2025-01-14 13:34:36 +01:00
Felix Fietkau
e733647566
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 >
2025-01-14 13:34:36 +01:00
Felix Fietkau
82d6f1adfe
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 >
2025-01-14 13:34:36 +01:00
Felix Fietkau
228bc0e79c
wifi: mt76: only enable tx worker after setting the channel
...
Avoids sending packets too early
Fixes: 0b3be9d1d3 ("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 >
2025-01-14 13:34:36 +01:00
Felix Fietkau
1254c66356
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 >
2025-01-14 13:34:36 +01:00
Felix Fietkau
e5243352a4
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 >
2025-01-14 13:34:36 +01:00
Felix Fietkau
858fd2a538
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: 98686cd216 ("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 >
2025-01-14 13:34:36 +01:00
Felix Fietkau
87594d2b1a
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 >
2025-01-14 13:34:36 +01:00
Felix Fietkau
56465b6fd0
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 >
2025-01-14 13:34:36 +01:00
Felix Fietkau
6ae0eab1bf
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 >
2025-01-14 13:34:36 +01:00
Felix Fietkau
7cac2827b2
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 >
2025-01-14 13:34:36 +01:00
Nick Morrow
47d9a8ba1d
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 >
2025-01-14 13:34:36 +01:00
Zhang Kunbo
8ad8b8c2dc
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 7649773293 ("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 >
2025-01-14 13:34:36 +01:00
Allan Wang
5190594bce
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 >
2025-01-14 13:34:36 +01:00
Leon Yen
8aa2f59260
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 >
2025-01-14 13:34:35 +01:00
Michael Lo
efeaabc568
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 >
2025-01-14 13:34:35 +01:00
Quan Zhou
50f64e4253
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 >
2025-01-14 13:34:35 +01:00