[PATCH 09/28] wifi: mt76: mt7925: deactivate the DEV and BSS on disconnect
Emery Hsin
emery.hsin at mediatek.com
Mon Nov 9 19:12:25 PST 2026
On disconnect the BSS is marked disconnected but stays active, so the
firmware keeps its old band binding and a later connection can get the
stale band. Also deactivate the DEV and BSS and reset the band to auto.
This is a preparation patch before the MT7925 MLO hybrid/EMLSR work.
Signed-off-by: Emery Hsin <emery.hsin at mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/main.c | 25 +++++++--
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 56 -------------------
.../net/wireless/mediatek/mt76/mt7925/mcu.h | 2 -
3 files changed, 21 insertions(+), 62 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 62018d17745c..4889d3bfe08d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -1401,15 +1401,30 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev,
link_conf = mt792x_vif_to_bss_conf(vif, link_id);
if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) {
+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_bss_conf *mconf;
mconf = mt792x_link_conf_to_mconf(link_conf);
- if (ieee80211_vif_is_mld(vif))
- mt792x_mac_link_bss_remove(dev, mconf, mlink);
- else
+ /* reset to auto band so the deactivate drops the band binding */
+ mconf->mt76.band_idx = MT792x_BAND_AUTO;
+
+ if (ieee80211_vif_is_mld(vif)) {
+ /* Sub-links are removed. The primary link is kept for
+ * reconnect but deactivated in firmware.
+ */
+ if (mconf != &mvif->bss_conf)
+ mt792x_mac_link_bss_remove(dev, mconf, mlink);
+ else
+ mt792x_mcu_set_dev_active(dev, link_conf, mconf,
+ &mlink->wcid, false);
+ } else {
+ /* deactivate DEV and BSS, re-activated on the next connect */
mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf,
link_sta, false);
+ mt792x_mcu_set_dev_active(dev, link_conf, mconf,
+ &mlink->wcid, false);
+ }
}
spin_lock_bh(&mdev->sta_poll_lock);
@@ -1457,6 +1472,9 @@ mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif,
mconf = mt792x_link_conf_to_mconf(link_conf);
+ /* reset to auto band before the disconnect command */
+ mconf->mt76.band_idx = MT792x_BAND_AUTO;
+
mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf,
link_sta, false);
}
@@ -1529,7 +1547,6 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
if (ieee80211_vif_is_mld(vif)) {
mt7925_mac_sta_remove_links(dev, vif, sta, msta->valid_links);
- mt7925_mcu_del_dev(mdev, vif);
} else {
mt7925_mac_link_sta_remove(mdev, vif, &sta->deflink,
&msta->deflink);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index b16a3c3122a1..557f8d3dea12 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -3185,62 +3185,6 @@ int mt7925_mcu_set_timing(struct mt792x_phy *phy,
MCU_UNI_CMD(BSS_INFO_UPDATE), true);
}
-void mt7925_mcu_del_dev(struct mt76_dev *mdev,
- struct ieee80211_vif *vif)
-{
- struct mt76_vif_link *mvif = (struct mt76_vif_link *)vif->drv_priv;
- struct {
- struct {
- u8 omac_idx;
- u8 band_idx;
- __le16 pad;
- } __packed hdr;
- struct req_tlv {
- __le16 tag;
- __le16 len;
- u8 active;
- u8 link_idx; /* hw link idx */
- u8 omac_addr[ETH_ALEN];
- } __packed tlv;
- } dev_req = {
- .tlv = {
- .tag = cpu_to_le16(DEV_INFO_ACTIVE),
- .len = cpu_to_le16(sizeof(struct req_tlv)),
- .active = true,
- },
- };
- struct {
- struct {
- u8 bss_idx;
- u8 pad[3];
- } __packed hdr;
- struct mt76_connac_bss_basic_tlv basic;
- } basic_req = {
- .basic = {
- .tag = cpu_to_le16(UNI_BSS_INFO_BASIC),
- .len = cpu_to_le16(sizeof(struct mt76_connac_bss_basic_tlv)),
- .active = true,
- .conn_state = 1,
- },
- };
-
- dev_req.hdr.omac_idx = mvif->omac_idx;
- dev_req.hdr.band_idx = mvif->band_idx;
-
- basic_req.hdr.bss_idx = mvif->idx;
- basic_req.basic.omac_idx = mvif->omac_idx;
- basic_req.basic.band_idx = mvif->band_idx;
- basic_req.basic.link_idx = mvif->link_idx;
-
- mt76_mcu_send_msg(mdev, MCU_UNI_CMD(BSS_INFO_UPDATE),
- &basic_req, sizeof(basic_req), true);
-
- /* recovery omac address for the legacy interface */
- memcpy(dev_req.tlv.omac_addr, vif->addr, ETH_ALEN);
- mt76_mcu_send_msg(mdev, MCU_UNI_CMD(DEV_INFO_UPDATE),
- &dev_req, sizeof(dev_req), true);
-}
-
int mt7925_mcu_add_bss_info_sta(struct mt792x_phy *phy,
struct ieee80211_chanctx_conf *ctx,
struct ieee80211_bss_conf *link_conf,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
index 11f9eac13ffc..4a6a1226a317 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
@@ -730,8 +730,6 @@ int mt7925_mcu_sched_scan_req(struct mt76_phy *phy,
int mt7925_mcu_sched_scan_enable(struct mt76_phy *phy,
struct ieee80211_vif *vif,
bool enable);
-void mt7925_mcu_del_dev(struct mt76_dev *mdev,
- struct ieee80211_vif *vif);
int mt7925_mcu_add_bss_info(struct mt792x_phy *phy,
struct ieee80211_chanctx_conf *ctx,
struct ieee80211_bss_conf *link_conf,
--
2.45.2
More information about the Linux-mediatek
mailing list