1 // SPDX-License-Identifier: ISC
2 /* Copyright (C) 2019 MediaTek Inc.
4 * Author: Roy Luo <royluo@google.com>
5 * Ryder Lee <ryder.lee@mediatek.com>
6 * Felix Fietkau <nbd@nbd.name>
7 * Lorenzo Bianconi <lorenzo@kernel.org>
10 #include <linux/etherdevice.h>
11 #include <linux/module.h>
15 static bool mt7615_dev_running(struct mt7615_dev
*dev
)
17 struct mt7615_phy
*phy
;
19 if (test_bit(MT76_STATE_RUNNING
, &dev
->mphy
.state
))
22 phy
= mt7615_ext_phy(dev
);
24 return phy
&& test_bit(MT76_STATE_RUNNING
, &phy
->mt76
->state
);
27 static int mt7615_start(struct ieee80211_hw
*hw
)
29 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
30 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
31 unsigned long timeout
;
35 if (!mt7615_wait_for_mcu_init(dev
))
38 mt7615_mutex_acquire(dev
);
40 running
= mt7615_dev_running(dev
);
43 ret
= mt7615_mcu_set_pm(dev
, 0, 0);
47 ret
= mt76_connac_mcu_set_mac_enable(&dev
->mt76
, 0, true, false);
51 mt7615_mac_enable_nf(dev
, 0);
54 if (phy
!= &dev
->phy
) {
55 ret
= mt7615_mcu_set_pm(dev
, 1, 0);
59 ret
= mt76_connac_mcu_set_mac_enable(&dev
->mt76
, 1, true, false);
63 mt7615_mac_enable_nf(dev
, 1);
66 if (mt7615_firmware_offload(dev
)) {
67 ret
= mt76_connac_mcu_set_channel_domain(phy
->mt76
);
71 ret
= mt76_connac_mcu_set_rate_txpower(phy
->mt76
);
76 ret
= mt7615_mcu_set_chan_info(phy
, MCU_EXT_CMD(SET_RX_PATH
));
80 set_bit(MT76_STATE_RUNNING
, &phy
->mt76
->state
);
82 timeout
= mt7615_get_macwork_timeout(dev
);
83 ieee80211_queue_delayed_work(hw
, &phy
->mt76
->mac_work
, timeout
);
86 mt7615_mac_reset_counters(phy
);
89 mt7615_mutex_release(dev
);
94 static void mt7615_stop(struct ieee80211_hw
*hw
, bool suspend
)
96 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
97 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
99 cancel_delayed_work_sync(&phy
->mt76
->mac_work
);
100 del_timer_sync(&phy
->roc_timer
);
101 cancel_work_sync(&phy
->roc_work
);
103 cancel_delayed_work_sync(&dev
->pm
.ps_work
);
104 cancel_work_sync(&dev
->pm
.wake_work
);
106 mt76_connac_free_pending_tx_skbs(&dev
->pm
, NULL
);
108 mt7615_mutex_acquire(dev
);
110 mt76_testmode_reset(phy
->mt76
, true);
112 clear_bit(MT76_STATE_RUNNING
, &phy
->mt76
->state
);
113 cancel_delayed_work_sync(&phy
->scan_work
);
115 if (phy
!= &dev
->phy
) {
116 mt7615_mcu_set_pm(dev
, 1, 1);
117 mt76_connac_mcu_set_mac_enable(&dev
->mt76
, 1, false, false);
120 if (!mt7615_dev_running(dev
)) {
121 mt7615_mcu_set_pm(dev
, 0, 1);
122 mt76_connac_mcu_set_mac_enable(&dev
->mt76
, 0, false, false);
125 mt7615_mutex_release(dev
);
128 static inline int get_free_idx(u32 mask
, u8 start
, u8 end
)
130 return ffs(~mask
& GENMASK(end
, start
));
133 static int get_omac_idx(enum nl80211_iftype type
, u64 mask
)
138 case NL80211_IFTYPE_STATION
:
139 /* prefer hw bssid slot 1-3 */
140 i
= get_free_idx(mask
, HW_BSSID_1
, HW_BSSID_3
);
144 /* next, try to find a free repeater entry for the sta */
145 i
= get_free_idx(mask
>> REPEATER_BSSID_START
, 0,
146 REPEATER_BSSID_MAX
- REPEATER_BSSID_START
);
150 i
= get_free_idx(mask
, EXT_BSSID_1
, EXT_BSSID_MAX
);
154 if (~mask
& BIT(HW_BSSID_0
))
158 case NL80211_IFTYPE_ADHOC
:
159 case NL80211_IFTYPE_MESH_POINT
:
160 case NL80211_IFTYPE_MONITOR
:
161 case NL80211_IFTYPE_AP
:
162 /* ap uses hw bssid 0 and ext bssid */
163 if (~mask
& BIT(HW_BSSID_0
))
166 i
= get_free_idx(mask
, EXT_BSSID_1
, EXT_BSSID_MAX
);
179 static int mt7615_add_interface(struct ieee80211_hw
*hw
,
180 struct ieee80211_vif
*vif
)
182 struct mt7615_vif
*mvif
= (struct mt7615_vif
*)vif
->drv_priv
;
183 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
184 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
185 struct mt76_txq
*mtxq
;
186 bool ext_phy
= phy
!= &dev
->phy
;
189 mt7615_mutex_acquire(dev
);
191 mt76_testmode_reset(phy
->mt76
, true);
193 if (vif
->type
== NL80211_IFTYPE_MONITOR
&&
194 is_zero_ether_addr(vif
->addr
))
195 phy
->monitor_vif
= vif
;
197 mvif
->mt76
.idx
= __ffs64(~dev
->mt76
.vif_mask
);
198 if (mvif
->mt76
.idx
>= MT7615_MAX_INTERFACES
) {
203 idx
= get_omac_idx(vif
->type
, dev
->omac_mask
);
208 mvif
->mt76
.omac_idx
= idx
;
210 mvif
->mt76
.band_idx
= ext_phy
;
211 mvif
->mt76
.wmm_idx
= vif
->type
!= NL80211_IFTYPE_AP
;
213 mvif
->mt76
.wmm_idx
+= 2;
215 dev
->mt76
.vif_mask
|= BIT_ULL(mvif
->mt76
.idx
);
216 dev
->omac_mask
|= BIT_ULL(mvif
->mt76
.omac_idx
);
217 phy
->omac_mask
|= BIT_ULL(mvif
->mt76
.omac_idx
);
219 ret
= mt7615_mcu_set_dbdc(dev
);
223 idx
= MT7615_WTBL_RESERVED
- mvif
->mt76
.idx
;
225 INIT_LIST_HEAD(&mvif
->sta
.wcid
.poll_list
);
226 mvif
->sta
.wcid
.idx
= idx
;
227 mvif
->sta
.wcid
.phy_idx
= mvif
->mt76
.band_idx
;
228 mvif
->sta
.wcid
.hw_key_idx
= -1;
229 mt76_wcid_init(&mvif
->sta
.wcid
);
231 mt7615_mac_wtbl_update(dev
, idx
,
232 MT_WTBL_UPDATE_ADM_COUNT_CLEAR
);
234 rcu_assign_pointer(dev
->mt76
.wcid
[idx
], &mvif
->sta
.wcid
);
236 mtxq
= (struct mt76_txq
*)vif
->txq
->drv_priv
;
240 ret
= mt7615_mcu_add_dev_info(phy
, vif
, true);
242 mt7615_mutex_release(dev
);
247 static void mt7615_remove_interface(struct ieee80211_hw
*hw
,
248 struct ieee80211_vif
*vif
)
250 struct mt7615_vif
*mvif
= (struct mt7615_vif
*)vif
->drv_priv
;
251 struct mt7615_sta
*msta
= &mvif
->sta
;
252 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
253 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
254 int idx
= msta
->wcid
.idx
;
256 mt7615_mutex_acquire(dev
);
258 mt7615_mcu_add_bss_info(phy
, vif
, NULL
, false);
259 mt7615_mcu_sta_add(phy
, vif
, NULL
, false);
261 mt76_testmode_reset(phy
->mt76
, true);
262 if (vif
== phy
->monitor_vif
)
263 phy
->monitor_vif
= NULL
;
265 mt76_connac_free_pending_tx_skbs(&dev
->pm
, &msta
->wcid
);
267 mt7615_mcu_add_dev_info(phy
, vif
, false);
269 rcu_assign_pointer(dev
->mt76
.wcid
[idx
], NULL
);
271 dev
->mt76
.vif_mask
&= ~BIT_ULL(mvif
->mt76
.idx
);
272 dev
->omac_mask
&= ~BIT_ULL(mvif
->mt76
.omac_idx
);
273 phy
->omac_mask
&= ~BIT_ULL(mvif
->mt76
.omac_idx
);
275 mt7615_mutex_release(dev
);
277 spin_lock_bh(&dev
->mt76
.sta_poll_lock
);
278 if (!list_empty(&msta
->wcid
.poll_list
))
279 list_del_init(&msta
->wcid
.poll_list
);
280 spin_unlock_bh(&dev
->mt76
.sta_poll_lock
);
282 mt76_wcid_cleanup(&dev
->mt76
, &mvif
->sta
.wcid
);
285 int mt7615_set_channel(struct mt76_phy
*mphy
)
287 struct mt7615_phy
*phy
= mphy
->priv
;
288 struct mt7615_dev
*dev
= phy
->dev
;
289 bool ext_phy
= phy
!= &dev
->phy
;
292 mt76_connac_pm_wake(mphy
, &dev
->pm
);
294 if (is_mt7615(&dev
->mt76
) && dev
->flash_eeprom
) {
295 ret
= mt7615_mcu_apply_rx_dcoc(phy
);
299 ret
= mt7615_mcu_apply_tx_dpd(phy
);
304 ret
= mt7615_mcu_set_chan_info(phy
, MCU_EXT_CMD(CHANNEL_SWITCH
));
308 mt7615_mac_set_timing(phy
);
309 ret
= mt7615_dfs_init_radar_detector(phy
);
313 mt7615_mac_cca_stats_reset(phy
);
314 ret
= mt7615_mcu_set_sku_en(phy
, true);
318 mt7615_mac_reset_counters(phy
);
320 phy
->chfreq
= mt76_rr(dev
, MT_CHFREQ(ext_phy
));
323 mt76_connac_power_save_sched(mphy
, &dev
->pm
);
325 if (!mt76_testmode_enabled(phy
->mt76
)) {
326 unsigned long timeout
= mt7615_get_macwork_timeout(dev
);
328 ieee80211_queue_delayed_work(phy
->mt76
->hw
,
329 &phy
->mt76
->mac_work
, timeout
);
334 EXPORT_SYMBOL_GPL(mt7615_set_channel
);
336 static int mt7615_set_key(struct ieee80211_hw
*hw
, enum set_key_cmd cmd
,
337 struct ieee80211_vif
*vif
, struct ieee80211_sta
*sta
,
338 struct ieee80211_key_conf
*key
)
340 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
341 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
342 struct mt7615_vif
*mvif
= (struct mt7615_vif
*)vif
->drv_priv
;
343 struct mt7615_sta
*msta
= sta
? (struct mt7615_sta
*)sta
->drv_priv
:
345 struct mt76_wcid
*wcid
= &msta
->wcid
;
346 int idx
= key
->keyidx
, err
= 0;
347 u8
*wcid_keyidx
= &wcid
->hw_key_idx
;
349 /* The hardware does not support per-STA RX GTK, fallback
350 * to software mode for these.
352 if ((vif
->type
== NL80211_IFTYPE_ADHOC
||
353 vif
->type
== NL80211_IFTYPE_MESH_POINT
) &&
354 (key
->cipher
== WLAN_CIPHER_SUITE_TKIP
||
355 key
->cipher
== WLAN_CIPHER_SUITE_CCMP
) &&
356 !(key
->flags
& IEEE80211_KEY_FLAG_PAIRWISE
))
359 /* fall back to sw encryption for unsupported ciphers */
360 switch (key
->cipher
) {
361 case WLAN_CIPHER_SUITE_AES_CMAC
:
362 wcid_keyidx
= &wcid
->hw_key_idx2
;
363 key
->flags
|= IEEE80211_KEY_FLAG_GENERATE_MMIE
;
365 case WLAN_CIPHER_SUITE_TKIP
:
366 case WLAN_CIPHER_SUITE_CCMP
:
367 case WLAN_CIPHER_SUITE_CCMP_256
:
368 case WLAN_CIPHER_SUITE_GCMP
:
369 case WLAN_CIPHER_SUITE_GCMP_256
:
370 case WLAN_CIPHER_SUITE_SMS4
:
372 case WLAN_CIPHER_SUITE_WEP40
:
373 case WLAN_CIPHER_SUITE_WEP104
:
378 mt7615_mutex_acquire(dev
);
380 if (cmd
== SET_KEY
&& !sta
&& !mvif
->mt76
.cipher
) {
381 mvif
->mt76
.cipher
= mt76_connac_mcu_get_cipher(key
->cipher
);
382 mt7615_mcu_add_bss_info(phy
, vif
, NULL
, true);
388 if (idx
== *wcid_keyidx
)
393 mt76_wcid_key_setup(&dev
->mt76
, wcid
, key
);
394 if (mt76_is_mmio(&dev
->mt76
))
395 err
= mt7615_mac_wtbl_set_key(dev
, wcid
, key
);
397 err
= __mt7615_mac_wtbl_set_key(dev
, wcid
, key
);
400 mt7615_mutex_release(dev
);
405 static int mt7615_set_sar_specs(struct ieee80211_hw
*hw
,
406 const struct cfg80211_sar_specs
*sar
)
408 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
411 if (!cfg80211_chandef_valid(&phy
->mt76
->chandef
))
414 err
= mt76_init_sar_power(hw
, sar
);
418 if (mt7615_firmware_offload(phy
->dev
))
419 return mt76_connac_mcu_set_rate_txpower(phy
->mt76
);
421 return mt76_update_channel(phy
->mt76
);
424 static int mt7615_config(struct ieee80211_hw
*hw
, u32 changed
)
426 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
427 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
428 bool band
= phy
!= &dev
->phy
;
431 if (changed
& (IEEE80211_CONF_CHANGE_CHANNEL
|
432 IEEE80211_CONF_CHANGE_POWER
)) {
433 #ifdef CONFIG_NL80211_TESTMODE
434 if (phy
->mt76
->test
.state
!= MT76_TM_STATE_OFF
) {
435 mt7615_mutex_acquire(dev
);
436 mt76_testmode_reset(phy
->mt76
, false);
437 mt7615_mutex_release(dev
);
440 ret
= mt76_update_channel(phy
->mt76
);
443 mt7615_mutex_acquire(dev
);
445 if (changed
& IEEE80211_CONF_CHANGE_MONITOR
) {
446 mt76_testmode_reset(phy
->mt76
, true);
448 if (!(hw
->conf
.flags
& IEEE80211_CONF_MONITOR
))
449 phy
->rxfilter
|= MT_WF_RFCR_DROP_OTHER_UC
;
451 phy
->rxfilter
&= ~MT_WF_RFCR_DROP_OTHER_UC
;
453 mt76_wr(dev
, MT_WF_RFCR(band
), phy
->rxfilter
);
456 mt7615_mutex_release(dev
);
462 mt7615_conf_tx(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
,
463 unsigned int link_id
, u16 queue
,
464 const struct ieee80211_tx_queue_params
*params
)
466 struct mt76_vif
*mvif
= (struct mt76_vif
*)vif
->drv_priv
;
467 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
470 mt7615_mutex_acquire(dev
);
472 queue
= mt7615_lmac_mapping(dev
, queue
);
473 queue
+= mvif
->wmm_idx
* MT7615_MAX_WMM_SETS
;
474 err
= mt7615_mcu_set_wmm(dev
, queue
, params
);
476 mt7615_mutex_release(dev
);
481 static void mt7615_configure_filter(struct ieee80211_hw
*hw
,
482 unsigned int changed_flags
,
483 unsigned int *total_flags
,
486 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
487 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
488 bool band
= phy
!= &dev
->phy
;
490 u32 ctl_flags
= MT_WF_RFCR1_DROP_ACK
|
491 MT_WF_RFCR1_DROP_BF_POLL
|
492 MT_WF_RFCR1_DROP_BA
|
493 MT_WF_RFCR1_DROP_CFEND
|
494 MT_WF_RFCR1_DROP_CFACK
;
497 mt7615_mutex_acquire(dev
);
499 #define MT76_FILTER(_flag, _hw) do { \
500 flags |= *total_flags & FIF_##_flag; \
501 phy->rxfilter &= ~(_hw); \
502 if (!mt76_testmode_enabled(phy->mt76)) \
503 phy->rxfilter |= !(flags & FIF_##_flag) * (_hw);\
506 phy
->rxfilter
&= ~(MT_WF_RFCR_DROP_OTHER_BSS
|
507 MT_WF_RFCR_DROP_FRAME_REPORT
|
508 MT_WF_RFCR_DROP_PROBEREQ
|
509 MT_WF_RFCR_DROP_MCAST_FILTERED
|
510 MT_WF_RFCR_DROP_MCAST
|
511 MT_WF_RFCR_DROP_BCAST
|
512 MT_WF_RFCR_DROP_DUPLICATE
|
513 MT_WF_RFCR_DROP_A2_BSSID
|
514 MT_WF_RFCR_DROP_UNWANTED_CTL
|
515 MT_WF_RFCR_DROP_STBC_MULTI
);
517 if (phy
->n_beacon_vif
|| !mt7615_firmware_offload(dev
))
518 phy
->rxfilter
&= ~MT_WF_RFCR_DROP_OTHER_BEACON
;
520 MT76_FILTER(OTHER_BSS
, MT_WF_RFCR_DROP_OTHER_TIM
|
521 MT_WF_RFCR_DROP_A3_MAC
|
522 MT_WF_RFCR_DROP_A3_BSSID
);
524 MT76_FILTER(FCSFAIL
, MT_WF_RFCR_DROP_FCSFAIL
);
526 MT76_FILTER(CONTROL
, MT_WF_RFCR_DROP_CTS
|
527 MT_WF_RFCR_DROP_RTS
|
528 MT_WF_RFCR_DROP_CTL_RSV
|
529 MT_WF_RFCR_DROP_NDPA
);
531 *total_flags
= flags
;
532 mt76_wr(dev
, MT_WF_RFCR(band
), phy
->rxfilter
);
534 if (*total_flags
& FIF_CONTROL
)
535 mt76_clear(dev
, MT_WF_RFCR1(band
), ctl_flags
);
537 mt76_set(dev
, MT_WF_RFCR1(band
), ctl_flags
);
539 mt7615_mutex_release(dev
);
543 mt7615_update_mu_group(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
,
544 struct ieee80211_bss_conf
*info
)
546 struct mt7615_vif
*mvif
= (struct mt7615_vif
*)vif
->drv_priv
;
547 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
548 u8 i
, band
= mvif
->mt76
.band_idx
;
551 mu
= (u32
*)info
->mu_group
.membership
;
552 for (i
= 0; i
< WLAN_MEMBERSHIP_LEN
/ sizeof(*mu
); i
++) {
553 if (is_mt7663(&dev
->mt76
))
554 mt76_wr(dev
, MT7663_WF_PHY_GID_TAB_VLD(band
, i
), mu
[i
]);
556 mt76_wr(dev
, MT_WF_PHY_GID_TAB_VLD(band
, i
), mu
[i
]);
559 mu
= (u32
*)info
->mu_group
.position
;
560 for (i
= 0; i
< WLAN_USER_POSITION_LEN
/ sizeof(*mu
); i
++) {
561 if (is_mt7663(&dev
->mt76
))
562 mt76_wr(dev
, MT7663_WF_PHY_GID_TAB_POS(band
, i
), mu
[i
]);
564 mt76_wr(dev
, MT_WF_PHY_GID_TAB_POS(band
, i
), mu
[i
]);
568 static void mt7615_bss_info_changed(struct ieee80211_hw
*hw
,
569 struct ieee80211_vif
*vif
,
570 struct ieee80211_bss_conf
*info
,
573 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
574 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
576 mt7615_mutex_acquire(dev
);
578 if (changed
& BSS_CHANGED_ERP_SLOT
) {
579 int slottime
= info
->use_short_slot
? 9 : 20;
581 if (slottime
!= phy
->slottime
) {
582 phy
->slottime
= slottime
;
583 mt7615_mac_set_timing(phy
);
587 if (changed
& BSS_CHANGED_ERP_CTS_PROT
)
588 mt7615_mac_enable_rtscts(dev
, vif
, info
->use_cts_prot
);
590 if (changed
& BSS_CHANGED_BEACON_ENABLED
&& info
->enable_beacon
) {
591 mt7615_mcu_add_bss_info(phy
, vif
, NULL
, true);
592 mt7615_mcu_sta_add(phy
, vif
, NULL
, true);
594 if (mt7615_firmware_offload(dev
) && vif
->p2p
)
595 mt76_connac_mcu_set_p2p_oppps(hw
, vif
);
598 if (changed
& (BSS_CHANGED_BEACON
|
599 BSS_CHANGED_BEACON_ENABLED
))
600 mt7615_mcu_add_beacon(dev
, hw
, vif
, info
->enable_beacon
);
602 if (changed
& BSS_CHANGED_PS
)
603 mt76_connac_mcu_set_vif_ps(&dev
->mt76
, vif
);
605 if ((changed
& BSS_CHANGED_ARP_FILTER
) &&
606 mt7615_firmware_offload(dev
)) {
607 struct mt7615_vif
*mvif
= (struct mt7615_vif
*)vif
->drv_priv
;
609 mt76_connac_mcu_update_arp_filter(&dev
->mt76
, &mvif
->mt76
,
613 if (changed
& BSS_CHANGED_ASSOC
)
614 mt7615_mac_set_beacon_filter(phy
, vif
, vif
->cfg
.assoc
);
616 if (changed
& BSS_CHANGED_MU_GROUPS
)
617 mt7615_update_mu_group(hw
, vif
, info
);
619 mt7615_mutex_release(dev
);
623 mt7615_channel_switch_beacon(struct ieee80211_hw
*hw
,
624 struct ieee80211_vif
*vif
,
625 struct cfg80211_chan_def
*chandef
)
627 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
629 mt7615_mutex_acquire(dev
);
630 mt7615_mcu_add_beacon(dev
, hw
, vif
, true);
631 mt7615_mutex_release(dev
);
634 int mt7615_mac_sta_add(struct mt76_dev
*mdev
, struct ieee80211_vif
*vif
,
635 struct ieee80211_sta
*sta
)
637 struct mt7615_dev
*dev
= container_of(mdev
, struct mt7615_dev
, mt76
);
638 struct mt7615_sta
*msta
= (struct mt7615_sta
*)sta
->drv_priv
;
639 struct mt7615_vif
*mvif
= (struct mt7615_vif
*)vif
->drv_priv
;
640 struct mt7615_phy
*phy
;
643 idx
= mt76_wcid_alloc(dev
->mt76
.wcid_mask
, MT7615_WTBL_STA
- 1);
647 INIT_LIST_HEAD(&msta
->wcid
.poll_list
);
650 msta
->wcid
.idx
= idx
;
651 msta
->wcid
.phy_idx
= mvif
->mt76
.band_idx
;
653 phy
= mvif
->mt76
.band_idx
? mt7615_ext_phy(dev
) : &dev
->phy
;
654 err
= mt76_connac_pm_wake(phy
->mt76
, &dev
->pm
);
658 if (vif
->type
== NL80211_IFTYPE_STATION
&& !sta
->tdls
) {
659 err
= mt7615_mcu_add_bss_info(phy
, vif
, sta
, true);
664 mt7615_mac_wtbl_update(dev
, idx
,
665 MT_WTBL_UPDATE_ADM_COUNT_CLEAR
);
666 err
= mt7615_mcu_sta_add(&dev
->phy
, vif
, sta
, true);
670 mt76_connac_power_save_sched(phy
->mt76
, &dev
->pm
);
674 EXPORT_SYMBOL_GPL(mt7615_mac_sta_add
);
676 void mt7615_mac_sta_remove(struct mt76_dev
*mdev
, struct ieee80211_vif
*vif
,
677 struct ieee80211_sta
*sta
)
679 struct mt7615_dev
*dev
= container_of(mdev
, struct mt7615_dev
, mt76
);
680 struct mt7615_sta
*msta
= (struct mt7615_sta
*)sta
->drv_priv
;
681 struct mt7615_vif
*mvif
= (struct mt7615_vif
*)vif
->drv_priv
;
682 struct mt7615_phy
*phy
;
684 mt76_connac_free_pending_tx_skbs(&dev
->pm
, &msta
->wcid
);
686 phy
= mvif
->mt76
.band_idx
? mt7615_ext_phy(dev
) : &dev
->phy
;
687 mt76_connac_pm_wake(phy
->mt76
, &dev
->pm
);
689 mt7615_mcu_sta_add(&dev
->phy
, vif
, sta
, false);
690 mt7615_mac_wtbl_update(dev
, msta
->wcid
.idx
,
691 MT_WTBL_UPDATE_ADM_COUNT_CLEAR
);
692 if (vif
->type
== NL80211_IFTYPE_STATION
&& !sta
->tdls
)
693 mt7615_mcu_add_bss_info(phy
, vif
, sta
, false);
695 spin_lock_bh(&mdev
->sta_poll_lock
);
696 if (!list_empty(&msta
->wcid
.poll_list
))
697 list_del_init(&msta
->wcid
.poll_list
);
698 spin_unlock_bh(&mdev
->sta_poll_lock
);
700 mt76_connac_power_save_sched(phy
->mt76
, &dev
->pm
);
702 EXPORT_SYMBOL_GPL(mt7615_mac_sta_remove
);
704 static void mt7615_sta_rate_tbl_update(struct ieee80211_hw
*hw
,
705 struct ieee80211_vif
*vif
,
706 struct ieee80211_sta
*sta
)
708 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
709 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
710 struct mt7615_sta
*msta
= (struct mt7615_sta
*)sta
->drv_priv
;
711 struct ieee80211_sta_rates
*sta_rates
= rcu_dereference(sta
->rates
);
717 spin_lock_bh(&dev
->mt76
.lock
);
718 for (i
= 0; i
< ARRAY_SIZE(msta
->rates
); i
++) {
719 msta
->rates
[i
].idx
= sta_rates
->rate
[i
].idx
;
720 msta
->rates
[i
].count
= sta_rates
->rate
[i
].count
;
721 msta
->rates
[i
].flags
= sta_rates
->rate
[i
].flags
;
723 if (msta
->rates
[i
].idx
< 0 || !msta
->rates
[i
].count
)
727 if (mt76_connac_pm_ref(phy
->mt76
, &dev
->pm
)) {
728 mt7615_mac_set_rates(phy
, msta
, NULL
, msta
->rates
);
729 mt76_connac_pm_unref(phy
->mt76
, &dev
->pm
);
731 spin_unlock_bh(&dev
->mt76
.lock
);
734 void mt7615_tx_worker(struct mt76_worker
*w
)
736 struct mt7615_dev
*dev
= container_of(w
, struct mt7615_dev
,
739 if (!mt76_connac_pm_ref(&dev
->mphy
, &dev
->pm
)) {
740 queue_work(dev
->mt76
.wq
, &dev
->pm
.wake_work
);
744 mt76_tx_worker_run(&dev
->mt76
);
745 mt76_connac_pm_unref(&dev
->mphy
, &dev
->pm
);
748 static void mt7615_tx(struct ieee80211_hw
*hw
,
749 struct ieee80211_tx_control
*control
,
752 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
753 struct mt76_phy
*mphy
= hw
->priv
;
754 struct ieee80211_tx_info
*info
= IEEE80211_SKB_CB(skb
);
755 struct ieee80211_vif
*vif
= info
->control
.vif
;
756 struct mt76_wcid
*wcid
= &dev
->mt76
.global_wcid
;
757 struct mt7615_sta
*msta
= NULL
;
761 msta
= (struct mt7615_sta
*)control
->sta
->drv_priv
;
765 if (vif
&& !control
->sta
) {
766 struct mt7615_vif
*mvif
;
768 mvif
= (struct mt7615_vif
*)vif
->drv_priv
;
773 if (mt76_connac_pm_ref(mphy
, &dev
->pm
)) {
774 mt76_tx(mphy
, control
->sta
, wcid
, skb
);
775 mt76_connac_pm_unref(mphy
, &dev
->pm
);
779 qid
= skb_get_queue_mapping(skb
);
780 if (qid
>= MT_TXQ_PSD
) {
781 qid
= IEEE80211_AC_BE
;
782 skb_set_queue_mapping(skb
, qid
);
785 mt76_connac_pm_queue_skb(hw
, &dev
->pm
, wcid
, skb
);
788 static int mt7615_set_rts_threshold(struct ieee80211_hw
*hw
, u32 val
)
790 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
791 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
792 int err
, band
= phy
!= &dev
->phy
;
794 mt7615_mutex_acquire(dev
);
795 err
= mt76_connac_mcu_set_rts_thresh(&dev
->mt76
, val
, band
);
796 mt7615_mutex_release(dev
);
802 mt7615_ampdu_action(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
,
803 struct ieee80211_ampdu_params
*params
)
805 enum ieee80211_ampdu_mlme_action action
= params
->action
;
806 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
807 struct ieee80211_sta
*sta
= params
->sta
;
808 struct ieee80211_txq
*txq
= sta
->txq
[params
->tid
];
809 struct mt7615_sta
*msta
= (struct mt7615_sta
*)sta
->drv_priv
;
810 u16 tid
= params
->tid
;
811 u16 ssn
= params
->ssn
;
812 struct mt76_txq
*mtxq
;
818 mtxq
= (struct mt76_txq
*)txq
->drv_priv
;
820 mt7615_mutex_acquire(dev
);
823 case IEEE80211_AMPDU_RX_START
:
824 mt76_rx_aggr_start(&dev
->mt76
, &msta
->wcid
, tid
, ssn
,
826 ret
= mt7615_mcu_add_rx_ba(dev
, params
, true);
828 case IEEE80211_AMPDU_RX_STOP
:
829 mt76_rx_aggr_stop(&dev
->mt76
, &msta
->wcid
, tid
);
830 ret
= mt7615_mcu_add_rx_ba(dev
, params
, false);
832 case IEEE80211_AMPDU_TX_OPERATIONAL
:
834 mtxq
->send_bar
= false;
835 ret
= mt7615_mcu_add_tx_ba(dev
, params
, true);
836 ssn
= mt7615_mac_get_sta_tid_sn(dev
, msta
->wcid
.idx
, tid
);
837 ieee80211_send_bar(vif
, sta
->addr
, tid
,
838 IEEE80211_SN_TO_SEQ(ssn
));
840 case IEEE80211_AMPDU_TX_STOP_FLUSH
:
841 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT
:
843 ret
= mt7615_mcu_add_tx_ba(dev
, params
, false);
845 case IEEE80211_AMPDU_TX_START
:
846 ssn
= mt7615_mac_get_sta_tid_sn(dev
, msta
->wcid
.idx
, tid
);
848 ret
= IEEE80211_AMPDU_TX_START_IMMEDIATE
;
850 case IEEE80211_AMPDU_TX_STOP_CONT
:
852 ret
= mt7615_mcu_add_tx_ba(dev
, params
, false);
853 ieee80211_stop_tx_ba_cb_irqsafe(vif
, sta
->addr
, tid
);
856 mt7615_mutex_release(dev
);
862 mt7615_sta_add(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
,
863 struct ieee80211_sta
*sta
)
865 return mt76_sta_state(hw
, vif
, sta
, IEEE80211_STA_NOTEXIST
,
870 mt7615_sta_remove(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
,
871 struct ieee80211_sta
*sta
)
873 return mt76_sta_state(hw
, vif
, sta
, IEEE80211_STA_NONE
,
874 IEEE80211_STA_NOTEXIST
);
878 mt7615_get_stats(struct ieee80211_hw
*hw
,
879 struct ieee80211_low_level_stats
*stats
)
881 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
882 struct mib_stats
*mib
= &phy
->mib
;
884 mt7615_mutex_acquire(phy
->dev
);
886 stats
->dot11RTSSuccessCount
= mib
->rts_cnt
;
887 stats
->dot11RTSFailureCount
= mib
->rts_retries_cnt
;
888 stats
->dot11FCSErrorCount
= mib
->fcs_err_cnt
;
889 stats
->dot11ACKFailureCount
= mib
->ack_fail_cnt
;
891 mt7615_mutex_release(phy
->dev
);
897 mt7615_get_tsf(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
)
899 struct mt7615_vif
*mvif
= (struct mt7615_vif
*)vif
->drv_priv
;
900 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
905 u16 idx
= mvif
->mt76
.omac_idx
;
908 idx
= idx
> HW_BSSID_MAX
? HW_BSSID_0
: idx
;
909 reg
= idx
> 1 ? MT_LPON_TCR2(idx
): MT_LPON_TCR0(idx
);
911 mt7615_mutex_acquire(dev
);
914 mt76_rmw(dev
, reg
, MT_LPON_TCR_MODE
, MT_LPON_TCR_READ
);
915 tsf
.t32
[0] = mt76_rr(dev
, MT_LPON_UTTR0
);
916 tsf
.t32
[1] = mt76_rr(dev
, MT_LPON_UTTR1
);
918 mt7615_mutex_release(dev
);
924 mt7615_set_tsf(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
,
927 struct mt7615_vif
*mvif
= (struct mt7615_vif
*)vif
->drv_priv
;
928 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
932 } tsf
= { .t64
= timestamp
, };
933 u16 idx
= mvif
->mt76
.omac_idx
;
936 idx
= idx
> HW_BSSID_MAX
? HW_BSSID_0
: idx
;
937 reg
= idx
> 1 ? MT_LPON_TCR2(idx
): MT_LPON_TCR0(idx
);
939 mt7615_mutex_acquire(dev
);
941 mt76_wr(dev
, MT_LPON_UTTR0
, tsf
.t32
[0]);
942 mt76_wr(dev
, MT_LPON_UTTR1
, tsf
.t32
[1]);
943 /* TSF software overwrite */
944 mt76_rmw(dev
, reg
, MT_LPON_TCR_MODE
, MT_LPON_TCR_WRITE
);
946 mt7615_mutex_release(dev
);
950 mt7615_offset_tsf(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
,
953 struct mt7615_vif
*mvif
= (struct mt7615_vif
*)vif
->drv_priv
;
954 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
958 } tsf
= { .t64
= timestamp
, };
959 u16 idx
= mvif
->mt76
.omac_idx
;
962 idx
= idx
> HW_BSSID_MAX
? HW_BSSID_0
: idx
;
963 reg
= idx
> 1 ? MT_LPON_TCR2(idx
): MT_LPON_TCR0(idx
);
965 mt7615_mutex_acquire(dev
);
967 mt76_wr(dev
, MT_LPON_UTTR0
, tsf
.t32
[0]);
968 mt76_wr(dev
, MT_LPON_UTTR1
, tsf
.t32
[1]);
969 /* TSF software adjust*/
970 mt76_rmw(dev
, reg
, MT_LPON_TCR_MODE
, MT_LPON_TCR_ADJUST
);
972 mt7615_mutex_release(dev
);
976 mt7615_set_coverage_class(struct ieee80211_hw
*hw
, s16 coverage_class
)
978 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
979 struct mt7615_dev
*dev
= phy
->dev
;
981 mt7615_mutex_acquire(dev
);
982 phy
->coverage_class
= max_t(s16
, coverage_class
, 0);
983 mt7615_mac_set_timing(phy
);
984 mt7615_mutex_release(dev
);
988 mt7615_set_antenna(struct ieee80211_hw
*hw
, u32 tx_ant
, u32 rx_ant
)
990 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
991 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
992 int max_nss
= hweight8(hw
->wiphy
->available_antennas_tx
);
993 bool ext_phy
= phy
!= &dev
->phy
;
995 if (!tx_ant
|| tx_ant
!= rx_ant
|| ffs(tx_ant
) > max_nss
)
998 if ((BIT(hweight8(tx_ant
)) - 1) != tx_ant
)
999 tx_ant
= BIT(ffs(tx_ant
) - 1) - 1;
1001 mt7615_mutex_acquire(dev
);
1003 phy
->mt76
->antenna_mask
= tx_ant
;
1005 if (dev
->chainmask
== 0xf)
1010 phy
->mt76
->chainmask
= tx_ant
;
1012 mt76_set_stream_caps(phy
->mt76
, true);
1014 mt7615_mutex_release(dev
);
1019 static void mt7615_roc_iter(void *priv
, u8
*mac
,
1020 struct ieee80211_vif
*vif
)
1022 struct mt7615_phy
*phy
= priv
;
1024 mt7615_mcu_set_roc(phy
, vif
, NULL
, 0);
1027 void mt7615_roc_work(struct work_struct
*work
)
1029 struct mt7615_phy
*phy
;
1031 phy
= (struct mt7615_phy
*)container_of(work
, struct mt7615_phy
,
1034 if (!test_and_clear_bit(MT76_STATE_ROC
, &phy
->mt76
->state
))
1037 mt7615_mutex_acquire(phy
->dev
);
1038 ieee80211_iterate_active_interfaces(phy
->mt76
->hw
,
1039 IEEE80211_IFACE_ITER_RESUME_ALL
,
1040 mt7615_roc_iter
, phy
);
1041 mt7615_mutex_release(phy
->dev
);
1042 ieee80211_remain_on_channel_expired(phy
->mt76
->hw
);
1045 void mt7615_roc_timer(struct timer_list
*timer
)
1047 struct mt7615_phy
*phy
= from_timer(phy
, timer
, roc_timer
);
1049 ieee80211_queue_work(phy
->mt76
->hw
, &phy
->roc_work
);
1052 void mt7615_scan_work(struct work_struct
*work
)
1054 struct mt7615_phy
*phy
;
1056 phy
= (struct mt7615_phy
*)container_of(work
, struct mt7615_phy
,
1060 struct mt7615_mcu_rxd
*rxd
;
1061 struct sk_buff
*skb
;
1063 spin_lock_bh(&phy
->dev
->mt76
.lock
);
1064 skb
= __skb_dequeue(&phy
->scan_event_list
);
1065 spin_unlock_bh(&phy
->dev
->mt76
.lock
);
1070 rxd
= (struct mt7615_mcu_rxd
*)skb
->data
;
1071 if (rxd
->eid
== MCU_EVENT_SCHED_SCAN_DONE
) {
1072 ieee80211_sched_scan_results(phy
->mt76
->hw
);
1073 } else if (test_and_clear_bit(MT76_HW_SCANNING
,
1074 &phy
->mt76
->state
)) {
1075 struct cfg80211_scan_info info
= {
1079 ieee80211_scan_completed(phy
->mt76
->hw
, &info
);
1086 mt7615_hw_scan(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
,
1087 struct ieee80211_scan_request
*req
)
1089 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
1090 struct mt76_phy
*mphy
= hw
->priv
;
1093 /* fall-back to sw-scan */
1094 if (!mt7615_firmware_offload(dev
))
1097 mt7615_mutex_acquire(dev
);
1098 err
= mt76_connac_mcu_hw_scan(mphy
, vif
, req
);
1099 mt7615_mutex_release(dev
);
1105 mt7615_cancel_hw_scan(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
)
1107 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
1108 struct mt76_phy
*mphy
= hw
->priv
;
1110 mt7615_mutex_acquire(dev
);
1111 mt76_connac_mcu_cancel_hw_scan(mphy
, vif
);
1112 mt7615_mutex_release(dev
);
1116 mt7615_start_sched_scan(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
,
1117 struct cfg80211_sched_scan_request
*req
,
1118 struct ieee80211_scan_ies
*ies
)
1120 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
1121 struct mt76_phy
*mphy
= hw
->priv
;
1124 if (!mt7615_firmware_offload(dev
))
1127 mt7615_mutex_acquire(dev
);
1129 err
= mt76_connac_mcu_sched_scan_req(mphy
, vif
, req
);
1133 err
= mt76_connac_mcu_sched_scan_enable(mphy
, vif
, true);
1135 mt7615_mutex_release(dev
);
1141 mt7615_stop_sched_scan(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
)
1143 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
1144 struct mt76_phy
*mphy
= hw
->priv
;
1147 if (!mt7615_firmware_offload(dev
))
1150 mt7615_mutex_acquire(dev
);
1151 err
= mt76_connac_mcu_sched_scan_enable(mphy
, vif
, false);
1152 mt7615_mutex_release(dev
);
1157 static int mt7615_remain_on_channel(struct ieee80211_hw
*hw
,
1158 struct ieee80211_vif
*vif
,
1159 struct ieee80211_channel
*chan
,
1161 enum ieee80211_roc_type type
)
1163 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
1166 if (test_and_set_bit(MT76_STATE_ROC
, &phy
->mt76
->state
))
1169 mt7615_mutex_acquire(phy
->dev
);
1171 err
= mt7615_mcu_set_roc(phy
, vif
, chan
, duration
);
1173 clear_bit(MT76_STATE_ROC
, &phy
->mt76
->state
);
1177 if (!wait_event_timeout(phy
->roc_wait
, phy
->roc_grant
, HZ
)) {
1178 mt7615_mcu_set_roc(phy
, vif
, NULL
, 0);
1179 clear_bit(MT76_STATE_ROC
, &phy
->mt76
->state
);
1184 mt7615_mutex_release(phy
->dev
);
1189 static int mt7615_cancel_remain_on_channel(struct ieee80211_hw
*hw
,
1190 struct ieee80211_vif
*vif
)
1192 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
1195 if (!test_and_clear_bit(MT76_STATE_ROC
, &phy
->mt76
->state
))
1198 del_timer_sync(&phy
->roc_timer
);
1199 cancel_work_sync(&phy
->roc_work
);
1201 mt7615_mutex_acquire(phy
->dev
);
1202 err
= mt7615_mcu_set_roc(phy
, vif
, NULL
, 0);
1203 mt7615_mutex_release(phy
->dev
);
1208 static void mt7615_sta_set_decap_offload(struct ieee80211_hw
*hw
,
1209 struct ieee80211_vif
*vif
,
1210 struct ieee80211_sta
*sta
,
1213 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
1214 struct mt7615_sta
*msta
= (struct mt7615_sta
*)sta
->drv_priv
;
1216 mt7615_mutex_acquire(dev
);
1219 set_bit(MT_WCID_FLAG_HDR_TRANS
, &msta
->wcid
.flags
);
1221 clear_bit(MT_WCID_FLAG_HDR_TRANS
, &msta
->wcid
.flags
);
1223 mt7615_mcu_set_sta_decap_offload(dev
, vif
, sta
);
1225 mt7615_mutex_release(dev
);
1229 static int mt7615_suspend(struct ieee80211_hw
*hw
,
1230 struct cfg80211_wowlan
*wowlan
)
1232 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
1233 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
1236 cancel_delayed_work_sync(&dev
->pm
.ps_work
);
1237 mt76_connac_free_pending_tx_skbs(&dev
->pm
, NULL
);
1239 mt7615_mutex_acquire(dev
);
1241 clear_bit(MT76_STATE_RUNNING
, &phy
->mt76
->state
);
1242 cancel_delayed_work_sync(&phy
->scan_work
);
1243 cancel_delayed_work_sync(&phy
->mt76
->mac_work
);
1245 set_bit(MT76_STATE_SUSPEND
, &phy
->mt76
->state
);
1246 ieee80211_iterate_active_interfaces(hw
,
1247 IEEE80211_IFACE_ITER_RESUME_ALL
,
1248 mt76_connac_mcu_set_suspend_iter
,
1251 if (!mt7615_dev_running(dev
))
1252 err
= mt76_connac_mcu_set_hif_suspend(&dev
->mt76
, true);
1254 mt7615_mutex_release(dev
);
1259 static int mt7615_resume(struct ieee80211_hw
*hw
)
1261 struct mt7615_phy
*phy
= mt7615_hw_phy(hw
);
1262 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
1263 unsigned long timeout
;
1266 mt7615_mutex_acquire(dev
);
1268 running
= mt7615_dev_running(dev
);
1269 set_bit(MT76_STATE_RUNNING
, &phy
->mt76
->state
);
1274 err
= mt76_connac_mcu_set_hif_suspend(&dev
->mt76
, false);
1276 mt7615_mutex_release(dev
);
1281 clear_bit(MT76_STATE_SUSPEND
, &phy
->mt76
->state
);
1282 ieee80211_iterate_active_interfaces(hw
,
1283 IEEE80211_IFACE_ITER_RESUME_ALL
,
1284 mt76_connac_mcu_set_suspend_iter
,
1287 timeout
= mt7615_get_macwork_timeout(dev
);
1288 ieee80211_queue_delayed_work(hw
, &phy
->mt76
->mac_work
, timeout
);
1290 mt7615_mutex_release(dev
);
1295 static void mt7615_set_wakeup(struct ieee80211_hw
*hw
, bool enabled
)
1297 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
1298 struct mt76_dev
*mdev
= &dev
->mt76
;
1300 device_set_wakeup_enable(mdev
->dev
, enabled
);
1303 static void mt7615_set_rekey_data(struct ieee80211_hw
*hw
,
1304 struct ieee80211_vif
*vif
,
1305 struct cfg80211_gtk_rekey_data
*data
)
1307 struct mt7615_dev
*dev
= mt7615_hw_dev(hw
);
1309 mt7615_mutex_acquire(dev
);
1310 mt76_connac_mcu_update_gtk_rekey(hw
, vif
, data
);
1311 mt7615_mutex_release(dev
);
1313 #endif /* CONFIG_PM */
1315 const struct ieee80211_ops mt7615_ops
= {
1316 .add_chanctx
= ieee80211_emulate_add_chanctx
,
1317 .remove_chanctx
= ieee80211_emulate_remove_chanctx
,
1318 .change_chanctx
= ieee80211_emulate_change_chanctx
,
1319 .switch_vif_chanctx
= ieee80211_emulate_switch_vif_chanctx
,
1321 .start
= mt7615_start
,
1322 .stop
= mt7615_stop
,
1323 .add_interface
= mt7615_add_interface
,
1324 .remove_interface
= mt7615_remove_interface
,
1325 .config
= mt7615_config
,
1326 .conf_tx
= mt7615_conf_tx
,
1327 .configure_filter
= mt7615_configure_filter
,
1328 .bss_info_changed
= mt7615_bss_info_changed
,
1329 .sta_add
= mt7615_sta_add
,
1330 .sta_remove
= mt7615_sta_remove
,
1331 .sta_pre_rcu_remove
= mt76_sta_pre_rcu_remove
,
1332 .set_key
= mt7615_set_key
,
1333 .sta_set_decap_offload
= mt7615_sta_set_decap_offload
,
1334 .ampdu_action
= mt7615_ampdu_action
,
1335 .set_rts_threshold
= mt7615_set_rts_threshold
,
1336 .wake_tx_queue
= mt76_wake_tx_queue
,
1337 .sta_rate_tbl_update
= mt7615_sta_rate_tbl_update
,
1338 .sw_scan_start
= mt76_sw_scan
,
1339 .sw_scan_complete
= mt76_sw_scan_complete
,
1340 .release_buffered_frames
= mt76_release_buffered_frames
,
1341 .get_txpower
= mt76_get_txpower
,
1342 .channel_switch_beacon
= mt7615_channel_switch_beacon
,
1343 .get_stats
= mt7615_get_stats
,
1344 .get_tsf
= mt7615_get_tsf
,
1345 .set_tsf
= mt7615_set_tsf
,
1346 .offset_tsf
= mt7615_offset_tsf
,
1347 .get_survey
= mt76_get_survey
,
1348 .get_antenna
= mt76_get_antenna
,
1349 .set_antenna
= mt7615_set_antenna
,
1350 .set_coverage_class
= mt7615_set_coverage_class
,
1351 .hw_scan
= mt7615_hw_scan
,
1352 .cancel_hw_scan
= mt7615_cancel_hw_scan
,
1353 .sched_scan_start
= mt7615_start_sched_scan
,
1354 .sched_scan_stop
= mt7615_stop_sched_scan
,
1355 .remain_on_channel
= mt7615_remain_on_channel
,
1356 .cancel_remain_on_channel
= mt7615_cancel_remain_on_channel
,
1357 CFG80211_TESTMODE_CMD(mt76_testmode_cmd
)
1358 CFG80211_TESTMODE_DUMP(mt76_testmode_dump
)
1360 .suspend
= mt7615_suspend
,
1361 .resume
= mt7615_resume
,
1362 .set_wakeup
= mt7615_set_wakeup
,
1363 .set_rekey_data
= mt7615_set_rekey_data
,
1364 #endif /* CONFIG_PM */
1365 .set_sar_specs
= mt7615_set_sar_specs
,
1367 EXPORT_SYMBOL_GPL(mt7615_ops
);
1369 MODULE_DESCRIPTION("MediaTek MT7615E and MT7663E wireless driver");
1370 MODULE_LICENSE("Dual BSD/GPL");