]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mt76: mt7996: Remove link pointer dependency in mt7996_mac_sta_remove_links()
authorLorenzo Bianconi <lorenzo@kernel.org>
Fri, 6 Mar 2026 10:27:52 +0000 (11:27 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 24 Mar 2026 15:49:30 +0000 (15:49 +0000)
Remove link pointer dependency in mt7996_mac_sta_remove_links routine to
get the mt7996_phy pointer since the link can be already offchannel
running mt7996_mac_sta_remove_links(). Rely on __mt7996_phy routine
instead.

Fixes: 344dd6a4c919 ("wifi: mt76: mt7996: Move num_sta accounting in mt7996_mac_sta_{add,remove}_links")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260306-mt7996-deflink-lookup-link-remove-v1-1-7162b332873c@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7996/main.c

index 06f4c653ed675a60a2428430ad52022121278cec..f063888b998071c91ab757533b6de6e6a4bae9ef 100644 (file)
@@ -1097,8 +1097,7 @@ mt7996_mac_sta_remove_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
 
        for_each_set_bit(link_id, &links, IEEE80211_MLD_MAX_NUM_LINKS) {
                struct mt7996_sta_link *msta_link = NULL;
-               struct mt7996_vif_link *link;
-               struct mt76_phy *mphy;
+               struct mt7996_phy *phy;
 
                msta_link = rcu_replace_pointer(msta->link[link_id], msta_link,
                                                lockdep_is_held(&mdev->mutex));
@@ -1107,17 +1106,12 @@ mt7996_mac_sta_remove_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
 
                mt7996_mac_wtbl_update(dev, msta_link->wcid.idx,
                                       MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
-
                mt7996_mac_sta_deinit_link(dev, msta_link);
-               link = mt7996_vif_link(dev, vif, link_id);
-               if (!link)
-                       continue;
 
-               mphy = mt76_vif_link_phy(&link->mt76);
-               if (!mphy)
-                       continue;
+               phy = __mt7996_phy(dev, msta_link->wcid.phy_idx);
+               if (phy)
+                       phy->mt76->num_sta--;
 
-               mphy->num_sta--;
                if (msta->deflink_id == link_id) {
                        msta->deflink_id = IEEE80211_LINK_UNSPECIFIED;
                        if (msta->seclink_id == link_id) {