blob: 2cf9c0d90bcb77ff93b605555ffae772bba1996a [file] [log] [blame]
developer2157bf82023-06-26 02:27:49 +08001From f433ab08414bf574d03a362ef997918cd98e696e 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
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 +-
developerbbd45e12023-05-19 08:22:06 +080014 mt76_connac_mcu.c | 108 +++++++++---------
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 +-
developer2157bf82023-06-26 02:27:49 +080019 mt7915/main.c | 17 ++-
developerbbd45e12023-05-19 08:22:06 +080020 mt7915/mcu.c | 273 ++++++++++++++++++++++++++++++----------------
developer2157bf82023-06-26 02:27:49 +080021 mt7915/mmio.c | 2 +-
developerbbd45e12023-05-19 08:22:06 +080022 mt7915/mt7915.h | 14 +++
23 mt7915/testmode.c | 8 +-
developer2157bf82023-06-26 02:27:49 +080024 tx.c | 22 ++--
25 17 files changed, 286 insertions(+), 201 deletions(-)
developer6100db22023-04-05 13:22:26 +080026
27diff --git a/dma.c b/dma.c
developerbbd45e12023-05-19 08:22:06 +080028index 4daa64d..220e684 100644
developer6100db22023-04-05 13:22:26 +080029--- a/dma.c
30+++ b/dma.c
developerbbd45e12023-05-19 08:22:06 +080031@@ -994,7 +994,7 @@ mt76_dma_init(struct mt76_dev *dev,
developer6100db22023-04-05 13:22:26 +080032 init_completion(&dev->mmio.wed_reset_complete);
33
34 mt76_for_each_q_rx(dev, i) {
35- netif_napi_add(&dev->napi_dev, &dev->napi[i], poll);
36+ netif_napi_add(&dev->napi_dev, &dev->napi[i], poll, 64);
37 mt76_dma_rx_fill(dev, &dev->q_rx[i]);
38 napi_enable(&dev->napi[i]);
39 }
40diff --git a/mac80211.c b/mac80211.c
developer2157bf82023-06-26 02:27:49 +080041index 52c552b..b5cee8c 100644
developer6100db22023-04-05 13:22:26 +080042--- a/mac80211.c
43+++ b/mac80211.c
developer2157bf82023-06-26 02:27:49 +080044@@ -1521,7 +1521,7 @@ EXPORT_SYMBOL_GPL(mt76_get_sar_power);
developer6100db22023-04-05 13:22:26 +080045 static void
46 __mt76_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
47 {
48- if (vif->bss_conf.csa_active && ieee80211_beacon_cntdwn_is_complete(vif))
49+ if (vif->csa_active && ieee80211_beacon_cntdwn_is_complete(vif))
50 ieee80211_csa_finish(vif);
51 }
52
developer2157bf82023-06-26 02:27:49 +080053@@ -1543,7 +1543,7 @@ __mt76_csa_check(void *priv, u8 *mac, struct ieee80211_vif *vif)
developer6100db22023-04-05 13:22:26 +080054 {
55 struct mt76_dev *dev = priv;
56
57- if (!vif->bss_conf.csa_active)
58+ if (!vif->csa_active)
59 return;
60
61 dev->csa_complete |= ieee80211_beacon_cntdwn_is_complete(vif);
62diff --git a/mt7615/dma.c b/mt7615/dma.c
developerbbd45e12023-05-19 08:22:06 +080063index 0ce01cc..ad32485 100644
developer6100db22023-04-05 13:22:26 +080064--- a/mt7615/dma.c
65+++ b/mt7615/dma.c
developerbbd45e12023-05-19 08:22:06 +080066@@ -282,8 +282,8 @@ int mt7615_dma_init(struct mt7615_dev *dev)
developer6100db22023-04-05 13:22:26 +080067 if (ret < 0)
68 return ret;
69
70- netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
71- mt7615_poll_tx);
72+ netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
73+ mt7615_poll_tx, NAPI_POLL_WEIGHT);
74 napi_enable(&dev->mt76.tx_napi);
75
76 mt76_poll(dev, MT_WPDMA_GLO_CFG,
77diff --git a/mt7615/main.c b/mt7615/main.c
developer2157bf82023-06-26 02:27:49 +080078index 200b175..53f30a0 100644
developer6100db22023-04-05 13:22:26 +080079--- a/mt7615/main.c
80+++ b/mt7615/main.c
developer22eedcc2023-05-03 22:59:35 +080081@@ -473,7 +473,7 @@ static int mt7615_config(struct ieee80211_hw *hw, u32 changed)
developer6100db22023-04-05 13:22:26 +080082
83 static int
84 mt7615_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
85- unsigned int link_id, u16 queue,
86+ u16 queue,
87 const struct ieee80211_tx_queue_params *params)
88 {
89 struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
developer2157bf82023-06-26 02:27:49 +080090@@ -581,7 +581,7 @@ mt7615_update_mu_group(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +080091 static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
92 struct ieee80211_vif *vif,
93 struct ieee80211_bss_conf *info,
94- u64 changed)
95+ u32 changed)
96 {
97 struct mt7615_dev *dev = mt7615_hw_dev(hw);
98 struct mt7615_phy *phy = mt7615_hw_phy(hw);
developer2157bf82023-06-26 02:27:49 +080099@@ -624,7 +624,7 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
developer6100db22023-04-05 13:22:26 +0800100 }
101
102 if (changed & BSS_CHANGED_ASSOC)
103- mt7615_mac_set_beacon_filter(phy, vif, vif->cfg.assoc);
104+ mt7615_mac_set_beacon_filter(phy, vif, info->assoc);
105
developer2157bf82023-06-26 02:27:49 +0800106 if (changed & BSS_CHANGED_MU_GROUPS)
107 mt7615_update_mu_group(hw, vif, info);
developer6100db22023-04-05 13:22:26 +0800108diff --git a/mt7615/mcu.c b/mt7615/mcu.c
developerbbd45e12023-05-19 08:22:06 +0800109index 86061e9..a79308b 100644
developer6100db22023-04-05 13:22:26 +0800110--- a/mt7615/mcu.c
111+++ b/mt7615/mcu.c
112@@ -353,7 +353,7 @@ out:
113 static void
114 mt7615_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
115 {
116- if (vif->bss_conf.csa_active)
117+ if (vif->csa_active)
118 ieee80211_csa_finish(vif);
119 }
120
121@@ -699,7 +699,7 @@ mt7615_mcu_add_beacon_offload(struct mt7615_dev *dev,
122 if (!enable)
123 goto out;
124
125- skb = ieee80211_beacon_get_template(hw, vif, &offs, 0);
126+ skb = ieee80211_beacon_get_template(hw, vif, &offs);
127 if (!skb)
128 return -EINVAL;
129
developerbbd45e12023-05-19 08:22:06 +0800130@@ -1075,7 +1075,7 @@ mt7615_mcu_uni_add_beacon_offload(struct mt7615_dev *dev,
developer6100db22023-04-05 13:22:26 +0800131 if (!enable)
132 goto out;
133
134- skb = ieee80211_beacon_get_template(mt76_hw(dev), vif, &offs, 0);
135+ skb = ieee80211_beacon_get_template(mt76_hw(dev), vif, &offs);
136 if (!skb)
137 return -EINVAL;
138
developerbbd45e12023-05-19 08:22:06 +0800139@@ -2526,7 +2526,7 @@ int mt7615_mcu_set_bss_pm(struct mt7615_dev *dev, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800140 u8 pad;
141 } req = {
142 .bss_idx = mvif->mt76.idx,
143- .aid = cpu_to_le16(vif->cfg.aid),
144+ .aid = cpu_to_le16(vif->bss_conf.aid),
145 .dtim_period = vif->bss_conf.dtim_period,
146 .bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int),
147 };
developer2157bf82023-06-26 02:27:49 +0800148diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
149index 5edf912..44c5221 100644
150--- a/mt76_connac_mac.c
151+++ b/mt76_connac_mac.c
152@@ -1118,7 +1118,7 @@ void mt76_connac2_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
153 u32 val;
154
155 if (!sta ||
156- !(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
157+ !(sta->ht_cap.ht_supported || sta->he_cap.has_he))
158 return;
159
160 tid = le32_get_bits(txwi[1], MT_TXD1_TID);
developer6100db22023-04-05 13:22:26 +0800161diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
developer2157bf82023-06-26 02:27:49 +0800162index e6b468c..220c133 100644
developer6100db22023-04-05 13:22:26 +0800163--- a/mt76_connac_mcu.c
164+++ b/mt76_connac_mcu.c
165@@ -197,7 +197,7 @@ int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif)
166 */
167 } req = {
168 .bss_idx = mvif->idx,
169- .ps_state = vif->cfg.ps ? 2 : 0,
170+ .ps_state = vif->bss_conf.ps ? 2 : 0,
171 };
172
173 if (vif->type != NL80211_IFTYPE_STATION)
developerbbd45e12023-05-19 08:22:06 +0800174@@ -409,7 +409,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800175 else
176 conn_type = CONNECTION_INFRA_AP;
177 basic->conn_type = cpu_to_le32(conn_type);
178- basic->aid = cpu_to_le16(vif->cfg.aid);
179+ basic->aid = cpu_to_le16(vif->bss_conf.aid);
180 break;
181 case NL80211_IFTYPE_ADHOC:
182 basic->conn_type = cpu_to_le32(CONNECTION_IBSS_ADHOC);
183@@ -553,7 +553,7 @@ void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev,
184
185 if (sta) {
186 if (vif->type == NL80211_IFTYPE_STATION)
187- generic->partial_aid = cpu_to_le16(vif->cfg.aid);
188+ generic->partial_aid = cpu_to_le16(vif->bss_conf.aid);
189 else
190 generic->partial_aid = cpu_to_le16(sta->aid);
191 memcpy(generic->peer_addr, sta->addr, ETH_ALEN);
192@@ -602,14 +602,14 @@ mt76_connac_mcu_sta_amsdu_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
193 vif->type != NL80211_IFTYPE_STATION)
194 return;
195
196- if (!sta->deflink.agg.max_amsdu_len)
197+ if (!sta->max_amsdu_len)
198 return;
199
200 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu));
201 amsdu = (struct sta_rec_amsdu *)tlv;
202 amsdu->max_amsdu_num = 8;
203 amsdu->amsdu_en = true;
204- amsdu->max_mpdu_size = sta->deflink.agg.max_amsdu_len >=
205+ amsdu->max_mpdu_size = sta->max_amsdu_len >=
206 IEEE80211_MAX_MPDU_LEN_VHT_7991;
207
208 wcid->amsdu = true;
209@@ -620,7 +620,7 @@ mt76_connac_mcu_sta_amsdu_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
210 static void
211 mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
212 {
213- struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap;
214+ struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
215 struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem;
216 struct sta_rec_he *he;
217 struct tlv *tlv;
218@@ -708,7 +708,7 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
219
220 he->he_cap = cpu_to_le32(cap);
221
222- switch (sta->deflink.bandwidth) {
223+ switch (sta->bandwidth) {
224 case IEEE80211_STA_RX_BW_160:
225 if (elem->phy_cap_info[0] &
226 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
227@@ -753,7 +753,7 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
228 static void
229 mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
230 {
231- struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap;
232+ struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
233 struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem;
234 struct sta_rec_he_v2 *he;
235 struct tlv *tlv;
236@@ -764,7 +764,7 @@ mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
237 memcpy(he->he_phy_cap, elem->phy_cap_info, sizeof(he->he_phy_cap));
238 memcpy(he->he_mac_cap, elem->mac_cap_info, sizeof(he->he_mac_cap));
239
240- switch (sta->deflink.bandwidth) {
241+ switch (sta->bandwidth) {
242 case IEEE80211_STA_RX_BW_160:
243 if (elem->phy_cap_info[0] &
244 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
245@@ -780,7 +780,7 @@ mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
246 break;
247 }
248
249- he->pkt_ext = IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US;
250+ he->pkt_ext = IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US;
251 }
252
253 static u8
254@@ -793,9 +793,9 @@ mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif,
255 u8 mode = 0;
256
257 if (sta) {
258- ht_cap = &sta->deflink.ht_cap;
259- vht_cap = &sta->deflink.vht_cap;
260- he_cap = &sta->deflink.he_cap;
261+ ht_cap = &sta->ht_cap;
262+ vht_cap = &sta->vht_cap;
263+ he_cap = &sta->he_cap;
264 } else {
265 struct ieee80211_supported_band *sband;
266
267@@ -844,25 +844,25 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
268 u16 supp_rates;
269
270 /* starec ht */
271- if (sta->deflink.ht_cap.ht_supported) {
272+ if (sta->ht_cap.ht_supported) {
273 struct sta_rec_ht *ht;
274
275 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht));
276 ht = (struct sta_rec_ht *)tlv;
277- ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap);
278+ ht->ht_cap = cpu_to_le16(sta->ht_cap.cap);
279 }
280
281 /* starec vht */
282- if (sta->deflink.vht_cap.vht_supported) {
283+ if (sta->vht_cap.vht_supported) {
284 struct sta_rec_vht *vht;
285 int len;
286
287 len = is_mt7921(dev) ? sizeof(*vht) : sizeof(*vht) - 4;
288 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, len);
289 vht = (struct sta_rec_vht *)tlv;
290- vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap);
291- vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map;
292- vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map;
293+ vht->vht_cap = cpu_to_le32(sta->vht_cap.cap);
294+ vht->vht_rx_mcs_map = sta->vht_cap.vht_mcs.rx_mcs_map;
295+ vht->vht_tx_mcs_map = sta->vht_cap.vht_mcs.tx_mcs_map;
296 }
297
298 /* starec uapsd */
299@@ -871,11 +871,11 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
300 if (!is_mt7921(dev))
301 return;
302
303- if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he)
304+ if (sta->ht_cap.ht_supported || sta->he_cap.has_he)
305 mt76_connac_mcu_sta_amsdu_tlv(skb, sta, vif);
306
307 /* starec he */
308- if (sta->deflink.he_cap.has_he) {
309+ if (sta->he_cap.has_he) {
310 mt76_connac_mcu_sta_he_tlv(skb, sta);
311 mt76_connac_mcu_sta_he_tlv_v2(skb, sta);
312 if (band == NL80211_BAND_6GHZ &&
313@@ -885,7 +885,7 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
314 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE_6G,
315 sizeof(*he_6g_capa));
316 he_6g_capa = (struct sta_rec_he_6g_capa *)tlv;
317- he_6g_capa->capa = sta->deflink.he_6ghz_capa.capa;
318+ he_6g_capa->capa = sta->he_6ghz_capa.capa;
319 }
320 }
321
322@@ -895,14 +895,14 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
323 phy->basic_rate = cpu_to_le16((u16)vif->bss_conf.basic_rates);
324 phy->rcpi = rcpi;
325 phy->ampdu = FIELD_PREP(IEEE80211_HT_AMPDU_PARM_FACTOR,
326- sta->deflink.ht_cap.ampdu_factor) |
327+ sta->ht_cap.ampdu_factor) |
328 FIELD_PREP(IEEE80211_HT_AMPDU_PARM_DENSITY,
329- sta->deflink.ht_cap.ampdu_density);
330+ sta->ht_cap.ampdu_density);
331
332 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra_info));
333 ra_info = (struct sta_rec_ra_info *)tlv;
334
335- supp_rates = sta->deflink.supp_rates[band];
336+ supp_rates = sta->supp_rates[band];
337 if (band == NL80211_BAND_2GHZ)
338 supp_rates = FIELD_PREP(RA_LEGACY_OFDM, supp_rates >> 4) |
339 FIELD_PREP(RA_LEGACY_CCK, supp_rates & 0xf);
340@@ -911,18 +911,18 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
341
342 ra_info->legacy = cpu_to_le16(supp_rates);
343
344- if (sta->deflink.ht_cap.ht_supported)
345+ if (sta->ht_cap.ht_supported)
346 memcpy(ra_info->rx_mcs_bitmask,
347- sta->deflink.ht_cap.mcs.rx_mask,
348+ sta->ht_cap.mcs.rx_mask,
349 HT_MCS_MASK_NUM);
350
351 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_STATE, sizeof(*state));
352 state = (struct sta_rec_state *)tlv;
353 state->state = sta_state;
354
355- if (sta->deflink.vht_cap.vht_supported) {
356- state->vht_opmode = sta->deflink.bandwidth;
357- state->vht_opmode |= (sta->deflink.rx_nss - 1) <<
358+ if (sta->vht_cap.vht_supported) {
359+ state->vht_opmode = sta->bandwidth;
360+ state->vht_opmode |= (sta->rx_nss - 1) <<
361 IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT;
362 }
363 }
364@@ -938,7 +938,7 @@ void mt76_connac_mcu_wtbl_smps_tlv(struct sk_buff *skb,
365 tlv = mt76_connac_mcu_add_nested_tlv(skb, WTBL_SMPS, sizeof(*smps),
366 wtbl_tlv, sta_wtbl);
367 smps = (struct wtbl_smps *)tlv;
368- smps->smps = (sta->deflink.smps_mode == IEEE80211_SMPS_DYNAMIC);
369+ smps->smps = (sta->smps_mode == IEEE80211_SMPS_DYNAMIC);
370 }
371 EXPORT_SYMBOL_GPL(mt76_connac_mcu_wtbl_smps_tlv);
372
373@@ -950,27 +950,27 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
374 struct tlv *tlv;
375 u32 flags = 0;
376
377- if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_6ghz_capa.capa) {
378+ if (sta->ht_cap.ht_supported || sta->he_6ghz_capa.capa) {
379 tlv = mt76_connac_mcu_add_nested_tlv(skb, WTBL_HT, sizeof(*ht),
380 wtbl_tlv, sta_wtbl);
381 ht = (struct wtbl_ht *)tlv;
382 ht->ldpc = ht_ldpc &&
383- !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING);
384+ !!(sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING);
385
386- if (sta->deflink.ht_cap.ht_supported) {
387- ht->af = sta->deflink.ht_cap.ampdu_factor;
388- ht->mm = sta->deflink.ht_cap.ampdu_density;
389+ if (sta->ht_cap.ht_supported) {
390+ ht->af = sta->ht_cap.ampdu_factor;
391+ ht->mm = sta->ht_cap.ampdu_density;
392 } else {
393- ht->af = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
394+ ht->af = le16_get_bits(sta->he_6ghz_capa.capa,
395 IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP);
396- ht->mm = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
397+ ht->mm = le16_get_bits(sta->he_6ghz_capa.capa,
398 IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START);
399 }
400
401 ht->ht = true;
402 }
403
404- if (sta->deflink.vht_cap.vht_supported || sta->deflink.he_6ghz_capa.capa) {
405+ if (sta->vht_cap.vht_supported || sta->he_6ghz_capa.capa) {
406 struct wtbl_vht *vht;
407 u8 af;
408
409@@ -979,18 +979,18 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
410 sta_wtbl);
411 vht = (struct wtbl_vht *)tlv;
412 vht->ldpc = vht_ldpc &&
413- !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC);
414+ !!(sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC);
415 vht->vht = true;
416
417 af = FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK,
418- sta->deflink.vht_cap.cap);
419+ sta->vht_cap.cap);
420 if (ht)
421 ht->af = max(ht->af, af);
422 }
423
424 mt76_connac_mcu_wtbl_smps_tlv(skb, sta, sta_wtbl, wtbl_tlv);
425
426- if (is_connac_v1(dev) && sta->deflink.ht_cap.ht_supported) {
427+ if (is_connac_v1(dev) && sta->ht_cap.ht_supported) {
428 /* sgi */
429 u32 msk = MT_WTBL_W5_SHORT_GI_20 | MT_WTBL_W5_SHORT_GI_40 |
430 MT_WTBL_W5_SHORT_GI_80 | MT_WTBL_W5_SHORT_GI_160;
431@@ -1000,15 +1000,15 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
432 sizeof(*raw), wtbl_tlv,
433 sta_wtbl);
434
435- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
436+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
437 flags |= MT_WTBL_W5_SHORT_GI_20;
438- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
439+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
440 flags |= MT_WTBL_W5_SHORT_GI_40;
441
442- if (sta->deflink.vht_cap.vht_supported) {
443- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
444+ if (sta->vht_cap.vht_supported) {
445+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
446 flags |= MT_WTBL_W5_SHORT_GI_80;
447- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
448+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
449 flags |= MT_WTBL_W5_SHORT_GI_160;
450 }
451 raw = (struct wtbl_raw *)tlv;
developer2157bf82023-06-26 02:27:49 +0800452@@ -1297,9 +1297,9 @@ u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800453 return 0x38;
454
455 if (sta) {
456- ht_cap = &sta->deflink.ht_cap;
457- vht_cap = &sta->deflink.vht_cap;
458- he_cap = &sta->deflink.he_cap;
459+ ht_cap = &sta->ht_cap;
460+ vht_cap = &sta->vht_cap;
461+ he_cap = &sta->he_cap;
462 } else {
463 struct ieee80211_supported_band *sband;
464
developer2157bf82023-06-26 02:27:49 +0800465@@ -1619,7 +1619,6 @@ int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800466 for (i = 0; i < sreq->n_ssids; i++) {
467 if (!sreq->ssids[i].ssid_len)
468 continue;
469-
470 req->ssids[i].ssid_len = cpu_to_le32(sreq->ssids[i].ssid_len);
471 memcpy(req->ssids[i].ssid, sreq->ssids[i].ssid,
472 sreq->ssids[i].ssid_len);
developer2157bf82023-06-26 02:27:49 +0800473@@ -1759,7 +1758,6 @@ int mt76_connac_mcu_sched_scan_req(struct mt76_phy *phy,
developer6100db22023-04-05 13:22:26 +0800474 memcpy(req->ssids[i].ssid, ssid->ssid, ssid->ssid_len);
475 req->ssids[i].ssid_len = cpu_to_le32(ssid->ssid_len);
476 }
477-
478 req->match_num = sreq->n_match_sets;
479 for (i = 0; i < req->match_num; i++) {
480 match = &sreq->match_sets[i];
developer2157bf82023-06-26 02:27:49 +0800481@@ -2246,10 +2244,8 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev,
developer6100db22023-04-05 13:22:26 +0800482 struct mt76_vif *vif,
483 struct ieee80211_bss_conf *info)
484 {
485- struct ieee80211_vif *mvif = container_of(info, struct ieee80211_vif,
486- bss_conf);
487 struct sk_buff *skb;
488- int i, len = min_t(int, mvif->cfg.arp_addr_cnt,
489+ int i, len = min_t(int, info->arp_addr_cnt,
490 IEEE80211_BSS_ARP_ADDR_LIST_LEN);
491 struct {
492 struct {
developer2157bf82023-06-26 02:27:49 +0800493@@ -2277,7 +2273,7 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev,
developer6100db22023-04-05 13:22:26 +0800494
495 skb_put_data(skb, &req_hdr, sizeof(req_hdr));
496 for (i = 0; i < len; i++)
497- skb_put_data(skb, &mvif->cfg.arp_addr_list[i], sizeof(__be32));
498+ skb_put_data(skb, &info->arp_addr_list[i], sizeof(__be32));
499
500 return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD(OFFLOAD), true);
501 }
502diff --git a/mt76x02_mac.c b/mt76x02_mac.c
developerbbd45e12023-05-19 08:22:06 +0800503index 3e41d80..c289ae0 100644
developer6100db22023-04-05 13:22:26 +0800504--- a/mt76x02_mac.c
505+++ b/mt76x02_mac.c
506@@ -404,7 +404,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
507 txwi->rate |= cpu_to_le16(MT_RXWI_RATE_LDPC);
508 if ((info->flags & IEEE80211_TX_CTL_STBC) && nss == 1)
509 txwi->rate |= cpu_to_le16(MT_RXWI_RATE_STBC);
510- if (nss > 1 && sta && sta->deflink.smps_mode == IEEE80211_SMPS_DYNAMIC)
511+ if (nss > 1 && sta && sta->smps_mode == IEEE80211_SMPS_DYNAMIC)
512 txwi_flags |= MT_TXWI_FLAGS_MMPS;
513 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
514 txwi->ack_ctl |= MT_TXWI_ACK_CTL_REQ;
515@@ -412,9 +412,9 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
516 txwi->ack_ctl |= MT_TXWI_ACK_CTL_NSEQ;
517 if ((info->flags & IEEE80211_TX_CTL_AMPDU) && sta) {
518 u8 ba_size = IEEE80211_MIN_AMPDU_BUF;
519- u8 ampdu_density = sta->deflink.ht_cap.ampdu_density;
520+ u8 ampdu_density = sta->ht_cap.ampdu_density;
521
522- ba_size <<= sta->deflink.ht_cap.ampdu_factor;
523+ ba_size <<= sta->ht_cap.ampdu_factor;
524 ba_size = min_t(int, 63, ba_size - 1);
525 if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
526 ba_size = 0;
527diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
developer2157bf82023-06-26 02:27:49 +0800528index 73e132b..5345ff7 100644
developer6100db22023-04-05 13:22:26 +0800529--- a/mt7915/debugfs.c
530+++ b/mt7915/debugfs.c
developer2157bf82023-06-26 02:27:49 +0800531@@ -1915,8 +1915,8 @@ static ssize_t mt7915_sta_fixed_rate_set(struct file *file,
developer6100db22023-04-05 13:22:26 +0800532
533 phy.ldpc = (phy.bw || phy.ldpc) * GENMASK(2, 0);
534 for (i = 0; i <= phy.bw; i++) {
535- phy.sgi |= gi << (i << sta->deflink.he_cap.has_he);
536- phy.he_ltf |= he_ltf << (i << sta->deflink.he_cap.has_he);
537+ phy.sgi |= gi << (i << sta->he_cap.has_he);
538+ phy.he_ltf |= he_ltf << (i << sta->he_cap.has_he);
539 }
540 field = RATE_PARAM_FIXED;
541
542diff --git a/mt7915/dma.c b/mt7915/dma.c
developer2157bf82023-06-26 02:27:49 +0800543index f71ec55..b4e231b 100644
developer6100db22023-04-05 13:22:26 +0800544--- a/mt7915/dma.c
545+++ b/mt7915/dma.c
developer2324aa22023-04-12 11:30:15 +0800546@@ -590,8 +590,8 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
developer6100db22023-04-05 13:22:26 +0800547 if (ret < 0)
548 return ret;
549
550- netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
551- mt7915_poll_tx);
552+ netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
553+ mt7915_poll_tx, NAPI_POLL_WEIGHT);
554 napi_enable(&dev->mt76.tx_napi);
555
developer2324aa22023-04-12 11:30:15 +0800556 mt7915_dma_enable(dev, false);
developer6100db22023-04-05 13:22:26 +0800557diff --git a/mt7915/init.c b/mt7915/init.c
developer2157bf82023-06-26 02:27:49 +0800558index cf576ed..ad5f788 100644
developer6100db22023-04-05 13:22:26 +0800559--- a/mt7915/init.c
560+++ b/mt7915/init.c
developer2157bf82023-06-26 02:27:49 +0800561@@ -1140,8 +1140,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
developerbbd45e12023-05-19 08:22:06 +0800562 mt76_connac_gen_ppe_thresh(he_cap->ppe_thres, nss);
developer6100db22023-04-05 13:22:26 +0800563 } else {
564 he_cap_elem->phy_cap_info[9] |=
565- u8_encode_bits(IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US,
566- IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK);
567+ IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US;
568 }
569
570 if (band == NL80211_BAND_6GHZ) {
developer6100db22023-04-05 13:22:26 +0800571diff --git a/mt7915/main.c b/mt7915/main.c
developer2157bf82023-06-26 02:27:49 +0800572index 5db7e6a..d90bdaf 100644
developer6100db22023-04-05 13:22:26 +0800573--- a/mt7915/main.c
574+++ b/mt7915/main.c
developerbbd45e12023-05-19 08:22:06 +0800575@@ -273,6 +273,7 @@ int mt7915_init_vif(struct mt7915_phy *phy, struct ieee80211_vif *vif, bool bf_e
576 vif->offload_flags |= IEEE80211_OFFLOAD_ENCAP_4ADDR;
577
578 mt7915_init_bitrate_mask(vif);
579+ memset(&mvif->cap, -1, sizeof(mvif->cap));
580
581 mt7915_mcu_add_bss_info(phy, vif, true);
582 mt7915_mcu_add_sta(dev, vif, NULL, true);
583@@ -529,7 +530,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;
developerbbd45e12023-05-19 08:22:06 +0800592@@ -624,7 +625,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);
developerbbd45e12023-05-19 08:22:06 +0800601@@ -644,7 +645,7 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
developer6100db22023-04-05 13:22:26 +0800602 }
603
604 if (changed & BSS_CHANGED_ASSOC)
605- mt7915_mcu_add_bss_info(phy, vif, vif->cfg.assoc);
606+ mt7915_mcu_add_bss_info(phy, vif, info->assoc);
607
608 if (changed & BSS_CHANGED_ERP_CTS_PROT)
609 mt7915_mac_enable_rtscts(dev, vif, info->use_cts_prot);
developer2157bf82023-06-26 02:27:49 +0800610@@ -680,8 +681,7 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
611 }
612
613 static int
614-mt7915_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
615- struct ieee80211_bss_conf *link_conf)
616+mt7915_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
developer6100db22023-04-05 13:22:26 +0800617 {
618 struct mt7915_phy *phy = mt7915_hw_phy(hw);
619 struct mt7915_dev *dev = mt7915_hw_dev(hw);
developer2157bf82023-06-26 02:27:49 +0800620@@ -700,8 +700,7 @@ out:
621 }
622
623 static void
624-mt7915_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
625- struct ieee80211_bss_conf *link_conf)
626+mt7915_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
627 {
628 struct mt7915_dev *dev = mt7915_hw_dev(hw);
629
630@@ -1265,10 +1264,10 @@ static int mt7915_sta_set_txpwr(struct ieee80211_hw *hw,
631 {
632 struct mt7915_phy *phy = mt7915_hw_phy(hw);
633 struct mt7915_dev *dev = mt7915_hw_dev(hw);
developer6100db22023-04-05 13:22:26 +0800634- s16 txpower = sta->deflink.txpwr.power;
635+ s16 txpower = sta->txpwr.power;
636 int ret;
637
638- if (sta->deflink.txpwr.type == NL80211_TX_POWER_AUTOMATIC)
639+ if (sta->txpwr.type == NL80211_TX_POWER_AUTOMATIC)
640 txpower = 0;
641
642 mutex_lock(&dev->mt76.mutex);
643diff --git a/mt7915/mcu.c b/mt7915/mcu.c
developer2157bf82023-06-26 02:27:49 +0800644index 26d2964..cf80d77 100644
developer6100db22023-04-05 13:22:26 +0800645--- a/mt7915/mcu.c
646+++ b/mt7915/mcu.c
developerbbd45e12023-05-19 08:22:06 +0800647@@ -67,7 +67,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
developer6100db22023-04-05 13:22:26 +0800648 struct mt7915_dev *dev = msta->vif->phy->dev;
649 enum nl80211_band band = msta->vif->phy->mt76->chandef.chan->band;
650 const u16 *mask = msta->vif->bitrate_mask.control[band].he_mcs;
651- int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
652+ int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
653
654 for (nss = 0; nss < max_nss; nss++) {
655 int mcs;
developerbbd45e12023-05-19 08:22:06 +0800656@@ -107,7 +107,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
developer6100db22023-04-05 13:22:26 +0800657
658 /* only support 2ss on 160MHz for mt7915 */
659 if (is_mt7915(&dev->mt76) && nss > 1 &&
660- sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
661+ sta->bandwidth == IEEE80211_STA_RX_BW_160)
662 break;
663 }
664
developerbbd45e12023-05-19 08:22:06 +0800665@@ -120,8 +120,8 @@ mt7915_mcu_set_sta_vht_mcs(struct ieee80211_sta *sta, __le16 *vht_mcs,
developer6100db22023-04-05 13:22:26 +0800666 {
667 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
668 struct mt7915_dev *dev = msta->vif->phy->dev;
669- u16 mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map);
670- int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
671+ u16 mcs_map = le16_to_cpu(sta->vht_cap.vht_mcs.rx_mcs_map);
672+ int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
673 u16 mcs;
674
675 for (nss = 0; nss < max_nss; nss++, mcs_map >>= 2) {
developerbbd45e12023-05-19 08:22:06 +0800676@@ -143,7 +143,7 @@ mt7915_mcu_set_sta_vht_mcs(struct ieee80211_sta *sta, __le16 *vht_mcs,
developer6100db22023-04-05 13:22:26 +0800677
678 /* only support 2ss on 160MHz for mt7915 */
679 if (is_mt7915(&dev->mt76) && nss > 1 &&
680- sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
681+ sta->bandwidth == IEEE80211_STA_RX_BW_160)
682 break;
683 }
684 }
developerbbd45e12023-05-19 08:22:06 +0800685@@ -152,10 +152,10 @@ static void
developer6100db22023-04-05 13:22:26 +0800686 mt7915_mcu_set_sta_ht_mcs(struct ieee80211_sta *sta, u8 *ht_mcs,
687 const u8 *mask)
688 {
689- int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
690+ int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
691
692 for (nss = 0; nss < max_nss; nss++)
693- ht_mcs[nss] = sta->deflink.ht_cap.mcs.rx_mask[nss] & mask[nss];
694+ ht_mcs[nss] = sta->ht_cap.mcs.rx_mask[nss] & mask[nss];
695 }
696
697 static int
developerbbd45e12023-05-19 08:22:06 +0800698@@ -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 +0800699 static void
700 mt7915_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
701 {
702- if (vif->bss_conf.csa_active)
703+ if (vif->csa_active)
704 ieee80211_csa_finish(vif);
705 }
706
developerbbd45e12023-05-19 08:22:06 +0800707@@ -337,7 +337,7 @@ mt7915_mcu_rx_log_message(struct mt7915_dev *dev, struct sk_buff *skb)
developer6100db22023-04-05 13:22:26 +0800708 static void
709 mt7915_mcu_cca_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
710 {
711- if (!vif->bss_conf.color_change_active)
712+ if (!vif->color_change_active)
713 return;
714
715 ieee80211_color_change_finish(vif);
developer2157bf82023-06-26 02:27:49 +0800716@@ -751,13 +751,14 @@ static void
developerbbd45e12023-05-19 08:22:06 +0800717 mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
developer6100db22023-04-05 13:22:26 +0800718 struct ieee80211_vif *vif)
719 {
developer6100db22023-04-05 13:22:26 +0800720- struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem;
developerbbd45e12023-05-19 08:22:06 +0800721+ struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
developer6100db22023-04-05 13:22:26 +0800722+ struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem;
723 struct ieee80211_he_mcs_nss_supp mcs_map;
724 struct sta_rec_he *he;
725 struct tlv *tlv;
726 u32 cap = 0;
727
728- if (!sta->deflink.he_cap.has_he)
729+ if (!sta->he_cap.has_he)
730 return;
731
732 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE, sizeof(*he));
developer2157bf82023-06-26 02:27:49 +0800733@@ -784,7 +785,7 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
developerbbd45e12023-05-19 08:22:06 +0800734 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_5G))
735 cap |= STA_REC_HE_CAP_BW20_RU242_SUPPORT;
736
737- if (vif->bss_conf.he_ldpc &&
738+ if (mvif->cap.he_ldpc &&
739 (elem->phy_cap_info[1] &
740 IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD))
741 cap |= STA_REC_HE_CAP_LDPC;
developer2157bf82023-06-26 02:27:49 +0800742@@ -843,8 +844,8 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
developer6100db22023-04-05 13:22:26 +0800743
744 he->he_cap = cpu_to_le32(cap);
745
746- mcs_map = sta->deflink.he_cap.he_mcs_nss_supp;
747- switch (sta->deflink.bandwidth) {
748+ mcs_map = sta->he_cap.he_mcs_nss_supp;
749+ switch (sta->bandwidth) {
750 case IEEE80211_STA_RX_BW_160:
751 if (elem->phy_cap_info[0] &
752 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
developer2157bf82023-06-26 02:27:49 +0800753@@ -893,8 +894,9 @@ static void
developerbbd45e12023-05-19 08:22:06 +0800754 mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
755 struct ieee80211_sta *sta, struct ieee80211_vif *vif)
developer6100db22023-04-05 13:22:26 +0800756 {
developerbbd45e12023-05-19 08:22:06 +0800757+ struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
developer6100db22023-04-05 13:22:26 +0800758 struct mt7915_phy *phy = mvif->phy;
759- struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem;
760+ struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem;
761 struct sta_rec_muru *muru;
762 struct tlv *tlv;
763
developer2157bf82023-06-26 02:27:49 +0800764@@ -906,9 +908,9 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developerbbd45e12023-05-19 08:22:06 +0800765
766 muru = (struct sta_rec_muru *)tlv;
767
768- muru->cfg.mimo_dl_en = (vif->bss_conf.he_mu_beamformer ||
769- vif->bss_conf.vht_mu_beamformer ||
770- vif->bss_conf.vht_mu_beamformee) &&
771+ muru->cfg.mimo_dl_en = (mvif->cap.he_mu_ebfer ||
772+ mvif->cap.vht_mu_ebfer ||
773+ mvif->cap.vht_mu_ebfee) &&
774 !!(phy->muru_onoff & MUMIMO_DL);
775 if (!is_mt7915(&dev->mt76))
776 muru->cfg.mimo_ul_en = true;
developer2157bf82023-06-26 02:27:49 +0800777@@ -918,11 +920,11 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800778 muru->cfg.ofdma_dl_en = !!(phy->muru_onoff & OFDMA_DL);
779 muru->cfg.ofdma_ul_en = !!(phy->muru_onoff & OFDMA_UL);
780
781- if (sta->deflink.vht_cap.vht_supported)
782+ if (sta->vht_cap.vht_supported)
783 muru->mimo_dl.vht_mu_bfee =
784- !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
785+ !!(sta->vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
786
787- if (!sta->deflink.he_cap.has_he)
788+ if (!sta->he_cap.has_he)
789 return;
790
791 muru->mimo_dl.partial_bw_dl_mimo =
developer2157bf82023-06-26 02:27:49 +0800792@@ -956,13 +958,13 @@ mt7915_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
developer6100db22023-04-05 13:22:26 +0800793 struct sta_rec_ht *ht;
794 struct tlv *tlv;
795
796- if (!sta->deflink.ht_cap.ht_supported)
797+ if (!sta->ht_cap.ht_supported)
798 return;
799
800 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht));
801
802 ht = (struct sta_rec_ht *)tlv;
803- ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap);
804+ ht->ht_cap = cpu_to_le16(sta->ht_cap.cap);
805 }
806
807 static void
developer2157bf82023-06-26 02:27:49 +0800808@@ -971,15 +973,15 @@ mt7915_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
developer6100db22023-04-05 13:22:26 +0800809 struct sta_rec_vht *vht;
810 struct tlv *tlv;
811
812- if (!sta->deflink.vht_cap.vht_supported)
813+ if (!sta->vht_cap.vht_supported)
814 return;
815
816 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, sizeof(*vht));
817
818 vht = (struct sta_rec_vht *)tlv;
819- vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap);
820- vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map;
821- vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map;
822+ vht->vht_cap = cpu_to_le32(sta->vht_cap.cap);
823+ vht->vht_rx_mcs_map = sta->vht_cap.vht_mcs.rx_mcs_map;
824+ vht->vht_tx_mcs_map = sta->vht_cap.vht_mcs.tx_mcs_map;
825 }
826
827 static void
developer2157bf82023-06-26 02:27:49 +0800828@@ -994,7 +996,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800829 vif->type != NL80211_IFTYPE_AP)
830 return;
831
832- if (!sta->deflink.agg.max_amsdu_len)
833+ if (!sta->max_amsdu_len)
834 return;
835
836 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu));
developer2157bf82023-06-26 02:27:49 +0800837@@ -1003,7 +1005,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800838 amsdu->amsdu_en = true;
839 msta->wcid.amsdu = true;
840
841- switch (sta->deflink.agg.max_amsdu_len) {
842+ switch (sta->max_amsdu_len) {
843 case IEEE80211_MAX_MPDU_LEN_VHT_11454:
844 if (!is_mt7915(&dev->mt76)) {
845 amsdu->max_mpdu_size =
developer2157bf82023-06-26 02:27:49 +0800846@@ -1046,8 +1048,8 @@ mt7915_mcu_sta_wtbl_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developerbbd45e12023-05-19 08:22:06 +0800847 mt76_connac_mcu_wtbl_hdr_trans_tlv(skb, vif, wcid, tlv, wtbl_hdr);
848 if (sta)
849 mt76_connac_mcu_wtbl_ht_tlv(&dev->mt76, skb, sta, tlv,
850- wtbl_hdr, vif->bss_conf.ht_ldpc,
851- vif->bss_conf.vht_ldpc);
852+ wtbl_hdr, mvif->cap.ht_ldpc,
853+ mvif->cap.vht_ldpc);
854
855 return 0;
856 }
developer2157bf82023-06-26 02:27:49 +0800857@@ -1056,6 +1058,7 @@ static inline bool
developerbbd45e12023-05-19 08:22:06 +0800858 mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
859 struct ieee80211_sta *sta, bool bfee)
860 {
861+ struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
862 int sts = hweight16(phy->mt76->chainmask);
863
864 if (vif->type != NL80211_IFTYPE_STATION &&
developer2157bf82023-06-26 02:27:49 +0800865@@ -1065,25 +1068,25 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
developer69542b52023-04-13 10:46:44 +0800866 if (!bfee && sts < 2)
developer6100db22023-04-05 13:22:26 +0800867 return false;
868
869- if (sta->deflink.he_cap.has_he) {
870- struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem;
871+ if (sta->he_cap.has_he) {
872+ struct ieee80211_he_cap_elem *pe = &sta->he_cap.he_cap_elem;
873
874 if (bfee)
developerbbd45e12023-05-19 08:22:06 +0800875- return vif->bss_conf.he_su_beamformee &&
876+ return mvif->cap.he_su_ebfee &&
877 HE_PHY(CAP3_SU_BEAMFORMER, pe->phy_cap_info[3]);
878 else
879- return vif->bss_conf.he_su_beamformer &&
880+ return mvif->cap.he_su_ebfer &&
developer6100db22023-04-05 13:22:26 +0800881 HE_PHY(CAP4_SU_BEAMFORMEE, pe->phy_cap_info[4]);
882 }
883
884- if (sta->deflink.vht_cap.vht_supported) {
885- u32 cap = sta->deflink.vht_cap.cap;
886+ if (sta->vht_cap.vht_supported) {
887+ u32 cap = sta->vht_cap.cap;
888
889 if (bfee)
developerbbd45e12023-05-19 08:22:06 +0800890- return vif->bss_conf.vht_su_beamformee &&
891+ return mvif->cap.vht_su_ebfee &&
892 (cap & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE);
893 else
894- return vif->bss_conf.vht_su_beamformer &&
895+ return mvif->cap.vht_su_ebfer &&
896 (cap & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE);
897 }
898
developer2157bf82023-06-26 02:27:49 +0800899@@ -1103,7 +1106,7 @@ static void
developer6100db22023-04-05 13:22:26 +0800900 mt7915_mcu_sta_bfer_ht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
901 struct sta_rec_bf *bf)
902 {
903- struct ieee80211_mcs_info *mcs = &sta->deflink.ht_cap.mcs;
904+ struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
905 u8 n = 0;
906
907 bf->tx_mode = MT_PHY_TYPE_HT;
developer2157bf82023-06-26 02:27:49 +0800908@@ -1128,7 +1131,7 @@ static void
developer6100db22023-04-05 13:22:26 +0800909 mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
910 struct sta_rec_bf *bf, bool explicit)
911 {
912- struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap;
913+ struct ieee80211_sta_vht_cap *pc = &sta->vht_cap;
914 struct ieee80211_sta_vht_cap *vc = &phy->mt76->sband_5g.sband.vht_cap;
915 u16 mcs_map = le16_to_cpu(pc->vht_mcs.rx_mcs_map);
916 u8 nss_mcs = mt7915_mcu_get_sta_nss(mcs_map);
developer2157bf82023-06-26 02:27:49 +0800917@@ -1149,14 +1152,14 @@ mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
developer6100db22023-04-05 13:22:26 +0800918 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
919 bf->ibf_ncol = bf->ncol;
920
921- if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
922+ if (sta->bandwidth == IEEE80211_STA_RX_BW_160)
923 bf->nrow = 1;
924 } else {
925 bf->nrow = tx_ant;
926 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
927 bf->ibf_ncol = nss_mcs;
928
929- if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
930+ if (sta->bandwidth == IEEE80211_STA_RX_BW_160)
931 bf->ibf_nrow = 1;
932 }
933 }
developer2157bf82023-06-26 02:27:49 +0800934@@ -1165,7 +1168,7 @@ static void
developer6100db22023-04-05 13:22:26 +0800935 mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
936 struct mt7915_phy *phy, struct sta_rec_bf *bf)
937 {
938- struct ieee80211_sta_he_cap *pc = &sta->deflink.he_cap;
939+ struct ieee80211_sta_he_cap *pc = &sta->he_cap;
940 struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem;
941 const struct ieee80211_sta_he_cap *vc =
942 mt76_connac_get_he_phy_cap(phy->mt76, vif);
developer2157bf82023-06-26 02:27:49 +0800943@@ -1190,7 +1193,7 @@ mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800944 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
945 bf->ibf_ncol = bf->ncol;
946
947- if (sta->deflink.bandwidth != IEEE80211_STA_RX_BW_160)
948+ if (sta->bandwidth != IEEE80211_STA_RX_BW_160)
949 return;
950
951 /* go over for 160MHz and 80p80 */
developer2157bf82023-06-26 02:27:49 +0800952@@ -1238,7 +1241,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800953 };
954 bool ebf;
955
956- if (!(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
957+ if (!(sta->ht_cap.ht_supported || sta->he_cap.has_he))
958 return;
959
960 ebf = mt7915_is_ebf_supported(phy, vif, sta, false);
developer2157bf82023-06-26 02:27:49 +0800961@@ -1252,21 +1255,21 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800962 * vht: support eBF and iBF
963 * ht: iBF only, since mac80211 lacks of eBF support
964 */
965- if (sta->deflink.he_cap.has_he && ebf)
966+ if (sta->he_cap.has_he && ebf)
967 mt7915_mcu_sta_bfer_he(sta, vif, phy, bf);
968- else if (sta->deflink.vht_cap.vht_supported)
969+ else if (sta->vht_cap.vht_supported)
970 mt7915_mcu_sta_bfer_vht(sta, phy, bf, ebf);
971- else if (sta->deflink.ht_cap.ht_supported)
972+ else if (sta->ht_cap.ht_supported)
973 mt7915_mcu_sta_bfer_ht(sta, phy, bf);
974 else
975 return;
976
977 bf->bf_cap = ebf ? ebf : dev->ibf << 1;
978- bf->bw = sta->deflink.bandwidth;
979- bf->ibf_dbw = sta->deflink.bandwidth;
980+ bf->bw = sta->bandwidth;
981+ bf->ibf_dbw = sta->bandwidth;
982 bf->ibf_nrow = tx_ant;
983
984- if (!ebf && sta->deflink.bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol)
985+ if (!ebf && sta->bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol)
986 bf->ibf_timeout = 0x48;
987 else
988 bf->ibf_timeout = 0x18;
developer2157bf82023-06-26 02:27:49 +0800989@@ -1276,7 +1279,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800990 else
991 bf->mem_20m = matrix[bf->nrow][bf->ncol];
992
993- switch (sta->deflink.bandwidth) {
994+ switch (sta->bandwidth) {
995 case IEEE80211_STA_RX_BW_160:
996 case IEEE80211_STA_RX_BW_80:
997 bf->mem_total = bf->mem_20m * 2;
developer2157bf82023-06-26 02:27:49 +0800998@@ -1301,7 +1304,7 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800999 struct tlv *tlv;
1000 u8 nrow = 0;
1001
1002- if (!(sta->deflink.vht_cap.vht_supported || sta->deflink.he_cap.has_he))
1003+ if (!(sta->vht_cap.vht_supported || sta->he_cap.has_he))
1004 return;
1005
1006 if (!mt7915_is_ebf_supported(phy, vif, sta, true))
developer2157bf82023-06-26 02:27:49 +08001007@@ -1310,13 +1313,13 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +08001008 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_BFEE, sizeof(*bfee));
1009 bfee = (struct sta_rec_bfee *)tlv;
1010
1011- if (sta->deflink.he_cap.has_he) {
1012- struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem;
1013+ if (sta->he_cap.has_he) {
1014+ struct ieee80211_he_cap_elem *pe = &sta->he_cap.he_cap_elem;
1015
1016 nrow = HE_PHY(CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK,
1017 pe->phy_cap_info[5]);
1018- } else if (sta->deflink.vht_cap.vht_supported) {
1019- struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap;
1020+ } else if (sta->vht_cap.vht_supported) {
1021+ struct ieee80211_sta_vht_cap *pc = &sta->vht_cap;
1022
1023 nrow = FIELD_GET(IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK,
1024 pc->cap);
developer2157bf82023-06-26 02:27:49 +08001025@@ -1372,7 +1375,7 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001026 ra->phy = *phy;
1027 break;
1028 case RATE_PARAM_MMPS_UPDATE:
1029- ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->deflink.smps_mode);
1030+ ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->smps_mode);
1031 break;
1032 case RATE_PARAM_SPE_UPDATE:
1033 ra->spe_idx = *(u8 *)data;
developer2157bf82023-06-26 02:27:49 +08001034@@ -1447,7 +1450,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001035 do { \
1036 u8 i, gi = mask->control[band]._gi; \
1037 gi = (_he) ? gi : gi == NL80211_TXRATE_FORCE_SGI; \
1038- for (i = 0; i <= sta->deflink.bandwidth; i++) { \
1039+ for (i = 0; i <= sta->bandwidth; i++) { \
1040 phy.sgi |= gi << (i << (_he)); \
1041 phy.he_ltf |= mask->control[band].he_ltf << (i << (_he));\
1042 } \
developer2157bf82023-06-26 02:27:49 +08001043@@ -1461,11 +1464,11 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001044 } \
1045 } while (0)
1046
1047- if (sta->deflink.he_cap.has_he) {
1048+ if (sta->he_cap.has_he) {
1049 __sta_phy_bitrate_mask_check(he_mcs, he_gi, 0, 1);
1050- } else if (sta->deflink.vht_cap.vht_supported) {
1051+ } else if (sta->vht_cap.vht_supported) {
1052 __sta_phy_bitrate_mask_check(vht_mcs, gi, 0, 0);
1053- } else if (sta->deflink.ht_cap.ht_supported) {
1054+ } else if (sta->ht_cap.ht_supported) {
1055 __sta_phy_bitrate_mask_check(ht_mcs, gi, 1, 0);
1056 } else {
1057 nrates = hweight32(mask->control[band].legacy);
developer2157bf82023-06-26 02:27:49 +08001058@@ -1499,7 +1502,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001059 * actual txrate hardware sends out.
1060 */
1061 addr = mt7915_mac_wtbl_lmac_addr(dev, msta->wcid.idx, 7);
1062- if (sta->deflink.he_cap.has_he)
1063+ if (sta->he_cap.has_he)
1064 mt76_rmw_field(dev, addr, GENMASK(31, 24), phy.sgi);
1065 else
1066 mt76_rmw_field(dev, addr, GENMASK(15, 12), phy.sgi);
developer2157bf82023-06-26 02:27:49 +08001067@@ -1532,7 +1535,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001068 enum nl80211_band band = chandef->chan->band;
1069 struct sta_rec_ra *ra;
1070 struct tlv *tlv;
1071- u32 supp_rate = sta->deflink.supp_rates[band];
1072+ u32 supp_rate = sta->supp_rates[band];
1073 u32 cap = sta->wme ? STA_CAP_WMM : 0;
1074
1075 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra));
developer2157bf82023-06-26 02:27:49 +08001076@@ -1542,9 +1545,9 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001077 ra->auto_rate = true;
1078 ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, sta);
1079 ra->channel = chandef->chan->hw_value;
1080- ra->bw = sta->deflink.bandwidth;
1081- ra->phy.bw = sta->deflink.bandwidth;
1082- ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->deflink.smps_mode);
1083+ ra->bw = sta->bandwidth;
1084+ ra->phy.bw = sta->bandwidth;
1085+ ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->smps_mode);
1086
1087 if (supp_rate) {
1088 supp_rate &= mask->control[band].legacy;
developer2157bf82023-06-26 02:27:49 +08001089@@ -1564,22 +1567,22 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001090 }
1091 }
1092
1093- if (sta->deflink.ht_cap.ht_supported) {
1094+ if (sta->ht_cap.ht_supported) {
1095 ra->supp_mode |= MODE_HT;
1096- ra->af = sta->deflink.ht_cap.ampdu_factor;
1097- ra->ht_gf = !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
1098+ ra->af = sta->ht_cap.ampdu_factor;
1099+ ra->ht_gf = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
1100
1101 cap |= STA_CAP_HT;
1102- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
1103+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
1104 cap |= STA_CAP_SGI_20;
1105- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
1106+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
1107 cap |= STA_CAP_SGI_40;
1108- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)
1109+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)
1110 cap |= STA_CAP_TX_STBC;
1111- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
1112+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
1113 cap |= STA_CAP_RX_STBC;
developerbbd45e12023-05-19 08:22:06 +08001114- if (vif->bss_conf.ht_ldpc &&
developer6100db22023-04-05 13:22:26 +08001115- (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING))
developerbbd45e12023-05-19 08:22:06 +08001116+ if (mvif->cap.ht_ldpc &&
developer6100db22023-04-05 13:22:26 +08001117+ (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING))
1118 cap |= STA_CAP_LDPC;
1119
1120 mt7915_mcu_set_sta_ht_mcs(sta, ra->ht_mcs,
developer2157bf82023-06-26 02:27:49 +08001121@@ -1587,37 +1590,37 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001122 ra->supp_ht_mcs = *(__le32 *)ra->ht_mcs;
1123 }
1124
1125- if (sta->deflink.vht_cap.vht_supported) {
1126+ if (sta->vht_cap.vht_supported) {
1127 u8 af;
1128
1129 ra->supp_mode |= MODE_VHT;
1130 af = FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK,
1131- sta->deflink.vht_cap.cap);
1132+ sta->vht_cap.cap);
1133 ra->af = max_t(u8, ra->af, af);
1134
1135 cap |= STA_CAP_VHT;
1136- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
1137+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
1138 cap |= STA_CAP_VHT_SGI_80;
1139- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
1140+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
1141 cap |= STA_CAP_VHT_SGI_160;
1142- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC)
1143+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC)
1144 cap |= STA_CAP_VHT_TX_STBC;
1145- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1)
1146+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1)
1147 cap |= STA_CAP_VHT_RX_STBC;
developerbbd45e12023-05-19 08:22:06 +08001148- if (vif->bss_conf.vht_ldpc &&
developer6100db22023-04-05 13:22:26 +08001149- (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC))
developerbbd45e12023-05-19 08:22:06 +08001150+ if (mvif->cap.vht_ldpc &&
developer6100db22023-04-05 13:22:26 +08001151+ (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC))
1152 cap |= STA_CAP_VHT_LDPC;
1153
1154 mt7915_mcu_set_sta_vht_mcs(sta, ra->supp_vht_mcs,
1155 mask->control[band].vht_mcs);
1156 }
1157
1158- if (sta->deflink.he_cap.has_he) {
1159+ if (sta->he_cap.has_he) {
1160 ra->supp_mode |= MODE_HE;
1161 cap |= STA_CAP_HE;
1162
1163- if (sta->deflink.he_6ghz_capa.capa)
1164- ra->af = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
1165+ if (sta->he_6ghz_capa.capa)
1166+ ra->af = le16_get_bits(sta->he_6ghz_capa.capa,
1167 IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP);
1168 }
1169
developer2157bf82023-06-26 02:27:49 +08001170@@ -1826,7 +1829,7 @@ mt7915_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,
developer6100db22023-04-05 13:22:26 +08001171 if (!offs->cntdwn_counter_offs[0])
1172 return;
1173
1174- sub_tag = vif->bss_conf.csa_active ? BSS_INFO_BCN_CSA : BSS_INFO_BCN_BCC;
1175+ sub_tag = vif->csa_active ? BSS_INFO_BCN_CSA : BSS_INFO_BCN_BCC;
1176 tlv = mt7915_mcu_add_nested_subtlv(rskb, sub_tag, sizeof(*info),
1177 &bcn->sub_ntlv, &bcn->len);
1178 info = (struct bss_info_bcn_cntdwn *)tlv;
developer2157bf82023-06-26 02:27:49 +08001179@@ -1911,9 +1914,9 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +08001180 if (offs->cntdwn_counter_offs[0]) {
1181 u16 offset = offs->cntdwn_counter_offs[0];
1182
1183- if (vif->bss_conf.csa_active)
1184+ if (vif->csa_active)
1185 cont->csa_ofs = cpu_to_le16(offset - 4);
1186- if (vif->bss_conf.color_change_active)
1187+ if (vif->color_change_active)
1188 cont->bcc_ofs = cpu_to_le16(offset - 3);
1189 }
1190
developer2157bf82023-06-26 02:27:49 +08001191@@ -1923,6 +1926,85 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,
developerbbd45e12023-05-19 08:22:06 +08001192 memcpy(buf + MT_TXD_SIZE, skb->data, skb->len);
1193 }
1194
1195+static void
1196+mt7915_mcu_beacon_check_caps(struct mt7915_phy *phy, struct ieee80211_vif *vif,
1197+ struct sk_buff *skb)
1198+{
1199+ struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
1200+ struct mt7915_vif_cap *vc = &mvif->cap;
1201+ const struct ieee80211_he_cap_elem *he;
1202+ const struct ieee80211_vht_cap *vht;
1203+ const struct ieee80211_ht_cap *ht;
1204+ struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
1205+ const u8 *ie;
1206+ u32 len, bc;
1207+
1208+ /* Check missing configuration options to allow AP mode in mac80211
1209+ * to remain in sync with hostapd settings, and get a subset of
1210+ * beacon and hardware capabilities.
1211+ */
1212+ if (WARN_ON_ONCE(skb->len <= (mgmt->u.beacon.variable - skb->data)))
1213+ return;
1214+
1215+ memset(vc, 0, sizeof(*vc));
1216+
1217+ len = skb->len - (mgmt->u.beacon.variable - skb->data);
1218+
1219+ ie = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, mgmt->u.beacon.variable,
1220+ len);
1221+ if (ie && ie[1] >= sizeof(*ht)) {
1222+ ht = (void *)(ie + 2);
1223+ vc->ht_ldpc = !!(le16_to_cpu(ht->cap_info) &
1224+ IEEE80211_HT_CAP_LDPC_CODING);
1225+ }
1226+
1227+ ie = cfg80211_find_ie(WLAN_EID_VHT_CAPABILITY, mgmt->u.beacon.variable,
1228+ len);
1229+ if (ie && ie[1] >= sizeof(*vht)) {
1230+ u32 pc = phy->mt76->sband_5g.sband.vht_cap.cap;
1231+
1232+ vht = (void *)(ie + 2);
1233+ bc = le32_to_cpu(vht->vht_cap_info);
1234+
1235+ vc->vht_ldpc = !!(bc & IEEE80211_VHT_CAP_RXLDPC);
1236+ vc->vht_su_ebfer =
1237+ (bc & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE) &&
1238+ (pc & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE);
1239+ vc->vht_su_ebfee =
1240+ (bc & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE) &&
1241+ (pc & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE);
1242+ vc->vht_mu_ebfer =
1243+ (bc & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE) &&
1244+ (pc & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE);
1245+ vc->vht_mu_ebfee =
1246+ (bc & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE) &&
1247+ (pc & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
1248+ }
1249+
1250+ ie = cfg80211_find_ext_ie(WLAN_EID_EXT_HE_CAPABILITY,
1251+ mgmt->u.beacon.variable, len);
1252+ if (ie && ie[1] >= sizeof(*he) + 1) {
1253+ const struct ieee80211_sta_he_cap *pc =
1254+ mt76_connac_get_he_phy_cap(phy->mt76, vif);
1255+ const struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem;
1256+
1257+ he = (void *)(ie + 3);
1258+
1259+ vc->he_ldpc =
1260+ HE_PHY(CAP1_LDPC_CODING_IN_PAYLOAD, he->phy_cap_info[1]) &&
1261+ HE_PHY(CAP1_LDPC_CODING_IN_PAYLOAD, pe->phy_cap_info[1]);
1262+ vc->he_su_ebfer =
1263+ HE_PHY(CAP3_SU_BEAMFORMER, he->phy_cap_info[3]) &&
1264+ HE_PHY(CAP3_SU_BEAMFORMER, pe->phy_cap_info[3]);
1265+ vc->he_su_ebfee =
1266+ HE_PHY(CAP4_SU_BEAMFORMEE, he->phy_cap_info[4]) &&
1267+ HE_PHY(CAP4_SU_BEAMFORMEE, pe->phy_cap_info[4]);
1268+ vc->he_mu_ebfer =
1269+ HE_PHY(CAP4_MU_BEAMFORMER, he->phy_cap_info[4]) &&
1270+ HE_PHY(CAP4_MU_BEAMFORMER, pe->phy_cap_info[4]);
1271+ }
1272+}
1273+
1274 int
1275 mt7915_mcu_add_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vif,
1276 u32 changed)
developer2157bf82023-06-26 02:27:49 +08001277@@ -2034,7 +2116,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +08001278 if (!en)
1279 goto out;
1280
1281- skb = ieee80211_beacon_get_template(hw, vif, &offs, 0);
1282+ skb = ieee80211_beacon_get_template(hw, vif, &offs);
1283 if (!skb)
1284 return -EINVAL;
1285
developer2157bf82023-06-26 02:27:49 +08001286@@ -2047,6 +2129,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
developerbbd45e12023-05-19 08:22:06 +08001287 info = IEEE80211_SKB_CB(skb);
1288 info->hw_queue = FIELD_PREP(MT_TX_HW_QUEUE_PHY, ext_phy);
1289
1290+ mt7915_mcu_beacon_check_caps(phy, vif, skb);
1291 mt7915_mcu_beacon_cntdwn(vif, rskb, skb, bcn, &offs);
1292 mt7915_mcu_beacon_mbss(rskb, skb, vif, bcn, &offs);
1293 mt7915_mcu_beacon_cont(dev, vif, rskb, skb, bcn, &offs);
developer2157bf82023-06-26 02:27:49 +08001294@@ -3320,17 +3403,17 @@ int mt7915_mcu_set_txpower_frame(struct mt7915_phy *phy,
developer6100db22023-04-05 13:22:26 +08001295 if (txpower) {
1296 u32 offs, len, i;
1297
1298- if (sta->deflink.ht_cap.ht_supported) {
1299+ if (sta->ht_cap.ht_supported) {
1300 const u8 *sku_len = mt7915_sku_group_len;
1301
1302 offs = sku_len[SKU_CCK] + sku_len[SKU_OFDM];
1303 len = sku_len[SKU_HT_BW20] + sku_len[SKU_HT_BW40];
1304
1305- if (sta->deflink.vht_cap.vht_supported) {
1306+ if (sta->vht_cap.vht_supported) {
1307 offs += len;
1308 len = sku_len[SKU_VHT_BW20] * 4;
1309
1310- if (sta->deflink.he_cap.has_he) {
1311+ if (sta->he_cap.has_he) {
1312 offs += len + sku_len[SKU_HE_RU26] * 3;
1313 len = sku_len[SKU_HE_RU242] * 4;
1314 }
developer2157bf82023-06-26 02:27:49 +08001315diff --git a/mt7915/mmio.c b/mt7915/mmio.c
1316index 25893bd..2d849d5 100644
1317--- a/mt7915/mmio.c
1318+++ b/mt7915/mmio.c
1319@@ -651,7 +651,7 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
1320 phy_addr = dma_map_single(dev->mt76.dma_dev, ptr,
1321 wed->wlan.rx_size,
1322 DMA_TO_DEVICE);
1323-
1324+
1325 if (unlikely(dma_mapping_error(dev->mt76.dev, phy_addr))) {
1326 skb_free_frag(ptr);
1327 mt76_put_rxwi(&dev->mt76, r);
developerbbd45e12023-05-19 08:22:06 +08001328diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
developer2157bf82023-06-26 02:27:49 +08001329index 85c5c95..04fc539 100644
developerbbd45e12023-05-19 08:22:06 +08001330--- a/mt7915/mt7915.h
1331+++ b/mt7915/mt7915.h
developer2157bf82023-06-26 02:27:49 +08001332@@ -217,9 +217,23 @@ struct mt7915_sta {
developerbbd45e12023-05-19 08:22:06 +08001333 struct mt7915_vow_sta_cfg vow_sta_cfg;
1334 };
1335
1336+struct mt7915_vif_cap {
1337+ bool ht_ldpc:1;
1338+ bool vht_ldpc:1;
1339+ bool he_ldpc:1;
1340+ bool vht_su_ebfer:1;
1341+ bool vht_su_ebfee:1;
1342+ bool vht_mu_ebfer:1;
1343+ bool vht_mu_ebfee:1;
1344+ bool he_su_ebfer:1;
1345+ bool he_su_ebfee:1;
1346+ bool he_mu_ebfer:1;
1347+};
1348+
1349 struct mt7915_vif {
1350 struct mt76_vif mt76; /* must be first */
1351
1352+ struct mt7915_vif_cap cap;
1353 struct mt7915_sta sta;
1354 struct mt7915_phy *phy;
1355
developer6100db22023-04-05 13:22:26 +08001356diff --git a/mt7915/testmode.c b/mt7915/testmode.c
developer2157bf82023-06-26 02:27:49 +08001357index fafe909..b10dec5 100644
developer6100db22023-04-05 13:22:26 +08001358--- a/mt7915/testmode.c
1359+++ b/mt7915/testmode.c
developer2157bf82023-06-26 02:27:49 +08001360@@ -416,12 +416,12 @@ mt7915_tm_entry_add(struct mt7915_phy *phy, u8 aid)
developer6100db22023-04-05 13:22:26 +08001361 memcpy(sta->addr, td->addr[0], ETH_ALEN);
1362
1363 if (td->tx_rate_mode >= MT76_TM_TX_MODE_HT)
1364- memcpy(&sta->deflink.ht_cap, &sband->ht_cap, sizeof(sta->deflink.ht_cap));
1365+ memcpy(&sta->ht_cap, &sband->ht_cap, sizeof(sta->ht_cap));
1366 if (td->tx_rate_mode >= MT76_TM_TX_MODE_VHT)
1367- memcpy(&sta->deflink.vht_cap, &sband->vht_cap, sizeof(sta->deflink.vht_cap));
1368+ memcpy(&sta->vht_cap, &sband->vht_cap, sizeof(sta->vht_cap));
1369 if (td->tx_rate_mode >= MT76_TM_TX_MODE_HE_SU)
1370- memcpy(&sta->deflink.he_cap, &sdata[NL80211_IFTYPE_STATION].he_cap,
1371- sizeof(sta->deflink.he_cap));
1372+ memcpy(&sta->he_cap, &sdata[NL80211_IFTYPE_STATION].he_cap,
1373+ sizeof(sta->he_cap));
1374 sta->aid = aid;
1375 sta->wme = 1;
1376
1377diff --git a/tx.c b/tx.c
developer2157bf82023-06-26 02:27:49 +08001378index 2594a62..26fa665 100644
developer6100db22023-04-05 13:22:26 +08001379--- a/tx.c
1380+++ b/tx.c
1381@@ -60,20 +60,15 @@ mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list)
1382 .skb = skb,
1383 .info = IEEE80211_SKB_CB(skb),
1384 };
1385- struct ieee80211_rate_status rs = {};
1386 struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb);
1387 struct mt76_wcid *wcid;
1388
1389 wcid = rcu_dereference(dev->wcid[cb->wcid]);
1390 if (wcid) {
1391 status.sta = wcid_to_sta(wcid);
1392- if (status.sta && (wcid->rate.flags || wcid->rate.legacy)) {
1393- rs.rate_idx = wcid->rate;
1394- status.rates = &rs;
1395- status.n_rates = 1;
1396- } else {
1397- status.n_rates = 0;
1398- }
1399+
1400+ if (status.sta)
1401+ status.rate = &wcid->rate;
1402 }
1403
1404 hw = mt76_tx_status_get_hw(dev, skb);
developer2157bf82023-06-26 02:27:49 +08001405@@ -239,6 +234,7 @@ mt76_tx_check_non_aql(struct mt76_dev *dev, struct mt76_wcid *wcid,
developer22eedcc2023-05-03 22:59:35 +08001406 void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *skb,
1407 struct list_head *free_list)
1408 {
1409+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1410 struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb);
1411 struct ieee80211_tx_status status = {
1412 .skb = skb,
developer2157bf82023-06-26 02:27:49 +08001413@@ -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 +08001414 #endif
1415
1416 if (cb->pktid < MT_PACKET_ID_FIRST) {
developer22eedcc2023-05-03 22:59:35 +08001417- struct ieee80211_rate_status rs = {};
1418-
1419 hw = mt76_tx_status_get_hw(dev, skb);
1420 status.sta = wcid_to_sta(wcid);
developer2157bf82023-06-26 02:27:49 +08001421- if (status.sta && (wcid->rate.flags || wcid->rate.legacy)) {
1422- rs.rate_idx = wcid->rate;
1423- status.rates = &rs;
1424- status.n_rates = 1;
1425+ if (status.sta) {
1426+ info->status.rates[0].idx = -1;
1427+ status.rate = &wcid->rate;
developer22eedcc2023-05-03 22:59:35 +08001428 }
developer2157bf82023-06-26 02:27:49 +08001429+
developerbbd45e12023-05-19 08:22:06 +08001430 spin_lock_bh(&dev->rx_lock);
developer2157bf82023-06-26 02:27:49 +08001431 ieee80211_tx_status_ext(hw, &status);
1432 spin_unlock_bh(&dev->rx_lock);
developer6100db22023-04-05 13:22:26 +08001433--
developer5bea7322023-04-13 18:50:55 +080014342.18.0
developer6100db22023-04-05 13:22:26 +08001435