Lines Matching +full:cm +full:- +full:poll +full:- +full:mode
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.
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()
1050 arg.channel.mode = chan_to_phymode(chandef); 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()
1498 arg.channel.mode = chan_to_phymode(chandef); 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()
1510 /* For now allow DFS for AP mode */ 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()
1521 ath10k_wmi_phymode_str(arg.channel.mode)); 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()
1896 ath10k_warn(ar, "failed to submit ps poll count %u on vdev %i: %d\n", 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()
1978 ath10k_warn(ar, "failed to set PS Mode %d for vdev %d: %d\n", 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()
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()
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()
3450 "mac channel [%zd/%d] freq %d maxpower %d regpower %d antenna %d mode %d\n", 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()
3740 * end up disconnecting sleeping clients in AP mode. It should fix STA in ath10k_mac_tx_h_get_txmode()
3741 * mode though because AP don't sleep. 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()
3755 * FIXME: Check if raw mode works with TDLS. 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()
3787 /* HTT Tx uses Native Wifi tx mode which expects 802.11 frames without QoS
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()
3916 * with tx encap mode set to RAW. Ex: Multicast traffic generated 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()
4816 static bool ath10k_check_chain_mask(struct ath10k *ar, u32 cm, const char *dbg) in ath10k_check_chain_mask() argument
4822 if (cm == 15 || cm == 7 || cm == 3 || cm == 1 || cm == 0) in ath10k_check_chain_mask()
4826 dbg, cm); in ath10k_check_chain_mask()
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()
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()
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()
5803 ath10k_warn(ar, "failed to recalc ps poll count on vdev %i: %d\n", 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()
6114 "vdev %d set beacon tx mode to staggered\n", 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()
6121 ath10k_warn(ar, "failed to set beacon mode for vdev %d: %i\n", 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 ret = -ENOMEM; in ath10k_hw_scan()
6412 arg->vdev_id = arvif->vdev_id; in ath10k_hw_scan()
6413 arg->scan_id = ATH10K_SCAN_ID; in ath10k_hw_scan()
6415 if (req->ie_len) { in ath10k_hw_scan()
6416 arg->ie_len = req->ie_len; in ath10k_hw_scan()
6417 memcpy(arg->ie, req->ie, arg->ie_len); in ath10k_hw_scan()
6420 if (req->n_ssids) { in ath10k_hw_scan()
6421 arg->n_ssids = req->n_ssids; in ath10k_hw_scan()
6422 for (i = 0; i < arg->n_ssids; i++) { in ath10k_hw_scan()
6423 arg->ssids[i].len = req->ssids[i].ssid_len; in ath10k_hw_scan()
6424 arg->ssids[i].ssid = req->ssids[i].ssid; in ath10k_hw_scan()
6427 arg->scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE; in ath10k_hw_scan()
6430 if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { in ath10k_hw_scan()
6431 arg->scan_ctrl_flags |= WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ; in ath10k_hw_scan()
6432 ether_addr_copy(arg->mac_addr.addr, req->mac_addr); in ath10k_hw_scan()
6433 ether_addr_copy(arg->mac_mask.addr, req->mac_addr_mask); in ath10k_hw_scan()
6436 if (req->n_channels) { in ath10k_hw_scan()
6437 arg->n_channels = req->n_channels; in ath10k_hw_scan()
6438 for (i = 0; i < arg->n_channels; i++) in ath10k_hw_scan()
6439 arg->channels[i] = req->channels[i]->center_freq; in ath10k_hw_scan()
6443 if (req->duration) { in ath10k_hw_scan()
6444 arg->dwell_time_active = req->duration; in ath10k_hw_scan()
6445 arg->dwell_time_passive = req->duration; in ath10k_hw_scan()
6446 arg->burst_duration_ms = req->duration; in ath10k_hw_scan()
6448 scan_timeout = min_t(u32, arg->max_rest_time * in ath10k_hw_scan()
6449 (arg->n_channels - 1) + (req->duration + in ath10k_hw_scan()
6451 arg->n_channels, arg->max_scan_time); in ath10k_hw_scan()
6453 scan_timeout = arg->max_scan_time; in ath10k_hw_scan()
6462 spin_lock_bh(&ar->data_lock); in ath10k_hw_scan()
6463 ar->scan.state = ATH10K_SCAN_IDLE; in ath10k_hw_scan()
6464 spin_unlock_bh(&ar->data_lock); in ath10k_hw_scan()
6467 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath10k_hw_scan()
6473 mutex_unlock(&ar->conf_mutex); in ath10k_hw_scan()
6480 struct ath10k *ar = hw->priv; in ath10k_cancel_hw_scan()
6482 mutex_lock(&ar->conf_mutex); in ath10k_cancel_hw_scan()
6484 mutex_unlock(&ar->conf_mutex); in ath10k_cancel_hw_scan()
6486 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_cancel_hw_scan()
6494 u32 vdev_param = arvif->ar->wmi.vdev_param->def_keyid; in ath10k_set_key_h_def_keyidx()
6499 * frames with multi-vif APs. This is not required for main firmware in ath10k_set_key_h_def_keyidx()
6502 * This is also needed for 636 fw for IBSS-RSN to work more reliably. in ath10k_set_key_h_def_keyidx()
6504 * FIXME: It remains unknown if this is required for multi-vif STA in ath10k_set_key_h_def_keyidx()
6508 if (arvif->vdev_type != WMI_VDEV_TYPE_AP && in ath10k_set_key_h_def_keyidx()
6509 arvif->vdev_type != WMI_VDEV_TYPE_IBSS) in ath10k_set_key_h_def_keyidx()
6512 if (key->cipher == WLAN_CIPHER_SUITE_WEP40) in ath10k_set_key_h_def_keyidx()
6515 if (key->cipher == WLAN_CIPHER_SUITE_WEP104) in ath10k_set_key_h_def_keyidx()
6518 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath10k_set_key_h_def_keyidx()
6524 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_set_key_h_def_keyidx()
6525 key->keyidx); in ath10k_set_key_h_def_keyidx()
6528 arvif->vdev_id, ret); in ath10k_set_key_h_def_keyidx()
6535 struct ath10k *ar = hw->priv; in ath10k_set_key()
6536 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_set_key()
6540 bool is_wep = key->cipher == WLAN_CIPHER_SUITE_WEP40 || in ath10k_set_key()
6541 key->cipher == WLAN_CIPHER_SUITE_WEP104; in ath10k_set_key()
6548 if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || in ath10k_set_key()
6549 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || in ath10k_set_key()
6550 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 || in ath10k_set_key()
6551 key->cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256) in ath10k_set_key()
6554 if (arvif->nohwcrypt) in ath10k_set_key()
6557 if (key->keyidx > WMI_MAX_KEY_INDEX) in ath10k_set_key()
6558 return -ENOSPC; in ath10k_set_key()
6560 mutex_lock(&ar->conf_mutex); in ath10k_set_key()
6563 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_set_key()
6564 peer_addr = sta->addr; in ath10k_set_key()
6565 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6566 arsta->ucast_cipher = key->cipher; in ath10k_set_key()
6567 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6568 } else if (arvif->vdev_type == WMI_VDEV_TYPE_STA) { in ath10k_set_key()
6569 peer_addr = vif->bss_conf.bssid; in ath10k_set_key()
6571 peer_addr = vif->addr; in ath10k_set_key()
6574 key->hw_key_idx = key->keyidx; in ath10k_set_key()
6578 arvif->wep_keys[key->keyidx] = key; in ath10k_set_key()
6580 arvif->wep_keys[key->keyidx] = NULL; in ath10k_set_key()
6583 /* the peer should not disappear in mid-way (unless FW goes awry) since in ath10k_set_key()
6586 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6587 peer = ath10k_peer_find(ar, arvif->vdev_id, peer_addr); in ath10k_set_key()
6588 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6592 ath10k_warn(ar, "failed to install key for non-existent peer %pM\n", in ath10k_set_key()
6594 ret = -EOPNOTSUPP; in ath10k_set_key()
6602 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath10k_set_key()
6613 * keys. Static WEP needs an explicit per-peer key upload. in ath10k_set_key()
6615 if (vif->type == NL80211_IFTYPE_ADHOC && in ath10k_set_key()
6625 if (cmd == SET_KEY && arvif->def_wep_key_idx == -1) in ath10k_set_key()
6633 arvif->vdev_id, peer_addr, ret); in ath10k_set_key()
6640 if (is_wep && !sta && vif->type == NL80211_IFTYPE_STATION) { in ath10k_set_key()
6649 arvif->vdev_id, peer_addr, ret); in ath10k_set_key()
6655 arvif->vdev_id, peer_addr, ret2); in ath10k_set_key()
6663 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6664 peer = ath10k_peer_find(ar, arvif->vdev_id, peer_addr); in ath10k_set_key()
6666 peer->keys[key->keyidx] = key; in ath10k_set_key()
6668 peer->keys[key->keyidx] = NULL; in ath10k_set_key()
6672 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6674 if (sta && sta->tdls) in ath10k_set_key()
6675 ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_set_key()
6676 ar->wmi.peer_param->authorize, 1); in ath10k_set_key()
6677 else if (sta && cmd == SET_KEY && (key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) in ath10k_set_key()
6678 ath10k_wmi_peer_set_param(ar, arvif->vdev_id, peer_addr, in ath10k_set_key()
6679 ar->wmi.peer_param->authorize, 1); in ath10k_set_key()
6682 mutex_unlock(&ar->conf_mutex); in ath10k_set_key()
6690 struct ath10k *ar = hw->priv; in ath10k_set_default_unicast_key()
6691 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_set_default_unicast_key()
6694 mutex_lock(&arvif->ar->conf_mutex); in ath10k_set_default_unicast_key()
6696 if (arvif->ar->state != ATH10K_STATE_ON) in ath10k_set_default_unicast_key()
6700 arvif->vdev_id, keyidx); in ath10k_set_default_unicast_key()
6702 ret = ath10k_wmi_vdev_set_param(arvif->ar, in ath10k_set_default_unicast_key()
6703 arvif->vdev_id, in ath10k_set_default_unicast_key()
6704 arvif->ar->wmi.vdev_param->def_keyid, in ath10k_set_default_unicast_key()
6709 arvif->vdev_id, in ath10k_set_default_unicast_key()
6714 arvif->def_wep_key_idx = keyidx; in ath10k_set_default_unicast_key()
6717 mutex_unlock(&arvif->ar->conf_mutex); in ath10k_set_default_unicast_key()
6735 arvif = arsta->arvif; in ath10k_sta_rc_update_wk()
6736 ar = arvif->ar; in ath10k_sta_rc_update_wk()
6738 if (WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) in ath10k_sta_rc_update_wk()
6741 band = def.chan->band; in ath10k_sta_rc_update_wk()
6742 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath10k_sta_rc_update_wk()
6743 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_sta_rc_update_wk()
6745 spin_lock_bh(&ar->data_lock); in ath10k_sta_rc_update_wk()
6747 changed = arsta->changed; in ath10k_sta_rc_update_wk()
6748 arsta->changed = 0; in ath10k_sta_rc_update_wk()
6750 bw = arsta->bw; in ath10k_sta_rc_update_wk()
6751 nss = arsta->nss; in ath10k_sta_rc_update_wk()
6752 smps = arsta->smps; in ath10k_sta_rc_update_wk()
6754 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update_wk()
6756 mutex_lock(&ar->conf_mutex); in ath10k_sta_rc_update_wk()
6763 enum wmi_phy_mode mode; in ath10k_sta_rc_update_wk() local
6765 mode = chan_to_phymode(&def); in ath10k_sta_rc_update_wk()
6767 sta->addr, bw, mode); in ath10k_sta_rc_update_wk()
6769 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6770 ar->wmi.peer_param->phymode, mode); in ath10k_sta_rc_update_wk()
6773 sta->addr, mode, err); in ath10k_sta_rc_update_wk()
6777 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6778 ar->wmi.peer_param->chan_width, bw); in ath10k_sta_rc_update_wk()
6781 sta->addr, bw, err); in ath10k_sta_rc_update_wk()
6786 sta->addr, nss); in ath10k_sta_rc_update_wk()
6788 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6789 ar->wmi.peer_param->nss, nss); in ath10k_sta_rc_update_wk()
6792 sta->addr, nss, err); in ath10k_sta_rc_update_wk()
6797 sta->addr, smps); in ath10k_sta_rc_update_wk()
6799 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6800 ar->wmi.peer_param->smps_state, smps); in ath10k_sta_rc_update_wk()
6803 sta->addr, smps, err); in ath10k_sta_rc_update_wk()
6808 sta->addr); in ath10k_sta_rc_update_wk()
6810 err = ath10k_station_assoc(ar, arvif->vif, sta, true); in ath10k_sta_rc_update_wk()
6813 sta->addr); in ath10k_sta_rc_update_wk()
6817 mutex_unlock(&ar->conf_mutex); in ath10k_sta_rc_update_wk()
6823 struct ath10k *ar = arvif->ar; in ath10k_mac_inc_num_stations()
6825 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_inc_num_stations()
6827 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath10k_mac_inc_num_stations()
6830 if (ar->num_stations >= ar->max_num_stations) in ath10k_mac_inc_num_stations()
6831 return -ENOBUFS; in ath10k_mac_inc_num_stations()
6833 ar->num_stations++; in ath10k_mac_inc_num_stations()
6841 struct ath10k *ar = arvif->ar; in ath10k_mac_dec_num_stations()
6843 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_dec_num_stations()
6845 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath10k_mac_dec_num_stations()
6848 ar->num_stations--; in ath10k_mac_dec_num_stations()
6855 struct ath10k *ar = hw->priv; in ath10k_sta_set_txpwr()
6856 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_set_txpwr()
6860 if (sta->deflink.txpwr.type == NL80211_TX_POWER_AUTOMATIC) { in ath10k_sta_set_txpwr()
6863 txpwr = sta->deflink.txpwr.power; in ath10k_sta_set_txpwr()
6865 return -EINVAL; in ath10k_sta_set_txpwr()
6869 return -EINVAL; in ath10k_sta_set_txpwr()
6871 mutex_lock(&ar->conf_mutex); in ath10k_sta_set_txpwr()
6873 ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_set_txpwr()
6874 ar->wmi.peer_param->use_fixed_power, txpwr); in ath10k_sta_set_txpwr()
6882 mutex_unlock(&ar->conf_mutex); in ath10k_sta_set_txpwr()
6901 num_rates += hweight32(mask->control[band].legacy); in ath10k_mac_bitrate_mask_has_single_rate()
6903 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) in ath10k_mac_bitrate_mask_has_single_rate()
6904 num_rates += hweight8(mask->control[band].ht_mcs[i]); in ath10k_mac_bitrate_mask_has_single_rate()
6907 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_has_single_rate()
6908 tmp = hweight16(mask->control[band].vht_mcs[i]); in ath10k_mac_bitrate_mask_has_single_rate()
6931 if (hweight32(mask->control[band].legacy) == 1) { in ath10k_mac_bitrate_mask_get_single_rate()
6932 rate_idx = ffs(mask->control[band].legacy) - 1; in ath10k_mac_bitrate_mask_get_single_rate()
6934 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_mac_bitrate_mask_get_single_rate()
6947 (*nss - 1) << 4 | in ath10k_mac_bitrate_mask_get_single_rate()
6953 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_rate()
6954 if (hweight8(mask->control[band].ht_mcs[i]) == 1) { in ath10k_mac_bitrate_mask_get_single_rate()
6957 (*nss - 1) << 4 | in ath10k_mac_bitrate_mask_get_single_rate()
6958 (ffs(mask->control[band].ht_mcs[i]) - 1); in ath10k_mac_bitrate_mask_get_single_rate()
6965 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_rate()
6966 if (hweight16(mask->control[band].vht_mcs[i]) == 1) { in ath10k_mac_bitrate_mask_get_single_rate()
6969 (*nss - 1) << 4 | in ath10k_mac_bitrate_mask_get_single_rate()
6970 (ffs(mask->control[band].vht_mcs[i]) - 1); in ath10k_mac_bitrate_mask_get_single_rate()
6976 return -EINVAL; in ath10k_mac_bitrate_mask_get_single_rate()
6983 struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; in ath10k_mac_validate_rate_mask()
6984 struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; in ath10k_mac_validate_rate_mask()
6986 if (nss > sta->deflink.rx_nss) { in ath10k_mac_validate_rate_mask()
6988 nss, sta->deflink.rx_nss); in ath10k_mac_validate_rate_mask()
6989 return -EINVAL; in ath10k_mac_validate_rate_mask()
6993 if (!vht_cap->vht_supported) { in ath10k_mac_validate_rate_mask()
6995 sta->addr); in ath10k_mac_validate_rate_mask()
6996 return -EINVAL; in ath10k_mac_validate_rate_mask()
6999 if (!ht_cap->ht_supported || vht_cap->vht_supported) { in ath10k_mac_validate_rate_mask()
7001 sta->addr); in ath10k_mac_validate_rate_mask()
7002 return -EINVAL; in ath10k_mac_validate_rate_mask()
7005 if (ht_cap->ht_supported || vht_cap->vht_supported) in ath10k_mac_validate_rate_mask()
7006 return -EINVAL; in ath10k_mac_validate_rate_mask()
7026 return -EINVAL; in ath10k_mac_tid_bitrate_config()
7034 band = def.chan->band; in ath10k_mac_tid_bitrate_config()
7038 return -EINVAL; in ath10k_mac_tid_bitrate_config()
7052 return -EINVAL; in ath10k_mac_tid_bitrate_config()
7058 ar->wmi.svc_map))) in ath10k_mac_tid_bitrate_config()
7061 return -EOPNOTSUPP; in ath10k_mac_tid_bitrate_config()
7070 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_set_tid_config()
7075 if (!sta->wme) in ath10k_mac_set_tid_config()
7076 return -EOPNOTSUPP; in ath10k_mac_set_tid_config()
7078 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_set_tid_config()
7081 if ((arsta->retry_long[arg->tid] > 0 || in ath10k_mac_set_tid_config()
7082 arsta->rate_code[arg->tid] > 0 || in ath10k_mac_set_tid_config()
7083 arsta->ampdu[arg->tid] == in ath10k_mac_set_tid_config()
7085 arg->ack_policy == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7087 arg->ack_policy = 0; in ath10k_mac_set_tid_config()
7088 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7089 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7090 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7095 if (arsta->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_mac_set_tid_config()
7096 arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7097 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7104 if (arsta->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_mac_set_tid_config()
7105 arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7106 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7107 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7111 ether_addr_copy(arg->peer_macaddr.addr, sta->addr); in ath10k_mac_set_tid_config()
7119 arsta->noack[arg->tid] = arg->ack_policy; in ath10k_mac_set_tid_config()
7120 arg->ack_policy = 0; in ath10k_mac_set_tid_config()
7121 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7122 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7123 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7127 arsta->retry_long[arg->tid] = arg->retry_count; in ath10k_mac_set_tid_config()
7128 arg->retry_count = 0; in ath10k_mac_set_tid_config()
7132 arsta->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
7133 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7138 arsta->rate_ctrl[arg->tid] = arg->rate_ctrl; in ath10k_mac_set_tid_config()
7139 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7140 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7144 arsta->rtscts[arg->tid] = arg->rtscts_ctrl; in ath10k_mac_set_tid_config()
7145 arg->ext_tid_cfg_bitmap = 0; in ath10k_mac_set_tid_config()
7149 if ((arvif->retry_long[arg->tid] || in ath10k_mac_set_tid_config()
7150 arvif->rate_code[arg->tid] || in ath10k_mac_set_tid_config()
7151 arvif->ampdu[arg->tid] == in ath10k_mac_set_tid_config()
7153 arg->ack_policy == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7156 arvif->noack[arg->tid] = arg->ack_policy; in ath10k_mac_set_tid_config()
7157 arvif->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
7158 arvif->rate_ctrl[arg->tid] = arg->rate_ctrl; 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->retry_long[arg->tid] = arg->retry_count; in ath10k_mac_set_tid_config()
7170 if (arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_set_tid_config()
7173 arvif->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
7178 if (arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7182 arvif->rate_ctrl[arg->tid] = arg->rate_ctrl; in ath10k_mac_set_tid_config()
7183 arvif->rate_code[arg->tid] = arg->rcode_flags; in ath10k_mac_set_tid_config()
7188 arvif->rtscts[arg->tid] = arg->rtscts_ctrl; in ath10k_mac_set_tid_config()
7189 arg->ext_tid_cfg_bitmap = 0; in ath10k_mac_set_tid_config()
7193 arvif->tid_conf_changed[arg->tid] |= changed; in ath10k_mac_set_tid_config()
7206 u32 changed = tid_conf->mask; in ath10k_mac_parse_tid_config()
7210 return -EINVAL; in ath10k_mac_parse_tid_config()
7213 if (!(tid_conf->tids & BIT(i))) { in ath10k_mac_parse_tid_config()
7218 arg->tid = i; in ath10k_mac_parse_tid_config()
7221 if (tid_conf->noack == NL80211_TID_CONFIG_ENABLE) { in ath10k_mac_parse_tid_config()
7222 arg->ack_policy = WMI_PEER_TID_CONFIG_NOACK; 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()
7228 arg->ack_policy = in ath10k_mac_parse_tid_config()
7230 arg->rate_ctrl = in ath10k_mac_parse_tid_config()
7232 arg->aggr_control = in ath10k_mac_parse_tid_config()
7238 arg->retry_count = tid_conf->retry_long; in ath10k_mac_parse_tid_config()
7241 if (tid_conf->noack == NL80211_TID_CONFIG_ENABLE) in ath10k_mac_parse_tid_config()
7242 arg->aggr_control = WMI_TID_CONFIG_AGGR_CONTROL_ENABLE; in ath10k_mac_parse_tid_config()
7244 arg->aggr_control = WMI_TID_CONFIG_AGGR_CONTROL_DISABLE; in ath10k_mac_parse_tid_config()
7250 &arg->rcode_flags, in ath10k_mac_parse_tid_config()
7251 &arg->rate_ctrl, in ath10k_mac_parse_tid_config()
7252 tid_conf->txrate_type, in ath10k_mac_parse_tid_config()
7253 &tid_conf->txrate_mask); in ath10k_mac_parse_tid_config()
7257 arg->rcode_flags = 0; in ath10k_mac_parse_tid_config()
7258 arg->rate_ctrl = 0; in ath10k_mac_parse_tid_config()
7263 if (tid_conf->rtscts) in ath10k_mac_parse_tid_config()
7264 arg->rtscts_ctrl = tid_conf->rtscts; in ath10k_mac_parse_tid_config()
7266 arg->ext_tid_cfg_bitmap = WMI_EXT_TID_RTS_CTS_CONFIG; in ath10k_mac_parse_tid_config()
7283 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_reset_tid_config()
7287 arg.vdev_id = arvif->vdev_id; in ath10k_mac_reset_tid_config()
7302 ether_addr_copy(arg.peer_macaddr.addr, sta->addr); in ath10k_mac_reset_tid_config()
7308 if (!arvif->tids_rst) { in ath10k_mac_reset_tid_config()
7309 arsta->retry_long[i] = -1; in ath10k_mac_reset_tid_config()
7310 arsta->noack[i] = -1; in ath10k_mac_reset_tid_config()
7311 arsta->ampdu[i] = -1; in ath10k_mac_reset_tid_config()
7312 arsta->rate_code[i] = -1; in ath10k_mac_reset_tid_config()
7313 arsta->rate_ctrl[i] = 0; in ath10k_mac_reset_tid_config()
7314 arsta->rtscts[i] = -1; in ath10k_mac_reset_tid_config()
7316 arvif->retry_long[i] = 0; in ath10k_mac_reset_tid_config()
7317 arvif->noack[i] = 0; in ath10k_mac_reset_tid_config()
7318 arvif->ampdu[i] = 0; in ath10k_mac_reset_tid_config()
7319 arvif->rate_code[i] = 0; in ath10k_mac_reset_tid_config()
7320 arvif->rate_ctrl[i] = 0; in ath10k_mac_reset_tid_config()
7321 arvif->rtscts[i] = 0; in ath10k_mac_reset_tid_config()
7344 arvif = arsta->arvif; in ath10k_sta_tid_cfg_wk()
7345 ar = arvif->ar; in ath10k_sta_tid_cfg_wk()
7347 mutex_lock(&ar->conf_mutex); in ath10k_sta_tid_cfg_wk()
7349 if (arvif->tids_rst) { in ath10k_sta_tid_cfg_wk()
7351 arvif->tids_rst); in ath10k_sta_tid_cfg_wk()
7355 ether_addr_copy(arg.peer_macaddr.addr, sta->addr); in ath10k_sta_tid_cfg_wk()
7359 changed = arvif->tid_conf_changed[i]; in ath10k_sta_tid_cfg_wk()
7362 if (arsta->noack[i] != -1) { in ath10k_sta_tid_cfg_wk()
7366 arg.ack_policy = arvif->noack[i]; in ath10k_sta_tid_cfg_wk()
7367 arg.aggr_control = arvif->ampdu[i]; in ath10k_sta_tid_cfg_wk()
7368 arg.rate_ctrl = arvif->rate_ctrl[i]; in ath10k_sta_tid_cfg_wk()
7373 if (arsta->retry_long[i] != -1 || in ath10k_sta_tid_cfg_wk()
7374 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7375 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7378 arg.retry_count = arvif->retry_long[i]; in ath10k_sta_tid_cfg_wk()
7384 if (arsta->ampdu[i] != -1 || in ath10k_sta_tid_cfg_wk()
7385 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7386 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7389 arg.aggr_control = arvif->ampdu[i]; in ath10k_sta_tid_cfg_wk()
7396 nss = ATH10K_HW_NSS(arvif->rate_code[i]); in ath10k_sta_tid_cfg_wk()
7398 arvif->rate_code[i], in ath10k_sta_tid_cfg_wk()
7401 arvif->rate_ctrl[i] > WMI_TID_CONFIG_RATE_CONTROL_AUTO) { in ath10k_sta_tid_cfg_wk()
7406 if (arsta->rate_ctrl[i] > in ath10k_sta_tid_cfg_wk()
7408 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7409 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7413 arg.rate_ctrl = arvif->rate_ctrl[i]; in ath10k_sta_tid_cfg_wk()
7414 arg.rcode_flags = arvif->rate_code[i]; in ath10k_sta_tid_cfg_wk()
7420 if (arsta->rtscts[i]) { in ath10k_sta_tid_cfg_wk()
7424 arg.rtscts_ctrl = arvif->rtscts[i] - 1; in ath10k_sta_tid_cfg_wk()
7437 sta->addr, ret); in ath10k_sta_tid_cfg_wk()
7448 mutex_unlock(&ar->conf_mutex); in ath10k_sta_tid_cfg_wk()
7454 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_vif_stations_tid_conf()
7456 struct ieee80211_vif *sta_vif = arsta->arvif->vif; in ath10k_mac_vif_stations_tid_conf()
7458 if (sta_vif != iter_data->curr_vif || !sta->wme) in ath10k_mac_vif_stations_tid_conf()
7461 ieee80211_queue_work(iter_data->ar->hw, &arsta->tid_config_wk); in ath10k_mac_vif_stations_tid_conf()
7470 struct ath10k *ar = hw->priv; in ath10k_sta_state()
7471 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_state()
7472 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_state()
7480 arsta->arvif = arvif; in ath10k_sta_state()
7481 arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED; in ath10k_sta_state()
7482 INIT_WORK(&arsta->update_wk, ath10k_sta_rc_update_wk); in ath10k_sta_state()
7483 INIT_WORK(&arsta->tid_config_wk, ath10k_sta_tid_cfg_wk); in ath10k_sta_state()
7485 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) in ath10k_sta_state()
7486 ath10k_mac_txq_init(sta->txq[i]); in ath10k_sta_state()
7492 cancel_work_sync(&arsta->update_wk); in ath10k_sta_state()
7493 cancel_work_sync(&arsta->tid_config_wk); in ath10k_sta_state()
7496 mutex_lock(&ar->conf_mutex); in ath10k_sta_state()
7508 arvif->vdev_id, sta->addr, in ath10k_sta_state()
7509 ar->num_stations + 1, ar->max_num_stations, in ath10k_sta_state()
7510 ar->num_peers + 1, ar->max_num_peers); in ath10k_sta_state()
7514 if (sta->tdls) { in ath10k_sta_state()
7515 if (num_tdls_stations >= ar->max_num_tdls_vdevs) { in ath10k_sta_state()
7517 arvif->vdev_id, in ath10k_sta_state()
7518 ar->max_num_tdls_vdevs); in ath10k_sta_state()
7519 ret = -ELNRNG; in ath10k_sta_state()
7528 ar->max_num_stations); in ath10k_sta_state()
7533 arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), in ath10k_sta_state()
7535 if (!arsta->tx_stats) { in ath10k_sta_state()
7537 ret = -ENOMEM; in ath10k_sta_state()
7542 ret = ath10k_peer_create(ar, vif, sta, arvif->vdev_id, in ath10k_sta_state()
7543 sta->addr, peer_type); in ath10k_sta_state()
7546 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7548 kfree(arsta->tx_stats); in ath10k_sta_state()
7552 spin_lock_bh(&ar->data_lock); in ath10k_sta_state()
7554 peer = ath10k_peer_find(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7557 vif->addr, arvif->vdev_id); in ath10k_sta_state()
7558 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7559 ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7561 kfree(arsta->tx_stats); in ath10k_sta_state()
7562 ret = -ENOENT; in ath10k_sta_state()
7566 arsta->peer_id = find_first_bit(peer->peer_ids, in ath10k_sta_state()
7569 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7571 if (!sta->tdls) in ath10k_sta_state()
7574 ret = ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7578 arvif->vdev_id, ret); in ath10k_sta_state()
7579 ath10k_peer_delete(ar, arvif->vdev_id, in ath10k_sta_state()
7580 sta->addr); in ath10k_sta_state()
7582 kfree(arsta->tx_stats); in ath10k_sta_state()
7586 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, sta, in ath10k_sta_state()
7591 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7592 ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7594 kfree(arsta->tx_stats); in ath10k_sta_state()
7598 ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7608 arvif->vdev_id, sta->addr, sta); in ath10k_sta_state()
7610 if (sta->tdls) { in ath10k_sta_state()
7611 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, in ath10k_sta_state()
7616 sta->addr, in ath10k_sta_state()
7620 ret = ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7623 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7627 spin_lock_bh(&ar->data_lock); in ath10k_sta_state()
7628 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_sta_state()
7629 peer = ar->peer_map[i]; in ath10k_sta_state()
7633 if (peer->sta == sta) { in ath10k_sta_state()
7635 sta->addr, peer, i, arvif->vdev_id); in ath10k_sta_state()
7636 peer->sta = NULL; in ath10k_sta_state()
7644 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7647 kfree(arsta->tx_stats); in ath10k_sta_state()
7648 arsta->tx_stats = NULL; in ath10k_sta_state()
7651 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) in ath10k_sta_state()
7652 ath10k_mac_txq_unref(ar, sta->txq[i]); in ath10k_sta_state()
7654 if (!sta->tdls) in ath10k_sta_state()
7661 ret = ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7665 arvif->vdev_id, ret); in ath10k_sta_state()
7669 (vif->type == NL80211_IFTYPE_AP || in ath10k_sta_state()
7670 vif->type == NL80211_IFTYPE_MESH_POINT || in ath10k_sta_state()
7671 vif->type == NL80211_IFTYPE_ADHOC)) { in ath10k_sta_state()
7676 sta->addr); in ath10k_sta_state()
7681 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7684 sta->tdls) { in ath10k_sta_state()
7689 sta->addr); in ath10k_sta_state()
7694 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7698 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, sta, in ath10k_sta_state()
7702 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7705 (vif->type == NL80211_IFTYPE_AP || in ath10k_sta_state()
7706 vif->type == NL80211_IFTYPE_MESH_POINT || in ath10k_sta_state()
7707 vif->type == NL80211_IFTYPE_ADHOC)) { in ath10k_sta_state()
7712 sta->addr); in ath10k_sta_state()
7717 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7720 mutex_unlock(&ar->conf_mutex); in ath10k_sta_state()
7727 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_conf_tx_uapsd()
7733 lockdep_assert_held(&ar->conf_mutex); in ath10k_conf_tx_uapsd()
7735 if (arvif->vdev_type != WMI_VDEV_TYPE_STA) in ath10k_conf_tx_uapsd()
7766 arvif->u.sta.uapsd |= value; in ath10k_conf_tx_uapsd()
7768 arvif->u.sta.uapsd &= ~value; in ath10k_conf_tx_uapsd()
7770 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7772 arvif->u.sta.uapsd); in ath10k_conf_tx_uapsd()
7778 if (arvif->u.sta.uapsd) in ath10k_conf_tx_uapsd()
7783 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7792 arvif->vdev_id, ret); in ath10k_conf_tx_uapsd()
7798 ath10k_warn(ar, "failed to recalc ps poll count on vdev %i: %d\n", in ath10k_conf_tx_uapsd()
7799 arvif->vdev_id, ret); in ath10k_conf_tx_uapsd()
7803 if (test_bit(WMI_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG, ar->wmi.svc_map) || in ath10k_conf_tx_uapsd()
7804 test_bit(WMI_SERVICE_STA_UAPSD_VAR_AUTO_TRIG, ar->wmi.svc_map)) { in ath10k_conf_tx_uapsd()
7806 * trigger frame. The following effectively disables u-UAPSD in ath10k_conf_tx_uapsd()
7817 ret = ath10k_wmi_vdev_sta_uapsd(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7818 arvif->bssid, &arg, 1); in ath10k_conf_tx_uapsd()
7835 struct ath10k *ar = hw->priv; in ath10k_conf_tx()
7836 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_conf_tx()
7840 mutex_lock(&ar->conf_mutex); in ath10k_conf_tx()
7844 p = &arvif->wmm_params.ac_vo; in ath10k_conf_tx()
7847 p = &arvif->wmm_params.ac_vi; in ath10k_conf_tx()
7850 p = &arvif->wmm_params.ac_be; in ath10k_conf_tx()
7853 p = &arvif->wmm_params.ac_bk; in ath10k_conf_tx()
7858 ret = -EINVAL; in ath10k_conf_tx()
7862 p->cwmin = params->cw_min; in ath10k_conf_tx()
7863 p->cwmax = params->cw_max; in ath10k_conf_tx()
7864 p->aifs = params->aifs; in ath10k_conf_tx()
7871 p->txop = params->txop * 32; in ath10k_conf_tx()
7873 if (ar->wmi.ops->gen_vdev_wmm_conf) { in ath10k_conf_tx()
7874 ret = ath10k_wmi_vdev_wmm_conf(ar, arvif->vdev_id, in ath10k_conf_tx()
7875 &arvif->wmm_params); in ath10k_conf_tx()
7878 arvif->vdev_id, ret); in ath10k_conf_tx()
7882 /* This won't work well with multi-interface cases but it's in ath10k_conf_tx()
7885 ret = ath10k_wmi_pdev_set_wmm_params(ar, &arvif->wmm_params); in ath10k_conf_tx()
7892 ret = ath10k_conf_tx_uapsd(ar, vif, ac, params->uapsd); in ath10k_conf_tx()
7897 mutex_unlock(&ar->conf_mutex); in ath10k_conf_tx()
7907 struct ath10k *ar = hw->priv; in ath10k_remain_on_channel()
7908 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_remain_on_channel()
7913 mutex_lock(&ar->conf_mutex); in ath10k_remain_on_channel()
7916 ret = -EBUSY; in ath10k_remain_on_channel()
7920 spin_lock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7921 switch (ar->scan.state) { in ath10k_remain_on_channel()
7923 reinit_completion(&ar->scan.started); in ath10k_remain_on_channel()
7924 reinit_completion(&ar->scan.completed); in ath10k_remain_on_channel()
7925 reinit_completion(&ar->scan.on_channel); in ath10k_remain_on_channel()
7926 ar->scan.state = ATH10K_SCAN_STARTING; in ath10k_remain_on_channel()
7927 ar->scan.is_roc = true; in ath10k_remain_on_channel()
7928 ar->scan.vdev_id = arvif->vdev_id; in ath10k_remain_on_channel()
7929 ar->scan.roc_freq = chan->center_freq; in ath10k_remain_on_channel()
7930 ar->scan.roc_notify = true; in ath10k_remain_on_channel()
7936 ret = -EBUSY; in ath10k_remain_on_channel()
7939 spin_unlock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7944 scan_time_msec = ar->hw->wiphy->max_remain_on_channel_duration * 2; in ath10k_remain_on_channel()
7948 ret = -ENOMEM; in ath10k_remain_on_channel()
7953 arg->vdev_id = arvif->vdev_id; in ath10k_remain_on_channel()
7954 arg->scan_id = ATH10K_SCAN_ID; in ath10k_remain_on_channel()
7955 arg->n_channels = 1; in ath10k_remain_on_channel()
7956 arg->channels[0] = chan->center_freq; in ath10k_remain_on_channel()
7957 arg->dwell_time_active = scan_time_msec; in ath10k_remain_on_channel()
7958 arg->dwell_time_passive = scan_time_msec; in ath10k_remain_on_channel()
7959 arg->max_scan_time = scan_time_msec; in ath10k_remain_on_channel()
7960 arg->scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE; in ath10k_remain_on_channel()
7961 arg->scan_ctrl_flags |= WMI_SCAN_FILTER_PROBE_REQ; in ath10k_remain_on_channel()
7962 arg->burst_duration_ms = duration; in ath10k_remain_on_channel()
7967 spin_lock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7968 ar->scan.state = ATH10K_SCAN_IDLE; in ath10k_remain_on_channel()
7969 spin_unlock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7973 ret = wait_for_completion_timeout(&ar->scan.on_channel, 3 * HZ); in ath10k_remain_on_channel()
7981 ret = -ETIMEDOUT; in ath10k_remain_on_channel()
7985 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath10k_remain_on_channel()
7992 mutex_unlock(&ar->conf_mutex); in ath10k_remain_on_channel()
7999 struct ath10k *ar = hw->priv; in ath10k_cancel_remain_on_channel()
8001 mutex_lock(&ar->conf_mutex); in ath10k_cancel_remain_on_channel()
8003 spin_lock_bh(&ar->data_lock); in ath10k_cancel_remain_on_channel()
8004 ar->scan.roc_notify = false; in ath10k_cancel_remain_on_channel()
8005 spin_unlock_bh(&ar->data_lock); in ath10k_cancel_remain_on_channel()
8009 mutex_unlock(&ar->conf_mutex); in ath10k_cancel_remain_on_channel()
8011 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_cancel_remain_on_channel()
8017 * Both RTS and Fragmentation threshold are interface-specific
8018 * in ath10k, but device-specific in mac80211.
8023 struct ath10k *ar = hw->priv; in ath10k_set_rts_threshold()
8027 mutex_lock(&ar->conf_mutex); in ath10k_set_rts_threshold()
8028 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_set_rts_threshold()
8030 arvif->vdev_id, value); in ath10k_set_rts_threshold()
8035 arvif->vdev_id, ret); in ath10k_set_rts_threshold()
8039 mutex_unlock(&ar->conf_mutex); in ath10k_set_rts_threshold()
8056 return -EOPNOTSUPP; in ath10k_mac_op_set_frag_threshold()
8068 if (ar->state == ATH10K_STATE_WEDGED) in ath10k_mac_wait_tx_complete()
8071 time_left = wait_event_timeout(ar->htt.empty_tx_wq, ({ in ath10k_mac_wait_tx_complete()
8074 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_wait_tx_complete()
8075 empty = (ar->htt.num_pending_tx == 0); in ath10k_mac_wait_tx_complete()
8076 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_wait_tx_complete()
8078 skip = (ar->state == ATH10K_STATE_WEDGED) || in ath10k_mac_wait_tx_complete()
8080 &ar->dev_flags); in ath10k_mac_wait_tx_complete()
8086 ath10k_warn(ar, "failed to flush transmit queue (skip %i ar-state %i): %ld\n", in ath10k_mac_wait_tx_complete()
8087 skip, ar->state, time_left); in ath10k_mac_wait_tx_complete()
8093 struct ath10k *ar = hw->priv; in ath10k_flush()
8098 if (vif && vif->type == NL80211_IFTYPE_STATION) { in ath10k_flush()
8100 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_flush()
8101 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath10k_flush()
8102 ath10k_wmi_peer_flush(ar, arvif->vdev_id, in ath10k_flush()
8103 arvif->bssid, bitmap); in ath10k_flush()
8105 ath10k_htt_flush_tx(&ar->htt); in ath10k_flush()
8110 mutex_lock(&ar->conf_mutex); in ath10k_flush()
8112 mutex_unlock(&ar->conf_mutex); in ath10k_flush()
8116 * For now it is needed to reply to Probe Requests in IBSS mode.
8127 struct ath10k *ar = hw->priv; in ath10k_reconfig_complete()
8133 mutex_lock(&ar->conf_mutex); in ath10k_reconfig_complete()
8138 if (ar->state == ATH10K_STATE_RESTARTED) { in ath10k_reconfig_complete()
8140 ar->state = ATH10K_STATE_ON; in ath10k_reconfig_complete()
8141 ieee80211_wake_queues(ar->hw); in ath10k_reconfig_complete()
8142 clear_bit(ATH10K_FLAG_RESTARTING, &ar->dev_flags); in ath10k_reconfig_complete()
8143 if (ar->hw_params.hw_restart_disconnect) { in ath10k_reconfig_complete()
8144 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_reconfig_complete()
8145 if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath10k_reconfig_complete()
8146 ieee80211_hw_restart_disconnect(arvif->vif); in ath10k_reconfig_complete()
8151 mutex_unlock(&ar->conf_mutex); in ath10k_reconfig_complete()
8161 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_bss_chan_survey()
8163 if (!test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map) || in ath10k_mac_update_bss_chan_survey()
8164 (ar->rx_channel != channel)) in ath10k_mac_update_bss_chan_survey()
8167 if (ar->scan.state != ATH10K_SCAN_IDLE) { in ath10k_mac_update_bss_chan_survey()
8172 reinit_completion(&ar->bss_survey_done); in ath10k_mac_update_bss_chan_survey()
8180 ret = wait_for_completion_timeout(&ar->bss_survey_done, 3 * HZ); in ath10k_mac_update_bss_chan_survey()
8190 struct ath10k *ar = hw->priv; in ath10k_get_survey()
8192 struct survey_info *ar_survey = &ar->survey[idx]; in ath10k_get_survey()
8195 mutex_lock(&ar->conf_mutex); in ath10k_get_survey()
8197 sband = hw->wiphy->bands[NL80211_BAND_2GHZ]; in ath10k_get_survey()
8198 if (sband && idx >= sband->n_channels) { in ath10k_get_survey()
8199 idx -= sband->n_channels; in ath10k_get_survey()
8204 sband = hw->wiphy->bands[NL80211_BAND_5GHZ]; in ath10k_get_survey()
8206 if (!sband || idx >= sband->n_channels) { in ath10k_get_survey()
8207 ret = -ENOENT; in ath10k_get_survey()
8211 ath10k_mac_update_bss_chan_survey(ar, &sband->channels[idx]); in ath10k_get_survey()
8213 spin_lock_bh(&ar->data_lock); in ath10k_get_survey()
8215 spin_unlock_bh(&ar->data_lock); in ath10k_get_survey()
8217 survey->channel = &sband->channels[idx]; in ath10k_get_survey()
8219 if (ar->rx_channel == survey->channel) in ath10k_get_survey()
8220 survey->filled |= SURVEY_INFO_IN_USE; in ath10k_get_survey()
8223 mutex_unlock(&ar->conf_mutex); in ath10k_get_survey()
8233 struct ieee80211_supported_band *sband = &ar->mac.sbands[band]; in ath10k_mac_bitrate_mask_get_single_nss()
8234 u16 vht_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map); in ath10k_mac_bitrate_mask_get_single_nss()
8239 if (mask->control[band].legacy) in ath10k_mac_bitrate_mask_get_single_nss()
8242 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_nss()
8243 if (mask->control[band].ht_mcs[i] == 0) in ath10k_mac_bitrate_mask_get_single_nss()
8245 else if (mask->control[band].ht_mcs[i] == in ath10k_mac_bitrate_mask_get_single_nss()
8246 sband->ht_cap.mcs.rx_mask[i]) in ath10k_mac_bitrate_mask_get_single_nss()
8252 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_nss()
8253 if (mask->control[band].vht_mcs[i] == 0) in ath10k_mac_bitrate_mask_get_single_nss()
8255 else if (mask->control[band].vht_mcs[i] == in ath10k_mac_bitrate_mask_get_single_nss()
8268 if (BIT(fls(ht_nss_mask)) - 1 != ht_nss_mask) in ath10k_mac_bitrate_mask_get_single_nss()
8279 struct ath10k *ar = arvif->ar; in ath10k_mac_set_fixed_rate_params()
8283 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_set_fixed_rate_params()
8286 arvif->vdev_id, rate, nss, sgi); in ath10k_mac_set_fixed_rate_params()
8288 vdev_param = ar->wmi.vdev_param->fixed_rate; in ath10k_mac_set_fixed_rate_params()
8289 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, rate); in ath10k_mac_set_fixed_rate_params()
8296 vdev_param = ar->wmi.vdev_param->nss; in ath10k_mac_set_fixed_rate_params()
8297 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, nss); in ath10k_mac_set_fixed_rate_params()
8303 vdev_param = ar->wmi.vdev_param->sgi; in ath10k_mac_set_fixed_rate_params()
8304 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, sgi); in ath10k_mac_set_fixed_rate_params()
8310 vdev_param = ar->wmi.vdev_param->ldpc; in ath10k_mac_set_fixed_rate_params()
8311 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, ldpc); in ath10k_mac_set_fixed_rate_params()
8331 * ranges can be used: none, 0-7, 0-8 and 0-9. in ath10k_mac_can_set_bitrate_mask()
8334 vht_mcs = mask->control[band].vht_mcs[i]; in ath10k_mac_can_set_bitrate_mask()
8338 case BIT(8) - 1: in ath10k_mac_can_set_bitrate_mask()
8339 case BIT(9) - 1: in ath10k_mac_can_set_bitrate_mask()
8340 case BIT(10) - 1: in ath10k_mac_can_set_bitrate_mask()
8344 ath10k_warn(ar, "refusing bitrate mask with missing 0-7 VHT MCS rates\n"); in ath10k_mac_can_set_bitrate_mask()
8357 u8 rate = arvif->vht_pfr; in ath10k_mac_set_vht_bitrate_mask_fixup()
8360 if (!sta->deflink.vht_cap.vht_supported || arvif->vht_num_rates != 1) in ath10k_mac_set_vht_bitrate_mask_fixup()
8363 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_mac_set_vht_bitrate_mask_fixup()
8367 sta->addr, err); in ath10k_mac_set_vht_bitrate_mask_fixup()
8376 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_set_bitrate_mask_iter()
8377 struct ath10k *ar = arvif->ar; in ath10k_mac_set_bitrate_mask_iter()
8379 if (arsta->arvif != arvif) in ath10k_mac_set_bitrate_mask_iter()
8385 spin_lock_bh(&ar->data_lock); in ath10k_mac_set_bitrate_mask_iter()
8386 arsta->changed |= IEEE80211_RC_SUPP_RATES_CHANGED; in ath10k_mac_set_bitrate_mask_iter()
8387 spin_unlock_bh(&ar->data_lock); in ath10k_mac_set_bitrate_mask_iter()
8389 ieee80211_queue_work(ar->hw, &arsta->update_wk); in ath10k_mac_set_bitrate_mask_iter()
8396 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_clr_bitrate_mask_iter()
8397 struct ath10k *ar = arvif->ar; in ath10k_mac_clr_bitrate_mask_iter()
8401 if (arsta->arvif != arvif || !sta->deflink.vht_cap.vht_supported) in ath10k_mac_clr_bitrate_mask_iter()
8404 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_mac_clr_bitrate_mask_iter()
8409 sta->addr, err); in ath10k_mac_clr_bitrate_mask_iter()
8416 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_set_bitrate_mask()
8418 struct ath10k *ar = arvif->ar; in ath10k_mac_op_set_bitrate_mask()
8433 return -EPERM; in ath10k_mac_op_set_bitrate_mask()
8435 band = def.chan->band; in ath10k_mac_op_set_bitrate_mask()
8436 ht_mcs_mask = mask->control[band].ht_mcs; in ath10k_mac_op_set_bitrate_mask()
8437 vht_mcs_mask = mask->control[band].vht_mcs; in ath10k_mac_op_set_bitrate_mask()
8438 ldpc = !!(ar->ht_cap_info & WMI_HT_CAP_LDPC); in ath10k_mac_op_set_bitrate_mask()
8440 sgi = mask->control[band].gi; in ath10k_mac_op_set_bitrate_mask()
8442 return -EINVAL; in ath10k_mac_op_set_bitrate_mask()
8445 ar->normal_mode_fw.fw_file.fw_features); in ath10k_mac_op_set_bitrate_mask()
8447 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8448 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_mac_op_set_bitrate_mask()
8451 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8461 arvif->vdev_id, ret); in ath10k_mac_op_set_bitrate_mask()
8470 nss = min(ar->num_rf_chains, in ath10k_mac_op_set_bitrate_mask()
8479 return -EINVAL; in ath10k_mac_op_set_bitrate_mask()
8494 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8497 arvif->bitrate_mask = *mask; in ath10k_mac_op_set_bitrate_mask()
8498 arvif->vht_num_rates = vht_num_rates; in ath10k_mac_op_set_bitrate_mask()
8499 arvif->vht_pfr = vht_pfr; in ath10k_mac_op_set_bitrate_mask()
8500 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_mac_op_set_bitrate_mask()
8504 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8507 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8512 arvif->vdev_id, ret); in ath10k_mac_op_set_bitrate_mask()
8517 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8527 struct ieee80211_sta *sta = link_sta->sta; in ath10k_sta_rc_update()
8528 struct ath10k *ar = hw->priv; in ath10k_sta_rc_update()
8529 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_rc_update()
8530 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_rc_update()
8534 spin_lock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8536 peer = ath10k_peer_find(ar, arvif->vdev_id, sta->addr); in ath10k_sta_rc_update()
8538 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8540 sta->addr, arvif->vdev_id); in ath10k_sta_rc_update()
8546 sta->addr, changed, sta->deflink.bandwidth, in ath10k_sta_rc_update()
8547 sta->deflink.rx_nss, in ath10k_sta_rc_update()
8548 sta->deflink.smps_mode); in ath10k_sta_rc_update()
8553 switch (sta->deflink.bandwidth) { in ath10k_sta_rc_update()
8568 sta->deflink.bandwidth, sta->addr); in ath10k_sta_rc_update()
8573 arsta->bw = bw; in ath10k_sta_rc_update()
8577 arsta->nss = sta->deflink.rx_nss; in ath10k_sta_rc_update()
8582 switch (sta->deflink.smps_mode) { in ath10k_sta_rc_update()
8595 sta->deflink.smps_mode, sta->addr); in ath10k_sta_rc_update()
8600 arsta->smps = smps; in ath10k_sta_rc_update()
8603 arsta->changed |= changed; in ath10k_sta_rc_update()
8605 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8607 ieee80211_queue_work(hw, &arsta->update_wk); in ath10k_sta_rc_update()
8613 struct ath10k *ar = hw->priv; in ath10k_offset_tsf()
8614 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_offset_tsf()
8619 vdev_param = ar->wmi.vdev_param->dec_tsf; in ath10k_offset_tsf()
8620 offset = -tsf_offset; in ath10k_offset_tsf()
8622 vdev_param = ar->wmi.vdev_param->inc_tsf; in ath10k_offset_tsf()
8626 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_offset_tsf()
8629 if (ret && ret != -EOPNOTSUPP) in ath10k_offset_tsf()
8638 struct ath10k *ar = hw->priv; in ath10k_ampdu_action()
8639 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_ampdu_action()
8640 struct ieee80211_sta *sta = params->sta; in ath10k_ampdu_action()
8641 enum ieee80211_ampdu_mlme_action action = params->action; in ath10k_ampdu_action()
8642 u16 tid = params->tid; in ath10k_ampdu_action()
8645 arvif->vdev_id, sta->addr, tid, action); in ath10k_ampdu_action()
8662 return -EOPNOTSUPP; in ath10k_ampdu_action()
8665 return -EINVAL; in ath10k_ampdu_action()
8676 /* Both locks are required because ar->rx_channel is modified. This in ath10k_mac_update_rx_channel()
8679 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_rx_channel()
8680 lockdep_assert_held(&ar->data_lock); in ath10k_mac_update_rx_channel()
8686 * on a linked list now. Doing a lookup peer -> vif -> chanctx for each in ath10k_mac_update_rx_channel()
8687 * ppdu on Rx may reduce performance on low-end systems. It should be in ath10k_mac_update_rx_channel()
8691 * only for multi-channel cases. Single-channel cases will remain to in ath10k_mac_update_rx_channel()
8697 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_update_rx_channel()
8702 def = &vifs[0].new_ctx->def; in ath10k_mac_update_rx_channel()
8704 ar->rx_channel = def->chan; in ath10k_mac_update_rx_channel()
8706 (ctx && (ar->state == ATH10K_STATE_RESTARTED))) { in ath10k_mac_update_rx_channel()
8712 ar->rx_channel = ctx->def.chan; in ath10k_mac_update_rx_channel()
8714 ar->rx_channel = NULL; in ath10k_mac_update_rx_channel()
8728 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_vif_chan()
8733 if (ar->monitor_started) in ath10k_mac_update_vif_chan()
8737 arvif = (void *)vifs[i].vif->drv_priv; in ath10k_mac_update_vif_chan()
8740 "mac chanctx switch vdev_id %i freq %u->%u width %d->%d\n", in ath10k_mac_update_vif_chan()
8741 arvif->vdev_id, in ath10k_mac_update_vif_chan()
8742 vifs[i].old_ctx->def.chan->center_freq, in ath10k_mac_update_vif_chan()
8743 vifs[i].new_ctx->def.chan->center_freq, in ath10k_mac_update_vif_chan()
8744 vifs[i].old_ctx->def.width, in ath10k_mac_update_vif_chan()
8745 vifs[i].new_ctx->def.width); in ath10k_mac_update_vif_chan()
8747 if (WARN_ON(!arvif->is_started)) in ath10k_mac_update_vif_chan()
8750 if (WARN_ON(!arvif->is_up)) in ath10k_mac_update_vif_chan()
8753 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_update_vif_chan()
8756 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8765 spin_lock_bh(&ar->data_lock); in ath10k_mac_update_vif_chan()
8767 spin_unlock_bh(&ar->data_lock); in ath10k_mac_update_vif_chan()
8770 arvif = (void *)vifs[i].vif->drv_priv; in ath10k_mac_update_vif_chan()
8772 if (WARN_ON(!arvif->is_started)) in ath10k_mac_update_vif_chan()
8775 if (WARN_ON(!arvif->is_up)) in ath10k_mac_update_vif_chan()
8788 ret = ath10k_vdev_restart(arvif, &vifs[i].new_ctx->def); in ath10k_mac_update_vif_chan()
8791 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8795 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_mac_update_vif_chan()
8796 arvif->bssid); in ath10k_mac_update_vif_chan()
8799 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8811 struct ath10k *ar = hw->priv; in ath10k_mac_op_add_chanctx()
8815 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath10k_mac_op_add_chanctx()
8817 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_add_chanctx()
8819 spin_lock_bh(&ar->data_lock); in ath10k_mac_op_add_chanctx()
8821 spin_unlock_bh(&ar->data_lock); in ath10k_mac_op_add_chanctx()
8826 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_add_chanctx()
8835 struct ath10k *ar = hw->priv; in ath10k_mac_op_remove_chanctx()
8839 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath10k_mac_op_remove_chanctx()
8841 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_remove_chanctx()
8843 spin_lock_bh(&ar->data_lock); in ath10k_mac_op_remove_chanctx()
8845 spin_unlock_bh(&ar->data_lock); in ath10k_mac_op_remove_chanctx()
8850 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_remove_chanctx()
8866 if (rcu_access_pointer(vif->bss_conf.chanctx_conf) != arg->ctx) in ath10k_mac_change_chanctx_cnt_iter()
8869 arg->n_vifs++; in ath10k_mac_change_chanctx_cnt_iter()
8879 ctx = rcu_access_pointer(vif->bss_conf.chanctx_conf); in ath10k_mac_change_chanctx_fill_iter()
8880 if (ctx != arg->ctx) in ath10k_mac_change_chanctx_fill_iter()
8883 if (WARN_ON(arg->next_vif == arg->n_vifs)) in ath10k_mac_change_chanctx_fill_iter()
8886 arg->vifs[arg->next_vif].vif = vif; in ath10k_mac_change_chanctx_fill_iter()
8887 arg->vifs[arg->next_vif].old_ctx = ctx; in ath10k_mac_change_chanctx_fill_iter()
8888 arg->vifs[arg->next_vif].new_ctx = ctx; in ath10k_mac_change_chanctx_fill_iter()
8889 arg->next_vif++; in ath10k_mac_change_chanctx_fill_iter()
8897 struct ath10k *ar = hw->priv; in ath10k_mac_op_change_chanctx()
8900 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_change_chanctx()
8904 ctx->def.chan->center_freq, ctx->def.width, ctx, changed); in ath10k_mac_op_change_chanctx()
8941 * definitions per vdev internally and there's no host-side channel in ath10k_mac_op_change_chanctx()
8946 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_change_chanctx()
8955 struct ath10k *ar = hw->priv; in ath10k_mac_op_assign_vif_chanctx()
8956 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_assign_vif_chanctx()
8959 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8963 ctx, arvif->vdev_id); in ath10k_mac_op_assign_vif_chanctx()
8965 if (WARN_ON(arvif->is_started)) { in ath10k_mac_op_assign_vif_chanctx()
8966 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8967 return -EBUSY; in ath10k_mac_op_assign_vif_chanctx()
8970 ret = ath10k_vdev_start(arvif, &ctx->def); in ath10k_mac_op_assign_vif_chanctx()
8973 arvif->vdev_id, vif->addr, in ath10k_mac_op_assign_vif_chanctx()
8974 ctx->def.chan->center_freq, ret); in ath10k_mac_op_assign_vif_chanctx()
8978 arvif->is_started = true; in ath10k_mac_op_assign_vif_chanctx()
8983 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
8987 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_mac_op_assign_vif_chanctx()
8988 ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, 0, vif->addr); in ath10k_mac_op_assign_vif_chanctx()
8991 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
8995 arvif->is_up = true; in ath10k_mac_op_assign_vif_chanctx()
9002 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
9006 ar->hw_params.tx_stats_over_pktlog) { in ath10k_mac_op_assign_vif_chanctx()
9007 ar->pktlog_filter |= ATH10K_PKTLOG_PEER_STATS; in ath10k_mac_op_assign_vif_chanctx()
9009 ar->pktlog_filter); in ath10k_mac_op_assign_vif_chanctx()
9016 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
9021 arvif->is_started = false; in ath10k_mac_op_assign_vif_chanctx()
9025 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
9035 struct ath10k *ar = hw->priv; in ath10k_mac_op_unassign_vif_chanctx()
9036 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_unassign_vif_chanctx()
9039 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_unassign_vif_chanctx()
9043 ctx, arvif->vdev_id); in ath10k_mac_op_unassign_vif_chanctx()
9045 WARN_ON(!arvif->is_started); in ath10k_mac_op_unassign_vif_chanctx()
9047 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_mac_op_unassign_vif_chanctx()
9048 WARN_ON(!arvif->is_up); in ath10k_mac_op_unassign_vif_chanctx()
9050 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_op_unassign_vif_chanctx()
9053 arvif->vdev_id, ret); in ath10k_mac_op_unassign_vif_chanctx()
9055 arvif->is_up = false; in ath10k_mac_op_unassign_vif_chanctx()
9061 arvif->vdev_id, ret); in ath10k_mac_op_unassign_vif_chanctx()
9063 arvif->is_started = false; in ath10k_mac_op_unassign_vif_chanctx()
9065 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_unassign_vif_chanctx()
9072 enum ieee80211_chanctx_switch_mode mode) in ath10k_mac_op_switch_vif_chanctx() argument
9074 struct ath10k *ar = hw->priv; in ath10k_mac_op_switch_vif_chanctx()
9076 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_switch_vif_chanctx()
9079 "mac chanctx switch n_vifs %d mode %d\n", in ath10k_mac_op_switch_vif_chanctx()
9080 n_vifs, mode); in ath10k_mac_op_switch_vif_chanctx()
9083 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_switch_vif_chanctx()
9094 ar = hw->priv; in ath10k_mac_op_sta_pre_rcu_remove()
9096 list_for_each_entry(peer, &ar->peers, list) in ath10k_mac_op_sta_pre_rcu_remove()
9097 if (peer->sta == sta) in ath10k_mac_op_sta_pre_rcu_remove()
9098 peer->removed = true; in ath10k_mac_op_sta_pre_rcu_remove()
9175 index = mcs - len_nss1; in ath10k_mac_get_rate_flags_ht()
9226 enum ath10k_phy_mode mode, u8 nss, u8 mcs, in ath10k_mac_get_rate_flags() argument
9229 if (mode == ATH10K_PHY_MODE_HT) { in ath10k_mac_get_rate_flags()
9232 } else if (mode == ATH10K_PHY_MODE_VHT) { in ath10k_mac_get_rate_flags()
9241 enum ath10k_phy_mode mode = ATH10K_PHY_MODE_LEGACY; in ath10k_mac_parse_bitrate() local
9251 mode = ATH10K_PHY_MODE_HT; in ath10k_mac_parse_bitrate()
9253 mode = ATH10K_PHY_MODE_VHT; in ath10k_mac_parse_bitrate()
9255 ath10k_mac_get_rate_flags(ar, bitrate_kbps / 100, mode, nss, mcs, &flags, &bw); in ath10k_mac_parse_bitrate()
9258 "mac parse bitrate preamble %d mode %d nss %d mcs %d flags %x bw %d\n", in ath10k_mac_parse_bitrate()
9259 preamble, mode, nss, mcs, flags, bw); in ath10k_mac_parse_bitrate()
9261 rate->flags = flags; in ath10k_mac_parse_bitrate()
9262 rate->bw = bw; in ath10k_mac_parse_bitrate()
9263 rate->legacy = bitrate_kbps / 100; in ath10k_mac_parse_bitrate()
9264 rate->nss = nss; in ath10k_mac_parse_bitrate()
9265 rate->mcs = mcs; in ath10k_mac_parse_bitrate()
9272 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_sta_get_peer_stats_info()
9277 if (!(ar->hw_params.supports_peer_stats_info && in ath10k_mac_sta_get_peer_stats_info()
9278 arsta->arvif->vdev_type == WMI_VDEV_TYPE_STA)) in ath10k_mac_sta_get_peer_stats_info()
9281 spin_lock_bh(&ar->data_lock); in ath10k_mac_sta_get_peer_stats_info()
9282 peer = ath10k_peer_find(ar, arsta->arvif->vdev_id, sta->addr); in ath10k_mac_sta_get_peer_stats_info()
9283 spin_unlock_bh(&ar->data_lock); in ath10k_mac_sta_get_peer_stats_info()
9287 reinit_completion(&ar->peer_stats_info_complete); in ath10k_mac_sta_get_peer_stats_info()
9290 arsta->arvif->vdev_id, in ath10k_mac_sta_get_peer_stats_info()
9292 arsta->arvif->bssid, in ath10k_mac_sta_get_peer_stats_info()
9294 if (ret && ret != -EOPNOTSUPP) { in ath10k_mac_sta_get_peer_stats_info()
9299 time_left = wait_for_completion_timeout(&ar->peer_stats_info_complete, 3 * HZ); in ath10k_mac_sta_get_peer_stats_info()
9305 if (arsta->rx_rate_code != 0 && arsta->rx_bitrate_kbps != 0) { in ath10k_mac_sta_get_peer_stats_info()
9306 ath10k_mac_parse_bitrate(ar, arsta->rx_rate_code, in ath10k_mac_sta_get_peer_stats_info()
9307 arsta->rx_bitrate_kbps, in ath10k_mac_sta_get_peer_stats_info()
9308 &sinfo->rxrate); in ath10k_mac_sta_get_peer_stats_info()
9310 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); in ath10k_mac_sta_get_peer_stats_info()
9311 arsta->rx_rate_code = 0; in ath10k_mac_sta_get_peer_stats_info()
9312 arsta->rx_bitrate_kbps = 0; in ath10k_mac_sta_get_peer_stats_info()
9315 if (arsta->tx_rate_code != 0 && arsta->tx_bitrate_kbps != 0) { in ath10k_mac_sta_get_peer_stats_info()
9316 ath10k_mac_parse_bitrate(ar, arsta->tx_rate_code, in ath10k_mac_sta_get_peer_stats_info()
9317 arsta->tx_bitrate_kbps, in ath10k_mac_sta_get_peer_stats_info()
9318 &sinfo->txrate); in ath10k_mac_sta_get_peer_stats_info()
9320 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in ath10k_mac_sta_get_peer_stats_info()
9321 arsta->tx_rate_code = 0; in ath10k_mac_sta_get_peer_stats_info()
9322 arsta->tx_bitrate_kbps = 0; in ath10k_mac_sta_get_peer_stats_info()
9331 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_statistics()
9332 struct ath10k *ar = arsta->arvif->ar; in ath10k_sta_statistics()
9337 mutex_lock(&ar->conf_mutex); in ath10k_sta_statistics()
9339 mutex_unlock(&ar->conf_mutex); in ath10k_sta_statistics()
9341 sinfo->rx_duration = arsta->rx_duration; in ath10k_sta_statistics()
9342 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION); in ath10k_sta_statistics()
9344 if (arsta->txrate.legacy || arsta->txrate.nss) { in ath10k_sta_statistics()
9345 if (arsta->txrate.legacy) { in ath10k_sta_statistics()
9346 sinfo->txrate.legacy = arsta->txrate.legacy; in ath10k_sta_statistics()
9348 sinfo->txrate.mcs = arsta->txrate.mcs; in ath10k_sta_statistics()
9349 sinfo->txrate.nss = arsta->txrate.nss; in ath10k_sta_statistics()
9350 sinfo->txrate.bw = arsta->txrate.bw; in ath10k_sta_statistics()
9352 sinfo->txrate.flags = arsta->txrate.flags; in ath10k_sta_statistics()
9353 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in ath10k_sta_statistics()
9356 if (ar->htt.disable_tx_comp) { in ath10k_sta_statistics()
9357 sinfo->tx_failed = arsta->tx_failed; in ath10k_sta_statistics()
9358 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); in ath10k_sta_statistics()
9361 sinfo->tx_retries = arsta->tx_retries; in ath10k_sta_statistics()
9362 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES); in ath10k_sta_statistics()
9372 struct ath10k *ar = hw->priv; in ath10k_mac_op_set_tid_config()
9373 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_set_tid_config()
9378 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_tid_config()
9379 arg.vdev_id = arvif->vdev_id; in ath10k_mac_op_set_tid_config()
9381 arvif->tids_rst = 0; in ath10k_mac_op_set_tid_config()
9382 memset(arvif->tid_conf_changed, 0, sizeof(arvif->tid_conf_changed)); in ath10k_mac_op_set_tid_config()
9384 for (i = 0; i < tid_config->n_tid_conf; i++) { in ath10k_mac_op_set_tid_config()
9386 &tid_config->tid_conf[i], in ath10k_mac_op_set_tid_config()
9397 arvif->tids_rst = 0; in ath10k_mac_op_set_tid_config()
9405 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_tid_config()
9414 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_reset_tid_config()
9416 struct ath10k *ar = hw->priv; in ath10k_mac_op_reset_tid_config()
9419 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_reset_tid_config()
9422 arvif->tids_rst = 0; in ath10k_mac_op_reset_tid_config()
9427 arvif->tids_rst = tids; in ath10k_mac_op_reset_tid_config()
9434 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_reset_tid_config()
9581 ar = hw->priv; in ath10k_mac_create()
9582 ar->hw = hw; in ath10k_mac_create()
9583 ar->ops = ops; in ath10k_mac_create()
9590 struct ieee80211_ops *ops = ar->ops; in ath10k_mac_destroy()
9592 ieee80211_free_hw(ar->hw); in ath10k_mac_destroy()
9714 /* FIXME: This is not thoroughly tested. These combinations may over- or
9810 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_get_arvif_iter()
9812 if (arvif->vdev_id == arvif_iter->vdev_id) in ath10k_get_arvif_iter()
9813 arvif_iter->arvif = arvif; in ath10k_get_arvif_iter()
9823 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_get_arvif()
9845 if (wrdd->type != ACPI_TYPE_PACKAGE || in ath10k_mac_wrdd_get_mcc()
9846 wrdd->package.count < 2 || in ath10k_mac_wrdd_get_mcc()
9847 wrdd->package.elements[0].type != ACPI_TYPE_INTEGER || in ath10k_mac_wrdd_get_mcc()
9848 wrdd->package.elements[0].integer.value != 0) { in ath10k_mac_wrdd_get_mcc()
9853 for (i = 1; i < wrdd->package.count; ++i) { in ath10k_mac_wrdd_get_mcc()
9854 mcc_pkg = &wrdd->package.elements[i]; in ath10k_mac_wrdd_get_mcc()
9856 if (mcc_pkg->type != ACPI_TYPE_PACKAGE) in ath10k_mac_wrdd_get_mcc()
9858 if (mcc_pkg->package.count < 2) in ath10k_mac_wrdd_get_mcc()
9860 if (mcc_pkg->package.elements[0].type != ACPI_TYPE_INTEGER || in ath10k_mac_wrdd_get_mcc()
9861 mcc_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) in ath10k_mac_wrdd_get_mcc()
9864 domain_type = &mcc_pkg->package.elements[0]; in ath10k_mac_wrdd_get_mcc()
9865 if (domain_type->integer.value != WRDD_WIFI) in ath10k_mac_wrdd_get_mcc()
9868 mcc_value = &mcc_pkg->package.elements[1]; in ath10k_mac_wrdd_get_mcc()
9869 return mcc_value->integer.value; in ath10k_mac_wrdd_get_mcc()
9883 root_handle = ACPI_HANDLE(ar->dev); in ath10k_mac_get_wrdd_regulatory()
9885 return -EOPNOTSUPP; in ath10k_mac_get_wrdd_regulatory()
9891 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9898 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9904 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9911 "regulatory hint from WRDD (alpha2-code): %s\n", alpha2); in ath10k_mac_get_wrdd_regulatory()
9915 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9930 rd = ar->hw_eeprom_rd; in ath10k_mac_init_rd()
9933 ar->ath_common.regulatory.current_rd = rd; in ath10k_mac_init_rd()
9954 /* Only QCA99x0 and QCA4019 variants support GCMP-128, GCMP-256 in ath10k_mac_register()
9955 * and CCMP-256 in hardware. in ath10k_mac_register()
9965 if (!is_valid_ether_addr(ar->mac_addr)) { in ath10k_mac_register()
9967 eth_random_addr(ar->mac_addr); in ath10k_mac_register()
9969 SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr); in ath10k_mac_register()
9971 SET_IEEE80211_DEV(ar->hw, ar->dev); in ath10k_mac_register()
9977 if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) { in ath10k_mac_register()
9982 ret = -ENOMEM; in ath10k_mac_register()
9986 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath10k_mac_register()
9987 band->n_channels = ARRAY_SIZE(ath10k_2ghz_channels); in ath10k_mac_register()
9988 band->channels = channels; in ath10k_mac_register()
9990 if (ar->hw_params.cck_rate_map_rev2) { in ath10k_mac_register()
9991 band->n_bitrates = ath10k_g_rates_rev2_size; in ath10k_mac_register()
9992 band->bitrates = ath10k_g_rates_rev2; in ath10k_mac_register()
9994 band->n_bitrates = ath10k_g_rates_size; in ath10k_mac_register()
9995 band->bitrates = ath10k_g_rates; in ath10k_mac_register()
9998 ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = band; in ath10k_mac_register()
10001 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) { in ath10k_mac_register()
10006 ret = -ENOMEM; in ath10k_mac_register()
10010 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath10k_mac_register()
10011 band->n_channels = ARRAY_SIZE(ath10k_5ghz_channels); in ath10k_mac_register()
10012 band->channels = channels; in ath10k_mac_register()
10013 band->n_bitrates = ath10k_a_rates_size; in ath10k_mac_register()
10014 band->bitrates = ath10k_a_rates; in ath10k_mac_register()
10015 ar->hw->wiphy->bands[NL80211_BAND_5GHZ] = band; in ath10k_mac_register()
10018 wiphy_read_of_freq_limits(ar->hw->wiphy); in ath10k_mac_register()
10021 ar->hw->wiphy->interface_modes = in ath10k_mac_register()
10026 ar->hw->wiphy->available_antennas_rx = ar->cfg_rx_chainmask; in ath10k_mac_register()
10027 ar->hw->wiphy->available_antennas_tx = ar->cfg_tx_chainmask; in ath10k_mac_register()
10029 if (!test_bit(ATH10K_FW_FEATURE_NO_P2P, ar->normal_mode_fw.fw_file.fw_features)) in ath10k_mac_register()
10030 ar->hw->wiphy->interface_modes |= in ath10k_mac_register()
10035 ieee80211_hw_set(ar->hw, SIGNAL_DBM); in ath10k_mac_register()
10038 ar->running_fw->fw_file.fw_features)) { in ath10k_mac_register()
10039 ieee80211_hw_set(ar->hw, SUPPORTS_PS); in ath10k_mac_register()
10040 ieee80211_hw_set(ar->hw, SUPPORTS_DYNAMIC_PS); in ath10k_mac_register()
10043 ieee80211_hw_set(ar->hw, MFP_CAPABLE); in ath10k_mac_register()
10044 ieee80211_hw_set(ar->hw, REPORTS_TX_ACK_STATUS); in ath10k_mac_register()
10045 ieee80211_hw_set(ar->hw, HAS_RATE_CONTROL); in ath10k_mac_register()
10046 ieee80211_hw_set(ar->hw, AP_LINK_PS); in ath10k_mac_register()
10047 ieee80211_hw_set(ar->hw, SPECTRUM_MGMT); in ath10k_mac_register()
10048 ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT); in ath10k_mac_register()
10049 ieee80211_hw_set(ar->hw, CONNECTION_MONITOR); in ath10k_mac_register()
10050 ieee80211_hw_set(ar->hw, SUPPORTS_PER_STA_GTK); in ath10k_mac_register()
10051 ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF); in ath10k_mac_register()
10052 ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); in ath10k_mac_register()
10053 ieee80211_hw_set(ar->hw, QUEUE_CONTROL); in ath10k_mac_register()
10054 ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); in ath10k_mac_register()
10055 ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); in ath10k_mac_register()
10057 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) in ath10k_mac_register()
10058 ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); in ath10k_mac_register()
10060 ar->hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS; in ath10k_mac_register()
10061 ar->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in ath10k_mac_register()
10063 if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) in ath10k_mac_register()
10064 ar->hw->wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS; in ath10k_mac_register()
10066 if (ar->ht_cap_info & WMI_HT_CAP_ENABLED) { in ath10k_mac_register()
10067 ieee80211_hw_set(ar->hw, AMPDU_AGGREGATION); in ath10k_mac_register()
10068 ieee80211_hw_set(ar->hw, TX_AMPDU_SETUP_IN_HW); in ath10k_mac_register()
10071 ar->hw->wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID; in ath10k_mac_register()
10072 ar->hw->wiphy->max_scan_ie_len = WLAN_SCAN_PARAMS_MAX_IE_LEN; in ath10k_mac_register()
10074 if (test_bit(WMI_SERVICE_NLO, ar->wmi.svc_map)) { in ath10k_mac_register()
10075 ar->hw->wiphy->max_sched_scan_ssids = WMI_PNO_MAX_SUPP_NETWORKS; in ath10k_mac_register()
10076 ar->hw->wiphy->max_match_sets = WMI_PNO_MAX_SUPP_NETWORKS; in ath10k_mac_register()
10077 ar->hw->wiphy->max_sched_scan_ie_len = WMI_PNO_MAX_IE_LENGTH; in ath10k_mac_register()
10078 ar->hw->wiphy->max_sched_scan_plans = WMI_PNO_MAX_SCHED_SCAN_PLANS; in ath10k_mac_register()
10079 ar->hw->wiphy->max_sched_scan_plan_interval = in ath10k_mac_register()
10081 ar->hw->wiphy->max_sched_scan_plan_iterations = in ath10k_mac_register()
10083 ar->hw->wiphy->features |= NL80211_FEATURE_ND_RANDOM_MAC_ADDR; in ath10k_mac_register()
10086 ar->hw->vif_data_size = sizeof(struct ath10k_vif); in ath10k_mac_register()
10087 ar->hw->sta_data_size = sizeof(struct ath10k_sta); in ath10k_mac_register()
10088 ar->hw->txq_data_size = sizeof(struct ath10k_txq); in ath10k_mac_register()
10090 ar->hw->max_listen_interval = ATH10K_MAX_HW_LISTEN_INTERVAL; in ath10k_mac_register()
10092 if (test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) { in ath10k_mac_register()
10093 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD; in ath10k_mac_register()
10099 ar->hw->wiphy->probe_resp_offload |= in ath10k_mac_register()
10105 if (test_bit(WMI_SERVICE_TDLS, ar->wmi.svc_map) || in ath10k_mac_register()
10106 test_bit(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY, ar->wmi.svc_map)) { in ath10k_mac_register()
10107 ar->hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; in ath10k_mac_register()
10108 if (test_bit(WMI_SERVICE_TDLS_WIDER_BANDWIDTH, ar->wmi.svc_map)) in ath10k_mac_register()
10109 ieee80211_hw_set(ar->hw, TDLS_WIDER_BW); in ath10k_mac_register()
10112 if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map)) in ath10k_mac_register()
10113 ieee80211_hw_set(ar->hw, SUPPORTS_TDLS_BUFFER_STA); in ath10k_mac_register()
10116 if (ar->wmi.vdev_param->tx_encap_type != in ath10k_mac_register()
10118 ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD); in ath10k_mac_register()
10121 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; in ath10k_mac_register()
10122 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; in ath10k_mac_register()
10123 ar->hw->wiphy->max_remain_on_channel_duration = 5000; in ath10k_mac_register()
10125 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; in ath10k_mac_register()
10126 ar->hw->wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE | in ath10k_mac_register()
10129 ar->hw->wiphy->max_ap_assoc_sta = ar->max_num_stations; in ath10k_mac_register()
10137 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS); in ath10k_mac_register()
10138 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10140 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL); in ath10k_mac_register()
10142 if (ar->hw_params.mcast_frame_registration) in ath10k_mac_register()
10143 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10146 if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map) || in ath10k_mac_register()
10147 test_bit(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ar->wmi.svc_map)) in ath10k_mac_register()
10148 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10152 test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map)) in ath10k_mac_register()
10153 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10156 if (test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) in ath10k_mac_register()
10157 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10160 if (test_bit(WMI_SERVICE_TX_PWR_PER_PEER, ar->wmi.svc_map)) in ath10k_mac_register()
10161 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10164 if (test_bit(WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT, ar->wmi.svc_map)) { in ath10k_mac_register()
10165 ar->hw->wiphy->tid_config_support.vif |= in ath10k_mac_register()
10174 ar->wmi.svc_map)) { in ath10k_mac_register()
10175 ar->hw->wiphy->tid_config_support.vif |= in ath10k_mac_register()
10179 ar->hw->wiphy->tid_config_support.peer = in ath10k_mac_register()
10180 ar->hw->wiphy->tid_config_support.vif; in ath10k_mac_register()
10181 ar->hw->wiphy->max_data_retry_count = ATH10K_MAX_RETRY_COUNT; in ath10k_mac_register()
10183 ar->ops->set_tid_config = NULL; in ath10k_mac_register()
10189 ar->hw->queues = IEEE80211_MAX_QUEUES; in ath10k_mac_register()
10195 ar->hw->offchannel_tx_hw_queue = IEEE80211_MAX_QUEUES - 1; in ath10k_mac_register()
10197 switch (ar->running_fw->fw_file.wmi_op_version) { in ath10k_mac_register()
10199 ar->hw->wiphy->iface_combinations = ath10k_if_comb; in ath10k_mac_register()
10200 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10202 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); in ath10k_mac_register()
10205 if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar->wmi.svc_map)) { in ath10k_mac_register()
10206 ar->hw->wiphy->iface_combinations = in ath10k_mac_register()
10208 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10211 ar->hw->wiphy->iface_combinations = ath10k_tlv_if_comb; in ath10k_mac_register()
10212 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10215 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); in ath10k_mac_register()
10220 ar->hw->wiphy->iface_combinations = ath10k_10x_if_comb; in ath10k_mac_register()
10221 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10225 ar->hw->wiphy->iface_combinations = ath10k_10_4_if_comb; in ath10k_mac_register()
10226 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10229 ar->wmi.svc_map)) { in ath10k_mac_register()
10230 ar->hw->wiphy->iface_combinations = in ath10k_mac_register()
10232 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10239 ret = -EINVAL; in ath10k_mac_register()
10243 if (ar->hw_params.dynamic_sar_support) in ath10k_mac_register()
10244 ar->hw->wiphy->sar_capa = &ath10k_sar_capa; in ath10k_mac_register()
10246 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) in ath10k_mac_register()
10247 ar->hw->netdev_features = NETIF_F_HW_CSUM; in ath10k_mac_register()
10251 ar->ath_common.debug_mask = ATH_DBG_DFS; in ath10k_mac_register()
10252 ar->dfs_detector = dfs_pattern_detector_init(&ar->ath_common, in ath10k_mac_register()
10255 if (!ar->dfs_detector) in ath10k_mac_register()
10266 if (!ar->hw_params.hw_ops->set_coverage_class) in ath10k_mac_register()
10267 ar->ops->set_coverage_class = NULL; in ath10k_mac_register()
10269 ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy, in ath10k_mac_register()
10276 if (test_bit(WMI_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi.svc_map)) { in ath10k_mac_register()
10277 ar->hw->wiphy->features |= in ath10k_mac_register()
10281 ar->hw->wiphy->cipher_suites = cipher_suites; in ath10k_mac_register()
10283 /* QCA988x and QCA6174 family chips do not support CCMP-256, GCMP-128 in ath10k_mac_register()
10284 * and GCMP-256 ciphers in hardware. Fetch number of ciphers supported in ath10k_mac_register()
10287 if (!ar->hw_params.n_cipher_suites || in ath10k_mac_register()
10288 ar->hw_params.n_cipher_suites > ARRAY_SIZE(cipher_suites)) { in ath10k_mac_register()
10290 ar->hw_params.n_cipher_suites); in ath10k_mac_register()
10291 ar->hw_params.n_cipher_suites = 8; in ath10k_mac_register()
10293 ar->hw->wiphy->n_cipher_suites = ar->hw_params.n_cipher_suites; in ath10k_mac_register()
10295 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); in ath10k_mac_register()
10297 ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; in ath10k_mac_register()
10299 ret = ieee80211_register_hw(ar->hw); in ath10k_mac_register()
10305 if (test_bit(WMI_SERVICE_PER_PACKET_SW_ENCRYPT, ar->wmi.svc_map)) { in ath10k_mac_register()
10306 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); in ath10k_mac_register()
10307 ar->hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN); in ath10k_mac_register()
10310 if (!ath_is_world_regd(&ar->ath_common.reg_world_copy) && in ath10k_mac_register()
10311 !ath_is_world_regd(&ar->ath_common.regulatory)) { in ath10k_mac_register()
10312 ret = regulatory_hint(ar->hw->wiphy, in ath10k_mac_register()
10313 ar->ath_common.regulatory.alpha2); in ath10k_mac_register()
10321 ieee80211_unregister_hw(ar->hw); in ath10k_mac_register()
10324 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) in ath10k_mac_register()
10325 ar->dfs_detector->exit(ar->dfs_detector); in ath10k_mac_register()
10328 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath10k_mac_register()
10329 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in ath10k_mac_register()
10331 SET_IEEE80211_DEV(ar->hw, NULL); in ath10k_mac_register()
10337 ieee80211_unregister_hw(ar->hw); in ath10k_mac_unregister()
10339 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) in ath10k_mac_unregister()
10340 ar->dfs_detector->exit(ar->dfs_detector); in ath10k_mac_unregister()
10342 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath10k_mac_unregister()
10343 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in ath10k_mac_unregister()
10345 SET_IEEE80211_DEV(ar->hw, NULL); in ath10k_mac_unregister()