mt76: split single ldpc cap bit into bits
authorMeiChia Chiu <MeiChia.Chiu@mediatek.com>
Wed, 2 Mar 2022 06:14:06 +0000 (14:14 +0800)
committerFelix Fietkau <nbd@nbd.name>
Wed, 16 Mar 2022 16:40:22 +0000 (17:40 +0100)
The original single LDPC cap bit cannot be used to
differentiate LDPC cap in each PHY mode.
This modification split the single bit into 3 bits,
ht_ldpc, vht_ldpc, and he_ldpc.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Suggested-by: Money Wang <Money.Wang@mediatek.com>
Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h

index e98c6076a6336aa6cfd7306e9a1524427561b7ba..390add3144c2e891e214826b77e04f7f76c17e8b 100644 (file)
@@ -880,7 +880,7 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_phy *phy, struct ieee80211_vif *vif,
                                                 NULL, wtbl_hdr);
                if (sta)
                        mt76_connac_mcu_wtbl_ht_tlv(&dev->mt76, wskb, sta,
-                                                   NULL, wtbl_hdr, true);
+                                                   NULL, wtbl_hdr, true, true);
                mt76_connac_mcu_wtbl_hdr_trans_tlv(wskb, vif, &msta->wcid,
                                                   NULL, wtbl_hdr);
        }
index 0a646ae51c8d0b1f5fcbbbbaffa783d81880f737..6c762fbf9aaaca42464dccb9e22021689341adb3 100644 (file)
@@ -899,7 +899,7 @@ EXPORT_SYMBOL_GPL(mt76_connac_mcu_wtbl_smps_tlv);
 
 void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
                                 struct ieee80211_sta *sta, void *sta_wtbl,
-                                void *wtbl_tlv, bool ldpc)
+                                void *wtbl_tlv, bool ht_ldpc, bool vht_ldpc)
 {
        struct wtbl_ht *ht = NULL;
        struct tlv *tlv;
@@ -909,7 +909,7 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
                tlv = mt76_connac_mcu_add_nested_tlv(skb, WTBL_HT, sizeof(*ht),
                                                     wtbl_tlv, sta_wtbl);
                ht = (struct wtbl_ht *)tlv;
-               ht->ldpc = ldpc &&
+               ht->ldpc = ht_ldpc &&
                           !!(sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING);
                ht->af = sta->ht_cap.ampdu_factor;
                ht->mm = sta->ht_cap.ampdu_density;
@@ -924,7 +924,7 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
                                                     sizeof(*vht), wtbl_tlv,
                                                     sta_wtbl);
                vht = (struct wtbl_vht *)tlv;
-               vht->ldpc = ldpc &&
+               vht->ldpc = vht_ldpc &&
                            !!(sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC);
                vht->vht = true;
 
@@ -1004,7 +1004,8 @@ int mt76_connac_mcu_sta_cmd(struct mt76_phy *phy,
                                                   sta_wtbl, wtbl_hdr);
                if (info->sta)
                        mt76_connac_mcu_wtbl_ht_tlv(dev, skb, info->sta,
-                                                   sta_wtbl, wtbl_hdr, true);
+                                                   sta_wtbl, wtbl_hdr,
+                                                   true, true);
        }
 
        return mt76_mcu_skb_send_msg(dev, skb, info->cmd, true);
index e5857d2cf78c3adc0e73e72b1b1b4020e94b8dc7..c3c93338d56a34d5132bbf87196b91c74701e78c 100644 (file)
@@ -1562,7 +1562,7 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
                             u8 rcpi, u8 state);
 void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
                                 struct ieee80211_sta *sta, void *sta_wtbl,
-                                void *wtbl_tlv, bool ldpc);
+                                void *wtbl_tlv, bool ht_ldpc, bool vht_ldpc);
 void mt76_connac_mcu_wtbl_ba_tlv(struct mt76_dev *dev, struct sk_buff *skb,
                                 struct ieee80211_ampdu_params *params,
                                 bool enable, bool tx, void *sta_wtbl,
index 119f9358162fde32d944cc3303a7ac35fa87a814..cc7d8e7e8d8a4de35d1fdd5f207fe0d5739abf18 100644 (file)
@@ -821,8 +821,9 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
             IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_5G))
                cap |= STA_REC_HE_CAP_BW20_RU242_SUPPORT;
 
