blob: ce5c2912df5571002385083f3796e367ae188ef6 [file] [log] [blame]
developerd8ca5d32023-08-30 19:05:17 +08001From 9074d9a81a1f1af34fbab064d6dca3ac1b1cd2e3 Mon Sep 17 00:00:00 2001
developer6100db22023-04-05 13:22:26 +08002From: Evelyn Tsai <evelyn.tsai@mediatek.com>
3Date: Wed, 5 Apr 2023 08:29:19 +0800
developer23d6e272023-08-28 11:10:51 +08004Subject: [PATCH] mt76: revert for backports-5.15 wireless stack
developer6100db22023-04-05 13:22:26 +08005
developerbbd45e12023-05-19 08:22:06 +08006wifi: mt76: mt7915: add support for he ldpc control from hostapd
developer6100db22023-04-05 13:22:26 +08007---
8 dma.c | 2 +-
9 mac80211.c | 4 +-
10 mt7615/dma.c | 4 +-
11 mt7615/main.c | 6 +-
developerbbd45e12023-05-19 08:22:06 +080012 mt7615/mcu.c | 8 +-
developer2157bf82023-06-26 02:27:49 +080013 mt76_connac_mac.c | 2 +-
developerd8ca5d32023-08-30 19:05:17 +080014 mt76_connac_mcu.c | 110 ++++++++++-----------
developer6100db22023-04-05 13:22:26 +080015 mt76x02_mac.c | 6 +-
16 mt7915/debugfs.c | 4 +-
17 mt7915/dma.c | 4 +-
18 mt7915/init.c | 3 +-
developerc1571f92023-07-04 22:11:24 +080019 mt7915/main.c | 36 ++-----
20 mt7915/mcu.c | 246 ++++++++++++++++++++++++++++++----------------
developer2157bf82023-06-26 02:27:49 +080021 mt7915/mmio.c | 2 +-
developerbbd45e12023-05-19 08:22:06 +080022 mt7915/testmode.c | 8 +-
developerc1571f92023-07-04 22:11:24 +080023 tx.c | 22 ++---
developerd8ca5d32023-08-30 19:05:17 +080024 16 files changed, 257 insertions(+), 210 deletions(-)
developer6100db22023-04-05 13:22:26 +080025
26diff --git a/dma.c b/dma.c
developer849549c2023-08-02 17:26:48 +080027index 4daa64da..220e684a 100644
developer6100db22023-04-05 13:22:26 +080028--- a/dma.c
29+++ b/dma.c
developerbbd45e12023-05-19 08:22:06 +080030@@ -994,7 +994,7 @@ mt76_dma_init(struct mt76_dev *dev,
developer6100db22023-04-05 13:22:26 +080031 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 }
39diff --git a/mac80211.c b/mac80211.c
developer849549c2023-08-02 17:26:48 +080040index 35cd297c..629770c0 100644
developer6100db22023-04-05 13:22:26 +080041--- a/mac80211.c
42+++ b/mac80211.c
developer2157bf82023-06-26 02:27:49 +080043@@ -1521,7 +1521,7 @@ EXPORT_SYMBOL_GPL(mt76_get_sar_power);
developer6100db22023-04-05 13:22:26 +080044 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
developer2157bf82023-06-26 02:27:49 +080052@@ -1543,7 +1543,7 @@ __mt76_csa_check(void *priv, u8 *mac, struct ieee80211_vif *vif)
developer6100db22023-04-05 13:22:26 +080053 {
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);
61diff --git a/mt7615/dma.c b/mt7615/dma.c
developer849549c2023-08-02 17:26:48 +080062index 0ce01ccc..ad324850 100644
developer6100db22023-04-05 13:22:26 +080063--- a/mt7615/dma.c
64+++ b/mt7615/dma.c
developerbbd45e12023-05-19 08:22:06 +080065@@ -282,8 +282,8 @@ int mt7615_dma_init(struct mt7615_dev *dev)
developer6100db22023-04-05 13:22:26 +080066 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,
76diff --git a/mt7615/main.c b/mt7615/main.c
developer849549c2023-08-02 17:26:48 +080077index 200b1752..53f30a0f 100644
developer6100db22023-04-05 13:22:26 +080078--- a/mt7615/main.c
79+++ b/mt7615/main.c
developer22eedcc2023-05-03 22:59:35 +080080@@ -473,7 +473,7 @@ static int mt7615_config(struct ieee80211_hw *hw, u32 changed)
developer6100db22023-04-05 13:22:26 +080081
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;
developer2157bf82023-06-26 02:27:49 +080089@@ -581,7 +581,7 @@ mt7615_update_mu_group(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +080090 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);
developer2157bf82023-06-26 02:27:49 +080098@@ -624,7 +624,7 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
developer6100db22023-04-05 13:22:26 +080099 }
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
developer2157bf82023-06-26 02:27:49 +0800105 if (changed & BSS_CHANGED_MU_GROUPS)
106 mt7615_update_mu_group(hw, vif, info);
developer6100db22023-04-05 13:22:26 +0800107diff --git a/mt7615/mcu.c b/mt7615/mcu.c
developer849549c2023-08-02 17:26:48 +0800108index 86061e95..a79308b6 100644
developer6100db22023-04-05 13:22:26 +0800109--- 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
developerbbd45e12023-05-19 08:22:06 +0800129@@ -1075,7 +1075,7 @@ mt7615_mcu_uni_add_beacon_offload(struct mt7615_dev *dev,
developer6100db22023-04-05 13:22:26 +0800130 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
developerbbd45e12023-05-19 08:22:06 +0800138@@ -2526,7 +2526,7 @@ int mt7615_mcu_set_bss_pm(struct mt7615_dev *dev, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800139 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 };
developer2157bf82023-06-26 02:27:49 +0800147diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
developer23d6e272023-08-28 11:10:51 +0800148index b87b7335..08a92ace 100644
developer2157bf82023-06-26 02:27:49 +0800149--- a/mt76_connac_mac.c
150+++ b/mt76_connac_mac.c
developer8f0d89b2023-07-28 07:16:44 +0800151@@ -1122,7 +1122,7 @@ void mt76_connac2_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
developer2157bf82023-06-26 02:27:49 +0800152 u32 val;
153
154 if (!sta ||
155- !(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
156+ !(sta->ht_cap.ht_supported || sta->he_cap.has_he))
157 return;
158
159 tid = le32_get_bits(txwi[1], MT_TXD1_TID);
developer6100db22023-04-05 13:22:26 +0800160diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
developerd8ca5d32023-08-30 19:05:17 +0800161index bf9d27ab..263efb3a 100644
developer6100db22023-04-05 13:22:26 +0800162--- a/mt76_connac_mcu.c
163+++ b/mt76_connac_mcu.c
164@@ -197,7 +197,7 @@ int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif)
165 */
166 } req = {
167 .bss_idx = mvif->idx,
168- .ps_state = vif->cfg.ps ? 2 : 0,
169+ .ps_state = vif->bss_conf.ps ? 2 : 0,
170 };
171
172 if (vif->type != NL80211_IFTYPE_STATION)
developerd8ca5d32023-08-30 19:05:17 +0800173@@ -392,7 +392,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
174 if (vif->type == NL80211_IFTYPE_STATION &&
175 !is_zero_ether_addr(vif->bss_conf.bssid)) {
176 memcpy(basic->peer_addr, vif->bss_conf.bssid, ETH_ALEN);
177- basic->aid = cpu_to_le16(vif->cfg.aid);
178+ basic->aid = cpu_to_le16(vif->bss_conf.aid);
179 } else {
180 eth_broadcast_addr(basic->peer_addr);
181 }
182@@ -416,7 +416,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800183 else
184 conn_type = CONNECTION_INFRA_AP;
185 basic->conn_type = cpu_to_le32(conn_type);
186- basic->aid = cpu_to_le16(vif->cfg.aid);
187+ basic->aid = cpu_to_le16(vif->bss_conf.aid);
188 break;
189 case NL80211_IFTYPE_ADHOC:
190 basic->conn_type = cpu_to_le32(CONNECTION_IBSS_ADHOC);
developerd8ca5d32023-08-30 19:05:17 +0800191@@ -560,7 +560,7 @@ void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev,
developer6100db22023-04-05 13:22:26 +0800192
193 if (sta) {
194 if (vif->type == NL80211_IFTYPE_STATION)
195- generic->partial_aid = cpu_to_le16(vif->cfg.aid);
196+ generic->partial_aid = cpu_to_le16(vif->bss_conf.aid);
197 else
198 generic->partial_aid = cpu_to_le16(sta->aid);
199 memcpy(generic->peer_addr, sta->addr, ETH_ALEN);
developerd8ca5d32023-08-30 19:05:17 +0800200@@ -609,14 +609,14 @@ mt76_connac_mcu_sta_amsdu_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
developer6100db22023-04-05 13:22:26 +0800201 vif->type != NL80211_IFTYPE_STATION)
202 return;
203
204- if (!sta->deflink.agg.max_amsdu_len)
205+ if (!sta->max_amsdu_len)
206 return;
207
208 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu));
209 amsdu = (struct sta_rec_amsdu *)tlv;
210 amsdu->max_amsdu_num = 8;
211 amsdu->amsdu_en = true;
212- amsdu->max_mpdu_size = sta->deflink.agg.max_amsdu_len >=
213+ amsdu->max_mpdu_size = sta->max_amsdu_len >=
214 IEEE80211_MAX_MPDU_LEN_VHT_7991;
215
216 wcid->amsdu = true;
developerd8ca5d32023-08-30 19:05:17 +0800217@@ -627,7 +627,7 @@ mt76_connac_mcu_sta_amsdu_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
developer6100db22023-04-05 13:22:26 +0800218 static void
219 mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
220 {
221- struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap;
222+ struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
223 struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem;
224 struct sta_rec_he *he;
225 struct tlv *tlv;
developerd8ca5d32023-08-30 19:05:17 +0800226@@ -715,7 +715,7 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
developer6100db22023-04-05 13:22:26 +0800227
228 he->he_cap = cpu_to_le32(cap);
229
230- switch (sta->deflink.bandwidth) {
231+ switch (sta->bandwidth) {
232 case IEEE80211_STA_RX_BW_160:
233 if (elem->phy_cap_info[0] &
234 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
developerd8ca5d32023-08-30 19:05:17 +0800235@@ -760,7 +760,7 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
developer6100db22023-04-05 13:22:26 +0800236 static void
237 mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
238 {
239- struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap;
240+ struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
241 struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem;
242 struct sta_rec_he_v2 *he;
243 struct tlv *tlv;
developerd8ca5d32023-08-30 19:05:17 +0800244@@ -771,7 +771,7 @@ mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
developer6100db22023-04-05 13:22:26 +0800245 memcpy(he->he_phy_cap, elem->phy_cap_info, sizeof(he->he_phy_cap));
246 memcpy(he->he_mac_cap, elem->mac_cap_info, sizeof(he->he_mac_cap));
247
248- switch (sta->deflink.bandwidth) {
249+ switch (sta->bandwidth) {
250 case IEEE80211_STA_RX_BW_160:
251 if (elem->phy_cap_info[0] &
252 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
developerd8ca5d32023-08-30 19:05:17 +0800253@@ -787,7 +787,7 @@ mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
developer6100db22023-04-05 13:22:26 +0800254 break;
255 }
256
257- he->pkt_ext = IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US;
258+ he->pkt_ext = IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US;
259 }
260
261 static u8
developerd8ca5d32023-08-30 19:05:17 +0800262@@ -800,9 +800,9 @@ mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800263 u8 mode = 0;
264
265 if (sta) {
266- ht_cap = &sta->deflink.ht_cap;
267- vht_cap = &sta->deflink.vht_cap;
268- he_cap = &sta->deflink.he_cap;
269+ ht_cap = &sta->ht_cap;
270+ vht_cap = &sta->vht_cap;
271+ he_cap = &sta->he_cap;
272 } else {
273 struct ieee80211_supported_band *sband;
274
developerd8ca5d32023-08-30 19:05:17 +0800275@@ -851,25 +851,25 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800276 u16 supp_rates;
277
278 /* starec ht */
279- if (sta->deflink.ht_cap.ht_supported) {
280+ if (sta->ht_cap.ht_supported) {
281 struct sta_rec_ht *ht;
282
283 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht));
284 ht = (struct sta_rec_ht *)tlv;
285- ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap);
286+ ht->ht_cap = cpu_to_le16(sta->ht_cap.cap);
287 }
288
289 /* starec vht */
290- if (sta->deflink.vht_cap.vht_supported) {
291+ if (sta->vht_cap.vht_supported) {
292 struct sta_rec_vht *vht;
293 int len;
294
295 len = is_mt7921(dev) ? sizeof(*vht) : sizeof(*vht) - 4;
296 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, len);
297 vht = (struct sta_rec_vht *)tlv;
298- vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap);
299- vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map;
300- vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map;
301+ vht->vht_cap = cpu_to_le32(sta->vht_cap.cap);
302+ vht->vht_rx_mcs_map = sta->vht_cap.vht_mcs.rx_mcs_map;
303+ vht->vht_tx_mcs_map = sta->vht_cap.vht_mcs.tx_mcs_map;
304 }
305
306 /* starec uapsd */
developerd8ca5d32023-08-30 19:05:17 +0800307@@ -878,11 +878,11 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800308 if (!is_mt7921(dev))
309 return;
310
311- if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he)
312+ if (sta->ht_cap.ht_supported || sta->he_cap.has_he)
313 mt76_connac_mcu_sta_amsdu_tlv(skb, sta, vif);
314
315 /* starec he */
316- if (sta->deflink.he_cap.has_he) {
317+ if (sta->he_cap.has_he) {
318 mt76_connac_mcu_sta_he_tlv(skb, sta);
319 mt76_connac_mcu_sta_he_tlv_v2(skb, sta);
320 if (band == NL80211_BAND_6GHZ &&
developerd8ca5d32023-08-30 19:05:17 +0800321@@ -892,7 +892,7 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800322 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE_6G,
323 sizeof(*he_6g_capa));
324 he_6g_capa = (struct sta_rec_he_6g_capa *)tlv;
325- he_6g_capa->capa = sta->deflink.he_6ghz_capa.capa;
326+ he_6g_capa->capa = sta->he_6ghz_capa.capa;
327 }
328 }
329
developerd8ca5d32023-08-30 19:05:17 +0800330@@ -902,14 +902,14 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800331 phy->basic_rate = cpu_to_le16((u16)vif->bss_conf.basic_rates);
332 phy->rcpi = rcpi;
333 phy->ampdu = FIELD_PREP(IEEE80211_HT_AMPDU_PARM_FACTOR,
334- sta->deflink.ht_cap.ampdu_factor) |
335+ sta->ht_cap.ampdu_factor) |
336 FIELD_PREP(IEEE80211_HT_AMPDU_PARM_DENSITY,
337- sta->deflink.ht_cap.ampdu_density);
338+ sta->ht_cap.ampdu_density);
339
340 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra_info));
341 ra_info = (struct sta_rec_ra_info *)tlv;
342
343- supp_rates = sta->deflink.supp_rates[band];
344+ supp_rates = sta->supp_rates[band];
345 if (band == NL80211_BAND_2GHZ)
346 supp_rates = FIELD_PREP(RA_LEGACY_OFDM, supp_rates >> 4) |
347 FIELD_PREP(RA_LEGACY_CCK, supp_rates & 0xf);
developerd8ca5d32023-08-30 19:05:17 +0800348@@ -918,18 +918,18 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800349
350 ra_info->legacy = cpu_to_le16(supp_rates);
351
352- if (sta->deflink.ht_cap.ht_supported)
353+ if (sta->ht_cap.ht_supported)
354 memcpy(ra_info->rx_mcs_bitmask,
355- sta->deflink.ht_cap.mcs.rx_mask,
356+ sta->ht_cap.mcs.rx_mask,
357 HT_MCS_MASK_NUM);
358
359 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_STATE, sizeof(*state));
360 state = (struct sta_rec_state *)tlv;
361 state->state = sta_state;
362
363- if (sta->deflink.vht_cap.vht_supported) {
364- state->vht_opmode = sta->deflink.bandwidth;
365- state->vht_opmode |= (sta->deflink.rx_nss - 1) <<
366+ if (sta->vht_cap.vht_supported) {
367+ state->vht_opmode = sta->bandwidth;
368+ state->vht_opmode |= (sta->rx_nss - 1) <<
369 IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT;
370 }
371 }
developerd8ca5d32023-08-30 19:05:17 +0800372@@ -945,7 +945,7 @@ void mt76_connac_mcu_wtbl_smps_tlv(struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800373 tlv = mt76_connac_mcu_add_nested_tlv(skb, WTBL_SMPS, sizeof(*smps),
374 wtbl_tlv, sta_wtbl);
375 smps = (struct wtbl_smps *)tlv;
376- smps->smps = (sta->deflink.smps_mode == IEEE80211_SMPS_DYNAMIC);
377+ smps->smps = (sta->smps_mode == IEEE80211_SMPS_DYNAMIC);
378 }
379 EXPORT_SYMBOL_GPL(mt76_connac_mcu_wtbl_smps_tlv);
380
developerd8ca5d32023-08-30 19:05:17 +0800381@@ -957,27 +957,27 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800382 struct tlv *tlv;
383 u32 flags = 0;
384
385- if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_6ghz_capa.capa) {
386+ if (sta->ht_cap.ht_supported || sta->he_6ghz_capa.capa) {
387 tlv = mt76_connac_mcu_add_nested_tlv(skb, WTBL_HT, sizeof(*ht),
388 wtbl_tlv, sta_wtbl);
389 ht = (struct wtbl_ht *)tlv;
390 ht->ldpc = ht_ldpc &&
391- !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING);
392+ !!(sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING);
393
394- if (sta->deflink.ht_cap.ht_supported) {
395- ht->af = sta->deflink.ht_cap.ampdu_factor;
396- ht->mm = sta->deflink.ht_cap.ampdu_density;
397+ if (sta->ht_cap.ht_supported) {
398+ ht->af = sta->ht_cap.ampdu_factor;
399+ ht->mm = sta->ht_cap.ampdu_density;
400 } else {
401- ht->af = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
402+ ht->af = le16_get_bits(sta->he_6ghz_capa.capa,
403 IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP);
404- ht->mm = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
405+ ht->mm = le16_get_bits(sta->he_6ghz_capa.capa,
406 IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START);
407 }
408
409 ht->ht = true;
410 }
411
412- if (sta->deflink.vht_cap.vht_supported || sta->deflink.he_6ghz_capa.capa) {
413+ if (sta->vht_cap.vht_supported || sta->he_6ghz_capa.capa) {
414 struct wtbl_vht *vht;
415 u8 af;
416
developerd8ca5d32023-08-30 19:05:17 +0800417@@ -986,18 +986,18 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800418 sta_wtbl);
419 vht = (struct wtbl_vht *)tlv;
420 vht->ldpc = vht_ldpc &&
421- !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC);
422+ !!(sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC);
423 vht->vht = true;
424
425 af = FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK,
426- sta->deflink.vht_cap.cap);
427+ sta->vht_cap.cap);
428 if (ht)
429 ht->af = max(ht->af, af);
430 }
431
432 mt76_connac_mcu_wtbl_smps_tlv(skb, sta, sta_wtbl, wtbl_tlv);
433
434- if (is_connac_v1(dev) && sta->deflink.ht_cap.ht_supported) {
435+ if (is_connac_v1(dev) && sta->ht_cap.ht_supported) {
436 /* sgi */
437 u32 msk = MT_WTBL_W5_SHORT_GI_20 | MT_WTBL_W5_SHORT_GI_40 |
438 MT_WTBL_W5_SHORT_GI_80 | MT_WTBL_W5_SHORT_GI_160;
developerd8ca5d32023-08-30 19:05:17 +0800439@@ -1007,15 +1007,15 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800440 sizeof(*raw), wtbl_tlv,
441 sta_wtbl);
442
443- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
444+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
445 flags |= MT_WTBL_W5_SHORT_GI_20;
446- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
447+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
448 flags |= MT_WTBL_W5_SHORT_GI_40;
449
450- if (sta->deflink.vht_cap.vht_supported) {
451- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
452+ if (sta->vht_cap.vht_supported) {
453+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
454 flags |= MT_WTBL_W5_SHORT_GI_80;
455- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
456+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
457 flags |= MT_WTBL_W5_SHORT_GI_160;
458 }
459 raw = (struct wtbl_raw *)tlv;
developerd8ca5d32023-08-30 19:05:17 +0800460@@ -1304,9 +1304,9 @@ u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800461 return 0x38;
462
463 if (sta) {
464- ht_cap = &sta->deflink.ht_cap;
465- vht_cap = &sta->deflink.vht_cap;
466- he_cap = &sta->deflink.he_cap;
467+ ht_cap = &sta->ht_cap;
468+ vht_cap = &sta->vht_cap;
469+ he_cap = &sta->he_cap;
470 } else {
471 struct ieee80211_supported_band *sband;
472
developerd8ca5d32023-08-30 19:05:17 +0800473@@ -1626,7 +1626,6 @@ int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800474 for (i = 0; i < sreq->n_ssids; i++) {
475 if (!sreq->ssids[i].ssid_len)
476 continue;
477-
478 req->ssids[i].ssid_len = cpu_to_le32(sreq->ssids[i].ssid_len);
479 memcpy(req->ssids[i].ssid, sreq->ssids[i].ssid,
480 sreq->ssids[i].ssid_len);
developerd8ca5d32023-08-30 19:05:17 +0800481@@ -1766,7 +1765,6 @@ int mt76_connac_mcu_sched_scan_req(struct mt76_phy *phy,
developer6100db22023-04-05 13:22:26 +0800482 memcpy(req->ssids[i].ssid, ssid->ssid, ssid->ssid_len);
483 req->ssids[i].ssid_len = cpu_to_le32(ssid->ssid_len);
484 }
485-
486 req->match_num = sreq->n_match_sets;
487 for (i = 0; i < req->match_num; i++) {
488 match = &sreq->match_sets[i];
developerd8ca5d32023-08-30 19:05:17 +0800489@@ -2253,10 +2251,8 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev,
developer6100db22023-04-05 13:22:26 +0800490 struct mt76_vif *vif,
491 struct ieee80211_bss_conf *info)
492 {
493- struct ieee80211_vif *mvif = container_of(info, struct ieee80211_vif,
494- bss_conf);
495 struct sk_buff *skb;
496- int i, len = min_t(int, mvif->cfg.arp_addr_cnt,
497+ int i, len = min_t(int, info->arp_addr_cnt,
498 IEEE80211_BSS_ARP_ADDR_LIST_LEN);
499 struct {
500 struct {
developerd8ca5d32023-08-30 19:05:17 +0800501@@ -2284,7 +2280,7 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev,
developer6100db22023-04-05 13:22:26 +0800502
503 skb_put_data(skb, &req_hdr, sizeof(req_hdr));
504 for (i = 0; i < len; i++)
505- skb_put_data(skb, &mvif->cfg.arp_addr_list[i], sizeof(__be32));
506+ skb_put_data(skb, &info->arp_addr_list[i], sizeof(__be32));
507
508 return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD(OFFLOAD), true);
509 }
510diff --git a/mt76x02_mac.c b/mt76x02_mac.c
developer849549c2023-08-02 17:26:48 +0800511index d5db6ffd..fec3d10d 100644
developer6100db22023-04-05 13:22:26 +0800512--- a/mt76x02_mac.c
513+++ b/mt76x02_mac.c
514@@ -404,7 +404,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
515 txwi->rate |= cpu_to_le16(MT_RXWI_RATE_LDPC);
516 if ((info->flags & IEEE80211_TX_CTL_STBC) && nss == 1)
517 txwi->rate |= cpu_to_le16(MT_RXWI_RATE_STBC);
518- if (nss > 1 && sta && sta->deflink.smps_mode == IEEE80211_SMPS_DYNAMIC)
519+ if (nss > 1 && sta && sta->smps_mode == IEEE80211_SMPS_DYNAMIC)
520 txwi_flags |= MT_TXWI_FLAGS_MMPS;
521 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
522 txwi->ack_ctl |= MT_TXWI_ACK_CTL_REQ;
523@@ -412,9 +412,9 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
524 txwi->ack_ctl |= MT_TXWI_ACK_CTL_NSEQ;
525 if ((info->flags & IEEE80211_TX_CTL_AMPDU) && sta) {
526 u8 ba_size = IEEE80211_MIN_AMPDU_BUF;
527- u8 ampdu_density = sta->deflink.ht_cap.ampdu_density;
528+ u8 ampdu_density = sta->ht_cap.ampdu_density;
529
530- ba_size <<= sta->deflink.ht_cap.ampdu_factor;
531+ ba_size <<= sta->ht_cap.ampdu_factor;
532 ba_size = min_t(int, 63, ba_size - 1);
533 if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
534 ba_size = 0;
535diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
developer23d6e272023-08-28 11:10:51 +0800536index fefa4540..848ba4ee 100644
developer6100db22023-04-05 13:22:26 +0800537--- a/mt7915/debugfs.c
538+++ b/mt7915/debugfs.c
developer23d6e272023-08-28 11:10:51 +0800539@@ -2045,8 +2045,8 @@ static ssize_t mt7915_sta_fixed_rate_set(struct file *file,
developer6100db22023-04-05 13:22:26 +0800540
541 phy.ldpc = (phy.bw || phy.ldpc) * GENMASK(2, 0);
542 for (i = 0; i <= phy.bw; i++) {
543- phy.sgi |= gi << (i << sta->deflink.he_cap.has_he);
544- phy.he_ltf |= he_ltf << (i << sta->deflink.he_cap.has_he);
545+ phy.sgi |= gi << (i << sta->he_cap.has_he);
546+ phy.he_ltf |= he_ltf << (i << sta->he_cap.has_he);
547 }
548 field = RATE_PARAM_FIXED;
549
550diff --git a/mt7915/dma.c b/mt7915/dma.c
developer849549c2023-08-02 17:26:48 +0800551index f71ec55b..b4e231b7 100644
developer6100db22023-04-05 13:22:26 +0800552--- a/mt7915/dma.c
553+++ b/mt7915/dma.c
developer2324aa22023-04-12 11:30:15 +0800554@@ -590,8 +590,8 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
developer6100db22023-04-05 13:22:26 +0800555 if (ret < 0)
556 return ret;
557
558- netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
559- mt7915_poll_tx);
560+ netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
561+ mt7915_poll_tx, NAPI_POLL_WEIGHT);
562 napi_enable(&dev->mt76.tx_napi);
563
developer2324aa22023-04-12 11:30:15 +0800564 mt7915_dma_enable(dev, false);
developer6100db22023-04-05 13:22:26 +0800565diff --git a/mt7915/init.c b/mt7915/init.c
developer23d6e272023-08-28 11:10:51 +0800566index 2e9c94fb..b30aaea2 100644
developer6100db22023-04-05 13:22:26 +0800567--- a/mt7915/init.c
568+++ b/mt7915/init.c
developer23d6e272023-08-28 11:10:51 +0800569@@ -1157,8 +1157,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
developerbbd45e12023-05-19 08:22:06 +0800570 mt76_connac_gen_ppe_thresh(he_cap->ppe_thres, nss);
developer6100db22023-04-05 13:22:26 +0800571 } else {
572 he_cap_elem->phy_cap_info[9] |=
573- u8_encode_bits(IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US,
574- IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK);
575+ IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US;
576 }
577
578 if (band == NL80211_BAND_6GHZ) {
developer6100db22023-04-05 13:22:26 +0800579diff --git a/mt7915/main.c b/mt7915/main.c
developer23d6e272023-08-28 11:10:51 +0800580index deef1bb6..14b691a2 100644
developer6100db22023-04-05 13:22:26 +0800581--- a/mt7915/main.c
582+++ b/mt7915/main.c
developer23d6e272023-08-28 11:10:51 +0800583@@ -532,7 +532,7 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
developer6100db22023-04-05 13:22:26 +0800584
585 static int
586 mt7915_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
587- unsigned int link_id, u16 queue,
588+ u16 queue,
589 const struct ieee80211_tx_queue_params *params)
590 {
591 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
developer23d6e272023-08-28 11:10:51 +0800592@@ -627,7 +627,7 @@ mt7915_update_bss_color(struct ieee80211_hw *hw,
developer6100db22023-04-05 13:22:26 +0800593 static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
594 struct ieee80211_vif *vif,
595 struct ieee80211_bss_conf *info,
596- u64 changed)
597+ u32 changed)
598 {
599 struct mt7915_phy *phy = mt7915_hw_phy(hw);
600 struct mt7915_dev *dev = mt7915_hw_dev(hw);
developer23d6e272023-08-28 11:10:51 +0800601@@ -643,7 +643,7 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
developerc1571f92023-07-04 22:11:24 +0800602 vif->type == NL80211_IFTYPE_STATION)
603 set_bss_info = set_sta = !is_zero_ether_addr(info->bssid);
developer6100db22023-04-05 13:22:26 +0800604 if (changed & BSS_CHANGED_ASSOC)
developerc1571f92023-07-04 22:11:24 +0800605- set_bss_info = vif->cfg.assoc;
606+ set_bss_info = info->assoc;
607 if (changed & BSS_CHANGED_BEACON_ENABLED &&
608 vif->type != NL80211_IFTYPE_AP)
609 set_bss_info = set_sta = info->enable_beacon;
developer23d6e272023-08-28 11:10:51 +0800610@@ -691,27 +691,8 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
developerc1571f92023-07-04 22:11:24 +0800611 mutex_unlock(&dev->mt76.mutex);
developer2157bf82023-06-26 02:27:49 +0800612 }
613
developerc1571f92023-07-04 22:11:24 +0800614-static void
615-mt7915_vif_check_caps(struct mt7915_phy *phy, struct ieee80211_vif *vif)
616-{
617- struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
618- struct mt7915_vif_cap *vc = &mvif->cap;
619-
620- vc->ht_ldpc = vif->bss_conf.ht_ldpc;
621- vc->vht_ldpc = vif->bss_conf.vht_ldpc;
622- vc->vht_su_ebfer = vif->bss_conf.vht_su_beamformer;
623- vc->vht_su_ebfee = vif->bss_conf.vht_su_beamformee;
624- vc->vht_mu_ebfer = vif->bss_conf.vht_mu_beamformer;
625- vc->vht_mu_ebfee = vif->bss_conf.vht_mu_beamformee;
626- vc->he_ldpc = vif->bss_conf.he_ldpc;
627- vc->he_su_ebfer = vif->bss_conf.he_su_beamformer;
628- vc->he_su_ebfee = vif->bss_conf.he_su_beamformee;
629- vc->he_mu_ebfer = vif->bss_conf.he_mu_beamformer;
630-}
631-
developer2157bf82023-06-26 02:27:49 +0800632 static int
633-mt7915_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
634- struct ieee80211_bss_conf *link_conf)
635+mt7915_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
developer6100db22023-04-05 13:22:26 +0800636 {
637 struct mt7915_phy *phy = mt7915_hw_phy(hw);
638 struct mt7915_dev *dev = mt7915_hw_dev(hw);
developer23d6e272023-08-28 11:10:51 +0800639@@ -719,8 +700,6 @@ mt7915_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
developerc1571f92023-07-04 22:11:24 +0800640
641 mutex_lock(&dev->mt76.mutex);
642
643- mt7915_vif_check_caps(phy, vif);
644-
645 err = mt7915_mcu_add_bss_info(phy, vif, true);
646 if (err)
647 goto out;
developer23d6e272023-08-28 11:10:51 +0800648@@ -732,8 +711,7 @@ out:
developer2157bf82023-06-26 02:27:49 +0800649 }
650
651 static void
652-mt7915_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
653- struct ieee80211_bss_conf *link_conf)
654+mt7915_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
655 {
656 struct mt7915_dev *dev = mt7915_hw_dev(hw);
657
developer23d6e272023-08-28 11:10:51 +0800658@@ -1296,10 +1274,10 @@ static int mt7915_sta_set_txpwr(struct ieee80211_hw *hw,
developer2157bf82023-06-26 02:27:49 +0800659 {
660 struct mt7915_phy *phy = mt7915_hw_phy(hw);
661 struct mt7915_dev *dev = mt7915_hw_dev(hw);
developer6100db22023-04-05 13:22:26 +0800662- s16 txpower = sta->deflink.txpwr.power;
663+ s16 txpower = sta->txpwr.power;
664 int ret;
665
666- if (sta->deflink.txpwr.type == NL80211_TX_POWER_AUTOMATIC)
667+ if (sta->txpwr.type == NL80211_TX_POWER_AUTOMATIC)
668 txpower = 0;
669
670 mutex_lock(&dev->mt76.mutex);
671diff --git a/mt7915/mcu.c b/mt7915/mcu.c
developerd8ca5d32023-08-30 19:05:17 +0800672index 7edf3782..6236078d 100644
developer6100db22023-04-05 13:22:26 +0800673--- a/mt7915/mcu.c
674+++ b/mt7915/mcu.c
developerbbd45e12023-05-19 08:22:06 +0800675@@ -67,7 +67,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
developer6100db22023-04-05 13:22:26 +0800676 struct mt7915_dev *dev = msta->vif->phy->dev;
677 enum nl80211_band band = msta->vif->phy->mt76->chandef.chan->band;
678 const u16 *mask = msta->vif->bitrate_mask.control[band].he_mcs;
679- int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
680+ int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
681
682 for (nss = 0; nss < max_nss; nss++) {
683 int mcs;
developerbbd45e12023-05-19 08:22:06 +0800684@@ -107,7 +107,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
developer6100db22023-04-05 13:22:26 +0800685
686 /* only support 2ss on 160MHz for mt7915 */
687 if (is_mt7915(&dev->mt76) && nss > 1 &&
688- sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
689+ sta->bandwidth == IEEE80211_STA_RX_BW_160)
690 break;
691 }
692
developerbbd45e12023-05-19 08:22:06 +0800693@@ -120,8 +120,8 @@ mt7915_mcu_set_sta_vht_mcs(struct ieee80211_sta *sta, __le16 *vht_mcs,
developer6100db22023-04-05 13:22:26 +0800694 {
695 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
696 struct mt7915_dev *dev = msta->vif->phy->dev;
697- u16 mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map);
698- int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
699+ u16 mcs_map = le16_to_cpu(sta->vht_cap.vht_mcs.rx_mcs_map);
700+ int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
701 u16 mcs;
702
703 for (nss = 0; nss < max_nss; nss++, mcs_map >>= 2) {
developerbbd45e12023-05-19 08:22:06 +0800704@@ -143,7 +143,7 @@ mt7915_mcu_set_sta_vht_mcs(struct ieee80211_sta *sta, __le16 *vht_mcs,
developer6100db22023-04-05 13:22:26 +0800705
706 /* only support 2ss on 160MHz for mt7915 */
707 if (is_mt7915(&dev->mt76) && nss > 1 &&
708- sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
709+ sta->bandwidth == IEEE80211_STA_RX_BW_160)
710 break;
711 }
712 }
developerbbd45e12023-05-19 08:22:06 +0800713@@ -152,10 +152,10 @@ static void
developer6100db22023-04-05 13:22:26 +0800714 mt7915_mcu_set_sta_ht_mcs(struct ieee80211_sta *sta, u8 *ht_mcs,
715 const u8 *mask)
716 {
717- int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
718+ int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
719
720 for (nss = 0; nss < max_nss; nss++)
721- ht_mcs[nss] = sta->deflink.ht_cap.mcs.rx_mask[nss] & mask[nss];
722+ ht_mcs[nss] = sta->ht_cap.mcs.rx_mask[nss] & mask[nss];
723 }
724
725 static int
developerbbd45e12023-05-19 08:22:06 +0800726@@ -236,7 +236,7 @@ int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3)
developer6100db22023-04-05 13:22:26 +0800727 static void
728 mt7915_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
729 {
developer23d6e272023-08-28 11:10:51 +0800730- if (vif->bss_conf.csa_active && vif->type != NL80211_IFTYPE_STATION)
731+ if (vif->csa_active && vif->type != NL80211_IFTYPE_STATION)
developer6100db22023-04-05 13:22:26 +0800732 ieee80211_csa_finish(vif);
733 }
734
developerbbd45e12023-05-19 08:22:06 +0800735@@ -337,7 +337,7 @@ mt7915_mcu_rx_log_message(struct mt7915_dev *dev, struct sk_buff *skb)
developer6100db22023-04-05 13:22:26 +0800736 static void
737 mt7915_mcu_cca_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
738 {
developer23d6e272023-08-28 11:10:51 +0800739- if (!vif->bss_conf.color_change_active || vif->type == NL80211_IFTYPE_STATION)
740+ if (!vif->color_change_active || vif->type == NL80211_IFTYPE_STATION)
developer6100db22023-04-05 13:22:26 +0800741 return;
742
743 ieee80211_color_change_finish(vif);
developerc1571f92023-07-04 22:11:24 +0800744@@ -752,13 +752,13 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
developer6100db22023-04-05 13:22:26 +0800745 struct ieee80211_vif *vif)
746 {
developerc1571f92023-07-04 22:11:24 +0800747 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
developer6100db22023-04-05 13:22:26 +0800748- struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem;
749+ struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem;
750 struct ieee80211_he_mcs_nss_supp mcs_map;
751 struct sta_rec_he *he;
752 struct tlv *tlv;
753 u32 cap = 0;
754
755- if (!sta->deflink.he_cap.has_he)
756+ if (!sta->he_cap.has_he)
757 return;
758
759 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE, sizeof(*he));
developerc1571f92023-07-04 22:11:24 +0800760@@ -844,8 +844,8 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
developer6100db22023-04-05 13:22:26 +0800761
762 he->he_cap = cpu_to_le32(cap);
763
764- mcs_map = sta->deflink.he_cap.he_mcs_nss_supp;
765- switch (sta->deflink.bandwidth) {
766+ mcs_map = sta->he_cap.he_mcs_nss_supp;
767+ switch (sta->bandwidth) {
768 case IEEE80211_STA_RX_BW_160:
769 if (elem->phy_cap_info[0] &
770 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
developerc1571f92023-07-04 22:11:24 +0800771@@ -895,7 +895,7 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developerbbd45e12023-05-19 08:22:06 +0800772 struct ieee80211_sta *sta, struct ieee80211_vif *vif)
developer6100db22023-04-05 13:22:26 +0800773 {
developerc1571f92023-07-04 22:11:24 +0800774 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
developer6100db22023-04-05 13:22:26 +0800775- struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem;
776+ struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem;
developerc1571f92023-07-04 22:11:24 +0800777 struct mt7915_phy *phy = mvif->phy;
developer6100db22023-04-05 13:22:26 +0800778 struct sta_rec_muru *muru;
779 struct tlv *tlv;
developerc1571f92023-07-04 22:11:24 +0800780@@ -920,11 +920,11 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800781 muru->cfg.ofdma_dl_en = !!(phy->muru_onoff & OFDMA_DL);
782 muru->cfg.ofdma_ul_en = !!(phy->muru_onoff & OFDMA_UL);
783
784- if (sta->deflink.vht_cap.vht_supported)
785+ if (sta->vht_cap.vht_supported)
786 muru->mimo_dl.vht_mu_bfee =
787- !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
788+ !!(sta->vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
789
790- if (!sta->deflink.he_cap.has_he)
791+ if (!sta->he_cap.has_he)
792 return;
793
794 muru->mimo_dl.partial_bw_dl_mimo =
developerd8ca5d32023-08-30 19:05:17 +0800795@@ -960,13 +960,13 @@ mt7915_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
developer6100db22023-04-05 13:22:26 +0800796 struct sta_rec_ht *ht;
797 struct tlv *tlv;
798
799- if (!sta->deflink.ht_cap.ht_supported)
800+ if (!sta->ht_cap.ht_supported)
801 return;
802
803 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht));
804
805 ht = (struct sta_rec_ht *)tlv;
806- ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap);
807+ ht->ht_cap = cpu_to_le16(sta->ht_cap.cap);
808 }
809
810 static void
developerd8ca5d32023-08-30 19:05:17 +0800811@@ -975,15 +975,15 @@ mt7915_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
developer6100db22023-04-05 13:22:26 +0800812 struct sta_rec_vht *vht;
813 struct tlv *tlv;
814
815- if (!sta->deflink.vht_cap.vht_supported)
816+ if (!sta->vht_cap.vht_supported)
817 return;
818
819 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, sizeof(*vht));
820
821 vht = (struct sta_rec_vht *)tlv;
822- vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap);
823- vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map;
824- vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map;
825+ vht->vht_cap = cpu_to_le32(sta->vht_cap.cap);
826+ vht->vht_rx_mcs_map = sta->vht_cap.vht_mcs.rx_mcs_map;
827+ vht->vht_tx_mcs_map = sta->vht_cap.vht_mcs.tx_mcs_map;
828 }
829
830 static void
developerd8ca5d32023-08-30 19:05:17 +0800831@@ -998,7 +998,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800832 vif->type != NL80211_IFTYPE_AP)
833 return;
834
835- if (!sta->deflink.agg.max_amsdu_len)
836+ if (!sta->max_amsdu_len)
837 return;
838
839 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu));
developerd8ca5d32023-08-30 19:05:17 +0800840@@ -1007,7 +1007,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800841 amsdu->amsdu_en = true;
842 msta->wcid.amsdu = true;
843
844- switch (sta->deflink.agg.max_amsdu_len) {
845+ switch (sta->max_amsdu_len) {
846 case IEEE80211_MAX_MPDU_LEN_VHT_11454:
847 if (!is_mt7915(&dev->mt76)) {
848 amsdu->max_mpdu_size =
developerd8ca5d32023-08-30 19:05:17 +0800849@@ -1070,8 +1070,8 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
developer69542b52023-04-13 10:46:44 +0800850 if (!bfee && sts < 2)
developer6100db22023-04-05 13:22:26 +0800851 return false;
852
853- if (sta->deflink.he_cap.has_he) {
854- struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem;
855+ if (sta->he_cap.has_he) {
856+ struct ieee80211_he_cap_elem *pe = &sta->he_cap.he_cap_elem;
857
858 if (bfee)
developerc1571f92023-07-04 22:11:24 +0800859 return mvif->cap.he_su_ebfee &&
developerd8ca5d32023-08-30 19:05:17 +0800860@@ -1081,8 +1081,8 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800861 HE_PHY(CAP4_SU_BEAMFORMEE, pe->phy_cap_info[4]);
862 }
863
864- if (sta->deflink.vht_cap.vht_supported) {
865- u32 cap = sta->deflink.vht_cap.cap;
866+ if (sta->vht_cap.vht_supported) {
867+ u32 cap = sta->vht_cap.cap;
868
869 if (bfee)
developerc1571f92023-07-04 22:11:24 +0800870 return mvif->cap.vht_su_ebfee &&
developerd8ca5d32023-08-30 19:05:17 +0800871@@ -1108,7 +1108,7 @@ static void
developer6100db22023-04-05 13:22:26 +0800872 mt7915_mcu_sta_bfer_ht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
873 struct sta_rec_bf *bf)
874 {
875- struct ieee80211_mcs_info *mcs = &sta->deflink.ht_cap.mcs;
876+ struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
877 u8 n = 0;
878
879 bf->tx_mode = MT_PHY_TYPE_HT;
developerd8ca5d32023-08-30 19:05:17 +0800880@@ -1133,7 +1133,7 @@ static void
developer6100db22023-04-05 13:22:26 +0800881 mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
882 struct sta_rec_bf *bf, bool explicit)
883 {
884- struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap;
885+ struct ieee80211_sta_vht_cap *pc = &sta->vht_cap;
886 struct ieee80211_sta_vht_cap *vc = &phy->mt76->sband_5g.sband.vht_cap;
887 u16 mcs_map = le16_to_cpu(pc->vht_mcs.rx_mcs_map);
888 u8 nss_mcs = mt7915_mcu_get_sta_nss(mcs_map);
developerd8ca5d32023-08-30 19:05:17 +0800889@@ -1154,14 +1154,14 @@ mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
developer6100db22023-04-05 13:22:26 +0800890 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
891 bf->ibf_ncol = bf->ncol;
892
893- if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
894+ if (sta->bandwidth == IEEE80211_STA_RX_BW_160)
895 bf->nrow = 1;
896 } else {
897 bf->nrow = tx_ant;
898 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
899 bf->ibf_ncol = nss_mcs;
900
901- if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
902+ if (sta->bandwidth == IEEE80211_STA_RX_BW_160)
903 bf->ibf_nrow = 1;
904 }
905 }
developerd8ca5d32023-08-30 19:05:17 +0800906@@ -1170,7 +1170,7 @@ static void
developer6100db22023-04-05 13:22:26 +0800907 mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
908 struct mt7915_phy *phy, struct sta_rec_bf *bf)
909 {
910- struct ieee80211_sta_he_cap *pc = &sta->deflink.he_cap;
911+ struct ieee80211_sta_he_cap *pc = &sta->he_cap;
912 struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem;
913 const struct ieee80211_sta_he_cap *vc =
914 mt76_connac_get_he_phy_cap(phy->mt76, vif);
developerd8ca5d32023-08-30 19:05:17 +0800915@@ -1195,7 +1195,7 @@ mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800916 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
917 bf->ibf_ncol = bf->ncol;
918
919- if (sta->deflink.bandwidth != IEEE80211_STA_RX_BW_160)
920+ if (sta->bandwidth != IEEE80211_STA_RX_BW_160)
921 return;
922
923 /* go over for 160MHz and 80p80 */
developerd8ca5d32023-08-30 19:05:17 +0800924@@ -1243,7 +1243,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800925 };
926 bool ebf;
927
928- if (!(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
929+ if (!(sta->ht_cap.ht_supported || sta->he_cap.has_he))
930 return;
931
932 ebf = mt7915_is_ebf_supported(phy, vif, sta, false);
developerd8ca5d32023-08-30 19:05:17 +0800933@@ -1257,21 +1257,21 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800934 * vht: support eBF and iBF
935 * ht: iBF only, since mac80211 lacks of eBF support
936 */
937- if (sta->deflink.he_cap.has_he && ebf)
938+ if (sta->he_cap.has_he && ebf)
939 mt7915_mcu_sta_bfer_he(sta, vif, phy, bf);
940- else if (sta->deflink.vht_cap.vht_supported)
941+ else if (sta->vht_cap.vht_supported)
942 mt7915_mcu_sta_bfer_vht(sta, phy, bf, ebf);
943- else if (sta->deflink.ht_cap.ht_supported)
944+ else if (sta->ht_cap.ht_supported)
945 mt7915_mcu_sta_bfer_ht(sta, phy, bf);
946 else
947 return;
948
949 bf->bf_cap = ebf ? ebf : dev->ibf << 1;
950- bf->bw = sta->deflink.bandwidth;
951- bf->ibf_dbw = sta->deflink.bandwidth;
952+ bf->bw = sta->bandwidth;
953+ bf->ibf_dbw = sta->bandwidth;
954 bf->ibf_nrow = tx_ant;
955
956- if (!ebf && sta->deflink.bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol)
957+ if (!ebf && sta->bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol)
958 bf->ibf_timeout = 0x48;
959 else
960 bf->ibf_timeout = 0x18;
developerd8ca5d32023-08-30 19:05:17 +0800961@@ -1281,7 +1281,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800962 else
963 bf->mem_20m = matrix[bf->nrow][bf->ncol];
964
965- switch (sta->deflink.bandwidth) {
966+ switch (sta->bandwidth) {
967 case IEEE80211_STA_RX_BW_160:
968 case IEEE80211_STA_RX_BW_80:
969 bf->mem_total = bf->mem_20m * 2;
developerd8ca5d32023-08-30 19:05:17 +0800970@@ -1306,7 +1306,7 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800971 struct tlv *tlv;
972 u8 nrow = 0;
973
974- if (!(sta->deflink.vht_cap.vht_supported || sta->deflink.he_cap.has_he))
975+ if (!(sta->vht_cap.vht_supported || sta->he_cap.has_he))
976 return;
977
978 if (!mt7915_is_ebf_supported(phy, vif, sta, true))
developerd8ca5d32023-08-30 19:05:17 +0800979@@ -1315,13 +1315,13 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800980 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_BFEE, sizeof(*bfee));
981 bfee = (struct sta_rec_bfee *)tlv;
982
983- if (sta->deflink.he_cap.has_he) {
984- struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem;
985+ if (sta->he_cap.has_he) {
986+ struct ieee80211_he_cap_elem *pe = &sta->he_cap.he_cap_elem;
987
988 nrow = HE_PHY(CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK,
989 pe->phy_cap_info[5]);
990- } else if (sta->deflink.vht_cap.vht_supported) {
991- struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap;
992+ } else if (sta->vht_cap.vht_supported) {
993+ struct ieee80211_sta_vht_cap *pc = &sta->vht_cap;
994
995 nrow = FIELD_GET(IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK,
996 pc->cap);
developerd8ca5d32023-08-30 19:05:17 +0800997@@ -1377,7 +1377,7 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +0800998 ra->phy = *phy;
999 break;
1000 case RATE_PARAM_MMPS_UPDATE:
1001- ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->deflink.smps_mode);
1002+ ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->smps_mode);
1003 break;
1004 case RATE_PARAM_SPE_UPDATE:
1005 ra->spe_idx = *(u8 *)data;
developerd8ca5d32023-08-30 19:05:17 +08001006@@ -1452,7 +1452,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001007 do { \
1008 u8 i, gi = mask->control[band]._gi; \
1009 gi = (_he) ? gi : gi == NL80211_TXRATE_FORCE_SGI; \
1010- for (i = 0; i <= sta->deflink.bandwidth; i++) { \
1011+ for (i = 0; i <= sta->bandwidth; i++) { \
1012 phy.sgi |= gi << (i << (_he)); \
1013 phy.he_ltf |= mask->control[band].he_ltf << (i << (_he));\
1014 } \
developerd8ca5d32023-08-30 19:05:17 +08001015@@ -1466,11 +1466,11 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001016 } \
1017 } while (0)
1018
1019- if (sta->deflink.he_cap.has_he) {
1020+ if (sta->he_cap.has_he) {
1021 __sta_phy_bitrate_mask_check(he_mcs, he_gi, 0, 1);
1022- } else if (sta->deflink.vht_cap.vht_supported) {
1023+ } else if (sta->vht_cap.vht_supported) {
1024 __sta_phy_bitrate_mask_check(vht_mcs, gi, 0, 0);
1025- } else if (sta->deflink.ht_cap.ht_supported) {
1026+ } else if (sta->ht_cap.ht_supported) {
1027 __sta_phy_bitrate_mask_check(ht_mcs, gi, 1, 0);
1028 } else {
1029 nrates = hweight32(mask->control[band].legacy);
developerd8ca5d32023-08-30 19:05:17 +08001030@@ -1504,7 +1504,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001031 * actual txrate hardware sends out.
1032 */
1033 addr = mt7915_mac_wtbl_lmac_addr(dev, msta->wcid.idx, 7);
1034- if (sta->deflink.he_cap.has_he)
1035+ if (sta->he_cap.has_he)
1036 mt76_rmw_field(dev, addr, GENMASK(31, 24), phy.sgi);
1037 else
1038 mt76_rmw_field(dev, addr, GENMASK(15, 12), phy.sgi);
developerd8ca5d32023-08-30 19:05:17 +08001039@@ -1537,7 +1537,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001040 enum nl80211_band band = chandef->chan->band;
1041 struct sta_rec_ra *ra;
1042 struct tlv *tlv;
1043- u32 supp_rate = sta->deflink.supp_rates[band];
1044+ u32 supp_rate = sta->supp_rates[band];
1045 u32 cap = sta->wme ? STA_CAP_WMM : 0;
1046
1047 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra));
developerd8ca5d32023-08-30 19:05:17 +08001048@@ -1547,9 +1547,9 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001049 ra->auto_rate = true;
1050 ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, sta);
1051 ra->channel = chandef->chan->hw_value;
1052- ra->bw = sta->deflink.bandwidth;
1053- ra->phy.bw = sta->deflink.bandwidth;
1054- ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->deflink.smps_mode);
1055+ ra->bw = sta->bandwidth;
1056+ ra->phy.bw = sta->bandwidth;
1057+ ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->smps_mode);
1058
1059 if (supp_rate) {
1060 supp_rate &= mask->control[band].legacy;
developerd8ca5d32023-08-30 19:05:17 +08001061@@ -1569,22 +1569,22 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001062 }
1063 }
1064
1065- if (sta->deflink.ht_cap.ht_supported) {
1066+ if (sta->ht_cap.ht_supported) {
1067 ra->supp_mode |= MODE_HT;
1068- ra->af = sta->deflink.ht_cap.ampdu_factor;
1069- ra->ht_gf = !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
1070+ ra->af = sta->ht_cap.ampdu_factor;
1071+ ra->ht_gf = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
1072
1073 cap |= STA_CAP_HT;
1074- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
1075+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
1076 cap |= STA_CAP_SGI_20;
1077- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
1078+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
1079 cap |= STA_CAP_SGI_40;
1080- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)
1081+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)
1082 cap |= STA_CAP_TX_STBC;
1083- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
1084+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
1085 cap |= STA_CAP_RX_STBC;
developerc1571f92023-07-04 22:11:24 +08001086 if (mvif->cap.ht_ldpc &&
developer6100db22023-04-05 13:22:26 +08001087- (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING))
1088+ (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING))
1089 cap |= STA_CAP_LDPC;
1090
1091 mt7915_mcu_set_sta_ht_mcs(sta, ra->ht_mcs,
developerd8ca5d32023-08-30 19:05:17 +08001092@@ -1592,37 +1592,37 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001093 ra->supp_ht_mcs = *(__le32 *)ra->ht_mcs;
1094 }
1095
1096- if (sta->deflink.vht_cap.vht_supported) {
1097+ if (sta->vht_cap.vht_supported) {
1098 u8 af;
1099
1100 ra->supp_mode |= MODE_VHT;
1101 af = FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK,
1102- sta->deflink.vht_cap.cap);
1103+ sta->vht_cap.cap);
1104 ra->af = max_t(u8, ra->af, af);
1105
1106 cap |= STA_CAP_VHT;
1107- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
1108+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
1109 cap |= STA_CAP_VHT_SGI_80;
1110- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
1111+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
1112 cap |= STA_CAP_VHT_SGI_160;
1113- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC)
1114+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC)
1115 cap |= STA_CAP_VHT_TX_STBC;
1116- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1)
1117+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1)
1118 cap |= STA_CAP_VHT_RX_STBC;
developerc1571f92023-07-04 22:11:24 +08001119 if (mvif->cap.vht_ldpc &&
developer6100db22023-04-05 13:22:26 +08001120- (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC))
1121+ (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC))
1122 cap |= STA_CAP_VHT_LDPC;
1123
1124 mt7915_mcu_set_sta_vht_mcs(sta, ra->supp_vht_mcs,
1125 mask->control[band].vht_mcs);
1126 }
1127
1128- if (sta->deflink.he_cap.has_he) {
1129+ if (sta->he_cap.has_he) {
1130 ra->supp_mode |= MODE_HE;
1131 cap |= STA_CAP_HE;
1132
1133- if (sta->deflink.he_6ghz_capa.capa)
1134- ra->af = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
1135+ if (sta->he_6ghz_capa.capa)
1136+ ra->af = le16_get_bits(sta->he_6ghz_capa.capa,
1137 IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP);
1138 }
1139
developerd8ca5d32023-08-30 19:05:17 +08001140@@ -1831,7 +1831,7 @@ mt7915_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,
developer6100db22023-04-05 13:22:26 +08001141 if (!offs->cntdwn_counter_offs[0])
1142 return;
1143
1144- sub_tag = vif->bss_conf.csa_active ? BSS_INFO_BCN_CSA : BSS_INFO_BCN_BCC;
1145+ sub_tag = vif->csa_active ? BSS_INFO_BCN_CSA : BSS_INFO_BCN_BCC;
1146 tlv = mt7915_mcu_add_nested_subtlv(rskb, sub_tag, sizeof(*info),
1147 &bcn->sub_ntlv, &bcn->len);
1148 info = (struct bss_info_bcn_cntdwn *)tlv;
developerd8ca5d32023-08-30 19:05:17 +08001149@@ -1916,9 +1916,9 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +08001150 if (offs->cntdwn_counter_offs[0]) {
1151 u16 offset = offs->cntdwn_counter_offs[0];
1152
1153- if (vif->bss_conf.csa_active)
1154+ if (vif->csa_active)
1155 cont->csa_ofs = cpu_to_le16(offset - 4);
1156- if (vif->bss_conf.color_change_active)
1157+ if (vif->color_change_active)
1158 cont->bcc_ofs = cpu_to_le16(offset - 3);
1159 }
1160
developerd8ca5d32023-08-30 19:05:17 +08001161@@ -1928,6 +1928,85 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,
developerbbd45e12023-05-19 08:22:06 +08001162 memcpy(buf + MT_TXD_SIZE, skb->data, skb->len);
1163 }
1164
1165+static void
1166+mt7915_mcu_beacon_check_caps(struct mt7915_phy *phy, struct ieee80211_vif *vif,
1167+ struct sk_buff *skb)
1168+{
1169+ struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
1170+ struct mt7915_vif_cap *vc = &mvif->cap;
1171+ const struct ieee80211_he_cap_elem *he;
1172+ const struct ieee80211_vht_cap *vht;
1173+ const struct ieee80211_ht_cap *ht;
1174+ struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
1175+ const u8 *ie;
1176+ u32 len, bc;
1177+
1178+ /* Check missing configuration options to allow AP mode in mac80211
1179+ * to remain in sync with hostapd settings, and get a subset of
1180+ * beacon and hardware capabilities.
1181+ */
1182+ if (WARN_ON_ONCE(skb->len <= (mgmt->u.beacon.variable - skb->data)))
1183+ return;
1184+
1185+ memset(vc, 0, sizeof(*vc));
1186+
1187+ len = skb->len - (mgmt->u.beacon.variable - skb->data);
1188+
1189+ ie = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, mgmt->u.beacon.variable,
1190+ len);
1191+ if (ie && ie[1] >= sizeof(*ht)) {
1192+ ht = (void *)(ie + 2);
1193+ vc->ht_ldpc = !!(le16_to_cpu(ht->cap_info) &
1194+ IEEE80211_HT_CAP_LDPC_CODING);
1195+ }
1196+
1197+ ie = cfg80211_find_ie(WLAN_EID_VHT_CAPABILITY, mgmt->u.beacon.variable,
1198+ len);
1199+ if (ie && ie[1] >= sizeof(*vht)) {
1200+ u32 pc = phy->mt76->sband_5g.sband.vht_cap.cap;
1201+
1202+ vht = (void *)(ie + 2);
1203+ bc = le32_to_cpu(vht->vht_cap_info);
1204+
1205+ vc->vht_ldpc = !!(bc & IEEE80211_VHT_CAP_RXLDPC);
1206+ vc->vht_su_ebfer =
1207+ (bc & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE) &&
1208+ (pc & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE);
1209+ vc->vht_su_ebfee =
1210+ (bc & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE) &&
1211+ (pc & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE);
1212+ vc->vht_mu_ebfer =
1213+ (bc & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE) &&
1214+ (pc & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE);
1215+ vc->vht_mu_ebfee =
1216+ (bc & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE) &&
1217+ (pc & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
1218+ }
1219+
1220+ ie = cfg80211_find_ext_ie(WLAN_EID_EXT_HE_CAPABILITY,
1221+ mgmt->u.beacon.variable, len);
1222+ if (ie && ie[1] >= sizeof(*he) + 1) {
1223+ const struct ieee80211_sta_he_cap *pc =
1224+ mt76_connac_get_he_phy_cap(phy->mt76, vif);
1225+ const struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem;
1226+
1227+ he = (void *)(ie + 3);
1228+
1229+ vc->he_ldpc =
1230+ HE_PHY(CAP1_LDPC_CODING_IN_PAYLOAD, he->phy_cap_info[1]) &&
1231+ HE_PHY(CAP1_LDPC_CODING_IN_PAYLOAD, pe->phy_cap_info[1]);
1232+ vc->he_su_ebfer =
1233+ HE_PHY(CAP3_SU_BEAMFORMER, he->phy_cap_info[3]) &&
1234+ HE_PHY(CAP3_SU_BEAMFORMER, pe->phy_cap_info[3]);
1235+ vc->he_su_ebfee =
1236+ HE_PHY(CAP4_SU_BEAMFORMEE, he->phy_cap_info[4]) &&
1237+ HE_PHY(CAP4_SU_BEAMFORMEE, pe->phy_cap_info[4]);
1238+ vc->he_mu_ebfer =
1239+ HE_PHY(CAP4_MU_BEAMFORMER, he->phy_cap_info[4]) &&
1240+ HE_PHY(CAP4_MU_BEAMFORMER, pe->phy_cap_info[4]);
1241+ }
1242+}
1243+
1244 int
1245 mt7915_mcu_add_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vif,
1246 u32 changed)
developerd8ca5d32023-08-30 19:05:17 +08001247@@ -2042,7 +2121,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +08001248 if (!en)
1249 goto out;
1250
1251- skb = ieee80211_beacon_get_template(hw, vif, &offs, 0);
1252+ skb = ieee80211_beacon_get_template(hw, vif, &offs);
developerd8ca5d32023-08-30 19:05:17 +08001253 if (!skb) {
1254 dev_kfree_skb(rskb);
developer6100db22023-04-05 13:22:26 +08001255 return -EINVAL;
developerd8ca5d32023-08-30 19:05:17 +08001256@@ -2058,6 +2137,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
developerbbd45e12023-05-19 08:22:06 +08001257 info = IEEE80211_SKB_CB(skb);
1258 info->hw_queue = FIELD_PREP(MT_TX_HW_QUEUE_PHY, ext_phy);
1259
1260+ mt7915_mcu_beacon_check_caps(phy, vif, skb);
1261 mt7915_mcu_beacon_cntdwn(vif, rskb, skb, bcn, &offs);
1262 mt7915_mcu_beacon_mbss(rskb, skb, vif, bcn, &offs);
1263 mt7915_mcu_beacon_cont(dev, vif, rskb, skb, bcn, &offs);
developerd8ca5d32023-08-30 19:05:17 +08001264@@ -3331,17 +3411,17 @@ int mt7915_mcu_set_txpower_frame(struct mt7915_phy *phy,
developer6100db22023-04-05 13:22:26 +08001265 if (txpower) {
1266 u32 offs, len, i;
1267
1268- if (sta->deflink.ht_cap.ht_supported) {
1269+ if (sta->ht_cap.ht_supported) {
1270 const u8 *sku_len = mt7915_sku_group_len;
1271
1272 offs = sku_len[SKU_CCK] + sku_len[SKU_OFDM];
1273 len = sku_len[SKU_HT_BW20] + sku_len[SKU_HT_BW40];
1274
1275- if (sta->deflink.vht_cap.vht_supported) {
1276+ if (sta->vht_cap.vht_supported) {
1277 offs += len;
1278 len = sku_len[SKU_VHT_BW20] * 4;
1279
1280- if (sta->deflink.he_cap.has_he) {
1281+ if (sta->he_cap.has_he) {
1282 offs += len + sku_len[SKU_HE_RU26] * 3;
1283 len = sku_len[SKU_HE_RU242] * 4;
1284 }
developer2157bf82023-06-26 02:27:49 +08001285diff --git a/mt7915/mmio.c b/mt7915/mmio.c
developer23d6e272023-08-28 11:10:51 +08001286index aa5c5dd6..08e7c52f 100644
developer2157bf82023-06-26 02:27:49 +08001287--- a/mt7915/mmio.c
1288+++ b/mt7915/mmio.c
developer23d6e272023-08-28 11:10:51 +08001289@@ -689,7 +689,7 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
developer2157bf82023-06-26 02:27:49 +08001290 phy_addr = dma_map_single(dev->mt76.dma_dev, ptr,
1291 wed->wlan.rx_size,
1292 DMA_TO_DEVICE);
1293-
1294+
1295 if (unlikely(dma_mapping_error(dev->mt76.dev, phy_addr))) {
1296 skb_free_frag(ptr);
1297 mt76_put_rxwi(&dev->mt76, r);
developer6100db22023-04-05 13:22:26 +08001298diff --git a/mt7915/testmode.c b/mt7915/testmode.c
developer23d6e272023-08-28 11:10:51 +08001299index d5c74dfd..38ac79d6 100644
developer6100db22023-04-05 13:22:26 +08001300--- a/mt7915/testmode.c
1301+++ b/mt7915/testmode.c
developer2157bf82023-06-26 02:27:49 +08001302@@ -416,12 +416,12 @@ mt7915_tm_entry_add(struct mt7915_phy *phy, u8 aid)
developer6100db22023-04-05 13:22:26 +08001303 memcpy(sta->addr, td->addr[0], ETH_ALEN);
1304
1305 if (td->tx_rate_mode >= MT76_TM_TX_MODE_HT)
1306- memcpy(&sta->deflink.ht_cap, &sband->ht_cap, sizeof(sta->deflink.ht_cap));
1307+ memcpy(&sta->ht_cap, &sband->ht_cap, sizeof(sta->ht_cap));
1308 if (td->tx_rate_mode >= MT76_TM_TX_MODE_VHT)
1309- memcpy(&sta->deflink.vht_cap, &sband->vht_cap, sizeof(sta->deflink.vht_cap));
1310+ memcpy(&sta->vht_cap, &sband->vht_cap, sizeof(sta->vht_cap));
1311 if (td->tx_rate_mode >= MT76_TM_TX_MODE_HE_SU)
1312- memcpy(&sta->deflink.he_cap, &sdata[NL80211_IFTYPE_STATION].he_cap,
1313- sizeof(sta->deflink.he_cap));
1314+ memcpy(&sta->he_cap, &sdata[NL80211_IFTYPE_STATION].he_cap,
1315+ sizeof(sta->he_cap));
1316 sta->aid = aid;
1317 sta->wme = 1;
1318
1319diff --git a/tx.c b/tx.c
developer849549c2023-08-02 17:26:48 +08001320index 2594a625..26fa6650 100644
developer6100db22023-04-05 13:22:26 +08001321--- a/tx.c
1322+++ b/tx.c
1323@@ -60,20 +60,15 @@ mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list)
1324 .skb = skb,
1325 .info = IEEE80211_SKB_CB(skb),
1326 };
1327- struct ieee80211_rate_status rs = {};
1328 struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb);
1329 struct mt76_wcid *wcid;
1330
1331 wcid = rcu_dereference(dev->wcid[cb->wcid]);
1332 if (wcid) {
1333 status.sta = wcid_to_sta(wcid);
1334- if (status.sta && (wcid->rate.flags || wcid->rate.legacy)) {
1335- rs.rate_idx = wcid->rate;
1336- status.rates = &rs;
1337- status.n_rates = 1;
1338- } else {
1339- status.n_rates = 0;
1340- }
1341+
1342+ if (status.sta)
1343+ status.rate = &wcid->rate;
1344 }
1345
1346 hw = mt76_tx_status_get_hw(dev, skb);
developer2157bf82023-06-26 02:27:49 +08001347@@ -239,6 +234,7 @@ mt76_tx_check_non_aql(struct mt76_dev *dev, struct mt76_wcid *wcid,
developer22eedcc2023-05-03 22:59:35 +08001348 void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *skb,
1349 struct list_head *free_list)
1350 {
1351+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1352 struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb);
1353 struct ieee80211_tx_status status = {
1354 .skb = skb,
developer2157bf82023-06-26 02:27:49 +08001355@@ -269,15 +265,13 @@ void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *
developer22eedcc2023-05-03 22:59:35 +08001356 #endif
1357
1358 if (cb->pktid < MT_PACKET_ID_FIRST) {
developer22eedcc2023-05-03 22:59:35 +08001359- struct ieee80211_rate_status rs = {};
1360-
1361 hw = mt76_tx_status_get_hw(dev, skb);
1362 status.sta = wcid_to_sta(wcid);
developer2157bf82023-06-26 02:27:49 +08001363- if (status.sta && (wcid->rate.flags || wcid->rate.legacy)) {
1364- rs.rate_idx = wcid->rate;
1365- status.rates = &rs;
1366- status.n_rates = 1;
1367+ if (status.sta) {
1368+ info->status.rates[0].idx = -1;
1369+ status.rate = &wcid->rate;
developer22eedcc2023-05-03 22:59:35 +08001370 }
developer2157bf82023-06-26 02:27:49 +08001371+
developerbbd45e12023-05-19 08:22:06 +08001372 spin_lock_bh(&dev->rx_lock);
developer2157bf82023-06-26 02:27:49 +08001373 ieee80211_tx_status_ext(hw, &status);
1374 spin_unlock_bh(&dev->rx_lock);
developer6100db22023-04-05 13:22:26 +08001375--
developerd8ca5d32023-08-30 19:05:17 +080013762.39.2
developer6100db22023-04-05 13:22:26 +08001377