wifi: mt76: mt7925: pass mlink to mcu_sta_update()

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>
This commit is contained in:
Sean Wang 2026-03-06 17:22:23 -06:00 committed by Felix Fietkau
parent ff643b81bc
commit dc019e3294
4 changed files with 28 additions and 18 deletions

View 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);
}

View 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);

View 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);

View 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);