-       if (mvif->cap.ldpc && (elem->phy_cap_info[1] &
-                              IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD))
+       if (mvif->cap.he_ldpc &&
+           (elem->phy_cap_info[1] &
+            IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD))
                cap |= STA_REC_HE_CAP_LDPC;
 
        if (elem->phy_cap_info[1] &
@@ -1073,7 +1074,8 @@ mt7915_mcu_sta_wtbl_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
        mt76_connac_mcu_wtbl_hdr_trans_tlv(skb, vif, wcid, tlv, wtbl_hdr);
        if (sta)
                mt76_connac_mcu_wtbl_ht_tlv(&dev->mt76, skb, sta, tlv,
-                                           wtbl_hdr, mvif->cap.ldpc);
+                                           wtbl_hdr, mvif->cap.ht_ldpc,
+                                           mvif->cap.vht_ldpc);
 
        return 0;
 }
@@ -1582,7 +1584,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
                        cap |= STA_CAP_TX_STBC;
                if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
                        cap |= STA_CAP_RX_STBC;
-               if (mvif->cap.ldpc &&
+               if (mvif->cap.ht_ldpc &&
                    (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING))
                        cap |= STA_CAP_LDPC;
 
@@ -1608,7 +1610,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
                        cap |= STA_CAP_VHT_TX_STBC;
                if (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1)
                        cap |= STA_CAP_VHT_RX_STBC;
-               if (mvif->cap.ldpc &&
+               if (mvif->cap.vht_ldpc &&
                    (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC))
                        cap |= STA_CAP_VHT_LDPC;
 
@@ -1872,8 +1874,8 @@ mt7915_mcu_beacon_check_caps(struct mt7915_phy *phy, struct ieee80211_vif *vif,
                              len);
        if (ie && ie[1] >= sizeof(*ht)) {
                ht = (void *)(ie + 2);
-               vc->ldpc |= !!(le16_to_cpu(ht->cap_info) &
-                              IEEE80211_HT_CAP_LDPC_CODING);
+               vc->ht_ldpc = !!(le16_to_cpu(ht->cap_info) &
+                                IEEE80211_HT_CAP_LDPC_CODING);
        }
 
        ie = cfg80211_find_ie(WLAN_EID_VHT_CAPABILITY, mgmt->u.beacon.variable,
@@ -1884,7 +1886,7 @@ mt7915_mcu_beacon_check_caps(struct mt7915_phy *phy, struct ieee80211_vif *vif,
                vht = (void *)(ie + 2);
                bc = le32_to_cpu(vht->vht_cap_info);
 
-               vc->ldpc |= !!(bc & IEEE80211_VHT_CAP_RXLDPC);
+               vc->vht_ldpc = !!(bc & IEEE80211_VHT_CAP_RXLDPC);
                vc->vht_su_ebfer =
                        (bc & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE) &&
                        (pc & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE);
@@ -1908,6 +1910,8 @@ mt7915_mcu_beacon_check_caps(struct mt7915_phy *phy, struct ieee80211_vif *vif,
 
                he = (void *)(ie + 3);
 
+               vc->he_ldpc =
+                       HE_PHY(CAP1_LDPC_CODING_IN_PAYLOAD, pe->phy_cap_info[1]);
                vc->he_su_ebfer =
                        HE_PHY(CAP3_SU_BEAMFORMER, he->phy_cap_info[3]) &&
                        HE_PHY(CAP3_SU_BEAMFORMER, pe->phy_cap_info[3]);
index 52b848dd4b6608c151d8ecc03083cb09023217d9..2fe737f2f844fd8123cb3d098d1edf50fd921d8b 100644 (file)
@@ -138,7 +138,9 @@ struct mt7915_sta {
 };
 
 struct mt7915_vif_cap {
-       bool ldpc:1;
+       bool ht_ldpc:1;
+       bool vht_ldpc:1;
+       bool he_ldpc:1;
        bool vht_su_ebfer:1;
        bool vht_su_ebfee:1;
        bool vht_mu_ebfer:1;