Lines Matching +full:max +full:- +full:bitrate
1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2005-2011 Atheros Communications Inc.
4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
5 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
24 #include "wmi-tlv.h"
25 #include "wmi-ops.h"
33 { .bitrate = 10,
35 { .bitrate = 20,
39 { .bitrate = 55,
43 { .bitrate = 110,
48 { .bitrate = 60, .hw_value = ATH10K_HW_RATE_OFDM_6M },
49 { .bitrate = 90, .hw_value = ATH10K_HW_RATE_OFDM_9M },
50 { .bitrate = 120, .hw_value = ATH10K_HW_RATE_OFDM_12M },
51 { .bitrate = 180, .hw_value = ATH10K_HW_RATE_OFDM_18M },
52 { .bitrate = 240, .hw_value = ATH10K_HW_RATE_OFDM_24M },
53 { .bitrate = 360, .hw_value = ATH10K_HW_RATE_OFDM_36M },
54 { .bitrate = 480, .hw_value = ATH10K_HW_RATE_OFDM_48M },
55 { .bitrate = 540, .hw_value = ATH10K_HW_RATE_OFDM_54M },
59 { .bitrate = 10,
61 { .bitrate = 20,
65 { .bitrate = 55,
69 { .bitrate = 110,
74 { .bitrate = 60, .hw_value = ATH10K_HW_RATE_OFDM_6M },
75 { .bitrate = 90, .hw_value = ATH10K_HW_RATE_OFDM_9M },
76 { .bitrate = 120, .hw_value = ATH10K_HW_RATE_OFDM_12M },
77 { .bitrate = 180, .hw_value = ATH10K_HW_RATE_OFDM_18M },
78 { .bitrate = 240, .hw_value = ATH10K_HW_RATE_OFDM_24M },
79 { .bitrate = 360, .hw_value = ATH10K_HW_RATE_OFDM_36M },
80 { .bitrate = 480, .hw_value = ATH10K_HW_RATE_OFDM_48M },
81 { .bitrate = 540, .hw_value = ATH10K_HW_RATE_OFDM_54M },
98 #define ath10k_a_rates_size (ARRAY_SIZE(ath10k_rates) - \
108 static bool ath10k_mac_bitrate_is_cck(int bitrate) in ath10k_mac_bitrate_is_cck() argument
110 switch (bitrate) { in ath10k_mac_bitrate_is_cck()
121 static u8 ath10k_mac_bitrate_to_rate(int bitrate) in ath10k_mac_bitrate_to_rate() argument
123 return DIV_ROUND_UP(bitrate, 5) | in ath10k_mac_bitrate_to_rate()
124 (ath10k_mac_bitrate_is_cck(bitrate) ? BIT(7) : 0); in ath10k_mac_bitrate_to_rate()
133 for (i = 0; i < sband->n_bitrates; i++) { in ath10k_mac_hw_rate_to_idx()
134 rate = &sband->bitrates[i]; in ath10k_mac_hw_rate_to_idx()
136 if (ath10k_mac_bitrate_is_cck(rate->bitrate) != cck) in ath10k_mac_hw_rate_to_idx()
139 if (rate->hw_value == hw_rate) in ath10k_mac_hw_rate_to_idx()
141 else if (rate->flags & IEEE80211_RATE_SHORT_PREAMBLE && in ath10k_mac_hw_rate_to_idx()
142 rate->hw_value_short == hw_rate) in ath10k_mac_hw_rate_to_idx()
150 u32 bitrate) in ath10k_mac_bitrate_to_idx() argument
154 for (i = 0; i < sband->n_bitrates; i++) in ath10k_mac_bitrate_to_idx()
155 if (sband->bitrates[i].bitrate == bitrate) in ath10k_mac_bitrate_to_idx()
161 static int ath10k_mac_get_rate_hw_value(int bitrate) in ath10k_mac_get_rate_hw_value() argument
166 if (ath10k_mac_bitrate_is_cck(bitrate)) in ath10k_mac_get_rate_hw_value()
170 if (ath10k_rates[i].bitrate == bitrate) in ath10k_mac_get_rate_hw_value()
174 return -EINVAL; in ath10k_mac_get_rate_hw_value()
180 case IEEE80211_VHT_MCS_SUPPORT_0_7: return BIT(8) - 1; in ath10k_mac_get_max_vht_mcs_map()
181 case IEEE80211_VHT_MCS_SUPPORT_0_8: return BIT(9) - 1; in ath10k_mac_get_max_vht_mcs_map()
182 case IEEE80211_VHT_MCS_SUPPORT_0_9: return BIT(10) - 1; in ath10k_mac_get_max_vht_mcs_map()
192 for (nss = IEEE80211_HT_MCS_MASK_LEN - 1; nss >= 0; nss--) in ath10k_mac_max_ht_nss()
204 for (nss = NL80211_VHT_NSS_MAX - 1; nss >= 0; nss--) in ath10k_mac_max_vht_nss()
216 if (test_bit(WMI_SERVICE_TX_MODE_DYNAMIC, ar->wmi.svc_map)) in ath10k_mac_ext_resource_config()
223 if (ret && ret != -EOPNOTSUPP) { in ath10k_mac_ext_resource_config()
240 struct ath10k *ar = arvif->ar; in ath10k_send_key()
242 .vdev_id = arvif->vdev_id, in ath10k_send_key()
243 .key_idx = key->keyidx, in ath10k_send_key()
244 .key_len = key->keylen, in ath10k_send_key()
245 .key_data = key->key, in ath10k_send_key()
250 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_send_key()
252 switch (key->cipher) { in ath10k_send_key()
254 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_CCM]; in ath10k_send_key()
255 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; in ath10k_send_key()
258 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_TKIP]; in ath10k_send_key()
264 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_WEP]; in ath10k_send_key()
267 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_CCM]; in ath10k_send_key()
271 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_GCM]; in ath10k_send_key()
272 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; in ath10k_send_key()
279 return -EINVAL; in ath10k_send_key()
281 ath10k_warn(ar, "cipher %d is not supported\n", key->cipher); in ath10k_send_key()
282 return -EOPNOTSUPP; in ath10k_send_key()
285 if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) in ath10k_send_key()
286 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; in ath10k_send_key()
289 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_NONE]; in ath10k_send_key()
293 return ath10k_wmi_vdev_install_key(arvif->ar, &arg); in ath10k_send_key()
301 struct ath10k *ar = arvif->ar; in ath10k_install_key()
305 lockdep_assert_held(&ar->conf_mutex); in ath10k_install_key()
307 reinit_completion(&ar->install_key_done); in ath10k_install_key()
309 if (arvif->nohwcrypt) in ath10k_install_key()
316 time_left = wait_for_completion_timeout(&ar->install_key_done, 3 * HZ); in ath10k_install_key()
318 return -ETIMEDOUT; in ath10k_install_key()
326 struct ath10k *ar = arvif->ar; in ath10k_install_peer_wep_keys()
332 lockdep_assert_held(&ar->conf_mutex); in ath10k_install_peer_wep_keys()
334 if (WARN_ON(arvif->vif->type != NL80211_IFTYPE_AP && in ath10k_install_peer_wep_keys()
335 arvif->vif->type != NL80211_IFTYPE_ADHOC && in ath10k_install_peer_wep_keys()
336 arvif->vif->type != NL80211_IFTYPE_MESH_POINT)) in ath10k_install_peer_wep_keys()
337 return -EINVAL; in ath10k_install_peer_wep_keys()
339 spin_lock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
340 peer = ath10k_peer_find(ar, arvif->vdev_id, addr); in ath10k_install_peer_wep_keys()
341 spin_unlock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
344 return -ENOENT; in ath10k_install_peer_wep_keys()
346 for (i = 0; i < ARRAY_SIZE(arvif->wep_keys); i++) { in ath10k_install_peer_wep_keys()
347 if (arvif->wep_keys[i] == NULL) in ath10k_install_peer_wep_keys()
350 switch (arvif->vif->type) { in ath10k_install_peer_wep_keys()
354 if (arvif->def_wep_key_idx == i) in ath10k_install_peer_wep_keys()
357 ret = ath10k_install_key(arvif, arvif->wep_keys[i], in ath10k_install_peer_wep_keys()
363 ret = ath10k_install_key(arvif, arvif->wep_keys[i], in ath10k_install_peer_wep_keys()
369 ret = ath10k_install_key(arvif, arvif->wep_keys[i], in ath10k_install_peer_wep_keys()
376 return -EINVAL; in ath10k_install_peer_wep_keys()
379 spin_lock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
380 peer->keys[i] = arvif->wep_keys[i]; in ath10k_install_peer_wep_keys()
381 spin_unlock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
392 if (arvif->vif->type != NL80211_IFTYPE_ADHOC) in ath10k_install_peer_wep_keys()
395 if (arvif->def_wep_key_idx == -1) in ath10k_install_peer_wep_keys()
398 ret = ath10k_wmi_vdev_set_param(arvif->ar, in ath10k_install_peer_wep_keys()
399 arvif->vdev_id, in ath10k_install_peer_wep_keys()
400 arvif->ar->wmi.vdev_param->def_keyid, in ath10k_install_peer_wep_keys()
401 arvif->def_wep_key_idx); in ath10k_install_peer_wep_keys()
403 ath10k_warn(ar, "failed to re-set def wpa key idxon vdev %i: %d\n", in ath10k_install_peer_wep_keys()
404 arvif->vdev_id, ret); in ath10k_install_peer_wep_keys()
414 struct ath10k *ar = arvif->ar; in ath10k_clear_peer_keys()
421 lockdep_assert_held(&ar->conf_mutex); in ath10k_clear_peer_keys()
423 spin_lock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
424 peer = ath10k_peer_find(ar, arvif->vdev_id, addr); in ath10k_clear_peer_keys()
425 spin_unlock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
428 return -ENOENT; in ath10k_clear_peer_keys()
430 for (i = 0; i < ARRAY_SIZE(peer->keys); i++) { in ath10k_clear_peer_keys()
431 if (peer->keys[i] == NULL) in ath10k_clear_peer_keys()
435 ret = ath10k_install_key(arvif, peer->keys[i], in ath10k_clear_peer_keys()
444 spin_lock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
445 peer->keys[i] = NULL; in ath10k_clear_peer_keys()
446 spin_unlock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
458 lockdep_assert_held(&ar->data_lock); in ath10k_mac_is_peer_wep_key_set()
463 * FIXME: multi-bss needs to be handled. in ath10k_mac_is_peer_wep_key_set()
469 for (i = 0; i < ARRAY_SIZE(peer->keys); i++) { in ath10k_mac_is_peer_wep_key_set()
470 if (peer->keys[i] && peer->keys[i]->keyidx == keyidx) in ath10k_mac_is_peer_wep_key_set()
480 struct ath10k *ar = arvif->ar; in ath10k_clear_vdev_key()
488 lockdep_assert_held(&ar->conf_mutex); in ath10k_clear_vdev_key()
494 spin_lock_bh(&ar->data_lock); in ath10k_clear_vdev_key()
496 list_for_each_entry(peer, &ar->peers, list) { in ath10k_clear_vdev_key()
497 for (i = 0; i < ARRAY_SIZE(peer->keys); i++) { in ath10k_clear_vdev_key()
498 if (peer->keys[i] == key) { in ath10k_clear_vdev_key()
499 ether_addr_copy(addr, peer->addr); in ath10k_clear_vdev_key()
500 peer->keys[i] = NULL; in ath10k_clear_vdev_key()
505 if (i < ARRAY_SIZE(peer->keys)) in ath10k_clear_vdev_key()
508 spin_unlock_bh(&ar->data_lock); in ath10k_clear_vdev_key()
510 if (i == ARRAY_SIZE(peer->keys)) in ath10k_clear_vdev_key()
528 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_update_wep_key()
532 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_vif_update_wep_key()
534 list_for_each_entry(peer, &ar->peers, list) { in ath10k_mac_vif_update_wep_key()
535 if (ether_addr_equal(peer->addr, arvif->vif->addr)) in ath10k_mac_vif_update_wep_key()
538 if (ether_addr_equal(peer->addr, arvif->bssid)) in ath10k_mac_vif_update_wep_key()
541 if (peer->keys[key->keyidx] == key) in ath10k_mac_vif_update_wep_key()
545 arvif->vdev_id, key->keyidx); in ath10k_mac_vif_update_wep_key()
547 ret = ath10k_install_peer_wep_keys(arvif, peer->addr); in ath10k_mac_vif_update_wep_key()
550 arvif->vdev_id, peer->addr, ret); in ath10k_mac_vif_update_wep_key()
567 switch (chandef->chan->band) { in chan_to_phymode()
569 switch (chandef->width) { in chan_to_phymode()
571 if (chandef->chan->flags & IEEE80211_CHAN_NO_OFDM) in chan_to_phymode()
588 switch (chandef->width) { in chan_to_phymode()
662 conf = rcu_dereference(vif->chanctx_conf); in ath10k_mac_vif_chan()
665 return -ENOENT; in ath10k_mac_vif_chan()
668 *def = conf->def; in ath10k_mac_vif_chan()
687 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_num_chanctxs()
701 *def = &conf->def; in ath10k_mac_get_any_chandef_iter()
710 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) { in ath10k_wait_for_peer_delete_done()
717 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()
738 num_peers = ar->num_peers; in ath10k_peer_create()
741 list_for_each_entry(arvif, &ar->arvifs, list) in ath10k_peer_create()
744 if (num_peers >= ar->max_num_peers) in ath10k_peer_create()
745 return -ENOBUFS; in ath10k_peer_create()
761 spin_lock_bh(&ar->data_lock); in ath10k_peer_create()
765 spin_unlock_bh(&ar->data_lock); in ath10k_peer_create()
769 return -ENOENT; in ath10k_peer_create()
772 peer->vif = vif; in ath10k_peer_create()
773 peer->sta = sta; in ath10k_peer_create()
775 spin_unlock_bh(&ar->data_lock); in ath10k_peer_create()
777 ar->num_peers++; in ath10k_peer_create()
784 struct ath10k *ar = arvif->ar; in ath10k_mac_set_kickout()
788 param = ar->wmi.pdev_param->sta_kickout_th; in ath10k_mac_set_kickout()
793 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
797 param = ar->wmi.vdev_param->ap_keepalive_min_idle_inactive_time_secs; in ath10k_mac_set_kickout()
798 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
802 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
806 param = ar->wmi.vdev_param->ap_keepalive_max_idle_inactive_time_secs; in ath10k_mac_set_kickout()
807 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
811 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
815 param = ar->wmi.vdev_param->ap_keepalive_max_unresponsive_time_secs; in ath10k_mac_set_kickout()
816 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
820 arvif->vdev_id, ret); in ath10k_mac_set_kickout()
829 struct ath10k *ar = arvif->ar; in ath10k_mac_set_rts()
832 vdev_param = ar->wmi.vdev_param->rts_threshold; in ath10k_mac_set_rts()
833 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, value); in ath10k_mac_set_rts()
840 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_delete()
850 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) { in ath10k_peer_delete()
854 (&ar->peer_delete_done, 5 * HZ); in ath10k_peer_delete()
858 return -ETIMEDOUT; in ath10k_peer_delete()
862 ar->num_peers--; in ath10k_peer_delete()
873 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_cleanup()
875 spin_lock_bh(&ar->data_lock); in ath10k_peer_cleanup()
876 list_for_each_entry_safe(peer, tmp, &ar->peers, list) { in ath10k_peer_cleanup()
877 if (peer->vdev_id != vdev_id) in ath10k_peer_cleanup()
881 peer->addr, vdev_id); in ath10k_peer_cleanup()
883 for_each_set_bit(peer_id, peer->peer_ids, in ath10k_peer_cleanup()
885 ar->peer_map[peer_id] = NULL; in ath10k_peer_cleanup()
888 /* Double check that peer is properly un-referenced from in ath10k_peer_cleanup()
891 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_peer_cleanup()
892 if (ar->peer_map[i] == peer) { in ath10k_peer_cleanup()
894 peer->addr, peer, i); in ath10k_peer_cleanup()
895 ar->peer_map[i] = NULL; in ath10k_peer_cleanup()
899 list_del(&peer->list); in ath10k_peer_cleanup()
901 ar->num_peers--; in ath10k_peer_cleanup()
903 spin_unlock_bh(&ar->data_lock); in ath10k_peer_cleanup()
911 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_cleanup_all()
913 spin_lock_bh(&ar->data_lock); in ath10k_peer_cleanup_all()
914 list_for_each_entry_safe(peer, tmp, &ar->peers, list) { in ath10k_peer_cleanup_all()
915 list_del(&peer->list); in ath10k_peer_cleanup_all()
919 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) in ath10k_peer_cleanup_all()
920 ar->peer_map[i] = NULL; in ath10k_peer_cleanup_all()
922 spin_unlock_bh(&ar->data_lock); in ath10k_peer_cleanup_all()
924 ar->num_peers = 0; in ath10k_peer_cleanup_all()
925 ar->num_stations = 0; in ath10k_peer_cleanup_all()
937 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_tdls_peer_update()
941 ether_addr_copy(arg.addr, sta->addr); in ath10k_mac_tdls_peer_update()
943 cap.peer_max_sp = sta->max_sp; in ath10k_mac_tdls_peer_update()
944 cap.peer_uapsd_queues = sta->uapsd_queues; in ath10k_mac_tdls_peer_update()
947 !sta->tdls_initiator) in ath10k_mac_tdls_peer_update()
966 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_beacon_free()
968 lockdep_assert_held(&ar->data_lock); in ath10k_mac_vif_beacon_free()
970 if (!arvif->beacon) in ath10k_mac_vif_beacon_free()
973 if (!arvif->beacon_buf) in ath10k_mac_vif_beacon_free()
974 dma_unmap_single(ar->dev, ATH10K_SKB_CB(arvif->beacon)->paddr, in ath10k_mac_vif_beacon_free()
975 arvif->beacon->len, DMA_TO_DEVICE); in ath10k_mac_vif_beacon_free()
977 if (WARN_ON(arvif->beacon_state != ATH10K_BEACON_SCHEDULED && in ath10k_mac_vif_beacon_free()
978 arvif->beacon_state != ATH10K_BEACON_SENT)) in ath10k_mac_vif_beacon_free()
981 dev_kfree_skb_any(arvif->beacon); in ath10k_mac_vif_beacon_free()
983 arvif->beacon = NULL; in ath10k_mac_vif_beacon_free()
984 arvif->beacon_state = ATH10K_BEACON_SCHEDULED; in ath10k_mac_vif_beacon_free()
989 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_beacon_cleanup()
991 lockdep_assert_held(&ar->data_lock); in ath10k_mac_vif_beacon_cleanup()
995 if (arvif->beacon_buf) { in ath10k_mac_vif_beacon_cleanup()
996 dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, in ath10k_mac_vif_beacon_cleanup()
997 arvif->beacon_buf, arvif->beacon_paddr); in ath10k_mac_vif_beacon_cleanup()
998 arvif->beacon_buf = NULL; in ath10k_mac_vif_beacon_cleanup()
1006 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_setup_sync()
1008 if (test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)) in ath10k_vdev_setup_sync()
1009 return -ESHUTDOWN; in ath10k_vdev_setup_sync()
1011 time_left = wait_for_completion_timeout(&ar->vdev_setup_done, in ath10k_vdev_setup_sync()
1014 return -ETIMEDOUT; in ath10k_vdev_setup_sync()
1016 return ar->last_wmi_vdev_start_status; in ath10k_vdev_setup_sync()
1026 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_start()
1028 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_monitor_vdev_start()
1032 return -ENOENT; in ath10k_monitor_vdev_start()
1034 channel = chandef->chan; in ath10k_monitor_vdev_start()
1037 arg.channel.freq = channel->center_freq; in ath10k_monitor_vdev_start()
1038 arg.channel.band_center_freq1 = chandef->center_freq1; in ath10k_monitor_vdev_start()
1039 arg.channel.band_center_freq2 = chandef->center_freq2; in ath10k_monitor_vdev_start()
1046 !!(channel->flags & IEEE80211_CHAN_RADAR); in ath10k_monitor_vdev_start()
1049 arg.channel.max_power = channel->max_power * 2; in ath10k_monitor_vdev_start()
1050 arg.channel.max_reg_power = channel->max_reg_power * 2; in ath10k_monitor_vdev_start()
1051 arg.channel.max_antenna_gain = channel->max_antenna_gain * 2; in ath10k_monitor_vdev_start()
1053 reinit_completion(&ar->vdev_setup_done); in ath10k_monitor_vdev_start()
1054 reinit_completion(&ar->vdev_delete_done); in ath10k_monitor_vdev_start()
1070 ret = ath10k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr); in ath10k_monitor_vdev_start()
1077 ar->monitor_vdev_id = vdev_id; in ath10k_monitor_vdev_start()
1080 ar->monitor_vdev_id); in ath10k_monitor_vdev_start()
1084 ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_start()
1087 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_start()
1096 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_stop()
1098 ret = ath10k_wmi_vdev_down(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1101 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1103 reinit_completion(&ar->vdev_setup_done); in ath10k_monitor_vdev_stop()
1104 reinit_completion(&ar->vdev_delete_done); in ath10k_monitor_vdev_stop()
1106 ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1109 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1114 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1117 ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1125 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_create()
1127 if (ar->free_vdev_map == 0) { in ath10k_monitor_vdev_create()
1129 return -ENOMEM; in ath10k_monitor_vdev_create()
1132 bit = __ffs64(ar->free_vdev_map); in ath10k_monitor_vdev_create()
1134 ar->monitor_vdev_id = bit; in ath10k_monitor_vdev_create()
1136 ret = ath10k_wmi_vdev_create(ar, ar->monitor_vdev_id, in ath10k_monitor_vdev_create()
1138 0, ar->mac_addr); in ath10k_monitor_vdev_create()
1141 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_create()
1145 ar->free_vdev_map &= ~(1LL << ar->monitor_vdev_id); in ath10k_monitor_vdev_create()
1147 ar->monitor_vdev_id); in ath10k_monitor_vdev_create()
1156 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_delete()
1158 ret = ath10k_wmi_vdev_delete(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_delete()
1161 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_delete()
1165 ar->free_vdev_map |= 1LL << ar->monitor_vdev_id; in ath10k_monitor_vdev_delete()
1168 ar->monitor_vdev_id); in ath10k_monitor_vdev_delete()
1176 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_start()
1184 ret = ath10k_monitor_vdev_start(ar, ar->monitor_vdev_id); in ath10k_monitor_start()
1191 ar->monitor_started = true; in ath10k_monitor_start()
1201 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_stop()
1215 ar->monitor_started = false; in ath10k_monitor_stop()
1235 if (ar->monitor_arvif) in ath10k_mac_monitor_vdev_is_needed()
1238 return ar->monitor || in ath10k_mac_monitor_vdev_is_needed()
1240 ar->running_fw->fw_file.fw_features) && in ath10k_mac_monitor_vdev_is_needed()
1241 (ar->filter_flags & FIF_OTHER_BSS)) || in ath10k_mac_monitor_vdev_is_needed()
1242 test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_mac_monitor_vdev_is_needed()
1253 * case anyway since multi-channel DFS hasn't been tested at all. in ath10k_mac_monitor_vdev_is_allowed()
1255 if (test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags) && num_ctx > 1) in ath10k_mac_monitor_vdev_is_allowed()
1267 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_recalc()
1274 ar->monitor_started, needed, allowed); in ath10k_monitor_recalc()
1277 if (ar->monitor_started) { in ath10k_monitor_recalc()
1287 return -EPERM; in ath10k_monitor_recalc()
1290 if (needed == ar->monitor_started) in ath10k_monitor_recalc()
1301 struct ath10k *ar = arvif->ar; in ath10k_mac_can_set_cts_prot()
1303 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_can_set_cts_prot()
1305 if (!arvif->is_started) { in ath10k_mac_can_set_cts_prot()
1315 struct ath10k *ar = arvif->ar; in ath10k_mac_set_cts_prot()
1318 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_set_cts_prot()
1320 vdev_param = ar->wmi.vdev_param->protection_mode; in ath10k_mac_set_cts_prot()
1323 arvif->vdev_id, arvif->use_cts_prot); in ath10k_mac_set_cts_prot()
1325 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_mac_set_cts_prot()
1326 arvif->use_cts_prot ? 1 : 0); in ath10k_mac_set_cts_prot()
1331 struct ath10k *ar = arvif->ar; in ath10k_recalc_rtscts_prot()
1334 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalc_rtscts_prot()
1336 vdev_param = ar->wmi.vdev_param->enable_rtscts; in ath10k_recalc_rtscts_prot()
1340 if (arvif->num_legacy_stations > 0) in ath10k_recalc_rtscts_prot()
1348 arvif->vdev_id, rts_cts); in ath10k_recalc_rtscts_prot()
1350 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_recalc_rtscts_prot()
1358 lockdep_assert_held(&ar->conf_mutex); in ath10k_start_cac()
1360 set_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_start_cac()
1365 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_start_cac()
1370 ar->monitor_vdev_id); in ath10k_start_cac()
1377 lockdep_assert_held(&ar->conf_mutex); in ath10k_stop_cac()
1379 /* CAC is not running - do nothing */ in ath10k_stop_cac()
1380 if (!test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags)) in ath10k_stop_cac()
1383 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_stop_cac()
1397 if (!*ret && conf->radar_enabled) in ath10k_mac_has_radar_iter()
1405 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_has_radar_enabled()
1416 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalc_radar_detection()
1423 if (ar->num_started_vdevs > 0) in ath10k_recalc_radar_detection()
1434 ieee80211_radar_detected(ar->hw); in ath10k_recalc_radar_detection()
1440 struct ath10k *ar = arvif->ar; in ath10k_vdev_stop()
1443 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_stop()
1445 reinit_completion(&ar->vdev_setup_done); in ath10k_vdev_stop()
1446 reinit_completion(&ar->vdev_delete_done); in ath10k_vdev_stop()
1448 ret = ath10k_wmi_vdev_stop(ar, arvif->vdev_id); in ath10k_vdev_stop()
1451 arvif->vdev_id, ret); in ath10k_vdev_stop()
1458 arvif->vdev_id, ret); in ath10k_vdev_stop()
1462 WARN_ON(ar->num_started_vdevs == 0); in ath10k_vdev_stop()
1464 if (ar->num_started_vdevs != 0) { in ath10k_vdev_stop()
1465 ar->num_started_vdevs--; in ath10k_vdev_stop()
1476 struct ath10k *ar = arvif->ar; in ath10k_vdev_start_restart()
1480 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_start_restart()
1482 reinit_completion(&ar->vdev_setup_done); in ath10k_vdev_start_restart()
1483 reinit_completion(&ar->vdev_delete_done); in ath10k_vdev_start_restart()
1485 arg.vdev_id = arvif->vdev_id; in ath10k_vdev_start_restart()
1486 arg.dtim_period = arvif->dtim_period; in ath10k_vdev_start_restart()
1487 arg.bcn_intval = arvif->beacon_interval; in ath10k_vdev_start_restart()
1489 arg.channel.freq = chandef->chan->center_freq; in ath10k_vdev_start_restart()
1490 arg.channel.band_center_freq1 = chandef->center_freq1; in ath10k_vdev_start_restart()
1491 arg.channel.band_center_freq2 = chandef->center_freq2; in ath10k_vdev_start_restart()
1495 arg.channel.max_power = chandef->chan->max_power * 2; in ath10k_vdev_start_restart()
1496 arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; in ath10k_vdev_start_restart()
1497 arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain * 2; in ath10k_vdev_start_restart()
1499 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath10k_vdev_start_restart()
1500 arg.ssid = arvif->u.ap.ssid; in ath10k_vdev_start_restart()
1501 arg.ssid_len = arvif->u.ap.ssid_len; in ath10k_vdev_start_restart()
1502 arg.hidden_ssid = arvif->u.ap.hidden_ssid; in ath10k_vdev_start_restart()
1506 !!(chandef->chan->flags & IEEE80211_CHAN_RADAR); in ath10k_vdev_start_restart()
1507 } else if (arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_vdev_start_restart()
1508 arg.ssid = arvif->vif->bss_conf.ssid; in ath10k_vdev_start_restart()
1509 arg.ssid_len = arvif->vif->bss_conf.ssid_len; in ath10k_vdev_start_restart()
1536 ar->num_started_vdevs++; in ath10k_vdev_start_restart()
1557 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_bcn_p2p_ie()
1562 if (arvif->vif->type != NL80211_IFTYPE_AP || !arvif->vif->p2p) in ath10k_mac_setup_bcn_p2p_ie()
1565 mgmt = (void *)bcn->data; in ath10k_mac_setup_bcn_p2p_ie()
1567 mgmt->u.beacon.variable, in ath10k_mac_setup_bcn_p2p_ie()
1568 bcn->len - (mgmt->u.beacon.variable - in ath10k_mac_setup_bcn_p2p_ie()
1569 bcn->data)); in ath10k_mac_setup_bcn_p2p_ie()
1571 return -ENOENT; in ath10k_mac_setup_bcn_p2p_ie()
1573 ret = ath10k_wmi_p2p_go_bcn_ie(ar, arvif->vdev_id, p2p_ie); in ath10k_mac_setup_bcn_p2p_ie()
1576 arvif->vdev_id, ret); in ath10k_mac_setup_bcn_p2p_ie()
1591 if (WARN_ON(skb->len < ie_offset)) in ath10k_mac_remove_vendor_ie()
1592 return -EINVAL; in ath10k_mac_remove_vendor_ie()
1595 skb->data + ie_offset, in ath10k_mac_remove_vendor_ie()
1596 skb->len - ie_offset); in ath10k_mac_remove_vendor_ie()
1598 return -ENOENT; in ath10k_mac_remove_vendor_ie()
1601 end = skb->data + skb->len; in ath10k_mac_remove_vendor_ie()
1605 return -EINVAL; in ath10k_mac_remove_vendor_ie()
1607 memmove(ie, next, end - next); in ath10k_mac_remove_vendor_ie()
1608 skb_trim(skb, skb->len - len); in ath10k_mac_remove_vendor_ie()
1615 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_bcn_tmpl()
1616 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_setup_bcn_tmpl()
1617 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_setup_bcn_tmpl()
1622 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_setup_bcn_tmpl()
1625 if (arvif->vdev_type != WMI_VDEV_TYPE_AP && in ath10k_mac_setup_bcn_tmpl()
1626 arvif->vdev_type != WMI_VDEV_TYPE_IBSS) in ath10k_mac_setup_bcn_tmpl()
1632 return -EPERM; in ath10k_mac_setup_bcn_tmpl()
1650 ret = ath10k_wmi_bcn_tmpl(ar, arvif->vdev_id, offs.tim_offset, bcn, 0, in ath10k_mac_setup_bcn_tmpl()
1665 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_prb_tmpl()
1666 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_setup_prb_tmpl()
1667 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_setup_prb_tmpl()
1671 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_setup_prb_tmpl()
1674 if (arvif->vdev_type != WMI_VDEV_TYPE_AP) in ath10k_mac_setup_prb_tmpl()
1684 return -EPERM; in ath10k_mac_setup_prb_tmpl()
1687 ret = ath10k_wmi_prb_tmpl(ar, arvif->vdev_id, prb); in ath10k_mac_setup_prb_tmpl()
1701 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_fix_hidden_ssid()
1716 * since only wmi-tlv firmware are known to have beacon offload and in ath10k_mac_vif_fix_hidden_ssid()
1717 * wmi-tlv doesn't seem to misbehave like 10.2 wrt vdev restart in ath10k_mac_vif_fix_hidden_ssid()
1720 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_vif_fix_hidden_ssid()
1723 if (WARN_ON(!arvif->is_started)) in ath10k_mac_vif_fix_hidden_ssid()
1724 return -EINVAL; in ath10k_mac_vif_fix_hidden_ssid()
1726 if (WARN_ON(!arvif->is_up)) in ath10k_mac_vif_fix_hidden_ssid()
1727 return -EINVAL; in ath10k_mac_vif_fix_hidden_ssid()
1729 if (WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) in ath10k_mac_vif_fix_hidden_ssid()
1730 return -EINVAL; in ath10k_mac_vif_fix_hidden_ssid()
1732 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_vif_fix_hidden_ssid()
1735 arvif->vdev_id, ret); in ath10k_mac_vif_fix_hidden_ssid()
1758 arvif->vdev_id, ret); in ath10k_mac_vif_fix_hidden_ssid()
1762 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_mac_vif_fix_hidden_ssid()
1763 arvif->bssid); in ath10k_mac_vif_fix_hidden_ssid()
1766 arvif->vdev_id, ret); in ath10k_mac_vif_fix_hidden_ssid()
1776 struct ath10k *ar = arvif->ar; in ath10k_control_beaconing()
1779 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_control_beaconing()
1781 if (!info->enable_beacon) { in ath10k_control_beaconing()
1782 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_control_beaconing()
1785 arvif->vdev_id, ret); in ath10k_control_beaconing()
1787 arvif->is_up = false; in ath10k_control_beaconing()
1789 spin_lock_bh(&arvif->ar->data_lock); in ath10k_control_beaconing()
1791 spin_unlock_bh(&arvif->ar->data_lock); in ath10k_control_beaconing()
1796 arvif->tx_seq_no = 0x1000; in ath10k_control_beaconing()
1798 arvif->aid = 0; in ath10k_control_beaconing()
1799 ether_addr_copy(arvif->bssid, info->bssid); in ath10k_control_beaconing()
1801 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_control_beaconing()
1802 arvif->bssid); in ath10k_control_beaconing()
1805 arvif->vdev_id, ret); in ath10k_control_beaconing()
1809 arvif->is_up = true; in ath10k_control_beaconing()
1814 arvif->vdev_id, ret); in ath10k_control_beaconing()
1818 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %d up\n", arvif->vdev_id); in ath10k_control_beaconing()
1825 struct ath10k *ar = arvif->ar; in ath10k_control_ibss()
1829 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_control_ibss()
1831 if (!info->ibss_joined) { in ath10k_control_ibss()
1832 if (is_zero_ether_addr(arvif->bssid)) in ath10k_control_ibss()
1835 eth_zero_addr(arvif->bssid); in ath10k_control_ibss()
1840 vdev_param = arvif->ar->wmi.vdev_param->atim_window; in ath10k_control_ibss()
1841 ret = ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id, vdev_param, in ath10k_control_ibss()
1845 arvif->vdev_id, ret); in ath10k_control_ibss()
1850 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_recalc_ps_wake_threshold()
1855 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_recalc_ps_wake_threshold()
1857 if (arvif->u.sta.uapsd) in ath10k_mac_vif_recalc_ps_wake_threshold()
1863 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, value); in ath10k_mac_vif_recalc_ps_wake_threshold()
1866 value, arvif->vdev_id, ret); in ath10k_mac_vif_recalc_ps_wake_threshold()
1875 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_recalc_ps_poll_count()
1880 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_recalc_ps_poll_count()
1882 if (arvif->u.sta.uapsd) in ath10k_mac_vif_recalc_ps_poll_count()
1888 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_mac_vif_recalc_ps_poll_count()
1892 value, arvif->vdev_id, ret); in ath10k_mac_vif_recalc_ps_poll_count()
1904 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_num_vifs_started()
1906 list_for_each_entry(arvif, &ar->arvifs, list) in ath10k_mac_num_vifs_started()
1907 if (arvif->is_started) in ath10k_mac_num_vifs_started()
1915 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_setup_ps()
1916 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_vif_setup_ps()
1917 struct ieee80211_conf *conf = &ar->hw->conf; in ath10k_mac_vif_setup_ps()
1924 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_setup_ps()
1926 if (arvif->vif->type != NL80211_IFTYPE_STATION) in ath10k_mac_vif_setup_ps()
1929 enable_ps = arvif->ps; in ath10k_mac_vif_setup_ps()
1933 ar->running_fw->fw_file.fw_features)) { in ath10k_mac_vif_setup_ps()
1935 arvif->vdev_id); in ath10k_mac_vif_setup_ps()
1939 if (!arvif->is_started) { in ath10k_mac_vif_setup_ps()
1942 * necessary if PS is disabled on a non-started vdev. Hence in ath10k_mac_vif_setup_ps()
1943 * force-enable PS for non-running vdevs. in ath10k_mac_vif_setup_ps()
1950 ps_timeout = conf->dynamic_ps_timeout; in ath10k_mac_vif_setup_ps()
1954 vif->bss_conf.beacon_int) / 1000; in ath10k_mac_vif_setup_ps()
1957 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, in ath10k_mac_vif_setup_ps()
1961 arvif->vdev_id, ret); in ath10k_mac_vif_setup_ps()
1969 arvif->vdev_id, psmode ? "enable" : "disable"); in ath10k_mac_vif_setup_ps()
1971 ret = ath10k_wmi_set_psmode(ar, arvif->vdev_id, psmode); in ath10k_mac_vif_setup_ps()
1974 psmode, arvif->vdev_id, ret); in ath10k_mac_vif_setup_ps()
1983 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_disable_keepalive()
1987 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_disable_keepalive()
1989 if (arvif->vdev_type != WMI_VDEV_TYPE_STA) in ath10k_mac_vif_disable_keepalive()
1992 if (!test_bit(WMI_SERVICE_STA_KEEP_ALIVE, ar->wmi.svc_map)) in ath10k_mac_vif_disable_keepalive()
1998 arg.vdev_id = arvif->vdev_id; in ath10k_mac_vif_disable_keepalive()
2006 arvif->vdev_id, ret); in ath10k_mac_vif_disable_keepalive()
2015 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_ap_csa_count_down()
2016 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_vif_ap_csa_count_down()
2019 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_ap_csa_count_down()
2021 if (WARN_ON(!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map))) in ath10k_mac_vif_ap_csa_count_down()
2024 if (arvif->vdev_type != WMI_VDEV_TYPE_AP) in ath10k_mac_vif_ap_csa_count_down()
2027 if (!vif->csa_active) in ath10k_mac_vif_ap_csa_count_down()
2030 if (!arvif->is_up) in ath10k_mac_vif_ap_csa_count_down()
2054 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_ap_csa_work()
2056 mutex_lock(&ar->conf_mutex); in ath10k_mac_vif_ap_csa_work()
2058 mutex_unlock(&ar->conf_mutex); in ath10k_mac_vif_ap_csa_work()
2065 struct ieee80211_mgmt *mgmt = (void *)skb->data; in ath10k_mac_handle_beacon_iter()
2066 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_handle_beacon_iter()
2068 if (vif->type != NL80211_IFTYPE_STATION) in ath10k_mac_handle_beacon_iter()
2071 if (!ether_addr_equal(mgmt->bssid, vif->bss_conf.bssid)) in ath10k_mac_handle_beacon_iter()
2074 cancel_delayed_work(&arvif->connection_loss_work); in ath10k_mac_handle_beacon_iter()
2079 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_beacon()
2089 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_handle_beacon_miss_iter()
2090 struct ath10k *ar = arvif->ar; in ath10k_mac_handle_beacon_miss_iter()
2091 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_handle_beacon_miss_iter()
2093 if (arvif->vdev_id != *vdev_id) in ath10k_mac_handle_beacon_miss_iter()
2096 if (!arvif->is_up) in ath10k_mac_handle_beacon_miss_iter()
2106 ieee80211_queue_delayed_work(hw, &arvif->connection_loss_work, in ath10k_mac_handle_beacon_miss_iter()
2112 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_beacon_miss()
2122 struct ieee80211_vif *vif = arvif->vif; in ath10k_mac_vif_sta_connection_loss_work()
2124 if (!arvif->is_up) in ath10k_mac_vif_sta_connection_loss_work()
2145 if (vif->type == NL80211_IFTYPE_STATION) in ath10k_peer_assoc_h_listen_intval()
2148 return ar->hw->conf.listen_interval; in ath10k_peer_assoc_h_listen_intval()
2156 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_basic()
2159 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_basic()
2161 if (vif->type == NL80211_IFTYPE_STATION) in ath10k_peer_assoc_h_basic()
2162 aid = vif->bss_conf.aid; in ath10k_peer_assoc_h_basic()
2164 aid = sta->aid; in ath10k_peer_assoc_h_basic()
2166 ether_addr_copy(arg->addr, sta->addr); in ath10k_peer_assoc_h_basic()
2167 arg->vdev_id = arvif->vdev_id; in ath10k_peer_assoc_h_basic()
2168 arg->peer_aid = aid; in ath10k_peer_assoc_h_basic()
2169 arg->peer_flags |= arvif->ar->wmi.peer_flags->auth; in ath10k_peer_assoc_h_basic()
2170 arg->peer_listen_intval = ath10k_peer_assoc_h_listen_intval(ar, vif); in ath10k_peer_assoc_h_basic()
2171 arg->peer_num_spatial_streams = 1; in ath10k_peer_assoc_h_basic()
2172 arg->peer_caps = vif->bss_conf.assoc_capability; in ath10k_peer_assoc_h_basic()
2180 struct ieee80211_bss_conf *info = &vif->bss_conf; in ath10k_peer_assoc_h_crypto()
2186 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_crypto()
2191 bss = cfg80211_get_bss(ar->hw->wiphy, def.chan, info->bssid, in ath10k_peer_assoc_h_crypto()
2192 info->ssid_len ? info->ssid : NULL, info->ssid_len, in ath10k_peer_assoc_h_crypto()
2200 ies = rcu_dereference(bss->ies); in ath10k_peer_assoc_h_crypto()
2204 ies->data, in ath10k_peer_assoc_h_crypto()
2205 ies->len); in ath10k_peer_assoc_h_crypto()
2207 cfg80211_put_bss(ar->hw->wiphy, bss); in ath10k_peer_assoc_h_crypto()
2213 arg->peer_flags |= ar->wmi.peer_flags->need_ptk_4_way; in ath10k_peer_assoc_h_crypto()
2218 arg->peer_flags |= ar->wmi.peer_flags->need_gtk_2_way; in ath10k_peer_assoc_h_crypto()
2221 if (sta->mfp && in ath10k_peer_assoc_h_crypto()
2223 ar->running_fw->fw_file.fw_features)) { in ath10k_peer_assoc_h_crypto()
2224 arg->peer_flags |= ar->wmi.peer_flags->pmf; in ath10k_peer_assoc_h_crypto()
2233 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_rates()
2234 struct wmi_rate_set_arg *rateset = &arg->peer_legacy_rates; in ath10k_peer_assoc_h_rates()
2243 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_rates()
2248 band = def.chan->band; in ath10k_peer_assoc_h_rates()
2249 sband = ar->hw->wiphy->bands[band]; in ath10k_peer_assoc_h_rates()
2250 ratemask = sta->supp_rates[band]; in ath10k_peer_assoc_h_rates()
2251 ratemask &= arvif->bitrate_mask.control[band].legacy; in ath10k_peer_assoc_h_rates()
2252 rates = sband->bitrates; in ath10k_peer_assoc_h_rates()
2254 rateset->num_rates = 0; in ath10k_peer_assoc_h_rates()
2260 rate = ath10k_mac_bitrate_to_rate(rates->bitrate); in ath10k_peer_assoc_h_rates()
2261 rateset->rates[rateset->num_rates] = rate; in ath10k_peer_assoc_h_rates()
2262 rateset->num_rates++; in ath10k_peer_assoc_h_rates()
2295 const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; in ath10k_peer_assoc_h_ht()
2296 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_ht()
2305 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_ht()
2310 if (!ht_cap->ht_supported) in ath10k_peer_assoc_h_ht()
2313 band = def.chan->band; in ath10k_peer_assoc_h_ht()
2314 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath10k_peer_assoc_h_ht()
2315 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_peer_assoc_h_ht()
2321 arg->peer_flags |= ar->wmi.peer_flags->ht; in ath10k_peer_assoc_h_ht()
2322 arg->peer_max_mpdu = (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + in ath10k_peer_assoc_h_ht()
2323 ht_cap->ampdu_factor)) - 1; in ath10k_peer_assoc_h_ht()
2325 arg->peer_mpdu_density = in ath10k_peer_assoc_h_ht()
2326 ath10k_parse_mpdudensity(ht_cap->ampdu_density); in ath10k_peer_assoc_h_ht()
2328 arg->peer_ht_caps = ht_cap->cap; in ath10k_peer_assoc_h_ht()
2329 arg->peer_rate_caps |= WMI_RC_HT_FLAG; in ath10k_peer_assoc_h_ht()
2331 if (ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING) in ath10k_peer_assoc_h_ht()
2332 arg->peer_flags |= ar->wmi.peer_flags->ldbc; in ath10k_peer_assoc_h_ht()
2334 if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) { in ath10k_peer_assoc_h_ht()
2335 arg->peer_flags |= ar->wmi.peer_flags->bw40; in ath10k_peer_assoc_h_ht()
2336 arg->peer_rate_caps |= WMI_RC_CW40_FLAG; in ath10k_peer_assoc_h_ht()
2339 if (arvif->bitrate_mask.control[band].gi != NL80211_TXRATE_FORCE_LGI) { in ath10k_peer_assoc_h_ht()
2340 if (ht_cap->cap & IEEE80211_HT_CAP_SGI_20) in ath10k_peer_assoc_h_ht()
2341 arg->peer_rate_caps |= WMI_RC_SGI_FLAG; in ath10k_peer_assoc_h_ht()
2343 if (ht_cap->cap & IEEE80211_HT_CAP_SGI_40) in ath10k_peer_assoc_h_ht()
2344 arg->peer_rate_caps |= WMI_RC_SGI_FLAG; in ath10k_peer_assoc_h_ht()
2347 if (ht_cap->cap & IEEE80211_HT_CAP_TX_STBC) { in ath10k_peer_assoc_h_ht()
2348 arg->peer_rate_caps |= WMI_RC_TX_STBC_FLAG; in ath10k_peer_assoc_h_ht()
2349 arg->peer_flags |= ar->wmi.peer_flags->stbc; in ath10k_peer_assoc_h_ht()
2352 if (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC) { in ath10k_peer_assoc_h_ht()
2353 stbc = ht_cap->cap & IEEE80211_HT_CAP_RX_STBC; in ath10k_peer_assoc_h_ht()
2356 arg->peer_rate_caps |= stbc; in ath10k_peer_assoc_h_ht()
2357 arg->peer_flags |= ar->wmi.peer_flags->stbc; in ath10k_peer_assoc_h_ht()
2360 if (ht_cap->mcs.rx_mask[1] && ht_cap->mcs.rx_mask[2]) in ath10k_peer_assoc_h_ht()
2361 arg->peer_rate_caps |= WMI_RC_TS_FLAG; in ath10k_peer_assoc_h_ht()
2362 else if (ht_cap->mcs.rx_mask[1]) in ath10k_peer_assoc_h_ht()
2363 arg->peer_rate_caps |= WMI_RC_DS_FLAG; in ath10k_peer_assoc_h_ht()
2366 if ((ht_cap->mcs.rx_mask[i / 8] & BIT(i % 8)) && in ath10k_peer_assoc_h_ht()
2369 arg->peer_ht_rates.rates[n++] = i; in ath10k_peer_assoc_h_ht()
2373 * This is a workaround for HT-enabled STAs which break the spec in ath10k_peer_assoc_h_ht()
2382 arg->peer_ht_rates.num_rates = 8; in ath10k_peer_assoc_h_ht()
2383 for (i = 0; i < arg->peer_ht_rates.num_rates; i++) in ath10k_peer_assoc_h_ht()
2384 arg->peer_ht_rates.rates[i] = i; in ath10k_peer_assoc_h_ht()
2386 arg->peer_ht_rates.num_rates = n; in ath10k_peer_assoc_h_ht()
2387 arg->peer_num_spatial_streams = min(sta->rx_nss, max_nss); in ath10k_peer_assoc_h_ht()
2391 arg->addr, in ath10k_peer_assoc_h_ht()
2392 arg->peer_ht_rates.num_rates, in ath10k_peer_assoc_h_ht()
2393 arg->peer_num_spatial_streams); in ath10k_peer_assoc_h_ht()
2404 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_qos_ap()
2406 if (sta->wme && sta->uapsd_queues) { in ath10k_peer_assoc_qos_ap()
2408 sta->uapsd_queues, sta->max_sp); in ath10k_peer_assoc_qos_ap()
2410 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) in ath10k_peer_assoc_qos_ap()
2413 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VI) in ath10k_peer_assoc_qos_ap()
2416 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BK) in ath10k_peer_assoc_qos_ap()
2419 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BE) in ath10k_peer_assoc_qos_ap()
2423 if (sta->max_sp < MAX_WMI_AP_PS_PEER_PARAM_MAX_SP) in ath10k_peer_assoc_qos_ap()
2424 max_sp = sta->max_sp; in ath10k_peer_assoc_qos_ap()
2426 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, in ath10k_peer_assoc_qos_ap()
2427 sta->addr, in ath10k_peer_assoc_qos_ap()
2432 arvif->vdev_id, ret); in ath10k_peer_assoc_qos_ap()
2436 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, in ath10k_peer_assoc_qos_ap()
2437 sta->addr, in ath10k_peer_assoc_qos_ap()
2441 ath10k_warn(ar, "failed to set ap ps peer param max sp for vdev %i: %d\n", in ath10k_peer_assoc_qos_ap()
2442 arvif->vdev_id, ret); in ath10k_peer_assoc_qos_ap()
2448 * sta->listen_interval - mac80211 patch required. in ath10k_peer_assoc_qos_ap()
2451 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, sta->addr, in ath10k_peer_assoc_qos_ap()
2456 arvif->vdev_id, ret); in ath10k_peer_assoc_qos_ap()
2478 idx_limit = fls(mcs_map) - 1; in ath10k_peer_assoc_h_vht_limit()
2480 idx_limit = -1; in ath10k_peer_assoc_h_vht_limit()
2494 case -1: in ath10k_peer_assoc_h_vht_limit()
2544 const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; in ath10k_peer_assoc_h_vht()
2545 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_vht()
2546 struct ath10k_hw_params *hw = &ar->hw_params; in ath10k_peer_assoc_h_vht()
2557 if (!vht_cap->vht_supported) in ath10k_peer_assoc_h_vht()
2560 band = def.chan->band; in ath10k_peer_assoc_h_vht()
2561 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_peer_assoc_h_vht()
2566 arg->peer_flags |= ar->wmi.peer_flags->vht; in ath10k_peer_assoc_h_vht()
2568 if (def.chan->band == NL80211_BAND_2GHZ) in ath10k_peer_assoc_h_vht()
2569 arg->peer_flags |= ar->wmi.peer_flags->vht_2g; in ath10k_peer_assoc_h_vht()
2571 arg->peer_vht_caps = vht_cap->cap; in ath10k_peer_assoc_h_vht()
2573 ampdu_factor = (vht_cap->cap & in ath10k_peer_assoc_h_vht()
2577 /* Workaround: Some Netgear/Linksys 11ac APs set Rx A-MPDU factor to in ath10k_peer_assoc_h_vht()
2579 * arg->peer_max_mpdu at this point contains HT max_mpdu so keep in ath10k_peer_assoc_h_vht()
2582 arg->peer_max_mpdu = max(arg->peer_max_mpdu, in ath10k_peer_assoc_h_vht()
2584 ampdu_factor)) - 1); in ath10k_peer_assoc_h_vht()
2586 if (sta->bandwidth == IEEE80211_STA_RX_BW_80) in ath10k_peer_assoc_h_vht()
2587 arg->peer_flags |= ar->wmi.peer_flags->bw80; in ath10k_peer_assoc_h_vht()
2589 if (sta->bandwidth == IEEE80211_STA_RX_BW_160) in ath10k_peer_assoc_h_vht()
2590 arg->peer_flags |= ar->wmi.peer_flags->bw160; in ath10k_peer_assoc_h_vht()
2596 vht_mcs = __le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map) >> in ath10k_peer_assoc_h_vht()
2603 arg->peer_num_spatial_streams = min(sta->rx_nss, max_nss); in ath10k_peer_assoc_h_vht()
2604 arg->peer_vht_rates.rx_max_rate = in ath10k_peer_assoc_h_vht()
2605 __le16_to_cpu(vht_cap->vht_mcs.rx_highest); in ath10k_peer_assoc_h_vht()
2606 arg->peer_vht_rates.rx_mcs_set = in ath10k_peer_assoc_h_vht()
2607 __le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map); in ath10k_peer_assoc_h_vht()
2608 arg->peer_vht_rates.tx_max_rate = in ath10k_peer_assoc_h_vht()
2609 __le16_to_cpu(vht_cap->vht_mcs.tx_highest); in ath10k_peer_assoc_h_vht()
2610 arg->peer_vht_rates.tx_mcs_set = ath10k_peer_assoc_h_vht_limit( in ath10k_peer_assoc_h_vht()
2611 __le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); in ath10k_peer_assoc_h_vht()
2613 /* Configure bandwidth-NSS mapping to FW in ath10k_peer_assoc_h_vht()
2616 if (arg->peer_phymode == MODE_11AC_VHT160 || in ath10k_peer_assoc_h_vht()
2617 arg->peer_phymode == MODE_11AC_VHT80_80) { in ath10k_peer_assoc_h_vht()
2621 max_rate = arg->peer_vht_rates.rx_max_rate; in ath10k_peer_assoc_h_vht()
2625 rx_nss = arg->peer_num_spatial_streams; in ath10k_peer_assoc_h_vht()
2627 rx_nss = min(arg->peer_num_spatial_streams, rx_nss); in ath10k_peer_assoc_h_vht()
2629 max_rate = hw->vht160_mcs_tx_highest; in ath10k_peer_assoc_h_vht()
2632 arg->peer_bw_rxnss_override = in ath10k_peer_assoc_h_vht()
2634 FIELD_PREP(WMI_PEER_NSS_160MHZ_MASK, (rx_nss - 1)); in ath10k_peer_assoc_h_vht()
2636 if (arg->peer_phymode == MODE_11AC_VHT80_80) { in ath10k_peer_assoc_h_vht()
2637 arg->peer_bw_rxnss_override |= in ath10k_peer_assoc_h_vht()
2638 FIELD_PREP(WMI_PEER_NSS_80_80MHZ_MASK, (rx_nss - 1)); in ath10k_peer_assoc_h_vht()
2643 sta->addr, arg->peer_max_mpdu, in ath10k_peer_assoc_h_vht()
2644 arg->peer_flags, arg->peer_bw_rxnss_override); in ath10k_peer_assoc_h_vht()
2652 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_qos()
2654 switch (arvif->vdev_type) { in ath10k_peer_assoc_h_qos()
2656 if (sta->wme) in ath10k_peer_assoc_h_qos()
2657 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2659 if (sta->wme && sta->uapsd_queues) { in ath10k_peer_assoc_h_qos()
2660 arg->peer_flags |= arvif->ar->wmi.peer_flags->apsd; in ath10k_peer_assoc_h_qos()
2661 arg->peer_rate_caps |= WMI_RC_UAPSD_FLAG; in ath10k_peer_assoc_h_qos()
2665 if (sta->wme) in ath10k_peer_assoc_h_qos()
2666 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2669 if (sta->wme) in ath10k_peer_assoc_h_qos()
2670 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2677 sta->addr, !!(arg->peer_flags & in ath10k_peer_assoc_h_qos()
2678 arvif->ar->wmi.peer_flags->qos)); in ath10k_peer_assoc_h_qos()
2683 return sta->supp_rates[NL80211_BAND_2GHZ] >> in ath10k_mac_sta_has_ofdm_only()
2690 if (sta->bandwidth == IEEE80211_STA_RX_BW_160) { in ath10k_mac_get_phymode_vht()
2691 switch (sta->vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) { in ath10k_mac_get_phymode_vht()
2702 if (sta->bandwidth == IEEE80211_STA_RX_BW_80) in ath10k_mac_get_phymode_vht()
2705 if (sta->bandwidth == IEEE80211_STA_RX_BW_40) in ath10k_mac_get_phymode_vht()
2708 if (sta->bandwidth == IEEE80211_STA_RX_BW_20) in ath10k_mac_get_phymode_vht()
2719 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_peer_assoc_h_phymode()
2729 band = def.chan->band; in ath10k_peer_assoc_h_phymode()
2730 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath10k_peer_assoc_h_phymode()
2731 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_peer_assoc_h_phymode()
2735 if (sta->vht_cap.vht_supported && in ath10k_peer_assoc_h_phymode()
2737 if (sta->bandwidth == IEEE80211_STA_RX_BW_40) in ath10k_peer_assoc_h_phymode()
2741 } else if (sta->ht_cap.ht_supported && in ath10k_peer_assoc_h_phymode()
2743 if (sta->bandwidth == IEEE80211_STA_RX_BW_40) in ath10k_peer_assoc_h_phymode()
2758 if (sta->vht_cap.vht_supported && in ath10k_peer_assoc_h_phymode()
2761 } else if (sta->ht_cap.ht_supported && in ath10k_peer_assoc_h_phymode()
2763 if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) in ath10k_peer_assoc_h_phymode()
2777 sta->addr, ath10k_wmi_phymode_str(phymode)); in ath10k_peer_assoc_h_phymode()
2779 arg->peer_phymode = phymode; in ath10k_peer_assoc_h_phymode()
2788 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_prepare()
2816 if (!ht_cap->ht_supported) in ath10k_setup_peer_smps()
2819 smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS; in ath10k_setup_peer_smps()
2823 return -EINVAL; in ath10k_setup_peer_smps()
2825 return ath10k_wmi_peer_set_param(ar, arvif->vdev_id, addr, in ath10k_setup_peer_smps()
2826 ar->wmi.peer_param->smps_state, in ath10k_setup_peer_smps()
2834 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_vif_recalc_txbf()
2842 if (!(ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2849 param = ar->wmi.vdev_param->txbf; in ath10k_mac_vif_recalc_txbf()
2859 if (ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2869 if (ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2885 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, value); in ath10k_mac_vif_recalc_txbf()
2899 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_mac_is_connected()
2900 if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath10k_mac_is_connected()
2914 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_txpower_setup()
2922 if (connected && ar->tx_power_2g_limit) in ath10k_mac_txpower_setup()
2923 if (tx_power_2g > ar->tx_power_2g_limit) in ath10k_mac_txpower_setup()
2924 tx_power_2g = ar->tx_power_2g_limit; in ath10k_mac_txpower_setup()
2926 if (connected && ar->tx_power_5g_limit) in ath10k_mac_txpower_setup()
2927 if (tx_power_5g > ar->tx_power_5g_limit) in ath10k_mac_txpower_setup()
2928 tx_power_5g = ar->tx_power_5g_limit; in ath10k_mac_txpower_setup()
2933 param = ar->wmi.pdev_param->txpower_limit2g; in ath10k_mac_txpower_setup()
2941 param = ar->wmi.pdev_param->txpower_limit5g; in ath10k_mac_txpower_setup()
2955 int ret, txpower = -1; in ath10k_mac_txpower_recalc()
2957 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_txpower_recalc()
2959 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_mac_txpower_recalc()
2961 if (arvif->txpower == INT_MIN) in ath10k_mac_txpower_recalc()
2964 if (txpower == -1) in ath10k_mac_txpower_recalc()
2965 txpower = arvif->txpower; in ath10k_mac_txpower_recalc()
2967 txpower = min(txpower, arvif->txpower); in ath10k_mac_txpower_recalc()
2970 if (txpower == -1) in ath10k_mac_txpower_recalc()
2985 if (!ar->hw_params.dynamic_sar_support) in ath10k_mac_set_sar_power()
2986 return -EOPNOTSUPP; in ath10k_mac_set_sar_power()
2991 /* if connected, then arvif->txpower must be valid */ in ath10k_mac_set_sar_power()
2999 struct ath10k *ar = hw->priv; in ath10k_mac_set_sar_specs()
3003 mutex_lock(&ar->conf_mutex); in ath10k_mac_set_sar_specs()
3005 if (!ar->hw_params.dynamic_sar_support) { in ath10k_mac_set_sar_specs()
3006 ret = -EOPNOTSUPP; in ath10k_mac_set_sar_specs()
3010 if (!sar || sar->type != NL80211_SAR_TYPE_POWER || in ath10k_mac_set_sar_specs()
3011 sar->num_sub_specs == 0) { in ath10k_mac_set_sar_specs()
3012 ret = -EINVAL; in ath10k_mac_set_sar_specs()
3016 sub_specs = sar->sub_specs; in ath10k_mac_set_sar_specs()
3021 ar->tx_power_2g_limit = 0; in ath10k_mac_set_sar_specs()
3022 ar->tx_power_5g_limit = 0; in ath10k_mac_set_sar_specs()
3027 for (i = 0; i < sar->num_sub_specs; i++) { in ath10k_mac_set_sar_specs()
3028 if (sub_specs->freq_range_index == 0) in ath10k_mac_set_sar_specs()
3029 ar->tx_power_2g_limit = sub_specs->power / 2; in ath10k_mac_set_sar_specs()
3030 else if (sub_specs->freq_range_index == 1) in ath10k_mac_set_sar_specs()
3031 ar->tx_power_5g_limit = sub_specs->power / 2; in ath10k_mac_set_sar_specs()
3043 mutex_unlock(&ar->conf_mutex); in ath10k_mac_set_sar_specs()
3052 struct ath10k *ar = hw->priv; in ath10k_bss_assoc()
3053 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_bss_assoc()
3060 lockdep_assert_held(&ar->conf_mutex); in ath10k_bss_assoc()
3063 arvif->vdev_id, arvif->bssid, arvif->aid); in ath10k_bss_assoc()
3067 ap_sta = ieee80211_find_sta(vif, bss_conf->bssid); in ath10k_bss_assoc()
3070 bss_conf->bssid, arvif->vdev_id); in ath10k_bss_assoc()
3078 ht_cap = ap_sta->ht_cap; in ath10k_bss_assoc()
3079 vht_cap = ap_sta->vht_cap; in ath10k_bss_assoc()
3084 bss_conf->bssid, arvif->vdev_id, ret); in ath10k_bss_assoc()
3094 bss_conf->bssid, arvif->vdev_id, ret); in ath10k_bss_assoc()
3098 ret = ath10k_setup_peer_smps(ar, arvif, bss_conf->bssid, &ht_cap); in ath10k_bss_assoc()
3101 arvif->vdev_id, ret); in ath10k_bss_assoc()
3108 arvif->vdev_id, bss_conf->bssid, ret); in ath10k_bss_assoc()
3114 arvif->vdev_id, bss_conf->bssid, bss_conf->aid); in ath10k_bss_assoc()
3116 WARN_ON(arvif->is_up); in ath10k_bss_assoc()
3118 arvif->aid = bss_conf->aid; in ath10k_bss_assoc()
3119 ether_addr_copy(arvif->bssid, bss_conf->bssid); in ath10k_bss_assoc()
3122 ar->wmi.pdev_param->peer_stats_info_enable, 1); in ath10k_bss_assoc()
3126 ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid); in ath10k_bss_assoc()
3129 arvif->vdev_id, ret); in ath10k_bss_assoc()
3133 arvif->is_up = true; in ath10k_bss_assoc()
3138 * WLAN.RM.2.0-00073) have buggy powersave state machine and must be in ath10k_bss_assoc()
3141 ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, arvif->bssid, in ath10k_bss_assoc()
3142 ar->wmi.peer_param->dummy_var, 1); in ath10k_bss_assoc()
3145 arvif->bssid, arvif->vdev_id, ret); in ath10k_bss_assoc()
3153 struct ath10k *ar = hw->priv; in ath10k_bss_disassoc()
3154 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_bss_disassoc()
3158 lockdep_assert_held(&ar->conf_mutex); in ath10k_bss_disassoc()
3161 arvif->vdev_id, arvif->bssid); in ath10k_bss_disassoc()
3163 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_bss_disassoc()
3166 arvif->vdev_id, ret); in ath10k_bss_disassoc()
3168 arvif->def_wep_key_idx = -1; in ath10k_bss_disassoc()
3173 arvif->vdev_id, ret); in ath10k_bss_disassoc()
3177 arvif->is_up = false; in ath10k_bss_disassoc()
3181 cancel_delayed_work_sync(&arvif->connection_loss_work); in ath10k_bss_disassoc()
3189 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_new_peer_tid_config()
3195 if (arvif->retry_long[i] || arvif->ampdu[i] || in ath10k_new_peer_tid_config()
3196 arvif->rate_ctrl[i] || arvif->rtscts[i]) { in ath10k_new_peer_tid_config()
3199 arg.vdev_id = arvif->vdev_id; in ath10k_new_peer_tid_config()
3200 arg.retry_count = arvif->retry_long[i]; in ath10k_new_peer_tid_config()
3201 arg.aggr_control = arvif->ampdu[i]; in ath10k_new_peer_tid_config()
3202 arg.rate_ctrl = arvif->rate_ctrl[i]; in ath10k_new_peer_tid_config()
3203 arg.rcode_flags = arvif->rate_code[i]; in ath10k_new_peer_tid_config()
3205 if (arvif->rtscts[i]) in ath10k_new_peer_tid_config()
3211 arg.rtscts_ctrl = arvif->rtscts[i]; in ath10k_new_peer_tid_config()
3214 if (arvif->noack[i]) { in ath10k_new_peer_tid_config()
3215 arg.ack_policy = arvif->noack[i]; in ath10k_new_peer_tid_config()
3221 /* Assign default value(-1) to newly connected station. in ath10k_new_peer_tid_config()
3225 arsta->retry_long[i] = -1; in ath10k_new_peer_tid_config()
3226 arsta->noack[i] = -1; in ath10k_new_peer_tid_config()
3227 arsta->ampdu[i] = -1; in ath10k_new_peer_tid_config()
3232 ether_addr_copy(arg.peer_macaddr.addr, sta->addr); in ath10k_new_peer_tid_config()
3237 sta->addr, ret); in ath10k_new_peer_tid_config()
3252 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_station_assoc()
3256 lockdep_assert_held(&ar->conf_mutex); in ath10k_station_assoc()
3261 sta->addr, arvif->vdev_id, ret); in ath10k_station_assoc()
3268 sta->addr, arvif->vdev_id, ret); in ath10k_station_assoc()
3272 /* Re-assoc is run only to update supported rates for given station. It in ath10k_station_assoc()
3276 ret = ath10k_setup_peer_smps(ar, arvif, sta->addr, in ath10k_station_assoc()
3277 &sta->ht_cap); in ath10k_station_assoc()
3280 arvif->vdev_id, ret); in ath10k_station_assoc()
3287 sta->addr, arvif->vdev_id, ret); in ath10k_station_assoc()
3291 if (!sta->wme) { in ath10k_station_assoc()
3292 arvif->num_legacy_stations++; in ath10k_station_assoc()
3296 arvif->vdev_id, ret); in ath10k_station_assoc()
3302 if ((arvif->def_wep_key_idx != -1) && (!sta->tdls)) { in ath10k_station_assoc()
3303 ret = ath10k_install_peer_wep_keys(arvif, sta->addr); in ath10k_station_assoc()
3306 arvif->vdev_id, ret); in ath10k_station_assoc()
3312 if (!test_bit(WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT, ar->wmi.svc_map)) in ath10k_station_assoc()
3322 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_station_disassoc()
3325 lockdep_assert_held(&ar->conf_mutex); in ath10k_station_disassoc()
3327 if (!sta->wme) { in ath10k_station_disassoc()
3328 arvif->num_legacy_stations--; in ath10k_station_disassoc()
3332 arvif->vdev_id, ret); in ath10k_station_disassoc()
3337 ret = ath10k_clear_peer_keys(arvif, sta->addr); in ath10k_station_disassoc()
3340 arvif->vdev_id, ret); in ath10k_station_disassoc()
3353 struct ieee80211_hw *hw = ar->hw; in ath10k_update_channel_list()
3364 lockdep_assert_held(&ar->conf_mutex); in ath10k_update_channel_list()
3366 bands = hw->wiphy->bands; in ath10k_update_channel_list()
3371 for (i = 0; i < bands[band]->n_channels; i++) { in ath10k_update_channel_list()
3372 if (bands[band]->channels[i].flags & in ath10k_update_channel_list()
3383 return -ENOMEM; in ath10k_update_channel_list()
3390 for (i = 0; i < bands[band]->n_channels; i++) { in ath10k_update_channel_list()
3391 channel = &bands[band]->channels[i]; in ath10k_update_channel_list()
3393 if (channel->flags & IEEE80211_CHAN_DISABLED) in ath10k_update_channel_list()
3396 ch->allow_ht = true; in ath10k_update_channel_list()
3399 ch->allow_vht = true; in ath10k_update_channel_list()
3401 ch->allow_ibss = in ath10k_update_channel_list()
3402 !(channel->flags & IEEE80211_CHAN_NO_IR); in ath10k_update_channel_list()
3404 ch->ht40plus = in ath10k_update_channel_list()
3405 !(channel->flags & IEEE80211_CHAN_NO_HT40PLUS); in ath10k_update_channel_list()
3407 ch->chan_radar = in ath10k_update_channel_list()
3408 !!(channel->flags & IEEE80211_CHAN_RADAR); in ath10k_update_channel_list()
3410 passive = channel->flags & IEEE80211_CHAN_NO_IR; in ath10k_update_channel_list()
3411 ch->passive = passive; in ath10k_update_channel_list()
3418 ch->passive |= ch->chan_radar; in ath10k_update_channel_list()
3420 ch->freq = channel->center_freq; in ath10k_update_channel_list()
3421 ch->band_center_freq1 = channel->center_freq; in ath10k_update_channel_list()
3422 ch->min_power = 0; in ath10k_update_channel_list()
3423 ch->max_power = channel->max_power * 2; in ath10k_update_channel_list()
3424 ch->max_reg_power = channel->max_reg_power * 2; in ath10k_update_channel_list()
3425 ch->max_antenna_gain = channel->max_antenna_gain * 2; in ath10k_update_channel_list()
3426 ch->reg_class_id = 0; /* FIXME */ in ath10k_update_channel_list()
3432 if (channel->band == NL80211_BAND_2GHZ) in ath10k_update_channel_list()
3433 ch->mode = MODE_11G; in ath10k_update_channel_list()
3435 ch->mode = MODE_11A; in ath10k_update_channel_list()
3437 if (WARN_ON_ONCE(ch->mode == MODE_UNKNOWN)) in ath10k_update_channel_list()
3442 ch - arg.channels, arg.n_channels, in ath10k_update_channel_list()
3443 ch->freq, ch->max_power, ch->max_reg_power, in ath10k_update_channel_list()
3444 ch->max_antenna_gain, ch->mode); in ath10k_update_channel_list()
3479 lockdep_assert_held(&ar->conf_mutex); in ath10k_regd_update()
3485 regpair = ar->ath_common.regulatory.regpair; in ath10k_regd_update()
3487 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { in ath10k_regd_update()
3488 nl_dfs_reg = ar->dfs_detector->region; in ath10k_regd_update()
3494 /* Target allows setting up per-band regdomain but ath_common provides in ath10k_regd_update()
3498 regpair->reg_domain, in ath10k_regd_update()
3499 regpair->reg_domain, /* 2ghz */ in ath10k_regd_update()
3500 regpair->reg_domain, /* 5ghz */ in ath10k_regd_update()
3501 regpair->reg_2ghz_ctl, in ath10k_regd_update()
3502 regpair->reg_5ghz_ctl, in ath10k_regd_update()
3513 if (ar->low_5ghz_chan && ar->high_5ghz_chan) { in ath10k_mac_update_channel_list()
3514 for (i = 0; i < band->n_channels; i++) { in ath10k_mac_update_channel_list()
3515 if (band->channels[i].center_freq < ar->low_5ghz_chan || in ath10k_mac_update_channel_list()
3516 band->channels[i].center_freq > ar->high_5ghz_chan) in ath10k_mac_update_channel_list()
3517 band->channels[i].flags |= in ath10k_mac_update_channel_list()
3527 struct ath10k *ar = hw->priv; in ath10k_reg_notifier()
3530 ath_reg_notifier_apply(wiphy, request, &ar->ath_common.regulatory); in ath10k_reg_notifier()
3532 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { in ath10k_reg_notifier()
3534 request->dfs_region); in ath10k_reg_notifier()
3535 result = ar->dfs_detector->set_dfs_domain(ar->dfs_detector, in ath10k_reg_notifier()
3536 request->dfs_region); in ath10k_reg_notifier()
3539 request->dfs_region); in ath10k_reg_notifier()
3542 mutex_lock(&ar->conf_mutex); in ath10k_reg_notifier()
3543 if (ar->state == ATH10K_STATE_ON) in ath10k_reg_notifier()
3545 mutex_unlock(&ar->conf_mutex); in ath10k_reg_notifier()
3547 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_reg_notifier()
3549 ar->hw->wiphy->bands[NL80211_BAND_5GHZ]); in ath10k_reg_notifier()
3554 spin_lock_bh(&ar->data_lock); in ath10k_stop_radar_confirmation()
3555 ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_STOPPED; in ath10k_stop_radar_confirmation()
3556 spin_unlock_bh(&ar->data_lock); in ath10k_stop_radar_confirmation()
3558 cancel_work_sync(&ar->radar_confirmation_work); in ath10k_stop_radar_confirmation()
3574 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_tx_lock()
3577 ar->tx_paused |= BIT(reason); in ath10k_mac_tx_lock()
3578 ieee80211_stop_queues(ar->hw); in ath10k_mac_tx_lock()
3585 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_tx_unlock_iter()
3587 if (arvif->tx_paused) in ath10k_mac_tx_unlock_iter()
3590 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_mac_tx_unlock_iter()
3595 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_tx_unlock()
3598 ar->tx_paused &= ~BIT(reason); in ath10k_mac_tx_unlock()
3600 if (ar->tx_paused) in ath10k_mac_tx_unlock()
3603 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_tx_unlock()
3608 ieee80211_wake_queue(ar->hw, ar->hw->offchannel_tx_hw_queue); in ath10k_mac_tx_unlock()
3613 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_tx_lock()
3615 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_tx_lock()
3618 arvif->tx_paused |= BIT(reason); in ath10k_mac_vif_tx_lock()
3619 ieee80211_stop_queue(ar->hw, arvif->vdev_id); in ath10k_mac_vif_tx_lock()
3624 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_tx_unlock()
3626 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_tx_unlock()
3629 arvif->tx_paused &= ~BIT(reason); in ath10k_mac_vif_tx_unlock()
3631 if (ar->tx_paused) in ath10k_mac_vif_tx_unlock()
3634 if (arvif->tx_paused) in ath10k_mac_vif_tx_unlock()
3637 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_mac_vif_tx_unlock()
3644 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_handle_tx_pause()
3646 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_handle_tx_pause()
3658 action, arvif->vdev_id); in ath10k_mac_vif_handle_tx_pause()
3672 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_handle_tx_pause_iter()
3675 if (arvif->vdev_id != arg->vdev_id) in ath10k_mac_handle_tx_pause_iter()
3678 ath10k_mac_vif_handle_tx_pause(arvif, arg->pause_id, arg->action); in ath10k_mac_handle_tx_pause_iter()
3691 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_handle_tx_pause_vdev()
3692 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_tx_pause_vdev()
3696 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_handle_tx_pause_vdev()
3705 const struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_mac_tx_h_get_txmode()
3707 __le16 fc = hdr->frame_control; in ath10k_mac_tx_h_get_txmode()
3709 if (!vif || vif->type == NL80211_IFTYPE_MONITOR) in ath10k_mac_tx_h_get_txmode()
3719 * accurate - otherwise either mac80211 or userspace (e.g. hostapd) can in ath10k_mac_tx_h_get_txmode()
3731 if (ar->htt.target_version_major < 3 && in ath10k_mac_tx_h_get_txmode()
3734 ar->running_fw->fw_file.fw_features)) in ath10k_mac_tx_h_get_txmode()
3739 * Some wmi-tlv firmwares for qca6174 have broken Tx key selection for in ath10k_mac_tx_h_get_txmode()
3740 * NativeWifi txmode - it selects AP key instead of peer key. It seems in ath10k_mac_tx_h_get_txmode()
3745 if (ieee80211_is_data_present(fc) && sta && sta->tdls) in ath10k_mac_tx_h_get_txmode()
3748 if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) || in ath10k_mac_tx_h_get_txmode()
3749 skb_cb->flags & ATH10K_SKB_F_RAW_TX) in ath10k_mac_tx_h_get_txmode()
3759 const struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_tx_h_use_hwcrypto()
3763 if (!ieee80211_has_protected(hdr->frame_control)) in ath10k_tx_h_use_hwcrypto()
3766 if ((info->flags & mask) == mask) in ath10k_tx_h_use_hwcrypto()
3770 return !((struct ath10k_vif *)vif->drv_priv)->nohwcrypt; in ath10k_tx_h_use_hwcrypto()
3780 struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_tx_h_nwifi()
3784 if (!ieee80211_is_data_qos(hdr->frame_control)) in ath10k_tx_h_nwifi()
3788 memmove(skb->data + IEEE80211_QOS_CTL_LEN, in ath10k_tx_h_nwifi()
3789 skb->data, (void *)qos_ctl - (void *)skb->data); in ath10k_tx_h_nwifi()
3796 hdr = (void *)skb->data; in ath10k_tx_h_nwifi()
3797 if (ieee80211_is_qos_nullfunc(hdr->frame_control)) in ath10k_tx_h_nwifi()
3798 cb->flags &= ~ATH10K_SKB_F_QOS; in ath10k_tx_h_nwifi()
3800 hdr->frame_control &= ~__cpu_to_le16(IEEE80211_STYPE_QOS_DATA); in ath10k_tx_h_nwifi()
3813 hdr = (void *)skb->data; in ath10k_tx_h_8023()
3814 hdrlen = ieee80211_hdrlen(hdr->frame_control); in ath10k_tx_h_8023()
3815 rfc1042 = (void *)skb->data + hdrlen; in ath10k_tx_h_8023()
3819 type = rfc1042->snap_type; in ath10k_tx_h_8023()
3824 eth = (void *)skb->data; in ath10k_tx_h_8023()
3825 ether_addr_copy(eth->h_dest, da); in ath10k_tx_h_8023()
3826 ether_addr_copy(eth->h_source, sa); in ath10k_tx_h_8023()
3827 eth->h_proto = type; in ath10k_tx_h_8023()
3834 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in ath10k_tx_h_add_p2p_noa_ie()
3835 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_tx_h_add_p2p_noa_ie()
3838 if (vif->type != NL80211_IFTYPE_AP || !vif->p2p) in ath10k_tx_h_add_p2p_noa_ie()
3841 if (unlikely(ieee80211_is_probe_resp(hdr->frame_control))) { in ath10k_tx_h_add_p2p_noa_ie()
3842 spin_lock_bh(&ar->data_lock); in ath10k_tx_h_add_p2p_noa_ie()
3843 if (arvif->u.ap.noa_data) in ath10k_tx_h_add_p2p_noa_ie()
3844 if (!pskb_expand_head(skb, 0, arvif->u.ap.noa_len, in ath10k_tx_h_add_p2p_noa_ie()
3846 skb_put_data(skb, arvif->u.ap.noa_data, in ath10k_tx_h_add_p2p_noa_ie()
3847 arvif->u.ap.noa_len); in ath10k_tx_h_add_p2p_noa_ie()
3848 spin_unlock_bh(&ar->data_lock); in ath10k_tx_h_add_p2p_noa_ie()
3858 struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_mac_tx_h_fill_cb()
3861 bool is_data = ieee80211_is_data(hdr->frame_control) || in ath10k_mac_tx_h_fill_cb()
3862 ieee80211_is_data_qos(hdr->frame_control); in ath10k_mac_tx_h_fill_cb()
3863 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_tx_h_fill_cb()
3868 cb->flags = 0; in ath10k_mac_tx_h_fill_cb()
3870 cb->flags |= ATH10K_SKB_F_NO_HWCRYPT; in ath10k_mac_tx_h_fill_cb()
3872 if (ieee80211_is_mgmt(hdr->frame_control)) in ath10k_mac_tx_h_fill_cb()
3873 cb->flags |= ATH10K_SKB_F_MGMT; in ath10k_mac_tx_h_fill_cb()
3875 if (ieee80211_is_data_qos(hdr->frame_control)) { in ath10k_mac_tx_h_fill_cb()
3876 cb->flags |= ATH10K_SKB_F_QOS; in ath10k_mac_tx_h_fill_cb()
3880 if (arvif->noack[tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_tx_h_fill_cb()
3884 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_tx_h_fill_cb()
3886 if (arsta->noack[tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_tx_h_fill_cb()
3889 if (arsta->noack[tid] == WMI_PEER_TID_CONFIG_ACK) in ath10k_mac_tx_h_fill_cb()
3894 cb->flags |= ATH10K_SKB_F_NOACK_TID; in ath10k_mac_tx_h_fill_cb()
3901 if (is_data && ieee80211_has_protected(hdr->frame_control) && in ath10k_mac_tx_h_fill_cb()
3902 !info->control.hw_key) { in ath10k_mac_tx_h_fill_cb()
3903 cb->flags |= ATH10K_SKB_F_NO_HWCRYPT; in ath10k_mac_tx_h_fill_cb()
3904 cb->flags |= ATH10K_SKB_F_RAW_TX; in ath10k_mac_tx_h_fill_cb()
3907 cb->vif = vif; in ath10k_mac_tx_h_fill_cb()
3908 cb->txq = txq; in ath10k_mac_tx_h_fill_cb()
3909 cb->airtime_est = airtime; in ath10k_mac_tx_h_fill_cb()
3911 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_tx_h_fill_cb()
3912 spin_lock_bh(&ar->data_lock); in ath10k_mac_tx_h_fill_cb()
3913 cb->ucast_cipher = arsta->ucast_cipher; in ath10k_mac_tx_h_fill_cb()
3914 spin_unlock_bh(&ar->data_lock); in ath10k_mac_tx_h_fill_cb()
3922 * offchannel tx (and actually creating them causes issues with wmi-htc in ath10k_mac_tx_frm_has_freq()
3926 return (ar->htt.target_version_major >= 3 && in ath10k_mac_tx_frm_has_freq()
3927 ar->htt.target_version_minor >= 4 && in ath10k_mac_tx_frm_has_freq()
3928 ar->running_fw->fw_file.htt_op_version == ATH10K_FW_HTT_OP_VERSION_TLV); in ath10k_mac_tx_frm_has_freq()
3933 struct sk_buff_head *q = &ar->wmi_mgmt_tx_queue; in ath10k_mac_tx_wmi_mgmt()
3937 return -ENOSPC; in ath10k_mac_tx_wmi_mgmt()
3941 ieee80211_queue_work(ar->hw, &ar->wmi_mgmt_tx_work); in ath10k_mac_tx_wmi_mgmt()
3958 ar->running_fw->fw_file.fw_features) || in ath10k_mac_tx_h_get_txpath()
3960 ar->wmi.svc_map)) in ath10k_mac_tx_h_get_txpath()
3962 else if (ar->htt.target_version_major >= 3) in ath10k_mac_tx_h_get_txpath()
3976 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_tx_submit()
3977 int ret = -EINVAL; in ath10k_mac_tx_submit()
3991 ret = -EINVAL; in ath10k_mac_tx_submit()
3998 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_tx_submit()
4013 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_tx()
4019 if (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE) in ath10k_mac_tx()
4033 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) && in ath10k_mac_tx()
4034 !(skb_cb->flags & ATH10K_SKB_F_RAW_TX)) { in ath10k_mac_tx()
4037 return -ENOTSUPP; in ath10k_mac_tx()
4041 if (!noque_offchan && info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) { in ath10k_mac_tx()
4044 skb, skb->len); in ath10k_mac_tx()
4046 skb_queue_tail(&ar->offchan_tx_queue, skb); in ath10k_mac_tx()
4047 ieee80211_queue_work(hw, &ar->offchan_tx_work); in ath10k_mac_tx()
4066 skb = skb_dequeue(&ar->offchan_tx_queue); in ath10k_offchan_tx_purge()
4070 ieee80211_free_txskb(ar->hw, skb); in ath10k_offchan_tx_purge()
4100 skb = skb_dequeue(&ar->offchan_tx_queue); in ath10k_offchan_tx_work()
4104 mutex_lock(&ar->conf_mutex); in ath10k_offchan_tx_work()
4107 skb, skb->len); in ath10k_offchan_tx_work()
4109 hdr = (struct ieee80211_hdr *)skb->data; in ath10k_offchan_tx_work()
4112 spin_lock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4113 vdev_id = ar->scan.vdev_id; in ath10k_offchan_tx_work()
4115 spin_unlock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4131 spin_lock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4132 reinit_completion(&ar->offchan_tx_completed); in ath10k_offchan_tx_work()
4133 ar->offchan_tx_skb = skb; in ath10k_offchan_tx_work()
4134 spin_unlock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4136 /* It's safe to access vif and sta - conf_mutex guarantees that in ath10k_offchan_tx_work()
4142 vif = arvif->vif; in ath10k_offchan_tx_work()
4160 wait_for_completion_timeout(&ar->offchan_tx_completed, 3 * HZ); in ath10k_offchan_tx_work()
4163 skb, skb->len); in ath10k_offchan_tx_work()
4172 mutex_unlock(&ar->conf_mutex); in ath10k_offchan_tx_work()
4181 skb = skb_dequeue(&ar->wmi_mgmt_tx_queue); in ath10k_mgmt_over_wmi_tx_purge()
4185 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_purge()
4197 skb = skb_dequeue(&ar->wmi_mgmt_tx_queue); in ath10k_mgmt_over_wmi_tx_work()
4202 ar->running_fw->fw_file.fw_features)) { in ath10k_mgmt_over_wmi_tx_work()
4203 paddr = dma_map_single(ar->dev, skb->data, in ath10k_mgmt_over_wmi_tx_work()
4204 skb->len, DMA_TO_DEVICE); in ath10k_mgmt_over_wmi_tx_work()
4205 if (dma_mapping_error(ar->dev, paddr)) { in ath10k_mgmt_over_wmi_tx_work()
4206 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4216 dma_unmap_single(ar->dev, paddr, skb->len, in ath10k_mgmt_over_wmi_tx_work()
4218 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4225 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4238 artxq = (void *)txq->drv_priv; in ath10k_mac_txq_init()
4239 INIT_LIST_HEAD(&artxq->list); in ath10k_mac_txq_init()
4251 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_txq_unref()
4252 idr_for_each_entry(&ar->htt.pending_tx, msdu, msdu_id) { in ath10k_mac_txq_unref()
4254 if (cb->txq == txq) in ath10k_mac_txq_unref()
4255 cb->txq = NULL; in ath10k_mac_txq_unref()
4257 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_txq_unref()
4266 lockdep_assert_held(&ar->data_lock); in ath10k_mac_txq_lookup()
4268 peer = ar->peer_map[peer_id]; in ath10k_mac_txq_lookup()
4272 if (peer->removed) in ath10k_mac_txq_lookup()
4275 if (peer->sta) in ath10k_mac_txq_lookup()
4276 return peer->sta->txq[tid]; in ath10k_mac_txq_lookup()
4277 else if (peer->vif) in ath10k_mac_txq_lookup()
4278 return peer->vif->txq; in ath10k_mac_txq_lookup()
4286 struct ath10k *ar = hw->priv; in ath10k_mac_tx_can_push()
4287 struct ath10k_txq *artxq = (void *)txq->drv_priv; in ath10k_mac_tx_can_push()
4290 if (ar->htt.tx_q_state.mode == HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_tx_can_push()
4293 if (ar->htt.num_pending_tx < ar->htt.tx_q_state.num_push_allowed) in ath10k_mac_tx_can_push()
4296 if (artxq->num_fw_queued < artxq->num_push_allowed) in ath10k_mac_tx_can_push()
4318 if (!txq || !txq->sta) in ath10k_mac_update_airtime()
4321 if (test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map)) in ath10k_mac_update_airtime()
4324 spin_lock_bh(&ar->data_lock); in ath10k_mac_update_airtime()
4325 arsta = (struct ath10k_sta *)txq->sta->drv_priv; in ath10k_mac_update_airtime()
4327 pktlen = skb->len + 38; /* Assume MAC header 30, SNAP 8 for most case */ in ath10k_mac_update_airtime()
4328 if (arsta->last_tx_bitrate) { in ath10k_mac_update_airtime()
4331 / arsta->last_tx_bitrate; in ath10k_mac_update_airtime()
4343 spin_unlock_bh(&ar->data_lock); in ath10k_mac_update_airtime()
4351 struct ath10k *ar = hw->priv; in ath10k_mac_tx_push_txq()
4352 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_tx_push_txq()
4353 struct ath10k_txq *artxq = (void *)txq->drv_priv; in ath10k_mac_tx_push_txq()
4354 struct ieee80211_vif *vif = txq->vif; in ath10k_mac_tx_push_txq()
4355 struct ieee80211_sta *sta = txq->sta; in ath10k_mac_tx_push_txq()
4365 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4367 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4374 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4376 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4378 return -ENOENT; in ath10k_mac_tx_push_txq()
4384 skb_len = skb->len; in ath10k_mac_tx_push_txq()
4390 hdr = (struct ieee80211_hdr *)skb->data; in ath10k_mac_tx_push_txq()
4391 is_presp = ieee80211_is_probe_resp(hdr->frame_control); in ath10k_mac_tx_push_txq()
4393 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()
4401 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4408 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4412 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4417 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4418 artxq->num_fw_queued++; in ath10k_mac_tx_push_txq()
4419 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4438 if (ret == -EBUSY) in ath10k_mac_schedule_txq()
4448 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_tx_push_pending()
4451 if (ar->htt.tx_q_state.mode != HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_tx_push_pending()
4454 if (ar->htt.num_pending_tx >= (ar->htt.max_num_pending_tx / 2)) in ath10k_mac_tx_push_pending()
4459 if (ath10k_mac_schedule_txq(hw, ac) == -EBUSY) in ath10k_mac_tx_push_pending()
4472 lockdep_assert_held(&ar->data_lock); in __ath10k_scan_finish()
4474 switch (ar->scan.state) { in __ath10k_scan_finish()
4479 if (!ar->scan.is_roc) { in __ath10k_scan_finish()
4481 .aborted = (ar->scan.state == in __ath10k_scan_finish()
4485 ieee80211_scan_completed(ar->hw, &info); in __ath10k_scan_finish()
4486 } else if (ar->scan.roc_notify) { in __ath10k_scan_finish()
4487 ieee80211_remain_on_channel_expired(ar->hw); in __ath10k_scan_finish()
4491 ar->scan.state = ATH10K_SCAN_IDLE; in __ath10k_scan_finish()
4492 ar->scan_channel = NULL; in __ath10k_scan_finish()
4493 ar->scan.roc_freq = 0; in __ath10k_scan_finish()
4495 cancel_delayed_work(&ar->scan.timeout); in __ath10k_scan_finish()
4496 complete(&ar->scan.completed); in __ath10k_scan_finish()
4503 spin_lock_bh(&ar->data_lock); in ath10k_scan_finish()
4505 spin_unlock_bh(&ar->data_lock); in ath10k_scan_finish()
4517 lockdep_assert_held(&ar->conf_mutex); in ath10k_scan_stop()
4525 ret = wait_for_completion_timeout(&ar->scan.completed, 3 * HZ); in ath10k_scan_stop()
4528 ret = -ETIMEDOUT; in ath10k_scan_stop()
4541 spin_lock_bh(&ar->data_lock); in ath10k_scan_stop()
4542 if (ar->scan.state != ATH10K_SCAN_IDLE) in ath10k_scan_stop()
4544 spin_unlock_bh(&ar->data_lock); in ath10k_scan_stop()
4553 lockdep_assert_held(&ar->conf_mutex); in ath10k_scan_abort()
4555 spin_lock_bh(&ar->data_lock); in ath10k_scan_abort()
4557 switch (ar->scan.state) { in ath10k_scan_abort()
4566 ath10k_scan_state_str(ar->scan.state), in ath10k_scan_abort()
4567 ar->scan.state); in ath10k_scan_abort()
4570 ar->scan.state = ATH10K_SCAN_ABORTING; in ath10k_scan_abort()
4571 spin_unlock_bh(&ar->data_lock); in ath10k_scan_abort()
4577 spin_lock_bh(&ar->data_lock); in ath10k_scan_abort()
4581 spin_unlock_bh(&ar->data_lock); in ath10k_scan_abort()
4589 mutex_lock(&ar->conf_mutex); in ath10k_scan_timeout_work()
4591 mutex_unlock(&ar->conf_mutex); in ath10k_scan_timeout_work()
4599 lockdep_assert_held(&ar->conf_mutex); in ath10k_start_scan()
4605 ret = wait_for_completion_timeout(&ar->scan.started, 1 * HZ); in ath10k_start_scan()
4611 return -ETIMEDOUT; in ath10k_start_scan()
4618 spin_lock_bh(&ar->data_lock); in ath10k_start_scan()
4619 if (ar->scan.state == ATH10K_SCAN_IDLE) { in ath10k_start_scan()
4620 spin_unlock_bh(&ar->data_lock); in ath10k_start_scan()
4621 return -EINVAL; in ath10k_start_scan()
4623 spin_unlock_bh(&ar->data_lock); in ath10k_start_scan()
4636 struct ath10k *ar = hw->priv; in ath10k_mac_op_tx()
4637 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_op_tx()
4639 struct ieee80211_vif *vif = info->control.vif; in ath10k_mac_op_tx()
4640 struct ieee80211_sta *sta = control->sta; in ath10k_mac_op_tx()
4642 struct ieee80211_hdr *hdr = (void *)skb->data; in ath10k_mac_op_tx()
4661 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4662 is_presp = ieee80211_is_probe_resp(hdr->frame_control); in ath10k_mac_op_tx()
4668 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4669 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_op_tx()
4678 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4679 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_op_tx()
4682 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4689 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4693 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4702 struct ath10k *ar = hw->priv; in ath10k_mac_op_wake_tx_queue()
4707 if (ar->htt.tx_q_state.mode != HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_op_wake_tx_queue()
4710 ac = txq->ac; in ath10k_mac_op_wake_tx_queue()
4730 lockdep_assert_not_held(&ar->conf_mutex); in ath10k_drain_tx()
4732 /* make sure rcu-protected mac80211 tx path itself is drained */ in ath10k_drain_tx()
4738 cancel_work_sync(&ar->offchan_tx_work); in ath10k_drain_tx()
4739 cancel_work_sync(&ar->wmi_mgmt_tx_work); in ath10k_drain_tx()
4746 lockdep_assert_held(&ar->conf_mutex); in ath10k_halt()
4748 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_halt()
4749 ar->filter_flags = 0; in ath10k_halt()
4750 ar->monitor = false; in ath10k_halt()
4751 ar->monitor_arvif = NULL; in ath10k_halt()
4753 if (ar->monitor_started) in ath10k_halt()
4756 ar->monitor_started = false; in ath10k_halt()
4757 ar->tx_paused = 0; in ath10k_halt()
4765 spin_lock_bh(&ar->data_lock); in ath10k_halt()
4766 list_for_each_entry(arvif, &ar->arvifs, list) in ath10k_halt()
4768 spin_unlock_bh(&ar->data_lock); in ath10k_halt()
4773 struct ath10k *ar = hw->priv; in ath10k_get_antenna()
4775 mutex_lock(&ar->conf_mutex); in ath10k_get_antenna()
4777 *tx_ant = ar->cfg_tx_chainmask; in ath10k_get_antenna()
4778 *rx_ant = ar->cfg_rx_chainmask; in ath10k_get_antenna()
4780 mutex_unlock(&ar->conf_mutex); in ath10k_get_antenna()
4801 int nsts = ar->vht_cap_info; in ath10k_mac_get_vht_cap_bf_sts()
4806 /* If firmware does not deliver to host number of space-time in ath10k_mac_get_vht_cap_bf_sts()
4808 * the value for VHT CAP: nsts-1) in ath10k_mac_get_vht_cap_bf_sts()
4818 int sound_dim = ar->vht_cap_info; in ath10k_mac_get_vht_cap_bf_sound_dim()
4835 struct ath10k_hw_params *hw = &ar->hw_params; in ath10k_create_vht_cap()
4841 vht_cap.cap = ar->vht_cap_info; in ath10k_create_vht_cap()
4843 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | in ath10k_create_vht_cap()
4852 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | in ath10k_create_vht_cap()
4863 if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i))) in ath10k_create_vht_cap()
4869 if (ar->cfg_tx_chainmask <= 1) in ath10k_create_vht_cap()
4877 * user-space a clue if that is the case. in ath10k_create_vht_cap()
4880 (hw->vht160_mcs_rx_highest != 0 || in ath10k_create_vht_cap()
4881 hw->vht160_mcs_tx_highest != 0)) { in ath10k_create_vht_cap()
4882 vht_cap.vht_mcs.rx_highest = cpu_to_le16(hw->vht160_mcs_rx_highest); in ath10k_create_vht_cap()
4883 vht_cap.vht_mcs.tx_highest = cpu_to_le16(hw->vht160_mcs_tx_highest); in ath10k_create_vht_cap()
4894 if (!(ar->ht_cap_info & WMI_HT_CAP_ENABLED)) in ath10k_get_ht_cap()
4905 if (ar->ht_cap_info & WMI_HT_CAP_HT20_SGI) in ath10k_get_ht_cap()
4908 if (ar->ht_cap_info & WMI_HT_CAP_HT40_SGI) in ath10k_get_ht_cap()
4911 if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) { in ath10k_get_ht_cap()
4920 if (ar->ht_cap_info & WMI_HT_CAP_TX_STBC && (ar->cfg_tx_chainmask > 1)) in ath10k_get_ht_cap()
4923 if (ar->ht_cap_info & WMI_HT_CAP_RX_STBC) { in ath10k_get_ht_cap()
4926 stbc = ar->ht_cap_info; in ath10k_get_ht_cap()
4935 if (ar->ht_cap_info & WMI_HT_CAP_LDPC || (ar->ht_cap_info & in ath10k_get_ht_cap()
4936 WMI_HT_CAP_RX_LDPC && (ar->ht_cap_info & WMI_HT_CAP_TX_LDPC))) in ath10k_get_ht_cap()
4939 if (ar->ht_cap_info & WMI_HT_CAP_L_SIG_TXOP_PROT) in ath10k_get_ht_cap()
4942 /* max AMSDU is implicitly taken from vht_cap_info */ in ath10k_get_ht_cap()
4943 if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK) in ath10k_get_ht_cap()
4946 for (i = 0; i < ar->num_rf_chains; i++) { in ath10k_get_ht_cap()
4947 if (ar->cfg_rx_chainmask & BIT(i)) in ath10k_get_ht_cap()
4965 if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) { in ath10k_mac_setup_ht_vht_cap()
4966 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath10k_mac_setup_ht_vht_cap()
4967 band->ht_cap = ht_cap; in ath10k_mac_setup_ht_vht_cap()
4969 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) { in ath10k_mac_setup_ht_vht_cap()
4970 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath10k_mac_setup_ht_vht_cap()
4971 band->ht_cap = ht_cap; in ath10k_mac_setup_ht_vht_cap()
4972 band->vht_cap = vht_cap; in ath10k_mac_setup_ht_vht_cap()
4981 lockdep_assert_held(&ar->conf_mutex); in __ath10k_set_antenna()
4987 return -EINVAL; in __ath10k_set_antenna()
4989 ar->cfg_tx_chainmask = tx_ant; in __ath10k_set_antenna()
4990 ar->cfg_rx_chainmask = rx_ant; in __ath10k_set_antenna()
4992 if ((ar->state != ATH10K_STATE_ON) && in __ath10k_set_antenna()
4993 (ar->state != ATH10K_STATE_RESTARTED)) in __ath10k_set_antenna()
4996 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->tx_chain_mask, in __ath10k_set_antenna()
4999 ath10k_warn(ar, "failed to set tx-chainmask: %d, req 0x%x\n", in __ath10k_set_antenna()
5004 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->rx_chain_mask, in __ath10k_set_antenna()
5007 ath10k_warn(ar, "failed to set rx-chainmask: %d, req 0x%x\n", in __ath10k_set_antenna()
5020 struct ath10k *ar = hw->priv; in ath10k_set_antenna()
5023 mutex_lock(&ar->conf_mutex); in ath10k_set_antenna()
5025 mutex_unlock(&ar->conf_mutex); in ath10k_set_antenna()
5036 node = ar->dev->of_node; in __ath10k_fetch_bb_timing_dt()
5038 return -ENOENT; in __ath10k_fetch_bb_timing_dt()
5040 ret = of_property_read_string_index(node, "ext-fem-name", 0, &fem_name); in __ath10k_fetch_bb_timing_dt()
5042 return -ENOENT; in __ath10k_fetch_bb_timing_dt()
5049 if (!strcmp("microsemi-lx5586", fem_name)) { in __ath10k_fetch_bb_timing_dt()
5050 bb_timing->bb_tx_timing = 0x00; in __ath10k_fetch_bb_timing_dt()
5051 bb_timing->bb_xpa_timing = 0x0101; in __ath10k_fetch_bb_timing_dt()
5053 return -ENOENT; in __ath10k_fetch_bb_timing_dt()
5057 bb_timing->bb_tx_timing, bb_timing->bb_xpa_timing); in __ath10k_fetch_bb_timing_dt()
5066 if (ar->hw_values->rfkill_pin == 0) { in ath10k_mac_rfkill_config()
5068 return -EOPNOTSUPP; in ath10k_mac_rfkill_config()
5073 ar->hw_values->rfkill_pin, ar->hw_values->rfkill_cfg, in ath10k_mac_rfkill_config()
5074 ar->hw_values->rfkill_on_level); in ath10k_mac_rfkill_config()
5077 ar->hw_values->rfkill_on_level) | in ath10k_mac_rfkill_config()
5079 ar->hw_values->rfkill_pin) | in ath10k_mac_rfkill_config()
5081 ar->hw_values->rfkill_cfg); in ath10k_mac_rfkill_config()
5084 ar->wmi.pdev_param->rfkill_config, in ath10k_mac_rfkill_config()
5107 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->rfkill_enable, in ath10k_mac_rfkill_enable_radio()
5120 struct ath10k *ar = hw->priv; in ath10k_start()
5132 mutex_lock(&ar->conf_mutex); in ath10k_start()
5134 switch (ar->state) { in ath10k_start()
5136 ar->state = ATH10K_STATE_ON; in ath10k_start()
5139 ar->state = ATH10K_STATE_RESTARTED; in ath10k_start()
5145 ret = -EINVAL; in ath10k_start()
5148 ret = -EBUSY; in ath10k_start()
5152 spin_lock_bh(&ar->data_lock); in ath10k_start()
5154 if (ar->hw_rfkill_on) { in ath10k_start()
5155 ar->hw_rfkill_on = false; in ath10k_start()
5156 spin_unlock_bh(&ar->data_lock); in ath10k_start()
5160 spin_unlock_bh(&ar->data_lock); in ath10k_start()
5169 &ar->normal_mode_fw); in ath10k_start()
5175 if (ar->sys_cap_info & WMI_TLV_SYS_CAP_INFO_RFKILL) { in ath10k_start()
5177 if (ret && ret != -EOPNOTSUPP) { in ath10k_start()
5183 param = ar->wmi.pdev_param->pmf_qos; in ath10k_start()
5190 param = ar->wmi.pdev_param->dynamic_bw; in ath10k_start()
5197 if (test_bit(WMI_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi.svc_map)) { in ath10k_start()
5198 ret = ath10k_wmi_scan_prob_req_oui(ar, ar->mac_addr); in ath10k_start()
5205 if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar->wmi.svc_map)) { in ath10k_start()
5214 if (test_bit(WMI_SERVICE_BURST, ar->wmi.svc_map)) { in ath10k_start()
5215 param = ar->wmi.pdev_param->burst_enable; in ath10k_start()
5223 param = ar->wmi.pdev_param->idle_ps_config; in ath10k_start()
5225 if (ret && ret != -EOPNOTSUPP) { in ath10k_start()
5230 __ath10k_set_antenna(ar, ar->cfg_tx_chainmask, ar->cfg_rx_chainmask); in ath10k_start()
5241 param = ar->wmi.pdev_param->arp_ac_override; in ath10k_start()
5250 ar->running_fw->fw_file.fw_features)) { in ath10k_start()
5261 param = ar->wmi.pdev_param->ani_enable; in ath10k_start()
5269 ar->ani_enabled = true; in ath10k_start()
5272 param = ar->wmi.pdev_param->peer_stats_update_period; in ath10k_start()
5283 param = ar->wmi.pdev_param->enable_btcoex; in ath10k_start()
5284 if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map) && in ath10k_start()
5286 ar->running_fw->fw_file.fw_features) && in ath10k_start()
5287 ar->coex_support) { in ath10k_start()
5294 clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); in ath10k_start()
5297 if (test_bit(WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT, ar->wmi.svc_map)) { in ath10k_start()
5310 ar->num_started_vdevs = 0; in ath10k_start()
5316 ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_IDLE; in ath10k_start()
5318 mutex_unlock(&ar->conf_mutex); in ath10k_start()
5328 ar->state = ATH10K_STATE_OFF; in ath10k_start()
5331 mutex_unlock(&ar->conf_mutex); in ath10k_start()
5337 struct ath10k *ar = hw->priv; in ath10k_stop()
5341 mutex_lock(&ar->conf_mutex); in ath10k_stop()
5342 if (ar->state != ATH10K_STATE_OFF) { in ath10k_stop()
5343 if (!ar->hw_rfkill_on) in ath10k_stop()
5345 ar->state = ATH10K_STATE_OFF; in ath10k_stop()
5347 mutex_unlock(&ar->conf_mutex); in ath10k_stop()
5349 cancel_work_sync(&ar->set_coverage_class_work); in ath10k_stop()
5350 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_stop()
5351 cancel_work_sync(&ar->restart_work); in ath10k_stop()
5359 lockdep_assert_held(&ar->conf_mutex); in ath10k_config_ps()
5361 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_config_ps()
5374 struct ath10k *ar = hw->priv; in ath10k_config()
5375 struct ieee80211_conf *conf = &hw->conf; in ath10k_config()
5378 mutex_lock(&ar->conf_mutex); in ath10k_config()
5384 ar->monitor = conf->flags & IEEE80211_CONF_MONITOR; in ath10k_config()
5390 mutex_unlock(&ar->conf_mutex); in ath10k_config()
5408 struct ath10k *ar = arvif->ar; in ath10k_mac_set_txbf_conf()
5416 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | in ath10k_mac_set_txbf_conf()
5421 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | in ath10k_mac_set_txbf_conf()
5428 if (ar->vht_cap_info & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE) in ath10k_mac_set_txbf_conf()
5431 if (ar->vht_cap_info & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE) in ath10k_mac_set_txbf_conf()
5435 if (ar->vht_cap_info & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE) in ath10k_mac_set_txbf_conf()
5438 if (ar->vht_cap_info & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE) in ath10k_mac_set_txbf_conf()
5442 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_mac_set_txbf_conf()
5443 ar->wmi.vdev_param->txbf, value); in ath10k_mac_set_txbf_conf()
5456 struct ath10k *ar = hw->priv; in ath10k_add_interface()
5457 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_add_interface()
5466 vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; in ath10k_add_interface()
5468 mutex_lock(&ar->conf_mutex); in ath10k_add_interface()
5471 ath10k_mac_txq_init(vif->txq); in ath10k_add_interface()
5473 arvif->ar = ar; in ath10k_add_interface()
5474 arvif->vif = vif; in ath10k_add_interface()
5476 INIT_LIST_HEAD(&arvif->list); in ath10k_add_interface()
5477 INIT_WORK(&arvif->ap_csa_work, ath10k_mac_vif_ap_csa_work); in ath10k_add_interface()
5478 INIT_DELAYED_WORK(&arvif->connection_loss_work, in ath10k_add_interface()
5481 for (i = 0; i < ARRAY_SIZE(arvif->bitrate_mask.control); i++) { in ath10k_add_interface()
5482 arvif->bitrate_mask.control[i].legacy = 0xffffffff; in ath10k_add_interface()
5483 memset(arvif->bitrate_mask.control[i].ht_mcs, 0xff, in ath10k_add_interface()
5484 sizeof(arvif->bitrate_mask.control[i].ht_mcs)); in ath10k_add_interface()
5485 memset(arvif->bitrate_mask.control[i].vht_mcs, 0xff, in ath10k_add_interface()
5486 sizeof(arvif->bitrate_mask.control[i].vht_mcs)); in ath10k_add_interface()
5489 if (ar->num_peers >= ar->max_num_peers) { in ath10k_add_interface()
5491 ret = -ENOBUFS; in ath10k_add_interface()
5495 if (ar->free_vdev_map == 0) { in ath10k_add_interface()
5497 ret = -EBUSY; in ath10k_add_interface()
5500 bit = __ffs64(ar->free_vdev_map); in ath10k_add_interface()
5503 bit, ar->free_vdev_map); in ath10k_add_interface()
5505 arvif->vdev_id = bit; in ath10k_add_interface()
5506 arvif->vdev_subtype = in ath10k_add_interface()
5509 switch (vif->type) { in ath10k_add_interface()
5511 arvif->vdev_type = WMI_VDEV_TYPE_STA; in ath10k_add_interface()
5512 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5517 arvif->vdev_type = WMI_VDEV_TYPE_STA; in ath10k_add_interface()
5518 if (vif->p2p) in ath10k_add_interface()
5519 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5523 arvif->vdev_type = WMI_VDEV_TYPE_IBSS; in ath10k_add_interface()
5526 if (test_bit(WMI_SERVICE_MESH_11S, ar->wmi.svc_map)) { in ath10k_add_interface()
5527 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5529 } else if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { in ath10k_add_interface()
5530 ret = -EINVAL; in ath10k_add_interface()
5534 arvif->vdev_type = WMI_VDEV_TYPE_AP; in ath10k_add_interface()
5537 arvif->vdev_type = WMI_VDEV_TYPE_AP; in ath10k_add_interface()
5539 if (vif->p2p) in ath10k_add_interface()
5540 arvif->vdev_subtype = ath10k_wmi_get_vdev_subtype in ath10k_add_interface()
5544 arvif->vdev_type = WMI_VDEV_TYPE_MONITOR; in ath10k_add_interface()
5551 /* Using vdev_id as queue number will make it very easy to do per-vif in ath10k_add_interface()
5556 vif->cab_queue = arvif->vdev_id % (IEEE80211_MAX_QUEUES - 1); in ath10k_add_interface()
5557 for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++) in ath10k_add_interface()
5558 vif->hw_queue[i] = arvif->vdev_id % (IEEE80211_MAX_QUEUES - 1); in ath10k_add_interface()
5565 * On non-IOMMU-enabled hosts this could be a possible security issue in ath10k_add_interface()
5567 * IOMMU-enabled hosts DMAR faults would occur in most cases and target in ath10k_add_interface()
5572 * DMA-coherent buffer for a lifetime of a vif and use it for all in ath10k_add_interface()
5574 * become corrupted, e.g. have garbled IEs or out-of-date TIM bitmap. in ath10k_add_interface()
5576 if (vif->type == NL80211_IFTYPE_ADHOC || in ath10k_add_interface()
5577 vif->type == NL80211_IFTYPE_MESH_POINT || in ath10k_add_interface()
5578 vif->type == NL80211_IFTYPE_AP) { in ath10k_add_interface()
5579 arvif->beacon_buf = dma_alloc_coherent(ar->dev, in ath10k_add_interface()
5581 &arvif->beacon_paddr, in ath10k_add_interface()
5583 if (!arvif->beacon_buf) { in ath10k_add_interface()
5584 ret = -ENOMEM; in ath10k_add_interface()
5590 if (test_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, &ar->dev_flags)) in ath10k_add_interface()
5591 arvif->nohwcrypt = true; in ath10k_add_interface()
5593 if (arvif->nohwcrypt && in ath10k_add_interface()
5594 !test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { in ath10k_add_interface()
5595 ret = -EINVAL; in ath10k_add_interface()
5601 arvif->vdev_id, arvif->vdev_type, arvif->vdev_subtype, in ath10k_add_interface()
5602 arvif->beacon_buf ? "single-buf" : "per-skb"); in ath10k_add_interface()
5604 ret = ath10k_wmi_vdev_create(ar, arvif->vdev_id, arvif->vdev_type, in ath10k_add_interface()
5605 arvif->vdev_subtype, vif->addr); in ath10k_add_interface()
5608 arvif->vdev_id, ret); in ath10k_add_interface()
5613 ar->wmi.svc_map)) { in ath10k_add_interface()
5614 vdev_param = ar->wmi.vdev_param->disable_4addr_src_lrn; in ath10k_add_interface()
5615 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5617 if (ret && ret != -EOPNOTSUPP) { in ath10k_add_interface()
5619 arvif->vdev_id, ret); in ath10k_add_interface()
5623 ar->free_vdev_map &= ~(1LL << arvif->vdev_id); in ath10k_add_interface()
5624 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5625 list_add(&arvif->list, &ar->arvifs); in ath10k_add_interface()
5626 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5634 arvif->vdev_id, ret); in ath10k_add_interface()
5638 arvif->def_wep_key_idx = -1; in ath10k_add_interface()
5640 vdev_param = ar->wmi.vdev_param->tx_encap_type; in ath10k_add_interface()
5641 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5644 if (ret && ret != -EOPNOTSUPP) { in ath10k_add_interface()
5646 arvif->vdev_id, ret); in ath10k_add_interface()
5653 if (ar->cfg_tx_chainmask && (vif->type != NL80211_IFTYPE_MONITOR)) { in ath10k_add_interface()
5654 u16 nss = get_nss_from_chainmask(ar->cfg_tx_chainmask); in ath10k_add_interface()
5656 vdev_param = ar->wmi.vdev_param->nss; in ath10k_add_interface()
5657 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5661 arvif->vdev_id, ar->cfg_tx_chainmask, nss, in ath10k_add_interface()
5667 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_add_interface()
5668 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_add_interface()
5669 ret = ath10k_peer_create(ar, vif, NULL, arvif->vdev_id, in ath10k_add_interface()
5670 vif->addr, WMI_PEER_TYPE_DEFAULT); in ath10k_add_interface()
5673 arvif->vdev_id, ret); in ath10k_add_interface()
5677 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5679 peer = ath10k_peer_find(ar, arvif->vdev_id, vif->addr); in ath10k_add_interface()
5682 vif->addr, arvif->vdev_id); in ath10k_add_interface()
5683 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5684 ret = -ENOENT; in ath10k_add_interface()
5688 arvif->peer_id = find_first_bit(peer->peer_ids, in ath10k_add_interface()
5691 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5693 arvif->peer_id = HTT_INVALID_PEERID; in ath10k_add_interface()
5696 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath10k_add_interface()
5700 arvif->vdev_id, ret); in ath10k_add_interface()
5705 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) { in ath10k_add_interface()
5708 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_add_interface()
5712 arvif->vdev_id, ret); in ath10k_add_interface()
5719 arvif->vdev_id, ret); in ath10k_add_interface()
5726 arvif->vdev_id, ret); in ath10k_add_interface()
5734 arvif->vdev_id, ret); in ath10k_add_interface()
5738 ret = ath10k_mac_set_rts(arvif, ar->hw->wiphy->rts_threshold); in ath10k_add_interface()
5741 arvif->vdev_id, ret); in ath10k_add_interface()
5745 arvif->txpower = vif->bss_conf.txpower; in ath10k_add_interface()
5752 if (test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) { in ath10k_add_interface()
5753 vdev_param = ar->wmi.vdev_param->rtt_responder_role; in ath10k_add_interface()
5754 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5755 arvif->ftm_responder); in ath10k_add_interface()
5758 if (ret && ret != -EOPNOTSUPP) in ath10k_add_interface()
5760 arvif->vdev_id, ret); in ath10k_add_interface()
5763 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_add_interface()
5764 ar->monitor_arvif = arvif; in ath10k_add_interface()
5772 spin_lock_bh(&ar->htt.tx_lock); in ath10k_add_interface()
5773 if (!ar->tx_paused) in ath10k_add_interface()
5774 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_add_interface()
5775 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_add_interface()
5777 mutex_unlock(&ar->conf_mutex); in ath10k_add_interface()
5781 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_add_interface()
5782 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_add_interface()
5783 ath10k_wmi_peer_delete(ar, arvif->vdev_id, vif->addr); in ath10k_add_interface()
5784 ath10k_wait_for_peer_delete_done(ar, arvif->vdev_id, in ath10k_add_interface()
5785 vif->addr); in ath10k_add_interface()
5789 ath10k_wmi_vdev_delete(ar, arvif->vdev_id); in ath10k_add_interface()
5790 ar->free_vdev_map |= 1LL << arvif->vdev_id; in ath10k_add_interface()
5791 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5792 list_del(&arvif->list); in ath10k_add_interface()
5793 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5796 if (arvif->beacon_buf) { in ath10k_add_interface()
5797 dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, in ath10k_add_interface()
5798 arvif->beacon_buf, arvif->beacon_paddr); in ath10k_add_interface()
5799 arvif->beacon_buf = NULL; in ath10k_add_interface()
5802 mutex_unlock(&ar->conf_mutex); in ath10k_add_interface()
5818 struct ath10k *ar = hw->priv; in ath10k_remove_interface()
5819 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_remove_interface()
5825 cancel_work_sync(&arvif->ap_csa_work); in ath10k_remove_interface()
5826 cancel_delayed_work_sync(&arvif->connection_loss_work); in ath10k_remove_interface()
5828 mutex_lock(&ar->conf_mutex); in ath10k_remove_interface()
5833 arvif->vdev_id, ret); in ath10k_remove_interface()
5835 ar->free_vdev_map |= 1LL << arvif->vdev_id; in ath10k_remove_interface()
5836 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5837 list_del(&arvif->list); in ath10k_remove_interface()
5838 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
5840 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_remove_interface()
5841 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_remove_interface()
5842 ret = ath10k_wmi_peer_delete(arvif->ar, arvif->vdev_id, in ath10k_remove_interface()
5843 vif->addr); in ath10k_remove_interface()
5845 ath10k_warn(ar, "failed to submit AP/IBSS self-peer removal on vdev %i: %d\n", in ath10k_remove_interface()
5846 arvif->vdev_id, ret); in ath10k_remove_interface()
5848 ath10k_wait_for_peer_delete_done(ar, arvif->vdev_id, in ath10k_remove_interface()
5849 vif->addr); in ath10k_remove_interface()
5850 kfree(arvif->u.ap.noa_data); in ath10k_remove_interface()
5854 arvif->vdev_id); in ath10k_remove_interface()
5856 ret = ath10k_wmi_vdev_delete(ar, arvif->vdev_id); in ath10k_remove_interface()
5859 arvif->vdev_id, ret); in ath10k_remove_interface()
5861 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) { in ath10k_remove_interface()
5862 time_left = wait_for_completion_timeout(&ar->vdev_delete_done, in ath10k_remove_interface()
5870 /* Some firmware revisions don't notify host about self-peer removal in ath10k_remove_interface()
5873 if (arvif->vdev_type == WMI_VDEV_TYPE_AP || in ath10k_remove_interface()
5874 arvif->vdev_type == WMI_VDEV_TYPE_IBSS) { in ath10k_remove_interface()
5875 ret = ath10k_wait_for_peer_deleted(ar, arvif->vdev_id, in ath10k_remove_interface()
5876 vif->addr); in ath10k_remove_interface()
5878 ath10k_warn(ar, "failed to remove AP self-peer on vdev %i: %d\n", in ath10k_remove_interface()
5879 arvif->vdev_id, ret); in ath10k_remove_interface()
5881 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5882 ar->num_peers--; in ath10k_remove_interface()
5883 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
5886 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5887 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_remove_interface()
5888 peer = ar->peer_map[i]; in ath10k_remove_interface()
5892 if (peer->vif == vif) { in ath10k_remove_interface()
5894 vif->addr, arvif->vdev_id); in ath10k_remove_interface()
5895 peer->vif = NULL; in ath10k_remove_interface()
5903 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
5905 ath10k_peer_cleanup(ar, arvif->vdev_id); in ath10k_remove_interface()
5906 ath10k_mac_txq_unref(ar, vif->txq); in ath10k_remove_interface()
5908 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_remove_interface()
5909 ar->monitor_arvif = NULL; in ath10k_remove_interface()
5919 spin_lock_bh(&ar->htt.tx_lock); in ath10k_remove_interface()
5921 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_remove_interface()
5923 ath10k_mac_txq_unref(ar, vif->txq); in ath10k_remove_interface()
5926 mutex_unlock(&ar->conf_mutex); in ath10k_remove_interface()
5946 struct ath10k *ar = hw->priv; in ath10k_configure_filter()
5949 mutex_lock(&ar->conf_mutex); in ath10k_configure_filter()
5953 ar->filter_flags = *total_flags; in ath10k_configure_filter()
5959 mutex_unlock(&ar->conf_mutex); in ath10k_configure_filter()
5966 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_recalculate_mgmt_rate()
5971 u16 bitrate; in ath10k_recalculate_mgmt_rate() local
5974 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalculate_mgmt_rate()
5976 sband = ar->hw->wiphy->bands[def->chan->band]; in ath10k_recalculate_mgmt_rate()
5977 basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; in ath10k_recalculate_mgmt_rate()
5978 bitrate = sband->bitrates[basic_rate_idx].bitrate; in ath10k_recalculate_mgmt_rate()
5980 hw_rate_code = ath10k_mac_get_rate_hw_value(bitrate); in ath10k_recalculate_mgmt_rate()
5982 ath10k_warn(ar, "bitrate not supported %d\n", bitrate); in ath10k_recalculate_mgmt_rate()
5986 vdev_param = ar->wmi.vdev_param->mgmt_rate; in ath10k_recalculate_mgmt_rate()
5987 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_recalculate_mgmt_rate()
5998 struct ath10k *ar = hw->priv; in ath10k_bss_info_changed()
5999 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_bss_info_changed()
6002 u16 bitrate, hw_value; in ath10k_bss_info_changed() local
6007 mutex_lock(&ar->conf_mutex); in ath10k_bss_info_changed()
6010 ath10k_control_ibss(arvif, info, vif->addr); in ath10k_bss_info_changed()
6013 arvif->beacon_interval = info->beacon_int; in ath10k_bss_info_changed()
6014 vdev_param = ar->wmi.vdev_param->beacon_interval; in ath10k_bss_info_changed()
6015 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6016 arvif->beacon_interval); in ath10k_bss_info_changed()
6019 arvif->vdev_id, arvif->beacon_interval); in ath10k_bss_info_changed()
6023 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6029 arvif->vdev_id); in ath10k_bss_info_changed()
6031 pdev_param = ar->wmi.pdev_param->beacon_tx_mode; in ath10k_bss_info_changed()
6036 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6045 strncpy(arvif->u.ap.ssid, "mesh", in ath10k_bss_info_changed()
6046 sizeof(arvif->u.ap.ssid)); in ath10k_bss_info_changed()
6047 arvif->u.ap.ssid_len = 4; in ath10k_bss_info_changed()
6055 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6059 arvif->dtim_period = info->dtim_period; in ath10k_bss_info_changed()
6063 arvif->vdev_id, arvif->dtim_period); in ath10k_bss_info_changed()
6065 vdev_param = ar->wmi.vdev_param->dtim_period; in ath10k_bss_info_changed()
6066 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6067 arvif->dtim_period); in ath10k_bss_info_changed()
6070 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6074 vif->type == NL80211_IFTYPE_AP) { in ath10k_bss_info_changed()
6075 arvif->u.ap.ssid_len = info->ssid_len; in ath10k_bss_info_changed()
6076 if (info->ssid_len) in ath10k_bss_info_changed()
6077 memcpy(arvif->u.ap.ssid, info->ssid, info->ssid_len); in ath10k_bss_info_changed()
6078 arvif->u.ap.hidden_ssid = info->hidden_ssid; in ath10k_bss_info_changed()
6081 if (changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) in ath10k_bss_info_changed()
6082 ether_addr_copy(arvif->bssid, info->bssid); in ath10k_bss_info_changed()
6085 arvif->ftm_responder != info->ftm_responder && in ath10k_bss_info_changed()
6086 test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) { in ath10k_bss_info_changed()
6087 arvif->ftm_responder = info->ftm_responder; in ath10k_bss_info_changed()
6089 vdev_param = ar->wmi.vdev_param->rtt_responder_role; in ath10k_bss_info_changed()
6090 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6091 arvif->ftm_responder); in ath10k_bss_info_changed()
6095 arvif->vdev_id, arvif->ftm_responder, ret); in ath10k_bss_info_changed()
6102 arvif->use_cts_prot = info->use_cts_prot; in ath10k_bss_info_changed()
6107 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6113 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6118 if (info->use_short_slot) in ath10k_bss_info_changed()
6125 arvif->vdev_id, slottime); in ath10k_bss_info_changed()
6127 vdev_param = ar->wmi.vdev_param->slot_time; in ath10k_bss_info_changed()
6128 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6132 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6136 if (info->use_short_preamble) in ath10k_bss_info_changed()
6143 arvif->vdev_id, preamble); in ath10k_bss_info_changed()
6145 vdev_param = ar->wmi.vdev_param->preamble; in ath10k_bss_info_changed()
6146 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6150 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6154 if (info->assoc) { in ath10k_bss_info_changed()
6159 if (ar->monitor_started) in ath10k_bss_info_changed()
6170 arvif->vdev_id, info->txpower); in ath10k_bss_info_changed()
6172 arvif->txpower = info->txpower; in ath10k_bss_info_changed()
6179 arvif->ps = vif->bss_conf.ps; in ath10k_bss_info_changed()
6184 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6188 !ath10k_mac_vif_chan(arvif->vif, &def)) { in ath10k_bss_info_changed()
6189 band = def.chan->band; in ath10k_bss_info_changed()
6190 mcast_rate = vif->bss_conf.mcast_rate[band]; in ath10k_bss_info_changed()
6192 rateidx = mcast_rate - 1; in ath10k_bss_info_changed()
6194 rateidx = ffs(vif->bss_conf.basic_rates) - 1; in ath10k_bss_info_changed()
6196 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_bss_info_changed()
6199 bitrate = ath10k_wmi_legacy_rates[rateidx].bitrate; in ath10k_bss_info_changed()
6201 if (ath10k_mac_bitrate_is_cck(bitrate)) in ath10k_bss_info_changed()
6210 arvif->vdev_id, rate); in ath10k_bss_info_changed()
6212 vdev_param = ar->wmi.vdev_param->mcast_data_rate; in ath10k_bss_info_changed()
6213 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_bss_info_changed()
6218 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6220 vdev_param = ar->wmi.vdev_param->bcast_data_rate; in ath10k_bss_info_changed()
6221 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_bss_info_changed()
6226 arvif->vdev_id, ret); in ath10k_bss_info_changed()
6230 !ath10k_mac_vif_chan(arvif->vif, &def)) in ath10k_bss_info_changed()
6233 mutex_unlock(&ar->conf_mutex); in ath10k_bss_info_changed()
6238 struct ath10k *ar = hw->priv; in ath10k_mac_op_set_coverage_class()
6243 if (!ar->hw_params.hw_ops->set_coverage_class) { in ath10k_mac_op_set_coverage_class()
6247 ar->hw_params.hw_ops->set_coverage_class(ar, value); in ath10k_mac_op_set_coverage_class()
6259 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_tdls_vif_stations_count_iter()
6260 struct ieee80211_vif *sta_vif = arsta->arvif->vif; in ath10k_mac_tdls_vif_stations_count_iter()
6262 if (sta->tdls && sta_vif == iter_data->curr_vif) in ath10k_mac_tdls_vif_stations_count_iter()
6263 iter_data->num_tdls_stations++; in ath10k_mac_tdls_vif_stations_count_iter()
6283 struct ath10k *ar = hw->priv; in ath10k_hw_scan()
6284 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_hw_scan()
6285 struct cfg80211_scan_request *req = &hw_req->req; in ath10k_hw_scan()
6291 mutex_lock(&ar->conf_mutex); in ath10k_hw_scan()
6294 ret = -EBUSY; in ath10k_hw_scan()
6298 spin_lock_bh(&ar->data_lock); in ath10k_hw_scan()
6299 switch (ar->scan.state) { in ath10k_hw_scan()
6301 reinit_completion(&ar->scan.started); in ath10k_hw_scan()
6302 reinit_completion(&ar->scan.completed); in ath10k_hw_scan()
6303 ar->scan.state = ATH10K_SCAN_STARTING; in ath10k_hw_scan()
6304 ar->scan.is_roc = false; in ath10k_hw_scan()
6305 ar->scan.vdev_id = arvif->vdev_id; in ath10k_hw_scan()
6311 ret = -EBUSY; in ath10k_hw_scan()
6314 spin_unlock_bh(&ar->data_lock); in ath10k_hw_scan()
6321 arg.vdev_id = arvif->vdev_id; in ath10k_hw_scan()
6324 if (req->ie_len) { in ath10k_hw_scan()
6325 arg.ie_len = req->ie_len; in ath10k_hw_scan()
6326 memcpy(arg.ie, req->ie, arg.ie_len); in ath10k_hw_scan()
6329 if (req->n_ssids) { in ath10k_hw_scan()
6330 arg.n_ssids = req->n_ssids; in ath10k_hw_scan()
6332 arg.ssids[i].len = req->ssids[i].ssid_len; in ath10k_hw_scan()
6333 arg.ssids[i].ssid = req->ssids[i].ssid; in ath10k_hw_scan()
6339 if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { in ath10k_hw_scan()
6341 ether_addr_copy(arg.mac_addr.addr, req->mac_addr); in ath10k_hw_scan()
6342 ether_addr_copy(arg.mac_mask.addr, req->mac_addr_mask); in ath10k_hw_scan()
6345 if (req->n_channels) { in ath10k_hw_scan()
6346 arg.n_channels = req->n_channels; in ath10k_hw_scan()
6348 arg.channels[i] = req->channels[i]->center_freq; in ath10k_hw_scan()
6352 if (req->duration) { in ath10k_hw_scan()
6353 arg.dwell_time_active = req->duration; in ath10k_hw_scan()
6354 arg.dwell_time_passive = req->duration; in ath10k_hw_scan()
6355 arg.burst_duration_ms = req->duration; in ath10k_hw_scan()
6358 (arg.n_channels - 1) + (req->duration + in ath10k_hw_scan()
6370 spin_lock_bh(&ar->data_lock); in ath10k_hw_scan()
6371 ar->scan.state = ATH10K_SCAN_IDLE; in ath10k_hw_scan()
6372 spin_unlock_bh(&ar->data_lock); in ath10k_hw_scan()
6375 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath10k_hw_scan()
6379 mutex_unlock(&ar->conf_mutex); in ath10k_hw_scan()
6386 struct ath10k *ar = hw->priv; in ath10k_cancel_hw_scan()
6388 mutex_lock(&ar->conf_mutex); in ath10k_cancel_hw_scan()
6390 mutex_unlock(&ar->conf_mutex); in ath10k_cancel_hw_scan()
6392 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_cancel_hw_scan()
6400 u32 vdev_param = arvif->ar->wmi.vdev_param->def_keyid; in ath10k_set_key_h_def_keyidx()
6405 * frames with multi-vif APs. This is not required for main firmware in ath10k_set_key_h_def_keyidx()
6408 * This is also needed for 636 fw for IBSS-RSN to work more reliably. in ath10k_set_key_h_def_keyidx()
6410 * FIXME: It remains unknown if this is required for multi-vif STA in ath10k_set_key_h_def_keyidx()
6414 if (arvif->vdev_type != WMI_VDEV_TYPE_AP && in ath10k_set_key_h_def_keyidx()
6415 arvif->vdev_type != WMI_VDEV_TYPE_IBSS) in ath10k_set_key_h_def_keyidx()
6418 if (key->cipher == WLAN_CIPHER_SUITE_WEP40) in ath10k_set_key_h_def_keyidx()
6421 if (key->cipher == WLAN_CIPHER_SUITE_WEP104) in ath10k_set_key_h_def_keyidx()
6424 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath10k_set_key_h_def_keyidx()
6430 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_set_key_h_def_keyidx()
6431 key->keyidx); in ath10k_set_key_h_def_keyidx()
6434 arvif->vdev_id, ret); in ath10k_set_key_h_def_keyidx()
6441 struct ath10k *ar = hw->priv; in ath10k_set_key()
6442 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_set_key()
6446 bool is_wep = key->cipher == WLAN_CIPHER_SUITE_WEP40 || in ath10k_set_key()
6447 key->cipher == WLAN_CIPHER_SUITE_WEP104; in ath10k_set_key()
6454 if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || in ath10k_set_key()
6455 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || in ath10k_set_key()
6456 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 || in ath10k_set_key()
6457 key->cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256) in ath10k_set_key()
6460 if (arvif->nohwcrypt) in ath10k_set_key()
6463 if (key->keyidx > WMI_MAX_KEY_INDEX) in ath10k_set_key()
6464 return -ENOSPC; in ath10k_set_key()
6466 mutex_lock(&ar->conf_mutex); in ath10k_set_key()
6469 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_set_key()
6470 peer_addr = sta->addr; in ath10k_set_key()
6471 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6472 arsta->ucast_cipher = key->cipher; in ath10k_set_key()
6473 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6474 } else if (arvif->vdev_type == WMI_VDEV_TYPE_STA) { in ath10k_set_key()
6475 peer_addr = vif->bss_conf.bssid; in ath10k_set_key()
6477 peer_addr = vif->addr; in ath10k_set_key()
6480 key->hw_key_idx = key->keyidx; in ath10k_set_key()
6484 arvif->wep_keys[key->keyidx] = key; in ath10k_set_key()
6486 arvif->wep_keys[key->keyidx] = NULL; in ath10k_set_key()
6489 /* the peer should not disappear in mid-way (unless FW goes awry) since in ath10k_set_key()
6492 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6493 peer = ath10k_peer_find(ar, arvif->vdev_id, peer_addr); in ath10k_set_key()
6494 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6498 ath10k_warn(ar, "failed to install key for non-existent peer %pM\n", in ath10k_set_key()
6500 ret = -EOPNOTSUPP; in ath10k_set_key()
6508 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath10k_set_key()
6519 * keys. Static WEP needs an explicit per-peer key upload. in ath10k_set_key()
6521 if (vif->type == NL80211_IFTYPE_ADHOC && in ath10k_set_key()
6531 if (cmd == SET_KEY && arvif->def_wep_key_idx == -1) in ath10k_set_key()
6539 arvif->vdev_id, peer_addr, ret); in ath10k_set_key()
6546 if (is_wep && !sta && vif->type == NL80211_IFTYPE_STATION) { in ath10k_set_key()
6555 arvif->vdev_id, peer_addr, ret); in ath10k_set_key()
6561 arvif->vdev_id, peer_addr, ret2); in ath10k_set_key()
6569 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6570 peer = ath10k_peer_find(ar, arvif->vdev_id, peer_addr); in ath10k_set_key()
6572 peer->keys[key->keyidx] = key; in ath10k_set_key()
6574 peer->keys[key->keyidx] = NULL; in ath10k_set_key()
6578 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6580 if (sta && sta->tdls) in ath10k_set_key()
6581 ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_set_key()
6582 ar->wmi.peer_param->authorize, 1); in ath10k_set_key()
6583 else if (sta && cmd == SET_KEY && (key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) in ath10k_set_key()
6584 ath10k_wmi_peer_set_param(ar, arvif->vdev_id, peer_addr, in ath10k_set_key()
6585 ar->wmi.peer_param->authorize, 1); in ath10k_set_key()
6588 mutex_unlock(&ar->conf_mutex); in ath10k_set_key()
6596 struct ath10k *ar = hw->priv; in ath10k_set_default_unicast_key()
6597 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_set_default_unicast_key()
6600 mutex_lock(&arvif->ar->conf_mutex); in ath10k_set_default_unicast_key()
6602 if (arvif->ar->state != ATH10K_STATE_ON) in ath10k_set_default_unicast_key()
6606 arvif->vdev_id, keyidx); in ath10k_set_default_unicast_key()
6608 ret = ath10k_wmi_vdev_set_param(arvif->ar, in ath10k_set_default_unicast_key()
6609 arvif->vdev_id, in ath10k_set_default_unicast_key()
6610 arvif->ar->wmi.vdev_param->def_keyid, in ath10k_set_default_unicast_key()
6615 arvif->vdev_id, in ath10k_set_default_unicast_key()
6620 arvif->def_wep_key_idx = keyidx; in ath10k_set_default_unicast_key()
6623 mutex_unlock(&arvif->ar->conf_mutex); in ath10k_set_default_unicast_key()
6641 arvif = arsta->arvif; in ath10k_sta_rc_update_wk()
6642 ar = arvif->ar; in ath10k_sta_rc_update_wk()
6644 if (WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) in ath10k_sta_rc_update_wk()
6647 band = def.chan->band; in ath10k_sta_rc_update_wk()
6648 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath10k_sta_rc_update_wk()
6649 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath10k_sta_rc_update_wk()
6651 spin_lock_bh(&ar->data_lock); in ath10k_sta_rc_update_wk()
6653 changed = arsta->changed; in ath10k_sta_rc_update_wk()
6654 arsta->changed = 0; in ath10k_sta_rc_update_wk()
6656 bw = arsta->bw; in ath10k_sta_rc_update_wk()
6657 nss = arsta->nss; in ath10k_sta_rc_update_wk()
6658 smps = arsta->smps; in ath10k_sta_rc_update_wk()
6660 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update_wk()
6662 mutex_lock(&ar->conf_mutex); in ath10k_sta_rc_update_wk()
6665 nss = min(nss, max(ath10k_mac_max_ht_nss(ht_mcs_mask), in ath10k_sta_rc_update_wk()
6673 sta->addr, bw, mode); in ath10k_sta_rc_update_wk()
6675 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6676 ar->wmi.peer_param->phymode, mode); in ath10k_sta_rc_update_wk()
6679 sta->addr, mode, err); in ath10k_sta_rc_update_wk()
6683 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6684 ar->wmi.peer_param->chan_width, bw); in ath10k_sta_rc_update_wk()
6687 sta->addr, bw, err); in ath10k_sta_rc_update_wk()
6692 sta->addr, nss); in ath10k_sta_rc_update_wk()
6694 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6695 ar->wmi.peer_param->nss, nss); in ath10k_sta_rc_update_wk()
6698 sta->addr, nss, err); in ath10k_sta_rc_update_wk()
6703 sta->addr, smps); in ath10k_sta_rc_update_wk()
6705 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6706 ar->wmi.peer_param->smps_state, smps); in ath10k_sta_rc_update_wk()
6709 sta->addr, smps, err); in ath10k_sta_rc_update_wk()
6714 sta->addr); in ath10k_sta_rc_update_wk()
6716 err = ath10k_station_assoc(ar, arvif->vif, sta, true); in ath10k_sta_rc_update_wk()
6719 sta->addr); in ath10k_sta_rc_update_wk()
6723 mutex_unlock(&ar->conf_mutex); in ath10k_sta_rc_update_wk()
6729 struct ath10k *ar = arvif->ar; in ath10k_mac_inc_num_stations()
6731 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_inc_num_stations()
6733 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath10k_mac_inc_num_stations()
6736 if (ar->num_stations >= ar->max_num_stations) in ath10k_mac_inc_num_stations()
6737 return -ENOBUFS; in ath10k_mac_inc_num_stations()
6739 ar->num_stations++; in ath10k_mac_inc_num_stations()
6747 struct ath10k *ar = arvif->ar; in ath10k_mac_dec_num_stations()
6749 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_dec_num_stations()
6751 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath10k_mac_dec_num_stations()
6754 ar->num_stations--; in ath10k_mac_dec_num_stations()
6761 struct ath10k *ar = hw->priv; in ath10k_sta_set_txpwr()
6762 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_set_txpwr()
6766 if (sta->txpwr.type == NL80211_TX_POWER_AUTOMATIC) { in ath10k_sta_set_txpwr()
6769 txpwr = sta->txpwr.power; in ath10k_sta_set_txpwr()
6771 return -EINVAL; in ath10k_sta_set_txpwr()
6775 return -EINVAL; in ath10k_sta_set_txpwr()
6777 mutex_lock(&ar->conf_mutex); in ath10k_sta_set_txpwr()
6779 ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_set_txpwr()
6780 ar->wmi.peer_param->use_fixed_power, txpwr); in ath10k_sta_set_txpwr()
6788 mutex_unlock(&ar->conf_mutex); in ath10k_sta_set_txpwr()
6807 num_rates += hweight32(mask->control[band].legacy); in ath10k_mac_bitrate_mask_has_single_rate()
6809 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) in ath10k_mac_bitrate_mask_has_single_rate()
6810 num_rates += hweight8(mask->control[band].ht_mcs[i]); in ath10k_mac_bitrate_mask_has_single_rate()
6813 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_has_single_rate()
6814 tmp = hweight16(mask->control[band].vht_mcs[i]); in ath10k_mac_bitrate_mask_has_single_rate()
6830 u16 bitrate; in ath10k_mac_bitrate_mask_get_single_rate() local
6837 if (hweight32(mask->control[band].legacy) == 1) { in ath10k_mac_bitrate_mask_get_single_rate()
6838 rate_idx = ffs(mask->control[band].legacy) - 1; in ath10k_mac_bitrate_mask_get_single_rate()
6840 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_mac_bitrate_mask_get_single_rate()
6844 bitrate = ath10k_wmi_legacy_rates[rate_idx].bitrate; in ath10k_mac_bitrate_mask_get_single_rate()
6846 if (ath10k_mac_bitrate_is_cck(bitrate)) in ath10k_mac_bitrate_mask_get_single_rate()
6853 (*nss - 1) << 4 | in ath10k_mac_bitrate_mask_get_single_rate()
6859 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_rate()
6860 if (hweight8(mask->control[band].ht_mcs[i]) == 1) { in ath10k_mac_bitrate_mask_get_single_rate()
6863 (*nss - 1) << 4 | in ath10k_mac_bitrate_mask_get_single_rate()
6864 (ffs(mask->control[band].ht_mcs[i]) - 1); in ath10k_mac_bitrate_mask_get_single_rate()
6871 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_rate()
6872 if (hweight16(mask->control[band].vht_mcs[i]) == 1) { in ath10k_mac_bitrate_mask_get_single_rate()
6875 (*nss - 1) << 4 | in ath10k_mac_bitrate_mask_get_single_rate()
6876 (ffs(mask->control[band].vht_mcs[i]) - 1); in ath10k_mac_bitrate_mask_get_single_rate()
6882 return -EINVAL; in ath10k_mac_bitrate_mask_get_single_rate()
6889 if (nss > sta->rx_nss) { in ath10k_mac_validate_rate_mask()
6891 nss, sta->rx_nss); in ath10k_mac_validate_rate_mask()
6892 return -EINVAL; in ath10k_mac_validate_rate_mask()
6896 if (!sta->vht_cap.vht_supported) { in ath10k_mac_validate_rate_mask()
6898 sta->addr); in ath10k_mac_validate_rate_mask()
6899 return -EINVAL; in ath10k_mac_validate_rate_mask()
6902 if (!sta->ht_cap.ht_supported || sta->vht_cap.vht_supported) { in ath10k_mac_validate_rate_mask()
6904 sta->addr); in ath10k_mac_validate_rate_mask()
6905 return -EINVAL; in ath10k_mac_validate_rate_mask()
6908 if (sta->ht_cap.ht_supported || sta->vht_cap.vht_supported) in ath10k_mac_validate_rate_mask()
6909 return -EINVAL; in ath10k_mac_validate_rate_mask()
6929 return -EINVAL; in ath10k_mac_tid_bitrate_config()
6937 band = def.chan->band; in ath10k_mac_tid_bitrate_config()
6941 return -EINVAL; in ath10k_mac_tid_bitrate_config()
6955 return -EINVAL; in ath10k_mac_tid_bitrate_config()
6961 ar->wmi.svc_map))) in ath10k_mac_tid_bitrate_config()
6964 return -EOPNOTSUPP; in ath10k_mac_tid_bitrate_config()
6973 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_set_tid_config()
6978 if (!sta->wme) in ath10k_mac_set_tid_config()
6979 return -ENOTSUPP; in ath10k_mac_set_tid_config()
6981 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_set_tid_config()
6984 if ((arsta->retry_long[arg->tid] > 0 || in ath10k_mac_set_tid_config()
6985 arsta->rate_code[arg->tid] > 0 || in ath10k_mac_set_tid_config()
6986 arsta->ampdu[arg->tid] == in ath10k_mac_set_tid_config()
6988 arg->ack_policy == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
6990 arg->ack_policy = 0; in ath10k_mac_set_tid_config()
6991 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
6992 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
6993 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
6998 if (arsta->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_mac_set_tid_config()
6999 arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7000 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7007 if (arsta->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_mac_set_tid_config()
7008 arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7009 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7010 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7014 ether_addr_copy(arg->peer_macaddr.addr, sta->addr); in ath10k_mac_set_tid_config()
7022 arsta->noack[arg->tid] = arg->ack_policy; in ath10k_mac_set_tid_config()
7023 arg->ack_policy = 0; in ath10k_mac_set_tid_config()
7024 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7025 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7026 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7030 arsta->retry_long[arg->tid] = arg->retry_count; in ath10k_mac_set_tid_config()
7031 arg->retry_count = 0; in ath10k_mac_set_tid_config()
7035 arsta->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
7036 arg->aggr_control = 0; in ath10k_mac_set_tid_config()
7041 arsta->rate_ctrl[arg->tid] = arg->rate_ctrl; in ath10k_mac_set_tid_config()
7042 arg->rate_ctrl = 0; in ath10k_mac_set_tid_config()
7043 arg->rcode_flags = 0; in ath10k_mac_set_tid_config()
7047 arsta->rtscts[arg->tid] = arg->rtscts_ctrl; in ath10k_mac_set_tid_config()
7048 arg->ext_tid_cfg_bitmap = 0; in ath10k_mac_set_tid_config()
7052 if ((arvif->retry_long[arg->tid] || in ath10k_mac_set_tid_config()
7053 arvif->rate_code[arg->tid] || in ath10k_mac_set_tid_config()
7054 arvif->ampdu[arg->tid] == in ath10k_mac_set_tid_config()
7056 arg->ack_policy == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7059 arvif->noack[arg->tid] = arg->ack_policy; in ath10k_mac_set_tid_config()
7060 arvif->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
7061 arvif->rate_ctrl[arg->tid] = arg->rate_ctrl; in ath10k_mac_set_tid_config()
7066 if (arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_set_tid_config()
7069 arvif->retry_long[arg->tid] = arg->retry_count; in ath10k_mac_set_tid_config()
7073 if (arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) in ath10k_mac_set_tid_config()
7076 arvif->ampdu[arg->tid] = arg->aggr_control; in ath10k_mac_set_tid_config()
7081 if (arvif->noack[arg->tid] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_mac_set_tid_config()
7085 arvif->rate_ctrl[arg->tid] = arg->rate_ctrl; in ath10k_mac_set_tid_config()
7086 arvif->rate_code[arg->tid] = arg->rcode_flags; in ath10k_mac_set_tid_config()
7091 arvif->rtscts[arg->tid] = arg->rtscts_ctrl; in ath10k_mac_set_tid_config()
7092 arg->ext_tid_cfg_bitmap = 0; in ath10k_mac_set_tid_config()
7096 arvif->tid_conf_changed[arg->tid] |= changed; in ath10k_mac_set_tid_config()
7109 u32 changed = tid_conf->mask; in ath10k_mac_parse_tid_config()
7113 return -EINVAL; in ath10k_mac_parse_tid_config()
7116 if (!(tid_conf->tids & BIT(i))) { in ath10k_mac_parse_tid_config()
7121 arg->tid = i; in ath10k_mac_parse_tid_config()
7124 if (tid_conf->noack == NL80211_TID_CONFIG_ENABLE) { in ath10k_mac_parse_tid_config()
7125 arg->ack_policy = WMI_PEER_TID_CONFIG_NOACK; in ath10k_mac_parse_tid_config()
7126 arg->rate_ctrl = in ath10k_mac_parse_tid_config()
7128 arg->aggr_control = in ath10k_mac_parse_tid_config()
7131 arg->ack_policy = in ath10k_mac_parse_tid_config()
7133 arg->rate_ctrl = in ath10k_mac_parse_tid_config()
7135 arg->aggr_control = in ath10k_mac_parse_tid_config()
7141 arg->retry_count = tid_conf->retry_long; in ath10k_mac_parse_tid_config()
7144 if (tid_conf->noack == NL80211_TID_CONFIG_ENABLE) in ath10k_mac_parse_tid_config()
7145 arg->aggr_control = WMI_TID_CONFIG_AGGR_CONTROL_ENABLE; in ath10k_mac_parse_tid_config()
7147 arg->aggr_control = WMI_TID_CONFIG_AGGR_CONTROL_DISABLE; in ath10k_mac_parse_tid_config()
7153 &arg->rcode_flags, in ath10k_mac_parse_tid_config()
7154 &arg->rate_ctrl, in ath10k_mac_parse_tid_config()
7155 tid_conf->txrate_type, in ath10k_mac_parse_tid_config()
7156 &tid_conf->txrate_mask); in ath10k_mac_parse_tid_config()
7158 ath10k_warn(ar, "failed to configure bitrate mask %d\n", in ath10k_mac_parse_tid_config()
7160 arg->rcode_flags = 0; in ath10k_mac_parse_tid_config()
7161 arg->rate_ctrl = 0; in ath10k_mac_parse_tid_config()
7166 if (tid_conf->rtscts) in ath10k_mac_parse_tid_config()
7167 arg->rtscts_ctrl = tid_conf->rtscts; in ath10k_mac_parse_tid_config()
7169 arg->ext_tid_cfg_bitmap = WMI_EXT_TID_RTS_CTS_CONFIG; in ath10k_mac_parse_tid_config()
7186 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_reset_tid_config()
7190 arg.vdev_id = arvif->vdev_id; in ath10k_mac_reset_tid_config()
7205 ether_addr_copy(arg.peer_macaddr.addr, sta->addr); in ath10k_mac_reset_tid_config()
7211 if (!arvif->tids_rst) { in ath10k_mac_reset_tid_config()
7212 arsta->retry_long[i] = -1; in ath10k_mac_reset_tid_config()
7213 arsta->noack[i] = -1; in ath10k_mac_reset_tid_config()
7214 arsta->ampdu[i] = -1; in ath10k_mac_reset_tid_config()
7215 arsta->rate_code[i] = -1; in ath10k_mac_reset_tid_config()
7216 arsta->rate_ctrl[i] = 0; in ath10k_mac_reset_tid_config()
7217 arsta->rtscts[i] = -1; in ath10k_mac_reset_tid_config()
7219 arvif->retry_long[i] = 0; in ath10k_mac_reset_tid_config()
7220 arvif->noack[i] = 0; in ath10k_mac_reset_tid_config()
7221 arvif->ampdu[i] = 0; in ath10k_mac_reset_tid_config()
7222 arvif->rate_code[i] = 0; in ath10k_mac_reset_tid_config()
7223 arvif->rate_ctrl[i] = 0; in ath10k_mac_reset_tid_config()
7224 arvif->rtscts[i] = 0; in ath10k_mac_reset_tid_config()
7247 arvif = arsta->arvif; in ath10k_sta_tid_cfg_wk()
7248 ar = arvif->ar; in ath10k_sta_tid_cfg_wk()
7250 mutex_lock(&ar->conf_mutex); in ath10k_sta_tid_cfg_wk()
7252 if (arvif->tids_rst) { in ath10k_sta_tid_cfg_wk()
7254 arvif->tids_rst); in ath10k_sta_tid_cfg_wk()
7258 ether_addr_copy(arg.peer_macaddr.addr, sta->addr); in ath10k_sta_tid_cfg_wk()
7262 changed = arvif->tid_conf_changed[i]; in ath10k_sta_tid_cfg_wk()
7265 if (arsta->noack[i] != -1) { in ath10k_sta_tid_cfg_wk()
7269 arg.ack_policy = arvif->noack[i]; in ath10k_sta_tid_cfg_wk()
7270 arg.aggr_control = arvif->ampdu[i]; in ath10k_sta_tid_cfg_wk()
7271 arg.rate_ctrl = arvif->rate_ctrl[i]; in ath10k_sta_tid_cfg_wk()
7276 if (arsta->retry_long[i] != -1 || in ath10k_sta_tid_cfg_wk()
7277 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7278 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7281 arg.retry_count = arvif->retry_long[i]; in ath10k_sta_tid_cfg_wk()
7287 if (arsta->ampdu[i] != -1 || in ath10k_sta_tid_cfg_wk()
7288 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7289 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7292 arg.aggr_control = arvif->ampdu[i]; in ath10k_sta_tid_cfg_wk()
7299 nss = ATH10K_HW_NSS(arvif->rate_code[i]); in ath10k_sta_tid_cfg_wk()
7301 arvif->rate_code[i], in ath10k_sta_tid_cfg_wk()
7304 arvif->rate_ctrl[i] > WMI_TID_CONFIG_RATE_CONTROL_AUTO) { in ath10k_sta_tid_cfg_wk()
7309 if (arsta->rate_ctrl[i] > in ath10k_sta_tid_cfg_wk()
7311 arsta->noack[i] == WMI_PEER_TID_CONFIG_NOACK || in ath10k_sta_tid_cfg_wk()
7312 arvif->noack[i] == WMI_PEER_TID_CONFIG_NOACK) { in ath10k_sta_tid_cfg_wk()
7316 arg.rate_ctrl = arvif->rate_ctrl[i]; in ath10k_sta_tid_cfg_wk()
7317 arg.rcode_flags = arvif->rate_code[i]; in ath10k_sta_tid_cfg_wk()
7323 if (arsta->rtscts[i]) { in ath10k_sta_tid_cfg_wk()
7327 arg.rtscts_ctrl = arvif->rtscts[i] - 1; in ath10k_sta_tid_cfg_wk()
7340 sta->addr, ret); in ath10k_sta_tid_cfg_wk()
7351 mutex_unlock(&ar->conf_mutex); in ath10k_sta_tid_cfg_wk()
7357 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_vif_stations_tid_conf()
7359 struct ieee80211_vif *sta_vif = arsta->arvif->vif; in ath10k_mac_vif_stations_tid_conf()
7361 if (sta_vif != iter_data->curr_vif || !sta->wme) in ath10k_mac_vif_stations_tid_conf()
7364 ieee80211_queue_work(iter_data->ar->hw, &arsta->tid_config_wk); in ath10k_mac_vif_stations_tid_conf()
7373 struct ath10k *ar = hw->priv; in ath10k_sta_state()
7374 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_state()
7375 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_state()
7383 arsta->arvif = arvif; in ath10k_sta_state()
7384 arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED; in ath10k_sta_state()
7385 INIT_WORK(&arsta->update_wk, ath10k_sta_rc_update_wk); in ath10k_sta_state()
7386 INIT_WORK(&arsta->tid_config_wk, ath10k_sta_tid_cfg_wk); in ath10k_sta_state()
7388 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) in ath10k_sta_state()
7389 ath10k_mac_txq_init(sta->txq[i]); in ath10k_sta_state()
7395 cancel_work_sync(&arsta->update_wk); in ath10k_sta_state()
7396 cancel_work_sync(&arsta->tid_config_wk); in ath10k_sta_state()
7399 mutex_lock(&ar->conf_mutex); in ath10k_sta_state()
7411 arvif->vdev_id, sta->addr, in ath10k_sta_state()
7412 ar->num_stations + 1, ar->max_num_stations, in ath10k_sta_state()
7413 ar->num_peers + 1, ar->max_num_peers); in ath10k_sta_state()
7417 if (sta->tdls) { in ath10k_sta_state()
7418 if (num_tdls_stations >= ar->max_num_tdls_vdevs) { in ath10k_sta_state()
7420 arvif->vdev_id, in ath10k_sta_state()
7421 ar->max_num_tdls_vdevs); in ath10k_sta_state()
7422 ret = -ELNRNG; in ath10k_sta_state()
7431 ar->max_num_stations); in ath10k_sta_state()
7436 arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), in ath10k_sta_state()
7438 if (!arsta->tx_stats) { in ath10k_sta_state()
7440 ret = -ENOMEM; in ath10k_sta_state()
7445 ret = ath10k_peer_create(ar, vif, sta, arvif->vdev_id, in ath10k_sta_state()
7446 sta->addr, peer_type); in ath10k_sta_state()
7449 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7451 kfree(arsta->tx_stats); in ath10k_sta_state()
7455 spin_lock_bh(&ar->data_lock); in ath10k_sta_state()
7457 peer = ath10k_peer_find(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7460 vif->addr, arvif->vdev_id); in ath10k_sta_state()
7461 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7462 ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7464 kfree(arsta->tx_stats); in ath10k_sta_state()
7465 ret = -ENOENT; in ath10k_sta_state()
7469 arsta->peer_id = find_first_bit(peer->peer_ids, in ath10k_sta_state()
7472 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7474 if (!sta->tdls) in ath10k_sta_state()
7477 ret = ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7481 arvif->vdev_id, ret); in ath10k_sta_state()
7482 ath10k_peer_delete(ar, arvif->vdev_id, in ath10k_sta_state()
7483 sta->addr); in ath10k_sta_state()
7485 kfree(arsta->tx_stats); in ath10k_sta_state()
7489 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, sta, in ath10k_sta_state()
7494 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7495 ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7497 kfree(arsta->tx_stats); in ath10k_sta_state()
7501 ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7511 arvif->vdev_id, sta->addr, sta); in ath10k_sta_state()
7513 if (sta->tdls) { in ath10k_sta_state()
7514 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, in ath10k_sta_state()
7519 sta->addr, in ath10k_sta_state()
7523 ret = ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7526 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7530 spin_lock_bh(&ar->data_lock); in ath10k_sta_state()
7531 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_sta_state()
7532 peer = ar->peer_map[i]; in ath10k_sta_state()
7536 if (peer->sta == sta) { in ath10k_sta_state()
7538 sta->addr, peer, i, arvif->vdev_id); in ath10k_sta_state()
7539 peer->sta = NULL; in ath10k_sta_state()
7544 list_del(&peer->list); in ath10k_sta_state()
7545 ar->peer_map[i] = NULL; in ath10k_sta_state()
7547 ar->num_peers--; in ath10k_sta_state()
7550 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7553 kfree(arsta->tx_stats); in ath10k_sta_state()
7554 arsta->tx_stats = NULL; in ath10k_sta_state()
7557 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) in ath10k_sta_state()
7558 ath10k_mac_txq_unref(ar, sta->txq[i]); in ath10k_sta_state()
7560 if (!sta->tdls) in ath10k_sta_state()
7567 ret = ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7571 arvif->vdev_id, ret); in ath10k_sta_state()
7575 (vif->type == NL80211_IFTYPE_AP || in ath10k_sta_state()
7576 vif->type == NL80211_IFTYPE_MESH_POINT || in ath10k_sta_state()
7577 vif->type == NL80211_IFTYPE_ADHOC)) { in ath10k_sta_state()
7582 sta->addr); in ath10k_sta_state()
7587 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7590 sta->tdls) { in ath10k_sta_state()
7595 sta->addr); in ath10k_sta_state()
7600 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7604 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, sta, in ath10k_sta_state()
7608 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7611 (vif->type == NL80211_IFTYPE_AP || in ath10k_sta_state()
7612 vif->type == NL80211_IFTYPE_MESH_POINT || in ath10k_sta_state()
7613 vif->type == NL80211_IFTYPE_ADHOC)) { in ath10k_sta_state()
7618 sta->addr); in ath10k_sta_state()
7623 sta->addr, arvif->vdev_id, ret); in ath10k_sta_state()
7626 mutex_unlock(&ar->conf_mutex); in ath10k_sta_state()
7633 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_conf_tx_uapsd()
7639 lockdep_assert_held(&ar->conf_mutex); in ath10k_conf_tx_uapsd()
7641 if (arvif->vdev_type != WMI_VDEV_TYPE_STA) in ath10k_conf_tx_uapsd()
7672 arvif->u.sta.uapsd |= value; in ath10k_conf_tx_uapsd()
7674 arvif->u.sta.uapsd &= ~value; in ath10k_conf_tx_uapsd()
7676 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7678 arvif->u.sta.uapsd); in ath10k_conf_tx_uapsd()
7684 if (arvif->u.sta.uapsd) in ath10k_conf_tx_uapsd()
7689 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7698 arvif->vdev_id, ret); in ath10k_conf_tx_uapsd()
7705 arvif->vdev_id, ret); in ath10k_conf_tx_uapsd()
7709 if (test_bit(WMI_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG, ar->wmi.svc_map) || in ath10k_conf_tx_uapsd()
7710 test_bit(WMI_SERVICE_STA_UAPSD_VAR_AUTO_TRIG, ar->wmi.svc_map)) { in ath10k_conf_tx_uapsd()
7712 * trigger frame. The following effectively disables u-UAPSD in ath10k_conf_tx_uapsd()
7723 ret = ath10k_wmi_vdev_sta_uapsd(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7724 arvif->bssid, &arg, 1); in ath10k_conf_tx_uapsd()
7740 struct ath10k *ar = hw->priv; in ath10k_conf_tx()
7741 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_conf_tx()
7745 mutex_lock(&ar->conf_mutex); in ath10k_conf_tx()
7749 p = &arvif->wmm_params.ac_vo; in ath10k_conf_tx()
7752 p = &arvif->wmm_params.ac_vi; in ath10k_conf_tx()
7755 p = &arvif->wmm_params.ac_be; in ath10k_conf_tx()
7758 p = &arvif->wmm_params.ac_bk; in ath10k_conf_tx()
7763 ret = -EINVAL; in ath10k_conf_tx()
7767 p->cwmin = params->cw_min; in ath10k_conf_tx()
7768 p->cwmax = params->cw_max; in ath10k_conf_tx()
7769 p->aifs = params->aifs; in ath10k_conf_tx()
7776 p->txop = params->txop * 32; in ath10k_conf_tx()
7778 if (ar->wmi.ops->gen_vdev_wmm_conf) { in ath10k_conf_tx()
7779 ret = ath10k_wmi_vdev_wmm_conf(ar, arvif->vdev_id, in ath10k_conf_tx()
7780 &arvif->wmm_params); in ath10k_conf_tx()
7783 arvif->vdev_id, ret); in ath10k_conf_tx()
7787 /* This won't work well with multi-interface cases but it's in ath10k_conf_tx()
7790 ret = ath10k_wmi_pdev_set_wmm_params(ar, &arvif->wmm_params); in ath10k_conf_tx()
7797 ret = ath10k_conf_tx_uapsd(ar, vif, ac, params->uapsd); in ath10k_conf_tx()
7802 mutex_unlock(&ar->conf_mutex); in ath10k_conf_tx()
7812 struct ath10k *ar = hw->priv; in ath10k_remain_on_channel()
7813 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_remain_on_channel()
7818 mutex_lock(&ar->conf_mutex); in ath10k_remain_on_channel()
7821 ret = -EBUSY; in ath10k_remain_on_channel()
7825 spin_lock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7826 switch (ar->scan.state) { in ath10k_remain_on_channel()
7828 reinit_completion(&ar->scan.started); in ath10k_remain_on_channel()
7829 reinit_completion(&ar->scan.completed); in ath10k_remain_on_channel()
7830 reinit_completion(&ar->scan.on_channel); in ath10k_remain_on_channel()
7831 ar->scan.state = ATH10K_SCAN_STARTING; in ath10k_remain_on_channel()
7832 ar->scan.is_roc = true; in ath10k_remain_on_channel()
7833 ar->scan.vdev_id = arvif->vdev_id; in ath10k_remain_on_channel()
7834 ar->scan.roc_freq = chan->center_freq; in ath10k_remain_on_channel()
7835 ar->scan.roc_notify = true; in ath10k_remain_on_channel()
7841 ret = -EBUSY; in ath10k_remain_on_channel()
7844 spin_unlock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7849 scan_time_msec = ar->hw->wiphy->max_remain_on_channel_duration * 2; in ath10k_remain_on_channel()
7853 arg.vdev_id = arvif->vdev_id; in ath10k_remain_on_channel()
7856 arg.channels[0] = chan->center_freq; in ath10k_remain_on_channel()
7867 spin_lock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7868 ar->scan.state = ATH10K_SCAN_IDLE; in ath10k_remain_on_channel()
7869 spin_unlock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7873 ret = wait_for_completion_timeout(&ar->scan.on_channel, 3 * HZ); in ath10k_remain_on_channel()
7881 ret = -ETIMEDOUT; in ath10k_remain_on_channel()
7885 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath10k_remain_on_channel()
7890 mutex_unlock(&ar->conf_mutex); in ath10k_remain_on_channel()
7897 struct ath10k *ar = hw->priv; in ath10k_cancel_remain_on_channel()
7899 mutex_lock(&ar->conf_mutex); in ath10k_cancel_remain_on_channel()
7901 spin_lock_bh(&ar->data_lock); in ath10k_cancel_remain_on_channel()
7902 ar->scan.roc_notify = false; in ath10k_cancel_remain_on_channel()
7903 spin_unlock_bh(&ar->data_lock); in ath10k_cancel_remain_on_channel()
7907 mutex_unlock(&ar->conf_mutex); in ath10k_cancel_remain_on_channel()
7909 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_cancel_remain_on_channel()
7915 * Both RTS and Fragmentation threshold are interface-specific
7916 * in ath10k, but device-specific in mac80211.
7921 struct ath10k *ar = hw->priv; in ath10k_set_rts_threshold()
7925 mutex_lock(&ar->conf_mutex); in ath10k_set_rts_threshold()
7926 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_set_rts_threshold()
7928 arvif->vdev_id, value); in ath10k_set_rts_threshold()
7933 arvif->vdev_id, ret); in ath10k_set_rts_threshold()
7937 mutex_unlock(&ar->conf_mutex); in ath10k_set_rts_threshold()
7954 return -EOPNOTSUPP; in ath10k_mac_op_set_frag_threshold()
7966 if (ar->state == ATH10K_STATE_WEDGED) in ath10k_mac_wait_tx_complete()
7969 time_left = wait_event_timeout(ar->htt.empty_tx_wq, ({ in ath10k_mac_wait_tx_complete()
7972 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_wait_tx_complete()
7973 empty = (ar->htt.num_pending_tx == 0); in ath10k_mac_wait_tx_complete()
7974 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_wait_tx_complete()
7976 skip = (ar->state == ATH10K_STATE_WEDGED) || in ath10k_mac_wait_tx_complete()
7978 &ar->dev_flags); in ath10k_mac_wait_tx_complete()
7984 ath10k_warn(ar, "failed to flush transmit queue (skip %i ar-state %i): %ld\n", in ath10k_mac_wait_tx_complete()
7985 skip, ar->state, time_left); in ath10k_mac_wait_tx_complete()
7991 struct ath10k *ar = hw->priv; in ath10k_flush()
7996 if (vif && vif->type == NL80211_IFTYPE_STATION) { in ath10k_flush()
7998 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_flush()
7999 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath10k_flush()
8000 ath10k_wmi_peer_flush(ar, arvif->vdev_id, in ath10k_flush()
8001 arvif->bssid, bitmap); in ath10k_flush()
8003 ath10k_htt_flush_tx(&ar->htt); in ath10k_flush()
8008 mutex_lock(&ar->conf_mutex); in ath10k_flush()
8010 mutex_unlock(&ar->conf_mutex); in ath10k_flush()
8025 struct ath10k *ar = hw->priv; in ath10k_reconfig_complete()
8030 mutex_lock(&ar->conf_mutex); in ath10k_reconfig_complete()
8035 if (ar->state == ATH10K_STATE_RESTARTED) { in ath10k_reconfig_complete()
8037 ar->state = ATH10K_STATE_ON; in ath10k_reconfig_complete()
8038 ieee80211_wake_queues(ar->hw); in ath10k_reconfig_complete()
8039 clear_bit(ATH10K_FLAG_RESTARTING, &ar->dev_flags); in ath10k_reconfig_complete()
8042 mutex_unlock(&ar->conf_mutex); in ath10k_reconfig_complete()
8052 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_bss_chan_survey()
8054 if (!test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map) || in ath10k_mac_update_bss_chan_survey()
8055 (ar->rx_channel != channel)) in ath10k_mac_update_bss_chan_survey()
8058 if (ar->scan.state != ATH10K_SCAN_IDLE) { in ath10k_mac_update_bss_chan_survey()
8063 reinit_completion(&ar->bss_survey_done); in ath10k_mac_update_bss_chan_survey()
8071 ret = wait_for_completion_timeout(&ar->bss_survey_done, 3 * HZ); in ath10k_mac_update_bss_chan_survey()
8081 struct ath10k *ar = hw->priv; in ath10k_get_survey()
8083 struct survey_info *ar_survey = &ar->survey[idx]; in ath10k_get_survey()
8086 mutex_lock(&ar->conf_mutex); in ath10k_get_survey()
8088 sband = hw->wiphy->bands[NL80211_BAND_2GHZ]; in ath10k_get_survey()
8089 if (sband && idx >= sband->n_channels) { in ath10k_get_survey()
8090 idx -= sband->n_channels; in ath10k_get_survey()
8095 sband = hw->wiphy->bands[NL80211_BAND_5GHZ]; in ath10k_get_survey()
8097 if (!sband || idx >= sband->n_channels) { in ath10k_get_survey()
8098 ret = -ENOENT; in ath10k_get_survey()
8102 ath10k_mac_update_bss_chan_survey(ar, &sband->channels[idx]); in ath10k_get_survey()
8104 spin_lock_bh(&ar->data_lock); in ath10k_get_survey()
8106 spin_unlock_bh(&ar->data_lock); in ath10k_get_survey()
8108 survey->channel = &sband->channels[idx]; in ath10k_get_survey()
8110 if (ar->rx_channel == survey->channel) in ath10k_get_survey()
8111 survey->filled |= SURVEY_INFO_IN_USE; in ath10k_get_survey()
8114 mutex_unlock(&ar->conf_mutex); in ath10k_get_survey()
8124 struct ieee80211_supported_band *sband = &ar->mac.sbands[band]; in ath10k_mac_bitrate_mask_get_single_nss()
8125 u16 vht_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map); in ath10k_mac_bitrate_mask_get_single_nss()
8130 if (mask->control[band].legacy) in ath10k_mac_bitrate_mask_get_single_nss()
8133 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_nss()
8134 if (mask->control[band].ht_mcs[i] == 0) in ath10k_mac_bitrate_mask_get_single_nss()
8136 else if (mask->control[band].ht_mcs[i] == in ath10k_mac_bitrate_mask_get_single_nss()
8137 sband->ht_cap.mcs.rx_mask[i]) in ath10k_mac_bitrate_mask_get_single_nss()
8143 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath10k_mac_bitrate_mask_get_single_nss()
8144 if (mask->control[band].vht_mcs[i] == 0) in ath10k_mac_bitrate_mask_get_single_nss()
8146 else if (mask->control[band].vht_mcs[i] == in ath10k_mac_bitrate_mask_get_single_nss()
8159 if (BIT(fls(ht_nss_mask)) - 1 != ht_nss_mask) in ath10k_mac_bitrate_mask_get_single_nss()
8170 struct ath10k *ar = arvif->ar; in ath10k_mac_set_fixed_rate_params()
8174 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_set_fixed_rate_params()
8177 arvif->vdev_id, rate, nss, sgi); in ath10k_mac_set_fixed_rate_params()
8179 vdev_param = ar->wmi.vdev_param->fixed_rate; in ath10k_mac_set_fixed_rate_params()
8180 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, rate); in ath10k_mac_set_fixed_rate_params()
8187 vdev_param = ar->wmi.vdev_param->nss; in ath10k_mac_set_fixed_rate_params()
8188 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, nss); in ath10k_mac_set_fixed_rate_params()
8194 vdev_param = ar->wmi.vdev_param->sgi; in ath10k_mac_set_fixed_rate_params()
8195 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, sgi); in ath10k_mac_set_fixed_rate_params()
8201 vdev_param = ar->wmi.vdev_param->ldpc; in ath10k_mac_set_fixed_rate_params()
8202 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, ldpc); in ath10k_mac_set_fixed_rate_params()
8222 * ranges can be used: none, 0-7, 0-8 and 0-9. in ath10k_mac_can_set_bitrate_mask()
8225 vht_mcs = mask->control[band].vht_mcs[i]; in ath10k_mac_can_set_bitrate_mask()
8229 case BIT(8) - 1: in ath10k_mac_can_set_bitrate_mask()
8230 case BIT(9) - 1: in ath10k_mac_can_set_bitrate_mask()
8231 case BIT(10) - 1: in ath10k_mac_can_set_bitrate_mask()
8235 ath10k_warn(ar, "refusing bitrate mask with missing 0-7 VHT MCS rates\n"); in ath10k_mac_can_set_bitrate_mask()
8248 u8 rate = arvif->vht_pfr; in ath10k_mac_set_vht_bitrate_mask_fixup()
8251 if (!sta->vht_cap.vht_supported || arvif->vht_num_rates != 1) in ath10k_mac_set_vht_bitrate_mask_fixup()
8254 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_mac_set_vht_bitrate_mask_fixup()
8258 sta->addr, err); in ath10k_mac_set_vht_bitrate_mask_fixup()
8267 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_set_bitrate_mask_iter()
8268 struct ath10k *ar = arvif->ar; in ath10k_mac_set_bitrate_mask_iter()
8270 if (arsta->arvif != arvif) in ath10k_mac_set_bitrate_mask_iter()
8276 spin_lock_bh(&ar->data_lock); in ath10k_mac_set_bitrate_mask_iter()
8277 arsta->changed |= IEEE80211_RC_SUPP_RATES_CHANGED; in ath10k_mac_set_bitrate_mask_iter()
8278 spin_unlock_bh(&ar->data_lock); in ath10k_mac_set_bitrate_mask_iter()
8280 ieee80211_queue_work(ar->hw, &arsta->update_wk); in ath10k_mac_set_bitrate_mask_iter()
8287 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_clr_bitrate_mask_iter()
8288 struct ath10k *ar = arvif->ar; in ath10k_mac_clr_bitrate_mask_iter()
8292 if (arsta->arvif != arvif || !sta->vht_cap.vht_supported) in ath10k_mac_clr_bitrate_mask_iter()
8295 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_mac_clr_bitrate_mask_iter()
8300 sta->addr, err); in ath10k_mac_clr_bitrate_mask_iter()
8307 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_set_bitrate_mask()
8309 struct ath10k *ar = arvif->ar; in ath10k_mac_op_set_bitrate_mask()
8324 return -EPERM; in ath10k_mac_op_set_bitrate_mask()
8326 band = def.chan->band; in ath10k_mac_op_set_bitrate_mask()
8327 ht_mcs_mask = mask->control[band].ht_mcs; in ath10k_mac_op_set_bitrate_mask()
8328 vht_mcs_mask = mask->control[band].vht_mcs; in ath10k_mac_op_set_bitrate_mask()
8329 ldpc = !!(ar->ht_cap_info & WMI_HT_CAP_LDPC); in ath10k_mac_op_set_bitrate_mask()
8331 sgi = mask->control[band].gi; in ath10k_mac_op_set_bitrate_mask()
8333 return -EINVAL; in ath10k_mac_op_set_bitrate_mask()
8336 ar->normal_mode_fw.fw_file.fw_features); in ath10k_mac_op_set_bitrate_mask()
8338 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8339 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_mac_op_set_bitrate_mask()
8342 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8352 arvif->vdev_id, ret); in ath10k_mac_op_set_bitrate_mask()
8361 nss = min(ar->num_rf_chains, in ath10k_mac_op_set_bitrate_mask()
8362 max(ath10k_mac_max_ht_nss(ht_mcs_mask), in ath10k_mac_op_set_bitrate_mask()
8370 return -EINVAL; in ath10k_mac_op_set_bitrate_mask()
8385 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8388 arvif->bitrate_mask = *mask; in ath10k_mac_op_set_bitrate_mask()
8389 arvif->vht_num_rates = vht_num_rates; in ath10k_mac_op_set_bitrate_mask()
8390 arvif->vht_pfr = vht_pfr; in ath10k_mac_op_set_bitrate_mask()
8391 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_mac_op_set_bitrate_mask()
8395 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8398 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8403 arvif->vdev_id, ret); in ath10k_mac_op_set_bitrate_mask()
8408 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8418 struct ath10k *ar = hw->priv; in ath10k_sta_rc_update()
8419 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_rc_update()
8420 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_sta_rc_update()
8424 spin_lock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8426 peer = ath10k_peer_find(ar, arvif->vdev_id, sta->addr); in ath10k_sta_rc_update()
8428 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8430 sta->addr, arvif->vdev_id); in ath10k_sta_rc_update()
8436 sta->addr, changed, sta->bandwidth, sta->rx_nss, in ath10k_sta_rc_update()
8437 sta->smps_mode); in ath10k_sta_rc_update()
8442 switch (sta->bandwidth) { in ath10k_sta_rc_update()
8457 sta->bandwidth, sta->addr); in ath10k_sta_rc_update()
8462 arsta->bw = bw; in ath10k_sta_rc_update()
8466 arsta->nss = sta->rx_nss; in ath10k_sta_rc_update()
8471 switch (sta->smps_mode) { in ath10k_sta_rc_update()
8484 sta->smps_mode, sta->addr); in ath10k_sta_rc_update()
8489 arsta->smps = smps; in ath10k_sta_rc_update()
8492 arsta->changed |= changed; in ath10k_sta_rc_update()
8494 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8496 ieee80211_queue_work(hw, &arsta->update_wk); in ath10k_sta_rc_update()
8502 struct ath10k *ar = hw->priv; in ath10k_offset_tsf()
8503 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_offset_tsf()
8508 vdev_param = ar->wmi.vdev_param->dec_tsf; in ath10k_offset_tsf()
8509 offset = -tsf_offset; in ath10k_offset_tsf()
8511 vdev_param = ar->wmi.vdev_param->inc_tsf; in ath10k_offset_tsf()
8515 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_offset_tsf()
8518 if (ret && ret != -EOPNOTSUPP) in ath10k_offset_tsf()
8527 struct ath10k *ar = hw->priv; in ath10k_ampdu_action()
8528 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_ampdu_action()
8529 struct ieee80211_sta *sta = params->sta; in ath10k_ampdu_action()
8530 enum ieee80211_ampdu_mlme_action action = params->action; in ath10k_ampdu_action()
8531 u16 tid = params->tid; in ath10k_ampdu_action()
8534 arvif->vdev_id, sta->addr, tid, action); in ath10k_ampdu_action()
8551 return -EOPNOTSUPP; in ath10k_ampdu_action()
8554 return -EINVAL; in ath10k_ampdu_action()
8565 /* Both locks are required because ar->rx_channel is modified. This in ath10k_mac_update_rx_channel()
8568 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_rx_channel()
8569 lockdep_assert_held(&ar->data_lock); in ath10k_mac_update_rx_channel()
8575 * on a linked list now. Doing a lookup peer -> vif -> chanctx for each in ath10k_mac_update_rx_channel()
8576 * ppdu on Rx may reduce performance on low-end systems. It should be in ath10k_mac_update_rx_channel()
8580 * only for multi-channel cases. Single-channel cases will remain to in ath10k_mac_update_rx_channel()
8586 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_update_rx_channel()
8591 def = &vifs[0].new_ctx->def; in ath10k_mac_update_rx_channel()
8593 ar->rx_channel = def->chan; in ath10k_mac_update_rx_channel()
8595 (ctx && (ar->state == ATH10K_STATE_RESTARTED))) { in ath10k_mac_update_rx_channel()
8601 ar->rx_channel = ctx->def.chan; in ath10k_mac_update_rx_channel()
8603 ar->rx_channel = NULL; in ath10k_mac_update_rx_channel()
8617 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_vif_chan()
8622 if (ar->monitor_started) in ath10k_mac_update_vif_chan()
8626 arvif = (void *)vifs[i].vif->drv_priv; in ath10k_mac_update_vif_chan()
8629 "mac chanctx switch vdev_id %i freq %u->%u width %d->%d\n", in ath10k_mac_update_vif_chan()
8630 arvif->vdev_id, in ath10k_mac_update_vif_chan()
8631 vifs[i].old_ctx->def.chan->center_freq, in ath10k_mac_update_vif_chan()
8632 vifs[i].new_ctx->def.chan->center_freq, in ath10k_mac_update_vif_chan()
8633 vifs[i].old_ctx->def.width, in ath10k_mac_update_vif_chan()
8634 vifs[i].new_ctx->def.width); in ath10k_mac_update_vif_chan()
8636 if (WARN_ON(!arvif->is_started)) in ath10k_mac_update_vif_chan()
8639 if (WARN_ON(!arvif->is_up)) in ath10k_mac_update_vif_chan()
8642 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_update_vif_chan()
8645 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8654 spin_lock_bh(&ar->data_lock); in ath10k_mac_update_vif_chan()
8656 spin_unlock_bh(&ar->data_lock); in ath10k_mac_update_vif_chan()
8659 arvif = (void *)vifs[i].vif->drv_priv; in ath10k_mac_update_vif_chan()
8661 if (WARN_ON(!arvif->is_started)) in ath10k_mac_update_vif_chan()
8664 if (WARN_ON(!arvif->is_up)) in ath10k_mac_update_vif_chan()
8677 ret = ath10k_vdev_restart(arvif, &vifs[i].new_ctx->def); in ath10k_mac_update_vif_chan()
8680 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8684 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_mac_update_vif_chan()
8685 arvif->bssid); in ath10k_mac_update_vif_chan()
8688 arvif->vdev_id, ret); in ath10k_mac_update_vif_chan()
8700 struct ath10k *ar = hw->priv; in ath10k_mac_op_add_chanctx()
8704 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath10k_mac_op_add_chanctx()
8706 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_add_chanctx()
8708 spin_lock_bh(&ar->data_lock); in ath10k_mac_op_add_chanctx()
8710 spin_unlock_bh(&ar->data_lock); in ath10k_mac_op_add_chanctx()
8715 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_add_chanctx()
8724 struct ath10k *ar = hw->priv; in ath10k_mac_op_remove_chanctx()
8728 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath10k_mac_op_remove_chanctx()
8730 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_remove_chanctx()
8732 spin_lock_bh(&ar->data_lock); in ath10k_mac_op_remove_chanctx()
8734 spin_unlock_bh(&ar->data_lock); in ath10k_mac_op_remove_chanctx()
8739 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_remove_chanctx()
8755 if (rcu_access_pointer(vif->chanctx_conf) != arg->ctx) in ath10k_mac_change_chanctx_cnt_iter()
8758 arg->n_vifs++; in ath10k_mac_change_chanctx_cnt_iter()
8768 ctx = rcu_access_pointer(vif->chanctx_conf); in ath10k_mac_change_chanctx_fill_iter()
8769 if (ctx != arg->ctx) in ath10k_mac_change_chanctx_fill_iter()
8772 if (WARN_ON(arg->next_vif == arg->n_vifs)) in ath10k_mac_change_chanctx_fill_iter()
8775 arg->vifs[arg->next_vif].vif = vif; in ath10k_mac_change_chanctx_fill_iter()
8776 arg->vifs[arg->next_vif].old_ctx = ctx; in ath10k_mac_change_chanctx_fill_iter()
8777 arg->vifs[arg->next_vif].new_ctx = ctx; in ath10k_mac_change_chanctx_fill_iter()
8778 arg->next_vif++; in ath10k_mac_change_chanctx_fill_iter()
8786 struct ath10k *ar = hw->priv; in ath10k_mac_op_change_chanctx()
8789 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_change_chanctx()
8793 ctx->def.chan->center_freq, ctx->def.width, ctx, changed); in ath10k_mac_op_change_chanctx()
8830 * definitions per vdev internally and there's no host-side channel in ath10k_mac_op_change_chanctx()
8835 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_change_chanctx()
8843 struct ath10k *ar = hw->priv; in ath10k_mac_op_assign_vif_chanctx()
8844 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_assign_vif_chanctx()
8847 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8851 ctx, arvif->vdev_id); in ath10k_mac_op_assign_vif_chanctx()
8853 if (WARN_ON(arvif->is_started)) { in ath10k_mac_op_assign_vif_chanctx()
8854 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8855 return -EBUSY; in ath10k_mac_op_assign_vif_chanctx()
8858 ret = ath10k_vdev_start(arvif, &ctx->def); in ath10k_mac_op_assign_vif_chanctx()
8861 arvif->vdev_id, vif->addr, in ath10k_mac_op_assign_vif_chanctx()
8862 ctx->def.chan->center_freq, ret); in ath10k_mac_op_assign_vif_chanctx()
8866 arvif->is_started = true; in ath10k_mac_op_assign_vif_chanctx()
8871 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
8875 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_mac_op_assign_vif_chanctx()
8876 ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, 0, vif->addr); in ath10k_mac_op_assign_vif_chanctx()
8879 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
8883 arvif->is_up = true; in ath10k_mac_op_assign_vif_chanctx()
8890 arvif->vdev_id, ret); in ath10k_mac_op_assign_vif_chanctx()
8894 ar->hw_params.tx_stats_over_pktlog) { in ath10k_mac_op_assign_vif_chanctx()
8895 ar->pktlog_filter |= ATH10K_PKTLOG_PEER_STATS; in ath10k_mac_op_assign_vif_chanctx()
8897 ar->pktlog_filter); in ath10k_mac_op_assign_vif_chanctx()
8904 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8909 arvif->is_started = false; in ath10k_mac_op_assign_vif_chanctx()
8913 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8922 struct ath10k *ar = hw->priv; in ath10k_mac_op_unassign_vif_chanctx()
8923 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_unassign_vif_chanctx()
8926 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_unassign_vif_chanctx()
8930 ctx, arvif->vdev_id); in ath10k_mac_op_unassign_vif_chanctx()
8932 WARN_ON(!arvif->is_started); in ath10k_mac_op_unassign_vif_chanctx()
8934 if (vif->type == NL80211_IFTYPE_MONITOR) { in ath10k_mac_op_unassign_vif_chanctx()
8935 WARN_ON(!arvif->is_up); in ath10k_mac_op_unassign_vif_chanctx()
8937 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_op_unassign_vif_chanctx()
8940 arvif->vdev_id, ret); in ath10k_mac_op_unassign_vif_chanctx()
8942 arvif->is_up = false; in ath10k_mac_op_unassign_vif_chanctx()
8948 arvif->vdev_id, ret); in ath10k_mac_op_unassign_vif_chanctx()
8950 arvif->is_started = false; in ath10k_mac_op_unassign_vif_chanctx()
8952 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_unassign_vif_chanctx()
8961 struct ath10k *ar = hw->priv; in ath10k_mac_op_switch_vif_chanctx()
8963 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_switch_vif_chanctx()
8970 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_switch_vif_chanctx()
8981 ar = hw->priv; in ath10k_mac_op_sta_pre_rcu_remove()
8983 list_for_each_entry(peer, &ar->peers, list) in ath10k_mac_op_sta_pre_rcu_remove()
8984 if (peer->sta == sta) in ath10k_mac_op_sta_pre_rcu_remove()
8985 peer->removed = true; in ath10k_mac_op_sta_pre_rcu_remove()
9062 index = mcs - len_nss1; in ath10k_mac_get_rate_flags_ht()
9134 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac parse rate code 0x%x bitrate %d kbps\n", in ath10k_mac_parse_bitrate()
9145 "mac parse bitrate preamble %d mode %d nss %d mcs %d flags %x bw %d\n", in ath10k_mac_parse_bitrate()
9148 rate->flags = flags; in ath10k_mac_parse_bitrate()
9149 rate->bw = bw; in ath10k_mac_parse_bitrate()
9150 rate->legacy = bitrate_kbps / 100; in ath10k_mac_parse_bitrate()
9151 rate->nss = nss; in ath10k_mac_parse_bitrate()
9152 rate->mcs = mcs; in ath10k_mac_parse_bitrate()
9159 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_mac_sta_get_peer_stats_info()
9164 if (!(ar->hw_params.supports_peer_stats_info && in ath10k_mac_sta_get_peer_stats_info()
9165 arsta->arvif->vdev_type == WMI_VDEV_TYPE_STA)) in ath10k_mac_sta_get_peer_stats_info()
9168 spin_lock_bh(&ar->data_lock); in ath10k_mac_sta_get_peer_stats_info()
9169 peer = ath10k_peer_find(ar, arsta->arvif->vdev_id, sta->addr); in ath10k_mac_sta_get_peer_stats_info()
9170 spin_unlock_bh(&ar->data_lock); in ath10k_mac_sta_get_peer_stats_info()
9174 reinit_completion(&ar->peer_stats_info_complete); in ath10k_mac_sta_get_peer_stats_info()
9177 arsta->arvif->vdev_id, in ath10k_mac_sta_get_peer_stats_info()
9179 arsta->arvif->bssid, in ath10k_mac_sta_get_peer_stats_info()
9181 if (ret && ret != -EOPNOTSUPP) { in ath10k_mac_sta_get_peer_stats_info()
9186 time_left = wait_for_completion_timeout(&ar->peer_stats_info_complete, 3 * HZ); in ath10k_mac_sta_get_peer_stats_info()
9192 if (arsta->rx_rate_code != 0 && arsta->rx_bitrate_kbps != 0) { in ath10k_mac_sta_get_peer_stats_info()
9193 ath10k_mac_parse_bitrate(ar, arsta->rx_rate_code, in ath10k_mac_sta_get_peer_stats_info()
9194 arsta->rx_bitrate_kbps, in ath10k_mac_sta_get_peer_stats_info()
9195 &sinfo->rxrate); in ath10k_mac_sta_get_peer_stats_info()
9197 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BITRATE); in ath10k_mac_sta_get_peer_stats_info()
9198 arsta->rx_rate_code = 0; in ath10k_mac_sta_get_peer_stats_info()
9199 arsta->rx_bitrate_kbps = 0; in ath10k_mac_sta_get_peer_stats_info()
9202 if (arsta->tx_rate_code != 0 && arsta->tx_bitrate_kbps != 0) { in ath10k_mac_sta_get_peer_stats_info()
9203 ath10k_mac_parse_bitrate(ar, arsta->tx_rate_code, in ath10k_mac_sta_get_peer_stats_info()
9204 arsta->tx_bitrate_kbps, in ath10k_mac_sta_get_peer_stats_info()
9205 &sinfo->txrate); in ath10k_mac_sta_get_peer_stats_info()
9207 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in ath10k_mac_sta_get_peer_stats_info()
9208 arsta->tx_rate_code = 0; in ath10k_mac_sta_get_peer_stats_info()
9209 arsta->tx_bitrate_kbps = 0; in ath10k_mac_sta_get_peer_stats_info()
9218 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_statistics()
9219 struct ath10k *ar = arsta->arvif->ar; in ath10k_sta_statistics()
9224 mutex_lock(&ar->conf_mutex); in ath10k_sta_statistics()
9226 mutex_unlock(&ar->conf_mutex); in ath10k_sta_statistics()
9228 sinfo->rx_duration = arsta->rx_duration; in ath10k_sta_statistics()
9229 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION); in ath10k_sta_statistics()
9231 if (arsta->txrate.legacy || arsta->txrate.nss) { in ath10k_sta_statistics()
9232 if (arsta->txrate.legacy) { in ath10k_sta_statistics()
9233 sinfo->txrate.legacy = arsta->txrate.legacy; in ath10k_sta_statistics()
9235 sinfo->txrate.mcs = arsta->txrate.mcs; in ath10k_sta_statistics()
9236 sinfo->txrate.nss = arsta->txrate.nss; in ath10k_sta_statistics()
9237 sinfo->txrate.bw = arsta->txrate.bw; in ath10k_sta_statistics()
9239 sinfo->txrate.flags = arsta->txrate.flags; in ath10k_sta_statistics()
9240 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in ath10k_sta_statistics()
9243 if (ar->htt.disable_tx_comp) { in ath10k_sta_statistics()
9244 sinfo->tx_failed = arsta->tx_failed; in ath10k_sta_statistics()
9245 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); in ath10k_sta_statistics()
9248 sinfo->tx_retries = arsta->tx_retries; in ath10k_sta_statistics()
9249 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES); in ath10k_sta_statistics()
9259 struct ath10k *ar = hw->priv; in ath10k_mac_op_set_tid_config()
9260 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_set_tid_config()
9265 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_tid_config()
9266 arg.vdev_id = arvif->vdev_id; in ath10k_mac_op_set_tid_config()
9268 arvif->tids_rst = 0; in ath10k_mac_op_set_tid_config()
9269 memset(arvif->tid_conf_changed, 0, sizeof(arvif->tid_conf_changed)); in ath10k_mac_op_set_tid_config()
9271 for (i = 0; i < tid_config->n_tid_conf; i++) { in ath10k_mac_op_set_tid_config()
9273 &tid_config->tid_conf[i], in ath10k_mac_op_set_tid_config()
9284 arvif->tids_rst = 0; in ath10k_mac_op_set_tid_config()
9292 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_tid_config()
9301 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_mac_op_reset_tid_config()
9303 struct ath10k *ar = hw->priv; in ath10k_mac_op_reset_tid_config()
9306 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_reset_tid_config()
9309 arvif->tids_rst = 0; in ath10k_mac_op_reset_tid_config()
9314 arvif->tids_rst = tids; in ath10k_mac_op_reset_tid_config()
9321 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_reset_tid_config()
9467 ar = hw->priv; in ath10k_mac_create()
9468 ar->hw = hw; in ath10k_mac_create()
9469 ar->ops = ops; in ath10k_mac_create()
9476 struct ieee80211_ops *ops = ar->ops; in ath10k_mac_destroy()
9478 ieee80211_free_hw(ar->hw); in ath10k_mac_destroy()
9484 .max = 8,
9489 .max = 3,
9493 .max = 1,
9497 .max = 7,
9507 .max = 8,
9514 .max = 1,
9548 .max = 2,
9552 .max = 2,
9561 .max = 1,
9568 .max = 2,
9572 .max = 2,
9576 .max = 1,
9584 .max = 1,
9591 .max = 1,
9595 .max = 1,
9600 /* FIXME: This is not thouroughly tested. These combinations may over- or
9641 .max = 1,
9645 .max = 16,
9696 struct ath10k_vif *arvif = (void *)vif->drv_priv; in ath10k_get_arvif_iter()
9698 if (arvif->vdev_id == arvif_iter->vdev_id) in ath10k_get_arvif_iter()
9699 arvif_iter->arvif = arvif; in ath10k_get_arvif_iter()
9709 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_get_arvif()
9731 if (wrdd->type != ACPI_TYPE_PACKAGE || in ath10k_mac_wrdd_get_mcc()
9732 wrdd->package.count < 2 || in ath10k_mac_wrdd_get_mcc()
9733 wrdd->package.elements[0].type != ACPI_TYPE_INTEGER || in ath10k_mac_wrdd_get_mcc()
9734 wrdd->package.elements[0].integer.value != 0) { in ath10k_mac_wrdd_get_mcc()
9739 for (i = 1; i < wrdd->package.count; ++i) { in ath10k_mac_wrdd_get_mcc()
9740 mcc_pkg = &wrdd->package.elements[i]; in ath10k_mac_wrdd_get_mcc()
9742 if (mcc_pkg->type != ACPI_TYPE_PACKAGE) in ath10k_mac_wrdd_get_mcc()
9744 if (mcc_pkg->package.count < 2) in ath10k_mac_wrdd_get_mcc()
9746 if (mcc_pkg->package.elements[0].type != ACPI_TYPE_INTEGER || in ath10k_mac_wrdd_get_mcc()
9747 mcc_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) in ath10k_mac_wrdd_get_mcc()
9750 domain_type = &mcc_pkg->package.elements[0]; in ath10k_mac_wrdd_get_mcc()
9751 if (domain_type->integer.value != WRDD_WIFI) in ath10k_mac_wrdd_get_mcc()
9754 mcc_value = &mcc_pkg->package.elements[1]; in ath10k_mac_wrdd_get_mcc()
9755 return mcc_value->integer.value; in ath10k_mac_wrdd_get_mcc()
9769 root_handle = ACPI_HANDLE(ar->dev); in ath10k_mac_get_wrdd_regulatory()
9771 return -EOPNOTSUPP; in ath10k_mac_get_wrdd_regulatory()
9777 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9784 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9790 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9797 "regulatory hint from WRDD (alpha2-code): %s\n", alpha2); in ath10k_mac_get_wrdd_regulatory()
9801 return -EIO; in ath10k_mac_get_wrdd_regulatory()
9816 rd = ar->hw_eeprom_rd; in ath10k_mac_init_rd()
9819 ar->ath_common.regulatory.current_rd = rd; in ath10k_mac_init_rd()
9840 /* Only QCA99x0 and QCA4019 varients support GCMP-128, GCMP-256 in ath10k_mac_register()
9841 * and CCMP-256 in hardware. in ath10k_mac_register()
9851 if (!is_valid_ether_addr(ar->mac_addr)) { in ath10k_mac_register()
9853 eth_random_addr(ar->mac_addr); in ath10k_mac_register()
9855 SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr); in ath10k_mac_register()
9857 SET_IEEE80211_DEV(ar->hw, ar->dev); in ath10k_mac_register()
9863 if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) { in ath10k_mac_register()
9868 ret = -ENOMEM; in ath10k_mac_register()
9872 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath10k_mac_register()
9873 band->n_channels = ARRAY_SIZE(ath10k_2ghz_channels); in ath10k_mac_register()
9874 band->channels = channels; in ath10k_mac_register()
9876 if (ar->hw_params.cck_rate_map_rev2) { in ath10k_mac_register()
9877 band->n_bitrates = ath10k_g_rates_rev2_size; in ath10k_mac_register()
9878 band->bitrates = ath10k_g_rates_rev2; in ath10k_mac_register()
9880 band->n_bitrates = ath10k_g_rates_size; in ath10k_mac_register()
9881 band->bitrates = ath10k_g_rates; in ath10k_mac_register()
9884 ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = band; in ath10k_mac_register()
9887 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) { in ath10k_mac_register()
9892 ret = -ENOMEM; in ath10k_mac_register()
9896 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath10k_mac_register()
9897 band->n_channels = ARRAY_SIZE(ath10k_5ghz_channels); in ath10k_mac_register()
9898 band->channels = channels; in ath10k_mac_register()
9899 band->n_bitrates = ath10k_a_rates_size; in ath10k_mac_register()
9900 band->bitrates = ath10k_a_rates; in ath10k_mac_register()
9901 ar->hw->wiphy->bands[NL80211_BAND_5GHZ] = band; in ath10k_mac_register()
9904 wiphy_read_of_freq_limits(ar->hw->wiphy); in ath10k_mac_register()
9907 ar->hw->wiphy->interface_modes = in ath10k_mac_register()
9912 ar->hw->wiphy->available_antennas_rx = ar->cfg_rx_chainmask; in ath10k_mac_register()
9913 ar->hw->wiphy->available_antennas_tx = ar->cfg_tx_chainmask; in ath10k_mac_register()
9915 if (!test_bit(ATH10K_FW_FEATURE_NO_P2P, ar->normal_mode_fw.fw_file.fw_features)) in ath10k_mac_register()
9916 ar->hw->wiphy->interface_modes |= in ath10k_mac_register()
9921 ieee80211_hw_set(ar->hw, SIGNAL_DBM); in ath10k_mac_register()
9924 ar->running_fw->fw_file.fw_features)) { in ath10k_mac_register()
9925 ieee80211_hw_set(ar->hw, SUPPORTS_PS); in ath10k_mac_register()
9926 ieee80211_hw_set(ar->hw, SUPPORTS_DYNAMIC_PS); in ath10k_mac_register()
9929 ieee80211_hw_set(ar->hw, MFP_CAPABLE); in ath10k_mac_register()
9930 ieee80211_hw_set(ar->hw, REPORTS_TX_ACK_STATUS); in ath10k_mac_register()
9931 ieee80211_hw_set(ar->hw, HAS_RATE_CONTROL); in ath10k_mac_register()
9932 ieee80211_hw_set(ar->hw, AP_LINK_PS); in ath10k_mac_register()
9933 ieee80211_hw_set(ar->hw, SPECTRUM_MGMT); in ath10k_mac_register()
9934 ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT); in ath10k_mac_register()
9935 ieee80211_hw_set(ar->hw, CONNECTION_MONITOR); in ath10k_mac_register()
9936 ieee80211_hw_set(ar->hw, SUPPORTS_PER_STA_GTK); in ath10k_mac_register()
9937 ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF); in ath10k_mac_register()
9938 ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); in ath10k_mac_register()
9939 ieee80211_hw_set(ar->hw, QUEUE_CONTROL); in ath10k_mac_register()
9940 ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); in ath10k_mac_register()
9941 ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); in ath10k_mac_register()
9943 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) in ath10k_mac_register()
9944 ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); in ath10k_mac_register()
9946 ar->hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS; in ath10k_mac_register()
9947 ar->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in ath10k_mac_register()
9949 if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) in ath10k_mac_register()
9950 ar->hw->wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS; in ath10k_mac_register()
9952 if (ar->ht_cap_info & WMI_HT_CAP_ENABLED) { in ath10k_mac_register()
9953 ieee80211_hw_set(ar->hw, AMPDU_AGGREGATION); in ath10k_mac_register()
9954 ieee80211_hw_set(ar->hw, TX_AMPDU_SETUP_IN_HW); in ath10k_mac_register()
9957 ar->hw->wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID; in ath10k_mac_register()
9958 ar->hw->wiphy->max_scan_ie_len = WLAN_SCAN_PARAMS_MAX_IE_LEN; in ath10k_mac_register()
9960 if (test_bit(WMI_SERVICE_NLO, ar->wmi.svc_map)) { in ath10k_mac_register()
9961 ar->hw->wiphy->max_sched_scan_ssids = WMI_PNO_MAX_SUPP_NETWORKS; in ath10k_mac_register()
9962 ar->hw->wiphy->max_match_sets = WMI_PNO_MAX_SUPP_NETWORKS; in ath10k_mac_register()
9963 ar->hw->wiphy->max_sched_scan_ie_len = WMI_PNO_MAX_IE_LENGTH; in ath10k_mac_register()
9964 ar->hw->wiphy->max_sched_scan_plans = WMI_PNO_MAX_SCHED_SCAN_PLANS; in ath10k_mac_register()
9965 ar->hw->wiphy->max_sched_scan_plan_interval = in ath10k_mac_register()
9967 ar->hw->wiphy->max_sched_scan_plan_iterations = in ath10k_mac_register()
9969 ar->hw->wiphy->features |= NL80211_FEATURE_ND_RANDOM_MAC_ADDR; in ath10k_mac_register()
9972 ar->hw->vif_data_size = sizeof(struct ath10k_vif); in ath10k_mac_register()
9973 ar->hw->sta_data_size = sizeof(struct ath10k_sta); in ath10k_mac_register()
9974 ar->hw->txq_data_size = sizeof(struct ath10k_txq); in ath10k_mac_register()
9976 ar->hw->max_listen_interval = ATH10K_MAX_HW_LISTEN_INTERVAL; in ath10k_mac_register()
9978 if (test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) { in ath10k_mac_register()
9979 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD; in ath10k_mac_register()
9985 ar->hw->wiphy->probe_resp_offload |= in ath10k_mac_register()
9991 if (test_bit(WMI_SERVICE_TDLS, ar->wmi.svc_map) || in ath10k_mac_register()
9992 test_bit(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY, ar->wmi.svc_map)) { in ath10k_mac_register()
9993 ar->hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; in ath10k_mac_register()
9994 if (test_bit(WMI_SERVICE_TDLS_WIDER_BANDWIDTH, ar->wmi.svc_map)) in ath10k_mac_register()
9995 ieee80211_hw_set(ar->hw, TDLS_WIDER_BW); in ath10k_mac_register()
9998 if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map)) in ath10k_mac_register()
9999 ieee80211_hw_set(ar->hw, SUPPORTS_TDLS_BUFFER_STA); in ath10k_mac_register()
10001 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; in ath10k_mac_register()
10002 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; in ath10k_mac_register()
10003 ar->hw->wiphy->max_remain_on_channel_duration = 5000; in ath10k_mac_register()
10005 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; in ath10k_mac_register()
10006 ar->hw->wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE | in ath10k_mac_register()
10009 ar->hw->wiphy->max_ap_assoc_sta = ar->max_num_stations; in ath10k_mac_register()
10017 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS); in ath10k_mac_register()
10018 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10020 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL); in ath10k_mac_register()
10022 if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map) || in ath10k_mac_register()
10023 test_bit(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ar->wmi.svc_map)) in ath10k_mac_register()
10024 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10028 test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map)) in ath10k_mac_register()
10029 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10032 if (test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) in ath10k_mac_register()
10033 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10036 if (test_bit(WMI_SERVICE_TX_PWR_PER_PEER, ar->wmi.svc_map)) in ath10k_mac_register()
10037 wiphy_ext_feature_set(ar->hw->wiphy, in ath10k_mac_register()
10040 if (test_bit(WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT, ar->wmi.svc_map)) { in ath10k_mac_register()
10041 ar->hw->wiphy->tid_config_support.vif |= in ath10k_mac_register()
10050 ar->wmi.svc_map)) { in ath10k_mac_register()
10051 ar->hw->wiphy->tid_config_support.vif |= in ath10k_mac_register()
10055 ar->hw->wiphy->tid_config_support.peer = in ath10k_mac_register()
10056 ar->hw->wiphy->tid_config_support.vif; in ath10k_mac_register()
10057 ar->hw->wiphy->max_data_retry_count = ATH10K_MAX_RETRY_COUNT; in ath10k_mac_register()
10059 ar->ops->set_tid_config = NULL; in ath10k_mac_register()
10065 ar->hw->queues = IEEE80211_MAX_QUEUES; in ath10k_mac_register()
10071 ar->hw->offchannel_tx_hw_queue = IEEE80211_MAX_QUEUES - 1; in ath10k_mac_register()
10073 switch (ar->running_fw->fw_file.wmi_op_version) { in ath10k_mac_register()
10075 ar->hw->wiphy->iface_combinations = ath10k_if_comb; in ath10k_mac_register()
10076 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10078 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); in ath10k_mac_register()
10081 if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar->wmi.svc_map)) { in ath10k_mac_register()
10082 ar->hw->wiphy->iface_combinations = in ath10k_mac_register()
10084 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10087 ar->hw->wiphy->iface_combinations = ath10k_tlv_if_comb; in ath10k_mac_register()
10088 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10091 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); in ath10k_mac_register()
10096 ar->hw->wiphy->iface_combinations = ath10k_10x_if_comb; in ath10k_mac_register()
10097 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10101 ar->hw->wiphy->iface_combinations = ath10k_10_4_if_comb; in ath10k_mac_register()
10102 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10105 ar->wmi.svc_map)) { in ath10k_mac_register()
10106 ar->hw->wiphy->iface_combinations = in ath10k_mac_register()
10108 ar->hw->wiphy->n_iface_combinations = in ath10k_mac_register()
10115 ret = -EINVAL; in ath10k_mac_register()
10119 if (ar->hw_params.dynamic_sar_support) in ath10k_mac_register()
10120 ar->hw->wiphy->sar_capa = &ath10k_sar_capa; in ath10k_mac_register()
10122 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) in ath10k_mac_register()
10123 ar->hw->netdev_features = NETIF_F_HW_CSUM; in ath10k_mac_register()
10127 ar->ath_common.debug_mask = ATH_DBG_DFS; in ath10k_mac_register()
10128 ar->dfs_detector = dfs_pattern_detector_init(&ar->ath_common, in ath10k_mac_register()
10131 if (!ar->dfs_detector) in ath10k_mac_register()
10142 if (!ar->hw_params.hw_ops->set_coverage_class) in ath10k_mac_register()
10143 ar->ops->set_coverage_class = NULL; in ath10k_mac_register()
10145 ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy, in ath10k_mac_register()
10152 if (test_bit(WMI_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi.svc_map)) { in ath10k_mac_register()
10153 ar->hw->wiphy->features |= in ath10k_mac_register()
10157 ar->hw->wiphy->cipher_suites = cipher_suites; in ath10k_mac_register()
10159 /* QCA988x and QCA6174 family chips do not support CCMP-256, GCMP-128 in ath10k_mac_register()
10160 * and GCMP-256 ciphers in hardware. Fetch number of ciphers supported in ath10k_mac_register()
10163 if (!ar->hw_params.n_cipher_suites || in ath10k_mac_register()
10164 ar->hw_params.n_cipher_suites > ARRAY_SIZE(cipher_suites)) { in ath10k_mac_register()
10166 ar->hw_params.n_cipher_suites); in ath10k_mac_register()
10167 ar->hw_params.n_cipher_suites = 8; in ath10k_mac_register()
10169 ar->hw->wiphy->n_cipher_suites = ar->hw_params.n_cipher_suites; in ath10k_mac_register()
10171 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); in ath10k_mac_register()
10173 ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; in ath10k_mac_register()
10175 ret = ieee80211_register_hw(ar->hw); in ath10k_mac_register()
10181 if (test_bit(WMI_SERVICE_PER_PACKET_SW_ENCRYPT, ar->wmi.svc_map)) { in ath10k_mac_register()
10182 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); in ath10k_mac_register()
10183 ar->hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN); in ath10k_mac_register()
10186 if (!ath_is_world_regd(&ar->ath_common.regulatory)) { in ath10k_mac_register()
10187 ret = regulatory_hint(ar->hw->wiphy, in ath10k_mac_register()
10188 ar->ath_common.regulatory.alpha2); in ath10k_mac_register()
10196 ieee80211_unregister_hw(ar->hw); in ath10k_mac_register()
10199 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) in ath10k_mac_register()
10200 ar->dfs_detector->exit(ar->dfs_detector); in ath10k_mac_register()
10203 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath10k_mac_register()
10204 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in ath10k_mac_register()
10206 SET_IEEE80211_DEV(ar->hw, NULL); in ath10k_mac_register()
10212 ieee80211_unregister_hw(ar->hw); in ath10k_mac_unregister()
10214 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) in ath10k_mac_unregister()
10215 ar->dfs_detector->exit(ar->dfs_detector); in ath10k_mac_unregister()
10217 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath10k_mac_unregister()
10218 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in ath10k_mac_unregister()
10220 SET_IEEE80211_DEV(ar->hw, NULL); in ath10k_mac_unregister()