developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 1 | From f83177be8bfcc35eb7e6a1e7742175d27435ce82 Mon Sep 17 00:00:00 2001 |
| 2 | From: MeiChia Chiu <meichia.chiu@mediatek.com> |
| 3 | Date: Wed, 9 Feb 2022 15:43:19 +0800 |
| 4 | Subject: [PATCH 09/11] mt76: fix mt76 tlv in 6GHz |
| 5 | |
| 6 | [Description] |
| 7 | 1. Fix mt76 STA_REC/WTBL tlv |
| 8 | 2. Fix Tx BA issue |
| 9 | --- |
| 10 | .../wireless/mediatek/mt76/mt76_connac_mcu.c | 30 +++++++++++++++---- |
| 11 | .../net/wireless/mediatek/mt76/mt7915/mac.c | 2 +- |
| 12 | .../net/wireless/mediatek/mt76/mt7915/mcu.c | 23 ++++++++++++++ |
| 13 | 3 files changed, 48 insertions(+), 7 deletions(-) |
| 14 | |
| 15 | diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c |
| 16 | index 0a646ae..eac096c 100644 |
| 17 | --- a/mt76_connac_mcu.c |
| 18 | +++ b/mt76_connac_mcu.c |
| 19 | @@ -905,18 +905,28 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb, |
| 20 | struct tlv *tlv; |
| 21 | u32 flags = 0; |
| 22 | |
| 23 | - if (sta->ht_cap.ht_supported) { |
| 24 | + if (sta->ht_cap.ht_supported || sta->he_6ghz_capa.capa) { |
| 25 | tlv = mt76_connac_mcu_add_nested_tlv(skb, WTBL_HT, sizeof(*ht), |
| 26 | wtbl_tlv, sta_wtbl); |
| 27 | ht = (struct wtbl_ht *)tlv; |
| 28 | ht->ldpc = ldpc && |
| 29 | !!(sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING); |
| 30 | - ht->af = sta->ht_cap.ampdu_factor; |
| 31 | - ht->mm = sta->ht_cap.ampdu_density; |
| 32 | + |
| 33 | + if (sta->ht_cap.ht_supported) { |
| 34 | + ht->af = sta->ht_cap.ampdu_factor; |
| 35 | + ht->mm = sta->ht_cap.ampdu_density; |
| 36 | + } |
| 37 | + else { |
| 38 | + ht->af = FIELD_GET(IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP, |
| 39 | + sta->he_6ghz_capa.capa); |
| 40 | + ht->mm = FIELD_GET(IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START, |
| 41 | + sta->he_6ghz_capa.capa); |
| 42 | + } |
| 43 | + |
| 44 | ht->ht = true; |
| 45 | } |
| 46 | |
| 47 | - if (sta->vht_cap.vht_supported) { |
| 48 | + if (sta->vht_cap.vht_supported || sta->he_6ghz_capa.capa) { |
| 49 | struct wtbl_vht *vht; |
| 50 | u8 af; |
| 51 | |
| 52 | @@ -1241,7 +1251,7 @@ u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif, |
| 53 | |
| 54 | if (he_cap && he_cap->has_he) |
| 55 | mode |= PHY_MODE_AX_24G; |
| 56 | - } else if (band == NL80211_BAND_5GHZ || band == NL80211_BAND_6GHZ) { |
| 57 | + } else if (band == NL80211_BAND_5GHZ) { |
| 58 | mode |= PHY_MODE_A; |
| 59 | |
| 60 | if (ht_cap->ht_supported) |
| 61 | @@ -1250,8 +1260,16 @@ u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif, |
| 62 | if (vht_cap->vht_supported) |
| 63 | mode |= PHY_MODE_AC; |
| 64 | |
| 65 | - if (he_cap && he_cap->has_he && band == NL80211_BAND_5GHZ) |
| 66 | + if (he_cap && he_cap->has_he) |
| 67 | mode |= PHY_MODE_AX_5G; |
| 68 | + } else if (band == NL80211_BAND_6GHZ) { |
| 69 | + mode |= PHY_MODE_A; |
| 70 | + |
| 71 | + if (he_cap && he_cap->has_he) { |
| 72 | + mode |= PHY_MODE_AN; |
| 73 | + mode |= PHY_MODE_AC; |
| 74 | + mode |= PHY_MODE_AX_5G; |
| 75 | + } |
| 76 | } |
| 77 | |
| 78 | return mode; |
| 79 | diff --git a/mt7915/mac.c b/mt7915/mac.c |
| 80 | index b7e7cd4..261861a 100644 |
| 81 | --- a/mt7915/mac.c |
| 82 | +++ b/mt7915/mac.c |
| 83 | @@ -1354,7 +1354,7 @@ mt7915_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi) |
| 84 | u16 fc, tid; |
| 85 | u32 val; |
| 86 | |
| 87 | - if (!sta || !sta->ht_cap.ht_supported) |
| 88 | + if (!sta || !(sta->ht_cap.ht_supported || sta->he_cap.has_he)) |
| 89 | return; |
| 90 | |
| 91 | tid = FIELD_GET(MT_TXD1_TID, le32_to_cpu(txwi[1])); |
| 92 | diff --git a/mt7915/mcu.c b/mt7915/mcu.c |
| 93 | index 8eb48fa..15580f0 100644 |
| 94 | --- a/mt7915/mcu.c |
| 95 | +++ b/mt7915/mcu.c |
| 96 | @@ -1538,6 +1538,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev, |
| 97 | struct tlv *tlv; |
| 98 | u32 supp_rate = sta->supp_rates[band]; |
| 99 | u32 cap = sta->wme ? STA_CAP_WMM : 0; |
| 100 | + bool is_6ghz = band == NL80211_BAND_6GHZ; |
| 101 | |
| 102 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra)); |
| 103 | ra = (struct sta_rec_ra *)tlv; |
| 104 | @@ -1617,8 +1618,25 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev, |
| 105 | } |
| 106 | |
| 107 | if (sta->he_cap.has_he) { |
| 108 | + u8 *phy_cap = sta->he_cap.he_cap_elem.phy_cap_info; |
| 109 | + |
| 110 | ra->supp_mode |= MODE_HE; |
| 111 | cap |= STA_CAP_HE; |
| 112 | + |
| 113 | + if(is_6ghz) { |
| 114 | + ra->af = FIELD_GET(IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP, |
| 115 | + sta->he_6ghz_capa.capa); |
| 116 | + ra->mmps_mode = FIELD_GET(IEEE80211_HE_6GHZ_CAP_SM_PS, |
| 117 | + sta->he_6ghz_capa.capa); |
| 118 | + ra->phy.type = ffs(MODE_HE); |
| 119 | + ra->phy.stbc = 1; |
| 120 | + ra->phy.sgi = 1; |
| 121 | + ra->phy.ldpc = (mvif->cap.ldpc && !!(phy_cap[1] & |
| 122 | + IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD)); |
| 123 | + ra->phy.mcs = 9; |
| 124 | + ra->phy.nss = sta->rx_nss; |
| 125 | + } |
| 126 | + |
| 127 | } |
| 128 | |
| 129 | ra->sta_cap = cpu_to_le32(cap); |
| 130 | @@ -1858,6 +1876,8 @@ mt7915_mcu_beacon_check_caps(struct mt7915_phy *phy, struct ieee80211_vif *vif, |
| 131 | const struct ieee80211_vht_cap *vht; |
| 132 | const struct ieee80211_ht_cap *ht; |
| 133 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; |
| 134 | + enum nl80211_band band = phy->mt76->chandef.chan->band; |
| 135 | + bool is_6ghz = band == NL80211_BAND_6GHZ; |
| 136 | const u8 *ie; |
| 137 | u32 len, bc; |
| 138 | |
| 139 | @@ -1921,6 +1941,9 @@ mt7915_mcu_beacon_check_caps(struct mt7915_phy *phy, struct ieee80211_vif *vif, |
| 140 | vc->he_mu_ebfer = |
| 141 | HE_PHY(CAP4_MU_BEAMFORMER, he->phy_cap_info[4]) && |
| 142 | HE_PHY(CAP4_MU_BEAMFORMER, pe->phy_cap_info[4]); |
| 143 | + |
| 144 | + if (is_6ghz) |
| 145 | + vc->ldpc |= HE_PHY(CAP1_LDPC_CODING_IN_PAYLOAD, pe->phy_cap_info[1]); |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | -- |
| 150 | 2.25.1 |
| 151 | |