From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH mt76-next 03/25] wifi: mt76: mt7996: only remove a BMC STA_REC that was added
Date: Wed, 28 Oct 2026 13:23:41 +0100 [thread overview]
Message-ID: <20261028122403.796394-3-nbd@nbd.name> (raw)
In-Reply-To: <20261028122403.796394-1-nbd@nbd.name>
mt7996_vif_link_add() defers the BMC STA_REC of a station interface to
BSS_CHANGED_BSSID or BSS_CHANGED_ASSOC. A link that
mt76_get_vif_phy_link() creates for a scan or ROC receives neither,
because it is not part of the vif links. mt7996_vif_link_destroy() still
sends a STA_REC removal for it at the end of each scan, and the firmware
rejects it:
staRecFreeStaRec-1606 Err: u2ClientSupportCnt is already 0. (wcid 1087)
staRecUniCmdUpdate, u2Tag 0x0 ret = 0xc0000001 not success
Record per link whether the firmware accepted its BMC STA_REC, and only
send the removal for such a link. This also covers a station link that
is torn down before its first BSSID or association update.
Fixes: 51b795d68cad ("wifi: mt76: connac: use peer address for station BMC entry")
Fixes: 69d54ce7491d ("wifi: mt76: mt7996: switch to single multi-radio wiphy")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
.../net/wireless/mediatek/mt76/mt7996/main.c | 18 +++++++++++-------
.../net/wireless/mediatek/mt76/mt7996/mt7996.h | 1 +
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index a2655784a13d..e8faa826e037 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -349,6 +349,7 @@ int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif,
return -ENOSPC;
link->mld_idx = mld_idx;
+ link->bmc_sta_added = false;
link->csa_bcn_uploaded = false;
eth_zero_addr(link->bmc_bssid);
mlink->omac_idx = idx;
@@ -392,9 +393,10 @@ int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif,
/* defer the first STA_REC of BMC entry to BSS_CHANGED_BSSID for STA
* interface, since firmware only records BSSID when the entry is new
*/
- if (vif->type != NL80211_IFTYPE_STATION)
- mt7996_mcu_add_sta(dev, link_conf, NULL, link, NULL,
- CONN_STATE_PORT_SECURE, true);
+ if (vif->type != NL80211_IFTYPE_STATION &&
+ !mt7996_mcu_add_sta(dev, link_conf, NULL, link, NULL,
+ CONN_STATE_PORT_SECURE, true))
+ link->bmc_sta_added = true;
rcu_assign_pointer(dev->mt76.wcid[idx], &msta_link->wcid);
if (!mlink->wcid->offchannel)
@@ -441,8 +443,9 @@ static void mt7996_vif_link_destroy(struct mt7996_phy *phy,
if (!link_conf)
link_conf = &vif->bss_conf;
- mt7996_mcu_add_sta(dev, link_conf, NULL, link, NULL,
- CONN_STATE_DISCONNECT, false);
+ if (link->bmc_sta_added)
+ 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);
mt7996_mcu_add_dev_info(phy, vif, link_conf, mlink, false);
@@ -939,8 +942,9 @@ mt7996_vif_link_bss_add(struct mt7996_phy *phy, struct ieee80211_vif *vif,
mt7996_mcu_add_bss_info(phy, vif, link_conf, &link->mt76,
&link->msta_link, true);
- mt7996_mcu_add_sta(phy->dev, link_conf, NULL, link, NULL,
- CONN_STATE_PORT_SECURE, newly);
+ if (!mt7996_mcu_add_sta(phy->dev, link_conf, NULL, link, NULL,
+ CONN_STATE_PORT_SECURE, newly))
+ link->bmc_sta_added = true;
}
static void
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
index 84edb905fe06..d30b4d689bac 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
@@ -295,6 +295,7 @@ struct mt7996_vif_link {
u8 mld_idx;
u8 bmc_bssid[ETH_ALEN];
+ bool bmc_sta_added;
bool csa_bcn_uploaded;
};
--
2.47.3
next prev parent reply other threads:[~2026-10-28 12:24 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 12:23 [PATCH mt76-next 01/25] wifi: mt76: mt7996: take the link of an 802.3 frame from its station Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 02/25] wifi: mt76: mt7996: do not update beacons while CSA is active Felix Fietkau
2026-10-28 12:23 ` Felix Fietkau [this message]
2026-10-28 12:23 ` [PATCH mt76-next 04/25] wifi: mt76: mt7996: pass the puncturing bitmap to the firmware Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 05/25] wifi: mt76: abort a scan when the chanctx changes Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 06/25] wifi: mt76: set the channel again when the chanctx puncturing changes Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 07/25] wifi: mt76: mt7996: advertise preamble puncturing support Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 08/25] wifi: mt76: mt7996: keep scan and ROC links out of the MLD group Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 09/25] wifi: mt76: mt7996: factor the vif link teardown out of remove_interface Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 10/25] wifi: mt76: mt7996: destroy station links before the MLD group is freed Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 11/25] wifi: mt76: mt7996: send MLD link operations for an AP MLD only Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 12/25] wifi: mt76: mt7996: set up a vif link again on another radio Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 13/25] wifi: mt76: mt7996: describe an MLD peer with the PEER_MLD command Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 14/25] wifi: mt76: mt7915: honour the valid flag in efuse block reads Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 15/25] wifi: mt76: mt7996: skip MLD address translation for encap offload frames Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 16/25] wifi: mt76: mt7921: honour the valid flag in efuse block reads Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 17/25] wifi: mt76: mt7915: upload the CSA beacon only once Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 18/25] wifi: mt76: read the chanctx of a link once Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 19/25] wifi: mt76: restart the beacon monitor of a link that gets a chanctx again Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 20/25] wifi: mt76: publish the beacon monitor interval after its timestamp Felix Fietkau
2026-10-28 12:23 ` [PATCH mt76-next 21/25] wifi: mt76: mt7996: keep rx header translation off while a monitor runs Felix Fietkau
2026-10-28 12:24 ` [PATCH mt76-next 22/25] wifi: mt76: mt7996: apply monitor mode again after a full reset Felix Fietkau
2026-10-28 12:24 ` [PATCH mt76-next 23/25] wifi: mt76: check the RX PN of an MLD peer once per peer Felix Fietkau
2026-10-28 12:24 ` [PATCH mt76-next 24/25] wifi: mt76: mt7996: send no MLD_SETUP when station links only go away Felix Fietkau
2026-10-28 12:24 ` [PATCH mt76-next 25/25] wifi: mt76: mt7996: keep a unicast management frame on its MLO link 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=20261028122403.796394-3-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