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 1/6] wifi: mt76: mt7996: Rely on msta_link link_id in mt7996_vif_link_remove()
Date: Sun, 15 Mar 2026 11:26:24 +0100 [thread overview]
Message-ID: <20260315-mt7996-mlo-link-reconf-v1-1-a8a634fbc927@kernel.org> (raw)
In-Reply-To: <20260315-mt7996-mlo-link-reconf-v1-0-a8a634fbc927@kernel.org>
Rely on msta_link link_id value in mt7996_vif_link_remove routine
instead of using link_conf pointer. This assumption is correct since
msta_link link_id is set to link_conf link_id value in mt7996_vif_link_add
routine.
Moreover, fallback to default ieee80211_bss_conf struct if the link_conf
pointer in mt7996_vif_link_remove() is NULL.
MT7996 hw requires to remove AP MLD links from MCU configuration during
AP tear-down process (e.g. running mt7996_remove_interface()). Doing so,
we can't assume link_conf pointer is always non-NULL running
mt7996_vif_link_remove routine.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt7996/main.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index 834edd31458d57a21fc2e02d429ea139057aa60b..21a240f0c8c275b9fb5532ff74bbf76b741dac84 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -396,17 +396,21 @@ void mt7996_vif_link_remove(struct mt76_phy *mphy, struct ieee80211_vif *vif,
struct mt7996_vif_link *link = container_of(mlink, struct mt7996_vif_link, mt76);
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta_link *msta_link = &link->msta_link;
+ unsigned int link_id = msta_link->wcid.link_id;
struct mt7996_phy *phy = mphy->priv;
struct mt7996_dev *dev = phy->dev;
struct mt7996_key_iter_data it = {
.cmd = SET_KEY,
- .link_id = link_conf->link_id,
+ .link_id = link_id,
};
int idx = msta_link->wcid.idx;
if (!mlink->wcid->offchannel)
ieee80211_iter_keys(mphy->hw, vif, mt7996_key_iter, &it);
+ if (!link_conf)
+ link_conf = &vif->bss_conf;
+
mt7996_mcu_add_sta(dev, link_conf, NULL, link, NULL,
CONN_STATE_DISCONNECT, false);
mt7996_mcu_add_bss_info(phy, vif, link_conf, mlink, msta_link, false);
@@ -416,10 +420,9 @@ 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_conf->link_id) {
+ mvif->mt76.deflink_id == link_id) {
struct ieee80211_bss_conf *iter;
struct mt76_txq *mtxq;
- unsigned int link_id;
mvif->mt76.deflink_id = IEEE80211_LINK_UNSPECIFIED;
mtxq = (struct mt76_txq *)vif->txq->drv_priv;
@@ -427,7 +430,7 @@ void mt7996_vif_link_remove(struct mt76_phy *mphy, struct ieee80211_vif *vif,
for_each_vif_active_link(vif, iter, link_id) {
struct mt7996_vif_link *link;
- if (link_id == link_conf->link_id)
+ if (link_id == msta_link->wcid.link_id)
continue;
link = mt7996_vif_link(dev, vif, link_id);
--
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 ` Lorenzo Bianconi [this message]
2026-03-15 10:26 ` [PATCH mt76 2/6] wifi: mt76: mt7996: Account active links in valid_links fields Lorenzo Bianconi
2026-03-15 10:26 ` [PATCH mt76 3/6] wifi: mt76: mt7996: Move mlink deallocation in mt7996_vif_link_remove() 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-1-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