Lines Matching +full:assoc +full:- +full:select
1 // SPDX-License-Identifier: ISC
15 if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state)) in mt7915_dev_running()
20 return phy && test_bit(MT76_STATE_RUNNING, &phy->mt76->state); in mt7915_dev_running()
30 flush_work(&dev->init_work); in mt7915_start()
32 mutex_lock(&dev->mt76.mutex); in mt7915_start()
37 ret = mt76_connac_mcu_set_pm(&dev->mt76, 0, 0); in mt7915_start()
48 if (phy != &dev->phy || phy->band_idx) { in mt7915_start()
49 ret = mt76_connac_mcu_set_pm(&dev->mt76, 1, 0); in mt7915_start()
60 ret = mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b, in mt7915_start()
61 phy != &dev->phy); in mt7915_start()
73 set_bit(MT76_STATE_RUNNING, &phy->mt76->state); in mt7915_start()
75 if (!mt76_testmode_enabled(phy->mt76)) in mt7915_start()
76 ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work, in mt7915_start()
83 mutex_unlock(&dev->mt76.mutex); in mt7915_start()
93 cancel_delayed_work_sync(&phy->mt76->mac_work); in mt7915_stop()
95 mutex_lock(&dev->mt76.mutex); in mt7915_stop()
97 mt76_testmode_reset(phy->mt76, true); in mt7915_stop()
99 clear_bit(MT76_STATE_RUNNING, &phy->mt76->state); in mt7915_stop()
101 if (phy != &dev->phy) { in mt7915_stop()
102 mt76_connac_mcu_set_pm(&dev->mt76, 1, 1); in mt7915_stop()
107 mt76_connac_mcu_set_pm(&dev->mt76, 0, 1); in mt7915_stop()
111 mutex_unlock(&dev->mt76.mutex); in mt7915_stop()
127 /* prefer hw bssid slot 1-3 */ in get_omac_idx()
130 return i - 1; in get_omac_idx()
137 return i - 1; in get_omac_idx()
151 return i - 1; in get_omac_idx()
159 return -1; in get_omac_idx()
164 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_init_bitrate_mask()
167 for (i = 0; i < ARRAY_SIZE(mvif->bitrate_mask.control); i++) { in mt7915_init_bitrate_mask()
168 mvif->bitrate_mask.control[i].gi = NL80211_TXRATE_DEFAULT_GI; in mt7915_init_bitrate_mask()
169 mvif->bitrate_mask.control[i].he_gi = 0xff; in mt7915_init_bitrate_mask()
170 mvif->bitrate_mask.control[i].he_ltf = 0xff; in mt7915_init_bitrate_mask()
171 mvif->bitrate_mask.control[i].legacy = GENMASK(31, 0); in mt7915_init_bitrate_mask()
172 memset(mvif->bitrate_mask.control[i].ht_mcs, 0xff, in mt7915_init_bitrate_mask()
173 sizeof(mvif->bitrate_mask.control[i].ht_mcs)); in mt7915_init_bitrate_mask()
174 memset(mvif->bitrate_mask.control[i].vht_mcs, 0xff, in mt7915_init_bitrate_mask()
175 sizeof(mvif->bitrate_mask.control[i].vht_mcs)); in mt7915_init_bitrate_mask()
176 memset(mvif->bitrate_mask.control[i].he_mcs, 0xff, in mt7915_init_bitrate_mask()
177 sizeof(mvif->bitrate_mask.control[i].he_mcs)); in mt7915_init_bitrate_mask()
184 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_add_interface()
188 bool ext_phy = phy != &dev->phy; in mt7915_add_interface()
191 mutex_lock(&dev->mt76.mutex); in mt7915_add_interface()
193 mt76_testmode_reset(phy->mt76, true); in mt7915_add_interface()
195 if (vif->type == NL80211_IFTYPE_MONITOR && in mt7915_add_interface()
196 is_zero_ether_addr(vif->addr)) in mt7915_add_interface()
197 phy->monitor_vif = vif; in mt7915_add_interface()
199 mvif->mt76.idx = __ffs64(~dev->mt76.vif_mask); in mt7915_add_interface()
200 if (mvif->mt76.idx >= (MT7915_MAX_INTERFACES << dev->dbdc_support)) { in mt7915_add_interface()
201 ret = -ENOSPC; in mt7915_add_interface()
205 idx = get_omac_idx(vif->type, phy->omac_mask); in mt7915_add_interface()
207 ret = -ENOSPC; in mt7915_add_interface()
210 mvif->mt76.omac_idx = idx; in mt7915_add_interface()
211 mvif->phy = phy; in mt7915_add_interface()
212 mvif->mt76.band_idx = phy->band_idx; in mt7915_add_interface()
214 mvif->mt76.wmm_idx = vif->type != NL80211_IFTYPE_AP; in mt7915_add_interface()
216 mvif->mt76.wmm_idx += 2; in mt7915_add_interface()
222 dev->mt76.vif_mask |= BIT_ULL(mvif->mt76.idx); in mt7915_add_interface()
223 phy->omac_mask |= BIT_ULL(mvif->mt76.omac_idx); in mt7915_add_interface()
225 idx = MT7915_WTBL_RESERVED - mvif->mt76.idx; in mt7915_add_interface()
227 INIT_LIST_HEAD(&mvif->sta.rc_list); in mt7915_add_interface()
228 INIT_LIST_HEAD(&mvif->sta.poll_list); in mt7915_add_interface()
229 mvif->sta.wcid.idx = idx; in mt7915_add_interface()
230 mvif->sta.wcid.phy_idx = ext_phy; in mt7915_add_interface()
231 mvif->sta.wcid.hw_key_idx = -1; in mt7915_add_interface()
232 mvif->sta.wcid.tx_info |= MT_WCID_TX_INFO_SET; in mt7915_add_interface()
233 mt76_packet_id_init(&mvif->sta.wcid); in mt7915_add_interface()
238 if (vif->txq) { in mt7915_add_interface()
239 mtxq = (struct mt76_txq *)vif->txq->drv_priv; in mt7915_add_interface()
240 mtxq->wcid = idx; in mt7915_add_interface()
243 if (vif->type != NL80211_IFTYPE_AP && in mt7915_add_interface()
244 (!mvif->mt76.omac_idx || mvif->mt76.omac_idx > 3)) in mt7915_add_interface()
245 vif->offload_flags = 0; in mt7915_add_interface()
246 vif->offload_flags |= IEEE80211_OFFLOAD_ENCAP_4ADDR; in mt7915_add_interface()
249 memset(&mvif->cap, -1, sizeof(mvif->cap)); in mt7915_add_interface()
253 rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.wcid); in mt7915_add_interface()
256 mutex_unlock(&dev->mt76.mutex); in mt7915_add_interface()
264 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_remove_interface()
265 struct mt7915_sta *msta = &mvif->sta; in mt7915_remove_interface()
268 int idx = msta->wcid.idx; in mt7915_remove_interface()
273 mutex_lock(&dev->mt76.mutex); in mt7915_remove_interface()
274 mt76_testmode_reset(phy->mt76, true); in mt7915_remove_interface()
275 mutex_unlock(&dev->mt76.mutex); in mt7915_remove_interface()
277 if (vif == phy->monitor_vif) in mt7915_remove_interface()
278 phy->monitor_vif = NULL; in mt7915_remove_interface()
282 rcu_assign_pointer(dev->mt76.wcid[idx], NULL); in mt7915_remove_interface()
284 mutex_lock(&dev->mt76.mutex); in mt7915_remove_interface()
285 dev->mt76.vif_mask &= ~BIT_ULL(mvif->mt76.idx); in mt7915_remove_interface()
286 phy->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx); in mt7915_remove_interface()
287 mutex_unlock(&dev->mt76.mutex); in mt7915_remove_interface()
289 spin_lock_bh(&dev->sta_poll_lock); in mt7915_remove_interface()
290 if (!list_empty(&msta->poll_list)) in mt7915_remove_interface()
291 list_del_init(&msta->poll_list); in mt7915_remove_interface()
292 spin_unlock_bh(&dev->sta_poll_lock); in mt7915_remove_interface()
294 mt76_packet_id_flush(&dev->mt76, &msta->wcid); in mt7915_remove_interface()
299 struct mt7915_dev *dev = phy->dev; in mt7915_set_channel()
302 cancel_delayed_work_sync(&phy->mt76->mac_work); in mt7915_set_channel()
304 mutex_lock(&dev->mt76.mutex); in mt7915_set_channel()
305 set_bit(MT76_RESET, &phy->mt76->state); in mt7915_set_channel()
307 mt76_set_channel(phy->mt76); in mt7915_set_channel()
309 if (dev->flash_mode) { in mt7915_set_channel()
324 phy->noise = 0; in mt7915_set_channel()
327 clear_bit(MT76_RESET, &phy->mt76->state); in mt7915_set_channel()
328 mutex_unlock(&dev->mt76.mutex); in mt7915_set_channel()
330 mt76_txq_schedule_all(phy->mt76); in mt7915_set_channel()
332 if (!mt76_testmode_enabled(phy->mt76)) in mt7915_set_channel()
333 ieee80211_queue_delayed_work(phy->mt76->hw, in mt7915_set_channel()
334 &phy->mt76->mac_work, in mt7915_set_channel()
346 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_set_key()
347 struct mt7915_sta *msta = sta ? (struct mt7915_sta *)sta->drv_priv : in mt7915_set_key()
348 &mvif->sta; in mt7915_set_key()
349 struct mt76_wcid *wcid = &msta->wcid; in mt7915_set_key()
350 u8 *wcid_keyidx = &wcid->hw_key_idx; in mt7915_set_key()
351 int idx = key->keyidx; in mt7915_set_key()
354 /* The hardware does not support per-STA RX GTK, fallback in mt7915_set_key()
357 if ((vif->type == NL80211_IFTYPE_ADHOC || in mt7915_set_key()
358 vif->type == NL80211_IFTYPE_MESH_POINT) && in mt7915_set_key()
359 (key->cipher == WLAN_CIPHER_SUITE_TKIP || in mt7915_set_key()
360 key->cipher == WLAN_CIPHER_SUITE_CCMP) && in mt7915_set_key()
361 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) in mt7915_set_key()
362 return -EOPNOTSUPP; in mt7915_set_key()
365 switch (key->cipher) { in mt7915_set_key()
367 wcid_keyidx = &wcid->hw_key_idx2; in mt7915_set_key()
368 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIE; in mt7915_set_key()
380 return -EOPNOTSUPP; in mt7915_set_key()
383 mutex_lock(&dev->mt76.mutex); in mt7915_set_key()
385 if (cmd == SET_KEY && !sta && !mvif->mt76.cipher) { in mt7915_set_key()
386 mvif->mt76.cipher = mt76_connac_mcu_get_cipher(key->cipher); in mt7915_set_key()
393 *wcid_keyidx = -1; in mt7915_set_key()
397 mt76_wcid_key_setup(&dev->mt76, wcid, in mt7915_set_key()
400 err = mt76_connac_mcu_add_key(&dev->mt76, vif, &msta->bip, in mt7915_set_key()
402 &msta->wcid, cmd); in mt7915_set_key()
404 mutex_unlock(&dev->mt76.mutex); in mt7915_set_key()
414 int err = -EINVAL; in mt7915_set_sar_specs()
416 mutex_lock(&dev->mt76.mutex); in mt7915_set_sar_specs()
417 if (!cfg80211_chandef_valid(&phy->mt76->chandef)) in mt7915_set_sar_specs()
426 mutex_unlock(&dev->mt76.mutex); in mt7915_set_sar_specs()
435 bool band = phy != &dev->phy; in mt7915_config()
440 if (phy->mt76->test.state != MT76_TM_STATE_OFF) { in mt7915_config()
441 mutex_lock(&dev->mt76.mutex); in mt7915_config()
442 mt76_testmode_reset(phy->mt76, false); in mt7915_config()
443 mutex_unlock(&dev->mt76.mutex); in mt7915_config()
459 mutex_lock(&dev->mt76.mutex); in mt7915_config()
462 bool enabled = !!(hw->conf.flags & IEEE80211_CONF_MONITOR); in mt7915_config()
465 phy->rxfilter |= MT_WF_RFCR_DROP_OTHER_UC; in mt7915_config()
467 phy->rxfilter &= ~MT_WF_RFCR_DROP_OTHER_UC; in mt7915_config()
471 mt76_testmode_reset(phy->mt76, true); in mt7915_config()
472 mt76_wr(dev, MT_WF_RFCR(band), phy->rxfilter); in mt7915_config()
475 mutex_unlock(&dev->mt76.mutex); in mt7915_config()
485 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_conf_tx()
489 mvif->queue_params[queue] = *params; in mt7915_conf_tx()
501 bool band = phy != &dev->phy; in mt7915_configure_filter()
511 phy->rxfilter &= ~(_hw); \ in mt7915_configure_filter()
512 phy->rxfilter |= !(flags & FIF_##_flag) * (_hw); \ in mt7915_configure_filter()
515 mutex_lock(&dev->mt76.mutex); in mt7915_configure_filter()
517 phy->rxfilter &= ~(MT_WF_RFCR_DROP_OTHER_BSS | in mt7915_configure_filter()
541 mt76_wr(dev, MT_WF_RFCR(band), phy->rxfilter); in mt7915_configure_filter()
548 mutex_unlock(&dev->mt76.mutex); in mt7915_configure_filter()
558 switch (vif->type) { in mt7915_update_bss_color()
560 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_update_bss_color()
562 if (mvif->mt76.omac_idx > HW_BSSID_MAX) in mt7915_update_bss_color()
582 mutex_lock(&dev->mt76.mutex); in mt7915_bss_info_changed()
589 vif->type == NL80211_IFTYPE_STATION) { in mt7915_bss_info_changed()
590 bool join = !is_zero_ether_addr(info->bssid); in mt7915_bss_info_changed()
597 mt7915_mcu_add_bss_info(phy, vif, vif->cfg.assoc); in mt7915_bss_info_changed()
598 mt7915_mcu_add_obss_spr(dev, vif, info->he_obss_pd.enable); in mt7915_bss_info_changed()
602 int slottime = info->use_short_slot ? 9 : 20; in mt7915_bss_info_changed()
604 if (slottime != phy->slottime) { in mt7915_bss_info_changed()
605 phy->slottime = slottime; in mt7915_bss_info_changed()
610 if (changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon) { in mt7915_bss_info_changed()
620 mt7915_mcu_add_obss_spr(dev, vif, info->he_obss_pd.enable); in mt7915_bss_info_changed()
623 mt7915_update_bss_color(hw, vif, &info->he_bss_color); in mt7915_bss_info_changed()
629 mt7915_mcu_add_beacon(hw, vif, info->enable_beacon, changed); in mt7915_bss_info_changed()
631 mutex_unlock(&dev->mt76.mutex); in mt7915_bss_info_changed()
641 mutex_lock(&dev->mt76.mutex); in mt7915_channel_switch_beacon()
643 mutex_unlock(&dev->mt76.mutex); in mt7915_channel_switch_beacon()
650 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_mac_sta_add()
651 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_mac_sta_add()
652 bool ext_phy = mvif->phy != &dev->phy; in mt7915_mac_sta_add()
655 idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA); in mt7915_mac_sta_add()
657 return -ENOSPC; in mt7915_mac_sta_add()
659 INIT_LIST_HEAD(&msta->rc_list); in mt7915_mac_sta_add()
660 INIT_LIST_HEAD(&msta->poll_list); in mt7915_mac_sta_add()
661 msta->vif = mvif; in mt7915_mac_sta_add()
662 msta->wcid.sta = 1; in mt7915_mac_sta_add()
663 msta->wcid.idx = idx; in mt7915_mac_sta_add()
664 msta->wcid.phy_idx = ext_phy; in mt7915_mac_sta_add()
665 msta->wcid.tx_info |= MT_WCID_TX_INFO_SET; in mt7915_mac_sta_add()
666 msta->jiffies = jiffies; in mt7915_mac_sta_add()
682 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_mac_sta_remove()
687 mt7915_mac_wtbl_update(dev, msta->wcid.idx, in mt7915_mac_sta_remove()
690 for (i = 0; i < ARRAY_SIZE(msta->twt.flow); i++) in mt7915_mac_sta_remove()
693 spin_lock_bh(&dev->sta_poll_lock); in mt7915_mac_sta_remove()
694 if (!list_empty(&msta->poll_list)) in mt7915_mac_sta_remove()
695 list_del_init(&msta->poll_list); in mt7915_mac_sta_remove()
696 if (!list_empty(&msta->rc_list)) in mt7915_mac_sta_remove()
697 list_del_init(&msta->rc_list); in mt7915_mac_sta_remove()
698 spin_unlock_bh(&dev->sta_poll_lock); in mt7915_mac_sta_remove()
706 struct mt76_phy *mphy = hw->priv; in mt7915_tx()
708 struct ieee80211_vif *vif = info->control.vif; in mt7915_tx()
709 struct mt76_wcid *wcid = &dev->mt76.global_wcid; in mt7915_tx()
711 if (control->sta) { in mt7915_tx()
714 sta = (struct mt7915_sta *)control->sta->drv_priv; in mt7915_tx()
715 wcid = &sta->wcid; in mt7915_tx()
718 if (vif && !control->sta) { in mt7915_tx()
721 mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_tx()
722 wcid = &mvif->sta.wcid; in mt7915_tx()
725 mt76_tx(mphy, control->sta, wcid, skb); in mt7915_tx()
734 mutex_lock(&dev->mt76.mutex); in mt7915_set_rts_threshold()
735 ret = mt76_connac_mcu_set_rts_thresh(&dev->mt76, val, phy != &dev->phy); in mt7915_set_rts_threshold()
736 mutex_unlock(&dev->mt76.mutex); in mt7915_set_rts_threshold()
745 enum ieee80211_ampdu_mlme_action action = params->action; in mt7915_ampdu_action()
747 struct ieee80211_sta *sta = params->sta; in mt7915_ampdu_action()
748 struct ieee80211_txq *txq = sta->txq[params->tid]; in mt7915_ampdu_action()
749 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_ampdu_action()
750 u16 tid = params->tid; in mt7915_ampdu_action()
751 u16 ssn = params->ssn; in mt7915_ampdu_action()
756 return -EINVAL; in mt7915_ampdu_action()
758 mtxq = (struct mt76_txq *)txq->drv_priv; in mt7915_ampdu_action()
760 mutex_lock(&dev->mt76.mutex); in mt7915_ampdu_action()
763 mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid, ssn, in mt7915_ampdu_action()
764 params->buf_size); in mt7915_ampdu_action()
768 mt76_rx_aggr_stop(&dev->mt76, &msta->wcid, tid); in mt7915_ampdu_action()
772 mtxq->aggr = true; in mt7915_ampdu_action()
773 mtxq->send_bar = false; in mt7915_ampdu_action()
778 mtxq->aggr = false; in mt7915_ampdu_action()
779 clear_bit(tid, &msta->ampdu_state); in mt7915_ampdu_action()
783 set_bit(tid, &msta->ampdu_state); in mt7915_ampdu_action()
787 mtxq->aggr = false; in mt7915_ampdu_action()
788 clear_bit(tid, &msta->ampdu_state); in mt7915_ampdu_action()
790 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); in mt7915_ampdu_action()
793 mutex_unlock(&dev->mt76.mutex); in mt7915_ampdu_action()
820 struct mib_stats *mib = &phy->mib; in mt7915_get_stats()
822 mutex_lock(&dev->mt76.mutex); in mt7915_get_stats()
824 stats->dot11RTSSuccessCount = mib->rts_cnt; in mt7915_get_stats()
825 stats->dot11RTSFailureCount = mib->rts_retries_cnt; in mt7915_get_stats()
826 stats->dot11FCSErrorCount = mib->fcs_err_cnt; in mt7915_get_stats()
827 stats->dot11ACKFailureCount = mib->ack_fail_cnt; in mt7915_get_stats()
829 mutex_unlock(&dev->mt76.mutex); in mt7915_get_stats()
838 bool band = phy != &dev->phy; in __mt7915_get_tsf()
845 lockdep_assert_held(&dev->mt76.mutex); in __mt7915_get_tsf()
847 n = mvif->mt76.omac_idx > HW_BSSID_MAX ? HW_BSSID_0 in __mt7915_get_tsf()
848 : mvif->mt76.omac_idx; in __mt7915_get_tsf()
850 if (is_mt7915(&dev->mt76)) in __mt7915_get_tsf()
865 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_get_tsf()
869 mutex_lock(&dev->mt76.mutex); in mt7915_get_tsf()
871 mutex_unlock(&dev->mt76.mutex); in mt7915_get_tsf()
880 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_set_tsf()
883 bool band = phy != &dev->phy; in mt7915_set_tsf()
890 mutex_lock(&dev->mt76.mutex); in mt7915_set_tsf()
892 n = mvif->mt76.omac_idx > HW_BSSID_MAX ? HW_BSSID_0 in mt7915_set_tsf()
893 : mvif->mt76.omac_idx; in mt7915_set_tsf()
897 if (is_mt7915(&dev->mt76)) in mt7915_set_tsf()
904 mutex_unlock(&dev->mt76.mutex); in mt7915_set_tsf()
911 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_offset_tsf()
914 bool band = phy != &dev->phy; in mt7915_offset_tsf()
921 mutex_lock(&dev->mt76.mutex); in mt7915_offset_tsf()
923 n = mvif->mt76.omac_idx > HW_BSSID_MAX ? HW_BSSID_0 in mt7915_offset_tsf()
924 : mvif->mt76.omac_idx; in mt7915_offset_tsf()
928 if (is_mt7915(&dev->mt76)) in mt7915_offset_tsf()
935 mutex_unlock(&dev->mt76.mutex); in mt7915_offset_tsf()
942 struct mt7915_dev *dev = phy->dev; in mt7915_set_coverage_class()
944 mutex_lock(&dev->mt76.mutex); in mt7915_set_coverage_class()
945 phy->coverage_class = max_t(s16, coverage_class, 0); in mt7915_set_coverage_class()
947 mutex_unlock(&dev->mt76.mutex); in mt7915_set_coverage_class()
955 int max_nss = hweight8(hw->wiphy->available_antennas_tx); in mt7915_set_antenna()
956 bool ext_phy = phy != &dev->phy; in mt7915_set_antenna()
959 return -EINVAL; in mt7915_set_antenna()
961 if ((BIT(hweight8(tx_ant)) - 1) != tx_ant) in mt7915_set_antenna()
962 tx_ant = BIT(ffs(tx_ant) - 1) - 1; in mt7915_set_antenna()
964 mutex_lock(&dev->mt76.mutex); in mt7915_set_antenna()
966 phy->mt76->antenna_mask = tx_ant; in mt7915_set_antenna()
969 tx_ant <<= dev->chainshift; in mt7915_set_antenna()
971 phy->mt76->chainmask = tx_ant; in mt7915_set_antenna()
973 mt76_set_stream_caps(phy->mt76, true); in mt7915_set_antenna()
977 mutex_unlock(&dev->mt76.mutex); in mt7915_set_antenna()
988 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_sta_statistics()
989 struct rate_info *txrate = &msta->wcid.rate; in mt7915_sta_statistics()
992 if (is_mt7915(&phy->dev->mt76) && in mt7915_sta_statistics()
994 sinfo->rxrate = rxrate; in mt7915_sta_statistics()
995 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); in mt7915_sta_statistics()
998 if (!txrate->legacy && !txrate->flags) in mt7915_sta_statistics()
1001 if (txrate->legacy) { in mt7915_sta_statistics()
1002 sinfo->txrate.legacy = txrate->legacy; in mt7915_sta_statistics()
1004 sinfo->txrate.mcs = txrate->mcs; in mt7915_sta_statistics()
1005 sinfo->txrate.nss = txrate->nss; in mt7915_sta_statistics()
1006 sinfo->txrate.bw = txrate->bw; in mt7915_sta_statistics()
1007 sinfo->txrate.he_gi = txrate->he_gi; in mt7915_sta_statistics()
1008 sinfo->txrate.he_dcm = txrate->he_dcm; in mt7915_sta_statistics()
1009 sinfo->txrate.he_ru_alloc = txrate->he_ru_alloc; in mt7915_sta_statistics()
1011 sinfo->txrate.flags = txrate->flags; in mt7915_sta_statistics()
1012 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in mt7915_sta_statistics()
1017 if (mtk_wed_device_active(&phy->dev->mt76.mmio.wed)) { in mt7915_sta_statistics()
1018 sinfo->tx_bytes = msta->wcid.stats.tx_bytes; in mt7915_sta_statistics()
1019 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64); in mt7915_sta_statistics()
1021 sinfo->tx_packets = msta->wcid.stats.tx_packets; in mt7915_sta_statistics()
1022 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); in mt7915_sta_statistics()
1024 sinfo->tx_failed = msta->wcid.stats.tx_failed; in mt7915_sta_statistics()
1025 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); in mt7915_sta_statistics()
1027 sinfo->tx_retries = msta->wcid.stats.tx_retries; in mt7915_sta_statistics()
1028 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES); in mt7915_sta_statistics()
1034 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_sta_rc_work()
1035 struct mt7915_dev *dev = msta->vif->phy->dev; in mt7915_sta_rc_work()
1038 spin_lock_bh(&dev->sta_poll_lock); in mt7915_sta_rc_work()
1039 msta->changed |= *changed; in mt7915_sta_rc_work()
1040 if (list_empty(&msta->rc_list)) in mt7915_sta_rc_work()
1041 list_add_tail(&msta->rc_list, &dev->sta_rc_list); in mt7915_sta_rc_work()
1042 spin_unlock_bh(&dev->sta_poll_lock); in mt7915_sta_rc_work()
1051 struct mt7915_dev *dev = phy->dev; in mt7915_sta_rc_update()
1054 ieee80211_queue_work(hw, &dev->rc_work); in mt7915_sta_rc_update()
1061 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_set_bitrate_mask()
1063 struct mt7915_dev *dev = phy->dev; in mt7915_set_bitrate_mask()
1066 mvif->bitrate_mask = *mask; in mt7915_set_bitrate_mask()
1071 * - single rate : if a rate is passed along with different preambles, in mt7915_set_bitrate_mask()
1072 * we select the highest one as fixed rate. i.e VHT MCS for VHT peers. in mt7915_set_bitrate_mask()
1073 * - multiple rates: if it's not in range format i.e 0-{7,8,9} for VHT in mt7915_set_bitrate_mask()
1077 ieee80211_queue_work(hw, &dev->rc_work); in mt7915_set_bitrate_mask()
1088 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_sta_set_4addr()
1091 set_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags); in mt7915_sta_set_4addr()
1093 clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags); in mt7915_sta_set_4addr()
1095 mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta); in mt7915_sta_set_4addr()
1104 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_sta_set_decap_offload()
1107 set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); in mt7915_sta_set_decap_offload()
1109 clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); in mt7915_sta_set_decap_offload()
1111 mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta); in mt7915_sta_set_decap_offload()
1123 "tx_ampdu_len:0-1",
1124 "tx_ampdu_len:2-10",
1125 "tx_ampdu_len:11-19",
1126 "tx_ampdu_len:20-28",
1127 "tx_ampdu_len:29-37",
1128 "tx_ampdu_len:38-46",
1129 "tx_ampdu_len:47-55",
1130 "tx_ampdu_len:56-79",
1131 "tx_ampdu_len:80-103",
1132 "tx_ampdu_len:104-127",
1133 "tx_ampdu_len:128-151",
1134 "tx_ampdu_len:152-175",
1135 "tx_ampdu_len:176-199",
1136 "tx_ampdu_len:200-223",
1137 "tx_ampdu_len:224-247",
1239 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_ethtool_worker()
1241 if (msta->vif->mt76.idx != wi->idx) in mt7915_ethtool_worker()
1244 mt76_ethtool_worker(wi, &msta->wcid.stats); in mt7915_ethtool_worker()
1254 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_get_et_stats()
1257 .idx = mvif->mt76.idx, in mt7915_get_et_stats()
1259 struct mib_stats *mib = &phy->mib; in mt7915_get_et_stats()
1263 mutex_lock(&dev->mt76.mutex); in mt7915_get_et_stats()
1267 data[ei++] = mib->tx_ampdu_cnt; in mt7915_get_et_stats()
1268 data[ei++] = mib->tx_stop_q_empty_cnt; in mt7915_get_et_stats()
1269 data[ei++] = mib->tx_mpdu_attempts_cnt; in mt7915_get_et_stats()
1270 data[ei++] = mib->tx_mpdu_success_cnt; in mt7915_get_et_stats()
1271 data[ei++] = mib->tx_rwp_fail_cnt; in mt7915_get_et_stats()
1272 data[ei++] = mib->tx_rwp_need_cnt; in mt7915_get_et_stats()
1273 data[ei++] = mib->tx_pkt_ebf_cnt; in mt7915_get_et_stats()
1274 data[ei++] = mib->tx_pkt_ibf_cnt; in mt7915_get_et_stats()
1277 n = phy->band_idx ? ARRAY_SIZE(dev->mt76.aggr_stats) / 2 : 0; in mt7915_get_et_stats()
1279 data[ei++] = dev->mt76.aggr_stats[i + n]; in mt7915_get_et_stats()
1281 data[ei++] = phy->mib.ba_miss_cnt; in mt7915_get_et_stats()
1284 data[ei++] = mib->tx_bf_ibf_ppdu_cnt; in mt7915_get_et_stats()
1285 data[ei++] = mib->tx_bf_ebf_ppdu_cnt; in mt7915_get_et_stats()
1288 data[ei++] = mib->tx_bf_rx_fb_all_cnt; in mt7915_get_et_stats()
1289 data[ei++] = mib->tx_bf_rx_fb_he_cnt; in mt7915_get_et_stats()
1290 data[ei++] = mib->tx_bf_rx_fb_vht_cnt; in mt7915_get_et_stats()
1291 data[ei++] = mib->tx_bf_rx_fb_ht_cnt; in mt7915_get_et_stats()
1293 data[ei++] = mib->tx_bf_rx_fb_bw; in mt7915_get_et_stats()
1294 data[ei++] = mib->tx_bf_rx_fb_nc_cnt; in mt7915_get_et_stats()
1295 data[ei++] = mib->tx_bf_rx_fb_nr_cnt; in mt7915_get_et_stats()
1298 data[ei++] = mib->tx_bf_fb_cpl_cnt; in mt7915_get_et_stats()
1299 data[ei++] = mib->tx_bf_fb_trig_cnt; in mt7915_get_et_stats()
1302 data[ei++] = mib->tx_bf_cnt; in mt7915_get_et_stats()
1303 data[ei++] = mib->tx_mu_mpdu_cnt; in mt7915_get_et_stats()
1304 data[ei++] = mib->tx_mu_acked_mpdu_cnt; in mt7915_get_et_stats()
1305 data[ei++] = mib->tx_su_acked_mpdu_cnt; in mt7915_get_et_stats()
1307 /* Tx amsdu info (pack-count histogram) */ in mt7915_get_et_stats()
1308 for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++) in mt7915_get_et_stats()
1309 data[ei++] = mib->tx_amsdu[i]; in mt7915_get_et_stats()
1312 data[ei++] = mib->rx_fifo_full_cnt; in mt7915_get_et_stats()
1313 data[ei++] = mib->rx_mpdu_cnt; in mt7915_get_et_stats()
1314 data[ei++] = mib->channel_idle_cnt; in mt7915_get_et_stats()
1315 data[ei++] = mib->primary_cca_busy_time; in mt7915_get_et_stats()
1316 data[ei++] = mib->secondary_cca_busy_time; in mt7915_get_et_stats()
1317 data[ei++] = mib->primary_energy_detect_time; in mt7915_get_et_stats()
1318 data[ei++] = mib->cck_mdrdy_time; in mt7915_get_et_stats()
1319 data[ei++] = mib->ofdm_mdrdy_time; in mt7915_get_et_stats()
1320 data[ei++] = mib->green_mdrdy_time; in mt7915_get_et_stats()
1321 data[ei++] = mib->rx_vector_mismatch_cnt; in mt7915_get_et_stats()
1322 data[ei++] = mib->rx_delimiter_fail_cnt; in mt7915_get_et_stats()
1323 data[ei++] = mib->rx_mrdy_cnt; in mt7915_get_et_stats()
1324 data[ei++] = mib->rx_len_mismatch_cnt; in mt7915_get_et_stats()
1325 data[ei++] = mib->rx_ampdu_cnt; in mt7915_get_et_stats()
1326 data[ei++] = mib->rx_ampdu_bytes_cnt; in mt7915_get_et_stats()
1327 data[ei++] = mib->rx_ampdu_valid_subframe_cnt; in mt7915_get_et_stats()
1328 data[ei++] = mib->rx_ampdu_valid_subframe_bytes_cnt; in mt7915_get_et_stats()
1329 data[ei++] = mib->rx_pfdrop_cnt; in mt7915_get_et_stats()
1330 data[ei++] = mib->rx_vec_queue_overflow_drop_cnt; in mt7915_get_et_stats()
1331 data[ei++] = mib->rx_ba_cnt; in mt7915_get_et_stats()
1337 mutex_unlock(&dev->mt76.mutex); in mt7915_get_et_stats()
1344 dev_err(dev->mt76.dev, "ei: %d MT7915_SSTATS_LEN: %d", in mt7915_get_et_stats()
1353 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_twt_teardown_request()
1356 mutex_lock(&dev->mt76.mutex); in mt7915_twt_teardown_request()
1358 mutex_unlock(&dev->mt76.mutex); in mt7915_twt_teardown_request()
1366 struct mt7915_dev *dev = phy->dev; in mt7915_set_radar_background()
1367 int ret = -EINVAL; in mt7915_set_radar_background()
1370 mutex_lock(&dev->mt76.mutex); in mt7915_set_radar_background()
1372 if (dev->mt76.region == NL80211_DFS_UNSET) in mt7915_set_radar_background()
1375 if (dev->rdd2_phy && dev->rdd2_phy != phy) { in mt7915_set_radar_background()
1377 ret = -EBUSY; in mt7915_set_radar_background()
1382 running = dev->rdd2_phy && in mt7915_set_radar_background()
1383 cfg80211_chandef_valid(&dev->rdd2_chandef) && in mt7915_set_radar_background()
1384 !!(dev->rdd2_chandef.chan->flags & IEEE80211_CHAN_RADAR); in mt7915_set_radar_background()
1387 !(chandef->chan->flags & IEEE80211_CHAN_RADAR)) { in mt7915_set_radar_background()
1401 dev->rdd2_phy = chandef ? phy : NULL; in mt7915_set_radar_background()
1403 dev->rdd2_chandef = *chandef; in mt7915_set_radar_background()
1405 mutex_unlock(&dev->mt76.mutex); in mt7915_set_radar_background()
1418 struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; in mt7915_net_fill_forward_path()
1419 struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; in mt7915_net_fill_forward_path()
1422 struct mtk_wed_device *wed = &dev->mt76.mmio.wed; in mt7915_net_fill_forward_path()
1425 return -ENODEV; in mt7915_net_fill_forward_path()
1427 if (msta->wcid.idx > 0xff) in mt7915_net_fill_forward_path()
1428 return -EIO; in mt7915_net_fill_forward_path()
1430 path->type = DEV_PATH_MTK_WDMA; in mt7915_net_fill_forward_path()
1431 path->dev = ctx->dev; in mt7915_net_fill_forward_path()
1432 path->mtk_wdma.wdma_idx = wed->wdma_idx; in mt7915_net_fill_forward_path()
1433 path->mtk_wdma.bss = mvif->mt76.idx; in mt7915_net_fill_forward_path()
1434 path->mtk_wdma.wcid = msta->wcid.idx; in mt7915_net_fill_forward_path()
1435 path->mtk_wdma.queue = phy != &dev->phy; in mt7915_net_fill_forward_path()
1437 ctx->dev = NULL; in mt7915_net_fill_forward_path()