blob: 02d65c23b666d96cab8d6c47e622809598502a6e [file] [log] [blame]
developer2324aa22023-04-12 11:30:15 +08001From 578ebe5d2db344f4b424af636149cfa7fafdc082 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
4Subject: [PATCH] mt76: revert for backports-5.15 wireless stack
5
6---
7 dma.c | 2 +-
8 mac80211.c | 4 +-
9 mt7615/dma.c | 4 +-
10 mt7615/main.c | 6 +-
11 mt7615/mcu.c | 8 +--
12 mt76_connac_mcu.c | 108 +++++++++++++++---------------
13 mt76x02_mac.c | 6 +-
14 mt7915/debugfs.c | 4 +-
15 mt7915/dma.c | 4 +-
16 mt7915/init.c | 3 +-
17 mt7915/mac.c | 2 +-
18 mt7915/main.c | 10 +--
19 mt7915/mcu.c | 166 +++++++++++++++++++++++-----------------------
20 mt7915/testmode.c | 8 +--
21 tx.c | 11 +--
22 15 files changed, 168 insertions(+), 178 deletions(-)
23
24diff --git a/dma.c b/dma.c
developer2324aa22023-04-12 11:30:15 +080025index 7c147c1..2169682 100644
developer6100db22023-04-05 13:22:26 +080026--- a/dma.c
27+++ b/dma.c
developer2324aa22023-04-12 11:30:15 +080028@@ -992,7 +992,7 @@ mt76_dma_init(struct mt76_dev *dev,
developer6100db22023-04-05 13:22:26 +080029 init_completion(&dev->mmio.wed_reset_complete);
30
31 mt76_for_each_q_rx(dev, i) {
32- netif_napi_add(&dev->napi_dev, &dev->napi[i], poll);
33+ netif_napi_add(&dev->napi_dev, &dev->napi[i], poll, 64);
34 mt76_dma_rx_fill(dev, &dev->q_rx[i]);
35 napi_enable(&dev->napi[i]);
36 }
37diff --git a/mac80211.c b/mac80211.c
developer2324aa22023-04-12 11:30:15 +080038index 4dc7627..4c88710 100644
developer6100db22023-04-05 13:22:26 +080039--- a/mac80211.c
40+++ b/mac80211.c
41@@ -1517,7 +1517,7 @@ EXPORT_SYMBOL_GPL(mt76_get_sar_power);
42 static void
43 __mt76_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
44 {
45- if (vif->bss_conf.csa_active && ieee80211_beacon_cntdwn_is_complete(vif))
46+ if (vif->csa_active && ieee80211_beacon_cntdwn_is_complete(vif))
47 ieee80211_csa_finish(vif);
48 }
49
50@@ -1539,7 +1539,7 @@ __mt76_csa_check(void *priv, u8 *mac, struct ieee80211_vif *vif)
51 {
52 struct mt76_dev *dev = priv;
53
54- if (!vif->bss_conf.csa_active)
55+ if (!vif->csa_active)
56 return;
57
58 dev->csa_complete |= ieee80211_beacon_cntdwn_is_complete(vif);
59diff --git a/mt7615/dma.c b/mt7615/dma.c
developer2324aa22023-04-12 11:30:15 +080060index f191443..ec729db 100644
developer6100db22023-04-05 13:22:26 +080061--- a/mt7615/dma.c
62+++ b/mt7615/dma.c
63@@ -281,8 +281,8 @@ int mt7615_dma_init(struct mt7615_dev *dev)
64 if (ret < 0)
65 return ret;
66
67- netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
68- mt7615_poll_tx);
69+ netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
70+ mt7615_poll_tx, NAPI_POLL_WEIGHT);
71 napi_enable(&dev->mt76.tx_napi);
72
73 mt76_poll(dev, MT_WPDMA_GLO_CFG,
74diff --git a/mt7615/main.c b/mt7615/main.c
developer2324aa22023-04-12 11:30:15 +080075index dadb13f..2c61c36 100644
developer6100db22023-04-05 13:22:26 +080076--- a/mt7615/main.c
77+++ b/mt7615/main.c
developer2324aa22023-04-12 11:30:15 +080078@@ -473,7 +473,7 @@ static int mt7615_config(struct ieee80211_hw *hw, u32 changed)
developer6100db22023-04-05 13:22:26 +080079
80 static int
81 mt7615_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
82- unsigned int link_id, u16 queue,
83+ u16 queue,
84 const struct ieee80211_tx_queue_params *params)
85 {
86 struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
developer2324aa22023-04-12 11:30:15 +080087@@ -555,7 +555,7 @@ static void mt7615_configure_filter(struct ieee80211_hw *hw,
developer6100db22023-04-05 13:22:26 +080088 static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
89 struct ieee80211_vif *vif,
90 struct ieee80211_bss_conf *info,
91- u64 changed)
92+ u32 changed)
93 {
94 struct mt7615_dev *dev = mt7615_hw_dev(hw);
95 struct mt7615_phy *phy = mt7615_hw_phy(hw);
developer2324aa22023-04-12 11:30:15 +080096@@ -598,7 +598,7 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
developer6100db22023-04-05 13:22:26 +080097 }
98
99 if (changed & BSS_CHANGED_ASSOC)
100- mt7615_mac_set_beacon_filter(phy, vif, vif->cfg.assoc);
101+ mt7615_mac_set_beacon_filter(phy, vif, info->assoc);
102
103 mt7615_mutex_release(dev);
104 }
105diff --git a/mt7615/mcu.c b/mt7615/mcu.c
developer2324aa22023-04-12 11:30:15 +0800106index 4593b2e..39e81d2 100644
developer6100db22023-04-05 13:22:26 +0800107--- a/mt7615/mcu.c
108+++ b/mt7615/mcu.c
109@@ -353,7 +353,7 @@ out:
110 static void
111 mt7615_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
112 {
113- if (vif->bss_conf.csa_active)
114+ if (vif->csa_active)
115 ieee80211_csa_finish(vif);
116 }
117
118@@ -699,7 +699,7 @@ mt7615_mcu_add_beacon_offload(struct mt7615_dev *dev,
119 if (!enable)
120 goto out;
121
122- skb = ieee80211_beacon_get_template(hw, vif, &offs, 0);
123+ skb = ieee80211_beacon_get_template(hw, vif, &offs);
124 if (!skb)
125 return -EINVAL;
126
127@@ -1074,7 +1074,7 @@ mt7615_mcu_uni_add_beacon_offload(struct mt7615_dev *dev,
128 if (!enable)
129 goto out;
130
131- skb = ieee80211_beacon_get_template(mt76_hw(dev), vif, &offs, 0);
132+ skb = ieee80211_beacon_get_template(mt76_hw(dev), vif, &offs);
133 if (!skb)
134 return -EINVAL;
135
136@@ -2525,7 +2525,7 @@ int mt7615_mcu_set_bss_pm(struct mt7615_dev *dev, struct ieee80211_vif *vif,
137 u8 pad;
138 } req = {
139 .bss_idx = mvif->mt76.idx,
140- .aid = cpu_to_le16(vif->cfg.aid),
141+ .aid = cpu_to_le16(vif->bss_conf.aid),
142 .dtim_period = vif->bss_conf.dtim_period,
143 .bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int),
144 };
145diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
developer2324aa22023-04-12 11:30:15 +0800146index d406013..703ca73 100644
developer6100db22023-04-05 13:22:26 +0800147--- a/mt76_connac_mcu.c
148+++ b/mt76_connac_mcu.c
149@@ -197,7 +197,7 @@ int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif)
150 */
151 } req = {
152 .bss_idx = mvif->idx,
153- .ps_state = vif->cfg.ps ? 2 : 0,
154+ .ps_state = vif->bss_conf.ps ? 2 : 0,
155 };
156
157 if (vif->type != NL80211_IFTYPE_STATION)
158@@ -409,7 +409,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct sk_buff *skb,
159 else
160 conn_type = CONNECTION_INFRA_AP;
161 basic->conn_type = cpu_to_le32(conn_type);
162- basic->aid = cpu_to_le16(vif->cfg.aid);
163+ basic->aid = cpu_to_le16(vif->bss_conf.aid);
164 break;
165 case NL80211_IFTYPE_ADHOC:
166 basic->conn_type = cpu_to_le32(CONNECTION_IBSS_ADHOC);
167@@ -553,7 +553,7 @@ void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev,
168
169 if (sta) {
170 if (vif->type == NL80211_IFTYPE_STATION)
171- generic->partial_aid = cpu_to_le16(vif->cfg.aid);
172+ generic->partial_aid = cpu_to_le16(vif->bss_conf.aid);
173 else
174 generic->partial_aid = cpu_to_le16(sta->aid);
175 memcpy(generic->peer_addr, sta->addr, ETH_ALEN);
176@@ -602,14 +602,14 @@ mt76_connac_mcu_sta_amsdu_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
177 vif->type != NL80211_IFTYPE_STATION)
178 return;
179
180- if (!sta->deflink.agg.max_amsdu_len)
181+ if (!sta->max_amsdu_len)
182 return;
183
184 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu));
185 amsdu = (struct sta_rec_amsdu *)tlv;
186 amsdu->max_amsdu_num = 8;
187 amsdu->amsdu_en = true;
188- amsdu->max_mpdu_size = sta->deflink.agg.max_amsdu_len >=
189+ amsdu->max_mpdu_size = sta->max_amsdu_len >=
190 IEEE80211_MAX_MPDU_LEN_VHT_7991;
191
192 wcid->amsdu = true;
193@@ -620,7 +620,7 @@ mt76_connac_mcu_sta_amsdu_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
194 static void
195 mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
196 {
197- struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap;
198+ struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
199 struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem;
200 struct sta_rec_he *he;
201 struct tlv *tlv;
202@@ -708,7 +708,7 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
203
204 he->he_cap = cpu_to_le32(cap);
205
206- switch (sta->deflink.bandwidth) {
207+ switch (sta->bandwidth) {
208 case IEEE80211_STA_RX_BW_160:
209 if (elem->phy_cap_info[0] &
210 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
211@@ -753,7 +753,7 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
212 static void
213 mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
214 {
215- struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap;
216+ struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
217 struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem;
218 struct sta_rec_he_v2 *he;
219 struct tlv *tlv;
220@@ -764,7 +764,7 @@ mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
221 memcpy(he->he_phy_cap, elem->phy_cap_info, sizeof(he->he_phy_cap));
222 memcpy(he->he_mac_cap, elem->mac_cap_info, sizeof(he->he_mac_cap));
223
224- switch (sta->deflink.bandwidth) {
225+ switch (sta->bandwidth) {
226 case IEEE80211_STA_RX_BW_160:
227 if (elem->phy_cap_info[0] &
228 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
229@@ -780,7 +780,7 @@ mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
230 break;
231 }
232
233- he->pkt_ext = IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US;
234+ he->pkt_ext = IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US;
235 }
236
237 static u8
238@@ -793,9 +793,9 @@ mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif,
239 u8 mode = 0;
240
241 if (sta) {
242- ht_cap = &sta->deflink.ht_cap;
243- vht_cap = &sta->deflink.vht_cap;
244- he_cap = &sta->deflink.he_cap;
245+ ht_cap = &sta->ht_cap;
246+ vht_cap = &sta->vht_cap;
247+ he_cap = &sta->he_cap;
248 } else {
249 struct ieee80211_supported_band *sband;
250
251@@ -844,25 +844,25 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
252 u16 supp_rates;
253
254 /* starec ht */
255- if (sta->deflink.ht_cap.ht_supported) {
256+ if (sta->ht_cap.ht_supported) {
257 struct sta_rec_ht *ht;
258
259 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht));
260 ht = (struct sta_rec_ht *)tlv;
261- ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap);
262+ ht->ht_cap = cpu_to_le16(sta->ht_cap.cap);
263 }
264
265 /* starec vht */
266- if (sta->deflink.vht_cap.vht_supported) {
267+ if (sta->vht_cap.vht_supported) {
268 struct sta_rec_vht *vht;
269 int len;
270
271 len = is_mt7921(dev) ? sizeof(*vht) : sizeof(*vht) - 4;
272 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, len);
273 vht = (struct sta_rec_vht *)tlv;
274- vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap);
275- vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map;
276- vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map;
277+ vht->vht_cap = cpu_to_le32(sta->vht_cap.cap);
278+ vht->vht_rx_mcs_map = sta->vht_cap.vht_mcs.rx_mcs_map;
279+ vht->vht_tx_mcs_map = sta->vht_cap.vht_mcs.tx_mcs_map;
280 }
281
282 /* starec uapsd */
283@@ -871,11 +871,11 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
284 if (!is_mt7921(dev))
285 return;
286
287- if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he)
288+ if (sta->ht_cap.ht_supported || sta->he_cap.has_he)
289 mt76_connac_mcu_sta_amsdu_tlv(skb, sta, vif);
290
291 /* starec he */
292- if (sta->deflink.he_cap.has_he) {
293+ if (sta->he_cap.has_he) {
294 mt76_connac_mcu_sta_he_tlv(skb, sta);
295 mt76_connac_mcu_sta_he_tlv_v2(skb, sta);
296 if (band == NL80211_BAND_6GHZ &&
297@@ -885,7 +885,7 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
298 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE_6G,
299 sizeof(*he_6g_capa));
300 he_6g_capa = (struct sta_rec_he_6g_capa *)tlv;
301- he_6g_capa->capa = sta->deflink.he_6ghz_capa.capa;
302+ he_6g_capa->capa = sta->he_6ghz_capa.capa;
303 }
304 }
305
306@@ -895,14 +895,14 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
307 phy->basic_rate = cpu_to_le16((u16)vif->bss_conf.basic_rates);
308 phy->rcpi = rcpi;
309 phy->ampdu = FIELD_PREP(IEEE80211_HT_AMPDU_PARM_FACTOR,
310- sta->deflink.ht_cap.ampdu_factor) |
311+ sta->ht_cap.ampdu_factor) |
312 FIELD_PREP(IEEE80211_HT_AMPDU_PARM_DENSITY,
313- sta->deflink.ht_cap.ampdu_density);
314+ sta->ht_cap.ampdu_density);
315
316 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra_info));
317 ra_info = (struct sta_rec_ra_info *)tlv;
318
319- supp_rates = sta->deflink.supp_rates[band];
320+ supp_rates = sta->supp_rates[band];
321 if (band == NL80211_BAND_2GHZ)
322 supp_rates = FIELD_PREP(RA_LEGACY_OFDM, supp_rates >> 4) |
323 FIELD_PREP(RA_LEGACY_CCK, supp_rates & 0xf);
324@@ -911,18 +911,18 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
325
326 ra_info->legacy = cpu_to_le16(supp_rates);
327
328- if (sta->deflink.ht_cap.ht_supported)
329+ if (sta->ht_cap.ht_supported)
330 memcpy(ra_info->rx_mcs_bitmask,
331- sta->deflink.ht_cap.mcs.rx_mask,
332+ sta->ht_cap.mcs.rx_mask,
333 HT_MCS_MASK_NUM);
334
335 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_STATE, sizeof(*state));
336 state = (struct sta_rec_state *)tlv;
337 state->state = sta_state;
338
339- if (sta->deflink.vht_cap.vht_supported) {
340- state->vht_opmode = sta->deflink.bandwidth;
341- state->vht_opmode |= (sta->deflink.rx_nss - 1) <<
342+ if (sta->vht_cap.vht_supported) {
343+ state->vht_opmode = sta->bandwidth;
344+ state->vht_opmode |= (sta->rx_nss - 1) <<
345 IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT;
346 }
347 }
348@@ -938,7 +938,7 @@ void mt76_connac_mcu_wtbl_smps_tlv(struct sk_buff *skb,
349 tlv = mt76_connac_mcu_add_nested_tlv(skb, WTBL_SMPS, sizeof(*smps),
350 wtbl_tlv, sta_wtbl);
351 smps = (struct wtbl_smps *)tlv;
352- smps->smps = (sta->deflink.smps_mode == IEEE80211_SMPS_DYNAMIC);
353+ smps->smps = (sta->smps_mode == IEEE80211_SMPS_DYNAMIC);
354 }
355 EXPORT_SYMBOL_GPL(mt76_connac_mcu_wtbl_smps_tlv);
356
357@@ -950,27 +950,27 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
358 struct tlv *tlv;
359 u32 flags = 0;
360
361- if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_6ghz_capa.capa) {
362+ if (sta->ht_cap.ht_supported || sta->he_6ghz_capa.capa) {
363 tlv = mt76_connac_mcu_add_nested_tlv(skb, WTBL_HT, sizeof(*ht),
364 wtbl_tlv, sta_wtbl);
365 ht = (struct wtbl_ht *)tlv;
366 ht->ldpc = ht_ldpc &&
367- !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING);
368+ !!(sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING);
369
370- if (sta->deflink.ht_cap.ht_supported) {
371- ht->af = sta->deflink.ht_cap.ampdu_factor;
372- ht->mm = sta->deflink.ht_cap.ampdu_density;
373+ if (sta->ht_cap.ht_supported) {
374+ ht->af = sta->ht_cap.ampdu_factor;
375+ ht->mm = sta->ht_cap.ampdu_density;
376 } else {
377- ht->af = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
378+ ht->af = le16_get_bits(sta->he_6ghz_capa.capa,
379 IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP);
380- ht->mm = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
381+ ht->mm = le16_get_bits(sta->he_6ghz_capa.capa,
382 IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START);
383 }
384
385 ht->ht = true;
386 }
387
388- if (sta->deflink.vht_cap.vht_supported || sta->deflink.he_6ghz_capa.capa) {
389+ if (sta->vht_cap.vht_supported || sta->he_6ghz_capa.capa) {
390 struct wtbl_vht *vht;
391 u8 af;
392
393@@ -979,18 +979,18 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
394 sta_wtbl);
395 vht = (struct wtbl_vht *)tlv;
396 vht->ldpc = vht_ldpc &&
397- !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC);
398+ !!(sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC);
399 vht->vht = true;
400
401 af = FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK,
402- sta->deflink.vht_cap.cap);
403+ sta->vht_cap.cap);
404 if (ht)
405 ht->af = max(ht->af, af);
406 }
407
408 mt76_connac_mcu_wtbl_smps_tlv(skb, sta, sta_wtbl, wtbl_tlv);
409
410- if (is_connac_v1(dev) && sta->deflink.ht_cap.ht_supported) {
411+ if (is_connac_v1(dev) && sta->ht_cap.ht_supported) {
412 /* sgi */
413 u32 msk = MT_WTBL_W5_SHORT_GI_20 | MT_WTBL_W5_SHORT_GI_40 |
414 MT_WTBL_W5_SHORT_GI_80 | MT_WTBL_W5_SHORT_GI_160;
415@@ -1000,15 +1000,15 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
416 sizeof(*raw), wtbl_tlv,
417 sta_wtbl);
418
419- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
420+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
421 flags |= MT_WTBL_W5_SHORT_GI_20;
422- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
423+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
424 flags |= MT_WTBL_W5_SHORT_GI_40;
425
426- if (sta->deflink.vht_cap.vht_supported) {
427- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
428+ if (sta->vht_cap.vht_supported) {
429+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
430 flags |= MT_WTBL_W5_SHORT_GI_80;
431- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
432+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
433 flags |= MT_WTBL_W5_SHORT_GI_160;
434 }
435 raw = (struct wtbl_raw *)tlv;
436@@ -1294,9 +1294,9 @@ u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
437 return 0x38;
438
439 if (sta) {
440- ht_cap = &sta->deflink.ht_cap;
441- vht_cap = &sta->deflink.vht_cap;
442- he_cap = &sta->deflink.he_cap;
443+ ht_cap = &sta->ht_cap;
444+ vht_cap = &sta->vht_cap;
445+ he_cap = &sta->he_cap;
446 } else {
447 struct ieee80211_supported_band *sband;
448
449@@ -1616,7 +1616,6 @@ int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
450 for (i = 0; i < sreq->n_ssids; i++) {
451 if (!sreq->ssids[i].ssid_len)
452 continue;
453-
454 req->ssids[i].ssid_len = cpu_to_le32(sreq->ssids[i].ssid_len);
455 memcpy(req->ssids[i].ssid, sreq->ssids[i].ssid,
456 sreq->ssids[i].ssid_len);
457@@ -1749,7 +1748,6 @@ int mt76_connac_mcu_sched_scan_req(struct mt76_phy *phy,
458 memcpy(req->ssids[i].ssid, ssid->ssid, ssid->ssid_len);
459 req->ssids[i].ssid_len = cpu_to_le32(ssid->ssid_len);
460 }
461-
462 req->match_num = sreq->n_match_sets;
463 for (i = 0; i < req->match_num; i++) {
464 match = &sreq->match_sets[i];
465@@ -2236,10 +2234,8 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev,
466 struct mt76_vif *vif,
467 struct ieee80211_bss_conf *info)
468 {
469- struct ieee80211_vif *mvif = container_of(info, struct ieee80211_vif,
470- bss_conf);
471 struct sk_buff *skb;
472- int i, len = min_t(int, mvif->cfg.arp_addr_cnt,
473+ int i, len = min_t(int, info->arp_addr_cnt,
474 IEEE80211_BSS_ARP_ADDR_LIST_LEN);
475 struct {
476 struct {
477@@ -2267,7 +2263,7 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev,
478
479 skb_put_data(skb, &req_hdr, sizeof(req_hdr));
480 for (i = 0; i < len; i++)
481- skb_put_data(skb, &mvif->cfg.arp_addr_list[i], sizeof(__be32));
482+ skb_put_data(skb, &info->arp_addr_list[i], sizeof(__be32));
483
484 return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD(OFFLOAD), true);
485 }
486diff --git a/mt76x02_mac.c b/mt76x02_mac.c
developer2324aa22023-04-12 11:30:15 +0800487index d3f7447..87ea3db 100644
developer6100db22023-04-05 13:22:26 +0800488--- a/mt76x02_mac.c
489+++ b/mt76x02_mac.c
490@@ -404,7 +404,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
491 txwi->rate |= cpu_to_le16(MT_RXWI_RATE_LDPC);
492 if ((info->flags & IEEE80211_TX_CTL_STBC) && nss == 1)
493 txwi->rate |= cpu_to_le16(MT_RXWI_RATE_STBC);
494- if (nss > 1 && sta && sta->deflink.smps_mode == IEEE80211_SMPS_DYNAMIC)
495+ if (nss > 1 && sta && sta->smps_mode == IEEE80211_SMPS_DYNAMIC)
496 txwi_flags |= MT_TXWI_FLAGS_MMPS;
497 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
498 txwi->ack_ctl |= MT_TXWI_ACK_CTL_REQ;
499@@ -412,9 +412,9 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
500 txwi->ack_ctl |= MT_TXWI_ACK_CTL_NSEQ;
501 if ((info->flags & IEEE80211_TX_CTL_AMPDU) && sta) {
502 u8 ba_size = IEEE80211_MIN_AMPDU_BUF;
503- u8 ampdu_density = sta->deflink.ht_cap.ampdu_density;
504+ u8 ampdu_density = sta->ht_cap.ampdu_density;
505
506- ba_size <<= sta->deflink.ht_cap.ampdu_factor;
507+ ba_size <<= sta->ht_cap.ampdu_factor;
508 ba_size = min_t(int, 63, ba_size - 1);
509 if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
510 ba_size = 0;
511diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
developer2324aa22023-04-12 11:30:15 +0800512index 079629a..dcd773c 100644
developer6100db22023-04-05 13:22:26 +0800513--- a/mt7915/debugfs.c
514+++ b/mt7915/debugfs.c
515@@ -1911,8 +1911,8 @@ static ssize_t mt7915_sta_fixed_rate_set(struct file *file,
516
517 phy.ldpc = (phy.bw || phy.ldpc) * GENMASK(2, 0);
518 for (i = 0; i <= phy.bw; i++) {
519- phy.sgi |= gi << (i << sta->deflink.he_cap.has_he);
520- phy.he_ltf |= he_ltf << (i << sta->deflink.he_cap.has_he);
521+ phy.sgi |= gi << (i << sta->he_cap.has_he);
522+ phy.he_ltf |= he_ltf << (i << sta->he_cap.has_he);
523 }
524 field = RATE_PARAM_FIXED;
525
526diff --git a/mt7915/dma.c b/mt7915/dma.c
developer2324aa22023-04-12 11:30:15 +0800527index 60138f5..b30e418 100644
developer6100db22023-04-05 13:22:26 +0800528--- a/mt7915/dma.c
529+++ b/mt7915/dma.c
developer2324aa22023-04-12 11:30:15 +0800530@@ -590,8 +590,8 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
developer6100db22023-04-05 13:22:26 +0800531 if (ret < 0)
532 return ret;
533
534- netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
535- mt7915_poll_tx);
536+ netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
537+ mt7915_poll_tx, NAPI_POLL_WEIGHT);
538 napi_enable(&dev->mt76.tx_napi);
539
developer2324aa22023-04-12 11:30:15 +0800540 mt7915_dma_enable(dev, false);
developer6100db22023-04-05 13:22:26 +0800541diff --git a/mt7915/init.c b/mt7915/init.c
developer2324aa22023-04-12 11:30:15 +0800542index 70563c9..0b85228 100644
developer6100db22023-04-05 13:22:26 +0800543--- a/mt7915/init.c
544+++ b/mt7915/init.c
545@@ -1160,8 +1160,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
546 mt7915_gen_ppe_thresh(he_cap->ppe_thres, nss);
547 } else {
548 he_cap_elem->phy_cap_info[9] |=
549- u8_encode_bits(IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US,
550- IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK);
551+ IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US;
552 }
553
554 if (band == NL80211_BAND_6GHZ) {
555diff --git a/mt7915/mac.c b/mt7915/mac.c
developer2324aa22023-04-12 11:30:15 +0800556index 7450cc9..d1732b8 100644
developer6100db22023-04-05 13:22:26 +0800557--- a/mt7915/mac.c
558+++ b/mt7915/mac.c
559@@ -902,7 +902,7 @@ mt7915_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
560 u16 fc, tid;
561 u32 val;
562
563- if (!sta || !(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
564+ if (!sta || !(sta->ht_cap.ht_supported || sta->he_cap.has_he))
565 return;
566
567 tid = le32_get_bits(txwi[1], MT_TXD1_TID);
568diff --git a/mt7915/main.c b/mt7915/main.c
developer2324aa22023-04-12 11:30:15 +0800569index d674f12..f4b0cad 100644
developer6100db22023-04-05 13:22:26 +0800570--- a/mt7915/main.c
571+++ b/mt7915/main.c
developer2324aa22023-04-12 11:30:15 +0800572@@ -530,7 +530,7 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
developer6100db22023-04-05 13:22:26 +0800573
574 static int
575 mt7915_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
576- unsigned int link_id, u16 queue,
577+ u16 queue,
578 const struct ieee80211_tx_queue_params *params)
579 {
580 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
developer2324aa22023-04-12 11:30:15 +0800581@@ -625,7 +625,7 @@ mt7915_update_bss_color(struct ieee80211_hw *hw,
developer6100db22023-04-05 13:22:26 +0800582 static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
583 struct ieee80211_vif *vif,
584 struct ieee80211_bss_conf *info,
585- u64 changed)
586+ u32 changed)
587 {
588 struct mt7915_phy *phy = mt7915_hw_phy(hw);
589 struct mt7915_dev *dev = mt7915_hw_dev(hw);
developer2324aa22023-04-12 11:30:15 +0800590@@ -645,7 +645,7 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
developer6100db22023-04-05 13:22:26 +0800591 }
592
593 if (changed & BSS_CHANGED_ASSOC)
594- mt7915_mcu_add_bss_info(phy, vif, vif->cfg.assoc);
595+ mt7915_mcu_add_bss_info(phy, vif, info->assoc);
596
597 if (changed & BSS_CHANGED_ERP_CTS_PROT)
598 mt7915_mac_enable_rtscts(dev, vif, info->use_cts_prot);
developer2324aa22023-04-12 11:30:15 +0800599@@ -1234,10 +1234,10 @@ static int mt7915_sta_set_txpwr(struct ieee80211_hw *hw,
developer6100db22023-04-05 13:22:26 +0800600 {
601 struct mt7915_phy *phy = mt7915_hw_phy(hw);
602 struct mt7915_dev *dev = mt7915_hw_dev(hw);
603- s16 txpower = sta->deflink.txpwr.power;
604+ s16 txpower = sta->txpwr.power;
605 int ret;
606
607- if (sta->deflink.txpwr.type == NL80211_TX_POWER_AUTOMATIC)
608+ if (sta->txpwr.type == NL80211_TX_POWER_AUTOMATIC)
609 txpower = 0;
610
611 mutex_lock(&dev->mt76.mutex);
612diff --git a/mt7915/mcu.c b/mt7915/mcu.c
developer2324aa22023-04-12 11:30:15 +0800613index 2a40f5a..a8b3fe6 100644
developer6100db22023-04-05 13:22:26 +0800614--- a/mt7915/mcu.c
615+++ b/mt7915/mcu.c
616@@ -64,7 +64,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
617 struct mt7915_dev *dev = msta->vif->phy->dev;
618 enum nl80211_band band = msta->vif->phy->mt76->chandef.chan->band;
619 const u16 *mask = msta->vif->bitrate_mask.control[band].he_mcs;
620- int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
621+ int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
622
623 for (nss = 0; nss < max_nss; nss++) {
624 int mcs;
625@@ -104,7 +104,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
626
627 /* only support 2ss on 160MHz for mt7915 */
628 if (is_mt7915(&dev->mt76) && nss > 1 &&
629- sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
630+ sta->bandwidth == IEEE80211_STA_RX_BW_160)
631 break;
632 }
633
634@@ -117,8 +117,8 @@ mt7915_mcu_set_sta_vht_mcs(struct ieee80211_sta *sta, __le16 *vht_mcs,
635 {
636 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
637 struct mt7915_dev *dev = msta->vif->phy->dev;
638- u16 mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map);
639- int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
640+ u16 mcs_map = le16_to_cpu(sta->vht_cap.vht_mcs.rx_mcs_map);
641+ int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
642 u16 mcs;
643
644 for (nss = 0; nss < max_nss; nss++, mcs_map >>= 2) {
645@@ -140,7 +140,7 @@ mt7915_mcu_set_sta_vht_mcs(struct ieee80211_sta *sta, __le16 *vht_mcs,
646
647 /* only support 2ss on 160MHz for mt7915 */
648 if (is_mt7915(&dev->mt76) && nss > 1 &&
649- sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
650+ sta->bandwidth == IEEE80211_STA_RX_BW_160)
651 break;
652 }
653 }
654@@ -149,10 +149,10 @@ static void
655 mt7915_mcu_set_sta_ht_mcs(struct ieee80211_sta *sta, u8 *ht_mcs,
656 const u8 *mask)
657 {
658- int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
659+ int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
660
661 for (nss = 0; nss < max_nss; nss++)
662- ht_mcs[nss] = sta->deflink.ht_cap.mcs.rx_mask[nss] & mask[nss];
663+ ht_mcs[nss] = sta->ht_cap.mcs.rx_mask[nss] & mask[nss];
664 }
665
666 static int
667@@ -233,7 +233,7 @@ int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3)
668 static void
669 mt7915_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
670 {
671- if (vif->bss_conf.csa_active)
672+ if (vif->csa_active)
673 ieee80211_csa_finish(vif);
674 }
675
676@@ -334,7 +334,7 @@ mt7915_mcu_rx_log_message(struct mt7915_dev *dev, struct sk_buff *skb)
677 static void
678 mt7915_mcu_cca_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
679 {
680- if (!vif->bss_conf.color_change_active)
681+ if (!vif->color_change_active)
682 return;
683
684 ieee80211_color_change_finish(vif);
685@@ -748,13 +748,13 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
686 struct ieee80211_vif *vif)
687 {
688 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
689- struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem;
690+ struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem;
691 struct ieee80211_he_mcs_nss_supp mcs_map;
692 struct sta_rec_he *he;
693 struct tlv *tlv;
694 u32 cap = 0;
695
696- if (!sta->deflink.he_cap.has_he)
697+ if (!sta->he_cap.has_he)
698 return;
699
700 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE, sizeof(*he));
701@@ -840,8 +840,8 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
702
703 he->he_cap = cpu_to_le32(cap);
704
705- mcs_map = sta->deflink.he_cap.he_mcs_nss_supp;
706- switch (sta->deflink.bandwidth) {
707+ mcs_map = sta->he_cap.he_mcs_nss_supp;
708+ switch (sta->bandwidth) {
709 case IEEE80211_STA_RX_BW_160:
710 if (elem->phy_cap_info[0] &
711 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
712@@ -892,7 +892,7 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
713 {
714 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
715 struct mt7915_phy *phy = mvif->phy;
716- struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem;
717+ struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem;
718 struct sta_rec_muru *muru;
719 struct tlv *tlv;
720
721@@ -916,11 +916,11 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
722 muru->cfg.ofdma_dl_en = !!(phy->muru_onoff & OFDMA_DL);
723 muru->cfg.ofdma_ul_en = !!(phy->muru_onoff & OFDMA_UL);
724
725- if (sta->deflink.vht_cap.vht_supported)
726+ if (sta->vht_cap.vht_supported)
727 muru->mimo_dl.vht_mu_bfee =
728- !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
729+ !!(sta->vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
730
731- if (!sta->deflink.he_cap.has_he)
732+ if (!sta->he_cap.has_he)
733 return;
734
735 muru->mimo_dl.partial_bw_dl_mimo =
736@@ -954,13 +954,13 @@ mt7915_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
737 struct sta_rec_ht *ht;
738 struct tlv *tlv;
739
740- if (!sta->deflink.ht_cap.ht_supported)
741+ if (!sta->ht_cap.ht_supported)
742 return;
743
744 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht));
745
746 ht = (struct sta_rec_ht *)tlv;
747- ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap);
748+ ht->ht_cap = cpu_to_le16(sta->ht_cap.cap);
749 }
750
751 static void
752@@ -969,15 +969,15 @@ mt7915_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
753 struct sta_rec_vht *vht;
754 struct tlv *tlv;
755
756- if (!sta->deflink.vht_cap.vht_supported)
757+ if (!sta->vht_cap.vht_supported)
758 return;
759
760 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, sizeof(*vht));
761
762 vht = (struct sta_rec_vht *)tlv;
763- vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap);
764- vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map;
765- vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map;
766+ vht->vht_cap = cpu_to_le32(sta->vht_cap.cap);
767+ vht->vht_rx_mcs_map = sta->vht_cap.vht_mcs.rx_mcs_map;
768+ vht->vht_tx_mcs_map = sta->vht_cap.vht_mcs.tx_mcs_map;
769 }
770
771 static void
772@@ -992,7 +992,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
773 vif->type != NL80211_IFTYPE_AP)
774 return;
775
776- if (!sta->deflink.agg.max_amsdu_len)
777+ if (!sta->max_amsdu_len)
778 return;
779
780 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu));
781@@ -1001,7 +1001,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
782 amsdu->amsdu_en = true;
783 msta->wcid.amsdu = true;
784
785- switch (sta->deflink.agg.max_amsdu_len) {
786+ switch (sta->max_amsdu_len) {
787 case IEEE80211_MAX_MPDU_LEN_VHT_11454:
788 if (!is_mt7915(&dev->mt76)) {
789 amsdu->max_mpdu_size =
790@@ -1064,8 +1064,8 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
791 if (!bfee && tx_ant < 2)
792 return false;
793
794- if (sta->deflink.he_cap.has_he) {
795- struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem;
796+ if (sta->he_cap.has_he) {
797+ struct ieee80211_he_cap_elem *pe = &sta->he_cap.he_cap_elem;
798
799 if (bfee)
800 return mvif->cap.he_su_ebfee &&
801@@ -1075,8 +1075,8 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
802 HE_PHY(CAP4_SU_BEAMFORMEE, pe->phy_cap_info[4]);
803 }
804
805- if (sta->deflink.vht_cap.vht_supported) {
806- u32 cap = sta->deflink.vht_cap.cap;
807+ if (sta->vht_cap.vht_supported) {
808+ u32 cap = sta->vht_cap.cap;
809
810 if (bfee)
811 return mvif->cap.vht_su_ebfee &&
812@@ -1102,7 +1102,7 @@ static void
813 mt7915_mcu_sta_bfer_ht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
814 struct sta_rec_bf *bf)
815 {
816- struct ieee80211_mcs_info *mcs = &sta->deflink.ht_cap.mcs;
817+ struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
818 u8 n = 0;
819
820 bf->tx_mode = MT_PHY_TYPE_HT;
821@@ -1127,7 +1127,7 @@ static void
822 mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
823 struct sta_rec_bf *bf, bool explicit)
824 {
825- struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap;
826+ struct ieee80211_sta_vht_cap *pc = &sta->vht_cap;
827 struct ieee80211_sta_vht_cap *vc = &phy->mt76->sband_5g.sband.vht_cap;
828 u16 mcs_map = le16_to_cpu(pc->vht_mcs.rx_mcs_map);
829 u8 nss_mcs = mt7915_mcu_get_sta_nss(mcs_map);
830@@ -1148,14 +1148,14 @@ mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
831 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
832 bf->ibf_ncol = bf->ncol;
833
834- if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
835+ if (sta->bandwidth == IEEE80211_STA_RX_BW_160)
836 bf->nrow = 1;
837 } else {
838 bf->nrow = tx_ant;
839 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
840 bf->ibf_ncol = nss_mcs;
841
842- if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
843+ if (sta->bandwidth == IEEE80211_STA_RX_BW_160)
844 bf->ibf_nrow = 1;
845 }
846 }
847@@ -1164,7 +1164,7 @@ static void
848 mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
849 struct mt7915_phy *phy, struct sta_rec_bf *bf)
850 {
851- struct ieee80211_sta_he_cap *pc = &sta->deflink.he_cap;
852+ struct ieee80211_sta_he_cap *pc = &sta->he_cap;
853 struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem;
854 const struct ieee80211_sta_he_cap *vc =
855 mt76_connac_get_he_phy_cap(phy->mt76, vif);
856@@ -1189,7 +1189,7 @@ mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
857 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
858 bf->ibf_ncol = bf->ncol;
859
860- if (sta->deflink.bandwidth != IEEE80211_STA_RX_BW_160)
861+ if (sta->bandwidth != IEEE80211_STA_RX_BW_160)
862 return;
863
864 /* go over for 160MHz and 80p80 */
865@@ -1237,7 +1237,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
866 };
867 bool ebf;
868
869- if (!(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
870+ if (!(sta->ht_cap.ht_supported || sta->he_cap.has_he))
871 return;
872
873 ebf = mt7915_is_ebf_supported(phy, vif, sta, false);
874@@ -1251,21 +1251,21 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
875 * vht: support eBF and iBF
876 * ht: iBF only, since mac80211 lacks of eBF support
877 */
878- if (sta->deflink.he_cap.has_he && ebf)
879+ if (sta->he_cap.has_he && ebf)
880 mt7915_mcu_sta_bfer_he(sta, vif, phy, bf);
881- else if (sta->deflink.vht_cap.vht_supported)
882+ else if (sta->vht_cap.vht_supported)
883 mt7915_mcu_sta_bfer_vht(sta, phy, bf, ebf);
884- else if (sta->deflink.ht_cap.ht_supported)
885+ else if (sta->ht_cap.ht_supported)
886 mt7915_mcu_sta_bfer_ht(sta, phy, bf);
887 else
888 return;
889
890 bf->bf_cap = ebf ? ebf : dev->ibf << 1;
891- bf->bw = sta->deflink.bandwidth;
892- bf->ibf_dbw = sta->deflink.bandwidth;
893+ bf->bw = sta->bandwidth;
894+ bf->ibf_dbw = sta->bandwidth;
895 bf->ibf_nrow = tx_ant;
896
897- if (!ebf && sta->deflink.bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol)
898+ if (!ebf && sta->bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol)
899 bf->ibf_timeout = 0x48;
900 else
901 bf->ibf_timeout = 0x18;
902@@ -1275,7 +1275,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
903 else
904 bf->mem_20m = matrix[bf->nrow][bf->ncol];
905
906- switch (sta->deflink.bandwidth) {
907+ switch (sta->bandwidth) {
908 case IEEE80211_STA_RX_BW_160:
909 case IEEE80211_STA_RX_BW_80:
910 bf->mem_total = bf->mem_20m * 2;
911@@ -1300,7 +1300,7 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
912 struct tlv *tlv;
913 u8 nrow = 0;
914
915- if (!(sta->deflink.vht_cap.vht_supported || sta->deflink.he_cap.has_he))
916+ if (!(sta->vht_cap.vht_supported || sta->he_cap.has_he))
917 return;
918
919 if (!mt7915_is_ebf_supported(phy, vif, sta, true))
920@@ -1309,13 +1309,13 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
921 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_BFEE, sizeof(*bfee));
922 bfee = (struct sta_rec_bfee *)tlv;
923
924- if (sta->deflink.he_cap.has_he) {
925- struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem;
926+ if (sta->he_cap.has_he) {
927+ struct ieee80211_he_cap_elem *pe = &sta->he_cap.he_cap_elem;
928
929 nrow = HE_PHY(CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK,
930 pe->phy_cap_info[5]);
931- } else if (sta->deflink.vht_cap.vht_supported) {
932- struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap;
933+ } else if (sta->vht_cap.vht_supported) {
934+ struct ieee80211_sta_vht_cap *pc = &sta->vht_cap;
935
936 nrow = FIELD_GET(IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK,
937 pc->cap);
938@@ -1371,7 +1371,7 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
939 ra->phy = *phy;
940 break;
941 case RATE_PARAM_MMPS_UPDATE:
942- ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->deflink.smps_mode);
943+ ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->smps_mode);
944 break;
945 case RATE_PARAM_SPE_UPDATE:
946 ra->spe_idx = *(u8 *)data;
947@@ -1446,7 +1446,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
948 do { \
949 u8 i, gi = mask->control[band]._gi; \
950 gi = (_he) ? gi : gi == NL80211_TXRATE_FORCE_SGI; \
951- for (i = 0; i <= sta->deflink.bandwidth; i++) { \
952+ for (i = 0; i <= sta->bandwidth; i++) { \
953 phy.sgi |= gi << (i << (_he)); \
954 phy.he_ltf |= mask->control[band].he_ltf << (i << (_he));\
955 } \
956@@ -1460,11 +1460,11 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
957 } \
958 } while (0)
959
960- if (sta->deflink.he_cap.has_he) {
961+ if (sta->he_cap.has_he) {
962 __sta_phy_bitrate_mask_check(he_mcs, he_gi, 0, 1);
963- } else if (sta->deflink.vht_cap.vht_supported) {
964+ } else if (sta->vht_cap.vht_supported) {
965 __sta_phy_bitrate_mask_check(vht_mcs, gi, 0, 0);
966- } else if (sta->deflink.ht_cap.ht_supported) {
967+ } else if (sta->ht_cap.ht_supported) {
968 __sta_phy_bitrate_mask_check(ht_mcs, gi, 1, 0);
969 } else {
970 nrates = hweight32(mask->control[band].legacy);
971@@ -1498,7 +1498,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
972 * actual txrate hardware sends out.
973 */
974 addr = mt7915_mac_wtbl_lmac_addr(dev, msta->wcid.idx, 7);
975- if (sta->deflink.he_cap.has_he)
976+ if (sta->he_cap.has_he)
977 mt76_rmw_field(dev, addr, GENMASK(31, 24), phy.sgi);
978 else
979 mt76_rmw_field(dev, addr, GENMASK(15, 12), phy.sgi);
980@@ -1531,7 +1531,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
981 enum nl80211_band band = chandef->chan->band;
982 struct sta_rec_ra *ra;
983 struct tlv *tlv;
984- u32 supp_rate = sta->deflink.supp_rates[band];
985+ u32 supp_rate = sta->supp_rates[band];
986 u32 cap = sta->wme ? STA_CAP_WMM : 0;
987
988 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra));
989@@ -1541,9 +1541,9 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
990 ra->auto_rate = true;
991 ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, sta);
992 ra->channel = chandef->chan->hw_value;
993- ra->bw = sta->deflink.bandwidth;
994- ra->phy.bw = sta->deflink.bandwidth;
995- ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->deflink.smps_mode);
996+ ra->bw = sta->bandwidth;
997+ ra->phy.bw = sta->bandwidth;
998+ ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->smps_mode);
999
1000 if (supp_rate) {
1001 supp_rate &= mask->control[band].legacy;
1002@@ -1563,22 +1563,22 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
1003 }
1004 }
1005
1006- if (sta->deflink.ht_cap.ht_supported) {
1007+ if (sta->ht_cap.ht_supported) {
1008 ra->supp_mode |= MODE_HT;
1009- ra->af = sta->deflink.ht_cap.ampdu_factor;
1010- ra->ht_gf = !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
1011+ ra->af = sta->ht_cap.ampdu_factor;
1012+ ra->ht_gf = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
1013
1014 cap |= STA_CAP_HT;
1015- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
1016+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
1017 cap |= STA_CAP_SGI_20;
1018- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
1019+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
1020 cap |= STA_CAP_SGI_40;
1021- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)
1022+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)
1023 cap |= STA_CAP_TX_STBC;
1024- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
1025+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
1026 cap |= STA_CAP_RX_STBC;
1027 if (mvif->cap.ht_ldpc &&
1028- (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING))
1029+ (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING))
1030 cap |= STA_CAP_LDPC;
1031
1032 mt7915_mcu_set_sta_ht_mcs(sta, ra->ht_mcs,
1033@@ -1586,37 +1586,37 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
1034 ra->supp_ht_mcs = *(__le32 *)ra->ht_mcs;
1035 }
1036
1037- if (sta->deflink.vht_cap.vht_supported) {
1038+ if (sta->vht_cap.vht_supported) {
1039 u8 af;
1040
1041 ra->supp_mode |= MODE_VHT;
1042 af = FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK,
1043- sta->deflink.vht_cap.cap);
1044+ sta->vht_cap.cap);
1045 ra->af = max_t(u8, ra->af, af);
1046
1047 cap |= STA_CAP_VHT;
1048- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
1049+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
1050 cap |= STA_CAP_VHT_SGI_80;
1051- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
1052+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
1053 cap |= STA_CAP_VHT_SGI_160;
1054- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC)
1055+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC)
1056 cap |= STA_CAP_VHT_TX_STBC;
1057- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1)
1058+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1)
1059 cap |= STA_CAP_VHT_RX_STBC;
1060 if (mvif->cap.vht_ldpc &&
1061- (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC))
1062+ (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC))
1063 cap |= STA_CAP_VHT_LDPC;
1064
1065 mt7915_mcu_set_sta_vht_mcs(sta, ra->supp_vht_mcs,
1066 mask->control[band].vht_mcs);
1067 }
1068
1069- if (sta->deflink.he_cap.has_he) {
1070+ if (sta->he_cap.has_he) {
1071 ra->supp_mode |= MODE_HE;
1072 cap |= STA_CAP_HE;
1073
1074- if (sta->deflink.he_6ghz_capa.capa)
1075- ra->af = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
1076+ if (sta->he_6ghz_capa.capa)
1077+ ra->af = le16_get_bits(sta->he_6ghz_capa.capa,
1078 IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP);
1079 }
1080
1081@@ -1825,7 +1825,7 @@ mt7915_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,
1082 if (!offs->cntdwn_counter_offs[0])
1083 return;
1084
1085- sub_tag = vif->bss_conf.csa_active ? BSS_INFO_BCN_CSA : BSS_INFO_BCN_BCC;
1086+ sub_tag = vif->csa_active ? BSS_INFO_BCN_CSA : BSS_INFO_BCN_BCC;
1087 tlv = mt7915_mcu_add_nested_subtlv(rskb, sub_tag, sizeof(*info),
1088 &bcn->sub_ntlv, &bcn->len);
1089 info = (struct bss_info_bcn_cntdwn *)tlv;
1090@@ -1910,9 +1910,9 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,
1091 if (offs->cntdwn_counter_offs[0]) {
1092 u16 offset = offs->cntdwn_counter_offs[0];
1093
1094- if (vif->bss_conf.csa_active)
1095+ if (vif->csa_active)
1096 cont->csa_ofs = cpu_to_le16(offset - 4);
1097- if (vif->bss_conf.color_change_active)
1098+ if (vif->color_change_active)
1099 cont->bcc_ofs = cpu_to_le16(offset - 3);
1100 }
1101
1102@@ -2112,7 +2112,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1103 if (!en)
1104 goto out;
1105
1106- skb = ieee80211_beacon_get_template(hw, vif, &offs, 0);
1107+ skb = ieee80211_beacon_get_template(hw, vif, &offs);
1108 if (!skb)
1109 return -EINVAL;
1110
developer2324aa22023-04-12 11:30:15 +08001111@@ -3364,17 +3364,17 @@ int mt7915_mcu_set_txpower_frame(struct mt7915_phy *phy,
developer6100db22023-04-05 13:22:26 +08001112 if (txpower) {
1113 u32 offs, len, i;
1114
1115- if (sta->deflink.ht_cap.ht_supported) {
1116+ if (sta->ht_cap.ht_supported) {
1117 const u8 *sku_len = mt7915_sku_group_len;
1118
1119 offs = sku_len[SKU_CCK] + sku_len[SKU_OFDM];
1120 len = sku_len[SKU_HT_BW20] + sku_len[SKU_HT_BW40];
1121
1122- if (sta->deflink.vht_cap.vht_supported) {
1123+ if (sta->vht_cap.vht_supported) {
1124 offs += len;
1125 len = sku_len[SKU_VHT_BW20] * 4;
1126
1127- if (sta->deflink.he_cap.has_he) {
1128+ if (sta->he_cap.has_he) {
1129 offs += len + sku_len[SKU_HE_RU26] * 3;
1130 len = sku_len[SKU_HE_RU242] * 4;
1131 }
1132diff --git a/mt7915/testmode.c b/mt7915/testmode.c
developer2324aa22023-04-12 11:30:15 +08001133index f3b9392..95d3a6d 100644
developer6100db22023-04-05 13:22:26 +08001134--- a/mt7915/testmode.c
1135+++ b/mt7915/testmode.c
1136@@ -397,12 +397,12 @@ mt7915_tm_entry_add(struct mt7915_phy *phy, u8 aid)
1137 memcpy(sta->addr, td->addr[0], ETH_ALEN);
1138
1139 if (td->tx_rate_mode >= MT76_TM_TX_MODE_HT)
1140- memcpy(&sta->deflink.ht_cap, &sband->ht_cap, sizeof(sta->deflink.ht_cap));
1141+ memcpy(&sta->ht_cap, &sband->ht_cap, sizeof(sta->ht_cap));
1142 if (td->tx_rate_mode >= MT76_TM_TX_MODE_VHT)
1143- memcpy(&sta->deflink.vht_cap, &sband->vht_cap, sizeof(sta->deflink.vht_cap));
1144+ memcpy(&sta->vht_cap, &sband->vht_cap, sizeof(sta->vht_cap));
1145 if (td->tx_rate_mode >= MT76_TM_TX_MODE_HE_SU)
1146- memcpy(&sta->deflink.he_cap, &sdata[NL80211_IFTYPE_STATION].he_cap,
1147- sizeof(sta->deflink.he_cap));
1148+ memcpy(&sta->he_cap, &sdata[NL80211_IFTYPE_STATION].he_cap,
1149+ sizeof(sta->he_cap));
1150 sta->aid = aid;
1151 sta->wme = 1;
1152
1153diff --git a/tx.c b/tx.c
developer2324aa22023-04-12 11:30:15 +08001154index 5a43e4c..607f494 100644
developer6100db22023-04-05 13:22:26 +08001155--- a/tx.c
1156+++ b/tx.c
1157@@ -60,20 +60,15 @@ mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list)
1158 .skb = skb,
1159 .info = IEEE80211_SKB_CB(skb),
1160 };
1161- struct ieee80211_rate_status rs = {};
1162 struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb);
1163 struct mt76_wcid *wcid;
1164
1165 wcid = rcu_dereference(dev->wcid[cb->wcid]);
1166 if (wcid) {
1167 status.sta = wcid_to_sta(wcid);
1168- if (status.sta && (wcid->rate.flags || wcid->rate.legacy)) {
1169- rs.rate_idx = wcid->rate;
1170- status.rates = &rs;
1171- status.n_rates = 1;
1172- } else {
1173- status.n_rates = 0;
1174- }
1175+
1176+ if (status.sta)
1177+ status.rate = &wcid->rate;
1178 }
1179
1180 hw = mt76_tx_status_get_hw(dev, skb);
1181--
developer2324aa22023-04-12 11:30:15 +080011822.18.0
developer6100db22023-04-05 13:22:26 +08001183