wifi: mt76: connac: add eht support for phy mode config
authorDeren Wu <deren.wu@mediatek.com>
Tue, 1 Aug 2023 14:30:28 +0000 (22:30 +0800)
committerFelix Fietkau <nbd@nbd.name>
Sat, 30 Sep 2023 18:03:03 +0000 (20:03 +0200)
Add eht configuration support in existing function
mt76_connac_get_phy_mode_v2() and export it for mt7925.

This is a preliminary patch to support mt7925 driver.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h

index dfbe31a..c0f129d 100644 (file)
@@ -780,19 +780,21 @@ mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
 }
 EXPORT_SYMBOL_GPL(mt76_connac_mcu_sta_he_tlv_v2);
 
-static u8
+u8
 mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif,
                            enum nl80211_band band, struct ieee80211_sta *sta)
 {
        struct ieee80211_sta_ht_cap *ht_cap;
        struct ieee80211_sta_vht_cap *vht_cap;
        const struct ieee80211_sta_he_cap *he_cap;
+       const struct ieee80211_sta_eht_cap *eht_cap;
        u8 mode = 0;
 
        if (sta) {
                ht_cap = &sta->deflink.ht_cap;
                vht_cap = &sta->deflink.vht_cap;
                he_cap = &sta->deflink.he_cap;
+               eht_cap = &sta->deflink.eht_cap;
        } else {
                struct ieee80211_supported_band *sband;
 
@@ -800,6 +802,7 @@ mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif,
                ht_cap = &sband->ht_cap;
                vht_cap = &sband->vht_cap;
                he_cap = ieee80211_get_he_iftype_cap(sband, vif->type);
+               eht_cap = ieee80211_get_eht_iftype_cap(sband, vif->type);
        }
 
        if (band == NL80211_BAND_2GHZ) {
@@ -810,6 +813,9 @@ mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif,
 
                if (he_cap && he_cap->has_he)
                        mode |= PHY_TYPE_BIT_HE;
+
+               if (eht_cap && eht_cap->has_eht)
+                       mode |= PHY_TYPE_BIT_BE;
        } else if (band == NL80211_BAND_5GHZ || band == NL80211_BAND_6GHZ) {
                mode |= PHY_TYPE_BIT_OFDM;
 
@@ -821,10 +827,14 @@ mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif,
 
                if (he_cap && he_cap->has_he)
                        mode |= PHY_TYPE_BIT_HE;
+
+               if (eht_cap && eht_cap->has_eht)
+                       mode |= PHY_TYPE_BIT_BE;
        }
 
        return mode;
 }
+EXPORT_SYMBOL_GPL(mt76_connac_get_phy_mode_v2);
 
 void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
                             struct ieee80211_sta *sta,
index 879a665..4b64426 100644 (file)
@@ -919,6 +919,7 @@ enum {
        PHY_TYPE_HT_INDEX,
        PHY_TYPE_VHT_INDEX,
        PHY_TYPE_HE_INDEX,
+       PHY_TYPE_BE_INDEX,
        PHY_TYPE_INDEX_NUM
 };
 
@@ -928,6 +929,7 @@ enum {
 #define PHY_TYPE_BIT_HT                                BIT(PHY_TYPE_HT_INDEX)
 #define PHY_TYPE_BIT_VHT                       BIT(PHY_TYPE_VHT_INDEX)
 #define PHY_TYPE_BIT_HE                                BIT(PHY_TYPE_HE_INDEX)
+#define PHY_TYPE_BIT_BE                                BIT(PHY_TYPE_BE_INDEX)
 
 #define MT_WTBL_RATE_TX_MODE                   GENMASK(9, 6)
 #define MT_WTBL_RATE_MCS                       GENMASK(5, 0)
@@ -1808,6 +1810,8 @@ int mt76_connac_mcu_sta_update_hdr_trans(struct mt76_dev *dev,
                                         struct ieee80211_vif *vif,
                                         struct mt76_wcid *wcid, int cmd);
 void mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta);
+u8 mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif,
+                              enum nl80211_band band, struct ieee80211_sta *sta);
 int mt76_connac_mcu_wtbl_update_hdr_trans(struct mt76_dev *dev,
                                          struct ieee80211_vif *vif,
                                          struct ieee80211_sta *sta);