From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH mt76-next 02/17] wifi: mt76: add a helper to point the TXQs of a station at a wcid
Date: Sat, 21 Nov 2026 13:09:11 +0100 [thread overview]
Message-ID: <20261121120926.3603979-2-nbd@nbd.name> (raw)
In-Reply-To: <20261121120926.3603979-1-nbd@nbd.name>
The TXQs of a station name the wcid that the TX scheduler sends their
frames on. mt76_sta_add() sets it when the station is added. mt7996
adds its stations without mt76_sta_add() and sets it with a loop of its
own whenever it sets the default link of a station.
Move that loop into the core, so that other drivers can use it for the
same purpose, and use it in mt76_sta_add() too.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
drivers/net/wireless/mediatek/mt76/mac80211.c | 11 +----------
drivers/net/wireless/mediatek/mt76/mt76.h | 16 ++++++++++++++++
.../net/wireless/mediatek/mt76/mt7996/main.c | 18 +-----------------
3 files changed, 18 insertions(+), 27 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index b8a568e0ae27..db604ffde216 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -1758,7 +1758,6 @@ mt76_sta_add(struct mt76_phy *phy, struct ieee80211_vif *vif,
struct mt76_wcid *published;
bool registered;
int ret;
- int i;
mutex_lock(&dev->mutex);
@@ -1772,15 +1771,7 @@ mt76_sta_add(struct mt76_phy *phy, struct ieee80211_vif *vif,
if (ret)
goto out;
- for (i = 0; i < ARRAY_SIZE(sta->txq); i++) {
- struct mt76_txq *mtxq;
-
- if (!sta->txq[i])
- continue;
-
- mtxq = (struct mt76_txq *)sta->txq[i]->drv_priv;
- mtxq->wcid = wcid->idx;
- }
+ mt76_sta_txq_wcid_set(sta, wcid->idx);
published = rcu_dereference_protected(dev->wcid[wcid->idx],
lockdep_is_held(&dev->mutex));
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index ddada6834170..d82d22c14c9f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -1449,6 +1449,22 @@ mtxq_to_txq(struct mt76_txq *mtxq)
return container_of(ptr, struct ieee80211_txq, drv_priv);
}
+static inline void
+mt76_sta_txq_wcid_set(struct ieee80211_sta *sta, u16 idx)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(sta->txq); i++) {
+ struct mt76_txq *mtxq;
+
+ if (!sta->txq[i])
+ continue;
+
+ mtxq = (struct mt76_txq *)sta->txq[i]->drv_priv;
+ mtxq->wcid = idx;
+ }
+}
+
/* peer-wide state uses the wcid of the primary link */
static inline struct mt76_wcid *
mt76_wcid_primary(struct mt76_wcid *wcid)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index d323557898b6..253603d25662 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -1226,22 +1226,6 @@ mt7996_post_channel_switch(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
return ret;
}
-static void
-mt7996_sta_init_txq_wcid(struct ieee80211_sta *sta, int idx)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(sta->txq); i++) {
- struct mt76_txq *mtxq;
-
- if (!sta->txq[i])
- continue;
-
- mtxq = (struct mt76_txq *)sta->txq[i]->drv_priv;
- mtxq->wcid = idx;
- }
-}
-
static void
mt7996_sta_deflink_set(struct ieee80211_sta *sta, unsigned int link_id,
int idx)
@@ -1251,7 +1235,7 @@ mt7996_sta_deflink_set(struct ieee80211_sta *sta, unsigned int link_id,
msta->deflink_id = link_id;
if (msta->seclink_id == IEEE80211_LINK_UNSPECIFIED)
msta->seclink_id = link_id;
- mt7996_sta_init_txq_wcid(sta, idx);
+ mt76_sta_txq_wcid_set(sta, idx);
}
static void
--
2.47.3
next prev parent reply other threads:[~2026-11-21 12:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 12:09 [PATCH mt76-next 01/17] wifi: mt76: mt7996: name a new secondary link to the firmware first Felix Fietkau
2026-11-21 12:09 ` Felix Fietkau [this message]
2026-11-21 12:09 ` [PATCH mt76-next 03/17] wifi: mt76: mt7925: move the default link to a remaining link Felix Fietkau
2026-11-21 12:09 ` [PATCH mt76-next 04/17] wifi: mt76: mt7925: keep the deflink wcid index until station removal Felix Fietkau
2026-11-21 12:09 ` [PATCH mt76-next 05/17] wifi: mt76: mt792x: look up the TX links under RCU Felix Fietkau
2026-11-21 12:09 ` [PATCH mt76-next 06/17] wifi: mt76: mt7925: read the links under RCU in the IPv6 notifier Felix Fietkau
2026-11-21 12:09 ` [PATCH mt76-next 07/17] wifi: mt76: mt7925: abort a ROC on the BSS that requested it Felix Fietkau
2026-11-21 12:09 ` [PATCH mt76-next 08/17] wifi: mt76: mt7925: take the link conf of a removed link from old[] Felix Fietkau
2026-11-21 12:09 ` [PATCH mt76-next 09/17] wifi: mt76: mt7925: send the MLO ROC only for a station vif Felix Fietkau
2026-11-21 12:09 ` [PATCH mt76-next 10/17] wifi: mt76: mt7996: send the Beacon rate table again after a full reset Felix Fietkau
2026-11-21 12:09 ` [PATCH mt76-next 11/17] wifi: mt76: mt7996: restore the operating channel after an L1 SER Felix Fietkau
2026-11-21 12:09 ` [PATCH mt76-next 12/17] wifi: mt76: reset the DFS state of a phy at a full reset Felix Fietkau
2026-11-21 12:09 ` [PATCH mt76-next 13/17] wifi: mt76: mt7996: abort a background CAC " Felix Fietkau
2026-11-21 12:09 ` [PATCH mt76-next 14/17] wifi: mt76: mt7915: " Felix Fietkau
2026-11-21 12:09 ` [PATCH mt76-next 15/17] wifi: mt76: mt7996: clear the airtime counts with the WTBL counters Felix Fietkau
2026-11-21 12:09 ` [PATCH mt76-next 16/17] wifi: mt76: mt7996: drop the host WTBL write of a fixed GI Felix Fietkau
2026-11-21 12:09 ` [PATCH mt76-next 17/17] wifi: mt76: mt7925: don't reset the USB device on probe Felix Fietkau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261121120926.3603979-2-nbd@nbd.name \
--to=nbd@nbd.name \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox