From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH mt76-next 20/20] wifi: mt76: mt7996: set the default link again when a link is reused
Date: Tue, 24 Nov 2026 09:43:09 +0100 [thread overview]
Message-ID: <20261124084309.1981968-20-nbd@nbd.name> (raw)
In-Reply-To: <20261124084309.1981968-1-nbd@nbd.name>
Since commit 08813703ac41 ("wifi: mt76: mt7996: Destroy vif active links
in mt7996_remove_interface()"), a removed vif link stays valid. Its
removal still clears mvif->mt76.deflink_id if it is the default link.
A later add on the same band reuses the link and leaves deflink_id unset
until the interface goes away. A mesh point thus loses its TSF
adjustment after it leaves and joins the mesh, since mt7996_offset_tsf()
finds no link.
Make a reused link the default link if the interface has none. Give its
wcid to the TX queue as well, as the first add of a link does.
Fixes: 08813703ac41 ("wifi: mt76: mt7996: Destroy vif active links in mt7996_remove_interface()")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
.../net/wireless/mediatek/mt76/mt7996/main.c | 40 ++++++++++++-------
1 file changed, 25 insertions(+), 15 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index c220376cded6..ac4f8b89bd90 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -356,6 +356,20 @@ static void mt7996_vif_link_free(struct mt7996_vif_link *link,
kfree_rcu(mlink, rcu_head);
}
+static void mt7996_vif_deflink_init(struct ieee80211_vif *vif,
+ struct mt7996_vif_link *link)
+{
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct mt76_txq *mtxq;
+
+ if (!vif->txq || mvif->mt76.deflink_id != IEEE80211_LINK_UNSPECIFIED)
+ return;
+
+ mtxq = (struct mt76_txq *)vif->txq->drv_priv;
+ mvif->mt76.deflink_id = link->msta_link.wcid.link_id;
+ mtxq->wcid = link->msta_link.wcid.idx;
+}
+
static int mt7996_vif_link_reuse(struct mt7996_phy *phy,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf,
@@ -369,10 +383,16 @@ static int mt7996_vif_link_reuse(struct mt7996_phy *phy,
return ret;
if (vif->type == NL80211_IFTYPE_AP && ieee80211_vif_is_mld(vif))
- return mt7996_mcu_mld_link_oper(phy->dev, link_conf, link, true);
+ ret = mt7996_mcu_mld_link_oper(phy->dev, link_conf, link, true);
+ else
+ ret = mt7996_mcu_add_bss_info(phy, vif, link_conf, mlink,
+ &link->msta_link, true);
+ if (ret)
+ return ret;
- return mt7996_mcu_add_bss_info(phy, vif, link_conf, mlink,
- &link->msta_link, true);
+ mt7996_vif_deflink_init(vif, link);
+
+ return 0;
}
int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif,
@@ -475,14 +495,7 @@ int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif,
ieee80211_iter_keys(mphy->hw, vif, mt7996_key_iter, &it);
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;
- }
+ mt7996_vif_deflink_init(vif, link);
mvif->mt76.valid_links |= BIT(link_conf->link_id);
}
@@ -564,10 +577,8 @@ void mt7996_vif_link_remove(struct mt76_phy *mphy, struct ieee80211_vif *vif,
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) {
if (link_id == msta_link->wcid.link_id)
@@ -577,8 +588,7 @@ void mt7996_vif_link_remove(struct mt76_phy *mphy, struct ieee80211_vif *vif,
if (!link)
continue;
- mtxq->wcid = link->msta_link.wcid.idx;
- mvif->mt76.deflink_id = link_id;
+ mt7996_vif_deflink_init(vif, link);
break;
}
}
--
2.47.3
next prev parent reply other threads:[~2026-11-24 8:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 8:42 [PATCH mt76-next 01/20] wifi: mt76: mt7915: dump the firmware memory of mt7916 Felix Fietkau
2026-11-24 8:42 ` [PATCH mt76-next 02/20] wifi: mt76: mt7915: set the LED GPIO mux " Felix Fietkau
2026-11-24 8:53 ` Lorenzo Bianconi
2026-11-24 8:42 ` [PATCH mt76-next 03/20] wifi: mt76: fail an MCU command started during an MCU reset Felix Fietkau
2026-11-24 8:54 ` Lorenzo Bianconi
2026-11-24 8:42 ` [PATCH mt76-next 04/20] wifi: mt76: mark an MCU command that only reads Felix Fietkau
2026-11-24 8:42 ` [PATCH mt76-next 05/20] wifi: mt76: retry only an MCU command that reads Felix Fietkau
2026-11-24 8:42 ` [PATCH mt76-next 06/20] wifi: mt76: report an MCU command whose outcome is unknown Felix Fietkau
2026-11-24 8:42 ` [PATCH mt76-next 07/20] wifi: mt76: mt7996: mark the MCU commands that only read Felix Fietkau
2026-11-24 8:42 ` [PATCH mt76-next 08/20] wifi: mt76: mt7996: reset after an MCU reset lost a state command Felix Fietkau
2026-11-24 8:42 ` [PATCH mt76-next 09/20] wifi: mt76: mt7915: mark the MCU commands that only read Felix Fietkau
2026-11-24 8:42 ` [PATCH mt76-next 10/20] wifi: mt76: mt7915: hold the device mutex in the rate control work Felix Fietkau
2026-11-24 8:56 ` Lorenzo Bianconi
2026-11-24 8:43 ` [PATCH mt76-next 11/20] wifi: mt76: mt7915: hold the device mutex in the station and regd updates Felix Fietkau
2026-11-24 8:58 ` Lorenzo Bianconi
2026-11-24 8:43 ` [PATCH mt76-next 12/20] wifi: mt76: mt7915: reset after an MCU reset lost a state command Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 13/20] wifi: mt76: mt7996: clear the PS state of stations at a reset Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 14/20] wifi: mt76: mt7996: apply the PS sync bitmap to MLD stations alone Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 15/20] wifi: mt76: mt7996: keep the TWT state out of the PS flag Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 16/20] wifi: mt76: mt7996: read the TSF twice against the firmware's latch Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 17/20] wifi: mt76: mt7996: check a TSF write " Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 18/20] wifi: mt76: mt7915: keep the TWT state out of the PS flag Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 19/20] wifi: mt76: mt7915: clear the PS flag of a station at a reset Felix Fietkau
2026-11-24 8:43 ` Felix Fietkau [this message]
2026-11-24 8:53 ` [PATCH mt76-next 01/20] wifi: mt76: mt7915: dump the firmware memory of mt7916 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=20261124084309.1981968-20-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;
as well as URLs for NNTP newsgroup(s).