developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1 | From db40f94c0f681cb7f36efcee47997a9755c63325 Mon Sep 17 00:00:00 2001 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 2 | From: Evelyn Tsai <evelyn.tsai@mediatek.com> |
| 3 | Date: Wed, 5 Apr 2023 08:29:19 +0800 |
| 4 | Subject: [PATCH] mt76: revert for backports-5.15 wireless stack |
| 5 | |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 6 | wifi: mt76: mt7915: add support for he ldpc control from hostapd |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 7 | --- |
| 8 | dma.c | 2 +- |
| 9 | mac80211.c | 4 +- |
| 10 | mt7615/dma.c | 4 +- |
| 11 | mt7615/main.c | 6 +- |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 12 | mt7615/mcu.c | 8 +- |
| 13 | mt76_connac_mcu.c | 108 +++++++++--------- |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 14 | mt76x02_mac.c | 6 +- |
| 15 | mt7915/debugfs.c | 4 +- |
| 16 | mt7915/dma.c | 4 +- |
| 17 | mt7915/init.c | 3 +- |
| 18 | mt7915/mac.c | 2 +- |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 19 | mt7915/main.c | 11 +- |
| 20 | mt7915/mcu.c | 273 ++++++++++++++++++++++++++++++---------------- |
| 21 | mt7915/mt7915.h | 14 +++ |
| 22 | mt7915/testmode.c | 8 +- |
| 23 | tx.c | 26 ++--- |
| 24 | 16 files changed, 282 insertions(+), 201 deletions(-) |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 25 | |
| 26 | diff --git a/dma.c b/dma.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 27 | index 4daa64d..220e684 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 28 | --- a/dma.c |
| 29 | +++ b/dma.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 30 | @@ -994,7 +994,7 @@ mt76_dma_init(struct mt76_dev *dev, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 31 | init_completion(&dev->mmio.wed_reset_complete); |
| 32 | |
| 33 | mt76_for_each_q_rx(dev, i) { |
| 34 | - netif_napi_add(&dev->napi_dev, &dev->napi[i], poll); |
| 35 | + netif_napi_add(&dev->napi_dev, &dev->napi[i], poll, 64); |
| 36 | mt76_dma_rx_fill(dev, &dev->q_rx[i]); |
| 37 | napi_enable(&dev->napi[i]); |
| 38 | } |
| 39 | diff --git a/mac80211.c b/mac80211.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 40 | index 4a0f333..b3058e0 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 41 | --- a/mac80211.c |
| 42 | +++ b/mac80211.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 43 | @@ -1519,7 +1519,7 @@ EXPORT_SYMBOL_GPL(mt76_get_sar_power); |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 44 | static void |
| 45 | __mt76_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif) |
| 46 | { |
| 47 | - if (vif->bss_conf.csa_active && ieee80211_beacon_cntdwn_is_complete(vif)) |
| 48 | + if (vif->csa_active && ieee80211_beacon_cntdwn_is_complete(vif)) |
| 49 | ieee80211_csa_finish(vif); |
| 50 | } |
| 51 | |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 52 | @@ -1541,7 +1541,7 @@ __mt76_csa_check(void *priv, u8 *mac, struct ieee80211_vif *vif) |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 53 | { |
| 54 | struct mt76_dev *dev = priv; |
| 55 | |
| 56 | - if (!vif->bss_conf.csa_active) |
| 57 | + if (!vif->csa_active) |
| 58 | return; |
| 59 | |
| 60 | dev->csa_complete |= ieee80211_beacon_cntdwn_is_complete(vif); |
| 61 | diff --git a/mt7615/dma.c b/mt7615/dma.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 62 | index 0ce01cc..ad32485 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 63 | --- a/mt7615/dma.c |
| 64 | +++ b/mt7615/dma.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 65 | @@ -282,8 +282,8 @@ int mt7615_dma_init(struct mt7615_dev *dev) |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 66 | if (ret < 0) |
| 67 | return ret; |
| 68 | |
| 69 | - netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi, |
| 70 | - mt7615_poll_tx); |
| 71 | + netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi, |
| 72 | + mt7615_poll_tx, NAPI_POLL_WEIGHT); |
| 73 | napi_enable(&dev->mt76.tx_napi); |
| 74 | |
| 75 | mt76_poll(dev, MT_WPDMA_GLO_CFG, |
| 76 | diff --git a/mt7615/main.c b/mt7615/main.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 77 | index dadb13f..2c61c36 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 78 | --- a/mt7615/main.c |
| 79 | +++ b/mt7615/main.c |
developer | 22eedcc | 2023-05-03 22:59:35 +0800 | [diff] [blame] | 80 | @@ -473,7 +473,7 @@ static int mt7615_config(struct ieee80211_hw *hw, u32 changed) |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 81 | |
| 82 | static int |
| 83 | mt7615_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 84 | - unsigned int link_id, u16 queue, |
| 85 | + u16 queue, |
| 86 | const struct ieee80211_tx_queue_params *params) |
| 87 | { |
| 88 | struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; |
developer | 22eedcc | 2023-05-03 22:59:35 +0800 | [diff] [blame] | 89 | @@ -555,7 +555,7 @@ static void mt7615_configure_filter(struct ieee80211_hw *hw, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 90 | static void mt7615_bss_info_changed(struct ieee80211_hw *hw, |
| 91 | struct ieee80211_vif *vif, |
| 92 | struct ieee80211_bss_conf *info, |
| 93 | - u64 changed) |
| 94 | + u32 changed) |
| 95 | { |
| 96 | struct mt7615_dev *dev = mt7615_hw_dev(hw); |
| 97 | struct mt7615_phy *phy = mt7615_hw_phy(hw); |
developer | 22eedcc | 2023-05-03 22:59:35 +0800 | [diff] [blame] | 98 | @@ -598,7 +598,7 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | if (changed & BSS_CHANGED_ASSOC) |
| 102 | - mt7615_mac_set_beacon_filter(phy, vif, vif->cfg.assoc); |
| 103 | + mt7615_mac_set_beacon_filter(phy, vif, info->assoc); |
| 104 | |
| 105 | mt7615_mutex_release(dev); |
| 106 | } |
| 107 | diff --git a/mt7615/mcu.c b/mt7615/mcu.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 108 | index 86061e9..a79308b 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 109 | --- a/mt7615/mcu.c |
| 110 | +++ b/mt7615/mcu.c |
| 111 | @@ -353,7 +353,7 @@ out: |
| 112 | static void |
| 113 | mt7615_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif) |
| 114 | { |
| 115 | - if (vif->bss_conf.csa_active) |
| 116 | + if (vif->csa_active) |
| 117 | ieee80211_csa_finish(vif); |
| 118 | } |
| 119 | |
| 120 | @@ -699,7 +699,7 @@ mt7615_mcu_add_beacon_offload(struct mt7615_dev *dev, |
| 121 | if (!enable) |
| 122 | goto out; |
| 123 | |
| 124 | - skb = ieee80211_beacon_get_template(hw, vif, &offs, 0); |
| 125 | + skb = ieee80211_beacon_get_template(hw, vif, &offs); |
| 126 | if (!skb) |
| 127 | return -EINVAL; |
| 128 | |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 129 | @@ -1075,7 +1075,7 @@ mt7615_mcu_uni_add_beacon_offload(struct mt7615_dev *dev, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 130 | if (!enable) |
| 131 | goto out; |
| 132 | |
| 133 | - skb = ieee80211_beacon_get_template(mt76_hw(dev), vif, &offs, 0); |
| 134 | + skb = ieee80211_beacon_get_template(mt76_hw(dev), vif, &offs); |
| 135 | if (!skb) |
| 136 | return -EINVAL; |
| 137 | |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 138 | @@ -2526,7 +2526,7 @@ int mt7615_mcu_set_bss_pm(struct mt7615_dev *dev, struct ieee80211_vif *vif, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 139 | u8 pad; |
| 140 | } req = { |
| 141 | .bss_idx = mvif->mt76.idx, |
| 142 | - .aid = cpu_to_le16(vif->cfg.aid), |
| 143 | + .aid = cpu_to_le16(vif->bss_conf.aid), |
| 144 | .dtim_period = vif->bss_conf.dtim_period, |
| 145 | .bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int), |
| 146 | }; |
| 147 | diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 148 | index d228312..665de18 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 149 | --- a/mt76_connac_mcu.c |
| 150 | +++ b/mt76_connac_mcu.c |
| 151 | @@ -197,7 +197,7 @@ int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif) |
| 152 | */ |
| 153 | } req = { |
| 154 | .bss_idx = mvif->idx, |
| 155 | - .ps_state = vif->cfg.ps ? 2 : 0, |
| 156 | + .ps_state = vif->bss_conf.ps ? 2 : 0, |
| 157 | }; |
| 158 | |
| 159 | if (vif->type != NL80211_IFTYPE_STATION) |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 160 | @@ -409,7 +409,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 161 | else |
| 162 | conn_type = CONNECTION_INFRA_AP; |
| 163 | basic->conn_type = cpu_to_le32(conn_type); |
| 164 | - basic->aid = cpu_to_le16(vif->cfg.aid); |
| 165 | + basic->aid = cpu_to_le16(vif->bss_conf.aid); |
| 166 | break; |
| 167 | case NL80211_IFTYPE_ADHOC: |
| 168 | basic->conn_type = cpu_to_le32(CONNECTION_IBSS_ADHOC); |
| 169 | @@ -553,7 +553,7 @@ void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev, |
| 170 | |
| 171 | if (sta) { |
| 172 | if (vif->type == NL80211_IFTYPE_STATION) |
| 173 | - generic->partial_aid = cpu_to_le16(vif->cfg.aid); |
| 174 | + generic->partial_aid = cpu_to_le16(vif->bss_conf.aid); |
| 175 | else |
| 176 | generic->partial_aid = cpu_to_le16(sta->aid); |
| 177 | memcpy(generic->peer_addr, sta->addr, ETH_ALEN); |
| 178 | @@ -602,14 +602,14 @@ mt76_connac_mcu_sta_amsdu_tlv(struct sk_buff *skb, struct ieee80211_sta *sta, |
| 179 | vif->type != NL80211_IFTYPE_STATION) |
| 180 | return; |
| 181 | |
| 182 | - if (!sta->deflink.agg.max_amsdu_len) |
| 183 | + if (!sta->max_amsdu_len) |
| 184 | return; |
| 185 | |
| 186 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu)); |
| 187 | amsdu = (struct sta_rec_amsdu *)tlv; |
| 188 | amsdu->max_amsdu_num = 8; |
| 189 | amsdu->amsdu_en = true; |
| 190 | - amsdu->max_mpdu_size = sta->deflink.agg.max_amsdu_len >= |
| 191 | + amsdu->max_mpdu_size = sta->max_amsdu_len >= |
| 192 | IEEE80211_MAX_MPDU_LEN_VHT_7991; |
| 193 | |
| 194 | wcid->amsdu = true; |
| 195 | @@ -620,7 +620,7 @@ mt76_connac_mcu_sta_amsdu_tlv(struct sk_buff *skb, struct ieee80211_sta *sta, |
| 196 | static void |
| 197 | mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
| 198 | { |
| 199 | - struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap; |
| 200 | + struct ieee80211_sta_he_cap *he_cap = &sta->he_cap; |
| 201 | struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem; |
| 202 | struct sta_rec_he *he; |
| 203 | struct tlv *tlv; |
| 204 | @@ -708,7 +708,7 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
| 205 | |
| 206 | he->he_cap = cpu_to_le32(cap); |
| 207 | |
| 208 | - switch (sta->deflink.bandwidth) { |
| 209 | + switch (sta->bandwidth) { |
| 210 | case IEEE80211_STA_RX_BW_160: |
| 211 | if (elem->phy_cap_info[0] & |
| 212 | IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G) |
| 213 | @@ -753,7 +753,7 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
| 214 | static void |
| 215 | mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta) |
| 216 | { |
| 217 | - struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap; |
| 218 | + struct ieee80211_sta_he_cap *he_cap = &sta->he_cap; |
| 219 | struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem; |
| 220 | struct sta_rec_he_v2 *he; |
| 221 | struct tlv *tlv; |
| 222 | @@ -764,7 +764,7 @@ mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta) |
| 223 | memcpy(he->he_phy_cap, elem->phy_cap_info, sizeof(he->he_phy_cap)); |
| 224 | memcpy(he->he_mac_cap, elem->mac_cap_info, sizeof(he->he_mac_cap)); |
| 225 | |
| 226 | - switch (sta->deflink.bandwidth) { |
| 227 | + switch (sta->bandwidth) { |
| 228 | case IEEE80211_STA_RX_BW_160: |
| 229 | if (elem->phy_cap_info[0] & |
| 230 | IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G) |
| 231 | @@ -780,7 +780,7 @@ mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta) |
| 232 | break; |
| 233 | } |
| 234 | |
| 235 | - he->pkt_ext = IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US; |
| 236 | + he->pkt_ext = IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US; |
| 237 | } |
| 238 | |
| 239 | static u8 |
| 240 | @@ -793,9 +793,9 @@ mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif, |
| 241 | u8 mode = 0; |
| 242 | |
| 243 | if (sta) { |
| 244 | - ht_cap = &sta->deflink.ht_cap; |
| 245 | - vht_cap = &sta->deflink.vht_cap; |
| 246 | - he_cap = &sta->deflink.he_cap; |
| 247 | + ht_cap = &sta->ht_cap; |
| 248 | + vht_cap = &sta->vht_cap; |
| 249 | + he_cap = &sta->he_cap; |
| 250 | } else { |
| 251 | struct ieee80211_supported_band *sband; |
| 252 | |
| 253 | @@ -844,25 +844,25 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb, |
| 254 | u16 supp_rates; |
| 255 | |
| 256 | /* starec ht */ |
| 257 | - if (sta->deflink.ht_cap.ht_supported) { |
| 258 | + if (sta->ht_cap.ht_supported) { |
| 259 | struct sta_rec_ht *ht; |
| 260 | |
| 261 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht)); |
| 262 | ht = (struct sta_rec_ht *)tlv; |
| 263 | - ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap); |
| 264 | + ht->ht_cap = cpu_to_le16(sta->ht_cap.cap); |
| 265 | } |
| 266 | |
| 267 | /* starec vht */ |
| 268 | - if (sta->deflink.vht_cap.vht_supported) { |
| 269 | + if (sta->vht_cap.vht_supported) { |
| 270 | struct sta_rec_vht *vht; |
| 271 | int len; |
| 272 | |
| 273 | len = is_mt7921(dev) ? sizeof(*vht) : sizeof(*vht) - 4; |
| 274 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, len); |
| 275 | vht = (struct sta_rec_vht *)tlv; |
| 276 | - vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap); |
| 277 | - vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map; |
| 278 | - vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map; |
| 279 | + vht->vht_cap = cpu_to_le32(sta->vht_cap.cap); |
| 280 | + vht->vht_rx_mcs_map = sta->vht_cap.vht_mcs.rx_mcs_map; |
| 281 | + vht->vht_tx_mcs_map = sta->vht_cap.vht_mcs.tx_mcs_map; |
| 282 | } |
| 283 | |
| 284 | /* starec uapsd */ |
| 285 | @@ -871,11 +871,11 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb, |
| 286 | if (!is_mt7921(dev)) |
| 287 | return; |
| 288 | |
| 289 | - if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he) |
| 290 | + if (sta->ht_cap.ht_supported || sta->he_cap.has_he) |
| 291 | mt76_connac_mcu_sta_amsdu_tlv(skb, sta, vif); |
| 292 | |
| 293 | /* starec he */ |
| 294 | - if (sta->deflink.he_cap.has_he) { |
| 295 | + if (sta->he_cap.has_he) { |
| 296 | mt76_connac_mcu_sta_he_tlv(skb, sta); |
| 297 | mt76_connac_mcu_sta_he_tlv_v2(skb, sta); |
| 298 | if (band == NL80211_BAND_6GHZ && |
| 299 | @@ -885,7 +885,7 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb, |
| 300 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE_6G, |
| 301 | sizeof(*he_6g_capa)); |
| 302 | he_6g_capa = (struct sta_rec_he_6g_capa *)tlv; |
| 303 | - he_6g_capa->capa = sta->deflink.he_6ghz_capa.capa; |
| 304 | + he_6g_capa->capa = sta->he_6ghz_capa.capa; |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | @@ -895,14 +895,14 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb, |
| 309 | phy->basic_rate = cpu_to_le16((u16)vif->bss_conf.basic_rates); |
| 310 | phy->rcpi = rcpi; |
| 311 | phy->ampdu = FIELD_PREP(IEEE80211_HT_AMPDU_PARM_FACTOR, |
| 312 | - sta->deflink.ht_cap.ampdu_factor) | |
| 313 | + sta->ht_cap.ampdu_factor) | |
| 314 | FIELD_PREP(IEEE80211_HT_AMPDU_PARM_DENSITY, |
| 315 | - sta->deflink.ht_cap.ampdu_density); |
| 316 | + sta->ht_cap.ampdu_density); |
| 317 | |
| 318 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra_info)); |
| 319 | ra_info = (struct sta_rec_ra_info *)tlv; |
| 320 | |
| 321 | - supp_rates = sta->deflink.supp_rates[band]; |
| 322 | + supp_rates = sta->supp_rates[band]; |
| 323 | if (band == NL80211_BAND_2GHZ) |
| 324 | supp_rates = FIELD_PREP(RA_LEGACY_OFDM, supp_rates >> 4) | |
| 325 | FIELD_PREP(RA_LEGACY_CCK, supp_rates & 0xf); |
| 326 | @@ -911,18 +911,18 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb, |
| 327 | |
| 328 | ra_info->legacy = cpu_to_le16(supp_rates); |
| 329 | |
| 330 | - if (sta->deflink.ht_cap.ht_supported) |
| 331 | + if (sta->ht_cap.ht_supported) |
| 332 | memcpy(ra_info->rx_mcs_bitmask, |
| 333 | - sta->deflink.ht_cap.mcs.rx_mask, |
| 334 | + sta->ht_cap.mcs.rx_mask, |
| 335 | HT_MCS_MASK_NUM); |
| 336 | |
| 337 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_STATE, sizeof(*state)); |
| 338 | state = (struct sta_rec_state *)tlv; |
| 339 | state->state = sta_state; |
| 340 | |
| 341 | - if (sta->deflink.vht_cap.vht_supported) { |
| 342 | - state->vht_opmode = sta->deflink.bandwidth; |
| 343 | - state->vht_opmode |= (sta->deflink.rx_nss - 1) << |
| 344 | + if (sta->vht_cap.vht_supported) { |
| 345 | + state->vht_opmode = sta->bandwidth; |
| 346 | + state->vht_opmode |= (sta->rx_nss - 1) << |
| 347 | IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT; |
| 348 | } |
| 349 | } |
| 350 | @@ -938,7 +938,7 @@ void mt76_connac_mcu_wtbl_smps_tlv(struct sk_buff *skb, |
| 351 | tlv = mt76_connac_mcu_add_nested_tlv(skb, WTBL_SMPS, sizeof(*smps), |
| 352 | wtbl_tlv, sta_wtbl); |
| 353 | smps = (struct wtbl_smps *)tlv; |
| 354 | - smps->smps = (sta->deflink.smps_mode == IEEE80211_SMPS_DYNAMIC); |
| 355 | + smps->smps = (sta->smps_mode == IEEE80211_SMPS_DYNAMIC); |
| 356 | } |
| 357 | EXPORT_SYMBOL_GPL(mt76_connac_mcu_wtbl_smps_tlv); |
| 358 | |
| 359 | @@ -950,27 +950,27 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb, |
| 360 | struct tlv *tlv; |
| 361 | u32 flags = 0; |
| 362 | |
| 363 | - if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_6ghz_capa.capa) { |
| 364 | + if (sta->ht_cap.ht_supported || sta->he_6ghz_capa.capa) { |
| 365 | tlv = mt76_connac_mcu_add_nested_tlv(skb, WTBL_HT, sizeof(*ht), |
| 366 | wtbl_tlv, sta_wtbl); |
| 367 | ht = (struct wtbl_ht *)tlv; |
| 368 | ht->ldpc = ht_ldpc && |
| 369 | - !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING); |
| 370 | + !!(sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING); |
| 371 | |
| 372 | - if (sta->deflink.ht_cap.ht_supported) { |
| 373 | - ht->af = sta->deflink.ht_cap.ampdu_factor; |
| 374 | - ht->mm = sta->deflink.ht_cap.ampdu_density; |
| 375 | + if (sta->ht_cap.ht_supported) { |
| 376 | + ht->af = sta->ht_cap.ampdu_factor; |
| 377 | + ht->mm = sta->ht_cap.ampdu_density; |
| 378 | } else { |
| 379 | - ht->af = le16_get_bits(sta->deflink.he_6ghz_capa.capa, |
| 380 | + ht->af = le16_get_bits(sta->he_6ghz_capa.capa, |
| 381 | IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP); |
| 382 | - ht->mm = le16_get_bits(sta->deflink.he_6ghz_capa.capa, |
| 383 | + ht->mm = le16_get_bits(sta->he_6ghz_capa.capa, |
| 384 | IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START); |
| 385 | } |
| 386 | |
| 387 | ht->ht = true; |
| 388 | } |
| 389 | |
| 390 | - if (sta->deflink.vht_cap.vht_supported || sta->deflink.he_6ghz_capa.capa) { |
| 391 | + if (sta->vht_cap.vht_supported || sta->he_6ghz_capa.capa) { |
| 392 | struct wtbl_vht *vht; |
| 393 | u8 af; |
| 394 | |
| 395 | @@ -979,18 +979,18 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb, |
| 396 | sta_wtbl); |
| 397 | vht = (struct wtbl_vht *)tlv; |
| 398 | vht->ldpc = vht_ldpc && |
| 399 | - !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC); |
| 400 | + !!(sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC); |
| 401 | vht->vht = true; |
| 402 | |
| 403 | af = FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK, |
| 404 | - sta->deflink.vht_cap.cap); |
| 405 | + sta->vht_cap.cap); |
| 406 | if (ht) |
| 407 | ht->af = max(ht->af, af); |
| 408 | } |
| 409 | |
| 410 | mt76_connac_mcu_wtbl_smps_tlv(skb, sta, sta_wtbl, wtbl_tlv); |
| 411 | |
| 412 | - if (is_connac_v1(dev) && sta->deflink.ht_cap.ht_supported) { |
| 413 | + if (is_connac_v1(dev) && sta->ht_cap.ht_supported) { |
| 414 | /* sgi */ |
| 415 | u32 msk = MT_WTBL_W5_SHORT_GI_20 | MT_WTBL_W5_SHORT_GI_40 | |
| 416 | MT_WTBL_W5_SHORT_GI_80 | MT_WTBL_W5_SHORT_GI_160; |
| 417 | @@ -1000,15 +1000,15 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb, |
| 418 | sizeof(*raw), wtbl_tlv, |
| 419 | sta_wtbl); |
| 420 | |
| 421 | - if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20) |
| 422 | + if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) |
| 423 | flags |= MT_WTBL_W5_SHORT_GI_20; |
| 424 | - if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40) |
| 425 | + if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) |
| 426 | flags |= MT_WTBL_W5_SHORT_GI_40; |
| 427 | |
| 428 | - if (sta->deflink.vht_cap.vht_supported) { |
| 429 | - if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80) |
| 430 | + if (sta->vht_cap.vht_supported) { |
| 431 | + if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80) |
| 432 | flags |= MT_WTBL_W5_SHORT_GI_80; |
| 433 | - if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160) |
| 434 | + if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160) |
| 435 | flags |= MT_WTBL_W5_SHORT_GI_160; |
| 436 | } |
| 437 | raw = (struct wtbl_raw *)tlv; |
| 438 | @@ -1294,9 +1294,9 @@ u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif, |
| 439 | return 0x38; |
| 440 | |
| 441 | if (sta) { |
| 442 | - ht_cap = &sta->deflink.ht_cap; |
| 443 | - vht_cap = &sta->deflink.vht_cap; |
| 444 | - he_cap = &sta->deflink.he_cap; |
| 445 | + ht_cap = &sta->ht_cap; |
| 446 | + vht_cap = &sta->vht_cap; |
| 447 | + he_cap = &sta->he_cap; |
| 448 | } else { |
| 449 | struct ieee80211_supported_band *sband; |
| 450 | |
| 451 | @@ -1616,7 +1616,6 @@ int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif, |
| 452 | for (i = 0; i < sreq->n_ssids; i++) { |
| 453 | if (!sreq->ssids[i].ssid_len) |
| 454 | continue; |
| 455 | - |
| 456 | req->ssids[i].ssid_len = cpu_to_le32(sreq->ssids[i].ssid_len); |
| 457 | memcpy(req->ssids[i].ssid, sreq->ssids[i].ssid, |
| 458 | sreq->ssids[i].ssid_len); |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 459 | @@ -1756,7 +1755,6 @@ int mt76_connac_mcu_sched_scan_req(struct mt76_phy *phy, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 460 | memcpy(req->ssids[i].ssid, ssid->ssid, ssid->ssid_len); |
| 461 | req->ssids[i].ssid_len = cpu_to_le32(ssid->ssid_len); |
| 462 | } |
| 463 | - |
| 464 | req->match_num = sreq->n_match_sets; |
| 465 | for (i = 0; i < req->match_num; i++) { |
| 466 | match = &sreq->match_sets[i]; |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 467 | @@ -2243,10 +2241,8 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 468 | struct mt76_vif *vif, |
| 469 | struct ieee80211_bss_conf *info) |
| 470 | { |
| 471 | - struct ieee80211_vif *mvif = container_of(info, struct ieee80211_vif, |
| 472 | - bss_conf); |
| 473 | struct sk_buff *skb; |
| 474 | - int i, len = min_t(int, mvif->cfg.arp_addr_cnt, |
| 475 | + int i, len = min_t(int, info->arp_addr_cnt, |
| 476 | IEEE80211_BSS_ARP_ADDR_LIST_LEN); |
| 477 | struct { |
| 478 | struct { |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 479 | @@ -2274,7 +2270,7 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 480 | |
| 481 | skb_put_data(skb, &req_hdr, sizeof(req_hdr)); |
| 482 | for (i = 0; i < len; i++) |
| 483 | - skb_put_data(skb, &mvif->cfg.arp_addr_list[i], sizeof(__be32)); |
| 484 | + skb_put_data(skb, &info->arp_addr_list[i], sizeof(__be32)); |
| 485 | |
| 486 | return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD(OFFLOAD), true); |
| 487 | } |
| 488 | diff --git a/mt76x02_mac.c b/mt76x02_mac.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 489 | index 3e41d80..c289ae0 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 490 | --- a/mt76x02_mac.c |
| 491 | +++ b/mt76x02_mac.c |
| 492 | @@ -404,7 +404,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi, |
| 493 | txwi->rate |= cpu_to_le16(MT_RXWI_RATE_LDPC); |
| 494 | if ((info->flags & IEEE80211_TX_CTL_STBC) && nss == 1) |
| 495 | txwi->rate |= cpu_to_le16(MT_RXWI_RATE_STBC); |
| 496 | - if (nss > 1 && sta && sta->deflink.smps_mode == IEEE80211_SMPS_DYNAMIC) |
| 497 | + if (nss > 1 && sta && sta->smps_mode == IEEE80211_SMPS_DYNAMIC) |
| 498 | txwi_flags |= MT_TXWI_FLAGS_MMPS; |
| 499 | if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) |
| 500 | txwi->ack_ctl |= MT_TXWI_ACK_CTL_REQ; |
| 501 | @@ -412,9 +412,9 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi, |
| 502 | txwi->ack_ctl |= MT_TXWI_ACK_CTL_NSEQ; |
| 503 | if ((info->flags & IEEE80211_TX_CTL_AMPDU) && sta) { |
| 504 | u8 ba_size = IEEE80211_MIN_AMPDU_BUF; |
| 505 | - u8 ampdu_density = sta->deflink.ht_cap.ampdu_density; |
| 506 | + u8 ampdu_density = sta->ht_cap.ampdu_density; |
| 507 | |
| 508 | - ba_size <<= sta->deflink.ht_cap.ampdu_factor; |
| 509 | + ba_size <<= sta->ht_cap.ampdu_factor; |
| 510 | ba_size = min_t(int, 63, ba_size - 1); |
| 511 | if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) |
| 512 | ba_size = 0; |
| 513 | diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 514 | index e44ac9a..e841d1e 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 515 | --- a/mt7915/debugfs.c |
| 516 | +++ b/mt7915/debugfs.c |
| 517 | @@ -1911,8 +1911,8 @@ static ssize_t mt7915_sta_fixed_rate_set(struct file *file, |
| 518 | |
| 519 | phy.ldpc = (phy.bw || phy.ldpc) * GENMASK(2, 0); |
| 520 | for (i = 0; i <= phy.bw; i++) { |
| 521 | - phy.sgi |= gi << (i << sta->deflink.he_cap.has_he); |
| 522 | - phy.he_ltf |= he_ltf << (i << sta->deflink.he_cap.has_he); |
| 523 | + phy.sgi |= gi << (i << sta->he_cap.has_he); |
| 524 | + phy.he_ltf |= he_ltf << (i << sta->he_cap.has_he); |
| 525 | } |
| 526 | field = RATE_PARAM_FIXED; |
| 527 | |
| 528 | diff --git a/mt7915/dma.c b/mt7915/dma.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 529 | index daa01fd..5b8426a 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 530 | --- a/mt7915/dma.c |
| 531 | +++ b/mt7915/dma.c |
developer | 2324aa2 | 2023-04-12 11:30:15 +0800 | [diff] [blame] | 532 | @@ -590,8 +590,8 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2) |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 533 | if (ret < 0) |
| 534 | return ret; |
| 535 | |
| 536 | - netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi, |
| 537 | - mt7915_poll_tx); |
| 538 | + netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi, |
| 539 | + mt7915_poll_tx, NAPI_POLL_WEIGHT); |
| 540 | napi_enable(&dev->mt76.tx_napi); |
| 541 | |
developer | 2324aa2 | 2023-04-12 11:30:15 +0800 | [diff] [blame] | 542 | mt7915_dma_enable(dev, false); |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 543 | diff --git a/mt7915/init.c b/mt7915/init.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 544 | index 9036f44..f5d5adb 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 545 | --- a/mt7915/init.c |
| 546 | +++ b/mt7915/init.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 547 | @@ -1145,8 +1145,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band, |
| 548 | mt76_connac_gen_ppe_thresh(he_cap->ppe_thres, nss); |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 549 | } else { |
| 550 | he_cap_elem->phy_cap_info[9] |= |
| 551 | - u8_encode_bits(IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US, |
| 552 | - IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK); |
| 553 | + IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US; |
| 554 | } |
| 555 | |
| 556 | if (band == NL80211_BAND_6GHZ) { |
| 557 | diff --git a/mt7915/mac.c b/mt7915/mac.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 558 | index 0994ce1..e9156af 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 559 | --- a/mt7915/mac.c |
| 560 | +++ b/mt7915/mac.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 561 | @@ -878,7 +878,7 @@ mt7915_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi) |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 562 | u16 fc, tid; |
| 563 | u32 val; |
| 564 | |
| 565 | - if (!sta || !(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he)) |
| 566 | + if (!sta || !(sta->ht_cap.ht_supported || sta->he_cap.has_he)) |
| 567 | return; |
| 568 | |
| 569 | tid = le32_get_bits(txwi[1], MT_TXD1_TID); |
| 570 | diff --git a/mt7915/main.c b/mt7915/main.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 571 | index f836aa8..653dffe 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 572 | --- a/mt7915/main.c |
| 573 | +++ b/mt7915/main.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 574 | @@ -273,6 +273,7 @@ int mt7915_init_vif(struct mt7915_phy *phy, struct ieee80211_vif *vif, bool bf_e |
| 575 | vif->offload_flags |= IEEE80211_OFFLOAD_ENCAP_4ADDR; |
| 576 | |
| 577 | mt7915_init_bitrate_mask(vif); |
| 578 | + memset(&mvif->cap, -1, sizeof(mvif->cap)); |
| 579 | |
| 580 | mt7915_mcu_add_bss_info(phy, vif, true); |
| 581 | mt7915_mcu_add_sta(dev, vif, NULL, true); |
| 582 | @@ -529,7 +530,7 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed) |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 583 | |
| 584 | static int |
| 585 | mt7915_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 586 | - unsigned int link_id, u16 queue, |
| 587 | + u16 queue, |
| 588 | const struct ieee80211_tx_queue_params *params) |
| 589 | { |
| 590 | struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 591 | @@ -624,7 +625,7 @@ mt7915_update_bss_color(struct ieee80211_hw *hw, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 592 | static void mt7915_bss_info_changed(struct ieee80211_hw *hw, |
| 593 | struct ieee80211_vif *vif, |
| 594 | struct ieee80211_bss_conf *info, |
| 595 | - u64 changed) |
| 596 | + u32 changed) |
| 597 | { |
| 598 | struct mt7915_phy *phy = mt7915_hw_phy(hw); |
| 599 | struct mt7915_dev *dev = mt7915_hw_dev(hw); |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 600 | @@ -644,7 +645,7 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 601 | } |
| 602 | |
| 603 | if (changed & BSS_CHANGED_ASSOC) |
| 604 | - mt7915_mcu_add_bss_info(phy, vif, vif->cfg.assoc); |
| 605 | + mt7915_mcu_add_bss_info(phy, vif, info->assoc); |
| 606 | |
| 607 | if (changed & BSS_CHANGED_ERP_CTS_PROT) |
| 608 | mt7915_mac_enable_rtscts(dev, vif, info->use_cts_prot); |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 609 | @@ -1240,10 +1241,10 @@ static int mt7915_sta_set_txpwr(struct ieee80211_hw *hw, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 610 | { |
| 611 | struct mt7915_phy *phy = mt7915_hw_phy(hw); |
| 612 | struct mt7915_dev *dev = mt7915_hw_dev(hw); |
| 613 | - s16 txpower = sta->deflink.txpwr.power; |
| 614 | + s16 txpower = sta->txpwr.power; |
| 615 | int ret; |
| 616 | |
| 617 | - if (sta->deflink.txpwr.type == NL80211_TX_POWER_AUTOMATIC) |
| 618 | + if (sta->txpwr.type == NL80211_TX_POWER_AUTOMATIC) |
| 619 | txpower = 0; |
| 620 | |
| 621 | mutex_lock(&dev->mt76.mutex); |
| 622 | diff --git a/mt7915/mcu.c b/mt7915/mcu.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 623 | index 2c6dddc..94c3215 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 624 | --- a/mt7915/mcu.c |
| 625 | +++ b/mt7915/mcu.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 626 | @@ -67,7 +67,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 627 | struct mt7915_dev *dev = msta->vif->phy->dev; |
| 628 | enum nl80211_band band = msta->vif->phy->mt76->chandef.chan->band; |
| 629 | const u16 *mask = msta->vif->bitrate_mask.control[band].he_mcs; |
| 630 | - int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss; |
| 631 | + int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss; |
| 632 | |
| 633 | for (nss = 0; nss < max_nss; nss++) { |
| 634 | int mcs; |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 635 | @@ -107,7 +107,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 636 | |
| 637 | /* only support 2ss on 160MHz for mt7915 */ |
| 638 | if (is_mt7915(&dev->mt76) && nss > 1 && |
| 639 | - sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) |
| 640 | + sta->bandwidth == IEEE80211_STA_RX_BW_160) |
| 641 | break; |
| 642 | } |
| 643 | |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 644 | @@ -120,8 +120,8 @@ mt7915_mcu_set_sta_vht_mcs(struct ieee80211_sta *sta, __le16 *vht_mcs, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 645 | { |
| 646 | struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; |
| 647 | struct mt7915_dev *dev = msta->vif->phy->dev; |
| 648 | - u16 mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map); |
| 649 | - int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss; |
| 650 | + u16 mcs_map = le16_to_cpu(sta->vht_cap.vht_mcs.rx_mcs_map); |
| 651 | + int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss; |
| 652 | u16 mcs; |
| 653 | |
| 654 | for (nss = 0; nss < max_nss; nss++, mcs_map >>= 2) { |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 655 | @@ -143,7 +143,7 @@ mt7915_mcu_set_sta_vht_mcs(struct ieee80211_sta *sta, __le16 *vht_mcs, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 656 | |
| 657 | /* only support 2ss on 160MHz for mt7915 */ |
| 658 | if (is_mt7915(&dev->mt76) && nss > 1 && |
| 659 | - sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) |
| 660 | + sta->bandwidth == IEEE80211_STA_RX_BW_160) |
| 661 | break; |
| 662 | } |
| 663 | } |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 664 | @@ -152,10 +152,10 @@ static void |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 665 | mt7915_mcu_set_sta_ht_mcs(struct ieee80211_sta *sta, u8 *ht_mcs, |
| 666 | const u8 *mask) |
| 667 | { |
| 668 | - int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss; |
| 669 | + int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss; |
| 670 | |
| 671 | for (nss = 0; nss < max_nss; nss++) |
| 672 | - ht_mcs[nss] = sta->deflink.ht_cap.mcs.rx_mask[nss] & mask[nss]; |
| 673 | + ht_mcs[nss] = sta->ht_cap.mcs.rx_mask[nss] & mask[nss]; |
| 674 | } |
| 675 | |
| 676 | static int |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 677 | @@ -236,7 +236,7 @@ int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3) |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 678 | static void |
| 679 | mt7915_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif) |
| 680 | { |
| 681 | - if (vif->bss_conf.csa_active) |
| 682 | + if (vif->csa_active) |
| 683 | ieee80211_csa_finish(vif); |
| 684 | } |
| 685 | |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 686 | @@ -337,7 +337,7 @@ mt7915_mcu_rx_log_message(struct mt7915_dev *dev, struct sk_buff *skb) |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 687 | static void |
| 688 | mt7915_mcu_cca_finish(void *priv, u8 *mac, struct ieee80211_vif *vif) |
| 689 | { |
| 690 | - if (!vif->bss_conf.color_change_active) |
| 691 | + if (!vif->color_change_active) |
| 692 | return; |
| 693 | |
| 694 | ieee80211_color_change_finish(vif); |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 695 | @@ -750,13 +750,14 @@ static void |
| 696 | mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 697 | struct ieee80211_vif *vif) |
| 698 | { |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 699 | - struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem; |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 700 | + struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 701 | + struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem; |
| 702 | struct ieee80211_he_mcs_nss_supp mcs_map; |
| 703 | struct sta_rec_he *he; |
| 704 | struct tlv *tlv; |
| 705 | u32 cap = 0; |
| 706 | |
| 707 | - if (!sta->deflink.he_cap.has_he) |
| 708 | + if (!sta->he_cap.has_he) |
| 709 | return; |
| 710 | |
| 711 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE, sizeof(*he)); |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 712 | @@ -783,7 +784,7 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta, |
| 713 | IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_5G)) |
| 714 | cap |= STA_REC_HE_CAP_BW20_RU242_SUPPORT; |
| 715 | |
| 716 | - if (vif->bss_conf.he_ldpc && |
| 717 | + if (mvif->cap.he_ldpc && |
| 718 | (elem->phy_cap_info[1] & |
| 719 | IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD)) |
| 720 | cap |= STA_REC_HE_CAP_LDPC; |
| 721 | @@ -842,8 +843,8 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 722 | |
| 723 | he->he_cap = cpu_to_le32(cap); |
| 724 | |
| 725 | - mcs_map = sta->deflink.he_cap.he_mcs_nss_supp; |
| 726 | - switch (sta->deflink.bandwidth) { |
| 727 | + mcs_map = sta->he_cap.he_mcs_nss_supp; |
| 728 | + switch (sta->bandwidth) { |
| 729 | case IEEE80211_STA_RX_BW_160: |
| 730 | if (elem->phy_cap_info[0] & |
| 731 | IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G) |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 732 | @@ -892,8 +893,9 @@ static void |
| 733 | mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
| 734 | struct ieee80211_sta *sta, struct ieee80211_vif *vif) |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 735 | { |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 736 | + struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 737 | struct mt7915_phy *phy = mvif->phy; |
| 738 | - struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem; |
| 739 | + struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem; |
| 740 | struct sta_rec_muru *muru; |
| 741 | struct tlv *tlv; |
| 742 | |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 743 | @@ -905,9 +907,9 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
| 744 | |
| 745 | muru = (struct sta_rec_muru *)tlv; |
| 746 | |
| 747 | - muru->cfg.mimo_dl_en = (vif->bss_conf.he_mu_beamformer || |
| 748 | - vif->bss_conf.vht_mu_beamformer || |
| 749 | - vif->bss_conf.vht_mu_beamformee) && |
| 750 | + muru->cfg.mimo_dl_en = (mvif->cap.he_mu_ebfer || |
| 751 | + mvif->cap.vht_mu_ebfer || |
| 752 | + mvif->cap.vht_mu_ebfee) && |
| 753 | !!(phy->muru_onoff & MUMIMO_DL); |
| 754 | if (!is_mt7915(&dev->mt76)) |
| 755 | muru->cfg.mimo_ul_en = true; |
| 756 | @@ -917,11 +919,11 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 757 | muru->cfg.ofdma_dl_en = !!(phy->muru_onoff & OFDMA_DL); |
| 758 | muru->cfg.ofdma_ul_en = !!(phy->muru_onoff & OFDMA_UL); |
| 759 | |
| 760 | - if (sta->deflink.vht_cap.vht_supported) |
| 761 | + if (sta->vht_cap.vht_supported) |
| 762 | muru->mimo_dl.vht_mu_bfee = |
| 763 | - !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE); |
| 764 | + !!(sta->vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE); |
| 765 | |
| 766 | - if (!sta->deflink.he_cap.has_he) |
| 767 | + if (!sta->he_cap.has_he) |
| 768 | return; |
| 769 | |
| 770 | muru->mimo_dl.partial_bw_dl_mimo = |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 771 | @@ -955,13 +957,13 @@ mt7915_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 772 | struct sta_rec_ht *ht; |
| 773 | struct tlv *tlv; |
| 774 | |
| 775 | - if (!sta->deflink.ht_cap.ht_supported) |
| 776 | + if (!sta->ht_cap.ht_supported) |
| 777 | return; |
| 778 | |
| 779 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht)); |
| 780 | |
| 781 | ht = (struct sta_rec_ht *)tlv; |
| 782 | - ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap); |
| 783 | + ht->ht_cap = cpu_to_le16(sta->ht_cap.cap); |
| 784 | } |
| 785 | |
| 786 | static void |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 787 | @@ -970,15 +972,15 @@ mt7915_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 788 | struct sta_rec_vht *vht; |
| 789 | struct tlv *tlv; |
| 790 | |
| 791 | - if (!sta->deflink.vht_cap.vht_supported) |
| 792 | + if (!sta->vht_cap.vht_supported) |
| 793 | return; |
| 794 | |
| 795 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, sizeof(*vht)); |
| 796 | |
| 797 | vht = (struct sta_rec_vht *)tlv; |
| 798 | - vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap); |
| 799 | - vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map; |
| 800 | - vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map; |
| 801 | + vht->vht_cap = cpu_to_le32(sta->vht_cap.cap); |
| 802 | + vht->vht_rx_mcs_map = sta->vht_cap.vht_mcs.rx_mcs_map; |
| 803 | + vht->vht_tx_mcs_map = sta->vht_cap.vht_mcs.tx_mcs_map; |
| 804 | } |
| 805 | |
| 806 | static void |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 807 | @@ -993,7 +995,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 808 | vif->type != NL80211_IFTYPE_AP) |
| 809 | return; |
| 810 | |
| 811 | - if (!sta->deflink.agg.max_amsdu_len) |
| 812 | + if (!sta->max_amsdu_len) |
| 813 | return; |
| 814 | |
| 815 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu)); |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 816 | @@ -1002,7 +1004,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 817 | amsdu->amsdu_en = true; |
| 818 | msta->wcid.amsdu = true; |
| 819 | |
| 820 | - switch (sta->deflink.agg.max_amsdu_len) { |
| 821 | + switch (sta->max_amsdu_len) { |
| 822 | case IEEE80211_MAX_MPDU_LEN_VHT_11454: |
| 823 | if (!is_mt7915(&dev->mt76)) { |
| 824 | amsdu->max_mpdu_size = |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 825 | @@ -1045,8 +1047,8 @@ mt7915_mcu_sta_wtbl_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
| 826 | mt76_connac_mcu_wtbl_hdr_trans_tlv(skb, vif, wcid, tlv, wtbl_hdr); |
| 827 | if (sta) |
| 828 | mt76_connac_mcu_wtbl_ht_tlv(&dev->mt76, skb, sta, tlv, |
| 829 | - wtbl_hdr, vif->bss_conf.ht_ldpc, |
| 830 | - vif->bss_conf.vht_ldpc); |
| 831 | + wtbl_hdr, mvif->cap.ht_ldpc, |
| 832 | + mvif->cap.vht_ldpc); |
| 833 | |
| 834 | return 0; |
| 835 | } |
| 836 | @@ -1055,6 +1057,7 @@ static inline bool |
| 837 | mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif, |
| 838 | struct ieee80211_sta *sta, bool bfee) |
| 839 | { |
| 840 | + struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; |
| 841 | int sts = hweight16(phy->mt76->chainmask); |
| 842 | |
| 843 | if (vif->type != NL80211_IFTYPE_STATION && |
| 844 | @@ -1064,25 +1067,25 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif, |
developer | 69542b5 | 2023-04-13 10:46:44 +0800 | [diff] [blame] | 845 | if (!bfee && sts < 2) |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 846 | return false; |
| 847 | |
| 848 | - if (sta->deflink.he_cap.has_he) { |
| 849 | - struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem; |
| 850 | + if (sta->he_cap.has_he) { |
| 851 | + struct ieee80211_he_cap_elem *pe = &sta->he_cap.he_cap_elem; |
| 852 | |
| 853 | if (bfee) |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 854 | - return vif->bss_conf.he_su_beamformee && |
| 855 | + return mvif->cap.he_su_ebfee && |
| 856 | HE_PHY(CAP3_SU_BEAMFORMER, pe->phy_cap_info[3]); |
| 857 | else |
| 858 | - return vif->bss_conf.he_su_beamformer && |
| 859 | + return mvif->cap.he_su_ebfer && |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 860 | HE_PHY(CAP4_SU_BEAMFORMEE, pe->phy_cap_info[4]); |
| 861 | } |
| 862 | |
| 863 | - if (sta->deflink.vht_cap.vht_supported) { |
| 864 | - u32 cap = sta->deflink.vht_cap.cap; |
| 865 | + if (sta->vht_cap.vht_supported) { |
| 866 | + u32 cap = sta->vht_cap.cap; |
| 867 | |
| 868 | if (bfee) |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 869 | - return vif->bss_conf.vht_su_beamformee && |
| 870 | + return mvif->cap.vht_su_ebfee && |
| 871 | (cap & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE); |
| 872 | else |
| 873 | - return vif->bss_conf.vht_su_beamformer && |
| 874 | + return mvif->cap.vht_su_ebfer && |
| 875 | (cap & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE); |
| 876 | } |
| 877 | |
| 878 | @@ -1102,7 +1105,7 @@ static void |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 879 | mt7915_mcu_sta_bfer_ht(struct ieee80211_sta *sta, struct mt7915_phy *phy, |
| 880 | struct sta_rec_bf *bf) |
| 881 | { |
| 882 | - struct ieee80211_mcs_info *mcs = &sta->deflink.ht_cap.mcs; |
| 883 | + struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs; |
| 884 | u8 n = 0; |
| 885 | |
| 886 | bf->tx_mode = MT_PHY_TYPE_HT; |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 887 | @@ -1127,7 +1130,7 @@ static void |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 888 | mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy, |
| 889 | struct sta_rec_bf *bf, bool explicit) |
| 890 | { |
| 891 | - struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap; |
| 892 | + struct ieee80211_sta_vht_cap *pc = &sta->vht_cap; |
| 893 | struct ieee80211_sta_vht_cap *vc = &phy->mt76->sband_5g.sband.vht_cap; |
| 894 | u16 mcs_map = le16_to_cpu(pc->vht_mcs.rx_mcs_map); |
| 895 | u8 nss_mcs = mt7915_mcu_get_sta_nss(mcs_map); |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 896 | @@ -1148,14 +1151,14 @@ mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 897 | bf->ncol = min_t(u8, nss_mcs, bf->nrow); |
| 898 | bf->ibf_ncol = bf->ncol; |
| 899 | |
| 900 | - if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) |
| 901 | + if (sta->bandwidth == IEEE80211_STA_RX_BW_160) |
| 902 | bf->nrow = 1; |
| 903 | } else { |
| 904 | bf->nrow = tx_ant; |
| 905 | bf->ncol = min_t(u8, nss_mcs, bf->nrow); |
| 906 | bf->ibf_ncol = nss_mcs; |
| 907 | |
| 908 | - if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) |
| 909 | + if (sta->bandwidth == IEEE80211_STA_RX_BW_160) |
| 910 | bf->ibf_nrow = 1; |
| 911 | } |
| 912 | } |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 913 | @@ -1164,7 +1167,7 @@ static void |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 914 | mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif, |
| 915 | struct mt7915_phy *phy, struct sta_rec_bf *bf) |
| 916 | { |
| 917 | - struct ieee80211_sta_he_cap *pc = &sta->deflink.he_cap; |
| 918 | + struct ieee80211_sta_he_cap *pc = &sta->he_cap; |
| 919 | struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem; |
| 920 | const struct ieee80211_sta_he_cap *vc = |
| 921 | mt76_connac_get_he_phy_cap(phy->mt76, vif); |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 922 | @@ -1189,7 +1192,7 @@ mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 923 | bf->ncol = min_t(u8, nss_mcs, bf->nrow); |
| 924 | bf->ibf_ncol = bf->ncol; |
| 925 | |
| 926 | - if (sta->deflink.bandwidth != IEEE80211_STA_RX_BW_160) |
| 927 | + if (sta->bandwidth != IEEE80211_STA_RX_BW_160) |
| 928 | return; |
| 929 | |
| 930 | /* go over for 160MHz and 80p80 */ |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 931 | @@ -1237,7 +1240,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 932 | }; |
| 933 | bool ebf; |
| 934 | |
| 935 | - if (!(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he)) |
| 936 | + if (!(sta->ht_cap.ht_supported || sta->he_cap.has_he)) |
| 937 | return; |
| 938 | |
| 939 | ebf = mt7915_is_ebf_supported(phy, vif, sta, false); |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 940 | @@ -1251,21 +1254,21 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 941 | * vht: support eBF and iBF |
| 942 | * ht: iBF only, since mac80211 lacks of eBF support |
| 943 | */ |
| 944 | - if (sta->deflink.he_cap.has_he && ebf) |
| 945 | + if (sta->he_cap.has_he && ebf) |
| 946 | mt7915_mcu_sta_bfer_he(sta, vif, phy, bf); |
| 947 | - else if (sta->deflink.vht_cap.vht_supported) |
| 948 | + else if (sta->vht_cap.vht_supported) |
| 949 | mt7915_mcu_sta_bfer_vht(sta, phy, bf, ebf); |
| 950 | - else if (sta->deflink.ht_cap.ht_supported) |
| 951 | + else if (sta->ht_cap.ht_supported) |
| 952 | mt7915_mcu_sta_bfer_ht(sta, phy, bf); |
| 953 | else |
| 954 | return; |
| 955 | |
| 956 | bf->bf_cap = ebf ? ebf : dev->ibf << 1; |
| 957 | - bf->bw = sta->deflink.bandwidth; |
| 958 | - bf->ibf_dbw = sta->deflink.bandwidth; |
| 959 | + bf->bw = sta->bandwidth; |
| 960 | + bf->ibf_dbw = sta->bandwidth; |
| 961 | bf->ibf_nrow = tx_ant; |
| 962 | |
| 963 | - if (!ebf && sta->deflink.bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol) |
| 964 | + if (!ebf && sta->bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol) |
| 965 | bf->ibf_timeout = 0x48; |
| 966 | else |
| 967 | bf->ibf_timeout = 0x18; |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 968 | @@ -1275,7 +1278,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 969 | else |
| 970 | bf->mem_20m = matrix[bf->nrow][bf->ncol]; |
| 971 | |
| 972 | - switch (sta->deflink.bandwidth) { |
| 973 | + switch (sta->bandwidth) { |
| 974 | case IEEE80211_STA_RX_BW_160: |
| 975 | case IEEE80211_STA_RX_BW_80: |
| 976 | bf->mem_total = bf->mem_20m * 2; |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 977 | @@ -1300,7 +1303,7 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 978 | struct tlv *tlv; |
| 979 | u8 nrow = 0; |
| 980 | |
| 981 | - if (!(sta->deflink.vht_cap.vht_supported || sta->deflink.he_cap.has_he)) |
| 982 | + if (!(sta->vht_cap.vht_supported || sta->he_cap.has_he)) |
| 983 | return; |
| 984 | |
| 985 | if (!mt7915_is_ebf_supported(phy, vif, sta, true)) |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 986 | @@ -1309,13 +1312,13 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 987 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_BFEE, sizeof(*bfee)); |
| 988 | bfee = (struct sta_rec_bfee *)tlv; |
| 989 | |
| 990 | - if (sta->deflink.he_cap.has_he) { |
| 991 | - struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem; |
| 992 | + if (sta->he_cap.has_he) { |
| 993 | + struct ieee80211_he_cap_elem *pe = &sta->he_cap.he_cap_elem; |
| 994 | |
| 995 | nrow = HE_PHY(CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK, |
| 996 | pe->phy_cap_info[5]); |
| 997 | - } else if (sta->deflink.vht_cap.vht_supported) { |
| 998 | - struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap; |
| 999 | + } else if (sta->vht_cap.vht_supported) { |
| 1000 | + struct ieee80211_sta_vht_cap *pc = &sta->vht_cap; |
| 1001 | |
| 1002 | nrow = FIELD_GET(IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK, |
| 1003 | pc->cap); |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1004 | @@ -1371,7 +1374,7 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1005 | ra->phy = *phy; |
| 1006 | break; |
| 1007 | case RATE_PARAM_MMPS_UPDATE: |
| 1008 | - ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->deflink.smps_mode); |
| 1009 | + ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->smps_mode); |
| 1010 | break; |
| 1011 | case RATE_PARAM_SPE_UPDATE: |
| 1012 | ra->spe_idx = *(u8 *)data; |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1013 | @@ -1446,7 +1449,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1014 | do { \ |
| 1015 | u8 i, gi = mask->control[band]._gi; \ |
| 1016 | gi = (_he) ? gi : gi == NL80211_TXRATE_FORCE_SGI; \ |
| 1017 | - for (i = 0; i <= sta->deflink.bandwidth; i++) { \ |
| 1018 | + for (i = 0; i <= sta->bandwidth; i++) { \ |
| 1019 | phy.sgi |= gi << (i << (_he)); \ |
| 1020 | phy.he_ltf |= mask->control[band].he_ltf << (i << (_he));\ |
| 1021 | } \ |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1022 | @@ -1460,11 +1463,11 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1023 | } \ |
| 1024 | } while (0) |
| 1025 | |
| 1026 | - if (sta->deflink.he_cap.has_he) { |
| 1027 | + if (sta->he_cap.has_he) { |
| 1028 | __sta_phy_bitrate_mask_check(he_mcs, he_gi, 0, 1); |
| 1029 | - } else if (sta->deflink.vht_cap.vht_supported) { |
| 1030 | + } else if (sta->vht_cap.vht_supported) { |
| 1031 | __sta_phy_bitrate_mask_check(vht_mcs, gi, 0, 0); |
| 1032 | - } else if (sta->deflink.ht_cap.ht_supported) { |
| 1033 | + } else if (sta->ht_cap.ht_supported) { |
| 1034 | __sta_phy_bitrate_mask_check(ht_mcs, gi, 1, 0); |
| 1035 | } else { |
| 1036 | nrates = hweight32(mask->control[band].legacy); |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1037 | @@ -1498,7 +1501,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1038 | * actual txrate hardware sends out. |
| 1039 | */ |
| 1040 | addr = mt7915_mac_wtbl_lmac_addr(dev, msta->wcid.idx, 7); |
| 1041 | - if (sta->deflink.he_cap.has_he) |
| 1042 | + if (sta->he_cap.has_he) |
| 1043 | mt76_rmw_field(dev, addr, GENMASK(31, 24), phy.sgi); |
| 1044 | else |
| 1045 | mt76_rmw_field(dev, addr, GENMASK(15, 12), phy.sgi); |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1046 | @@ -1531,7 +1534,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1047 | enum nl80211_band band = chandef->chan->band; |
| 1048 | struct sta_rec_ra *ra; |
| 1049 | struct tlv *tlv; |
| 1050 | - u32 supp_rate = sta->deflink.supp_rates[band]; |
| 1051 | + u32 supp_rate = sta->supp_rates[band]; |
| 1052 | u32 cap = sta->wme ? STA_CAP_WMM : 0; |
| 1053 | |
| 1054 | tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra)); |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1055 | @@ -1541,9 +1544,9 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1056 | ra->auto_rate = true; |
| 1057 | ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, sta); |
| 1058 | ra->channel = chandef->chan->hw_value; |
| 1059 | - ra->bw = sta->deflink.bandwidth; |
| 1060 | - ra->phy.bw = sta->deflink.bandwidth; |
| 1061 | - ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->deflink.smps_mode); |
| 1062 | + ra->bw = sta->bandwidth; |
| 1063 | + ra->phy.bw = sta->bandwidth; |
| 1064 | + ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->smps_mode); |
| 1065 | |
| 1066 | if (supp_rate) { |
| 1067 | supp_rate &= mask->control[band].legacy; |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1068 | @@ -1563,22 +1566,22 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1069 | } |
| 1070 | } |
| 1071 | |
| 1072 | - if (sta->deflink.ht_cap.ht_supported) { |
| 1073 | + if (sta->ht_cap.ht_supported) { |
| 1074 | ra->supp_mode |= MODE_HT; |
| 1075 | - ra->af = sta->deflink.ht_cap.ampdu_factor; |
| 1076 | - ra->ht_gf = !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD); |
| 1077 | + ra->af = sta->ht_cap.ampdu_factor; |
| 1078 | + ra->ht_gf = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD); |
| 1079 | |
| 1080 | cap |= STA_CAP_HT; |
| 1081 | - if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20) |
| 1082 | + if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) |
| 1083 | cap |= STA_CAP_SGI_20; |
| 1084 | - if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40) |
| 1085 | + if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) |
| 1086 | cap |= STA_CAP_SGI_40; |
| 1087 | - if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_TX_STBC) |
| 1088 | + if (sta->ht_cap.cap & IEEE80211_HT_CAP_TX_STBC) |
| 1089 | cap |= STA_CAP_TX_STBC; |
| 1090 | - if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC) |
| 1091 | + if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC) |
| 1092 | cap |= STA_CAP_RX_STBC; |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1093 | - if (vif->bss_conf.ht_ldpc && |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1094 | - (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING)) |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1095 | + if (mvif->cap.ht_ldpc && |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1096 | + (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING)) |
| 1097 | cap |= STA_CAP_LDPC; |
| 1098 | |
| 1099 | mt7915_mcu_set_sta_ht_mcs(sta, ra->ht_mcs, |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1100 | @@ -1586,37 +1589,37 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1101 | ra->supp_ht_mcs = *(__le32 *)ra->ht_mcs; |
| 1102 | } |
| 1103 | |
| 1104 | - if (sta->deflink.vht_cap.vht_supported) { |
| 1105 | + if (sta->vht_cap.vht_supported) { |
| 1106 | u8 af; |
| 1107 | |
| 1108 | ra->supp_mode |= MODE_VHT; |
| 1109 | af = FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK, |
| 1110 | - sta->deflink.vht_cap.cap); |
| 1111 | + sta->vht_cap.cap); |
| 1112 | ra->af = max_t(u8, ra->af, af); |
| 1113 | |
| 1114 | cap |= STA_CAP_VHT; |
| 1115 | - if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80) |
| 1116 | + if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80) |
| 1117 | cap |= STA_CAP_VHT_SGI_80; |
| 1118 | - if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160) |
| 1119 | + if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160) |
| 1120 | cap |= STA_CAP_VHT_SGI_160; |
| 1121 | - if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC) |
| 1122 | + if (sta->vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC) |
| 1123 | cap |= STA_CAP_VHT_TX_STBC; |
| 1124 | - if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1) |
| 1125 | + if (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1) |
| 1126 | cap |= STA_CAP_VHT_RX_STBC; |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1127 | - if (vif->bss_conf.vht_ldpc && |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1128 | - (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC)) |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1129 | + if (mvif->cap.vht_ldpc && |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1130 | + (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC)) |
| 1131 | cap |= STA_CAP_VHT_LDPC; |
| 1132 | |
| 1133 | mt7915_mcu_set_sta_vht_mcs(sta, ra->supp_vht_mcs, |
| 1134 | mask->control[band].vht_mcs); |
| 1135 | } |
| 1136 | |
| 1137 | - if (sta->deflink.he_cap.has_he) { |
| 1138 | + if (sta->he_cap.has_he) { |
| 1139 | ra->supp_mode |= MODE_HE; |
| 1140 | cap |= STA_CAP_HE; |
| 1141 | |
| 1142 | - if (sta->deflink.he_6ghz_capa.capa) |
| 1143 | - ra->af = le16_get_bits(sta->deflink.he_6ghz_capa.capa, |
| 1144 | + if (sta->he_6ghz_capa.capa) |
| 1145 | + ra->af = le16_get_bits(sta->he_6ghz_capa.capa, |
| 1146 | IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP); |
| 1147 | } |
| 1148 | |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1149 | @@ -1825,7 +1828,7 @@ mt7915_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1150 | if (!offs->cntdwn_counter_offs[0]) |
| 1151 | return; |
| 1152 | |
| 1153 | - sub_tag = vif->bss_conf.csa_active ? BSS_INFO_BCN_CSA : BSS_INFO_BCN_BCC; |
| 1154 | + sub_tag = vif->csa_active ? BSS_INFO_BCN_CSA : BSS_INFO_BCN_BCC; |
| 1155 | tlv = mt7915_mcu_add_nested_subtlv(rskb, sub_tag, sizeof(*info), |
| 1156 | &bcn->sub_ntlv, &bcn->len); |
| 1157 | info = (struct bss_info_bcn_cntdwn *)tlv; |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1158 | @@ -1910,9 +1913,9 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1159 | if (offs->cntdwn_counter_offs[0]) { |
| 1160 | u16 offset = offs->cntdwn_counter_offs[0]; |
| 1161 | |
| 1162 | - if (vif->bss_conf.csa_active) |
| 1163 | + if (vif->csa_active) |
| 1164 | cont->csa_ofs = cpu_to_le16(offset - 4); |
| 1165 | - if (vif->bss_conf.color_change_active) |
| 1166 | + if (vif->color_change_active) |
| 1167 | cont->bcc_ofs = cpu_to_le16(offset - 3); |
| 1168 | } |
| 1169 | |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1170 | @@ -1922,6 +1925,85 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif, |
| 1171 | memcpy(buf + MT_TXD_SIZE, skb->data, skb->len); |
| 1172 | } |
| 1173 | |
| 1174 | +static void |
| 1175 | +mt7915_mcu_beacon_check_caps(struct mt7915_phy *phy, struct ieee80211_vif *vif, |
| 1176 | + struct sk_buff *skb) |
| 1177 | +{ |
| 1178 | + struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; |
| 1179 | + struct mt7915_vif_cap *vc = &mvif->cap; |
| 1180 | + const struct ieee80211_he_cap_elem *he; |
| 1181 | + const struct ieee80211_vht_cap *vht; |
| 1182 | + const struct ieee80211_ht_cap *ht; |
| 1183 | + struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; |
| 1184 | + const u8 *ie; |
| 1185 | + u32 len, bc; |
| 1186 | + |
| 1187 | + /* Check missing configuration options to allow AP mode in mac80211 |
| 1188 | + * to remain in sync with hostapd settings, and get a subset of |
| 1189 | + * beacon and hardware capabilities. |
| 1190 | + */ |
| 1191 | + if (WARN_ON_ONCE(skb->len <= (mgmt->u.beacon.variable - skb->data))) |
| 1192 | + return; |
| 1193 | + |
| 1194 | + memset(vc, 0, sizeof(*vc)); |
| 1195 | + |
| 1196 | + len = skb->len - (mgmt->u.beacon.variable - skb->data); |
| 1197 | + |
| 1198 | + ie = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, mgmt->u.beacon.variable, |
| 1199 | + len); |
| 1200 | + if (ie && ie[1] >= sizeof(*ht)) { |
| 1201 | + ht = (void *)(ie + 2); |
| 1202 | + vc->ht_ldpc = !!(le16_to_cpu(ht->cap_info) & |
| 1203 | + IEEE80211_HT_CAP_LDPC_CODING); |
| 1204 | + } |
| 1205 | + |
| 1206 | + ie = cfg80211_find_ie(WLAN_EID_VHT_CAPABILITY, mgmt->u.beacon.variable, |
| 1207 | + len); |
| 1208 | + if (ie && ie[1] >= sizeof(*vht)) { |
| 1209 | + u32 pc = phy->mt76->sband_5g.sband.vht_cap.cap; |
| 1210 | + |
| 1211 | + vht = (void *)(ie + 2); |
| 1212 | + bc = le32_to_cpu(vht->vht_cap_info); |
| 1213 | + |
| 1214 | + vc->vht_ldpc = !!(bc & IEEE80211_VHT_CAP_RXLDPC); |
| 1215 | + vc->vht_su_ebfer = |
| 1216 | + (bc & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE) && |
| 1217 | + (pc & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE); |
| 1218 | + vc->vht_su_ebfee = |
| 1219 | + (bc & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE) && |
| 1220 | + (pc & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE); |
| 1221 | + vc->vht_mu_ebfer = |
| 1222 | + (bc & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE) && |
| 1223 | + (pc & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE); |
| 1224 | + vc->vht_mu_ebfee = |
| 1225 | + (bc & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE) && |
| 1226 | + (pc & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE); |
| 1227 | + } |
| 1228 | + |
| 1229 | + ie = cfg80211_find_ext_ie(WLAN_EID_EXT_HE_CAPABILITY, |
| 1230 | + mgmt->u.beacon.variable, len); |
| 1231 | + if (ie && ie[1] >= sizeof(*he) + 1) { |
| 1232 | + const struct ieee80211_sta_he_cap *pc = |
| 1233 | + mt76_connac_get_he_phy_cap(phy->mt76, vif); |
| 1234 | + const struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem; |
| 1235 | + |
| 1236 | + he = (void *)(ie + 3); |
| 1237 | + |
| 1238 | + vc->he_ldpc = |
| 1239 | + HE_PHY(CAP1_LDPC_CODING_IN_PAYLOAD, he->phy_cap_info[1]) && |
| 1240 | + HE_PHY(CAP1_LDPC_CODING_IN_PAYLOAD, pe->phy_cap_info[1]); |
| 1241 | + vc->he_su_ebfer = |
| 1242 | + HE_PHY(CAP3_SU_BEAMFORMER, he->phy_cap_info[3]) && |
| 1243 | + HE_PHY(CAP3_SU_BEAMFORMER, pe->phy_cap_info[3]); |
| 1244 | + vc->he_su_ebfee = |
| 1245 | + HE_PHY(CAP4_SU_BEAMFORMEE, he->phy_cap_info[4]) && |
| 1246 | + HE_PHY(CAP4_SU_BEAMFORMEE, pe->phy_cap_info[4]); |
| 1247 | + vc->he_mu_ebfer = |
| 1248 | + HE_PHY(CAP4_MU_BEAMFORMER, he->phy_cap_info[4]) && |
| 1249 | + HE_PHY(CAP4_MU_BEAMFORMER, pe->phy_cap_info[4]); |
| 1250 | + } |
| 1251 | +} |
| 1252 | + |
| 1253 | int |
| 1254 | mt7915_mcu_add_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vif, |
| 1255 | u32 changed) |
| 1256 | @@ -2033,7 +2115,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1257 | if (!en) |
| 1258 | goto out; |
| 1259 | |
| 1260 | - skb = ieee80211_beacon_get_template(hw, vif, &offs, 0); |
| 1261 | + skb = ieee80211_beacon_get_template(hw, vif, &offs); |
| 1262 | if (!skb) |
| 1263 | return -EINVAL; |
| 1264 | |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1265 | @@ -2046,6 +2128,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 1266 | info = IEEE80211_SKB_CB(skb); |
| 1267 | info->hw_queue = FIELD_PREP(MT_TX_HW_QUEUE_PHY, ext_phy); |
| 1268 | |
| 1269 | + mt7915_mcu_beacon_check_caps(phy, vif, skb); |
| 1270 | mt7915_mcu_beacon_cntdwn(vif, rskb, skb, bcn, &offs); |
| 1271 | mt7915_mcu_beacon_mbss(rskb, skb, vif, bcn, &offs); |
| 1272 | mt7915_mcu_beacon_cont(dev, vif, rskb, skb, bcn, &offs); |
| 1273 | @@ -3283,17 +3366,17 @@ int mt7915_mcu_set_txpower_frame(struct mt7915_phy *phy, |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1274 | if (txpower) { |
| 1275 | u32 offs, len, i; |
| 1276 | |
| 1277 | - if (sta->deflink.ht_cap.ht_supported) { |
| 1278 | + if (sta->ht_cap.ht_supported) { |
| 1279 | const u8 *sku_len = mt7915_sku_group_len; |
| 1280 | |
| 1281 | offs = sku_len[SKU_CCK] + sku_len[SKU_OFDM]; |
| 1282 | len = sku_len[SKU_HT_BW20] + sku_len[SKU_HT_BW40]; |
| 1283 | |
| 1284 | - if (sta->deflink.vht_cap.vht_supported) { |
| 1285 | + if (sta->vht_cap.vht_supported) { |
| 1286 | offs += len; |
| 1287 | len = sku_len[SKU_VHT_BW20] * 4; |
| 1288 | |
| 1289 | - if (sta->deflink.he_cap.has_he) { |
| 1290 | + if (sta->he_cap.has_he) { |
| 1291 | offs += len + sku_len[SKU_HE_RU26] * 3; |
| 1292 | len = sku_len[SKU_HE_RU242] * 4; |
| 1293 | } |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1294 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
| 1295 | index 52cf748..fcd10b3 100644 |
| 1296 | --- a/mt7915/mt7915.h |
| 1297 | +++ b/mt7915/mt7915.h |
| 1298 | @@ -212,9 +212,23 @@ struct mt7915_sta { |
| 1299 | struct mt7915_vow_sta_cfg vow_sta_cfg; |
| 1300 | }; |
| 1301 | |
| 1302 | +struct mt7915_vif_cap { |
| 1303 | + bool ht_ldpc:1; |
| 1304 | + bool vht_ldpc:1; |
| 1305 | + bool he_ldpc:1; |
| 1306 | + bool vht_su_ebfer:1; |
| 1307 | + bool vht_su_ebfee:1; |
| 1308 | + bool vht_mu_ebfer:1; |
| 1309 | + bool vht_mu_ebfee:1; |
| 1310 | + bool he_su_ebfer:1; |
| 1311 | + bool he_su_ebfee:1; |
| 1312 | + bool he_mu_ebfer:1; |
| 1313 | +}; |
| 1314 | + |
| 1315 | struct mt7915_vif { |
| 1316 | struct mt76_vif mt76; /* must be first */ |
| 1317 | |
| 1318 | + struct mt7915_vif_cap cap; |
| 1319 | struct mt7915_sta sta; |
| 1320 | struct mt7915_phy *phy; |
| 1321 | |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1322 | diff --git a/mt7915/testmode.c b/mt7915/testmode.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1323 | index b99bed5..8b9813b 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1324 | --- a/mt7915/testmode.c |
| 1325 | +++ b/mt7915/testmode.c |
| 1326 | @@ -397,12 +397,12 @@ mt7915_tm_entry_add(struct mt7915_phy *phy, u8 aid) |
| 1327 | memcpy(sta->addr, td->addr[0], ETH_ALEN); |
| 1328 | |
| 1329 | if (td->tx_rate_mode >= MT76_TM_TX_MODE_HT) |
| 1330 | - memcpy(&sta->deflink.ht_cap, &sband->ht_cap, sizeof(sta->deflink.ht_cap)); |
| 1331 | + memcpy(&sta->ht_cap, &sband->ht_cap, sizeof(sta->ht_cap)); |
| 1332 | if (td->tx_rate_mode >= MT76_TM_TX_MODE_VHT) |
| 1333 | - memcpy(&sta->deflink.vht_cap, &sband->vht_cap, sizeof(sta->deflink.vht_cap)); |
| 1334 | + memcpy(&sta->vht_cap, &sband->vht_cap, sizeof(sta->vht_cap)); |
| 1335 | if (td->tx_rate_mode >= MT76_TM_TX_MODE_HE_SU) |
| 1336 | - memcpy(&sta->deflink.he_cap, &sdata[NL80211_IFTYPE_STATION].he_cap, |
| 1337 | - sizeof(sta->deflink.he_cap)); |
| 1338 | + memcpy(&sta->he_cap, &sdata[NL80211_IFTYPE_STATION].he_cap, |
| 1339 | + sizeof(sta->he_cap)); |
| 1340 | sta->aid = aid; |
| 1341 | sta->wme = 1; |
| 1342 | |
| 1343 | diff --git a/tx.c b/tx.c |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1344 | index 335ddb5..445469e 100644 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1345 | --- a/tx.c |
| 1346 | +++ b/tx.c |
| 1347 | @@ -60,20 +60,15 @@ mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list) |
| 1348 | .skb = skb, |
| 1349 | .info = IEEE80211_SKB_CB(skb), |
| 1350 | }; |
| 1351 | - struct ieee80211_rate_status rs = {}; |
| 1352 | struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb); |
| 1353 | struct mt76_wcid *wcid; |
| 1354 | |
| 1355 | wcid = rcu_dereference(dev->wcid[cb->wcid]); |
| 1356 | if (wcid) { |
| 1357 | status.sta = wcid_to_sta(wcid); |
| 1358 | - if (status.sta && (wcid->rate.flags || wcid->rate.legacy)) { |
| 1359 | - rs.rate_idx = wcid->rate; |
| 1360 | - status.rates = &rs; |
| 1361 | - status.n_rates = 1; |
| 1362 | - } else { |
| 1363 | - status.n_rates = 0; |
| 1364 | - } |
| 1365 | + |
| 1366 | + if (status.sta) |
| 1367 | + status.rate = &wcid->rate; |
| 1368 | } |
| 1369 | |
| 1370 | hw = mt76_tx_status_get_hw(dev, skb); |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1371 | @@ -238,6 +233,7 @@ mt76_tx_check_non_aql(struct mt76_dev *dev, struct mt76_wcid *wcid, |
developer | 22eedcc | 2023-05-03 22:59:35 +0800 | [diff] [blame] | 1372 | void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *skb, |
| 1373 | struct list_head *free_list) |
| 1374 | { |
| 1375 | + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
| 1376 | struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb); |
| 1377 | struct ieee80211_tx_status status = { |
| 1378 | .skb = skb, |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1379 | @@ -268,21 +264,13 @@ void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff * |
developer | 22eedcc | 2023-05-03 22:59:35 +0800 | [diff] [blame] | 1380 | #endif |
| 1381 | |
| 1382 | if (cb->pktid < MT_PACKET_ID_FIRST) { |
| 1383 | - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
| 1384 | - struct ieee80211_rate_status rs = {}; |
| 1385 | - |
| 1386 | hw = mt76_tx_status_get_hw(dev, skb); |
| 1387 | status.sta = wcid_to_sta(wcid); |
| 1388 | if (mtk_wed_device_active(&dev->mmio.wed) && |
| 1389 | (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) { |
| 1390 | - info->status.rates[0].idx = -1; |
| 1391 | - |
| 1392 | - if (status.sta && (wcid->rate.flags || wcid->rate.legacy)) { |
| 1393 | - rs.rate_idx = wcid->rate; |
| 1394 | - status.rates = &rs; |
| 1395 | - status.n_rates = 1; |
| 1396 | - } else { |
| 1397 | - status.n_rates = 0; |
| 1398 | + if (status.sta) { |
| 1399 | + info->status.rates[0].idx = -1; |
| 1400 | + status.rate = &wcid->rate; |
| 1401 | } |
| 1402 | } |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 1403 | spin_lock_bh(&dev->rx_lock); |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1404 | -- |
developer | 5bea732 | 2023-04-13 18:50:55 +0800 | [diff] [blame] | 1405 | 2.18.0 |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 1406 | |