blob: 95eeb1e6b3047271dcf13a8ba583b1dd18894215 [file] [log] [blame]
developer5feecba2023-09-05 18:01:51 +08001From 7b82a7ca86e377e26747dd57ec4cd5badc9d4bcb Mon Sep 17 00:00:00 2001
developer6100db22023-04-05 13:22:26 +08002From: Evelyn Tsai <evelyn.tsai@mediatek.com>
3Date: Wed, 5 Apr 2023 08:29:19 +0800
developer23d6e272023-08-28 11:10:51 +08004Subject: [PATCH] mt76: revert for backports-5.15 wireless stack
developer6100db22023-04-05 13:22:26 +08005
developerbbd45e12023-05-19 08:22:06 +08006wifi: mt76: mt7915: add support for he ldpc control from hostapd
developer6100db22023-04-05 13:22:26 +08007---
8 dma.c | 2 +-
9 mac80211.c | 4 +-
10 mt7615/dma.c | 4 +-
11 mt7615/main.c | 6 +-
developerbbd45e12023-05-19 08:22:06 +080012 mt7615/mcu.c | 8 +-
developer2157bf82023-06-26 02:27:49 +080013 mt76_connac_mac.c | 2 +-
developer5feecba2023-09-05 18:01:51 +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 +-
developerc1571f92023-07-04 22:11:24 +080019 mt7915/main.c | 36 ++-----
20 mt7915/mcu.c | 246 ++++++++++++++++++++++++++++++----------------
developer2157bf82023-06-26 02:27:49 +080021 mt7915/mmio.c | 2 +-
developerbbd45e12023-05-19 08:22:06 +080022 mt7915/testmode.c | 8 +-
developerc1571f92023-07-04 22:11:24 +080023 tx.c | 22 ++---
developer5feecba2023-09-05 18:01:51 +080024 16 files changed, 256 insertions(+), 209 deletions(-)
developer6100db22023-04-05 13:22:26 +080025
26diff --git a/dma.c b/dma.c
developer849549c2023-08-02 17:26:48 +080027index 4daa64da..220e684a 100644
developer6100db22023-04-05 13:22:26 +080028--- a/dma.c
29+++ b/dma.c
developerbbd45e12023-05-19 08:22:06 +080030@@ -994,7 +994,7 @@ mt76_dma_init(struct mt76_dev *dev,
developer6100db22023-04-05 13:22:26 +080031 init_completion(&dev->mmio.wed_reset_complete);
32
33 mt76_for_each_q_rx(dev, i) {
34- netif_napi_add(&dev->napi_dev, &dev->napi[i], poll);
35+ netif_napi_add(&dev->napi_dev, &dev->napi[i], poll, 64);
36 mt76_dma_rx_fill(dev, &dev->q_rx[i]);
37 napi_enable(&dev->napi[i]);
38 }
39diff --git a/mac80211.c b/mac80211.c
developer849549c2023-08-02 17:26:48 +080040index 35cd297c..629770c0 100644
developer6100db22023-04-05 13:22:26 +080041--- a/mac80211.c
42+++ b/mac80211.c
developer2157bf82023-06-26 02:27:49 +080043@@ -1521,7 +1521,7 @@ EXPORT_SYMBOL_GPL(mt76_get_sar_power);
developer6100db22023-04-05 13:22:26 +080044 static void
45 __mt76_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
46 {
47- if (vif->bss_conf.csa_active && ieee80211_beacon_cntdwn_is_complete(vif))
48+ if (vif->csa_active && ieee80211_beacon_cntdwn_is_complete(vif))
49 ieee80211_csa_finish(vif);
50 }
51
developer2157bf82023-06-26 02:27:49 +080052@@ -1543,7 +1543,7 @@ __mt76_csa_check(void *priv, u8 *mac, struct ieee80211_vif *vif)
developer6100db22023-04-05 13:22:26 +080053 {
54 struct mt76_dev *dev = priv;
55
56- if (!vif->bss_conf.csa_active)
57+ if (!vif->csa_active)
58 return;
59
60 dev->csa_complete |= ieee80211_beacon_cntdwn_is_complete(vif);
61diff --git a/mt7615/dma.c b/mt7615/dma.c
developer849549c2023-08-02 17:26:48 +080062index 0ce01ccc..ad324850 100644
developer6100db22023-04-05 13:22:26 +080063--- a/mt7615/dma.c
64+++ b/mt7615/dma.c
developerbbd45e12023-05-19 08:22:06 +080065@@ -282,8 +282,8 @@ int mt7615_dma_init(struct mt7615_dev *dev)
developer6100db22023-04-05 13:22:26 +080066 if (ret < 0)
67 return ret;
68
69- netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
70- mt7615_poll_tx);
71+ netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
72+ mt7615_poll_tx, NAPI_POLL_WEIGHT);
73 napi_enable(&dev->mt76.tx_napi);
74
75 mt76_poll(dev, MT_WPDMA_GLO_CFG,
76diff --git a/mt7615/main.c b/mt7615/main.c
developer849549c2023-08-02 17:26:48 +080077index 200b1752..53f30a0f 100644
developer6100db22023-04-05 13:22:26 +080078--- a/mt7615/main.c
79+++ b/mt7615/main.c
developer22eedcc2023-05-03 22:59:35 +080080@@ -473,7 +473,7 @@ static int mt7615_config(struct ieee80211_hw *hw, u32 changed)
developer6100db22023-04-05 13:22:26 +080081
82 static int
83 mt7615_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
84- unsigned int link_id, u16 queue,
85+ u16 queue,
86 const struct ieee80211_tx_queue_params *params)
87 {
88 struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
developer2157bf82023-06-26 02:27:49 +080089@@ -581,7 +581,7 @@ mt7615_update_mu_group(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +080090 static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
91 struct ieee80211_vif *vif,
92 struct ieee80211_bss_conf *info,
93- u64 changed)
94+ u32 changed)
95 {
96 struct mt7615_dev *dev = mt7615_hw_dev(hw);
97 struct mt7615_phy *phy = mt7615_hw_phy(hw);
developer2157bf82023-06-26 02:27:49 +080098@@ -624,7 +624,7 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
developer6100db22023-04-05 13:22:26 +080099 }
100
101 if (changed & BSS_CHANGED_ASSOC)
102- mt7615_mac_set_beacon_filter(phy, vif, vif->cfg.assoc);
103+ mt7615_mac_set_beacon_filter(phy, vif, info->assoc);
104
developer2157bf82023-06-26 02:27:49 +0800105 if (changed & BSS_CHANGED_MU_GROUPS)
106 mt7615_update_mu_group(hw, vif, info);
developer6100db22023-04-05 13:22:26 +0800107diff --git a/mt7615/mcu.c b/mt7615/mcu.c
developer849549c2023-08-02 17:26:48 +0800108index 86061e95..a79308b6 100644
developer6100db22023-04-05 13:22:26 +0800109--- a/mt7615/mcu.c
110+++ b/mt7615/mcu.c
111@@ -353,7 +353,7 @@ out:
112 static void
113 mt7615_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
114 {
115- if (vif->bss_conf.csa_active)
116+ if (vif->csa_active)
117 ieee80211_csa_finish(vif);
118 }
119
120@@ -699,7 +699,7 @@ mt7615_mcu_add_beacon_offload(struct mt7615_dev *dev,
121 if (!enable)
122 goto out;
123
124- skb = ieee80211_beacon_get_template(hw, vif, &offs, 0);
125+ skb = ieee80211_beacon_get_template(hw, vif, &offs);
126 if (!skb)
127 return -EINVAL;
128
developerbbd45e12023-05-19 08:22:06 +0800129@@ -1075,7 +1075,7 @@ mt7615_mcu_uni_add_beacon_offload(struct mt7615_dev *dev,
developer6100db22023-04-05 13:22:26 +0800130 if (!enable)
131 goto out;
132
133- skb = ieee80211_beacon_get_template(mt76_hw(dev), vif, &offs, 0);
134+ skb = ieee80211_beacon_get_template(mt76_hw(dev), vif, &offs);
135 if (!skb)
136 return -EINVAL;
137
developerbbd45e12023-05-19 08:22:06 +0800138@@ -2526,7 +2526,7 @@ int mt7615_mcu_set_bss_pm(struct mt7615_dev *dev, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800139 u8 pad;
140 } req = {
141 .bss_idx = mvif->mt76.idx,
142- .aid = cpu_to_le16(vif->cfg.aid),
143+ .aid = cpu_to_le16(vif->bss_conf.aid),
144 .dtim_period = vif->bss_conf.dtim_period,
145 .bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int),
146 };
developer2157bf82023-06-26 02:27:49 +0800147diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
developer23d6e272023-08-28 11:10:51 +0800148index b87b7335..08a92ace 100644
developer2157bf82023-06-26 02:27:49 +0800149--- a/mt76_connac_mac.c
150+++ b/mt76_connac_mac.c
developer8f0d89b2023-07-28 07:16:44 +0800151@@ -1122,7 +1122,7 @@ void mt76_connac2_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
developer2157bf82023-06-26 02:27:49 +0800152 u32 val;
153
154 if (!sta ||
155- !(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
156+ !(sta->ht_cap.ht_supported || sta->he_cap.has_he))
157 return;
158
159 tid = le32_get_bits(txwi[1], MT_TXD1_TID);
developer6100db22023-04-05 13:22:26 +0800160diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
developer5feecba2023-09-05 18:01:51 +0800161index e6b468c4..220c1335 100644
developer6100db22023-04-05 13:22:26 +0800162--- a/mt76_connac_mcu.c
163+++ b/mt76_connac_mcu.c
164@@ -197,7 +197,7 @@ int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif)
165 */
166 } req = {
167 .bss_idx = mvif->idx,
168- .ps_state = vif->cfg.ps ? 2 : 0,
169+ .ps_state = vif->bss_conf.ps ? 2 : 0,
170 };
171
172 if (vif->type != NL80211_IFTYPE_STATION)
developer5feecba2023-09-05 18:01:51 +0800173@@ -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 +0800174 else
175 conn_type = CONNECTION_INFRA_AP;
176 basic->conn_type = cpu_to_le32(conn_type);
177- basic->aid = cpu_to_le16(vif->cfg.aid);
178+ basic->aid = cpu_to_le16(vif->bss_conf.aid);
179 break;
180 case NL80211_IFTYPE_ADHOC:
181 basic->conn_type = cpu_to_le32(CONNECTION_IBSS_ADHOC);
developer5feecba2023-09-05 18:01:51 +0800182@@ -553,7 +553,7 @@ void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev,
developer6100db22023-04-05 13:22:26 +0800183
184 if (sta) {
185 if (vif->type == NL80211_IFTYPE_STATION)
186- generic->partial_aid = cpu_to_le16(vif->cfg.aid);
187+ generic->partial_aid = cpu_to_le16(vif->bss_conf.aid);
188 else
189 generic->partial_aid = cpu_to_le16(sta->aid);
190 memcpy(generic->peer_addr, sta->addr, ETH_ALEN);
developer5feecba2023-09-05 18:01:51 +0800191@@ -602,14 +602,14 @@ mt76_connac_mcu_sta_amsdu_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
developer6100db22023-04-05 13:22:26 +0800192 vif->type != NL80211_IFTYPE_STATION)
193 return;
194
195- if (!sta->deflink.agg.max_amsdu_len)
196+ if (!sta->max_amsdu_len)
197 return;
198
199 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu));
200 amsdu = (struct sta_rec_amsdu *)tlv;
201 amsdu->max_amsdu_num = 8;
202 amsdu->amsdu_en = true;
203- amsdu->max_mpdu_size = sta->deflink.agg.max_amsdu_len >=
204+ amsdu->max_mpdu_size = sta->max_amsdu_len >=
205 IEEE80211_MAX_MPDU_LEN_VHT_7991;
206
207 wcid->amsdu = true;
developer5feecba2023-09-05 18:01:51 +0800208@@ -620,7 +620,7 @@ mt76_connac_mcu_sta_amsdu_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
developer6100db22023-04-05 13:22:26 +0800209 static void
210 mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
211 {
212- struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap;
213+ struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
214 struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem;
215 struct sta_rec_he *he;
216 struct tlv *tlv;
developer5feecba2023-09-05 18:01:51 +0800217@@ -708,7 +708,7 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
developer6100db22023-04-05 13:22:26 +0800218
219 he->he_cap = cpu_to_le32(cap);
220
221- switch (sta->deflink.bandwidth) {
222+ switch (sta->bandwidth) {
223 case IEEE80211_STA_RX_BW_160:
224 if (elem->phy_cap_info[0] &
225 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
developer5feecba2023-09-05 18:01:51 +0800226@@ -753,7 +753,7 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
developer6100db22023-04-05 13:22:26 +0800227 static void
228 mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
229 {
230- struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap;
231+ struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
232 struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem;
233 struct sta_rec_he_v2 *he;
234 struct tlv *tlv;
developer5feecba2023-09-05 18:01:51 +0800235@@ -764,7 +764,7 @@ mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
developer6100db22023-04-05 13:22:26 +0800236 memcpy(he->he_phy_cap, elem->phy_cap_info, sizeof(he->he_phy_cap));
237 memcpy(he->he_mac_cap, elem->mac_cap_info, sizeof(he->he_mac_cap));
238
239- switch (sta->deflink.bandwidth) {
240+ switch (sta->bandwidth) {
241 case IEEE80211_STA_RX_BW_160:
242 if (elem->phy_cap_info[0] &
243 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
developer5feecba2023-09-05 18:01:51 +0800244@@ -780,7 +780,7 @@ mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
developer6100db22023-04-05 13:22:26 +0800245 break;
246 }
247
248- he->pkt_ext = IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US;
249+ he->pkt_ext = IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US;
250 }
251
252 static u8
developer5feecba2023-09-05 18:01:51 +0800253@@ -793,9 +793,9 @@ mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800254 u8 mode = 0;
255
256 if (sta) {
257- ht_cap = &sta->deflink.ht_cap;
258- vht_cap = &sta->deflink.vht_cap;
259- he_cap = &sta->deflink.he_cap;
260+ ht_cap = &sta->ht_cap;
261+ vht_cap = &sta->vht_cap;
262+ he_cap = &sta->he_cap;
263 } else {
264 struct ieee80211_supported_band *sband;
265
developer5feecba2023-09-05 18:01:51 +0800266@@ -844,25 +844,25 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800267 u16 supp_rates;
268
269 /* starec ht */
270- if (sta->deflink.ht_cap.ht_supported) {
271+ if (sta->ht_cap.ht_supported) {
272 struct sta_rec_ht *ht;
273
274 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht));
275 ht = (struct sta_rec_ht *)tlv;
276- ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap);
277+ ht->ht_cap = cpu_to_le16(sta->ht_cap.cap);
278 }
279
280 /* starec vht */
281- if (sta->deflink.vht_cap.vht_supported) {
282+ if (sta->vht_cap.vht_supported) {
283 struct sta_rec_vht *vht;
284 int len;
285
286 len = is_mt7921(dev) ? sizeof(*vht) : sizeof(*vht) - 4;
287 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, len);
288 vht = (struct sta_rec_vht *)tlv;
289- vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap);
290- vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map;
291- vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map;
292+ vht->vht_cap = cpu_to_le32(sta->vht_cap.cap);
293+ vht->vht_rx_mcs_map = sta->vht_cap.vht_mcs.rx_mcs_map;
294+ vht->vht_tx_mcs_map = sta->vht_cap.vht_mcs.tx_mcs_map;
295 }
296
297 /* starec uapsd */
developer5feecba2023-09-05 18:01:51 +0800298@@ -871,11 +871,11 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800299 if (!is_mt7921(dev))
300 return;
301
302- if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he)
303+ if (sta->ht_cap.ht_supported || sta->he_cap.has_he)
304 mt76_connac_mcu_sta_amsdu_tlv(skb, sta, vif);
305
306 /* starec he */
307- if (sta->deflink.he_cap.has_he) {
308+ if (sta->he_cap.has_he) {
309 mt76_connac_mcu_sta_he_tlv(skb, sta);
310 mt76_connac_mcu_sta_he_tlv_v2(skb, sta);
311 if (band == NL80211_BAND_6GHZ &&
developer5feecba2023-09-05 18:01:51 +0800312@@ -885,7 +885,7 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800313 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE_6G,
314 sizeof(*he_6g_capa));
315 he_6g_capa = (struct sta_rec_he_6g_capa *)tlv;
316- he_6g_capa->capa = sta->deflink.he_6ghz_capa.capa;
317+ he_6g_capa->capa = sta->he_6ghz_capa.capa;
318 }
319 }
320
developer5feecba2023-09-05 18:01:51 +0800321@@ -895,14 +895,14 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800322 phy->basic_rate = cpu_to_le16((u16)vif->bss_conf.basic_rates);
323 phy->rcpi = rcpi;
324 phy->ampdu = FIELD_PREP(IEEE80211_HT_AMPDU_PARM_FACTOR,
325- sta->deflink.ht_cap.ampdu_factor) |
326+ sta->ht_cap.ampdu_factor) |
327 FIELD_PREP(IEEE80211_HT_AMPDU_PARM_DENSITY,
328- sta->deflink.ht_cap.ampdu_density);
329+ sta->ht_cap.ampdu_density);
330
331 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra_info));
332 ra_info = (struct sta_rec_ra_info *)tlv;
333
334- supp_rates = sta->deflink.supp_rates[band];
335+ supp_rates = sta->supp_rates[band];
336 if (band == NL80211_BAND_2GHZ)
337 supp_rates = FIELD_PREP(RA_LEGACY_OFDM, supp_rates >> 4) |
338 FIELD_PREP(RA_LEGACY_CCK, supp_rates & 0xf);
developer5feecba2023-09-05 18:01:51 +0800339@@ -911,18 +911,18 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800340
341 ra_info->legacy = cpu_to_le16(supp_rates);
342
343- if (sta->deflink.ht_cap.ht_supported)
344+ if (sta->ht_cap.ht_supported)
345 memcpy(ra_info->rx_mcs_bitmask,
346- sta->deflink.ht_cap.mcs.rx_mask,
347+ sta->ht_cap.mcs.rx_mask,
348 HT_MCS_MASK_NUM);
349
350 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_STATE, sizeof(*state));
351 state = (struct sta_rec_state *)tlv;
352 state->state = sta_state;
353
354- if (sta->deflink.vht_cap.vht_supported) {
355- state->vht_opmode = sta->deflink.bandwidth;
356- state->vht_opmode |= (sta->deflink.rx_nss - 1) <<
357+ if (sta->vht_cap.vht_supported) {
358+ state->vht_opmode = sta->bandwidth;
359+ state->vht_opmode |= (sta->rx_nss - 1) <<
360 IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT;
361 }
362 }
developer5feecba2023-09-05 18:01:51 +0800363@@ -938,7 +938,7 @@ void mt76_connac_mcu_wtbl_smps_tlv(struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800364 tlv = mt76_connac_mcu_add_nested_tlv(skb, WTBL_SMPS, sizeof(*smps),
365 wtbl_tlv, sta_wtbl);
366 smps = (struct wtbl_smps *)tlv;
367- smps->smps = (sta->deflink.smps_mode == IEEE80211_SMPS_DYNAMIC);
368+ smps->smps = (sta->smps_mode == IEEE80211_SMPS_DYNAMIC);
369 }
370 EXPORT_SYMBOL_GPL(mt76_connac_mcu_wtbl_smps_tlv);
371
developer5feecba2023-09-05 18:01:51 +0800372@@ -950,27 +950,27 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800373 struct tlv *tlv;
374 u32 flags = 0;
375
376- if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_6ghz_capa.capa) {
377+ if (sta->ht_cap.ht_supported || sta->he_6ghz_capa.capa) {
378 tlv = mt76_connac_mcu_add_nested_tlv(skb, WTBL_HT, sizeof(*ht),
379 wtbl_tlv, sta_wtbl);
380 ht = (struct wtbl_ht *)tlv;
381 ht->ldpc = ht_ldpc &&
382- !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING);
383+ !!(sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING);
384
385- if (sta->deflink.ht_cap.ht_supported) {
386- ht->af = sta->deflink.ht_cap.ampdu_factor;
387- ht->mm = sta->deflink.ht_cap.ampdu_density;
388+ if (sta->ht_cap.ht_supported) {
389+ ht->af = sta->ht_cap.ampdu_factor;
390+ ht->mm = sta->ht_cap.ampdu_density;
391 } else {
392- ht->af = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
393+ ht->af = le16_get_bits(sta->he_6ghz_capa.capa,
394 IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP);
395- ht->mm = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
396+ ht->mm = le16_get_bits(sta->he_6ghz_capa.capa,
397 IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START);
398 }
399
400 ht->ht = true;
401 }
402
403- if (sta->deflink.vht_cap.vht_supported || sta->deflink.he_6ghz_capa.capa) {
404+ if (sta->vht_cap.vht_supported || sta->he_6ghz_capa.capa) {
405 struct wtbl_vht *vht;
406 u8 af;
407
developer5feecba2023-09-05 18:01:51 +0800408@@ -979,18 +979,18 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800409 sta_wtbl);
410 vht = (struct wtbl_vht *)tlv;
411 vht->ldpc = vht_ldpc &&
412- !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC);
413+ !!(sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC);
414 vht->vht = true;
415
416 af = FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK,
417- sta->deflink.vht_cap.cap);
418+ sta->vht_cap.cap);
419 if (ht)
420 ht->af = max(ht->af, af);
421 }
422
423 mt76_connac_mcu_wtbl_smps_tlv(skb, sta, sta_wtbl, wtbl_tlv);
424
425- if (is_connac_v1(dev) && sta->deflink.ht_cap.ht_supported) {
426+ if (is_connac_v1(dev) && sta->ht_cap.ht_supported) {
427 /* sgi */
428 u32 msk = MT_WTBL_W5_SHORT_GI_20 | MT_WTBL_W5_SHORT_GI_40 |
429 MT_WTBL_W5_SHORT_GI_80 | MT_WTBL_W5_SHORT_GI_160;
developer5feecba2023-09-05 18:01:51 +0800430@@ -1000,15 +1000,15 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800431 sizeof(*raw), wtbl_tlv,
432 sta_wtbl);
433
434- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
435+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
436 flags |= MT_WTBL_W5_SHORT_GI_20;
437- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
438+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
439 flags |= MT_WTBL_W5_SHORT_GI_40;
440
441- if (sta->deflink.vht_cap.vht_supported) {
442- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
443+ if (sta->vht_cap.vht_supported) {
444+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
445 flags |= MT_WTBL_W5_SHORT_GI_80;
446- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
447+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
448 flags |= MT_WTBL_W5_SHORT_GI_160;
449 }
450 raw = (struct wtbl_raw *)tlv;
developer5feecba2023-09-05 18:01:51 +0800451@@ -1297,9 +1297,9 @@ u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800452 return 0x38;
453
454 if (sta) {
455- ht_cap = &sta->deflink.ht_cap;
456- vht_cap = &sta->deflink.vht_cap;
457- he_cap = &sta->deflink.he_cap;
458+ ht_cap = &sta->ht_cap;
459+ vht_cap = &sta->vht_cap;
460+ he_cap = &sta->he_cap;
461 } else {
462 struct ieee80211_supported_band *sband;
463
developer5feecba2023-09-05 18:01:51 +0800464@@ -1619,7 +1619,6 @@ int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800465 for (i = 0; i < sreq->n_ssids; i++) {
466 if (!sreq->ssids[i].ssid_len)
467 continue;
468-
469 req->ssids[i].ssid_len = cpu_to_le32(sreq->ssids[i].ssid_len);
470 memcpy(req->ssids[i].ssid, sreq->ssids[i].ssid,
471 sreq->ssids[i].ssid_len);
developer5feecba2023-09-05 18:01:51 +0800472@@ -1759,7 +1758,6 @@ int mt76_connac_mcu_sched_scan_req(struct mt76_phy *phy,
developer6100db22023-04-05 13:22:26 +0800473 memcpy(req->ssids[i].ssid, ssid->ssid, ssid->ssid_len);
474 req->ssids[i].ssid_len = cpu_to_le32(ssid->ssid_len);
475 }
476-
477 req->match_num = sreq->n_match_sets;
478 for (i = 0; i < req->match_num; i++) {
479 match = &sreq->match_sets[i];
developer5feecba2023-09-05 18:01:51 +0800480@@ -2246,10 +2244,8 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev,
developer6100db22023-04-05 13:22:26 +0800481 struct mt76_vif *vif,
482 struct ieee80211_bss_conf *info)
483 {
484- struct ieee80211_vif *mvif = container_of(info, struct ieee80211_vif,
485- bss_conf);
486 struct sk_buff *skb;
487- int i, len = min_t(int, mvif->cfg.arp_addr_cnt,
488+ int i, len = min_t(int, info->arp_addr_cnt,
489 IEEE80211_BSS_ARP_ADDR_LIST_LEN);
490 struct {
491 struct {
developer5feecba2023-09-05 18:01:51 +0800492@@ -2277,7 +2273,7 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev,
developer6100db22023-04-05 13:22:26 +0800493
494 skb_put_data(skb, &req_hdr, sizeof(req_hdr));
495 for (i = 0; i < len; i++)
496- skb_put_data(skb, &mvif->cfg.arp_addr_list[i], sizeof(__be32));
497+ skb_put_data(skb, &info->arp_addr_list[i], sizeof(__be32));
498
499 return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD(OFFLOAD), true);
500 }
501diff --git a/mt76x02_mac.c b/mt76x02_mac.c
developer849549c2023-08-02 17:26:48 +0800502index d5db6ffd..fec3d10d 100644
developer6100db22023-04-05 13:22:26 +0800503--- a/mt76x02_mac.c
504+++ b/mt76x02_mac.c
505@@ -404,7 +404,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
506 txwi->rate |= cpu_to_le16(MT_RXWI_RATE_LDPC);
507 if ((info->flags & IEEE80211_TX_CTL_STBC) && nss == 1)
508 txwi->rate |= cpu_to_le16(MT_RXWI_RATE_STBC);
509- if (nss > 1 && sta && sta->deflink.smps_mode == IEEE80211_SMPS_DYNAMIC)
510+ if (nss > 1 && sta && sta->smps_mode == IEEE80211_SMPS_DYNAMIC)
511 txwi_flags |= MT_TXWI_FLAGS_MMPS;
512 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
513 txwi->ack_ctl |= MT_TXWI_ACK_CTL_REQ;
514@@ -412,9 +412,9 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
515 txwi->ack_ctl |= MT_TXWI_ACK_CTL_NSEQ;
516 if ((info->flags & IEEE80211_TX_CTL_AMPDU) && sta) {
517 u8 ba_size = IEEE80211_MIN_AMPDU_BUF;
518- u8 ampdu_density = sta->deflink.ht_cap.ampdu_density;
519+ u8 ampdu_density = sta->ht_cap.ampdu_density;
520
521- ba_size <<= sta->deflink.ht_cap.ampdu_factor;
522+ ba_size <<= sta->ht_cap.ampdu_factor;
523 ba_size = min_t(int, 63, ba_size - 1);
524 if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
525 ba_size = 0;
526diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
developer23d6e272023-08-28 11:10:51 +0800527index fefa4540..848ba4ee 100644
developer6100db22023-04-05 13:22:26 +0800528--- a/mt7915/debugfs.c
529+++ b/mt7915/debugfs.c
developer23d6e272023-08-28 11:10:51 +0800530@@ -2045,8 +2045,8 @@ static ssize_t mt7915_sta_fixed_rate_set(struct file *file,
developer6100db22023-04-05 13:22:26 +0800531
532 phy.ldpc = (phy.bw || phy.ldpc) * GENMASK(2, 0);
533 for (i = 0; i <= phy.bw; i++) {
534- phy.sgi |= gi << (i << sta->deflink.he_cap.has_he);
535- phy.he_ltf |= he_ltf << (i << sta->deflink.he_cap.has_he);
536+ phy.sgi |= gi << (i << sta->he_cap.has_he);
537+ phy.he_ltf |= he_ltf << (i << sta->he_cap.has_he);
538 }
539 field = RATE_PARAM_FIXED;
540
541diff --git a/mt7915/dma.c b/mt7915/dma.c
developer849549c2023-08-02 17:26:48 +0800542index f71ec55b..b4e231b7 100644
developer6100db22023-04-05 13:22:26 +0800543--- a/mt7915/dma.c
544+++ b/mt7915/dma.c
developer2324aa22023-04-12 11:30:15 +0800545@@ -590,8 +590,8 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
developer6100db22023-04-05 13:22:26 +0800546 if (ret < 0)
547 return ret;
548
549- netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
550- mt7915_poll_tx);
551+ netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
552+ mt7915_poll_tx, NAPI_POLL_WEIGHT);
553 napi_enable(&dev->mt76.tx_napi);
554
developer2324aa22023-04-12 11:30:15 +0800555 mt7915_dma_enable(dev, false);
developer6100db22023-04-05 13:22:26 +0800556diff --git a/mt7915/init.c b/mt7915/init.c
developer23d6e272023-08-28 11:10:51 +0800557index 2e9c94fb..b30aaea2 100644
developer6100db22023-04-05 13:22:26 +0800558--- a/mt7915/init.c
559+++ b/mt7915/init.c
developer23d6e272023-08-28 11:10:51 +0800560@@ -1157,8 +1157,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
developerbbd45e12023-05-19 08:22:06 +0800561 mt76_connac_gen_ppe_thresh(he_cap->ppe_thres, nss);
developer6100db22023-04-05 13:22:26 +0800562 } else {
563 he_cap_elem->phy_cap_info[9] |=
564- u8_encode_bits(IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US,
565- IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK);
566+ IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US;
567 }
568
569 if (band == NL80211_BAND_6GHZ) {
developer6100db22023-04-05 13:22:26 +0800570diff --git a/mt7915/main.c b/mt7915/main.c
developer23d6e272023-08-28 11:10:51 +0800571index deef1bb6..14b691a2 100644
developer6100db22023-04-05 13:22:26 +0800572--- a/mt7915/main.c
573+++ b/mt7915/main.c
developer23d6e272023-08-28 11:10:51 +0800574@@ -532,7 +532,7 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
developer6100db22023-04-05 13:22:26 +0800575
576 static int
577 mt7915_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
578- unsigned int link_id, u16 queue,
579+ u16 queue,
580 const struct ieee80211_tx_queue_params *params)
581 {
582 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
developer23d6e272023-08-28 11:10:51 +0800583@@ -627,7 +627,7 @@ mt7915_update_bss_color(struct ieee80211_hw *hw,
developer6100db22023-04-05 13:22:26 +0800584 static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
585 struct ieee80211_vif *vif,
586 struct ieee80211_bss_conf *info,
587- u64 changed)
588+ u32 changed)
589 {
590 struct mt7915_phy *phy = mt7915_hw_phy(hw);
591 struct mt7915_dev *dev = mt7915_hw_dev(hw);
developer23d6e272023-08-28 11:10:51 +0800592@@ -643,7 +643,7 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
developerc1571f92023-07-04 22:11:24 +0800593 vif->type == NL80211_IFTYPE_STATION)
594 set_bss_info = set_sta = !is_zero_ether_addr(info->bssid);
developer6100db22023-04-05 13:22:26 +0800595 if (changed & BSS_CHANGED_ASSOC)
developerc1571f92023-07-04 22:11:24 +0800596- set_bss_info = vif->cfg.assoc;
597+ set_bss_info = info->assoc;
598 if (changed & BSS_CHANGED_BEACON_ENABLED &&
599 vif->type != NL80211_IFTYPE_AP)
600 set_bss_info = set_sta = info->enable_beacon;
developer23d6e272023-08-28 11:10:51 +0800601@@ -691,27 +691,8 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
developerc1571f92023-07-04 22:11:24 +0800602 mutex_unlock(&dev->mt76.mutex);
developer2157bf82023-06-26 02:27:49 +0800603 }
604
developerc1571f92023-07-04 22:11:24 +0800605-static void
606-mt7915_vif_check_caps(struct mt7915_phy *phy, struct ieee80211_vif *vif)
607-{
608- struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
609- struct mt7915_vif_cap *vc = &mvif->cap;
610-
611- vc->ht_ldpc = vif->bss_conf.ht_ldpc;
612- vc->vht_ldpc = vif->bss_conf.vht_ldpc;
613- vc->vht_su_ebfer = vif->bss_conf.vht_su_beamformer;
614- vc->vht_su_ebfee = vif->bss_conf.vht_su_beamformee;
615- vc->vht_mu_ebfer = vif->bss_conf.vht_mu_beamformer;
616- vc->vht_mu_ebfee = vif->bss_conf.vht_mu_beamformee;
617- vc->he_ldpc = vif->bss_conf.he_ldpc;
618- vc->he_su_ebfer = vif->bss_conf.he_su_beamformer;
619- vc->he_su_ebfee = vif->bss_conf.he_su_beamformee;
620- vc->he_mu_ebfer = vif->bss_conf.he_mu_beamformer;
621-}
622-
developer2157bf82023-06-26 02:27:49 +0800623 static int
624-mt7915_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
625- struct ieee80211_bss_conf *link_conf)
626+mt7915_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
developer6100db22023-04-05 13:22:26 +0800627 {
628 struct mt7915_phy *phy = mt7915_hw_phy(hw);
629 struct mt7915_dev *dev = mt7915_hw_dev(hw);
developer23d6e272023-08-28 11:10:51 +0800630@@ -719,8 +700,6 @@ mt7915_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
developerc1571f92023-07-04 22:11:24 +0800631
632 mutex_lock(&dev->mt76.mutex);
633
634- mt7915_vif_check_caps(phy, vif);
635-
636 err = mt7915_mcu_add_bss_info(phy, vif, true);
637 if (err)
638 goto out;
developer23d6e272023-08-28 11:10:51 +0800639@@ -732,8 +711,7 @@ out:
developer2157bf82023-06-26 02:27:49 +0800640 }
641
642 static void
643-mt7915_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
644- struct ieee80211_bss_conf *link_conf)
645+mt7915_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
646 {
647 struct mt7915_dev *dev = mt7915_hw_dev(hw);
648
developer23d6e272023-08-28 11:10:51 +0800649@@ -1296,10 +1274,10 @@ static int mt7915_sta_set_txpwr(struct ieee80211_hw *hw,
developer2157bf82023-06-26 02:27:49 +0800650 {
651 struct mt7915_phy *phy = mt7915_hw_phy(hw);
652 struct mt7915_dev *dev = mt7915_hw_dev(hw);
developer6100db22023-04-05 13:22:26 +0800653- s16 txpower = sta->deflink.txpwr.power;
654+ s16 txpower = sta->txpwr.power;
655 int ret;
656
657- if (sta->deflink.txpwr.type == NL80211_TX_POWER_AUTOMATIC)
658+ if (sta->txpwr.type == NL80211_TX_POWER_AUTOMATIC)
659 txpower = 0;
660
661 mutex_lock(&dev->mt76.mutex);
662diff --git a/mt7915/mcu.c b/mt7915/mcu.c
developer5feecba2023-09-05 18:01:51 +0800663index 7c3e25c6..8dce1dea 100644
developer6100db22023-04-05 13:22:26 +0800664--- a/mt7915/mcu.c
665+++ b/mt7915/mcu.c
developerbbd45e12023-05-19 08:22:06 +0800666@@ -67,7 +67,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
developer6100db22023-04-05 13:22:26 +0800667 struct mt7915_dev *dev = msta->vif->phy->dev;
668 enum nl80211_band band = msta->vif->phy->mt76->chandef.chan->band;
669 const u16 *mask = msta->vif->bitrate_mask.control[band].he_mcs;
670- int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
671+ int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
672
673 for (nss = 0; nss < max_nss; nss++) {
674 int mcs;
developerbbd45e12023-05-19 08:22:06 +0800675@@ -107,7 +107,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
developer6100db22023-04-05 13:22:26 +0800676
677 /* only support 2ss on 160MHz for mt7915 */
678 if (is_mt7915(&dev->mt76) && nss > 1 &&
679- sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
680+ sta->bandwidth == IEEE80211_STA_RX_BW_160)
681 break;
682 }
683
developerbbd45e12023-05-19 08:22:06 +0800684@@ -120,8 +120,8 @@ mt7915_mcu_set_sta_vht_mcs(struct ieee80211_sta *sta, __le16 *vht_mcs,
developer6100db22023-04-05 13:22:26 +0800685 {
686 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
687 struct mt7915_dev *dev = msta->vif->phy->dev;
688- u16 mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map);
689- int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
690+ u16 mcs_map = le16_to_cpu(sta->vht_cap.vht_mcs.rx_mcs_map);
691+ int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
692 u16 mcs;
693
694 for (nss = 0; nss < max_nss; nss++, mcs_map >>= 2) {
developerbbd45e12023-05-19 08:22:06 +0800695@@ -143,7 +143,7 @@ mt7915_mcu_set_sta_vht_mcs(struct ieee80211_sta *sta, __le16 *vht_mcs,
developer6100db22023-04-05 13:22:26 +0800696
697 /* only support 2ss on 160MHz for mt7915 */
698 if (is_mt7915(&dev->mt76) && nss > 1 &&
699- sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
700+ sta->bandwidth == IEEE80211_STA_RX_BW_160)
701 break;
702 }
703 }
developerbbd45e12023-05-19 08:22:06 +0800704@@ -152,10 +152,10 @@ static void
developer6100db22023-04-05 13:22:26 +0800705 mt7915_mcu_set_sta_ht_mcs(struct ieee80211_sta *sta, u8 *ht_mcs,
706 const u8 *mask)
707 {
708- int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
709+ int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
710
711 for (nss = 0; nss < max_nss; nss++)
712- ht_mcs[nss] = sta->deflink.ht_cap.mcs.rx_mask[nss] & mask[nss];
713+ ht_mcs[nss] = sta->ht_cap.mcs.rx_mask[nss] & mask[nss];
714 }
715
716 static int
developerbbd45e12023-05-19 08:22:06 +0800717@@ -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 +0800718 static void
719 mt7915_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
720 {
developer23d6e272023-08-28 11:10:51 +0800721- if (vif->bss_conf.csa_active && vif->type != NL80211_IFTYPE_STATION)
722+ if (vif->csa_active && vif->type != NL80211_IFTYPE_STATION)
developer6100db22023-04-05 13:22:26 +0800723 ieee80211_csa_finish(vif);
724 }
725
developerbbd45e12023-05-19 08:22:06 +0800726@@ -337,7 +337,7 @@ mt7915_mcu_rx_log_message(struct mt7915_dev *dev, struct sk_buff *skb)
developer6100db22023-04-05 13:22:26 +0800727 static void
728 mt7915_mcu_cca_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
729 {
developer23d6e272023-08-28 11:10:51 +0800730- if (!vif->bss_conf.color_change_active || vif->type == NL80211_IFTYPE_STATION)
731+ if (!vif->color_change_active || vif->type == NL80211_IFTYPE_STATION)
developer6100db22023-04-05 13:22:26 +0800732 return;
733
734 ieee80211_color_change_finish(vif);
developerc1571f92023-07-04 22:11:24 +0800735@@ -752,13 +752,13 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
developer6100db22023-04-05 13:22:26 +0800736 struct ieee80211_vif *vif)
737 {
developerc1571f92023-07-04 22:11:24 +0800738 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
developer6100db22023-04-05 13:22:26 +0800739- struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem;
740+ struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem;
741 struct ieee80211_he_mcs_nss_supp mcs_map;
742 struct sta_rec_he *he;
743 struct tlv *tlv;
744 u32 cap = 0;
745
746- if (!sta->deflink.he_cap.has_he)
747+ if (!sta->he_cap.has_he)
748 return;
749
750 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE, sizeof(*he));
developerc1571f92023-07-04 22:11:24 +0800751@@ -844,8 +844,8 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
developer6100db22023-04-05 13:22:26 +0800752
753 he->he_cap = cpu_to_le32(cap);
754
755- mcs_map = sta->deflink.he_cap.he_mcs_nss_supp;
756- switch (sta->deflink.bandwidth) {
757+ mcs_map = sta->he_cap.he_mcs_nss_supp;
758+ switch (sta->bandwidth) {
759 case IEEE80211_STA_RX_BW_160:
760 if (elem->phy_cap_info[0] &
761 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
developerc1571f92023-07-04 22:11:24 +0800762@@ -895,7 +895,7 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developerbbd45e12023-05-19 08:22:06 +0800763 struct ieee80211_sta *sta, struct ieee80211_vif *vif)
developer6100db22023-04-05 13:22:26 +0800764 {
developerc1571f92023-07-04 22:11:24 +0800765 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
developer6100db22023-04-05 13:22:26 +0800766- struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem;
767+ struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem;
developerc1571f92023-07-04 22:11:24 +0800768 struct mt7915_phy *phy = mvif->phy;
developer6100db22023-04-05 13:22:26 +0800769 struct sta_rec_muru *muru;
770 struct tlv *tlv;
developerc1571f92023-07-04 22:11:24 +0800771@@ -920,11 +920,11 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800772 muru->cfg.ofdma_dl_en = !!(phy->muru_onoff & OFDMA_DL);
773 muru->cfg.ofdma_ul_en = !!(phy->muru_onoff & OFDMA_UL);
774
775- if (sta->deflink.vht_cap.vht_supported)
776+ if (sta->vht_cap.vht_supported)
777 muru->mimo_dl.vht_mu_bfee =
778- !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
779+ !!(sta->vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
780
781- if (!sta->deflink.he_cap.has_he)
782+ if (!sta->he_cap.has_he)
783 return;
784
785 muru->mimo_dl.partial_bw_dl_mimo =
developerd8ca5d32023-08-30 19:05:17 +0800786@@ -960,13 +960,13 @@ mt7915_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
developer6100db22023-04-05 13:22:26 +0800787 struct sta_rec_ht *ht;
788 struct tlv *tlv;
789
790- if (!sta->deflink.ht_cap.ht_supported)
791+ if (!sta->ht_cap.ht_supported)
792 return;
793
794 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht));
795
796 ht = (struct sta_rec_ht *)tlv;
797- ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap);
798+ ht->ht_cap = cpu_to_le16(sta->ht_cap.cap);
799 }
800
801 static void
developerd8ca5d32023-08-30 19:05:17 +0800802@@ -975,15 +975,15 @@ mt7915_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
developer6100db22023-04-05 13:22:26 +0800803 struct sta_rec_vht *vht;
804 struct tlv *tlv;
805
806- if (!sta->deflink.vht_cap.vht_supported)
807+ if (!sta->vht_cap.vht_supported)
808 return;
809
810 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, sizeof(*vht));
811
812 vht = (struct sta_rec_vht *)tlv;
813- vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap);
814- vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map;
815- vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map;
816+ vht->vht_cap = cpu_to_le32(sta->vht_cap.cap);
817+ vht->vht_rx_mcs_map = sta->vht_cap.vht_mcs.rx_mcs_map;
818+ vht->vht_tx_mcs_map = sta->vht_cap.vht_mcs.tx_mcs_map;
819 }
820
821 static void
developerd8ca5d32023-08-30 19:05:17 +0800822@@ -998,7 +998,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800823 vif->type != NL80211_IFTYPE_AP)
824 return;
825
826- if (!sta->deflink.agg.max_amsdu_len)
827+ if (!sta->max_amsdu_len)
828 return;
829
830 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu));
developerd8ca5d32023-08-30 19:05:17 +0800831@@ -1007,7 +1007,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800832 amsdu->amsdu_en = true;
833 msta->wcid.amsdu = true;
834
835- switch (sta->deflink.agg.max_amsdu_len) {
836+ switch (sta->max_amsdu_len) {
837 case IEEE80211_MAX_MPDU_LEN_VHT_11454:
838 if (!is_mt7915(&dev->mt76)) {
839 amsdu->max_mpdu_size =
developerd8ca5d32023-08-30 19:05:17 +0800840@@ -1070,8 +1070,8 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
developer69542b52023-04-13 10:46:44 +0800841 if (!bfee && sts < 2)
developer6100db22023-04-05 13:22:26 +0800842 return false;
843
844- if (sta->deflink.he_cap.has_he) {
845- struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem;
846+ if (sta->he_cap.has_he) {
847+ struct ieee80211_he_cap_elem *pe = &sta->he_cap.he_cap_elem;
848
849 if (bfee)
developerc1571f92023-07-04 22:11:24 +0800850 return mvif->cap.he_su_ebfee &&
developerd8ca5d32023-08-30 19:05:17 +0800851@@ -1081,8 +1081,8 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800852 HE_PHY(CAP4_SU_BEAMFORMEE, pe->phy_cap_info[4]);
853 }
854
855- if (sta->deflink.vht_cap.vht_supported) {
856- u32 cap = sta->deflink.vht_cap.cap;
857+ if (sta->vht_cap.vht_supported) {
858+ u32 cap = sta->vht_cap.cap;
859
860 if (bfee)
developerc1571f92023-07-04 22:11:24 +0800861 return mvif->cap.vht_su_ebfee &&
developerd8ca5d32023-08-30 19:05:17 +0800862@@ -1108,7 +1108,7 @@ static void
developer6100db22023-04-05 13:22:26 +0800863 mt7915_mcu_sta_bfer_ht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
864 struct sta_rec_bf *bf)
865 {
866- struct ieee80211_mcs_info *mcs = &sta->deflink.ht_cap.mcs;
867+ struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
868 u8 n = 0;
869
870 bf->tx_mode = MT_PHY_TYPE_HT;
developerd8ca5d32023-08-30 19:05:17 +0800871@@ -1133,7 +1133,7 @@ static void
developer6100db22023-04-05 13:22:26 +0800872 mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
873 struct sta_rec_bf *bf, bool explicit)
874 {
875- struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap;
876+ struct ieee80211_sta_vht_cap *pc = &sta->vht_cap;
877 struct ieee80211_sta_vht_cap *vc = &phy->mt76->sband_5g.sband.vht_cap;
878 u16 mcs_map = le16_to_cpu(pc->vht_mcs.rx_mcs_map);
879 u8 nss_mcs = mt7915_mcu_get_sta_nss(mcs_map);
developerd8ca5d32023-08-30 19:05:17 +0800880@@ -1154,14 +1154,14 @@ mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
developer6100db22023-04-05 13:22:26 +0800881 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
882 bf->ibf_ncol = bf->ncol;
883
884- if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
885+ if (sta->bandwidth == IEEE80211_STA_RX_BW_160)
886 bf->nrow = 1;
887 } else {
888 bf->nrow = tx_ant;
889 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
890 bf->ibf_ncol = nss_mcs;
891
892- if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
893+ if (sta->bandwidth == IEEE80211_STA_RX_BW_160)
894 bf->ibf_nrow = 1;
895 }
896 }
developerd8ca5d32023-08-30 19:05:17 +0800897@@ -1170,7 +1170,7 @@ static void
developer6100db22023-04-05 13:22:26 +0800898 mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
899 struct mt7915_phy *phy, struct sta_rec_bf *bf)
900 {
901- struct ieee80211_sta_he_cap *pc = &sta->deflink.he_cap;
902+ struct ieee80211_sta_he_cap *pc = &sta->he_cap;
903 struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem;
904 const struct ieee80211_sta_he_cap *vc =
905 mt76_connac_get_he_phy_cap(phy->mt76, vif);
developerd8ca5d32023-08-30 19:05:17 +0800906@@ -1195,7 +1195,7 @@ mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +0800907 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
908 bf->ibf_ncol = bf->ncol;
909
910- if (sta->deflink.bandwidth != IEEE80211_STA_RX_BW_160)
911+ if (sta->bandwidth != IEEE80211_STA_RX_BW_160)
912 return;
913
914 /* go over for 160MHz and 80p80 */
developerd8ca5d32023-08-30 19:05:17 +0800915@@ -1243,7 +1243,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800916 };
917 bool ebf;
918
919- if (!(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
920+ if (!(sta->ht_cap.ht_supported || sta->he_cap.has_he))
921 return;
922
923 ebf = mt7915_is_ebf_supported(phy, vif, sta, false);
developerd8ca5d32023-08-30 19:05:17 +0800924@@ -1257,21 +1257,21 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800925 * vht: support eBF and iBF
926 * ht: iBF only, since mac80211 lacks of eBF support
927 */
928- if (sta->deflink.he_cap.has_he && ebf)
929+ if (sta->he_cap.has_he && ebf)
930 mt7915_mcu_sta_bfer_he(sta, vif, phy, bf);
931- else if (sta->deflink.vht_cap.vht_supported)
932+ else if (sta->vht_cap.vht_supported)
933 mt7915_mcu_sta_bfer_vht(sta, phy, bf, ebf);
934- else if (sta->deflink.ht_cap.ht_supported)
935+ else if (sta->ht_cap.ht_supported)
936 mt7915_mcu_sta_bfer_ht(sta, phy, bf);
937 else
938 return;
939
940 bf->bf_cap = ebf ? ebf : dev->ibf << 1;
941- bf->bw = sta->deflink.bandwidth;
942- bf->ibf_dbw = sta->deflink.bandwidth;
943+ bf->bw = sta->bandwidth;
944+ bf->ibf_dbw = sta->bandwidth;
945 bf->ibf_nrow = tx_ant;
946
947- if (!ebf && sta->deflink.bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol)
948+ if (!ebf && sta->bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol)
949 bf->ibf_timeout = 0x48;
950 else
951 bf->ibf_timeout = 0x18;
developerd8ca5d32023-08-30 19:05:17 +0800952@@ -1281,7 +1281,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800953 else
954 bf->mem_20m = matrix[bf->nrow][bf->ncol];
955
956- switch (sta->deflink.bandwidth) {
957+ switch (sta->bandwidth) {
958 case IEEE80211_STA_RX_BW_160:
959 case IEEE80211_STA_RX_BW_80:
960 bf->mem_total = bf->mem_20m * 2;
developerd8ca5d32023-08-30 19:05:17 +0800961@@ -1306,7 +1306,7 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800962 struct tlv *tlv;
963 u8 nrow = 0;
964
965- if (!(sta->deflink.vht_cap.vht_supported || sta->deflink.he_cap.has_he))
966+ if (!(sta->vht_cap.vht_supported || sta->he_cap.has_he))
967 return;
968
969 if (!mt7915_is_ebf_supported(phy, vif, sta, true))
developerd8ca5d32023-08-30 19:05:17 +0800970@@ -1315,13 +1315,13 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developer6100db22023-04-05 13:22:26 +0800971 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_BFEE, sizeof(*bfee));
972 bfee = (struct sta_rec_bfee *)tlv;
973
974- if (sta->deflink.he_cap.has_he) {
975- struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem;
976+ if (sta->he_cap.has_he) {
977+ struct ieee80211_he_cap_elem *pe = &sta->he_cap.he_cap_elem;
978
979 nrow = HE_PHY(CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK,
980 pe->phy_cap_info[5]);
981- } else if (sta->deflink.vht_cap.vht_supported) {
982- struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap;
983+ } else if (sta->vht_cap.vht_supported) {
984+ struct ieee80211_sta_vht_cap *pc = &sta->vht_cap;
985
986 nrow = FIELD_GET(IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK,
987 pc->cap);
developerd8ca5d32023-08-30 19:05:17 +0800988@@ -1377,7 +1377,7 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +0800989 ra->phy = *phy;
990 break;
991 case RATE_PARAM_MMPS_UPDATE:
992- ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->deflink.smps_mode);
993+ ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->smps_mode);
994 break;
995 case RATE_PARAM_SPE_UPDATE:
996 ra->spe_idx = *(u8 *)data;
developerd8ca5d32023-08-30 19:05:17 +0800997@@ -1452,7 +1452,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +0800998 do { \
999 u8 i, gi = mask->control[band]._gi; \
1000 gi = (_he) ? gi : gi == NL80211_TXRATE_FORCE_SGI; \
1001- for (i = 0; i <= sta->deflink.bandwidth; i++) { \
1002+ for (i = 0; i <= sta->bandwidth; i++) { \
1003 phy.sgi |= gi << (i << (_he)); \
1004 phy.he_ltf |= mask->control[band].he_ltf << (i << (_he));\
1005 } \
developerd8ca5d32023-08-30 19:05:17 +08001006@@ -1466,11 +1466,11 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001007 } \
1008 } while (0)
1009
1010- if (sta->deflink.he_cap.has_he) {
1011+ if (sta->he_cap.has_he) {
1012 __sta_phy_bitrate_mask_check(he_mcs, he_gi, 0, 1);
1013- } else if (sta->deflink.vht_cap.vht_supported) {
1014+ } else if (sta->vht_cap.vht_supported) {
1015 __sta_phy_bitrate_mask_check(vht_mcs, gi, 0, 0);
1016- } else if (sta->deflink.ht_cap.ht_supported) {
1017+ } else if (sta->ht_cap.ht_supported) {
1018 __sta_phy_bitrate_mask_check(ht_mcs, gi, 1, 0);
1019 } else {
1020 nrates = hweight32(mask->control[band].legacy);
developerd8ca5d32023-08-30 19:05:17 +08001021@@ -1504,7 +1504,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001022 * actual txrate hardware sends out.
1023 */
1024 addr = mt7915_mac_wtbl_lmac_addr(dev, msta->wcid.idx, 7);
1025- if (sta->deflink.he_cap.has_he)
1026+ if (sta->he_cap.has_he)
1027 mt76_rmw_field(dev, addr, GENMASK(31, 24), phy.sgi);
1028 else
1029 mt76_rmw_field(dev, addr, GENMASK(15, 12), phy.sgi);
developerd8ca5d32023-08-30 19:05:17 +08001030@@ -1537,7 +1537,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001031 enum nl80211_band band = chandef->chan->band;
1032 struct sta_rec_ra *ra;
1033 struct tlv *tlv;
1034- u32 supp_rate = sta->deflink.supp_rates[band];
1035+ u32 supp_rate = sta->supp_rates[band];
1036 u32 cap = sta->wme ? STA_CAP_WMM : 0;
1037
1038 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra));
developerd8ca5d32023-08-30 19:05:17 +08001039@@ -1547,9 +1547,9 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001040 ra->auto_rate = true;
1041 ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, sta);
1042 ra->channel = chandef->chan->hw_value;
1043- ra->bw = sta->deflink.bandwidth;
1044- ra->phy.bw = sta->deflink.bandwidth;
1045- ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->deflink.smps_mode);
1046+ ra->bw = sta->bandwidth;
1047+ ra->phy.bw = sta->bandwidth;
1048+ ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->smps_mode);
1049
1050 if (supp_rate) {
1051 supp_rate &= mask->control[band].legacy;
developerd8ca5d32023-08-30 19:05:17 +08001052@@ -1569,22 +1569,22 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001053 }
1054 }
1055
1056- if (sta->deflink.ht_cap.ht_supported) {
1057+ if (sta->ht_cap.ht_supported) {
1058 ra->supp_mode |= MODE_HT;
1059- ra->af = sta->deflink.ht_cap.ampdu_factor;
1060- ra->ht_gf = !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
1061+ ra->af = sta->ht_cap.ampdu_factor;
1062+ ra->ht_gf = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
1063
1064 cap |= STA_CAP_HT;
1065- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
1066+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
1067 cap |= STA_CAP_SGI_20;
1068- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
1069+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
1070 cap |= STA_CAP_SGI_40;
1071- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)
1072+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)
1073 cap |= STA_CAP_TX_STBC;
1074- if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
1075+ if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
1076 cap |= STA_CAP_RX_STBC;
developerc1571f92023-07-04 22:11:24 +08001077 if (mvif->cap.ht_ldpc &&
developer6100db22023-04-05 13:22:26 +08001078- (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING))
1079+ (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING))
1080 cap |= STA_CAP_LDPC;
1081
1082 mt7915_mcu_set_sta_ht_mcs(sta, ra->ht_mcs,
developerd8ca5d32023-08-30 19:05:17 +08001083@@ -1592,37 +1592,37 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
developer6100db22023-04-05 13:22:26 +08001084 ra->supp_ht_mcs = *(__le32 *)ra->ht_mcs;
1085 }
1086
1087- if (sta->deflink.vht_cap.vht_supported) {
1088+ if (sta->vht_cap.vht_supported) {
1089 u8 af;
1090
1091 ra->supp_mode |= MODE_VHT;
1092 af = FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK,
1093- sta->deflink.vht_cap.cap);
1094+ sta->vht_cap.cap);
1095 ra->af = max_t(u8, ra->af, af);
1096
1097 cap |= STA_CAP_VHT;
1098- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
1099+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
1100 cap |= STA_CAP_VHT_SGI_80;
1101- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
1102+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
1103 cap |= STA_CAP_VHT_SGI_160;
1104- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC)
1105+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC)
1106 cap |= STA_CAP_VHT_TX_STBC;
1107- if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1)
1108+ if (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1)
1109 cap |= STA_CAP_VHT_RX_STBC;
developerc1571f92023-07-04 22:11:24 +08001110 if (mvif->cap.vht_ldpc &&
developer6100db22023-04-05 13:22:26 +08001111- (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC))
1112+ (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC))
1113 cap |= STA_CAP_VHT_LDPC;
1114
1115 mt7915_mcu_set_sta_vht_mcs(sta, ra->supp_vht_mcs,
1116 mask->control[band].vht_mcs);
1117 }
1118
1119- if (sta->deflink.he_cap.has_he) {
1120+ if (sta->he_cap.has_he) {
1121 ra->supp_mode |= MODE_HE;
1122 cap |= STA_CAP_HE;
1123
1124- if (sta->deflink.he_6ghz_capa.capa)
1125- ra->af = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
1126+ if (sta->he_6ghz_capa.capa)
1127+ ra->af = le16_get_bits(sta->he_6ghz_capa.capa,
1128 IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP);
1129 }
1130
developerd8ca5d32023-08-30 19:05:17 +08001131@@ -1831,7 +1831,7 @@ mt7915_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,
developer6100db22023-04-05 13:22:26 +08001132 if (!offs->cntdwn_counter_offs[0])
1133 return;
1134
1135- sub_tag = vif->bss_conf.csa_active ? BSS_INFO_BCN_CSA : BSS_INFO_BCN_BCC;
1136+ sub_tag = vif->csa_active ? BSS_INFO_BCN_CSA : BSS_INFO_BCN_BCC;
1137 tlv = mt7915_mcu_add_nested_subtlv(rskb, sub_tag, sizeof(*info),
1138 &bcn->sub_ntlv, &bcn->len);
1139 info = (struct bss_info_bcn_cntdwn *)tlv;
developerd8ca5d32023-08-30 19:05:17 +08001140@@ -1916,9 +1916,9 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +08001141 if (offs->cntdwn_counter_offs[0]) {
1142 u16 offset = offs->cntdwn_counter_offs[0];
1143
1144- if (vif->bss_conf.csa_active)
1145+ if (vif->csa_active)
1146 cont->csa_ofs = cpu_to_le16(offset - 4);
1147- if (vif->bss_conf.color_change_active)
1148+ if (vif->color_change_active)
1149 cont->bcc_ofs = cpu_to_le16(offset - 3);
1150 }
1151
developerd8ca5d32023-08-30 19:05:17 +08001152@@ -1928,6 +1928,85 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,
developerbbd45e12023-05-19 08:22:06 +08001153 memcpy(buf + MT_TXD_SIZE, skb->data, skb->len);
1154 }
1155
1156+static void
1157+mt7915_mcu_beacon_check_caps(struct mt7915_phy *phy, struct ieee80211_vif *vif,
1158+ struct sk_buff *skb)
1159+{
1160+ struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
1161+ struct mt7915_vif_cap *vc = &mvif->cap;
1162+ const struct ieee80211_he_cap_elem *he;
1163+ const struct ieee80211_vht_cap *vht;
1164+ const struct ieee80211_ht_cap *ht;
1165+ struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
1166+ const u8 *ie;
1167+ u32 len, bc;
1168+
1169+ /* Check missing configuration options to allow AP mode in mac80211
1170+ * to remain in sync with hostapd settings, and get a subset of
1171+ * beacon and hardware capabilities.
1172+ */
1173+ if (WARN_ON_ONCE(skb->len <= (mgmt->u.beacon.variable - skb->data)))
1174+ return;
1175+
1176+ memset(vc, 0, sizeof(*vc));
1177+
1178+ len = skb->len - (mgmt->u.beacon.variable - skb->data);
1179+
1180+ ie = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, mgmt->u.beacon.variable,
1181+ len);
1182+ if (ie && ie[1] >= sizeof(*ht)) {
1183+ ht = (void *)(ie + 2);
1184+ vc->ht_ldpc = !!(le16_to_cpu(ht->cap_info) &
1185+ IEEE80211_HT_CAP_LDPC_CODING);
1186+ }
1187+
1188+ ie = cfg80211_find_ie(WLAN_EID_VHT_CAPABILITY, mgmt->u.beacon.variable,
1189+ len);
1190+ if (ie && ie[1] >= sizeof(*vht)) {
1191+ u32 pc = phy->mt76->sband_5g.sband.vht_cap.cap;
1192+
1193+ vht = (void *)(ie + 2);
1194+ bc = le32_to_cpu(vht->vht_cap_info);
1195+
1196+ vc->vht_ldpc = !!(bc & IEEE80211_VHT_CAP_RXLDPC);
1197+ vc->vht_su_ebfer =
1198+ (bc & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE) &&
1199+ (pc & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE);
1200+ vc->vht_su_ebfee =
1201+ (bc & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE) &&
1202+ (pc & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE);
1203+ vc->vht_mu_ebfer =
1204+ (bc & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE) &&
1205+ (pc & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE);
1206+ vc->vht_mu_ebfee =
1207+ (bc & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE) &&
1208+ (pc & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
1209+ }
1210+
1211+ ie = cfg80211_find_ext_ie(WLAN_EID_EXT_HE_CAPABILITY,
1212+ mgmt->u.beacon.variable, len);
1213+ if (ie && ie[1] >= sizeof(*he) + 1) {
1214+ const struct ieee80211_sta_he_cap *pc =
1215+ mt76_connac_get_he_phy_cap(phy->mt76, vif);
1216+ const struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem;
1217+
1218+ he = (void *)(ie + 3);
1219+
1220+ vc->he_ldpc =
1221+ HE_PHY(CAP1_LDPC_CODING_IN_PAYLOAD, he->phy_cap_info[1]) &&
1222+ HE_PHY(CAP1_LDPC_CODING_IN_PAYLOAD, pe->phy_cap_info[1]);
1223+ vc->he_su_ebfer =
1224+ HE_PHY(CAP3_SU_BEAMFORMER, he->phy_cap_info[3]) &&
1225+ HE_PHY(CAP3_SU_BEAMFORMER, pe->phy_cap_info[3]);
1226+ vc->he_su_ebfee =
1227+ HE_PHY(CAP4_SU_BEAMFORMEE, he->phy_cap_info[4]) &&
1228+ HE_PHY(CAP4_SU_BEAMFORMEE, pe->phy_cap_info[4]);
1229+ vc->he_mu_ebfer =
1230+ HE_PHY(CAP4_MU_BEAMFORMER, he->phy_cap_info[4]) &&
1231+ HE_PHY(CAP4_MU_BEAMFORMER, pe->phy_cap_info[4]);
1232+ }
1233+}
1234+
1235 int
1236 mt7915_mcu_add_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vif,
1237 u32 changed)
developer5feecba2023-09-05 18:01:51 +08001238@@ -2041,7 +2120,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
developer6100db22023-04-05 13:22:26 +08001239 if (!en)
1240 goto out;
1241
1242- skb = ieee80211_beacon_get_template(hw, vif, &offs, 0);
1243+ skb = ieee80211_beacon_get_template(hw, vif, &offs);
developerd8ca5d32023-08-30 19:05:17 +08001244 if (!skb) {
1245 dev_kfree_skb(rskb);
developer6100db22023-04-05 13:22:26 +08001246 return -EINVAL;
developer5feecba2023-09-05 18:01:51 +08001247@@ -2057,6 +2136,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
developerbbd45e12023-05-19 08:22:06 +08001248 info = IEEE80211_SKB_CB(skb);
1249 info->hw_queue = FIELD_PREP(MT_TX_HW_QUEUE_PHY, ext_phy);
1250
1251+ mt7915_mcu_beacon_check_caps(phy, vif, skb);
1252 mt7915_mcu_beacon_cntdwn(vif, rskb, skb, bcn, &offs);
1253 mt7915_mcu_beacon_mbss(rskb, skb, vif, bcn, &offs);
1254 mt7915_mcu_beacon_cont(dev, vif, rskb, skb, bcn, &offs);
developer5feecba2023-09-05 18:01:51 +08001255@@ -3329,17 +3409,17 @@ int mt7915_mcu_set_txpower_frame(struct mt7915_phy *phy,
developer6100db22023-04-05 13:22:26 +08001256 if (txpower) {
1257 u32 offs, len, i;
1258
1259- if (sta->deflink.ht_cap.ht_supported) {
1260+ if (sta->ht_cap.ht_supported) {
1261 const u8 *sku_len = mt7915_sku_group_len;
1262
1263 offs = sku_len[SKU_CCK] + sku_len[SKU_OFDM];
1264 len = sku_len[SKU_HT_BW20] + sku_len[SKU_HT_BW40];
1265
1266- if (sta->deflink.vht_cap.vht_supported) {
1267+ if (sta->vht_cap.vht_supported) {
1268 offs += len;
1269 len = sku_len[SKU_VHT_BW20] * 4;
1270
1271- if (sta->deflink.he_cap.has_he) {
1272+ if (sta->he_cap.has_he) {
1273 offs += len + sku_len[SKU_HE_RU26] * 3;
1274 len = sku_len[SKU_HE_RU242] * 4;
1275 }
developer2157bf82023-06-26 02:27:49 +08001276diff --git a/mt7915/mmio.c b/mt7915/mmio.c
developer23d6e272023-08-28 11:10:51 +08001277index aa5c5dd6..08e7c52f 100644
developer2157bf82023-06-26 02:27:49 +08001278--- a/mt7915/mmio.c
1279+++ b/mt7915/mmio.c
developer23d6e272023-08-28 11:10:51 +08001280@@ -689,7 +689,7 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
developer2157bf82023-06-26 02:27:49 +08001281 phy_addr = dma_map_single(dev->mt76.dma_dev, ptr,
1282 wed->wlan.rx_size,
1283 DMA_TO_DEVICE);
1284-
1285+
1286 if (unlikely(dma_mapping_error(dev->mt76.dev, phy_addr))) {
1287 skb_free_frag(ptr);
1288 mt76_put_rxwi(&dev->mt76, r);
developer6100db22023-04-05 13:22:26 +08001289diff --git a/mt7915/testmode.c b/mt7915/testmode.c
developer23d6e272023-08-28 11:10:51 +08001290index d5c74dfd..38ac79d6 100644
developer6100db22023-04-05 13:22:26 +08001291--- a/mt7915/testmode.c
1292+++ b/mt7915/testmode.c
developer2157bf82023-06-26 02:27:49 +08001293@@ -416,12 +416,12 @@ mt7915_tm_entry_add(struct mt7915_phy *phy, u8 aid)
developer6100db22023-04-05 13:22:26 +08001294 memcpy(sta->addr, td->addr[0], ETH_ALEN);
1295
1296 if (td->tx_rate_mode >= MT76_TM_TX_MODE_HT)
1297- memcpy(&sta->deflink.ht_cap, &sband->ht_cap, sizeof(sta->deflink.ht_cap));
1298+ memcpy(&sta->ht_cap, &sband->ht_cap, sizeof(sta->ht_cap));
1299 if (td->tx_rate_mode >= MT76_TM_TX_MODE_VHT)
1300- memcpy(&sta->deflink.vht_cap, &sband->vht_cap, sizeof(sta->deflink.vht_cap));
1301+ memcpy(&sta->vht_cap, &sband->vht_cap, sizeof(sta->vht_cap));
1302 if (td->tx_rate_mode >= MT76_TM_TX_MODE_HE_SU)
1303- memcpy(&sta->deflink.he_cap, &sdata[NL80211_IFTYPE_STATION].he_cap,
1304- sizeof(sta->deflink.he_cap));
1305+ memcpy(&sta->he_cap, &sdata[NL80211_IFTYPE_STATION].he_cap,
1306+ sizeof(sta->he_cap));
1307 sta->aid = aid;
1308 sta->wme = 1;
1309
1310diff --git a/tx.c b/tx.c
developer849549c2023-08-02 17:26:48 +08001311index 2594a625..26fa6650 100644
developer6100db22023-04-05 13:22:26 +08001312--- a/tx.c
1313+++ b/tx.c
1314@@ -60,20 +60,15 @@ mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list)
1315 .skb = skb,
1316 .info = IEEE80211_SKB_CB(skb),
1317 };
1318- struct ieee80211_rate_status rs = {};
1319 struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb);
1320 struct mt76_wcid *wcid;
1321
1322 wcid = rcu_dereference(dev->wcid[cb->wcid]);
1323 if (wcid) {
1324 status.sta = wcid_to_sta(wcid);
1325- if (status.sta && (wcid->rate.flags || wcid->rate.legacy)) {
1326- rs.rate_idx = wcid->rate;
1327- status.rates = &rs;
1328- status.n_rates = 1;
1329- } else {
1330- status.n_rates = 0;
1331- }
1332+
1333+ if (status.sta)
1334+ status.rate = &wcid->rate;
1335 }
1336
1337 hw = mt76_tx_status_get_hw(dev, skb);
developer2157bf82023-06-26 02:27:49 +08001338@@ -239,6 +234,7 @@ mt76_tx_check_non_aql(struct mt76_dev *dev, struct mt76_wcid *wcid,
developer22eedcc2023-05-03 22:59:35 +08001339 void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *skb,
1340 struct list_head *free_list)
1341 {
1342+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1343 struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb);
1344 struct ieee80211_tx_status status = {
1345 .skb = skb,
developer2157bf82023-06-26 02:27:49 +08001346@@ -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 +08001347 #endif
1348
1349 if (cb->pktid < MT_PACKET_ID_FIRST) {
developer22eedcc2023-05-03 22:59:35 +08001350- struct ieee80211_rate_status rs = {};
1351-
1352 hw = mt76_tx_status_get_hw(dev, skb);
1353 status.sta = wcid_to_sta(wcid);
developer2157bf82023-06-26 02:27:49 +08001354- if (status.sta && (wcid->rate.flags || wcid->rate.legacy)) {
1355- rs.rate_idx = wcid->rate;
1356- status.rates = &rs;
1357- status.n_rates = 1;
1358+ if (status.sta) {
1359+ info->status.rates[0].idx = -1;
1360+ status.rate = &wcid->rate;
developer22eedcc2023-05-03 22:59:35 +08001361 }
developer2157bf82023-06-26 02:27:49 +08001362+
developerbbd45e12023-05-19 08:22:06 +08001363 spin_lock_bh(&dev->rx_lock);
developer2157bf82023-06-26 02:27:49 +08001364 ieee80211_tx_status_ext(hw, &status);
1365 spin_unlock_bh(&dev->rx_lock);
developer6100db22023-04-05 13:22:26 +08001366--
developerd8ca5d32023-08-30 19:05:17 +080013672.39.2
developer6100db22023-04-05 13:22:26 +08001368