]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mt76: mt7925: pass mlink to mcu_sta_update()
authorSean Wang <sean.wang@mediatek.com>
Fri, 6 Mar 2026 23:22:23 +0000 (17:22 -0600)
committerFelix Fietkau <nbd@nbd.name>
Tue, 24 Mar 2026 15:49:31 +0000 (15:49 +0000)
Drop the mt792x_sta_to_link() lookup in mt7925_mcu_sta_update() and
pass the resolved mlink from the caller instead. The link context is
already known at the call site, making the lookup redundant.

This keeps the helper lookup-free and makes WCID selection explicit.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-5-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7925/mac.c
drivers/net/wireless/mediatek/mt76/mt7925/main.c
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h

index 0bafa8e770a66f283271a1b598dca9412af6014a..c47bd812b66b9c8dcdd2f283eec1efc0151f7d20 100644 (file)
@@ -1285,7 +1285,8 @@ mt7925_vif_connect_iter(void *priv, u8 *mac,
        if (vif->type == NL80211_IFTYPE_AP) {
                mt76_connac_mcu_uni_add_bss(dev->phy.mt76, vif, &mvif->sta.deflink.wcid,
                                            true, NULL);
-               mt7925_mcu_sta_update(dev, NULL, vif, true,
+               mt7925_mcu_sta_update(dev, NULL, vif,
+                                     &mvif->sta.deflink, true,
                                      MT76_STA_INFO_STATE_NONE);
                mt7925_mcu_uni_add_beacon_offload(dev, hw, vif, true);
        }
index 353461f0e16994e1ad3e81786f5334851e80abef..c65e32a14c015f3a23e2f1fe317974fef3da98e9 100644 (file)
@@ -919,23 +919,31 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev,
 
        if (ieee80211_vif_is_mld(vif) &&
            link_sta == mlink->pri_link) {
-               ret = mt7925_mcu_sta_update(dev, link_sta, vif, true,
+               ret = mt7925_mcu_sta_update(dev, link_sta, vif,
+                                           mlink, true,
                                            MT76_STA_INFO_STATE_NONE);
                if (ret)
                        return ret;
        } else if (ieee80211_vif_is_mld(vif) &&
                   link_sta != mlink->pri_link) {
+               struct mt792x_link_sta *pri_mlink;
+
+               pri_mlink = mt792x_sta_to_link(msta, mlink->pri_link->link_id);
+
                ret = mt7925_mcu_sta_update(dev, mlink->pri_link, vif,
-                                           true, MT76_STA_INFO_STATE_ASSOC);
+                                           pri_mlink, true,
+                                           MT76_STA_INFO_STATE_ASSOC);
                if (ret)
                        return ret;
 
-               ret = mt7925_mcu_sta_update(dev, link_sta, vif, true,
+               ret = mt7925_mcu_sta_update(dev, link_sta, vif,
+                                           mlink, true,
                                            MT76_STA_INFO_STATE_ASSOC);
                if (ret)
                        return ret;
        } else {
-               ret = mt7925_mcu_sta_update(dev, link_sta, vif, true,
+               ret = mt7925_mcu_sta_update(dev, link_sta, vif,
+                                           mlink, true,
                                            MT76_STA_INFO_STATE_NONE);
                if (ret)
                        return ret;
@@ -1075,7 +1083,8 @@ static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev,
                               MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
        memset(mlink->airtime_ac, 0, sizeof(mlink->airtime_ac));
 
-       mt7925_mcu_sta_update(dev, link_sta, vif, true, MT76_STA_INFO_STATE_ASSOC);
+       mt7925_mcu_sta_update(dev, link_sta, vif, mlink, true,
+                             MT76_STA_INFO_STATE_ASSOC);
 
        mt792x_mutex_release(dev);
 }
@@ -1119,7 +1128,7 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev,
        mt76_connac_free_pending_tx_skbs(&dev->pm, &mlink->wcid);
        mt76_connac_pm_wake(&dev->mphy, &dev->pm);
 
-       mt7925_mcu_sta_update(dev, link_sta, vif, false,
+       mt7925_mcu_sta_update(dev, link_sta, vif, mlink, false,
                              MT76_STA_INFO_STATE_NONE);
        mt7925_mac_wtbl_update(dev, mlink->wcid.idx,
                               MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
@@ -1744,7 +1753,8 @@ mt7925_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
        if (err)
                goto out;
 
-       err = mt7925_mcu_sta_update(dev, NULL, vif, true,
+       err = mt7925_mcu_sta_update(dev, NULL, vif,
+                                   &mvif->sta.deflink, true,
                                    MT76_STA_INFO_STATE_NONE);
 out:
        mt792x_mutex_release(dev);
@@ -1887,7 +1897,8 @@ static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw,
        mt792x_mutex_acquire(dev);
 
        if (changed & BSS_CHANGED_ASSOC) {
-               mt7925_mcu_sta_update(dev, NULL, vif, true,
+               mt7925_mcu_sta_update(dev, NULL, vif,
+                                     &mvif->sta.deflink, true,
                                      MT76_STA_INFO_STATE_ASSOC);
                mt7925_mcu_set_beacon_filter(dev, vif, vif->cfg.assoc);
 
index 1e46adf7ddd9c5972c40512998ca0bc4470a7c0e..c97f5917c854d54270e032d2b573bb0242617636 100644 (file)
@@ -2036,7 +2036,9 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy,
 
 int mt7925_mcu_sta_update(struct mt792x_dev *dev,
                          struct ieee80211_link_sta *link_sta,
-                         struct ieee80211_vif *vif, bool enable,
+                         struct ieee80211_vif *vif,
+                         struct mt792x_link_sta *mlink,
+                         bool enable,
                          enum mt76_sta_info_state state)
 {
        struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
@@ -2051,14 +2053,8 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev,
                .offload_fw = true,
                .rcpi = to_rcpi(rssi),
        };
-       struct mt792x_sta *msta;
-       struct mt792x_link_sta *mlink;
 
-       if (link_sta) {
-               msta = (struct mt792x_sta *)link_sta->sta->drv_priv;
-               mlink = mt792x_sta_to_link(msta, link_sta->link_id);
-       }
-       info.wcid = link_sta ? &mlink->wcid : &mvif->sta.deflink.wcid;
+       info.wcid = &mlink->wcid;
        info.newly = state != MT76_STA_INFO_STATE_ASSOC;
 
        return mt7925_mcu_sta_cmd(&dev->mphy, &info);
index 0f0eff748bb779d623ba7812304bbcc02186afe7..95f29dae4d9d223e31094059c12e4f1d8c34be59 100644 (file)
@@ -250,7 +250,9 @@ int mt7925_mcu_set_bss_pm(struct mt792x_dev *dev,
                          bool enable);
 int mt7925_mcu_sta_update(struct mt792x_dev *dev,
                          struct ieee80211_link_sta *link_sta,
-                         struct ieee80211_vif *vif, bool enable,
+                         struct ieee80211_vif *vif,
+                         struct mt792x_link_sta *mlink,
+                         bool enable,
                          enum mt76_sta_info_state state);
 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);