1 // SPDX-License-Identifier: ISC
2 /* Copyright (C) 2020 MediaTek Inc. */
4 #include <linux/etherdevice.h>
5 #include <linux/platform_device.h>
7 #include <linux/module.h>
11 static bool mt7915_dev_running(struct mt7915_dev *dev)
13 struct mt7915_phy *phy;
15 if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
18 phy = mt7915_ext_phy(dev);
20 return phy && test_bit(MT76_STATE_RUNNING, &phy->mt76->state);
23 static int mt7915_start(struct ieee80211_hw *hw)
25 struct mt7915_dev *dev = mt7915_hw_dev(hw);
26 struct mt7915_phy *phy = mt7915_hw_phy(hw);
30 flush_work(&dev->init_work);
32 mutex_lock(&dev->mt76.mutex);
34 running = mt7915_dev_running(dev);
37 ret = mt76_connac_mcu_set_pm(&dev->mt76, 0, 0);
41 ret = mt7915_mcu_set_mac(dev, 0, true, true);
45 ret = mt7915_mcu_set_scs(dev, 0, true);
49 mt7915_mac_enable_nf(dev, 0);
52 if (phy != &dev->phy || phy->band_idx) {
53 ret = mt76_connac_mcu_set_pm(&dev->mt76, 1, 0);
57 ret = mt7915_mcu_set_mac(dev, 1, true, true);
61 ret = mt7915_mcu_set_scs(dev, 1, true);
65 mt7915_mac_enable_nf(dev, 1);
68 ret = mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b,
73 ret = mt7915_mcu_set_sku_en(phy, true);
77 ret = mt7915_mcu_set_chan_info(phy, MCU_EXT_CMD(SET_RX_PATH));
81 set_bit(MT76_STATE_RUNNING, &phy->mt76->state);
83 if (!mt76_testmode_enabled(phy->mt76))
84 ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work,
85 MT7915_WATCHDOG_TIME);
88 mt7915_mac_reset_counters(phy);
91 mutex_unlock(&dev->mt76.mutex);
96 static void mt7915_stop(struct ieee80211_hw *hw)
98 struct mt7915_dev *dev = mt7915_hw_dev(hw);
99 struct mt7915_phy *phy = mt7915_hw_phy(hw);
101 cancel_delayed_work_sync(&phy->mt76->mac_work);
103 mutex_lock(&dev->mt76.mutex);
105 mt76_testmode_reset(phy->mt76, true);
107 clear_bit(MT76_STATE_RUNNING, &phy->mt76->state);
109 if (phy != &dev->phy) {
110 mt76_connac_mcu_set_pm(&dev->mt76, 1, 1);
111 mt7915_mcu_set_mac(dev, 1, false, false);
114 if (!mt7915_dev_running(dev)) {
115 mt76_connac_mcu_set_pm(&dev->mt76, 0, 1);
116 mt7915_mcu_set_mac(dev, 0, false, false);
119 mutex_unlock(&dev->mt76.mutex);
122 static inline int get_free_idx(u32 mask, u8 start, u8 end)
124 return ffs(~mask & GENMASK(end, start));
127 static int get_omac_idx(enum nl80211_iftype type, u64 mask)
132 case NL80211_IFTYPE_MESH_POINT:
133 case NL80211_IFTYPE_ADHOC:
134 case NL80211_IFTYPE_STATION:
135 /* prefer hw bssid slot 1-3 */
136 i = get_free_idx(mask, HW_BSSID_1, HW_BSSID_3);
140 if (type != NL80211_IFTYPE_STATION)
143 i = get_free_idx(mask, EXT_BSSID_1, EXT_BSSID_MAX);
147 if (~mask & BIT(HW_BSSID_0))
151 case NL80211_IFTYPE_MONITOR:
152 case NL80211_IFTYPE_AP:
153 /* ap uses hw bssid 0 and ext bssid */
154 if (~mask & BIT(HW_BSSID_0))
157 i = get_free_idx(mask, EXT_BSSID_1, EXT_BSSID_MAX);
170 static void mt7915_init_bitrate_mask(struct ieee80211_vif *vif)
172 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
175 for (i = 0; i < ARRAY_SIZE(mvif->bitrate_mask.control); i++) {
176 mvif->bitrate_mask.control[i].gi = NL80211_TXRATE_DEFAULT_GI;
177 mvif->bitrate_mask.control[i].he_gi = GENMASK(7, 0);
178 mvif->bitrate_mask.control[i].he_ltf = GENMASK(7, 0);
179 mvif->bitrate_mask.control[i].legacy = GENMASK(31, 0);
180 memset(mvif->bitrate_mask.control[i].ht_mcs, GENMASK(7, 0),
181 sizeof(mvif->bitrate_mask.control[i].ht_mcs));
182 memset(mvif->bitrate_mask.control[i].vht_mcs, GENMASK(15, 0),
183 sizeof(mvif->bitrate_mask.control[i].vht_mcs));
184 memset(mvif->bitrate_mask.control[i].he_mcs, GENMASK(15, 0),
185 sizeof(mvif->bitrate_mask.control[i].he_mcs));
189 static int mt7915_add_interface(struct ieee80211_hw *hw,
190 struct ieee80211_vif *vif)
192 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
193 struct mt7915_dev *dev = mt7915_hw_dev(hw);
194 struct mt7915_phy *phy = mt7915_hw_phy(hw);
195 struct mt76_txq *mtxq;
196 bool ext_phy = phy != &dev->phy;
199 mutex_lock(&dev->mt76.mutex);
201 mt76_testmode_reset(phy->mt76, true);
203 if (vif->type == NL80211_IFTYPE_MONITOR &&
204 is_zero_ether_addr(vif->addr))
205 phy->monitor_vif = vif;
207 mvif->mt76.idx = ffs(~dev->mt76.vif_mask) - 1;
208 if (mvif->mt76.idx >= MT7915_MAX_INTERFACES) {
213 idx = get_omac_idx(vif->type, phy->omac_mask);
218 mvif->mt76.omac_idx = idx;
220 mvif->mt76.band_idx = phy->band_idx;
222 mvif->mt76.wmm_idx = vif->type != NL80211_IFTYPE_AP;
224 mvif->mt76.wmm_idx += 2;
226 ret = mt7915_mcu_add_dev_info(phy, vif, true);
230 dev->mt76.vif_mask |= BIT(mvif->mt76.idx);
231 phy->omac_mask |= BIT_ULL(mvif->mt76.omac_idx);
233 idx = MT7915_WTBL_RESERVED - mvif->mt76.idx;
235 INIT_LIST_HEAD(&mvif->sta.rc_list);
236 INIT_LIST_HEAD(&mvif->sta.poll_list);
237 mvif->sta.wcid.idx = idx;
238 mvif->sta.wcid.ext_phy = ext_phy;
239 mvif->sta.wcid.hw_key_idx = -1;
240 mvif->sta.wcid.tx_info |= MT_WCID_TX_INFO_SET;
241 mt76_packet_id_init(&mvif->sta.wcid);
243 mt7915_mac_wtbl_update(dev, idx,
244 MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
246 rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.wcid);
248 mtxq = (struct mt76_txq *)vif->txq->drv_priv;
252 if (vif->type != NL80211_IFTYPE_AP &&
253 (!mvif->mt76.omac_idx || mvif->mt76.omac_idx > 3))
254 vif->offload_flags = 0;
255 vif->offload_flags |= IEEE80211_OFFLOAD_ENCAP_4ADDR;
257 mt7915_init_bitrate_mask(vif);
258 memset(&mvif->cap, -1, sizeof(mvif->cap));
260 mt7915_mcu_add_bss_info(phy, vif, true);
261 mt7915_mcu_add_sta(dev, vif, NULL, true);
264 mutex_unlock(&dev->mt76.mutex);
269 static void mt7915_remove_interface(struct ieee80211_hw *hw,
270 struct ieee80211_vif *vif)
272 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
273 struct mt7915_sta *msta = &mvif->sta;
274 struct mt7915_dev *dev = mt7915_hw_dev(hw);
275 struct mt7915_phy *phy = mt7915_hw_phy(hw);
276 int idx = msta->wcid.idx;
278 mt7915_mcu_add_bss_info(phy, vif, false);
279 mt7915_mcu_add_sta(dev, vif, NULL, false);
281 mutex_lock(&dev->mt76.mutex);
282 mt76_testmode_reset(phy->mt76, true);
283 mutex_unlock(&dev->mt76.mutex);
285 if (vif == phy->monitor_vif)
286 phy->monitor_vif = NULL;
288 mt7915_mcu_add_dev_info(phy, vif, false);
290 rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
292 mutex_lock(&dev->mt76.mutex);
293 dev->mt76.vif_mask &= ~BIT(mvif->mt76.idx);
294 phy->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx);
295 mutex_unlock(&dev->mt76.mutex);
297 spin_lock_bh(&dev->sta_poll_lock);
298 if (!list_empty(&msta->poll_list))
299 list_del_init(&msta->poll_list);
300 spin_unlock_bh(&dev->sta_poll_lock);
302 mt76_packet_id_flush(&dev->mt76, &msta->wcid);
305 int mt7915_set_channel(struct mt7915_phy *phy)
307 struct mt7915_dev *dev = phy->dev;
310 cancel_delayed_work_sync(&phy->mt76->mac_work);
312 mutex_lock(&dev->mt76.mutex);
313 set_bit(MT76_RESET, &phy->mt76->state);
315 mt76_set_channel(phy->mt76);
317 if (dev->flash_mode) {
318 ret = mt7915_mcu_apply_tx_dpd(phy);
323 ret = mt7915_mcu_set_chan_info(phy, MCU_EXT_CMD(CHANNEL_SWITCH));
327 mt7915_mac_set_timing(phy);
328 ret = mt7915_dfs_init_radar_detector(phy);
329 mt7915_mac_cca_stats_reset(phy);
331 mt7915_mac_reset_counters(phy);
335 clear_bit(MT76_RESET, &phy->mt76->state);
336 mutex_unlock(&dev->mt76.mutex);
338 mt76_txq_schedule_all(phy->mt76);
340 if (!mt76_testmode_enabled(phy->mt76))
341 ieee80211_queue_delayed_work(phy->mt76->hw,
342 &phy->mt76->mac_work,
343 MT7915_WATCHDOG_TIME);
348 static int mt7915_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
349 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
350 struct ieee80211_key_conf *key)
352 struct mt7915_dev *dev = mt7915_hw_dev(hw);
353 struct mt7915_phy *phy = mt7915_hw_phy(hw);
354 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
355 struct mt7915_sta *msta = sta ? (struct mt7915_sta *)sta->drv_priv :
357 struct mt76_wcid *wcid = &msta->wcid;
358 u8 *wcid_keyidx = &wcid->hw_key_idx;
359 int idx = key->keyidx;
362 /* The hardware does not support per-STA RX GTK, fallback
363 * to software mode for these.
365 if ((vif->type == NL80211_IFTYPE_ADHOC ||
366 vif->type == NL80211_IFTYPE_MESH_POINT) &&
367 (key->cipher == WLAN_CIPHER_SUITE_TKIP ||
368 key->cipher == WLAN_CIPHER_SUITE_CCMP) &&
369 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))
372 /* fall back to sw encryption for unsupported ciphers */
373 switch (key->cipher) {
374 case WLAN_CIPHER_SUITE_AES_CMAC:
375 wcid_keyidx = &wcid->hw_key_idx2;
376 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIE;
378 case WLAN_CIPHER_SUITE_TKIP:
379 case WLAN_CIPHER_SUITE_CCMP:
380 case WLAN_CIPHER_SUITE_CCMP_256:
381 case WLAN_CIPHER_SUITE_GCMP:
382 case WLAN_CIPHER_SUITE_GCMP_256:
383 case WLAN_CIPHER_SUITE_SMS4:
385 case WLAN_CIPHER_SUITE_WEP40:
386 case WLAN_CIPHER_SUITE_WEP104:
391 mutex_lock(&dev->mt76.mutex);
393 if (cmd == SET_KEY && !sta && !mvif->mt76.cipher) {
394 mvif->mt76.cipher = mt76_connac_mcu_get_cipher(key->cipher);
395 mt7915_mcu_add_bss_info(phy, vif, true);
400 else if (idx == *wcid_keyidx)
405 mt76_wcid_key_setup(&dev->mt76, wcid,
406 cmd == SET_KEY ? key : NULL);
408 err = mt76_connac_mcu_add_key(&dev->mt76, vif, &msta->bip,
409 key, MCU_EXT_CMD(STA_REC_UPDATE),
412 mutex_unlock(&dev->mt76.mutex);
417 static int mt7915_set_sar_specs(struct ieee80211_hw *hw,
418 const struct cfg80211_sar_specs *sar)
420 struct mt7915_phy *phy = mt7915_hw_phy(hw);
421 struct mt7915_dev *dev = mt7915_hw_dev(hw);
424 mutex_lock(&dev->mt76.mutex);
425 if (!cfg80211_chandef_valid(&phy->mt76->chandef))
428 err = mt76_init_sar_power(hw, sar);
432 err = mt7915_mcu_set_txpower_sku(phy);
434 mutex_unlock(&dev->mt76.mutex);
439 static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
441 struct mt7915_dev *dev = mt7915_hw_dev(hw);
442 struct mt7915_phy *phy = mt7915_hw_phy(hw);
443 bool band = phy != &dev->phy;
446 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
447 #ifdef CONFIG_NL80211_TESTMODE
448 if (phy->mt76->test.state != MT76_TM_STATE_OFF) {
449 mutex_lock(&dev->mt76.mutex);
450 mt76_testmode_reset(phy->mt76, false);
451 mutex_unlock(&dev->mt76.mutex);
454 ieee80211_stop_queues(hw);
455 ret = mt7915_set_channel(phy);
458 ieee80211_wake_queues(hw);
461 if (changed & IEEE80211_CONF_CHANGE_POWER) {
462 ret = mt7915_mcu_set_txpower_sku(phy);
467 mutex_lock(&dev->mt76.mutex);
469 if (changed & IEEE80211_CONF_CHANGE_MONITOR) {
470 bool enabled = !!(hw->conf.flags & IEEE80211_CONF_MONITOR);
473 phy->rxfilter |= MT_WF_RFCR_DROP_OTHER_UC;
475 phy->rxfilter &= ~MT_WF_RFCR_DROP_OTHER_UC;
477 mt76_rmw_field(dev, MT_DMA_DCR0(band), MT_DMA_DCR0_RXD_G5_EN,
479 mt76_testmode_reset(phy->mt76, true);
480 mt76_wr(dev, MT_WF_RFCR(band), phy->rxfilter);
483 mutex_unlock(&dev->mt76.mutex);
489 mt7915_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue,
490 const struct ieee80211_tx_queue_params *params)
492 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
494 /* no need to update right away, we'll get BSS_CHANGED_QOS */
495 queue = mt76_connac_lmac_mapping(queue);
496 mvif->queue_params[queue] = *params;
501 static void mt7915_configure_filter(struct ieee80211_hw *hw,
502 unsigned int changed_flags,
503 unsigned int *total_flags,
506 struct mt7915_dev *dev = mt7915_hw_dev(hw);
507 struct mt7915_phy *phy = mt7915_hw_phy(hw);
508 bool band = phy != &dev->phy;
509 u32 ctl_flags = MT_WF_RFCR1_DROP_ACK |
510 MT_WF_RFCR1_DROP_BF_POLL |
511 MT_WF_RFCR1_DROP_BA |
512 MT_WF_RFCR1_DROP_CFEND |
513 MT_WF_RFCR1_DROP_CFACK;
516 #define MT76_FILTER(_flag, _hw) do { \
517 flags |= *total_flags & FIF_##_flag; \
518 phy->rxfilter &= ~(_hw); \
519 phy->rxfilter |= !(flags & FIF_##_flag) * (_hw); \
522 mutex_lock(&dev->mt76.mutex);
524 phy->rxfilter &= ~(MT_WF_RFCR_DROP_OTHER_BSS |
525 MT_WF_RFCR_DROP_OTHER_BEACON |
526 MT_WF_RFCR_DROP_FRAME_REPORT |
527 MT_WF_RFCR_DROP_PROBEREQ |
528 MT_WF_RFCR_DROP_MCAST_FILTERED |
529 MT_WF_RFCR_DROP_MCAST |
530 MT_WF_RFCR_DROP_BCAST |
531 MT_WF_RFCR_DROP_DUPLICATE |
532 MT_WF_RFCR_DROP_A2_BSSID |
533 MT_WF_RFCR_DROP_UNWANTED_CTL |
534 MT_WF_RFCR_DROP_STBC_MULTI);
536 MT76_FILTER(OTHER_BSS, MT_WF_RFCR_DROP_OTHER_TIM |
537 MT_WF_RFCR_DROP_A3_MAC |
538 MT_WF_RFCR_DROP_A3_BSSID);
540 MT76_FILTER(FCSFAIL, MT_WF_RFCR_DROP_FCSFAIL);
542 MT76_FILTER(CONTROL, MT_WF_RFCR_DROP_CTS |
543 MT_WF_RFCR_DROP_RTS |
544 MT_WF_RFCR_DROP_CTL_RSV |
545 MT_WF_RFCR_DROP_NDPA);
547 *total_flags = flags;
548 mt76_wr(dev, MT_WF_RFCR(band), phy->rxfilter);
550 if (*total_flags & FIF_CONTROL)
551 mt76_clear(dev, MT_WF_RFCR1(band), ctl_flags);
553 mt76_set(dev, MT_WF_RFCR1(band), ctl_flags);
555 mutex_unlock(&dev->mt76.mutex);
559 mt7915_update_bss_color(struct ieee80211_hw *hw,
560 struct ieee80211_vif *vif,
561 struct cfg80211_he_bss_color *bss_color)
563 struct mt7915_dev *dev = mt7915_hw_dev(hw);
566 case NL80211_IFTYPE_AP: {
567 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
569 if (mvif->mt76.omac_idx > HW_BSSID_MAX)
573 case NL80211_IFTYPE_STATION:
574 mt7915_mcu_update_bss_color(dev, vif, bss_color);
581 static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
582 struct ieee80211_vif *vif,
583 struct ieee80211_bss_conf *info,
586 struct mt7915_phy *phy = mt7915_hw_phy(hw);
587 struct mt7915_dev *dev = mt7915_hw_dev(hw);
589 mutex_lock(&dev->mt76.mutex);
592 * station mode uses BSSID to map the wlan entry to a peer,
593 * and then peer references bss_info_rfch to set bandwidth cap.
595 if (changed & BSS_CHANGED_BSSID &&
596 vif->type == NL80211_IFTYPE_STATION) {
597 bool join = !is_zero_ether_addr(info->bssid);
599 mt7915_mcu_add_bss_info(phy, vif, join);
600 mt7915_mcu_add_sta(dev, vif, NULL, join);
603 if (changed & BSS_CHANGED_ASSOC) {
604 mt7915_mcu_add_bss_info(phy, vif, info->assoc);
605 mt7915_mcu_add_obss_spr(dev, vif, info->he_obss_pd.enable);
608 if (changed & BSS_CHANGED_ERP_SLOT) {
609 int slottime = info->use_short_slot ? 9 : 20;
611 if (slottime != phy->slottime) {
612 phy->slottime = slottime;
613 mt7915_mac_set_timing(phy);
617 if (changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon) {
618 mt7915_mcu_add_bss_info(phy, vif, true);
619 mt7915_mcu_add_sta(dev, vif, NULL, true);
622 /* ensure that enable txcmd_mode after bss_info */
623 if (changed & (BSS_CHANGED_QOS | BSS_CHANGED_BEACON_ENABLED))
624 mt7915_mcu_set_tx(dev, vif);
626 if (changed & BSS_CHANGED_HE_OBSS_PD)
627 mt7915_mcu_add_obss_spr(dev, vif, info->he_obss_pd.enable);
629 if (changed & BSS_CHANGED_HE_BSS_COLOR)
630 mt7915_update_bss_color(hw, vif, &info->he_bss_color);
632 if (changed & (BSS_CHANGED_BEACON |
633 BSS_CHANGED_BEACON_ENABLED))
634 mt7915_mcu_add_beacon(hw, vif, info->enable_beacon);
636 mutex_unlock(&dev->mt76.mutex);
640 mt7915_channel_switch_beacon(struct ieee80211_hw *hw,
641 struct ieee80211_vif *vif,
642 struct cfg80211_chan_def *chandef)
644 struct mt7915_dev *dev = mt7915_hw_dev(hw);
646 mutex_lock(&dev->mt76.mutex);
647 mt7915_mcu_add_beacon(hw, vif, true);
648 mutex_unlock(&dev->mt76.mutex);
651 int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
652 struct ieee80211_sta *sta)
654 struct mt7915_dev *dev = container_of(mdev, struct mt7915_dev, mt76);
655 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
656 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
657 bool ext_phy = mvif->phy != &dev->phy;
660 idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
664 INIT_LIST_HEAD(&msta->rc_list);
665 INIT_LIST_HEAD(&msta->poll_list);
668 msta->wcid.idx = idx;
669 msta->wcid.ext_phy = ext_phy;
670 msta->wcid.tx_info |= MT_WCID_TX_INFO_SET;
671 msta->jiffies = jiffies;
673 mt7915_mac_wtbl_update(dev, idx,
674 MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
676 ret = mt7915_mcu_add_sta(dev, vif, sta, true);
680 return mt7915_mcu_add_rate_ctrl(dev, vif, sta, false);
683 void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
684 struct ieee80211_sta *sta)
686 struct mt7915_dev *dev = container_of(mdev, struct mt7915_dev, mt76);
687 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
690 mt7915_mcu_add_sta(dev, vif, sta, false);
692 mt7915_mac_wtbl_update(dev, msta->wcid.idx,
693 MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
695 for (i = 0; i < ARRAY_SIZE(msta->twt.flow); i++)
696 mt7915_mac_twt_teardown_flow(dev, msta, i);
698 spin_lock_bh(&dev->sta_poll_lock);
699 if (!list_empty(&msta->poll_list))
700 list_del_init(&msta->poll_list);
701 if (!list_empty(&msta->rc_list))
702 list_del_init(&msta->rc_list);
703 spin_unlock_bh(&dev->sta_poll_lock);
706 static void mt7915_tx(struct ieee80211_hw *hw,
707 struct ieee80211_tx_control *control,
710 struct mt7915_dev *dev = mt7915_hw_dev(hw);
711 struct mt76_phy *mphy = hw->priv;
712 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
713 struct ieee80211_vif *vif = info->control.vif;
714 struct mt76_wcid *wcid = &dev->mt76.global_wcid;
717 struct mt7915_sta *sta;
719 sta = (struct mt7915_sta *)control->sta->drv_priv;
723 if (vif && !control->sta) {
724 struct mt7915_vif *mvif;
726 mvif = (struct mt7915_vif *)vif->drv_priv;
727 wcid = &mvif->sta.wcid;
730 mt76_tx(mphy, control->sta, wcid, skb);
733 static int mt7915_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
735 struct mt7915_dev *dev = mt7915_hw_dev(hw);
736 struct mt7915_phy *phy = mt7915_hw_phy(hw);
739 mutex_lock(&dev->mt76.mutex);
740 ret = mt76_connac_mcu_set_rts_thresh(&dev->mt76, val, phy != &dev->phy);
741 mutex_unlock(&dev->mt76.mutex);
747 mt7915_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
748 struct ieee80211_ampdu_params *params)
750 enum ieee80211_ampdu_mlme_action action = params->action;
751 struct mt7915_dev *dev = mt7915_hw_dev(hw);
752 struct ieee80211_sta *sta = params->sta;
753 struct ieee80211_txq *txq = sta->txq[params->tid];
754 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
755 u16 tid = params->tid;
756 u16 ssn = params->ssn;
757 struct mt76_txq *mtxq;
763 mtxq = (struct mt76_txq *)txq->drv_priv;
765 mutex_lock(&dev->mt76.mutex);
767 case IEEE80211_AMPDU_RX_START:
768 mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid, ssn,
770 ret = mt7915_mcu_add_rx_ba(dev, params, true);
772 case IEEE80211_AMPDU_RX_STOP:
773 mt76_rx_aggr_stop(&dev->mt76, &msta->wcid, tid);
774 ret = mt7915_mcu_add_rx_ba(dev, params, false);
776 case IEEE80211_AMPDU_TX_OPERATIONAL:
778 mtxq->send_bar = false;
779 ret = mt7915_mcu_add_tx_ba(dev, params, true);
781 case IEEE80211_AMPDU_TX_STOP_FLUSH:
782 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
784 clear_bit(tid, &msta->ampdu_state);
785 ret = mt7915_mcu_add_tx_ba(dev, params, false);
787 case IEEE80211_AMPDU_TX_START:
788 set_bit(tid, &msta->ampdu_state);
789 ret = IEEE80211_AMPDU_TX_START_IMMEDIATE;
791 case IEEE80211_AMPDU_TX_STOP_CONT:
793 clear_bit(tid, &msta->ampdu_state);
794 ret = mt7915_mcu_add_tx_ba(dev, params, false);
795 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
798 mutex_unlock(&dev->mt76.mutex);
804 mt7915_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
805 struct ieee80211_sta *sta)
807 return mt76_sta_state(hw, vif, sta, IEEE80211_STA_NOTEXIST,
812 mt7915_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
813 struct ieee80211_sta *sta)
815 return mt76_sta_state(hw, vif, sta, IEEE80211_STA_NONE,
816 IEEE80211_STA_NOTEXIST);
820 mt7915_get_stats(struct ieee80211_hw *hw,
821 struct ieee80211_low_level_stats *stats)
823 struct mt7915_phy *phy = mt7915_hw_phy(hw);
824 struct mt7915_dev *dev = mt7915_hw_dev(hw);
825 struct mib_stats *mib = &phy->mib;
827 mutex_lock(&dev->mt76.mutex);
829 stats->dot11RTSSuccessCount = mib->rts_cnt;
830 stats->dot11RTSFailureCount = mib->rts_retries_cnt;
831 stats->dot11FCSErrorCount = mib->fcs_err_cnt;
832 stats->dot11ACKFailureCount = mib->ack_fail_cnt;
834 mutex_unlock(&dev->mt76.mutex);
839 u64 __mt7915_get_tsf(struct ieee80211_hw *hw, struct mt7915_vif *mvif)
841 struct mt7915_dev *dev = mt7915_hw_dev(hw);
842 struct mt7915_phy *phy = mt7915_hw_phy(hw);
843 bool band = phy != &dev->phy;
850 lockdep_assert_held(&dev->mt76.mutex);
852 n = mvif->mt76.omac_idx > HW_BSSID_MAX ? HW_BSSID_0
853 : mvif->mt76.omac_idx;
854 /* TSF software read */
855 if (is_mt7915(&dev->mt76))
856 mt76_rmw(dev, MT_LPON_TCR(band, n), MT_LPON_TCR_SW_MODE,
857 MT_LPON_TCR_SW_READ);
859 mt76_rmw(dev, MT_LPON_TCR_MT7916(band, n), MT_LPON_TCR_SW_MODE,
860 MT_LPON_TCR_SW_READ);
861 tsf.t32[0] = mt76_rr(dev, MT_LPON_UTTR0(band));
862 tsf.t32[1] = mt76_rr(dev, MT_LPON_UTTR1(band));
868 mt7915_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
870 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
871 struct mt7915_dev *dev = mt7915_hw_dev(hw);
874 mutex_lock(&dev->mt76.mutex);
875 ret = __mt7915_get_tsf(hw, mvif);
876 mutex_unlock(&dev->mt76.mutex);
882 mt7915_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
885 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
886 struct mt7915_dev *dev = mt7915_hw_dev(hw);
887 struct mt7915_phy *phy = mt7915_hw_phy(hw);
888 bool band = phy != &dev->phy;
892 } tsf = { .t64 = timestamp, };
895 mutex_lock(&dev->mt76.mutex);
897 n = mvif->mt76.omac_idx > HW_BSSID_MAX ? HW_BSSID_0
898 : mvif->mt76.omac_idx;
899 mt76_wr(dev, MT_LPON_UTTR0(band), tsf.t32[0]);
900 mt76_wr(dev, MT_LPON_UTTR1(band), tsf.t32[1]);
901 /* TSF software overwrite */
902 if (is_mt7915(&dev->mt76))
903 mt76_rmw(dev, MT_LPON_TCR(band, n), MT_LPON_TCR_SW_MODE,
904 MT_LPON_TCR_SW_WRITE);
906 mt76_rmw(dev, MT_LPON_TCR_MT7916(band, n), MT_LPON_TCR_SW_MODE,
907 MT_LPON_TCR_SW_WRITE);
909 mutex_unlock(&dev->mt76.mutex);
913 mt7915_offset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
916 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
917 struct mt7915_dev *dev = mt7915_hw_dev(hw);
918 struct mt7915_phy *phy = mt7915_hw_phy(hw);
919 bool band = phy != &dev->phy;
923 } tsf = { .t64 = timestamp, };
926 mutex_lock(&dev->mt76.mutex);
928 n = mvif->mt76.omac_idx > HW_BSSID_MAX ? HW_BSSID_0
929 : mvif->mt76.omac_idx;
930 mt76_wr(dev, MT_LPON_UTTR0(band), tsf.t32[0]);
931 mt76_wr(dev, MT_LPON_UTTR1(band), tsf.t32[1]);
932 /* TSF software adjust*/
933 if (is_mt7915(&dev->mt76))
934 mt76_rmw(dev, MT_LPON_TCR(band, n), MT_LPON_TCR_SW_MODE,
935 MT_LPON_TCR_SW_ADJUST);
937 mt76_rmw(dev, MT_LPON_TCR_MT7916(band, n), MT_LPON_TCR_SW_MODE,
938 MT_LPON_TCR_SW_ADJUST);
940 mutex_unlock(&dev->mt76.mutex);
944 mt7915_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
946 struct mt7915_phy *phy = mt7915_hw_phy(hw);
947 struct mt7915_dev *dev = phy->dev;
949 mutex_lock(&dev->mt76.mutex);
950 phy->coverage_class = max_t(s16, coverage_class, 0);
951 mt7915_mac_set_timing(phy);
952 mutex_unlock(&dev->mt76.mutex);
956 mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
958 struct mt7915_dev *dev = mt7915_hw_dev(hw);
959 struct mt7915_phy *phy = mt7915_hw_phy(hw);
960 int max_nss = hweight8(hw->wiphy->available_antennas_tx);
961 bool ext_phy = phy != &dev->phy;
963 if (!tx_ant || tx_ant != rx_ant || ffs(tx_ant) > max_nss)
966 if ((BIT(hweight8(tx_ant)) - 1) != tx_ant)
967 tx_ant = BIT(ffs(tx_ant) - 1) - 1;
969 mutex_lock(&dev->mt76.mutex);
971 phy->mt76->antenna_mask = tx_ant;
974 tx_ant <<= dev->chainshift;
976 phy->mt76->chainmask = tx_ant;
978 mt76_set_stream_caps(phy->mt76, true);
979 mt7915_set_stream_vht_txbf_caps(phy);
980 mt7915_set_stream_he_caps(phy);
982 mutex_unlock(&dev->mt76.mutex);
987 static void mt7915_sta_statistics(struct ieee80211_hw *hw,
988 struct ieee80211_vif *vif,
989 struct ieee80211_sta *sta,
990 struct station_info *sinfo)
992 struct mt7915_phy *phy = mt7915_hw_phy(hw);
993 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
994 struct rate_info *txrate = &msta->wcid.rate;
995 struct rate_info rxrate = {};
997 if (is_mt7915(&phy->dev->mt76) &&
998 !mt7915_mcu_get_rx_rate(phy, vif, sta, &rxrate)) {
999 sinfo->rxrate = rxrate;
1000 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE);
1003 if (!txrate->legacy && !txrate->flags)
1006 if (txrate->legacy) {
1007 sinfo->txrate.legacy = txrate->legacy;
1009 sinfo->txrate.mcs = txrate->mcs;
1010 sinfo->txrate.nss = txrate->nss;
1011 sinfo->txrate.bw = txrate->bw;
1012 sinfo->txrate.he_gi = txrate->he_gi;
1013 sinfo->txrate.he_dcm = txrate->he_dcm;
1014 sinfo->txrate.he_ru_alloc = txrate->he_ru_alloc;
1016 sinfo->txrate.flags = txrate->flags;
1017 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
1020 static void mt7915_sta_rc_work(void *data, struct ieee80211_sta *sta)
1022 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
1023 struct mt7915_dev *dev = msta->vif->phy->dev;
1024 u32 *changed = data;
1026 spin_lock_bh(&dev->sta_poll_lock);
1027 msta->changed |= *changed;
1028 if (list_empty(&msta->rc_list))
1029 list_add_tail(&msta->rc_list, &dev->sta_rc_list);
1030 spin_unlock_bh(&dev->sta_poll_lock);
1033 static void mt7915_sta_rc_update(struct ieee80211_hw *hw,
1034 struct ieee80211_vif *vif,
1035 struct ieee80211_sta *sta,
1038 struct mt7915_phy *phy = mt7915_hw_phy(hw);
1039 struct mt7915_dev *dev = phy->dev;
1041 mt7915_sta_rc_work(&changed, sta);
1042 ieee80211_queue_work(hw, &dev->rc_work);
1046 mt7915_set_bitrate_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1047 const struct cfg80211_bitrate_mask *mask)
1049 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
1050 struct mt7915_phy *phy = mt7915_hw_phy(hw);
1051 struct mt7915_dev *dev = phy->dev;
1052 u32 changed = IEEE80211_RC_SUPP_RATES_CHANGED;
1054 mvif->bitrate_mask = *mask;
1056 /* if multiple rates across different preambles are given we can
1057 * reconfigure this info with all peers using sta_rec command with
1058 * the below exception cases.
1059 * - single rate : if a rate is passed along with different preambles,
1060 * we select the highest one as fixed rate. i.e VHT MCS for VHT peers.
1061 * - multiple rates: if it's not in range format i.e 0-{7,8,9} for VHT
1062 * then multiple MCS setting (MCS 4,5,6) is not supported.
1064 ieee80211_iterate_stations_atomic(hw, mt7915_sta_rc_work, &changed);
1065 ieee80211_queue_work(hw, &dev->rc_work);
1070 static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
1071 struct ieee80211_vif *vif,
1072 struct ieee80211_sta *sta,
1075 struct mt7915_dev *dev = mt7915_hw_dev(hw);
1076 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
1079 set_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
1081 clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
1083 mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
1086 static void mt7915_sta_set_decap_offload(struct ieee80211_hw *hw,
1087 struct ieee80211_vif *vif,
1088 struct ieee80211_sta *sta,
1091 struct mt7915_dev *dev = mt7915_hw_dev(hw);
1092 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
1095 set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags);
1097 clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags);
1099 mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
1102 static const char mt7915_gstrings_stats[][ETH_GSTRING_LEN] = {
1104 "tx_stop_q_empty_cnt",
1112 "tx_ampdu_len:2-10",
1113 "tx_ampdu_len:11-19",
1114 "tx_ampdu_len:20-28",
1115 "tx_ampdu_len:29-37",
1116 "tx_ampdu_len:38-46",
1117 "tx_ampdu_len:47-55",
1118 "tx_ampdu_len:56-79",
1119 "tx_ampdu_len:80-103",
1120 "tx_ampdu_len:104-127",
1121 "tx_ampdu_len:128-151",
1122 "tx_ampdu_len:152-175",
1123 "tx_ampdu_len:176-199",
1124 "tx_ampdu_len:200-223",
1125 "tx_ampdu_len:224-247",
1127 "tx_beamformer_ppdu_iBF",
1128 "tx_beamformer_ppdu_eBF",
1129 "tx_beamformer_rx_feedback_all",
1130 "tx_beamformer_rx_feedback_he",
1131 "tx_beamformer_rx_feedback_vht",
1132 "tx_beamformer_rx_feedback_ht",
1133 "tx_beamformer_rx_feedback_bw", /* zero based idx: 20, 40, 80, 160 */
1134 "tx_beamformer_rx_feedback_nc",
1135 "tx_beamformer_rx_feedback_nr",
1136 "tx_beamformee_ok_feedback_pkts",
1137 "tx_beamformee_feedback_trig",
1138 "tx_mu_beamforming",
1140 "tx_mu_successful_mpdu",
1141 "tx_su_successful_mpdu",
1155 "rx_vector_mismatch_cnt",
1156 "rx_delimiter_fail_cnt",
1157 "rx_len_mismatch_cnt",
1159 "rx_ampdu_bytes_cnt",
1160 "rx_ampdu_valid_subframe_cnt",
1161 "rx_ampdu_valid_subframe_b_cnt",
1163 "rx_vec_queue_overflow_drop_cnt",
1166 /* per vif counters */
1173 "v_tx_mode_he_ext_su",
1194 #define MT7915_SSTATS_LEN ARRAY_SIZE(mt7915_gstrings_stats)
1196 /* Ethtool related API */
1198 void mt7915_get_et_strings(struct ieee80211_hw *hw,
1199 struct ieee80211_vif *vif,
1202 if (sset == ETH_SS_STATS)
1203 memcpy(data, *mt7915_gstrings_stats,
1204 sizeof(mt7915_gstrings_stats));
1208 int mt7915_get_et_sset_count(struct ieee80211_hw *hw,
1209 struct ieee80211_vif *vif, int sset)
1211 if (sset == ETH_SS_STATS)
1212 return MT7915_SSTATS_LEN;
1217 static void mt7915_ethtool_worker(void *wi_data, struct ieee80211_sta *sta)
1219 struct mt76_ethtool_worker_info *wi = wi_data;
1220 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
1222 if (msta->vif->mt76.idx != wi->idx)
1225 mt76_ethtool_worker(wi, &msta->stats);
1229 void mt7915_get_et_stats(struct ieee80211_hw *hw,
1230 struct ieee80211_vif *vif,
1231 struct ethtool_stats *stats, u64 *data)
1233 struct mt7915_dev *dev = mt7915_hw_dev(hw);
1234 struct mt7915_phy *phy = mt7915_hw_phy(hw);
1235 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
1236 struct mt76_ethtool_worker_info wi = {
1238 .idx = mvif->mt76.idx,
1240 struct mib_stats *mib = &phy->mib;
1241 /* See mt7915_ampdu_stat_read_phy, etc */
1244 mutex_lock(&dev->mt76.mutex);
1246 mt7915_mac_update_stats(phy);
1248 data[ei++] = mib->tx_ampdu_cnt;
1249 data[ei++] = mib->tx_stop_q_empty_cnt;
1250 data[ei++] = mib->tx_mpdu_attempts_cnt;
1251 data[ei++] = mib->tx_mpdu_success_cnt;
1252 data[ei++] = mib->tx_rwp_fail_cnt;
1253 data[ei++] = mib->tx_rwp_need_cnt;
1254 data[ei++] = mib->tx_pkt_ebf_cnt;
1255 data[ei++] = mib->tx_pkt_ibf_cnt;
1258 n = phy->band_idx ? ARRAY_SIZE(dev->mt76.aggr_stats) / 2 : 0;
1259 for (i = 0; i < 15 /*ARRAY_SIZE(bound)*/; i++)
1260 data[ei++] = dev->mt76.aggr_stats[i + n];
1262 data[ei++] = phy->mib.ba_miss_cnt;
1264 /* Tx Beamformer monitor */
1265 data[ei++] = mib->tx_bf_ibf_ppdu_cnt;
1266 data[ei++] = mib->tx_bf_ebf_ppdu_cnt;
1268 /* Tx Beamformer Rx feedback monitor */
1269 data[ei++] = mib->tx_bf_rx_fb_all_cnt;
1270 data[ei++] = mib->tx_bf_rx_fb_he_cnt;
1271 data[ei++] = mib->tx_bf_rx_fb_vht_cnt;
1272 data[ei++] = mib->tx_bf_rx_fb_ht_cnt;
1274 data[ei++] = mib->tx_bf_rx_fb_bw;
1275 data[ei++] = mib->tx_bf_rx_fb_nc_cnt;
1276 data[ei++] = mib->tx_bf_rx_fb_nr_cnt;
1278 /* Tx Beamformee Rx NDPA & Tx feedback report */
1279 data[ei++] = mib->tx_bf_fb_cpl_cnt;
1280 data[ei++] = mib->tx_bf_fb_trig_cnt;
1282 /* Tx SU & MU counters */
1283 data[ei++] = mib->tx_bf_cnt;
1284 data[ei++] = mib->tx_mu_mpdu_cnt;
1285 data[ei++] = mib->tx_mu_acked_mpdu_cnt;
1286 data[ei++] = mib->tx_su_acked_mpdu_cnt;
1288 /* Tx amsdu info (pack-count histogram) */
1289 for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++)
1290 data[ei++] = mib->tx_amsdu[i];
1293 data[ei++] = mib->rx_fifo_full_cnt;
1294 data[ei++] = mib->rx_mpdu_cnt;
1295 data[ei++] = mib->channel_idle_cnt;
1296 data[ei++] = mib->rx_vector_mismatch_cnt;
1297 data[ei++] = mib->rx_delimiter_fail_cnt;
1298 data[ei++] = mib->rx_len_mismatch_cnt;
1299 data[ei++] = mib->rx_ampdu_cnt;
1300 data[ei++] = mib->rx_ampdu_bytes_cnt;
1301 data[ei++] = mib->rx_ampdu_valid_subframe_cnt;
1302 data[ei++] = mib->rx_ampdu_valid_subframe_bytes_cnt;
1303 data[ei++] = mib->rx_pfdrop_cnt;
1304 data[ei++] = mib->rx_vec_queue_overflow_drop_cnt;
1305 data[ei++] = mib->rx_ba_cnt;
1307 /* Add values for all stations owned by this vif */
1308 wi.initial_stat_idx = ei;
1309 ieee80211_iterate_stations_atomic(hw, mt7915_ethtool_worker, &wi);
1311 mutex_unlock(&dev->mt76.mutex);
1313 if (wi.sta_count == 0)
1316 ei += wi.worker_stat_count;
1317 if (ei != MT7915_SSTATS_LEN)
1318 dev_err(dev->mt76.dev, "ei: %d MT7915_SSTATS_LEN: %d",
1319 ei, (int)MT7915_SSTATS_LEN);
1323 mt7915_twt_teardown_request(struct ieee80211_hw *hw,
1324 struct ieee80211_sta *sta,
1327 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
1328 struct mt7915_dev *dev = mt7915_hw_dev(hw);
1330 mutex_lock(&dev->mt76.mutex);
1331 mt7915_mac_twt_teardown_flow(dev, msta, flowid);
1332 mutex_unlock(&dev->mt76.mutex);
1336 mt7915_set_radar_background(struct ieee80211_hw *hw,
1337 struct cfg80211_chan_def *chandef)
1339 struct mt7915_phy *phy = mt7915_hw_phy(hw);
1340 struct mt7915_dev *dev = phy->dev;
1344 mutex_lock(&dev->mt76.mutex);
1346 if (dev->mt76.region == NL80211_DFS_UNSET)
1349 if (dev->rdd2_phy && dev->rdd2_phy != phy) {
1350 /* rdd2 is already locked */
1355 /* rdd2 already configured on a radar channel */
1356 running = dev->rdd2_phy &&
1357 cfg80211_chandef_valid(&dev->rdd2_chandef) &&
1358 !!(dev->rdd2_chandef.chan->flags & IEEE80211_CHAN_RADAR);
1360 if (!chandef || running ||
1361 !(chandef->chan->flags & IEEE80211_CHAN_RADAR)) {
1362 ret = mt7915_mcu_rdd_background_enable(phy, NULL);
1370 ret = mt7915_mcu_rdd_background_enable(phy, chandef);
1375 dev->rdd2_phy = chandef ? phy : NULL;
1377 dev->rdd2_chandef = *chandef;
1379 mutex_unlock(&dev->mt76.mutex);
1384 const struct ieee80211_ops mt7915_ops = {
1386 .start = mt7915_start,
1387 .stop = mt7915_stop,
1388 .add_interface = mt7915_add_interface,
1389 .remove_interface = mt7915_remove_interface,
1390 .config = mt7915_config,
1391 .conf_tx = mt7915_conf_tx,
1392 .configure_filter = mt7915_configure_filter,
1393 .bss_info_changed = mt7915_bss_info_changed,
1394 .sta_add = mt7915_sta_add,
1395 .sta_remove = mt7915_sta_remove,
1396 .sta_pre_rcu_remove = mt76_sta_pre_rcu_remove,
1397 .sta_rc_update = mt7915_sta_rc_update,
1398 .set_key = mt7915_set_key,
1399 .ampdu_action = mt7915_ampdu_action,
1400 .set_rts_threshold = mt7915_set_rts_threshold,
1401 .wake_tx_queue = mt76_wake_tx_queue,
1402 .sw_scan_start = mt76_sw_scan,
1403 .sw_scan_complete = mt76_sw_scan_complete,
1404 .release_buffered_frames = mt76_release_buffered_frames,
1405 .get_txpower = mt76_get_txpower,
1406 .set_sar_specs = mt7915_set_sar_specs,
1407 .channel_switch_beacon = mt7915_channel_switch_beacon,
1408 .get_stats = mt7915_get_stats,
1409 .get_et_sset_count = mt7915_get_et_sset_count,
1410 .get_et_stats = mt7915_get_et_stats,
1411 .get_et_strings = mt7915_get_et_strings,
1412 .get_tsf = mt7915_get_tsf,
1413 .set_tsf = mt7915_set_tsf,
1414 .offset_tsf = mt7915_offset_tsf,
1415 .get_survey = mt76_get_survey,
1416 .get_antenna = mt76_get_antenna,
1417 .set_antenna = mt7915_set_antenna,
1418 .set_bitrate_mask = mt7915_set_bitrate_mask,
1419 .set_coverage_class = mt7915_set_coverage_class,
1420 .sta_statistics = mt7915_sta_statistics,
1421 .sta_set_4addr = mt7915_sta_set_4addr,
1422 .sta_set_decap_offload = mt7915_sta_set_decap_offload,
1423 .add_twt_setup = mt7915_mac_add_twt_setup,
1424 .twt_teardown_request = mt7915_twt_teardown_request,
1425 CFG80211_TESTMODE_CMD(mt76_testmode_cmd)
1426 CFG80211_TESTMODE_DUMP(mt76_testmode_dump)
1427 #ifdef CONFIG_MAC80211_DEBUGFS
1428 .sta_add_debugfs = mt7915_sta_add_debugfs,