wifi: mt76: mt7925: keep MLD membership consistent during link add
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Andrei,
I tested v2 on an MT7925 PCIe card against a DD-WRT Wi-Fi 7 AP that advertises three links (2.4, 5 and 6 GHz). Results below, in case they help.
Setup:
- MT7925 PCIe (14c3:7925, subsystem 103c:8c94), firmware WIFI_RAM_CODE 20260813113118 / patch 20260813113015a
- Fedora 44, kernel 7.2.8-200.fc44; mt76 rebuilt out of tree from the 7.2.8 sources with the patches listed below
- AP: <router model and DD-WRT build>, one MLO SSID with three links; WPA3-SAE
- wpa_supplicant 2.11 with hostap commit b048a294a ("MLD: Iterate per-link in wpa_clear_keys() for MLO group keys") backported; without it, every intra-MLD reconnect logged "link ID must be set for MLO group key" and often failed
- Test: 15 minutes, ~1 MB/s download, nl80211 rescan every 60 s, gateway ping plus HTTP probe every 5 s
Results:
1) Stock 7.2.8: a two-link (5+6 GHz) association stalled after about 160 s. Traffic stopped without any disconnect, and a scan was left pending ("Reject scan trigger since one is already pending"). The same signature appeared after about 2 h on a 2.4+6 GHz association.
2) 7.2.8 + v2 alone: MLO associations failed (AP-side 4-way handshake timeouts). After MLO teardown, associations to a separate legacy SSID on the same AP were repeatedly deauthenticated by the AP with reason 6 (Class 2 frame received from nonauthenticated STA), followed by SA Query timeouts on the STA. This matches what "wifi: mt76: mt7925: restore the legacy BSS after MLO teardown" describes. I did not isolate whether v2 contributed.
3) 7.2.8 + the seven mt76 commits below + your v2 (eight patches in total): PASS. 900 s on a three-link (2.4+5+6 GHz) association:
176/176 probes OK, no disconnects. All 61 full-band scans completed (median 8.4 s, max 10.0 s), none stuck.
wifi: mt76: mt7925: guard BSS capability lookups
wifi: mt76: check the owner of a remain-on-channel request
wifi: mt76: mt7925: fix lock inversion between dev->mutex and iflist_mtx
wifi: mt76: mt7925: check drv_pmctrl return in the PCIe reset path
wifi: mt76: mt7925: restore the reset state when fw_pmctrl fails
wifi: mt76: mt7925: fix the lock inversion in suspend and resume
wifi: mt76: mt7925: restore the legacy BSS after MLO teardown
Caveats: this is a single 15-minute run on a backported 7.2.8 base, and I did not bisect which of the commits above, besides v2, are required. I'm continuing to run it day to day and can report back.
Thanks for working on this.
From 66103e694e3baae13de9739184224acfcbfbfb7b Mon Sep 17 00:00:00 2001
From: Sean Wang <[email protected]>
Date: Wed, 24 Jun 2026 19:18:27 -0500
Subject: [PATCH 1/8] wifi: mt76: mt7925: guard BSS capability lookups
mt7925 BSS setup may dereference missing channel data or query HE 6 GHz capabilities for an iftype without HE support.
Guard both lookups before adding NAN paths that can use partially configured BSS state.
--- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +20 -6
@@ -2378,11 +2378,18 @@ void mt7925_mcu_bss_rlm_tlv(struct sk_buff *skb, struct mt76_phy *phy, {struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &link_conf->chanreq.oper; -int freq1 = chandef->center_freq1, freq2 = chandef->center_freq2; -enum nl80211_band band = chandef->chan->band;struct bss_rlm_tlv *req; +enum nl80211_band band; +int freq1, freq2;struct tlv *tlv; +if (WARN_ON_ONCE (!chandef || !chandef->chan)) +return ; + + freq1 = chandef->center_freq1; + freq2 = chandef->center_freq2; + band = chandef->chan->band; + tlv =mt76_connac_mcu_add_tlv (skb,UNI_BSS_INFO_RLM ,sizeof (*req)); req = (struct bss_rlm_tlv *)tlv; req->control_channel = chandef->chan->hw_value;
@@ -2520,8 +2527,8 @@ mt7925_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif,enum nl80211_band band, struct ieee80211_link_sta *link_sta) { - struct ieee80211_he_6ghz_capa *he_6ghz_capa; -const struct ieee80211_sta_eht_cap *eht_cap; + struct ieee80211_he_6ghz_capa *he_6ghz_capa = NULL; +const struct ieee80211_sta_eht_cap *eht_cap =NULL ;__le16 capa =0 ;u8 mode =0 ;
@@ -2529,11 +2536,18 @@ mt7925_get_phy_mode_ext(struct mt76_phy *phy, struct ieee80211_vif *vif, he_6ghz_capa = &link_sta->he_6ghz_capa; eht_cap = &link_sta->eht_cap; }else { +const struct ieee80211_sta_he_cap *he_cap;struct ieee80211_supported_band *sband; sband = phy->hw->wiphy->bands[band]; - capa =ieee80211_get_he_6ghz_capa (sband, vif->type); - he_6ghz_capa = (struct ieee80211_he_6ghz_capa *)&capa; + + he_cap = (band ==NL80211_BAND_6GHZ ) ? +ieee80211_get_he_iftype_cap (sband, vif->type) :NULL ; + +if (he_cap) { + capa =ieee80211_get_he_6ghz_capa (sband, vif->type); + he_6ghz_capa = (struct ieee80211_he_6ghz_capa *)&capa; + } eht_cap =ieee80211_get_eht_iftype_cap (sband, vif->type); }
Signature · 1 line
2.55.0
From aecfeee548e4eee87f47fa40906ea412ff2e97f2 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <[email protected]>
Date: Tue, 18 Aug 2026 12:58:22 +0000
Subject: [PATCH 2/8] wifi: mt76: check the owner of a remain-on-channel
request
mvif->roc_phy points to the phy of the request that started last for the interface. That request can end, and the phy can start a request for a different interface. The driver does not always clear the pointer.
Two callers trust the pointer:
- mt76_vif_cleanup() aborts the request on that phy when the driver removes the interface.
- mt76_cancel_remain_on_channel() aborts the request on that phy for the interface.
If the phy holds a request for a different interface, both callers abort the wrong request. The request of the interface stays active. Its work then runs after the driver removes the interface. The work tears the link down through the freed bss_conf.
Compare phy->roc_vif with the interface in both callers before the abort.
--- drivers/net/wireless/mediatek/mt76/channel.c | 2 +- drivers/net/wireless/mediatek/mt76/mac80211.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/channel.c +1 -1
@@ -423,7 +423,7 @@ int mt76_cancel_remain_on_channel(struct ieee80211_hw *hw,struct mt76_vif_data *mvif = mlink->mvif;struct mt76_phy *phy = mvif->roc_phy; -if (!phy) +if (!phy || phy->roc_vif != vif)return 0 ;mt76_abort_roc (phy);
drivers/net/wireless/mediatek/mt76/mac80211.c +1 -1
@@ -2106,7 +2106,7 @@ void mt76_vif_cleanup(struct mt76_dev *dev, struct ieee80211_vif *vif)rcu_assign_pointer (mvif->link[0 ],NULL );mt76_abort_scan (dev); -if (mvif->roc_phy) +if (mvif->roc_phy && mvif->roc_phy->roc_vif == vif)mt76_abort_roc (mvif->roc_phy); }EXPORT_SYMBOL_GPL (mt76_vif_cleanup);
Signature · 1 line
2.55.0
From a9587ea180a58063ce5286e64037f93ac7756108 Mon Sep 17 00:00:00 2001
From: Devin Wittmayer <[email protected]>
Date: Sun, 9 Aug 2026 21:53:38 -0700
Subject: [PATCH 3/8] wifi: mt76: mt7925: fix lock inversion between dev->mutex
and iflist_mtx
mt7925_config() has the same inversion as mt7921_config(): it holds dev->mutex across ieee80211_iterate_active_interfaces(), which takes local->iflist_mtx, while mac80211 calls drv_unassign_vif_chanctx() with iflist_mtx already held.
.config is only reached through drv_config(), which asserts the wiphy mutex, so use ieee80211_iterate_active_interfaces_mtx() here too.
--- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +3 -3
@@ -818,9 +818,9 @@ static int mt7925_config(struct ieee80211_hw *hw, int radio_idx, u32 changed) }if (changed &IEEE80211_CONF_CHANGE_MONITOR ) { -ieee80211_iterate_active_interfaces (hw, -IEEE80211_IFACE_ITER_RESUME_ALL , - mt7925_sniffer_interface_iter, dev); +ieee80211_iterate_active_interfaces_mtx (hw, +IEEE80211_IFACE_ITER_RESUME_ALL , + mt7925_sniffer_interface_iter, dev); } out:
Signature · 1 line
2.55.0
From 0de8ed4134b5ea731f84adc9dcf5c05501a7b08f Mon Sep 17 00:00:00 2001
From: Devin Wittmayer <[email protected]>
Date: Sun, 9 Aug 2026 13:55:59 -0700
Subject: [PATCH 4/8] wifi: mt76: mt7925: check drv_pmctrl return in the PCIe
reset path
mt7925e_mac_reset() ignores the return value of mt792xe_mcu_drv_pmctrl(), unlike the two pmctrl calls later in the same function. When the driver-own handshake fails, __mt792xe_mcu_drv_pmctrl() returns -EIO without reinitialising WPDMA or clearing MT76_STATE_PM, and the reset carries on: it writes the interrupt enable registers, cycles NAPI, resets WPDMA and calls mt7925_run_firmware() on a chip the driver does not own.
Return the error instead. The call is the first statement in the function, before MT76_RESET is set and before the TX worker and NAPI are disabled, so nothing needs unwinding.
--- drivers/net/wireless/mediatek/mt76/mt7925/pci_mac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7925/pci_mac.c +3 -1
@@ -73,7 +73,9 @@ int mt7925e_mac_reset(struct mt792x_dev *dev)const struct mt792x_irq_map *irq_map = dev->irq_map;int i, err; -mt792xe_mcu_drv_pmctrl (dev); + err =mt792xe_mcu_drv_pmctrl (dev); +if (err) +return err;mt76_connac_free_pending_tx_skbs (&dev->pm,NULL );
Signature · 1 line
2.55.0
From efb449e0872747072f1b383bd59de1cec8deebfb Mon Sep 17 00:00:00 2001
From: Felix Fietkau <[email protected]>
Date: Thu, 27 Aug 2026 18:21:15 +0200
Subject: [PATCH 5/8] wifi: mt76: mt7925: restore the reset state when
fw_pmctrl fails
mt7925e_mac_reset() returns directly when mt792xe_mcu_fw_pmctrl() fails, leaving MT76_RESET set and the TX worker parked. Every other error path jumps to out, which clears both. mt7925_mac_reset_work() clears neither, so once every reset attempt fails there, TX stays blocked until another reset succeeds.
Jump to out instead.
--- drivers/net/wireless/mediatek/mt76/mt7925/pci_mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7925/pci_mac.c +1 -1
@@ -129,7 +129,7 @@ int mt7925e_mac_reset(struct mt792x_dev *dev) err =mt792xe_mcu_fw_pmctrl (dev);if (err) -return err; + goto out; err =__mt792xe_mcu_drv_pmctrl (dev);if (err)
Signature · 1 line
2.55.0
From ac5d29815d432aa6c014206a8dafceb060561ce4 Mon Sep 17 00:00:00 2001
From: Devin Wittmayer <[email protected]>
Date: Sat, 29 Aug 2026 23:42:01 -0700
Subject: [PATCH 6/8] wifi: mt76: mt7925: fix the lock inversion in suspend and
resume
Same as the previous patch, other driver.
--- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +8 -8
@@ -1648,10 +1648,10 @@ static int mt7925_suspend(struct ieee80211_hw *hw,mt792x_mutex_acquire (dev);clear_bit (MT76_STATE_RUNNING , &phy->mt76->state); -ieee80211_iterate_active_interfaces (hw, -IEEE80211_IFACE_ITER_RESUME_ALL , - mt7925_mcu_set_suspend_iter, - &dev->mphy); +ieee80211_iterate_active_interfaces_mtx (hw, +IEEE80211_IFACE_ITER_RESUME_ALL , + mt7925_mcu_set_suspend_iter, + &dev->mphy);mt792x_mutex_release (dev);
@@ -1666,10 +1666,10 @@ static int mt7925_resume(struct ieee80211_hw *hw)mt792x_mutex_acquire (dev);set_bit (MT76_STATE_RUNNING , &phy->mt76->state); -ieee80211_iterate_active_interfaces (hw, -IEEE80211_IFACE_ITER_RESUME_ALL , - mt7925_mcu_set_suspend_iter, - &dev->mphy); +ieee80211_iterate_active_interfaces_mtx (hw, +IEEE80211_IFACE_ITER_RESUME_ALL , + mt7925_mcu_set_suspend_iter, + &dev->mphy);ieee80211_queue_delayed_work (hw, &phy->mt76->mac_work, MT792x_WATCHDOG_TIME);
Signature · 1 line
2.55.0
From 7a447a1450c56e58ec7ef656108ab1a60485ed21 Mon Sep 17 00:00:00 2001
From: Aaron Ma <[email protected]>
Date: Wed, 26 Aug 2026 12:36:58 +0800
Subject: [PATCH 7/8] wifi: mt76: mt7925: restore the legacy BSS after MLO
teardown
Removing the last link of an MLD interface leaves the firmware with the MLD BSS and DEV entry: the removal loop skips the deflink, and the hweight16(mvif->valid_links) fallback reads the stale pre-update valid_links, which is still non-zero. The entry keeps the per-link MAC address, so every subsequent legacy association fails authentication until the interface is removed or the module is reloaded.
Remove the deflink BSS and add it back as a legacy BSS on the transition to zero links.
--- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +12 -0
@@ -2220,6 +2220,18 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mvif->valid_links = new_links; +/* Restore the legacy BSS after disabling MLO */ +if (old_links && !new_links) { +mt792x_mac_link_bss_remove (dev, &mvif->bss_conf, + &mvif->sta.deflink); + err =mt7925_mac_link_bss_add (dev, &vif->bss_conf, + &mvif->sta.deflink); +if (err <0 ) { +mt792x_mutex_release (dev); +return err; + } + } +mt792x_mutex_release (dev);return 0 ;
Signature · 1 line
2.55.0
From 9ac45a634d857d5c141e09d93b0ef1a1377eaae1 Mon Sep 17 00:00:00 2001
From: Andrei Rusu de Castro <[email protected]>
Date: Sun, 4 Oct 2026 15:49:02 +0000
Subject: [PATCH 8/8] wifi: mt76: mt7925: keep MLD membership consistent during
link add
mt7925_mac_link_sta_add() sends an ASSOC update for the primary WCID before sending the update for a new secondary WCID. The new link is published in msta->link[] and msta->valid_links only after both commands succeed.
Selecting the secondary entry from the subject of each command gives the primary STA_REC_MLD one link and the secondary STA_REC_MLD two links. Enumerating published links alone still omits the pending link from the primary command. Firmware-bound command captures reproduce this n=1/n=2 sequence during a secondary addition.
Build each MLD TLV from the station's published links and an explicit pending link. Pass the initialized pending link through both add-time station updates, including the update whose subject is the primary. Keep the primary first, bound entries by the firmware array, and skip links without station and BSS state. Other update callers have no pending link.
This leaves msta->link[] publication after successful link setup and preserves the existing add-failure cleanup. The pending pointer is used synchronously to populate the command, not stored in shared state.
--- .../net/wireless/mediatek/mt76/mt7925/mac.c | 2 +- .../net/wireless/mediatek/mt76/mt7925/main.c | 16 ++--- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 59 +++++++++++++++---- .../wireless/mediatek/mt76/mt7925/mt7925.h | 3 +- 4 files changed, 60 insertions(+), 20 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/mac.c +1 -1
@@ -1303,7 +1303,7 @@ mt7925_vif_connect_iter(void *priv, u8 *mac, true, NULL);mt7925_mcu_sta_update (dev,NULL , vif, &mvif->sta.deflink, true, -MT76_STA_INFO_STATE_NONE ); +MT76_STA_INFO_STATE_NONE ,NULL );mt7925_mcu_uni_add_beacon_offload (dev, hw, vif, true); } }
drivers/net/wireless/mediatek/mt76/mt7925/main.c +8 -8
@@ -969,7 +969,7 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, link_sta == mlink->pri_link) { ret =mt7925_mcu_sta_update (dev, link_sta, vif, mlink, true, -MT76_STA_INFO_STATE_NONE ); +MT76_STA_INFO_STATE_NONE ,NULL );if (ret) goto out_pm; } else if (ieee80211_vif_is_mld(vif) &&
@@ -991,19 +991,19 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, ret =mt7925_mcu_sta_update (dev, mlink->pri_link, vif, pri_mlink, true, -MT76_STA_INFO_STATE_ASSOC ); +MT76_STA_INFO_STATE_ASSOC , mlink);if (ret) goto out_pm; ret =mt7925_mcu_sta_update (dev, link_sta, vif, mlink, true, -MT76_STA_INFO_STATE_ASSOC ); +MT76_STA_INFO_STATE_ASSOC , mlink);if (ret) goto out_pm; }else { ret =mt7925_mcu_sta_update (dev, link_sta, vif, mlink, true, -MT76_STA_INFO_STATE_NONE ); +MT76_STA_INFO_STATE_NONE ,NULL );if (ret) goto out_pm; }
@@ -1211,7 +1211,7 @@ static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev,memset (mlink->airtime_ac,0 ,sizeof (mlink->airtime_ac));mt7925_mcu_sta_update (dev, link_sta, vif, mlink, true, -MT76_STA_INFO_STATE_ASSOC ); +MT76_STA_INFO_STATE_ASSOC ,NULL );mt792x_mutex_release (dev); }
@@ -1254,7 +1254,7 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev,mt76_connac_pm_wake (&dev->mphy, &dev->pm);mt7925_mcu_sta_update (dev, link_sta, vif, mlink, false, -MT76_STA_INFO_STATE_NONE ); +MT76_STA_INFO_STATE_NONE ,NULL );mt7925_mac_wtbl_update (dev, mlink->wcid.idx,MT_WTBL_UPDATE_ADM_COUNT_CLEAR );
@@ -1895,7 +1895,7 @@ mt7925_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, err =mt7925_mcu_sta_update (dev,NULL , vif, &mvif->sta.deflink, true, -MT76_STA_INFO_STATE_NONE ); +MT76_STA_INFO_STATE_NONE ,NULL ); out:mt792x_mutex_release (dev);
@@ -2039,7 +2039,7 @@ static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw,if (changed &BSS_CHANGED_ASSOC ) {mt7925_mcu_sta_update (dev,NULL , vif, &mvif->sta.deflink, true, -MT76_STA_INFO_STATE_ASSOC ); +MT76_STA_INFO_STATE_ASSOC ,NULL );mt7925_mcu_set_beacon_filter (dev, vif, vif->cfg.assoc);if (ieee80211_vif_is_mld (vif))
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +49 -10
102 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +2 -1
@@ -278,7 +278,8 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev,struct ieee80211_vif *vif, struct mt792x_link_sta *mlink, bool enable, - enum mt76_sta_info_state state); + enum mt76_sta_info_state state, + struct mt792x_link_sta *pending);int mt7925_mcu_set_chan_info (struct mt792x_phy *phy,u16 tag);int mt7925_mcu_set_tx (struct mt792x_dev *dev,struct ieee80211_bss_conf *bss_conf);int mt7925_mcu_set_eeprom (struct mt792x_dev *dev);
Signature · 1 line
2.55.0