Lines Matching +full:ext +full:- +full:fem +full:- +full:name
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.
26 #include "wmi-tlv.h"
27 #include "wmi-ops.h"
100 #define ath10k_a_rates_size (ARRAY_SIZE(ath10k_rates) - \
135 for (i = 0; i < sband->n_bitrates; i++) { in ath10k_mac_hw_rate_to_idx()
136 rate = &sband->bitrates[i]; in ath10k_mac_hw_rate_to_idx()
138 if (ath10k_mac_bitrate_is_cck(rate->bitrate) != cck) in ath10k_mac_hw_rate_to_idx()
141 if (rate->hw_value == hw_rate) in ath10k_mac_hw_rate_to_idx()
143 else if (rate->flags & IEEE80211_RATE_SHORT_PREAMBLE && in ath10k_mac_hw_rate_to_idx()
144 rate->hw_value_short == hw_rate) in ath10k_mac_hw_rate_to_idx()
156 for (i = 0; i < sband->n_bitrates; i++) in ath10k_mac_bitrate_to_idx()
157 if (sband->bitrates[i].bitrate == bitrate) in ath10k_mac_bitrate_to_idx()
176 return -EINVAL; in ath10k_mac_get_rate_hw_value()
182 case IEEE80211_VHT_MCS_SUPPORT_0_7: return BIT(8) - 1; in ath10k_mac_get_max_vht_mcs_map()
183 case IEEE80211_VHT_MCS_SUPPORT_0_8: return BIT(9) - 1; in ath10k_mac_get_max_vht_mcs_map()
184 case IEEE80211_VHT_MCS_SUPPORT_0_9: return BIT(10) - 1; in ath10k_mac_get_max_vht_mcs_map()
194 for (nss = IEEE80211_HT_MCS_MASK_LEN - 1; nss >= 0; nss--) in ath10k_mac_max_ht_nss()
206 for (nss = NL80211_VHT_NSS_MAX - 1; nss >= 0; nss--) in ath10k_mac_max_vht_nss()
218 if (test_bit(WMI_SERVICE_TX_MODE_DYNAMIC, ar->wmi.svc_map)) in ath10k_mac_ext_resource_config()
225 if (ret && ret != -EOPNOTSUPP) { in ath10k_mac_ext_resource_config()
226 ath10k_warn(ar, "failed to configure ext resource: %d\n", ret); in ath10k_mac_ext_resource_config()
242 struct ath10k *ar = arvif->ar; in ath10k_send_key()
244 .vdev_id = arvif->vdev_id, in ath10k_send_key()
245 .key_idx = key->keyidx, in ath10k_send_key()
246 .key_len = key->keylen, in ath10k_send_key()
247 .key_data = key->key, in ath10k_send_key()
252 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_send_key()
254 switch (key->cipher) { in ath10k_send_key()
256 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_CCM]; in ath10k_send_key()
257 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; in ath10k_send_key()
260 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_TKIP]; in ath10k_send_key()
266 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_WEP]; in ath10k_send_key()
269 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_CCM]; in ath10k_send_key()
273 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_GCM]; in ath10k_send_key()
274 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; in ath10k_send_key()
281 return -EINVAL; in ath10k_send_key()
283 ath10k_warn(ar, "cipher %d is not supported\n", key->cipher); in ath10k_send_key()
284 return -EOPNOTSUPP; in ath10k_send_key()
287 if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) in ath10k_send_key()
288 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; in ath10k_send_key()
291 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_NONE]; in ath10k_send_key()
295 return ath10k_wmi_vdev_install_key(arvif->ar, &arg); in ath10k_send_key()
303 struct ath10k *ar = arvif->ar; in ath10k_install_key()
307 lockdep_assert_held(&ar->conf_mutex); in ath10k_install_key()
309 reinit_completion(&ar->install_key_done); in ath10k_install_key()
311 if (arvif->nohwcrypt) in ath10k_install_key()
318 time_left = wait_for_completion_timeout(&ar->install_key_done, 3 * HZ); in ath10k_install_key()
320 return -ETIMEDOUT; in ath10k_install_key()
328 struct ath10k *ar = arvif->ar; in ath10k_install_peer_wep_keys()
334 lockdep_assert_held(&ar->conf_mutex); in ath10k_install_peer_wep_keys()
336 if (WARN_ON(arvif->vif->type != NL80211_IFTYPE_AP && in ath10k_install_peer_wep_keys()
337 arvif->vif->type != NL80211_IFTYPE_ADHOC && in ath10k_install_peer_wep_keys()
338 arvif->vif->type != NL80211_IFTYPE_MESH_POINT)) in ath10k_install_peer_wep_keys()
339 return -EINVAL; in ath10k_install_peer_wep_keys()
341 spin_lock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
342 peer = ath10k_peer_find(ar, arvif->vdev_id, addr); in ath10k_install_peer_wep_keys()
343 spin_unlock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
346 return -ENOENT; in ath10k_install_peer_wep_keys()
348 for (i = 0; i < ARRAY_SIZE(arvif->wep_keys); i++) { in ath10k_install_peer_wep_keys()
349 if (arvif->wep_keys[i] == NULL) in ath10k_install_peer_wep_keys()
352 switch (arvif->vif->type) { in ath10k_install_peer_wep_keys()
356 if (arvif->def_wep_key_idx == i) in ath10k_install_peer_wep_keys()
359 ret = ath10k_install_key(arvif, arvif->wep_keys[i], in ath10k_install_peer_wep_keys()
365 ret = ath10k_install_key(arvif, arvif->wep_keys[i], in ath10k_install_peer_wep_keys()
371 ret = ath10k_install_key(arvif, arvif->wep_keys[i], in ath10k_install_peer_wep_keys()
378 return -EINVAL; in ath10k_install_peer_wep_keys()
381 spin_lock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
382 peer->keys[i] = arvif->wep_keys[i]; in ath10k_install_peer_wep_keys()
383 spin_unlock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
394 if (arvif->vif->type != NL80211_IFTYPE_ADHOC) in ath10k_install_peer_wep_keys()
397 if (arvif->def_wep_key_idx == -1) in ath10k_install_peer_wep_keys()
400 ret = ath10k_wmi_vdev_set_param(arvif->ar, in ath10k_install_peer_wep_keys()
401 arvif->vdev_id, in ath10k_install_peer_wep_keys()
402 arvif->ar->wmi.vdev_param->def_keyid, in ath10k_install_peer_wep_keys()
403 arvif->def_wep_key_idx); in ath10k_install_peer_wep_keys()
405 ath10k_warn(ar, "failed to re-set def wpa key idxon vdev %i: %d\n", in ath10k_install_peer_wep_keys()
406 arvif->vdev_id, ret); in ath10k_install_peer_wep_keys()
416 struct ath10k *ar = arvif->ar; in ath10k_clear_peer_keys()
423 lockdep_assert_held(&ar->conf_mutex); in ath10k_clear_peer_keys()
425 spin_lock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
426 peer = ath10k_peer_find(ar, arvif->vdev_id, addr); in ath10k_clear_peer_keys()
427 spin_unlock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
430 return -ENOENT; in ath10k_clear_peer_keys()
432 for (i = 0; i < ARRAY_SIZE(peer->keys); i++) { in ath10k_clear_peer_keys()
433 if (peer->keys[i] == NULL) in ath10k_clear_peer_keys()
437 ret = ath10k_install_key(arvif, peer->keys[i], in ath10k_clear_peer_keys()
446 spin_lock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
447 peer->keys[i] = NULL; in ath10k_clear_peer_keys()
448 spin_unlock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
460 lockdep_assert_held(&ar->data_lock); in ath10k_mac_is_peer_wep_key_set()
465 * FIXME: multi-bss needs to be handled. in ath10k_mac_is_peer_wep_key_set()
471 for (i = 0; i < ARRAY_SIZE(peer->keys); i++) { in ath10k_mac_is_peer_wep_key_set()
472 if (peer->keys[i] && peer->keys[i]->keyidx == keyidx) in ath10k_mac_is_peer_wep_key_set()
482 struct ath10k *ar = arvif->ar; in ath10k_clear_vdev_key()
490 lockdep_assert_held(&ar->conf_mutex); in ath10k_clear_vdev_key()
496 spin_lock_bh(&ar->data_lock); in ath10k_clear_vdev_key()
498 list_for_each_entry(peer, &ar->peers, list) { in ath10k_clear_vdev_key()
499 for (i = 0; i < ARRAY_SIZE(peer->keys); i++) { in ath10k_clear_vdev_key()
500 if (peer->keys[i] == key) { in ath10k_clear_vdev_key()
501 ether_addr_copy(addr, peer->addr); in ath10k_clear_vdev_key()
502 peer->keys[i] = NULL; in ath10k_clear_vdev_key()
507 if (i < ARRAY_SIZE(peer->keys)) in ath10k_clear_vdev_key()
510 spin_unlock_bh(&ar->data_lock); in ath10k_clear_vdev_key()
512 if (i == ARRAY_SIZE(peer->keys)) in ath10k_clear_vdev_key()
530 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_update_wep_key()
534 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_vif_update_wep_key()
536 list_for_each_entry(peer, &ar->peers, list) { in ath10k_mac_vif_update_wep_key()
537 if (ether_addr_equal(peer->addr, arvif->vif->addr)) in ath10k_mac_vif_update_wep_key()
540 if (ether_addr_equal(peer->addr, arvif->bssid)) in ath10k_mac_vif_update_wep_key()
543 if (peer->keys[key->keyidx] == key) in ath10k_mac_vif_update_wep_key()
547 arvif->vdev_id, key->keyidx); in ath10k_mac_vif_update_wep_key()
549 ret = ath10k_install_peer_wep_keys(arvif, peer->addr); in ath10k_mac_vif_update_wep_key()
552 arvif->vdev_id, peer->addr, ret); in ath10k_mac_vif_update_wep_key()
569 switch (chandef->chan->band) { in chan_to_phymode()
571 switch (chandef->width) { in chan_to_phymode()
573 if (chandef->chan->flags & IEEE80211_CHAN_NO_OFDM) in chan_to_phymode()
590 switch (chandef->width) { in chan_to_phymode()
664 conf = rcu_dereference(vif->bss_conf.chanctx_conf); in ath10k_mac_vif_chan()
667 return -ENOENT; in ath10k_mac_vif_chan()
670 *def = conf->def; in ath10k_mac_vif_chan()
689 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_num_chanctxs()
703 *def = &conf->def; in ath10k_mac_get_any_chandef_iter()
712 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) { in ath10k_wait_for_peer_delete_done()
719 time_left = wait_for_completion_timeout(&ar->peer_delete_done, in ath10k_wait_for_peer_delete_done()
738 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_create()
740 num_peers = ar->num_peers; in ath10k_peer_create()
743 list_for_each_entry(arvif, &ar->arvifs, list) in ath10k_peer_create()
746 if (num_peers >= ar->max_num_peers) in ath10k_peer_create()
747 return -ENOBUFS; in ath10k_peer_create()
763 spin_lock_bh(&ar->data_lock); in ath10k_peer_create()
767 spin_unlock_bh(&ar->data_lock); in ath10k_peer_create()
771 return -ENOENT; in ath10k_peer_create()
774 peer->vif = vif; in ath10k_peer_create()
775 peer->sta = sta; in ath10k_peer_create()
777 spin_unlock_bh(&ar->data_lock); in ath10k_peer_create()
779 ar->num_peers++; in ath10k_peer_create()
786 struct ath10k *ar = arvif->ar; in ath10k_mac_set_kickout()
790 param = ar->wmi.pdev_param->sta_kickout_th; in ath10k_mac_set_kickout()
795 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
799 param = ar->wmi.vdev_param->ap_keepalive_min_idle_inactive_time_secs; in ath10k_mac_set_kickout()
800 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
804 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
808 param = ar->wmi.vdev_param->ap_keepalive_max_idle_inactive_time_secs; in ath10k_mac_set_kickout()
809 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
813 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
817 param = ar->wmi.vdev_param->ap_keepalive_max_unresponsive_time_secs; in ath10k_mac_set_kickout()
818 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
822 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
831 struct ath10k *ar = arvif->ar; in ath10k_mac_set_rts()
834 vdev_param = ar->wmi.vdev_param->rts_threshold; in ath10k_mac_set_rts()
835 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, value); in ath10k_mac_set_rts()
842 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_delete()
852 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) { in ath10k_peer_delete()
856 (&ar->peer_delete_done, 5 * HZ); in ath10k_peer_delete()
860 return -ETIMEDOUT; in ath10k_peer_delete()
864 ar->num_peers--; in ath10k_peer_delete()
873 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_map_cleanup()
875 for_each_set_bit(peer_id, peer->peer_ids, in ath10k_peer_map_cleanup()
877 ar->peer_map[peer_id] = NULL; in ath10k_peer_map_cleanup()
880 /* Double check that peer is properly un-referenced from in ath10k_peer_map_cleanup()
883 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_peer_map_cleanup()
884 if (ar->peer_map[i] == peer) { in ath10k_peer_map_cleanup()
886 peer->addr, peer, i); in ath10k_peer_map_cleanup()
887 ar->peer_map[i] = NULL; in ath10k_peer_map_cleanup()
891 list_del(&peer->list); in ath10k_peer_map_cleanup()
893 ar->num_peers--; in ath10k_peer_map_cleanup()
900 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_cleanup()
902 spin_lock_bh(&ar->data_lock); in ath10k_peer_cleanup()
903 list_for_each_entry_safe(peer, tmp, &ar->peers, list) { in ath10k_peer_cleanup()
904 if (peer->vdev_id != vdev_id) in ath10k_peer_cleanup()
908 peer->addr, vdev_id); in ath10k_peer_cleanup()
912 spin_unlock_bh(&ar->data_lock); in ath10k_peer_cleanup()
920 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_cleanup_all()
922 spin_lock_bh(&ar->data_lock); in ath10k_peer_cleanup_all()
923 list_for_each_entry_safe(peer, tmp, &ar->peers, list) { in ath10k_peer_cleanup_all()
924 list_del(&peer->list); in ath10k_peer_cleanup_all()
928 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) in ath10k_peer_cleanup_all()
929 ar->peer_map[i] = NULL; in ath10k_peer_cleanup_all()
931 spin_unlock_bh(&ar->data_lock); in ath10k_peer_cleanup_all()
933 ar->num_peers = 0; in ath10k_peer_cleanup_all()
934 ar->num_stations = 0; in ath10k_peer_cleanup_all()
946 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_tdls_peer_update()
950 ether_addr_copy(arg.addr, sta->addr); in ath10k_mac_tdls_peer_update()
952 cap.peer_max_sp = sta->max_sp; in ath10k_mac_tdls_peer_update()
953 cap.peer_uapsd_queues = sta->uapsd_queues; in ath10k_mac_tdls_peer_update()
956 !sta->tdls_initiator) in ath10k_mac_tdls_peer_update()
975 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_beacon_free()
977 lockdep_assert_held(&ar->data_lock); in ath10k_mac_vif_beacon_free()
979 if (!arvif->beacon) in ath10k_mac_vif_beacon_free()
982 if (!arvif->beacon_buf) in ath10k_mac_vif_beacon_free()
983 dma_unmap_single(ar->dev, ATH10K_SKB_CB(arvif->beacon)->paddr, in ath10k_mac_vif_beacon_free()
984 arvif->beacon->len, DMA_TO_DEVICE); in ath10k_mac_vif_beacon_free()
986 if (WARN_ON(arvif->beacon_state != ATH10K_BEACON_SCHEDULED && in ath10k_mac_vif_beacon_free()
987 arvif->beacon_state != ATH10K_BEACON_SENT)) in ath10k_mac_vif_beacon_free()
990 dev_kfree_skb_any(arvif->beacon); in ath10k_mac_vif_beacon_free()
992 arvif->beacon = NULL; in ath10k_mac_vif_beacon_free()
993 arvif->beacon_state = ATH10K_BEACON_SCHEDULED; in ath10k_mac_vif_beacon_free()
998 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_beacon_cleanup()
1000 lockdep_assert_held(&ar->data_lock); in ath10k_mac_vif_beacon_cleanup()
1004 if (arvif->beacon_buf) { in ath10k_mac_vif_beacon_cleanup()
1005 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) in ath10k_mac_vif_beacon_cleanup()
1006 kfree(arvif->beacon_buf); in ath10k_mac_vif_beacon_cleanup()
1008 dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, in ath10k_mac_vif_beacon_cleanup()
1009 arvif->beacon_buf, in ath10k_mac_vif_beacon_cleanup()
1010 arvif->beacon_paddr); in ath10k_mac_vif_beacon_cleanup()
1011 arvif->beacon_buf = NULL; in ath10k_mac_vif_beacon_cleanup()
1019 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_setup_sync()
1021 if (test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)) in ath10k_vdev_setup_sync()
1022 return -ESHUTDOWN; in ath10k_vdev_setup_sync()
1024 time_left = wait_for_completion_timeout(&ar->vdev_setup_done, in ath10k_vdev_setup_sync()
1027 return -ETIMEDOUT; in ath10k_vdev_setup_sync()
1029 return ar->last_wmi_vdev_start_status; in ath10k_vdev_setup_sync()
1039 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_start()
1041 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_monitor_vdev_start()
1045 return -ENOENT; in ath10k_monitor_vdev_start()
1047 channel = chandef->chan; in ath10k_monitor_vdev_start()
1050 arg.channel.freq = channel->center_freq; in ath10k_monitor_vdev_start()
1051 arg.channel.band_center_freq1 = chandef->center_freq1; in ath10k_monitor_vdev_start()
1052 arg.channel.band_center_freq2 = chandef->center_freq2; in ath10k_monitor_vdev_start()
1059 !!(channel->flags & IEEE80211_CHAN_RADAR); in ath10k_monitor_vdev_start()
1062 arg.channel.max_power = channel->max_power * 2; in ath10k_monitor_vdev_start()
1063 arg.channel.max_reg_power = channel->max_reg_power * 2; in ath10k_monitor_vdev_start()
1064 arg.channel.max_antenna_gain = channel->max_antenna_gain; in ath10k_monitor_vdev_start()
1066 reinit_completion(&ar->vdev_setup_done); in ath10k_monitor_vdev_start()
1067 reinit_completion(&ar->vdev_delete_done); in ath10k_monitor_vdev_start()
1083 ret = ath10k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr); in ath10k_monitor_vdev_start()
1090 ar->monitor_vdev_id = vdev_id; in ath10k_monitor_vdev_start()
1093 ar->monitor_vdev_id); in ath10k_monitor_vdev_start()
1097 ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_start()
1100 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_start()
1109 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_stop()
1111 ret = ath10k_wmi_vdev_down(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1114 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1116 reinit_completion(&ar->vdev_setup_done); in ath10k_monitor_vdev_stop()
1117 reinit_completion(&ar->vdev_delete_done); in ath10k_monitor_vdev_stop()
1119 ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1122 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1127 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1130 ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1138 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_create()
1140 if (ar->free_vdev_map == 0) { in ath10k_monitor_vdev_create()
1142 return -ENOMEM; in ath10k_monitor_vdev_create()
1145 bit = __ffs64(ar->free_vdev_map); in ath10k_monitor_vdev_create()
1147 ar->monitor_vdev_id = bit; in ath10k_monitor_vdev_create()
1149 ret = ath10k_wmi_vdev_create(ar, ar->monitor_vdev_id, in ath10k_monitor_vdev_create()
1151 0, ar->mac_addr); in ath10k_monitor_vdev_create()
1154 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_create()
1158 ar->free_vdev_map &= ~(1LL << ar->monitor_vdev_id); in ath10k_monitor_vdev_create()
1160 ar->monitor_vdev_id); in ath10k_monitor_vdev_create()
1169 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_delete()
1171 ret = ath10k_wmi_vdev_delete(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_delete()
1174 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_delete()
1178 ar->free_vdev_map |= 1LL << ar->monitor_vdev_id; in ath10k_monitor_vdev_delete()
1181 ar->monitor_vdev_id); in ath10k_monitor_vdev_delete()
1189 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_start()
1197 ret = ath10k_monitor_vdev_start(ar, ar->monitor_vdev_id); in ath10k_monitor_start()
1204 ar->monitor_started = true; in ath10k_monitor_start()
1214 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_stop()
1228 ar->monitor_started = false; in ath10k_monitor_stop()
1248 if (ar->monitor_arvif) in ath10k_mac_monitor_vdev_is_needed()
1251 return ar->monitor || in ath10k_mac_monitor_vdev_is_needed()
1253 ar->running_fw->fw_file.fw_features) && in ath10k_mac_monitor_vdev_is_needed()
1254 (ar->filter_flags & FIF_OTHER_BSS)) || in ath10k_mac_monitor_vdev_is_needed()
1255 test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_mac_monitor_vdev_is_needed()
1266 * case anyway since multi-channel DFS hasn't been tested at all. in ath10k_mac_monitor_vdev_is_allowed()
1268 if (test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags) && num_ctx > 1) in ath10k_mac_monitor_vdev_is_allowed()
1280 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_recalc()
1287 ar->monitor_started, needed, allowed); in ath10k_monitor_recalc()
1290 if (ar->monitor_started) { in ath10k_monitor_recalc()
1300 return -EPERM; in ath10k_monitor_recalc()
1303 if (needed == ar->monitor_started) in ath10k_monitor_recalc()
1314 struct ath10k *ar = arvif->ar; in ath10k_mac_can_set_cts_prot()
1316 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_can_set_cts_prot()
1318 if (!arvif->is_started) { in ath10k_mac_can_set_cts_prot()
1328 struct ath10k *ar = arvif->ar; in ath10k_mac_set_cts_prot()
1331 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_set_cts_prot()
1333 vdev_param = ar->wmi.vdev_param->protection_mode; in ath10k_mac_set_cts_prot()
1336 arvif->vdev_id, arvif->use_cts_prot); in ath10k_mac_set_cts_prot()
1338 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_mac_set_cts_prot()
1339 arvif->use_cts_prot ? 1 : 0); in ath10k_mac_set_cts_prot()
1344 struct ath10k *ar = arvif->ar; in ath10k_recalc_rtscts_prot()
1347 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalc_rtscts_prot()
1349 vdev_param = ar->wmi.vdev_param->enable_rtscts; in ath10k_recalc_rtscts_prot()
1353 if (arvif->num_legacy_stations > 0) in ath10k_recalc_rtscts_prot()
1361 arvif->vdev_id, rts_cts); in ath10k_recalc_rtscts_prot()
1363 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_recalc_rtscts_prot()
1371 lockdep_assert_held(&ar->conf_mutex); in ath10k_start_cac()
1373 set_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_start_cac()
1378 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_start_cac()
1383 ar->monitor_vdev_id); in ath10k_start_cac()
1390 lockdep_assert_held(&ar->conf_mutex); in ath10k_stop_cac()
1392 /* CAC is not running - do nothing */ in ath10k_stop_cac()
1393 if (!test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags)) in ath10k_stop_cac()
1396 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_stop_cac()
1410 if (!*ret && conf->radar_enabled) in ath10k_mac_has_radar_iter()
1418 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_has_radar_enabled()
1429 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalc_radar_detection()
1436 if (ar->num_started_vdevs > 0) in ath10k_recalc_radar_detection()
1447 ieee80211_radar_detected(ar->hw); in ath10k_recalc_radar_detection()
1453 struct ath10k *ar = arvif->ar; in ath10k_vdev_stop()
1456 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_stop()
1458 reinit_completion(&ar->vdev_setup_done); in ath10k_vdev_stop()
1459 reinit_completion(&ar->vdev_delete_done); in ath10k_vdev_stop()
1461 ret = ath10k_wmi_vdev_stop(ar, arvif->vdev_id); in ath10k_vdev_stop()
1464 arvif->vdev_id, ret); in ath10k_vdev_stop()
1471 arvif->vdev_id, ret); in ath10k_vdev_stop()
1475 WARN_ON(ar->num_started_vdevs == 0); in ath10k_vdev_stop()
1477 if (ar->num_started_vdevs != 0) { in ath10k_vdev_stop()
1478 ar->num_started_vdevs--; in ath10k_vdev_stop()
1489 struct ath10k *ar = arvif->ar; in ath10k_vdev_start_restart()
1493 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_start_restart()
1495 reinit_completion(&ar->vdev_setup_done); in ath10k_vdev_start_restart()
1496 reinit_completion(&ar->vdev_delete_done); in ath10k_vdev_start_restart()
1498 arg.vdev_id = arvif->vdev_id; in ath10k_vdev_start_restart()
1499 arg.dtim_period = arvif->dtim_period; in ath10k_vdev_start_restart()
1500 arg.bcn_intval = arvif->beacon_interval; in ath10k_vdev_start_restart()
1502 arg.channel.freq = chandef->chan->center_freq; in ath10k_vdev_start_restart()
1503 arg.channel.band_center_freq1 = chandef->center_freq1; in ath10k_vdev_start_restart()
1504 arg.channel.band_center_freq2 = chandef->center_freq2; in ath10k_vdev_start_restart()
1508 arg.channel.max_power = chandef->chan->max_power * 2; in ath10k_vdev_start_restart()
1509 arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; in ath10k_vdev_start_restart()
1510 arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain; in ath10k_vdev_start_restart()
1512 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath10k_vdev_start_restart()
1513 arg.ssid = arvif->u.ap.ssid; in ath10k_vdev_start_restart()
1514 arg.ssid_len = arvif->u.ap.ssid_len; in ath10k_vdev_start_restart()
1515 arg.hidden_ssid = arvif->u.ap.hidden_ssid; in ath10k_vdev_start_restart()
1519 !!(chandef->chan->flags & IEEE80211_CHAN_RADAR); in ath10k_vdev_start_restart()
1520 } else if (arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_vdev_start_restart()
1521 arg.ssid = arvif->vif->cfg.ssid; in ath10k_vdev_start_restart()
1522 arg.ssid_len = arvif->vif->cfg.ssid_len; in ath10k_vdev_start_restart()
1549 ar->num_started_vdevs++; in ath10k_vdev_start_restart()
1570 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_bcn_p2p_ie()
1575 if (arvif->vif->type != NL80211_IFTYPE_AP || !arvif->vif->p2p) in ath10k_mac_setup_bcn_p2p_ie()
1578 mgmt = (void *)bcn->data; in ath10k_mac_setup_bcn_p2p_ie()
1580 mgmt->u.beacon.variable, in ath10k_mac_setup_bcn_p2p_ie()
1581 bcn->len - (mgmt->u.beacon.variable - in ath10k_mac_setup_bcn_p2p_ie()
1582 bcn->data)); in ath10k_mac_setup_bcn_p2p_ie()
1584 return -ENOENT; in ath10k_mac_setup_bcn_p2p_ie()
1586 ret = ath10k_wmi_p2p_go_bcn_ie(ar, arvif->vdev_id, p2p_ie); in ath10k_mac_setup_bcn_p2p_ie()
1589 arvif->vdev_id, ret); in ath10k_mac_setup_bcn_p2p_ie()
1604 if (WARN_ON(skb->len < ie_offset)) in ath10k_mac_remove_vendor_ie()
1605 return -EINVAL; in ath10k_mac_remove_vendor_ie()
1608 skb->data + ie_offset, in ath10k_mac_remove_vendor_ie()
1609 skb->len - ie_offset); in ath10k_mac_remove_vendor_ie()
1611 return -ENOENT; in ath10k_mac_remove_vendor_ie()
1614 end = skb->data + skb->len; in ath10k_mac_remove_vendor_ie()
1618 return -EINVAL; in ath10k_mac_remove_vendor_ie()
1620 memmove(ie, next, end - next); in ath10k_mac_remove_vendor_ie()
1621 skb_trim(skb, skb->len - len); in ath10k_mac_remove_vendor_ie()
1628 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_bcn_tmpl()
1629 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_setup_bcn_tmpl()
1630 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_setup_bcn_tmpl()
1635 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_setup_bcn_tmpl()
1638 if (arvif->vdev_type != WMI_VDEV_TYPE_AP && in ath10k_mac_setup_bcn_tmpl()
1639 arvif->vdev_type != WMI_VDEV_TYPE_IBSS) in ath10k_mac_setup_bcn_tmpl()
1645 return -EPERM; in ath10k_mac_setup_bcn_tmpl()
1663 ret = ath10k_wmi_bcn_tmpl(ar, arvif->vdev_id, offs.tim_offset, bcn, 0, in ath10k_mac_setup_bcn_tmpl()
1678 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_prb_tmpl()
1679 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_setup_prb_tmpl()
1680 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_setup_prb_tmpl()
1684 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_setup_prb_tmpl()
1687 if (arvif->vdev_type != WMI_VDEV_TYPE_AP) in ath10k_mac_setup_prb_tmpl()
1697 return -EPERM; in ath10k_mac_setup_prb_tmpl()
1700 ret = ath10k_wmi_prb_tmpl(ar, arvif->vdev_id, prb); in ath10k_mac_setup_prb_tmpl()
1714 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_fix_hidden_ssid()
1729 * since only wmi-tlv firmware are known to have beacon offload and in ath10k_mac_vif_fix_hidden_ssid()
1730 * wmi-tlv doesn't seem to misbehave like 10.2 wrt vdev restart in ath10k_mac_vif_fix_hidden_ssid()
1733 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_vif_fix_hidden_ssid()
1736 if (WARN_ON(!arvif->is_started)) in ath10k_mac_vif_fix_hidden_ssid()
1737 return -EINVAL; in ath10k_mac_vif_fix_hidden_ssid()
1739 if (WARN_ON(!arvif->is_up)) in ath10k_mac_vif_fix_hidden_ssid()
1740 return -EINVAL; in ath10k_mac_vif_fix_hidden_ssid()
1742 if (WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) in ath10k_mac_vif_fix_hidden_ssid()
1743 return -EINVAL; in ath10k_mac_vif_fix_hidden_ssid()
1745 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_vif_fix_hidden_ssid()
1748 arvif->vdev_id, ret); in ath10k_mac_vif_fix_hidden_ssid()
1771 arvif->vdev_id, ret); in ath10k_mac_vif_fix_hidden_ssid()
1775 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_mac_vif_fix_hidden_ssid()
1776 arvif->bssid); in ath10k_mac_vif_fix_hidden_ssid()
1779 arvif->vdev_id, ret); in ath10k_mac_vif_fix_hidden_ssid()
1789 struct ath10k *ar = arvif->ar; in ath10k_control_beaconing()
1792 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_control_beaconing()
1794 if (!info->enable_beacon) { in ath10k_control_beaconing()
1795 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_control_beaconing()
1798 arvif->vdev_id, ret); in ath10k_control_beaconing()
1800 arvif->is_up = false; in ath10k_control_beaconing()
1802 spin_lock_bh(&arvif->ar->data_lock); in ath10k_control_beaconing()
1804 spin_unlock_bh(&arvif->ar->data_lock); in ath10k_control_beaconing()
1809 arvif->tx_seq_no = 0x1000; in ath10k_control_beaconing()
1811 arvif->aid = 0; in ath10k_control_beaconing()
1812 ether_addr_copy(arvif->bssid, info->bssid); in ath10k_control_beaconing()
1814 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_control_beaconing()
1815 arvif->bssid); in ath10k_control_beaconing()
1818 arvif->vdev_id, ret); in ath10k_control_beaconing()
1822 arvif->is_up = true; in ath10k_control_beaconing()
1827 arvif->vdev_id, ret); in ath10k_control_beaconing()
1831 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %d up\n", arvif->vdev_id); in ath10k_control_beaconing()
1837 struct ath10k *ar = arvif->ar; in ath10k_control_ibss()
1841 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_control_ibss()
1843 if (!vif->cfg.ibss_joined) { in ath10k_control_ibss()
1844 if (is_zero_ether_addr(arvif->bssid)) in ath10k_control_ibss()
1847 eth_zero_addr(arvif->bssid); in ath10k_control_ibss()
1852 vdev_param = arvif->ar->wmi.vdev_param->atim_window; in ath10k_control_ibss()
1853 ret = ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id, vdev_param, in ath10k_control_ibss()
1857 arvif->vdev_id, ret); in ath10k_control_ibss()
1862 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_recalc_ps_wake_threshold()
1867 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_recalc_ps_wake_threshold()
1869 if (arvif->u.sta.uapsd) in ath10k_mac_vif_recalc_ps_wake_threshold()
1875 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, value); in ath10k_mac_vif_recalc_ps_wake_threshold()
1878 value, arvif->vdev_id, ret); in ath10k_mac_vif_recalc_ps_wake_threshold()
1887 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_recalc_ps_poll_count()
1892 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_recalc_ps_poll_count()
1894 if (arvif->u.sta.uapsd) in ath10k_mac_vif_recalc_ps_poll_count()
1900 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_mac_vif_recalc_ps_poll_count()
1904 value, arvif->vdev_id, ret); in ath10k_mac_vif_recalc_ps_poll_count()
1916 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_num_vifs_started()
1918 list_for_each_entry(arvif, &ar->arvifs, list) in ath10k_mac_num_vifs_started()
1919 if (arvif->is_started) in ath10k_mac_num_vifs_started()
1927 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_setup_ps()
1928 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_vif_setup_ps()
1929 struct ieee80211_conf *conf = &ar->hw->conf; in ath10k_mac_vif_setup_ps()
1936 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_setup_ps()
1938 if (arvif->vif->type != NL80211_IFTYPE_STATION) in ath10k_mac_vif_setup_ps()
1941 enable_ps = arvif->ps; in ath10k_mac_vif_setup_ps()
1945 ar->running_fw->fw_file.fw_features)) { in ath10k_mac_vif_setup_ps()
1947 arvif->vdev_id); in ath10k_mac_vif_setup_ps()
1951 if (!arvif->is_started) { in ath10k_mac_vif_setup_ps()
1954 * necessary if PS is disabled on a non-started vdev. Hence in ath10k_mac_vif_setup_ps()
1955 * force-enable PS for non-running vdevs. in ath10k_mac_vif_setup_ps()
1962 ps_timeout = conf->dynamic_ps_timeout; in ath10k_mac_vif_setup_ps()
1966 vif->bss_conf.beacon_int) / 1000; in ath10k_mac_vif_setup_ps()
1969 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, in ath10k_mac_vif_setup_ps()
1973 arvif->vdev_id, ret); in ath10k_mac_vif_setup_ps()
1981 arvif->vdev_id, psmode ? "enable" : "disable"); in ath10k_mac_vif_setup_ps()
1983 ret = ath10k_wmi_set_psmode(ar, arvif->vdev_id, psmode); in ath10k_mac_vif_setup_ps()
1986 psmode, arvif->vdev_id, ret); in ath10k_mac_vif_setup_ps()
1995 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_disable_keepalive()
1999 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_disable_keepalive()
2001 if (arvif->vdev_type != WMI_VDEV_TYPE_STA) in ath10k_mac_vif_disable_keepalive()
2004 if (!test_bit(WMI_SERVICE_STA_KEEP_ALIVE, ar->wmi.svc_map)) in ath10k_mac_vif_disable_keepalive()
2010 arg.vdev_id = arvif->vdev_id; in ath10k_mac_vif_disable_keepalive()
2018 arvif->vdev_id, ret); in ath10k_mac_vif_disable_keepalive()
2027 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_ap_csa_count_down()
2028 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_vif_ap_csa_count_down()
2031 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_ap_csa_count_down()
2033 if (WARN_ON(!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map))) in ath10k_mac_vif_ap_csa_count_down()
2036 if (arvif->vdev_type != WMI_VDEV_TYPE_AP) in ath10k_mac_vif_ap_csa_count_down()
2039 if (!vif->bss_conf.csa_active) in ath10k_mac_vif_ap_csa_count_down()
2042 if (!arvif->is_up) in ath10k_mac_vif_ap_csa_count_down()
2066 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_ap_csa_work()
2068 mutex_lock(&ar->conf_mutex); in ath10k_mac_vif_ap_csa_work()
2070 mutex_unlock(&ar->conf_mutex); in ath10k_mac_vif_ap_csa_work()
2077 struct ieee80211_mgmt *mgmt = (void *)skb->data; in ath10k_mac_handle_beacon_iter()
2078 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_handle_beacon_iter()
2080 if (vif->type != NL80211_IFTYPE_STATION) in ath10k_mac_handle_beacon_iter()
2083 if (!ether_addr_equal(mgmt->bssid, vif->bss_conf.bssid)) in ath10k_mac_handle_beacon_iter()
2086 cancel_delayed_work(&arvif->connection_loss_work); in ath10k_mac_handle_beacon_iter()
2091 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_beacon()
2101 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_handle_beacon_miss_iter()
2102 struct ath10k *ar = arvif->ar; in ath10k_mac_handle_beacon_miss_iter()
2103 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_handle_beacon_miss_iter()
2105 if (arvif->vdev_id != *vdev_id) in ath10k_mac_handle_beacon_miss_iter()
2108 if (!arvif->is_up) in ath10k_mac_handle_beacon_miss_iter()
2118 ieee80211_queue_delayed_work(hw, &arvif->connection_loss_work, in ath10k_mac_handle_beacon_miss_iter()
2124 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_beacon_miss()
2134 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_vif_sta_connection_loss_work()
2136 if (!arvif->is_up) in ath10k_mac_vif_sta_connection_loss_work()
2157 if (vif->type == NL80211_IFTYPE_STATION) in ath10k_peer_assoc_h_listen_intval()
2160 return ar->hw->conf.listen_interval; in ath10k_peer_assoc_h_listen_intval()
2168 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_basic()
2171 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_basic()
2173 if (vif->type == NL80211_IFTYPE_STATION) in ath10k_peer_assoc_h_basic()
2174 aid = vif->cfg.aid; in ath10k_peer_assoc_h_basic()
2176 aid = sta->aid; in ath10k_peer_assoc_h_basic()
2178 ether_addr_copy(arg->addr, sta->addr); in ath10k_peer_assoc_h_basic()
2179 arg->vdev_id = arvif->vdev_id; in ath10k_peer_assoc_h_basic()
2180 arg->peer_aid = aid; in ath10k_peer_assoc_h_basic()
2181 arg->peer_flags |= arvif->ar->wmi.peer_flags->auth; in ath10k_peer_assoc_h_basic()
2182 arg->peer_listen_intval = ath10k_peer_assoc_h_listen_intval(ar, vif); in ath10k_peer_assoc_h_basic()
2183 arg->peer_num_spatial_streams = 1; in ath10k_peer_assoc_h_basic()
2184 arg->peer_caps = vif->bss_conf.assoc_capability; in ath10k_peer_assoc_h_basic()
2192 struct ieee80211_bss_conf *info = &vif->bss_conf; in ath10k_peer_assoc_h_crypto()
2198 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_crypto()
2203 bss = cfg80211_get_bss(ar->hw->wiphy, def.chan, info->bssid, in ath10k_peer_assoc_h_crypto()
2204 vif->cfg.ssid_len ? vif->cfg.ssid : NULL, in ath10k_peer_assoc_h_crypto()
2205 vif->cfg.ssid_len, in ath10k_peer_assoc_h_crypto()
2213 ies = rcu_dereference(bss->ies); in ath10k_peer_assoc_h_crypto()
2217 ies->data, in ath10k_peer_assoc_h_crypto()
2218 ies->len); in ath10k_peer_assoc_h_crypto()
2220 cfg80211_put_bss(ar->hw->wiphy, bss); in ath10k_peer_assoc_h_crypto()
2226 arg->peer_flags |= ar->wmi.peer_flags->need_ptk_4_way; in ath10k_peer_assoc_h_crypto()
2231 arg->peer_flags |= ar->wmi.peer_flags->need_gtk_2_way; in ath10k_peer_assoc_h_crypto()
2234 if (sta->mfp && in ath10k_peer_assoc_h_crypto()
2236 ar->running_fw->fw_file.fw_features)) { in ath10k_peer_assoc_h_crypto()
2237 arg->peer_flags |= ar->wmi.peer_flags->pmf; in ath10k_peer_assoc_h_crypto()
2246 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_rates()
2247 struct wmi_rate_set_arg *rateset = &arg->peer_legacy_rates; in ath10k_peer_assoc_h_rates()
2256 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_rates()
2261 band = def.chan->band; in ath10k_peer_assoc_h_rates()
2262 sband = ar->hw->wiphy->bands[band]; in ath10k_peer_assoc_h_rates()
2263 ratemask = sta->deflink.supp_rates[band]; in ath10k_peer_assoc_h_rates()
2264 ratemask &= arvif->bitrate_mask.control[band].legacy; in ath10k_peer_assoc_h_rates()
2265 rates = sband->bitrates; in ath10k_peer_assoc_h_rates()
2267 rateset->num_rates = 0; in ath10k_peer_assoc_h_rates()
2273 rate = ath10k_mac_bitrate_to_rate(rates->bitrate); in ath10k_peer_assoc_h_rates()
2274 rateset->rates[rateset->num_rates] = rate; in ath10k_peer_assoc_h_rates()
2275 rateset->num_rates++; in ath10k_peer_assoc_h_rates()
2308 const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; in ath10k_peer_assoc_h_ht()
2309 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_ht()
2318 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_ht()
2323 if (!ht_cap->ht_supported) in ath10k_peer_assoc_h_ht()
2326 band = def.chan->band; in ath10k_peer_assoc_h_ht()
2327 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath10k_peer_assoc_h_ht()
2328 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_peer_assoc_h_ht()
2334 arg->peer_flags |= ar->wmi.peer_flags->ht; in ath10k_peer_assoc_h_ht()
2335 arg->peer_max_mpdu = (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + in ath10k_peer_assoc_h_ht()
2336 ht_cap->ampdu_factor)) - 1; in ath10k_peer_assoc_h_ht()
2338 arg->peer_mpdu_density = in ath10k_peer_assoc_h_ht()
2339 ath10k_parse_mpdudensity(ht_cap->ampdu_density); in ath10k_peer_assoc_h_ht()
2341 arg->peer_ht_caps = ht_cap->cap; in ath10k_peer_assoc_h_ht()
2342 arg->peer_rate_caps |= WMI_RC_HT_FLAG; in ath10k_peer_assoc_h_ht()
2344 if (ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING) in ath10k_peer_assoc_h_ht()
2345 arg->peer_flags |= ar->wmi.peer_flags->ldbc; in ath10k_peer_assoc_h_ht()
2347 if (sta->deflink.bandwidth >= IEEE80211_STA_RX_BW_40) { in ath10k_peer_assoc_h_ht()
2348 arg->peer_flags |= ar->wmi.peer_flags->bw40; in ath10k_peer_assoc_h_ht()
2349 arg->peer_rate_caps |= WMI_RC_CW40_FLAG; in ath10k_peer_assoc_h_ht()
2352 if (arvif->bitrate_mask.control[band].gi != NL80211_TXRATE_FORCE_LGI) { in ath10k_peer_assoc_h_ht()
2353 if (ht_cap->cap & IEEE80211_HT_CAP_SGI_20) in ath10k_peer_assoc_h_ht()
2354 arg->peer_rate_caps |= WMI_RC_SGI_FLAG; in ath10k_peer_assoc_h_ht()
2356 if (ht_cap->cap & IEEE80211_HT_CAP_SGI_40) in ath10k_peer_assoc_h_ht()
2357 arg->peer_rate_caps |= WMI_RC_SGI_FLAG; in ath10k_peer_assoc_h_ht()
2360 if (ht_cap->cap & IEEE80211_HT_CAP_TX_STBC) { in ath10k_peer_assoc_h_ht()
2361 arg->peer_rate_caps |= WMI_RC_TX_STBC_FLAG; in ath10k_peer_assoc_h_ht()
2362 arg->peer_flags |= ar->wmi.peer_flags->stbc; in ath10k_peer_assoc_h_ht()
2365 if (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC) { in ath10k_peer_assoc_h_ht()
2366 stbc = ht_cap->cap & IEEE80211_HT_CAP_RX_STBC; in ath10k_peer_assoc_h_ht()
2369 arg->peer_rate_caps |= stbc; in ath10k_peer_assoc_h_ht()
2370 arg->peer_flags |= ar->wmi.peer_flags->stbc; in ath10k_peer_assoc_h_ht()
2373 if (ht_cap->mcs.rx_mask[1] && ht_cap->mcs.rx_mask[2]) in ath10k_peer_assoc_h_ht()
2374 arg->peer_rate_caps |= WMI_RC_TS_FLAG; in ath10k_peer_assoc_h_ht()
2375 else if (ht_cap->mcs.rx_mask[1]) in ath10k_peer_assoc_h_ht()
2376 arg->peer_rate_caps |= WMI_RC_DS_FLAG; in ath10k_peer_assoc_h_ht()
2379 if ((ht_cap->mcs.rx_mask[i / 8] & BIT(i % 8)) && in ath10k_peer_assoc_h_ht()
2382 arg->peer_ht_rates.rates[n++] = i; in ath10k_peer_assoc_h_ht()
2386 * This is a workaround for HT-enabled STAs which break the spec in ath10k_peer_assoc_h_ht()
2395 arg->peer_ht_rates.num_rates = 8; in ath10k_peer_assoc_h_ht()
2396 for (i = 0; i < arg->peer_ht_rates.num_rates; i++) in ath10k_peer_assoc_h_ht()
2397 arg->peer_ht_rates.rates[i] = i; in ath10k_peer_assoc_h_ht()
2399 arg->peer_ht_rates.num_rates = n; in ath10k_peer_assoc_h_ht()
2400 arg->peer_num_spatial_streams = min(sta->deflink.rx_nss, in ath10k_peer_assoc_h_ht()
2405 arg->addr, in ath10k_peer_assoc_h_ht()
2406 arg->peer_ht_rates.num_rates, in ath10k_peer_assoc_h_ht()
2407 arg->peer_num_spatial_streams); in ath10k_peer_assoc_h_ht()
2418 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_qos_ap()
2420 if (sta->wme && sta->uapsd_queues) { in ath10k_peer_assoc_qos_ap()
2422 sta->uapsd_queues, sta->max_sp); in ath10k_peer_assoc_qos_ap()
2424 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) in ath10k_peer_assoc_qos_ap()
2427 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VI) in ath10k_peer_assoc_qos_ap()
2430 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BK) in ath10k_peer_assoc_qos_ap()
2433 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BE) in ath10k_peer_assoc_qos_ap()
2437 if (sta->max_sp < MAX_WMI_AP_PS_PEER_PARAM_MAX_SP) in ath10k_peer_assoc_qos_ap()
2438 max_sp = sta->max_sp; in ath10k_peer_assoc_qos_ap()
2440 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, in ath10k_peer_assoc_qos_ap()
2441 sta->addr, in ath10k_peer_assoc_qos_ap()
2446 arvif->vdev_id, ret); in ath10k_peer_assoc_qos_ap()
2450 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, in ath10k_peer_assoc_qos_ap()
2451 sta->addr, in ath10k_peer_assoc_qos_ap()
2456 arvif->vdev_id, ret); in ath10k_peer_assoc_qos_ap()
2462 * sta->listen_interval - mac80211 patch required. in ath10k_peer_assoc_qos_ap()
2465 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, sta->addr, in ath10k_peer_assoc_qos_ap()
2470 arvif->vdev_id, ret); in ath10k_peer_assoc_qos_ap()
2492 idx_limit = fls(mcs_map) - 1; in ath10k_peer_assoc_h_vht_limit()
2494 idx_limit = -1; in ath10k_peer_assoc_h_vht_limit()
2508 case -1: in ath10k_peer_assoc_h_vht_limit()
2558 const struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; in ath10k_peer_assoc_h_vht()
2559 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_vht()
2560 struct ath10k_hw_params *hw = &ar->hw_params; in ath10k_peer_assoc_h_vht()
2571 if (!vht_cap->vht_supported) in ath10k_peer_assoc_h_vht()
2574 band = def.chan->band; in ath10k_peer_assoc_h_vht()
2575 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_peer_assoc_h_vht()
2580 arg->peer_flags |= ar->wmi.peer_flags->vht; in ath10k_peer_assoc_h_vht()
2582 if (def.chan->band == NL80211_BAND_2GHZ) in ath10k_peer_assoc_h_vht()
2583 arg->peer_flags |= ar->wmi.peer_flags->vht_2g; in ath10k_peer_assoc_h_vht()
2585 arg->peer_vht_caps = vht_cap->cap; in ath10k_peer_assoc_h_vht()
2587 ampdu_factor = (vht_cap->cap & in ath10k_peer_assoc_h_vht()
2591 /* Workaround: Some Netgear/Linksys 11ac APs set Rx A-MPDU factor to in ath10k_peer_assoc_h_vht()
2593 * arg->peer_max_mpdu at this point contains HT max_mpdu so keep in ath10k_peer_assoc_h_vht()
2596 arg->peer_max_mpdu = max(arg->peer_max_mpdu, in ath10k_peer_assoc_h_vht()
2598 ampdu_factor)) - 1); in ath10k_peer_assoc_h_vht()
2600 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) in ath10k_peer_assoc_h_vht()
2601 arg->peer_flags |= ar->wmi.peer_flags->bw80; in ath10k_peer_assoc_h_vht()
2603 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) in ath10k_peer_assoc_h_vht()
2604 arg->peer_flags |= ar->wmi.peer_flags->bw160; in ath10k_peer_assoc_h_vht()
2610 vht_mcs = __le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map) >> in ath10k_peer_assoc_h_vht()
2617 arg->peer_num_spatial_streams = min(sta->deflink.rx_nss, max_nss); in ath10k_peer_assoc_h_vht()
2618 arg->peer_vht_rates.rx_max_rate = in ath10k_peer_assoc_h_vht()
2619 __le16_to_cpu(vht_cap->vht_mcs.rx_highest); in ath10k_peer_assoc_h_vht()
2620 arg->peer_vht_rates.rx_mcs_set = in ath10k_peer_assoc_h_vht()
2621 __le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map); in ath10k_peer_assoc_h_vht()
2622 arg->peer_vht_rates.tx_max_rate = in ath10k_peer_assoc_h_vht()
2623 __le16_to_cpu(vht_cap->vht_mcs.tx_highest); in ath10k_peer_assoc_h_vht()
2624 arg->peer_vht_rates.tx_mcs_set = ath10k_peer_assoc_h_vht_limit( in ath10k_peer_assoc_h_vht()
2625 __le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); in ath10k_peer_assoc_h_vht()
2627 /* Configure bandwidth-NSS mapping to FW in ath10k_peer_assoc_h_vht()
2630 if (arg->peer_phymode == MODE_11AC_VHT160 || in ath10k_peer_assoc_h_vht()
2631 arg->peer_phymode == MODE_11AC_VHT80_80) { in ath10k_peer_assoc_h_vht()
2635 max_rate = arg->peer_vht_rates.rx_max_rate; in ath10k_peer_assoc_h_vht()
2639 rx_nss = arg->peer_num_spatial_streams; in ath10k_peer_assoc_h_vht()
2641 rx_nss = min(arg->peer_num_spatial_streams, rx_nss); in ath10k_peer_assoc_h_vht()
2643 max_rate = hw->vht160_mcs_tx_highest; in ath10k_peer_assoc_h_vht()
2646 arg->peer_bw_rxnss_override = in ath10k_peer_assoc_h_vht()
2648 FIELD_PREP(WMI_PEER_NSS_160MHZ_MASK, (rx_nss - 1)); in ath10k_peer_assoc_h_vht()
2650 if (arg->peer_phymode == MODE_11AC_VHT80_80) { in ath10k_peer_assoc_h_vht()
2651 arg->peer_bw_rxnss_override |= in ath10k_peer_assoc_h_vht()
2652 FIELD_PREP(WMI_PEER_NSS_80_80MHZ_MASK, (rx_nss - 1)); in ath10k_peer_assoc_h_vht()
2657 sta->addr, arg->peer_max_mpdu, in ath10k_peer_assoc_h_vht()
2658 arg->peer_flags, arg->peer_bw_rxnss_override); in ath10k_peer_assoc_h_vht()
2666 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_qos()
2668 switch (arvif->vdev_type) { in ath10k_peer_assoc_h_qos()
2670 if (sta->wme) in ath10k_peer_assoc_h_qos()
2671 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2673 if (sta->wme && sta->uapsd_queues) { in ath10k_peer_assoc_h_qos()
2674 arg->peer_flags |= arvif->ar->wmi.peer_flags->apsd; in ath10k_peer_assoc_h_qos()
2675 arg->peer_rate_caps |= WMI_RC_UAPSD_FLAG; in ath10k_peer_assoc_h_qos()
2679 if (sta->wme) in ath10k_peer_assoc_h_qos()
2680 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2683 if (sta->wme) in ath10k_peer_assoc_h_qos()
2684 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2691 sta->addr, !!(arg->peer_flags & in ath10k_peer_assoc_h_qos()
2692 arvif->ar->wmi.peer_flags->qos)); in ath10k_peer_assoc_h_qos()
2697 return sta->deflink.supp_rates[NL80211_BAND_2GHZ] >> in ath10k_mac_sta_has_ofdm_only()
2704 struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; in ath10k_mac_get_phymode_vht()
2706 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) { in ath10k_mac_get_phymode_vht()
2707 switch (vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) { in ath10k_mac_get_phymode_vht()
2718 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) in ath10k_mac_get_phymode_vht()
2721 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath10k_mac_get_phymode_vht()
2724 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_20) in ath10k_mac_get_phymode_vht()
2735 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_phymode()
2745 band = def.chan->band; in ath10k_peer_assoc_h_phymode()
2746 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath10k_peer_assoc_h_phymode()
2747 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_peer_assoc_h_phymode()
2751 if (sta->deflink.vht_cap.vht_supported && in ath10k_peer_assoc_h_phymode()
2753 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath10k_peer_assoc_h_phymode()
2757 } else if (sta->deflink.ht_cap.ht_supported && in ath10k_peer_assoc_h_phymode()
2759 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath10k_peer_assoc_h_phymode()
2774 if (sta->deflink.vht_cap.vht_supported && in ath10k_peer_assoc_h_phymode()
2777 } else if (sta->deflink.ht_cap.ht_supported && in ath10k_peer_assoc_h_phymode()
2779 if (sta->deflink.bandwidth >= IEEE80211_STA_RX_BW_40) in ath10k_peer_assoc_h_phymode()
2793 sta->addr, ath10k_wmi_phymode_str(phymode)); in ath10k_peer_assoc_h_phymode()
2795 arg->peer_phymode = phymode; in ath10k_peer_assoc_h_phymode()
2804 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_prepare()
2832 if (!ht_cap->ht_supported) in ath10k_setup_peer_smps()
2835 smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS; in ath10k_setup_peer_smps()
2839 return -EINVAL; in ath10k_setup_peer_smps()
2841 return ath10k_wmi_peer_set_param(ar, arvif->vdev_id, addr, in ath10k_setup_peer_smps()
2842 ar->wmi.peer_param->smps_state, in ath10k_setup_peer_smps()
2850 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_vif_recalc_txbf()
2858 if (!(ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2865 param = ar->wmi.vdev_param->txbf; in ath10k_mac_vif_recalc_txbf()
2875 if (ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2885 if (ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2901 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, value); in ath10k_mac_vif_recalc_txbf()
2915 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_mac_is_connected()
2916 if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath10k_mac_is_connected()
2930 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_txpower_setup()
2938 if (connected && ar->tx_power_2g_limit) in ath10k_mac_txpower_setup()
2939 if (tx_power_2g > ar->tx_power_2g_limit) in ath10k_mac_txpower_setup()
2940 tx_power_2g = ar->tx_power_2g_limit; in ath10k_mac_txpower_setup()
2942 if (connected && ar->tx_power_5g_limit) in ath10k_mac_txpower_setup()
2943 if (tx_power_5g > ar->tx_power_5g_limit) in ath10k_mac_txpower_setup()
2944 tx_power_5g = ar->tx_power_5g_limit; in ath10k_mac_txpower_setup()
2949 param = ar->wmi.pdev_param->txpower_limit2g; in ath10k_mac_txpower_setup()
2957 param = ar->wmi.pdev_param->txpower_limit5g; in ath10k_mac_txpower_setup()
2971 int ret, txpower = -1; in ath10k_mac_txpower_recalc()
2973 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_txpower_recalc()
2975 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_mac_txpower_recalc()
2977 if (arvif->txpower == INT_MIN) in ath10k_mac_txpower_recalc()
2980 if (txpower == -1) in ath10k_mac_txpower_recalc()
2981 txpower = arvif->txpower; in ath10k_mac_txpower_recalc()
2983 txpower = min(txpower, arvif->txpower); in ath10k_mac_txpower_recalc()
2986 if (txpower == -1) in ath10k_mac_txpower_recalc()
3001 if (!ar->hw_params.dynamic_sar_support) in ath10k_mac_set_sar_power()
3002 return -EOPNOTSUPP; in ath10k_mac_set_sar_power()
3007 /* if connected, then arvif->txpower must be valid */ in ath10k_mac_set_sar_power()
3015 struct ath10k *ar = hw->priv; in ath10k_mac_set_sar_specs()
3019 mutex_lock(&ar->conf_mutex); in ath10k_mac_set_sar_specs()
3021 if (!ar->hw_params.dynamic_sar_support) { in ath10k_mac_set_sar_specs()
3022 ret = -EOPNOTSUPP; in ath10k_mac_set_sar_specs()
3026 if (!sar || sar->type != NL80211_SAR_TYPE_POWER || in ath10k_mac_set_sar_specs()
3027 sar->num_sub_specs == 0) { in ath10k_mac_set_sar_specs()
3028 ret = -EINVAL; in ath10k_mac_set_sar_specs()
3032 sub_specs = sar->sub_specs; in ath10k_mac_set_sar_specs()
3037 ar->tx_power_2g_limit = 0; in ath10k_mac_set_sar_specs()
3038 ar->tx_power_5g_limit = 0; in ath10k_mac_set_sar_specs()
3043 for (i = 0; i < sar->num_sub_specs; i++) { in ath10k_mac_set_sar_specs()
3044 if (sub_specs->freq_range_index == 0) in ath10k_mac_set_sar_specs()
3045 ar->tx_power_2g_limit = sub_specs->power / 2; in ath10k_mac_set_sar_specs()
3046 else if (sub_specs->freq_range_index == 1) in ath10k_mac_set_sar_specs()
3047 ar->tx_power_5g_limit = sub_specs->power / 2; in ath10k_mac_set_sar_specs()
3059 mutex_unlock(&ar->conf_mutex); in ath10k_mac_set_sar_specs()
3068 struct ath10k *ar = hw->priv; in ath10k_bss_assoc()
3069 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_bss_assoc()
3076 lockdep_assert_held(&ar->conf_mutex); in ath10k_bss_assoc()
3079 arvif->vdev_id, arvif->bssid, arvif->aid); in ath10k_bss_assoc()
3083 ap_sta = ieee80211_find_sta(vif, bss_conf->bssid); in ath10k_bss_assoc()
3086 bss_conf->bssid, arvif->vdev_id); in ath10k_bss_assoc()
3094 ht_cap = ap_sta->deflink.ht_cap; in ath10k_bss_assoc()
3095 vht_cap = ap_sta->deflink.vht_cap; in ath10k_bss_assoc()
3100 bss_conf->bssid, arvif->vdev_id, ret); in ath10k_bss_assoc()
3110 bss_conf->bssid, arvif->vdev_id, ret); in ath10k_bss_assoc()
3114 ret = ath10k_setup_peer_smps(ar, arvif, bss_conf->bssid, &ht_cap); in ath10k_bss_assoc()
3117 arvif->vdev_id, ret); in ath10k_bss_assoc()
3124 arvif->vdev_id, bss_conf->bssid, ret); in ath10k_bss_assoc()
3130 arvif->vdev_id, bss_conf->bssid, vif->cfg.aid); in ath10k_bss_assoc()
3132 WARN_ON(arvif->is_up); in ath10k_bss_assoc()
3134 arvif->aid = vif->cfg.aid; in ath10k_bss_assoc()
3135 ether_addr_copy(arvif->bssid, bss_conf->bssid); in ath10k_bss_assoc()
3138 ar->wmi.pdev_param->peer_stats_info_enable, 1); in ath10k_bss_assoc()
3142 ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid); in ath10k_bss_assoc()
3145 arvif->vdev_id, ret); in ath10k_bss_assoc()
3149 arvif->is_up = true; in ath10k_bss_assoc()
3154 * WLAN.RM.2.0-00073) have buggy powersave state machine and must be in ath10k_bss_assoc()
3157 ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, arvif->bssid, in ath10k_bss_assoc()
3158 ar->wmi.peer_param->dummy_var, 1); in ath10k_bss_assoc()
3161 arvif->bssid, arvif->vdev_id, ret); in ath10k_bss_assoc()
3169 struct ath10k *ar = hw->priv; in ath10k_bss_disassoc()
3170 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_bss_disassoc()
3174 lockdep_assert_held(&ar->conf_mutex); in ath10k_bss_disassoc()
3177 arvif->vdev_id, arvif->bssid); in ath10k_bss_disassoc()
3179 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_bss_disassoc()
3182 arvif->vdev_id, ret); in ath10k_bss_disassoc()
3184 arvif->def_wep_key_idx = -1; in ath10k_bss_disassoc()
3189 arvif->vdev_id, ret); in ath10k_bss_disassoc()
3193 arvif->is_up = false; in ath10k_bss_disassoc()
3197 cancel_delayed_work_sync(&arvif->connection_loss_work); in ath10k_bss_disassoc()
3205 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_new_peer_tid_config()
3211 if (arvif->retry_long[i] || arvif->ampdu[i] || in ath10k_new_peer_tid_config()
3212 arvif->rate_ctrl[i] || arvif->rtscts[i]) { in ath10k_new_peer_tid_config()
3215 arg.vdev_id = arvif->vdev_id; in ath10k_new_peer_tid_config()
3216 arg.retry_count = arvif->retry_long[i]; in ath10k_new_peer_tid_config()
3217 arg.aggr_control = arvif->ampdu[i]; in ath10k_new_peer_tid_config()
3218 arg.rate_ctrl = arvif->rate_ctrl[i]; in ath10k_new_peer_tid_config()
3219 arg.rcode_flags = arvif->rate_code[i]; in ath10k_new_peer_tid_config()
3221 if (arvif->rtscts[i]) in ath10k_new_peer_tid_config()
3227 arg.rtscts_ctrl = arvif->rtscts[i]; in ath10k_new_peer_tid_config()
3230 if (arvif->noack[i]) { in ath10k_new_peer_tid_config()
3231 arg.ack_policy = arvif->noack[i]; in ath10k_new_peer_tid_config()
3237 /* Assign default value(-1) to newly connected station. in ath10k_new_peer_tid_config()
3241 arsta->retry_long[i] = -1; in ath10k_new_peer_tid_config()
3242 arsta->noack[i] = -1; in ath10k_new_peer_tid_config()
3243 arsta->ampdu[i] = -1; in ath10k_new_peer_tid_config()
3248 ether_addr_copy(arg.peer_macaddr.addr, sta->addr); in ath10k_new_peer_tid_config()
3253 sta->addr, ret); in ath10k_new_peer_tid_config()
3268 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_station_assoc()
3272 lockdep_assert_held(&ar->conf_mutex); in ath10k_station_assoc()
3277 sta->addr, arvif->vdev_id, ret); in ath10k_station_assoc()
3284 sta->addr, arvif->vdev_id, ret); in ath10k_station_assoc()
3288 /* Re-assoc is run only to update supported rates for given station. It in ath10k_station_assoc()
3292 ret = ath10k_setup_peer_smps(ar, arvif, sta->addr, in ath10k_station_assoc()
3293 &sta->deflink.ht_cap); in ath10k_station_assoc()
3296 arvif->vdev_id, ret); in ath10k_station_assoc()
3303 sta->addr, arvif->vdev_id, ret); in ath10k_station_assoc()
3307 if (!sta->wme) { in ath10k_station_assoc()
3308 arvif->num_legacy_stations++; in ath10k_station_assoc()
3312 arvif->vdev_id, ret); in ath10k_station_assoc()
3318 if ((arvif->def_wep_key_idx != -1) && (!sta->tdls)) { in ath10k_station_assoc()
3319 ret = ath10k_install_peer_wep_keys(arvif, sta->addr); in ath10k_station_assoc()
3322 arvif->vdev_id, ret); in ath10k_station_assoc()
3328 if (!test_bit(WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT, ar->wmi.svc_map)) in ath10k_station_assoc()
3338 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_station_disassoc()
3341 lockdep_assert_held(&ar->conf_mutex); in ath10k_station_disassoc()
3343 if (!sta->wme) { in ath10k_station_disassoc()
3344 arvif->num_legacy_stations--; in ath10k_station_disassoc()
3348 arvif->vdev_id, ret); in ath10k_station_disassoc()
3353 ret = ath10k_clear_peer_keys(arvif, sta->addr); in ath10k_station_disassoc()
3356 arvif->vdev_id, ret); in ath10k_station_disassoc()
3369 struct ieee80211_hw *hw = ar->hw; in ath10k_update_channel_list()
3380 lockdep_assert_held(&ar->conf_mutex); in ath10k_update_channel_list()
3382 bands = hw->wiphy->bands; in ath10k_update_channel_list()
3387 for (i = 0; i < bands[band]->n_channels; i++) { in ath10k_update_channel_list()
3388 if (bands[band]->channels[i].flags & in ath10k_update_channel_list()
3399 return -ENOMEM; in ath10k_update_channel_list()
3406 for (i = 0; i < bands[band]->n_channels; i++) { in ath10k_update_channel_list()
3407 channel = &bands[band]->channels[i]; in ath10k_update_channel_list()
3409 if (channel->flags & IEEE80211_CHAN_DISABLED) in ath10k_update_channel_list()
3412 ch->allow_ht = true; in ath10k_update_channel_list()
3415 ch->allow_vht = true; in ath10k_update_channel_list()
3417 ch->allow_ibss = in ath10k_update_channel_list()
3418 !(channel->flags & IEEE80211_CHAN_NO_IR); in ath10k_update_channel_list()
3420 ch->ht40plus = in ath10k_update_channel_list()
3421 !(channel->flags & IEEE80211_CHAN_NO_HT40PLUS); in ath10k_update_channel_list()
3423 ch->chan_radar = in ath10k_update_channel_list()
3424 !!(channel->flags & IEEE80211_CHAN_RADAR); in ath10k_update_channel_list()
3426 passive = channel->flags & IEEE80211_CHAN_NO_IR; in ath10k_update_channel_list()
3427 ch->passive = passive; in ath10k_update_channel_list()
3434 ch->passive |= ch->chan_radar; in ath10k_update_channel_list()
3436 ch->freq = channel->center_freq; in ath10k_update_channel_list()
3437 ch->band_center_freq1 = channel->center_freq; in ath10k_update_channel_list()
3438 ch->min_power = 0; in ath10k_update_channel_list()
3439 ch->max_power = channel->max_power * 2; in ath10k_update_channel_list()
3440 ch->max_reg_power = channel->max_reg_power * 2; in ath10k_update_channel_list()
3441 ch->max_antenna_gain = channel->max_antenna_gain; in ath10k_update_channel_list()
3442 ch->reg_class_id = 0; /* FIXME */ in ath10k_update_channel_list()
3448 if (channel->band == NL80211_BAND_2GHZ) in ath10k_update_channel_list()
3449 ch->mode = MODE_11G; in ath10k_update_channel_list()
3451 ch->mode = MODE_11A; in ath10k_update_channel_list()
3453 if (WARN_ON_ONCE(ch->mode == MODE_UNKNOWN)) in ath10k_update_channel_list()
3458 ch - arg.channels, arg.n_channels, in ath10k_update_channel_list()
3459 ch->freq, ch->max_power, ch->max_reg_power, in ath10k_update_channel_list()
3460 ch->max_antenna_gain, ch->mode); in ath10k_update_channel_list()
3495 lockdep_assert_held(&ar->conf_mutex); in ath10k_regd_update()
3501 regpair = ar->ath_common.regulatory.regpair; in ath10k_regd_update()
3503 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { in ath10k_regd_update()
3504 nl_dfs_reg = ar->dfs_detector->region; in ath10k_regd_update()
3510 /* Target allows setting up per-band regdomain but ath_common provides in ath10k_regd_update()
3514 regpair->reg_domain, in ath10k_regd_update()
3515 regpair->reg_domain, /* 2ghz */ in ath10k_regd_update()
3516 regpair->reg_domain, /* 5ghz */ in ath10k_regd_update()
3517 regpair->reg_2ghz_ctl, in ath10k_regd_update()
3518 regpair->reg_5ghz_ctl, in ath10k_regd_update()
3529 if (ar->low_5ghz_chan && ar->high_5ghz_chan) { in ath10k_mac_update_channel_list()
3530 for (i = 0; i < band->n_channels; i++) { in ath10k_mac_update_channel_list()
3531 if (band->channels[i].center_freq < ar->low_5ghz_chan || in ath10k_mac_update_channel_list()
3532 band->channels[i].center_freq > ar->high_5ghz_chan) in ath10k_mac_update_channel_list()
3533 band->channels[i].flags |= in ath10k_mac_update_channel_list()
3543 struct ath10k *ar = hw->priv; in ath10k_reg_notifier()
3546 ath_reg_notifier_apply(wiphy, request, &ar->ath_common.regulatory); in ath10k_reg_notifier()
3548 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { in ath10k_reg_notifier()
3550 request->dfs_region); in ath10k_reg_notifier()
3551 result = ar->dfs_detector->set_dfs_domain(ar->dfs_detector, in ath10k_reg_notifier()
3552 request->dfs_region); in ath10k_reg_notifier()
3555 request->dfs_region); in ath10k_reg_notifier()
3558 mutex_lock(&ar->conf_mutex); in ath10k_reg_notifier()
3559 if (ar->state == ATH10K_STATE_ON) in ath10k_reg_notifier()
3561 mutex_unlock(&ar->conf_mutex); in ath10k_reg_notifier()
3563 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_reg_notifier()
3565 ar->hw->wiphy->bands[NL80211_BAND_5GHZ]); in ath10k_reg_notifier()
3570 spin_lock_bh(&ar->data_lock); in ath10k_stop_radar_confirmation()
3571 ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_STOPPED; in ath10k_stop_radar_confirmation()
3572 spin_unlock_bh(&ar->data_lock); in ath10k_stop_radar_confirmation()
3574 cancel_work_sync(&ar->radar_confirmation_work); in ath10k_stop_radar_confirmation()
3590 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_tx_lock()
3593 ar->tx_paused |= BIT(reason); in ath10k_mac_tx_lock()
3594 ieee80211_stop_queues(ar->hw); in ath10k_mac_tx_lock()
3601 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_tx_unlock_iter()
3603 if (arvif->tx_paused) in ath10k_mac_tx_unlock_iter()
3606 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_mac_tx_unlock_iter()
3611 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_tx_unlock()
3614 ar->tx_paused &= ~BIT(reason); in ath10k_mac_tx_unlock()
3616 if (ar->tx_paused) in ath10k_mac_tx_unlock()
3619 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_tx_unlock()
3624 ieee80211_wake_queue(ar->hw, ar->hw->offchannel_tx_hw_queue); in ath10k_mac_tx_unlock()
3629 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_tx_lock()
3631 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_tx_lock()
3634 arvif->tx_paused |= BIT(reason); in ath10k_mac_vif_tx_lock()
3635 ieee80211_stop_queue(ar->hw, arvif->vdev_id); in ath10k_mac_vif_tx_lock()
3640 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_tx_unlock()
3642 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_tx_unlock()
3645 arvif->tx_paused &= ~BIT(reason); in ath10k_mac_vif_tx_unlock()
3647 if (ar->tx_paused) in ath10k_mac_vif_tx_unlock()
3650 if (arvif->tx_paused) in ath10k_mac_vif_tx_unlock()
3653 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_mac_vif_tx_unlock()
3660 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_handle_tx_pause()
3662 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_handle_tx_pause()
3674 action, arvif->vdev_id); in ath10k_mac_vif_handle_tx_pause()
3688 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_handle_tx_pause_iter()
3691 if (arvif->vdev_id != arg->vdev_id) in ath10k_mac_handle_tx_pause_iter()
3694 ath10k_mac_vif_handle_tx_pause(arvif, arg->pause_id, arg->action); in ath10k_mac_handle_tx_pause_iter()
3707 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_handle_tx_pause_vdev()
3708 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_tx_pause_vdev()
3712 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_handle_tx_pause_vdev()
3721 const struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_mac_tx_h_get_txmode()
3723 __le16 fc = hdr->frame_control; in ath10k_mac_tx_h_get_txmode()
3725 if (IEEE80211_SKB_CB(skb)->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) in ath10k_mac_tx_h_get_txmode()
3728 if (!vif || vif->type == NL80211_IFTYPE_MONITOR) in ath10k_mac_tx_h_get_txmode()
3738 * accurate - otherwise either mac80211 or userspace (e.g. hostapd) can in ath10k_mac_tx_h_get_txmode()
3750 if (ar->htt.target_version_major < 3 && in ath10k_mac_tx_h_get_txmode()
3753 ar->running_fw->fw_file.fw_features)) in ath10k_mac_tx_h_get_txmode()
3758 * Some wmi-tlv firmwares for qca6174 have broken Tx key selection for in ath10k_mac_tx_h_get_txmode()
3759 * NativeWifi txmode - it selects AP key instead of peer key. It seems in ath10k_mac_tx_h_get_txmode()
3764 if (ieee80211_is_data_present(fc) && sta && sta->tdls) in ath10k_mac_tx_h_get_txmode()
3767 if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) || in ath10k_mac_tx_h_get_txmode()
3768 skb_cb->flags & ATH10K_SKB_F_RAW_TX) in ath10k_mac_tx_h_get_txmode()
3778 const struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_tx_h_use_hwcrypto()
3782 if (!ieee80211_has_protected(hdr->frame_control)) in ath10k_tx_h_use_hwcrypto()
3785 if ((info->flags & mask) == mask) in ath10k_tx_h_use_hwcrypto()
3789 return !((struct ath10k_vif *)vif->drv_priv)->nohwcrypt; in ath10k_tx_h_use_hwcrypto()
3799 struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_tx_h_nwifi()
3803 if (!ieee80211_is_data_qos(hdr->frame_control)) in ath10k_tx_h_nwifi()
3807 memmove(skb->data + IEEE80211_QOS_CTL_LEN, in ath10k_tx_h_nwifi()
3809 skb->data, (void *)qos_ctl - (void *)skb->data); in ath10k_tx_h_nwifi()
3811 skb->data, qos_ctl - skb->data); in ath10k_tx_h_nwifi()
3819 hdr = (void *)skb->data; in ath10k_tx_h_nwifi()
3820 if (ieee80211_is_qos_nullfunc(hdr->frame_control)) in ath10k_tx_h_nwifi()
3821 cb->flags &= ~ATH10K_SKB_F_QOS; in ath10k_tx_h_nwifi()
3823 hdr->frame_control &= ~__cpu_to_le16(IEEE80211_STYPE_QOS_DATA); in ath10k_tx_h_nwifi()
3836 hdr = (void *)skb->data; in ath10k_tx_h_8023()
3837 hdrlen = ieee80211_hdrlen(hdr->frame_control); in ath10k_tx_h_8023()
3839 rfc1042 = (void *)skb->data + hdrlen; in ath10k_tx_h_8023()
3841 rfc1042 = (void *)(skb->data + hdrlen); in ath10k_tx_h_8023()
3846 type = rfc1042->snap_type; in ath10k_tx_h_8023()
3851 eth = (void *)skb->data; in ath10k_tx_h_8023()
3852 ether_addr_copy(eth->h_dest, da); in ath10k_tx_h_8023()
3853 ether_addr_copy(eth->h_source, sa); in ath10k_tx_h_8023()
3854 eth->h_proto = type; in ath10k_tx_h_8023()
3861 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in ath10k_tx_h_add_p2p_noa_ie()
3862 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_tx_h_add_p2p_noa_ie()
3865 if (vif->type != NL80211_IFTYPE_AP || !vif->p2p) in ath10k_tx_h_add_p2p_noa_ie()
3868 if (unlikely(ieee80211_is_probe_resp(hdr->frame_control))) { in ath10k_tx_h_add_p2p_noa_ie()
3869 spin_lock_bh(&ar->data_lock); in ath10k_tx_h_add_p2p_noa_ie()
3870 if (arvif->u.ap.noa_data) in ath10k_tx_h_add_p2p_noa_ie()
3871 if (!pskb_expand_head(skb, 0, arvif->u.ap.noa_len, in ath10k_tx_h_add_p2p_noa_ie()
3873 skb_put_data(skb, arvif->u.ap.noa_data, in ath10k_tx_h_add_p2p_noa_ie()
3874 arvif->u.ap.noa_len); in ath10k_tx_h_add_p2p_noa_ie()
3875 spin_unlock_bh(&ar->data_lock); in ath10k_tx_h_add_p2p_noa_ie()
3885 struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_mac_tx_h_fill_cb()
3888 bool is_data = ieee80211_is_data(hdr->frame_control) || in ath10k_mac_tx_h_fill_cb()
3889 ieee80211_is_data_qos(hdr->frame_control); in ath10k_mac_tx_h_fill_cb()
3890 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_tx_h_fill_cb()
3895 cb->flags = 0; in ath10k_mac_tx_h_fill_cb()
3897 if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { in ath10k_mac_tx_h_fill_cb()
3898 cb->flags |= ATH10K_SKB_F_QOS; /* Assume data frames are QoS */ in ath10k_mac_tx_h_fill_cb()
3903 cb->flags |= ATH10K_SKB_F_NO_HWCRYPT; in ath10k_mac_tx_h_fill_cb()
3905 if (ieee80211_is_mgmt(hdr->frame_control)) in ath10k_mac_tx_h_fill_cb()
3906 cb->flags |= ATH10K_SKB_F_MGMT; in ath10k_mac_tx_h_fill_cb()
3908 if (ieee80211_is_data_qos(hdr->frame_control)) { in ath10k_mac_tx_h_fill_cb()
3909 cb->flags |= ATH10K_SKB_F_QOS; in ath10k_mac_tx_h_fill_cb()
3913 if (arvif->noack[tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_tx_h_fill_cb()
3917 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_tx_h_fill_cb()
3919 if (arsta->noack[tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_tx_h_fill_cb()
3922 if (arsta->noack[tid] == WMI_PEER_TID_CONFIG_ACK) in ath10k_mac_tx_h_fill_cb()
3927 cb->flags |= ATH10K_SKB_F_NOACK_TID; in ath10k_mac_tx_h_fill_cb()
3934 if (is_data && ieee80211_has_protected(hdr->frame_control) && in ath10k_mac_tx_h_fill_cb()
3935 !info->control.hw_key) { in ath10k_mac_tx_h_fill_cb()
3936 cb->flags |= ATH10K_SKB_F_NO_HWCRYPT; in ath10k_mac_tx_h_fill_cb()
3937 cb->flags |= ATH10K_SKB_F_RAW_TX; in ath10k_mac_tx_h_fill_cb()
3941 cb->vif = vif; in ath10k_mac_tx_h_fill_cb()
3942 cb->txq = txq; in ath10k_mac_tx_h_fill_cb()
3943 cb->airtime_est = airtime; in ath10k_mac_tx_h_fill_cb()
3945 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_tx_h_fill_cb()
3946 spin_lock_bh(&ar->data_lock); in ath10k_mac_tx_h_fill_cb()
3947 cb->ucast_cipher = arsta->ucast_cipher; in ath10k_mac_tx_h_fill_cb()
3948 spin_unlock_bh(&ar->data_lock); in ath10k_mac_tx_h_fill_cb()
3956 * offchannel tx (and actually creating them causes issues with wmi-htc in ath10k_mac_tx_frm_has_freq()
3960 return (ar->htt.target_version_major >= 3 && in ath10k_mac_tx_frm_has_freq()
3961 ar->htt.target_version_minor >= 4 && in ath10k_mac_tx_frm_has_freq()
3962 ar->running_fw->fw_file.htt_op_version == ATH10K_FW_HTT_OP_VERSION_TLV); in ath10k_mac_tx_frm_has_freq()
3967 struct sk_buff_head *q = &ar->wmi_mgmt_tx_queue; in ath10k_mac_tx_wmi_mgmt()
3971 return -ENOSPC; in ath10k_mac_tx_wmi_mgmt()
3975 ieee80211_queue_work(ar->hw, &ar->wmi_mgmt_tx_work); in ath10k_mac_tx_wmi_mgmt()
3992 ar->running_fw->fw_file.fw_features) || in ath10k_mac_tx_h_get_txpath()
3994 ar->wmi.svc_map)) in ath10k_mac_tx_h_get_txpath()
3996 else if (ar->htt.target_version_major >= 3) in ath10k_mac_tx_h_get_txpath()
4010 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_tx_submit()
4011 int ret = -EINVAL; in ath10k_mac_tx_submit()
4025 ret = -EINVAL; in ath10k_mac_tx_submit()
4032 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_tx_submit()
4047 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_tx()
4053 if (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE) in ath10k_mac_tx()
4064 /* Convert 802.11->802.3 header only if the frame was earlier in ath10k_mac_tx()
4067 if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) in ath10k_mac_tx()
4071 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) && in ath10k_mac_tx()
4072 !(skb_cb->flags & ATH10K_SKB_F_RAW_TX)) { in ath10k_mac_tx()
4075 return -ENOTSUPP; in ath10k_mac_tx()
4079 if (!noque_offchan && info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) { in ath10k_mac_tx()
4082 skb, skb->len); in ath10k_mac_tx()
4084 skb_queue_tail(&ar->offchan_tx_queue, skb); in ath10k_mac_tx()
4085 ieee80211_queue_work(hw, &ar->offchan_tx_work); in ath10k_mac_tx()
4104 skb = skb_dequeue(&ar->offchan_tx_queue); in ath10k_offchan_tx_purge()
4108 ieee80211_free_txskb(ar->hw, skb); in ath10k_offchan_tx_purge()
4138 skb = skb_dequeue(&ar->offchan_tx_queue); in ath10k_offchan_tx_work()
4142 mutex_lock(&ar->conf_mutex); in ath10k_offchan_tx_work()
4145 skb, skb->len); in ath10k_offchan_tx_work()
4147 hdr = (struct ieee80211_hdr *)skb->data; in ath10k_offchan_tx_work()
4150 spin_lock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4151 vdev_id = ar->scan.vdev_id; in ath10k_offchan_tx_work()
4153 spin_unlock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4168 spin_lock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4169 reinit_completion(&ar->offchan_tx_completed); in ath10k_offchan_tx_work()
4170 ar->offchan_tx_skb = skb; in ath10k_offchan_tx_work()
4171 spin_unlock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4173 /* It's safe to access vif and sta - conf_mutex guarantees that in ath10k_offchan_tx_work()
4179 vif = arvif->vif; in ath10k_offchan_tx_work()
4197 wait_for_completion_timeout(&ar->offchan_tx_completed, 3 * HZ); in ath10k_offchan_tx_work()
4200 skb, skb->len); in ath10k_offchan_tx_work()
4209 mutex_unlock(&ar->conf_mutex); in ath10k_offchan_tx_work()
4218 skb = skb_dequeue(&ar->wmi_mgmt_tx_queue); in ath10k_mgmt_over_wmi_tx_purge()
4222 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_purge()
4234 skb = skb_dequeue(&ar->wmi_mgmt_tx_queue); in ath10k_mgmt_over_wmi_tx_work()
4239 ar->running_fw->fw_file.fw_features)) { in ath10k_mgmt_over_wmi_tx_work()
4240 paddr = dma_map_single(ar->dev, skb->data, in ath10k_mgmt_over_wmi_tx_work()
4241 skb->len, DMA_TO_DEVICE); in ath10k_mgmt_over_wmi_tx_work()
4242 if (dma_mapping_error(ar->dev, paddr)) { in ath10k_mgmt_over_wmi_tx_work()
4243 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4253 dma_unmap_single(ar->dev, paddr, skb->len, in ath10k_mgmt_over_wmi_tx_work()
4255 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4262 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4275 artxq = (void *)txq->drv_priv; in ath10k_mac_txq_init()
4276 INIT_LIST_HEAD(&artxq->list); in ath10k_mac_txq_init()
4288 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_txq_unref()
4289 idr_for_each_entry(&ar->htt.pending_tx, msdu, msdu_id) { in ath10k_mac_txq_unref()
4291 if (cb->txq == txq) in ath10k_mac_txq_unref()
4292 cb->txq = NULL; in ath10k_mac_txq_unref()
4294 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_txq_unref()
4303 lockdep_assert_held(&ar->data_lock); in ath10k_mac_txq_lookup()
4305 peer = ar->peer_map[peer_id]; in ath10k_mac_txq_lookup()
4309 if (peer->removed) in ath10k_mac_txq_lookup()
4312 if (peer->sta) in ath10k_mac_txq_lookup()
4313 return peer->sta->txq[tid]; in ath10k_mac_txq_lookup()
4314 else if (peer->vif) in ath10k_mac_txq_lookup()
4315 return peer->vif->txq; in ath10k_mac_txq_lookup()
4323 struct ath10k *ar = hw->priv; in ath10k_mac_tx_can_push()
4324 struct ath10k_txq *artxq = (void *)txq->drv_priv; in ath10k_mac_tx_can_push()
4327 if (ar->htt.tx_q_state.mode == HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_tx_can_push()
4330 if (ar->htt.num_pending_tx < ar->htt.tx_q_state.num_push_allowed) in ath10k_mac_tx_can_push()
4333 if (artxq->num_fw_queued < artxq->num_push_allowed) in ath10k_mac_tx_can_push()
4355 if (!txq || !txq->sta) in ath10k_mac_update_airtime()
4358 if (test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map)) in ath10k_mac_update_airtime()
4361 spin_lock_bh(&ar->data_lock); in ath10k_mac_update_airtime()
4362 arsta = (struct ath10k_sta *)txq->sta->drv_priv; in ath10k_mac_update_airtime()
4364 pktlen = skb->len + 38; /* Assume MAC header 30, SNAP 8 for most case */ in ath10k_mac_update_airtime()
4365 if (arsta->last_tx_bitrate) { in ath10k_mac_update_airtime()
4368 / arsta->last_tx_bitrate; in ath10k_mac_update_airtime()
4380 spin_unlock_bh(&ar->data_lock); in ath10k_mac_update_airtime()
4388 struct ath10k *ar = hw->priv; in ath10k_mac_tx_push_txq()
4389 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_tx_push_txq()
4390 struct ath10k_txq *artxq = (void *)txq->drv_priv; in ath10k_mac_tx_push_txq()
4391 struct ieee80211_vif *vif = txq->vif; in ath10k_mac_tx_push_txq()
4392 struct ieee80211_sta *sta = txq->sta; in ath10k_mac_tx_push_txq()
4402 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4404 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4411 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4413 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4415 return -ENOENT; in ath10k_mac_tx_push_txq()
4421 skb_len = skb->len; in ath10k_mac_tx_push_txq()
4427 hdr = (struct ieee80211_hdr *)skb->data; in ath10k_mac_tx_push_txq()
4428 is_presp = ieee80211_is_probe_resp(hdr->frame_control); in ath10k_mac_tx_push_txq()
4430 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4435 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4438 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4445 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4449 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4454 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4455 artxq->num_fw_queued++; in ath10k_mac_tx_push_txq()
4456 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4475 if (ret == -EBUSY) in ath10k_mac_schedule_txq()
4485 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_tx_push_pending()
4488 if (ar->htt.tx_q_state.mode != HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_tx_push_pending()
4491 if (ar->htt.num_pending_tx >= (ar->htt.max_num_pending_tx / 2)) in ath10k_mac_tx_push_pending()
4496 if (ath10k_mac_schedule_txq(hw, ac) == -EBUSY) in ath10k_mac_tx_push_pending()
4509 lockdep_assert_held(&ar->data_lock); in __ath10k_scan_finish()
4511 switch (ar->scan.state) { in __ath10k_scan_finish()
4516 if (!ar->scan.is_roc) { in __ath10k_scan_finish()
4518 .aborted = (ar->scan.state == in __ath10k_scan_finish()
4522 ieee80211_scan_completed(ar->hw, &info); in __ath10k_scan_finish()
4523 } else if (ar->scan.roc_notify) { in __ath10k_scan_finish()
4524 ieee80211_remain_on_channel_expired(ar->hw); in __ath10k_scan_finish()
4528 ar->scan.state = ATH10K_SCAN_IDLE; in __ath10k_scan_finish()
4529 ar->scan_channel = NULL; in __ath10k_scan_finish()
4530 ar->scan.roc_freq = 0; in __ath10k_scan_finish()
4532 cancel_delayed_work(&ar->scan.timeout); in __ath10k_scan_finish()
4533 complete(&ar->scan.completed); in __ath10k_scan_finish()
4540 spin_lock_bh(&ar->data_lock); in ath10k_scan_finish()
4542 spin_unlock_bh(&ar->data_lock); in ath10k_scan_finish()
4554 lockdep_assert_held(&ar->conf_mutex); in ath10k_scan_stop()
4562 ret = wait_for_completion_timeout(&ar->scan.completed, 3 * HZ); in ath10k_scan_stop()
4565 ret = -ETIMEDOUT; in ath10k_scan_stop()
4578 spin_lock_bh(&ar->data_lock); in ath10k_scan_stop()
4579 if (ar->scan.state != ATH10K_SCAN_IDLE) in ath10k_scan_stop()
4581 spin_unlock_bh(&ar->data_lock); in ath10k_scan_stop()
4590 lockdep_assert_held(&ar->conf_mutex); in ath10k_scan_abort()
4592 spin_lock_bh(&ar->data_lock); in ath10k_scan_abort()
4594 switch (ar->scan.state) { in ath10k_scan_abort()
4603 ath10k_scan_state_str(ar->scan.state), in ath10k_scan_abort()
4604 ar->scan.state); in ath10k_scan_abort()
4607 ar->scan.state = ATH10K_SCAN_ABORTING; in ath10k_scan_abort()
4608 spin_unlock_bh(&ar->data_lock); in ath10k_scan_abort()
4614 spin_lock_bh(&ar->data_lock); in ath10k_scan_abort()
4618 spin_unlock_bh(&ar->data_lock); in ath10k_scan_abort()
4626 mutex_lock(&ar->conf_mutex); in ath10k_scan_timeout_work()
4628 mutex_unlock(&ar->conf_mutex); in ath10k_scan_timeout_work()
4636 lockdep_assert_held(&ar->conf_mutex); in ath10k_start_scan()
4642 ret = wait_for_completion_timeout(&ar->scan.started, 1 * HZ); in ath10k_start_scan()
4648 return -ETIMEDOUT; in ath10k_start_scan()
4655 spin_lock_bh(&ar->data_lock); in ath10k_start_scan()
4656 if (ar->scan.state == ATH10K_SCAN_IDLE) { in ath10k_start_scan()
4657 spin_unlock_bh(&ar->data_lock); in ath10k_start_scan()
4658 return -EINVAL; in ath10k_start_scan()
4660 spin_unlock_bh(&ar->data_lock); in ath10k_start_scan()
4673 struct ath10k *ar = hw->priv; in ath10k_mac_op_tx()
4674 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_op_tx()
4676 struct ieee80211_vif *vif = info->control.vif; in ath10k_mac_op_tx()
4677 struct ieee80211_sta *sta = control->sta; in ath10k_mac_op_tx()
4698 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4699 if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) { in ath10k_mac_op_tx()
4700 struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_mac_op_tx()
4702 is_presp = ieee80211_is_probe_resp(hdr->frame_control); in ath10k_mac_op_tx()
4709 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4710 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_op_tx()
4719 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4720 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_op_tx()
4723 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4730 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4734 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4743 struct ath10k *ar = hw->priv; in ath10k_mac_op_wake_tx_queue()
4745 u8 ac = txq->ac; in ath10k_mac_op_wake_tx_queue()
4748 if (ar->htt.tx_q_state.mode != HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_op_wake_tx_queue()
4751 spin_lock_bh(&ar->queue_lock[ac]); in ath10k_mac_op_wake_tx_queue()
4767 spin_unlock_bh(&ar->queue_lock[ac]); in ath10k_mac_op_wake_tx_queue()
4773 lockdep_assert_not_held(&ar->conf_mutex); in ath10k_drain_tx()
4775 /* make sure rcu-protected mac80211 tx path itself is drained */ in ath10k_drain_tx()
4781 cancel_work_sync(&ar->offchan_tx_work); in ath10k_drain_tx()
4782 cancel_work_sync(&ar->wmi_mgmt_tx_work); in ath10k_drain_tx()
4789 lockdep_assert_held(&ar->conf_mutex); in ath10k_halt()
4791 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_halt()
4792 ar->filter_flags = 0; in ath10k_halt()
4793 ar->monitor = false; in ath10k_halt()
4794 ar->monitor_arvif = NULL; in ath10k_halt()
4796 if (ar->monitor_started) in ath10k_halt()
4799 ar->monitor_started = false; in ath10k_halt()
4800 ar->tx_paused = 0; in ath10k_halt()
4808 spin_lock_bh(&ar->data_lock); in ath10k_halt()
4809 list_for_each_entry(arvif, &ar->arvifs, list) in ath10k_halt()
4811 spin_unlock_bh(&ar->data_lock); in ath10k_halt()
4816 struct ath10k *ar = hw->priv; in ath10k_get_antenna()
4818 mutex_lock(&ar->conf_mutex); in ath10k_get_antenna()
4820 *tx_ant = ar->cfg_tx_chainmask; in ath10k_get_antenna()
4821 *rx_ant = ar->cfg_rx_chainmask; in ath10k_get_antenna()
4823 mutex_unlock(&ar->conf_mutex); in ath10k_get_antenna()
4844 int nsts = ar->vht_cap_info; in ath10k_mac_get_vht_cap_bf_sts()
4849 /* If firmware does not deliver to host number of space-time in ath10k_mac_get_vht_cap_bf_sts()
4851 * the value for VHT CAP: nsts-1) in ath10k_mac_get_vht_cap_bf_sts()
4861 int sound_dim = ar->vht_cap_info; in ath10k_mac_get_vht_cap_bf_sound_dim()
4878 struct ath10k_hw_params *hw = &ar->hw_params; in ath10k_create_vht_cap()
4884 vht_cap.cap = ar->vht_cap_info; in ath10k_create_vht_cap()
4886 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | in ath10k_create_vht_cap()
4895 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | in ath10k_create_vht_cap()
4906 if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i))) in ath10k_create_vht_cap()
4912 if (ar->cfg_tx_chainmask <= 1) in ath10k_create_vht_cap()
4920 * user-space a clue if that is the case. in ath10k_create_vht_cap()
4923 (hw->vht160_mcs_rx_highest != 0 || in ath10k_create_vht_cap()
4924 hw->vht160_mcs_tx_highest != 0)) { in ath10k_create_vht_cap()
4925 vht_cap.vht_mcs.rx_highest = cpu_to_le16(hw->vht160_mcs_rx_highest); in ath10k_create_vht_cap()
4926 vht_cap.vht_mcs.tx_highest = cpu_to_le16(hw->vht160_mcs_tx_highest); in ath10k_create_vht_cap()
4937 if (!(ar->ht_cap_info & WMI_HT_CAP_ENABLED)) in ath10k_get_ht_cap()
4948 if (ar->ht_cap_info & WMI_HT_CAP_HT20_SGI) in ath10k_get_ht_cap()
4951 if (ar->ht_cap_info & WMI_HT_CAP_HT40_SGI) in ath10k_get_ht_cap()
4954 if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) { in ath10k_get_ht_cap()
4963 if (ar->ht_cap_info & WMI_HT_CAP_TX_STBC && (ar->cfg_tx_chainmask > 1)) in ath10k_get_ht_cap()
4966 if (ar->ht_cap_info & WMI_HT_CAP_RX_STBC) { in ath10k_get_ht_cap()
4969 stbc = ar->ht_cap_info; in ath10k_get_ht_cap()
4978 if (ar->ht_cap_info & WMI_HT_CAP_LDPC || (ar->ht_cap_info & in ath10k_get_ht_cap()
4979 WMI_HT_CAP_RX_LDPC && (ar->ht_cap_info & WMI_HT_CAP_TX_LDPC))) in ath10k_get_ht_cap()
4982 if (ar->ht_cap_info & WMI_HT_CAP_L_SIG_TXOP_PROT) in ath10k_get_ht_cap()
4986 if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK) in ath10k_get_ht_cap()
4989 for (i = 0; i < ar->num_rf_chains; i++) { in ath10k_get_ht_cap()
4990 if (ar->cfg_rx_chainmask & BIT(i)) in ath10k_get_ht_cap()
5008 if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) { in ath10k_mac_setup_ht_vht_cap()
5009 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath10k_mac_setup_ht_vht_cap()
5010 band->ht_cap = ht_cap; in ath10k_mac_setup_ht_vht_cap()
5012 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) { in ath10k_mac_setup_ht_vht_cap()
5013 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath10k_mac_setup_ht_vht_cap()
5014 band->ht_cap = ht_cap; in ath10k_mac_setup_ht_vht_cap()
5015 band->vht_cap = vht_cap; in ath10k_mac_setup_ht_vht_cap()
5024 lockdep_assert_held(&ar->conf_mutex); in __ath10k_set_antenna()
5030 return -EINVAL; in __ath10k_set_antenna()
5032 ar->cfg_tx_chainmask = tx_ant; in __ath10k_set_antenna()
5033 ar->cfg_rx_chainmask = rx_ant; in __ath10k_set_antenna()
5035 if ((ar->state != ATH10K_STATE_ON) && in __ath10k_set_antenna()
5036 (ar->state != ATH10K_STATE_RESTARTED)) in __ath10k_set_antenna()
5039 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->tx_chain_mask, in __ath10k_set_antenna()
5042 ath10k_warn(ar, "failed to set tx-chainmask: %d, req 0x%x\n", in __ath10k_set_antenna()
5047 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->rx_chain_mask, in __ath10k_set_antenna()
5050 ath10k_warn(ar, "failed to set rx-chainmask: %d, req 0x%x\n", in __ath10k_set_antenna()
5063 struct ath10k *ar = hw->priv; in ath10k_set_antenna()
5066 mutex_lock(&ar->conf_mutex); in ath10k_set_antenna()
5068 mutex_unlock(&ar->conf_mutex); in ath10k_set_antenna()
5080 node = ar->dev->of_node; in __ath10k_fetch_bb_timing_dt()
5082 return -ENOENT; in __ath10k_fetch_bb_timing_dt()
5084 ret = of_property_read_string_index(node, "ext-fem-name", 0, &fem_name); in __ath10k_fetch_bb_timing_dt()
5086 return -ENOENT; in __ath10k_fetch_bb_timing_dt()
5091 * so choosing different value suitable for that external FEM. in __ath10k_fetch_bb_timing_dt()
5093 if (!strcmp("microsemi-lx5586", fem_name)) { in __ath10k_fetch_bb_timing_dt()
5094 bb_timing->bb_tx_timing = 0x00; in __ath10k_fetch_bb_timing_dt()
5095 bb_timing->bb_xpa_timing = 0x0101; in __ath10k_fetch_bb_timing_dt()
5097 return -ENOENT; in __ath10k_fetch_bb_timing_dt()
5101 bb_timing->bb_tx_timing, bb_timing->bb_xpa_timing); in __ath10k_fetch_bb_timing_dt()
5104 return -EINVAL; in __ath10k_fetch_bb_timing_dt()
5113 if (ar->hw_values->rfkill_pin == 0) { in ath10k_mac_rfkill_config()
5115 return -EOPNOTSUPP; in ath10k_mac_rfkill_config()
5120 ar->hw_values->rfkill_pin, ar->hw_values->rfkill_cfg, in ath10k_mac_rfkill_config()
5121 ar->hw_values->rfkill_on_level); in ath10k_mac_rfkill_config()
5124 ar->hw_values->rfkill_on_level) | in ath10k_mac_rfkill_config()
5126 ar->hw_values->rfkill_pin) | in ath10k_mac_rfkill_config()
5128 ar->hw_values->rfkill_cfg); in ath10k_mac_rfkill_config()
5131 ar->wmi.pdev_param->rfkill_config, in ath10k_mac_rfkill_config()
5154 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->rfkill_enable, in ath10k_mac_rfkill_enable_radio()
5167 struct ath10k *ar = hw->priv; in ath10k_start()
5179 mutex_lock(&ar->conf_mutex); in ath10k_start()
5181 switch (ar->state) { in ath10k_start()
5183 ar->state = ATH10K_STATE_ON; in ath10k_start()
5186 ar->state = ATH10K_STATE_RESTARTED; in ath10k_start()
5192 ret = -EINVAL; in ath10k_start()
5195 ret = -EBUSY; in ath10k_start()
5199 spin_lock_bh(&ar->data_lock); in ath10k_start()
5201 if (ar->hw_rfkill_on) { in ath10k_start()
5202 ar->hw_rfkill_on = false; in ath10k_start()
5203 spin_unlock_bh(&ar->data_lock); in ath10k_start()
5207 spin_unlock_bh(&ar->data_lock); in ath10k_start()
5216 &ar->normal_mode_fw); in ath10k_start()
5222 if (ar->sys_cap_info & WMI_TLV_SYS_CAP_INFO_RFKILL) { in ath10k_start()
5224 if (ret && ret != -EOPNOTSUPP) { in ath10k_start()
5230 param = ar->wmi.pdev_param->pmf_qos; in ath10k_start()
5237 param = ar->wmi.pdev_param->dynamic_bw; in ath10k_start()
5244 if (test_bit(WMI_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi.svc_map)) { in ath10k_start()
5245 ret = ath10k_wmi_scan_prob_req_oui(ar, ar->mac_addr); in ath10k_start()
5252 if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar->wmi.svc_map)) { in ath10k_start()
5261 if (test_bit(WMI_SERVICE_BURST, ar->wmi.svc_map)) { in ath10k_start()
5262 param = ar->wmi.pdev_param->burst_enable; in ath10k_start()
5270 param = ar->wmi.pdev_param->idle_ps_config; in ath10k_start()
5272 if (ret && ret != -EOPNOTSUPP) { in ath10k_start()
5277 __ath10k_set_antenna(ar, ar->cfg_tx_chainmask, ar->cfg_rx_chainmask); in ath10k_start()
5288 param = ar->wmi.pdev_param->arp_ac_override; in ath10k_start()
5297 ar->running_fw->fw_file.fw_features)) { in ath10k_start()
5308 param = ar->wmi.pdev_param->ani_enable; in ath10k_start()
5316 ar->ani_enabled = true; in ath10k_start()
5319 param = ar->wmi.pdev_param->peer_stats_update_period; in ath10k_start()
5330 param = ar->wmi.pdev_param->enable_btcoex; in ath10k_start()
5331 if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map) && in ath10k_start()
5333 ar->running_fw->fw_file.fw_features) && in ath10k_start()
5334 ar->coex_support) { in ath10k_start()
5341 clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); in ath10k_start()
5344 if (test_bit(WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT, ar->wmi.svc_map)) { in ath10k_start()
5357 ar->num_started_vdevs = 0; in ath10k_start()
5363 ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_IDLE; in ath10k_start()
5365 mutex_unlock(&ar->conf_mutex); in ath10k_start()
5375 ar->state = ATH10K_STATE_OFF; in ath10k_start()
5378 mutex_unlock(&ar->conf_mutex); in ath10k_start()
5384 struct ath10k *ar = hw->priv; in ath10k_stop()
5389 mutex_lock(&ar->conf_mutex); in ath10k_stop()
5390 if (ar->state != ATH10K_STATE_OFF) { in ath10k_stop()
5391 if (!ar->hw_rfkill_on) { in ath10k_stop()
5397 if (ar->state != ATH10K_STATE_RESTARTING) { in ath10k_stop()
5408 ar->state = ATH10K_STATE_OFF; in ath10k_stop()
5410 mutex_unlock(&ar->conf_mutex); in ath10k_stop()
5412 cancel_work_sync(&ar->set_coverage_class_work); in ath10k_stop()
5413 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_stop()
5414 cancel_work_sync(&ar->restart_work); in ath10k_stop()
5422 lockdep_assert_held(&ar->conf_mutex); in ath10k_config_ps()
5424 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_config_ps()
5437 struct ath10k *ar = hw->priv; in ath10k_config()
5438 struct ieee80211_conf *conf = &hw->conf; in ath10k_config()
5441 mutex_lock(&ar->conf_mutex); in ath10k_config()
5447 ar->monitor = conf->flags & IEEE80211_CONF_MONITOR; in ath10k_config()
5453 mutex_unlock(&ar->conf_mutex); in ath10k_config()
5471 struct ath10k *ar = arvif->ar; in ath10k_mac_set_txbf_conf()
5479 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | in ath10k_mac_set_txbf_conf()
5484 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | in ath10k_mac_set_txbf_conf()
5491 if (ar->vht_cap_info & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE) in ath10k_mac_set_txbf_conf()
5494 if (ar->vht_cap_info & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE) in ath10k_mac_set_txbf_conf()
5498 if (ar->vht_cap_info & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE) in ath10k_mac_set_txbf_conf()
5501 if (ar->vht_cap_info & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE) in ath10k_mac_set_txbf_conf()
5505 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_mac_set_txbf_conf()
5506 ar->wmi.vdev_param->txbf, value); in ath10k_mac_set_txbf_conf()
5512 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_update_vif_offload()
5513 struct ath10k *ar = hw->priv; in ath10k_update_vif_offload()
5518 ar->wmi.vdev_param->tx_encap_type == WMI_VDEV_PARAM_UNSUPPORTED || in ath10k_update_vif_offload()
5519 (vif->type != NL80211_IFTYPE_STATION && in ath10k_update_vif_offload()
5520 vif->type != NL80211_IFTYPE_AP)) in ath10k_update_vif_offload()
5521 vif->offload_flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED; in ath10k_update_vif_offload()
5523 vdev_param = ar->wmi.vdev_param->tx_encap_type; in ath10k_update_vif_offload()
5524 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_update_vif_offload()
5527 if (ret && ret != -EOPNOTSUPP) { in ath10k_update_vif_offload()
5529 arvif->vdev_id, ret); in ath10k_update_vif_offload()
5543 struct ath10k *ar = hw->priv; in ath10k_add_interface()
5544 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_add_interface()
5553 vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; in ath10k_add_interface()
5555 mutex_lock(&ar->conf_mutex); in ath10k_add_interface()
5558 ath10k_mac_txq_init(vif->txq); in ath10k_add_interface()
5560 arvif->ar = ar; in ath10k_add_interface()
5561 arvif->vif = vif; in ath10k_add_interface()
5563 INIT_LIST_HEAD(&arvif->list); in ath10k_add_interface()
5564 INIT_WORK(&arvif->ap_csa_work, ath10k_mac_vif_ap_csa_work); in ath10k_add_interface()
5565 INIT_DELAYED_WORK(&arvif->connection_loss_work, in ath10k_add_interface()
5568 for (i = 0; i < ARRAY_SIZE(arvif->bitrate_mask.control); i++) { in ath10k_add_interface()
5569 arvif->bitrate_mask.control[i].legacy = 0xffffffff; in ath10k_add_interface()
5570 memset(arvif->bitrate_mask.control[i].ht_mcs, 0xff, in ath10k_add_interface()
5571 sizeof(arvif->bitrate_mask.control[i].ht_mcs)); in ath10k_add_interface()
5572 memset(arvif->bitrate_mask.control[i].vht_mcs, 0xff, in ath10k_add_interface()
5573 sizeof(arvif->bitrate_mask.control[i].vht_mcs)); in ath10k_add_interface()
5576 if (ar->num_peers >= ar->max_num_peers) { in ath10k_add_interface()
5578 ret = -ENOBUFS; in ath10k_add_interface()
5582 if (ar->free_vdev_map == 0) { in ath10k_add_interface()
5584 ret = -EBUSY; in ath10k_add_interface()
5587 bit = __ffs64(ar->free_vdev_map); in ath10k_add_interface()
5590 bit, ar->free_vdev_map); in ath10k_add_interface()
5592 arvif->vdev_id = bit; in ath10k_add_interface()
5593 arvif->vdev_subtype = in ath10k_add_interface()
5596 switch (vif->type) { in ath10k_add_interface()
5598 arvif->vdev_type = WMI_VDEV_TYPE_STA; in ath10k_add_interface()
5599 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5604 arvif->vdev_type = WMI_VDEV_TYPE_STA; in ath10k_add_interface()
5605 if (vif->p2p) in ath10k_add_interface()
5606 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5610 arvif->vdev_type = WMI_VDEV_TYPE_IBSS; in ath10k_add_interface()
5613 if (test_bit(WMI_SERVICE_MESH_11S, ar->wmi.svc_map)) { in ath10k_add_interface()
5614 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5616 } else if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { in ath10k_add_interface()
5617 ret = -EINVAL; in ath10k_add_interface()
5621 arvif->vdev_type = WMI_VDEV_TYPE_AP; in ath10k_add_interface()
5624 arvif->vdev_type = WMI_VDEV_TYPE_AP; in ath10k_add_interface()
5626 if (vif->p2p) in ath10k_add_interface()
5627 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5631 arvif->vdev_type = WMI_VDEV_TYPE_MONITOR; in ath10k_add_interface()
5638 /* Using vdev_id as queue number will make it very easy to do per-vif in ath10k_add_interface()
5643 vif->cab_queue = arvif->vdev_id % (IEEE80211_MAX_QUEUES - 1); in ath10k_add_interface()
5644 for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++) in ath10k_add_interface()
5645 vif->hw_queue[i] = arvif->vdev_id % (IEEE80211_MAX_QUEUES - 1); in ath10k_add_interface()
5652 * On non-IOMMU-enabled hosts this could be a possible security issue in ath10k_add_interface()
5654 * IOMMU-enabled hosts DMAR faults would occur in most cases and target in ath10k_add_interface()
5659 * DMA-coherent buffer for a lifetime of a vif and use it for all in ath10k_add_interface()
5661 * become corrupted, e.g. have garbled IEs or out-of-date TIM bitmap. in ath10k_add_interface()
5663 if (vif->type == NL80211_IFTYPE_ADHOC || in ath10k_add_interface()
5664 vif->type == NL80211_IFTYPE_MESH_POINT || in ath10k_add_interface()
5665 vif->type == NL80211_IFTYPE_AP) { in ath10k_add_interface()
5666 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) { in ath10k_add_interface()
5667 arvif->beacon_buf = kmalloc(IEEE80211_MAX_FRAME_LEN, in ath10k_add_interface()
5673 * known-invalid address token instead, which in ath10k_add_interface()
5677 arvif->beacon_paddr = DMA_MAPPING_ERROR; in ath10k_add_interface()
5679 arvif->beacon_buf = in ath10k_add_interface()
5680 dma_alloc_coherent(ar->dev, in ath10k_add_interface()
5682 &arvif->beacon_paddr, in ath10k_add_interface()
5685 if (!arvif->beacon_buf) { in ath10k_add_interface()
5686 ret = -ENOMEM; in ath10k_add_interface()
5692 if (test_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, &ar->dev_flags)) in ath10k_add_interface()
5693 arvif->nohwcrypt = true; in ath10k_add_interface()
5695 if (arvif->nohwcrypt && in ath10k_add_interface()
5696 !test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { in ath10k_add_interface()
5697 ret = -EINVAL; in ath10k_add_interface()
5703 arvif->vdev_id, arvif->vdev_type, arvif->vdev_subtype, in ath10k_add_interface()
5704 arvif->beacon_buf ? "single-buf" : "per-skb"); in ath10k_add_interface()
5706 ret = ath10k_wmi_vdev_create(ar, arvif->vdev_id, arvif->vdev_type, in ath10k_add_interface()
5707 arvif->vdev_subtype, vif->addr); in ath10k_add_interface()
5710 arvif->vdev_id, ret); in ath10k_add_interface()
5715 ar->wmi.svc_map)) { in ath10k_add_interface()
5716 vdev_param = ar->wmi.vdev_param->disable_4addr_src_lrn; in ath10k_add_interface()
5717 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5719 if (ret && ret != -EOPNOTSUPP) { in ath10k_add_interface()
5721 arvif->vdev_id, ret); in ath10k_add_interface()
5725 ar->free_vdev_map &= ~(1LL << arvif->vdev_id); in ath10k_add_interface()
5726 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5727 list_add(&arvif->list, &ar->arvifs); in ath10k_add_interface()
5728 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5736 arvif->vdev_id, ret); in ath10k_add_interface()
5740 arvif->def_wep_key_idx = -1; in ath10k_add_interface()
5747 if (ar->cfg_tx_chainmask && (vif->type != NL80211_IFTYPE_MONITOR)) { in ath10k_add_interface()
5748 u16 nss = get_nss_from_chainmask(ar->cfg_tx_chainmask); in ath10k_add_interface()
5750 vdev_param = ar->wmi.vdev_param->nss; in ath10k_add_interface()
5751 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5755 arvif->vdev_id, ar->cfg_tx_chainmask, nss, in ath10k_add_interface()
5761 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_add_interface()
5762 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_add_interface()
5763 ret = ath10k_peer_create(ar, vif, NULL, arvif->vdev_id, in ath10k_add_interface()
5764 vif->addr, WMI_PEER_TYPE_DEFAULT); in ath10k_add_interface()
5767 arvif->vdev_id, ret); in ath10k_add_interface()
5771 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5773 peer = ath10k_peer_find(ar, arvif->vdev_id, vif->addr); in ath10k_add_interface()
5776 vif->addr, arvif->vdev_id); in ath10k_add_interface()
5777 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5778 ret = -ENOENT; in ath10k_add_interface()
5782 arvif->peer_id = find_first_bit(peer->peer_ids, in ath10k_add_interface()
5785 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5787 arvif->peer_id = HTT_INVALID_PEERID; in ath10k_add_interface()
5790 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath10k_add_interface()
5794 arvif->vdev_id, ret); in ath10k_add_interface()
5799 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) { in ath10k_add_interface()
5802 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_add_interface()
5806 arvif->vdev_id, ret); in ath10k_add_interface()
5813 arvif->vdev_id, ret); in ath10k_add_interface()
5820 arvif->vdev_id, ret); in ath10k_add_interface()
5828 arvif->vdev_id, ret); in ath10k_add_interface()
5832 ret = ath10k_mac_set_rts(arvif, ar->hw->wiphy->rts_threshold); in ath10k_add_interface()
5835 arvif->vdev_id, ret); in ath10k_add_interface()
5839 arvif->txpower = vif->bss_conf.txpower; in ath10k_add_interface()
5846 if (test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) { in ath10k_add_interface()
5847 vdev_param = ar->wmi.vdev_param->rtt_responder_role; in ath10k_add_interface()
5848 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5849 arvif->ftm_responder); in ath10k_add_interface()
5852 if (ret && ret != -EOPNOTSUPP) in ath10k_add_interface()
5854 arvif->vdev_id, ret); in ath10k_add_interface()
5857 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_add_interface()
5858 ar->monitor_arvif = arvif; in ath10k_add_interface()
5866 spin_lock_bh(&ar->htt.tx_lock); in ath10k_add_interface()
5867 if (!ar->tx_paused) in ath10k_add_interface()
5868 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_add_interface()
5869 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_add_interface()
5871 mutex_unlock(&ar->conf_mutex); in ath10k_add_interface()
5875 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_add_interface()
5876 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_add_interface()
5877 ath10k_wmi_peer_delete(ar, arvif->vdev_id, vif->addr); in ath10k_add_interface()
5878 ath10k_wait_for_peer_delete_done(ar, arvif->vdev_id, in ath10k_add_interface()
5879 vif->addr); in ath10k_add_interface()
5883 ath10k_wmi_vdev_delete(ar, arvif->vdev_id); in ath10k_add_interface()
5884 ar->free_vdev_map |= 1LL << arvif->vdev_id; in ath10k_add_interface()
5885 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5886 list_del(&arvif->list); in ath10k_add_interface()
5887 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5890 if (arvif->beacon_buf) { in ath10k_add_interface()
5891 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) in ath10k_add_interface()
5892 kfree(arvif->beacon_buf); in ath10k_add_interface()
5894 dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, in ath10k_add_interface()
5895 arvif->beacon_buf, in ath10k_add_interface()
5896 arvif->beacon_paddr); in ath10k_add_interface()
5897 arvif->beacon_buf = NULL; in ath10k_add_interface()
5900 mutex_unlock(&ar->conf_mutex); in ath10k_add_interface()
5916 struct ath10k *ar = hw->priv; in ath10k_remove_interface()
5917 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_remove_interface()
5923 cancel_work_sync(&arvif->ap_csa_work); in ath10k_remove_interface()
5924 cancel_delayed_work_sync(&arvif->connection_loss_work); in ath10k_remove_interface()
5926 mutex_lock(&ar->conf_mutex); in ath10k_remove_interface()
5931 arvif->vdev_id, ret); in ath10k_remove_interface()
5933 ar->free_vdev_map |= 1LL << arvif->vdev_id; in ath10k_remove_interface()
5934 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5935 list_del(&arvif->list); in ath10k_remove_interface()
5936 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
5938 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_remove_interface()
5939 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_remove_interface()
5940 ret = ath10k_wmi_peer_delete(arvif->ar, arvif->vdev_id, in ath10k_remove_interface()
5941 vif->addr); in ath10k_remove_interface()
5943 ath10k_warn(ar, "failed to submit AP/IBSS self-peer removal on vdev %i: %d\n", in ath10k_remove_interface()
5944 arvif->vdev_id, ret); in ath10k_remove_interface()
5946 ath10k_wait_for_peer_delete_done(ar, arvif->vdev_id, in ath10k_remove_interface()
5947 vif->addr); in ath10k_remove_interface()
5948 kfree(arvif->u.ap.noa_data); in ath10k_remove_interface()
5952 arvif->vdev_id); in ath10k_remove_interface()
5954 ret = ath10k_wmi_vdev_delete(ar, arvif->vdev_id); in ath10k_remove_interface()
5957 arvif->vdev_id, ret); in ath10k_remove_interface()
5959 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) { in ath10k_remove_interface()
5960 time_left = wait_for_completion_timeout(&ar->vdev_delete_done, in ath10k_remove_interface()
5968 /* Some firmware revisions don't notify host about self-peer removal in ath10k_remove_interface()
5971 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_remove_interface()
5972 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_remove_interface()
5973 ret = ath10k_wait_for_peer_deleted(ar, arvif->vdev_id, in ath10k_remove_interface()
5974 vif->addr); in ath10k_remove_interface()
5976 ath10k_warn(ar, "failed to remove AP self-peer on vdev %i: %d\n", in ath10k_remove_interface()
5977 arvif->vdev_id, ret); in ath10k_remove_interface()
5979 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5980 ar->num_peers--; in ath10k_remove_interface()
5981 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
5984 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5985 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_remove_interface()
5986 peer = ar->peer_map[i]; in ath10k_remove_interface()
5990 if (peer->vif == vif) { in ath10k_remove_interface()
5992 vif->addr, arvif->vdev_id); in ath10k_remove_interface()
5993 peer->vif = NULL; in ath10k_remove_interface()
6001 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
6003 ath10k_peer_cleanup(ar, arvif->vdev_id); in ath10k_remove_interface()
6004 ath10k_mac_txq_unref(ar, vif->txq); in ath10k_remove_interface()
6006 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_remove_interface()
6007 ar->monitor_arvif = NULL; in ath10k_remove_interface()
6017 spin_lock_bh(&ar->htt.tx_lock); in ath10k_remove_interface()
6019 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_remove_interface()
6021 ath10k_mac_txq_unref(ar, vif->txq); in ath10k_remove_interface()
6024 mutex_unlock(&ar->conf_mutex); in ath10k_remove_interface()
6044 struct ath10k *ar = hw->priv; in ath10k_configure_filter()
6047 mutex_lock(&ar->conf_mutex); in ath10k_configure_filter()
6050 ar->filter_flags = *total_flags; in ath10k_configure_filter()
6056 mutex_unlock(&ar->conf_mutex); in ath10k_configure_filter()
6063 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_recalculate_mgmt_rate()
6071 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalculate_mgmt_rate()
6073 sband = ar->hw->wiphy->bands[def->chan->band]; in ath10k_recalculate_mgmt_rate()
6074 basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; in ath10k_recalculate_mgmt_rate()
6075 bitrate = sband->bitrates[basic_rate_idx].bitrate; in ath10k_recalculate_mgmt_rate()
6083 vdev_param = ar->wmi.vdev_param->mgmt_rate; in ath10k_recalculate_mgmt_rate()
6084 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_recalculate_mgmt_rate()
6095 struct ath10k *ar = hw->priv; in ath10k_bss_info_changed()
6096 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_bss_info_changed()
6104 mutex_lock(&ar->conf_mutex); in ath10k_bss_info_changed()
6110 arvif->beacon_interval = info->beacon_int; in ath10k_bss_info_changed()
6111 vdev_param = ar->wmi.vdev_param->beacon_interval; in ath10k_bss_info_changed()
6112 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6113 arvif->beacon_interval); in ath10k_bss_info_changed()
6116 arvif->vdev_id, arvif->beacon_interval); in ath10k_bss_info_changed()
6120 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6126 arvif->vdev_id); in ath10k_bss_info_changed()
6128 pdev_param = ar->wmi.pdev_param->beacon_tx_mode; in ath10k_bss_info_changed()
6133 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6142 strncpy(arvif->u.ap.ssid, "mesh", in ath10k_bss_info_changed()
6143 sizeof(arvif->u.ap.ssid)); in ath10k_bss_info_changed()
6144 arvif->u.ap.ssid_len = 4; in ath10k_bss_info_changed()
6152 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6156 arvif->dtim_period = info->dtim_period; in ath10k_bss_info_changed()
6160 arvif->vdev_id, arvif->dtim_period); in ath10k_bss_info_changed()
6162 vdev_param = ar->wmi.vdev_param->dtim_period; in ath10k_bss_info_changed()
6163 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6164 arvif->dtim_period); in ath10k_bss_info_changed()
6167 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6171 vif->type == NL80211_IFTYPE_AP) { in ath10k_bss_info_changed()
6172 arvif->u.ap.ssid_len = vif->cfg.ssid_len; in ath10k_bss_info_changed()
6173 if (vif->cfg.ssid_len) in ath10k_bss_info_changed()
6174 memcpy(arvif->u.ap.ssid, vif->cfg.ssid, in ath10k_bss_info_changed()
6175 vif->cfg.ssid_len); in ath10k_bss_info_changed()
6176 arvif->u.ap.hidden_ssid = info->hidden_ssid; in ath10k_bss_info_changed()
6179 if (changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) in ath10k_bss_info_changed()
6180 ether_addr_copy(arvif->bssid, info->bssid); in ath10k_bss_info_changed()
6183 arvif->ftm_responder != info->ftm_responder && in ath10k_bss_info_changed()
6184 test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) { in ath10k_bss_info_changed()
6185 arvif->ftm_responder = info->ftm_responder; in ath10k_bss_info_changed()
6187 vdev_param = ar->wmi.vdev_param->rtt_responder_role; in ath10k_bss_info_changed()
6188 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6189 arvif->ftm_responder); in ath10k_bss_info_changed()
6193 arvif->vdev_id, arvif->ftm_responder, ret); in ath10k_bss_info_changed()
6200 arvif->use_cts_prot = info->use_cts_prot; in ath10k_bss_info_changed()
6205 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6211 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6216 if (info->use_short_slot) in ath10k_bss_info_changed()
6223 arvif->vdev_id, slottime); in ath10k_bss_info_changed()
6225 vdev_param = ar->wmi.vdev_param->slot_time; in ath10k_bss_info_changed()
6226 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6230 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6234 if (info->use_short_preamble) in ath10k_bss_info_changed()
6241 arvif->vdev_id, preamble); in ath10k_bss_info_changed()
6243 vdev_param = ar->wmi.vdev_param->preamble; in ath10k_bss_info_changed()
6244 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6248 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6252 if (vif->cfg.assoc) { in ath10k_bss_info_changed()
6257 if (ar->monitor_started) in ath10k_bss_info_changed()
6268 arvif->vdev_id, info->txpower); in ath10k_bss_info_changed()
6270 arvif->txpower = info->txpower; in ath10k_bss_info_changed()
6277 arvif->ps = vif->cfg.ps; in ath10k_bss_info_changed()
6282 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6286 !ath10k_mac_vif_chan(arvif->vif, &def)) { in ath10k_bss_info_changed()
6287 band = def.chan->band; in ath10k_bss_info_changed()
6288 mcast_rate = vif->bss_conf.mcast_rate[band]; in ath10k_bss_info_changed()
6290 rateidx = mcast_rate - 1; in ath10k_bss_info_changed()
6292 rateidx = ffs(vif->bss_conf.basic_rates) - 1; in ath10k_bss_info_changed()
6294 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_bss_info_changed()
6308 arvif->vdev_id, rate); in ath10k_bss_info_changed()
6310 vdev_param = ar->wmi.vdev_param->mcast_data_rate; in ath10k_bss_info_changed()
6311 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_bss_info_changed()
6316 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6318 vdev_param = ar->wmi.vdev_param->bcast_data_rate; in ath10k_bss_info_changed()
6319 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_bss_info_changed()
6324 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6328 !ath10k_mac_vif_chan(arvif->vif, &def)) in ath10k_bss_info_changed()
6331 mutex_unlock(&ar->conf_mutex); in ath10k_bss_info_changed()
6336 struct ath10k *ar = hw->priv; in ath10k_mac_op_set_coverage_class()
6341 if (!ar->hw_params.hw_ops->set_coverage_class) { in ath10k_mac_op_set_coverage_class()
6345 ar->hw_params.hw_ops->set_coverage_class(ar, value); in ath10k_mac_op_set_coverage_class()
6357 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_tdls_vif_stations_count_iter()
6358 struct ieee80211_vif *sta_vif = arsta->arvif->vif; in ath10k_mac_tdls_vif_stations_count_iter()
6360 if (sta->tdls && sta_vif == iter_data->curr_vif) in ath10k_mac_tdls_vif_stations_count_iter()
6361 iter_data->num_tdls_stations++; in ath10k_mac_tdls_vif_stations_count_iter()
6381 struct ath10k *ar = hw->priv; in ath10k_hw_scan()
6382 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_hw_scan()
6383 struct cfg80211_scan_request *req = &hw_req->req; in ath10k_hw_scan()
6389 mutex_lock(&ar->conf_mutex); in ath10k_hw_scan()
6392 ret = -EBUSY; in ath10k_hw_scan()
6396 spin_lock_bh(&ar->data_lock); in ath10k_hw_scan()
6397 switch (ar->scan.state) { in ath10k_hw_scan()
6399 reinit_completion(&ar->scan.started); in ath10k_hw_scan()
6400 reinit_completion(&ar->scan.completed); in ath10k_hw_scan()
6401 ar->scan.state = ATH10K_SCAN_STARTING; in ath10k_hw_scan()
6402 ar->scan.is_roc = false; in ath10k_hw_scan()
6403 ar->scan.vdev_id = arvif->vdev_id; in ath10k_hw_scan()
6409 ret = -EBUSY; in ath10k_hw_scan()
6412 spin_unlock_bh(&ar->data_lock); in ath10k_hw_scan()
6419 arg.vdev_id = arvif->vdev_id; in ath10k_hw_scan()
6422 if (req->ie_len) { in ath10k_hw_scan()
6423 arg.ie_len = req->ie_len; in ath10k_hw_scan()
6424 memcpy(arg.ie, req->ie, arg.ie_len); in ath10k_hw_scan()
6427 if (req->n_ssids) { in ath10k_hw_scan()
6428 arg.n_ssids = req->n_ssids; in ath10k_hw_scan()
6430 arg.ssids[i].len = req->ssids[i].ssid_len; in ath10k_hw_scan()
6431 arg.ssids[i].ssid = req->ssids[i].ssid; in ath10k_hw_scan()
6437 if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { in ath10k_hw_scan()
6439 ether_addr_copy(arg.mac_addr.addr, req->mac_addr); in ath10k_hw_scan()
6440 ether_addr_copy(arg.mac_mask.addr, req->mac_addr_mask); in ath10k_hw_scan()
6443 if (req->n_channels) { in ath10k_hw_scan()
6444 arg.n_channels = req->n_channels; in ath10k_hw_scan()
6446 arg.channels[i] = req->channels[i]->center_freq; in ath10k_hw_scan()
6450 if (req->duration) { in ath10k_hw_scan()
6451 arg.dwell_time_active = req->duration; in ath10k_hw_scan()
6452 arg.dwell_time_passive = req->duration; in ath10k_hw_scan()
6453 arg.burst_duration_ms = req->duration; in ath10k_hw_scan()
6456 (arg.n_channels - 1) + (req->duration + in ath10k_hw_scan()
6469 spin_lock_bh(&ar->data_lock); in ath10k_hw_scan()
6470 ar->scan.state = ATH10K_SCAN_IDLE; in ath10k_hw_scan()
6471 spin_unlock_bh(&ar->data_lock); in ath10k_hw_scan()
6474 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath10k_hw_scan()
6478 mutex_unlock(&ar->conf_mutex); in ath10k_hw_scan()
6485 struct ath10k *ar = hw->priv; in ath10k_cancel_hw_scan()
6487 mutex_lock(&ar->conf_mutex); in ath10k_cancel_hw_scan()
6489 mutex_unlock(&ar->conf_mutex); in ath10k_cancel_hw_scan()
6491 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_cancel_hw_scan()
6499 u32 vdev_param = arvif->ar->wmi.vdev_param->def_keyid; in ath10k_set_key_h_def_keyidx()
6504 * frames with multi-vif APs. This is not required for main firmware in ath10k_set_key_h_def_keyidx()
6507 * This is also needed for 636 fw for IBSS-RSN to work more reliably. in ath10k_set_key_h_def_keyidx()
6509 * FIXME: It remains unknown if this is required for multi-vif STA in ath10k_set_key_h_def_keyidx()
6513 if (arvif->vdev_type != WMI_VDEV_TYPE_AP && in ath10k_set_key_h_def_keyidx()
6514 arvif->vdev_type != WMI_VDEV_TYPE_IBSS) in ath10k_set_key_h_def_keyidx()
6517 if (key->cipher == WLAN_CIPHER_SUITE_WEP40) in ath10k_set_key_h_def_keyidx()
6520 if (key->cipher == WLAN_CIPHER_SUITE_WEP104) in ath10k_set_key_h_def_keyidx()
6523 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath10k_set_key_h_def_keyidx()
6529 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_set_key_h_def_keyidx()
6530 key->keyidx); in ath10k_set_key_h_def_keyidx()
6533 arvif->vdev_id, ret); in ath10k_set_key_h_def_keyidx()
6540 struct ath10k *ar = hw->priv; in ath10k_set_key()
6541 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_set_key()
6545 bool is_wep = key->cipher == WLAN_CIPHER_SUITE_WEP40 || in ath10k_set_key()
6546 key->cipher == WLAN_CIPHER_SUITE_WEP104; in ath10k_set_key()
6553 if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || in ath10k_set_key()
6554 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || in ath10k_set_key()
6555 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 || in ath10k_set_key()
6556 key->cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256) in ath10k_set_key()
6559 if (arvif->nohwcrypt) in ath10k_set_key()
6562 if (key->keyidx > WMI_MAX_KEY_INDEX) in ath10k_set_key()
6563 return -ENOSPC; in ath10k_set_key()
6565 mutex_lock(&ar->conf_mutex); in ath10k_set_key()
6568 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_set_key()
6569 peer_addr = sta->addr; in ath10k_set_key()
6570 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6571 arsta->ucast_cipher = key->cipher; in ath10k_set_key()
6572 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6573 } else if (arvif->vdev_type == WMI_VDEV_TYPE_STA) { in ath10k_set_key()
6574 peer_addr = vif->bss_conf.bssid; in ath10k_set_key()
6576 peer_addr = vif->addr; in ath10k_set_key()
6579 key->hw_key_idx = key->keyidx; in ath10k_set_key()
6583 arvif->wep_keys[key->keyidx] = key; in ath10k_set_key()
6585 arvif->wep_keys[key->keyidx] = NULL; in ath10k_set_key()
6588 /* the peer should not disappear in mid-way (unless FW goes awry) since in ath10k_set_key()
6591 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6592 peer = ath10k_peer_find(ar, arvif->vdev_id, peer_addr); in ath10k_set_key()
6593 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6597 ath10k_warn(ar, "failed to install key for non-existent peer %pM\n", in ath10k_set_key()
6599 ret = -EOPNOTSUPP; in ath10k_set_key()
6607 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath10k_set_key()
6618 * keys. Static WEP needs an explicit per-peer key upload. in ath10k_set_key()
6620 if (vif->type == NL80211_IFTYPE_ADHOC && in ath10k_set_key()
6630 if (cmd == SET_KEY && arvif->def_wep_key_idx == -1) in ath10k_set_key()
6638 arvif->vdev_id, peer_addr, ret); in ath10k_set_key()
6645 if (is_wep && !sta && vif->type == NL80211_IFTYPE_STATION) { in ath10k_set_key()
6654 arvif->vdev_id, peer_addr, ret); in ath10k_set_key()
6660 arvif->vdev_id, peer_addr, ret2); in ath10k_set_key()
6668 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6669 peer = ath10k_peer_find(ar, arvif->vdev_id, peer_addr); in ath10k_set_key()
6671 peer->keys[key->keyidx] = key; in ath10k_set_key()
6673 peer->keys[key->keyidx] = NULL; in ath10k_set_key()
6677 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6679 if (sta && sta->tdls) in ath10k_set_key()
6680 ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_set_key()
6681 ar->wmi.peer_param->authorize, 1); in ath10k_set_key()
6682 else if (sta && cmd == SET_KEY && (key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) in ath10k_set_key()
6683 ath10k_wmi_peer_set_param(ar, arvif->vdev_id, peer_addr, in ath10k_set_key()
6684 ar->wmi.peer_param->authorize, 1); in ath10k_set_key()
6687 mutex_unlock(&ar->conf_mutex); in ath10k_set_key()
6695 struct ath10k *ar = hw->priv; in ath10k_set_default_unicast_key()
6696 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_set_default_unicast_key()
6699 mutex_lock(&arvif->ar->conf_mutex); in ath10k_set_default_unicast_key()
6701 if (arvif->ar->state != ATH10K_STATE_ON) in ath10k_set_default_unicast_key()
6705 arvif->vdev_id, keyidx); in ath10k_set_default_unicast_key()
6707 ret = ath10k_wmi_vdev_set_param(arvif->ar, in ath10k_set_default_unicast_key()
6708 arvif->vdev_id, in ath10k_set_default_unicast_key()
6709 arvif->ar->wmi.vdev_param->def_keyid, in ath10k_set_default_unicast_key()
6714 arvif->vdev_id, in ath10k_set_default_unicast_key()
6719 arvif->def_wep_key_idx = keyidx; in ath10k_set_default_unicast_key()
6722 mutex_unlock(&arvif->ar->conf_mutex); in ath10k_set_default_unicast_key()
6740 arvif = arsta->arvif; in ath10k_sta_rc_update_wk()
6741 ar = arvif->ar; in ath10k_sta_rc_update_wk()
6743 if (WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) in ath10k_sta_rc_update_wk()
6746 band = def.chan->band; in ath10k_sta_rc_update_wk()
6747 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath10k_sta_rc_update_wk()
6748 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_sta_rc_update_wk()
6750 spin_lock_bh(&ar->data_lock); in ath10k_sta_rc_update_wk()
6752 changed = arsta->changed; in ath10k_sta_rc_update_wk()
6753 arsta->changed = 0; in ath10k_sta_rc_update_wk()
6755 bw = arsta->bw; in ath10k_sta_rc_update_wk()
6756 nss = arsta->nss; in ath10k_sta_rc_update_wk()
6757 smps = arsta->smps; in ath10k_sta_rc_update_wk()
6759 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update_wk()
6761 mutex_lock(&ar->conf_mutex); in ath10k_sta_rc_update_wk()
6772 sta->addr, bw, mode); in ath10k_sta_rc_update_wk()
6774 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6775 ar->wmi.peer_param->phymode, mode); in ath10k_sta_rc_update_wk()
6778 sta->addr, mode, err); in ath10k_sta_rc_update_wk()
6782 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6783 ar->wmi.peer_param->chan_width, bw); in ath10k_sta_rc_update_wk()
6786 sta->addr, bw, err); in ath10k_sta_rc_update_wk()
6791 sta->addr, nss); in ath10k_sta_rc_update_wk()
6793 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6794 ar->wmi.peer_param->nss, nss); in ath10k_sta_rc_update_wk()
6797 sta->addr, nss, err); in ath10k_sta_rc_update_wk()
6802 sta->addr, smps); in ath10k_sta_rc_update_wk()
6804 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6805 ar->wmi.peer_param->smps_state, smps); in ath10k_sta_rc_update_wk()
6808 sta->addr, smps, err); in ath10k_sta_rc_update_wk()
6813 sta->addr); in ath10k_sta_rc_update_wk()
6815 err = ath10k_station_assoc(ar, arvif->vif, sta, true); in ath10k_sta_rc_update_wk()
6818 sta->addr); in ath10k_sta_rc_update_wk()
6822 mutex_unlock(&ar->conf_mutex); in ath10k_sta_rc_update_wk()
6828 struct ath10k *ar = arvif->ar; in ath10k_mac_inc_num_stations()
6830 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_inc_num_stations()
6832 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath10k_mac_inc_num_stations()
6835 if (ar->num_stations >= ar->max_num_stations) in ath10k_mac_inc_num_stations()
6836 return -ENOBUFS; in ath10k_mac_inc_num_stations()
6838 ar->num_stations++; in ath10k_mac_inc_num_stations()
6846 struct ath10k *ar = arvif->ar; in ath10k_mac_dec_num_stations()
6848 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_dec_num_stations()
6850 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath10k_mac_dec_num_stations()
6853 ar->num_stations--; in ath10k_mac_dec_num_stations()
6860 struct ath10k *ar = hw->priv; in ath10k_sta_set_txpwr()
6861 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_set_txpwr()
6865 if (sta->deflink.txpwr.type == NL80211_TX_POWER_AUTOMATIC) { in ath10k_sta_set_txpwr()
6868 txpwr = sta->deflink.txpwr.power; in ath10k_sta_set_txpwr()
6870 return -EINVAL; in ath10k_sta_set_txpwr()
6874 return -EINVAL; in ath10k_sta_set_txpwr()
6876 mutex_lock(&ar->conf_mutex); in ath10k_sta_set_txpwr()
6878 ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_set_txpwr()
6879 ar->wmi.peer_param->use_fixed_power, txpwr); in ath10k_sta_set_txpwr()
6887 mutex_unlock(&ar->conf_mutex); in ath10k_sta_set_txpwr()
6906 num_rates += hweight32(mask->control[band].legacy); in ath10k_mac_bitrate_mask_has_single_rate()
6908 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) in ath10k_mac_bitrate_mask_has_single_rate()
6909 num_rates += hweight8(mask->control[band].ht_mcs[i]); in ath10k_mac_bitrate_mask_has_single_rate()
6912 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_has_single_rate()
6913 tmp = hweight16(mask->control[band].vht_mcs[i]); in ath10k_mac_bitrate_mask_has_single_rate()
6936 if (hweight32(mask->control[band].legacy) == 1) { in ath10k_mac_bitrate_mask_get_single_rate()
6937 rate_idx = ffs(mask->control[band].legacy) - 1; in ath10k_mac_bitrate_mask_get_single_rate()
6939 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_mac_bitrate_mask_get_single_rate()
6952 (*nss - 1) << 4 | in ath10k_mac_bitrate_mask_get_single_rate()
6958 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_rate()
6959 if (hweight8(mask->control[band].ht_mcs[i]) == 1) { in ath10k_mac_bitrate_mask_get_single_rate()
6962 (*nss - 1) << 4 | in ath10k_mac_bitrate_mask_get_single_rate()
6963 (ffs(mask->control[band].ht_mcs[i]) - 1); in ath10k_mac_bitrate_mask_get_single_rate()
6970 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_rate()
6971 if (hweight16(mask->control[band].vht_mcs[i]) == 1) { in ath10k_mac_bitrate_mask_get_single_rate()
6974 (*nss - 1) << 4 | in ath10k_mac_bitrate_mask_get_single_rate()
6975 (ffs(mask->control[band].vht_mcs[i]) - 1); in ath10k_mac_bitrate_mask_get_single_rate()
6981 return -EINVAL; in ath10k_mac_bitrate_mask_get_single_rate()
6988 struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; in ath10k_mac_validate_rate_mask()
6989 struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; in ath10k_mac_validate_rate_mask()
6991 if (nss > sta->deflink.rx_nss) { in ath10k_mac_validate_rate_mask()
6993 nss, sta->deflink.rx_nss); in ath10k_mac_validate_rate_mask()
6994 return -EINVAL; in ath10k_mac_validate_rate_mask()
6998 if (!vht_cap->vht_supported) { in ath10k_mac_validate_rate_mask()
7000 sta->addr); in ath10k_mac_validate_rate_mask()
7001 return -EINVAL; in ath10k_mac_validate_rate_mask()
7004 if (!ht_cap->ht_supported || vht_cap->vht_supported) { in ath10k_mac_validate_rate_mask()
7006 sta->addr); in ath10k_mac_validate_rate_mask()
7007 return -EINVAL; in ath10k_mac_validate_rate_mask()
7010 if (ht_cap->ht_supported || vht_cap->vht_supported) in ath10k_mac_validate_rate_mask()
7011 return -EINVAL; in ath10k_mac_validate_rate_mask()
7031 return -EINVAL; in ath10k_mac_tid_bitrate_config()
7039 band = def.chan->band; in ath10k_mac_tid_bitrate_config()
7043 return -EINVAL; in ath10k_mac_tid_bitrate_config()
7057 return -EINVAL; in ath10k_mac_tid_bitrate_config()
7063 ar->wmi.svc_map))) in ath10k_mac_tid_bitrate_config()
7066 return -EOPNOTSUPP; in ath10k_mac_tid_bitrate_config()
7075 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_set_tid_config()
7080 if (!sta->wme) in ath10k_mac_set_tid_config()
7081 return -ENOTSUPP; in ath10k_mac_set_tid_config()
7083 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_set_tid_config()
7086 if ((arsta->retry_long[arg->tid] > 0 || in ath10k_mac_set_tid_config()
7087 arsta->rate_code[arg->tid] > 0 || in ath10k_mac_set_tid_config()
7088 arsta->ampdu[arg->tid] == in ath10k_mac_set_tid_config()
7090 arg->ack_policy == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7092 arg->ack_policy = 0; in ath10k_mac_set_tid_config()
7093 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7094 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7095 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7100 if (arsta->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_mac_set_tid_config()
7101 arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7102 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7109 if (arsta->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_mac_set_tid_config()
7110 arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7111 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7112 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7116 ether_addr_copy(arg->peer_macaddr.addr, sta->addr); in ath10k_mac_set_tid_config()
7124 arsta->noack[arg->tid] = arg->ack_policy; in ath10k_mac_set_tid_config()
7125 arg->ack_policy = 0; in ath10k_mac_set_tid_config()
7126 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7127 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7128 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7132 arsta->retry_long[arg->tid] = arg->retry_count; in ath10k_mac_set_tid_config()
7133 arg->retry_count = 0; in ath10k_mac_set_tid_config()
7137 arsta->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
7138 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7143 arsta->rate_ctrl[arg->tid] = arg->rate_ctrl; in ath10k_mac_set_tid_config()
7144 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7145 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7149 arsta->rtscts[arg->tid] = arg->rtscts_ctrl; in ath10k_mac_set_tid_config()
7150 arg->ext_tid_cfg_bitmap = 0; in ath10k_mac_set_tid_config()
7154 if ((arvif->retry_long[arg->tid] || in ath10k_mac_set_tid_config()
7155 arvif->rate_code[arg->tid] || in ath10k_mac_set_tid_config()
7156 arvif->ampdu[arg->tid] == in ath10k_mac_set_tid_config()
7158 arg->ack_policy == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7161 arvif->noack[arg->tid] = arg->ack_policy; in ath10k_mac_set_tid_config()
7162 arvif->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
7163 arvif->rate_ctrl[arg->tid] = arg->rate_ctrl; in ath10k_mac_set_tid_config()
7168 if (arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_set_tid_config()
7171 arvif->retry_long[arg->tid] = arg->retry_count; in ath10k_mac_set_tid_config()
7175 if (arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_set_tid_config()
7178 arvif->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
7183 if (arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7187 arvif->rate_ctrl[arg->tid] = arg->rate_ctrl; in ath10k_mac_set_tid_config()
7188 arvif->rate_code[arg->tid] = arg->rcode_flags; in ath10k_mac_set_tid_config()
7193 arvif->rtscts[arg->tid] = arg->rtscts_ctrl; in ath10k_mac_set_tid_config()
7194 arg->ext_tid_cfg_bitmap = 0; in ath10k_mac_set_tid_config()
7198 arvif->tid_conf_changed[arg->tid] |= changed; in ath10k_mac_set_tid_config()
7211 u32 changed = tid_conf->mask; in ath10k_mac_parse_tid_config()
7215 return -EINVAL; in ath10k_mac_parse_tid_config()
7218 if (!(tid_conf->tids & BIT(i))) { in ath10k_mac_parse_tid_config()
7223 arg->tid = i; in ath10k_mac_parse_tid_config()
7226 if (tid_conf->noack == NL80211_TID_CONFIG_ENABLE) { in ath10k_mac_parse_tid_config()
7227 arg->ack_policy = WMI_PEER_TID_CONFIG_NOACK; in ath10k_mac_parse_tid_config()
7228 arg->rate_ctrl = in ath10k_mac_parse_tid_config()
7230 arg->aggr_control = in ath10k_mac_parse_tid_config()
7233 arg->ack_policy = in ath10k_mac_parse_tid_config()
7235 arg->rate_ctrl = in ath10k_mac_parse_tid_config()
7237 arg->aggr_control = in ath10k_mac_parse_tid_config()
7243 arg->retry_count = tid_conf->retry_long; in ath10k_mac_parse_tid_config()
7246 if (tid_conf->noack == NL80211_TID_CONFIG_ENABLE) in ath10k_mac_parse_tid_config()
7247 arg->aggr_control = WMI_TID_CONFIG_AGGR_CONTROL_ENABLE; in ath10k_mac_parse_tid_config()
7249 arg->aggr_control = WMI_TID_CONFIG_AGGR_CONTROL_DISABLE; in ath10k_mac_parse_tid_config()
7255 &arg->rcode_flags, in ath10k_mac_parse_tid_config()
7256 &arg->rate_ctrl, in ath10k_mac_parse_tid_config()
7257 tid_conf->txrate_type, in ath10k_mac_parse_tid_config()
7258 &tid_conf->txrate_mask); in ath10k_mac_parse_tid_config()
7262 arg->rcode_flags = 0; in ath10k_mac_parse_tid_config()
7263 arg->rate_ctrl = 0; in ath10k_mac_parse_tid_config()
7268 if (tid_conf->rtscts) in ath10k_mac_parse_tid_config()
7269 arg->rtscts_ctrl = tid_conf->rtscts; in ath10k_mac_parse_tid_config()
7271 arg->ext_tid_cfg_bitmap = WMI_EXT_TID_RTS_CTS_CONFIG; in ath10k_mac_parse_tid_config()
7288 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_reset_tid_config()
7292 arg.vdev_id = arvif->vdev_id; in ath10k_mac_reset_tid_config()
7307 ether_addr_copy(arg.peer_macaddr.addr, sta->addr); in ath10k_mac_reset_tid_config()
7313 if (!arvif->tids_rst) { in ath10k_mac_reset_tid_config()
7314 arsta->retry_long[i] = -1; in ath10k_mac_reset_tid_config()
7315 arsta->noack[i] = -1; in ath10k_mac_reset_tid_config()
7316 arsta->ampdu[i] = -1; in ath10k_mac_reset_tid_config()
7317 arsta->rate_code[i] = -1; in ath10k_mac_reset_tid_config()
7318 arsta->rate_ctrl[i] = 0; in ath10k_mac_reset_tid_config()
7319 arsta->rtscts[i] = -1; in ath10k_mac_reset_tid_config()
7321 arvif->retry_long[i] = 0; in ath10k_mac_reset_tid_config()
7322 arvif->noack[i] = 0; in ath10k_mac_reset_tid_config()
7323 arvif->ampdu[i] = 0; in ath10k_mac_reset_tid_config()
7324 arvif->rate_code[i] = 0; in ath10k_mac_reset_tid_config()
7325 arvif->rate_ctrl[i] = 0; in ath10k_mac_reset_tid_config()
7326 arvif->rtscts[i] = 0; in ath10k_mac_reset_tid_config()
7349 arvif = arsta->arvif; in ath10k_sta_tid_cfg_wk()
7350 ar = arvif->ar; in ath10k_sta_tid_cfg_wk()
7352 mutex_lock(&ar->conf_mutex); in ath10k_sta_tid_cfg_wk()
7354 if (arvif->tids_rst) { in ath10k_sta_tid_cfg_wk()
7356 arvif->tids_rst); in ath10k_sta_tid_cfg_wk()
7360 ether_addr_copy(arg.peer_macaddr.addr, sta->addr); in ath10k_sta_tid_cfg_wk()
7364 changed = arvif->tid_conf_changed[i]; in ath10k_sta_tid_cfg_wk()
7367 if (arsta->noack[i] != -1) { in ath10k_sta_tid_cfg_wk()
7371 arg.ack_policy = arvif->noack[i]; in ath10k_sta_tid_cfg_wk()
7372 arg.aggr_control = arvif->ampdu[i]; in ath10k_sta_tid_cfg_wk()
7373 arg.rate_ctrl = arvif->rate_ctrl[i]; in ath10k_sta_tid_cfg_wk()
7378 if (arsta->retry_long[i] != -1 || in ath10k_sta_tid_cfg_wk()
7379 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7380 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7383 arg.retry_count = arvif->retry_long[i]; in ath10k_sta_tid_cfg_wk()
7389 if (arsta->ampdu[i] != -1 || in ath10k_sta_tid_cfg_wk()
7390 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7391 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7394 arg.aggr_control = arvif->ampdu[i]; in ath10k_sta_tid_cfg_wk()
7401 nss = ATH10K_HW_NSS(arvif->rate_code[i]); in ath10k_sta_tid_cfg_wk()
7403 arvif->rate_code[i], in ath10k_sta_tid_cfg_wk()
7406 arvif->rate_ctrl[i] > WMI_TID_CONFIG_RATE_CONTROL_AUTO) { in ath10k_sta_tid_cfg_wk()
7411 if (arsta->rate_ctrl[i] > in ath10k_sta_tid_cfg_wk()
7413 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7414 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7418 arg.rate_ctrl = arvif->rate_ctrl[i]; in ath10k_sta_tid_cfg_wk()
7419 arg.rcode_flags = arvif->rate_code[i]; in ath10k_sta_tid_cfg_wk()
7425 if (arsta->rtscts[i]) { in ath10k_sta_tid_cfg_wk()
7429 arg.rtscts_ctrl = arvif->rtscts[i] - 1; in ath10k_sta_tid_cfg_wk()
7442 sta->addr, ret); in ath10k_sta_tid_cfg_wk()
7453 mutex_unlock(&ar->conf_mutex); in ath10k_sta_tid_cfg_wk()
7459 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_vif_stations_tid_conf()
7461 struct ieee80211_vif *sta_vif = arsta->arvif->vif; in ath10k_mac_vif_stations_tid_conf()
7463 if (sta_vif != iter_data->curr_vif || !sta->wme) in ath10k_mac_vif_stations_tid_conf()
7466 ieee80211_queue_work(iter_data->ar->hw, &arsta->tid_config_wk); in ath10k_mac_vif_stations_tid_conf()
7475 struct ath10k *ar = hw->priv; in ath10k_sta_state()
7476 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_state()
7477 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_state()
7485 arsta->arvif = arvif; in ath10k_sta_state()
7486 arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED; in ath10k_sta_state()
7487 INIT_WORK(&arsta->update_wk, ath10k_sta_rc_update_wk); in ath10k_sta_state()
7488 INIT_WORK(&arsta->tid_config_wk, ath10k_sta_tid_cfg_wk); in ath10k_sta_state()
7490 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) in ath10k_sta_state()
7491 ath10k_mac_txq_init(sta->txq[i]); in ath10k_sta_state()
7497 cancel_work_sync(&arsta->update_wk); in ath10k_sta_state()
7498 cancel_work_sync(&arsta->tid_config_wk); in ath10k_sta_state()
7501 mutex_lock(&ar->conf_mutex); in ath10k_sta_state()
7513 arvif->vdev_id, sta->addr, in ath10k_sta_state()
7514 ar->num_stations + 1, ar->max_num_stations, in ath10k_sta_state()
7515 ar->num_peers + 1, ar->max_num_peers); in ath10k_sta_state()
7519 if (sta->tdls) { in ath10k_sta_state()
7520 if (num_tdls_stations >= ar->max_num_tdls_vdevs) { in ath10k_sta_state()
7522 arvif->vdev_id, in ath10k_sta_state()
7523 ar->max_num_tdls_vdevs); in ath10k_sta_state()
7524 ret = -ELNRNG; in ath10k_sta_state()
7533 ar->max_num_stations); in ath10k_sta_state()
7538 arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), in ath10k_sta_state()
7540 if (!arsta->tx_stats) { in ath10k_sta_state()
7542 ret = -ENOMEM; in ath10k_sta_state()
7547 ret = ath10k_peer_create(ar, vif, sta, arvif->vdev_id, in ath10k_sta_state()
7548 sta->addr, peer_type); in ath10k_sta_state()
7551 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7553 kfree(arsta->tx_stats); in ath10k_sta_state()
7557 spin_lock_bh(&ar->data_lock); in ath10k_sta_state()
7559 peer = ath10k_peer_find(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7562 vif->addr, arvif->vdev_id); in ath10k_sta_state()
7563 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7564 ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7566 kfree(arsta->tx_stats); in ath10k_sta_state()
7567 ret = -ENOENT; in ath10k_sta_state()
7571 arsta->peer_id = find_first_bit(peer->peer_ids, in ath10k_sta_state()
7574 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7576 if (!sta->tdls) in ath10k_sta_state()
7579 ret = ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7583 arvif->vdev_id, ret); in ath10k_sta_state()
7584 ath10k_peer_delete(ar, arvif->vdev_id, in ath10k_sta_state()
7585 sta->addr); in ath10k_sta_state()
7587 kfree(arsta->tx_stats); in ath10k_sta_state()
7591 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, sta, in ath10k_sta_state()
7596 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7597 ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7599 kfree(arsta->tx_stats); in ath10k_sta_state()
7603 ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7613 arvif->vdev_id, sta->addr, sta); in ath10k_sta_state()
7615 if (sta->tdls) { in ath10k_sta_state()
7616 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, in ath10k_sta_state()
7621 sta->addr, in ath10k_sta_state()
7625 ret = ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7628 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7632 spin_lock_bh(&ar->data_lock); in ath10k_sta_state()
7633 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_sta_state()
7634 peer = ar->peer_map[i]; in ath10k_sta_state()
7638 if (peer->sta == sta) { in ath10k_sta_state()
7640 sta->addr, peer, i, arvif->vdev_id); in ath10k_sta_state()
7641 peer->sta = NULL; in ath10k_sta_state()
7649 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7652 kfree(arsta->tx_stats); in ath10k_sta_state()
7653 arsta->tx_stats = NULL; in ath10k_sta_state()
7656 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) in ath10k_sta_state()
7657 ath10k_mac_txq_unref(ar, sta->txq[i]); in ath10k_sta_state()
7659 if (!sta->tdls) in ath10k_sta_state()
7666 ret = ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7670 arvif->vdev_id, ret); in ath10k_sta_state()
7674 (vif->type == NL80211_IFTYPE_AP || in ath10k_sta_state()
7675 vif->type == NL80211_IFTYPE_MESH_POINT || in ath10k_sta_state()
7676 vif->type == NL80211_IFTYPE_ADHOC)) { in ath10k_sta_state()
7681 sta->addr); in ath10k_sta_state()
7686 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7689 sta->tdls) { in ath10k_sta_state()
7694 sta->addr); in ath10k_sta_state()
7699 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7703 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, sta, in ath10k_sta_state()
7707 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7710 (vif->type == NL80211_IFTYPE_AP || in ath10k_sta_state()
7711 vif->type == NL80211_IFTYPE_MESH_POINT || in ath10k_sta_state()
7712 vif->type == NL80211_IFTYPE_ADHOC)) { in ath10k_sta_state()
7717 sta->addr); in ath10k_sta_state()
7722 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7725 mutex_unlock(&ar->conf_mutex); in ath10k_sta_state()
7732 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_conf_tx_uapsd()
7738 lockdep_assert_held(&ar->conf_mutex); in ath10k_conf_tx_uapsd()
7740 if (arvif->vdev_type != WMI_VDEV_TYPE_STA) in ath10k_conf_tx_uapsd()
7771 arvif->u.sta.uapsd |= value; in ath10k_conf_tx_uapsd()
7773 arvif->u.sta.uapsd &= ~value; in ath10k_conf_tx_uapsd()
7775 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7777 arvif->u.sta.uapsd); in ath10k_conf_tx_uapsd()
7783 if (arvif->u.sta.uapsd) in ath10k_conf_tx_uapsd()
7788 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7797 arvif->vdev_id, ret); in ath10k_conf_tx_uapsd()
7804 arvif->vdev_id, ret); in ath10k_conf_tx_uapsd()
7808 if (test_bit(WMI_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG, ar->wmi.svc_map) || in ath10k_conf_tx_uapsd()
7809 test_bit(WMI_SERVICE_STA_UAPSD_VAR_AUTO_TRIG, ar->wmi.svc_map)) { in ath10k_conf_tx_uapsd()
7811 * trigger frame. The following effectively disables u-UAPSD in ath10k_conf_tx_uapsd()
7822 ret = ath10k_wmi_vdev_sta_uapsd(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7823 arvif->bssid, &arg, 1); in ath10k_conf_tx_uapsd()
7840 struct ath10k *ar = hw->priv; in ath10k_conf_tx()
7841 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_conf_tx()
7845 mutex_lock(&ar->conf_mutex); in ath10k_conf_tx()
7849 p = &arvif->wmm_params.ac_vo; in ath10k_conf_tx()
7852 p = &arvif->wmm_params.ac_vi; in ath10k_conf_tx()
7855 p = &arvif->wmm_params.ac_be; in ath10k_conf_tx()
7858 p = &arvif->wmm_params.ac_bk; in ath10k_conf_tx()
7863 ret = -EINVAL; in ath10k_conf_tx()
7867 p->cwmin = params->cw_min; in ath10k_conf_tx()
7868 p->cwmax = params->cw_max; in ath10k_conf_tx()
7869 p->aifs = params->aifs; in ath10k_conf_tx()
7876 p->txop = params->txop * 32; in ath10k_conf_tx()
7878 if (ar->wmi.ops->gen_vdev_wmm_conf) { in ath10k_conf_tx()
7879 ret = ath10k_wmi_vdev_wmm_conf(ar, arvif->vdev_id, in ath10k_conf_tx()
7880 &arvif->wmm_params); in ath10k_conf_tx()
7883 arvif->vdev_id, ret); in ath10k_conf_tx()
7887 /* This won't work well with multi-interface cases but it's in ath10k_conf_tx()
7890 ret = ath10k_wmi_pdev_set_wmm_params(ar, &arvif->wmm_params); in ath10k_conf_tx()
7897 ret = ath10k_conf_tx_uapsd(ar, vif, ac, params->uapsd); in ath10k_conf_tx()
7902 mutex_unlock(&ar->conf_mutex); in ath10k_conf_tx()
7912 struct ath10k *ar = hw->priv; in ath10k_remain_on_channel()
7913 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_remain_on_channel()
7918 mutex_lock(&ar->conf_mutex); in ath10k_remain_on_channel()
7921 ret = -EBUSY; in ath10k_remain_on_channel()
7925 spin_lock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7926 switch (ar->scan.state) { in ath10k_remain_on_channel()
7928 reinit_completion(&ar->scan.started); in ath10k_remain_on_channel()
7929 reinit_completion(&ar->scan.completed); in ath10k_remain_on_channel()
7930 reinit_completion(&ar->scan.on_channel); in ath10k_remain_on_channel()
7931 ar->scan.state = ATH10K_SCAN_STARTING; in ath10k_remain_on_channel()
7932 ar->scan.is_roc = true; in ath10k_remain_on_channel()
7933 ar->scan.vdev_id = arvif->vdev_id; in ath10k_remain_on_channel()
7934 ar->scan.roc_freq = chan->center_freq; in ath10k_remain_on_channel()
7935 ar->scan.roc_notify = true; in ath10k_remain_on_channel()
7941 ret = -EBUSY; in ath10k_remain_on_channel()
7944 spin_unlock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7949 scan_time_msec = ar->hw->wiphy->max_remain_on_channel_duration * 2; in ath10k_remain_on_channel()
7953 arg.vdev_id = arvif->vdev_id; in ath10k_remain_on_channel()
7956 arg.channels[0] = chan->center_freq; in ath10k_remain_on_channel()
7967 spin_lock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7968 ar->scan.state = ATH10K_SCAN_IDLE; in ath10k_remain_on_channel()
7969 spin_unlock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7973 ret = wait_for_completion_timeout(&ar->scan.on_channel, 3 * HZ); in ath10k_remain_on_channel()
7981 ret = -ETIMEDOUT; in ath10k_remain_on_channel()
7985 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath10k_remain_on_channel()
7990 mutex_unlock(&ar->conf_mutex); in ath10k_remain_on_channel()
7997 struct ath10k *ar = hw->priv; in ath10k_cancel_remain_on_channel()
7999 mutex_lock(&ar->conf_mutex); in ath10k_cancel_remain_on_channel()
8001 spin_lock_bh(&ar->data_lock); in ath10k_cancel_remain_on_channel()
8002 ar->scan.roc_notify = false; in ath10k_cancel_remain_on_channel()
8003 spin_unlock_bh(&ar->data_lock); in ath10k_cancel_remain_on_channel()
8007 mutex_unlock(&ar->conf_mutex); in ath10k_cancel_remain_on_channel()
8009 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_cancel_remain_on_channel()
8015 * Both RTS and Fragmentation threshold are interface-specific
8016 * in ath10k, but device-specific in mac80211.
8021 struct ath10k *ar = hw->priv; in ath10k_set_rts_threshold()
8025 mutex_lock(&ar->conf_mutex); in ath10k_set_rts_threshold()
8026 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_set_rts_threshold()
8028 arvif->vdev_id, value); in ath10k_set_rts_threshold()
8033 arvif->vdev_id, ret); in ath10k_set_rts_threshold()
8037 mutex_unlock(&ar->conf_mutex); in ath10k_set_rts_threshold()
8054 return -EOPNOTSUPP; in ath10k_mac_op_set_frag_threshold()
8066 if (ar->state == ATH10K_STATE_WEDGED) in ath10k_mac_wait_tx_complete()
8069 time_left = wait_event_timeout(ar->htt.empty_tx_wq, ({ in ath10k_mac_wait_tx_complete()
8072 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_wait_tx_complete()
8073 empty = (ar->htt.num_pending_tx == 0); in ath10k_mac_wait_tx_complete()
8074 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_wait_tx_complete()
8076 skip = (ar->state == ATH10K_STATE_WEDGED) || in ath10k_mac_wait_tx_complete()
8078 &ar->dev_flags); in ath10k_mac_wait_tx_complete()
8084 ath10k_warn(ar, "failed to flush transmit queue (skip %i ar-state %i): %ld\n", in ath10k_mac_wait_tx_complete()
8085 skip, ar->state, time_left); in ath10k_mac_wait_tx_complete()
8091 struct ath10k *ar = hw->priv; in ath10k_flush()
8096 if (vif && vif->type == NL80211_IFTYPE_STATION) { in ath10k_flush()
8098 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_flush()
8099 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath10k_flush()
8100 ath10k_wmi_peer_flush(ar, arvif->vdev_id, in ath10k_flush()
8101 arvif->bssid, bitmap); in ath10k_flush()
8103 ath10k_htt_flush_tx(&ar->htt); in ath10k_flush()
8108 mutex_lock(&ar->conf_mutex); in ath10k_flush()
8110 mutex_unlock(&ar->conf_mutex); in ath10k_flush()
8125 struct ath10k *ar = hw->priv; in ath10k_reconfig_complete()
8131 mutex_lock(&ar->conf_mutex); in ath10k_reconfig_complete()
8136 if (ar->state == ATH10K_STATE_RESTARTED) { in ath10k_reconfig_complete()
8138 ar->state = ATH10K_STATE_ON; in ath10k_reconfig_complete()
8139 ieee80211_wake_queues(ar->hw); in ath10k_reconfig_complete()
8140 clear_bit(ATH10K_FLAG_RESTARTING, &ar->dev_flags); in ath10k_reconfig_complete()
8141 if (ar->hw_params.hw_restart_disconnect) { in ath10k_reconfig_complete()
8142 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_reconfig_complete()
8143 if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath10k_reconfig_complete()
8144 ieee80211_hw_restart_disconnect(arvif->vif); in ath10k_reconfig_complete()
8149 mutex_unlock(&ar->conf_mutex); in ath10k_reconfig_complete()
8159 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_bss_chan_survey()
8161 if (!test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map) || in ath10k_mac_update_bss_chan_survey()
8162 (ar->rx_channel != channel)) in ath10k_mac_update_bss_chan_survey()
8165 if (ar->scan.state != ATH10K_SCAN_IDLE) { in ath10k_mac_update_bss_chan_survey()
8170 reinit_completion(&ar->bss_survey_done); in ath10k_mac_update_bss_chan_survey()
8178 ret = wait_for_completion_timeout(&ar->bss_survey_done, 3 * HZ); in ath10k_mac_update_bss_chan_survey()
8188 struct ath10k *ar = hw->priv; in ath10k_get_survey()
8190 struct survey_info *ar_survey = &ar->survey[idx]; in ath10k_get_survey()
8193 mutex_lock(&ar->conf_mutex); in ath10k_get_survey()
8195 sband = hw->wiphy->bands[NL80211_BAND_2GHZ]; in ath10k_get_survey()
8196 if (sband && idx >= sband->n_channels) { in ath10k_get_survey()
8197 idx -= sband->n_channels; in ath10k_get_survey()
8202 sband = hw->wiphy->bands[NL80211_BAND_5GHZ]; in ath10k_get_survey()
8204 if (!sband || idx >= sband->n_channels) { in ath10k_get_survey()
8205 ret = -ENOENT; in ath10k_get_survey()
8209 ath10k_mac_update_bss_chan_survey(ar, &sband->channels[idx]); in ath10k_get_survey()
8211 spin_lock_bh(&ar->data_lock); in ath10k_get_survey()
8213 spin_unlock_bh(&ar->data_lock); in ath10k_get_survey()
8215 survey->channel = &sband->channels[idx]; in ath10k_get_survey()
8217 if (ar->rx_channel == survey->channel) in ath10k_get_survey()
8218 survey->filled |= SURVEY_INFO_IN_USE; in ath10k_get_survey()
8221 mutex_unlock(&ar->conf_mutex); in ath10k_get_survey()
8231 struct ieee80211_supported_band *sband = &ar->mac.sbands[band]; in ath10k_mac_bitrate_mask_get_single_nss()
8232 u16 vht_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map); in ath10k_mac_bitrate_mask_get_single_nss()
8237 if (mask->control[band].legacy) in ath10k_mac_bitrate_mask_get_single_nss()
8240 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_nss()
8241 if (mask->control[band].ht_mcs[i] == 0) in ath10k_mac_bitrate_mask_get_single_nss()
8243 else if (mask->control[band].ht_mcs[i] == in ath10k_mac_bitrate_mask_get_single_nss()
8244 sband->ht_cap.mcs.rx_mask[i]) in ath10k_mac_bitrate_mask_get_single_nss()
8250 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_nss()
8251 if (mask->control[band].vht_mcs[i] == 0) in ath10k_mac_bitrate_mask_get_single_nss()
8253 else if (mask->control[band].vht_mcs[i] == in ath10k_mac_bitrate_mask_get_single_nss()
8266 if (BIT(fls(ht_nss_mask)) - 1 != ht_nss_mask) in ath10k_mac_bitrate_mask_get_single_nss()
8277 struct ath10k *ar = arvif->ar; in ath10k_mac_set_fixed_rate_params()
8281 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_set_fixed_rate_params()
8284 arvif->vdev_id, rate, nss, sgi); in ath10k_mac_set_fixed_rate_params()
8286 vdev_param = ar->wmi.vdev_param->fixed_rate; in ath10k_mac_set_fixed_rate_params()
8287 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, rate); in ath10k_mac_set_fixed_rate_params()
8294 vdev_param = ar->wmi.vdev_param->nss; in ath10k_mac_set_fixed_rate_params()
8295 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, nss); in ath10k_mac_set_fixed_rate_params()
8301 vdev_param = ar->wmi.vdev_param->sgi; in ath10k_mac_set_fixed_rate_params()
8302 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, sgi); in ath10k_mac_set_fixed_rate_params()
8308 vdev_param = ar->wmi.vdev_param->ldpc; in ath10k_mac_set_fixed_rate_params()
8309 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, ldpc); in ath10k_mac_set_fixed_rate_params()
8329 * ranges can be used: none, 0-7, 0-8 and 0-9. in ath10k_mac_can_set_bitrate_mask()
8332 vht_mcs = mask->control[band].vht_mcs[i]; in ath10k_mac_can_set_bitrate_mask()
8336 case BIT(8) - 1: in ath10k_mac_can_set_bitrate_mask()
8337 case BIT(9) - 1: in ath10k_mac_can_set_bitrate_mask()
8338 case BIT(10) - 1: in ath10k_mac_can_set_bitrate_mask()
8342 ath10k_warn(ar, "refusing bitrate mask with missing 0-7 VHT MCS rates\n"); in ath10k_mac_can_set_bitrate_mask()
8355 u8 rate = arvif->vht_pfr; in ath10k_mac_set_vht_bitrate_mask_fixup()
8358 if (!sta->deflink.vht_cap.vht_supported || arvif->vht_num_rates != 1) in ath10k_mac_set_vht_bitrate_mask_fixup()
8361 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_mac_set_vht_bitrate_mask_fixup()
8365 sta->addr, err); in ath10k_mac_set_vht_bitrate_mask_fixup()
8374 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_set_bitrate_mask_iter()
8375 struct ath10k *ar = arvif->ar; in ath10k_mac_set_bitrate_mask_iter()
8377 if (arsta->arvif != arvif) in ath10k_mac_set_bitrate_mask_iter()
8383 spin_lock_bh(&ar->data_lock); in ath10k_mac_set_bitrate_mask_iter()
8384 arsta->changed |= IEEE80211_RC_SUPP_RATES_CHANGED; in ath10k_mac_set_bitrate_mask_iter()
8385 spin_unlock_bh(&ar->data_lock); in ath10k_mac_set_bitrate_mask_iter()
8387 ieee80211_queue_work(ar->hw, &arsta->update_wk); in ath10k_mac_set_bitrate_mask_iter()
8394 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_clr_bitrate_mask_iter()
8395 struct ath10k *ar = arvif->ar; in ath10k_mac_clr_bitrate_mask_iter()
8399 if (arsta->arvif != arvif || !sta->deflink.vht_cap.vht_supported) in ath10k_mac_clr_bitrate_mask_iter()
8402 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_mac_clr_bitrate_mask_iter()
8407 sta->addr, err); in ath10k_mac_clr_bitrate_mask_iter()
8414 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_set_bitrate_mask()
8416 struct ath10k *ar = arvif->ar; in ath10k_mac_op_set_bitrate_mask()
8431 return -EPERM; in ath10k_mac_op_set_bitrate_mask()
8433 band = def.chan->band; in ath10k_mac_op_set_bitrate_mask()
8434 ht_mcs_mask = mask->control[band].ht_mcs; in ath10k_mac_op_set_bitrate_mask()
8435 vht_mcs_mask = mask->control[band].vht_mcs; in ath10k_mac_op_set_bitrate_mask()
8436 ldpc = !!(ar->ht_cap_info & WMI_HT_CAP_LDPC); in ath10k_mac_op_set_bitrate_mask()
8438 sgi = mask->control[band].gi; in ath10k_mac_op_set_bitrate_mask()
8440 return -EINVAL; in ath10k_mac_op_set_bitrate_mask()
8443 ar->normal_mode_fw.fw_file.fw_features); in ath10k_mac_op_set_bitrate_mask()
8445 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8446 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_mac_op_set_bitrate_mask()
8449 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8459 arvif->vdev_id, ret); in ath10k_mac_op_set_bitrate_mask()
8468 nss = min(ar->num_rf_chains, in ath10k_mac_op_set_bitrate_mask()
8480 return -EINVAL; in ath10k_mac_op_set_bitrate_mask()
8497 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8500 arvif->bitrate_mask = *mask; in ath10k_mac_op_set_bitrate_mask()
8501 arvif->vht_num_rates = vht_num_rates; in ath10k_mac_op_set_bitrate_mask()
8502 arvif->vht_pfr = vht_pfr; in ath10k_mac_op_set_bitrate_mask()
8503 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_mac_op_set_bitrate_mask()
8507 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8510 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8515 arvif->vdev_id, ret); in ath10k_mac_op_set_bitrate_mask()
8520 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8530 struct ath10k *ar = hw->priv; in ath10k_sta_rc_update()
8531 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_rc_update()
8532 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_rc_update()
8536 spin_lock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8538 peer = ath10k_peer_find(ar, arvif->vdev_id, sta->addr); in ath10k_sta_rc_update()
8540 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8542 sta->addr, arvif->vdev_id); in ath10k_sta_rc_update()
8548 sta->addr, changed, sta->deflink.bandwidth, in ath10k_sta_rc_update()
8549 sta->deflink.rx_nss, in ath10k_sta_rc_update()
8550 sta->deflink.smps_mode); in ath10k_sta_rc_update()
8555 switch (sta->deflink.bandwidth) { in ath10k_sta_rc_update()
8570 sta->deflink.bandwidth, sta->addr); in ath10k_sta_rc_update()
8575 arsta->bw = bw; in ath10k_sta_rc_update()
8579 arsta->nss = sta->deflink.rx_nss; in ath10k_sta_rc_update()
8584 switch (sta->deflink.smps_mode) { in ath10k_sta_rc_update()
8597 sta->deflink.smps_mode, sta->addr); in ath10k_sta_rc_update()
8602 arsta->smps = smps; in ath10k_sta_rc_update()
8605 arsta->changed |= changed; in ath10k_sta_rc_update()
8607 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8609 ieee80211_queue_work(hw, &arsta->update_wk); in ath10k_sta_rc_update()
8615 struct ath10k *ar = hw->priv; in ath10k_offset_tsf()
8616 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_offset_tsf()
8621 vdev_param = ar->wmi.vdev_param->dec_tsf; in ath10k_offset_tsf()
8622 offset = -tsf_offset; in ath10k_offset_tsf()
8624 vdev_param = ar->wmi.vdev_param->inc_tsf; in ath10k_offset_tsf()
8628 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_offset_tsf()
8631 if (ret && ret != -EOPNOTSUPP) in ath10k_offset_tsf()
8640 struct ath10k *ar = hw->priv; in ath10k_ampdu_action()
8641 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_ampdu_action()
8642 struct ieee80211_sta *sta = params->sta; in ath10k_ampdu_action()
8643 enum ieee80211_ampdu_mlme_action action = params->action; in ath10k_ampdu_action()
8644 u16 tid = params->tid; in ath10k_ampdu_action()
8647 arvif->vdev_id, sta->addr, tid, action); in ath10k_ampdu_action()
8667 return -EOPNOTSUPP; in ath10k_ampdu_action()
8670 return -EINVAL; in ath10k_ampdu_action()
8681 /* Both locks are required because ar->rx_channel is modified. This in ath10k_mac_update_rx_channel()
8684 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_rx_channel()
8685 lockdep_assert_held(&ar->data_lock); in ath10k_mac_update_rx_channel()
8691 * on a linked list now. Doing a lookup peer -> vif -> chanctx for each in ath10k_mac_update_rx_channel()
8692 * ppdu on Rx may reduce performance on low-end systems. It should be in ath10k_mac_update_rx_channel()
8696 * only for multi-channel cases. Single-channel cases will remain to in ath10k_mac_update_rx_channel()
8702 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_update_rx_channel()
8707 def = &vifs[0].new_ctx->def; in ath10k_mac_update_rx_channel()
8709 ar->rx_channel = def->chan; in ath10k_mac_update_rx_channel()
8711 (ctx && (ar->state == ATH10K_STATE_RESTARTED))) { in ath10k_mac_update_rx_channel()
8717 ar->rx_channel = ctx->def.chan; in ath10k_mac_update_rx_channel()
8719 ar->rx_channel = NULL; in ath10k_mac_update_rx_channel()
8733 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_vif_chan()
8738 if (ar->monitor_started) in ath10k_mac_update_vif_chan()
8742 arvif = (void *)vifs[i].vif->drv_priv; in ath10k_mac_update_vif_chan()
8745 "mac chanctx switch vdev_id %i freq %u->%u width %d->%d\n", in ath10k_mac_update_vif_chan()
8746 arvif->vdev_id, in ath10k_mac_update_vif_chan()
8747 vifs[i].old_ctx->def.chan->center_freq, in ath10k_mac_update_vif_chan()
8748 vifs[i].new_ctx->def.chan->center_freq, in ath10k_mac_update_vif_chan()
8749 vifs[i].old_ctx->def.width, in ath10k_mac_update_vif_chan()
8750 vifs[i].new_ctx->def.width); in ath10k_mac_update_vif_chan()
8752 if (WARN_ON(!arvif->is_started)) in ath10k_mac_update_vif_chan()
8755 if (WARN_ON(!arvif->is_up)) in ath10k_mac_update_vif_chan()
8758 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_update_vif_chan()
8761 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8770 spin_lock_bh(&ar->data_lock); in ath10k_mac_update_vif_chan()
8772 spin_unlock_bh(&ar->data_lock); in ath10k_mac_update_vif_chan()
8775 arvif = (void *)vifs[i].vif->drv_priv; in ath10k_mac_update_vif_chan()
8777 if (WARN_ON(!arvif->is_started)) in ath10k_mac_update_vif_chan()
8780 if (WARN_ON(!arvif->is_up)) in ath10k_mac_update_vif_chan()
8793 ret = ath10k_vdev_restart(arvif, &vifs[i].new_ctx->def); in ath10k_mac_update_vif_chan()
8796 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8800 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_mac_update_vif_chan()
8801 arvif->bssid); in ath10k_mac_update_vif_chan()
8804 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8816 struct ath10k *ar = hw->priv; in ath10k_mac_op_add_chanctx()
8820 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath10k_mac_op_add_chanctx()
8822 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_add_chanctx()
8824 spin_lock_bh(&ar->data_lock); in ath10k_mac_op_add_chanctx()
8826 spin_unlock_bh(&ar->data_lock); in ath10k_mac_op_add_chanctx()
8831 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_add_chanctx()
8840 struct ath10k *ar = hw->priv; in ath10k_mac_op_remove_chanctx()
8844 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath10k_mac_op_remove_chanctx()
8846 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_remove_chanctx()
8848 spin_lock_bh(&ar->data_lock); in ath10k_mac_op_remove_chanctx()
8850 spin_unlock_bh(&ar->data_lock); in ath10k_mac_op_remove_chanctx()
8855 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_remove_chanctx()
8871 if (rcu_access_pointer(vif->bss_conf.chanctx_conf) != arg->ctx) in ath10k_mac_change_chanctx_cnt_iter()
8874 arg->n_vifs++; in ath10k_mac_change_chanctx_cnt_iter()
8884 ctx = rcu_access_pointer(vif->bss_conf.chanctx_conf); in ath10k_mac_change_chanctx_fill_iter()
8885 if (ctx != arg->ctx) in ath10k_mac_change_chanctx_fill_iter()
8888 if (WARN_ON(arg->next_vif == arg->n_vifs)) in ath10k_mac_change_chanctx_fill_iter()
8891 arg->vifs[arg->next_vif].vif = vif; in ath10k_mac_change_chanctx_fill_iter()
8892 arg->vifs[arg->next_vif].old_ctx = ctx; in ath10k_mac_change_chanctx_fill_iter()
8893 arg->vifs[arg->next_vif].new_ctx = ctx; in ath10k_mac_change_chanctx_fill_iter()
8894 arg->next_vif++; in ath10k_mac_change_chanctx_fill_iter()
8902 struct ath10k *ar = hw->priv; in ath10k_mac_op_change_chanctx()
8905 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_change_chanctx()
8909 ctx->def.chan->center_freq, ctx->def.width, ctx, changed); in ath10k_mac_op_change_chanctx()
8946 * definitions per vdev internally and there's no host-side channel in ath10k_mac_op_change_chanctx()
8951 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_change_chanctx()
8960 struct ath10k *ar = hw->priv; in ath10k_mac_op_assign_vif_chanctx()
8961 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_assign_vif_chanctx()
8964 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8968 ctx, arvif->vdev_id); in ath10k_mac_op_assign_vif_chanctx()
8970 if (WARN_ON(arvif->is_started)) { in ath10k_mac_op_assign_vif_chanctx()
8971 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8972 return -EBUSY; in ath10k_mac_op_assign_vif_chanctx()
8975 ret = ath10k_vdev_start(arvif, &ctx->def); in ath10k_mac_op_assign_vif_chanctx()
8978 arvif->vdev_id, vif->addr, in ath10k_mac_op_assign_vif_chanctx()
8979 ctx->def.chan->center_freq, ret); in ath10k_mac_op_assign_vif_chanctx()
8983 arvif->is_started = true; in ath10k_mac_op_assign_vif_chanctx()
8988 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
8992 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_mac_op_assign_vif_chanctx()
8993 ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, 0, vif->addr); in ath10k_mac_op_assign_vif_chanctx()
8996 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
9000 arvif->is_up = true; in ath10k_mac_op_assign_vif_chanctx()
9007 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
9011 ar->hw_params.tx_stats_over_pktlog) { in ath10k_mac_op_assign_vif_chanctx()
9012 ar->pktlog_filter |= ATH10K_PKTLOG_PEER_STATS; in ath10k_mac_op_assign_vif_chanctx()
9014 ar->pktlog_filter); in ath10k_mac_op_assign_vif_chanctx()
9021 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
9026 arvif->is_started = false; in ath10k_mac_op_assign_vif_chanctx()
9030 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
9040 struct ath10k *ar = hw->priv; in ath10k_mac_op_unassign_vif_chanctx()
9041 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_unassign_vif_chanctx()
9044 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_unassign_vif_chanctx()
9048 ctx, arvif->vdev_id); in ath10k_mac_op_unassign_vif_chanctx()
9050 WARN_ON(!arvif->is_started); in ath10k_mac_op_unassign_vif_chanctx()
9052 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_mac_op_unassign_vif_chanctx()
9053 WARN_ON(!arvif->is_up); in ath10k_mac_op_unassign_vif_chanctx()
9055 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_op_unassign_vif_chanctx()
9058 arvif->vdev_id, ret); in ath10k_mac_op_unassign_vif_chanctx()
9060 arvif->is_up = false; in ath10k_mac_op_unassign_vif_chanctx()
9066 arvif->vdev_id, ret); in ath10k_mac_op_unassign_vif_chanctx()
9068 arvif->is_started = false; in ath10k_mac_op_unassign_vif_chanctx()
9070 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_unassign_vif_chanctx()
9079 struct ath10k *ar = hw->priv; in ath10k_mac_op_switch_vif_chanctx()
9081 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_switch_vif_chanctx()
9088 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_switch_vif_chanctx()
9099 ar = hw->priv; in ath10k_mac_op_sta_pre_rcu_remove()
9101 list_for_each_entry(peer, &ar->peers, list) in ath10k_mac_op_sta_pre_rcu_remove()
9102 if (peer->sta == sta) in ath10k_mac_op_sta_pre_rcu_remove()
9103 peer->removed = true; in ath10k_mac_op_sta_pre_rcu_remove()
9188 index = mcs - len_nss1; in ath10k_mac_get_rate_flags_ht()
9280 rate->flags = flags; in ath10k_mac_parse_bitrate()
9281 rate->bw = bw; in ath10k_mac_parse_bitrate()
9282 rate->legacy = bitrate_kbps / 100; in ath10k_mac_parse_bitrate()
9283 rate->nss = nss; in ath10k_mac_parse_bitrate()
9284 rate->mcs = mcs; in ath10k_mac_parse_bitrate()
9291 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_sta_get_peer_stats_info()
9296 if (!(ar->hw_params.supports_peer_stats_info && in ath10k_mac_sta_get_peer_stats_info()
9297 arsta->arvif->vdev_type == WMI_VDEV_TYPE_STA)) in ath10k_mac_sta_get_peer_stats_info()
9300 spin_lock_bh(&ar->data_lock); in ath10k_mac_sta_get_peer_stats_info()
9301 peer = ath10k_peer_find(ar, arsta->arvif->vdev_id, sta->addr); in ath10k_mac_sta_get_peer_stats_info()
9302 spin_unlock_bh(&ar->data_lock); in ath10k_mac_sta_get_peer_stats_info()
9306 reinit_completion(&ar->peer_stats_info_complete); in ath10k_mac_sta_get_peer_stats_info()
9309 arsta->arvif->vdev_id, in ath10k_mac_sta_get_peer_stats_info()
9311 arsta->arvif->bssid, in ath10k_mac_sta_get_peer_stats_info()
9313 if (ret && ret != -EOPNOTSUPP) { in ath10k_mac_sta_get_peer_stats_info()
9318 time_left = wait_for_completion_timeout(&ar->peer_stats_info_complete, 3 * HZ); in ath10k_mac_sta_get_peer_stats_info()
9324 if (arsta->rx_rate_code != 0 && arsta->rx_bitrate_kbps != 0) { in ath10k_mac_sta_get_peer_stats_info()
9325 ath10k_mac_parse_bitrate(ar, arsta->rx_rate_code, in ath10k_mac_sta_get_peer_stats_info()
9326 arsta->rx_bitrate_kbps, in ath10k_mac_sta_get_peer_stats_info()
9327 &sinfo->rxrate); in ath10k_mac_sta_get_peer_stats_info()
9329 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); in ath10k_mac_sta_get_peer_stats_info()
9330 arsta->rx_rate_code = 0; in ath10k_mac_sta_get_peer_stats_info()
9331 arsta->rx_bitrate_kbps = 0; in ath10k_mac_sta_get_peer_stats_info()
9334 if (arsta->tx_rate_code != 0 && arsta->tx_bitrate_kbps != 0) { in ath10k_mac_sta_get_peer_stats_info()
9335 ath10k_mac_parse_bitrate(ar, arsta->tx_rate_code, in ath10k_mac_sta_get_peer_stats_info()
9336 arsta->tx_bitrate_kbps, in ath10k_mac_sta_get_peer_stats_info()
9337 &sinfo->txrate); in ath10k_mac_sta_get_peer_stats_info()
9339 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in ath10k_mac_sta_get_peer_stats_info()
9340 arsta->tx_rate_code = 0; in ath10k_mac_sta_get_peer_stats_info()
9341 arsta->tx_bitrate_kbps = 0; in ath10k_mac_sta_get_peer_stats_info()
9350 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_statistics()
9351 struct ath10k *ar = arsta->arvif->ar; in ath10k_sta_statistics()
9356 mutex_lock(&ar->conf_mutex); in ath10k_sta_statistics()
9358 mutex_unlock(&ar->conf_mutex); in ath10k_sta_statistics()
9360 sinfo->rx_duration = arsta->rx_duration; in ath10k_sta_statistics()
9361 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION); in ath10k_sta_statistics()
9363 if (arsta->txrate.legacy || arsta->txrate.nss) { in ath10k_sta_statistics()
9364 if (arsta->txrate.legacy) { in ath10k_sta_statistics()
9365 sinfo->txrate.legacy = arsta->txrate.legacy; in ath10k_sta_statistics()
9367 sinfo->txrate.mcs = arsta->txrate.mcs; in ath10k_sta_statistics()
9368 sinfo->txrate.nss = arsta->txrate.nss; in ath10k_sta_statistics()
9369 sinfo->txrate.bw = arsta->txrate.bw; in ath10k_sta_statistics()
9371 sinfo->txrate.flags = arsta->txrate.flags; in ath10k_sta_statistics()
9372 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in ath10k_sta_statistics()
9375 if (ar->htt.disable_tx_comp) { in ath10k_sta_statistics()
9376 sinfo->tx_failed = arsta->tx_failed; in ath10k_sta_statistics()
9377 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); in ath10k_sta_statistics()
9380 sinfo->tx_retries = arsta->tx_retries; in ath10k_sta_statistics()
9381 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES); in ath10k_sta_statistics()
9391 struct ath10k *ar = hw->priv; in ath10k_mac_op_set_tid_config()
9392 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_set_tid_config()
9397 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_tid_config()
9398 arg.vdev_id = arvif->vdev_id; in ath10k_mac_op_set_tid_config()
9400 arvif->tids_rst = 0; in ath10k_mac_op_set_tid_config()
9401 memset(arvif->tid_conf_changed, 0, sizeof(arvif->tid_conf_changed)); in ath10k_mac_op_set_tid_config()
9403 for (i = 0; i < tid_config->n_tid_conf; i++) { in ath10k_mac_op_set_tid_config()
9405 &tid_config->tid_conf[i], in ath10k_mac_op_set_tid_config()
9416 arvif->tids_rst = 0; in ath10k_mac_op_set_tid_config()
9424 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_tid_config()
9433 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_reset_tid_config()
9435 struct ath10k *ar = hw->priv; in ath10k_mac_op_reset_tid_config()
9438 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_reset_tid_config()
9441 arvif->tids_rst = 0; in ath10k_mac_op_reset_tid_config()
9446 arvif->tids_rst = tids; in ath10k_mac_op_reset_tid_config()
9453 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_reset_tid_config()
9600 ar = hw->priv; in ath10k_mac_create()
9601 ar->hw = hw; in ath10k_mac_create()
9602 ar->ops = ops; in ath10k_mac_create()
9609 struct ieee80211_ops *ops = ar->ops; in ath10k_mac_destroy()
9611 ieee80211_free_hw(ar->hw); in ath10k_mac_destroy()
9733 /* FIXME: This is not thoroughly tested. These combinations may over- or
9829 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_get_arvif_iter()
9831 if (arvif->vdev_id == arvif_iter->vdev_id) in ath10k_get_arvif_iter()
9832 arvif_iter->arvif = arvif; in ath10k_get_arvif_iter()
9842 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_get_arvif()
9865 if (wrdd->type != ACPI_TYPE_PACKAGE ||
9866 wrdd->package.count < 2 ||
9867 wrdd->package.elements[0].type != ACPI_TYPE_INTEGER ||
9868 wrdd->package.elements[0].integer.value != 0) {
9870 if (wrdd->Type != ACPI_TYPE_PACKAGE ||
9871 wrdd->Package.Count < 2 ||
9872 wrdd->Package.Elements[0].Type != ACPI_TYPE_INTEGER ||
9873 wrdd->Package.Elements[0].Integer.Value != 0) {
9880 for (i = 1; i < wrdd->package.count; ++i) {
9881 mcc_pkg = &wrdd->package.elements[i];
9883 if (mcc_pkg->type != ACPI_TYPE_PACKAGE)
9885 if (mcc_pkg->package.count < 2)
9887 if (mcc_pkg->package.elements[0].type != ACPI_TYPE_INTEGER ||
9888 mcc_pkg->package.elements[1].type != ACPI_TYPE_INTEGER)
9891 domain_type = &mcc_pkg->package.elements[0];
9892 if (domain_type->integer.value != WRDD_WIFI)
9895 mcc_value = &mcc_pkg->package.elements[1];
9896 return mcc_value->integer.value;
9898 for (i = 1; i < wrdd->Package.Count; ++i) {
9899 mcc_pkg = &wrdd->Package.Elements[i];
9901 if (mcc_pkg->Type != ACPI_TYPE_PACKAGE)
9903 if (mcc_pkg->Package.Count < 2)
9905 if (mcc_pkg->Package.Elements[0].Type != ACPI_TYPE_INTEGER ||
9906 mcc_pkg->Package.Elements[1].Type != ACPI_TYPE_INTEGER)
9909 domain_type = &mcc_pkg->Package.Elements[0];
9910 if (domain_type->Integer.Value != WRDD_WIFI)
9913 mcc_value = &mcc_pkg->Package.Elements[1];
9914 return mcc_value->Integer.Value;
9929 root_handle = ACPI_HANDLE(ar->dev);
9931 return -EOPNOTSUPP;
9937 return -EIO;
9944 return -EIO;
9955 return -EIO;
9962 "regulatory hint from WRDD (alpha2-code): %s\n", alpha2);
9966 return -EIO;
9981 rd = ar->hw_eeprom_rd;
9984 ar->ath_common.regulatory.current_rd = rd;
10005 /* Only QCA99x0 and QCA4019 variants support GCMP-128, GCMP-256
10006 * and CCMP-256 in hardware.
10016 if (!is_valid_ether_addr(ar->mac_addr)) {
10018 eth_random_addr(ar->mac_addr);
10020 SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr);
10022 SET_IEEE80211_DEV(ar->hw, ar->dev);
10028 if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) {
10033 ret = -ENOMEM;
10037 band = &ar->mac.sbands[NL80211_BAND_2GHZ];
10038 band->n_channels = ARRAY_SIZE(ath10k_2ghz_channels);
10039 band->channels = channels;
10041 if (ar->hw_params.cck_rate_map_rev2) {
10042 band->n_bitrates = ath10k_g_rates_rev2_size;
10043 band->bitrates = ath10k_g_rates_rev2;
10045 band->n_bitrates = ath10k_g_rates_size;
10046 band->bitrates = ath10k_g_rates;
10049 ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = band;
10052 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
10057 ret = -ENOMEM;
10061 band = &ar->mac.sbands[NL80211_BAND_5GHZ];
10062 band->n_channels = ARRAY_SIZE(ath10k_5ghz_channels);
10063 band->channels = channels;
10064 band->n_bitrates = ath10k_a_rates_size;
10065 band->bitrates = ath10k_a_rates;
10066 ar->hw->wiphy->bands[NL80211_BAND_5GHZ] = band;
10069 wiphy_read_of_freq_limits(ar->hw->wiphy);
10072 ar->hw->wiphy->interface_modes =
10077 ar->hw->wiphy->available_antennas_rx = ar->cfg_rx_chainmask;
10078 ar->hw->wiphy->available_antennas_tx = ar->cfg_tx_chainmask;
10080 if (!test_bit(ATH10K_FW_FEATURE_NO_P2P, ar->normal_mode_fw.fw_file.fw_features))
10081 ar->hw->wiphy->interface_modes |=
10086 ieee80211_hw_set(ar->hw, SIGNAL_DBM);
10089 ar->running_fw->fw_file.fw_features)) {
10090 ieee80211_hw_set(ar->hw, SUPPORTS_PS);
10091 ieee80211_hw_set(ar->hw, SUPPORTS_DYNAMIC_PS);
10094 ieee80211_hw_set(ar->hw, MFP_CAPABLE);
10095 ieee80211_hw_set(ar->hw, REPORTS_TX_ACK_STATUS);
10096 ieee80211_hw_set(ar->hw, HAS_RATE_CONTROL);
10097 ieee80211_hw_set(ar->hw, AP_LINK_PS);
10098 ieee80211_hw_set(ar->hw, SPECTRUM_MGMT);
10099 ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT);
10100 ieee80211_hw_set(ar->hw, CONNECTION_MONITOR);
10101 ieee80211_hw_set(ar->hw, SUPPORTS_PER_STA_GTK);
10102 ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF);
10103 ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA);
10104 ieee80211_hw_set(ar->hw, QUEUE_CONTROL);
10105 ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG);
10106 ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK);
10108 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags))
10109 ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL);
10111 ar->hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS;
10112 ar->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
10114 if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS)
10115 ar->hw->wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS;
10117 if (ar->ht_cap_info & WMI_HT_CAP_ENABLED) {
10118 ieee80211_hw_set(ar->hw, AMPDU_AGGREGATION);
10119 ieee80211_hw_set(ar->hw, TX_AMPDU_SETUP_IN_HW);
10122 ar->hw->wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID;
10123 ar->hw->wiphy->max_scan_ie_len = WLAN_SCAN_PARAMS_MAX_IE_LEN;
10125 if (test_bit(WMI_SERVICE_NLO, ar->wmi.svc_map)) {
10126 ar->hw->wiphy->max_sched_scan_ssids = WMI_PNO_MAX_SUPP_NETWORKS;
10127 ar->hw->wiphy->max_match_sets = WMI_PNO_MAX_SUPP_NETWORKS;
10128 ar->hw->wiphy->max_sched_scan_ie_len = WMI_PNO_MAX_IE_LENGTH;
10129 ar->hw->wiphy->max_sched_scan_plans = WMI_PNO_MAX_SCHED_SCAN_PLANS;
10130 ar->hw->wiphy->max_sched_scan_plan_interval =
10132 ar->hw->wiphy->max_sched_scan_plan_iterations =
10134 ar->hw->wiphy->features |= NL80211_FEATURE_ND_RANDOM_MAC_ADDR;
10137 ar->hw->vif_data_size = sizeof(struct ath10k_vif);
10138 ar->hw->sta_data_size = sizeof(struct ath10k_sta);
10139 ar->hw->txq_data_size = sizeof(struct ath10k_txq);
10141 ar->hw->max_listen_interval = ATH10K_MAX_HW_LISTEN_INTERVAL;
10143 if (test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) {
10144 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD;
10150 ar->hw->wiphy->probe_resp_offload |=
10156 if (test_bit(WMI_SERVICE_TDLS, ar->wmi.svc_map) ||
10157 test_bit(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY, ar->wmi.svc_map)) {
10158 ar->hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS;
10159 if (test_bit(WMI_SERVICE_TDLS_WIDER_BANDWIDTH, ar->wmi.svc_map))
10160 ieee80211_hw_set(ar->hw, TDLS_WIDER_BW);
10163 if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map))
10164 ieee80211_hw_set(ar->hw, SUPPORTS_TDLS_BUFFER_STA);
10167 if (ar->wmi.vdev_param->tx_encap_type !=
10169 ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD);
10172 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
10173 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
10174 ar->hw->wiphy->max_remain_on_channel_duration = 5000;
10176 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD;
10177 ar->hw->wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE |
10180 ar->hw->wiphy->max_ap_assoc_sta = ar->max_num_stations;
10188 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
10189 wiphy_ext_feature_set(ar->hw->wiphy,
10191 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL);
10193 if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map) ||
10194 test_bit(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ar->wmi.svc_map))
10195 wiphy_ext_feature_set(ar->hw->wiphy,
10199 test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map))
10200 wiphy_ext_feature_set(ar->hw->wiphy,
10203 if (test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map))
10204 wiphy_ext_feature_set(ar->hw->wiphy,
10207 if (test_bit(WMI_SERVICE_TX_PWR_PER_PEER, ar->wmi.svc_map))
10208 wiphy_ext_feature_set(ar->hw->wiphy,
10211 if (test_bit(WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT, ar->wmi.svc_map)) {
10212 ar->hw->wiphy->tid_config_support.vif |=
10221 ar->wmi.svc_map)) {
10222 ar->hw->wiphy->tid_config_support.vif |=
10226 ar->hw->wiphy->tid_config_support.peer =
10227 ar->hw->wiphy->tid_config_support.vif;
10228 ar->hw->wiphy->max_data_retry_count = ATH10K_MAX_RETRY_COUNT;
10230 ar->ops->set_tid_config = NULL;
10236 ar->hw->queues = IEEE80211_MAX_QUEUES;
10242 ar->hw->offchannel_tx_hw_queue = IEEE80211_MAX_QUEUES - 1;
10244 switch (ar->running_fw->fw_file.wmi_op_version) {
10246 ar->hw->wiphy->iface_combinations = ath10k_if_comb;
10247 ar->hw->wiphy->n_iface_combinations =
10249 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
10252 if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar->wmi.svc_map)) {
10253 ar->hw->wiphy->iface_combinations =
10255 ar->hw->wiphy->n_iface_combinations =
10258 ar->hw->wiphy->iface_combinations = ath10k_tlv_if_comb;
10259 ar->hw->wiphy->n_iface_combinations =
10262 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
10267 ar->hw->wiphy->iface_combinations = ath10k_10x_if_comb;
10268 ar->hw->wiphy->n_iface_combinations =
10272 ar->hw->wiphy->iface_combinations = ath10k_10_4_if_comb;
10273 ar->hw->wiphy->n_iface_combinations =
10276 ar->wmi.svc_map)) {
10277 ar->hw->wiphy->iface_combinations =
10279 ar->hw->wiphy->n_iface_combinations =
10286 ret = -EINVAL;
10290 if (ar->hw_params.dynamic_sar_support)
10291 ar->hw->wiphy->sar_capa = &ath10k_sar_capa;
10293 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags))
10294 ar->hw->netdev_features = NETIF_F_HW_CSUM;
10298 ar->ath_common.debug_mask = ATH_DBG_DFS;
10299 ar->dfs_detector = dfs_pattern_detector_init(&ar->ath_common,
10302 if (!ar->dfs_detector)
10313 if (!ar->hw_params.hw_ops->set_coverage_class)
10314 ar->ops->set_coverage_class = NULL;
10316 ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy,
10323 if (test_bit(WMI_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi.svc_map)) {
10324 ar->hw->wiphy->features |=
10328 ar->hw->wiphy->cipher_suites = cipher_suites;
10330 /* QCA988x and QCA6174 family chips do not support CCMP-256, GCMP-128
10331 * and GCMP-256 ciphers in hardware. Fetch number of ciphers supported
10334 if (!ar->hw_params.n_cipher_suites ||
10335 ar->hw_params.n_cipher_suites > ARRAY_SIZE(cipher_suites)) {
10337 ar->hw_params.n_cipher_suites);
10338 ar->hw_params.n_cipher_suites = 8;
10340 ar->hw->wiphy->n_cipher_suites = ar->hw_params.n_cipher_suites;
10342 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
10344 ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER;
10346 ret = ieee80211_register_hw(ar->hw);
10352 if (test_bit(WMI_SERVICE_PER_PACKET_SW_ENCRYPT, ar->wmi.svc_map)) {
10353 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
10354 ar->hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN);
10357 if (!ath_is_world_regd(&ar->ath_common.reg_world_copy) &&
10358 !ath_is_world_regd(&ar->ath_common.regulatory)) {
10359 ret = regulatory_hint(ar->hw->wiphy,
10360 ar->ath_common.regulatory.alpha2);
10368 ieee80211_unregister_hw(ar->hw);
10371 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector)
10372 ar->dfs_detector->exit(ar->dfs_detector);
10375 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
10376 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels);
10378 SET_IEEE80211_DEV(ar->hw, NULL);
10384 ieee80211_unregister_hw(ar->hw);
10386 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector)
10387 ar->dfs_detector->exit(ar->dfs_detector);
10389 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
10390 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels);
10392 SET_IEEE80211_DEV(ar->hw, NULL);