Linux wireless drivers development
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH mt76-next 08/20] wifi: mt76: mt7925: mask the LDPC capabilities of an AP peer
Date: Sun, 29 Nov 2026 20:31:18 +0100	[thread overview]
Message-ID: <20261129193131.3367661-8-nbd@nbd.name> (raw)
In-Reply-To: <20261129193131.3367661-1-nbd@nbd.name>

mt7925_mcu_sta_ht_tlv(), mt7925_mcu_sta_vht_tlv() and
mt7925_mcu_sta_he_tlv() send the capabilities of the peer link
unchanged. mac80211 keeps the AP's own setting in ht_ldpc, vht_ldpc and
he_ldpc of the link conf alone. An AP configured without LDPC can thus
send LDPC frames to an LDPC peer.

On an AP, clear each LDPC bit where the conf of the peer's link has no
LDPC for that mode. mt7996 does the same. Other interface types keep the
peer's bits, since mac80211 sets these link conf fields for an AP alone.

Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 .../net/wireless/mediatek/mt76/mt7925/mcu.c   | 34 ++++++++++++++-----
 1 file changed, 25 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index a1c0633b9a4f..5eb6a2047045 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -1921,12 +1921,14 @@ mt7925_mcu_set_bss_pm(struct mt792x_dev *dev,
 }
 
 static void
-mt7925_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_link_sta *link_sta)
+mt7925_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *link_conf,
+		      struct ieee80211_link_sta *link_sta)
 {
 	if (!link_sta->he_cap.has_he)
 		return;
 
-	mt76_connac_mcu_sta_he_tlv_v2(skb, link_sta, true);
+	mt76_connac_mcu_sta_he_tlv_v2(skb, link_sta,
+				      mt76_connac_mcu_he_ldpc(link_conf));
 }
 
 static void
@@ -1975,23 +1977,30 @@ mt7925_mcu_sta_eht_tlv(struct sk_buff *skb, struct ieee80211_link_sta *link_sta)
 }
 
 static void
-mt7925_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_link_sta *link_sta)
+mt7925_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *link_conf,
+		      struct ieee80211_link_sta *link_sta)
 {
+	u16 cap = link_sta->ht_cap.cap;
 	struct sta_rec_ht *ht;
 	struct tlv *tlv;
 
 	if (!link_sta->ht_cap.ht_supported)
 		return;
 
+	if (!mt76_connac_mcu_ht_ldpc(link_conf))
+		cap &= ~IEEE80211_HT_CAP_LDPC_CODING;
+
 	tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht));
 
 	ht = (struct sta_rec_ht *)tlv;
-	ht->ht_cap = cpu_to_le16(link_sta->ht_cap.cap);
+	ht->ht_cap = cpu_to_le16(cap);
 }
 
 static void
-mt7925_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_link_sta *link_sta)
+mt7925_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *link_conf,
+		       struct ieee80211_link_sta *link_sta)
 {
+	u32 cap = link_sta->vht_cap.cap;
 	struct sta_rec_vht *vht;
 	struct tlv *tlv;
 
@@ -1999,10 +2008,13 @@ mt7925_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_link_sta *link_sta)
 	if (!link_sta->he_6ghz_capa.capa && !link_sta->vht_cap.vht_supported)
 		return;
 
+	if (!mt76_connac_mcu_vht_ldpc(link_conf))
+		cap &= ~IEEE80211_VHT_CAP_RXLDPC;
+
 	tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, sizeof(*vht));
 
 	vht = (struct sta_rec_vht *)tlv;
-	vht->vht_cap = cpu_to_le32(link_sta->vht_cap.cap);
+	vht->vht_cap = cpu_to_le32(cap);
 	vht->vht_rx_mcs_map = link_sta->vht_cap.vht_mcs.rx_mcs_map;
 	vht->vht_tx_mcs_map = link_sta->vht_cap.vht_mcs.tx_mcs_map;
 }
@@ -2310,6 +2322,7 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy,
 		   struct mt792x_link_sta *pending)
 {
 	struct mt792x_vif *mvif = (struct mt792x_vif *)info->vif->drv_priv;
+	struct ieee80211_bss_conf *link_conf;
 	struct mt76_dev *dev = phy->dev;
 	struct mt792x_bss_conf *mconf;
 	struct mt792x_link_sta *mlink;
@@ -2328,15 +2341,18 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy,
 				    CONN_STATE_DISCONNECT;
 
 	if (info->enable && info->link_sta) {
+		link_conf = mt792x_vif_to_bss_conf(info->vif,
+						   info->link_sta->link_id);
+
 		mt76_connac_mcu_sta_basic_tlv(dev, skb, info->link_conf,
 					      info->link_sta,
 					      conn_state, info->newly);
 		mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta);
-		mt7925_mcu_sta_ht_tlv(skb, info->link_sta);
-		mt7925_mcu_sta_vht_tlv(skb, info->link_sta);
+		mt7925_mcu_sta_ht_tlv(skb, link_conf, info->link_sta);
+		mt7925_mcu_sta_vht_tlv(skb, link_conf, info->link_sta);
 		mt76_connac_mcu_sta_uapsd(skb, info->vif, info->link_sta->sta);
 		mt7925_mcu_sta_amsdu_tlv(skb, info->vif, info->link_sta, mlink);
-		mt7925_mcu_sta_he_tlv(skb, info->link_sta);
+		mt7925_mcu_sta_he_tlv(skb, link_conf, info->link_sta);
 		mt7925_mcu_sta_he_6g_tlv(skb, info->link_sta);
 		mt7925_mcu_sta_eht_tlv(skb, info->link_sta);
 		mt7925_mcu_sta_rate_ctrl_tlv(skb, info->vif,
-- 
2.47.3


  parent reply	other threads:[~2026-11-29 19:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 19:31 [PATCH mt76-next 01/20] wifi: mt76: mt7996: hold the wiphy lock in the L1 SER reset work Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 02/20] wifi: mt76: mt7996: report the TX statistics of each link of a station Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 03/20] wifi: mt76: mt7996: stop the hardware when the probe fails Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 04/20] wifi: mt76: mt7996: clean up the DMA when the NPU RX queue init fails Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 05/20] wifi: mt76: mt7996: name the link and the error of a failed key install Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 06/20] wifi: mt76: mt7925: send the HE capabilities of each link of a peer Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 07/20] wifi: mt76: connac: mask the LDPC capabilities of an AP peer Felix Fietkau
2026-11-29 19:31 ` Felix Fietkau [this message]
2026-11-29 19:31 ` [PATCH mt76-next 09/20] wifi: mt76: mt7996: read the EHT capabilities of a station as LE Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 10/20] wifi: mt76: mt7925: " Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 11/20] wifi: mt76: mt7615: drop RX frame with a header gap past its end Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 12/20] wifi: mt76: connac: drop a first fragment without an Ethernet header Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 13/20] wifi: mt76: mt7915: drop RX frame with a header gap past its end Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 14/20] wifi: mt76: mt7921: " Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 15/20] wifi: mt76: mt7996: " Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 16/20] wifi: mt76: mt7925: bound the header gap by the linear data of a frame Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 17/20] wifi: mt76: mt7921: fix out-of-bounds read in mt7921_mac_add_txs Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 18/20] wifi: mt76: mt7925: fix out-of-bounds read in mt7925_mac_add_txs Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 19/20] wifi: mt76: mt7925: apply the dwell time of a scan request Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 20/20] wifi: mt76: connac: apply the dwell time of a scan request on mt7663 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=20261129193131.3367661-8-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