Lines Matching +full:combined +full:- +full:power +full:- +full:req
1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2005-2011 Atheros Communications Inc.
4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
5 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
24 #include "wmi-tlv.h"
25 #include "wmi-ops.h"
87 #define ath10k_a_rates_size (ARRAY_SIZE(ath10k_rates) - \
122 for (i = 0; i < sband->n_bitrates; i++) { in ath10k_mac_hw_rate_to_idx()
123 rate = &sband->bitrates[i]; in ath10k_mac_hw_rate_to_idx()
125 if (ath10k_mac_bitrate_is_cck(rate->bitrate) != cck) in ath10k_mac_hw_rate_to_idx()
128 if (rate->hw_value == hw_rate) in ath10k_mac_hw_rate_to_idx()
130 else if (rate->flags & IEEE80211_RATE_SHORT_PREAMBLE && in ath10k_mac_hw_rate_to_idx()
131 rate->hw_value_short == hw_rate) in ath10k_mac_hw_rate_to_idx()
143 for (i = 0; i < sband->n_bitrates; i++) in ath10k_mac_bitrate_to_idx()
144 if (sband->bitrates[i].bitrate == bitrate) in ath10k_mac_bitrate_to_idx()
163 return -EINVAL; in ath10k_mac_get_rate_hw_value()
169 case IEEE80211_VHT_MCS_SUPPORT_0_7: return BIT(8) - 1; in ath10k_mac_get_max_vht_mcs_map()
170 case IEEE80211_VHT_MCS_SUPPORT_0_8: return BIT(9) - 1; in ath10k_mac_get_max_vht_mcs_map()
171 case IEEE80211_VHT_MCS_SUPPORT_0_9: return BIT(10) - 1; in ath10k_mac_get_max_vht_mcs_map()
181 for (nss = IEEE80211_HT_MCS_MASK_LEN - 1; nss >= 0; nss--) in ath10k_mac_max_ht_nss()
193 for (nss = NL80211_VHT_NSS_MAX - 1; nss >= 0; nss--) in ath10k_mac_max_vht_nss()
205 if (test_bit(WMI_SERVICE_TX_MODE_DYNAMIC, ar->wmi.svc_map)) in ath10k_mac_ext_resource_config()
212 if (ret && ret != -EOPNOTSUPP) { in ath10k_mac_ext_resource_config()
229 struct ath10k *ar = arvif->ar; in ath10k_send_key()
231 .vdev_id = arvif->vdev_id, in ath10k_send_key()
232 .key_idx = key->keyidx, in ath10k_send_key()
233 .key_len = key->keylen, in ath10k_send_key()
234 .key_data = key->key, in ath10k_send_key()
239 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_send_key()
241 switch (key->cipher) { in ath10k_send_key()
243 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_CCM]; in ath10k_send_key()
244 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; in ath10k_send_key()
247 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_TKIP]; in ath10k_send_key()
253 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_WEP]; in ath10k_send_key()
256 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_CCM]; in ath10k_send_key()
260 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_GCM]; in ath10k_send_key()
261 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; in ath10k_send_key()
268 return -EINVAL; in ath10k_send_key()
270 ath10k_warn(ar, "cipher %d is not supported\n", key->cipher); in ath10k_send_key()
271 return -EOPNOTSUPP; in ath10k_send_key()
274 if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) in ath10k_send_key()
275 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; in ath10k_send_key()
278 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_NONE]; in ath10k_send_key()
282 return ath10k_wmi_vdev_install_key(arvif->ar, &arg); in ath10k_send_key()
290 struct ath10k *ar = arvif->ar; in ath10k_install_key()
294 lockdep_assert_held(&ar->conf_mutex); in ath10k_install_key()
296 reinit_completion(&ar->install_key_done); in ath10k_install_key()
298 if (arvif->nohwcrypt) in ath10k_install_key()
305 time_left = wait_for_completion_timeout(&ar->install_key_done, 3 * HZ); in ath10k_install_key()
307 return -ETIMEDOUT; in ath10k_install_key()
315 struct ath10k *ar = arvif->ar; in ath10k_install_peer_wep_keys()
321 lockdep_assert_held(&ar->conf_mutex); in ath10k_install_peer_wep_keys()
323 if (WARN_ON(arvif->vif->type != NL80211_IFTYPE_AP && in ath10k_install_peer_wep_keys()
324 arvif->vif->type != NL80211_IFTYPE_ADHOC && in ath10k_install_peer_wep_keys()
325 arvif->vif->type != NL80211_IFTYPE_MESH_POINT)) in ath10k_install_peer_wep_keys()
326 return -EINVAL; in ath10k_install_peer_wep_keys()
328 spin_lock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
329 peer = ath10k_peer_find(ar, arvif->vdev_id, addr); in ath10k_install_peer_wep_keys()
330 spin_unlock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
333 return -ENOENT; in ath10k_install_peer_wep_keys()
335 for (i = 0; i < ARRAY_SIZE(arvif->wep_keys); i++) { in ath10k_install_peer_wep_keys()
336 if (arvif->wep_keys[i] == NULL) in ath10k_install_peer_wep_keys()
339 switch (arvif->vif->type) { in ath10k_install_peer_wep_keys()
343 if (arvif->def_wep_key_idx == i) in ath10k_install_peer_wep_keys()
346 ret = ath10k_install_key(arvif, arvif->wep_keys[i], in ath10k_install_peer_wep_keys()
352 ret = ath10k_install_key(arvif, arvif->wep_keys[i], in ath10k_install_peer_wep_keys()
358 ret = ath10k_install_key(arvif, arvif->wep_keys[i], in ath10k_install_peer_wep_keys()
365 return -EINVAL; in ath10k_install_peer_wep_keys()
368 spin_lock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
369 peer->keys[i] = arvif->wep_keys[i]; in ath10k_install_peer_wep_keys()
370 spin_unlock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
381 if (arvif->vif->type != NL80211_IFTYPE_ADHOC) in ath10k_install_peer_wep_keys()
384 if (arvif->def_wep_key_idx == -1) in ath10k_install_peer_wep_keys()
387 ret = ath10k_wmi_vdev_set_param(arvif->ar, in ath10k_install_peer_wep_keys()
388 arvif->vdev_id, in ath10k_install_peer_wep_keys()
389 arvif->ar->wmi.vdev_param->def_keyid, in ath10k_install_peer_wep_keys()
390 arvif->def_wep_key_idx); in ath10k_install_peer_wep_keys()
392 ath10k_warn(ar, "failed to re-set def wpa key idxon vdev %i: %d\n", in ath10k_install_peer_wep_keys()
393 arvif->vdev_id, ret); in ath10k_install_peer_wep_keys()
403 struct ath10k *ar = arvif->ar; in ath10k_clear_peer_keys()
410 lockdep_assert_held(&ar->conf_mutex); in ath10k_clear_peer_keys()
412 spin_lock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
413 peer = ath10k_peer_find(ar, arvif->vdev_id, addr); in ath10k_clear_peer_keys()
414 spin_unlock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
417 return -ENOENT; in ath10k_clear_peer_keys()
419 for (i = 0; i < ARRAY_SIZE(peer->keys); i++) { in ath10k_clear_peer_keys()
420 if (peer->keys[i] == NULL) in ath10k_clear_peer_keys()
424 ret = ath10k_install_key(arvif, peer->keys[i], in ath10k_clear_peer_keys()
433 spin_lock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
434 peer->keys[i] = NULL; in ath10k_clear_peer_keys()
435 spin_unlock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
447 lockdep_assert_held(&ar->data_lock); in ath10k_mac_is_peer_wep_key_set()
452 * FIXME: multi-bss needs to be handled. in ath10k_mac_is_peer_wep_key_set()
458 for (i = 0; i < ARRAY_SIZE(peer->keys); i++) { in ath10k_mac_is_peer_wep_key_set()
459 if (peer->keys[i] && peer->keys[i]->keyidx == keyidx) in ath10k_mac_is_peer_wep_key_set()
469 struct ath10k *ar = arvif->ar; in ath10k_clear_vdev_key()
477 lockdep_assert_held(&ar->conf_mutex); in ath10k_clear_vdev_key()
483 spin_lock_bh(&ar->data_lock); in ath10k_clear_vdev_key()
485 list_for_each_entry(peer, &ar->peers, list) { in ath10k_clear_vdev_key()
486 for (i = 0; i < ARRAY_SIZE(peer->keys); i++) { in ath10k_clear_vdev_key()
487 if (peer->keys[i] == key) { in ath10k_clear_vdev_key()
488 ether_addr_copy(addr, peer->addr); in ath10k_clear_vdev_key()
489 peer->keys[i] = NULL; in ath10k_clear_vdev_key()
494 if (i < ARRAY_SIZE(peer->keys)) in ath10k_clear_vdev_key()
497 spin_unlock_bh(&ar->data_lock); in ath10k_clear_vdev_key()
499 if (i == ARRAY_SIZE(peer->keys)) in ath10k_clear_vdev_key()
517 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_update_wep_key()
521 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_vif_update_wep_key()
523 list_for_each_entry(peer, &ar->peers, list) { in ath10k_mac_vif_update_wep_key()
524 if (ether_addr_equal(peer->addr, arvif->vif->addr)) in ath10k_mac_vif_update_wep_key()
527 if (ether_addr_equal(peer->addr, arvif->bssid)) in ath10k_mac_vif_update_wep_key()
530 if (peer->keys[key->keyidx] == key) in ath10k_mac_vif_update_wep_key()
534 arvif->vdev_id, key->keyidx); in ath10k_mac_vif_update_wep_key()
536 ret = ath10k_install_peer_wep_keys(arvif, peer->addr); in ath10k_mac_vif_update_wep_key()
539 arvif->vdev_id, peer->addr, ret); in ath10k_mac_vif_update_wep_key()
556 switch (chandef->chan->band) { in chan_to_phymode()
558 switch (chandef->width) { in chan_to_phymode()
560 if (chandef->chan->flags & IEEE80211_CHAN_NO_OFDM) in chan_to_phymode()
577 switch (chandef->width) { in chan_to_phymode()
651 conf = rcu_dereference(vif->chanctx_conf); in ath10k_mac_vif_chan()
654 return -ENOENT; in ath10k_mac_vif_chan()
657 *def = conf->def; in ath10k_mac_vif_chan()
676 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_num_chanctxs()
690 *def = &conf->def; in ath10k_mac_get_any_chandef_iter()
699 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) { in ath10k_wait_for_peer_delete_done()
706 time_left = wait_for_completion_timeout(&ar->peer_delete_done, in ath10k_wait_for_peer_delete_done()
725 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_create()
727 num_peers = ar->num_peers; in ath10k_peer_create()
730 list_for_each_entry(arvif, &ar->arvifs, list) in ath10k_peer_create()
733 if (num_peers >= ar->max_num_peers) in ath10k_peer_create()
734 return -ENOBUFS; in ath10k_peer_create()
750 spin_lock_bh(&ar->data_lock); in ath10k_peer_create()
754 spin_unlock_bh(&ar->data_lock); in ath10k_peer_create()
758 return -ENOENT; in ath10k_peer_create()
761 peer->vif = vif; in ath10k_peer_create()
762 peer->sta = sta; in ath10k_peer_create()
764 spin_unlock_bh(&ar->data_lock); in ath10k_peer_create()
766 ar->num_peers++; in ath10k_peer_create()
773 struct ath10k *ar = arvif->ar; in ath10k_mac_set_kickout()
777 param = ar->wmi.pdev_param->sta_kickout_th; in ath10k_mac_set_kickout()
782 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
786 param = ar->wmi.vdev_param->ap_keepalive_min_idle_inactive_time_secs; in ath10k_mac_set_kickout()
787 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
791 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
795 param = ar->wmi.vdev_param->ap_keepalive_max_idle_inactive_time_secs; in ath10k_mac_set_kickout()
796 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
800 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
804 param = ar->wmi.vdev_param->ap_keepalive_max_unresponsive_time_secs; in ath10k_mac_set_kickout()
805 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
809 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
818 struct ath10k *ar = arvif->ar; in ath10k_mac_set_rts()
821 vdev_param = ar->wmi.vdev_param->rts_threshold; in ath10k_mac_set_rts()
822 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, value); in ath10k_mac_set_rts()
829 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_delete()
839 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) { in ath10k_peer_delete()
843 (&ar->peer_delete_done, 5 * HZ); in ath10k_peer_delete()
847 return -ETIMEDOUT; in ath10k_peer_delete()
851 ar->num_peers--; in ath10k_peer_delete()
862 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_cleanup()
864 spin_lock_bh(&ar->data_lock); in ath10k_peer_cleanup()
865 list_for_each_entry_safe(peer, tmp, &ar->peers, list) { in ath10k_peer_cleanup()
866 if (peer->vdev_id != vdev_id) in ath10k_peer_cleanup()
870 peer->addr, vdev_id); in ath10k_peer_cleanup()
872 for_each_set_bit(peer_id, peer->peer_ids, in ath10k_peer_cleanup()
874 ar->peer_map[peer_id] = NULL; in ath10k_peer_cleanup()
877 /* Double check that peer is properly un-referenced from in ath10k_peer_cleanup()
880 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_peer_cleanup()
881 if (ar->peer_map[i] == peer) { in ath10k_peer_cleanup()
883 peer->addr, peer, i); in ath10k_peer_cleanup()
884 ar->peer_map[i] = NULL; in ath10k_peer_cleanup()
888 list_del(&peer->list); in ath10k_peer_cleanup()
890 ar->num_peers--; in ath10k_peer_cleanup()
892 spin_unlock_bh(&ar->data_lock); in ath10k_peer_cleanup()
900 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_cleanup_all()
902 spin_lock_bh(&ar->data_lock); in ath10k_peer_cleanup_all()
903 list_for_each_entry_safe(peer, tmp, &ar->peers, list) { in ath10k_peer_cleanup_all()
904 list_del(&peer->list); in ath10k_peer_cleanup_all()
908 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) in ath10k_peer_cleanup_all()
909 ar->peer_map[i] = NULL; in ath10k_peer_cleanup_all()
911 spin_unlock_bh(&ar->data_lock); in ath10k_peer_cleanup_all()
913 ar->num_peers = 0; in ath10k_peer_cleanup_all()
914 ar->num_stations = 0; in ath10k_peer_cleanup_all()
926 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_tdls_peer_update()
930 ether_addr_copy(arg.addr, sta->addr); in ath10k_mac_tdls_peer_update()
932 cap.peer_max_sp = sta->max_sp; in ath10k_mac_tdls_peer_update()
933 cap.peer_uapsd_queues = sta->uapsd_queues; in ath10k_mac_tdls_peer_update()
936 !sta->tdls_initiator) in ath10k_mac_tdls_peer_update()
955 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_beacon_free()
957 lockdep_assert_held(&ar->data_lock); in ath10k_mac_vif_beacon_free()
959 if (!arvif->beacon) in ath10k_mac_vif_beacon_free()
962 if (!arvif->beacon_buf) in ath10k_mac_vif_beacon_free()
963 dma_unmap_single(ar->dev, ATH10K_SKB_CB(arvif->beacon)->paddr, in ath10k_mac_vif_beacon_free()
964 arvif->beacon->len, DMA_TO_DEVICE); in ath10k_mac_vif_beacon_free()
966 if (WARN_ON(arvif->beacon_state != ATH10K_BEACON_SCHEDULED && in ath10k_mac_vif_beacon_free()
967 arvif->beacon_state != ATH10K_BEACON_SENT)) in ath10k_mac_vif_beacon_free()
970 dev_kfree_skb_any(arvif->beacon); in ath10k_mac_vif_beacon_free()
972 arvif->beacon = NULL; in ath10k_mac_vif_beacon_free()
973 arvif->beacon_state = ATH10K_BEACON_SCHEDULED; in ath10k_mac_vif_beacon_free()
978 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_beacon_cleanup()
980 lockdep_assert_held(&ar->data_lock); in ath10k_mac_vif_beacon_cleanup()
984 if (arvif->beacon_buf) { in ath10k_mac_vif_beacon_cleanup()
985 dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, in ath10k_mac_vif_beacon_cleanup()
986 arvif->beacon_buf, arvif->beacon_paddr); in ath10k_mac_vif_beacon_cleanup()
987 arvif->beacon_buf = NULL; in ath10k_mac_vif_beacon_cleanup()
995 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_setup_sync()
997 if (test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)) in ath10k_vdev_setup_sync()
998 return -ESHUTDOWN; in ath10k_vdev_setup_sync()
1000 time_left = wait_for_completion_timeout(&ar->vdev_setup_done, in ath10k_vdev_setup_sync()
1003 return -ETIMEDOUT; in ath10k_vdev_setup_sync()
1005 return ar->last_wmi_vdev_start_status; in ath10k_vdev_setup_sync()
1015 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_start()
1017 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_monitor_vdev_start()
1021 return -ENOENT; in ath10k_monitor_vdev_start()
1023 channel = chandef->chan; in ath10k_monitor_vdev_start()
1026 arg.channel.freq = channel->center_freq; in ath10k_monitor_vdev_start()
1027 arg.channel.band_center_freq1 = chandef->center_freq1; in ath10k_monitor_vdev_start()
1028 arg.channel.band_center_freq2 = chandef->center_freq2; in ath10k_monitor_vdev_start()
1035 !!(channel->flags & IEEE80211_CHAN_RADAR); in ath10k_monitor_vdev_start()
1038 arg.channel.max_power = channel->max_power * 2; in ath10k_monitor_vdev_start()
1039 arg.channel.max_reg_power = channel->max_reg_power * 2; in ath10k_monitor_vdev_start()
1040 arg.channel.max_antenna_gain = channel->max_antenna_gain * 2; in ath10k_monitor_vdev_start()
1042 reinit_completion(&ar->vdev_setup_done); in ath10k_monitor_vdev_start()
1043 reinit_completion(&ar->vdev_delete_done); in ath10k_monitor_vdev_start()
1059 ret = ath10k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr); in ath10k_monitor_vdev_start()
1066 ar->monitor_vdev_id = vdev_id; in ath10k_monitor_vdev_start()
1069 ar->monitor_vdev_id); in ath10k_monitor_vdev_start()
1073 ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_start()
1076 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_start()
1085 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_stop()
1087 ret = ath10k_wmi_vdev_down(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1090 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1092 reinit_completion(&ar->vdev_setup_done); in ath10k_monitor_vdev_stop()
1093 reinit_completion(&ar->vdev_delete_done); in ath10k_monitor_vdev_stop()
1095 ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1098 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1103 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1106 ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1114 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_create()
1116 if (ar->free_vdev_map == 0) { in ath10k_monitor_vdev_create()
1118 return -ENOMEM; in ath10k_monitor_vdev_create()
1121 bit = __ffs64(ar->free_vdev_map); in ath10k_monitor_vdev_create()
1123 ar->monitor_vdev_id = bit; in ath10k_monitor_vdev_create()
1125 ret = ath10k_wmi_vdev_create(ar, ar->monitor_vdev_id, in ath10k_monitor_vdev_create()
1127 0, ar->mac_addr); in ath10k_monitor_vdev_create()
1130 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_create()
1134 ar->free_vdev_map &= ~(1LL << ar->monitor_vdev_id); in ath10k_monitor_vdev_create()
1136 ar->monitor_vdev_id); in ath10k_monitor_vdev_create()
1145 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_delete()
1147 ret = ath10k_wmi_vdev_delete(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_delete()
1150 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_delete()
1154 ar->free_vdev_map |= 1LL << ar->monitor_vdev_id; in ath10k_monitor_vdev_delete()
1157 ar->monitor_vdev_id); in ath10k_monitor_vdev_delete()
1165 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_start()
1173 ret = ath10k_monitor_vdev_start(ar, ar->monitor_vdev_id); in ath10k_monitor_start()
1180 ar->monitor_started = true; in ath10k_monitor_start()
1190 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_stop()
1204 ar->monitor_started = false; in ath10k_monitor_stop()
1224 if (ar->monitor_arvif) in ath10k_mac_monitor_vdev_is_needed()
1227 return ar->monitor || in ath10k_mac_monitor_vdev_is_needed()
1229 ar->running_fw->fw_file.fw_features) && in ath10k_mac_monitor_vdev_is_needed()
1230 (ar->filter_flags & FIF_OTHER_BSS)) || in ath10k_mac_monitor_vdev_is_needed()
1231 test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_mac_monitor_vdev_is_needed()
1242 * case anyway since multi-channel DFS hasn't been tested at all. in ath10k_mac_monitor_vdev_is_allowed()
1244 if (test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags) && num_ctx > 1) in ath10k_mac_monitor_vdev_is_allowed()
1256 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_recalc()
1263 ar->monitor_started, needed, allowed); in ath10k_monitor_recalc()
1266 if (ar->monitor_started) { in ath10k_monitor_recalc()
1276 return -EPERM; in ath10k_monitor_recalc()
1279 if (needed == ar->monitor_started) in ath10k_monitor_recalc()
1290 struct ath10k *ar = arvif->ar; in ath10k_mac_can_set_cts_prot()
1292 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_can_set_cts_prot()
1294 if (!arvif->is_started) { in ath10k_mac_can_set_cts_prot()
1304 struct ath10k *ar = arvif->ar; in ath10k_mac_set_cts_prot()
1307 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_set_cts_prot()
1309 vdev_param = ar->wmi.vdev_param->protection_mode; in ath10k_mac_set_cts_prot()
1312 arvif->vdev_id, arvif->use_cts_prot); in ath10k_mac_set_cts_prot()
1314 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_mac_set_cts_prot()
1315 arvif->use_cts_prot ? 1 : 0); in ath10k_mac_set_cts_prot()
1320 struct ath10k *ar = arvif->ar; in ath10k_recalc_rtscts_prot()
1323 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalc_rtscts_prot()
1325 vdev_param = ar->wmi.vdev_param->enable_rtscts; in ath10k_recalc_rtscts_prot()
1329 if (arvif->num_legacy_stations > 0) in ath10k_recalc_rtscts_prot()
1337 arvif->vdev_id, rts_cts); in ath10k_recalc_rtscts_prot()
1339 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_recalc_rtscts_prot()
1347 lockdep_assert_held(&ar->conf_mutex); in ath10k_start_cac()
1349 set_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_start_cac()
1354 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_start_cac()
1359 ar->monitor_vdev_id); in ath10k_start_cac()
1366 lockdep_assert_held(&ar->conf_mutex); in ath10k_stop_cac()
1368 /* CAC is not running - do nothing */ in ath10k_stop_cac()
1369 if (!test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags)) in ath10k_stop_cac()
1372 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_stop_cac()
1386 if (!*ret && conf->radar_enabled) in ath10k_mac_has_radar_iter()
1394 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_has_radar_enabled()
1405 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalc_radar_detection()
1412 if (ar->num_started_vdevs > 0) in ath10k_recalc_radar_detection()
1423 ieee80211_radar_detected(ar->hw); in ath10k_recalc_radar_detection()
1429 struct ath10k *ar = arvif->ar; in ath10k_vdev_stop()
1432 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_stop()
1434 reinit_completion(&ar->vdev_setup_done); in ath10k_vdev_stop()
1435 reinit_completion(&ar->vdev_delete_done); in ath10k_vdev_stop()
1437 ret = ath10k_wmi_vdev_stop(ar, arvif->vdev_id); in ath10k_vdev_stop()
1440 arvif->vdev_id, ret); in ath10k_vdev_stop()
1447 arvif->vdev_id, ret); in ath10k_vdev_stop()
1451 WARN_ON(ar->num_started_vdevs == 0); in ath10k_vdev_stop()
1453 if (ar->num_started_vdevs != 0) { in ath10k_vdev_stop()
1454 ar->num_started_vdevs--; in ath10k_vdev_stop()
1465 struct ath10k *ar = arvif->ar; in ath10k_vdev_start_restart()
1469 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_start_restart()
1471 reinit_completion(&ar->vdev_setup_done); in ath10k_vdev_start_restart()
1472 reinit_completion(&ar->vdev_delete_done); in ath10k_vdev_start_restart()
1474 arg.vdev_id = arvif->vdev_id; in ath10k_vdev_start_restart()
1475 arg.dtim_period = arvif->dtim_period; in ath10k_vdev_start_restart()
1476 arg.bcn_intval = arvif->beacon_interval; in ath10k_vdev_start_restart()
1478 arg.channel.freq = chandef->chan->center_freq; in ath10k_vdev_start_restart()
1479 arg.channel.band_center_freq1 = chandef->center_freq1; in ath10k_vdev_start_restart()
1480 arg.channel.band_center_freq2 = chandef->center_freq2; in ath10k_vdev_start_restart()
1484 arg.channel.max_power = chandef->chan->max_power * 2; in ath10k_vdev_start_restart()
1485 arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; in ath10k_vdev_start_restart()
1486 arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain * 2; in ath10k_vdev_start_restart()
1488 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath10k_vdev_start_restart()
1489 arg.ssid = arvif->u.ap.ssid; in ath10k_vdev_start_restart()
1490 arg.ssid_len = arvif->u.ap.ssid_len; in ath10k_vdev_start_restart()
1491 arg.hidden_ssid = arvif->u.ap.hidden_ssid; in ath10k_vdev_start_restart()
1495 !!(chandef->chan->flags & IEEE80211_CHAN_RADAR); in ath10k_vdev_start_restart()
1496 } else if (arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_vdev_start_restart()
1497 arg.ssid = arvif->vif->bss_conf.ssid; in ath10k_vdev_start_restart()
1498 arg.ssid_len = arvif->vif->bss_conf.ssid_len; in ath10k_vdev_start_restart()
1525 ar->num_started_vdevs++; in ath10k_vdev_start_restart()
1546 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_bcn_p2p_ie()
1551 if (arvif->vif->type != NL80211_IFTYPE_AP || !arvif->vif->p2p) in ath10k_mac_setup_bcn_p2p_ie()
1554 mgmt = (void *)bcn->data; in ath10k_mac_setup_bcn_p2p_ie()
1556 mgmt->u.beacon.variable, in ath10k_mac_setup_bcn_p2p_ie()
1557 bcn->len - (mgmt->u.beacon.variable - in ath10k_mac_setup_bcn_p2p_ie()
1558 bcn->data)); in ath10k_mac_setup_bcn_p2p_ie()
1560 return -ENOENT; in ath10k_mac_setup_bcn_p2p_ie()
1562 ret = ath10k_wmi_p2p_go_bcn_ie(ar, arvif->vdev_id, p2p_ie); in ath10k_mac_setup_bcn_p2p_ie()
1565 arvif->vdev_id, ret); in ath10k_mac_setup_bcn_p2p_ie()
1580 if (WARN_ON(skb->len < ie_offset)) in ath10k_mac_remove_vendor_ie()
1581 return -EINVAL; in ath10k_mac_remove_vendor_ie()
1584 skb->data + ie_offset, in ath10k_mac_remove_vendor_ie()
1585 skb->len - ie_offset); in ath10k_mac_remove_vendor_ie()
1587 return -ENOENT; in ath10k_mac_remove_vendor_ie()
1590 end = skb->data + skb->len; in ath10k_mac_remove_vendor_ie()
1594 return -EINVAL; in ath10k_mac_remove_vendor_ie()
1596 memmove(ie, next, end - next); in ath10k_mac_remove_vendor_ie()
1597 skb_trim(skb, skb->len - len); in ath10k_mac_remove_vendor_ie()
1604 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_bcn_tmpl()
1605 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_setup_bcn_tmpl()
1606 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_setup_bcn_tmpl()
1611 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_setup_bcn_tmpl()
1614 if (arvif->vdev_type != WMI_VDEV_TYPE_AP && in ath10k_mac_setup_bcn_tmpl()
1615 arvif->vdev_type != WMI_VDEV_TYPE_IBSS) in ath10k_mac_setup_bcn_tmpl()
1621 return -EPERM; in ath10k_mac_setup_bcn_tmpl()
1639 ret = ath10k_wmi_bcn_tmpl(ar, arvif->vdev_id, offs.tim_offset, bcn, 0, in ath10k_mac_setup_bcn_tmpl()
1654 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_prb_tmpl()
1655 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_setup_prb_tmpl()
1656 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_setup_prb_tmpl()
1660 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_setup_prb_tmpl()
1663 if (arvif->vdev_type != WMI_VDEV_TYPE_AP) in ath10k_mac_setup_prb_tmpl()
1673 return -EPERM; in ath10k_mac_setup_prb_tmpl()
1676 ret = ath10k_wmi_prb_tmpl(ar, arvif->vdev_id, prb); in ath10k_mac_setup_prb_tmpl()
1690 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_fix_hidden_ssid()
1705 * since only wmi-tlv firmware are known to have beacon offload and in ath10k_mac_vif_fix_hidden_ssid()
1706 * wmi-tlv doesn't seem to misbehave like 10.2 wrt vdev restart in ath10k_mac_vif_fix_hidden_ssid()
1709 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_vif_fix_hidden_ssid()
1712 if (WARN_ON(!arvif->is_started)) in ath10k_mac_vif_fix_hidden_ssid()
1713 return -EINVAL; in ath10k_mac_vif_fix_hidden_ssid()
1715 if (WARN_ON(!arvif->is_up)) in ath10k_mac_vif_fix_hidden_ssid()
1716 return -EINVAL; in ath10k_mac_vif_fix_hidden_ssid()
1718 if (WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) in ath10k_mac_vif_fix_hidden_ssid()
1719 return -EINVAL; in ath10k_mac_vif_fix_hidden_ssid()
1721 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_vif_fix_hidden_ssid()
1724 arvif->vdev_id, ret); in ath10k_mac_vif_fix_hidden_ssid()
1747 arvif->vdev_id, ret); in ath10k_mac_vif_fix_hidden_ssid()
1751 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_mac_vif_fix_hidden_ssid()
1752 arvif->bssid); in ath10k_mac_vif_fix_hidden_ssid()
1755 arvif->vdev_id, ret); in ath10k_mac_vif_fix_hidden_ssid()
1765 struct ath10k *ar = arvif->ar; in ath10k_control_beaconing()
1768 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_control_beaconing()
1770 if (!info->enable_beacon) { in ath10k_control_beaconing()
1771 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_control_beaconing()
1774 arvif->vdev_id, ret); in ath10k_control_beaconing()
1776 arvif->is_up = false; in ath10k_control_beaconing()
1778 spin_lock_bh(&arvif->ar->data_lock); in ath10k_control_beaconing()
1780 spin_unlock_bh(&arvif->ar->data_lock); in ath10k_control_beaconing()
1785 arvif->tx_seq_no = 0x1000; in ath10k_control_beaconing()
1787 arvif->aid = 0; in ath10k_control_beaconing()
1788 ether_addr_copy(arvif->bssid, info->bssid); in ath10k_control_beaconing()
1790 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_control_beaconing()
1791 arvif->bssid); in ath10k_control_beaconing()
1794 arvif->vdev_id, ret); in ath10k_control_beaconing()
1798 arvif->is_up = true; in ath10k_control_beaconing()
1803 arvif->vdev_id, ret); in ath10k_control_beaconing()
1807 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %d up\n", arvif->vdev_id); in ath10k_control_beaconing()
1814 struct ath10k *ar = arvif->ar; in ath10k_control_ibss()
1818 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_control_ibss()
1820 if (!info->ibss_joined) { in ath10k_control_ibss()
1821 if (is_zero_ether_addr(arvif->bssid)) in ath10k_control_ibss()
1824 eth_zero_addr(arvif->bssid); in ath10k_control_ibss()
1829 vdev_param = arvif->ar->wmi.vdev_param->atim_window; in ath10k_control_ibss()
1830 ret = ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id, vdev_param, in ath10k_control_ibss()
1834 arvif->vdev_id, ret); in ath10k_control_ibss()
1839 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_recalc_ps_wake_threshold()
1844 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_recalc_ps_wake_threshold()
1846 if (arvif->u.sta.uapsd) in ath10k_mac_vif_recalc_ps_wake_threshold()
1852 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, value); in ath10k_mac_vif_recalc_ps_wake_threshold()
1855 value, arvif->vdev_id, ret); in ath10k_mac_vif_recalc_ps_wake_threshold()
1864 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_recalc_ps_poll_count()
1869 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_recalc_ps_poll_count()
1871 if (arvif->u.sta.uapsd) in ath10k_mac_vif_recalc_ps_poll_count()
1877 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_mac_vif_recalc_ps_poll_count()
1881 value, arvif->vdev_id, ret); in ath10k_mac_vif_recalc_ps_poll_count()
1893 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_num_vifs_started()
1895 list_for_each_entry(arvif, &ar->arvifs, list) in ath10k_mac_num_vifs_started()
1896 if (arvif->is_started) in ath10k_mac_num_vifs_started()
1904 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_setup_ps()
1905 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_vif_setup_ps()
1906 struct ieee80211_conf *conf = &ar->hw->conf; in ath10k_mac_vif_setup_ps()
1913 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_setup_ps()
1915 if (arvif->vif->type != NL80211_IFTYPE_STATION) in ath10k_mac_vif_setup_ps()
1918 enable_ps = arvif->ps; in ath10k_mac_vif_setup_ps()
1922 ar->running_fw->fw_file.fw_features)) { in ath10k_mac_vif_setup_ps()
1924 arvif->vdev_id); in ath10k_mac_vif_setup_ps()
1928 if (!arvif->is_started) { in ath10k_mac_vif_setup_ps()
1930 * Firmware doesn't behave nicely and consumes more power than in ath10k_mac_vif_setup_ps()
1931 * necessary if PS is disabled on a non-started vdev. Hence in ath10k_mac_vif_setup_ps()
1932 * force-enable PS for non-running vdevs. in ath10k_mac_vif_setup_ps()
1939 ps_timeout = conf->dynamic_ps_timeout; in ath10k_mac_vif_setup_ps()
1943 vif->bss_conf.beacon_int) / 1000; in ath10k_mac_vif_setup_ps()
1946 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, in ath10k_mac_vif_setup_ps()
1950 arvif->vdev_id, ret); in ath10k_mac_vif_setup_ps()
1958 arvif->vdev_id, psmode ? "enable" : "disable"); in ath10k_mac_vif_setup_ps()
1960 ret = ath10k_wmi_set_psmode(ar, arvif->vdev_id, psmode); in ath10k_mac_vif_setup_ps()
1963 psmode, arvif->vdev_id, ret); in ath10k_mac_vif_setup_ps()
1972 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_disable_keepalive()
1976 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_disable_keepalive()
1978 if (arvif->vdev_type != WMI_VDEV_TYPE_STA) in ath10k_mac_vif_disable_keepalive()
1981 if (!test_bit(WMI_SERVICE_STA_KEEP_ALIVE, ar->wmi.svc_map)) in ath10k_mac_vif_disable_keepalive()
1987 arg.vdev_id = arvif->vdev_id; in ath10k_mac_vif_disable_keepalive()
1995 arvif->vdev_id, ret); in ath10k_mac_vif_disable_keepalive()
2004 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_ap_csa_count_down()
2005 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_vif_ap_csa_count_down()
2008 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_ap_csa_count_down()
2010 if (WARN_ON(!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map))) in ath10k_mac_vif_ap_csa_count_down()
2013 if (arvif->vdev_type != WMI_VDEV_TYPE_AP) in ath10k_mac_vif_ap_csa_count_down()
2016 if (!vif->csa_active) in ath10k_mac_vif_ap_csa_count_down()
2019 if (!arvif->is_up) in ath10k_mac_vif_ap_csa_count_down()
2043 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_ap_csa_work()
2045 mutex_lock(&ar->conf_mutex); in ath10k_mac_vif_ap_csa_work()
2047 mutex_unlock(&ar->conf_mutex); in ath10k_mac_vif_ap_csa_work()
2054 struct ieee80211_mgmt *mgmt = (void *)skb->data; in ath10k_mac_handle_beacon_iter()
2055 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_handle_beacon_iter()
2057 if (vif->type != NL80211_IFTYPE_STATION) in ath10k_mac_handle_beacon_iter()
2060 if (!ether_addr_equal(mgmt->bssid, vif->bss_conf.bssid)) in ath10k_mac_handle_beacon_iter()
2063 cancel_delayed_work(&arvif->connection_loss_work); in ath10k_mac_handle_beacon_iter()
2068 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_beacon()
2078 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_handle_beacon_miss_iter()
2079 struct ath10k *ar = arvif->ar; in ath10k_mac_handle_beacon_miss_iter()
2080 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_handle_beacon_miss_iter()
2082 if (arvif->vdev_id != *vdev_id) in ath10k_mac_handle_beacon_miss_iter()
2085 if (!arvif->is_up) in ath10k_mac_handle_beacon_miss_iter()
2095 ieee80211_queue_delayed_work(hw, &arvif->connection_loss_work, in ath10k_mac_handle_beacon_miss_iter()
2101 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_beacon_miss()
2111 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_vif_sta_connection_loss_work()
2113 if (!arvif->is_up) in ath10k_mac_vif_sta_connection_loss_work()
2134 if (vif->type == NL80211_IFTYPE_STATION) in ath10k_peer_assoc_h_listen_intval()
2137 return ar->hw->conf.listen_interval; in ath10k_peer_assoc_h_listen_intval()
2145 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_basic()
2148 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_basic()
2150 if (vif->type == NL80211_IFTYPE_STATION) in ath10k_peer_assoc_h_basic()
2151 aid = vif->bss_conf.aid; in ath10k_peer_assoc_h_basic()
2153 aid = sta->aid; in ath10k_peer_assoc_h_basic()
2155 ether_addr_copy(arg->addr, sta->addr); in ath10k_peer_assoc_h_basic()
2156 arg->vdev_id = arvif->vdev_id; in ath10k_peer_assoc_h_basic()
2157 arg->peer_aid = aid; in ath10k_peer_assoc_h_basic()
2158 arg->peer_flags |= arvif->ar->wmi.peer_flags->auth; in ath10k_peer_assoc_h_basic()
2159 arg->peer_listen_intval = ath10k_peer_assoc_h_listen_intval(ar, vif); in ath10k_peer_assoc_h_basic()
2160 arg->peer_num_spatial_streams = 1; in ath10k_peer_assoc_h_basic()
2161 arg->peer_caps = vif->bss_conf.assoc_capability; in ath10k_peer_assoc_h_basic()
2169 struct ieee80211_bss_conf *info = &vif->bss_conf; in ath10k_peer_assoc_h_crypto()
2175 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_crypto()
2180 bss = cfg80211_get_bss(ar->hw->wiphy, def.chan, info->bssid, NULL, 0, in ath10k_peer_assoc_h_crypto()
2188 ies = rcu_dereference(bss->ies); in ath10k_peer_assoc_h_crypto()
2192 ies->data, in ath10k_peer_assoc_h_crypto()
2193 ies->len); in ath10k_peer_assoc_h_crypto()
2195 cfg80211_put_bss(ar->hw->wiphy, bss); in ath10k_peer_assoc_h_crypto()
2201 arg->peer_flags |= ar->wmi.peer_flags->need_ptk_4_way; in ath10k_peer_assoc_h_crypto()
2206 arg->peer_flags |= ar->wmi.peer_flags->need_gtk_2_way; in ath10k_peer_assoc_h_crypto()
2209 if (sta->mfp && in ath10k_peer_assoc_h_crypto()
2211 ar->running_fw->fw_file.fw_features)) { in ath10k_peer_assoc_h_crypto()
2212 arg->peer_flags |= ar->wmi.peer_flags->pmf; in ath10k_peer_assoc_h_crypto()
2221 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_rates()
2222 struct wmi_rate_set_arg *rateset = &arg->peer_legacy_rates; in ath10k_peer_assoc_h_rates()
2231 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_rates()
2236 band = def.chan->band; in ath10k_peer_assoc_h_rates()
2237 sband = ar->hw->wiphy->bands[band]; in ath10k_peer_assoc_h_rates()
2238 ratemask = sta->supp_rates[band]; in ath10k_peer_assoc_h_rates()
2239 ratemask &= arvif->bitrate_mask.control[band].legacy; in ath10k_peer_assoc_h_rates()
2240 rates = sband->bitrates; in ath10k_peer_assoc_h_rates()
2242 rateset->num_rates = 0; in ath10k_peer_assoc_h_rates()
2248 rate = ath10k_mac_bitrate_to_rate(rates->bitrate); in ath10k_peer_assoc_h_rates()
2249 rateset->rates[rateset->num_rates] = rate; in ath10k_peer_assoc_h_rates()
2250 rateset->num_rates++; in ath10k_peer_assoc_h_rates()
2283 const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; in ath10k_peer_assoc_h_ht()
2284 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_ht()
2293 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_ht()
2298 if (!ht_cap->ht_supported) in ath10k_peer_assoc_h_ht()
2301 band = def.chan->band; in ath10k_peer_assoc_h_ht()
2302 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath10k_peer_assoc_h_ht()
2303 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_peer_assoc_h_ht()
2309 arg->peer_flags |= ar->wmi.peer_flags->ht; in ath10k_peer_assoc_h_ht()
2310 arg->peer_max_mpdu = (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + in ath10k_peer_assoc_h_ht()
2311 ht_cap->ampdu_factor)) - 1; in ath10k_peer_assoc_h_ht()
2313 arg->peer_mpdu_density = in ath10k_peer_assoc_h_ht()
2314 ath10k_parse_mpdudensity(ht_cap->ampdu_density); in ath10k_peer_assoc_h_ht()
2316 arg->peer_ht_caps = ht_cap->cap; in ath10k_peer_assoc_h_ht()
2317 arg->peer_rate_caps |= WMI_RC_HT_FLAG; in ath10k_peer_assoc_h_ht()
2319 if (ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING) in ath10k_peer_assoc_h_ht()
2320 arg->peer_flags |= ar->wmi.peer_flags->ldbc; in ath10k_peer_assoc_h_ht()
2322 if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) { in ath10k_peer_assoc_h_ht()
2323 arg->peer_flags |= ar->wmi.peer_flags->bw40; in ath10k_peer_assoc_h_ht()
2324 arg->peer_rate_caps |= WMI_RC_CW40_FLAG; in ath10k_peer_assoc_h_ht()
2327 if (arvif->bitrate_mask.control[band].gi != NL80211_TXRATE_FORCE_LGI) { in ath10k_peer_assoc_h_ht()
2328 if (ht_cap->cap & IEEE80211_HT_CAP_SGI_20) in ath10k_peer_assoc_h_ht()
2329 arg->peer_rate_caps |= WMI_RC_SGI_FLAG; in ath10k_peer_assoc_h_ht()
2331 if (ht_cap->cap & IEEE80211_HT_CAP_SGI_40) in ath10k_peer_assoc_h_ht()
2332 arg->peer_rate_caps |= WMI_RC_SGI_FLAG; in ath10k_peer_assoc_h_ht()
2335 if (ht_cap->cap & IEEE80211_HT_CAP_TX_STBC) { in ath10k_peer_assoc_h_ht()
2336 arg->peer_rate_caps |= WMI_RC_TX_STBC_FLAG; in ath10k_peer_assoc_h_ht()
2337 arg->peer_flags |= ar->wmi.peer_flags->stbc; in ath10k_peer_assoc_h_ht()
2340 if (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC) { in ath10k_peer_assoc_h_ht()
2341 stbc = ht_cap->cap & IEEE80211_HT_CAP_RX_STBC; in ath10k_peer_assoc_h_ht()
2344 arg->peer_rate_caps |= stbc; in ath10k_peer_assoc_h_ht()
2345 arg->peer_flags |= ar->wmi.peer_flags->stbc; in ath10k_peer_assoc_h_ht()
2348 if (ht_cap->mcs.rx_mask[1] && ht_cap->mcs.rx_mask[2]) in ath10k_peer_assoc_h_ht()
2349 arg->peer_rate_caps |= WMI_RC_TS_FLAG; in ath10k_peer_assoc_h_ht()
2350 else if (ht_cap->mcs.rx_mask[1]) in ath10k_peer_assoc_h_ht()
2351 arg->peer_rate_caps |= WMI_RC_DS_FLAG; in ath10k_peer_assoc_h_ht()
2354 if ((ht_cap->mcs.rx_mask[i / 8] & BIT(i % 8)) && in ath10k_peer_assoc_h_ht()
2357 arg->peer_ht_rates.rates[n++] = i; in ath10k_peer_assoc_h_ht()
2361 * This is a workaround for HT-enabled STAs which break the spec in ath10k_peer_assoc_h_ht()
2370 arg->peer_ht_rates.num_rates = 8; in ath10k_peer_assoc_h_ht()
2371 for (i = 0; i < arg->peer_ht_rates.num_rates; i++) in ath10k_peer_assoc_h_ht()
2372 arg->peer_ht_rates.rates[i] = i; in ath10k_peer_assoc_h_ht()
2374 arg->peer_ht_rates.num_rates = n; in ath10k_peer_assoc_h_ht()
2375 arg->peer_num_spatial_streams = min(sta->rx_nss, max_nss); in ath10k_peer_assoc_h_ht()
2379 arg->addr, in ath10k_peer_assoc_h_ht()
2380 arg->peer_ht_rates.num_rates, in ath10k_peer_assoc_h_ht()
2381 arg->peer_num_spatial_streams); in ath10k_peer_assoc_h_ht()
2392 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_qos_ap()
2394 if (sta->wme && sta->uapsd_queues) { in ath10k_peer_assoc_qos_ap()
2396 sta->uapsd_queues, sta->max_sp); in ath10k_peer_assoc_qos_ap()
2398 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) in ath10k_peer_assoc_qos_ap()
2401 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VI) in ath10k_peer_assoc_qos_ap()
2404 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BK) in ath10k_peer_assoc_qos_ap()
2407 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BE) in ath10k_peer_assoc_qos_ap()
2411 if (sta->max_sp < MAX_WMI_AP_PS_PEER_PARAM_MAX_SP) in ath10k_peer_assoc_qos_ap()
2412 max_sp = sta->max_sp; in ath10k_peer_assoc_qos_ap()
2414 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, in ath10k_peer_assoc_qos_ap()
2415 sta->addr, in ath10k_peer_assoc_qos_ap()
2420 arvif->vdev_id, ret); in ath10k_peer_assoc_qos_ap()
2424 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, in ath10k_peer_assoc_qos_ap()
2425 sta->addr, in ath10k_peer_assoc_qos_ap()
2430 arvif->vdev_id, ret); in ath10k_peer_assoc_qos_ap()
2436 * sta->listen_interval - mac80211 patch required. in ath10k_peer_assoc_qos_ap()
2439 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, sta->addr, in ath10k_peer_assoc_qos_ap()
2444 arvif->vdev_id, ret); in ath10k_peer_assoc_qos_ap()
2466 idx_limit = fls(mcs_map) - 1; in ath10k_peer_assoc_h_vht_limit()
2468 idx_limit = -1; in ath10k_peer_assoc_h_vht_limit()
2482 case -1: in ath10k_peer_assoc_h_vht_limit()
2532 const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; in ath10k_peer_assoc_h_vht()
2533 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_vht()
2534 struct ath10k_hw_params *hw = &ar->hw_params; in ath10k_peer_assoc_h_vht()
2545 if (!vht_cap->vht_supported) in ath10k_peer_assoc_h_vht()
2548 band = def.chan->band; in ath10k_peer_assoc_h_vht()
2549 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_peer_assoc_h_vht()
2554 arg->peer_flags |= ar->wmi.peer_flags->vht; in ath10k_peer_assoc_h_vht()
2556 if (def.chan->band == NL80211_BAND_2GHZ) in ath10k_peer_assoc_h_vht()
2557 arg->peer_flags |= ar->wmi.peer_flags->vht_2g; in ath10k_peer_assoc_h_vht()
2559 arg->peer_vht_caps = vht_cap->cap; in ath10k_peer_assoc_h_vht()
2561 ampdu_factor = (vht_cap->cap & in ath10k_peer_assoc_h_vht()
2565 /* Workaround: Some Netgear/Linksys 11ac APs set Rx A-MPDU factor to in ath10k_peer_assoc_h_vht()
2567 * arg->peer_max_mpdu at this point contains HT max_mpdu so keep in ath10k_peer_assoc_h_vht()
2570 arg->peer_max_mpdu = max(arg->peer_max_mpdu, in ath10k_peer_assoc_h_vht()
2572 ampdu_factor)) - 1); in ath10k_peer_assoc_h_vht()
2574 if (sta->bandwidth == IEEE80211_STA_RX_BW_80) in ath10k_peer_assoc_h_vht()
2575 arg->peer_flags |= ar->wmi.peer_flags->bw80; in ath10k_peer_assoc_h_vht()
2577 if (sta->bandwidth == IEEE80211_STA_RX_BW_160) in ath10k_peer_assoc_h_vht()
2578 arg->peer_flags |= ar->wmi.peer_flags->bw160; in ath10k_peer_assoc_h_vht()
2584 vht_mcs = __le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map) >> in ath10k_peer_assoc_h_vht()
2591 arg->peer_num_spatial_streams = min(sta->rx_nss, max_nss); in ath10k_peer_assoc_h_vht()
2592 arg->peer_vht_rates.rx_max_rate = in ath10k_peer_assoc_h_vht()
2593 __le16_to_cpu(vht_cap->vht_mcs.rx_highest); in ath10k_peer_assoc_h_vht()
2594 arg->peer_vht_rates.rx_mcs_set = in ath10k_peer_assoc_h_vht()
2595 __le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map); in ath10k_peer_assoc_h_vht()
2596 arg->peer_vht_rates.tx_max_rate = in ath10k_peer_assoc_h_vht()
2597 __le16_to_cpu(vht_cap->vht_mcs.tx_highest); in ath10k_peer_assoc_h_vht()
2598 arg->peer_vht_rates.tx_mcs_set = ath10k_peer_assoc_h_vht_limit( in ath10k_peer_assoc_h_vht()
2599 __le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); in ath10k_peer_assoc_h_vht()
2601 /* Configure bandwidth-NSS mapping to FW in ath10k_peer_assoc_h_vht()
2604 if (arg->peer_phymode == MODE_11AC_VHT160 || in ath10k_peer_assoc_h_vht()
2605 arg->peer_phymode == MODE_11AC_VHT80_80) { in ath10k_peer_assoc_h_vht()
2609 max_rate = arg->peer_vht_rates.rx_max_rate; in ath10k_peer_assoc_h_vht()
2613 rx_nss = arg->peer_num_spatial_streams; in ath10k_peer_assoc_h_vht()
2615 rx_nss = min(arg->peer_num_spatial_streams, rx_nss); in ath10k_peer_assoc_h_vht()
2617 max_rate = hw->vht160_mcs_tx_highest; in ath10k_peer_assoc_h_vht()
2620 arg->peer_bw_rxnss_override = in ath10k_peer_assoc_h_vht()
2622 FIELD_PREP(WMI_PEER_NSS_160MHZ_MASK, (rx_nss - 1)); in ath10k_peer_assoc_h_vht()
2624 if (arg->peer_phymode == MODE_11AC_VHT80_80) { in ath10k_peer_assoc_h_vht()
2625 arg->peer_bw_rxnss_override |= in ath10k_peer_assoc_h_vht()
2626 FIELD_PREP(WMI_PEER_NSS_80_80MHZ_MASK, (rx_nss - 1)); in ath10k_peer_assoc_h_vht()
2631 sta->addr, arg->peer_max_mpdu, in ath10k_peer_assoc_h_vht()
2632 arg->peer_flags, arg->peer_bw_rxnss_override); in ath10k_peer_assoc_h_vht()
2640 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_qos()
2642 switch (arvif->vdev_type) { in ath10k_peer_assoc_h_qos()
2644 if (sta->wme) in ath10k_peer_assoc_h_qos()
2645 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2647 if (sta->wme && sta->uapsd_queues) { in ath10k_peer_assoc_h_qos()
2648 arg->peer_flags |= arvif->ar->wmi.peer_flags->apsd; in ath10k_peer_assoc_h_qos()
2649 arg->peer_rate_caps |= WMI_RC_UAPSD_FLAG; in ath10k_peer_assoc_h_qos()
2653 if (sta->wme) in ath10k_peer_assoc_h_qos()
2654 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2657 if (sta->wme) in ath10k_peer_assoc_h_qos()
2658 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2665 sta->addr, !!(arg->peer_flags & in ath10k_peer_assoc_h_qos()
2666 arvif->ar->wmi.peer_flags->qos)); in ath10k_peer_assoc_h_qos()
2671 return sta->supp_rates[NL80211_BAND_2GHZ] >> in ath10k_mac_sta_has_ofdm_only()
2678 if (sta->bandwidth == IEEE80211_STA_RX_BW_160) { in ath10k_mac_get_phymode_vht()
2679 switch (sta->vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) { in ath10k_mac_get_phymode_vht()
2690 if (sta->bandwidth == IEEE80211_STA_RX_BW_80) in ath10k_mac_get_phymode_vht()
2693 if (sta->bandwidth == IEEE80211_STA_RX_BW_40) in ath10k_mac_get_phymode_vht()
2696 if (sta->bandwidth == IEEE80211_STA_RX_BW_20) in ath10k_mac_get_phymode_vht()
2707 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_phymode()
2717 band = def.chan->band; in ath10k_peer_assoc_h_phymode()
2718 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath10k_peer_assoc_h_phymode()
2719 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_peer_assoc_h_phymode()
2723 if (sta->vht_cap.vht_supported && in ath10k_peer_assoc_h_phymode()
2725 if (sta->bandwidth == IEEE80211_STA_RX_BW_40) in ath10k_peer_assoc_h_phymode()
2729 } else if (sta->ht_cap.ht_supported && in ath10k_peer_assoc_h_phymode()
2731 if (sta->bandwidth == IEEE80211_STA_RX_BW_40) in ath10k_peer_assoc_h_phymode()
2746 if (sta->vht_cap.vht_supported && in ath10k_peer_assoc_h_phymode()
2749 } else if (sta->ht_cap.ht_supported && in ath10k_peer_assoc_h_phymode()
2751 if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) in ath10k_peer_assoc_h_phymode()
2765 sta->addr, ath10k_wmi_phymode_str(phymode)); in ath10k_peer_assoc_h_phymode()
2767 arg->peer_phymode = phymode; in ath10k_peer_assoc_h_phymode()
2776 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_prepare()
2804 if (!ht_cap->ht_supported) in ath10k_setup_peer_smps()
2807 smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS; in ath10k_setup_peer_smps()
2811 return -EINVAL; in ath10k_setup_peer_smps()
2813 return ath10k_wmi_peer_set_param(ar, arvif->vdev_id, addr, in ath10k_setup_peer_smps()
2814 ar->wmi.peer_param->smps_state, in ath10k_setup_peer_smps()
2822 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_vif_recalc_txbf()
2830 if (!(ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2837 param = ar->wmi.vdev_param->txbf; in ath10k_mac_vif_recalc_txbf()
2847 if (ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2857 if (ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2873 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, value); in ath10k_mac_vif_recalc_txbf()
2888 struct ath10k *ar = hw->priv; in ath10k_bss_assoc()
2889 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_bss_assoc()
2896 lockdep_assert_held(&ar->conf_mutex); in ath10k_bss_assoc()
2899 arvif->vdev_id, arvif->bssid, arvif->aid); in ath10k_bss_assoc()
2903 ap_sta = ieee80211_find_sta(vif, bss_conf->bssid); in ath10k_bss_assoc()
2906 bss_conf->bssid, arvif->vdev_id); in ath10k_bss_assoc()
2914 ht_cap = ap_sta->ht_cap; in ath10k_bss_assoc()
2915 vht_cap = ap_sta->vht_cap; in ath10k_bss_assoc()
2920 bss_conf->bssid, arvif->vdev_id, ret); in ath10k_bss_assoc()
2930 bss_conf->bssid, arvif->vdev_id, ret); in ath10k_bss_assoc()
2934 ret = ath10k_setup_peer_smps(ar, arvif, bss_conf->bssid, &ht_cap); in ath10k_bss_assoc()
2937 arvif->vdev_id, ret); in ath10k_bss_assoc()
2944 arvif->vdev_id, bss_conf->bssid, ret); in ath10k_bss_assoc()
2950 arvif->vdev_id, bss_conf->bssid, bss_conf->aid); in ath10k_bss_assoc()
2952 WARN_ON(arvif->is_up); in ath10k_bss_assoc()
2954 arvif->aid = bss_conf->aid; in ath10k_bss_assoc()
2955 ether_addr_copy(arvif->bssid, bss_conf->bssid); in ath10k_bss_assoc()
2958 ar->wmi.pdev_param->peer_stats_info_enable, 1); in ath10k_bss_assoc()
2962 ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid); in ath10k_bss_assoc()
2965 arvif->vdev_id, ret); in ath10k_bss_assoc()
2969 arvif->is_up = true; in ath10k_bss_assoc()
2972 * WLAN.RM.2.0-00073) have buggy powersave state machine and must be in ath10k_bss_assoc()
2975 ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, arvif->bssid, in ath10k_bss_assoc()
2976 ar->wmi.peer_param->dummy_var, 1); in ath10k_bss_assoc()
2979 arvif->bssid, arvif->vdev_id, ret); in ath10k_bss_assoc()
2987 struct ath10k *ar = hw->priv; in ath10k_bss_disassoc()
2988 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_bss_disassoc()
2992 lockdep_assert_held(&ar->conf_mutex); in ath10k_bss_disassoc()
2995 arvif->vdev_id, arvif->bssid); in ath10k_bss_disassoc()
2997 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_bss_disassoc()
3000 arvif->vdev_id, ret); in ath10k_bss_disassoc()
3002 arvif->def_wep_key_idx = -1; in ath10k_bss_disassoc()
3007 arvif->vdev_id, ret); in ath10k_bss_disassoc()
3011 arvif->is_up = false; in ath10k_bss_disassoc()
3013 cancel_delayed_work_sync(&arvif->connection_loss_work); in ath10k_bss_disassoc()
3021 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_new_peer_tid_config()
3027 if (arvif->retry_long[i] || arvif->ampdu[i] || in ath10k_new_peer_tid_config()
3028 arvif->rate_ctrl[i] || arvif->rtscts[i]) { in ath10k_new_peer_tid_config()
3031 arg.vdev_id = arvif->vdev_id; in ath10k_new_peer_tid_config()
3032 arg.retry_count = arvif->retry_long[i]; in ath10k_new_peer_tid_config()
3033 arg.aggr_control = arvif->ampdu[i]; in ath10k_new_peer_tid_config()
3034 arg.rate_ctrl = arvif->rate_ctrl[i]; in ath10k_new_peer_tid_config()
3035 arg.rcode_flags = arvif->rate_code[i]; in ath10k_new_peer_tid_config()
3037 if (arvif->rtscts[i]) in ath10k_new_peer_tid_config()
3043 arg.rtscts_ctrl = arvif->rtscts[i]; in ath10k_new_peer_tid_config()
3046 if (arvif->noack[i]) { in ath10k_new_peer_tid_config()
3047 arg.ack_policy = arvif->noack[i]; in ath10k_new_peer_tid_config()
3053 /* Assign default value(-1) to newly connected station. in ath10k_new_peer_tid_config()
3057 arsta->retry_long[i] = -1; in ath10k_new_peer_tid_config()
3058 arsta->noack[i] = -1; in ath10k_new_peer_tid_config()
3059 arsta->ampdu[i] = -1; in ath10k_new_peer_tid_config()
3064 ether_addr_copy(arg.peer_macaddr.addr, sta->addr); in ath10k_new_peer_tid_config()
3069 sta->addr, ret); in ath10k_new_peer_tid_config()
3084 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_station_assoc()
3088 lockdep_assert_held(&ar->conf_mutex); in ath10k_station_assoc()
3093 sta->addr, arvif->vdev_id, ret); in ath10k_station_assoc()
3100 sta->addr, arvif->vdev_id, ret); in ath10k_station_assoc()
3104 /* Re-assoc is run only to update supported rates for given station. It in ath10k_station_assoc()
3108 ret = ath10k_setup_peer_smps(ar, arvif, sta->addr, in ath10k_station_assoc()
3109 &sta->ht_cap); in ath10k_station_assoc()
3112 arvif->vdev_id, ret); in ath10k_station_assoc()
3119 sta->addr, arvif->vdev_id, ret); in ath10k_station_assoc()
3123 if (!sta->wme) { in ath10k_station_assoc()
3124 arvif->num_legacy_stations++; in ath10k_station_assoc()
3128 arvif->vdev_id, ret); in ath10k_station_assoc()
3134 if ((arvif->def_wep_key_idx != -1) && (!sta->tdls)) { in ath10k_station_assoc()
3135 ret = ath10k_install_peer_wep_keys(arvif, sta->addr); in ath10k_station_assoc()
3138 arvif->vdev_id, ret); in ath10k_station_assoc()
3144 if (!test_bit(WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT, ar->wmi.svc_map)) in ath10k_station_assoc()
3154 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_station_disassoc()
3157 lockdep_assert_held(&ar->conf_mutex); in ath10k_station_disassoc()
3159 if (!sta->wme) { in ath10k_station_disassoc()
3160 arvif->num_legacy_stations--; in ath10k_station_disassoc()
3164 arvif->vdev_id, ret); in ath10k_station_disassoc()
3169 ret = ath10k_clear_peer_keys(arvif, sta->addr); in ath10k_station_disassoc()
3172 arvif->vdev_id, ret); in ath10k_station_disassoc()
3185 struct ieee80211_hw *hw = ar->hw; in ath10k_update_channel_list()
3196 lockdep_assert_held(&ar->conf_mutex); in ath10k_update_channel_list()
3198 bands = hw->wiphy->bands; in ath10k_update_channel_list()
3203 for (i = 0; i < bands[band]->n_channels; i++) { in ath10k_update_channel_list()
3204 if (bands[band]->channels[i].flags & in ath10k_update_channel_list()
3215 return -ENOMEM; in ath10k_update_channel_list()
3222 for (i = 0; i < bands[band]->n_channels; i++) { in ath10k_update_channel_list()
3223 channel = &bands[band]->channels[i]; in ath10k_update_channel_list()
3225 if (channel->flags & IEEE80211_CHAN_DISABLED) in ath10k_update_channel_list()
3228 ch->allow_ht = true; in ath10k_update_channel_list()
3231 ch->allow_vht = true; in ath10k_update_channel_list()
3233 ch->allow_ibss = in ath10k_update_channel_list()
3234 !(channel->flags & IEEE80211_CHAN_NO_IR); in ath10k_update_channel_list()
3236 ch->ht40plus = in ath10k_update_channel_list()
3237 !(channel->flags & IEEE80211_CHAN_NO_HT40PLUS); in ath10k_update_channel_list()
3239 ch->chan_radar = in ath10k_update_channel_list()
3240 !!(channel->flags & IEEE80211_CHAN_RADAR); in ath10k_update_channel_list()
3242 passive = channel->flags & IEEE80211_CHAN_NO_IR; in ath10k_update_channel_list()
3243 ch->passive = passive; in ath10k_update_channel_list()
3250 ch->passive |= ch->chan_radar; in ath10k_update_channel_list()
3252 ch->freq = channel->center_freq; in ath10k_update_channel_list()
3253 ch->band_center_freq1 = channel->center_freq; in ath10k_update_channel_list()
3254 ch->min_power = 0; in ath10k_update_channel_list()
3255 ch->max_power = channel->max_power * 2; in ath10k_update_channel_list()
3256 ch->max_reg_power = channel->max_reg_power * 2; in ath10k_update_channel_list()
3257 ch->max_antenna_gain = channel->max_antenna_gain * 2; in ath10k_update_channel_list()
3258 ch->reg_class_id = 0; /* FIXME */ in ath10k_update_channel_list()
3264 if (channel->band == NL80211_BAND_2GHZ) in ath10k_update_channel_list()
3265 ch->mode = MODE_11G; in ath10k_update_channel_list()
3267 ch->mode = MODE_11A; in ath10k_update_channel_list()
3269 if (WARN_ON_ONCE(ch->mode == MODE_UNKNOWN)) in ath10k_update_channel_list()
3274 ch - arg.channels, arg.n_channels, in ath10k_update_channel_list()
3275 ch->freq, ch->max_power, ch->max_reg_power, in ath10k_update_channel_list()
3276 ch->max_antenna_gain, ch->mode); in ath10k_update_channel_list()
3311 lockdep_assert_held(&ar->conf_mutex); in ath10k_regd_update()
3317 regpair = ar->ath_common.regulatory.regpair; in ath10k_regd_update()
3319 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { in ath10k_regd_update()
3320 nl_dfs_reg = ar->dfs_detector->region; in ath10k_regd_update()
3326 /* Target allows setting up per-band regdomain but ath_common provides in ath10k_regd_update()
3327 * a combined one only in ath10k_regd_update()
3330 regpair->reg_domain, in ath10k_regd_update()
3331 regpair->reg_domain, /* 2ghz */ in ath10k_regd_update()
3332 regpair->reg_domain, /* 5ghz */ in ath10k_regd_update()
3333 regpair->reg_2ghz_ctl, in ath10k_regd_update()
3334 regpair->reg_5ghz_ctl, in ath10k_regd_update()
3345 if (ar->low_5ghz_chan && ar->high_5ghz_chan) { in ath10k_mac_update_channel_list()
3346 for (i = 0; i < band->n_channels; i++) { in ath10k_mac_update_channel_list()
3347 if (band->channels[i].center_freq < ar->low_5ghz_chan || in ath10k_mac_update_channel_list()
3348 band->channels[i].center_freq > ar->high_5ghz_chan) in ath10k_mac_update_channel_list()
3349 band->channels[i].flags |= in ath10k_mac_update_channel_list()
3359 struct ath10k *ar = hw->priv; in ath10k_reg_notifier()
3362 ath_reg_notifier_apply(wiphy, request, &ar->ath_common.regulatory); in ath10k_reg_notifier()
3364 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { in ath10k_reg_notifier()
3366 request->dfs_region); in ath10k_reg_notifier()
3367 result = ar->dfs_detector->set_dfs_domain(ar->dfs_detector, in ath10k_reg_notifier()
3368 request->dfs_region); in ath10k_reg_notifier()
3371 request->dfs_region); in ath10k_reg_notifier()
3374 mutex_lock(&ar->conf_mutex); in ath10k_reg_notifier()
3375 if (ar->state == ATH10K_STATE_ON) in ath10k_reg_notifier()
3377 mutex_unlock(&ar->conf_mutex); in ath10k_reg_notifier()
3379 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_reg_notifier()
3381 ar->hw->wiphy->bands[NL80211_BAND_5GHZ]); in ath10k_reg_notifier()
3386 spin_lock_bh(&ar->data_lock); in ath10k_stop_radar_confirmation()
3387 ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_STOPPED; in ath10k_stop_radar_confirmation()
3388 spin_unlock_bh(&ar->data_lock); in ath10k_stop_radar_confirmation()
3390 cancel_work_sync(&ar->radar_confirmation_work); in ath10k_stop_radar_confirmation()
3406 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_tx_lock()
3409 ar->tx_paused |= BIT(reason); in ath10k_mac_tx_lock()
3410 ieee80211_stop_queues(ar->hw); in ath10k_mac_tx_lock()
3417 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_tx_unlock_iter()
3419 if (arvif->tx_paused) in ath10k_mac_tx_unlock_iter()
3422 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_mac_tx_unlock_iter()
3427 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_tx_unlock()
3430 ar->tx_paused &= ~BIT(reason); in ath10k_mac_tx_unlock()
3432 if (ar->tx_paused) in ath10k_mac_tx_unlock()
3435 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_tx_unlock()
3440 ieee80211_wake_queue(ar->hw, ar->hw->offchannel_tx_hw_queue); in ath10k_mac_tx_unlock()
3445 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_tx_lock()
3447 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_tx_lock()
3450 arvif->tx_paused |= BIT(reason); in ath10k_mac_vif_tx_lock()
3451 ieee80211_stop_queue(ar->hw, arvif->vdev_id); in ath10k_mac_vif_tx_lock()
3456 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_tx_unlock()
3458 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_tx_unlock()
3461 arvif->tx_paused &= ~BIT(reason); in ath10k_mac_vif_tx_unlock()
3463 if (ar->tx_paused) in ath10k_mac_vif_tx_unlock()
3466 if (arvif->tx_paused) in ath10k_mac_vif_tx_unlock()
3469 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_mac_vif_tx_unlock()
3476 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_handle_tx_pause()
3478 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_handle_tx_pause()
3490 action, arvif->vdev_id); in ath10k_mac_vif_handle_tx_pause()
3504 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_handle_tx_pause_iter()
3507 if (arvif->vdev_id != arg->vdev_id) in ath10k_mac_handle_tx_pause_iter()
3510 ath10k_mac_vif_handle_tx_pause(arvif, arg->pause_id, arg->action); in ath10k_mac_handle_tx_pause_iter()
3523 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_handle_tx_pause_vdev()
3524 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_tx_pause_vdev()
3528 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_handle_tx_pause_vdev()
3537 const struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_mac_tx_h_get_txmode()
3539 __le16 fc = hdr->frame_control; in ath10k_mac_tx_h_get_txmode()
3541 if (!vif || vif->type == NL80211_IFTYPE_MONITOR) in ath10k_mac_tx_h_get_txmode()
3551 * accurate - otherwise either mac80211 or userspace (e.g. hostapd) can in ath10k_mac_tx_h_get_txmode()
3563 if (ar->htt.target_version_major < 3 && in ath10k_mac_tx_h_get_txmode()
3566 ar->running_fw->fw_file.fw_features)) in ath10k_mac_tx_h_get_txmode()
3571 * Some wmi-tlv firmwares for qca6174 have broken Tx key selection for in ath10k_mac_tx_h_get_txmode()
3572 * NativeWifi txmode - it selects AP key instead of peer key. It seems in ath10k_mac_tx_h_get_txmode()
3577 if (ieee80211_is_data_present(fc) && sta && sta->tdls) in ath10k_mac_tx_h_get_txmode()
3580 if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) || in ath10k_mac_tx_h_get_txmode()
3581 skb_cb->flags & ATH10K_SKB_F_RAW_TX) in ath10k_mac_tx_h_get_txmode()
3591 const struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_tx_h_use_hwcrypto()
3595 if (!ieee80211_has_protected(hdr->frame_control)) in ath10k_tx_h_use_hwcrypto()
3598 if ((info->flags & mask) == mask) in ath10k_tx_h_use_hwcrypto()
3602 return !((struct ath10k_vif *)vif->drv_priv)->nohwcrypt; in ath10k_tx_h_use_hwcrypto()
3612 struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_tx_h_nwifi()
3616 if (!ieee80211_is_data_qos(hdr->frame_control)) in ath10k_tx_h_nwifi()
3620 memmove(skb->data + IEEE80211_QOS_CTL_LEN, in ath10k_tx_h_nwifi()
3621 skb->data, (void *)qos_ctl - (void *)skb->data); in ath10k_tx_h_nwifi()
3628 hdr = (void *)skb->data; in ath10k_tx_h_nwifi()
3629 if (ieee80211_is_qos_nullfunc(hdr->frame_control)) in ath10k_tx_h_nwifi()
3630 cb->flags &= ~ATH10K_SKB_F_QOS; in ath10k_tx_h_nwifi()
3632 hdr->frame_control &= ~__cpu_to_le16(IEEE80211_STYPE_QOS_DATA); in ath10k_tx_h_nwifi()
3645 hdr = (void *)skb->data; in ath10k_tx_h_8023()
3646 hdrlen = ieee80211_hdrlen(hdr->frame_control); in ath10k_tx_h_8023()
3647 rfc1042 = (void *)skb->data + hdrlen; in ath10k_tx_h_8023()
3651 type = rfc1042->snap_type; in ath10k_tx_h_8023()
3656 eth = (void *)skb->data; in ath10k_tx_h_8023()
3657 ether_addr_copy(eth->h_dest, da); in ath10k_tx_h_8023()
3658 ether_addr_copy(eth->h_source, sa); in ath10k_tx_h_8023()
3659 eth->h_proto = type; in ath10k_tx_h_8023()
3666 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in ath10k_tx_h_add_p2p_noa_ie()
3667 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_tx_h_add_p2p_noa_ie()
3670 if (vif->type != NL80211_IFTYPE_AP || !vif->p2p) in ath10k_tx_h_add_p2p_noa_ie()
3673 if (unlikely(ieee80211_is_probe_resp(hdr->frame_control))) { in ath10k_tx_h_add_p2p_noa_ie()
3674 spin_lock_bh(&ar->data_lock); in ath10k_tx_h_add_p2p_noa_ie()
3675 if (arvif->u.ap.noa_data) in ath10k_tx_h_add_p2p_noa_ie()
3676 if (!pskb_expand_head(skb, 0, arvif->u.ap.noa_len, in ath10k_tx_h_add_p2p_noa_ie()
3678 skb_put_data(skb, arvif->u.ap.noa_data, in ath10k_tx_h_add_p2p_noa_ie()
3679 arvif->u.ap.noa_len); in ath10k_tx_h_add_p2p_noa_ie()
3680 spin_unlock_bh(&ar->data_lock); in ath10k_tx_h_add_p2p_noa_ie()
3690 struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_mac_tx_h_fill_cb()
3693 bool is_data = ieee80211_is_data(hdr->frame_control) || in ath10k_mac_tx_h_fill_cb()
3694 ieee80211_is_data_qos(hdr->frame_control); in ath10k_mac_tx_h_fill_cb()
3695 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_tx_h_fill_cb()
3700 cb->flags = 0; in ath10k_mac_tx_h_fill_cb()
3702 cb->flags |= ATH10K_SKB_F_NO_HWCRYPT; in ath10k_mac_tx_h_fill_cb()
3704 if (ieee80211_is_mgmt(hdr->frame_control)) in ath10k_mac_tx_h_fill_cb()
3705 cb->flags |= ATH10K_SKB_F_MGMT; in ath10k_mac_tx_h_fill_cb()
3707 if (ieee80211_is_data_qos(hdr->frame_control)) { in ath10k_mac_tx_h_fill_cb()
3708 cb->flags |= ATH10K_SKB_F_QOS; in ath10k_mac_tx_h_fill_cb()
3712 if (arvif->noack[tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_tx_h_fill_cb()
3716 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_tx_h_fill_cb()
3718 if (arsta->noack[tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_tx_h_fill_cb()
3721 if (arsta->noack[tid] == WMI_PEER_TID_CONFIG_ACK) in ath10k_mac_tx_h_fill_cb()
3726 cb->flags |= ATH10K_SKB_F_NOACK_TID; in ath10k_mac_tx_h_fill_cb()
3733 if (is_data && ieee80211_has_protected(hdr->frame_control) && in ath10k_mac_tx_h_fill_cb()
3734 !info->control.hw_key) { in ath10k_mac_tx_h_fill_cb()
3735 cb->flags |= ATH10K_SKB_F_NO_HWCRYPT; in ath10k_mac_tx_h_fill_cb()
3736 cb->flags |= ATH10K_SKB_F_RAW_TX; in ath10k_mac_tx_h_fill_cb()
3739 cb->vif = vif; in ath10k_mac_tx_h_fill_cb()
3740 cb->txq = txq; in ath10k_mac_tx_h_fill_cb()
3741 cb->airtime_est = airtime; in ath10k_mac_tx_h_fill_cb()
3743 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_tx_h_fill_cb()
3744 spin_lock_bh(&ar->data_lock); in ath10k_mac_tx_h_fill_cb()
3745 cb->ucast_cipher = arsta->ucast_cipher; in ath10k_mac_tx_h_fill_cb()
3746 spin_unlock_bh(&ar->data_lock); in ath10k_mac_tx_h_fill_cb()
3754 * offchannel tx (and actually creating them causes issues with wmi-htc in ath10k_mac_tx_frm_has_freq()
3758 return (ar->htt.target_version_major >= 3 && in ath10k_mac_tx_frm_has_freq()
3759 ar->htt.target_version_minor >= 4 && in ath10k_mac_tx_frm_has_freq()
3760 ar->running_fw->fw_file.htt_op_version == ATH10K_FW_HTT_OP_VERSION_TLV); in ath10k_mac_tx_frm_has_freq()
3765 struct sk_buff_head *q = &ar->wmi_mgmt_tx_queue; in ath10k_mac_tx_wmi_mgmt()
3768 spin_lock_bh(&ar->data_lock); in ath10k_mac_tx_wmi_mgmt()
3772 ret = -ENOSPC; in ath10k_mac_tx_wmi_mgmt()
3777 ieee80211_queue_work(ar->hw, &ar->wmi_mgmt_tx_work); in ath10k_mac_tx_wmi_mgmt()
3780 spin_unlock_bh(&ar->data_lock); in ath10k_mac_tx_wmi_mgmt()
3797 ar->running_fw->fw_file.fw_features) || in ath10k_mac_tx_h_get_txpath()
3799 ar->wmi.svc_map)) in ath10k_mac_tx_h_get_txpath()
3801 else if (ar->htt.target_version_major >= 3) in ath10k_mac_tx_h_get_txpath()
3815 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_tx_submit()
3816 int ret = -EINVAL; in ath10k_mac_tx_submit()
3830 ret = -EINVAL; in ath10k_mac_tx_submit()
3837 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_tx_submit()
3852 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_tx()
3858 if (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE) in ath10k_mac_tx()
3872 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) && in ath10k_mac_tx()
3873 !(skb_cb->flags & ATH10K_SKB_F_RAW_TX)) { in ath10k_mac_tx()
3876 return -ENOTSUPP; in ath10k_mac_tx()
3880 if (!noque_offchan && info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) { in ath10k_mac_tx()
3883 skb, skb->len); in ath10k_mac_tx()
3885 skb_queue_tail(&ar->offchan_tx_queue, skb); in ath10k_mac_tx()
3886 ieee80211_queue_work(hw, &ar->offchan_tx_work); in ath10k_mac_tx()
3905 skb = skb_dequeue(&ar->offchan_tx_queue); in ath10k_offchan_tx_purge()
3909 ieee80211_free_txskb(ar->hw, skb); in ath10k_offchan_tx_purge()
3939 skb = skb_dequeue(&ar->offchan_tx_queue); in ath10k_offchan_tx_work()
3943 mutex_lock(&ar->conf_mutex); in ath10k_offchan_tx_work()
3946 skb, skb->len); in ath10k_offchan_tx_work()
3948 hdr = (struct ieee80211_hdr *)skb->data; in ath10k_offchan_tx_work()
3951 spin_lock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
3952 vdev_id = ar->scan.vdev_id; in ath10k_offchan_tx_work()
3954 spin_unlock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
3971 spin_lock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
3972 reinit_completion(&ar->offchan_tx_completed); in ath10k_offchan_tx_work()
3973 ar->offchan_tx_skb = skb; in ath10k_offchan_tx_work()
3974 spin_unlock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
3976 /* It's safe to access vif and sta - conf_mutex guarantees that in ath10k_offchan_tx_work()
3982 vif = arvif->vif; in ath10k_offchan_tx_work()
4000 wait_for_completion_timeout(&ar->offchan_tx_completed, 3 * HZ); in ath10k_offchan_tx_work()
4003 skb, skb->len); in ath10k_offchan_tx_work()
4012 mutex_unlock(&ar->conf_mutex); in ath10k_offchan_tx_work()
4021 skb = skb_dequeue(&ar->wmi_mgmt_tx_queue); in ath10k_mgmt_over_wmi_tx_purge()
4025 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_purge()
4037 skb = skb_dequeue(&ar->wmi_mgmt_tx_queue); in ath10k_mgmt_over_wmi_tx_work()
4042 ar->running_fw->fw_file.fw_features)) { in ath10k_mgmt_over_wmi_tx_work()
4043 paddr = dma_map_single(ar->dev, skb->data, in ath10k_mgmt_over_wmi_tx_work()
4044 skb->len, DMA_TO_DEVICE); in ath10k_mgmt_over_wmi_tx_work()
4045 if (dma_mapping_error(ar->dev, paddr)) { in ath10k_mgmt_over_wmi_tx_work()
4046 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4056 dma_unmap_single(ar->dev, paddr, skb->len, in ath10k_mgmt_over_wmi_tx_work()
4058 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4065 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4078 artxq = (void *)txq->drv_priv; in ath10k_mac_txq_init()
4079 INIT_LIST_HEAD(&artxq->list); in ath10k_mac_txq_init()
4091 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_txq_unref()
4092 idr_for_each_entry(&ar->htt.pending_tx, msdu, msdu_id) { in ath10k_mac_txq_unref()
4094 if (cb->txq == txq) in ath10k_mac_txq_unref()
4095 cb->txq = NULL; in ath10k_mac_txq_unref()
4097 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_txq_unref()
4106 lockdep_assert_held(&ar->data_lock); in ath10k_mac_txq_lookup()
4108 peer = ar->peer_map[peer_id]; in ath10k_mac_txq_lookup()
4112 if (peer->removed) in ath10k_mac_txq_lookup()
4115 if (peer->sta) in ath10k_mac_txq_lookup()
4116 return peer->sta->txq[tid]; in ath10k_mac_txq_lookup()
4117 else if (peer->vif) in ath10k_mac_txq_lookup()
4118 return peer->vif->txq; in ath10k_mac_txq_lookup()
4126 struct ath10k *ar = hw->priv; in ath10k_mac_tx_can_push()
4127 struct ath10k_txq *artxq = (void *)txq->drv_priv; in ath10k_mac_tx_can_push()
4130 if (ar->htt.tx_q_state.mode == HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_tx_can_push()
4133 if (ar->htt.num_pending_tx < ar->htt.tx_q_state.num_push_allowed) in ath10k_mac_tx_can_push()
4136 if (artxq->num_fw_queued < artxq->num_push_allowed) in ath10k_mac_tx_can_push()
4158 if (!txq || !txq->sta) in ath10k_mac_update_airtime()
4161 if (test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map)) in ath10k_mac_update_airtime()
4164 spin_lock_bh(&ar->data_lock); in ath10k_mac_update_airtime()
4165 arsta = (struct ath10k_sta *)txq->sta->drv_priv; in ath10k_mac_update_airtime()
4167 pktlen = skb->len + 38; /* Assume MAC header 30, SNAP 8 for most case */ in ath10k_mac_update_airtime()
4168 if (arsta->last_tx_bitrate) { in ath10k_mac_update_airtime()
4171 / arsta->last_tx_bitrate; in ath10k_mac_update_airtime()
4183 spin_unlock_bh(&ar->data_lock); in ath10k_mac_update_airtime()
4191 struct ath10k *ar = hw->priv; in ath10k_mac_tx_push_txq()
4192 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_tx_push_txq()
4193 struct ath10k_txq *artxq = (void *)txq->drv_priv; in ath10k_mac_tx_push_txq()
4194 struct ieee80211_vif *vif = txq->vif; in ath10k_mac_tx_push_txq()
4195 struct ieee80211_sta *sta = txq->sta; in ath10k_mac_tx_push_txq()
4205 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4207 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4214 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4216 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4218 return -ENOENT; in ath10k_mac_tx_push_txq()
4224 skb_len = skb->len; in ath10k_mac_tx_push_txq()
4230 hdr = (struct ieee80211_hdr *)skb->data; in ath10k_mac_tx_push_txq()
4231 is_presp = ieee80211_is_probe_resp(hdr->frame_control); in ath10k_mac_tx_push_txq()
4233 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4238 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4241 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4248 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4252 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4257 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4258 artxq->num_fw_queued++; in ath10k_mac_tx_push_txq()
4259 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4278 if (ret == -EBUSY) in ath10k_mac_schedule_txq()
4288 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_tx_push_pending()
4291 if (ar->htt.tx_q_state.mode != HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_tx_push_pending()
4294 if (ar->htt.num_pending_tx >= (ar->htt.max_num_pending_tx / 2)) in ath10k_mac_tx_push_pending()
4299 if (ath10k_mac_schedule_txq(hw, ac) == -EBUSY) in ath10k_mac_tx_push_pending()
4312 lockdep_assert_held(&ar->data_lock); in __ath10k_scan_finish()
4314 switch (ar->scan.state) { in __ath10k_scan_finish()
4319 if (!ar->scan.is_roc) { in __ath10k_scan_finish()
4321 .aborted = (ar->scan.state == in __ath10k_scan_finish()
4325 ieee80211_scan_completed(ar->hw, &info); in __ath10k_scan_finish()
4326 } else if (ar->scan.roc_notify) { in __ath10k_scan_finish()
4327 ieee80211_remain_on_channel_expired(ar->hw); in __ath10k_scan_finish()
4331 ar->scan.state = ATH10K_SCAN_IDLE; in __ath10k_scan_finish()
4332 ar->scan_channel = NULL; in __ath10k_scan_finish()
4333 ar->scan.roc_freq = 0; in __ath10k_scan_finish()
4335 cancel_delayed_work(&ar->scan.timeout); in __ath10k_scan_finish()
4336 complete(&ar->scan.completed); in __ath10k_scan_finish()
4343 spin_lock_bh(&ar->data_lock); in ath10k_scan_finish()
4345 spin_unlock_bh(&ar->data_lock); in ath10k_scan_finish()
4357 lockdep_assert_held(&ar->conf_mutex); in ath10k_scan_stop()
4365 ret = wait_for_completion_timeout(&ar->scan.completed, 3 * HZ); in ath10k_scan_stop()
4368 ret = -ETIMEDOUT; in ath10k_scan_stop()
4381 spin_lock_bh(&ar->data_lock); in ath10k_scan_stop()
4382 if (ar->scan.state != ATH10K_SCAN_IDLE) in ath10k_scan_stop()
4384 spin_unlock_bh(&ar->data_lock); in ath10k_scan_stop()
4393 lockdep_assert_held(&ar->conf_mutex); in ath10k_scan_abort()
4395 spin_lock_bh(&ar->data_lock); in ath10k_scan_abort()
4397 switch (ar->scan.state) { in ath10k_scan_abort()
4406 ath10k_scan_state_str(ar->scan.state), in ath10k_scan_abort()
4407 ar->scan.state); in ath10k_scan_abort()
4410 ar->scan.state = ATH10K_SCAN_ABORTING; in ath10k_scan_abort()
4411 spin_unlock_bh(&ar->data_lock); in ath10k_scan_abort()
4417 spin_lock_bh(&ar->data_lock); in ath10k_scan_abort()
4421 spin_unlock_bh(&ar->data_lock); in ath10k_scan_abort()
4429 mutex_lock(&ar->conf_mutex); in ath10k_scan_timeout_work()
4431 mutex_unlock(&ar->conf_mutex); in ath10k_scan_timeout_work()
4439 lockdep_assert_held(&ar->conf_mutex); in ath10k_start_scan()
4445 ret = wait_for_completion_timeout(&ar->scan.started, 1 * HZ); in ath10k_start_scan()
4451 return -ETIMEDOUT; in ath10k_start_scan()
4458 spin_lock_bh(&ar->data_lock); in ath10k_start_scan()
4459 if (ar->scan.state == ATH10K_SCAN_IDLE) { in ath10k_start_scan()
4460 spin_unlock_bh(&ar->data_lock); in ath10k_start_scan()
4461 return -EINVAL; in ath10k_start_scan()
4463 spin_unlock_bh(&ar->data_lock); in ath10k_start_scan()
4476 struct ath10k *ar = hw->priv; in ath10k_mac_op_tx()
4477 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_op_tx()
4479 struct ieee80211_vif *vif = info->control.vif; in ath10k_mac_op_tx()
4480 struct ieee80211_sta *sta = control->sta; in ath10k_mac_op_tx()
4482 struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_mac_op_tx()
4501 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4502 is_presp = ieee80211_is_probe_resp(hdr->frame_control); in ath10k_mac_op_tx()
4508 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4509 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_op_tx()
4518 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4519 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_op_tx()
4522 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4529 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4533 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4542 struct ath10k *ar = hw->priv; in ath10k_mac_op_wake_tx_queue()
4547 if (ar->htt.tx_q_state.mode != HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_op_wake_tx_queue()
4550 ac = txq->ac; in ath10k_mac_op_wake_tx_queue()
4570 /* make sure rcu-protected mac80211 tx path itself is drained */ in ath10k_drain_tx()
4576 cancel_work_sync(&ar->offchan_tx_work); in ath10k_drain_tx()
4577 cancel_work_sync(&ar->wmi_mgmt_tx_work); in ath10k_drain_tx()
4584 lockdep_assert_held(&ar->conf_mutex); in ath10k_halt()
4586 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_halt()
4587 ar->filter_flags = 0; in ath10k_halt()
4588 ar->monitor = false; in ath10k_halt()
4589 ar->monitor_arvif = NULL; in ath10k_halt()
4591 if (ar->monitor_started) in ath10k_halt()
4594 ar->monitor_started = false; in ath10k_halt()
4595 ar->tx_paused = 0; in ath10k_halt()
4603 spin_lock_bh(&ar->data_lock); in ath10k_halt()
4604 list_for_each_entry(arvif, &ar->arvifs, list) in ath10k_halt()
4606 spin_unlock_bh(&ar->data_lock); in ath10k_halt()
4611 struct ath10k *ar = hw->priv; in ath10k_get_antenna()
4613 mutex_lock(&ar->conf_mutex); in ath10k_get_antenna()
4615 *tx_ant = ar->cfg_tx_chainmask; in ath10k_get_antenna()
4616 *rx_ant = ar->cfg_rx_chainmask; in ath10k_get_antenna()
4618 mutex_unlock(&ar->conf_mutex); in ath10k_get_antenna()
4639 int nsts = ar->vht_cap_info; in ath10k_mac_get_vht_cap_bf_sts()
4644 /* If firmware does not deliver to host number of space-time in ath10k_mac_get_vht_cap_bf_sts()
4646 * the value for VHT CAP: nsts-1) in ath10k_mac_get_vht_cap_bf_sts()
4656 int sound_dim = ar->vht_cap_info; in ath10k_mac_get_vht_cap_bf_sound_dim()
4673 struct ath10k_hw_params *hw = &ar->hw_params; in ath10k_create_vht_cap()
4679 vht_cap.cap = ar->vht_cap_info; in ath10k_create_vht_cap()
4681 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | in ath10k_create_vht_cap()
4690 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | in ath10k_create_vht_cap()
4701 if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i))) in ath10k_create_vht_cap()
4707 if (ar->cfg_tx_chainmask <= 1) in ath10k_create_vht_cap()
4715 * user-space a clue if that is the case. in ath10k_create_vht_cap()
4718 (hw->vht160_mcs_rx_highest != 0 || in ath10k_create_vht_cap()
4719 hw->vht160_mcs_tx_highest != 0)) { in ath10k_create_vht_cap()
4720 vht_cap.vht_mcs.rx_highest = cpu_to_le16(hw->vht160_mcs_rx_highest); in ath10k_create_vht_cap()
4721 vht_cap.vht_mcs.tx_highest = cpu_to_le16(hw->vht160_mcs_tx_highest); in ath10k_create_vht_cap()
4732 if (!(ar->ht_cap_info & WMI_HT_CAP_ENABLED)) in ath10k_get_ht_cap()
4743 if (ar->ht_cap_info & WMI_HT_CAP_HT20_SGI) in ath10k_get_ht_cap()
4746 if (ar->ht_cap_info & WMI_HT_CAP_HT40_SGI) in ath10k_get_ht_cap()
4749 if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) { in ath10k_get_ht_cap()
4758 if (ar->ht_cap_info & WMI_HT_CAP_TX_STBC && (ar->cfg_tx_chainmask > 1)) in ath10k_get_ht_cap()
4761 if (ar->ht_cap_info & WMI_HT_CAP_RX_STBC) { in ath10k_get_ht_cap()
4764 stbc = ar->ht_cap_info; in ath10k_get_ht_cap()
4773 if (ar->ht_cap_info & WMI_HT_CAP_LDPC || (ar->ht_cap_info & in ath10k_get_ht_cap()
4774 WMI_HT_CAP_RX_LDPC && (ar->ht_cap_info & WMI_HT_CAP_TX_LDPC))) in ath10k_get_ht_cap()
4777 if (ar->ht_cap_info & WMI_HT_CAP_L_SIG_TXOP_PROT) in ath10k_get_ht_cap()
4781 if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK) in ath10k_get_ht_cap()
4784 for (i = 0; i < ar->num_rf_chains; i++) { in ath10k_get_ht_cap()
4785 if (ar->cfg_rx_chainmask & BIT(i)) in ath10k_get_ht_cap()
4803 if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) { in ath10k_mac_setup_ht_vht_cap()
4804 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath10k_mac_setup_ht_vht_cap()
4805 band->ht_cap = ht_cap; in ath10k_mac_setup_ht_vht_cap()
4807 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) { in ath10k_mac_setup_ht_vht_cap()
4808 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath10k_mac_setup_ht_vht_cap()
4809 band->ht_cap = ht_cap; in ath10k_mac_setup_ht_vht_cap()
4810 band->vht_cap = vht_cap; in ath10k_mac_setup_ht_vht_cap()
4819 lockdep_assert_held(&ar->conf_mutex); in __ath10k_set_antenna()
4825 return -EINVAL; in __ath10k_set_antenna()
4827 ar->cfg_tx_chainmask = tx_ant; in __ath10k_set_antenna()
4828 ar->cfg_rx_chainmask = rx_ant; in __ath10k_set_antenna()
4830 if ((ar->state != ATH10K_STATE_ON) && in __ath10k_set_antenna()
4831 (ar->state != ATH10K_STATE_RESTARTED)) in __ath10k_set_antenna()
4834 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->tx_chain_mask, in __ath10k_set_antenna()
4837 ath10k_warn(ar, "failed to set tx-chainmask: %d, req 0x%x\n", in __ath10k_set_antenna()
4842 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->rx_chain_mask, in __ath10k_set_antenna()
4845 ath10k_warn(ar, "failed to set rx-chainmask: %d, req 0x%x\n", in __ath10k_set_antenna()
4858 struct ath10k *ar = hw->priv; in ath10k_set_antenna()
4861 mutex_lock(&ar->conf_mutex); in ath10k_set_antenna()
4863 mutex_unlock(&ar->conf_mutex); in ath10k_set_antenna()
4874 node = ar->dev->of_node; in __ath10k_fetch_bb_timing_dt()
4876 return -ENOENT; in __ath10k_fetch_bb_timing_dt()
4878 ret = of_property_read_string_index(node, "ext-fem-name", 0, &fem_name); in __ath10k_fetch_bb_timing_dt()
4880 return -ENOENT; in __ath10k_fetch_bb_timing_dt()
4887 if (!strcmp("microsemi-lx5586", fem_name)) { in __ath10k_fetch_bb_timing_dt()
4888 bb_timing->bb_tx_timing = 0x00; in __ath10k_fetch_bb_timing_dt()
4889 bb_timing->bb_xpa_timing = 0x0101; in __ath10k_fetch_bb_timing_dt()
4891 return -ENOENT; in __ath10k_fetch_bb_timing_dt()
4895 bb_timing->bb_tx_timing, bb_timing->bb_xpa_timing); in __ath10k_fetch_bb_timing_dt()
4904 if (ar->hw_values->rfkill_pin == 0) { in ath10k_mac_rfkill_config()
4906 return -EOPNOTSUPP; in ath10k_mac_rfkill_config()
4911 ar->hw_values->rfkill_pin, ar->hw_values->rfkill_cfg, in ath10k_mac_rfkill_config()
4912 ar->hw_values->rfkill_on_level); in ath10k_mac_rfkill_config()
4915 ar->hw_values->rfkill_on_level) | in ath10k_mac_rfkill_config()
4917 ar->hw_values->rfkill_pin) | in ath10k_mac_rfkill_config()
4919 ar->hw_values->rfkill_cfg); in ath10k_mac_rfkill_config()
4922 ar->wmi.pdev_param->rfkill_config, in ath10k_mac_rfkill_config()
4945 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->rfkill_enable, in ath10k_mac_rfkill_enable_radio()
4958 struct ath10k *ar = hw->priv; in ath10k_start()
4970 mutex_lock(&ar->conf_mutex); in ath10k_start()
4972 switch (ar->state) { in ath10k_start()
4974 ar->state = ATH10K_STATE_ON; in ath10k_start()
4977 ar->state = ATH10K_STATE_RESTARTED; in ath10k_start()
4983 ret = -EINVAL; in ath10k_start()
4986 ret = -EBUSY; in ath10k_start()
4990 spin_lock_bh(&ar->data_lock); in ath10k_start()
4992 if (ar->hw_rfkill_on) { in ath10k_start()
4993 ar->hw_rfkill_on = false; in ath10k_start()
4994 spin_unlock_bh(&ar->data_lock); in ath10k_start()
4998 spin_unlock_bh(&ar->data_lock); in ath10k_start()
5007 &ar->normal_mode_fw); in ath10k_start()
5013 if (ar->sys_cap_info & WMI_TLV_SYS_CAP_INFO_RFKILL) { in ath10k_start()
5015 if (ret && ret != -EOPNOTSUPP) { in ath10k_start()
5021 param = ar->wmi.pdev_param->pmf_qos; in ath10k_start()
5028 param = ar->wmi.pdev_param->dynamic_bw; in ath10k_start()
5035 if (test_bit(WMI_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi.svc_map)) { in ath10k_start()
5036 ret = ath10k_wmi_scan_prob_req_oui(ar, ar->mac_addr); in ath10k_start()
5038 ath10k_err(ar, "failed to set prob req oui: %i\n", ret); in ath10k_start()
5043 if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar->wmi.svc_map)) { in ath10k_start()
5052 if (test_bit(WMI_SERVICE_BURST, ar->wmi.svc_map)) { in ath10k_start()
5053 param = ar->wmi.pdev_param->burst_enable; in ath10k_start()
5061 param = ar->wmi.pdev_param->idle_ps_config; in ath10k_start()
5063 if (ret && ret != -EOPNOTSUPP) { in ath10k_start()
5068 __ath10k_set_antenna(ar, ar->cfg_tx_chainmask, ar->cfg_rx_chainmask); in ath10k_start()
5079 param = ar->wmi.pdev_param->arp_ac_override; in ath10k_start()
5088 ar->running_fw->fw_file.fw_features)) { in ath10k_start()
5099 param = ar->wmi.pdev_param->ani_enable; in ath10k_start()
5107 ar->ani_enabled = true; in ath10k_start()
5110 param = ar->wmi.pdev_param->peer_stats_update_period; in ath10k_start()
5121 param = ar->wmi.pdev_param->enable_btcoex; in ath10k_start()
5122 if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map) && in ath10k_start()
5124 ar->running_fw->fw_file.fw_features) && in ath10k_start()
5125 ar->coex_support) { in ath10k_start()
5132 clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); in ath10k_start()
5135 if (test_bit(WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT, ar->wmi.svc_map)) { in ath10k_start()
5148 ar->num_started_vdevs = 0; in ath10k_start()
5154 ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_IDLE; in ath10k_start()
5156 mutex_unlock(&ar->conf_mutex); in ath10k_start()
5166 ar->state = ATH10K_STATE_OFF; in ath10k_start()
5169 mutex_unlock(&ar->conf_mutex); in ath10k_start()
5175 struct ath10k *ar = hw->priv; in ath10k_stop()
5179 mutex_lock(&ar->conf_mutex); in ath10k_stop()
5180 if (ar->state != ATH10K_STATE_OFF) { in ath10k_stop()
5181 if (!ar->hw_rfkill_on) in ath10k_stop()
5183 ar->state = ATH10K_STATE_OFF; in ath10k_stop()
5185 mutex_unlock(&ar->conf_mutex); in ath10k_stop()
5187 cancel_work_sync(&ar->set_coverage_class_work); in ath10k_stop()
5188 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_stop()
5189 cancel_work_sync(&ar->restart_work); in ath10k_stop()
5197 lockdep_assert_held(&ar->conf_mutex); in ath10k_config_ps()
5199 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_config_ps()
5215 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_txpower_setup()
5219 param = ar->wmi.pdev_param->txpower_limit2g; in ath10k_mac_txpower_setup()
5227 param = ar->wmi.pdev_param->txpower_limit5g; in ath10k_mac_txpower_setup()
5241 int ret, txpower = -1; in ath10k_mac_txpower_recalc()
5243 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_txpower_recalc()
5245 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_mac_txpower_recalc()
5247 if (arvif->txpower == INT_MIN) in ath10k_mac_txpower_recalc()
5250 if (txpower == -1) in ath10k_mac_txpower_recalc()
5251 txpower = arvif->txpower; in ath10k_mac_txpower_recalc()
5253 txpower = min(txpower, arvif->txpower); in ath10k_mac_txpower_recalc()
5256 if (txpower == -1) in ath10k_mac_txpower_recalc()
5261 ath10k_warn(ar, "failed to setup tx power %d: %d\n", in ath10k_mac_txpower_recalc()
5271 struct ath10k *ar = hw->priv; in ath10k_config()
5272 struct ieee80211_conf *conf = &hw->conf; in ath10k_config()
5275 mutex_lock(&ar->conf_mutex); in ath10k_config()
5281 ar->monitor = conf->flags & IEEE80211_CONF_MONITOR; in ath10k_config()
5287 mutex_unlock(&ar->conf_mutex); in ath10k_config()
5305 struct ath10k *ar = arvif->ar; in ath10k_mac_set_txbf_conf()
5313 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | in ath10k_mac_set_txbf_conf()
5318 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | in ath10k_mac_set_txbf_conf()
5325 if (ar->vht_cap_info & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE) in ath10k_mac_set_txbf_conf()
5328 if (ar->vht_cap_info & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE) in ath10k_mac_set_txbf_conf()
5332 if (ar->vht_cap_info & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE) in ath10k_mac_set_txbf_conf()
5335 if (ar->vht_cap_info & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE) in ath10k_mac_set_txbf_conf()
5339 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_mac_set_txbf_conf()
5340 ar->wmi.vdev_param->txbf, value); in ath10k_mac_set_txbf_conf()
5353 struct ath10k *ar = hw->priv; in ath10k_add_interface()
5354 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_add_interface()
5363 vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; in ath10k_add_interface()
5365 mutex_lock(&ar->conf_mutex); in ath10k_add_interface()
5368 ath10k_mac_txq_init(vif->txq); in ath10k_add_interface()
5370 arvif->ar = ar; in ath10k_add_interface()
5371 arvif->vif = vif; in ath10k_add_interface()
5373 INIT_LIST_HEAD(&arvif->list); in ath10k_add_interface()
5374 INIT_WORK(&arvif->ap_csa_work, ath10k_mac_vif_ap_csa_work); in ath10k_add_interface()
5375 INIT_DELAYED_WORK(&arvif->connection_loss_work, in ath10k_add_interface()
5378 for (i = 0; i < ARRAY_SIZE(arvif->bitrate_mask.control); i++) { in ath10k_add_interface()
5379 arvif->bitrate_mask.control[i].legacy = 0xffffffff; in ath10k_add_interface()
5380 memset(arvif->bitrate_mask.control[i].ht_mcs, 0xff, in ath10k_add_interface()
5381 sizeof(arvif->bitrate_mask.control[i].ht_mcs)); in ath10k_add_interface()
5382 memset(arvif->bitrate_mask.control[i].vht_mcs, 0xff, in ath10k_add_interface()
5383 sizeof(arvif->bitrate_mask.control[i].vht_mcs)); in ath10k_add_interface()
5386 if (ar->num_peers >= ar->max_num_peers) { in ath10k_add_interface()
5388 ret = -ENOBUFS; in ath10k_add_interface()
5392 if (ar->free_vdev_map == 0) { in ath10k_add_interface()
5394 ret = -EBUSY; in ath10k_add_interface()
5397 bit = __ffs64(ar->free_vdev_map); in ath10k_add_interface()
5400 bit, ar->free_vdev_map); in ath10k_add_interface()
5402 arvif->vdev_id = bit; in ath10k_add_interface()
5403 arvif->vdev_subtype = in ath10k_add_interface()
5406 switch (vif->type) { in ath10k_add_interface()
5408 arvif->vdev_type = WMI_VDEV_TYPE_STA; in ath10k_add_interface()
5409 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5414 arvif->vdev_type = WMI_VDEV_TYPE_STA; in ath10k_add_interface()
5415 if (vif->p2p) in ath10k_add_interface()
5416 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5420 arvif->vdev_type = WMI_VDEV_TYPE_IBSS; in ath10k_add_interface()
5423 if (test_bit(WMI_SERVICE_MESH_11S, ar->wmi.svc_map)) { in ath10k_add_interface()
5424 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5426 } else if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { in ath10k_add_interface()
5427 ret = -EINVAL; in ath10k_add_interface()
5431 arvif->vdev_type = WMI_VDEV_TYPE_AP; in ath10k_add_interface()
5434 arvif->vdev_type = WMI_VDEV_TYPE_AP; in ath10k_add_interface()
5436 if (vif->p2p) in ath10k_add_interface()
5437 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5441 arvif->vdev_type = WMI_VDEV_TYPE_MONITOR; in ath10k_add_interface()
5448 /* Using vdev_id as queue number will make it very easy to do per-vif in ath10k_add_interface()
5453 vif->cab_queue = arvif->vdev_id % (IEEE80211_MAX_QUEUES - 1); in ath10k_add_interface()
5454 for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++) in ath10k_add_interface()
5455 vif->hw_queue[i] = arvif->vdev_id % (IEEE80211_MAX_QUEUES - 1); in ath10k_add_interface()
5460 * combined with missed TBTT. This is very very rare. in ath10k_add_interface()
5462 * On non-IOMMU-enabled hosts this could be a possible security issue in ath10k_add_interface()
5464 * IOMMU-enabled hosts DMAR faults would occur in most cases and target in ath10k_add_interface()
5469 * DMA-coherent buffer for a lifetime of a vif and use it for all in ath10k_add_interface()
5471 * become corrupted, e.g. have garbled IEs or out-of-date TIM bitmap. in ath10k_add_interface()
5473 if (vif->type == NL80211_IFTYPE_ADHOC || in ath10k_add_interface()
5474 vif->type == NL80211_IFTYPE_MESH_POINT || in ath10k_add_interface()
5475 vif->type == NL80211_IFTYPE_AP) { in ath10k_add_interface()
5476 arvif->beacon_buf = dma_alloc_coherent(ar->dev, in ath10k_add_interface()
5478 &arvif->beacon_paddr, in ath10k_add_interface()
5480 if (!arvif->beacon_buf) { in ath10k_add_interface()
5481 ret = -ENOMEM; in ath10k_add_interface()
5487 if (test_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, &ar->dev_flags)) in ath10k_add_interface()
5488 arvif->nohwcrypt = true; in ath10k_add_interface()
5490 if (arvif->nohwcrypt && in ath10k_add_interface()
5491 !test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { in ath10k_add_interface()
5497 arvif->vdev_id, arvif->vdev_type, arvif->vdev_subtype, in ath10k_add_interface()
5498 arvif->beacon_buf ? "single-buf" : "per-skb"); in ath10k_add_interface()
5500 ret = ath10k_wmi_vdev_create(ar, arvif->vdev_id, arvif->vdev_type, in ath10k_add_interface()
5501 arvif->vdev_subtype, vif->addr); in ath10k_add_interface()
5504 arvif->vdev_id, ret); in ath10k_add_interface()
5509 ar->wmi.svc_map)) { in ath10k_add_interface()
5510 vdev_param = ar->wmi.vdev_param->disable_4addr_src_lrn; in ath10k_add_interface()
5511 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5513 if (ret && ret != -EOPNOTSUPP) { in ath10k_add_interface()
5515 arvif->vdev_id, ret); in ath10k_add_interface()
5519 ar->free_vdev_map &= ~(1LL << arvif->vdev_id); in ath10k_add_interface()
5520 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5521 list_add(&arvif->list, &ar->arvifs); in ath10k_add_interface()
5522 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5530 arvif->vdev_id, ret); in ath10k_add_interface()
5534 arvif->def_wep_key_idx = -1; in ath10k_add_interface()
5536 vdev_param = ar->wmi.vdev_param->tx_encap_type; in ath10k_add_interface()
5537 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5540 if (ret && ret != -EOPNOTSUPP) { in ath10k_add_interface()
5542 arvif->vdev_id, ret); in ath10k_add_interface()
5549 if (ar->cfg_tx_chainmask && (vif->type != NL80211_IFTYPE_MONITOR)) { in ath10k_add_interface()
5550 u16 nss = get_nss_from_chainmask(ar->cfg_tx_chainmask); in ath10k_add_interface()
5552 vdev_param = ar->wmi.vdev_param->nss; in ath10k_add_interface()
5553 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5557 arvif->vdev_id, ar->cfg_tx_chainmask, nss, in ath10k_add_interface()
5563 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_add_interface()
5564 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_add_interface()
5565 ret = ath10k_peer_create(ar, vif, NULL, arvif->vdev_id, in ath10k_add_interface()
5566 vif->addr, WMI_PEER_TYPE_DEFAULT); in ath10k_add_interface()
5569 arvif->vdev_id, ret); in ath10k_add_interface()
5573 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5575 peer = ath10k_peer_find(ar, arvif->vdev_id, vif->addr); in ath10k_add_interface()
5578 vif->addr, arvif->vdev_id); in ath10k_add_interface()
5579 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5580 ret = -ENOENT; in ath10k_add_interface()
5584 arvif->peer_id = find_first_bit(peer->peer_ids, in ath10k_add_interface()
5587 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5589 arvif->peer_id = HTT_INVALID_PEERID; in ath10k_add_interface()
5592 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath10k_add_interface()
5596 arvif->vdev_id, ret); in ath10k_add_interface()
5601 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) { in ath10k_add_interface()
5604 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_add_interface()
5608 arvif->vdev_id, ret); in ath10k_add_interface()
5615 arvif->vdev_id, ret); in ath10k_add_interface()
5622 arvif->vdev_id, ret); in ath10k_add_interface()
5630 arvif->vdev_id, ret); in ath10k_add_interface()
5634 ret = ath10k_mac_set_rts(arvif, ar->hw->wiphy->rts_threshold); in ath10k_add_interface()
5637 arvif->vdev_id, ret); in ath10k_add_interface()
5641 arvif->txpower = vif->bss_conf.txpower; in ath10k_add_interface()
5644 ath10k_warn(ar, "failed to recalc tx power: %d\n", ret); in ath10k_add_interface()
5648 if (test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) { in ath10k_add_interface()
5649 vdev_param = ar->wmi.vdev_param->rtt_responder_role; in ath10k_add_interface()
5650 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5651 arvif->ftm_responder); in ath10k_add_interface()
5654 if (ret && ret != -EOPNOTSUPP) in ath10k_add_interface()
5656 arvif->vdev_id, ret); in ath10k_add_interface()
5659 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_add_interface()
5660 ar->monitor_arvif = arvif; in ath10k_add_interface()
5668 spin_lock_bh(&ar->htt.tx_lock); in ath10k_add_interface()
5669 if (!ar->tx_paused) in ath10k_add_interface()
5670 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_add_interface()
5671 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_add_interface()
5673 mutex_unlock(&ar->conf_mutex); in ath10k_add_interface()
5677 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_add_interface()
5678 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_add_interface()
5679 ath10k_wmi_peer_delete(ar, arvif->vdev_id, vif->addr); in ath10k_add_interface()
5680 ath10k_wait_for_peer_delete_done(ar, arvif->vdev_id, in ath10k_add_interface()
5681 vif->addr); in ath10k_add_interface()
5685 ath10k_wmi_vdev_delete(ar, arvif->vdev_id); in ath10k_add_interface()
5686 ar->free_vdev_map |= 1LL << arvif->vdev_id; in ath10k_add_interface()
5687 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5688 list_del(&arvif->list); in ath10k_add_interface()
5689 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5692 if (arvif->beacon_buf) { in ath10k_add_interface()
5693 dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, in ath10k_add_interface()
5694 arvif->beacon_buf, arvif->beacon_paddr); in ath10k_add_interface()
5695 arvif->beacon_buf = NULL; in ath10k_add_interface()
5698 mutex_unlock(&ar->conf_mutex); in ath10k_add_interface()
5714 struct ath10k *ar = hw->priv; in ath10k_remove_interface()
5715 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_remove_interface()
5721 cancel_work_sync(&arvif->ap_csa_work); in ath10k_remove_interface()
5722 cancel_delayed_work_sync(&arvif->connection_loss_work); in ath10k_remove_interface()
5724 mutex_lock(&ar->conf_mutex); in ath10k_remove_interface()
5729 arvif->vdev_id, ret); in ath10k_remove_interface()
5731 ar->free_vdev_map |= 1LL << arvif->vdev_id; in ath10k_remove_interface()
5732 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5733 list_del(&arvif->list); in ath10k_remove_interface()
5734 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
5736 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_remove_interface()
5737 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_remove_interface()
5738 ret = ath10k_wmi_peer_delete(arvif->ar, arvif->vdev_id, in ath10k_remove_interface()
5739 vif->addr); in ath10k_remove_interface()
5741 ath10k_warn(ar, "failed to submit AP/IBSS self-peer removal on vdev %i: %d\n", in ath10k_remove_interface()
5742 arvif->vdev_id, ret); in ath10k_remove_interface()
5744 ath10k_wait_for_peer_delete_done(ar, arvif->vdev_id, in ath10k_remove_interface()
5745 vif->addr); in ath10k_remove_interface()
5746 kfree(arvif->u.ap.noa_data); in ath10k_remove_interface()
5750 arvif->vdev_id); in ath10k_remove_interface()
5752 ret = ath10k_wmi_vdev_delete(ar, arvif->vdev_id); in ath10k_remove_interface()
5755 arvif->vdev_id, ret); in ath10k_remove_interface()
5757 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) { in ath10k_remove_interface()
5758 time_left = wait_for_completion_timeout(&ar->vdev_delete_done, in ath10k_remove_interface()
5766 /* Some firmware revisions don't notify host about self-peer removal in ath10k_remove_interface()
5769 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_remove_interface()
5770 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_remove_interface()
5771 ret = ath10k_wait_for_peer_deleted(ar, arvif->vdev_id, in ath10k_remove_interface()
5772 vif->addr); in ath10k_remove_interface()
5774 ath10k_warn(ar, "failed to remove AP self-peer on vdev %i: %d\n", in ath10k_remove_interface()
5775 arvif->vdev_id, ret); in ath10k_remove_interface()
5777 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5778 ar->num_peers--; in ath10k_remove_interface()
5779 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
5782 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5783 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_remove_interface()
5784 peer = ar->peer_map[i]; in ath10k_remove_interface()
5788 if (peer->vif == vif) { in ath10k_remove_interface()
5790 vif->addr, arvif->vdev_id); in ath10k_remove_interface()
5791 peer->vif = NULL; in ath10k_remove_interface()
5799 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
5801 ath10k_peer_cleanup(ar, arvif->vdev_id); in ath10k_remove_interface()
5802 ath10k_mac_txq_unref(ar, vif->txq); in ath10k_remove_interface()
5804 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_remove_interface()
5805 ar->monitor_arvif = NULL; in ath10k_remove_interface()
5813 ath10k_warn(ar, "failed to recalc tx power: %d\n", ret); in ath10k_remove_interface()
5815 spin_lock_bh(&ar->htt.tx_lock); in ath10k_remove_interface()
5817 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_remove_interface()
5819 ath10k_mac_txq_unref(ar, vif->txq); in ath10k_remove_interface()
5822 mutex_unlock(&ar->conf_mutex); in ath10k_remove_interface()
5842 struct ath10k *ar = hw->priv; in ath10k_configure_filter()
5845 mutex_lock(&ar->conf_mutex); in ath10k_configure_filter()
5849 ar->filter_flags = *total_flags; in ath10k_configure_filter()
5855 mutex_unlock(&ar->conf_mutex); in ath10k_configure_filter()
5862 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_recalculate_mgmt_rate()
5870 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalculate_mgmt_rate()
5872 sband = ar->hw->wiphy->bands[def->chan->band]; in ath10k_recalculate_mgmt_rate()
5873 basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; in ath10k_recalculate_mgmt_rate()
5874 bitrate = sband->bitrates[basic_rate_idx].bitrate; in ath10k_recalculate_mgmt_rate()
5882 vdev_param = ar->wmi.vdev_param->mgmt_rate; in ath10k_recalculate_mgmt_rate()
5883 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_recalculate_mgmt_rate()
5894 struct ath10k *ar = hw->priv; in ath10k_bss_info_changed()
5895 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_bss_info_changed()
5903 mutex_lock(&ar->conf_mutex); in ath10k_bss_info_changed()
5906 ath10k_control_ibss(arvif, info, vif->addr); in ath10k_bss_info_changed()
5909 arvif->beacon_interval = info->beacon_int; in ath10k_bss_info_changed()
5910 vdev_param = ar->wmi.vdev_param->beacon_interval; in ath10k_bss_info_changed()
5911 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
5912 arvif->beacon_interval); in ath10k_bss_info_changed()
5915 arvif->vdev_id, arvif->beacon_interval); in ath10k_bss_info_changed()
5919 arvif->vdev_id, ret); in ath10k_bss_info_changed()
5925 arvif->vdev_id); in ath10k_bss_info_changed()
5927 pdev_param = ar->wmi.pdev_param->beacon_tx_mode; in ath10k_bss_info_changed()
5932 arvif->vdev_id, ret); in ath10k_bss_info_changed()
5941 strncpy(arvif->u.ap.ssid, "mesh", in ath10k_bss_info_changed()
5942 sizeof(arvif->u.ap.ssid)); in ath10k_bss_info_changed()
5943 arvif->u.ap.ssid_len = 4; in ath10k_bss_info_changed()
5951 arvif->vdev_id, ret); in ath10k_bss_info_changed()
5955 arvif->dtim_period = info->dtim_period; in ath10k_bss_info_changed()
5959 arvif->vdev_id, arvif->dtim_period); in ath10k_bss_info_changed()
5961 vdev_param = ar->wmi.vdev_param->dtim_period; in ath10k_bss_info_changed()
5962 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
5963 arvif->dtim_period); in ath10k_bss_info_changed()
5966 arvif->vdev_id, ret); in ath10k_bss_info_changed()
5970 vif->type == NL80211_IFTYPE_AP) { in ath10k_bss_info_changed()
5971 arvif->u.ap.ssid_len = info->ssid_len; in ath10k_bss_info_changed()
5972 if (info->ssid_len) in ath10k_bss_info_changed()
5973 memcpy(arvif->u.ap.ssid, info->ssid, info->ssid_len); in ath10k_bss_info_changed()
5974 arvif->u.ap.hidden_ssid = info->hidden_ssid; in ath10k_bss_info_changed()
5977 if (changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) in ath10k_bss_info_changed()
5978 ether_addr_copy(arvif->bssid, info->bssid); in ath10k_bss_info_changed()
5981 arvif->ftm_responder != info->ftm_responder && in ath10k_bss_info_changed()
5982 test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) { in ath10k_bss_info_changed()
5983 arvif->ftm_responder = info->ftm_responder; in ath10k_bss_info_changed()
5985 vdev_param = ar->wmi.vdev_param->rtt_responder_role; in ath10k_bss_info_changed()
5986 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
5987 arvif->ftm_responder); in ath10k_bss_info_changed()
5991 arvif->vdev_id, arvif->ftm_responder, ret); in ath10k_bss_info_changed()
5998 arvif->use_cts_prot = info->use_cts_prot; in ath10k_bss_info_changed()
6003 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6009 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6014 if (info->use_short_slot) in ath10k_bss_info_changed()
6021 arvif->vdev_id, slottime); in ath10k_bss_info_changed()
6023 vdev_param = ar->wmi.vdev_param->slot_time; in ath10k_bss_info_changed()
6024 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6028 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6032 if (info->use_short_preamble) in ath10k_bss_info_changed()
6039 arvif->vdev_id, preamble); in ath10k_bss_info_changed()
6041 vdev_param = ar->wmi.vdev_param->preamble; in ath10k_bss_info_changed()
6042 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6046 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6050 if (info->assoc) { in ath10k_bss_info_changed()
6055 if (ar->monitor_started) in ath10k_bss_info_changed()
6066 arvif->vdev_id, info->txpower); in ath10k_bss_info_changed()
6068 arvif->txpower = info->txpower; in ath10k_bss_info_changed()
6071 ath10k_warn(ar, "failed to recalc tx power: %d\n", ret); in ath10k_bss_info_changed()
6075 arvif->ps = vif->bss_conf.ps; in ath10k_bss_info_changed()
6080 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6084 !ath10k_mac_vif_chan(arvif->vif, &def)) { in ath10k_bss_info_changed()
6085 band = def.chan->band; in ath10k_bss_info_changed()
6086 mcast_rate = vif->bss_conf.mcast_rate[band]; in ath10k_bss_info_changed()
6088 rateidx = mcast_rate - 1; in ath10k_bss_info_changed()
6090 rateidx = ffs(vif->bss_conf.basic_rates) - 1; in ath10k_bss_info_changed()
6092 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_bss_info_changed()
6106 arvif->vdev_id, rate); in ath10k_bss_info_changed()
6108 vdev_param = ar->wmi.vdev_param->mcast_data_rate; in ath10k_bss_info_changed()
6109 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_bss_info_changed()
6114 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6116 vdev_param = ar->wmi.vdev_param->bcast_data_rate; in ath10k_bss_info_changed()
6117 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_bss_info_changed()
6122 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6126 !ath10k_mac_vif_chan(arvif->vif, &def)) in ath10k_bss_info_changed()
6129 mutex_unlock(&ar->conf_mutex); in ath10k_bss_info_changed()
6134 struct ath10k *ar = hw->priv; in ath10k_mac_op_set_coverage_class()
6139 if (!ar->hw_params.hw_ops->set_coverage_class) { in ath10k_mac_op_set_coverage_class()
6143 ar->hw_params.hw_ops->set_coverage_class(ar, value); in ath10k_mac_op_set_coverage_class()
6155 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_tdls_vif_stations_count_iter()
6156 struct ieee80211_vif *sta_vif = arsta->arvif->vif; in ath10k_mac_tdls_vif_stations_count_iter()
6158 if (sta->tdls && sta_vif == iter_data->curr_vif) in ath10k_mac_tdls_vif_stations_count_iter()
6159 iter_data->num_tdls_stations++; in ath10k_mac_tdls_vif_stations_count_iter()
6179 struct ath10k *ar = hw->priv; in ath10k_hw_scan()
6180 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_hw_scan()
6181 struct cfg80211_scan_request *req = &hw_req->req; in ath10k_hw_scan() local
6187 mutex_lock(&ar->conf_mutex); in ath10k_hw_scan()
6190 ret = -EBUSY; in ath10k_hw_scan()
6194 spin_lock_bh(&ar->data_lock); in ath10k_hw_scan()
6195 switch (ar->scan.state) { in ath10k_hw_scan()
6197 reinit_completion(&ar->scan.started); in ath10k_hw_scan()
6198 reinit_completion(&ar->scan.completed); in ath10k_hw_scan()
6199 ar->scan.state = ATH10K_SCAN_STARTING; in ath10k_hw_scan()
6200 ar->scan.is_roc = false; in ath10k_hw_scan()
6201 ar->scan.vdev_id = arvif->vdev_id; in ath10k_hw_scan()
6207 ret = -EBUSY; in ath10k_hw_scan()
6210 spin_unlock_bh(&ar->data_lock); in ath10k_hw_scan()
6217 arg.vdev_id = arvif->vdev_id; in ath10k_hw_scan()
6220 if (req->ie_len) { in ath10k_hw_scan()
6221 arg.ie_len = req->ie_len; in ath10k_hw_scan()
6222 memcpy(arg.ie, req->ie, arg.ie_len); in ath10k_hw_scan()
6225 if (req->n_ssids) { in ath10k_hw_scan()
6226 arg.n_ssids = req->n_ssids; in ath10k_hw_scan()
6228 arg.ssids[i].len = req->ssids[i].ssid_len; in ath10k_hw_scan()
6229 arg.ssids[i].ssid = req->ssids[i].ssid; in ath10k_hw_scan()
6235 if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { in ath10k_hw_scan()
6237 ether_addr_copy(arg.mac_addr.addr, req->mac_addr); in ath10k_hw_scan()
6238 ether_addr_copy(arg.mac_mask.addr, req->mac_addr_mask); in ath10k_hw_scan()
6241 if (req->n_channels) { in ath10k_hw_scan()
6242 arg.n_channels = req->n_channels; in ath10k_hw_scan()
6244 arg.channels[i] = req->channels[i]->center_freq; in ath10k_hw_scan()
6248 if (req->duration) { in ath10k_hw_scan()
6249 arg.dwell_time_active = req->duration; in ath10k_hw_scan()
6250 arg.dwell_time_passive = req->duration; in ath10k_hw_scan()
6251 arg.burst_duration_ms = req->duration; in ath10k_hw_scan()
6254 (arg.n_channels - 1) + (req->duration + in ath10k_hw_scan()
6266 spin_lock_bh(&ar->data_lock); in ath10k_hw_scan()
6267 ar->scan.state = ATH10K_SCAN_IDLE; in ath10k_hw_scan()
6268 spin_unlock_bh(&ar->data_lock); in ath10k_hw_scan()
6271 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath10k_hw_scan()
6275 mutex_unlock(&ar->conf_mutex); in ath10k_hw_scan()
6282 struct ath10k *ar = hw->priv; in ath10k_cancel_hw_scan()
6284 mutex_lock(&ar->conf_mutex); in ath10k_cancel_hw_scan()
6286 mutex_unlock(&ar->conf_mutex); in ath10k_cancel_hw_scan()
6288 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_cancel_hw_scan()
6296 u32 vdev_param = arvif->ar->wmi.vdev_param->def_keyid; in ath10k_set_key_h_def_keyidx()
6301 * frames with multi-vif APs. This is not required for main firmware in ath10k_set_key_h_def_keyidx()
6304 * This is also needed for 636 fw for IBSS-RSN to work more reliably. in ath10k_set_key_h_def_keyidx()
6306 * FIXME: It remains unknown if this is required for multi-vif STA in ath10k_set_key_h_def_keyidx()
6310 if (arvif->vdev_type != WMI_VDEV_TYPE_AP && in ath10k_set_key_h_def_keyidx()
6311 arvif->vdev_type != WMI_VDEV_TYPE_IBSS) in ath10k_set_key_h_def_keyidx()
6314 if (key->cipher == WLAN_CIPHER_SUITE_WEP40) in ath10k_set_key_h_def_keyidx()
6317 if (key->cipher == WLAN_CIPHER_SUITE_WEP104) in ath10k_set_key_h_def_keyidx()
6320 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath10k_set_key_h_def_keyidx()
6326 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_set_key_h_def_keyidx()
6327 key->keyidx); in ath10k_set_key_h_def_keyidx()
6330 arvif->vdev_id, ret); in ath10k_set_key_h_def_keyidx()
6337 struct ath10k *ar = hw->priv; in ath10k_set_key()
6338 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_set_key()
6342 bool is_wep = key->cipher == WLAN_CIPHER_SUITE_WEP40 || in ath10k_set_key()
6343 key->cipher == WLAN_CIPHER_SUITE_WEP104; in ath10k_set_key()
6350 if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || in ath10k_set_key()
6351 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || in ath10k_set_key()
6352 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 || in ath10k_set_key()
6353 key->cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256) in ath10k_set_key()
6356 if (arvif->nohwcrypt) in ath10k_set_key()
6359 if (key->keyidx > WMI_MAX_KEY_INDEX) in ath10k_set_key()
6360 return -ENOSPC; in ath10k_set_key()
6362 mutex_lock(&ar->conf_mutex); in ath10k_set_key()
6365 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_set_key()
6366 peer_addr = sta->addr; in ath10k_set_key()
6367 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6368 arsta->ucast_cipher = key->cipher; in ath10k_set_key()
6369 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6370 } else if (arvif->vdev_type == WMI_VDEV_TYPE_STA) { in ath10k_set_key()
6371 peer_addr = vif->bss_conf.bssid; in ath10k_set_key()
6373 peer_addr = vif->addr; in ath10k_set_key()
6376 key->hw_key_idx = key->keyidx; in ath10k_set_key()
6380 arvif->wep_keys[key->keyidx] = key; in ath10k_set_key()
6382 arvif->wep_keys[key->keyidx] = NULL; in ath10k_set_key()
6385 /* the peer should not disappear in mid-way (unless FW goes awry) since in ath10k_set_key()
6388 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6389 peer = ath10k_peer_find(ar, arvif->vdev_id, peer_addr); in ath10k_set_key()
6390 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6394 ath10k_warn(ar, "failed to install key for non-existent peer %pM\n", in ath10k_set_key()
6396 ret = -EOPNOTSUPP; in ath10k_set_key()
6404 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath10k_set_key()
6415 * keys. Static WEP needs an explicit per-peer key upload. in ath10k_set_key()
6417 if (vif->type == NL80211_IFTYPE_ADHOC && in ath10k_set_key()
6427 if (cmd == SET_KEY && arvif->def_wep_key_idx == -1) in ath10k_set_key()
6435 arvif->vdev_id, peer_addr, ret); in ath10k_set_key()
6442 if (is_wep && !sta && vif->type == NL80211_IFTYPE_STATION) { in ath10k_set_key()
6451 arvif->vdev_id, peer_addr, ret); in ath10k_set_key()
6457 arvif->vdev_id, peer_addr, ret2); in ath10k_set_key()
6465 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6466 peer = ath10k_peer_find(ar, arvif->vdev_id, peer_addr); in ath10k_set_key()
6468 peer->keys[key->keyidx] = key; in ath10k_set_key()
6470 peer->keys[key->keyidx] = NULL; in ath10k_set_key()
6474 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6476 if (sta && sta->tdls) in ath10k_set_key()
6477 ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_set_key()
6478 ar->wmi.peer_param->authorize, 1); in ath10k_set_key()
6479 else if (sta && cmd == SET_KEY && (key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) in ath10k_set_key()
6480 ath10k_wmi_peer_set_param(ar, arvif->vdev_id, peer_addr, in ath10k_set_key()
6481 ar->wmi.peer_param->authorize, 1); in ath10k_set_key()
6484 mutex_unlock(&ar->conf_mutex); in ath10k_set_key()
6492 struct ath10k *ar = hw->priv; in ath10k_set_default_unicast_key()
6493 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_set_default_unicast_key()
6496 mutex_lock(&arvif->ar->conf_mutex); in ath10k_set_default_unicast_key()
6498 if (arvif->ar->state != ATH10K_STATE_ON) in ath10k_set_default_unicast_key()
6502 arvif->vdev_id, keyidx); in ath10k_set_default_unicast_key()
6504 ret = ath10k_wmi_vdev_set_param(arvif->ar, in ath10k_set_default_unicast_key()
6505 arvif->vdev_id, in ath10k_set_default_unicast_key()
6506 arvif->ar->wmi.vdev_param->def_keyid, in ath10k_set_default_unicast_key()
6511 arvif->vdev_id, in ath10k_set_default_unicast_key()
6516 arvif->def_wep_key_idx = keyidx; in ath10k_set_default_unicast_key()
6519 mutex_unlock(&arvif->ar->conf_mutex); in ath10k_set_default_unicast_key()
6537 arvif = arsta->arvif; in ath10k_sta_rc_update_wk()
6538 ar = arvif->ar; in ath10k_sta_rc_update_wk()
6540 if (WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) in ath10k_sta_rc_update_wk()
6543 band = def.chan->band; in ath10k_sta_rc_update_wk()
6544 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath10k_sta_rc_update_wk()
6545 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_sta_rc_update_wk()
6547 spin_lock_bh(&ar->data_lock); in ath10k_sta_rc_update_wk()
6549 changed = arsta->changed; in ath10k_sta_rc_update_wk()
6550 arsta->changed = 0; in ath10k_sta_rc_update_wk()
6552 bw = arsta->bw; in ath10k_sta_rc_update_wk()
6553 nss = arsta->nss; in ath10k_sta_rc_update_wk()
6554 smps = arsta->smps; in ath10k_sta_rc_update_wk()
6556 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update_wk()
6558 mutex_lock(&ar->conf_mutex); in ath10k_sta_rc_update_wk()
6569 sta->addr, bw, mode); in ath10k_sta_rc_update_wk()
6571 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6572 ar->wmi.peer_param->phymode, mode); in ath10k_sta_rc_update_wk()
6575 sta->addr, mode, err); in ath10k_sta_rc_update_wk()
6579 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6580 ar->wmi.peer_param->chan_width, bw); in ath10k_sta_rc_update_wk()
6583 sta->addr, bw, err); in ath10k_sta_rc_update_wk()
6588 sta->addr, nss); in ath10k_sta_rc_update_wk()
6590 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6591 ar->wmi.peer_param->nss, nss); in ath10k_sta_rc_update_wk()
6594 sta->addr, nss, err); in ath10k_sta_rc_update_wk()
6599 sta->addr, smps); in ath10k_sta_rc_update_wk()
6601 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6602 ar->wmi.peer_param->smps_state, smps); in ath10k_sta_rc_update_wk()
6605 sta->addr, smps, err); in ath10k_sta_rc_update_wk()
6610 sta->addr); in ath10k_sta_rc_update_wk()
6612 err = ath10k_station_assoc(ar, arvif->vif, sta, true); in ath10k_sta_rc_update_wk()
6615 sta->addr); in ath10k_sta_rc_update_wk()
6619 mutex_unlock(&ar->conf_mutex); in ath10k_sta_rc_update_wk()
6625 struct ath10k *ar = arvif->ar; in ath10k_mac_inc_num_stations()
6627 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_inc_num_stations()
6629 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath10k_mac_inc_num_stations()
6632 if (ar->num_stations >= ar->max_num_stations) in ath10k_mac_inc_num_stations()
6633 return -ENOBUFS; in ath10k_mac_inc_num_stations()
6635 ar->num_stations++; in ath10k_mac_inc_num_stations()
6643 struct ath10k *ar = arvif->ar; in ath10k_mac_dec_num_stations()
6645 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_dec_num_stations()
6647 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath10k_mac_dec_num_stations()
6650 ar->num_stations--; in ath10k_mac_dec_num_stations()
6657 struct ath10k *ar = hw->priv; in ath10k_sta_set_txpwr()
6658 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_set_txpwr()
6662 if (sta->txpwr.type == NL80211_TX_POWER_AUTOMATIC) { in ath10k_sta_set_txpwr()
6665 txpwr = sta->txpwr.power; in ath10k_sta_set_txpwr()
6667 return -EINVAL; in ath10k_sta_set_txpwr()
6671 return -EINVAL; in ath10k_sta_set_txpwr()
6673 mutex_lock(&ar->conf_mutex); in ath10k_sta_set_txpwr()
6675 ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_set_txpwr()
6676 ar->wmi.peer_param->use_fixed_power, txpwr); in ath10k_sta_set_txpwr()
6678 ath10k_warn(ar, "failed to set tx power for station ret: %d\n", in ath10k_sta_set_txpwr()
6684 mutex_unlock(&ar->conf_mutex); in ath10k_sta_set_txpwr()
6703 num_rates += hweight32(mask->control[band].legacy); in ath10k_mac_bitrate_mask_has_single_rate()
6705 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) in ath10k_mac_bitrate_mask_has_single_rate()
6706 num_rates += hweight8(mask->control[band].ht_mcs[i]); in ath10k_mac_bitrate_mask_has_single_rate()
6709 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_has_single_rate()
6710 tmp = hweight16(mask->control[band].vht_mcs[i]); in ath10k_mac_bitrate_mask_has_single_rate()
6733 if (hweight32(mask->control[band].legacy) == 1) { in ath10k_mac_bitrate_mask_get_single_rate()
6734 rate_idx = ffs(mask->control[band].legacy) - 1; in ath10k_mac_bitrate_mask_get_single_rate()
6736 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_mac_bitrate_mask_get_single_rate()
6749 (*nss - 1) << 4 | in ath10k_mac_bitrate_mask_get_single_rate()
6755 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_rate()
6756 if (hweight8(mask->control[band].ht_mcs[i]) == 1) { in ath10k_mac_bitrate_mask_get_single_rate()
6759 (*nss - 1) << 4 | in ath10k_mac_bitrate_mask_get_single_rate()
6760 (ffs(mask->control[band].ht_mcs[i]) - 1); in ath10k_mac_bitrate_mask_get_single_rate()
6767 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_rate()
6768 if (hweight16(mask->control[band].vht_mcs[i]) == 1) { in ath10k_mac_bitrate_mask_get_single_rate()
6771 (*nss - 1) << 4 | in ath10k_mac_bitrate_mask_get_single_rate()
6772 (ffs(mask->control[band].vht_mcs[i]) - 1); in ath10k_mac_bitrate_mask_get_single_rate()
6778 return -EINVAL; in ath10k_mac_bitrate_mask_get_single_rate()
6785 if (nss > sta->rx_nss) { in ath10k_mac_validate_rate_mask()
6787 nss, sta->rx_nss); in ath10k_mac_validate_rate_mask()
6788 return -EINVAL; in ath10k_mac_validate_rate_mask()
6792 if (!sta->vht_cap.vht_supported) { in ath10k_mac_validate_rate_mask()
6794 sta->addr); in ath10k_mac_validate_rate_mask()
6795 return -EINVAL; in ath10k_mac_validate_rate_mask()
6798 if (!sta->ht_cap.ht_supported || sta->vht_cap.vht_supported) { in ath10k_mac_validate_rate_mask()
6800 sta->addr); in ath10k_mac_validate_rate_mask()
6801 return -EINVAL; in ath10k_mac_validate_rate_mask()
6804 if (sta->ht_cap.ht_supported || sta->vht_cap.vht_supported) in ath10k_mac_validate_rate_mask()
6805 return -EINVAL; in ath10k_mac_validate_rate_mask()
6825 return -EINVAL; in ath10k_mac_tid_bitrate_config()
6833 band = def.chan->band; in ath10k_mac_tid_bitrate_config()
6837 return -EINVAL; in ath10k_mac_tid_bitrate_config()
6851 return -EINVAL; in ath10k_mac_tid_bitrate_config()
6857 ar->wmi.svc_map))) in ath10k_mac_tid_bitrate_config()
6860 return -EOPNOTSUPP; in ath10k_mac_tid_bitrate_config()
6869 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_set_tid_config()
6874 if (!sta->wme) in ath10k_mac_set_tid_config()
6875 return -ENOTSUPP; in ath10k_mac_set_tid_config()
6877 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_set_tid_config()
6880 if ((arsta->retry_long[arg->tid] > 0 || in ath10k_mac_set_tid_config()
6881 arsta->rate_code[arg->tid] > 0 || in ath10k_mac_set_tid_config()
6882 arsta->ampdu[arg->tid] == in ath10k_mac_set_tid_config()
6884 arg->ack_policy == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
6886 arg->ack_policy = 0; in ath10k_mac_set_tid_config()
6887 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
6888 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
6889 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
6894 if (arsta->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_mac_set_tid_config()
6895 arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
6896 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
6903 if (arsta->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_mac_set_tid_config()
6904 arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
6905 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
6906 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
6910 ether_addr_copy(arg->peer_macaddr.addr, sta->addr); in ath10k_mac_set_tid_config()
6918 arsta->noack[arg->tid] = arg->ack_policy; in ath10k_mac_set_tid_config()
6919 arg->ack_policy = 0; in ath10k_mac_set_tid_config()
6920 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
6921 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
6922 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
6926 arsta->retry_long[arg->tid] = arg->retry_count; in ath10k_mac_set_tid_config()
6927 arg->retry_count = 0; in ath10k_mac_set_tid_config()
6931 arsta->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
6932 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
6937 arsta->rate_ctrl[arg->tid] = arg->rate_ctrl; in ath10k_mac_set_tid_config()
6938 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
6939 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
6943 arsta->rtscts[arg->tid] = arg->rtscts_ctrl; in ath10k_mac_set_tid_config()
6944 arg->ext_tid_cfg_bitmap = 0; in ath10k_mac_set_tid_config()
6948 if ((arvif->retry_long[arg->tid] || in ath10k_mac_set_tid_config()
6949 arvif->rate_code[arg->tid] || in ath10k_mac_set_tid_config()
6950 arvif->ampdu[arg->tid] == in ath10k_mac_set_tid_config()
6952 arg->ack_policy == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
6955 arvif->noack[arg->tid] = arg->ack_policy; in ath10k_mac_set_tid_config()
6956 arvif->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
6957 arvif->rate_ctrl[arg->tid] = arg->rate_ctrl; in ath10k_mac_set_tid_config()
6962 if (arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_set_tid_config()
6965 arvif->retry_long[arg->tid] = arg->retry_count; in ath10k_mac_set_tid_config()
6969 if (arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_set_tid_config()
6972 arvif->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
6977 if (arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
6981 arvif->rate_ctrl[arg->tid] = arg->rate_ctrl; in ath10k_mac_set_tid_config()
6982 arvif->rate_code[arg->tid] = arg->rcode_flags; in ath10k_mac_set_tid_config()
6987 arvif->rtscts[arg->tid] = arg->rtscts_ctrl; in ath10k_mac_set_tid_config()
6988 arg->ext_tid_cfg_bitmap = 0; in ath10k_mac_set_tid_config()
6992 arvif->tid_conf_changed[arg->tid] |= changed; in ath10k_mac_set_tid_config()
7005 u32 changed = tid_conf->mask; in ath10k_mac_parse_tid_config()
7009 return -EINVAL; in ath10k_mac_parse_tid_config()
7012 if (!(tid_conf->tids & BIT(i))) { in ath10k_mac_parse_tid_config()
7017 arg->tid = i; in ath10k_mac_parse_tid_config()
7020 if (tid_conf->noack == NL80211_TID_CONFIG_ENABLE) { in ath10k_mac_parse_tid_config()
7021 arg->ack_policy = WMI_PEER_TID_CONFIG_NOACK; in ath10k_mac_parse_tid_config()
7022 arg->rate_ctrl = in ath10k_mac_parse_tid_config()
7024 arg->aggr_control = in ath10k_mac_parse_tid_config()
7027 arg->ack_policy = in ath10k_mac_parse_tid_config()
7029 arg->rate_ctrl = in ath10k_mac_parse_tid_config()
7031 arg->aggr_control = in ath10k_mac_parse_tid_config()
7037 arg->retry_count = tid_conf->retry_long; in ath10k_mac_parse_tid_config()
7040 if (tid_conf->noack == NL80211_TID_CONFIG_ENABLE) in ath10k_mac_parse_tid_config()
7041 arg->aggr_control = WMI_TID_CONFIG_AGGR_CONTROL_ENABLE; in ath10k_mac_parse_tid_config()
7043 arg->aggr_control = WMI_TID_CONFIG_AGGR_CONTROL_DISABLE; in ath10k_mac_parse_tid_config()
7049 &arg->rcode_flags, in ath10k_mac_parse_tid_config()
7050 &arg->rate_ctrl, in ath10k_mac_parse_tid_config()
7051 tid_conf->txrate_type, in ath10k_mac_parse_tid_config()
7052 &tid_conf->txrate_mask); in ath10k_mac_parse_tid_config()
7056 arg->rcode_flags = 0; in ath10k_mac_parse_tid_config()
7057 arg->rate_ctrl = 0; in ath10k_mac_parse_tid_config()
7062 if (tid_conf->rtscts) in ath10k_mac_parse_tid_config()
7063 arg->rtscts_ctrl = tid_conf->rtscts; in ath10k_mac_parse_tid_config()
7065 arg->ext_tid_cfg_bitmap = WMI_EXT_TID_RTS_CTS_CONFIG; in ath10k_mac_parse_tid_config()
7082 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_reset_tid_config()
7086 arg.vdev_id = arvif->vdev_id; in ath10k_mac_reset_tid_config()
7101 ether_addr_copy(arg.peer_macaddr.addr, sta->addr); in ath10k_mac_reset_tid_config()
7107 if (!arvif->tids_rst) { in ath10k_mac_reset_tid_config()
7108 arsta->retry_long[i] = -1; in ath10k_mac_reset_tid_config()
7109 arsta->noack[i] = -1; in ath10k_mac_reset_tid_config()
7110 arsta->ampdu[i] = -1; in ath10k_mac_reset_tid_config()
7111 arsta->rate_code[i] = -1; in ath10k_mac_reset_tid_config()
7112 arsta->rate_ctrl[i] = 0; in ath10k_mac_reset_tid_config()
7113 arsta->rtscts[i] = -1; in ath10k_mac_reset_tid_config()
7115 arvif->retry_long[i] = 0; in ath10k_mac_reset_tid_config()
7116 arvif->noack[i] = 0; in ath10k_mac_reset_tid_config()
7117 arvif->ampdu[i] = 0; in ath10k_mac_reset_tid_config()
7118 arvif->rate_code[i] = 0; in ath10k_mac_reset_tid_config()
7119 arvif->rate_ctrl[i] = 0; in ath10k_mac_reset_tid_config()
7120 arvif->rtscts[i] = 0; in ath10k_mac_reset_tid_config()
7143 arvif = arsta->arvif; in ath10k_sta_tid_cfg_wk()
7144 ar = arvif->ar; in ath10k_sta_tid_cfg_wk()
7146 mutex_lock(&ar->conf_mutex); in ath10k_sta_tid_cfg_wk()
7148 if (arvif->tids_rst) { in ath10k_sta_tid_cfg_wk()
7150 arvif->tids_rst); in ath10k_sta_tid_cfg_wk()
7154 ether_addr_copy(arg.peer_macaddr.addr, sta->addr); in ath10k_sta_tid_cfg_wk()
7158 changed = arvif->tid_conf_changed[i]; in ath10k_sta_tid_cfg_wk()
7161 if (arsta->noack[i] != -1) { in ath10k_sta_tid_cfg_wk()
7165 arg.ack_policy = arvif->noack[i]; in ath10k_sta_tid_cfg_wk()
7166 arg.aggr_control = arvif->ampdu[i]; in ath10k_sta_tid_cfg_wk()
7167 arg.rate_ctrl = arvif->rate_ctrl[i]; in ath10k_sta_tid_cfg_wk()
7172 if (arsta->retry_long[i] != -1 || in ath10k_sta_tid_cfg_wk()
7173 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7174 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7177 arg.retry_count = arvif->retry_long[i]; in ath10k_sta_tid_cfg_wk()
7183 if (arsta->ampdu[i] != -1 || in ath10k_sta_tid_cfg_wk()
7184 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7185 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7188 arg.aggr_control = arvif->ampdu[i]; in ath10k_sta_tid_cfg_wk()
7195 nss = ATH10K_HW_NSS(arvif->rate_code[i]); in ath10k_sta_tid_cfg_wk()
7197 arvif->rate_code[i], in ath10k_sta_tid_cfg_wk()
7200 arvif->rate_ctrl[i] > WMI_TID_CONFIG_RATE_CONTROL_AUTO) { in ath10k_sta_tid_cfg_wk()
7205 if (arsta->rate_ctrl[i] > in ath10k_sta_tid_cfg_wk()
7207 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7208 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7212 arg.rate_ctrl = arvif->rate_ctrl[i]; in ath10k_sta_tid_cfg_wk()
7213 arg.rcode_flags = arvif->rate_code[i]; in ath10k_sta_tid_cfg_wk()
7219 if (arsta->rtscts[i]) { in ath10k_sta_tid_cfg_wk()
7223 arg.rtscts_ctrl = arvif->rtscts[i] - 1; in ath10k_sta_tid_cfg_wk()
7236 sta->addr, ret); in ath10k_sta_tid_cfg_wk()
7247 mutex_unlock(&ar->conf_mutex); in ath10k_sta_tid_cfg_wk()
7253 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_vif_stations_tid_conf()
7255 struct ieee80211_vif *sta_vif = arsta->arvif->vif; in ath10k_mac_vif_stations_tid_conf()
7257 if (sta_vif != iter_data->curr_vif || !sta->wme) in ath10k_mac_vif_stations_tid_conf()
7260 ieee80211_queue_work(iter_data->ar->hw, &arsta->tid_config_wk); in ath10k_mac_vif_stations_tid_conf()
7269 struct ath10k *ar = hw->priv; in ath10k_sta_state()
7270 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_state()
7271 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_state()
7279 arsta->arvif = arvif; in ath10k_sta_state()
7280 arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED; in ath10k_sta_state()
7281 INIT_WORK(&arsta->update_wk, ath10k_sta_rc_update_wk); in ath10k_sta_state()
7282 INIT_WORK(&arsta->tid_config_wk, ath10k_sta_tid_cfg_wk); in ath10k_sta_state()
7284 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) in ath10k_sta_state()
7285 ath10k_mac_txq_init(sta->txq[i]); in ath10k_sta_state()
7291 cancel_work_sync(&arsta->update_wk); in ath10k_sta_state()
7292 cancel_work_sync(&arsta->tid_config_wk); in ath10k_sta_state()
7295 mutex_lock(&ar->conf_mutex); in ath10k_sta_state()
7307 arvif->vdev_id, sta->addr, in ath10k_sta_state()
7308 ar->num_stations + 1, ar->max_num_stations, in ath10k_sta_state()
7309 ar->num_peers + 1, ar->max_num_peers); in ath10k_sta_state()
7313 if (sta->tdls) { in ath10k_sta_state()
7314 if (num_tdls_stations >= ar->max_num_tdls_vdevs) { in ath10k_sta_state()
7316 arvif->vdev_id, in ath10k_sta_state()
7317 ar->max_num_tdls_vdevs); in ath10k_sta_state()
7318 ret = -ELNRNG; in ath10k_sta_state()
7327 ar->max_num_stations); in ath10k_sta_state()
7332 arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), in ath10k_sta_state()
7334 if (!arsta->tx_stats) { in ath10k_sta_state()
7336 ret = -ENOMEM; in ath10k_sta_state()
7341 ret = ath10k_peer_create(ar, vif, sta, arvif->vdev_id, in ath10k_sta_state()
7342 sta->addr, peer_type); in ath10k_sta_state()
7345 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7347 kfree(arsta->tx_stats); in ath10k_sta_state()
7351 spin_lock_bh(&ar->data_lock); in ath10k_sta_state()
7353 peer = ath10k_peer_find(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7356 vif->addr, arvif->vdev_id); in ath10k_sta_state()
7357 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7358 ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7360 kfree(arsta->tx_stats); in ath10k_sta_state()
7361 ret = -ENOENT; in ath10k_sta_state()
7365 arsta->peer_id = find_first_bit(peer->peer_ids, in ath10k_sta_state()
7368 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7370 if (!sta->tdls) in ath10k_sta_state()
7373 ret = ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7377 arvif->vdev_id, ret); in ath10k_sta_state()
7378 ath10k_peer_delete(ar, arvif->vdev_id, in ath10k_sta_state()
7379 sta->addr); in ath10k_sta_state()
7381 kfree(arsta->tx_stats); in ath10k_sta_state()
7385 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, sta, in ath10k_sta_state()
7390 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7391 ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7393 kfree(arsta->tx_stats); in ath10k_sta_state()
7397 ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7407 arvif->vdev_id, sta->addr, sta); in ath10k_sta_state()
7409 if (sta->tdls) { in ath10k_sta_state()
7410 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, in ath10k_sta_state()
7415 sta->addr, in ath10k_sta_state()
7419 ret = ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7422 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7426 spin_lock_bh(&ar->data_lock); in ath10k_sta_state()
7427 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_sta_state()
7428 peer = ar->peer_map[i]; in ath10k_sta_state()
7432 if (peer->sta == sta) { in ath10k_sta_state()
7434 sta->addr, peer, i, arvif->vdev_id); in ath10k_sta_state()
7435 peer->sta = NULL; in ath10k_sta_state()
7440 list_del(&peer->list); in ath10k_sta_state()
7441 ar->peer_map[i] = NULL; in ath10k_sta_state()
7443 ar->num_peers--; in ath10k_sta_state()
7446 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7449 kfree(arsta->tx_stats); in ath10k_sta_state()
7450 arsta->tx_stats = NULL; in ath10k_sta_state()
7453 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) in ath10k_sta_state()
7454 ath10k_mac_txq_unref(ar, sta->txq[i]); in ath10k_sta_state()
7456 if (!sta->tdls) in ath10k_sta_state()
7463 ret = ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7467 arvif->vdev_id, ret); in ath10k_sta_state()
7471 (vif->type == NL80211_IFTYPE_AP || in ath10k_sta_state()
7472 vif->type == NL80211_IFTYPE_MESH_POINT || in ath10k_sta_state()
7473 vif->type == NL80211_IFTYPE_ADHOC)) { in ath10k_sta_state()
7478 sta->addr); in ath10k_sta_state()
7483 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7486 sta->tdls) { in ath10k_sta_state()
7491 sta->addr); in ath10k_sta_state()
7496 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7500 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, sta, in ath10k_sta_state()
7504 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7507 (vif->type == NL80211_IFTYPE_AP || in ath10k_sta_state()
7508 vif->type == NL80211_IFTYPE_MESH_POINT || in ath10k_sta_state()
7509 vif->type == NL80211_IFTYPE_ADHOC)) { in ath10k_sta_state()
7514 sta->addr); in ath10k_sta_state()
7519 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7522 mutex_unlock(&ar->conf_mutex); in ath10k_sta_state()
7529 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_conf_tx_uapsd()
7535 lockdep_assert_held(&ar->conf_mutex); in ath10k_conf_tx_uapsd()
7537 if (arvif->vdev_type != WMI_VDEV_TYPE_STA) in ath10k_conf_tx_uapsd()
7568 arvif->u.sta.uapsd |= value; in ath10k_conf_tx_uapsd()
7570 arvif->u.sta.uapsd &= ~value; in ath10k_conf_tx_uapsd()
7572 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7574 arvif->u.sta.uapsd); in ath10k_conf_tx_uapsd()
7580 if (arvif->u.sta.uapsd) in ath10k_conf_tx_uapsd()
7585 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7594 arvif->vdev_id, ret); in ath10k_conf_tx_uapsd()
7601 arvif->vdev_id, ret); in ath10k_conf_tx_uapsd()
7605 if (test_bit(WMI_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG, ar->wmi.svc_map) || in ath10k_conf_tx_uapsd()
7606 test_bit(WMI_SERVICE_STA_UAPSD_VAR_AUTO_TRIG, ar->wmi.svc_map)) { in ath10k_conf_tx_uapsd()
7608 * trigger frame. The following effectively disables u-UAPSD in ath10k_conf_tx_uapsd()
7619 ret = ath10k_wmi_vdev_sta_uapsd(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7620 arvif->bssid, &arg, 1); in ath10k_conf_tx_uapsd()
7636 struct ath10k *ar = hw->priv; in ath10k_conf_tx()
7637 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_conf_tx()
7641 mutex_lock(&ar->conf_mutex); in ath10k_conf_tx()
7645 p = &arvif->wmm_params.ac_vo; in ath10k_conf_tx()
7648 p = &arvif->wmm_params.ac_vi; in ath10k_conf_tx()
7651 p = &arvif->wmm_params.ac_be; in ath10k_conf_tx()
7654 p = &arvif->wmm_params.ac_bk; in ath10k_conf_tx()
7659 ret = -EINVAL; in ath10k_conf_tx()
7663 p->cwmin = params->cw_min; in ath10k_conf_tx()
7664 p->cwmax = params->cw_max; in ath10k_conf_tx()
7665 p->aifs = params->aifs; in ath10k_conf_tx()
7672 p->txop = params->txop * 32; in ath10k_conf_tx()
7674 if (ar->wmi.ops->gen_vdev_wmm_conf) { in ath10k_conf_tx()
7675 ret = ath10k_wmi_vdev_wmm_conf(ar, arvif->vdev_id, in ath10k_conf_tx()
7676 &arvif->wmm_params); in ath10k_conf_tx()
7679 arvif->vdev_id, ret); in ath10k_conf_tx()
7683 /* This won't work well with multi-interface cases but it's in ath10k_conf_tx()
7686 ret = ath10k_wmi_pdev_set_wmm_params(ar, &arvif->wmm_params); in ath10k_conf_tx()
7693 ret = ath10k_conf_tx_uapsd(ar, vif, ac, params->uapsd); in ath10k_conf_tx()
7698 mutex_unlock(&ar->conf_mutex); in ath10k_conf_tx()
7708 struct ath10k *ar = hw->priv; in ath10k_remain_on_channel()
7709 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_remain_on_channel()
7714 mutex_lock(&ar->conf_mutex); in ath10k_remain_on_channel()
7717 ret = -EBUSY; in ath10k_remain_on_channel()
7721 spin_lock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7722 switch (ar->scan.state) { in ath10k_remain_on_channel()
7724 reinit_completion(&ar->scan.started); in ath10k_remain_on_channel()
7725 reinit_completion(&ar->scan.completed); in ath10k_remain_on_channel()
7726 reinit_completion(&ar->scan.on_channel); in ath10k_remain_on_channel()
7727 ar->scan.state = ATH10K_SCAN_STARTING; in ath10k_remain_on_channel()
7728 ar->scan.is_roc = true; in ath10k_remain_on_channel()
7729 ar->scan.vdev_id = arvif->vdev_id; in ath10k_remain_on_channel()
7730 ar->scan.roc_freq = chan->center_freq; in ath10k_remain_on_channel()
7731 ar->scan.roc_notify = true; in ath10k_remain_on_channel()
7737 ret = -EBUSY; in ath10k_remain_on_channel()
7740 spin_unlock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7745 scan_time_msec = ar->hw->wiphy->max_remain_on_channel_duration * 2; in ath10k_remain_on_channel()
7749 arg.vdev_id = arvif->vdev_id; in ath10k_remain_on_channel()
7752 arg.channels[0] = chan->center_freq; in ath10k_remain_on_channel()
7763 spin_lock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7764 ar->scan.state = ATH10K_SCAN_IDLE; in ath10k_remain_on_channel()
7765 spin_unlock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7769 ret = wait_for_completion_timeout(&ar->scan.on_channel, 3 * HZ); in ath10k_remain_on_channel()
7777 ret = -ETIMEDOUT; in ath10k_remain_on_channel()
7781 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath10k_remain_on_channel()
7786 mutex_unlock(&ar->conf_mutex); in ath10k_remain_on_channel()
7793 struct ath10k *ar = hw->priv; in ath10k_cancel_remain_on_channel()
7795 mutex_lock(&ar->conf_mutex); in ath10k_cancel_remain_on_channel()
7797 spin_lock_bh(&ar->data_lock); in ath10k_cancel_remain_on_channel()
7798 ar->scan.roc_notify = false; in ath10k_cancel_remain_on_channel()
7799 spin_unlock_bh(&ar->data_lock); in ath10k_cancel_remain_on_channel()
7803 mutex_unlock(&ar->conf_mutex); in ath10k_cancel_remain_on_channel()
7805 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_cancel_remain_on_channel()
7811 * Both RTS and Fragmentation threshold are interface-specific
7812 * in ath10k, but device-specific in mac80211.
7817 struct ath10k *ar = hw->priv; in ath10k_set_rts_threshold()
7821 mutex_lock(&ar->conf_mutex); in ath10k_set_rts_threshold()
7822 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_set_rts_threshold()
7824 arvif->vdev_id, value); in ath10k_set_rts_threshold()
7829 arvif->vdev_id, ret); in ath10k_set_rts_threshold()
7833 mutex_unlock(&ar->conf_mutex); in ath10k_set_rts_threshold()
7850 return -EOPNOTSUPP; in ath10k_mac_op_set_frag_threshold()
7862 if (ar->state == ATH10K_STATE_WEDGED) in ath10k_mac_wait_tx_complete()
7865 time_left = wait_event_timeout(ar->htt.empty_tx_wq, ({ in ath10k_mac_wait_tx_complete()
7868 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_wait_tx_complete()
7869 empty = (ar->htt.num_pending_tx == 0); in ath10k_mac_wait_tx_complete()
7870 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_wait_tx_complete()
7872 skip = (ar->state == ATH10K_STATE_WEDGED) || in ath10k_mac_wait_tx_complete()
7874 &ar->dev_flags); in ath10k_mac_wait_tx_complete()
7880 ath10k_warn(ar, "failed to flush transmit queue (skip %i ar-state %i): %ld\n", in ath10k_mac_wait_tx_complete()
7881 skip, ar->state, time_left); in ath10k_mac_wait_tx_complete()
7887 struct ath10k *ar = hw->priv; in ath10k_flush()
7892 if (vif && vif->type == NL80211_IFTYPE_STATION) { in ath10k_flush()
7894 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_flush()
7895 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath10k_flush()
7896 ath10k_wmi_peer_flush(ar, arvif->vdev_id, in ath10k_flush()
7897 arvif->bssid, bitmap); in ath10k_flush()
7899 ath10k_htt_flush_tx(&ar->htt); in ath10k_flush()
7904 mutex_lock(&ar->conf_mutex); in ath10k_flush()
7906 mutex_unlock(&ar->conf_mutex); in ath10k_flush()
7921 struct ath10k *ar = hw->priv; in ath10k_reconfig_complete()
7926 mutex_lock(&ar->conf_mutex); in ath10k_reconfig_complete()
7931 if (ar->state == ATH10K_STATE_RESTARTED) { in ath10k_reconfig_complete()
7933 ar->state = ATH10K_STATE_ON; in ath10k_reconfig_complete()
7934 ieee80211_wake_queues(ar->hw); in ath10k_reconfig_complete()
7937 mutex_unlock(&ar->conf_mutex); in ath10k_reconfig_complete()
7947 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_bss_chan_survey()
7949 if (!test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map) || in ath10k_mac_update_bss_chan_survey()
7950 (ar->rx_channel != channel)) in ath10k_mac_update_bss_chan_survey()
7953 if (ar->scan.state != ATH10K_SCAN_IDLE) { in ath10k_mac_update_bss_chan_survey()
7958 reinit_completion(&ar->bss_survey_done); in ath10k_mac_update_bss_chan_survey()
7966 ret = wait_for_completion_timeout(&ar->bss_survey_done, 3 * HZ); in ath10k_mac_update_bss_chan_survey()
7976 struct ath10k *ar = hw->priv; in ath10k_get_survey()
7978 struct survey_info *ar_survey = &ar->survey[idx]; in ath10k_get_survey()
7981 mutex_lock(&ar->conf_mutex); in ath10k_get_survey()
7983 sband = hw->wiphy->bands[NL80211_BAND_2GHZ]; in ath10k_get_survey()
7984 if (sband && idx >= sband->n_channels) { in ath10k_get_survey()
7985 idx -= sband->n_channels; in ath10k_get_survey()
7990 sband = hw->wiphy->bands[NL80211_BAND_5GHZ]; in ath10k_get_survey()
7992 if (!sband || idx >= sband->n_channels) { in ath10k_get_survey()
7993 ret = -ENOENT; in ath10k_get_survey()
7997 ath10k_mac_update_bss_chan_survey(ar, &sband->channels[idx]); in ath10k_get_survey()
7999 spin_lock_bh(&ar->data_lock); in ath10k_get_survey()
8001 spin_unlock_bh(&ar->data_lock); in ath10k_get_survey()
8003 survey->channel = &sband->channels[idx]; in ath10k_get_survey()
8005 if (ar->rx_channel == survey->channel) in ath10k_get_survey()
8006 survey->filled |= SURVEY_INFO_IN_USE; in ath10k_get_survey()
8009 mutex_unlock(&ar->conf_mutex); in ath10k_get_survey()
8019 struct ieee80211_supported_band *sband = &ar->mac.sbands[band]; in ath10k_mac_bitrate_mask_get_single_nss()
8020 u16 vht_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map); in ath10k_mac_bitrate_mask_get_single_nss()
8025 if (mask->control[band].legacy) in ath10k_mac_bitrate_mask_get_single_nss()
8028 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_nss()
8029 if (mask->control[band].ht_mcs[i] == 0) in ath10k_mac_bitrate_mask_get_single_nss()
8031 else if (mask->control[band].ht_mcs[i] == in ath10k_mac_bitrate_mask_get_single_nss()
8032 sband->ht_cap.mcs.rx_mask[i]) in ath10k_mac_bitrate_mask_get_single_nss()
8038 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_nss()
8039 if (mask->control[band].vht_mcs[i] == 0) in ath10k_mac_bitrate_mask_get_single_nss()
8041 else if (mask->control[band].vht_mcs[i] == in ath10k_mac_bitrate_mask_get_single_nss()
8054 if (BIT(fls(ht_nss_mask)) - 1 != ht_nss_mask) in ath10k_mac_bitrate_mask_get_single_nss()
8065 struct ath10k *ar = arvif->ar; in ath10k_mac_set_fixed_rate_params()
8069 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_set_fixed_rate_params()
8072 arvif->vdev_id, rate, nss, sgi); in ath10k_mac_set_fixed_rate_params()
8074 vdev_param = ar->wmi.vdev_param->fixed_rate; in ath10k_mac_set_fixed_rate_params()
8075 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, rate); in ath10k_mac_set_fixed_rate_params()
8082 vdev_param = ar->wmi.vdev_param->nss; in ath10k_mac_set_fixed_rate_params()
8083 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, nss); in ath10k_mac_set_fixed_rate_params()
8089 vdev_param = ar->wmi.vdev_param->sgi; in ath10k_mac_set_fixed_rate_params()
8090 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, sgi); in ath10k_mac_set_fixed_rate_params()
8096 vdev_param = ar->wmi.vdev_param->ldpc; in ath10k_mac_set_fixed_rate_params()
8097 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, ldpc); in ath10k_mac_set_fixed_rate_params()
8117 * ranges can be used: none, 0-7, 0-8 and 0-9. in ath10k_mac_can_set_bitrate_mask()
8120 vht_mcs = mask->control[band].vht_mcs[i]; in ath10k_mac_can_set_bitrate_mask()
8124 case BIT(8) - 1: in ath10k_mac_can_set_bitrate_mask()
8125 case BIT(9) - 1: in ath10k_mac_can_set_bitrate_mask()
8126 case BIT(10) - 1: in ath10k_mac_can_set_bitrate_mask()
8130 ath10k_warn(ar, "refusing bitrate mask with missing 0-7 VHT MCS rates\n"); in ath10k_mac_can_set_bitrate_mask()
8143 u8 rate = arvif->vht_pfr; in ath10k_mac_set_vht_bitrate_mask_fixup()
8146 if (!sta->vht_cap.vht_supported || arvif->vht_num_rates != 1) in ath10k_mac_set_vht_bitrate_mask_fixup()
8149 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_mac_set_vht_bitrate_mask_fixup()
8153 sta->addr, err); in ath10k_mac_set_vht_bitrate_mask_fixup()
8162 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_set_bitrate_mask_iter()
8163 struct ath10k *ar = arvif->ar; in ath10k_mac_set_bitrate_mask_iter()
8165 if (arsta->arvif != arvif) in ath10k_mac_set_bitrate_mask_iter()
8171 spin_lock_bh(&ar->data_lock); in ath10k_mac_set_bitrate_mask_iter()
8172 arsta->changed |= IEEE80211_RC_SUPP_RATES_CHANGED; in ath10k_mac_set_bitrate_mask_iter()
8173 spin_unlock_bh(&ar->data_lock); in ath10k_mac_set_bitrate_mask_iter()
8175 ieee80211_queue_work(ar->hw, &arsta->update_wk); in ath10k_mac_set_bitrate_mask_iter()
8182 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_clr_bitrate_mask_iter()
8183 struct ath10k *ar = arvif->ar; in ath10k_mac_clr_bitrate_mask_iter()
8187 if (arsta->arvif != arvif || !sta->vht_cap.vht_supported) in ath10k_mac_clr_bitrate_mask_iter()
8190 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_mac_clr_bitrate_mask_iter()
8195 sta->addr, err); in ath10k_mac_clr_bitrate_mask_iter()
8202 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_set_bitrate_mask()
8204 struct ath10k *ar = arvif->ar; in ath10k_mac_op_set_bitrate_mask()
8219 return -EPERM; in ath10k_mac_op_set_bitrate_mask()
8221 band = def.chan->band; in ath10k_mac_op_set_bitrate_mask()
8222 ht_mcs_mask = mask->control[band].ht_mcs; in ath10k_mac_op_set_bitrate_mask()
8223 vht_mcs_mask = mask->control[band].vht_mcs; in ath10k_mac_op_set_bitrate_mask()
8224 ldpc = !!(ar->ht_cap_info & WMI_HT_CAP_LDPC); in ath10k_mac_op_set_bitrate_mask()
8226 sgi = mask->control[band].gi; in ath10k_mac_op_set_bitrate_mask()
8228 return -EINVAL; in ath10k_mac_op_set_bitrate_mask()
8231 ar->normal_mode_fw.fw_file.fw_features); in ath10k_mac_op_set_bitrate_mask()
8233 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8234 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_mac_op_set_bitrate_mask()
8237 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8247 arvif->vdev_id, ret); in ath10k_mac_op_set_bitrate_mask()
8256 nss = min(ar->num_rf_chains, in ath10k_mac_op_set_bitrate_mask()
8265 return -EINVAL; in ath10k_mac_op_set_bitrate_mask()
8280 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8283 arvif->bitrate_mask = *mask; in ath10k_mac_op_set_bitrate_mask()
8284 arvif->vht_num_rates = vht_num_rates; in ath10k_mac_op_set_bitrate_mask()
8285 arvif->vht_pfr = vht_pfr; in ath10k_mac_op_set_bitrate_mask()
8286 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_mac_op_set_bitrate_mask()
8290 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8293 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8298 arvif->vdev_id, ret); in ath10k_mac_op_set_bitrate_mask()
8303 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8313 struct ath10k *ar = hw->priv; in ath10k_sta_rc_update()
8314 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_rc_update()
8315 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_rc_update()
8319 spin_lock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8321 peer = ath10k_peer_find(ar, arvif->vdev_id, sta->addr); in ath10k_sta_rc_update()
8323 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8325 sta->addr, arvif->vdev_id); in ath10k_sta_rc_update()
8331 sta->addr, changed, sta->bandwidth, sta->rx_nss, in ath10k_sta_rc_update()
8332 sta->smps_mode); in ath10k_sta_rc_update()
8337 switch (sta->bandwidth) { in ath10k_sta_rc_update()
8352 sta->bandwidth, sta->addr); in ath10k_sta_rc_update()
8357 arsta->bw = bw; in ath10k_sta_rc_update()
8361 arsta->nss = sta->rx_nss; in ath10k_sta_rc_update()
8366 switch (sta->smps_mode) { in ath10k_sta_rc_update()
8379 sta->smps_mode, sta->addr); in ath10k_sta_rc_update()
8384 arsta->smps = smps; in ath10k_sta_rc_update()
8387 arsta->changed |= changed; in ath10k_sta_rc_update()
8389 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8391 ieee80211_queue_work(hw, &arsta->update_wk); in ath10k_sta_rc_update()
8397 struct ath10k *ar = hw->priv; in ath10k_offset_tsf()
8398 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_offset_tsf()
8403 vdev_param = ar->wmi.vdev_param->dec_tsf; in ath10k_offset_tsf()
8404 offset = -tsf_offset; in ath10k_offset_tsf()
8406 vdev_param = ar->wmi.vdev_param->inc_tsf; in ath10k_offset_tsf()
8410 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_offset_tsf()
8413 if (ret && ret != -EOPNOTSUPP) in ath10k_offset_tsf()
8422 struct ath10k *ar = hw->priv; in ath10k_ampdu_action()
8423 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_ampdu_action()
8424 struct ieee80211_sta *sta = params->sta; in ath10k_ampdu_action()
8425 enum ieee80211_ampdu_mlme_action action = params->action; in ath10k_ampdu_action()
8426 u16 tid = params->tid; in ath10k_ampdu_action()
8429 arvif->vdev_id, sta->addr, tid, action); in ath10k_ampdu_action()
8446 return -EOPNOTSUPP; in ath10k_ampdu_action()
8449 return -EINVAL; in ath10k_ampdu_action()
8460 /* Both locks are required because ar->rx_channel is modified. This in ath10k_mac_update_rx_channel()
8463 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_rx_channel()
8464 lockdep_assert_held(&ar->data_lock); in ath10k_mac_update_rx_channel()
8470 * on a linked list now. Doing a lookup peer -> vif -> chanctx for each in ath10k_mac_update_rx_channel()
8471 * ppdu on Rx may reduce performance on low-end systems. It should be in ath10k_mac_update_rx_channel()
8475 * only for multi-channel cases. Single-channel cases will remain to in ath10k_mac_update_rx_channel()
8481 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_update_rx_channel()
8486 def = &vifs[0].new_ctx->def; in ath10k_mac_update_rx_channel()
8488 ar->rx_channel = def->chan; in ath10k_mac_update_rx_channel()
8490 (ctx && (ar->state == ATH10K_STATE_RESTARTED))) { in ath10k_mac_update_rx_channel()
8496 ar->rx_channel = ctx->def.chan; in ath10k_mac_update_rx_channel()
8498 ar->rx_channel = NULL; in ath10k_mac_update_rx_channel()
8512 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_vif_chan()
8517 if (ar->monitor_started) in ath10k_mac_update_vif_chan()
8521 arvif = (void *)vifs[i].vif->drv_priv; in ath10k_mac_update_vif_chan()
8524 "mac chanctx switch vdev_id %i freq %hu->%hu width %d->%d\n", in ath10k_mac_update_vif_chan()
8525 arvif->vdev_id, in ath10k_mac_update_vif_chan()
8526 vifs[i].old_ctx->def.chan->center_freq, in ath10k_mac_update_vif_chan()
8527 vifs[i].new_ctx->def.chan->center_freq, in ath10k_mac_update_vif_chan()
8528 vifs[i].old_ctx->def.width, in ath10k_mac_update_vif_chan()
8529 vifs[i].new_ctx->def.width); in ath10k_mac_update_vif_chan()
8531 if (WARN_ON(!arvif->is_started)) in ath10k_mac_update_vif_chan()
8534 if (WARN_ON(!arvif->is_up)) in ath10k_mac_update_vif_chan()
8537 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_update_vif_chan()
8540 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8549 spin_lock_bh(&ar->data_lock); in ath10k_mac_update_vif_chan()
8551 spin_unlock_bh(&ar->data_lock); in ath10k_mac_update_vif_chan()
8554 arvif = (void *)vifs[i].vif->drv_priv; in ath10k_mac_update_vif_chan()
8556 if (WARN_ON(!arvif->is_started)) in ath10k_mac_update_vif_chan()
8559 if (WARN_ON(!arvif->is_up)) in ath10k_mac_update_vif_chan()
8572 ret = ath10k_vdev_restart(arvif, &vifs[i].new_ctx->def); in ath10k_mac_update_vif_chan()
8575 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8579 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_mac_update_vif_chan()
8580 arvif->bssid); in ath10k_mac_update_vif_chan()
8583 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8595 struct ath10k *ar = hw->priv; in ath10k_mac_op_add_chanctx()
8599 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath10k_mac_op_add_chanctx()
8601 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_add_chanctx()
8603 spin_lock_bh(&ar->data_lock); in ath10k_mac_op_add_chanctx()
8605 spin_unlock_bh(&ar->data_lock); in ath10k_mac_op_add_chanctx()
8610 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_add_chanctx()
8619 struct ath10k *ar = hw->priv; in ath10k_mac_op_remove_chanctx()
8623 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath10k_mac_op_remove_chanctx()
8625 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_remove_chanctx()
8627 spin_lock_bh(&ar->data_lock); in ath10k_mac_op_remove_chanctx()
8629 spin_unlock_bh(&ar->data_lock); in ath10k_mac_op_remove_chanctx()
8634 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_remove_chanctx()
8650 if (rcu_access_pointer(vif->chanctx_conf) != arg->ctx) in ath10k_mac_change_chanctx_cnt_iter()
8653 arg->n_vifs++; in ath10k_mac_change_chanctx_cnt_iter()
8663 ctx = rcu_access_pointer(vif->chanctx_conf); in ath10k_mac_change_chanctx_fill_iter()
8664 if (ctx != arg->ctx) in ath10k_mac_change_chanctx_fill_iter()
8667 if (WARN_ON(arg->next_vif == arg->n_vifs)) in ath10k_mac_change_chanctx_fill_iter()
8670 arg->vifs[arg->next_vif].vif = vif; in ath10k_mac_change_chanctx_fill_iter()
8671 arg->vifs[arg->next_vif].old_ctx = ctx; in ath10k_mac_change_chanctx_fill_iter()
8672 arg->vifs[arg->next_vif].new_ctx = ctx; in ath10k_mac_change_chanctx_fill_iter()
8673 arg->next_vif++; in ath10k_mac_change_chanctx_fill_iter()
8681 struct ath10k *ar = hw->priv; in ath10k_mac_op_change_chanctx()
8684 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_change_chanctx()
8688 ctx->def.chan->center_freq, ctx->def.width, ctx, changed); in ath10k_mac_op_change_chanctx()
8725 * definitions per vdev internally and there's no host-side channel in ath10k_mac_op_change_chanctx()
8730 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_change_chanctx()
8738 struct ath10k *ar = hw->priv; in ath10k_mac_op_assign_vif_chanctx()
8739 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_assign_vif_chanctx()
8742 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8746 ctx, arvif->vdev_id); in ath10k_mac_op_assign_vif_chanctx()
8748 if (WARN_ON(arvif->is_started)) { in ath10k_mac_op_assign_vif_chanctx()
8749 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8750 return -EBUSY; in ath10k_mac_op_assign_vif_chanctx()
8753 ret = ath10k_vdev_start(arvif, &ctx->def); in ath10k_mac_op_assign_vif_chanctx()
8756 arvif->vdev_id, vif->addr, in ath10k_mac_op_assign_vif_chanctx()
8757 ctx->def.chan->center_freq, ret); in ath10k_mac_op_assign_vif_chanctx()
8761 arvif->is_started = true; in ath10k_mac_op_assign_vif_chanctx()
8766 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
8770 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_mac_op_assign_vif_chanctx()
8771 ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, 0, vif->addr); in ath10k_mac_op_assign_vif_chanctx()
8774 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
8778 arvif->is_up = true; in ath10k_mac_op_assign_vif_chanctx()
8785 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
8789 ar->hw_params.tx_stats_over_pktlog) { in ath10k_mac_op_assign_vif_chanctx()
8790 ar->pktlog_filter |= ATH10K_PKTLOG_PEER_STATS; in ath10k_mac_op_assign_vif_chanctx()
8792 ar->pktlog_filter); in ath10k_mac_op_assign_vif_chanctx()
8799 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8804 arvif->is_started = false; in ath10k_mac_op_assign_vif_chanctx()
8808 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8817 struct ath10k *ar = hw->priv; in ath10k_mac_op_unassign_vif_chanctx()
8818 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_unassign_vif_chanctx()
8821 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_unassign_vif_chanctx()
8825 ctx, arvif->vdev_id); in ath10k_mac_op_unassign_vif_chanctx()
8827 WARN_ON(!arvif->is_started); in ath10k_mac_op_unassign_vif_chanctx()
8829 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_mac_op_unassign_vif_chanctx()
8830 WARN_ON(!arvif->is_up); in ath10k_mac_op_unassign_vif_chanctx()
8832 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_op_unassign_vif_chanctx()
8835 arvif->vdev_id, ret); in ath10k_mac_op_unassign_vif_chanctx()
8837 arvif->is_up = false; in ath10k_mac_op_unassign_vif_chanctx()
8843 arvif->vdev_id, ret); in ath10k_mac_op_unassign_vif_chanctx()
8845 arvif->is_started = false; in ath10k_mac_op_unassign_vif_chanctx()
8847 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_unassign_vif_chanctx()
8856 struct ath10k *ar = hw->priv; in ath10k_mac_op_switch_vif_chanctx()
8858 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_switch_vif_chanctx()
8865 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_switch_vif_chanctx()
8876 ar = hw->priv; in ath10k_mac_op_sta_pre_rcu_remove()
8878 list_for_each_entry(peer, &ar->peers, list) in ath10k_mac_op_sta_pre_rcu_remove()
8879 if (peer->sta == sta) in ath10k_mac_op_sta_pre_rcu_remove()
8880 peer->removed = true; in ath10k_mac_op_sta_pre_rcu_remove()
8957 index = mcs - len_nss1; in ath10k_mac_get_rate_flags_ht()
9043 rate->flags = flags; in ath10k_mac_parse_bitrate()
9044 rate->bw = bw; in ath10k_mac_parse_bitrate()
9045 rate->legacy = bitrate_kbps / 100; in ath10k_mac_parse_bitrate()
9046 rate->nss = nss; in ath10k_mac_parse_bitrate()
9047 rate->mcs = mcs; in ath10k_mac_parse_bitrate()
9054 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_sta_get_peer_stats_info()
9059 if (!(ar->hw_params.supports_peer_stats_info && in ath10k_mac_sta_get_peer_stats_info()
9060 arsta->arvif->vdev_type == WMI_VDEV_TYPE_STA)) in ath10k_mac_sta_get_peer_stats_info()
9063 spin_lock_bh(&ar->data_lock); in ath10k_mac_sta_get_peer_stats_info()
9064 peer = ath10k_peer_find(ar, arsta->arvif->vdev_id, sta->addr); in ath10k_mac_sta_get_peer_stats_info()
9065 spin_unlock_bh(&ar->data_lock); in ath10k_mac_sta_get_peer_stats_info()
9069 reinit_completion(&ar->peer_stats_info_complete); in ath10k_mac_sta_get_peer_stats_info()
9072 arsta->arvif->vdev_id, in ath10k_mac_sta_get_peer_stats_info()
9074 arsta->arvif->bssid, in ath10k_mac_sta_get_peer_stats_info()
9076 if (ret && ret != -EOPNOTSUPP) { in ath10k_mac_sta_get_peer_stats_info()
9081 time_left = wait_for_completion_timeout(&ar->peer_stats_info_complete, 3 * HZ); in ath10k_mac_sta_get_peer_stats_info()
9087 if (arsta->rx_rate_code != 0 && arsta->rx_bitrate_kbps != 0) { in ath10k_mac_sta_get_peer_stats_info()
9088 ath10k_mac_parse_bitrate(ar, arsta->rx_rate_code, in ath10k_mac_sta_get_peer_stats_info()
9089 arsta->rx_bitrate_kbps, in ath10k_mac_sta_get_peer_stats_info()
9090 &sinfo->rxrate); in ath10k_mac_sta_get_peer_stats_info()
9092 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); in ath10k_mac_sta_get_peer_stats_info()
9093 arsta->rx_rate_code = 0; in ath10k_mac_sta_get_peer_stats_info()
9094 arsta->rx_bitrate_kbps = 0; in ath10k_mac_sta_get_peer_stats_info()
9097 if (arsta->tx_rate_code != 0 && arsta->tx_bitrate_kbps != 0) { in ath10k_mac_sta_get_peer_stats_info()
9098 ath10k_mac_parse_bitrate(ar, arsta->tx_rate_code, in ath10k_mac_sta_get_peer_stats_info()
9099 arsta->tx_bitrate_kbps, in ath10k_mac_sta_get_peer_stats_info()
9100 &sinfo->txrate); in ath10k_mac_sta_get_peer_stats_info()
9102 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in ath10k_mac_sta_get_peer_stats_info()
9103 arsta->tx_rate_code = 0; in ath10k_mac_sta_get_peer_stats_info()
9104 arsta->tx_bitrate_kbps = 0; in ath10k_mac_sta_get_peer_stats_info()
9113 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_statistics()
9114 struct ath10k *ar = arsta->arvif->ar; in ath10k_sta_statistics()
9121 sinfo->rx_duration = arsta->rx_duration; in ath10k_sta_statistics()
9122 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION); in ath10k_sta_statistics()
9124 if (arsta->txrate.legacy || arsta->txrate.nss) { in ath10k_sta_statistics()
9125 if (arsta->txrate.legacy) { in ath10k_sta_statistics()
9126 sinfo->txrate.legacy = arsta->txrate.legacy; in ath10k_sta_statistics()
9128 sinfo->txrate.mcs = arsta->txrate.mcs; in ath10k_sta_statistics()
9129 sinfo->txrate.nss = arsta->txrate.nss; in ath10k_sta_statistics()
9130 sinfo->txrate.bw = arsta->txrate.bw; in ath10k_sta_statistics()
9132 sinfo->txrate.flags = arsta->txrate.flags; in ath10k_sta_statistics()
9133 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in ath10k_sta_statistics()
9136 if (ar->htt.disable_tx_comp) { in ath10k_sta_statistics()
9137 sinfo->tx_failed = arsta->tx_failed; in ath10k_sta_statistics()
9138 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); in ath10k_sta_statistics()
9141 sinfo->tx_retries = arsta->tx_retries; in ath10k_sta_statistics()
9142 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES); in ath10k_sta_statistics()
9152 struct ath10k *ar = hw->priv; in ath10k_mac_op_set_tid_config()
9153 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_set_tid_config()
9158 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_tid_config()
9159 arg.vdev_id = arvif->vdev_id; in ath10k_mac_op_set_tid_config()
9161 arvif->tids_rst = 0; in ath10k_mac_op_set_tid_config()
9162 memset(arvif->tid_conf_changed, 0, sizeof(arvif->tid_conf_changed)); in ath10k_mac_op_set_tid_config()
9164 for (i = 0; i < tid_config->n_tid_conf; i++) { in ath10k_mac_op_set_tid_config()
9166 &tid_config->tid_conf[i], in ath10k_mac_op_set_tid_config()
9176 arvif->tids_rst = 0; in ath10k_mac_op_set_tid_config()
9184 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_tid_config()
9193 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_reset_tid_config()
9195 struct ath10k *ar = hw->priv; in ath10k_mac_op_reset_tid_config()
9198 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_reset_tid_config()
9201 arvif->tids_rst = 0; in ath10k_mac_op_reset_tid_config()
9206 arvif->tids_rst = tids; in ath10k_mac_op_reset_tid_config()
9213 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_reset_tid_config()
9358 ar = hw->priv; in ath10k_mac_create()
9359 ar->hw = hw; in ath10k_mac_create()
9360 ar->ops = ops; in ath10k_mac_create()
9367 struct ieee80211_ops *ops = ar->ops; in ath10k_mac_destroy()
9369 ieee80211_free_hw(ar->hw); in ath10k_mac_destroy()
9491 /* FIXME: This is not thouroughly tested. These combinations may over- or
9587 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_get_arvif_iter()
9589 if (arvif->vdev_id == arvif_iter->vdev_id) in ath10k_get_arvif_iter()
9590 arvif_iter->arvif = arvif; in ath10k_get_arvif_iter()
9602 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_get_arvif()
9624 if (wrdd->type != ACPI_TYPE_PACKAGE || in ath10k_mac_wrdd_get_mcc()
9625 wrdd->package.count < 2 || in ath10k_mac_wrdd_get_mcc()
9626 wrdd->package.elements[0].type != ACPI_TYPE_INTEGER || in ath10k_mac_wrdd_get_mcc()
9627 wrdd->package.elements[0].integer.value != 0) { in ath10k_mac_wrdd_get_mcc()
9632 for (i = 1; i < wrdd->package.count; ++i) { in ath10k_mac_wrdd_get_mcc()
9633 mcc_pkg = &wrdd->package.elements[i]; in ath10k_mac_wrdd_get_mcc()
9635 if (mcc_pkg->type != ACPI_TYPE_PACKAGE) in ath10k_mac_wrdd_get_mcc()
9637 if (mcc_pkg->package.count < 2) in ath10k_mac_wrdd_get_mcc()
9639 if (mcc_pkg->package.elements[0].type != ACPI_TYPE_INTEGER || in ath10k_mac_wrdd_get_mcc()
9640 mcc_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) in ath10k_mac_wrdd_get_mcc()
9643 domain_type = &mcc_pkg->package.elements[0]; in ath10k_mac_wrdd_get_mcc()
9644 if (domain_type->integer.value != WRDD_WIFI) in ath10k_mac_wrdd_get_mcc()
9647 mcc_value = &mcc_pkg->package.elements[1]; in ath10k_mac_wrdd_get_mcc()
9648 return mcc_value->integer.value; in ath10k_mac_wrdd_get_mcc()
9662 root_handle = ACPI_HANDLE(ar->dev); in ath10k_mac_get_wrdd_regulatory()
9664 return -EOPNOTSUPP; in ath10k_mac_get_wrdd_regulatory()
9670 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9677 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9683 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9690 "regulatory hint from WRDD (alpha2-code): %s\n", alpha2); in ath10k_mac_get_wrdd_regulatory()
9694 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9709 rd = ar->hw_eeprom_rd; in ath10k_mac_init_rd()
9712 ar->ath_common.regulatory.current_rd = rd; in ath10k_mac_init_rd()
9733 /* Only QCA99x0 and QCA4019 varients support GCMP-128, GCMP-256 in ath10k_mac_register()
9734 * and CCMP-256 in hardware. in ath10k_mac_register()
9744 if (!is_valid_ether_addr(ar->mac_addr)) { in ath10k_mac_register()
9746 eth_random_addr(ar->mac_addr); in ath10k_mac_register()
9748 SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr); in ath10k_mac_register()
9750 SET_IEEE80211_DEV(ar->hw, ar->dev); in ath10k_mac_register()
9756 if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) { in ath10k_mac_register()
9761 ret = -ENOMEM; in ath10k_mac_register()
9765 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath10k_mac_register()
9766 band->n_channels = ARRAY_SIZE(ath10k_2ghz_channels); in ath10k_mac_register()
9767 band->channels = channels; in ath10k_mac_register()
9769 if (ar->hw_params.cck_rate_map_rev2) { in ath10k_mac_register()
9770 band->n_bitrates = ath10k_g_rates_rev2_size; in ath10k_mac_register()
9771 band->bitrates = ath10k_g_rates_rev2; in ath10k_mac_register()
9773 band->n_bitrates = ath10k_g_rates_size; in ath10k_mac_register()
9774 band->bitrates = ath10k_g_rates; in ath10k_mac_register()
9777 ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = band; in ath10k_mac_register()
9780 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) { in ath10k_mac_register()
9785 ret = -ENOMEM; in ath10k_mac_register()
9789 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath10k_mac_register()
9790 band->n_channels = ARRAY_SIZE(ath10k_5ghz_channels); in ath10k_mac_register()
9791 band->channels = channels; in ath10k_mac_register()
9792 band->n_bitrates = ath10k_a_rates_size; in ath10k_mac_register()
9793 band->bitrates = ath10k_a_rates; in ath10k_mac_register()
9794 ar->hw->wiphy->bands[NL80211_BAND_5GHZ] = band; in ath10k_mac_register()
9797 wiphy_read_of_freq_limits(ar->hw->wiphy); in ath10k_mac_register()
9800 ar->hw->wiphy->interface_modes = in ath10k_mac_register()
9805 ar->hw->wiphy->available_antennas_rx = ar->cfg_rx_chainmask; in ath10k_mac_register()
9806 ar->hw->wiphy->available_antennas_tx = ar->cfg_tx_chainmask; in ath10k_mac_register()
9808 if (!test_bit(ATH10K_FW_FEATURE_NO_P2P, ar->normal_mode_fw.fw_file.fw_features)) in ath10k_mac_register()
9809 ar->hw->wiphy->interface_modes |= in ath10k_mac_register()
9814 ieee80211_hw_set(ar->hw, SIGNAL_DBM); in ath10k_mac_register()
9817 ar->running_fw->fw_file.fw_features)) { in ath10k_mac_register()
9818 ieee80211_hw_set(ar->hw, SUPPORTS_PS); in ath10k_mac_register()
9819 ieee80211_hw_set(ar->hw, SUPPORTS_DYNAMIC_PS); in ath10k_mac_register()
9822 ieee80211_hw_set(ar->hw, MFP_CAPABLE); in ath10k_mac_register()
9823 ieee80211_hw_set(ar->hw, REPORTS_TX_ACK_STATUS); in ath10k_mac_register()
9824 ieee80211_hw_set(ar->hw, HAS_RATE_CONTROL); in ath10k_mac_register()
9825 ieee80211_hw_set(ar->hw, AP_LINK_PS); in ath10k_mac_register()
9826 ieee80211_hw_set(ar->hw, SPECTRUM_MGMT); in ath10k_mac_register()
9827 ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT); in ath10k_mac_register()
9828 ieee80211_hw_set(ar->hw, CONNECTION_MONITOR); in ath10k_mac_register()
9829 ieee80211_hw_set(ar->hw, SUPPORTS_PER_STA_GTK); in ath10k_mac_register()
9830 ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF); in ath10k_mac_register()
9831 ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); in ath10k_mac_register()
9832 ieee80211_hw_set(ar->hw, QUEUE_CONTROL); in ath10k_mac_register()
9833 ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); in ath10k_mac_register()
9834 ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); in ath10k_mac_register()
9836 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) in ath10k_mac_register()
9837 ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); in ath10k_mac_register()
9839 ar->hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS; in ath10k_mac_register()
9840 ar->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in ath10k_mac_register()
9842 if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) in ath10k_mac_register()
9843 ar->hw->wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS; in ath10k_mac_register()
9845 if (ar->ht_cap_info & WMI_HT_CAP_ENABLED) { in ath10k_mac_register()
9846 ieee80211_hw_set(ar->hw, AMPDU_AGGREGATION); in ath10k_mac_register()
9847 ieee80211_hw_set(ar->hw, TX_AMPDU_SETUP_IN_HW); in ath10k_mac_register()
9850 ar->hw->wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID; in ath10k_mac_register()
9851 ar->hw->wiphy->max_scan_ie_len = WLAN_SCAN_PARAMS_MAX_IE_LEN; in ath10k_mac_register()
9853 if (test_bit(WMI_SERVICE_NLO, ar->wmi.svc_map)) { in ath10k_mac_register()
9854 ar->hw->wiphy->max_sched_scan_ssids = WMI_PNO_MAX_SUPP_NETWORKS; in ath10k_mac_register()
9855 ar->hw->wiphy->max_match_sets = WMI_PNO_MAX_SUPP_NETWORKS; in ath10k_mac_register()
9856 ar->hw->wiphy->max_sched_scan_ie_len = WMI_PNO_MAX_IE_LENGTH; in ath10k_mac_register()
9857 ar->hw->wiphy->max_sched_scan_plans = WMI_PNO_MAX_SCHED_SCAN_PLANS; in ath10k_mac_register()
9858 ar->hw->wiphy->max_sched_scan_plan_interval = in ath10k_mac_register()
9860 ar->hw->wiphy->max_sched_scan_plan_iterations = in ath10k_mac_register()
9862 ar->hw->wiphy->features |= NL80211_FEATURE_ND_RANDOM_MAC_ADDR; in ath10k_mac_register()
9865 ar->hw->vif_data_size = sizeof(struct ath10k_vif); in ath10k_mac_register()
9866 ar->hw->sta_data_size = sizeof(struct ath10k_sta); in ath10k_mac_register()
9867 ar->hw->txq_data_size = sizeof(struct ath10k_txq); in ath10k_mac_register()
9869 ar->hw->max_listen_interval = ATH10K_MAX_HW_LISTEN_INTERVAL; in ath10k_mac_register()
9871 if (test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) { in ath10k_mac_register()
9872 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD; in ath10k_mac_register()
9878 ar->hw->wiphy->probe_resp_offload |= in ath10k_mac_register()
9884 if (test_bit(WMI_SERVICE_TDLS, ar->wmi.svc_map) || in ath10k_mac_register()
9885 test_bit(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY, ar->wmi.svc_map)) { in ath10k_mac_register()
9886 ar->hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; in ath10k_mac_register()
9887 if (test_bit(WMI_SERVICE_TDLS_WIDER_BANDWIDTH, ar->wmi.svc_map)) in ath10k_mac_register()
9888 ieee80211_hw_set(ar->hw, TDLS_WIDER_BW); in ath10k_mac_register()
9891 if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map)) in ath10k_mac_register()
9892 ieee80211_hw_set(ar->hw, SUPPORTS_TDLS_BUFFER_STA); in ath10k_mac_register()
9894 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; in ath10k_mac_register()
9895 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; in ath10k_mac_register()
9896 ar->hw->wiphy->max_remain_on_channel_duration = 5000; in ath10k_mac_register()
9898 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; in ath10k_mac_register()
9899 ar->hw->wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE | in ath10k_mac_register()
9902 ar->hw->wiphy->max_ap_assoc_sta = ar->max_num_stations; in ath10k_mac_register()
9910 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS); in ath10k_mac_register()
9911 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
9913 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL); in ath10k_mac_register()
9915 if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map) || in ath10k_mac_register()
9916 test_bit(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ar->wmi.svc_map)) in ath10k_mac_register()
9917 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
9921 test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map)) in ath10k_mac_register()
9922 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
9925 if (test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) in ath10k_mac_register()
9926 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
9929 if (test_bit(WMI_SERVICE_TX_PWR_PER_PEER, ar->wmi.svc_map)) in ath10k_mac_register()
9930 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
9933 if (test_bit(WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT, ar->wmi.svc_map)) { in ath10k_mac_register()
9934 ar->hw->wiphy->tid_config_support.vif |= in ath10k_mac_register()
9943 ar->wmi.svc_map)) { in ath10k_mac_register()
9944 ar->hw->wiphy->tid_config_support.vif |= in ath10k_mac_register()
9948 ar->hw->wiphy->tid_config_support.peer = in ath10k_mac_register()
9949 ar->hw->wiphy->tid_config_support.vif; in ath10k_mac_register()
9950 ar->hw->wiphy->max_data_retry_count = ATH10K_MAX_RETRY_COUNT; in ath10k_mac_register()
9952 ar->ops->set_tid_config = NULL; in ath10k_mac_register()
9958 ar->hw->queues = IEEE80211_MAX_QUEUES; in ath10k_mac_register()
9964 ar->hw->offchannel_tx_hw_queue = IEEE80211_MAX_QUEUES - 1; in ath10k_mac_register()
9966 switch (ar->running_fw->fw_file.wmi_op_version) { in ath10k_mac_register()
9968 ar->hw->wiphy->iface_combinations = ath10k_if_comb; in ath10k_mac_register()
9969 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
9971 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); in ath10k_mac_register()
9974 if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar->wmi.svc_map)) { in ath10k_mac_register()
9975 ar->hw->wiphy->iface_combinations = in ath10k_mac_register()
9977 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
9980 ar->hw->wiphy->iface_combinations = ath10k_tlv_if_comb; in ath10k_mac_register()
9981 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
9984 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); in ath10k_mac_register()
9989 ar->hw->wiphy->iface_combinations = ath10k_10x_if_comb; in ath10k_mac_register()
9990 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
9994 ar->hw->wiphy->iface_combinations = ath10k_10_4_if_comb; in ath10k_mac_register()
9995 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
9998 ar->wmi.svc_map)) { in ath10k_mac_register()
9999 ar->hw->wiphy->iface_combinations = in ath10k_mac_register()
10001 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10008 ret = -EINVAL; in ath10k_mac_register()
10012 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) in ath10k_mac_register()
10013 ar->hw->netdev_features = NETIF_F_HW_CSUM; in ath10k_mac_register()
10017 ar->ath_common.debug_mask = ATH_DBG_DFS; in ath10k_mac_register()
10018 ar->dfs_detector = dfs_pattern_detector_init(&ar->ath_common, in ath10k_mac_register()
10021 if (!ar->dfs_detector) in ath10k_mac_register()
10032 if (!ar->hw_params.hw_ops->set_coverage_class) in ath10k_mac_register()
10033 ar->ops->set_coverage_class = NULL; in ath10k_mac_register()
10035 ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy, in ath10k_mac_register()
10042 if (test_bit(WMI_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi.svc_map)) { in ath10k_mac_register()
10043 ar->hw->wiphy->features |= in ath10k_mac_register()
10047 ar->hw->wiphy->cipher_suites = cipher_suites; in ath10k_mac_register()
10049 /* QCA988x and QCA6174 family chips do not support CCMP-256, GCMP-128 in ath10k_mac_register()
10050 * and GCMP-256 ciphers in hardware. Fetch number of ciphers supported in ath10k_mac_register()
10053 if (!ar->hw_params.n_cipher_suites || in ath10k_mac_register()
10054 ar->hw_params.n_cipher_suites > ARRAY_SIZE(cipher_suites)) { in ath10k_mac_register()
10056 ar->hw_params.n_cipher_suites); in ath10k_mac_register()
10057 ar->hw_params.n_cipher_suites = 8; in ath10k_mac_register()
10059 ar->hw->wiphy->n_cipher_suites = ar->hw_params.n_cipher_suites; in ath10k_mac_register()
10061 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); in ath10k_mac_register()
10063 ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; in ath10k_mac_register()
10065 ret = ieee80211_register_hw(ar->hw); in ath10k_mac_register()
10071 if (test_bit(WMI_SERVICE_PER_PACKET_SW_ENCRYPT, ar->wmi.svc_map)) { in ath10k_mac_register()
10072 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); in ath10k_mac_register()
10073 ar->hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN); in ath10k_mac_register()
10076 if (!ath_is_world_regd(&ar->ath_common.regulatory)) { in ath10k_mac_register()
10077 ret = regulatory_hint(ar->hw->wiphy, in ath10k_mac_register()
10078 ar->ath_common.regulatory.alpha2); in ath10k_mac_register()
10086 ieee80211_unregister_hw(ar->hw); in ath10k_mac_register()
10089 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) in ath10k_mac_register()
10090 ar->dfs_detector->exit(ar->dfs_detector); in ath10k_mac_register()
10093 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath10k_mac_register()
10094 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in ath10k_mac_register()
10096 SET_IEEE80211_DEV(ar->hw, NULL); in ath10k_mac_register()
10102 ieee80211_unregister_hw(ar->hw); in ath10k_mac_unregister()
10104 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) in ath10k_mac_unregister()
10105 ar->dfs_detector->exit(ar->dfs_detector); in ath10k_mac_unregister()
10107 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath10k_mac_unregister()
10108 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in ath10k_mac_unregister()
10110 SET_IEEE80211_DEV(ar->hw, NULL); in ath10k_mac_unregister()