]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: mt76: mt7996: rework mt7996_sta_hw_queue_read to support MLO
authorLorenzo Bianconi <lorenzo@kernel.org>
Wed, 12 Mar 2025 11:13:54 +0000 (12:13 +0100)
committerFelix Fietkau <nbd@nbd.name>
Wed, 19 Mar 2025 13:47:06 +0000 (14:47 +0100)
Extend mt7996_sta_hw_queue_read to support multi-link setup.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250312-b4-mt7996-mlo-p2-v1-10-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c

index d453c2fc97e4fad10a29093b70e2ede8375ee0d8..4a28db17a2874078489e08ac8a038a51834b33a0 100644 (file)
@@ -616,29 +616,51 @@ static void
 mt7996_sta_hw_queue_read(void *data, struct ieee80211_sta *sta)
 {
        struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
-       struct mt7996_dev *dev = msta->vif->deflink.phy->dev;
-       struct mt7996_sta_link *msta_link = &msta->deflink;
+       struct mt7996_vif *mvif = msta->vif;
+       struct mt7996_dev *dev = mvif->deflink.phy->dev;
+       struct ieee80211_link_sta *link_sta;
        struct seq_file *s = data;
-       u8 ac;
+       struct ieee80211_vif *vif;
+       unsigned int link_id;
 
-       for (ac = 0; ac < 4; ac++) {
-               u32 qlen, ctrl, val;
-               u32 idx = msta_link->wcid.idx >> 5;
-               u8 offs = msta_link->wcid.idx & GENMASK(4, 0);
+       vif = container_of((void *)mvif, struct ieee80211_vif, drv_priv);
+
+       rcu_read_lock();
 
-               ctrl = BIT(31) | BIT(11) | (ac << 24);
-               val = mt76_rr(dev, MT_PLE_AC_QEMPTY(ac, idx));
+       for_each_sta_active_link(vif, sta, link_sta, link_id) {
+               struct mt7996_sta_link *msta_link;
+               struct mt76_vif_link *mlink;
+               u8 ac;
 
-               if (val & BIT(offs))
+               mlink = rcu_dereference(mvif->mt76.link[link_id]);
+               if (!mlink)
                        continue;
 
-               mt76_wr(dev, MT_FL_Q0_CTRL, ctrl | msta_link->wcid.idx);
-               qlen = mt76_get_field(dev, MT_FL_Q3_CTRL,
-                                     GENMASK(11, 0));
-               seq_printf(s, "\tSTA %pM wcid %d: AC%d%d queued:%d\n",
-                          sta->addr, msta_link->wcid.idx,
-                          msta->vif->deflink.mt76.wmm_idx, ac, qlen);
+               msta_link = rcu_dereference(msta->link[link_id]);
+               if (!msta_link)
+                       continue;
+
+               for (ac = 0; ac < 4; ac++) {
+                       u32 idx = msta_link->wcid.idx >> 5, qlen, ctrl, val;
+                       u8 offs = msta_link->wcid.idx & GENMASK(4, 0);
+
+                       ctrl = BIT(31) | BIT(11) | (ac << 24);
+                       val = mt76_rr(dev, MT_PLE_AC_QEMPTY(ac, idx));
+
+                       if (val & BIT(offs))
+                               continue;
+
+                       mt76_wr(dev,
+                               MT_FL_Q0_CTRL, ctrl | msta_link->wcid.idx);
+                       qlen = mt76_get_field(dev, MT_FL_Q3_CTRL,
+                                             GENMASK(11, 0));
+                       seq_printf(s, "\tSTA %pM wcid %d: AC%d%d queued:%d\n",
+                                  sta->addr, msta_link->wcid.idx,
+                                  mlink->wmm_idx, ac, qlen);
+               }
        }
+
+       rcu_read_unlock();
 }
 
 static int