1 From ec46d7486ab91786fbfe77edd306911b7c543334 Mon Sep 17 00:00:00 2001
2 From: Felix Fietkau <nbd@nbd.name>
3 Date: Tue, 11 Oct 2022 17:58:31 +0200
4 Subject: [PATCH] sync with upstream
6 Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 debugfs.c | 28 ++++++++
12 mt7603/beacon.c | 2 +-
14 mt7603/mac.c | 16 +++--
20 mt76_connac_mcu.c | 101 ++++++++++++++--------------
22 mt76x02_beacon.c | 2 +-
28 mt7915/debugfs.c | 4 +-
32 mt7915/main.c | 11 +--
33 mt7915/mcu.c | 166 +++++++++++++++++++++++-----------------------
38 mt7921/main.c | 18 ++---
40 mt7921/pci_mac.c | 2 +-
43 35 files changed, 250 insertions(+), 204 deletions(-)
45 diff --git a/debugfs.c b/debugfs.c
46 index b7aa8727ad1e..11b8153544a0 100644
49 @@ -25,6 +25,32 @@ mt76_reg_get(void *data, u64 *val)
50 DEFINE_DEBUGFS_ATTRIBUTE(fops_regval, mt76_reg_get, mt76_reg_set,
54 +mt76_napi_threaded_set(void *data, u64 val)
56 + struct mt76_dev *dev = data;
58 + if (!mt76_is_mmio(dev))
61 + if (dev->napi_dev.threaded != val)
62 + return dev_set_threaded(&dev->napi_dev, val);
68 +mt76_napi_threaded_get(void *data, u64 *val)
70 + struct mt76_dev *dev = data;
72 + *val = dev->napi_dev.threaded;
76 +DEFINE_DEBUGFS_ATTRIBUTE(fops_napi_threaded, mt76_napi_threaded_get,
77 + mt76_napi_threaded_set, "%llu\n");
79 int mt76_queues_read(struct seq_file *s, void *data)
81 struct mt76_dev *dev = dev_get_drvdata(s->private);
82 @@ -90,6 +116,8 @@ mt76_register_debugfs_fops(struct mt76_phy *phy,
83 debugfs_create_bool("led_active_low", 0600, dir, &dev->led_al);
84 debugfs_create_u32("regidx", 0600, dir, &dev->debugfs_reg);
85 debugfs_create_file_unsafe("regval", 0600, dir, dev, fops);
86 + debugfs_create_file_unsafe("napi_threaded", 0600, dir, dev,
87 + &fops_napi_threaded);
88 debugfs_create_blob("eeprom", 0400, dir, &dev->eeprom);
90 debugfs_create_blob("otp", 0400, dir, &dev->otp);
91 diff --git a/dma.c b/dma.c
92 index ae22b9592ead..8dca8d2447b7 100644
95 @@ -895,7 +895,7 @@ mt76_dma_init(struct mt76_dev *dev,
96 dev->napi_dev.threaded = 1;
98 mt76_for_each_q_rx(dev, i) {
99 - netif_napi_add(&dev->napi_dev, &dev->napi[i], poll, 64);
100 + netif_napi_add(&dev->napi_dev, &dev->napi[i], poll);
101 mt76_dma_rx_fill(dev, &dev->q_rx[i]);
102 napi_enable(&dev->napi[i]);
104 diff --git a/eeprom.c b/eeprom.c
105 index 25f677601034..0a88048b8976 100644
108 @@ -106,7 +106,6 @@ void
109 mt76_eeprom_override(struct mt76_phy *phy)
111 struct mt76_dev *dev = phy->dev;
113 struct device_node *np = dev->dev->of_node;
115 of_get_mac_address(np, phy->macaddr);
116 diff --git a/mac80211.c b/mac80211.c
117 index acac04eff0d6..fc608b369b3c 100644
120 @@ -1482,7 +1482,7 @@ EXPORT_SYMBOL_GPL(mt76_get_sar_power);
122 __mt76_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
124 - if (vif->csa_active && ieee80211_beacon_cntdwn_is_complete(vif))
125 + if (vif->bss_conf.csa_active && ieee80211_beacon_cntdwn_is_complete(vif))
126 ieee80211_csa_finish(vif);
129 @@ -1504,7 +1504,7 @@ __mt76_csa_check(void *priv, u8 *mac, struct ieee80211_vif *vif)
131 struct mt76_dev *dev = priv;
133 - if (!vif->csa_active)
134 + if (!vif->bss_conf.csa_active)
137 dev->csa_complete |= ieee80211_beacon_cntdwn_is_complete(vif);
138 diff --git a/mt7603/beacon.c b/mt7603/beacon.c
139 index 5807cf2cf862..b65b0a88c1de 100644
140 --- a/mt7603/beacon.c
141 +++ b/mt7603/beacon.c
142 @@ -20,7 +20,7 @@ mt7603_update_beacon_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
143 if (!(mdev->beacon_mask & BIT(mvif->idx)))
146 - skb = ieee80211_beacon_get(mt76_hw(dev), vif);
147 + skb = ieee80211_beacon_get(mt76_hw(dev), vif, 0);
151 diff --git a/mt7603/dma.c b/mt7603/dma.c
152 index 06a9e6ecce60..03ba11a61c90 100644
155 @@ -223,8 +223,8 @@ int mt7603_dma_init(struct mt7603_dev *dev)
159 - netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
160 - mt7603_poll_tx, NAPI_POLL_WEIGHT);
161 + netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
163 napi_enable(&dev->mt76.tx_napi);
166 diff --git a/mt7603/mac.c b/mt7603/mac.c
167 index b025e3553006..70a7f84af028 100644
170 @@ -326,19 +326,21 @@ void mt7603_wtbl_update_cap(struct mt7603_dev *dev, struct ieee80211_sta *sta)
172 addr = mt7603_wtbl1_addr(idx);
174 - ampdu_density = sta->ht_cap.ampdu_density;
175 + ampdu_density = sta->deflink.ht_cap.ampdu_density;
176 if (ampdu_density < IEEE80211_HT_MPDU_DENSITY_4)
177 ampdu_density = IEEE80211_HT_MPDU_DENSITY_4;
179 val = mt76_rr(dev, addr + 2 * 4);
180 val &= MT_WTBL1_W2_KEY_TYPE | MT_WTBL1_W2_ADMISSION_CONTROL;
181 - val |= FIELD_PREP(MT_WTBL1_W2_AMPDU_FACTOR, sta->ht_cap.ampdu_factor) |
182 - FIELD_PREP(MT_WTBL1_W2_MPDU_DENSITY, sta->ht_cap.ampdu_density) |
183 + val |= FIELD_PREP(MT_WTBL1_W2_AMPDU_FACTOR,
184 + sta->deflink.ht_cap.ampdu_factor) |
185 + FIELD_PREP(MT_WTBL1_W2_MPDU_DENSITY,
186 + sta->deflink.ht_cap.ampdu_density) |
187 MT_WTBL1_W2_TXS_BAF_REPORT;
189 - if (sta->ht_cap.cap)
190 + if (sta->deflink.ht_cap.cap)
191 val |= MT_WTBL1_W2_HT;
192 - if (sta->vht_cap.cap)
193 + if (sta->deflink.vht_cap.cap)
194 val |= MT_WTBL1_W2_VHT;
196 mt76_wr(dev, addr + 2 * 4, val);
197 @@ -347,9 +349,9 @@ void mt7603_wtbl_update_cap(struct mt7603_dev *dev, struct ieee80211_sta *sta)
198 val = mt76_rr(dev, addr + 9 * 4);
199 val &= ~(MT_WTBL2_W9_SHORT_GI_20 | MT_WTBL2_W9_SHORT_GI_40 |
200 MT_WTBL2_W9_SHORT_GI_80);
201 - if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
202 + if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
203 val |= MT_WTBL2_W9_SHORT_GI_20;
204 - if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
205 + if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
206 val |= MT_WTBL2_W9_SHORT_GI_40;
207 mt76_wr(dev, addr + 9 * 4, val);
209 diff --git a/mt7603/main.c b/mt7603/main.c
210 index 91425b454cae..ca50feb0b3a9 100644
213 @@ -297,7 +297,7 @@ mt7603_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
216 mt7603_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
217 - struct ieee80211_bss_conf *info, u32 changed)
218 + struct ieee80211_bss_conf *info, u64 changed)
220 struct mt7603_dev *dev = hw->priv;
221 struct mt7603_vif *mvif = (struct mt7603_vif *)vif->drv_priv;
222 @@ -305,7 +305,7 @@ mt7603_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
223 mutex_lock(&dev->mt76.mutex);
225 if (changed & (BSS_CHANGED_ASSOC | BSS_CHANGED_BSSID)) {
226 - if (info->assoc || info->ibss_joined) {
227 + if (vif->cfg.assoc || vif->cfg.ibss_joined) {
228 mt76_wr(dev, MT_BSSID0(mvif->idx),
229 get_unaligned_le32(info->bssid));
230 mt76_wr(dev, MT_BSSID1(mvif->idx),
231 @@ -527,7 +527,8 @@ mt7603_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
235 -mt7603_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue,
236 +mt7603_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
237 + unsigned int link_id, u16 queue,
238 const struct ieee80211_tx_queue_params *params)
240 struct mt7603_dev *dev = hw->priv;
241 @@ -657,7 +658,7 @@ mt7603_sta_rate_tbl_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
242 mt7603_wtbl_set_rates(dev, msta, NULL, msta->rates);
243 msta->rate_probe = false;
244 mt7603_wtbl_set_smps(dev, msta,
245 - sta->smps_mode == IEEE80211_SMPS_DYNAMIC);
246 + sta->deflink.smps_mode == IEEE80211_SMPS_DYNAMIC);
247 spin_unlock_bh(&dev->mt76.lock);
250 diff --git a/mt7615/dma.c b/mt7615/dma.c
251 index ec729dbe1cd8..f1914431ff7f 100644
254 @@ -281,8 +281,8 @@ int mt7615_dma_init(struct mt7615_dev *dev)
258 - netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
259 - mt7615_poll_tx, NAPI_POLL_WEIGHT);
260 + netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
262 napi_enable(&dev->mt76.tx_napi);
264 mt76_poll(dev, MT_WPDMA_GLO_CFG,
265 diff --git a/mt7615/main.c b/mt7615/main.c
266 index 0d80003c6f17..ab4c1b4478aa 100644
269 @@ -473,7 +473,8 @@ static int mt7615_config(struct ieee80211_hw *hw, u32 changed)
273 -mt7615_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue,
274 +mt7615_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
275 + unsigned int link_id, u16 queue,
276 const struct ieee80211_tx_queue_params *params)
278 struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
279 @@ -555,7 +556,7 @@ static void mt7615_configure_filter(struct ieee80211_hw *hw,
280 static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
281 struct ieee80211_vif *vif,
282 struct ieee80211_bss_conf *info,
286 struct mt7615_dev *dev = mt7615_hw_dev(hw);
287 struct mt7615_phy *phy = mt7615_hw_phy(hw);
288 @@ -598,7 +599,7 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
291 if (changed & BSS_CHANGED_ASSOC)
292 - mt7615_mac_set_beacon_filter(phy, vif, info->assoc);
293 + mt7615_mac_set_beacon_filter(phy, vif, vif->cfg.assoc);
295 mt7615_mutex_release(dev);
297 diff --git a/mt7615/mcu.c b/mt7615/mcu.c
298 index 81579a1422d4..83f30305414d 100644
301 @@ -352,7 +352,7 @@ out:
303 mt7615_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
305 - if (vif->csa_active)
306 + if (vif->bss_conf.csa_active)
307 ieee80211_csa_finish(vif);
310 @@ -698,7 +698,7 @@ mt7615_mcu_add_beacon_offload(struct mt7615_dev *dev,
314 - skb = ieee80211_beacon_get_template(hw, vif, &offs);
315 + skb = ieee80211_beacon_get_template(hw, vif, &offs, 0);
319 @@ -1073,7 +1073,7 @@ mt7615_mcu_uni_add_beacon_offload(struct mt7615_dev *dev,
323 - skb = ieee80211_beacon_get_template(mt76_hw(dev), vif, &offs);
324 + skb = ieee80211_beacon_get_template(mt76_hw(dev), vif, &offs, 0);
328 @@ -2525,7 +2525,7 @@ int mt7615_mcu_set_bss_pm(struct mt7615_dev *dev, struct ieee80211_vif *vif,
331 .bss_idx = mvif->mt76.idx,
332 - .aid = cpu_to_le16(vif->bss_conf.aid),
333 + .aid = cpu_to_le16(vif->cfg.aid),
334 .dtim_period = vif->bss_conf.dtim_period,
335 .bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int),
337 diff --git a/mt7615/soc.c b/mt7615/soc.c
338 index be9a69fe1b38..f13d1b418742 100644
341 @@ -31,7 +31,6 @@ int mt7622_wmac_init(struct mt7615_dev *dev)
343 static int mt7622_wmac_probe(struct platform_device *pdev)
345 - struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
346 void __iomem *mem_base;
349 @@ -39,7 +38,7 @@ static int mt7622_wmac_probe(struct platform_device *pdev)
353 - mem_base = devm_ioremap_resource(&pdev->dev, res);
354 + mem_base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
355 if (IS_ERR(mem_base))
356 return PTR_ERR(mem_base);
358 diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
359 index 673fca296b89..83c59d2de692 100644
360 --- a/mt76_connac_mcu.c
361 +++ b/mt76_connac_mcu.c
362 @@ -196,7 +196,7 @@ int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif)
365 .bss_idx = mvif->idx,
366 - .ps_state = vif->bss_conf.ps ? 2 : 0,
367 + .ps_state = vif->cfg.ps ? 2 : 0,
370 if (vif->type != NL80211_IFTYPE_STATION)
371 @@ -407,7 +407,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct sk_buff *skb,
373 conn_type = CONNECTION_INFRA_AP;
374 basic->conn_type = cpu_to_le32(conn_type);
375 - basic->aid = cpu_to_le16(vif->bss_conf.aid);
376 + basic->aid = cpu_to_le16(vif->cfg.aid);
378 case NL80211_IFTYPE_ADHOC:
379 basic->conn_type = cpu_to_le32(CONNECTION_IBSS_ADHOC);
380 @@ -551,7 +551,7 @@ void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev,
383 if (vif->type == NL80211_IFTYPE_STATION)
384 - generic->partial_aid = cpu_to_le16(vif->bss_conf.aid);
385 + generic->partial_aid = cpu_to_le16(vif->cfg.aid);
387 generic->partial_aid = cpu_to_le16(sta->aid);
388 memcpy(generic->peer_addr, sta->addr, ETH_ALEN);
389 @@ -597,14 +597,14 @@ mt76_connac_mcu_sta_amsdu_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
390 vif->type != NL80211_IFTYPE_STATION)
393 - if (!sta->max_amsdu_len)
394 + if (!sta->deflink.agg.max_amsdu_len)
397 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu));
398 amsdu = (struct sta_rec_amsdu *)tlv;
399 amsdu->max_amsdu_num = 8;
400 amsdu->amsdu_en = true;
401 - amsdu->max_mpdu_size = sta->max_amsdu_len >=
402 + amsdu->max_mpdu_size = sta->deflink.agg.max_amsdu_len >=
403 IEEE80211_MAX_MPDU_LEN_VHT_7991;
406 @@ -615,7 +615,7 @@ mt76_connac_mcu_sta_amsdu_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
408 mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
410 - struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
411 + struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap;
412 struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem;
413 struct sta_rec_he *he;
415 @@ -703,7 +703,7 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
417 he->he_cap = cpu_to_le32(cap);
419 - switch (sta->bandwidth) {
420 + switch (sta->deflink.bandwidth) {
421 case IEEE80211_STA_RX_BW_160:
422 if (elem->phy_cap_info[0] &
423 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
424 @@ -755,9 +755,9 @@ mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif,
428 - ht_cap = &sta->ht_cap;
429 - vht_cap = &sta->vht_cap;
430 - he_cap = &sta->he_cap;
431 + ht_cap = &sta->deflink.ht_cap;
432 + vht_cap = &sta->deflink.vht_cap;
433 + he_cap = &sta->deflink.he_cap;
435 struct ieee80211_supported_band *sband;
437 @@ -806,25 +806,25 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
441 - if (sta->ht_cap.ht_supported) {
442 + if (sta->deflink.ht_cap.ht_supported) {
443 struct sta_rec_ht *ht;
445 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht));
446 ht = (struct sta_rec_ht *)tlv;
447 - ht->ht_cap = cpu_to_le16(sta->ht_cap.cap);
448 + ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap);
452 - if (sta->vht_cap.vht_supported) {
453 + if (sta->deflink.vht_cap.vht_supported) {
454 struct sta_rec_vht *vht;
457 len = is_mt7921(dev) ? sizeof(*vht) : sizeof(*vht) - 4;
458 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, len);
459 vht = (struct sta_rec_vht *)tlv;
460 - vht->vht_cap = cpu_to_le32(sta->vht_cap.cap);
461 - vht->vht_rx_mcs_map = sta->vht_cap.vht_mcs.rx_mcs_map;
462 - vht->vht_tx_mcs_map = sta->vht_cap.vht_mcs.tx_mcs_map;
463 + vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap);
464 + vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map;
465 + vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map;
469 @@ -833,11 +833,11 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
473 - if (sta->ht_cap.ht_supported || sta->he_cap.has_he)
474 + if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he)
475 mt76_connac_mcu_sta_amsdu_tlv(skb, sta, vif);
478 - if (sta->he_cap.has_he) {
479 + if (sta->deflink.he_cap.has_he) {
480 mt76_connac_mcu_sta_he_tlv(skb, sta);
481 if (band == NL80211_BAND_6GHZ &&
482 sta_state == MT76_STA_INFO_STATE_ASSOC) {
483 @@ -846,7 +846,7 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
484 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE_6G,
485 sizeof(*he_6g_capa));
486 he_6g_capa = (struct sta_rec_he_6g_capa *)tlv;
487 - he_6g_capa->capa = sta->he_6ghz_capa.capa;
488 + he_6g_capa->capa = sta->deflink.he_6ghz_capa.capa;
492 @@ -856,14 +856,14 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
493 phy->basic_rate = cpu_to_le16((u16)vif->bss_conf.basic_rates);
495 phy->ampdu = FIELD_PREP(IEEE80211_HT_AMPDU_PARM_FACTOR,
496 - sta->ht_cap.ampdu_factor) |
497 + sta->deflink.ht_cap.ampdu_factor) |
498 FIELD_PREP(IEEE80211_HT_AMPDU_PARM_DENSITY,
499 - sta->ht_cap.ampdu_density);
500 + sta->deflink.ht_cap.ampdu_density);
502 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra_info));
503 ra_info = (struct sta_rec_ra_info *)tlv;
505 - supp_rates = sta->supp_rates[band];
506 + supp_rates = sta->deflink.supp_rates[band];
507 if (band == NL80211_BAND_2GHZ)
508 supp_rates = FIELD_PREP(RA_LEGACY_OFDM, supp_rates >> 4) |
509 FIELD_PREP(RA_LEGACY_CCK, supp_rates & 0xf);
510 @@ -872,17 +872,18 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
512 ra_info->legacy = cpu_to_le16(supp_rates);
514 - if (sta->ht_cap.ht_supported)
515 - memcpy(ra_info->rx_mcs_bitmask, sta->ht_cap.mcs.rx_mask,
516 + if (sta->deflink.ht_cap.ht_supported)
517 + memcpy(ra_info->rx_mcs_bitmask,
518 + sta->deflink.ht_cap.mcs.rx_mask,
521 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_STATE, sizeof(*state));
522 state = (struct sta_rec_state *)tlv;
523 state->state = sta_state;
525 - if (sta->vht_cap.vht_supported) {
526 - state->vht_opmode = sta->bandwidth;
527 - state->vht_opmode |= (sta->rx_nss - 1) <<
528 + if (sta->deflink.vht_cap.vht_supported) {
529 + state->vht_opmode = sta->deflink.bandwidth;
530 + state->vht_opmode |= (sta->deflink.rx_nss - 1) <<
531 IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT;
534 @@ -898,7 +899,7 @@ void mt76_connac_mcu_wtbl_smps_tlv(struct sk_buff *skb,
535 tlv = mt76_connac_mcu_add_nested_tlv(skb, WTBL_SMPS, sizeof(*smps),
537 smps = (struct wtbl_smps *)tlv;
538 - smps->smps = (sta->smps_mode == IEEE80211_SMPS_DYNAMIC);
539 + smps->smps = (sta->deflink.smps_mode == IEEE80211_SMPS_DYNAMIC);
541 EXPORT_SYMBOL_GPL(mt76_connac_mcu_wtbl_smps_tlv);
543 @@ -910,27 +911,27 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
547 - if (sta->ht_cap.ht_supported || sta->he_6ghz_capa.capa) {
548 + if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_6ghz_capa.capa) {
549 tlv = mt76_connac_mcu_add_nested_tlv(skb, WTBL_HT, sizeof(*ht),
551 ht = (struct wtbl_ht *)tlv;
552 ht->ldpc = ht_ldpc &&
553 - !!(sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING);
554 + !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING);
556 - if (sta->ht_cap.ht_supported) {
557 - ht->af = sta->ht_cap.ampdu_factor;
558 - ht->mm = sta->ht_cap.ampdu_density;
559 + if (sta->deflink.ht_cap.ht_supported) {
560 + ht->af = sta->deflink.ht_cap.ampdu_factor;
561 + ht->mm = sta->deflink.ht_cap.ampdu_density;
563 - ht->af = le16_get_bits(sta->he_6ghz_capa.capa,
564 + ht->af = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
565 IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP);
566 - ht->mm = le16_get_bits(sta->he_6ghz_capa.capa,
567 + ht->mm = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
568 IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START);
574 - if (sta->vht_cap.vht_supported || sta->he_6ghz_capa.capa) {
575 + if (sta->deflink.vht_cap.vht_supported || sta->deflink.he_6ghz_capa.capa) {
576 struct wtbl_vht *vht;
579 @@ -939,18 +940,18 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
581 vht = (struct wtbl_vht *)tlv;
582 vht->ldpc = vht_ldpc &&
583 - !!(sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC);
584 + !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC);
587 af = FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK,
589 + sta->deflink.vht_cap.cap);
591 ht->af = max(ht->af, af);
594 mt76_connac_mcu_wtbl_smps_tlv(skb, sta, sta_wtbl, wtbl_tlv);
596 - if (is_connac_v1(dev) && sta->ht_cap.ht_supported) {
597 + if (is_connac_v1(dev) && sta->deflink.ht_cap.ht_supported) {
599 u32 msk = MT_WTBL_W5_SHORT_GI_20 | MT_WTBL_W5_SHORT_GI_40 |
600 MT_WTBL_W5_SHORT_GI_80 | MT_WTBL_W5_SHORT_GI_160;
601 @@ -960,15 +961,15 @@ void mt76_connac_mcu_wtbl_ht_tlv(struct mt76_dev *dev, struct sk_buff *skb,
602 sizeof(*raw), wtbl_tlv,
605 - if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
606 + if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
607 flags |= MT_WTBL_W5_SHORT_GI_20;
608 - if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
609 + if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
610 flags |= MT_WTBL_W5_SHORT_GI_40;
612 - if (sta->vht_cap.vht_supported) {
613 - if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
614 + if (sta->deflink.vht_cap.vht_supported) {
615 + if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
616 flags |= MT_WTBL_W5_SHORT_GI_80;
617 - if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
618 + if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
619 flags |= MT_WTBL_W5_SHORT_GI_160;
621 raw = (struct wtbl_raw *)tlv;
622 @@ -1254,9 +1255,9 @@ u8 mt76_connac_get_phy_mode(struct mt76_phy *phy, struct ieee80211_vif *vif,
626 - ht_cap = &sta->ht_cap;
627 - vht_cap = &sta->vht_cap;
628 - he_cap = &sta->he_cap;
629 + ht_cap = &sta->deflink.ht_cap;
630 + vht_cap = &sta->deflink.vht_cap;
631 + he_cap = &sta->deflink.he_cap;
633 struct ieee80211_supported_band *sband;
635 @@ -2196,8 +2197,10 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev,
636 struct mt76_vif *vif,
637 struct ieee80211_bss_conf *info)
639 + struct ieee80211_vif *mvif = container_of(info, struct ieee80211_vif,
642 - int i, len = min_t(int, info->arp_addr_cnt,
643 + int i, len = min_t(int, mvif->cfg.arp_addr_cnt,
644 IEEE80211_BSS_ARP_ADDR_LIST_LEN);
647 @@ -2225,7 +2228,7 @@ int mt76_connac_mcu_update_arp_filter(struct mt76_dev *dev,
649 skb_put_data(skb, &req_hdr, sizeof(req_hdr));
650 for (i = 0; i < len; i++)
651 - skb_put_data(skb, &info->arp_addr_list[i], sizeof(__be32));
652 + skb_put_data(skb, &mvif->cfg.arp_addr_list[i], sizeof(__be32));
654 return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD(OFFLOAD), true);
656 diff --git a/mt76x02.h b/mt76x02.h
657 index 3f2a9b7fa070..4cd63bacd742 100644
660 @@ -170,7 +170,8 @@ int mt76x02_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
661 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
662 struct ieee80211_key_conf *key);
663 int mt76x02_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
664 - u16 queue, const struct ieee80211_tx_queue_params *params);
665 + unsigned int link_id, u16 queue,
666 + const struct ieee80211_tx_queue_params *params);
667 void mt76x02_sta_rate_tbl_update(struct ieee80211_hw *hw,
668 struct ieee80211_vif *vif,
669 struct ieee80211_sta *sta);
670 @@ -201,7 +202,7 @@ void mt76x02_sw_scan_complete(struct ieee80211_hw *hw,
671 void mt76x02_sta_ps(struct mt76_dev *dev, struct ieee80211_sta *sta, bool ps);
672 void mt76x02_bss_info_changed(struct ieee80211_hw *hw,
673 struct ieee80211_vif *vif,
674 - struct ieee80211_bss_conf *info, u32 changed);
675 + struct ieee80211_bss_conf *info, u64 changed);
676 void mt76x02_reconfig_complete(struct ieee80211_hw *hw,
677 enum ieee80211_reconfig_type reconfig_type);
679 diff --git a/mt76x02_beacon.c b/mt76x02_beacon.c
680 index 67844e2ed3f8..ad4dc8e17b58 100644
681 --- a/mt76x02_beacon.c
682 +++ b/mt76x02_beacon.c
683 @@ -143,7 +143,7 @@ mt76x02_update_beacon_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
684 if (!(dev->mt76.beacon_mask & BIT(mvif->idx)))
687 - skb = ieee80211_beacon_get(mt76_hw(dev), vif);
688 + skb = ieee80211_beacon_get(mt76_hw(dev), vif, 0);
692 diff --git a/mt76x02_mac.c b/mt76x02_mac.c
693 index 87ea3db140d9..d3f74473e6fb 100644
696 @@ -404,7 +404,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
697 txwi->rate |= cpu_to_le16(MT_RXWI_RATE_LDPC);
698 if ((info->flags & IEEE80211_TX_CTL_STBC) && nss == 1)
699 txwi->rate |= cpu_to_le16(MT_RXWI_RATE_STBC);
700 - if (nss > 1 && sta && sta->smps_mode == IEEE80211_SMPS_DYNAMIC)
701 + if (nss > 1 && sta && sta->deflink.smps_mode == IEEE80211_SMPS_DYNAMIC)
702 txwi_flags |= MT_TXWI_FLAGS_MMPS;
703 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
704 txwi->ack_ctl |= MT_TXWI_ACK_CTL_REQ;
705 @@ -412,9 +412,9 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
706 txwi->ack_ctl |= MT_TXWI_ACK_CTL_NSEQ;
707 if ((info->flags & IEEE80211_TX_CTL_AMPDU) && sta) {
708 u8 ba_size = IEEE80211_MIN_AMPDU_BUF;
709 - u8 ampdu_density = sta->ht_cap.ampdu_density;
710 + u8 ampdu_density = sta->deflink.ht_cap.ampdu_density;
712 - ba_size <<= sta->ht_cap.ampdu_factor;
713 + ba_size <<= sta->deflink.ht_cap.ampdu_factor;
714 ba_size = min_t(int, 63, ba_size - 1);
715 if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
717 diff --git a/mt76x02_mmio.c b/mt76x02_mmio.c
718 index 648f4ab9d684..e9c5e85ec07c 100644
721 @@ -231,8 +231,8 @@ int mt76x02_dma_init(struct mt76x02_dev *dev)
725 - netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
726 - mt76x02_poll_tx, NAPI_POLL_WEIGHT);
727 + netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
729 napi_enable(&dev->mt76.tx_napi);
732 diff --git a/mt76x02_util.c b/mt76x02_util.c
733 index 5bd0a0bae688..604ddcc21123 100644
736 @@ -487,7 +487,8 @@ int mt76x02_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
737 EXPORT_SYMBOL_GPL(mt76x02_set_key);
739 int mt76x02_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
740 - u16 queue, const struct ieee80211_tx_queue_params *params)
741 + unsigned int link_id, u16 queue,
742 + const struct ieee80211_tx_queue_params *params)
744 struct mt76x02_dev *dev = hw->priv;
745 u8 cw_min = 5, cw_max = 10, qid;
746 @@ -636,7 +637,7 @@ EXPORT_SYMBOL_GPL(mt76x02_sta_ps);
747 void mt76x02_bss_info_changed(struct ieee80211_hw *hw,
748 struct ieee80211_vif *vif,
749 struct ieee80211_bss_conf *info,
753 struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
754 struct mt76x02_dev *dev = hw->priv;
755 diff --git a/mt76x2/pci.c b/mt76x2/pci.c
756 index 8a22ee581674..df85ebc6e1df 100644
759 @@ -80,7 +80,7 @@ mt76x2e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
760 mt76_rmw_field(dev, 0x15a10, 0x1f << 16, 0x9);
762 /* RG_SSUSB_G1_CDR_BIC_LTR = 0xf */
763 - mt76_rmw_field(dev, 0x15a0c, 0xf << 28, 0xf);
764 + mt76_rmw_field(dev, 0x15a0c, 0xfU << 28, 0xf);
766 /* RG_SSUSB_CDR_BR_PE1D = 0x3 */
767 mt76_rmw_field(dev, 0x15c58, 0x3 << 6, 0x3);
768 diff --git a/mt7915/Kconfig b/mt7915/Kconfig
769 index 320012543634..d710726d47bf 100644
772 @@ -5,6 +5,7 @@ config MT7915E
773 select WANT_DEV_COREDUMP
778 This adds support for MT7915-based wireless PCIe devices,
779 which support concurrent dual-band operation at both 5GHz
780 diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
781 index e7c61378d1f0..fb46c2c1784f 100644
782 --- a/mt7915/debugfs.c
783 +++ b/mt7915/debugfs.c
784 @@ -1362,8 +1362,8 @@ static ssize_t mt7915_sta_fixed_rate_set(struct file *file,
786 phy.ldpc = (phy.bw || phy.ldpc) * GENMASK(2, 0);
787 for (i = 0; i <= phy.bw; i++) {
788 - phy.sgi |= gi << (i << sta->he_cap.has_he);
789 - phy.he_ltf |= he_ltf << (i << sta->he_cap.has_he);
790 + phy.sgi |= gi << (i << sta->deflink.he_cap.has_he);
791 + phy.he_ltf |= he_ltf << (i << sta->deflink.he_cap.has_he);
793 field = RATE_PARAM_FIXED;
795 diff --git a/mt7915/dma.c b/mt7915/dma.c
796 index 0ca68d4a999a..e3fa064918bf 100644
799 @@ -550,8 +550,8 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
803 - netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
804 - mt7915_poll_tx, NAPI_POLL_WEIGHT);
805 + netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
807 napi_enable(&dev->mt76.tx_napi);
809 mt7915_dma_enable(dev);
810 diff --git a/mt7915/init.c b/mt7915/init.c
811 index dfc3f53b1676..b97eb2cc8e8f 100644
814 @@ -1022,7 +1022,8 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
815 mt7915_gen_ppe_thresh(he_cap->ppe_thres, nss);
817 he_cap_elem->phy_cap_info[9] |=
818 - IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US;
819 + u8_encode_bits(IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US,
820 + IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK);
823 if (band == NL80211_BAND_6GHZ) {
824 diff --git a/mt7915/mac.c b/mt7915/mac.c
825 index b477e9d9fe03..f0d5a3603902 100644
828 @@ -853,7 +853,7 @@ mt7915_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
832 - if (!sta || !(sta->ht_cap.ht_supported || sta->he_cap.has_he))
833 + if (!sta || !(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
836 tid = le32_get_bits(txwi[1], MT_TXD1_TID);
837 diff --git a/mt7915/main.c b/mt7915/main.c
838 index 076688d8e7f0..0511d6a505b0 100644
841 @@ -490,7 +490,8 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
845 -mt7915_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue,
846 +mt7915_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
847 + unsigned int link_id, u16 queue,
848 const struct ieee80211_tx_queue_params *params)
850 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
851 @@ -585,7 +586,7 @@ mt7915_update_bss_color(struct ieee80211_hw *hw,
852 static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
853 struct ieee80211_vif *vif,
854 struct ieee80211_bss_conf *info,
858 struct mt7915_phy *phy = mt7915_hw_phy(hw);
859 struct mt7915_dev *dev = mt7915_hw_dev(hw);
860 @@ -605,7 +606,7 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
863 if (changed & BSS_CHANGED_ASSOC)
864 - mt7915_mcu_add_bss_info(phy, vif, info->assoc);
865 + mt7915_mcu_add_bss_info(phy, vif, vif->cfg.assoc);
867 if (changed & BSS_CHANGED_ERP_CTS_PROT)
868 mt7915_mac_enable_rtscts(dev, vif, info->use_cts_prot);
869 @@ -1145,10 +1146,10 @@ static int mt7915_sta_set_txpwr(struct ieee80211_hw *hw,
871 struct mt7915_phy *phy = mt7915_hw_phy(hw);
872 struct mt7915_dev *dev = mt7915_hw_dev(hw);
873 - s16 txpower = sta->txpwr.power;
874 + s16 txpower = sta->deflink.txpwr.power;
877 - if (sta->txpwr.type == NL80211_TX_POWER_AUTOMATIC)
878 + if (sta->deflink.txpwr.type == NL80211_TX_POWER_AUTOMATIC)
881 mutex_lock(&dev->mt76.mutex);
882 diff --git a/mt7915/mcu.c b/mt7915/mcu.c
883 index b787fa0cd307..d7d84b0f863f 100644
886 @@ -59,7 +59,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
887 struct mt7915_dev *dev = msta->vif->phy->dev;
888 enum nl80211_band band = msta->vif->phy->mt76->chandef.chan->band;
889 const u16 *mask = msta->vif->bitrate_mask.control[band].he_mcs;
890 - int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
891 + int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
893 for (nss = 0; nss < max_nss; nss++) {
895 @@ -99,7 +99,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
897 /* only support 2ss on 160MHz for mt7915 */
898 if (is_mt7915(&dev->mt76) && nss > 1 &&
899 - sta->bandwidth == IEEE80211_STA_RX_BW_160)
900 + sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
904 @@ -112,8 +112,8 @@ mt7915_mcu_set_sta_vht_mcs(struct ieee80211_sta *sta, __le16 *vht_mcs,
906 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
907 struct mt7915_dev *dev = msta->vif->phy->dev;
908 - u16 mcs_map = le16_to_cpu(sta->vht_cap.vht_mcs.rx_mcs_map);
909 - int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
910 + u16 mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map);
911 + int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
914 for (nss = 0; nss < max_nss; nss++, mcs_map >>= 2) {
915 @@ -135,7 +135,7 @@ mt7915_mcu_set_sta_vht_mcs(struct ieee80211_sta *sta, __le16 *vht_mcs,
917 /* only support 2ss on 160MHz for mt7915 */
918 if (is_mt7915(&dev->mt76) && nss > 1 &&
919 - sta->bandwidth == IEEE80211_STA_RX_BW_160)
920 + sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
924 @@ -144,10 +144,10 @@ static void
925 mt7915_mcu_set_sta_ht_mcs(struct ieee80211_sta *sta, u8 *ht_mcs,
928 - int nss, max_nss = sta->rx_nss > 3 ? 4 : sta->rx_nss;
929 + int nss, max_nss = sta->deflink.rx_nss > 3 ? 4 : sta->deflink.rx_nss;
931 for (nss = 0; nss < max_nss; nss++)
932 - ht_mcs[nss] = sta->ht_cap.mcs.rx_mask[nss] & mask[nss];
933 + ht_mcs[nss] = sta->deflink.ht_cap.mcs.rx_mask[nss] & mask[nss];
937 @@ -220,7 +220,7 @@ int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3)
939 mt7915_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
941 - if (vif->csa_active)
942 + if (vif->bss_conf.csa_active)
943 ieee80211_csa_finish(vif);
946 @@ -312,7 +312,7 @@ mt7915_mcu_rx_log_message(struct mt7915_dev *dev, struct sk_buff *skb)
948 mt7915_mcu_cca_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
950 - if (!vif->color_change_active)
951 + if (!vif->bss_conf.color_change_active)
954 ieee80211_color_change_finish(vif);
955 @@ -694,13 +694,13 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
956 struct ieee80211_vif *vif)
958 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
959 - struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem;
960 + struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem;
961 struct ieee80211_he_mcs_nss_supp mcs_map;
962 struct sta_rec_he *he;
966 - if (!sta->he_cap.has_he)
967 + if (!sta->deflink.he_cap.has_he)
970 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE, sizeof(*he));
971 @@ -786,8 +786,8 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
973 he->he_cap = cpu_to_le32(cap);
975 - mcs_map = sta->he_cap.he_mcs_nss_supp;
976 - switch (sta->bandwidth) {
977 + mcs_map = sta->deflink.he_cap.he_mcs_nss_supp;
978 + switch (sta->deflink.bandwidth) {
979 case IEEE80211_STA_RX_BW_160:
980 if (elem->phy_cap_info[0] &
981 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
982 @@ -837,7 +837,7 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
983 struct ieee80211_sta *sta, struct ieee80211_vif *vif)
985 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
986 - struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem;
987 + struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem;
988 struct sta_rec_muru *muru;
991 @@ -856,11 +856,11 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
992 muru->cfg.mimo_ul_en = true;
993 muru->cfg.ofdma_dl_en = true;
995 - if (sta->vht_cap.vht_supported)
996 + if (sta->deflink.vht_cap.vht_supported)
997 muru->mimo_dl.vht_mu_bfee =
998 - !!(sta->vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
999 + !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
1001 - if (!sta->he_cap.has_he)
1002 + if (!sta->deflink.he_cap.has_he)
1005 muru->mimo_dl.partial_bw_dl_mimo =
1006 @@ -894,13 +894,13 @@ mt7915_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
1007 struct sta_rec_ht *ht;
1010 - if (!sta->ht_cap.ht_supported)
1011 + if (!sta->deflink.ht_cap.ht_supported)
1014 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HT, sizeof(*ht));
1016 ht = (struct sta_rec_ht *)tlv;
1017 - ht->ht_cap = cpu_to_le16(sta->ht_cap.cap);
1018 + ht->ht_cap = cpu_to_le16(sta->deflink.ht_cap.cap);
1022 @@ -909,15 +909,15 @@ mt7915_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
1023 struct sta_rec_vht *vht;
1026 - if (!sta->vht_cap.vht_supported)
1027 + if (!sta->deflink.vht_cap.vht_supported)
1030 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, sizeof(*vht));
1032 vht = (struct sta_rec_vht *)tlv;
1033 - vht->vht_cap = cpu_to_le32(sta->vht_cap.cap);
1034 - vht->vht_rx_mcs_map = sta->vht_cap.vht_mcs.rx_mcs_map;
1035 - vht->vht_tx_mcs_map = sta->vht_cap.vht_mcs.tx_mcs_map;
1036 + vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap);
1037 + vht->vht_rx_mcs_map = sta->deflink.vht_cap.vht_mcs.rx_mcs_map;
1038 + vht->vht_tx_mcs_map = sta->deflink.vht_cap.vht_mcs.tx_mcs_map;
1042 @@ -932,7 +932,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
1043 vif->type != NL80211_IFTYPE_AP)
1046 - if (!sta->max_amsdu_len)
1047 + if (!sta->deflink.agg.max_amsdu_len)
1050 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu));
1051 @@ -941,7 +941,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
1052 amsdu->amsdu_en = true;
1053 msta->wcid.amsdu = true;
1055 - switch (sta->max_amsdu_len) {
1056 + switch (sta->deflink.agg.max_amsdu_len) {
1057 case IEEE80211_MAX_MPDU_LEN_VHT_11454:
1058 if (!is_mt7915(&dev->mt76)) {
1059 amsdu->max_mpdu_size =
1060 @@ -1004,8 +1004,8 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
1061 if (!bfee && tx_ant < 2)
1064 - if (sta->he_cap.has_he) {
1065 - struct ieee80211_he_cap_elem *pe = &sta->he_cap.he_cap_elem;
1066 + if (sta->deflink.he_cap.has_he) {
1067 + struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem;
1070 return mvif->cap.he_su_ebfee &&
1071 @@ -1015,8 +1015,8 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
1072 HE_PHY(CAP4_SU_BEAMFORMEE, pe->phy_cap_info[4]);
1075 - if (sta->vht_cap.vht_supported) {
1076 - u32 cap = sta->vht_cap.cap;
1077 + if (sta->deflink.vht_cap.vht_supported) {
1078 + u32 cap = sta->deflink.vht_cap.cap;
1081 return mvif->cap.vht_su_ebfee &&
1082 @@ -1042,7 +1042,7 @@ static void
1083 mt7915_mcu_sta_bfer_ht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
1084 struct sta_rec_bf *bf)
1086 - struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
1087 + struct ieee80211_mcs_info *mcs = &sta->deflink.ht_cap.mcs;
1090 bf->tx_mode = MT_PHY_TYPE_HT;
1091 @@ -1067,7 +1067,7 @@ static void
1092 mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
1093 struct sta_rec_bf *bf, bool explicit)
1095 - struct ieee80211_sta_vht_cap *pc = &sta->vht_cap;
1096 + struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap;
1097 struct ieee80211_sta_vht_cap *vc = &phy->mt76->sband_5g.sband.vht_cap;
1098 u16 mcs_map = le16_to_cpu(pc->vht_mcs.rx_mcs_map);
1099 u8 nss_mcs = mt7915_mcu_get_sta_nss(mcs_map);
1100 @@ -1088,14 +1088,14 @@ mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
1101 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
1102 bf->ibf_ncol = bf->ncol;
1104 - if (sta->bandwidth == IEEE80211_STA_RX_BW_160)
1105 + if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
1109 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
1110 bf->ibf_ncol = nss_mcs;
1112 - if (sta->bandwidth == IEEE80211_STA_RX_BW_160)
1113 + if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
1117 @@ -1104,7 +1104,7 @@ static void
1118 mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
1119 struct mt7915_phy *phy, struct sta_rec_bf *bf)
1121 - struct ieee80211_sta_he_cap *pc = &sta->he_cap;
1122 + struct ieee80211_sta_he_cap *pc = &sta->deflink.he_cap;
1123 struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem;
1124 const struct ieee80211_sta_he_cap *vc =
1125 mt76_connac_get_he_phy_cap(phy->mt76, vif);
1126 @@ -1129,7 +1129,7 @@ mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
1127 bf->ncol = min_t(u8, nss_mcs, bf->nrow);
1128 bf->ibf_ncol = bf->ncol;
1130 - if (sta->bandwidth != IEEE80211_STA_RX_BW_160)
1131 + if (sta->deflink.bandwidth != IEEE80211_STA_RX_BW_160)
1134 /* go over for 160MHz and 80p80 */
1135 @@ -1177,7 +1177,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
1139 - if (!(sta->ht_cap.ht_supported || sta->he_cap.has_he))
1140 + if (!(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
1143 ebf = mt7915_is_ebf_supported(phy, vif, sta, false);
1144 @@ -1191,21 +1191,21 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
1145 * vht: support eBF and iBF
1146 * ht: iBF only, since mac80211 lacks of eBF support
1148 - if (sta->he_cap.has_he && ebf)
1149 + if (sta->deflink.he_cap.has_he && ebf)
1150 mt7915_mcu_sta_bfer_he(sta, vif, phy, bf);
1151 - else if (sta->vht_cap.vht_supported)
1152 + else if (sta->deflink.vht_cap.vht_supported)
1153 mt7915_mcu_sta_bfer_vht(sta, phy, bf, ebf);
1154 - else if (sta->ht_cap.ht_supported)
1155 + else if (sta->deflink.ht_cap.ht_supported)
1156 mt7915_mcu_sta_bfer_ht(sta, phy, bf);
1160 bf->bf_cap = ebf ? ebf : dev->ibf << 1;
1161 - bf->bw = sta->bandwidth;
1162 - bf->ibf_dbw = sta->bandwidth;
1163 + bf->bw = sta->deflink.bandwidth;
1164 + bf->ibf_dbw = sta->deflink.bandwidth;
1165 bf->ibf_nrow = tx_ant;
1167 - if (!ebf && sta->bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol)
1168 + if (!ebf && sta->deflink.bandwidth <= IEEE80211_STA_RX_BW_40 && !bf->ncol)
1169 bf->ibf_timeout = 0x48;
1171 bf->ibf_timeout = 0x18;
1172 @@ -1215,7 +1215,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
1174 bf->mem_20m = matrix[bf->nrow][bf->ncol];
1176 - switch (sta->bandwidth) {
1177 + switch (sta->deflink.bandwidth) {
1178 case IEEE80211_STA_RX_BW_160:
1179 case IEEE80211_STA_RX_BW_80:
1180 bf->mem_total = bf->mem_20m * 2;
1181 @@ -1240,7 +1240,7 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
1185 - if (!(sta->vht_cap.vht_supported || sta->he_cap.has_he))
1186 + if (!(sta->deflink.vht_cap.vht_supported || sta->deflink.he_cap.has_he))
1189 if (!mt7915_is_ebf_supported(phy, vif, sta, true))
1190 @@ -1249,13 +1249,13 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
1191 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_BFEE, sizeof(*bfee));
1192 bfee = (struct sta_rec_bfee *)tlv;
1194 - if (sta->he_cap.has_he) {
1195 - struct ieee80211_he_cap_elem *pe = &sta->he_cap.he_cap_elem;
1196 + if (sta->deflink.he_cap.has_he) {
1197 + struct ieee80211_he_cap_elem *pe = &sta->deflink.he_cap.he_cap_elem;
1199 nrow = HE_PHY(CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK,
1200 pe->phy_cap_info[5]);
1201 - } else if (sta->vht_cap.vht_supported) {
1202 - struct ieee80211_sta_vht_cap *pc = &sta->vht_cap;
1203 + } else if (sta->deflink.vht_cap.vht_supported) {
1204 + struct ieee80211_sta_vht_cap *pc = &sta->deflink.vht_cap;
1206 nrow = FIELD_GET(IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK,
1208 @@ -1311,7 +1311,7 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
1211 case RATE_PARAM_MMPS_UPDATE:
1212 - ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->smps_mode);
1213 + ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->deflink.smps_mode);
1215 case RATE_PARAM_SPE_UPDATE:
1216 ra->spe_idx = *(u8 *)data;
1217 @@ -1386,7 +1386,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
1219 u8 i, gi = mask->control[band]._gi; \
1220 gi = (_he) ? gi : gi == NL80211_TXRATE_FORCE_SGI; \
1221 - for (i = 0; i <= sta->bandwidth; i++) { \
1222 + for (i = 0; i <= sta->deflink.bandwidth; i++) { \
1223 phy.sgi |= gi << (i << (_he)); \
1224 phy.he_ltf |= mask->control[band].he_ltf << (i << (_he));\
1226 @@ -1400,11 +1400,11 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
1230 - if (sta->he_cap.has_he) {
1231 + if (sta->deflink.he_cap.has_he) {
1232 __sta_phy_bitrate_mask_check(he_mcs, he_gi, 0, 1);
1233 - } else if (sta->vht_cap.vht_supported) {
1234 + } else if (sta->deflink.vht_cap.vht_supported) {
1235 __sta_phy_bitrate_mask_check(vht_mcs, gi, 0, 0);
1236 - } else if (sta->ht_cap.ht_supported) {
1237 + } else if (sta->deflink.ht_cap.ht_supported) {
1238 __sta_phy_bitrate_mask_check(ht_mcs, gi, 1, 0);
1240 nrates = hweight32(mask->control[band].legacy);
1241 @@ -1438,7 +1438,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
1242 * actual txrate hardware sends out.
1244 addr = mt7915_mac_wtbl_lmac_addr(dev, msta->wcid.idx, 7);
1245 - if (sta->he_cap.has_he)
1246 + if (sta->deflink.he_cap.has_he)
1247 mt76_rmw_field(dev, addr, GENMASK(31, 24), phy.sgi);
1249 mt76_rmw_field(dev, addr, GENMASK(15, 12), phy.sgi);
1250 @@ -1471,7 +1471,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
1251 enum nl80211_band band = chandef->chan->band;
1252 struct sta_rec_ra *ra;
1254 - u32 supp_rate = sta->supp_rates[band];
1255 + u32 supp_rate = sta->deflink.supp_rates[band];
1256 u32 cap = sta->wme ? STA_CAP_WMM : 0;
1258 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra));
1259 @@ -1481,9 +1481,9 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
1260 ra->auto_rate = true;
1261 ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, sta);
1262 ra->channel = chandef->chan->hw_value;
1263 - ra->bw = sta->bandwidth;
1264 - ra->phy.bw = sta->bandwidth;
1265 - ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->smps_mode);
1266 + ra->bw = sta->deflink.bandwidth;
1267 + ra->phy.bw = sta->deflink.bandwidth;
1268 + ra->mmps_mode = mt7915_mcu_get_mmps_mode(sta->deflink.smps_mode);
1271 supp_rate &= mask->control[band].legacy;
1272 @@ -1503,22 +1503,22 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
1276 - if (sta->ht_cap.ht_supported) {
1277 + if (sta->deflink.ht_cap.ht_supported) {
1278 ra->supp_mode |= MODE_HT;
1279 - ra->af = sta->ht_cap.ampdu_factor;
1280 - ra->ht_gf = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
1281 + ra->af = sta->deflink.ht_cap.ampdu_factor;
1282 + ra->ht_gf = !!(sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
1285 - if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
1286 + if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20)
1287 cap |= STA_CAP_SGI_20;
1288 - if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
1289 + if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
1290 cap |= STA_CAP_SGI_40;
1291 - if (sta->ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)
1292 + if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)
1293 cap |= STA_CAP_TX_STBC;
1294 - if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
1295 + if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
1296 cap |= STA_CAP_RX_STBC;
1297 if (mvif->cap.ht_ldpc &&
1298 - (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING))
1299 + (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING))
1300 cap |= STA_CAP_LDPC;
1302 mt7915_mcu_set_sta_ht_mcs(sta, ra->ht_mcs,
1303 @@ -1526,37 +1526,37 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
1304 ra->supp_ht_mcs = *(__le32 *)ra->ht_mcs;
1307 - if (sta->vht_cap.vht_supported) {
1308 + if (sta->deflink.vht_cap.vht_supported) {
1311 ra->supp_mode |= MODE_VHT;
1312 af = FIELD_GET(IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK,
1313 - sta->vht_cap.cap);
1314 + sta->deflink.vht_cap.cap);
1315 ra->af = max_t(u8, ra->af, af);
1318 - if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
1319 + if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
1320 cap |= STA_CAP_VHT_SGI_80;
1321 - if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
1322 + if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160)
1323 cap |= STA_CAP_VHT_SGI_160;
1324 - if (sta->vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC)
1325 + if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_TXSTBC)
1326 cap |= STA_CAP_VHT_TX_STBC;
1327 - if (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1)
1328 + if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1)
1329 cap |= STA_CAP_VHT_RX_STBC;
1330 if (mvif->cap.vht_ldpc &&
1331 - (sta->vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC))
1332 + (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC))
1333 cap |= STA_CAP_VHT_LDPC;
1335 mt7915_mcu_set_sta_vht_mcs(sta, ra->supp_vht_mcs,
1336 mask->control[band].vht_mcs);
1339 - if (sta->he_cap.has_he) {
1340 + if (sta->deflink.he_cap.has_he) {
1341 ra->supp_mode |= MODE_HE;
1344 - if (sta->he_6ghz_capa.capa)
1345 - ra->af = le16_get_bits(sta->he_6ghz_capa.capa,
1346 + if (sta->deflink.he_6ghz_capa.capa)
1347 + ra->af = le16_get_bits(sta->deflink.he_6ghz_capa.capa,
1348 IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP);
1351 @@ -1765,7 +1765,7 @@ mt7915_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,
1352 if (!offs->cntdwn_counter_offs[0])
1355 - sub_tag = vif->csa_active ? BSS_INFO_BCN_CSA : BSS_INFO_BCN_BCC;
1356 + sub_tag = vif->bss_conf.csa_active ? BSS_INFO_BCN_CSA : BSS_INFO_BCN_BCC;
1357 tlv = mt7915_mcu_add_nested_subtlv(rskb, sub_tag, sizeof(*info),
1358 &bcn->sub_ntlv, &bcn->len);
1359 info = (struct bss_info_bcn_cntdwn *)tlv;
1360 @@ -1850,9 +1850,9 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,
1361 if (offs->cntdwn_counter_offs[0]) {
1362 u16 offset = offs->cntdwn_counter_offs[0];
1364 - if (vif->csa_active)
1365 + if (vif->bss_conf.csa_active)
1366 cont->csa_ofs = cpu_to_le16(offset - 4);
1367 - if (vif->color_change_active)
1368 + if (vif->bss_conf.color_change_active)
1369 cont->bcc_ofs = cpu_to_le16(offset - 3);
1372 @@ -2037,7 +2037,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1376 - skb = ieee80211_beacon_get_template(hw, vif, &offs);
1377 + skb = ieee80211_beacon_get_template(hw, vif, &offs, 0);
1381 @@ -3162,17 +3162,17 @@ int mt7915_mcu_set_txpower_frame(struct mt7915_phy *phy,
1385 - if (sta->ht_cap.ht_supported) {
1386 + if (sta->deflink.ht_cap.ht_supported) {
1387 const u8 *sku_len = mt7915_sku_group_len;
1389 offs = sku_len[SKU_CCK] + sku_len[SKU_OFDM];
1390 len = sku_len[SKU_HT_BW20] + sku_len[SKU_HT_BW40];
1392 - if (sta->vht_cap.vht_supported) {
1393 + if (sta->deflink.vht_cap.vht_supported) {
1395 len = sku_len[SKU_VHT_BW20] * 4;
1397 - if (sta->he_cap.has_he) {
1398 + if (sta->deflink.he_cap.has_he) {
1399 offs += len + sku_len[SKU_HE_RU26] * 3;
1400 len = sku_len[SKU_HE_RU242] * 4;
1402 diff --git a/mt7915/soc.c b/mt7915/soc.c
1403 index 8b398d577369..c06c56a0270d 100644
1407 #include <linux/kernel.h>
1408 #include <linux/module.h>
1409 #include <linux/platform_device.h>
1410 +#include <linux/pinctrl/consumer.h>
1411 #include <linux/of.h>
1412 #include <linux/of_device.h>
1413 #include <linux/of_reserved_mem.h>
1414 diff --git a/mt7921/dma.c b/mt7921/dma.c
1415 index 6456c9a6175a..d1f10f6d9adc 100644
1418 @@ -283,8 +283,8 @@ int mt7921_dma_init(struct mt7921_dev *dev)
1422 - netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
1423 - mt7921_poll_tx, NAPI_POLL_WEIGHT);
1424 + netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
1426 napi_enable(&dev->mt76.tx_napi);
1428 return mt7921_dma_enable(dev);
1429 diff --git a/mt7921/init.c b/mt7921/init.c
1430 index e42cb6be4055..0d8db2bd6a25 100644
1433 @@ -55,8 +55,8 @@ mt7921_init_wiphy(struct ieee80211_hw *hw)
1434 struct wiphy *wiphy = hw->wiphy;
1437 - hw->max_rx_aggregation_subframes = 256;
1438 - hw->max_tx_aggregation_subframes = 256;
1439 + hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
1440 + hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
1441 hw->netdev_features = NETIF_F_RXCSUM;
1443 hw->radiotap_timestamp.units_pos =
1444 diff --git a/mt7921/mac.c b/mt7921/mac.c
1445 index 639614b04c5f..2d2b53d6cd47 100644
1448 @@ -504,7 +504,7 @@ static void mt7921_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
1452 - if (!sta || !(sta->ht_cap.ht_supported || sta->he_cap.has_he))
1453 + if (!sta || !(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
1456 tid = le32_get_bits(txwi[1], MT_TXD1_TID);
1457 diff --git a/mt7921/main.c b/mt7921/main.c
1458 index 1b7219e37d19..3e42dcaa4391 100644
1461 @@ -171,7 +171,8 @@ mt7921_init_he_caps(struct mt7921_phy *phy, enum nl80211_band band,
1462 mt7921_gen_ppe_thresh(he_cap->ppe_thres, nss);
1464 he_cap_elem->phy_cap_info[9] |=
1465 - IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US;
1466 + u8_encode_bits(IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US,
1467 + IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK);
1470 if (band == NL80211_BAND_6GHZ) {
1471 @@ -690,7 +691,8 @@ out:
1475 -mt7921_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue,
1476 +mt7921_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1477 + unsigned int link_id, u16 queue,
1478 const struct ieee80211_tx_queue_params *params)
1480 struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
1481 @@ -760,7 +762,7 @@ static void mt7921_configure_filter(struct ieee80211_hw *hw,
1482 static void mt7921_bss_info_changed(struct ieee80211_hw *hw,
1483 struct ieee80211_vif *vif,
1484 struct ieee80211_bss_conf *info,
1488 struct mt7921_phy *phy = mt7921_hw_phy(hw);
1489 struct mt7921_dev *dev = mt7921_hw_dev(hw);
1490 @@ -791,7 +793,7 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw,
1491 if (changed & BSS_CHANGED_ASSOC) {
1492 mt7921_mcu_sta_update(dev, NULL, vif, true,
1493 MT76_STA_INFO_STATE_ASSOC);
1494 - mt7921_mcu_set_beacon_filter(dev, vif, info->assoc);
1495 + mt7921_mcu_set_beacon_filter(dev, vif, vif->cfg.assoc);
1498 if (changed & BSS_CHANGED_ARP_FILTER) {
1499 @@ -1638,8 +1640,8 @@ mt7921_channel_switch_beacon(struct ieee80211_hw *hw,
1503 -mt7921_start_ap(struct ieee80211_hw *hw,
1504 - struct ieee80211_vif *vif)
1505 +mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1506 + struct ieee80211_bss_conf *link_conf)
1508 struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
1509 struct mt7921_phy *phy = mt7921_hw_phy(hw);
1510 @@ -1666,8 +1668,8 @@ out:
1514 -mt7921_stop_ap(struct ieee80211_hw *hw,
1515 - struct ieee80211_vif *vif)
1516 +mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1517 + struct ieee80211_bss_conf *link_conf)
1519 struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
1520 struct mt7921_phy *phy = mt7921_hw_phy(hw);
1521 diff --git a/mt7921/mcu.c b/mt7921/mcu.c
1522 index b7ed744fa396..fb9c0f66cb27 100644
1525 @@ -862,7 +862,7 @@ int mt7921_mcu_uni_bss_ps(struct mt7921_dev *dev, struct ieee80211_vif *vif)
1527 .tag = cpu_to_le16(UNI_BSS_INFO_PS),
1528 .len = cpu_to_le16(sizeof(struct ps_tlv)),
1529 - .ps_state = vif->bss_conf.ps ? 2 : 0,
1530 + .ps_state = vif->cfg.ps ? 2 : 0,
1534 @@ -926,7 +926,7 @@ mt7921_mcu_set_bss_pm(struct mt7921_dev *dev, struct ieee80211_vif *vif,
1537 .bss_idx = mvif->mt76.idx,
1538 - .aid = cpu_to_le16(vif->bss_conf.aid),
1539 + .aid = cpu_to_le16(vif->cfg.aid),
1540 .dtim_period = vif->bss_conf.dtim_period,
1541 .bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int),
1543 @@ -1143,7 +1143,7 @@ mt7921_mcu_uni_add_beacon_offload(struct mt7921_dev *dev,
1547 - skb = ieee80211_beacon_get_template(mt76_hw(dev), vif, &offs);
1548 + skb = ieee80211_beacon_get_template(mt76_hw(dev), vif, &offs, 0);
1552 diff --git a/mt7921/pci_mac.c b/mt7921/pci_mac.c
1553 index 436f07ba9629..8dd60408b117 100644
1554 --- a/mt7921/pci_mac.c
1555 +++ b/mt7921/pci_mac.c
1556 @@ -113,7 +113,7 @@ int mt7921e_mac_reset(struct mt7921_dev *dev)
1558 err = mt7921e_driver_own(dev);
1563 err = mt7921_run_firmware(dev);
1565 diff --git a/tx.c b/tx.c
1566 index c8d78b0a5d84..24568b98ed9d 100644
1569 @@ -60,15 +60,20 @@ mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list)
1571 .info = IEEE80211_SKB_CB(skb),
1573 + struct ieee80211_rate_status rs = {};
1574 struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb);
1575 struct mt76_wcid *wcid;
1577 wcid = rcu_dereference(dev->wcid[cb->wcid]);
1579 status.sta = wcid_to_sta(wcid);
1582 - status.rate = &wcid->rate;
1583 + if (status.sta && (wcid->rate.flags || wcid->rate.legacy)) {
1584 + rs.rate_idx = wcid->rate;
1585 + status.rates = &rs;
1586 + status.n_rates = 1;
1588 + status.n_rates = 0;
1592 hw = mt76_tx_status_get_hw(dev, skb);
1593 diff --git a/usb.c b/usb.c
1594 index 369c27ab9259..3e281715fcd4 100644
1597 @@ -1075,7 +1075,7 @@ int __mt76u_init(struct mt76_dev *dev, struct usb_interface *intf,
1599 INIT_WORK(&usb->stat_work, mt76u_tx_status_data);
1601 - usb->data_len = usb_maxpacket(udev, usb_sndctrlpipe(udev, 0), 1);
1602 + usb->data_len = usb_maxpacket(udev, usb_sndctrlpipe(udev, 0));
1603 if (usb->data_len < 32)