From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH mt76-next 16/27] wifi: mt76: mt7996: add the station BMC entry as new once per BSSID
Date: Tue, 6 Oct 2026 22:59:25 +0200 [thread overview]
Message-ID: <20261006205936.669125-16-nbd@nbd.name> (raw)
In-Reply-To: <20261006205936.669125-1-nbd@nbd.name>
A station link sends its broadcast STA_REC with EXTRA_INFO_NEW on every
BSS_CHANGED_BSSID. Commit 8e3e7567b8c1 ("mt76: mt7915: add sta_rec with
EXTRA_INFO_NEW for the first time only") notes that the firmware may
remove an entry that is added as new twice. Since a removed vif link
keeps its firmware entry, this happens on a link that is deactivated and
activated again: _ieee80211_set_active_links() reports
BSS_CHANGED_BSSID with the same BSSID, after ieee80211_key_switch_links()
has installed the group keys of the link, and nothing in the driver
installs them again after the entry is added as new.
Record the BSSID the entry was added with, and add it as new only for
a different BSSID. A BSSID that goes to zero on disconnection clears
the record, so that the next association adds the entry as new again.
A link that is set up clears the record as well, since the firmware has
no entry for it then.
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 | 38 ++++++++++++-------
.../wireless/mediatek/mt76/mt7996/mt7996.h | 1 +
2 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index 58a487549ddf..d868e9641334 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -341,6 +341,7 @@ int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif,
return -ENOSPC;
link->mld_idx = mld_idx;
+ eth_zero_addr(link->bmc_bssid);
mlink->omac_idx = idx;
mlink->band_idx = band_idx;
mlink->wmm_idx = vif->type == NL80211_IFTYPE_AP ? 0 : 3;
@@ -898,6 +899,23 @@ mt7996_update_mu_group(struct ieee80211_hw *hw, struct mt7996_vif_link *link,
mt76_wr(dev, MT_WF_PHYRX_BAND_GID_TAB_POS3(band), mu[3]);
}
+static void
+mt7996_vif_link_bss_add(struct mt7996_phy *phy, struct ieee80211_vif *vif,
+ struct ieee80211_bss_conf *link_conf,
+ struct mt7996_vif_link *link, bool newly)
+{
+ if (vif->type == NL80211_IFTYPE_STATION) {
+ newly = !ether_addr_equal_unaligned(link->bmc_bssid,
+ link_conf->bssid);
+ memcpy(link->bmc_bssid, link_conf->bssid, ETH_ALEN);
+ }
+
+ 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);
+}
+
static void
mt7996_vif_cfg_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u64 changed)
@@ -929,12 +947,8 @@ mt7996_vif_cfg_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (!phy)
continue;
- mt7996_mcu_add_bss_info(phy, vif, link_conf,
- &link->mt76, &link->msta_link,
- true);
- mt7996_mcu_add_sta(dev, link_conf, NULL, link, NULL,
- CONN_STATE_PORT_SECURE,
- !!(changed & BSS_CHANGED_BSSID));
+ mt7996_vif_link_bss_add(phy, vif, link_conf, link,
+ !!(changed & BSS_CHANGED_BSSID));
}
}
@@ -980,13 +994,11 @@ mt7996_link_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
* and then peer references bss_info_rfch to set bandwidth cap.
*/
if ((changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) ||
- (changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon)) {
- mt7996_mcu_add_bss_info(phy, vif, info, &link->mt76,
- &link->msta_link, true);
- mt7996_mcu_add_sta(dev, info, NULL, link, NULL,
- CONN_STATE_PORT_SECURE,
- !!(changed & BSS_CHANGED_BSSID));
- }
+ (changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon))
+ mt7996_vif_link_bss_add(phy, vif, info, link,
+ !!(changed & BSS_CHANGED_BSSID));
+ else if (changed & BSS_CHANGED_BSSID)
+ eth_zero_addr(link->bmc_bssid);
if (changed & BSS_CHANGED_HT || changed & BSS_CHANGED_ERP_CTS_PROT)
mt7996_mcu_set_protection(phy, link, info->ht_operation_mode,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
index 82a2a8a5db69..03fc0e7fd4f1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
@@ -279,6 +279,7 @@ struct mt7996_vif_link {
struct cfg80211_bitrate_mask bitrate_mask;
u8 mld_idx;
+ u8 bmc_bssid[ETH_ALEN];
};
struct mt7996_vif_link_info {
--
2.47.3
next prev parent reply other threads:[~2026-10-06 20:59 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 20:59 [PATCH mt76-next 01/27] wifi: mt76: abort a scan only for a link change on the scanning radio Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 02/27] wifi: mt76: mt7996: enable the SKU power limit table Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 03/27] wifi: mt76: mt7996: set sniffer mode on a radio that is already running Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 04/27] wifi: mt76: mt7996: update the address of an AP link that is added again Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 05/27] wifi: mt76: mt7996: size the MLD setup TLV by the links it describes Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 06/27] wifi: mt76: mt7996: find the last MLD link among the links torn down Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 07/27] wifi: mt76: mt7996: upload only the keys of the link being set up Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 08/27] wifi: mt76: mt7996: do not walk the vif keys when a link is destroyed Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 09/27] wifi: mt76: mt7996: report station statistics from the primary link Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 10/27] wifi: mt76: mt7996: clear all link wcid entries in sta_pre_rcu_remove Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 11/27] wifi: mt76: mt7996: free the WTBL index if a link allocation fails Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 12/27] wifi: mt76: mt7996: pick the secondary link from links with driver state Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 13/27] wifi: mt76: mt7996: make a returning link primary if a station has none Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 14/27] wifi: mt76: mt7996: do not reuse the deflink of a removed station link Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 15/27] wifi: mt76: mt7996: keep a returning link when adding station links fails Felix Fietkau
2026-10-06 20:59 ` Felix Fietkau [this message]
2026-10-06 20:59 ` [PATCH mt76-next 17/27] wifi: mt76: mt7996: keep 4-address and decap state per station Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 18/27] wifi: mt76: mt7996: do not add a station link in disconnected state Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 19/27] wifi: mt76: mt7996: record the connection state of a station Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 20/27] wifi: mt76: mt7996: keep the block ack session parameters per station Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 21/27] wifi: mt76: mt7996: set up the BSS of a late station link before its peer Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 22/27] wifi: mt76: mt7996: bring up station links added after association Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 23/27] wifi: mt76: mt7996: set up block ack sessions on station links added later Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 24/27] wifi: mt76: mt7996: restore a station link that returns after a removal Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 25/27] wifi: mt76: mt7996: fix PLE free page and AC queue register offsets Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 26/27] wifi: mt76: mt7996: fix the hw-queues debugfs queue requests Felix Fietkau
2026-10-06 20:59 ` [PATCH mt76-next 27/27] wifi: mt76: mt7996: disable the RX NAPIs before the DMA cleanup 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=20261006205936.669125-16-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