wifi: mt76: mt7925: add EHT preamble puncturing
authorAllan Wang <allan.wang@mediatek.com>
Tue, 1 Apr 2025 08:35:25 +0000 (16:35 +0800)
committerFelix Fietkau <nbd@nbd.name>
Wed, 21 May 2025 12:49:38 +0000 (14:49 +0200)
Add mt7925 EHT preamble puncturing.

Signed-off-by: Allan Wang <allan.wang@mediatek.com>
Link: https://patch.msgid.link/20250401083525.2734333-1-allan.wang@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
drivers/net/wireless/mediatek/mt76/mt7925/main.c
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
drivers/net/wireless/mediatek/mt76/mt7925/mcu.h

index 8226b975f7e639f4fc3a82c6418bf0946d44b16e..478cd18867361c27a2024c99dc856fdf688853ff 100644 (file)
@@ -1371,6 +1371,7 @@ enum {
        UNI_BSS_INFO_OFFLOAD = 25,
        UNI_BSS_INFO_MLD = 26,
        UNI_BSS_INFO_PM_DISABLE = 27,
+       UNI_BSS_INFO_EHT = 30,
 };
 
 enum {
index 66f327781947b8a05f342dc06c01b1a2edc493d6..128a742ca6317e1d8a25169db6173bedc46684dd 100644 (file)
@@ -1865,6 +1865,10 @@ mt7925_change_chanctx(struct ieee80211_hw *hw,
                        link_conf = mt792x_vif_to_bss_conf(vif, mconf->link_id);
                        mt7925_mcu_set_chctx(mvif->phy->mt76, &mconf->mt76,
                                             link_conf, ctx);
+
+                       if (changed & IEEE80211_CHANCTX_CHANGE_PUNCTURING)
+                               mt7925_mcu_set_eht_pp(mvif->phy->mt76, &mconf->mt76,
+                                                     link_conf, ctx);
                }
        }
 
@@ -1954,8 +1958,10 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw,
        struct mt792x_phy *phy = mt792x_hw_phy(hw);
        struct mt792x_dev *dev = mt792x_hw_dev(hw);
        struct mt792x_bss_conf *mconf;
+       struct ieee80211_bss_conf *link_conf;
 
        mconf = mt792x_vif_to_link(mvif, info->link_id);
+       link_conf = mt792x_vif_to_bss_conf(vif, mconf->link_id);
 
        mt792x_mutex_acquire(dev);
 
@@ -1997,6 +2003,10 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw,
                mvif->mlo_pm_state = MT792x_MLO_CHANGED_PS;
        }
 
+       if (changed & IEEE80211_CHANCTX_CHANGE_PUNCTURING)
+               mt7925_mcu_set_eht_pp(mvif->phy->mt76, &mconf->mt76,
+                                     link_conf, NULL);
+
        mt792x_mutex_release(dev);
 }
 
index e61da76b2097bfa13789410f2f735d8b0739884e..286f602623c00e156189713b7f2bdabbd78def91 100644 (file)
@@ -2298,6 +2298,40 @@ __mt7925_mcu_alloc_bss_req(struct mt76_dev *dev, struct mt76_vif_link *mvif, int
        return skb;
 }
 
+static
+void mt7925_mcu_bss_eht_tlv(struct sk_buff *skb, struct mt76_phy *phy,
+                           struct ieee80211_bss_conf *link_conf,
+                           struct ieee80211_chanctx_conf *ctx)
+{
+       struct cfg80211_chan_def *chandef = ctx ? &ctx->def :
+                                                 &link_conf->chanreq.oper;
+
+       struct bss_eht_tlv *req;
+       struct tlv *tlv;
+
+       tlv = mt76_connac_mcu_add_tlv(skb, UNI_BSS_INFO_EHT, sizeof(*req));
+       req = (struct bss_eht_tlv *)tlv;
+       req->is_eth_dscb_present = chandef->punctured ? 1 : 0;
+       req->eht_dis_sub_chan_bitmap = cpu_to_le16(chandef->punctured);
+}
+
+int mt7925_mcu_set_eht_pp(struct mt76_phy *phy, struct mt76_vif_link *mvif,
+                         struct ieee80211_bss_conf *link_conf,
+                         struct ieee80211_chanctx_conf *ctx)
+{
+       struct sk_buff *skb;
+
+       skb = __mt7925_mcu_alloc_bss_req(phy->dev, mvif,
+                                        MT7925_BSS_UPDATE_MAX_SIZE);
+       if (IS_ERR(skb))
+               return PTR_ERR(skb);
+
+       mt7925_mcu_bss_eht_tlv(skb, phy, link_conf, ctx);
+
+       return mt76_mcu_skb_send_msg(phy->dev, skb,
+                                    MCU_UNI_CMD(BSS_INFO_UPDATE), true);
+}
+
 int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif_link *mvif,
                         struct ieee80211_bss_conf *link_conf,
                         struct ieee80211_chanctx_conf *ctx)
index 8ac43feb26d64f0baa84fa9a56d2b4ee4f25f436..d55ea59bda7da704318e761f0aaa8449dd9b78d1 100644 (file)
@@ -372,6 +372,19 @@ struct bss_mld_tlv {
        u8 __rsv[3];
 } __packed;
 
+struct bss_eht_tlv {
+       __le16 tag;
+       __le16 len;
+       u8  is_eht_op_present;
+       u8  is_eth_dscb_present;
+       u8  eht_ctrl;
+       u8  eht_ccfs0;
+       u8  eht_ccfs1;
+       u8  pad1;
+       __le16 eht_dis_sub_chan_bitmap;
+       u8  pad2[4];
+} __packed;
+
 struct sta_rec_ba_uni {
        __le16 tag;
        __le16 len;
@@ -642,6 +655,9 @@ int mt7925_mcu_set_radio_en(struct mt792x_phy *phy, bool enable);
 int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif_link *mvif,
                         struct ieee80211_bss_conf *link_conf,
                         struct ieee80211_chanctx_conf *ctx);
+int mt7925_mcu_set_eht_pp(struct mt76_phy *phy, struct mt76_vif_link *mvif,
+                         struct ieee80211_bss_conf *link_conf,
+                         struct ieee80211_chanctx_conf *ctx);
 int mt7925_mcu_set_rate_txpower(struct mt76_phy *phy);
 int mt7925_mcu_update_arp_filter(struct mt76_dev *dev,
                                 struct ieee80211_bss_conf *link_conf);