wifi: mt76: mt7925: move WCID teardown into link_sta_remove()

Move WCID teardown into mt7925_mac_link_sta_remove() to mirror the
dev->mt76.wcid[] publish done during link add.

This clears the published WCID before the rest of teardown, so WCID
lookups no longer expose a link that is being removed.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-17-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Sean Wang 2026-03-06 17:22:35 -06:00 committed by Felix Fietkau
parent 0fff5b5e27
commit 52f088a2e6

View File

@ -1151,12 +1151,14 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev,
struct mt792x_link_sta *mlink)
{
struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
struct mt76_wcid *wcid = &mlink->wcid;
struct ieee80211_bss_conf *link_conf;
u8 link_id = link_sta->link_id;
u16 idx = wcid->idx;
mt7925_roc_abort_sync(dev);
mt76_connac_free_pending_tx_skbs(&dev->pm, &mlink->wcid);
mt76_connac_free_pending_tx_skbs(&dev->pm, wcid);
mt76_connac_pm_wake(&dev->mphy, &dev->pm);
mt7925_mcu_sta_update(dev, link_sta, vif, mlink, false,
@ -1183,6 +1185,10 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev,
list_del_init(&mlink->wcid.poll_list);
spin_unlock_bh(&mdev->sta_poll_lock);
rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
mt76_wcid_cleanup(mdev, wcid);
mt76_wcid_mask_clear(mdev->wcid_mask, idx);
mt76_connac_power_save_sched(&dev->mphy, &dev->pm);
}
@ -1191,8 +1197,6 @@ mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, unsigned long old_links)
{
struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
struct mt76_dev *mdev = &dev->mt76;
struct mt76_wcid *wcid;
unsigned int link_id;
/* clean up bss before starec */
@ -1235,16 +1239,12 @@ mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif,
if (!mlink)
continue;
mt7925_mac_link_sta_remove(&dev->mt76, vif, link_sta, mlink);
wcid = &mlink->wcid;
rcu_assign_pointer(msta->link[link_id], NULL);
msta->valid_links &= ~BIT(link_id);
mlink->sta = NULL;
mlink->pri_link = NULL;
mt76_wcid_cleanup(mdev, wcid);
mt76_wcid_mask_clear(mdev->wcid_mask, wcid->idx);
mt7925_mac_link_sta_remove(&dev->mt76, vif, link_sta, mlink);
if (msta->deflink_id == link_id)
msta->deflink_id = IEEE80211_LINK_UNSPECIFIED;