Lines Matching +full:sense +full:- +full:bitfield +full:- +full:width

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.
6 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
16 #include <linux/bitfield.h>
25 #include "wmi-tlv.h"
26 #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()
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()
736 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_create()
739 if (ar->num_peers + list_count_nodes(&ar->arvifs) >= ar->max_num_peers) in ath10k_peer_create()
740 return -ENOBUFS; in ath10k_peer_create()
756 spin_lock_bh(&ar->data_lock); in ath10k_peer_create()
760 spin_unlock_bh(&ar->data_lock); in ath10k_peer_create()
764 return -ENOENT; in ath10k_peer_create()
767 peer->vif = vif; in ath10k_peer_create()
768 peer->sta = sta; in ath10k_peer_create()
770 spin_unlock_bh(&ar->data_lock); in ath10k_peer_create()
772 ar->num_peers++; in ath10k_peer_create()
779 struct ath10k *ar = arvif->ar; in ath10k_mac_set_kickout()
783 param = ar->wmi.pdev_param->sta_kickout_th; in ath10k_mac_set_kickout()
788 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
792 param = ar->wmi.vdev_param->ap_keepalive_min_idle_inactive_time_secs; in ath10k_mac_set_kickout()
793 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
797 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
801 param = ar->wmi.vdev_param->ap_keepalive_max_idle_inactive_time_secs; in ath10k_mac_set_kickout()
802 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
806 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
810 param = ar->wmi.vdev_param->ap_keepalive_max_unresponsive_time_secs; in ath10k_mac_set_kickout()
811 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
815 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
824 struct ath10k *ar = arvif->ar; in ath10k_mac_set_rts()
827 vdev_param = ar->wmi.vdev_param->rts_threshold; in ath10k_mac_set_rts()
828 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, value); in ath10k_mac_set_rts()
835 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_delete()
845 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) { in ath10k_peer_delete()
849 (&ar->peer_delete_done, 5 * HZ); in ath10k_peer_delete()
853 return -ETIMEDOUT; in ath10k_peer_delete()
857 ar->num_peers--; in ath10k_peer_delete()
866 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_map_cleanup()
868 for_each_set_bit(peer_id, peer->peer_ids, in ath10k_peer_map_cleanup()
870 ar->peer_map[peer_id] = NULL; in ath10k_peer_map_cleanup()
873 /* Double check that peer is properly un-referenced from in ath10k_peer_map_cleanup()
876 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_peer_map_cleanup()
877 if (ar->peer_map[i] == peer) { in ath10k_peer_map_cleanup()
879 peer->addr, peer, i); in ath10k_peer_map_cleanup()
880 ar->peer_map[i] = NULL; in ath10k_peer_map_cleanup()
884 list_del(&peer->list); in ath10k_peer_map_cleanup()
886 ar->num_peers--; in ath10k_peer_map_cleanup()
893 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_cleanup()
895 spin_lock_bh(&ar->data_lock); in ath10k_peer_cleanup()
896 list_for_each_entry_safe(peer, tmp, &ar->peers, list) { in ath10k_peer_cleanup()
897 if (peer->vdev_id != vdev_id) in ath10k_peer_cleanup()
901 peer->addr, vdev_id); in ath10k_peer_cleanup()
905 spin_unlock_bh(&ar->data_lock); in ath10k_peer_cleanup()
913 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_cleanup_all()
915 spin_lock_bh(&ar->data_lock); in ath10k_peer_cleanup_all()
916 list_for_each_entry_safe(peer, tmp, &ar->peers, list) { in ath10k_peer_cleanup_all()
917 list_del(&peer->list); in ath10k_peer_cleanup_all()
921 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) in ath10k_peer_cleanup_all()
922 ar->peer_map[i] = NULL; in ath10k_peer_cleanup_all()
924 spin_unlock_bh(&ar->data_lock); in ath10k_peer_cleanup_all()
926 ar->num_peers = 0; in ath10k_peer_cleanup_all()
927 ar->num_stations = 0; in ath10k_peer_cleanup_all()
939 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_tdls_peer_update()
943 ether_addr_copy(arg.addr, sta->addr); in ath10k_mac_tdls_peer_update()
945 cap.peer_max_sp = sta->max_sp; in ath10k_mac_tdls_peer_update()
946 cap.peer_uapsd_queues = sta->uapsd_queues; in ath10k_mac_tdls_peer_update()
949 !sta->tdls_initiator) in ath10k_mac_tdls_peer_update()
968 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_beacon_free()
970 lockdep_assert_held(&ar->data_lock); in ath10k_mac_vif_beacon_free()
972 if (!arvif->beacon) in ath10k_mac_vif_beacon_free()
975 if (!arvif->beacon_buf) in ath10k_mac_vif_beacon_free()
976 dma_unmap_single(ar->dev, ATH10K_SKB_CB(arvif->beacon)->paddr, in ath10k_mac_vif_beacon_free()
977 arvif->beacon->len, DMA_TO_DEVICE); in ath10k_mac_vif_beacon_free()
979 if (WARN_ON(arvif->beacon_state != ATH10K_BEACON_SCHEDULED && in ath10k_mac_vif_beacon_free()
980 arvif->beacon_state != ATH10K_BEACON_SENT)) in ath10k_mac_vif_beacon_free()
983 dev_kfree_skb_any(arvif->beacon); in ath10k_mac_vif_beacon_free()
985 arvif->beacon = NULL; in ath10k_mac_vif_beacon_free()
986 arvif->beacon_state = ATH10K_BEACON_SCHEDULED; in ath10k_mac_vif_beacon_free()
991 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_beacon_cleanup()
993 lockdep_assert_held(&ar->data_lock); in ath10k_mac_vif_beacon_cleanup()
997 if (arvif->beacon_buf) { in ath10k_mac_vif_beacon_cleanup()
998 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) in ath10k_mac_vif_beacon_cleanup()
999 kfree(arvif->beacon_buf); in ath10k_mac_vif_beacon_cleanup()
1001 dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, in ath10k_mac_vif_beacon_cleanup()
1002 arvif->beacon_buf, in ath10k_mac_vif_beacon_cleanup()
1003 arvif->beacon_paddr); in ath10k_mac_vif_beacon_cleanup()
1004 arvif->beacon_buf = NULL; in ath10k_mac_vif_beacon_cleanup()
1012 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_setup_sync()
1014 if (test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)) in ath10k_vdev_setup_sync()
1015 return -ESHUTDOWN; in ath10k_vdev_setup_sync()
1017 time_left = wait_for_completion_timeout(&ar->vdev_setup_done, in ath10k_vdev_setup_sync()
1020 return -ETIMEDOUT; in ath10k_vdev_setup_sync()
1022 return ar->last_wmi_vdev_start_status; in ath10k_vdev_setup_sync()
1032 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_start()
1034 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_monitor_vdev_start()
1038 return -ENOENT; in ath10k_monitor_vdev_start()
1040 channel = chandef->chan; in ath10k_monitor_vdev_start()
1043 arg.channel.freq = channel->center_freq; in ath10k_monitor_vdev_start()
1044 arg.channel.band_center_freq1 = chandef->center_freq1; in ath10k_monitor_vdev_start()
1045 arg.channel.band_center_freq2 = chandef->center_freq2; in ath10k_monitor_vdev_start()
1052 !!(channel->flags & IEEE80211_CHAN_RADAR); in ath10k_monitor_vdev_start()
1055 arg.channel.max_power = channel->max_power * 2; in ath10k_monitor_vdev_start()
1056 arg.channel.max_reg_power = channel->max_reg_power * 2; in ath10k_monitor_vdev_start()
1057 arg.channel.max_antenna_gain = channel->max_antenna_gain; in ath10k_monitor_vdev_start()
1059 reinit_completion(&ar->vdev_setup_done); in ath10k_monitor_vdev_start()
1060 reinit_completion(&ar->vdev_delete_done); in ath10k_monitor_vdev_start()
1076 ret = ath10k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr); in ath10k_monitor_vdev_start()
1083 ar->monitor_vdev_id = vdev_id; in ath10k_monitor_vdev_start()
1086 ar->monitor_vdev_id); in ath10k_monitor_vdev_start()
1090 ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_start()
1093 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_start()
1102 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_stop()
1104 ret = ath10k_wmi_vdev_down(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1107 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1109 reinit_completion(&ar->vdev_setup_done); in ath10k_monitor_vdev_stop()
1110 reinit_completion(&ar->vdev_delete_done); in ath10k_monitor_vdev_stop()
1112 ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1115 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1120 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1123 ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1131 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_create()
1133 if (ar->free_vdev_map == 0) { in ath10k_monitor_vdev_create()
1135 return -ENOMEM; in ath10k_monitor_vdev_create()
1138 bit = __ffs64(ar->free_vdev_map); in ath10k_monitor_vdev_create()
1140 ar->monitor_vdev_id = bit; in ath10k_monitor_vdev_create()
1142 ret = ath10k_wmi_vdev_create(ar, ar->monitor_vdev_id, in ath10k_monitor_vdev_create()
1144 0, ar->mac_addr); in ath10k_monitor_vdev_create()
1147 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_create()
1151 ar->free_vdev_map &= ~(1LL << ar->monitor_vdev_id); in ath10k_monitor_vdev_create()
1153 ar->monitor_vdev_id); in ath10k_monitor_vdev_create()
1162 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_delete()
1164 ret = ath10k_wmi_vdev_delete(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_delete()
1167 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_delete()
1171 ar->free_vdev_map |= 1LL << ar->monitor_vdev_id; in ath10k_monitor_vdev_delete()
1174 ar->monitor_vdev_id); in ath10k_monitor_vdev_delete()
1182 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_start()
1190 ret = ath10k_monitor_vdev_start(ar, ar->monitor_vdev_id); in ath10k_monitor_start()
1197 ar->monitor_started = true; in ath10k_monitor_start()
1207 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_stop()
1221 ar->monitor_started = false; in ath10k_monitor_stop()
1241 if (ar->monitor_arvif) in ath10k_mac_monitor_vdev_is_needed()
1244 return ar->monitor || in ath10k_mac_monitor_vdev_is_needed()
1246 ar->running_fw->fw_file.fw_features) && in ath10k_mac_monitor_vdev_is_needed()
1247 (ar->filter_flags & (FIF_OTHER_BSS | FIF_MCAST_ACTION))) || in ath10k_mac_monitor_vdev_is_needed()
1248 test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_mac_monitor_vdev_is_needed()
1259 * case anyway since multi-channel DFS hasn't been tested at all. in ath10k_mac_monitor_vdev_is_allowed()
1261 if (test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags) && num_ctx > 1) in ath10k_mac_monitor_vdev_is_allowed()
1273 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_recalc()
1280 ar->monitor_started, needed, allowed); in ath10k_monitor_recalc()
1283 if (ar->monitor_started) { in ath10k_monitor_recalc()
1293 return -EPERM; in ath10k_monitor_recalc()
1296 if (needed == ar->monitor_started) in ath10k_monitor_recalc()
1307 struct ath10k *ar = arvif->ar; in ath10k_mac_can_set_cts_prot()
1309 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_can_set_cts_prot()
1311 if (!arvif->is_started) { in ath10k_mac_can_set_cts_prot()
1321 struct ath10k *ar = arvif->ar; in ath10k_mac_set_cts_prot()
1324 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_set_cts_prot()
1326 vdev_param = ar->wmi.vdev_param->protection_mode; in ath10k_mac_set_cts_prot()
1329 arvif->vdev_id, arvif->use_cts_prot); in ath10k_mac_set_cts_prot()
1331 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_mac_set_cts_prot()
1332 arvif->use_cts_prot ? 1 : 0); in ath10k_mac_set_cts_prot()
1337 struct ath10k *ar = arvif->ar; in ath10k_recalc_rtscts_prot()
1340 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalc_rtscts_prot()
1342 vdev_param = ar->wmi.vdev_param->enable_rtscts; in ath10k_recalc_rtscts_prot()
1346 if (arvif->num_legacy_stations > 0) in ath10k_recalc_rtscts_prot()
1354 arvif->vdev_id, rts_cts); in ath10k_recalc_rtscts_prot()
1356 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_recalc_rtscts_prot()
1364 lockdep_assert_held(&ar->conf_mutex); in ath10k_start_cac()
1366 set_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_start_cac()
1371 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_start_cac()
1376 ar->monitor_vdev_id); in ath10k_start_cac()
1383 lockdep_assert_held(&ar->conf_mutex); in ath10k_stop_cac()
1385 /* CAC is not running - do nothing */ in ath10k_stop_cac()
1386 if (!test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags)) in ath10k_stop_cac()
1389 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_stop_cac()
1403 if (!*ret && conf->radar_enabled) in ath10k_mac_has_radar_iter()
1411 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_has_radar_enabled()
1422 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalc_radar_detection()
1429 if (ar->num_started_vdevs > 0) in ath10k_recalc_radar_detection()
1440 ieee80211_radar_detected(ar->hw, NULL); in ath10k_recalc_radar_detection()
1446 struct ath10k *ar = arvif->ar; in ath10k_vdev_stop()
1449 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_stop()
1451 reinit_completion(&ar->vdev_setup_done); in ath10k_vdev_stop()
1452 reinit_completion(&ar->vdev_delete_done); in ath10k_vdev_stop()
1454 ret = ath10k_wmi_vdev_stop(ar, arvif->vdev_id); in ath10k_vdev_stop()
1457 arvif->vdev_id, ret); in ath10k_vdev_stop()
1464 arvif->vdev_id, ret); in ath10k_vdev_stop()
1468 WARN_ON(ar->num_started_vdevs == 0); in ath10k_vdev_stop()
1470 if (ar->num_started_vdevs != 0) { in ath10k_vdev_stop()
1471 ar->num_started_vdevs--; in ath10k_vdev_stop()
1482 struct ath10k *ar = arvif->ar; in ath10k_vdev_start_restart()
1486 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_start_restart()
1488 reinit_completion(&ar->vdev_setup_done); in ath10k_vdev_start_restart()
1489 reinit_completion(&ar->vdev_delete_done); in ath10k_vdev_start_restart()
1491 arg.vdev_id = arvif->vdev_id; in ath10k_vdev_start_restart()
1492 arg.dtim_period = arvif->dtim_period; in ath10k_vdev_start_restart()
1493 arg.bcn_intval = arvif->beacon_interval; in ath10k_vdev_start_restart()
1495 arg.channel.freq = chandef->chan->center_freq; in ath10k_vdev_start_restart()
1496 arg.channel.band_center_freq1 = chandef->center_freq1; in ath10k_vdev_start_restart()
1497 arg.channel.band_center_freq2 = chandef->center_freq2; in ath10k_vdev_start_restart()
1501 arg.channel.max_power = chandef->chan->max_power * 2; in ath10k_vdev_start_restart()
1502 arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; in ath10k_vdev_start_restart()
1503 arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain; in ath10k_vdev_start_restart()
1505 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath10k_vdev_start_restart()
1506 arg.ssid = arvif->u.ap.ssid; in ath10k_vdev_start_restart()
1507 arg.ssid_len = arvif->u.ap.ssid_len; in ath10k_vdev_start_restart()
1508 arg.hidden_ssid = arvif->u.ap.hidden_ssid; in ath10k_vdev_start_restart()
1512 !!(chandef->chan->flags & IEEE80211_CHAN_RADAR); in ath10k_vdev_start_restart()
1513 } else if (arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_vdev_start_restart()
1514 arg.ssid = arvif->vif->cfg.ssid; in ath10k_vdev_start_restart()
1515 arg.ssid_len = arvif->vif->cfg.ssid_len; in ath10k_vdev_start_restart()
1542 ar->num_started_vdevs++; in ath10k_vdev_start_restart()
1563 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_bcn_p2p_ie()
1568 if (arvif->vif->type != NL80211_IFTYPE_AP || !arvif->vif->p2p) in ath10k_mac_setup_bcn_p2p_ie()
1571 mgmt = (void *)bcn->data; in ath10k_mac_setup_bcn_p2p_ie()
1573 mgmt->u.beacon.variable, in ath10k_mac_setup_bcn_p2p_ie()
1574 bcn->len - (mgmt->u.beacon.variable - in ath10k_mac_setup_bcn_p2p_ie()
1575 bcn->data)); in ath10k_mac_setup_bcn_p2p_ie()
1577 return -ENOENT; in ath10k_mac_setup_bcn_p2p_ie()
1579 ret = ath10k_wmi_p2p_go_bcn_ie(ar, arvif->vdev_id, p2p_ie); in ath10k_mac_setup_bcn_p2p_ie()
1582 arvif->vdev_id, ret); in ath10k_mac_setup_bcn_p2p_ie()
1597 if (WARN_ON(skb->len < ie_offset)) in ath10k_mac_remove_vendor_ie()
1598 return -EINVAL; in ath10k_mac_remove_vendor_ie()
1601 skb->data + ie_offset, in ath10k_mac_remove_vendor_ie()
1602 skb->len - ie_offset); in ath10k_mac_remove_vendor_ie()
1604 return -ENOENT; in ath10k_mac_remove_vendor_ie()
1607 end = skb->data + skb->len; in ath10k_mac_remove_vendor_ie()
1611 return -EINVAL; in ath10k_mac_remove_vendor_ie()
1613 memmove(ie, next, end - next); in ath10k_mac_remove_vendor_ie()
1614 skb_trim(skb, skb->len - len); in ath10k_mac_remove_vendor_ie()
1621 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_bcn_tmpl()
1622 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_setup_bcn_tmpl()
1623 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_setup_bcn_tmpl()
1628 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_setup_bcn_tmpl()
1631 if (arvif->vdev_type != WMI_VDEV_TYPE_AP && in ath10k_mac_setup_bcn_tmpl()
1632 arvif->vdev_type != WMI_VDEV_TYPE_IBSS) in ath10k_mac_setup_bcn_tmpl()
1638 return -EPERM; in ath10k_mac_setup_bcn_tmpl()
1656 ret = ath10k_wmi_bcn_tmpl(ar, arvif->vdev_id, offs.tim_offset, bcn, 0, in ath10k_mac_setup_bcn_tmpl()
1671 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_prb_tmpl()
1672 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_setup_prb_tmpl()
1673 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_setup_prb_tmpl()
1677 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_setup_prb_tmpl()
1680 if (arvif->vdev_type != WMI_VDEV_TYPE_AP) in ath10k_mac_setup_prb_tmpl()
1690 return -EPERM; in ath10k_mac_setup_prb_tmpl()
1693 ret = ath10k_wmi_prb_tmpl(ar, arvif->vdev_id, prb); in ath10k_mac_setup_prb_tmpl()
1707 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_fix_hidden_ssid()
1722 * since only wmi-tlv firmware are known to have beacon offload and in ath10k_mac_vif_fix_hidden_ssid()
1723 * wmi-tlv doesn't seem to misbehave like 10.2 wrt vdev restart in ath10k_mac_vif_fix_hidden_ssid()
1726 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_vif_fix_hidden_ssid()
1729 if (WARN_ON(!arvif->is_started)) in ath10k_mac_vif_fix_hidden_ssid()
1730 return -EINVAL; in ath10k_mac_vif_fix_hidden_ssid()
1732 if (WARN_ON(!arvif->is_up)) in ath10k_mac_vif_fix_hidden_ssid()
1733 return -EINVAL; in ath10k_mac_vif_fix_hidden_ssid()
1735 if (WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) in ath10k_mac_vif_fix_hidden_ssid()
1736 return -EINVAL; in ath10k_mac_vif_fix_hidden_ssid()
1738 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_vif_fix_hidden_ssid()
1741 arvif->vdev_id, ret); in ath10k_mac_vif_fix_hidden_ssid()
1764 arvif->vdev_id, ret); in ath10k_mac_vif_fix_hidden_ssid()
1768 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_mac_vif_fix_hidden_ssid()
1769 arvif->bssid); in ath10k_mac_vif_fix_hidden_ssid()
1772 arvif->vdev_id, ret); in ath10k_mac_vif_fix_hidden_ssid()
1782 struct ath10k *ar = arvif->ar; in ath10k_control_beaconing()
1785 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_control_beaconing()
1787 if (!info->enable_beacon) { in ath10k_control_beaconing()
1788 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_control_beaconing()
1791 arvif->vdev_id, ret); in ath10k_control_beaconing()
1793 arvif->is_up = false; in ath10k_control_beaconing()
1795 spin_lock_bh(&arvif->ar->data_lock); in ath10k_control_beaconing()
1797 spin_unlock_bh(&arvif->ar->data_lock); in ath10k_control_beaconing()
1802 arvif->tx_seq_no = 0x1000; in ath10k_control_beaconing()
1804 arvif->aid = 0; in ath10k_control_beaconing()
1805 ether_addr_copy(arvif->bssid, info->bssid); in ath10k_control_beaconing()
1807 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_control_beaconing()
1808 arvif->bssid); in ath10k_control_beaconing()
1811 arvif->vdev_id, ret); in ath10k_control_beaconing()
1815 arvif->is_up = true; in ath10k_control_beaconing()
1820 arvif->vdev_id, ret); in ath10k_control_beaconing()
1824 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %d up\n", arvif->vdev_id); in ath10k_control_beaconing()
1830 struct ath10k *ar = arvif->ar; in ath10k_control_ibss()
1834 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_control_ibss()
1836 if (!vif->cfg.ibss_joined) { in ath10k_control_ibss()
1837 if (is_zero_ether_addr(arvif->bssid)) in ath10k_control_ibss()
1840 eth_zero_addr(arvif->bssid); in ath10k_control_ibss()
1845 vdev_param = arvif->ar->wmi.vdev_param->atim_window; in ath10k_control_ibss()
1846 ret = ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id, vdev_param, in ath10k_control_ibss()
1850 arvif->vdev_id, ret); in ath10k_control_ibss()
1855 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_recalc_ps_wake_threshold()
1860 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_recalc_ps_wake_threshold()
1862 if (arvif->u.sta.uapsd) in ath10k_mac_vif_recalc_ps_wake_threshold()
1868 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, value); in ath10k_mac_vif_recalc_ps_wake_threshold()
1871 value, arvif->vdev_id, ret); in ath10k_mac_vif_recalc_ps_wake_threshold()
1880 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_recalc_ps_poll_count()
1885 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_recalc_ps_poll_count()
1887 if (arvif->u.sta.uapsd) in ath10k_mac_vif_recalc_ps_poll_count()
1893 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_mac_vif_recalc_ps_poll_count()
1897 value, arvif->vdev_id, ret); in ath10k_mac_vif_recalc_ps_poll_count()
1909 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_num_vifs_started()
1911 list_for_each_entry(arvif, &ar->arvifs, list) in ath10k_mac_num_vifs_started()
1912 if (arvif->is_started) in ath10k_mac_num_vifs_started()
1920 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_setup_ps()
1921 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_vif_setup_ps()
1922 struct ieee80211_conf *conf = &ar->hw->conf; in ath10k_mac_vif_setup_ps()
1929 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_setup_ps()
1931 if (arvif->vif->type != NL80211_IFTYPE_STATION) in ath10k_mac_vif_setup_ps()
1934 enable_ps = arvif->ps; in ath10k_mac_vif_setup_ps()
1938 ar->running_fw->fw_file.fw_features)) { in ath10k_mac_vif_setup_ps()
1940 arvif->vdev_id); in ath10k_mac_vif_setup_ps()
1944 if (!arvif->is_started) { in ath10k_mac_vif_setup_ps()
1947 * necessary if PS is disabled on a non-started vdev. Hence in ath10k_mac_vif_setup_ps()
1948 * force-enable PS for non-running vdevs. in ath10k_mac_vif_setup_ps()
1955 ps_timeout = conf->dynamic_ps_timeout; in ath10k_mac_vif_setup_ps()
1959 vif->bss_conf.beacon_int) / 1000; in ath10k_mac_vif_setup_ps()
1962 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, in ath10k_mac_vif_setup_ps()
1966 arvif->vdev_id, ret); in ath10k_mac_vif_setup_ps()
1974 arvif->vdev_id, psmode ? "enable" : "disable"); in ath10k_mac_vif_setup_ps()
1976 ret = ath10k_wmi_set_psmode(ar, arvif->vdev_id, psmode); in ath10k_mac_vif_setup_ps()
1979 psmode, arvif->vdev_id, ret); in ath10k_mac_vif_setup_ps()
1988 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_disable_keepalive()
1992 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_disable_keepalive()
1994 if (arvif->vdev_type != WMI_VDEV_TYPE_STA) in ath10k_mac_vif_disable_keepalive()
1997 if (!test_bit(WMI_SERVICE_STA_KEEP_ALIVE, ar->wmi.svc_map)) in ath10k_mac_vif_disable_keepalive()
2003 arg.vdev_id = arvif->vdev_id; in ath10k_mac_vif_disable_keepalive()
2011 arvif->vdev_id, ret); in ath10k_mac_vif_disable_keepalive()
2020 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_ap_csa_count_down()
2021 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_vif_ap_csa_count_down()
2024 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_ap_csa_count_down()
2026 if (WARN_ON(!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map))) in ath10k_mac_vif_ap_csa_count_down()
2029 if (arvif->vdev_type != WMI_VDEV_TYPE_AP) in ath10k_mac_vif_ap_csa_count_down()
2032 if (!vif->bss_conf.csa_active) in ath10k_mac_vif_ap_csa_count_down()
2035 if (!arvif->is_up) in ath10k_mac_vif_ap_csa_count_down()
2059 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_ap_csa_work()
2061 mutex_lock(&ar->conf_mutex); in ath10k_mac_vif_ap_csa_work()
2063 mutex_unlock(&ar->conf_mutex); in ath10k_mac_vif_ap_csa_work()
2070 struct ieee80211_mgmt *mgmt = (void *)skb->data; in ath10k_mac_handle_beacon_iter()
2071 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_handle_beacon_iter()
2073 if (vif->type != NL80211_IFTYPE_STATION) in ath10k_mac_handle_beacon_iter()
2076 if (!ether_addr_equal(mgmt->bssid, vif->bss_conf.bssid)) in ath10k_mac_handle_beacon_iter()
2079 cancel_delayed_work(&arvif->connection_loss_work); in ath10k_mac_handle_beacon_iter()
2084 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_beacon()
2094 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_handle_beacon_miss_iter()
2095 struct ath10k *ar = arvif->ar; in ath10k_mac_handle_beacon_miss_iter()
2096 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_handle_beacon_miss_iter()
2098 if (arvif->vdev_id != *vdev_id) in ath10k_mac_handle_beacon_miss_iter()
2101 if (!arvif->is_up) in ath10k_mac_handle_beacon_miss_iter()
2108 * doesn't make sense to continue operation. Queue connection loss work in ath10k_mac_handle_beacon_miss_iter()
2111 ieee80211_queue_delayed_work(hw, &arvif->connection_loss_work, in ath10k_mac_handle_beacon_miss_iter()
2117 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_beacon_miss()
2127 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_vif_sta_connection_loss_work()
2129 if (!arvif->is_up) in ath10k_mac_vif_sta_connection_loss_work()
2150 if (vif->type == NL80211_IFTYPE_STATION) in ath10k_peer_assoc_h_listen_intval()
2153 return ar->hw->conf.listen_interval; in ath10k_peer_assoc_h_listen_intval()
2161 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_basic()
2164 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_basic()
2166 if (vif->type == NL80211_IFTYPE_STATION) in ath10k_peer_assoc_h_basic()
2167 aid = vif->cfg.aid; in ath10k_peer_assoc_h_basic()
2169 aid = sta->aid; in ath10k_peer_assoc_h_basic()
2171 ether_addr_copy(arg->addr, sta->addr); in ath10k_peer_assoc_h_basic()
2172 arg->vdev_id = arvif->vdev_id; in ath10k_peer_assoc_h_basic()
2173 arg->peer_aid = aid; in ath10k_peer_assoc_h_basic()
2174 arg->peer_flags |= arvif->ar->wmi.peer_flags->auth; in ath10k_peer_assoc_h_basic()
2175 arg->peer_listen_intval = ath10k_peer_assoc_h_listen_intval(ar, vif); in ath10k_peer_assoc_h_basic()
2176 arg->peer_num_spatial_streams = 1; in ath10k_peer_assoc_h_basic()
2177 arg->peer_caps = vif->bss_conf.assoc_capability; in ath10k_peer_assoc_h_basic()
2185 struct ieee80211_bss_conf *info = &vif->bss_conf; in ath10k_peer_assoc_h_crypto()
2191 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_crypto()
2196 bss = cfg80211_get_bss(ar->hw->wiphy, def.chan, info->bssid, in ath10k_peer_assoc_h_crypto()
2197 vif->cfg.ssid_len ? vif->cfg.ssid : NULL, in ath10k_peer_assoc_h_crypto()
2198 vif->cfg.ssid_len, in ath10k_peer_assoc_h_crypto()
2206 ies = rcu_dereference(bss->ies); in ath10k_peer_assoc_h_crypto()
2210 ies->data, in ath10k_peer_assoc_h_crypto()
2211 ies->len); in ath10k_peer_assoc_h_crypto()
2213 cfg80211_put_bss(ar->hw->wiphy, bss); in ath10k_peer_assoc_h_crypto()
2219 arg->peer_flags |= ar->wmi.peer_flags->need_ptk_4_way; in ath10k_peer_assoc_h_crypto()
2224 arg->peer_flags |= ar->wmi.peer_flags->need_gtk_2_way; in ath10k_peer_assoc_h_crypto()
2227 if (sta->mfp && in ath10k_peer_assoc_h_crypto()
2229 ar->running_fw->fw_file.fw_features)) { in ath10k_peer_assoc_h_crypto()
2230 arg->peer_flags |= ar->wmi.peer_flags->pmf; in ath10k_peer_assoc_h_crypto()
2239 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_rates()
2240 struct wmi_rate_set_arg *rateset = &arg->peer_legacy_rates; in ath10k_peer_assoc_h_rates()
2249 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_rates()
2254 band = def.chan->band; in ath10k_peer_assoc_h_rates()
2255 sband = ar->hw->wiphy->bands[band]; in ath10k_peer_assoc_h_rates()
2256 ratemask = sta->deflink.supp_rates[band]; in ath10k_peer_assoc_h_rates()
2257 ratemask &= arvif->bitrate_mask.control[band].legacy; in ath10k_peer_assoc_h_rates()
2258 rates = sband->bitrates; in ath10k_peer_assoc_h_rates()
2260 rateset->num_rates = 0; in ath10k_peer_assoc_h_rates()
2266 rate = ath10k_mac_bitrate_to_rate(rates->bitrate); in ath10k_peer_assoc_h_rates()
2267 rateset->rates[rateset->num_rates] = rate; in ath10k_peer_assoc_h_rates()
2268 rateset->num_rates++; in ath10k_peer_assoc_h_rates()
2301 const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; in ath10k_peer_assoc_h_ht()
2302 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_ht()
2311 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_ht()
2316 if (!ht_cap->ht_supported) in ath10k_peer_assoc_h_ht()
2319 band = def.chan->band; in ath10k_peer_assoc_h_ht()
2320 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath10k_peer_assoc_h_ht()
2321 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_peer_assoc_h_ht()
2327 arg->peer_flags |= ar->wmi.peer_flags->ht; in ath10k_peer_assoc_h_ht()
2328 arg->peer_max_mpdu = (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + in ath10k_peer_assoc_h_ht()
2329 ht_cap->ampdu_factor)) - 1; in ath10k_peer_assoc_h_ht()
2331 arg->peer_mpdu_density = in ath10k_peer_assoc_h_ht()
2332 ath10k_parse_mpdudensity(ht_cap->ampdu_density); in ath10k_peer_assoc_h_ht()
2334 arg->peer_ht_caps = ht_cap->cap; in ath10k_peer_assoc_h_ht()
2335 arg->peer_rate_caps |= WMI_RC_HT_FLAG; in ath10k_peer_assoc_h_ht()
2337 if (ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING) in ath10k_peer_assoc_h_ht()
2338 arg->peer_flags |= ar->wmi.peer_flags->ldbc; in ath10k_peer_assoc_h_ht()
2340 if (sta->deflink.bandwidth >= IEEE80211_STA_RX_BW_40) { in ath10k_peer_assoc_h_ht()
2341 arg->peer_flags |= ar->wmi.peer_flags->bw40; in ath10k_peer_assoc_h_ht()
2342 arg->peer_rate_caps |= WMI_RC_CW40_FLAG; in ath10k_peer_assoc_h_ht()
2345 if (arvif->bitrate_mask.control[band].gi != NL80211_TXRATE_FORCE_LGI) { in ath10k_peer_assoc_h_ht()
2346 if (ht_cap->cap & IEEE80211_HT_CAP_SGI_20) in ath10k_peer_assoc_h_ht()
2347 arg->peer_rate_caps |= WMI_RC_SGI_FLAG; in ath10k_peer_assoc_h_ht()
2349 if (ht_cap->cap & IEEE80211_HT_CAP_SGI_40) in ath10k_peer_assoc_h_ht()
2350 arg->peer_rate_caps |= WMI_RC_SGI_FLAG; in ath10k_peer_assoc_h_ht()
2353 if (ht_cap->cap & IEEE80211_HT_CAP_TX_STBC) { in ath10k_peer_assoc_h_ht()
2354 arg->peer_rate_caps |= WMI_RC_TX_STBC_FLAG; in ath10k_peer_assoc_h_ht()
2355 arg->peer_flags |= ar->wmi.peer_flags->stbc; in ath10k_peer_assoc_h_ht()
2358 if (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC) { in ath10k_peer_assoc_h_ht()
2359 stbc = ht_cap->cap & IEEE80211_HT_CAP_RX_STBC; in ath10k_peer_assoc_h_ht()
2362 arg->peer_rate_caps |= stbc; in ath10k_peer_assoc_h_ht()
2363 arg->peer_flags |= ar->wmi.peer_flags->stbc; in ath10k_peer_assoc_h_ht()
2366 if (ht_cap->mcs.rx_mask[1] && ht_cap->mcs.rx_mask[2]) in ath10k_peer_assoc_h_ht()
2367 arg->peer_rate_caps |= WMI_RC_TS_FLAG; in ath10k_peer_assoc_h_ht()
2368 else if (ht_cap->mcs.rx_mask[1]) in ath10k_peer_assoc_h_ht()
2369 arg->peer_rate_caps |= WMI_RC_DS_FLAG; in ath10k_peer_assoc_h_ht()
2372 if ((ht_cap->mcs.rx_mask[i / 8] & BIT(i % 8)) && in ath10k_peer_assoc_h_ht()
2375 arg->peer_ht_rates.rates[n++] = i; in ath10k_peer_assoc_h_ht()
2379 * This is a workaround for HT-enabled STAs which break the spec in ath10k_peer_assoc_h_ht()
2388 arg->peer_ht_rates.num_rates = 8; in ath10k_peer_assoc_h_ht()
2389 for (i = 0; i < arg->peer_ht_rates.num_rates; i++) in ath10k_peer_assoc_h_ht()
2390 arg->peer_ht_rates.rates[i] = i; in ath10k_peer_assoc_h_ht()
2392 arg->peer_ht_rates.num_rates = n; in ath10k_peer_assoc_h_ht()
2393 arg->peer_num_spatial_streams = min(sta->deflink.rx_nss, in ath10k_peer_assoc_h_ht()
2398 arg->addr, in ath10k_peer_assoc_h_ht()
2399 arg->peer_ht_rates.num_rates, in ath10k_peer_assoc_h_ht()
2400 arg->peer_num_spatial_streams); in ath10k_peer_assoc_h_ht()
2411 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_qos_ap()
2413 if (sta->wme && sta->uapsd_queues) { in ath10k_peer_assoc_qos_ap()
2415 sta->uapsd_queues, sta->max_sp); in ath10k_peer_assoc_qos_ap()
2417 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) in ath10k_peer_assoc_qos_ap()
2420 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VI) in ath10k_peer_assoc_qos_ap()
2423 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BK) in ath10k_peer_assoc_qos_ap()
2426 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BE) in ath10k_peer_assoc_qos_ap()
2430 if (sta->max_sp < MAX_WMI_AP_PS_PEER_PARAM_MAX_SP) in ath10k_peer_assoc_qos_ap()
2431 max_sp = sta->max_sp; in ath10k_peer_assoc_qos_ap()
2433 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, in ath10k_peer_assoc_qos_ap()
2434 sta->addr, in ath10k_peer_assoc_qos_ap()
2439 arvif->vdev_id, ret); in ath10k_peer_assoc_qos_ap()
2443 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, in ath10k_peer_assoc_qos_ap()
2444 sta->addr, in ath10k_peer_assoc_qos_ap()
2449 arvif->vdev_id, ret); in ath10k_peer_assoc_qos_ap()
2455 * sta->listen_interval - mac80211 patch required. in ath10k_peer_assoc_qos_ap()
2458 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, sta->addr, in ath10k_peer_assoc_qos_ap()
2463 arvif->vdev_id, ret); in ath10k_peer_assoc_qos_ap()
2485 idx_limit = fls(mcs_map) - 1; in ath10k_peer_assoc_h_vht_limit()
2487 idx_limit = -1; in ath10k_peer_assoc_h_vht_limit()
2501 case -1: in ath10k_peer_assoc_h_vht_limit()
2551 const struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; in ath10k_peer_assoc_h_vht()
2552 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_vht()
2553 struct ath10k_hw_params *hw = &ar->hw_params; in ath10k_peer_assoc_h_vht()
2564 if (!vht_cap->vht_supported) in ath10k_peer_assoc_h_vht()
2567 band = def.chan->band; in ath10k_peer_assoc_h_vht()
2568 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_peer_assoc_h_vht()
2573 arg->peer_flags |= ar->wmi.peer_flags->vht; in ath10k_peer_assoc_h_vht()
2575 if (def.chan->band == NL80211_BAND_2GHZ) in ath10k_peer_assoc_h_vht()
2576 arg->peer_flags |= ar->wmi.peer_flags->vht_2g; in ath10k_peer_assoc_h_vht()
2578 arg->peer_vht_caps = vht_cap->cap; in ath10k_peer_assoc_h_vht()
2580 ampdu_factor = (vht_cap->cap & in ath10k_peer_assoc_h_vht()
2584 /* Workaround: Some Netgear/Linksys 11ac APs set Rx A-MPDU factor to in ath10k_peer_assoc_h_vht()
2586 * arg->peer_max_mpdu at this point contains HT max_mpdu so keep in ath10k_peer_assoc_h_vht()
2589 arg->peer_max_mpdu = max(arg->peer_max_mpdu, in ath10k_peer_assoc_h_vht()
2591 ampdu_factor)) - 1); in ath10k_peer_assoc_h_vht()
2593 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) in ath10k_peer_assoc_h_vht()
2594 arg->peer_flags |= ar->wmi.peer_flags->bw80; in ath10k_peer_assoc_h_vht()
2596 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) in ath10k_peer_assoc_h_vht()
2597 arg->peer_flags |= ar->wmi.peer_flags->bw160; in ath10k_peer_assoc_h_vht()
2603 vht_mcs = __le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map) >> in ath10k_peer_assoc_h_vht()
2610 arg->peer_num_spatial_streams = min(sta->deflink.rx_nss, max_nss); in ath10k_peer_assoc_h_vht()
2611 arg->peer_vht_rates.rx_max_rate = in ath10k_peer_assoc_h_vht()
2612 __le16_to_cpu(vht_cap->vht_mcs.rx_highest); in ath10k_peer_assoc_h_vht()
2613 arg->peer_vht_rates.rx_mcs_set = in ath10k_peer_assoc_h_vht()
2614 __le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map); in ath10k_peer_assoc_h_vht()
2615 arg->peer_vht_rates.tx_max_rate = in ath10k_peer_assoc_h_vht()
2616 __le16_to_cpu(vht_cap->vht_mcs.tx_highest); in ath10k_peer_assoc_h_vht()
2617 arg->peer_vht_rates.tx_mcs_set = ath10k_peer_assoc_h_vht_limit( in ath10k_peer_assoc_h_vht()
2618 __le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); in ath10k_peer_assoc_h_vht()
2620 /* Configure bandwidth-NSS mapping to FW in ath10k_peer_assoc_h_vht()
2623 if (arg->peer_phymode == MODE_11AC_VHT160 || in ath10k_peer_assoc_h_vht()
2624 arg->peer_phymode == MODE_11AC_VHT80_80) { in ath10k_peer_assoc_h_vht()
2628 max_rate = arg->peer_vht_rates.rx_max_rate; in ath10k_peer_assoc_h_vht()
2632 rx_nss = arg->peer_num_spatial_streams; in ath10k_peer_assoc_h_vht()
2634 rx_nss = min(arg->peer_num_spatial_streams, rx_nss); in ath10k_peer_assoc_h_vht()
2636 max_rate = hw->vht160_mcs_tx_highest; in ath10k_peer_assoc_h_vht()
2639 arg->peer_bw_rxnss_override = in ath10k_peer_assoc_h_vht()
2641 FIELD_PREP(WMI_PEER_NSS_160MHZ_MASK, (rx_nss - 1)); in ath10k_peer_assoc_h_vht()
2643 if (arg->peer_phymode == MODE_11AC_VHT80_80) { in ath10k_peer_assoc_h_vht()
2644 arg->peer_bw_rxnss_override |= in ath10k_peer_assoc_h_vht()
2645 FIELD_PREP(WMI_PEER_NSS_80_80MHZ_MASK, (rx_nss - 1)); in ath10k_peer_assoc_h_vht()
2650 sta->addr, arg->peer_max_mpdu, in ath10k_peer_assoc_h_vht()
2651 arg->peer_flags, arg->peer_bw_rxnss_override); in ath10k_peer_assoc_h_vht()
2659 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_qos()
2661 switch (arvif->vdev_type) { in ath10k_peer_assoc_h_qos()
2663 if (sta->wme) in ath10k_peer_assoc_h_qos()
2664 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2666 if (sta->wme && sta->uapsd_queues) { in ath10k_peer_assoc_h_qos()
2667 arg->peer_flags |= arvif->ar->wmi.peer_flags->apsd; in ath10k_peer_assoc_h_qos()
2668 arg->peer_rate_caps |= WMI_RC_UAPSD_FLAG; in ath10k_peer_assoc_h_qos()
2672 if (sta->wme) in ath10k_peer_assoc_h_qos()
2673 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2676 if (sta->wme) in ath10k_peer_assoc_h_qos()
2677 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2684 sta->addr, !!(arg->peer_flags & in ath10k_peer_assoc_h_qos()
2685 arvif->ar->wmi.peer_flags->qos)); in ath10k_peer_assoc_h_qos()
2690 return sta->deflink.supp_rates[NL80211_BAND_2GHZ] >> in ath10k_mac_sta_has_ofdm_only()
2697 struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; in ath10k_mac_get_phymode_vht()
2699 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) { in ath10k_mac_get_phymode_vht()
2700 switch (vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) { in ath10k_mac_get_phymode_vht()
2711 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) in ath10k_mac_get_phymode_vht()
2714 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath10k_mac_get_phymode_vht()
2717 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_20) in ath10k_mac_get_phymode_vht()
2728 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_phymode()
2738 band = def.chan->band; in ath10k_peer_assoc_h_phymode()
2739 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath10k_peer_assoc_h_phymode()
2740 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_peer_assoc_h_phymode()
2744 if (sta->deflink.vht_cap.vht_supported && in ath10k_peer_assoc_h_phymode()
2746 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath10k_peer_assoc_h_phymode()
2750 } else if (sta->deflink.ht_cap.ht_supported && in ath10k_peer_assoc_h_phymode()
2752 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath10k_peer_assoc_h_phymode()
2767 if (sta->deflink.vht_cap.vht_supported && in ath10k_peer_assoc_h_phymode()
2770 } else if (sta->deflink.ht_cap.ht_supported && in ath10k_peer_assoc_h_phymode()
2772 if (sta->deflink.bandwidth >= IEEE80211_STA_RX_BW_40) in ath10k_peer_assoc_h_phymode()
2786 sta->addr, ath10k_wmi_phymode_str(phymode)); in ath10k_peer_assoc_h_phymode()
2788 arg->peer_phymode = phymode; in ath10k_peer_assoc_h_phymode()
2797 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_prepare()
2825 if (!ht_cap->ht_supported) in ath10k_setup_peer_smps()
2828 smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS; in ath10k_setup_peer_smps()
2832 return -EINVAL; in ath10k_setup_peer_smps()
2834 return ath10k_wmi_peer_set_param(ar, arvif->vdev_id, addr, in ath10k_setup_peer_smps()
2835 ar->wmi.peer_param->smps_state, in ath10k_setup_peer_smps()
2843 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_vif_recalc_txbf()
2851 if (!(ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2858 param = ar->wmi.vdev_param->txbf; in ath10k_mac_vif_recalc_txbf()
2868 if (ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2878 if (ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2894 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, value); in ath10k_mac_vif_recalc_txbf()
2908 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_mac_is_connected()
2909 if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath10k_mac_is_connected()
2923 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_txpower_setup()
2931 if (connected && ar->tx_power_2g_limit) in ath10k_mac_txpower_setup()
2932 if (tx_power_2g > ar->tx_power_2g_limit) in ath10k_mac_txpower_setup()
2933 tx_power_2g = ar->tx_power_2g_limit; in ath10k_mac_txpower_setup()
2935 if (connected && ar->tx_power_5g_limit) in ath10k_mac_txpower_setup()
2936 if (tx_power_5g > ar->tx_power_5g_limit) in ath10k_mac_txpower_setup()
2937 tx_power_5g = ar->tx_power_5g_limit; in ath10k_mac_txpower_setup()
2942 param = ar->wmi.pdev_param->txpower_limit2g; in ath10k_mac_txpower_setup()
2950 param = ar->wmi.pdev_param->txpower_limit5g; in ath10k_mac_txpower_setup()
2964 int ret, txpower = -1; in ath10k_mac_txpower_recalc()
2966 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_txpower_recalc()
2968 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_mac_txpower_recalc()
2970 if (arvif->txpower == INT_MIN) in ath10k_mac_txpower_recalc()
2973 if (txpower == -1) in ath10k_mac_txpower_recalc()
2974 txpower = arvif->txpower; in ath10k_mac_txpower_recalc()
2976 txpower = min(txpower, arvif->txpower); in ath10k_mac_txpower_recalc()
2979 if (txpower == -1) in ath10k_mac_txpower_recalc()
2994 if (!ar->hw_params.dynamic_sar_support) in ath10k_mac_set_sar_power()
2995 return -EOPNOTSUPP; in ath10k_mac_set_sar_power()
3000 /* if connected, then arvif->txpower must be valid */ in ath10k_mac_set_sar_power()
3008 struct ath10k *ar = hw->priv; in ath10k_mac_set_sar_specs()
3012 mutex_lock(&ar->conf_mutex); in ath10k_mac_set_sar_specs()
3014 if (!ar->hw_params.dynamic_sar_support) { in ath10k_mac_set_sar_specs()
3015 ret = -EOPNOTSUPP; in ath10k_mac_set_sar_specs()
3019 if (!sar || sar->type != NL80211_SAR_TYPE_POWER || in ath10k_mac_set_sar_specs()
3020 sar->num_sub_specs == 0) { in ath10k_mac_set_sar_specs()
3021 ret = -EINVAL; in ath10k_mac_set_sar_specs()
3025 sub_specs = sar->sub_specs; in ath10k_mac_set_sar_specs()
3030 ar->tx_power_2g_limit = 0; in ath10k_mac_set_sar_specs()
3031 ar->tx_power_5g_limit = 0; in ath10k_mac_set_sar_specs()
3036 for (i = 0; i < sar->num_sub_specs; i++) { in ath10k_mac_set_sar_specs()
3037 if (sub_specs->freq_range_index == 0) in ath10k_mac_set_sar_specs()
3038 ar->tx_power_2g_limit = sub_specs->power / 2; in ath10k_mac_set_sar_specs()
3039 else if (sub_specs->freq_range_index == 1) in ath10k_mac_set_sar_specs()
3040 ar->tx_power_5g_limit = sub_specs->power / 2; in ath10k_mac_set_sar_specs()
3052 mutex_unlock(&ar->conf_mutex); in ath10k_mac_set_sar_specs()
3061 struct ath10k *ar = hw->priv; in ath10k_bss_assoc()
3062 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_bss_assoc()
3069 lockdep_assert_held(&ar->conf_mutex); in ath10k_bss_assoc()
3072 arvif->vdev_id, arvif->bssid, arvif->aid); in ath10k_bss_assoc()
3076 ap_sta = ieee80211_find_sta(vif, bss_conf->bssid); in ath10k_bss_assoc()
3079 bss_conf->bssid, arvif->vdev_id); in ath10k_bss_assoc()
3087 ht_cap = ap_sta->deflink.ht_cap; in ath10k_bss_assoc()
3088 vht_cap = ap_sta->deflink.vht_cap; in ath10k_bss_assoc()
3093 bss_conf->bssid, arvif->vdev_id, ret); in ath10k_bss_assoc()
3103 bss_conf->bssid, arvif->vdev_id, ret); in ath10k_bss_assoc()
3107 ret = ath10k_setup_peer_smps(ar, arvif, bss_conf->bssid, &ht_cap); in ath10k_bss_assoc()
3110 arvif->vdev_id, ret); in ath10k_bss_assoc()
3117 arvif->vdev_id, bss_conf->bssid, ret); in ath10k_bss_assoc()
3123 arvif->vdev_id, bss_conf->bssid, vif->cfg.aid); in ath10k_bss_assoc()
3125 WARN_ON(arvif->is_up); in ath10k_bss_assoc()
3127 arvif->aid = vif->cfg.aid; in ath10k_bss_assoc()
3128 ether_addr_copy(arvif->bssid, bss_conf->bssid); in ath10k_bss_assoc()
3131 ar->wmi.pdev_param->peer_stats_info_enable, 1); in ath10k_bss_assoc()
3135 ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid); in ath10k_bss_assoc()
3138 arvif->vdev_id, ret); in ath10k_bss_assoc()
3142 arvif->is_up = true; in ath10k_bss_assoc()
3147 * WLAN.RM.2.0-00073) have buggy powersave state machine and must be in ath10k_bss_assoc()
3150 ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, arvif->bssid, in ath10k_bss_assoc()
3151 ar->wmi.peer_param->dummy_var, 1); in ath10k_bss_assoc()
3154 arvif->bssid, arvif->vdev_id, ret); in ath10k_bss_assoc()
3162 struct ath10k *ar = hw->priv; in ath10k_bss_disassoc()
3163 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_bss_disassoc()
3167 lockdep_assert_held(&ar->conf_mutex); in ath10k_bss_disassoc()
3170 arvif->vdev_id, arvif->bssid); in ath10k_bss_disassoc()
3172 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_bss_disassoc()
3175 arvif->vdev_id, ret); in ath10k_bss_disassoc()
3177 arvif->def_wep_key_idx = -1; in ath10k_bss_disassoc()
3182 arvif->vdev_id, ret); in ath10k_bss_disassoc()
3186 arvif->is_up = false; in ath10k_bss_disassoc()
3190 cancel_delayed_work_sync(&arvif->connection_loss_work); in ath10k_bss_disassoc()
3198 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_new_peer_tid_config()
3204 if (arvif->retry_long[i] || arvif->ampdu[i] || in ath10k_new_peer_tid_config()
3205 arvif->rate_ctrl[i] || arvif->rtscts[i]) { in ath10k_new_peer_tid_config()
3208 arg.vdev_id = arvif->vdev_id; in ath10k_new_peer_tid_config()
3209 arg.retry_count = arvif->retry_long[i]; in ath10k_new_peer_tid_config()
3210 arg.aggr_control = arvif->ampdu[i]; in ath10k_new_peer_tid_config()
3211 arg.rate_ctrl = arvif->rate_ctrl[i]; in ath10k_new_peer_tid_config()
3212 arg.rcode_flags = arvif->rate_code[i]; in ath10k_new_peer_tid_config()
3214 if (arvif->rtscts[i]) in ath10k_new_peer_tid_config()
3220 arg.rtscts_ctrl = arvif->rtscts[i]; in ath10k_new_peer_tid_config()
3223 if (arvif->noack[i]) { in ath10k_new_peer_tid_config()
3224 arg.ack_policy = arvif->noack[i]; in ath10k_new_peer_tid_config()
3230 /* Assign default value(-1) to newly connected station. in ath10k_new_peer_tid_config()
3234 arsta->retry_long[i] = -1; in ath10k_new_peer_tid_config()
3235 arsta->noack[i] = -1; in ath10k_new_peer_tid_config()
3236 arsta->ampdu[i] = -1; in ath10k_new_peer_tid_config()
3241 ether_addr_copy(arg.peer_macaddr.addr, sta->addr); in ath10k_new_peer_tid_config()
3246 sta->addr, ret); in ath10k_new_peer_tid_config()
3261 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_station_assoc()
3265 lockdep_assert_held(&ar->conf_mutex); in ath10k_station_assoc()
3270 sta->addr, arvif->vdev_id, ret); in ath10k_station_assoc()
3277 sta->addr, arvif->vdev_id, ret); in ath10k_station_assoc()
3281 /* Re-assoc is run only to update supported rates for given station. It in ath10k_station_assoc()
3282 * doesn't make much sense to reconfigure the peer completely. in ath10k_station_assoc()
3285 ret = ath10k_setup_peer_smps(ar, arvif, sta->addr, in ath10k_station_assoc()
3286 &sta->deflink.ht_cap); in ath10k_station_assoc()
3289 arvif->vdev_id, ret); in ath10k_station_assoc()
3296 sta->addr, arvif->vdev_id, ret); in ath10k_station_assoc()
3300 if (!sta->wme) { in ath10k_station_assoc()
3301 arvif->num_legacy_stations++; in ath10k_station_assoc()
3305 arvif->vdev_id, ret); in ath10k_station_assoc()
3311 if ((arvif->def_wep_key_idx != -1) && (!sta->tdls)) { in ath10k_station_assoc()
3312 ret = ath10k_install_peer_wep_keys(arvif, sta->addr); in ath10k_station_assoc()
3315 arvif->vdev_id, ret); in ath10k_station_assoc()
3321 if (!test_bit(WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT, ar->wmi.svc_map)) in ath10k_station_assoc()
3331 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_station_disassoc()
3334 lockdep_assert_held(&ar->conf_mutex); in ath10k_station_disassoc()
3336 if (!sta->wme) { in ath10k_station_disassoc()
3337 arvif->num_legacy_stations--; in ath10k_station_disassoc()
3341 arvif->vdev_id, ret); in ath10k_station_disassoc()
3346 ret = ath10k_clear_peer_keys(arvif, sta->addr); in ath10k_station_disassoc()
3349 arvif->vdev_id, ret); in ath10k_station_disassoc()
3362 struct ieee80211_hw *hw = ar->hw; in ath10k_update_channel_list()
3373 lockdep_assert_held(&ar->conf_mutex); in ath10k_update_channel_list()
3375 bands = hw->wiphy->bands; in ath10k_update_channel_list()
3380 for (i = 0; i < bands[band]->n_channels; i++) { in ath10k_update_channel_list()
3381 if (bands[band]->channels[i].flags & in ath10k_update_channel_list()
3392 return -ENOMEM; in ath10k_update_channel_list()
3399 for (i = 0; i < bands[band]->n_channels; i++) { in ath10k_update_channel_list()
3400 channel = &bands[band]->channels[i]; in ath10k_update_channel_list()
3402 if (channel->flags & IEEE80211_CHAN_DISABLED) in ath10k_update_channel_list()
3405 ch->allow_ht = true; in ath10k_update_channel_list()
3408 ch->allow_vht = true; in ath10k_update_channel_list()
3410 ch->allow_ibss = in ath10k_update_channel_list()
3411 !(channel->flags & IEEE80211_CHAN_NO_IR); in ath10k_update_channel_list()
3413 ch->ht40plus = in ath10k_update_channel_list()
3414 !(channel->flags & IEEE80211_CHAN_NO_HT40PLUS); in ath10k_update_channel_list()
3416 ch->chan_radar = in ath10k_update_channel_list()
3417 !!(channel->flags & IEEE80211_CHAN_RADAR); in ath10k_update_channel_list()
3419 passive = channel->flags & IEEE80211_CHAN_NO_IR; in ath10k_update_channel_list()
3420 ch->passive = passive; in ath10k_update_channel_list()
3427 ch->passive |= ch->chan_radar; in ath10k_update_channel_list()
3429 ch->freq = channel->center_freq; in ath10k_update_channel_list()
3430 ch->band_center_freq1 = channel->center_freq; in ath10k_update_channel_list()
3431 ch->min_power = 0; in ath10k_update_channel_list()
3432 ch->max_power = channel->max_power * 2; in ath10k_update_channel_list()
3433 ch->max_reg_power = channel->max_reg_power * 2; in ath10k_update_channel_list()
3434 ch->max_antenna_gain = channel->max_antenna_gain; in ath10k_update_channel_list()
3435 ch->reg_class_id = 0; /* FIXME */ in ath10k_update_channel_list()
3441 if (channel->band == NL80211_BAND_2GHZ) in ath10k_update_channel_list()
3442 ch->mode = MODE_11G; in ath10k_update_channel_list()
3444 ch->mode = MODE_11A; in ath10k_update_channel_list()
3446 if (WARN_ON_ONCE(ch->mode == MODE_UNKNOWN)) in ath10k_update_channel_list()
3451 ch - arg.channels, arg.n_channels, in ath10k_update_channel_list()
3452 ch->freq, ch->max_power, ch->max_reg_power, in ath10k_update_channel_list()
3453 ch->max_antenna_gain, ch->mode); in ath10k_update_channel_list()
3488 lockdep_assert_held(&ar->conf_mutex); in ath10k_regd_update()
3494 regpair = ar->ath_common.regulatory.regpair; in ath10k_regd_update()
3496 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { in ath10k_regd_update()
3497 nl_dfs_reg = ar->dfs_detector->region; in ath10k_regd_update()
3503 /* Target allows setting up per-band regdomain but ath_common provides in ath10k_regd_update()
3507 regpair->reg_domain, in ath10k_regd_update()
3508 regpair->reg_domain, /* 2ghz */ in ath10k_regd_update()
3509 regpair->reg_domain, /* 5ghz */ in ath10k_regd_update()
3510 regpair->reg_2ghz_ctl, in ath10k_regd_update()
3511 regpair->reg_5ghz_ctl, in ath10k_regd_update()
3522 if (ar->low_5ghz_chan && ar->high_5ghz_chan) { in ath10k_mac_update_channel_list()
3523 for (i = 0; i < band->n_channels; i++) { in ath10k_mac_update_channel_list()
3524 if (band->channels[i].center_freq < ar->low_5ghz_chan || in ath10k_mac_update_channel_list()
3525 band->channels[i].center_freq > ar->high_5ghz_chan) in ath10k_mac_update_channel_list()
3526 band->channels[i].flags |= in ath10k_mac_update_channel_list()
3536 struct ath10k *ar = hw->priv; in ath10k_reg_notifier()
3539 ath_reg_notifier_apply(wiphy, request, &ar->ath_common.regulatory); in ath10k_reg_notifier()
3541 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { in ath10k_reg_notifier()
3543 request->dfs_region); in ath10k_reg_notifier()
3544 result = ar->dfs_detector->set_dfs_domain(ar->dfs_detector, in ath10k_reg_notifier()
3545 request->dfs_region); in ath10k_reg_notifier()
3548 request->dfs_region); in ath10k_reg_notifier()
3551 mutex_lock(&ar->conf_mutex); in ath10k_reg_notifier()
3552 if (ar->state == ATH10K_STATE_ON) in ath10k_reg_notifier()
3554 mutex_unlock(&ar->conf_mutex); in ath10k_reg_notifier()
3556 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_reg_notifier()
3558 ar->hw->wiphy->bands[NL80211_BAND_5GHZ]); in ath10k_reg_notifier()
3563 spin_lock_bh(&ar->data_lock); in ath10k_stop_radar_confirmation()
3564 ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_STOPPED; in ath10k_stop_radar_confirmation()
3565 spin_unlock_bh(&ar->data_lock); in ath10k_stop_radar_confirmation()
3567 cancel_work_sync(&ar->radar_confirmation_work); in ath10k_stop_radar_confirmation()
3583 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_tx_lock()
3586 ar->tx_paused |= BIT(reason); in ath10k_mac_tx_lock()
3587 ieee80211_stop_queues(ar->hw); in ath10k_mac_tx_lock()
3594 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_tx_unlock_iter()
3596 if (arvif->tx_paused) in ath10k_mac_tx_unlock_iter()
3599 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_mac_tx_unlock_iter()
3604 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_tx_unlock()
3607 ar->tx_paused &= ~BIT(reason); in ath10k_mac_tx_unlock()
3609 if (ar->tx_paused) in ath10k_mac_tx_unlock()
3612 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_tx_unlock()
3617 ieee80211_wake_queue(ar->hw, ar->hw->offchannel_tx_hw_queue); in ath10k_mac_tx_unlock()
3622 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_tx_lock()
3624 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_tx_lock()
3627 arvif->tx_paused |= BIT(reason); in ath10k_mac_vif_tx_lock()
3628 ieee80211_stop_queue(ar->hw, arvif->vdev_id); in ath10k_mac_vif_tx_lock()
3633 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_tx_unlock()
3635 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_tx_unlock()
3638 arvif->tx_paused &= ~BIT(reason); in ath10k_mac_vif_tx_unlock()
3640 if (ar->tx_paused) in ath10k_mac_vif_tx_unlock()
3643 if (arvif->tx_paused) in ath10k_mac_vif_tx_unlock()
3646 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_mac_vif_tx_unlock()
3653 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_handle_tx_pause()
3655 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_handle_tx_pause()
3667 action, arvif->vdev_id); in ath10k_mac_vif_handle_tx_pause()
3681 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_handle_tx_pause_iter()
3684 if (arvif->vdev_id != arg->vdev_id) in ath10k_mac_handle_tx_pause_iter()
3687 ath10k_mac_vif_handle_tx_pause(arvif, arg->pause_id, arg->action); in ath10k_mac_handle_tx_pause_iter()
3700 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_handle_tx_pause_vdev()
3701 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_tx_pause_vdev()
3705 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_handle_tx_pause_vdev()
3714 const struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_mac_tx_h_get_txmode()
3716 __le16 fc = hdr->frame_control; in ath10k_mac_tx_h_get_txmode()
3718 if (IEEE80211_SKB_CB(skb)->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) in ath10k_mac_tx_h_get_txmode()
3721 if (!vif || vif->type == NL80211_IFTYPE_MONITOR) in ath10k_mac_tx_h_get_txmode()
3731 * accurate - otherwise either mac80211 or userspace (e.g. hostapd) can in ath10k_mac_tx_h_get_txmode()
3743 if (ar->htt.target_version_major < 3 && in ath10k_mac_tx_h_get_txmode()
3746 ar->running_fw->fw_file.fw_features)) in ath10k_mac_tx_h_get_txmode()
3751 * Some wmi-tlv firmwares for qca6174 have broken Tx key selection for in ath10k_mac_tx_h_get_txmode()
3752 * NativeWifi txmode - it selects AP key instead of peer key. It seems in ath10k_mac_tx_h_get_txmode()
3757 if (ieee80211_is_data_present(fc) && sta && sta->tdls) in ath10k_mac_tx_h_get_txmode()
3760 if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) || in ath10k_mac_tx_h_get_txmode()
3761 skb_cb->flags & ATH10K_SKB_F_RAW_TX) in ath10k_mac_tx_h_get_txmode()
3771 const struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_tx_h_use_hwcrypto()
3775 if (!ieee80211_has_protected(hdr->frame_control)) in ath10k_tx_h_use_hwcrypto()
3778 if ((info->flags & mask) == mask) in ath10k_tx_h_use_hwcrypto()
3782 return !((struct ath10k_vif *)vif->drv_priv)->nohwcrypt; in ath10k_tx_h_use_hwcrypto()
3792 struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_tx_h_nwifi()
3796 if (!ieee80211_is_data_qos(hdr->frame_control)) in ath10k_tx_h_nwifi()
3800 memmove(skb->data + IEEE80211_QOS_CTL_LEN, in ath10k_tx_h_nwifi()
3801 skb->data, (void *)qos_ctl - (void *)skb->data); in ath10k_tx_h_nwifi()
3808 hdr = (void *)skb->data; in ath10k_tx_h_nwifi()
3809 if (ieee80211_is_qos_nullfunc(hdr->frame_control)) in ath10k_tx_h_nwifi()
3810 cb->flags &= ~ATH10K_SKB_F_QOS; in ath10k_tx_h_nwifi()
3812 hdr->frame_control &= ~__cpu_to_le16(IEEE80211_STYPE_QOS_DATA); in ath10k_tx_h_nwifi()
3825 hdr = (void *)skb->data; in ath10k_tx_h_8023()
3826 hdrlen = ieee80211_hdrlen(hdr->frame_control); in ath10k_tx_h_8023()
3827 rfc1042 = (void *)skb->data + hdrlen; in ath10k_tx_h_8023()
3831 type = rfc1042->snap_type; in ath10k_tx_h_8023()
3836 eth = (void *)skb->data; in ath10k_tx_h_8023()
3837 ether_addr_copy(eth->h_dest, da); in ath10k_tx_h_8023()
3838 ether_addr_copy(eth->h_source, sa); in ath10k_tx_h_8023()
3839 eth->h_proto = type; in ath10k_tx_h_8023()
3846 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in ath10k_tx_h_add_p2p_noa_ie()
3847 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_tx_h_add_p2p_noa_ie()
3850 if (vif->type != NL80211_IFTYPE_AP || !vif->p2p) in ath10k_tx_h_add_p2p_noa_ie()
3853 if (unlikely(ieee80211_is_probe_resp(hdr->frame_control))) { in ath10k_tx_h_add_p2p_noa_ie()
3854 spin_lock_bh(&ar->data_lock); in ath10k_tx_h_add_p2p_noa_ie()
3855 if (arvif->u.ap.noa_data) in ath10k_tx_h_add_p2p_noa_ie()
3856 if (!pskb_expand_head(skb, 0, arvif->u.ap.noa_len, in ath10k_tx_h_add_p2p_noa_ie()
3858 skb_put_data(skb, arvif->u.ap.noa_data, in ath10k_tx_h_add_p2p_noa_ie()
3859 arvif->u.ap.noa_len); in ath10k_tx_h_add_p2p_noa_ie()
3860 spin_unlock_bh(&ar->data_lock); in ath10k_tx_h_add_p2p_noa_ie()
3870 struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_mac_tx_h_fill_cb()
3873 bool is_data = ieee80211_is_data(hdr->frame_control) || in ath10k_mac_tx_h_fill_cb()
3874 ieee80211_is_data_qos(hdr->frame_control); in ath10k_mac_tx_h_fill_cb()
3875 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_tx_h_fill_cb()
3880 cb->flags = 0; in ath10k_mac_tx_h_fill_cb()
3882 if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { in ath10k_mac_tx_h_fill_cb()
3883 cb->flags |= ATH10K_SKB_F_QOS; /* Assume data frames are QoS */ in ath10k_mac_tx_h_fill_cb()
3888 cb->flags |= ATH10K_SKB_F_NO_HWCRYPT; in ath10k_mac_tx_h_fill_cb()
3890 if (ieee80211_is_mgmt(hdr->frame_control)) in ath10k_mac_tx_h_fill_cb()
3891 cb->flags |= ATH10K_SKB_F_MGMT; in ath10k_mac_tx_h_fill_cb()
3893 if (ieee80211_is_data_qos(hdr->frame_control)) { in ath10k_mac_tx_h_fill_cb()
3894 cb->flags |= ATH10K_SKB_F_QOS; in ath10k_mac_tx_h_fill_cb()
3898 if (arvif->noack[tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_tx_h_fill_cb()
3902 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_tx_h_fill_cb()
3904 if (arsta->noack[tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_tx_h_fill_cb()
3907 if (arsta->noack[tid] == WMI_PEER_TID_CONFIG_ACK) in ath10k_mac_tx_h_fill_cb()
3912 cb->flags |= ATH10K_SKB_F_NOACK_TID; in ath10k_mac_tx_h_fill_cb()
3919 if (is_data && ieee80211_has_protected(hdr->frame_control) && in ath10k_mac_tx_h_fill_cb()
3920 !info->control.hw_key) { in ath10k_mac_tx_h_fill_cb()
3921 cb->flags |= ATH10K_SKB_F_NO_HWCRYPT; in ath10k_mac_tx_h_fill_cb()
3922 cb->flags |= ATH10K_SKB_F_RAW_TX; in ath10k_mac_tx_h_fill_cb()
3926 cb->vif = vif; in ath10k_mac_tx_h_fill_cb()
3927 cb->txq = txq; in ath10k_mac_tx_h_fill_cb()
3928 cb->airtime_est = airtime; in ath10k_mac_tx_h_fill_cb()
3930 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_tx_h_fill_cb()
3931 spin_lock_bh(&ar->data_lock); in ath10k_mac_tx_h_fill_cb()
3932 cb->ucast_cipher = arsta->ucast_cipher; in ath10k_mac_tx_h_fill_cb()
3933 spin_unlock_bh(&ar->data_lock); in ath10k_mac_tx_h_fill_cb()
3941 * offchannel tx (and actually creating them causes issues with wmi-htc in ath10k_mac_tx_frm_has_freq()
3945 return (ar->htt.target_version_major >= 3 && in ath10k_mac_tx_frm_has_freq()
3946 ar->htt.target_version_minor >= 4 && in ath10k_mac_tx_frm_has_freq()
3947 ar->running_fw->fw_file.htt_op_version == ATH10K_FW_HTT_OP_VERSION_TLV); in ath10k_mac_tx_frm_has_freq()
3952 struct sk_buff_head *q = &ar->wmi_mgmt_tx_queue; in ath10k_mac_tx_wmi_mgmt()
3956 return -ENOSPC; in ath10k_mac_tx_wmi_mgmt()
3960 ieee80211_queue_work(ar->hw, &ar->wmi_mgmt_tx_work); in ath10k_mac_tx_wmi_mgmt()
3977 ar->running_fw->fw_file.fw_features) || in ath10k_mac_tx_h_get_txpath()
3979 ar->wmi.svc_map)) in ath10k_mac_tx_h_get_txpath()
3981 else if (ar->htt.target_version_major >= 3) in ath10k_mac_tx_h_get_txpath()
3995 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_tx_submit()
3996 int ret = -EINVAL; in ath10k_mac_tx_submit()
4010 ret = -EINVAL; in ath10k_mac_tx_submit()
4017 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_tx_submit()
4032 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_tx()
4038 if (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE) in ath10k_mac_tx()
4049 /* Convert 802.11->802.3 header only if the frame was earlier in ath10k_mac_tx()
4052 if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) in ath10k_mac_tx()
4056 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) && in ath10k_mac_tx()
4057 !(skb_cb->flags & ATH10K_SKB_F_RAW_TX)) { in ath10k_mac_tx()
4060 return -EOPNOTSUPP; in ath10k_mac_tx()
4064 if (!noque_offchan && info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) { in ath10k_mac_tx()
4067 skb, skb->len); in ath10k_mac_tx()
4069 skb_queue_tail(&ar->offchan_tx_queue, skb); in ath10k_mac_tx()
4070 ieee80211_queue_work(hw, &ar->offchan_tx_work); in ath10k_mac_tx()
4089 skb = skb_dequeue(&ar->offchan_tx_queue); in ath10k_offchan_tx_purge()
4093 ieee80211_free_txskb(ar->hw, skb); in ath10k_offchan_tx_purge()
4123 skb = skb_dequeue(&ar->offchan_tx_queue); in ath10k_offchan_tx_work()
4127 mutex_lock(&ar->conf_mutex); in ath10k_offchan_tx_work()
4130 skb, skb->len); in ath10k_offchan_tx_work()
4132 hdr = (struct ieee80211_hdr *)skb->data; in ath10k_offchan_tx_work()
4135 spin_lock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4136 vdev_id = ar->scan.vdev_id; in ath10k_offchan_tx_work()
4138 spin_unlock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4153 spin_lock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4154 reinit_completion(&ar->offchan_tx_completed); in ath10k_offchan_tx_work()
4155 ar->offchan_tx_skb = skb; in ath10k_offchan_tx_work()
4156 spin_unlock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4158 /* It's safe to access vif and sta - conf_mutex guarantees that in ath10k_offchan_tx_work()
4164 vif = arvif->vif; in ath10k_offchan_tx_work()
4182 wait_for_completion_timeout(&ar->offchan_tx_completed, 3 * HZ); in ath10k_offchan_tx_work()
4185 skb, skb->len); in ath10k_offchan_tx_work()
4194 mutex_unlock(&ar->conf_mutex); in ath10k_offchan_tx_work()
4203 skb = skb_dequeue(&ar->wmi_mgmt_tx_queue); in ath10k_mgmt_over_wmi_tx_purge()
4207 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_purge()
4219 skb = skb_dequeue(&ar->wmi_mgmt_tx_queue); in ath10k_mgmt_over_wmi_tx_work()
4224 ar->running_fw->fw_file.fw_features)) { in ath10k_mgmt_over_wmi_tx_work()
4225 paddr = dma_map_single(ar->dev, skb->data, in ath10k_mgmt_over_wmi_tx_work()
4226 skb->len, DMA_TO_DEVICE); in ath10k_mgmt_over_wmi_tx_work()
4227 if (dma_mapping_error(ar->dev, paddr)) { in ath10k_mgmt_over_wmi_tx_work()
4228 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4238 dma_unmap_single(ar->dev, paddr, skb->len, in ath10k_mgmt_over_wmi_tx_work()
4240 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4247 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4260 artxq = (void *)txq->drv_priv; in ath10k_mac_txq_init()
4261 INIT_LIST_HEAD(&artxq->list); in ath10k_mac_txq_init()
4273 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_txq_unref()
4274 idr_for_each_entry(&ar->htt.pending_tx, msdu, msdu_id) { in ath10k_mac_txq_unref()
4276 if (cb->txq == txq) in ath10k_mac_txq_unref()
4277 cb->txq = NULL; in ath10k_mac_txq_unref()
4279 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_txq_unref()
4288 lockdep_assert_held(&ar->data_lock); in ath10k_mac_txq_lookup()
4290 peer = ar->peer_map[peer_id]; in ath10k_mac_txq_lookup()
4294 if (peer->removed) in ath10k_mac_txq_lookup()
4297 if (peer->sta) in ath10k_mac_txq_lookup()
4298 return peer->sta->txq[tid]; in ath10k_mac_txq_lookup()
4299 else if (peer->vif) in ath10k_mac_txq_lookup()
4300 return peer->vif->txq; in ath10k_mac_txq_lookup()
4308 struct ath10k *ar = hw->priv; in ath10k_mac_tx_can_push()
4309 struct ath10k_txq *artxq = (void *)txq->drv_priv; in ath10k_mac_tx_can_push()
4312 if (ar->htt.tx_q_state.mode == HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_tx_can_push()
4315 if (ar->htt.num_pending_tx < ar->htt.tx_q_state.num_push_allowed) in ath10k_mac_tx_can_push()
4318 if (artxq->num_fw_queued < artxq->num_push_allowed) in ath10k_mac_tx_can_push()
4340 if (!txq || !txq->sta) in ath10k_mac_update_airtime()
4343 if (test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map)) in ath10k_mac_update_airtime()
4346 spin_lock_bh(&ar->data_lock); in ath10k_mac_update_airtime()
4347 arsta = (struct ath10k_sta *)txq->sta->drv_priv; in ath10k_mac_update_airtime()
4349 pktlen = skb->len + 38; /* Assume MAC header 30, SNAP 8 for most case */ in ath10k_mac_update_airtime()
4350 if (arsta->last_tx_bitrate) { in ath10k_mac_update_airtime()
4353 / arsta->last_tx_bitrate; in ath10k_mac_update_airtime()
4365 spin_unlock_bh(&ar->data_lock); in ath10k_mac_update_airtime()
4373 struct ath10k *ar = hw->priv; in ath10k_mac_tx_push_txq()
4374 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_tx_push_txq()
4375 struct ath10k_txq *artxq = (void *)txq->drv_priv; in ath10k_mac_tx_push_txq()
4376 struct ieee80211_vif *vif = txq->vif; in ath10k_mac_tx_push_txq()
4377 struct ieee80211_sta *sta = txq->sta; in ath10k_mac_tx_push_txq()
4387 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4389 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4396 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4398 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4400 return -ENOENT; in ath10k_mac_tx_push_txq()
4406 skb_len = skb->len; in ath10k_mac_tx_push_txq()
4412 hdr = (struct ieee80211_hdr *)skb->data; in ath10k_mac_tx_push_txq()
4413 is_presp = ieee80211_is_probe_resp(hdr->frame_control); in ath10k_mac_tx_push_txq()
4415 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4420 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4423 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4430 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4434 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4439 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4440 artxq->num_fw_queued++; in ath10k_mac_tx_push_txq()
4441 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4460 if (ret == -EBUSY) in ath10k_mac_schedule_txq()
4470 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_tx_push_pending()
4473 if (ar->htt.tx_q_state.mode != HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_tx_push_pending()
4476 if (ar->htt.num_pending_tx >= (ar->htt.max_num_pending_tx / 2)) in ath10k_mac_tx_push_pending()
4481 if (ath10k_mac_schedule_txq(hw, ac) == -EBUSY) in ath10k_mac_tx_push_pending()
4494 lockdep_assert_held(&ar->data_lock); in __ath10k_scan_finish()
4496 switch (ar->scan.state) { in __ath10k_scan_finish()
4501 if (ar->scan.is_roc && ar->scan.roc_notify) in __ath10k_scan_finish()
4502 ieee80211_remain_on_channel_expired(ar->hw); in __ath10k_scan_finish()
4505 if (!ar->scan.is_roc) { in __ath10k_scan_finish()
4507 .aborted = ((ar->scan.state == in __ath10k_scan_finish()
4509 (ar->scan.state == in __ath10k_scan_finish()
4513 ieee80211_scan_completed(ar->hw, &info); in __ath10k_scan_finish()
4516 ar->scan.state = ATH10K_SCAN_IDLE; in __ath10k_scan_finish()
4517 ar->scan_channel = NULL; in __ath10k_scan_finish()
4518 ar->scan.roc_freq = 0; in __ath10k_scan_finish()
4520 cancel_delayed_work(&ar->scan.timeout); in __ath10k_scan_finish()
4521 complete(&ar->scan.completed); in __ath10k_scan_finish()
4528 spin_lock_bh(&ar->data_lock); in ath10k_scan_finish()
4530 spin_unlock_bh(&ar->data_lock); in ath10k_scan_finish()
4542 lockdep_assert_held(&ar->conf_mutex); in ath10k_scan_stop()
4550 ret = wait_for_completion_timeout(&ar->scan.completed, 3 * HZ); in ath10k_scan_stop()
4553 ret = -ETIMEDOUT; in ath10k_scan_stop()
4566 spin_lock_bh(&ar->data_lock); in ath10k_scan_stop()
4567 if (ar->scan.state != ATH10K_SCAN_IDLE) in ath10k_scan_stop()
4569 spin_unlock_bh(&ar->data_lock); in ath10k_scan_stop()
4578 lockdep_assert_held(&ar->conf_mutex); in ath10k_scan_abort()
4580 spin_lock_bh(&ar->data_lock); in ath10k_scan_abort()
4582 switch (ar->scan.state) { in ath10k_scan_abort()
4591 ath10k_scan_state_str(ar->scan.state), in ath10k_scan_abort()
4592 ar->scan.state); in ath10k_scan_abort()
4595 ar->scan.state = ATH10K_SCAN_ABORTING; in ath10k_scan_abort()
4596 spin_unlock_bh(&ar->data_lock); in ath10k_scan_abort()
4602 spin_lock_bh(&ar->data_lock); in ath10k_scan_abort()
4606 spin_unlock_bh(&ar->data_lock); in ath10k_scan_abort()
4614 mutex_lock(&ar->conf_mutex); in ath10k_scan_timeout_work()
4616 mutex_unlock(&ar->conf_mutex); in ath10k_scan_timeout_work()
4624 lockdep_assert_held(&ar->conf_mutex); in ath10k_start_scan()
4630 ret = wait_for_completion_timeout(&ar->scan.started, 1 * HZ); in ath10k_start_scan()
4636 return -ETIMEDOUT; in ath10k_start_scan()
4643 spin_lock_bh(&ar->data_lock); in ath10k_start_scan()
4644 if (ar->scan.state == ATH10K_SCAN_IDLE) { in ath10k_start_scan()
4645 spin_unlock_bh(&ar->data_lock); in ath10k_start_scan()
4646 return -EINVAL; in ath10k_start_scan()
4648 spin_unlock_bh(&ar->data_lock); in ath10k_start_scan()
4661 struct ath10k *ar = hw->priv; in ath10k_mac_op_tx()
4662 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_op_tx()
4664 struct ieee80211_vif *vif = info->control.vif; in ath10k_mac_op_tx()
4665 struct ieee80211_sta *sta = control->sta; in ath10k_mac_op_tx()
4686 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4687 if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) { in ath10k_mac_op_tx()
4688 struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_mac_op_tx()
4690 is_presp = ieee80211_is_probe_resp(hdr->frame_control); in ath10k_mac_op_tx()
4697 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4698 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_op_tx()
4707 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4708 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_op_tx()
4711 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4718 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4722 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4731 struct ath10k *ar = hw->priv; in ath10k_mac_op_wake_tx_queue()
4733 u8 ac = txq->ac; in ath10k_mac_op_wake_tx_queue()
4736 if (ar->htt.tx_q_state.mode != HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_op_wake_tx_queue()
4739 spin_lock_bh(&ar->queue_lock[ac]); in ath10k_mac_op_wake_tx_queue()
4755 spin_unlock_bh(&ar->queue_lock[ac]); in ath10k_mac_op_wake_tx_queue()
4761 lockdep_assert_not_held(&ar->conf_mutex); in ath10k_drain_tx()
4763 /* make sure rcu-protected mac80211 tx path itself is drained */ in ath10k_drain_tx()
4769 cancel_work_sync(&ar->offchan_tx_work); in ath10k_drain_tx()
4770 cancel_work_sync(&ar->wmi_mgmt_tx_work); in ath10k_drain_tx()
4777 lockdep_assert_held(&ar->conf_mutex); in ath10k_halt()
4779 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_halt()
4780 ar->filter_flags = 0; in ath10k_halt()
4781 ar->monitor = false; in ath10k_halt()
4782 ar->monitor_arvif = NULL; in ath10k_halt()
4784 if (ar->monitor_started) in ath10k_halt()
4787 ar->monitor_started = false; in ath10k_halt()
4788 ar->tx_paused = 0; in ath10k_halt()
4796 spin_lock_bh(&ar->data_lock); in ath10k_halt()
4797 list_for_each_entry(arvif, &ar->arvifs, list) in ath10k_halt()
4799 spin_unlock_bh(&ar->data_lock); in ath10k_halt()
4804 struct ath10k *ar = hw->priv; in ath10k_get_antenna()
4806 mutex_lock(&ar->conf_mutex); in ath10k_get_antenna()
4808 *tx_ant = ar->cfg_tx_chainmask; in ath10k_get_antenna()
4809 *rx_ant = ar->cfg_rx_chainmask; in ath10k_get_antenna()
4811 mutex_unlock(&ar->conf_mutex); in ath10k_get_antenna()
4832 int nsts = ar->vht_cap_info; in ath10k_mac_get_vht_cap_bf_sts()
4837 /* If firmware does not deliver to host number of space-time in ath10k_mac_get_vht_cap_bf_sts()
4839 * the value for VHT CAP: nsts-1) in ath10k_mac_get_vht_cap_bf_sts()
4849 int sound_dim = ar->vht_cap_info; in ath10k_mac_get_vht_cap_bf_sound_dim()
4866 struct ath10k_hw_params *hw = &ar->hw_params; in ath10k_create_vht_cap()
4872 vht_cap.cap = ar->vht_cap_info; in ath10k_create_vht_cap()
4874 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | in ath10k_create_vht_cap()
4883 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | in ath10k_create_vht_cap()
4894 if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i))) in ath10k_create_vht_cap()
4900 if (ar->cfg_tx_chainmask <= 1) in ath10k_create_vht_cap()
4908 * user-space a clue if that is the case. in ath10k_create_vht_cap()
4911 (hw->vht160_mcs_rx_highest != 0 || in ath10k_create_vht_cap()
4912 hw->vht160_mcs_tx_highest != 0)) { in ath10k_create_vht_cap()
4913 vht_cap.vht_mcs.rx_highest = cpu_to_le16(hw->vht160_mcs_rx_highest); in ath10k_create_vht_cap()
4914 vht_cap.vht_mcs.tx_highest = cpu_to_le16(hw->vht160_mcs_tx_highest); in ath10k_create_vht_cap()
4925 if (!(ar->ht_cap_info & WMI_HT_CAP_ENABLED)) in ath10k_get_ht_cap()
4936 if (ar->ht_cap_info & WMI_HT_CAP_HT20_SGI) in ath10k_get_ht_cap()
4939 if (ar->ht_cap_info & WMI_HT_CAP_HT40_SGI) in ath10k_get_ht_cap()
4942 if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) { in ath10k_get_ht_cap()
4951 if (ar->ht_cap_info & WMI_HT_CAP_TX_STBC && (ar->cfg_tx_chainmask > 1)) in ath10k_get_ht_cap()
4954 if (ar->ht_cap_info & WMI_HT_CAP_RX_STBC) { in ath10k_get_ht_cap()
4957 stbc = ar->ht_cap_info; in ath10k_get_ht_cap()
4966 if (ar->ht_cap_info & WMI_HT_CAP_LDPC || (ar->ht_cap_info & in ath10k_get_ht_cap()
4967 WMI_HT_CAP_RX_LDPC && (ar->ht_cap_info & WMI_HT_CAP_TX_LDPC))) in ath10k_get_ht_cap()
4970 if (ar->ht_cap_info & WMI_HT_CAP_L_SIG_TXOP_PROT) in ath10k_get_ht_cap()
4974 if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK) in ath10k_get_ht_cap()
4977 for (i = 0; i < ar->num_rf_chains; i++) { in ath10k_get_ht_cap()
4978 if (ar->cfg_rx_chainmask & BIT(i)) in ath10k_get_ht_cap()
4996 if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) { in ath10k_mac_setup_ht_vht_cap()
4997 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath10k_mac_setup_ht_vht_cap()
4998 band->ht_cap = ht_cap; in ath10k_mac_setup_ht_vht_cap()
5000 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) { in ath10k_mac_setup_ht_vht_cap()
5001 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath10k_mac_setup_ht_vht_cap()
5002 band->ht_cap = ht_cap; in ath10k_mac_setup_ht_vht_cap()
5003 band->vht_cap = vht_cap; in ath10k_mac_setup_ht_vht_cap()
5012 lockdep_assert_held(&ar->conf_mutex); in __ath10k_set_antenna()
5018 return -EINVAL; in __ath10k_set_antenna()
5020 ar->cfg_tx_chainmask = tx_ant; in __ath10k_set_antenna()
5021 ar->cfg_rx_chainmask = rx_ant; in __ath10k_set_antenna()
5023 if ((ar->state != ATH10K_STATE_ON) && in __ath10k_set_antenna()
5024 (ar->state != ATH10K_STATE_RESTARTED)) in __ath10k_set_antenna()
5027 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->tx_chain_mask, in __ath10k_set_antenna()
5030 ath10k_warn(ar, "failed to set tx-chainmask: %d, req 0x%x\n", in __ath10k_set_antenna()
5035 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->rx_chain_mask, in __ath10k_set_antenna()
5038 ath10k_warn(ar, "failed to set rx-chainmask: %d, req 0x%x\n", in __ath10k_set_antenna()
5051 struct ath10k *ar = hw->priv; in ath10k_set_antenna()
5054 mutex_lock(&ar->conf_mutex); in ath10k_set_antenna()
5056 mutex_unlock(&ar->conf_mutex); in ath10k_set_antenna()
5067 node = ar->dev->of_node; in __ath10k_fetch_bb_timing_dt()
5069 return -ENOENT; in __ath10k_fetch_bb_timing_dt()
5071 ret = of_property_read_string_index(node, "ext-fem-name", 0, &fem_name); in __ath10k_fetch_bb_timing_dt()
5073 return -ENOENT; in __ath10k_fetch_bb_timing_dt()
5080 if (!strcmp("microsemi-lx5586", fem_name)) { in __ath10k_fetch_bb_timing_dt()
5081 bb_timing->bb_tx_timing = 0x00; in __ath10k_fetch_bb_timing_dt()
5082 bb_timing->bb_xpa_timing = 0x0101; in __ath10k_fetch_bb_timing_dt()
5084 return -ENOENT; in __ath10k_fetch_bb_timing_dt()
5088 bb_timing->bb_tx_timing, bb_timing->bb_xpa_timing); in __ath10k_fetch_bb_timing_dt()
5097 if (ar->hw_values->rfkill_pin == 0) { in ath10k_mac_rfkill_config()
5099 return -EOPNOTSUPP; in ath10k_mac_rfkill_config()
5104 ar->hw_values->rfkill_pin, ar->hw_values->rfkill_cfg, in ath10k_mac_rfkill_config()
5105 ar->hw_values->rfkill_on_level); in ath10k_mac_rfkill_config()
5108 ar->hw_values->rfkill_on_level) | in ath10k_mac_rfkill_config()
5110 ar->hw_values->rfkill_pin) | in ath10k_mac_rfkill_config()
5112 ar->hw_values->rfkill_cfg); in ath10k_mac_rfkill_config()
5115 ar->wmi.pdev_param->rfkill_config, in ath10k_mac_rfkill_config()
5138 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->rfkill_enable, in ath10k_mac_rfkill_enable_radio()
5151 struct ath10k *ar = hw->priv; in ath10k_start()
5157 * This makes sense only when restarting hw. It is harmless to call in ath10k_start()
5163 mutex_lock(&ar->conf_mutex); in ath10k_start()
5165 switch (ar->state) { in ath10k_start()
5167 ar->state = ATH10K_STATE_ON; in ath10k_start()
5170 ar->state = ATH10K_STATE_RESTARTED; in ath10k_start()
5176 ret = -EINVAL; in ath10k_start()
5179 ret = -EBUSY; in ath10k_start()
5183 spin_lock_bh(&ar->data_lock); in ath10k_start()
5185 if (ar->hw_rfkill_on) { in ath10k_start()
5186 ar->hw_rfkill_on = false; in ath10k_start()
5187 spin_unlock_bh(&ar->data_lock); in ath10k_start()
5191 spin_unlock_bh(&ar->data_lock); in ath10k_start()
5200 &ar->normal_mode_fw); in ath10k_start()
5206 if (ar->sys_cap_info & WMI_TLV_SYS_CAP_INFO_RFKILL) { in ath10k_start()
5208 if (ret && ret != -EOPNOTSUPP) { in ath10k_start()
5214 param = ar->wmi.pdev_param->pmf_qos; in ath10k_start()
5221 param = ar->wmi.pdev_param->dynamic_bw; in ath10k_start()
5228 if (test_bit(WMI_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi.svc_map)) { in ath10k_start()
5229 ret = ath10k_wmi_scan_prob_req_oui(ar, ar->mac_addr); in ath10k_start()
5236 if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar->wmi.svc_map)) { in ath10k_start()
5245 if (test_bit(WMI_SERVICE_BURST, ar->wmi.svc_map)) { in ath10k_start()
5246 param = ar->wmi.pdev_param->burst_enable; in ath10k_start()
5254 param = ar->wmi.pdev_param->idle_ps_config; in ath10k_start()
5256 if (ret && ret != -EOPNOTSUPP) { in ath10k_start()
5261 __ath10k_set_antenna(ar, ar->cfg_tx_chainmask, ar->cfg_rx_chainmask); in ath10k_start()
5272 param = ar->wmi.pdev_param->arp_ac_override; in ath10k_start()
5281 ar->running_fw->fw_file.fw_features)) { in ath10k_start()
5292 param = ar->wmi.pdev_param->ani_enable; in ath10k_start()
5300 ar->ani_enabled = true; in ath10k_start()
5303 param = ar->wmi.pdev_param->peer_stats_update_period; in ath10k_start()
5314 param = ar->wmi.pdev_param->enable_btcoex; in ath10k_start()
5315 if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map) && in ath10k_start()
5317 ar->running_fw->fw_file.fw_features) && in ath10k_start()
5318 ar->coex_support) { in ath10k_start()
5325 clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); in ath10k_start()
5328 if (test_bit(WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT, ar->wmi.svc_map)) { in ath10k_start()
5341 ar->num_started_vdevs = 0; in ath10k_start()
5347 ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_IDLE; in ath10k_start()
5349 mutex_unlock(&ar->conf_mutex); in ath10k_start()
5359 ar->state = ATH10K_STATE_OFF; in ath10k_start()
5362 mutex_unlock(&ar->conf_mutex); in ath10k_start()
5368 struct ath10k *ar = hw->priv; in ath10k_stop()
5373 mutex_lock(&ar->conf_mutex); in ath10k_stop()
5374 if (ar->state != ATH10K_STATE_OFF) { in ath10k_stop()
5375 if (!ar->hw_rfkill_on) { in ath10k_stop()
5381 if (ar->state != ATH10K_STATE_RESTARTING) { in ath10k_stop()
5392 ar->state = ATH10K_STATE_OFF; in ath10k_stop()
5394 mutex_unlock(&ar->conf_mutex); in ath10k_stop()
5396 cancel_work_sync(&ar->set_coverage_class_work); in ath10k_stop()
5397 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_stop()
5398 cancel_work_sync(&ar->restart_work); in ath10k_stop()
5406 lockdep_assert_held(&ar->conf_mutex); in ath10k_config_ps()
5408 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_config_ps()
5421 struct ath10k *ar = hw->priv; in ath10k_config()
5422 struct ieee80211_conf *conf = &hw->conf; in ath10k_config()
5425 mutex_lock(&ar->conf_mutex); in ath10k_config()
5431 ar->monitor = conf->flags & IEEE80211_CONF_MONITOR; in ath10k_config()
5437 mutex_unlock(&ar->conf_mutex); in ath10k_config()
5455 struct ath10k *ar = arvif->ar; in ath10k_mac_set_txbf_conf()
5463 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | in ath10k_mac_set_txbf_conf()
5468 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | in ath10k_mac_set_txbf_conf()
5475 if (ar->vht_cap_info & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE) in ath10k_mac_set_txbf_conf()
5478 if (ar->vht_cap_info & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE) in ath10k_mac_set_txbf_conf()
5482 if (ar->vht_cap_info & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE) in ath10k_mac_set_txbf_conf()
5485 if (ar->vht_cap_info & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE) in ath10k_mac_set_txbf_conf()
5489 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_mac_set_txbf_conf()
5490 ar->wmi.vdev_param->txbf, value); in ath10k_mac_set_txbf_conf()
5496 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_update_vif_offload()
5497 struct ath10k *ar = hw->priv; in ath10k_update_vif_offload()
5502 ar->wmi.vdev_param->tx_encap_type == WMI_VDEV_PARAM_UNSUPPORTED || in ath10k_update_vif_offload()
5503 (vif->type != NL80211_IFTYPE_STATION && in ath10k_update_vif_offload()
5504 vif->type != NL80211_IFTYPE_AP)) in ath10k_update_vif_offload()
5505 vif->offload_flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED; in ath10k_update_vif_offload()
5507 vdev_param = ar->wmi.vdev_param->tx_encap_type; in ath10k_update_vif_offload()
5508 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_update_vif_offload()
5511 if (ret && ret != -EOPNOTSUPP) { in ath10k_update_vif_offload()
5513 arvif->vdev_id, ret); in ath10k_update_vif_offload()
5527 struct ath10k *ar = hw->priv; in ath10k_add_interface()
5528 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_add_interface()
5537 vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; in ath10k_add_interface()
5539 mutex_lock(&ar->conf_mutex); in ath10k_add_interface()
5542 ath10k_mac_txq_init(vif->txq); in ath10k_add_interface()
5544 arvif->ar = ar; in ath10k_add_interface()
5545 arvif->vif = vif; in ath10k_add_interface()
5547 INIT_LIST_HEAD(&arvif->list); in ath10k_add_interface()
5548 INIT_WORK(&arvif->ap_csa_work, ath10k_mac_vif_ap_csa_work); in ath10k_add_interface()
5549 INIT_DELAYED_WORK(&arvif->connection_loss_work, in ath10k_add_interface()
5552 for (i = 0; i < ARRAY_SIZE(arvif->bitrate_mask.control); i++) { in ath10k_add_interface()
5553 arvif->bitrate_mask.control[i].legacy = 0xffffffff; in ath10k_add_interface()
5554 memset(arvif->bitrate_mask.control[i].ht_mcs, 0xff, in ath10k_add_interface()
5555 sizeof(arvif->bitrate_mask.control[i].ht_mcs)); in ath10k_add_interface()
5556 memset(arvif->bitrate_mask.control[i].vht_mcs, 0xff, in ath10k_add_interface()
5557 sizeof(arvif->bitrate_mask.control[i].vht_mcs)); in ath10k_add_interface()
5560 if (ar->num_peers >= ar->max_num_peers) { in ath10k_add_interface()
5562 ret = -ENOBUFS; in ath10k_add_interface()
5566 if (ar->free_vdev_map == 0) { in ath10k_add_interface()
5568 ret = -EBUSY; in ath10k_add_interface()
5571 bit = __ffs64(ar->free_vdev_map); in ath10k_add_interface()
5574 bit, ar->free_vdev_map); in ath10k_add_interface()
5576 arvif->vdev_id = bit; in ath10k_add_interface()
5577 arvif->vdev_subtype = in ath10k_add_interface()
5580 switch (vif->type) { in ath10k_add_interface()
5582 arvif->vdev_type = WMI_VDEV_TYPE_STA; in ath10k_add_interface()
5583 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5588 arvif->vdev_type = WMI_VDEV_TYPE_STA; in ath10k_add_interface()
5589 if (vif->p2p) in ath10k_add_interface()
5590 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5594 arvif->vdev_type = WMI_VDEV_TYPE_IBSS; in ath10k_add_interface()
5597 if (test_bit(WMI_SERVICE_MESH_11S, ar->wmi.svc_map)) { in ath10k_add_interface()
5598 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5600 } else if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { in ath10k_add_interface()
5601 ret = -EINVAL; in ath10k_add_interface()
5605 arvif->vdev_type = WMI_VDEV_TYPE_AP; in ath10k_add_interface()
5608 arvif->vdev_type = WMI_VDEV_TYPE_AP; in ath10k_add_interface()
5610 if (vif->p2p) in ath10k_add_interface()
5611 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5615 arvif->vdev_type = WMI_VDEV_TYPE_MONITOR; in ath10k_add_interface()
5622 /* Using vdev_id as queue number will make it very easy to do per-vif in ath10k_add_interface()
5627 vif->cab_queue = arvif->vdev_id % (IEEE80211_MAX_QUEUES - 1); in ath10k_add_interface()
5628 for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++) in ath10k_add_interface()
5629 vif->hw_queue[i] = arvif->vdev_id % (IEEE80211_MAX_QUEUES - 1); in ath10k_add_interface()
5636 * On non-IOMMU-enabled hosts this could be a possible security issue in ath10k_add_interface()
5638 * IOMMU-enabled hosts DMAR faults would occur in most cases and target in ath10k_add_interface()
5643 * DMA-coherent buffer for a lifetime of a vif and use it for all in ath10k_add_interface()
5645 * become corrupted, e.g. have garbled IEs or out-of-date TIM bitmap. in ath10k_add_interface()
5647 if (vif->type == NL80211_IFTYPE_ADHOC || in ath10k_add_interface()
5648 vif->type == NL80211_IFTYPE_MESH_POINT || in ath10k_add_interface()
5649 vif->type == NL80211_IFTYPE_AP) { in ath10k_add_interface()
5650 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) { in ath10k_add_interface()
5651 arvif->beacon_buf = kmalloc(IEEE80211_MAX_FRAME_LEN, in ath10k_add_interface()
5657 * known-invalid address token instead, which in ath10k_add_interface()
5661 arvif->beacon_paddr = DMA_MAPPING_ERROR; in ath10k_add_interface()
5663 arvif->beacon_buf = in ath10k_add_interface()
5664 dma_alloc_coherent(ar->dev, in ath10k_add_interface()
5666 &arvif->beacon_paddr, in ath10k_add_interface()
5669 if (!arvif->beacon_buf) { in ath10k_add_interface()
5670 ret = -ENOMEM; in ath10k_add_interface()
5676 if (test_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, &ar->dev_flags)) in ath10k_add_interface()
5677 arvif->nohwcrypt = true; in ath10k_add_interface()
5679 if (arvif->nohwcrypt && in ath10k_add_interface()
5680 !test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { in ath10k_add_interface()
5681 ret = -EINVAL; in ath10k_add_interface()
5687 arvif->vdev_id, arvif->vdev_type, arvif->vdev_subtype, in ath10k_add_interface()
5688 arvif->beacon_buf ? "single-buf" : "per-skb"); in ath10k_add_interface()
5690 ret = ath10k_wmi_vdev_create(ar, arvif->vdev_id, arvif->vdev_type, in ath10k_add_interface()
5691 arvif->vdev_subtype, vif->addr); in ath10k_add_interface()
5694 arvif->vdev_id, ret); in ath10k_add_interface()
5699 ar->wmi.svc_map)) { in ath10k_add_interface()
5700 vdev_param = ar->wmi.vdev_param->disable_4addr_src_lrn; in ath10k_add_interface()
5701 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5703 if (ret && ret != -EOPNOTSUPP) { in ath10k_add_interface()
5705 arvif->vdev_id, ret); in ath10k_add_interface()
5709 ar->free_vdev_map &= ~(1LL << arvif->vdev_id); in ath10k_add_interface()
5710 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5711 list_add(&arvif->list, &ar->arvifs); in ath10k_add_interface()
5712 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5714 /* It makes no sense to have firmware do keepalives. mac80211 already in ath10k_add_interface()
5720 arvif->vdev_id, ret); in ath10k_add_interface()
5724 arvif->def_wep_key_idx = -1; in ath10k_add_interface()
5731 if (ar->cfg_tx_chainmask && (vif->type != NL80211_IFTYPE_MONITOR)) { in ath10k_add_interface()
5732 u16 nss = get_nss_from_chainmask(ar->cfg_tx_chainmask); in ath10k_add_interface()
5734 vdev_param = ar->wmi.vdev_param->nss; in ath10k_add_interface()
5735 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5739 arvif->vdev_id, ar->cfg_tx_chainmask, nss, in ath10k_add_interface()
5745 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_add_interface()
5746 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_add_interface()
5747 ret = ath10k_peer_create(ar, vif, NULL, arvif->vdev_id, in ath10k_add_interface()
5748 vif->addr, WMI_PEER_TYPE_DEFAULT); in ath10k_add_interface()
5751 arvif->vdev_id, ret); in ath10k_add_interface()
5755 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5757 peer = ath10k_peer_find(ar, arvif->vdev_id, vif->addr); in ath10k_add_interface()
5760 vif->addr, arvif->vdev_id); in ath10k_add_interface()
5761 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5762 ret = -ENOENT; in ath10k_add_interface()
5766 arvif->peer_id = find_first_bit(peer->peer_ids, in ath10k_add_interface()
5769 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5771 arvif->peer_id = HTT_INVALID_PEERID; in ath10k_add_interface()
5774 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath10k_add_interface()
5778 arvif->vdev_id, ret); in ath10k_add_interface()
5783 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) { in ath10k_add_interface()
5786 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_add_interface()
5790 arvif->vdev_id, ret); in ath10k_add_interface()
5797 arvif->vdev_id, ret); in ath10k_add_interface()
5804 arvif->vdev_id, ret); in ath10k_add_interface()
5812 arvif->vdev_id, ret); in ath10k_add_interface()
5816 ret = ath10k_mac_set_rts(arvif, ar->hw->wiphy->rts_threshold); in ath10k_add_interface()
5819 arvif->vdev_id, ret); in ath10k_add_interface()
5823 arvif->txpower = vif->bss_conf.txpower; in ath10k_add_interface()
5830 if (test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) { in ath10k_add_interface()
5831 vdev_param = ar->wmi.vdev_param->rtt_responder_role; in ath10k_add_interface()
5832 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5833 arvif->ftm_responder); in ath10k_add_interface()
5836 if (ret && ret != -EOPNOTSUPP) in ath10k_add_interface()
5838 arvif->vdev_id, ret); in ath10k_add_interface()
5841 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_add_interface()
5842 ar->monitor_arvif = arvif; in ath10k_add_interface()
5850 spin_lock_bh(&ar->htt.tx_lock); in ath10k_add_interface()
5851 if (!ar->tx_paused) in ath10k_add_interface()
5852 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_add_interface()
5853 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_add_interface()
5855 mutex_unlock(&ar->conf_mutex); in ath10k_add_interface()
5859 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_add_interface()
5860 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_add_interface()
5861 ath10k_wmi_peer_delete(ar, arvif->vdev_id, vif->addr); in ath10k_add_interface()
5862 ath10k_wait_for_peer_delete_done(ar, arvif->vdev_id, in ath10k_add_interface()
5863 vif->addr); in ath10k_add_interface()
5867 ath10k_wmi_vdev_delete(ar, arvif->vdev_id); in ath10k_add_interface()
5868 ar->free_vdev_map |= 1LL << arvif->vdev_id; in ath10k_add_interface()
5869 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5870 list_del(&arvif->list); in ath10k_add_interface()
5871 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5874 if (arvif->beacon_buf) { in ath10k_add_interface()
5875 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) in ath10k_add_interface()
5876 kfree(arvif->beacon_buf); in ath10k_add_interface()
5878 dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, in ath10k_add_interface()
5879 arvif->beacon_buf, in ath10k_add_interface()
5880 arvif->beacon_paddr); in ath10k_add_interface()
5881 arvif->beacon_buf = NULL; in ath10k_add_interface()
5884 mutex_unlock(&ar->conf_mutex); in ath10k_add_interface()
5900 struct ath10k *ar = hw->priv; in ath10k_remove_interface()
5901 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_remove_interface()
5907 cancel_work_sync(&arvif->ap_csa_work); in ath10k_remove_interface()
5908 cancel_delayed_work_sync(&arvif->connection_loss_work); in ath10k_remove_interface()
5910 mutex_lock(&ar->conf_mutex); in ath10k_remove_interface()
5915 arvif->vdev_id, ret); in ath10k_remove_interface()
5917 ar->free_vdev_map |= 1LL << arvif->vdev_id; in ath10k_remove_interface()
5918 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5919 list_del(&arvif->list); in ath10k_remove_interface()
5920 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
5922 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_remove_interface()
5923 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_remove_interface()
5924 ret = ath10k_wmi_peer_delete(arvif->ar, arvif->vdev_id, in ath10k_remove_interface()
5925 vif->addr); in ath10k_remove_interface()
5927 ath10k_warn(ar, "failed to submit AP/IBSS self-peer removal on vdev %i: %d\n", in ath10k_remove_interface()
5928 arvif->vdev_id, ret); in ath10k_remove_interface()
5930 ath10k_wait_for_peer_delete_done(ar, arvif->vdev_id, in ath10k_remove_interface()
5931 vif->addr); in ath10k_remove_interface()
5932 kfree(arvif->u.ap.noa_data); in ath10k_remove_interface()
5936 arvif->vdev_id); in ath10k_remove_interface()
5938 ret = ath10k_wmi_vdev_delete(ar, arvif->vdev_id); in ath10k_remove_interface()
5941 arvif->vdev_id, ret); in ath10k_remove_interface()
5943 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) { in ath10k_remove_interface()
5944 time_left = wait_for_completion_timeout(&ar->vdev_delete_done, in ath10k_remove_interface()
5952 /* Some firmware revisions don't notify host about self-peer removal in ath10k_remove_interface()
5955 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_remove_interface()
5956 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_remove_interface()
5957 ret = ath10k_wait_for_peer_deleted(ar, arvif->vdev_id, in ath10k_remove_interface()
5958 vif->addr); in ath10k_remove_interface()
5960 ath10k_warn(ar, "failed to remove AP self-peer on vdev %i: %d\n", in ath10k_remove_interface()
5961 arvif->vdev_id, ret); in ath10k_remove_interface()
5963 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5964 ar->num_peers--; in ath10k_remove_interface()
5965 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
5968 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5969 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_remove_interface()
5970 peer = ar->peer_map[i]; in ath10k_remove_interface()
5974 if (peer->vif == vif) { in ath10k_remove_interface()
5976 vif->addr, arvif->vdev_id); in ath10k_remove_interface()
5977 peer->vif = NULL; in ath10k_remove_interface()
5985 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
5987 ath10k_peer_cleanup(ar, arvif->vdev_id); in ath10k_remove_interface()
5988 ath10k_mac_txq_unref(ar, vif->txq); in ath10k_remove_interface()
5990 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_remove_interface()
5991 ar->monitor_arvif = NULL; in ath10k_remove_interface()
6001 spin_lock_bh(&ar->htt.tx_lock); in ath10k_remove_interface()
6003 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_remove_interface()
6005 ath10k_mac_txq_unref(ar, vif->txq); in ath10k_remove_interface()
6008 mutex_unlock(&ar->conf_mutex); in ath10k_remove_interface()
6028 struct ath10k *ar = hw->priv; in ath10k_configure_filter()
6032 mutex_lock(&ar->conf_mutex); in ath10k_configure_filter()
6034 if (ar->hw_params.mcast_frame_registration) in ath10k_configure_filter()
6039 ar->filter_flags = *total_flags; in ath10k_configure_filter()
6045 mutex_unlock(&ar->conf_mutex); in ath10k_configure_filter()
6052 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_recalculate_mgmt_rate()
6060 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalculate_mgmt_rate()
6062 sband = ar->hw->wiphy->bands[def->chan->band]; in ath10k_recalculate_mgmt_rate()
6063 basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; in ath10k_recalculate_mgmt_rate()
6064 bitrate = sband->bitrates[basic_rate_idx].bitrate; in ath10k_recalculate_mgmt_rate()
6072 vdev_param = ar->wmi.vdev_param->mgmt_rate; in ath10k_recalculate_mgmt_rate()
6073 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_recalculate_mgmt_rate()
6084 struct ath10k *ar = hw->priv; in ath10k_bss_info_changed()
6085 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_bss_info_changed()
6093 mutex_lock(&ar->conf_mutex); in ath10k_bss_info_changed()
6099 arvif->beacon_interval = info->beacon_int; in ath10k_bss_info_changed()
6100 vdev_param = ar->wmi.vdev_param->beacon_interval; in ath10k_bss_info_changed()
6101 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6102 arvif->beacon_interval); in ath10k_bss_info_changed()
6105 arvif->vdev_id, arvif->beacon_interval); in ath10k_bss_info_changed()
6109 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6115 arvif->vdev_id); in ath10k_bss_info_changed()
6117 pdev_param = ar->wmi.pdev_param->beacon_tx_mode; in ath10k_bss_info_changed()
6122 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6131 arvif->u.ap.ssid_len = 4; in ath10k_bss_info_changed()
6132 memcpy(arvif->u.ap.ssid, "mesh", arvif->u.ap.ssid_len); in ath10k_bss_info_changed()
6140 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6144 arvif->dtim_period = info->dtim_period; in ath10k_bss_info_changed()
6148 arvif->vdev_id, arvif->dtim_period); in ath10k_bss_info_changed()
6150 vdev_param = ar->wmi.vdev_param->dtim_period; in ath10k_bss_info_changed()
6151 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6152 arvif->dtim_period); in ath10k_bss_info_changed()
6155 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6159 vif->type == NL80211_IFTYPE_AP) { in ath10k_bss_info_changed()
6160 arvif->u.ap.ssid_len = vif->cfg.ssid_len; in ath10k_bss_info_changed()
6161 if (vif->cfg.ssid_len) in ath10k_bss_info_changed()
6162 memcpy(arvif->u.ap.ssid, vif->cfg.ssid, in ath10k_bss_info_changed()
6163 vif->cfg.ssid_len); in ath10k_bss_info_changed()
6164 arvif->u.ap.hidden_ssid = info->hidden_ssid; in ath10k_bss_info_changed()
6167 if (changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) in ath10k_bss_info_changed()
6168 ether_addr_copy(arvif->bssid, info->bssid); in ath10k_bss_info_changed()
6171 arvif->ftm_responder != info->ftm_responder && in ath10k_bss_info_changed()
6172 test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) { in ath10k_bss_info_changed()
6173 arvif->ftm_responder = info->ftm_responder; in ath10k_bss_info_changed()
6175 vdev_param = ar->wmi.vdev_param->rtt_responder_role; in ath10k_bss_info_changed()
6176 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6177 arvif->ftm_responder); in ath10k_bss_info_changed()
6181 arvif->vdev_id, arvif->ftm_responder, ret); in ath10k_bss_info_changed()
6188 arvif->use_cts_prot = info->use_cts_prot; in ath10k_bss_info_changed()
6193 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6199 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6204 if (info->use_short_slot) in ath10k_bss_info_changed()
6211 arvif->vdev_id, slottime); in ath10k_bss_info_changed()
6213 vdev_param = ar->wmi.vdev_param->slot_time; in ath10k_bss_info_changed()
6214 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6218 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6222 if (info->use_short_preamble) in ath10k_bss_info_changed()
6229 arvif->vdev_id, preamble); in ath10k_bss_info_changed()
6231 vdev_param = ar->wmi.vdev_param->preamble; in ath10k_bss_info_changed()
6232 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6236 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6240 if (vif->cfg.assoc) { in ath10k_bss_info_changed()
6245 if (ar->monitor_started) in ath10k_bss_info_changed()
6256 arvif->vdev_id, info->txpower); in ath10k_bss_info_changed()
6258 arvif->txpower = info->txpower; in ath10k_bss_info_changed()
6265 arvif->ps = vif->cfg.ps; in ath10k_bss_info_changed()
6270 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6274 !ath10k_mac_vif_chan(arvif->vif, &def)) { in ath10k_bss_info_changed()
6275 band = def.chan->band; in ath10k_bss_info_changed()
6276 mcast_rate = vif->bss_conf.mcast_rate[band]; in ath10k_bss_info_changed()
6278 rateidx = mcast_rate - 1; in ath10k_bss_info_changed()
6280 rateidx = ffs(vif->bss_conf.basic_rates) - 1; in ath10k_bss_info_changed()
6282 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_bss_info_changed()
6296 arvif->vdev_id, rate); in ath10k_bss_info_changed()
6298 vdev_param = ar->wmi.vdev_param->mcast_data_rate; in ath10k_bss_info_changed()
6299 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_bss_info_changed()
6304 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6306 vdev_param = ar->wmi.vdev_param->bcast_data_rate; in ath10k_bss_info_changed()
6307 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_bss_info_changed()
6312 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6316 !ath10k_mac_vif_chan(arvif->vif, &def)) in ath10k_bss_info_changed()
6319 mutex_unlock(&ar->conf_mutex); in ath10k_bss_info_changed()
6324 struct ath10k *ar = hw->priv; in ath10k_mac_op_set_coverage_class()
6329 if (!ar->hw_params.hw_ops->set_coverage_class) { in ath10k_mac_op_set_coverage_class()
6333 ar->hw_params.hw_ops->set_coverage_class(ar, value); in ath10k_mac_op_set_coverage_class()
6345 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_tdls_vif_stations_count_iter()
6346 struct ieee80211_vif *sta_vif = arsta->arvif->vif; in ath10k_mac_tdls_vif_stations_count_iter()
6348 if (sta->tdls && sta_vif == iter_data->curr_vif) in ath10k_mac_tdls_vif_stations_count_iter()
6349 iter_data->num_tdls_stations++; in ath10k_mac_tdls_vif_stations_count_iter()
6369 struct ath10k *ar = hw->priv; in ath10k_hw_scan()
6370 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_hw_scan()
6371 struct cfg80211_scan_request *req = &hw_req->req; in ath10k_hw_scan()
6377 mutex_lock(&ar->conf_mutex); in ath10k_hw_scan()
6380 ret = -EBUSY; in ath10k_hw_scan()
6384 spin_lock_bh(&ar->data_lock); in ath10k_hw_scan()
6385 switch (ar->scan.state) { in ath10k_hw_scan()
6387 reinit_completion(&ar->scan.started); in ath10k_hw_scan()
6388 reinit_completion(&ar->scan.completed); in ath10k_hw_scan()
6389 ar->scan.state = ATH10K_SCAN_STARTING; in ath10k_hw_scan()
6390 ar->scan.is_roc = false; in ath10k_hw_scan()
6391 ar->scan.vdev_id = arvif->vdev_id; in ath10k_hw_scan()
6397 ret = -EBUSY; in ath10k_hw_scan()
6400 spin_unlock_bh(&ar->data_lock); in ath10k_hw_scan()
6407 arg.vdev_id = arvif->vdev_id; in ath10k_hw_scan()
6410 if (req->ie_len) { in ath10k_hw_scan()
6411 arg.ie_len = req->ie_len; in ath10k_hw_scan()
6412 memcpy(arg.ie, req->ie, arg.ie_len); in ath10k_hw_scan()
6415 if (req->n_ssids) { in ath10k_hw_scan()
6416 arg.n_ssids = req->n_ssids; in ath10k_hw_scan()
6418 arg.ssids[i].len = req->ssids[i].ssid_len; in ath10k_hw_scan()
6419 arg.ssids[i].ssid = req->ssids[i].ssid; in ath10k_hw_scan()
6425 if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { in ath10k_hw_scan()
6427 ether_addr_copy(arg.mac_addr.addr, req->mac_addr); in ath10k_hw_scan()
6428 ether_addr_copy(arg.mac_mask.addr, req->mac_addr_mask); in ath10k_hw_scan()
6431 if (req->n_channels) { in ath10k_hw_scan()
6432 arg.n_channels = req->n_channels; in ath10k_hw_scan()
6434 arg.channels[i] = req->channels[i]->center_freq; in ath10k_hw_scan()
6438 if (req->duration) { in ath10k_hw_scan()
6439 arg.dwell_time_active = req->duration; in ath10k_hw_scan()
6440 arg.dwell_time_passive = req->duration; in ath10k_hw_scan()
6441 arg.burst_duration_ms = req->duration; in ath10k_hw_scan()
6444 (arg.n_channels - 1) + (req->duration + in ath10k_hw_scan()
6457 spin_lock_bh(&ar->data_lock); in ath10k_hw_scan()
6458 ar->scan.state = ATH10K_SCAN_IDLE; in ath10k_hw_scan()
6459 spin_unlock_bh(&ar->data_lock); in ath10k_hw_scan()
6462 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath10k_hw_scan()
6466 mutex_unlock(&ar->conf_mutex); in ath10k_hw_scan()
6473 struct ath10k *ar = hw->priv; in ath10k_cancel_hw_scan()
6475 mutex_lock(&ar->conf_mutex); in ath10k_cancel_hw_scan()
6477 mutex_unlock(&ar->conf_mutex); in ath10k_cancel_hw_scan()
6479 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_cancel_hw_scan()
6487 u32 vdev_param = arvif->ar->wmi.vdev_param->def_keyid; in ath10k_set_key_h_def_keyidx()
6492 * frames with multi-vif APs. This is not required for main firmware in ath10k_set_key_h_def_keyidx()
6495 * This is also needed for 636 fw for IBSS-RSN to work more reliably. in ath10k_set_key_h_def_keyidx()
6497 * FIXME: It remains unknown if this is required for multi-vif STA in ath10k_set_key_h_def_keyidx()
6501 if (arvif->vdev_type != WMI_VDEV_TYPE_AP && in ath10k_set_key_h_def_keyidx()
6502 arvif->vdev_type != WMI_VDEV_TYPE_IBSS) in ath10k_set_key_h_def_keyidx()
6505 if (key->cipher == WLAN_CIPHER_SUITE_WEP40) in ath10k_set_key_h_def_keyidx()
6508 if (key->cipher == WLAN_CIPHER_SUITE_WEP104) in ath10k_set_key_h_def_keyidx()
6511 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath10k_set_key_h_def_keyidx()
6517 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_set_key_h_def_keyidx()
6518 key->keyidx); in ath10k_set_key_h_def_keyidx()
6521 arvif->vdev_id, ret); in ath10k_set_key_h_def_keyidx()
6528 struct ath10k *ar = hw->priv; in ath10k_set_key()
6529 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_set_key()
6533 bool is_wep = key->cipher == WLAN_CIPHER_SUITE_WEP40 || in ath10k_set_key()
6534 key->cipher == WLAN_CIPHER_SUITE_WEP104; in ath10k_set_key()
6541 if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || in ath10k_set_key()
6542 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || in ath10k_set_key()
6543 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 || in ath10k_set_key()
6544 key->cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256) in ath10k_set_key()
6547 if (arvif->nohwcrypt) in ath10k_set_key()
6550 if (key->keyidx > WMI_MAX_KEY_INDEX) in ath10k_set_key()
6551 return -ENOSPC; in ath10k_set_key()
6553 mutex_lock(&ar->conf_mutex); in ath10k_set_key()
6556 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_set_key()
6557 peer_addr = sta->addr; in ath10k_set_key()
6558 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6559 arsta->ucast_cipher = key->cipher; in ath10k_set_key()
6560 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6561 } else if (arvif->vdev_type == WMI_VDEV_TYPE_STA) { in ath10k_set_key()
6562 peer_addr = vif->bss_conf.bssid; in ath10k_set_key()
6564 peer_addr = vif->addr; in ath10k_set_key()
6567 key->hw_key_idx = key->keyidx; in ath10k_set_key()
6571 arvif->wep_keys[key->keyidx] = key; in ath10k_set_key()
6573 arvif->wep_keys[key->keyidx] = NULL; in ath10k_set_key()
6576 /* the peer should not disappear in mid-way (unless FW goes awry) since in ath10k_set_key()
6579 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6580 peer = ath10k_peer_find(ar, arvif->vdev_id, peer_addr); in ath10k_set_key()
6581 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6585 ath10k_warn(ar, "failed to install key for non-existent peer %pM\n", in ath10k_set_key()
6587 ret = -EOPNOTSUPP; in ath10k_set_key()
6595 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath10k_set_key()
6606 * keys. Static WEP needs an explicit per-peer key upload. in ath10k_set_key()
6608 if (vif->type == NL80211_IFTYPE_ADHOC && in ath10k_set_key()
6618 if (cmd == SET_KEY && arvif->def_wep_key_idx == -1) in ath10k_set_key()
6626 arvif->vdev_id, peer_addr, ret); in ath10k_set_key()
6633 if (is_wep && !sta && vif->type == NL80211_IFTYPE_STATION) { in ath10k_set_key()
6642 arvif->vdev_id, peer_addr, ret); in ath10k_set_key()
6648 arvif->vdev_id, peer_addr, ret2); in ath10k_set_key()
6656 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6657 peer = ath10k_peer_find(ar, arvif->vdev_id, peer_addr); in ath10k_set_key()
6659 peer->keys[key->keyidx] = key; in ath10k_set_key()
6661 peer->keys[key->keyidx] = NULL; in ath10k_set_key()
6665 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6667 if (sta && sta->tdls) in ath10k_set_key()
6668 ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_set_key()
6669 ar->wmi.peer_param->authorize, 1); in ath10k_set_key()
6670 else if (sta && cmd == SET_KEY && (key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) in ath10k_set_key()
6671 ath10k_wmi_peer_set_param(ar, arvif->vdev_id, peer_addr, in ath10k_set_key()
6672 ar->wmi.peer_param->authorize, 1); in ath10k_set_key()
6675 mutex_unlock(&ar->conf_mutex); in ath10k_set_key()
6683 struct ath10k *ar = hw->priv; in ath10k_set_default_unicast_key()
6684 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_set_default_unicast_key()
6687 mutex_lock(&arvif->ar->conf_mutex); in ath10k_set_default_unicast_key()
6689 if (arvif->ar->state != ATH10K_STATE_ON) in ath10k_set_default_unicast_key()
6693 arvif->vdev_id, keyidx); in ath10k_set_default_unicast_key()
6695 ret = ath10k_wmi_vdev_set_param(arvif->ar, in ath10k_set_default_unicast_key()
6696 arvif->vdev_id, in ath10k_set_default_unicast_key()
6697 arvif->ar->wmi.vdev_param->def_keyid, in ath10k_set_default_unicast_key()
6702 arvif->vdev_id, in ath10k_set_default_unicast_key()
6707 arvif->def_wep_key_idx = keyidx; in ath10k_set_default_unicast_key()
6710 mutex_unlock(&arvif->ar->conf_mutex); in ath10k_set_default_unicast_key()
6728 arvif = arsta->arvif; in ath10k_sta_rc_update_wk()
6729 ar = arvif->ar; in ath10k_sta_rc_update_wk()
6731 if (WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) in ath10k_sta_rc_update_wk()
6734 band = def.chan->band; in ath10k_sta_rc_update_wk()
6735 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath10k_sta_rc_update_wk()
6736 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_sta_rc_update_wk()
6738 spin_lock_bh(&ar->data_lock); in ath10k_sta_rc_update_wk()
6740 changed = arsta->changed; in ath10k_sta_rc_update_wk()
6741 arsta->changed = 0; in ath10k_sta_rc_update_wk()
6743 bw = arsta->bw; in ath10k_sta_rc_update_wk()
6744 nss = arsta->nss; in ath10k_sta_rc_update_wk()
6745 smps = arsta->smps; in ath10k_sta_rc_update_wk()
6747 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update_wk()
6749 mutex_lock(&ar->conf_mutex); in ath10k_sta_rc_update_wk()
6760 sta->addr, bw, mode); in ath10k_sta_rc_update_wk()
6762 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6763 ar->wmi.peer_param->phymode, mode); in ath10k_sta_rc_update_wk()
6766 sta->addr, mode, err); in ath10k_sta_rc_update_wk()
6770 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6771 ar->wmi.peer_param->chan_width, bw); in ath10k_sta_rc_update_wk()
6774 sta->addr, bw, err); in ath10k_sta_rc_update_wk()
6779 sta->addr, nss); in ath10k_sta_rc_update_wk()
6781 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6782 ar->wmi.peer_param->nss, nss); in ath10k_sta_rc_update_wk()
6785 sta->addr, nss, err); in ath10k_sta_rc_update_wk()
6790 sta->addr, smps); in ath10k_sta_rc_update_wk()
6792 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6793 ar->wmi.peer_param->smps_state, smps); in ath10k_sta_rc_update_wk()
6796 sta->addr, smps, err); in ath10k_sta_rc_update_wk()
6801 sta->addr); in ath10k_sta_rc_update_wk()
6803 err = ath10k_station_assoc(ar, arvif->vif, sta, true); in ath10k_sta_rc_update_wk()
6806 sta->addr); in ath10k_sta_rc_update_wk()
6810 mutex_unlock(&ar->conf_mutex); in ath10k_sta_rc_update_wk()
6816 struct ath10k *ar = arvif->ar; in ath10k_mac_inc_num_stations()
6818 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_inc_num_stations()
6820 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath10k_mac_inc_num_stations()
6823 if (ar->num_stations >= ar->max_num_stations) in ath10k_mac_inc_num_stations()
6824 return -ENOBUFS; in ath10k_mac_inc_num_stations()
6826 ar->num_stations++; in ath10k_mac_inc_num_stations()
6834 struct ath10k *ar = arvif->ar; in ath10k_mac_dec_num_stations()
6836 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_dec_num_stations()
6838 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath10k_mac_dec_num_stations()
6841 ar->num_stations--; in ath10k_mac_dec_num_stations()
6848 struct ath10k *ar = hw->priv; in ath10k_sta_set_txpwr()
6849 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_set_txpwr()
6853 if (sta->deflink.txpwr.type == NL80211_TX_POWER_AUTOMATIC) { in ath10k_sta_set_txpwr()
6856 txpwr = sta->deflink.txpwr.power; in ath10k_sta_set_txpwr()
6858 return -EINVAL; in ath10k_sta_set_txpwr()
6862 return -EINVAL; in ath10k_sta_set_txpwr()
6864 mutex_lock(&ar->conf_mutex); in ath10k_sta_set_txpwr()
6866 ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_set_txpwr()
6867 ar->wmi.peer_param->use_fixed_power, txpwr); in ath10k_sta_set_txpwr()
6875 mutex_unlock(&ar->conf_mutex); in ath10k_sta_set_txpwr()
6894 num_rates += hweight32(mask->control[band].legacy); in ath10k_mac_bitrate_mask_has_single_rate()
6896 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) in ath10k_mac_bitrate_mask_has_single_rate()
6897 num_rates += hweight8(mask->control[band].ht_mcs[i]); in ath10k_mac_bitrate_mask_has_single_rate()
6900 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_has_single_rate()
6901 tmp = hweight16(mask->control[band].vht_mcs[i]); in ath10k_mac_bitrate_mask_has_single_rate()
6924 if (hweight32(mask->control[band].legacy) == 1) { in ath10k_mac_bitrate_mask_get_single_rate()
6925 rate_idx = ffs(mask->control[band].legacy) - 1; in ath10k_mac_bitrate_mask_get_single_rate()
6927 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_mac_bitrate_mask_get_single_rate()
6940 (*nss - 1) << 4 | in ath10k_mac_bitrate_mask_get_single_rate()
6946 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_rate()
6947 if (hweight8(mask->control[band].ht_mcs[i]) == 1) { in ath10k_mac_bitrate_mask_get_single_rate()
6950 (*nss - 1) << 4 | in ath10k_mac_bitrate_mask_get_single_rate()
6951 (ffs(mask->control[band].ht_mcs[i]) - 1); in ath10k_mac_bitrate_mask_get_single_rate()
6958 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_rate()
6959 if (hweight16(mask->control[band].vht_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].vht_mcs[i]) - 1); in ath10k_mac_bitrate_mask_get_single_rate()
6969 return -EINVAL; in ath10k_mac_bitrate_mask_get_single_rate()
6976 struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; in ath10k_mac_validate_rate_mask()
6977 struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; in ath10k_mac_validate_rate_mask()
6979 if (nss > sta->deflink.rx_nss) { in ath10k_mac_validate_rate_mask()
6981 nss, sta->deflink.rx_nss); in ath10k_mac_validate_rate_mask()
6982 return -EINVAL; in ath10k_mac_validate_rate_mask()
6986 if (!vht_cap->vht_supported) { in ath10k_mac_validate_rate_mask()
6988 sta->addr); in ath10k_mac_validate_rate_mask()
6989 return -EINVAL; in ath10k_mac_validate_rate_mask()
6992 if (!ht_cap->ht_supported || vht_cap->vht_supported) { in ath10k_mac_validate_rate_mask()
6994 sta->addr); in ath10k_mac_validate_rate_mask()
6995 return -EINVAL; in ath10k_mac_validate_rate_mask()
6998 if (ht_cap->ht_supported || vht_cap->vht_supported) in ath10k_mac_validate_rate_mask()
6999 return -EINVAL; in ath10k_mac_validate_rate_mask()
7019 return -EINVAL; in ath10k_mac_tid_bitrate_config()
7027 band = def.chan->band; in ath10k_mac_tid_bitrate_config()
7031 return -EINVAL; in ath10k_mac_tid_bitrate_config()
7045 return -EINVAL; in ath10k_mac_tid_bitrate_config()
7051 ar->wmi.svc_map))) in ath10k_mac_tid_bitrate_config()
7054 return -EOPNOTSUPP; in ath10k_mac_tid_bitrate_config()
7063 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_set_tid_config()
7068 if (!sta->wme) in ath10k_mac_set_tid_config()
7069 return -EOPNOTSUPP; in ath10k_mac_set_tid_config()
7071 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_set_tid_config()
7074 if ((arsta->retry_long[arg->tid] > 0 || in ath10k_mac_set_tid_config()
7075 arsta->rate_code[arg->tid] > 0 || in ath10k_mac_set_tid_config()
7076 arsta->ampdu[arg->tid] == in ath10k_mac_set_tid_config()
7078 arg->ack_policy == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7080 arg->ack_policy = 0; in ath10k_mac_set_tid_config()
7081 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7082 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7083 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7088 if (arsta->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_mac_set_tid_config()
7089 arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7090 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7097 if (arsta->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_mac_set_tid_config()
7098 arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7099 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7100 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7104 ether_addr_copy(arg->peer_macaddr.addr, sta->addr); in ath10k_mac_set_tid_config()
7112 arsta->noack[arg->tid] = arg->ack_policy; in ath10k_mac_set_tid_config()
7113 arg->ack_policy = 0; in ath10k_mac_set_tid_config()
7114 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7115 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7116 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7120 arsta->retry_long[arg->tid] = arg->retry_count; in ath10k_mac_set_tid_config()
7121 arg->retry_count = 0; in ath10k_mac_set_tid_config()
7125 arsta->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
7126 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7131 arsta->rate_ctrl[arg->tid] = arg->rate_ctrl; in ath10k_mac_set_tid_config()
7132 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7133 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7137 arsta->rtscts[arg->tid] = arg->rtscts_ctrl; in ath10k_mac_set_tid_config()
7138 arg->ext_tid_cfg_bitmap = 0; in ath10k_mac_set_tid_config()
7142 if ((arvif->retry_long[arg->tid] || in ath10k_mac_set_tid_config()
7143 arvif->rate_code[arg->tid] || in ath10k_mac_set_tid_config()
7144 arvif->ampdu[arg->tid] == in ath10k_mac_set_tid_config()
7146 arg->ack_policy == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7149 arvif->noack[arg->tid] = arg->ack_policy; in ath10k_mac_set_tid_config()
7150 arvif->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
7151 arvif->rate_ctrl[arg->tid] = arg->rate_ctrl; in ath10k_mac_set_tid_config()
7156 if (arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_set_tid_config()
7159 arvif->retry_long[arg->tid] = arg->retry_count; in ath10k_mac_set_tid_config()
7163 if (arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_set_tid_config()
7166 arvif->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
7171 if (arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7175 arvif->rate_ctrl[arg->tid] = arg->rate_ctrl; in ath10k_mac_set_tid_config()
7176 arvif->rate_code[arg->tid] = arg->rcode_flags; in ath10k_mac_set_tid_config()
7181 arvif->rtscts[arg->tid] = arg->rtscts_ctrl; in ath10k_mac_set_tid_config()
7182 arg->ext_tid_cfg_bitmap = 0; in ath10k_mac_set_tid_config()
7186 arvif->tid_conf_changed[arg->tid] |= changed; in ath10k_mac_set_tid_config()
7199 u32 changed = tid_conf->mask; in ath10k_mac_parse_tid_config()
7203 return -EINVAL; in ath10k_mac_parse_tid_config()
7206 if (!(tid_conf->tids & BIT(i))) { in ath10k_mac_parse_tid_config()
7211 arg->tid = i; in ath10k_mac_parse_tid_config()
7214 if (tid_conf->noack == NL80211_TID_CONFIG_ENABLE) { in ath10k_mac_parse_tid_config()
7215 arg->ack_policy = WMI_PEER_TID_CONFIG_NOACK; in ath10k_mac_parse_tid_config()
7216 arg->rate_ctrl = in ath10k_mac_parse_tid_config()
7218 arg->aggr_control = in ath10k_mac_parse_tid_config()
7221 arg->ack_policy = in ath10k_mac_parse_tid_config()
7223 arg->rate_ctrl = in ath10k_mac_parse_tid_config()
7225 arg->aggr_control = in ath10k_mac_parse_tid_config()
7231 arg->retry_count = tid_conf->retry_long; in ath10k_mac_parse_tid_config()
7234 if (tid_conf->noack == NL80211_TID_CONFIG_ENABLE) in ath10k_mac_parse_tid_config()
7235 arg->aggr_control = WMI_TID_CONFIG_AGGR_CONTROL_ENABLE; in ath10k_mac_parse_tid_config()
7237 arg->aggr_control = WMI_TID_CONFIG_AGGR_CONTROL_DISABLE; in ath10k_mac_parse_tid_config()
7243 &arg->rcode_flags, in ath10k_mac_parse_tid_config()
7244 &arg->rate_ctrl, in ath10k_mac_parse_tid_config()
7245 tid_conf->txrate_type, in ath10k_mac_parse_tid_config()
7246 &tid_conf->txrate_mask); in ath10k_mac_parse_tid_config()
7250 arg->rcode_flags = 0; in ath10k_mac_parse_tid_config()
7251 arg->rate_ctrl = 0; in ath10k_mac_parse_tid_config()
7256 if (tid_conf->rtscts) in ath10k_mac_parse_tid_config()
7257 arg->rtscts_ctrl = tid_conf->rtscts; in ath10k_mac_parse_tid_config()
7259 arg->ext_tid_cfg_bitmap = WMI_EXT_TID_RTS_CTS_CONFIG; in ath10k_mac_parse_tid_config()
7276 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_reset_tid_config()
7280 arg.vdev_id = arvif->vdev_id; in ath10k_mac_reset_tid_config()
7295 ether_addr_copy(arg.peer_macaddr.addr, sta->addr); in ath10k_mac_reset_tid_config()
7301 if (!arvif->tids_rst) { in ath10k_mac_reset_tid_config()
7302 arsta->retry_long[i] = -1; in ath10k_mac_reset_tid_config()
7303 arsta->noack[i] = -1; in ath10k_mac_reset_tid_config()
7304 arsta->ampdu[i] = -1; in ath10k_mac_reset_tid_config()
7305 arsta->rate_code[i] = -1; in ath10k_mac_reset_tid_config()
7306 arsta->rate_ctrl[i] = 0; in ath10k_mac_reset_tid_config()
7307 arsta->rtscts[i] = -1; in ath10k_mac_reset_tid_config()
7309 arvif->retry_long[i] = 0; in ath10k_mac_reset_tid_config()
7310 arvif->noack[i] = 0; in ath10k_mac_reset_tid_config()
7311 arvif->ampdu[i] = 0; in ath10k_mac_reset_tid_config()
7312 arvif->rate_code[i] = 0; in ath10k_mac_reset_tid_config()
7313 arvif->rate_ctrl[i] = 0; in ath10k_mac_reset_tid_config()
7314 arvif->rtscts[i] = 0; in ath10k_mac_reset_tid_config()
7337 arvif = arsta->arvif; in ath10k_sta_tid_cfg_wk()
7338 ar = arvif->ar; in ath10k_sta_tid_cfg_wk()
7340 mutex_lock(&ar->conf_mutex); in ath10k_sta_tid_cfg_wk()
7342 if (arvif->tids_rst) { in ath10k_sta_tid_cfg_wk()
7344 arvif->tids_rst); in ath10k_sta_tid_cfg_wk()
7348 ether_addr_copy(arg.peer_macaddr.addr, sta->addr); in ath10k_sta_tid_cfg_wk()
7352 changed = arvif->tid_conf_changed[i]; in ath10k_sta_tid_cfg_wk()
7355 if (arsta->noack[i] != -1) { in ath10k_sta_tid_cfg_wk()
7359 arg.ack_policy = arvif->noack[i]; in ath10k_sta_tid_cfg_wk()
7360 arg.aggr_control = arvif->ampdu[i]; in ath10k_sta_tid_cfg_wk()
7361 arg.rate_ctrl = arvif->rate_ctrl[i]; in ath10k_sta_tid_cfg_wk()
7366 if (arsta->retry_long[i] != -1 || in ath10k_sta_tid_cfg_wk()
7367 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7368 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7371 arg.retry_count = arvif->retry_long[i]; in ath10k_sta_tid_cfg_wk()
7377 if (arsta->ampdu[i] != -1 || in ath10k_sta_tid_cfg_wk()
7378 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7379 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7382 arg.aggr_control = arvif->ampdu[i]; in ath10k_sta_tid_cfg_wk()
7389 nss = ATH10K_HW_NSS(arvif->rate_code[i]); in ath10k_sta_tid_cfg_wk()
7391 arvif->rate_code[i], in ath10k_sta_tid_cfg_wk()
7394 arvif->rate_ctrl[i] > WMI_TID_CONFIG_RATE_CONTROL_AUTO) { in ath10k_sta_tid_cfg_wk()
7399 if (arsta->rate_ctrl[i] > in ath10k_sta_tid_cfg_wk()
7401 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7402 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7406 arg.rate_ctrl = arvif->rate_ctrl[i]; in ath10k_sta_tid_cfg_wk()
7407 arg.rcode_flags = arvif->rate_code[i]; in ath10k_sta_tid_cfg_wk()
7413 if (arsta->rtscts[i]) { in ath10k_sta_tid_cfg_wk()
7417 arg.rtscts_ctrl = arvif->rtscts[i] - 1; in ath10k_sta_tid_cfg_wk()
7430 sta->addr, ret); in ath10k_sta_tid_cfg_wk()
7441 mutex_unlock(&ar->conf_mutex); in ath10k_sta_tid_cfg_wk()
7447 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_vif_stations_tid_conf()
7449 struct ieee80211_vif *sta_vif = arsta->arvif->vif; in ath10k_mac_vif_stations_tid_conf()
7451 if (sta_vif != iter_data->curr_vif || !sta->wme) in ath10k_mac_vif_stations_tid_conf()
7454 ieee80211_queue_work(iter_data->ar->hw, &arsta->tid_config_wk); in ath10k_mac_vif_stations_tid_conf()
7463 struct ath10k *ar = hw->priv; in ath10k_sta_state()
7464 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_state()
7465 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_state()
7473 arsta->arvif = arvif; in ath10k_sta_state()
7474 arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED; in ath10k_sta_state()
7475 INIT_WORK(&arsta->update_wk, ath10k_sta_rc_update_wk); in ath10k_sta_state()
7476 INIT_WORK(&arsta->tid_config_wk, ath10k_sta_tid_cfg_wk); in ath10k_sta_state()
7478 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) in ath10k_sta_state()
7479 ath10k_mac_txq_init(sta->txq[i]); in ath10k_sta_state()
7485 cancel_work_sync(&arsta->update_wk); in ath10k_sta_state()
7486 cancel_work_sync(&arsta->tid_config_wk); in ath10k_sta_state()
7489 mutex_lock(&ar->conf_mutex); in ath10k_sta_state()
7501 arvif->vdev_id, sta->addr, in ath10k_sta_state()
7502 ar->num_stations + 1, ar->max_num_stations, in ath10k_sta_state()
7503 ar->num_peers + 1, ar->max_num_peers); in ath10k_sta_state()
7507 if (sta->tdls) { in ath10k_sta_state()
7508 if (num_tdls_stations >= ar->max_num_tdls_vdevs) { in ath10k_sta_state()
7510 arvif->vdev_id, in ath10k_sta_state()
7511 ar->max_num_tdls_vdevs); in ath10k_sta_state()
7512 ret = -ELNRNG; in ath10k_sta_state()
7521 ar->max_num_stations); in ath10k_sta_state()
7526 arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), in ath10k_sta_state()
7528 if (!arsta->tx_stats) { in ath10k_sta_state()
7530 ret = -ENOMEM; in ath10k_sta_state()
7535 ret = ath10k_peer_create(ar, vif, sta, arvif->vdev_id, in ath10k_sta_state()
7536 sta->addr, peer_type); in ath10k_sta_state()
7539 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7541 kfree(arsta->tx_stats); in ath10k_sta_state()
7545 spin_lock_bh(&ar->data_lock); in ath10k_sta_state()
7547 peer = ath10k_peer_find(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7550 vif->addr, arvif->vdev_id); in ath10k_sta_state()
7551 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7552 ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7554 kfree(arsta->tx_stats); in ath10k_sta_state()
7555 ret = -ENOENT; in ath10k_sta_state()
7559 arsta->peer_id = find_first_bit(peer->peer_ids, in ath10k_sta_state()
7562 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7564 if (!sta->tdls) in ath10k_sta_state()
7567 ret = ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7571 arvif->vdev_id, ret); in ath10k_sta_state()
7572 ath10k_peer_delete(ar, arvif->vdev_id, in ath10k_sta_state()
7573 sta->addr); in ath10k_sta_state()
7575 kfree(arsta->tx_stats); in ath10k_sta_state()
7579 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, sta, in ath10k_sta_state()
7584 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7585 ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7587 kfree(arsta->tx_stats); in ath10k_sta_state()
7591 ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7601 arvif->vdev_id, sta->addr, sta); in ath10k_sta_state()
7603 if (sta->tdls) { in ath10k_sta_state()
7604 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, in ath10k_sta_state()
7609 sta->addr, in ath10k_sta_state()
7613 ret = ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7616 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7620 spin_lock_bh(&ar->data_lock); in ath10k_sta_state()
7621 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_sta_state()
7622 peer = ar->peer_map[i]; in ath10k_sta_state()
7626 if (peer->sta == sta) { in ath10k_sta_state()
7628 sta->addr, peer, i, arvif->vdev_id); in ath10k_sta_state()
7629 peer->sta = NULL; in ath10k_sta_state()
7637 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7640 kfree(arsta->tx_stats); in ath10k_sta_state()
7641 arsta->tx_stats = NULL; in ath10k_sta_state()
7644 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) in ath10k_sta_state()
7645 ath10k_mac_txq_unref(ar, sta->txq[i]); in ath10k_sta_state()
7647 if (!sta->tdls) in ath10k_sta_state()
7654 ret = ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7658 arvif->vdev_id, ret); in ath10k_sta_state()
7662 (vif->type == NL80211_IFTYPE_AP || in ath10k_sta_state()
7663 vif->type == NL80211_IFTYPE_MESH_POINT || in ath10k_sta_state()
7664 vif->type == NL80211_IFTYPE_ADHOC)) { in ath10k_sta_state()
7669 sta->addr); in ath10k_sta_state()
7674 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7677 sta->tdls) { in ath10k_sta_state()
7682 sta->addr); in ath10k_sta_state()
7687 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7691 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, sta, in ath10k_sta_state()
7695 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7698 (vif->type == NL80211_IFTYPE_AP || in ath10k_sta_state()
7699 vif->type == NL80211_IFTYPE_MESH_POINT || in ath10k_sta_state()
7700 vif->type == NL80211_IFTYPE_ADHOC)) { in ath10k_sta_state()
7705 sta->addr); in ath10k_sta_state()
7710 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7713 mutex_unlock(&ar->conf_mutex); in ath10k_sta_state()
7720 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_conf_tx_uapsd()
7726 lockdep_assert_held(&ar->conf_mutex); in ath10k_conf_tx_uapsd()
7728 if (arvif->vdev_type != WMI_VDEV_TYPE_STA) in ath10k_conf_tx_uapsd()
7759 arvif->u.sta.uapsd |= value; in ath10k_conf_tx_uapsd()
7761 arvif->u.sta.uapsd &= ~value; in ath10k_conf_tx_uapsd()
7763 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7765 arvif->u.sta.uapsd); in ath10k_conf_tx_uapsd()
7771 if (arvif->u.sta.uapsd) in ath10k_conf_tx_uapsd()
7776 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7785 arvif->vdev_id, ret); in ath10k_conf_tx_uapsd()
7792 arvif->vdev_id, ret); in ath10k_conf_tx_uapsd()
7796 if (test_bit(WMI_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG, ar->wmi.svc_map) || in ath10k_conf_tx_uapsd()
7797 test_bit(WMI_SERVICE_STA_UAPSD_VAR_AUTO_TRIG, ar->wmi.svc_map)) { in ath10k_conf_tx_uapsd()
7799 * trigger frame. The following effectively disables u-UAPSD in ath10k_conf_tx_uapsd()
7810 ret = ath10k_wmi_vdev_sta_uapsd(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7811 arvif->bssid, &arg, 1); in ath10k_conf_tx_uapsd()
7828 struct ath10k *ar = hw->priv; in ath10k_conf_tx()
7829 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_conf_tx()
7833 mutex_lock(&ar->conf_mutex); in ath10k_conf_tx()
7837 p = &arvif->wmm_params.ac_vo; in ath10k_conf_tx()
7840 p = &arvif->wmm_params.ac_vi; in ath10k_conf_tx()
7843 p = &arvif->wmm_params.ac_be; in ath10k_conf_tx()
7846 p = &arvif->wmm_params.ac_bk; in ath10k_conf_tx()
7851 ret = -EINVAL; in ath10k_conf_tx()
7855 p->cwmin = params->cw_min; in ath10k_conf_tx()
7856 p->cwmax = params->cw_max; in ath10k_conf_tx()
7857 p->aifs = params->aifs; in ath10k_conf_tx()
7864 p->txop = params->txop * 32; in ath10k_conf_tx()
7866 if (ar->wmi.ops->gen_vdev_wmm_conf) { in ath10k_conf_tx()
7867 ret = ath10k_wmi_vdev_wmm_conf(ar, arvif->vdev_id, in ath10k_conf_tx()
7868 &arvif->wmm_params); in ath10k_conf_tx()
7871 arvif->vdev_id, ret); in ath10k_conf_tx()
7875 /* This won't work well with multi-interface cases but it's in ath10k_conf_tx()
7878 ret = ath10k_wmi_pdev_set_wmm_params(ar, &arvif->wmm_params); in ath10k_conf_tx()
7885 ret = ath10k_conf_tx_uapsd(ar, vif, ac, params->uapsd); in ath10k_conf_tx()
7890 mutex_unlock(&ar->conf_mutex); in ath10k_conf_tx()
7900 struct ath10k *ar = hw->priv; in ath10k_remain_on_channel()
7901 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_remain_on_channel()
7906 mutex_lock(&ar->conf_mutex); in ath10k_remain_on_channel()
7909 ret = -EBUSY; in ath10k_remain_on_channel()
7913 spin_lock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7914 switch (ar->scan.state) { in ath10k_remain_on_channel()
7916 reinit_completion(&ar->scan.started); in ath10k_remain_on_channel()
7917 reinit_completion(&ar->scan.completed); in ath10k_remain_on_channel()
7918 reinit_completion(&ar->scan.on_channel); in ath10k_remain_on_channel()
7919 ar->scan.state = ATH10K_SCAN_STARTING; in ath10k_remain_on_channel()
7920 ar->scan.is_roc = true; in ath10k_remain_on_channel()
7921 ar->scan.vdev_id = arvif->vdev_id; in ath10k_remain_on_channel()
7922 ar->scan.roc_freq = chan->center_freq; in ath10k_remain_on_channel()
7923 ar->scan.roc_notify = true; in ath10k_remain_on_channel()
7929 ret = -EBUSY; in ath10k_remain_on_channel()
7932 spin_unlock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7937 scan_time_msec = ar->hw->wiphy->max_remain_on_channel_duration * 2; in ath10k_remain_on_channel()
7941 arg.vdev_id = arvif->vdev_id; in ath10k_remain_on_channel()
7944 arg.channels[0] = chan->center_freq; in ath10k_remain_on_channel()
7955 spin_lock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7956 ar->scan.state = ATH10K_SCAN_IDLE; in ath10k_remain_on_channel()
7957 spin_unlock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7961 ret = wait_for_completion_timeout(&ar->scan.on_channel, 3 * HZ); in ath10k_remain_on_channel()
7969 ret = -ETIMEDOUT; in ath10k_remain_on_channel()
7973 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath10k_remain_on_channel()
7978 mutex_unlock(&ar->conf_mutex); in ath10k_remain_on_channel()
7985 struct ath10k *ar = hw->priv; in ath10k_cancel_remain_on_channel()
7987 mutex_lock(&ar->conf_mutex); in ath10k_cancel_remain_on_channel()
7989 spin_lock_bh(&ar->data_lock); in ath10k_cancel_remain_on_channel()
7990 ar->scan.roc_notify = false; in ath10k_cancel_remain_on_channel()
7991 spin_unlock_bh(&ar->data_lock); in ath10k_cancel_remain_on_channel()
7995 mutex_unlock(&ar->conf_mutex); in ath10k_cancel_remain_on_channel()
7997 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_cancel_remain_on_channel()
8003 * Both RTS and Fragmentation threshold are interface-specific
8004 * in ath10k, but device-specific in mac80211.
8009 struct ath10k *ar = hw->priv; in ath10k_set_rts_threshold()
8013 mutex_lock(&ar->conf_mutex); in ath10k_set_rts_threshold()
8014 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_set_rts_threshold()
8016 arvif->vdev_id, value); in ath10k_set_rts_threshold()
8021 arvif->vdev_id, ret); in ath10k_set_rts_threshold()
8025 mutex_unlock(&ar->conf_mutex); in ath10k_set_rts_threshold()
8042 return -EOPNOTSUPP; in ath10k_mac_op_set_frag_threshold()
8054 if (ar->state == ATH10K_STATE_WEDGED) in ath10k_mac_wait_tx_complete()
8057 time_left = wait_event_timeout(ar->htt.empty_tx_wq, ({ in ath10k_mac_wait_tx_complete()
8060 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_wait_tx_complete()
8061 empty = (ar->htt.num_pending_tx == 0); in ath10k_mac_wait_tx_complete()
8062 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_wait_tx_complete()
8064 skip = (ar->state == ATH10K_STATE_WEDGED) || in ath10k_mac_wait_tx_complete()
8066 &ar->dev_flags); in ath10k_mac_wait_tx_complete()
8072 ath10k_warn(ar, "failed to flush transmit queue (skip %i ar-state %i): %ld\n", in ath10k_mac_wait_tx_complete()
8073 skip, ar->state, time_left); in ath10k_mac_wait_tx_complete()
8079 struct ath10k *ar = hw->priv; in ath10k_flush()
8084 if (vif && vif->type == NL80211_IFTYPE_STATION) { in ath10k_flush()
8086 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_flush()
8087 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath10k_flush()
8088 ath10k_wmi_peer_flush(ar, arvif->vdev_id, in ath10k_flush()
8089 arvif->bssid, bitmap); in ath10k_flush()
8091 ath10k_htt_flush_tx(&ar->htt); in ath10k_flush()
8096 mutex_lock(&ar->conf_mutex); in ath10k_flush()
8098 mutex_unlock(&ar->conf_mutex); in ath10k_flush()
8113 struct ath10k *ar = hw->priv; in ath10k_reconfig_complete()
8119 mutex_lock(&ar->conf_mutex); in ath10k_reconfig_complete()
8124 if (ar->state == ATH10K_STATE_RESTARTED) { in ath10k_reconfig_complete()
8126 ar->state = ATH10K_STATE_ON; in ath10k_reconfig_complete()
8127 ieee80211_wake_queues(ar->hw); in ath10k_reconfig_complete()
8128 clear_bit(ATH10K_FLAG_RESTARTING, &ar->dev_flags); in ath10k_reconfig_complete()
8129 if (ar->hw_params.hw_restart_disconnect) { in ath10k_reconfig_complete()
8130 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_reconfig_complete()
8131 if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath10k_reconfig_complete()
8132 ieee80211_hw_restart_disconnect(arvif->vif); in ath10k_reconfig_complete()
8137 mutex_unlock(&ar->conf_mutex); in ath10k_reconfig_complete()
8147 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_bss_chan_survey()
8149 if (!test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map) || in ath10k_mac_update_bss_chan_survey()
8150 (ar->rx_channel != channel)) in ath10k_mac_update_bss_chan_survey()
8153 if (ar->scan.state != ATH10K_SCAN_IDLE) { in ath10k_mac_update_bss_chan_survey()
8158 reinit_completion(&ar->bss_survey_done); in ath10k_mac_update_bss_chan_survey()
8166 ret = wait_for_completion_timeout(&ar->bss_survey_done, 3 * HZ); in ath10k_mac_update_bss_chan_survey()
8176 struct ath10k *ar = hw->priv; in ath10k_get_survey()
8178 struct survey_info *ar_survey = &ar->survey[idx]; in ath10k_get_survey()
8181 mutex_lock(&ar->conf_mutex); in ath10k_get_survey()
8183 sband = hw->wiphy->bands[NL80211_BAND_2GHZ]; in ath10k_get_survey()
8184 if (sband && idx >= sband->n_channels) { in ath10k_get_survey()
8185 idx -= sband->n_channels; in ath10k_get_survey()
8190 sband = hw->wiphy->bands[NL80211_BAND_5GHZ]; in ath10k_get_survey()
8192 if (!sband || idx >= sband->n_channels) { in ath10k_get_survey()
8193 ret = -ENOENT; in ath10k_get_survey()
8197 ath10k_mac_update_bss_chan_survey(ar, &sband->channels[idx]); in ath10k_get_survey()
8199 spin_lock_bh(&ar->data_lock); in ath10k_get_survey()
8201 spin_unlock_bh(&ar->data_lock); in ath10k_get_survey()
8203 survey->channel = &sband->channels[idx]; in ath10k_get_survey()
8205 if (ar->rx_channel == survey->channel) in ath10k_get_survey()
8206 survey->filled |= SURVEY_INFO_IN_USE; in ath10k_get_survey()
8209 mutex_unlock(&ar->conf_mutex); in ath10k_get_survey()
8219 struct ieee80211_supported_band *sband = &ar->mac.sbands[band]; in ath10k_mac_bitrate_mask_get_single_nss()
8220 u16 vht_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map); in ath10k_mac_bitrate_mask_get_single_nss()
8225 if (mask->control[band].legacy) in ath10k_mac_bitrate_mask_get_single_nss()
8228 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_nss()
8229 if (mask->control[band].ht_mcs[i] == 0) in ath10k_mac_bitrate_mask_get_single_nss()
8231 else if (mask->control[band].ht_mcs[i] == in ath10k_mac_bitrate_mask_get_single_nss()
8232 sband->ht_cap.mcs.rx_mask[i]) in ath10k_mac_bitrate_mask_get_single_nss()
8238 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_nss()
8239 if (mask->control[band].vht_mcs[i] == 0) in ath10k_mac_bitrate_mask_get_single_nss()
8241 else if (mask->control[band].vht_mcs[i] == in ath10k_mac_bitrate_mask_get_single_nss()
8254 if (BIT(fls(ht_nss_mask)) - 1 != ht_nss_mask) in ath10k_mac_bitrate_mask_get_single_nss()
8265 struct ath10k *ar = arvif->ar; in ath10k_mac_set_fixed_rate_params()
8269 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_set_fixed_rate_params()
8272 arvif->vdev_id, rate, nss, sgi); in ath10k_mac_set_fixed_rate_params()
8274 vdev_param = ar->wmi.vdev_param->fixed_rate; in ath10k_mac_set_fixed_rate_params()
8275 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, rate); in ath10k_mac_set_fixed_rate_params()
8282 vdev_param = ar->wmi.vdev_param->nss; in ath10k_mac_set_fixed_rate_params()
8283 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, nss); in ath10k_mac_set_fixed_rate_params()
8289 vdev_param = ar->wmi.vdev_param->sgi; in ath10k_mac_set_fixed_rate_params()
8290 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, sgi); in ath10k_mac_set_fixed_rate_params()
8296 vdev_param = ar->wmi.vdev_param->ldpc; in ath10k_mac_set_fixed_rate_params()
8297 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, ldpc); in ath10k_mac_set_fixed_rate_params()
8317 * ranges can be used: none, 0-7, 0-8 and 0-9. in ath10k_mac_can_set_bitrate_mask()
8320 vht_mcs = mask->control[band].vht_mcs[i]; in ath10k_mac_can_set_bitrate_mask()
8324 case BIT(8) - 1: in ath10k_mac_can_set_bitrate_mask()
8325 case BIT(9) - 1: in ath10k_mac_can_set_bitrate_mask()
8326 case BIT(10) - 1: in ath10k_mac_can_set_bitrate_mask()
8330 ath10k_warn(ar, "refusing bitrate mask with missing 0-7 VHT MCS rates\n"); in ath10k_mac_can_set_bitrate_mask()
8343 u8 rate = arvif->vht_pfr; in ath10k_mac_set_vht_bitrate_mask_fixup()
8346 if (!sta->deflink.vht_cap.vht_supported || arvif->vht_num_rates != 1) in ath10k_mac_set_vht_bitrate_mask_fixup()
8349 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_mac_set_vht_bitrate_mask_fixup()
8353 sta->addr, err); in ath10k_mac_set_vht_bitrate_mask_fixup()
8362 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_set_bitrate_mask_iter()
8363 struct ath10k *ar = arvif->ar; in ath10k_mac_set_bitrate_mask_iter()
8365 if (arsta->arvif != arvif) in ath10k_mac_set_bitrate_mask_iter()
8371 spin_lock_bh(&ar->data_lock); in ath10k_mac_set_bitrate_mask_iter()
8372 arsta->changed |= IEEE80211_RC_SUPP_RATES_CHANGED; in ath10k_mac_set_bitrate_mask_iter()
8373 spin_unlock_bh(&ar->data_lock); in ath10k_mac_set_bitrate_mask_iter()
8375 ieee80211_queue_work(ar->hw, &arsta->update_wk); in ath10k_mac_set_bitrate_mask_iter()
8382 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_clr_bitrate_mask_iter()
8383 struct ath10k *ar = arvif->ar; in ath10k_mac_clr_bitrate_mask_iter()
8387 if (arsta->arvif != arvif || !sta->deflink.vht_cap.vht_supported) in ath10k_mac_clr_bitrate_mask_iter()
8390 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_mac_clr_bitrate_mask_iter()
8395 sta->addr, err); in ath10k_mac_clr_bitrate_mask_iter()
8402 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_set_bitrate_mask()
8404 struct ath10k *ar = arvif->ar; in ath10k_mac_op_set_bitrate_mask()
8419 return -EPERM; in ath10k_mac_op_set_bitrate_mask()
8421 band = def.chan->band; in ath10k_mac_op_set_bitrate_mask()
8422 ht_mcs_mask = mask->control[band].ht_mcs; in ath10k_mac_op_set_bitrate_mask()
8423 vht_mcs_mask = mask->control[band].vht_mcs; in ath10k_mac_op_set_bitrate_mask()
8424 ldpc = !!(ar->ht_cap_info & WMI_HT_CAP_LDPC); in ath10k_mac_op_set_bitrate_mask()
8426 sgi = mask->control[band].gi; in ath10k_mac_op_set_bitrate_mask()
8428 return -EINVAL; in ath10k_mac_op_set_bitrate_mask()
8431 ar->normal_mode_fw.fw_file.fw_features); in ath10k_mac_op_set_bitrate_mask()
8433 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8434 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_mac_op_set_bitrate_mask()
8437 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8447 arvif->vdev_id, ret); in ath10k_mac_op_set_bitrate_mask()
8456 nss = min(ar->num_rf_chains, in ath10k_mac_op_set_bitrate_mask()
8465 return -EINVAL; in ath10k_mac_op_set_bitrate_mask()
8480 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8483 arvif->bitrate_mask = *mask; in ath10k_mac_op_set_bitrate_mask()
8484 arvif->vht_num_rates = vht_num_rates; in ath10k_mac_op_set_bitrate_mask()
8485 arvif->vht_pfr = vht_pfr; in ath10k_mac_op_set_bitrate_mask()
8486 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_mac_op_set_bitrate_mask()
8490 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8493 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8498 arvif->vdev_id, ret); in ath10k_mac_op_set_bitrate_mask()
8503 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8513 struct ath10k *ar = hw->priv; in ath10k_sta_rc_update()
8514 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_rc_update()
8515 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_rc_update()
8519 spin_lock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8521 peer = ath10k_peer_find(ar, arvif->vdev_id, sta->addr); in ath10k_sta_rc_update()
8523 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8525 sta->addr, arvif->vdev_id); in ath10k_sta_rc_update()
8531 sta->addr, changed, sta->deflink.bandwidth, in ath10k_sta_rc_update()
8532 sta->deflink.rx_nss, in ath10k_sta_rc_update()
8533 sta->deflink.smps_mode); in ath10k_sta_rc_update()
8538 switch (sta->deflink.bandwidth) { in ath10k_sta_rc_update()
8553 sta->deflink.bandwidth, sta->addr); in ath10k_sta_rc_update()
8558 arsta->bw = bw; in ath10k_sta_rc_update()
8562 arsta->nss = sta->deflink.rx_nss; in ath10k_sta_rc_update()
8567 switch (sta->deflink.smps_mode) { in ath10k_sta_rc_update()
8580 sta->deflink.smps_mode, sta->addr); in ath10k_sta_rc_update()
8585 arsta->smps = smps; in ath10k_sta_rc_update()
8588 arsta->changed |= changed; in ath10k_sta_rc_update()
8590 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8592 ieee80211_queue_work(hw, &arsta->update_wk); in ath10k_sta_rc_update()
8598 struct ath10k *ar = hw->priv; in ath10k_offset_tsf()
8599 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_offset_tsf()
8604 vdev_param = ar->wmi.vdev_param->dec_tsf; in ath10k_offset_tsf()
8605 offset = -tsf_offset; in ath10k_offset_tsf()
8607 vdev_param = ar->wmi.vdev_param->inc_tsf; in ath10k_offset_tsf()
8611 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_offset_tsf()
8614 if (ret && ret != -EOPNOTSUPP) in ath10k_offset_tsf()
8623 struct ath10k *ar = hw->priv; in ath10k_ampdu_action()
8624 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_ampdu_action()
8625 struct ieee80211_sta *sta = params->sta; in ath10k_ampdu_action()
8626 enum ieee80211_ampdu_mlme_action action = params->action; in ath10k_ampdu_action()
8627 u16 tid = params->tid; in ath10k_ampdu_action()
8630 arvif->vdev_id, sta->addr, tid, action); in ath10k_ampdu_action()
8647 return -EOPNOTSUPP; in ath10k_ampdu_action()
8650 return -EINVAL; in ath10k_ampdu_action()
8661 /* Both locks are required because ar->rx_channel is modified. This in ath10k_mac_update_rx_channel()
8664 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_rx_channel()
8665 lockdep_assert_held(&ar->data_lock); in ath10k_mac_update_rx_channel()
8671 * on a linked list now. Doing a lookup peer -> vif -> chanctx for each in ath10k_mac_update_rx_channel()
8672 * ppdu on Rx may reduce performance on low-end systems. It should be in ath10k_mac_update_rx_channel()
8676 * only for multi-channel cases. Single-channel cases will remain to in ath10k_mac_update_rx_channel()
8682 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_update_rx_channel()
8687 def = &vifs[0].new_ctx->def; in ath10k_mac_update_rx_channel()
8689 ar->rx_channel = def->chan; in ath10k_mac_update_rx_channel()
8691 (ctx && (ar->state == ATH10K_STATE_RESTARTED))) { in ath10k_mac_update_rx_channel()
8697 ar->rx_channel = ctx->def.chan; in ath10k_mac_update_rx_channel()
8699 ar->rx_channel = NULL; in ath10k_mac_update_rx_channel()
8713 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_vif_chan()
8718 if (ar->monitor_started) in ath10k_mac_update_vif_chan()
8722 arvif = (void *)vifs[i].vif->drv_priv; in ath10k_mac_update_vif_chan()
8725 "mac chanctx switch vdev_id %i freq %u->%u width %d->%d\n", in ath10k_mac_update_vif_chan()
8726 arvif->vdev_id, in ath10k_mac_update_vif_chan()
8727 vifs[i].old_ctx->def.chan->center_freq, in ath10k_mac_update_vif_chan()
8728 vifs[i].new_ctx->def.chan->center_freq, in ath10k_mac_update_vif_chan()
8729 vifs[i].old_ctx->def.width, in ath10k_mac_update_vif_chan()
8730 vifs[i].new_ctx->def.width); in ath10k_mac_update_vif_chan()
8732 if (WARN_ON(!arvif->is_started)) in ath10k_mac_update_vif_chan()
8735 if (WARN_ON(!arvif->is_up)) in ath10k_mac_update_vif_chan()
8738 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_update_vif_chan()
8741 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8750 spin_lock_bh(&ar->data_lock); in ath10k_mac_update_vif_chan()
8752 spin_unlock_bh(&ar->data_lock); in ath10k_mac_update_vif_chan()
8755 arvif = (void *)vifs[i].vif->drv_priv; in ath10k_mac_update_vif_chan()
8757 if (WARN_ON(!arvif->is_started)) in ath10k_mac_update_vif_chan()
8760 if (WARN_ON(!arvif->is_up)) in ath10k_mac_update_vif_chan()
8773 ret = ath10k_vdev_restart(arvif, &vifs[i].new_ctx->def); in ath10k_mac_update_vif_chan()
8776 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8780 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_mac_update_vif_chan()
8781 arvif->bssid); in ath10k_mac_update_vif_chan()
8784 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8796 struct ath10k *ar = hw->priv; in ath10k_mac_op_add_chanctx()
8799 "mac chanctx add freq %u width %d ptr %pK\n", in ath10k_mac_op_add_chanctx()
8800 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath10k_mac_op_add_chanctx()
8802 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_add_chanctx()
8804 spin_lock_bh(&ar->data_lock); in ath10k_mac_op_add_chanctx()
8806 spin_unlock_bh(&ar->data_lock); in ath10k_mac_op_add_chanctx()
8811 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_add_chanctx()
8820 struct ath10k *ar = hw->priv; in ath10k_mac_op_remove_chanctx()
8823 "mac chanctx remove freq %u width %d ptr %pK\n", in ath10k_mac_op_remove_chanctx()
8824 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath10k_mac_op_remove_chanctx()
8826 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_remove_chanctx()
8828 spin_lock_bh(&ar->data_lock); in ath10k_mac_op_remove_chanctx()
8830 spin_unlock_bh(&ar->data_lock); in ath10k_mac_op_remove_chanctx()
8835 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_remove_chanctx()
8851 if (rcu_access_pointer(vif->bss_conf.chanctx_conf) != arg->ctx) in ath10k_mac_change_chanctx_cnt_iter()
8854 arg->n_vifs++; in ath10k_mac_change_chanctx_cnt_iter()
8864 ctx = rcu_access_pointer(vif->bss_conf.chanctx_conf); in ath10k_mac_change_chanctx_fill_iter()
8865 if (ctx != arg->ctx) in ath10k_mac_change_chanctx_fill_iter()
8868 if (WARN_ON(arg->next_vif == arg->n_vifs)) in ath10k_mac_change_chanctx_fill_iter()
8871 arg->vifs[arg->next_vif].vif = vif; in ath10k_mac_change_chanctx_fill_iter()
8872 arg->vifs[arg->next_vif].old_ctx = ctx; in ath10k_mac_change_chanctx_fill_iter()
8873 arg->vifs[arg->next_vif].new_ctx = ctx; in ath10k_mac_change_chanctx_fill_iter()
8874 arg->next_vif++; in ath10k_mac_change_chanctx_fill_iter()
8882 struct ath10k *ar = hw->priv; in ath10k_mac_op_change_chanctx()
8885 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_change_chanctx()
8888 "mac chanctx change freq %u width %d ptr %pK changed %x\n", in ath10k_mac_op_change_chanctx()
8889 ctx->def.chan->center_freq, ctx->def.width, ctx, changed); in ath10k_mac_op_change_chanctx()
8926 * definitions per vdev internally and there's no host-side channel in ath10k_mac_op_change_chanctx()
8927 * context abstraction to configure, e.g. channel width. in ath10k_mac_op_change_chanctx()
8931 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_change_chanctx()
8940 struct ath10k *ar = hw->priv; in ath10k_mac_op_assign_vif_chanctx()
8941 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_assign_vif_chanctx()
8944 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8948 ctx, arvif->vdev_id); in ath10k_mac_op_assign_vif_chanctx()
8950 if (WARN_ON(arvif->is_started)) { in ath10k_mac_op_assign_vif_chanctx()
8951 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8952 return -EBUSY; in ath10k_mac_op_assign_vif_chanctx()
8955 ret = ath10k_vdev_start(arvif, &ctx->def); in ath10k_mac_op_assign_vif_chanctx()
8958 arvif->vdev_id, vif->addr, in ath10k_mac_op_assign_vif_chanctx()
8959 ctx->def.chan->center_freq, ret); in ath10k_mac_op_assign_vif_chanctx()
8963 arvif->is_started = true; in ath10k_mac_op_assign_vif_chanctx()
8968 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
8972 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_mac_op_assign_vif_chanctx()
8973 ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, 0, vif->addr); in ath10k_mac_op_assign_vif_chanctx()
8976 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
8980 arvif->is_up = true; in ath10k_mac_op_assign_vif_chanctx()
8987 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
8991 ar->hw_params.tx_stats_over_pktlog) { in ath10k_mac_op_assign_vif_chanctx()
8992 ar->pktlog_filter |= ATH10K_PKTLOG_PEER_STATS; in ath10k_mac_op_assign_vif_chanctx()
8994 ar->pktlog_filter); in ath10k_mac_op_assign_vif_chanctx()
9001 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
9006 arvif->is_started = false; in ath10k_mac_op_assign_vif_chanctx()
9010 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
9020 struct ath10k *ar = hw->priv; in ath10k_mac_op_unassign_vif_chanctx()
9021 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_unassign_vif_chanctx()
9024 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_unassign_vif_chanctx()
9028 ctx, arvif->vdev_id); in ath10k_mac_op_unassign_vif_chanctx()
9030 WARN_ON(!arvif->is_started); in ath10k_mac_op_unassign_vif_chanctx()
9032 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_mac_op_unassign_vif_chanctx()
9033 WARN_ON(!arvif->is_up); in ath10k_mac_op_unassign_vif_chanctx()
9035 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_op_unassign_vif_chanctx()
9038 arvif->vdev_id, ret); in ath10k_mac_op_unassign_vif_chanctx()
9040 arvif->is_up = false; in ath10k_mac_op_unassign_vif_chanctx()
9046 arvif->vdev_id, ret); in ath10k_mac_op_unassign_vif_chanctx()
9048 arvif->is_started = false; in ath10k_mac_op_unassign_vif_chanctx()
9050 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_unassign_vif_chanctx()
9059 struct ath10k *ar = hw->priv; in ath10k_mac_op_switch_vif_chanctx()
9061 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_switch_vif_chanctx()
9068 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_switch_vif_chanctx()
9079 ar = hw->priv; in ath10k_mac_op_sta_pre_rcu_remove()
9081 list_for_each_entry(peer, &ar->peers, list) in ath10k_mac_op_sta_pre_rcu_remove()
9082 if (peer->sta == sta) in ath10k_mac_op_sta_pre_rcu_remove()
9083 peer->removed = true; in ath10k_mac_op_sta_pre_rcu_remove()
9160 index = mcs - len_nss1; in ath10k_mac_get_rate_flags_ht()
9246 rate->flags = flags; in ath10k_mac_parse_bitrate()
9247 rate->bw = bw; in ath10k_mac_parse_bitrate()
9248 rate->legacy = bitrate_kbps / 100; in ath10k_mac_parse_bitrate()
9249 rate->nss = nss; in ath10k_mac_parse_bitrate()
9250 rate->mcs = mcs; in ath10k_mac_parse_bitrate()
9257 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_sta_get_peer_stats_info()
9262 if (!(ar->hw_params.supports_peer_stats_info && in ath10k_mac_sta_get_peer_stats_info()
9263 arsta->arvif->vdev_type == WMI_VDEV_TYPE_STA)) in ath10k_mac_sta_get_peer_stats_info()
9266 spin_lock_bh(&ar->data_lock); in ath10k_mac_sta_get_peer_stats_info()
9267 peer = ath10k_peer_find(ar, arsta->arvif->vdev_id, sta->addr); in ath10k_mac_sta_get_peer_stats_info()
9268 spin_unlock_bh(&ar->data_lock); in ath10k_mac_sta_get_peer_stats_info()
9272 reinit_completion(&ar->peer_stats_info_complete); in ath10k_mac_sta_get_peer_stats_info()
9275 arsta->arvif->vdev_id, in ath10k_mac_sta_get_peer_stats_info()
9277 arsta->arvif->bssid, in ath10k_mac_sta_get_peer_stats_info()
9279 if (ret && ret != -EOPNOTSUPP) { in ath10k_mac_sta_get_peer_stats_info()
9284 time_left = wait_for_completion_timeout(&ar->peer_stats_info_complete, 3 * HZ); in ath10k_mac_sta_get_peer_stats_info()
9290 if (arsta->rx_rate_code != 0 && arsta->rx_bitrate_kbps != 0) { in ath10k_mac_sta_get_peer_stats_info()
9291 ath10k_mac_parse_bitrate(ar, arsta->rx_rate_code, in ath10k_mac_sta_get_peer_stats_info()
9292 arsta->rx_bitrate_kbps, in ath10k_mac_sta_get_peer_stats_info()
9293 &sinfo->rxrate); in ath10k_mac_sta_get_peer_stats_info()
9295 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); in ath10k_mac_sta_get_peer_stats_info()
9296 arsta->rx_rate_code = 0; in ath10k_mac_sta_get_peer_stats_info()
9297 arsta->rx_bitrate_kbps = 0; in ath10k_mac_sta_get_peer_stats_info()
9300 if (arsta->tx_rate_code != 0 && arsta->tx_bitrate_kbps != 0) { in ath10k_mac_sta_get_peer_stats_info()
9301 ath10k_mac_parse_bitrate(ar, arsta->tx_rate_code, in ath10k_mac_sta_get_peer_stats_info()
9302 arsta->tx_bitrate_kbps, in ath10k_mac_sta_get_peer_stats_info()
9303 &sinfo->txrate); in ath10k_mac_sta_get_peer_stats_info()
9305 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in ath10k_mac_sta_get_peer_stats_info()
9306 arsta->tx_rate_code = 0; in ath10k_mac_sta_get_peer_stats_info()
9307 arsta->tx_bitrate_kbps = 0; in ath10k_mac_sta_get_peer_stats_info()
9316 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_statistics()
9317 struct ath10k *ar = arsta->arvif->ar; in ath10k_sta_statistics()
9322 mutex_lock(&ar->conf_mutex); in ath10k_sta_statistics()
9324 mutex_unlock(&ar->conf_mutex); in ath10k_sta_statistics()
9326 sinfo->rx_duration = arsta->rx_duration; in ath10k_sta_statistics()
9327 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION); in ath10k_sta_statistics()
9329 if (arsta->txrate.legacy || arsta->txrate.nss) { in ath10k_sta_statistics()
9330 if (arsta->txrate.legacy) { in ath10k_sta_statistics()
9331 sinfo->txrate.legacy = arsta->txrate.legacy; in ath10k_sta_statistics()
9333 sinfo->txrate.mcs = arsta->txrate.mcs; in ath10k_sta_statistics()
9334 sinfo->txrate.nss = arsta->txrate.nss; in ath10k_sta_statistics()
9335 sinfo->txrate.bw = arsta->txrate.bw; in ath10k_sta_statistics()
9337 sinfo->txrate.flags = arsta->txrate.flags; in ath10k_sta_statistics()
9338 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in ath10k_sta_statistics()
9341 if (ar->htt.disable_tx_comp) { in ath10k_sta_statistics()
9342 sinfo->tx_failed = arsta->tx_failed; in ath10k_sta_statistics()
9343 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); in ath10k_sta_statistics()
9346 sinfo->tx_retries = arsta->tx_retries; in ath10k_sta_statistics()
9347 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES); in ath10k_sta_statistics()
9357 struct ath10k *ar = hw->priv; in ath10k_mac_op_set_tid_config()
9358 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_set_tid_config()
9363 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_tid_config()
9364 arg.vdev_id = arvif->vdev_id; in ath10k_mac_op_set_tid_config()
9366 arvif->tids_rst = 0; in ath10k_mac_op_set_tid_config()
9367 memset(arvif->tid_conf_changed, 0, sizeof(arvif->tid_conf_changed)); in ath10k_mac_op_set_tid_config()
9369 for (i = 0; i < tid_config->n_tid_conf; i++) { in ath10k_mac_op_set_tid_config()
9371 &tid_config->tid_conf[i], in ath10k_mac_op_set_tid_config()
9382 arvif->tids_rst = 0; in ath10k_mac_op_set_tid_config()
9390 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_tid_config()
9399 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_reset_tid_config()
9401 struct ath10k *ar = hw->priv; in ath10k_mac_op_reset_tid_config()
9404 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_reset_tid_config()
9407 arvif->tids_rst = 0; in ath10k_mac_op_reset_tid_config()
9412 arvif->tids_rst = tids; in ath10k_mac_op_reset_tid_config()
9419 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_reset_tid_config()
9566 ar = hw->priv; in ath10k_mac_create()
9567 ar->hw = hw; in ath10k_mac_create()
9568 ar->ops = ops; in ath10k_mac_create()
9575 struct ieee80211_ops *ops = ar->ops; in ath10k_mac_destroy()
9577 ieee80211_free_hw(ar->hw); in ath10k_mac_destroy()
9699 /* FIXME: This is not thoroughly tested. These combinations may over- or
9795 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_get_arvif_iter()
9797 if (arvif->vdev_id == arvif_iter->vdev_id) in ath10k_get_arvif_iter()
9798 arvif_iter->arvif = arvif; in ath10k_get_arvif_iter()
9808 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_get_arvif()
9830 if (wrdd->type != ACPI_TYPE_PACKAGE || in ath10k_mac_wrdd_get_mcc()
9831 wrdd->package.count < 2 || in ath10k_mac_wrdd_get_mcc()
9832 wrdd->package.elements[0].type != ACPI_TYPE_INTEGER || in ath10k_mac_wrdd_get_mcc()
9833 wrdd->package.elements[0].integer.value != 0) { in ath10k_mac_wrdd_get_mcc()
9838 for (i = 1; i < wrdd->package.count; ++i) { in ath10k_mac_wrdd_get_mcc()
9839 mcc_pkg = &wrdd->package.elements[i]; in ath10k_mac_wrdd_get_mcc()
9841 if (mcc_pkg->type != ACPI_TYPE_PACKAGE) in ath10k_mac_wrdd_get_mcc()
9843 if (mcc_pkg->package.count < 2) in ath10k_mac_wrdd_get_mcc()
9845 if (mcc_pkg->package.elements[0].type != ACPI_TYPE_INTEGER || in ath10k_mac_wrdd_get_mcc()
9846 mcc_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) in ath10k_mac_wrdd_get_mcc()
9849 domain_type = &mcc_pkg->package.elements[0]; in ath10k_mac_wrdd_get_mcc()
9850 if (domain_type->integer.value != WRDD_WIFI) in ath10k_mac_wrdd_get_mcc()
9853 mcc_value = &mcc_pkg->package.elements[1]; in ath10k_mac_wrdd_get_mcc()
9854 return mcc_value->integer.value; in ath10k_mac_wrdd_get_mcc()
9868 root_handle = ACPI_HANDLE(ar->dev); in ath10k_mac_get_wrdd_regulatory()
9870 return -EOPNOTSUPP; in ath10k_mac_get_wrdd_regulatory()
9876 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9883 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9889 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9896 "regulatory hint from WRDD (alpha2-code): %s\n", alpha2); in ath10k_mac_get_wrdd_regulatory()
9900 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9915 rd = ar->hw_eeprom_rd; in ath10k_mac_init_rd()
9918 ar->ath_common.regulatory.current_rd = rd; in ath10k_mac_init_rd()
9939 /* Only QCA99x0 and QCA4019 variants support GCMP-128, GCMP-256 in ath10k_mac_register()
9940 * and CCMP-256 in hardware. in ath10k_mac_register()
9950 if (!is_valid_ether_addr(ar->mac_addr)) { in ath10k_mac_register()
9952 eth_random_addr(ar->mac_addr); in ath10k_mac_register()
9954 SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr); in ath10k_mac_register()
9956 SET_IEEE80211_DEV(ar->hw, ar->dev); in ath10k_mac_register()
9962 if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) { in ath10k_mac_register()
9967 ret = -ENOMEM; in ath10k_mac_register()
9971 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath10k_mac_register()
9972 band->n_channels = ARRAY_SIZE(ath10k_2ghz_channels); in ath10k_mac_register()
9973 band->channels = channels; in ath10k_mac_register()
9975 if (ar->hw_params.cck_rate_map_rev2) { in ath10k_mac_register()
9976 band->n_bitrates = ath10k_g_rates_rev2_size; in ath10k_mac_register()
9977 band->bitrates = ath10k_g_rates_rev2; in ath10k_mac_register()
9979 band->n_bitrates = ath10k_g_rates_size; in ath10k_mac_register()
9980 band->bitrates = ath10k_g_rates; in ath10k_mac_register()
9983 ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = band; in ath10k_mac_register()
9986 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) { in ath10k_mac_register()
9991 ret = -ENOMEM; in ath10k_mac_register()
9995 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath10k_mac_register()
9996 band->n_channels = ARRAY_SIZE(ath10k_5ghz_channels); in ath10k_mac_register()
9997 band->channels = channels; in ath10k_mac_register()
9998 band->n_bitrates = ath10k_a_rates_size; in ath10k_mac_register()
9999 band->bitrates = ath10k_a_rates; in ath10k_mac_register()
10000 ar->hw->wiphy->bands[NL80211_BAND_5GHZ] = band; in ath10k_mac_register()
10003 wiphy_read_of_freq_limits(ar->hw->wiphy); in ath10k_mac_register()
10006 ar->hw->wiphy->interface_modes = in ath10k_mac_register()
10011 ar->hw->wiphy->available_antennas_rx = ar->cfg_rx_chainmask; in ath10k_mac_register()
10012 ar->hw->wiphy->available_antennas_tx = ar->cfg_tx_chainmask; in ath10k_mac_register()
10014 if (!test_bit(ATH10K_FW_FEATURE_NO_P2P, ar->normal_mode_fw.fw_file.fw_features)) in ath10k_mac_register()
10015 ar->hw->wiphy->interface_modes |= in ath10k_mac_register()
10020 ieee80211_hw_set(ar->hw, SIGNAL_DBM); in ath10k_mac_register()
10023 ar->running_fw->fw_file.fw_features)) { in ath10k_mac_register()
10024 ieee80211_hw_set(ar->hw, SUPPORTS_PS); in ath10k_mac_register()
10025 ieee80211_hw_set(ar->hw, SUPPORTS_DYNAMIC_PS); in ath10k_mac_register()
10028 ieee80211_hw_set(ar->hw, MFP_CAPABLE); in ath10k_mac_register()
10029 ieee80211_hw_set(ar->hw, REPORTS_TX_ACK_STATUS); in ath10k_mac_register()
10030 ieee80211_hw_set(ar->hw, HAS_RATE_CONTROL); in ath10k_mac_register()
10031 ieee80211_hw_set(ar->hw, AP_LINK_PS); in ath10k_mac_register()
10032 ieee80211_hw_set(ar->hw, SPECTRUM_MGMT); in ath10k_mac_register()
10033 ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT); in ath10k_mac_register()
10034 ieee80211_hw_set(ar->hw, CONNECTION_MONITOR); in ath10k_mac_register()
10035 ieee80211_hw_set(ar->hw, SUPPORTS_PER_STA_GTK); in ath10k_mac_register()
10036 ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF); in ath10k_mac_register()
10037 ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); in ath10k_mac_register()
10038 ieee80211_hw_set(ar->hw, QUEUE_CONTROL); in ath10k_mac_register()
10039 ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); in ath10k_mac_register()
10040 ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); in ath10k_mac_register()
10042 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) in ath10k_mac_register()
10043 ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); in ath10k_mac_register()
10045 ar->hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS; in ath10k_mac_register()
10046 ar->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in ath10k_mac_register()
10048 if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) in ath10k_mac_register()
10049 ar->hw->wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS; in ath10k_mac_register()
10051 if (ar->ht_cap_info & WMI_HT_CAP_ENABLED) { in ath10k_mac_register()
10052 ieee80211_hw_set(ar->hw, AMPDU_AGGREGATION); in ath10k_mac_register()
10053 ieee80211_hw_set(ar->hw, TX_AMPDU_SETUP_IN_HW); in ath10k_mac_register()
10056 ar->hw->wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID; in ath10k_mac_register()
10057 ar->hw->wiphy->max_scan_ie_len = WLAN_SCAN_PARAMS_MAX_IE_LEN; in ath10k_mac_register()
10059 if (test_bit(WMI_SERVICE_NLO, ar->wmi.svc_map)) { in ath10k_mac_register()
10060 ar->hw->wiphy->max_sched_scan_ssids = WMI_PNO_MAX_SUPP_NETWORKS; in ath10k_mac_register()
10061 ar->hw->wiphy->max_match_sets = WMI_PNO_MAX_SUPP_NETWORKS; in ath10k_mac_register()
10062 ar->hw->wiphy->max_sched_scan_ie_len = WMI_PNO_MAX_IE_LENGTH; in ath10k_mac_register()
10063 ar->hw->wiphy->max_sched_scan_plans = WMI_PNO_MAX_SCHED_SCAN_PLANS; in ath10k_mac_register()
10064 ar->hw->wiphy->max_sched_scan_plan_interval = in ath10k_mac_register()
10066 ar->hw->wiphy->max_sched_scan_plan_iterations = in ath10k_mac_register()
10068 ar->hw->wiphy->features |= NL80211_FEATURE_ND_RANDOM_MAC_ADDR; in ath10k_mac_register()
10071 ar->hw->vif_data_size = sizeof(struct ath10k_vif); in ath10k_mac_register()
10072 ar->hw->sta_data_size = sizeof(struct ath10k_sta); in ath10k_mac_register()
10073 ar->hw->txq_data_size = sizeof(struct ath10k_txq); in ath10k_mac_register()
10075 ar->hw->max_listen_interval = ATH10K_MAX_HW_LISTEN_INTERVAL; in ath10k_mac_register()
10077 if (test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) { in ath10k_mac_register()
10078 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD; in ath10k_mac_register()
10084 ar->hw->wiphy->probe_resp_offload |= in ath10k_mac_register()
10090 if (test_bit(WMI_SERVICE_TDLS, ar->wmi.svc_map) || in ath10k_mac_register()
10091 test_bit(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY, ar->wmi.svc_map)) { in ath10k_mac_register()
10092 ar->hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; in ath10k_mac_register()
10093 if (test_bit(WMI_SERVICE_TDLS_WIDER_BANDWIDTH, ar->wmi.svc_map)) in ath10k_mac_register()
10094 ieee80211_hw_set(ar->hw, TDLS_WIDER_BW); in ath10k_mac_register()
10097 if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map)) in ath10k_mac_register()
10098 ieee80211_hw_set(ar->hw, SUPPORTS_TDLS_BUFFER_STA); in ath10k_mac_register()
10101 if (ar->wmi.vdev_param->tx_encap_type != in ath10k_mac_register()
10103 ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD); in ath10k_mac_register()
10106 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; in ath10k_mac_register()
10107 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; in ath10k_mac_register()
10108 ar->hw->wiphy->max_remain_on_channel_duration = 5000; in ath10k_mac_register()
10110 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; in ath10k_mac_register()
10111 ar->hw->wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE | in ath10k_mac_register()
10114 ar->hw->wiphy->max_ap_assoc_sta = ar->max_num_stations; in ath10k_mac_register()
10122 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS); in ath10k_mac_register()
10123 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10125 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL); in ath10k_mac_register()
10127 if (ar->hw_params.mcast_frame_registration) in ath10k_mac_register()
10128 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10131 if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map) || in ath10k_mac_register()
10132 test_bit(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ar->wmi.svc_map)) in ath10k_mac_register()
10133 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10137 test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map)) in ath10k_mac_register()
10138 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10141 if (test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) in ath10k_mac_register()
10142 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10145 if (test_bit(WMI_SERVICE_TX_PWR_PER_PEER, ar->wmi.svc_map)) in ath10k_mac_register()
10146 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10149 if (test_bit(WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT, ar->wmi.svc_map)) { in ath10k_mac_register()
10150 ar->hw->wiphy->tid_config_support.vif |= in ath10k_mac_register()
10159 ar->wmi.svc_map)) { in ath10k_mac_register()
10160 ar->hw->wiphy->tid_config_support.vif |= in ath10k_mac_register()
10164 ar->hw->wiphy->tid_config_support.peer = in ath10k_mac_register()
10165 ar->hw->wiphy->tid_config_support.vif; in ath10k_mac_register()
10166 ar->hw->wiphy->max_data_retry_count = ATH10K_MAX_RETRY_COUNT; in ath10k_mac_register()
10168 ar->ops->set_tid_config = NULL; in ath10k_mac_register()
10174 ar->hw->queues = IEEE80211_MAX_QUEUES; in ath10k_mac_register()
10180 ar->hw->offchannel_tx_hw_queue = IEEE80211_MAX_QUEUES - 1; in ath10k_mac_register()
10182 switch (ar->running_fw->fw_file.wmi_op_version) { in ath10k_mac_register()
10184 ar->hw->wiphy->iface_combinations = ath10k_if_comb; in ath10k_mac_register()
10185 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10187 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); in ath10k_mac_register()
10190 if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar->wmi.svc_map)) { in ath10k_mac_register()
10191 ar->hw->wiphy->iface_combinations = in ath10k_mac_register()
10193 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10196 ar->hw->wiphy->iface_combinations = ath10k_tlv_if_comb; in ath10k_mac_register()
10197 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10200 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); in ath10k_mac_register()
10205 ar->hw->wiphy->iface_combinations = ath10k_10x_if_comb; in ath10k_mac_register()
10206 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10210 ar->hw->wiphy->iface_combinations = ath10k_10_4_if_comb; in ath10k_mac_register()
10211 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10214 ar->wmi.svc_map)) { in ath10k_mac_register()
10215 ar->hw->wiphy->iface_combinations = in ath10k_mac_register()
10217 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10224 ret = -EINVAL; in ath10k_mac_register()
10228 if (ar->hw_params.dynamic_sar_support) in ath10k_mac_register()
10229 ar->hw->wiphy->sar_capa = &ath10k_sar_capa; in ath10k_mac_register()
10231 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) in ath10k_mac_register()
10232 ar->hw->netdev_features = NETIF_F_HW_CSUM; in ath10k_mac_register()
10236 ar->ath_common.debug_mask = ATH_DBG_DFS; in ath10k_mac_register()
10237 ar->dfs_detector = dfs_pattern_detector_init(&ar->ath_common, in ath10k_mac_register()
10240 if (!ar->dfs_detector) in ath10k_mac_register()
10251 if (!ar->hw_params.hw_ops->set_coverage_class) in ath10k_mac_register()
10252 ar->ops->set_coverage_class = NULL; in ath10k_mac_register()
10254 ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy, in ath10k_mac_register()
10261 if (test_bit(WMI_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi.svc_map)) { in ath10k_mac_register()
10262 ar->hw->wiphy->features |= in ath10k_mac_register()
10266 ar->hw->wiphy->cipher_suites = cipher_suites; in ath10k_mac_register()
10268 /* QCA988x and QCA6174 family chips do not support CCMP-256, GCMP-128 in ath10k_mac_register()
10269 * and GCMP-256 ciphers in hardware. Fetch number of ciphers supported in ath10k_mac_register()
10272 if (!ar->hw_params.n_cipher_suites || in ath10k_mac_register()
10273 ar->hw_params.n_cipher_suites > ARRAY_SIZE(cipher_suites)) { in ath10k_mac_register()
10275 ar->hw_params.n_cipher_suites); in ath10k_mac_register()
10276 ar->hw_params.n_cipher_suites = 8; in ath10k_mac_register()
10278 ar->hw->wiphy->n_cipher_suites = ar->hw_params.n_cipher_suites; in ath10k_mac_register()
10280 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); in ath10k_mac_register()
10282 ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; in ath10k_mac_register()
10284 ret = ieee80211_register_hw(ar->hw); in ath10k_mac_register()
10290 if (test_bit(WMI_SERVICE_PER_PACKET_SW_ENCRYPT, ar->wmi.svc_map)) { in ath10k_mac_register()
10291 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); in ath10k_mac_register()
10292 ar->hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN); in ath10k_mac_register()
10295 if (!ath_is_world_regd(&ar->ath_common.reg_world_copy) && in ath10k_mac_register()
10296 !ath_is_world_regd(&ar->ath_common.regulatory)) { in ath10k_mac_register()
10297 ret = regulatory_hint(ar->hw->wiphy, in ath10k_mac_register()
10298 ar->ath_common.regulatory.alpha2); in ath10k_mac_register()
10306 ieee80211_unregister_hw(ar->hw); in ath10k_mac_register()
10309 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) in ath10k_mac_register()
10310 ar->dfs_detector->exit(ar->dfs_detector); in ath10k_mac_register()
10313 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath10k_mac_register()
10314 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in ath10k_mac_register()
10316 SET_IEEE80211_DEV(ar->hw, NULL); in ath10k_mac_register()
10322 ieee80211_unregister_hw(ar->hw); in ath10k_mac_unregister()
10324 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) in ath10k_mac_unregister()
10325 ar->dfs_detector->exit(ar->dfs_detector); in ath10k_mac_unregister()
10327 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath10k_mac_unregister()
10328 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in ath10k_mac_unregister()
10330 SET_IEEE80211_DEV(ar->hw, NULL); in ath10k_mac_unregister()