From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH mt76-next 02/16] wifi: mt76: mt7996: limit the HE and EHT maps of a peer to its rx_nss
Date: Thu, 26 Nov 2026 19:23:11 +0100 [thread overview]
Message-ID: <20261126182325.2516607-2-nbd@nbd.name> (raw)
In-Reply-To: <20261126182325.2516607-1-nbd@nbd.name>
The firmware takes the stream count of an HE or EHT peer from its MCS
maps. mt7996_mcu_set_sta_he_mcs() keeps the peer codes of the streams
from rx_nss up, and mt7996_mcu_sta_eht_tlv() copies the peer EHT maps.
A lower rx_nss from an Operating Mode Notification thus never reaches
the firmware.
Limit both maps to rx_nss. A 6 GHz HE peer without EHT that has fewer
streams at 160 MHz than at 80 MHz now gets the 160 MHz count at every
width. The rate update after a notification sends no EHT maps, so for
EHT only the notification in the association request takes effect.
Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Fixes: 92aa2da9fa49 ("wifi: mt76: mt7996: enable EHT support in firmware")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
.../net/wireless/mediatek/mt76/mt7996/mcu.c | 34 ++++++++++++++++---
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
index e4fd4b672e22..a3717dffe9ad 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
@@ -176,9 +176,26 @@ mt7996_mcu_set_sta_he_mcs(struct ieee80211_link_sta *link_sta,
mcs_map |= mcs << (nss * 2);
}
+ mcs_map |= GENMASK(15, 2 * max_nss);
+
*he_mcs = cpu_to_le16(mcs_map);
}
+static void
+mt7996_mcu_set_sta_eht_mcs(struct ieee80211_link_sta *link_sta,
+ u8 *eht_mcs, const u8 *mcs_map, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++) {
+ u8 nss = u8_get_bits(mcs_map[i], IEEE80211_EHT_MCS_NSS_RX);
+
+ nss = min(nss, link_sta->rx_nss);
+ eht_mcs[i] = u8_replace_bits(mcs_map[i], nss,
+ IEEE80211_EHT_MCS_NSS_RX);
+ }
+}
+
static void
mt7996_mcu_set_sta_vht_mcs(struct ieee80211_link_sta *link_sta,
__le16 *vht_mcs, const u16 *mask)
@@ -1735,14 +1752,21 @@ mt7996_mcu_sta_eht_tlv(struct sk_buff *skb,
IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G |
IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G |
IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)) == 0) {
- memcpy(eht->mcs_map_bw20, &mcs_map->only_20mhz,
- sizeof(eht->mcs_map_bw20));
+ mt7996_mcu_set_sta_eht_mcs(link_sta, eht->mcs_map_bw20,
+ (const u8 *)&mcs_map->only_20mhz,
+ sizeof(eht->mcs_map_bw20));
return;
}
- memcpy(eht->mcs_map_bw80, &mcs_map->bw._80, sizeof(eht->mcs_map_bw80));
- memcpy(eht->mcs_map_bw160, &mcs_map->bw._160, sizeof(eht->mcs_map_bw160));
- memcpy(eht->mcs_map_bw320, &mcs_map->bw._320, sizeof(eht->mcs_map_bw320));
+ mt7996_mcu_set_sta_eht_mcs(link_sta, eht->mcs_map_bw80,
+ (const u8 *)&mcs_map->bw._80,
+ sizeof(eht->mcs_map_bw80));
+ mt7996_mcu_set_sta_eht_mcs(link_sta, eht->mcs_map_bw160,
+ (const u8 *)&mcs_map->bw._160,
+ sizeof(eht->mcs_map_bw160));
+ mt7996_mcu_set_sta_eht_mcs(link_sta, eht->mcs_map_bw320,
+ (const u8 *)&mcs_map->bw._320,
+ sizeof(eht->mcs_map_bw320));
}
static void
--
2.47.3
next prev parent reply other threads:[~2026-11-26 18:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 18:23 [PATCH mt76-next 01/16] wifi: mt76: keep the Null frame of an AP on its AC queue Felix Fietkau
2026-11-26 18:23 ` Felix Fietkau [this message]
2026-11-26 18:23 ` [PATCH mt76-next 03/16] wifi: mt76: mt7915: send the current SM power save mode in STA_REC_HT Felix Fietkau
2026-11-26 18:23 ` [PATCH mt76-next 04/16] wifi: mt76: mt7996: take the HE caps of the band of each link Felix Fietkau
2026-11-26 18:23 ` [PATCH mt76-next 05/16] wifi: mt76: mt7915: count the WA TX statistics from an unsolicited event Felix Fietkau
2026-11-26 18:23 ` [PATCH mt76-next 06/16] wifi: mt76: keep an RX replay counter per group key id and TID Felix Fietkau
2026-11-26 18:23 ` [PATCH mt76-next 07/16] wifi: mt76: mt7996: check the RX PN of group addressed frames Felix Fietkau
2026-11-26 18:23 ` [PATCH mt76-next 08/16] wifi: mt76: mt7615: " Felix Fietkau
2026-11-26 18:23 ` [PATCH mt76-next 09/16] wifi: mt76: mt7615: reset the group RX PN counters at WoWLAN resume Felix Fietkau
2026-11-26 18:23 ` [PATCH mt76-next 10/16] wifi: mt76: mt7915: check the RX PN of group addressed frames Felix Fietkau
2026-11-26 18:23 ` [PATCH mt76-next 11/16] wifi: mt76: mt792x: " Felix Fietkau
2026-11-26 18:23 ` [PATCH mt76-next 12/16] wifi: mt76: mt792x: reset the group RX PN counters at WoWLAN resume Felix Fietkau
2026-11-26 18:23 ` [PATCH mt76-next 13/16] wifi: mt76: mt7603: check the RX PN of group addressed frames Felix Fietkau
2026-11-26 18:23 ` [PATCH mt76-next 14/16] wifi: mt76: mt76x02: find no station for the group wcid of a vif Felix Fietkau
2026-11-26 18:23 ` [PATCH mt76-next 15/16] wifi: mt76: mt7915: stop resets before the hw is unregistered Felix Fietkau
2026-11-26 18:23 ` [PATCH mt76-next 16/16] wifi: mt76: mt7996: " 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=20261126182325.2516607-2-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