From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Felix Fietkau <nbd@nbd.name>, Ryder Lee <ryder.lee@mediatek.com>,
Shayne Chen <shayne.chen@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Lorenzo Bianconi <lorenzo@kernel.org>
Cc: linux-wireless@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: [PATCH mt76 2/6] wifi: mt76: mt7996: Account active links in valid_links fields
Date: Sun, 15 Mar 2026 11:26:25 +0100 [thread overview]
Message-ID: <20260315-mt7996-mlo-link-reconf-v1-2-a8a634fbc927@kernel.org> (raw)
In-Reply-To: <20260315-mt7996-mlo-link-reconf-v1-0-a8a634fbc927@kernel.org>
From: Shayne Chen <shayne.chen@mediatek.com>
Track active vif links in mt7996_vif_link_add and mt7996_vif_link_remove
routines.
This is a preliminary patch in order to remove AP MLD links from MCU
configuration during AP tear-down process and to support MLO link
reconfiguration in MT7996 driver.
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt7996/main.c | 52 +++++++++++++-----------
1 file changed, 29 insertions(+), 23 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index 21a240f0c8c275b9fb5532ff74bbf76b741dac84..07a266f7670c1d6b050e3790ce91cba014b18eab 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -367,12 +367,16 @@ int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif,
ieee80211_iter_keys(mphy->hw, vif, mt7996_key_iter, &it);
- if (vif->txq && !mlink->wcid->offchannel &&
- mvif->mt76.deflink_id == IEEE80211_LINK_UNSPECIFIED) {
- struct mt76_txq *mtxq = (struct mt76_txq *)vif->txq->drv_priv;
-
- mvif->mt76.deflink_id = link_conf->link_id;
- mtxq->wcid = idx;
+ if (!mlink->wcid->offchannel) {
+ if (vif->txq &&
+ mvif->mt76.deflink_id == IEEE80211_LINK_UNSPECIFIED) {
+ struct mt76_txq *mtxq;
+
+ mtxq = (struct mt76_txq *)vif->txq->drv_priv;
+ mvif->mt76.deflink_id = link_conf->link_id;
+ mtxq->wcid = idx;
+ }
+ mvif->mt76.valid_links |= BIT(link_conf->link_id);
}
if (vif->type == NL80211_IFTYPE_STATION) {
@@ -419,28 +423,30 @@ void mt7996_vif_link_remove(struct mt76_phy *mphy, struct ieee80211_vif *vif,
rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
- if (vif->txq && !mlink->wcid->offchannel &&
- mvif->mt76.deflink_id == link_id) {
- struct ieee80211_bss_conf *iter;
- struct mt76_txq *mtxq;
+ if (!mlink->wcid->offchannel) {
+ if (vif->txq && mvif->mt76.deflink_id == link_id) {
+ struct ieee80211_bss_conf *iter;
+ struct mt76_txq *mtxq;
- mvif->mt76.deflink_id = IEEE80211_LINK_UNSPECIFIED;
- mtxq = (struct mt76_txq *)vif->txq->drv_priv;
- /* Primary link will be removed, look for a new one */
- for_each_vif_active_link(vif, iter, link_id) {
- struct mt7996_vif_link *link;
+ mvif->mt76.deflink_id = IEEE80211_LINK_UNSPECIFIED;
+ mtxq = (struct mt76_txq *)vif->txq->drv_priv;
+ /* Primary link will be removed, look for a new one */
+ for_each_vif_active_link(vif, iter, link_id) {
+ struct mt7996_vif_link *link;
- if (link_id == msta_link->wcid.link_id)
- continue;
+ if (link_id == msta_link->wcid.link_id)
+ continue;
- link = mt7996_vif_link(dev, vif, link_id);
- if (!link)
- continue;
+ link = mt7996_vif_link(dev, vif, link_id);
+ if (!link)
+ continue;
- mtxq->wcid = link->msta_link.wcid.idx;
- mvif->mt76.deflink_id = link_id;
- break;
+ mtxq->wcid = link->msta_link.wcid.idx;
+ mvif->mt76.deflink_id = link_id;
+ break;
+ }
}
+ mvif->mt76.valid_links &= ~BIT(link_id);
}
dev->mt76.vif_mask &= ~BIT_ULL(mlink->idx);
--
2.53.0
next prev parent reply other threads:[~2026-03-15 10:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-15 10:26 [PATCH mt76 0/6] wifi: mt76: mt7996: Rework vif/sta links management for link reconfiguration Lorenzo Bianconi
2026-03-15 10:26 ` [PATCH mt76 1/6] wifi: mt76: mt7996: Rely on msta_link link_id in mt7996_vif_link_remove() Lorenzo Bianconi
2026-03-15 10:26 ` Lorenzo Bianconi [this message]
2026-03-15 10:26 ` [PATCH mt76 3/6] wifi: mt76: mt7996: Move mlink deallocation " Lorenzo Bianconi
2026-03-15 10:26 ` [PATCH mt76 4/6] wifi: mt76: mt7996: Destroy vif active links in mt7996_remove_interface() Lorenzo Bianconi
2026-03-15 10:26 ` [PATCH mt76 5/6] wifi: mt76: mt7996: Add mcu APIs to enable/disable vif links Lorenzo Bianconi
2026-03-15 10:26 ` [PATCH mt76 6/6] wifi: mt76: mt7996: Destroy active sta links in mt7996_mac_sta_remove() Lorenzo Bianconi
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=20260315-mt7996-mlo-link-reconf-v1-2-a8a634fbc927@kernel.org \
--to=lorenzo@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shayne.chen@mediatek.com \
/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