]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: mt7925: add mt7925_mac_link_sta_assoc to associate per-link STA
authorSean Wang <sean.wang@mediatek.com>
Thu, 13 Jun 2024 03:02:37 +0000 (20:02 -0700)
committerFelix Fietkau <nbd@nbd.name>
Tue, 9 Jul 2024 21:01:59 +0000 (23:01 +0200)
The mt7925_mac_link_sta_add function currently associates the per-link STA.
We will extend this function when we implement the MLO functionality.

This patch only includes structural changes and does not involve any
logic changes.

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

index 3872b5debdd85fdca51cc29264bb19ff02450eb6..202bd84716abdf4349892e0668f76e60f2718c73 100644 (file)
@@ -767,32 +767,43 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL_GPL(mt7925_mac_sta_add);
 
-void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
-                         struct ieee80211_sta *sta)
+static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev,
+                                     struct ieee80211_vif *vif,
+                                     struct ieee80211_link_sta *link_sta)
 {
        struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
-       struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
        struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
        struct ieee80211_bss_conf *link_conf;
+       struct mt792x_link_sta *mlink;
+       struct mt792x_sta *msta;
+
+       msta = (struct mt792x_sta *)link_sta->sta->drv_priv;
+       mlink = mt792x_sta_to_link(msta, link_sta->link_id);
 
        mt792x_mutex_acquire(dev);
 
        link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id);
 
-       if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls)
+       if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls)
                mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx,
-                                       link_conf, &sta->deflink, true);
+                                       link_conf, link_sta, true);
 
-       ewma_avg_signal_init(&msta->deflink.avg_ack_signal);
+       ewma_avg_signal_init(&mlink->avg_ack_signal);
 
-       mt7925_mac_wtbl_update(dev, msta->deflink.wcid.idx,
+       mt7925_mac_wtbl_update(dev, mlink->wcid.idx,
                               MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
-       memset(msta->deflink.airtime_ac, 0, sizeof(msta->deflink.airtime_ac));
+       memset(mlink->airtime_ac, 0, sizeof(mlink->airtime_ac));
 
-       mt7925_mcu_sta_update(dev, &sta->deflink, vif, true, MT76_STA_INFO_STATE_ASSOC);
+       mt7925_mcu_sta_update(dev, link_sta, vif, true, MT76_STA_INFO_STATE_ASSOC);
 
        mt792x_mutex_release(dev);
 }
+
+void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+                         struct ieee80211_sta *sta)
+{
+       mt7925_mac_link_sta_assoc(mdev, vif, &sta->deflink);
+}
 EXPORT_SYMBOL_GPL(mt7925_mac_sta_assoc);
 
 void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,