Lines Matching refs:ar

213 int ath10k_mac_ext_resource_config(struct ath10k *ar, u32 val)  in ath10k_mac_ext_resource_config()  argument
218 if (test_bit(WMI_SERVICE_TX_MODE_DYNAMIC, ar->wmi.svc_map)) in ath10k_mac_ext_resource_config()
223 ret = ath10k_wmi_ext_resource_config(ar, platform_type, val); in ath10k_mac_ext_resource_config()
226 ath10k_warn(ar, "failed to configure ext resource: %d\n", ret); in ath10k_mac_ext_resource_config()
242 struct ath10k *ar = arvif->ar; in ath10k_send_key() local
252 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_send_key()
256 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_CCM]; in ath10k_send_key()
260 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_TKIP]; in ath10k_send_key()
266 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_WEP]; in ath10k_send_key()
269 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_CCM]; in ath10k_send_key()
273 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_GCM]; in ath10k_send_key()
283 ath10k_warn(ar, "cipher %d is not supported\n", key->cipher); in ath10k_send_key()
287 if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) in ath10k_send_key()
291 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_NONE]; in ath10k_send_key()
295 return ath10k_wmi_vdev_install_key(arvif->ar, &arg); in ath10k_send_key()
303 struct ath10k *ar = arvif->ar; in ath10k_install_key() local
307 lockdep_assert_held(&ar->conf_mutex); in ath10k_install_key()
309 reinit_completion(&ar->install_key_done); in ath10k_install_key()
318 time_left = wait_for_completion_timeout(&ar->install_key_done, 3 * HZ); in ath10k_install_key()
328 struct ath10k *ar = arvif->ar; in ath10k_install_peer_wep_keys() local
334 lockdep_assert_held(&ar->conf_mutex); in ath10k_install_peer_wep_keys()
341 spin_lock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
342 peer = ath10k_peer_find(ar, arvif->vdev_id, addr); in ath10k_install_peer_wep_keys()
343 spin_unlock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
381 spin_lock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
383 spin_unlock_bh(&ar->data_lock); in ath10k_install_peer_wep_keys()
400 ret = ath10k_wmi_vdev_set_param(arvif->ar, in ath10k_install_peer_wep_keys()
402 arvif->ar->wmi.vdev_param->def_keyid, in ath10k_install_peer_wep_keys()
405 ath10k_warn(ar, "failed to re-set def wpa key idxon vdev %i: %d\n", in ath10k_install_peer_wep_keys()
416 struct ath10k *ar = arvif->ar; in ath10k_clear_peer_keys() local
423 lockdep_assert_held(&ar->conf_mutex); in ath10k_clear_peer_keys()
425 spin_lock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
426 peer = ath10k_peer_find(ar, arvif->vdev_id, addr); in ath10k_clear_peer_keys()
427 spin_unlock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
443 ath10k_warn(ar, "failed to remove peer wep key %d: %d\n", in ath10k_clear_peer_keys()
446 spin_lock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
448 spin_unlock_bh(&ar->data_lock); in ath10k_clear_peer_keys()
454 bool ath10k_mac_is_peer_wep_key_set(struct ath10k *ar, const u8 *addr, in ath10k_mac_is_peer_wep_key_set() argument
460 lockdep_assert_held(&ar->data_lock); in ath10k_mac_is_peer_wep_key_set()
467 peer = ath10k_peer_find(ar, 0, addr); in ath10k_mac_is_peer_wep_key_set()
482 struct ath10k *ar = arvif->ar; in ath10k_clear_vdev_key() local
490 lockdep_assert_held(&ar->conf_mutex); in ath10k_clear_vdev_key()
496 spin_lock_bh(&ar->data_lock); in ath10k_clear_vdev_key()
498 list_for_each_entry(peer, &ar->peers, list) { in ath10k_clear_vdev_key()
510 spin_unlock_bh(&ar->data_lock); in ath10k_clear_vdev_key()
520 ath10k_warn(ar, "failed to remove key for %pM: %d\n", in ath10k_clear_vdev_key()
530 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_update_wep_key() local
534 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_vif_update_wep_key()
536 list_for_each_entry(peer, &ar->peers, list) { in ath10k_mac_vif_update_wep_key()
546 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vif vdev %i update key %i needs update\n", in ath10k_mac_vif_update_wep_key()
551 ath10k_warn(ar, "failed to update wep keys on vdev %i for peer %pM: %d\n", in ath10k_mac_vif_update_wep_key()
685 static int ath10k_mac_num_chanctxs(struct ath10k *ar) in ath10k_mac_num_chanctxs() argument
689 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_num_chanctxs()
706 static void ath10k_wait_for_peer_delete_done(struct ath10k *ar, u32 vdev_id, in ath10k_wait_for_peer_delete_done() argument
712 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) { in ath10k_wait_for_peer_delete_done()
713 ret = ath10k_wait_for_peer_deleted(ar, vdev_id, addr); in ath10k_wait_for_peer_delete_done()
715 ath10k_warn(ar, "failed wait for peer deleted"); in ath10k_wait_for_peer_delete_done()
719 time_left = wait_for_completion_timeout(&ar->peer_delete_done, in ath10k_wait_for_peer_delete_done()
722 ath10k_warn(ar, "Timeout in receiving peer delete response\n"); in ath10k_wait_for_peer_delete_done()
726 static int ath10k_peer_create(struct ath10k *ar, in ath10k_peer_create() argument
738 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_create()
740 num_peers = ar->num_peers; in ath10k_peer_create()
743 list_for_each_entry(arvif, &ar->arvifs, list) in ath10k_peer_create()
746 if (num_peers >= ar->max_num_peers) in ath10k_peer_create()
749 ret = ath10k_wmi_peer_create(ar, vdev_id, addr, peer_type); in ath10k_peer_create()
751 ath10k_warn(ar, "failed to create wmi peer %pM on vdev %i: %i\n", in ath10k_peer_create()
756 ret = ath10k_wait_for_peer_created(ar, vdev_id, addr); in ath10k_peer_create()
758 ath10k_warn(ar, "failed to wait for created wmi peer %pM on vdev %i: %i\n", in ath10k_peer_create()
763 spin_lock_bh(&ar->data_lock); in ath10k_peer_create()
765 peer = ath10k_peer_find(ar, vdev_id, addr); in ath10k_peer_create()
767 spin_unlock_bh(&ar->data_lock); in ath10k_peer_create()
768 ath10k_warn(ar, "failed to find peer %pM on vdev %i after creation\n", in ath10k_peer_create()
770 ath10k_wait_for_peer_delete_done(ar, vdev_id, addr); in ath10k_peer_create()
777 spin_unlock_bh(&ar->data_lock); in ath10k_peer_create()
779 ar->num_peers++; in ath10k_peer_create()
786 struct ath10k *ar = arvif->ar; in ath10k_mac_set_kickout() local
790 param = ar->wmi.pdev_param->sta_kickout_th; in ath10k_mac_set_kickout()
791 ret = ath10k_wmi_pdev_set_param(ar, param, in ath10k_mac_set_kickout()
794 ath10k_warn(ar, "failed to set kickout threshold on vdev %i: %d\n", in ath10k_mac_set_kickout()
799 param = ar->wmi.vdev_param->ap_keepalive_min_idle_inactive_time_secs; in ath10k_mac_set_kickout()
800 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
803 ath10k_warn(ar, "failed to set keepalive minimum idle time on vdev %i: %d\n", in ath10k_mac_set_kickout()
808 param = ar->wmi.vdev_param->ap_keepalive_max_idle_inactive_time_secs; in ath10k_mac_set_kickout()
809 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
812 ath10k_warn(ar, "failed to set keepalive maximum idle time on vdev %i: %d\n", in ath10k_mac_set_kickout()
817 param = ar->wmi.vdev_param->ap_keepalive_max_unresponsive_time_secs; in ath10k_mac_set_kickout()
818 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, in ath10k_mac_set_kickout()
821 ath10k_warn(ar, "failed to set keepalive maximum unresponsive time on vdev %i: %d\n", in ath10k_mac_set_kickout()
831 struct ath10k *ar = arvif->ar; in ath10k_mac_set_rts() local
834 vdev_param = ar->wmi.vdev_param->rts_threshold; in ath10k_mac_set_rts()
835 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, value); in ath10k_mac_set_rts()
838 static int ath10k_peer_delete(struct ath10k *ar, u32 vdev_id, const u8 *addr) in ath10k_peer_delete() argument
842 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_delete()
844 ret = ath10k_wmi_peer_delete(ar, vdev_id, addr); in ath10k_peer_delete()
848 ret = ath10k_wait_for_peer_deleted(ar, vdev_id, addr); in ath10k_peer_delete()
852 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) { in ath10k_peer_delete()
856 (&ar->peer_delete_done, 5 * HZ); in ath10k_peer_delete()
859 ath10k_warn(ar, "Timeout in receiving peer delete response\n"); in ath10k_peer_delete()
864 ar->num_peers--; in ath10k_peer_delete()
869 static void ath10k_peer_map_cleanup(struct ath10k *ar, struct ath10k_peer *peer) in ath10k_peer_map_cleanup() argument
873 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_map_cleanup()
877 ar->peer_map[peer_id] = NULL; in ath10k_peer_map_cleanup()
883 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_peer_map_cleanup()
884 if (ar->peer_map[i] == peer) { in ath10k_peer_map_cleanup()
885 ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %pK idx %d)\n", in ath10k_peer_map_cleanup()
887 ar->peer_map[i] = NULL; in ath10k_peer_map_cleanup()
893 ar->num_peers--; in ath10k_peer_map_cleanup()
896 static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id) in ath10k_peer_cleanup() argument
900 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_cleanup()
902 spin_lock_bh(&ar->data_lock); in ath10k_peer_cleanup()
903 list_for_each_entry_safe(peer, tmp, &ar->peers, list) { in ath10k_peer_cleanup()
907 ath10k_warn(ar, "removing stale peer %pM from vdev_id %d\n", in ath10k_peer_cleanup()
910 ath10k_peer_map_cleanup(ar, peer); in ath10k_peer_cleanup()
912 spin_unlock_bh(&ar->data_lock); in ath10k_peer_cleanup()
915 static void ath10k_peer_cleanup_all(struct ath10k *ar) in ath10k_peer_cleanup_all() argument
920 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_cleanup_all()
922 spin_lock_bh(&ar->data_lock); in ath10k_peer_cleanup_all()
923 list_for_each_entry_safe(peer, tmp, &ar->peers, list) { in ath10k_peer_cleanup_all()
928 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) in ath10k_peer_cleanup_all()
929 ar->peer_map[i] = NULL; in ath10k_peer_cleanup_all()
931 spin_unlock_bh(&ar->data_lock); in ath10k_peer_cleanup_all()
933 ar->num_peers = 0; in ath10k_peer_cleanup_all()
934 ar->num_stations = 0; in ath10k_peer_cleanup_all()
937 static int ath10k_mac_tdls_peer_update(struct ath10k *ar, u32 vdev_id, in ath10k_mac_tdls_peer_update() argument
946 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_tdls_peer_update()
959 ret = ath10k_wmi_tdls_peer_update(ar, &arg, &cap, &chan_arg); in ath10k_mac_tdls_peer_update()
961 ath10k_warn(ar, "failed to update tdls peer %pM on vdev %i: %i\n", in ath10k_mac_tdls_peer_update()
975 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_beacon_free() local
977 lockdep_assert_held(&ar->data_lock); in ath10k_mac_vif_beacon_free()
983 dma_unmap_single(ar->dev, ATH10K_SKB_CB(arvif->beacon)->paddr, in ath10k_mac_vif_beacon_free()
998 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_beacon_cleanup() local
1000 lockdep_assert_held(&ar->data_lock); in ath10k_mac_vif_beacon_cleanup()
1005 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) in ath10k_mac_vif_beacon_cleanup()
1008 dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, in ath10k_mac_vif_beacon_cleanup()
1015 static inline int ath10k_vdev_setup_sync(struct ath10k *ar) in ath10k_vdev_setup_sync() argument
1019 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_setup_sync()
1021 if (test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)) in ath10k_vdev_setup_sync()
1024 time_left = wait_for_completion_timeout(&ar->vdev_setup_done, in ath10k_vdev_setup_sync()
1029 return ar->last_wmi_vdev_start_status; in ath10k_vdev_setup_sync()
1032 static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id) in ath10k_monitor_vdev_start() argument
1039 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_start()
1041 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_monitor_vdev_start()
1066 reinit_completion(&ar->vdev_setup_done); in ath10k_monitor_vdev_start()
1067 reinit_completion(&ar->vdev_delete_done); in ath10k_monitor_vdev_start()
1069 ret = ath10k_wmi_vdev_start(ar, &arg); in ath10k_monitor_vdev_start()
1071 ath10k_warn(ar, "failed to request monitor vdev %i start: %d\n", in ath10k_monitor_vdev_start()
1076 ret = ath10k_vdev_setup_sync(ar); in ath10k_monitor_vdev_start()
1078 ath10k_warn(ar, "failed to synchronize setup for monitor vdev %i start: %d\n", in ath10k_monitor_vdev_start()
1083 ret = ath10k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr); in ath10k_monitor_vdev_start()
1085 ath10k_warn(ar, "failed to put up monitor vdev %i: %d\n", in ath10k_monitor_vdev_start()
1090 ar->monitor_vdev_id = vdev_id; in ath10k_monitor_vdev_start()
1092 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac monitor vdev %i started\n", in ath10k_monitor_vdev_start()
1093 ar->monitor_vdev_id); in ath10k_monitor_vdev_start()
1097 ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_start()
1099 ath10k_warn(ar, "failed to stop monitor vdev %i after start failure: %d\n", in ath10k_monitor_vdev_start()
1100 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_start()
1105 static int ath10k_monitor_vdev_stop(struct ath10k *ar) in ath10k_monitor_vdev_stop() argument
1109 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_stop()
1111 ret = ath10k_wmi_vdev_down(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1113 ath10k_warn(ar, "failed to put down monitor vdev %i: %d\n", in ath10k_monitor_vdev_stop()
1114 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1116 reinit_completion(&ar->vdev_setup_done); in ath10k_monitor_vdev_stop()
1117 reinit_completion(&ar->vdev_delete_done); in ath10k_monitor_vdev_stop()
1119 ret = ath10k_wmi_vdev_stop(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1121 ath10k_warn(ar, "failed to request monitor vdev %i stop: %d\n", in ath10k_monitor_vdev_stop()
1122 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1124 ret = ath10k_vdev_setup_sync(ar); in ath10k_monitor_vdev_stop()
1126 ath10k_warn(ar, "failed to synchronize monitor vdev %i stop: %d\n", in ath10k_monitor_vdev_stop()
1127 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_stop()
1129 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac monitor vdev %i stopped\n", in ath10k_monitor_vdev_stop()
1130 ar->monitor_vdev_id); in ath10k_monitor_vdev_stop()
1134 static int ath10k_monitor_vdev_create(struct ath10k *ar) in ath10k_monitor_vdev_create() argument
1138 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_create()
1140 if (ar->free_vdev_map == 0) { in ath10k_monitor_vdev_create()
1141 ath10k_warn(ar, "failed to find free vdev id for monitor vdev\n"); in ath10k_monitor_vdev_create()
1145 bit = __ffs64(ar->free_vdev_map); in ath10k_monitor_vdev_create()
1147 ar->monitor_vdev_id = bit; in ath10k_monitor_vdev_create()
1149 ret = ath10k_wmi_vdev_create(ar, ar->monitor_vdev_id, in ath10k_monitor_vdev_create()
1151 0, ar->mac_addr); in ath10k_monitor_vdev_create()
1153 ath10k_warn(ar, "failed to request monitor vdev %i creation: %d\n", in ath10k_monitor_vdev_create()
1154 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_create()
1158 ar->free_vdev_map &= ~(1LL << ar->monitor_vdev_id); in ath10k_monitor_vdev_create()
1159 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac monitor vdev %d created\n", in ath10k_monitor_vdev_create()
1160 ar->monitor_vdev_id); in ath10k_monitor_vdev_create()
1165 static int ath10k_monitor_vdev_delete(struct ath10k *ar) in ath10k_monitor_vdev_delete() argument
1169 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_vdev_delete()
1171 ret = ath10k_wmi_vdev_delete(ar, ar->monitor_vdev_id); in ath10k_monitor_vdev_delete()
1173 ath10k_warn(ar, "failed to request wmi monitor vdev %i removal: %d\n", in ath10k_monitor_vdev_delete()
1174 ar->monitor_vdev_id, ret); in ath10k_monitor_vdev_delete()
1178 ar->free_vdev_map |= 1LL << ar->monitor_vdev_id; in ath10k_monitor_vdev_delete()
1180 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac monitor vdev %d deleted\n", in ath10k_monitor_vdev_delete()
1181 ar->monitor_vdev_id); in ath10k_monitor_vdev_delete()
1185 static int ath10k_monitor_start(struct ath10k *ar) in ath10k_monitor_start() argument
1189 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_start()
1191 ret = ath10k_monitor_vdev_create(ar); in ath10k_monitor_start()
1193 ath10k_warn(ar, "failed to create monitor vdev: %d\n", ret); in ath10k_monitor_start()
1197 ret = ath10k_monitor_vdev_start(ar, ar->monitor_vdev_id); in ath10k_monitor_start()
1199 ath10k_warn(ar, "failed to start monitor vdev: %d\n", ret); in ath10k_monitor_start()
1200 ath10k_monitor_vdev_delete(ar); in ath10k_monitor_start()
1204 ar->monitor_started = true; in ath10k_monitor_start()
1205 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac monitor started\n"); in ath10k_monitor_start()
1210 static int ath10k_monitor_stop(struct ath10k *ar) in ath10k_monitor_stop() argument
1214 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_stop()
1216 ret = ath10k_monitor_vdev_stop(ar); in ath10k_monitor_stop()
1218 ath10k_warn(ar, "failed to stop monitor vdev: %d\n", ret); in ath10k_monitor_stop()
1222 ret = ath10k_monitor_vdev_delete(ar); in ath10k_monitor_stop()
1224 ath10k_warn(ar, "failed to delete monitor vdev: %d\n", ret); in ath10k_monitor_stop()
1228 ar->monitor_started = false; in ath10k_monitor_stop()
1229 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac monitor stopped\n"); in ath10k_monitor_stop()
1234 static bool ath10k_mac_monitor_vdev_is_needed(struct ath10k *ar) in ath10k_mac_monitor_vdev_is_needed() argument
1241 num_ctx = ath10k_mac_num_chanctxs(ar); in ath10k_mac_monitor_vdev_is_needed()
1248 if (ar->monitor_arvif) in ath10k_mac_monitor_vdev_is_needed()
1251 return ar->monitor || in ath10k_mac_monitor_vdev_is_needed()
1253 ar->running_fw->fw_file.fw_features) && in ath10k_mac_monitor_vdev_is_needed()
1254 (ar->filter_flags & FIF_OTHER_BSS)) || in ath10k_mac_monitor_vdev_is_needed()
1255 test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_mac_monitor_vdev_is_needed()
1258 static bool ath10k_mac_monitor_vdev_is_allowed(struct ath10k *ar) in ath10k_mac_monitor_vdev_is_allowed() argument
1262 num_ctx = ath10k_mac_num_chanctxs(ar); in ath10k_mac_monitor_vdev_is_allowed()
1268 if (test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags) && num_ctx > 1) in ath10k_mac_monitor_vdev_is_allowed()
1274 static int ath10k_monitor_recalc(struct ath10k *ar) in ath10k_monitor_recalc() argument
1280 lockdep_assert_held(&ar->conf_mutex); in ath10k_monitor_recalc()
1282 needed = ath10k_mac_monitor_vdev_is_needed(ar); in ath10k_monitor_recalc()
1283 allowed = ath10k_mac_monitor_vdev_is_allowed(ar); in ath10k_monitor_recalc()
1285 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_monitor_recalc()
1287 ar->monitor_started, needed, allowed); in ath10k_monitor_recalc()
1290 if (ar->monitor_started) { in ath10k_monitor_recalc()
1291 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac monitor stopping disallowed monitor\n"); in ath10k_monitor_recalc()
1293 ret = ath10k_monitor_stop(ar); in ath10k_monitor_recalc()
1295 ath10k_warn(ar, "failed to stop disallowed monitor: %d\n", in ath10k_monitor_recalc()
1303 if (needed == ar->monitor_started) in ath10k_monitor_recalc()
1307 return ath10k_monitor_start(ar); in ath10k_monitor_recalc()
1309 return ath10k_monitor_stop(ar); in ath10k_monitor_recalc()
1314 struct ath10k *ar = arvif->ar; in ath10k_mac_can_set_cts_prot() local
1316 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_can_set_cts_prot()
1319 ath10k_dbg(ar, ATH10K_DBG_MAC, "defer cts setup, vdev is not ready yet\n"); in ath10k_mac_can_set_cts_prot()
1328 struct ath10k *ar = arvif->ar; in ath10k_mac_set_cts_prot() local
1331 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_set_cts_prot()
1333 vdev_param = ar->wmi.vdev_param->protection_mode; in ath10k_mac_set_cts_prot()
1335 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %d cts_protection %d\n", in ath10k_mac_set_cts_prot()
1338 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_mac_set_cts_prot()
1344 struct ath10k *ar = arvif->ar; in ath10k_recalc_rtscts_prot() local
1347 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalc_rtscts_prot()
1349 vdev_param = ar->wmi.vdev_param->enable_rtscts; in ath10k_recalc_rtscts_prot()
1360 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %d recalc rts/cts prot %d\n", in ath10k_recalc_rtscts_prot()
1363 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_recalc_rtscts_prot()
1367 static int ath10k_start_cac(struct ath10k *ar) in ath10k_start_cac() argument
1371 lockdep_assert_held(&ar->conf_mutex); in ath10k_start_cac()
1373 set_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_start_cac()
1375 ret = ath10k_monitor_recalc(ar); in ath10k_start_cac()
1377 ath10k_warn(ar, "failed to start monitor (cac): %d\n", ret); in ath10k_start_cac()
1378 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_start_cac()
1382 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac cac start monitor vdev %d\n", in ath10k_start_cac()
1383 ar->monitor_vdev_id); in ath10k_start_cac()
1388 static int ath10k_stop_cac(struct ath10k *ar) in ath10k_stop_cac() argument
1390 lockdep_assert_held(&ar->conf_mutex); in ath10k_stop_cac()
1393 if (!test_bit(ATH10K_CAC_RUNNING, &ar->dev_flags)) in ath10k_stop_cac()
1396 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_stop_cac()
1397 ath10k_monitor_stop(ar); in ath10k_stop_cac()
1399 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac cac finished\n"); in ath10k_stop_cac()
1414 static bool ath10k_mac_has_radar_enabled(struct ath10k *ar) in ath10k_mac_has_radar_enabled() argument
1418 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_has_radar_enabled()
1425 static void ath10k_recalc_radar_detection(struct ath10k *ar) in ath10k_recalc_radar_detection() argument
1429 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalc_radar_detection()
1431 ath10k_stop_cac(ar); in ath10k_recalc_radar_detection()
1433 if (!ath10k_mac_has_radar_enabled(ar)) in ath10k_recalc_radar_detection()
1436 if (ar->num_started_vdevs > 0) in ath10k_recalc_radar_detection()
1439 ret = ath10k_start_cac(ar); in ath10k_recalc_radar_detection()
1446 ath10k_warn(ar, "failed to start CAC: %d\n", ret); in ath10k_recalc_radar_detection()
1447 ieee80211_radar_detected(ar->hw); in ath10k_recalc_radar_detection()
1453 struct ath10k *ar = arvif->ar; in ath10k_vdev_stop() local
1456 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_stop()
1458 reinit_completion(&ar->vdev_setup_done); in ath10k_vdev_stop()
1459 reinit_completion(&ar->vdev_delete_done); in ath10k_vdev_stop()
1461 ret = ath10k_wmi_vdev_stop(ar, arvif->vdev_id); in ath10k_vdev_stop()
1463 ath10k_warn(ar, "failed to stop WMI vdev %i: %d\n", in ath10k_vdev_stop()
1468 ret = ath10k_vdev_setup_sync(ar); in ath10k_vdev_stop()
1470 ath10k_warn(ar, "failed to synchronize setup for vdev %i: %d\n", in ath10k_vdev_stop()
1475 WARN_ON(ar->num_started_vdevs == 0); in ath10k_vdev_stop()
1477 if (ar->num_started_vdevs != 0) { in ath10k_vdev_stop()
1478 ar->num_started_vdevs--; in ath10k_vdev_stop()
1479 ath10k_recalc_radar_detection(ar); in ath10k_vdev_stop()
1489 struct ath10k *ar = arvif->ar; in ath10k_vdev_start_restart() local
1493 lockdep_assert_held(&ar->conf_mutex); in ath10k_vdev_start_restart()
1495 reinit_completion(&ar->vdev_setup_done); in ath10k_vdev_start_restart()
1496 reinit_completion(&ar->vdev_delete_done); in ath10k_vdev_start_restart()
1525 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_vdev_start_restart()
1531 ret = ath10k_wmi_vdev_restart(ar, &arg); in ath10k_vdev_start_restart()
1533 ret = ath10k_wmi_vdev_start(ar, &arg); in ath10k_vdev_start_restart()
1536 ath10k_warn(ar, "failed to start WMI vdev %i: %d\n", in ath10k_vdev_start_restart()
1541 ret = ath10k_vdev_setup_sync(ar); in ath10k_vdev_start_restart()
1543 ath10k_warn(ar, in ath10k_vdev_start_restart()
1549 ar->num_started_vdevs++; in ath10k_vdev_start_restart()
1550 ath10k_recalc_radar_detection(ar); in ath10k_vdev_start_restart()
1570 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_bcn_p2p_ie() local
1586 ret = ath10k_wmi_p2p_go_bcn_ie(ar, arvif->vdev_id, p2p_ie); in ath10k_mac_setup_bcn_p2p_ie()
1588 ath10k_warn(ar, "failed to submit p2p go bcn ie for vdev %i: %d\n", in ath10k_mac_setup_bcn_p2p_ie()
1628 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_bcn_tmpl() local
1629 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_setup_bcn_tmpl()
1635 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_setup_bcn_tmpl()
1644 ath10k_warn(ar, "failed to get beacon template from mac80211\n"); in ath10k_mac_setup_bcn_tmpl()
1650 ath10k_warn(ar, "failed to setup p2p go bcn ie: %d\n", ret); in ath10k_mac_setup_bcn_tmpl()
1663 ret = ath10k_wmi_bcn_tmpl(ar, arvif->vdev_id, offs.tim_offset, bcn, 0, in ath10k_mac_setup_bcn_tmpl()
1668 ath10k_warn(ar, "failed to submit beacon template command: %d\n", in ath10k_mac_setup_bcn_tmpl()
1678 struct ath10k *ar = arvif->ar; in ath10k_mac_setup_prb_tmpl() local
1679 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_setup_prb_tmpl()
1684 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_setup_prb_tmpl()
1696 ath10k_warn(ar, "failed to get probe resp template from mac80211\n"); in ath10k_mac_setup_prb_tmpl()
1700 ret = ath10k_wmi_prb_tmpl(ar, arvif->vdev_id, prb); in ath10k_mac_setup_prb_tmpl()
1704 ath10k_warn(ar, "failed to submit probe resp template command: %d\n", in ath10k_mac_setup_prb_tmpl()
1714 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_fix_hidden_ssid() local
1733 if (!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) in ath10k_mac_vif_fix_hidden_ssid()
1745 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_vif_fix_hidden_ssid()
1747 ath10k_warn(ar, "failed to bring down ap vdev %i: %d\n", in ath10k_mac_vif_fix_hidden_ssid()
1758 ath10k_warn(ar, "failed to update beacon template: %d\n", ret); in ath10k_mac_vif_fix_hidden_ssid()
1764 ath10k_warn(ar, "failed to update presp template: %d\n", ret); in ath10k_mac_vif_fix_hidden_ssid()
1770 ath10k_warn(ar, "failed to restart ap vdev %i: %d\n", in ath10k_mac_vif_fix_hidden_ssid()
1775 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_mac_vif_fix_hidden_ssid()
1778 ath10k_warn(ar, "failed to bring up ap vdev %i: %d\n", in ath10k_mac_vif_fix_hidden_ssid()
1789 struct ath10k *ar = arvif->ar; in ath10k_control_beaconing() local
1792 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_control_beaconing()
1795 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_control_beaconing()
1797 ath10k_warn(ar, "failed to down vdev_id %i: %d\n", in ath10k_control_beaconing()
1802 spin_lock_bh(&arvif->ar->data_lock); in ath10k_control_beaconing()
1804 spin_unlock_bh(&arvif->ar->data_lock); in ath10k_control_beaconing()
1814 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_control_beaconing()
1817 ath10k_warn(ar, "failed to bring up vdev %d: %i\n", in ath10k_control_beaconing()
1826 ath10k_warn(ar, "failed to fix hidden ssid for vdev %i, expect trouble: %d\n", in ath10k_control_beaconing()
1831 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %d up\n", arvif->vdev_id); in ath10k_control_beaconing()
1837 struct ath10k *ar = arvif->ar; in ath10k_control_ibss() local
1841 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_control_ibss()
1852 vdev_param = arvif->ar->wmi.vdev_param->atim_window; in ath10k_control_ibss()
1853 ret = ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id, vdev_param, in ath10k_control_ibss()
1856 ath10k_warn(ar, "failed to set IBSS ATIM for vdev %d: %d\n", in ath10k_control_ibss()
1862 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_recalc_ps_wake_threshold() local
1867 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_recalc_ps_wake_threshold()
1875 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, value); in ath10k_mac_vif_recalc_ps_wake_threshold()
1877 ath10k_warn(ar, "failed to submit ps wake threshold %u on vdev %i: %d\n", in ath10k_mac_vif_recalc_ps_wake_threshold()
1887 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_recalc_ps_poll_count() local
1892 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_recalc_ps_poll_count()
1900 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_mac_vif_recalc_ps_poll_count()
1903 ath10k_warn(ar, "failed to submit ps poll count %u on vdev %i: %d\n", in ath10k_mac_vif_recalc_ps_poll_count()
1911 static int ath10k_mac_num_vifs_started(struct ath10k *ar) in ath10k_mac_num_vifs_started() argument
1916 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_num_vifs_started()
1918 list_for_each_entry(arvif, &ar->arvifs, list) in ath10k_mac_num_vifs_started()
1927 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_setup_ps() local
1929 struct ieee80211_conf *conf = &ar->hw->conf; in ath10k_mac_vif_setup_ps()
1936 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_setup_ps()
1943 if (enable_ps && ath10k_mac_num_vifs_started(ar) > 1 && in ath10k_mac_vif_setup_ps()
1945 ar->running_fw->fw_file.fw_features)) { in ath10k_mac_vif_setup_ps()
1946 ath10k_warn(ar, "refusing to enable ps on vdev %i: not supported by fw\n", in ath10k_mac_vif_setup_ps()
1969 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, in ath10k_mac_vif_setup_ps()
1972 ath10k_warn(ar, "failed to set inactivity time for vdev %d: %i\n", in ath10k_mac_vif_setup_ps()
1980 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %d psmode %s\n", in ath10k_mac_vif_setup_ps()
1983 ret = ath10k_wmi_set_psmode(ar, arvif->vdev_id, psmode); in ath10k_mac_vif_setup_ps()
1985 ath10k_warn(ar, "failed to set PS Mode %d for vdev %d: %d\n", in ath10k_mac_vif_setup_ps()
1995 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_disable_keepalive() local
1999 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_disable_keepalive()
2004 if (!test_bit(WMI_SERVICE_STA_KEEP_ALIVE, ar->wmi.svc_map)) in ath10k_mac_vif_disable_keepalive()
2015 ret = ath10k_wmi_sta_keepalive(ar, &arg); in ath10k_mac_vif_disable_keepalive()
2017 ath10k_warn(ar, "failed to submit keepalive on vdev %i: %d\n", in ath10k_mac_vif_disable_keepalive()
2027 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_ap_csa_count_down() local
2031 lockdep_assert_held(&arvif->ar->conf_mutex); in ath10k_mac_vif_ap_csa_count_down()
2033 if (WARN_ON(!test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map))) in ath10k_mac_vif_ap_csa_count_down()
2050 ath10k_warn(ar, "failed to update bcn tmpl during csa: %d\n", in ath10k_mac_vif_ap_csa_count_down()
2055 ath10k_warn(ar, "failed to update prb tmpl during csa: %d\n", in ath10k_mac_vif_ap_csa_count_down()
2066 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_ap_csa_work() local
2068 mutex_lock(&ar->conf_mutex); in ath10k_mac_vif_ap_csa_work()
2070 mutex_unlock(&ar->conf_mutex); in ath10k_mac_vif_ap_csa_work()
2089 void ath10k_mac_handle_beacon(struct ath10k *ar, struct sk_buff *skb) in ath10k_mac_handle_beacon() argument
2091 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_beacon()
2102 struct ath10k *ar = arvif->ar; in ath10k_mac_handle_beacon_miss_iter() local
2103 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_handle_beacon_miss_iter()
2122 void ath10k_mac_handle_beacon_miss(struct ath10k *ar, u32 vdev_id) in ath10k_mac_handle_beacon_miss() argument
2124 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_beacon_miss()
2146 static u32 ath10k_peer_assoc_h_listen_intval(struct ath10k *ar, in ath10k_peer_assoc_h_listen_intval() argument
2160 return ar->hw->conf.listen_interval; in ath10k_peer_assoc_h_listen_intval()
2163 static void ath10k_peer_assoc_h_basic(struct ath10k *ar, in ath10k_peer_assoc_h_basic() argument
2171 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_basic()
2181 arg->peer_flags |= arvif->ar->wmi.peer_flags->auth; in ath10k_peer_assoc_h_basic()
2182 arg->peer_listen_intval = ath10k_peer_assoc_h_listen_intval(ar, vif); in ath10k_peer_assoc_h_basic()
2187 static void ath10k_peer_assoc_h_crypto(struct ath10k *ar, in ath10k_peer_assoc_h_crypto() argument
2198 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_crypto()
2203 bss = cfg80211_get_bss(ar->hw->wiphy, def.chan, info->bssid, in ath10k_peer_assoc_h_crypto()
2220 cfg80211_put_bss(ar->hw->wiphy, bss); in ath10k_peer_assoc_h_crypto()
2225 ath10k_dbg(ar, ATH10K_DBG_WMI, "%s: rsn ie found\n", __func__); in ath10k_peer_assoc_h_crypto()
2226 arg->peer_flags |= ar->wmi.peer_flags->need_ptk_4_way; in ath10k_peer_assoc_h_crypto()
2230 ath10k_dbg(ar, ATH10K_DBG_WMI, "%s: wpa ie found\n", __func__); in ath10k_peer_assoc_h_crypto()
2231 arg->peer_flags |= ar->wmi.peer_flags->need_gtk_2_way; in ath10k_peer_assoc_h_crypto()
2236 ar->running_fw->fw_file.fw_features)) { in ath10k_peer_assoc_h_crypto()
2237 arg->peer_flags |= ar->wmi.peer_flags->pmf; in ath10k_peer_assoc_h_crypto()
2241 static void ath10k_peer_assoc_h_rates(struct ath10k *ar, in ath10k_peer_assoc_h_rates() argument
2256 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_rates()
2262 sband = ar->hw->wiphy->bands[band]; in ath10k_peer_assoc_h_rates()
2303 static void ath10k_peer_assoc_h_ht(struct ath10k *ar, in ath10k_peer_assoc_h_ht() argument
2318 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_h_ht()
2334 arg->peer_flags |= ar->wmi.peer_flags->ht; in ath10k_peer_assoc_h_ht()
2345 arg->peer_flags |= ar->wmi.peer_flags->ldbc; in ath10k_peer_assoc_h_ht()
2348 arg->peer_flags |= ar->wmi.peer_flags->bw40; in ath10k_peer_assoc_h_ht()
2362 arg->peer_flags |= ar->wmi.peer_flags->stbc; in ath10k_peer_assoc_h_ht()
2370 arg->peer_flags |= ar->wmi.peer_flags->stbc; in ath10k_peer_assoc_h_ht()
2404 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac ht peer %pM mcs cnt %d nss %d\n", in ath10k_peer_assoc_h_ht()
2410 static int ath10k_peer_assoc_qos_ap(struct ath10k *ar, in ath10k_peer_assoc_qos_ap() argument
2418 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_qos_ap()
2421 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac uapsd_queues 0x%x max_sp %d\n", in ath10k_peer_assoc_qos_ap()
2440 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, in ath10k_peer_assoc_qos_ap()
2445 ath10k_warn(ar, "failed to set ap ps peer param uapsd for vdev %i: %d\n", in ath10k_peer_assoc_qos_ap()
2450 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, in ath10k_peer_assoc_qos_ap()
2455 ath10k_warn(ar, "failed to set ap ps peer param max sp for vdev %i: %d\n", in ath10k_peer_assoc_qos_ap()
2465 ret = ath10k_wmi_set_ap_ps_param(ar, arvif->vdev_id, sta->addr, in ath10k_peer_assoc_qos_ap()
2469 ath10k_warn(ar, "failed to set ap ps peer param ageout time for vdev %i: %d\n", in ath10k_peer_assoc_qos_ap()
2553 static void ath10k_peer_assoc_h_vht(struct ath10k *ar, in ath10k_peer_assoc_h_vht() argument
2560 struct ath10k_hw_params *hw = &ar->hw_params; in ath10k_peer_assoc_h_vht()
2580 arg->peer_flags |= ar->wmi.peer_flags->vht; in ath10k_peer_assoc_h_vht()
2583 arg->peer_flags |= ar->wmi.peer_flags->vht_2g; in ath10k_peer_assoc_h_vht()
2601 arg->peer_flags |= ar->wmi.peer_flags->bw80; in ath10k_peer_assoc_h_vht()
2604 arg->peer_flags |= ar->wmi.peer_flags->bw160; in ath10k_peer_assoc_h_vht()
2655 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_peer_assoc_h_vht()
2661 static void ath10k_peer_assoc_h_qos(struct ath10k *ar, in ath10k_peer_assoc_h_qos() argument
2671 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2674 arg->peer_flags |= arvif->ar->wmi.peer_flags->apsd; in ath10k_peer_assoc_h_qos()
2680 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2684 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; in ath10k_peer_assoc_h_qos()
2690 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac peer %pM qos %d\n", in ath10k_peer_assoc_h_qos()
2692 arvif->ar->wmi.peer_flags->qos)); in ath10k_peer_assoc_h_qos()
2701 static enum wmi_phy_mode ath10k_mac_get_phymode_vht(struct ath10k *ar, in ath10k_mac_get_phymode_vht() argument
2730 static void ath10k_peer_assoc_h_phymode(struct ath10k *ar, in ath10k_peer_assoc_h_phymode() argument
2776 phymode = ath10k_mac_get_phymode_vht(ar, sta); in ath10k_peer_assoc_h_phymode()
2792 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac peer %pM phymode %s\n", in ath10k_peer_assoc_h_phymode()
2799 static int ath10k_peer_assoc_prepare(struct ath10k *ar, in ath10k_peer_assoc_prepare() argument
2804 lockdep_assert_held(&ar->conf_mutex); in ath10k_peer_assoc_prepare()
2808 ath10k_peer_assoc_h_basic(ar, vif, sta, arg); in ath10k_peer_assoc_prepare()
2809 ath10k_peer_assoc_h_crypto(ar, vif, sta, arg); in ath10k_peer_assoc_prepare()
2810 ath10k_peer_assoc_h_rates(ar, vif, sta, arg); in ath10k_peer_assoc_prepare()
2811 ath10k_peer_assoc_h_ht(ar, vif, sta, arg); in ath10k_peer_assoc_prepare()
2812 ath10k_peer_assoc_h_phymode(ar, vif, sta, arg); in ath10k_peer_assoc_prepare()
2813 ath10k_peer_assoc_h_vht(ar, vif, sta, arg); in ath10k_peer_assoc_prepare()
2814 ath10k_peer_assoc_h_qos(ar, vif, sta, arg); in ath10k_peer_assoc_prepare()
2826 static int ath10k_setup_peer_smps(struct ath10k *ar, struct ath10k_vif *arvif, in ath10k_setup_peer_smps() argument
2841 return ath10k_wmi_peer_set_param(ar, arvif->vdev_id, addr, in ath10k_setup_peer_smps()
2842 ar->wmi.peer_param->smps_state, in ath10k_setup_peer_smps()
2846 static int ath10k_mac_vif_recalc_txbf(struct ath10k *ar, in ath10k_mac_vif_recalc_txbf() argument
2855 if (ath10k_wmi_get_txbf_conf_scheme(ar) != WMI_TXBF_CONF_AFTER_ASSOC) in ath10k_mac_vif_recalc_txbf()
2858 if (!(ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2865 param = ar->wmi.vdev_param->txbf; in ath10k_mac_vif_recalc_txbf()
2875 if (ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2885 if (ar->vht_cap_info & in ath10k_mac_vif_recalc_txbf()
2901 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, param, value); in ath10k_mac_vif_recalc_txbf()
2903 ath10k_warn(ar, "failed to submit vdev param txbf 0x%x: %d\n", in ath10k_mac_vif_recalc_txbf()
2911 static bool ath10k_mac_is_connected(struct ath10k *ar) in ath10k_mac_is_connected() argument
2915 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_mac_is_connected()
2923 static int ath10k_mac_txpower_setup(struct ath10k *ar, int txpower) in ath10k_mac_txpower_setup() argument
2930 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_txpower_setup()
2936 connected = ath10k_mac_is_connected(ar); in ath10k_mac_txpower_setup()
2938 if (connected && ar->tx_power_2g_limit) in ath10k_mac_txpower_setup()
2939 if (tx_power_2g > ar->tx_power_2g_limit) in ath10k_mac_txpower_setup()
2940 tx_power_2g = ar->tx_power_2g_limit; in ath10k_mac_txpower_setup()
2942 if (connected && ar->tx_power_5g_limit) in ath10k_mac_txpower_setup()
2943 if (tx_power_5g > ar->tx_power_5g_limit) in ath10k_mac_txpower_setup()
2944 tx_power_5g = ar->tx_power_5g_limit; in ath10k_mac_txpower_setup()
2946 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac txpower 2g: %d, 5g: %d\n", in ath10k_mac_txpower_setup()
2949 param = ar->wmi.pdev_param->txpower_limit2g; in ath10k_mac_txpower_setup()
2950 ret = ath10k_wmi_pdev_set_param(ar, param, tx_power_2g); in ath10k_mac_txpower_setup()
2952 ath10k_warn(ar, "failed to set 2g txpower %d: %d\n", in ath10k_mac_txpower_setup()
2957 param = ar->wmi.pdev_param->txpower_limit5g; in ath10k_mac_txpower_setup()
2958 ret = ath10k_wmi_pdev_set_param(ar, param, tx_power_5g); in ath10k_mac_txpower_setup()
2960 ath10k_warn(ar, "failed to set 5g txpower %d: %d\n", in ath10k_mac_txpower_setup()
2968 static int ath10k_mac_txpower_recalc(struct ath10k *ar) in ath10k_mac_txpower_recalc() argument
2973 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_txpower_recalc()
2975 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_mac_txpower_recalc()
2989 ret = ath10k_mac_txpower_setup(ar, txpower); in ath10k_mac_txpower_recalc()
2991 ath10k_warn(ar, "failed to setup tx power %d: %d\n", in ath10k_mac_txpower_recalc()
2999 static int ath10k_mac_set_sar_power(struct ath10k *ar) in ath10k_mac_set_sar_power() argument
3001 if (!ar->hw_params.dynamic_sar_support) in ath10k_mac_set_sar_power()
3004 if (!ath10k_mac_is_connected(ar)) in ath10k_mac_set_sar_power()
3008 return ath10k_mac_txpower_recalc(ar); in ath10k_mac_set_sar_power()
3015 struct ath10k *ar = hw->priv; in ath10k_mac_set_sar_specs() local
3019 mutex_lock(&ar->conf_mutex); in ath10k_mac_set_sar_specs()
3021 if (!ar->hw_params.dynamic_sar_support) { in ath10k_mac_set_sar_specs()
3037 ar->tx_power_2g_limit = 0; in ath10k_mac_set_sar_specs()
3038 ar->tx_power_5g_limit = 0; in ath10k_mac_set_sar_specs()
3045 ar->tx_power_2g_limit = sub_specs->power / 2; in ath10k_mac_set_sar_specs()
3047 ar->tx_power_5g_limit = sub_specs->power / 2; in ath10k_mac_set_sar_specs()
3052 ret = ath10k_mac_set_sar_power(ar); in ath10k_mac_set_sar_specs()
3054 ath10k_warn(ar, "failed to set sar power: %d", ret); in ath10k_mac_set_sar_specs()
3059 mutex_unlock(&ar->conf_mutex); in ath10k_mac_set_sar_specs()
3068 struct ath10k *ar = hw->priv; in ath10k_bss_assoc() local
3076 lockdep_assert_held(&ar->conf_mutex); in ath10k_bss_assoc()
3078 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %i assoc bssid %pM aid %d\n", in ath10k_bss_assoc()
3085 ath10k_warn(ar, "failed to find station entry for bss %pM vdev %i\n", in ath10k_bss_assoc()
3097 ret = ath10k_peer_assoc_prepare(ar, vif, ap_sta, &peer_arg); in ath10k_bss_assoc()
3099 ath10k_warn(ar, "failed to prepare peer assoc for %pM vdev %i: %d\n", in ath10k_bss_assoc()
3107 ret = ath10k_wmi_peer_assoc(ar, &peer_arg); in ath10k_bss_assoc()
3109 ath10k_warn(ar, "failed to run peer assoc for %pM vdev %i: %d\n", in ath10k_bss_assoc()
3114 ret = ath10k_setup_peer_smps(ar, arvif, bss_conf->bssid, &ht_cap); in ath10k_bss_assoc()
3116 ath10k_warn(ar, "failed to setup peer SMPS for vdev %i: %d\n", in ath10k_bss_assoc()
3121 ret = ath10k_mac_vif_recalc_txbf(ar, vif, vht_cap); in ath10k_bss_assoc()
3123 ath10k_warn(ar, "failed to recalc txbf for vdev %i on bss %pM: %d\n", in ath10k_bss_assoc()
3128 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_bss_assoc()
3137 ret = ath10k_wmi_pdev_set_param(ar, in ath10k_bss_assoc()
3138 ar->wmi.pdev_param->peer_stats_info_enable, 1); in ath10k_bss_assoc()
3140 ath10k_warn(ar, "failed to enable peer stats info: %d\n", ret); in ath10k_bss_assoc()
3142 ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid); in ath10k_bss_assoc()
3144 ath10k_warn(ar, "failed to set vdev %d up: %d\n", in ath10k_bss_assoc()
3151 ath10k_mac_set_sar_power(ar); in ath10k_bss_assoc()
3157 ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, arvif->bssid, in ath10k_bss_assoc()
3158 ar->wmi.peer_param->dummy_var, 1); in ath10k_bss_assoc()
3160 ath10k_warn(ar, "failed to poke peer %pM param for ps workaround on vdev %i: %d\n", in ath10k_bss_assoc()
3169 struct ath10k *ar = hw->priv; in ath10k_bss_disassoc() local
3174 lockdep_assert_held(&ar->conf_mutex); in ath10k_bss_disassoc()
3176 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %i disassoc bssid %pM\n", in ath10k_bss_disassoc()
3179 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_bss_disassoc()
3181 ath10k_warn(ar, "failed to down vdev %i: %d\n", in ath10k_bss_disassoc()
3186 ret = ath10k_mac_vif_recalc_txbf(ar, vif, vht_cap); in ath10k_bss_disassoc()
3188 ath10k_warn(ar, "failed to recalc txbf for vdev %i: %d\n", in ath10k_bss_disassoc()
3195 ath10k_mac_txpower_recalc(ar); in ath10k_bss_disassoc()
3200 static int ath10k_new_peer_tid_config(struct ath10k *ar, in ath10k_new_peer_tid_config() argument
3250 ret = ath10k_wmi_set_per_peer_per_tid_cfg(ar, &arg); in ath10k_new_peer_tid_config()
3252 ath10k_warn(ar, "failed to set per tid retry/aggr config for sta %pM: %d\n", in ath10k_new_peer_tid_config()
3263 static int ath10k_station_assoc(struct ath10k *ar, in ath10k_station_assoc() argument
3272 lockdep_assert_held(&ar->conf_mutex); in ath10k_station_assoc()
3274 ret = ath10k_peer_assoc_prepare(ar, vif, sta, &peer_arg); in ath10k_station_assoc()
3276 ath10k_warn(ar, "failed to prepare WMI peer assoc for %pM vdev %i: %i\n", in ath10k_station_assoc()
3281 ret = ath10k_wmi_peer_assoc(ar, &peer_arg); in ath10k_station_assoc()
3283 ath10k_warn(ar, "failed to run peer assoc for STA %pM vdev %i: %d\n", in ath10k_station_assoc()
3292 ret = ath10k_setup_peer_smps(ar, arvif, sta->addr, in ath10k_station_assoc()
3295 ath10k_warn(ar, "failed to setup peer SMPS for vdev %d: %d\n", in ath10k_station_assoc()
3300 ret = ath10k_peer_assoc_qos_ap(ar, arvif, sta); in ath10k_station_assoc()
3302 ath10k_warn(ar, "failed to set qos params for STA %pM for vdev %i: %d\n", in ath10k_station_assoc()
3311 ath10k_warn(ar, "failed to recalculate rts/cts prot for vdev %d: %d\n", in ath10k_station_assoc()
3321 ath10k_warn(ar, "failed to install peer wep keys for vdev %i: %d\n", in ath10k_station_assoc()
3328 if (!test_bit(WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT, ar->wmi.svc_map)) in ath10k_station_assoc()
3331 return ath10k_new_peer_tid_config(ar, sta, arvif); in ath10k_station_assoc()
3334 static int ath10k_station_disassoc(struct ath10k *ar, in ath10k_station_disassoc() argument
3341 lockdep_assert_held(&ar->conf_mutex); in ath10k_station_disassoc()
3347 ath10k_warn(ar, "failed to recalculate rts/cts prot for vdev %d: %d\n", in ath10k_station_disassoc()
3355 ath10k_warn(ar, "failed to clear all peer wep keys for vdev %i: %d\n", in ath10k_station_disassoc()
3367 static int ath10k_update_channel_list(struct ath10k *ar) in ath10k_update_channel_list() argument
3369 struct ieee80211_hw *hw = ar->hw; in ath10k_update_channel_list()
3380 lockdep_assert_held(&ar->conf_mutex); in ath10k_update_channel_list()
3456 ath10k_dbg(ar, ATH10K_DBG_WMI, in ath10k_update_channel_list()
3466 ret = ath10k_wmi_scan_chan_list(ar, &arg); in ath10k_update_channel_list()
3488 static void ath10k_regd_update(struct ath10k *ar) in ath10k_regd_update() argument
3495 lockdep_assert_held(&ar->conf_mutex); in ath10k_regd_update()
3497 ret = ath10k_update_channel_list(ar); in ath10k_regd_update()
3499 ath10k_warn(ar, "failed to update channel list: %d\n", ret); in ath10k_regd_update()
3501 regpair = ar->ath_common.regulatory.regpair; in ath10k_regd_update()
3503 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { in ath10k_regd_update()
3504 nl_dfs_reg = ar->dfs_detector->region; in ath10k_regd_update()
3513 ret = ath10k_wmi_pdev_set_regdomain(ar, in ath10k_regd_update()
3521 ath10k_warn(ar, "failed to set pdev regdomain: %d\n", ret); in ath10k_regd_update()
3524 static void ath10k_mac_update_channel_list(struct ath10k *ar, in ath10k_mac_update_channel_list() argument
3529 if (ar->low_5ghz_chan && ar->high_5ghz_chan) { in ath10k_mac_update_channel_list()
3531 if (band->channels[i].center_freq < ar->low_5ghz_chan || in ath10k_mac_update_channel_list()
3532 band->channels[i].center_freq > ar->high_5ghz_chan) in ath10k_mac_update_channel_list()
3543 struct ath10k *ar = hw->priv; in ath10k_reg_notifier() local
3546 ath_reg_notifier_apply(wiphy, request, &ar->ath_common.regulatory); in ath10k_reg_notifier()
3548 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { in ath10k_reg_notifier()
3549 ath10k_dbg(ar, ATH10K_DBG_REGULATORY, "dfs region 0x%x\n", in ath10k_reg_notifier()
3551 result = ar->dfs_detector->set_dfs_domain(ar->dfs_detector, in ath10k_reg_notifier()
3554 ath10k_warn(ar, "DFS region 0x%X not supported, will trigger radar for every pulse\n", in ath10k_reg_notifier()
3558 mutex_lock(&ar->conf_mutex); in ath10k_reg_notifier()
3559 if (ar->state == ATH10K_STATE_ON) in ath10k_reg_notifier()
3560 ath10k_regd_update(ar); in ath10k_reg_notifier()
3561 mutex_unlock(&ar->conf_mutex); in ath10k_reg_notifier()
3563 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_reg_notifier()
3564 ath10k_mac_update_channel_list(ar, in ath10k_reg_notifier()
3565 ar->hw->wiphy->bands[NL80211_BAND_5GHZ]); in ath10k_reg_notifier()
3568 static void ath10k_stop_radar_confirmation(struct ath10k *ar) in ath10k_stop_radar_confirmation() argument
3570 spin_lock_bh(&ar->data_lock); in ath10k_stop_radar_confirmation()
3571 ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_STOPPED; in ath10k_stop_radar_confirmation()
3572 spin_unlock_bh(&ar->data_lock); in ath10k_stop_radar_confirmation()
3574 cancel_work_sync(&ar->radar_confirmation_work); in ath10k_stop_radar_confirmation()
3588 void ath10k_mac_tx_lock(struct ath10k *ar, int reason) in ath10k_mac_tx_lock() argument
3590 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_tx_lock()
3593 ar->tx_paused |= BIT(reason); in ath10k_mac_tx_lock()
3594 ieee80211_stop_queues(ar->hw); in ath10k_mac_tx_lock()
3600 struct ath10k *ar = data; in ath10k_mac_tx_unlock_iter() local
3606 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_mac_tx_unlock_iter()
3609 void ath10k_mac_tx_unlock(struct ath10k *ar, int reason) in ath10k_mac_tx_unlock() argument
3611 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_tx_unlock()
3614 ar->tx_paused &= ~BIT(reason); in ath10k_mac_tx_unlock()
3616 if (ar->tx_paused) in ath10k_mac_tx_unlock()
3619 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_tx_unlock()
3622 ar); in ath10k_mac_tx_unlock()
3624 ieee80211_wake_queue(ar->hw, ar->hw->offchannel_tx_hw_queue); in ath10k_mac_tx_unlock()
3629 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_tx_lock() local
3631 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_tx_lock()
3635 ieee80211_stop_queue(ar->hw, arvif->vdev_id); in ath10k_mac_vif_tx_lock()
3640 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_tx_unlock() local
3642 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_tx_unlock()
3647 if (ar->tx_paused) in ath10k_mac_vif_tx_unlock()
3653 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_mac_vif_tx_unlock()
3660 struct ath10k *ar = arvif->ar; in ath10k_mac_vif_handle_tx_pause() local
3662 lockdep_assert_held(&ar->htt.tx_lock); in ath10k_mac_vif_handle_tx_pause()
3672 ath10k_dbg(ar, ATH10K_DBG_BOOT, in ath10k_mac_vif_handle_tx_pause()
3697 void ath10k_mac_handle_tx_pause_vdev(struct ath10k *ar, u32 vdev_id, in ath10k_mac_handle_tx_pause_vdev() argument
3707 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_handle_tx_pause_vdev()
3708 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_mac_handle_tx_pause_vdev()
3712 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_handle_tx_pause_vdev()
3716 ath10k_mac_tx_h_get_txmode(struct ath10k *ar, in ath10k_mac_tx_h_get_txmode() argument
3750 if (ar->htt.target_version_major < 3 && in ath10k_mac_tx_h_get_txmode()
3753 ar->running_fw->fw_file.fw_features)) in ath10k_mac_tx_h_get_txmode()
3767 if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) || in ath10k_mac_tx_h_get_txmode()
3857 static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar, in ath10k_tx_h_add_p2p_noa_ie() argument
3869 spin_lock_bh(&ar->data_lock); in ath10k_tx_h_add_p2p_noa_ie()
3875 spin_unlock_bh(&ar->data_lock); in ath10k_tx_h_add_p2p_noa_ie()
3879 static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar, in ath10k_mac_tx_h_fill_cb() argument
3946 spin_lock_bh(&ar->data_lock); in ath10k_mac_tx_h_fill_cb()
3948 spin_unlock_bh(&ar->data_lock); in ath10k_mac_tx_h_fill_cb()
3952 bool ath10k_mac_tx_frm_has_freq(struct ath10k *ar) in ath10k_mac_tx_frm_has_freq() argument
3960 return (ar->htt.target_version_major >= 3 && in ath10k_mac_tx_frm_has_freq()
3961 ar->htt.target_version_minor >= 4 && in ath10k_mac_tx_frm_has_freq()
3962 ar->running_fw->fw_file.htt_op_version == ATH10K_FW_HTT_OP_VERSION_TLV); in ath10k_mac_tx_frm_has_freq()
3965 static int ath10k_mac_tx_wmi_mgmt(struct ath10k *ar, struct sk_buff *skb) in ath10k_mac_tx_wmi_mgmt() argument
3967 struct sk_buff_head *q = &ar->wmi_mgmt_tx_queue; in ath10k_mac_tx_wmi_mgmt()
3970 ath10k_warn(ar, "wmi mgmt tx queue is full\n"); in ath10k_mac_tx_wmi_mgmt()
3975 ieee80211_queue_work(ar->hw, &ar->wmi_mgmt_tx_work); in ath10k_mac_tx_wmi_mgmt()
3981 ath10k_mac_tx_h_get_txpath(struct ath10k *ar, in ath10k_mac_tx_h_get_txpath() argument
3992 ar->running_fw->fw_file.fw_features) || in ath10k_mac_tx_h_get_txpath()
3994 ar->wmi.svc_map)) in ath10k_mac_tx_h_get_txpath()
3996 else if (ar->htt.target_version_major >= 3) in ath10k_mac_tx_h_get_txpath()
4005 static int ath10k_mac_tx_submit(struct ath10k *ar, in ath10k_mac_tx_submit() argument
4010 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_tx_submit()
4021 ret = ath10k_mac_tx_wmi_mgmt(ar, skb); in ath10k_mac_tx_submit()
4030 ath10k_warn(ar, "failed to transmit packet, dropping: %d\n", in ath10k_mac_tx_submit()
4032 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_tx_submit()
4041 static int ath10k_mac_tx(struct ath10k *ar, in ath10k_mac_tx() argument
4047 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_tx()
4054 ath10k_dbg(ar, ATH10K_DBG_MAC, "IEEE80211_TX_CTL_NO_CCK_RATE\n"); in ath10k_mac_tx()
4060 ath10k_tx_h_add_p2p_noa_ie(ar, vif, skb); in ath10k_mac_tx()
4071 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) && in ath10k_mac_tx()
4080 if (!ath10k_mac_tx_frm_has_freq(ar)) { in ath10k_mac_tx()
4081 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac queued offchannel skb %pK len %d\n", in ath10k_mac_tx()
4084 skb_queue_tail(&ar->offchan_tx_queue, skb); in ath10k_mac_tx()
4085 ieee80211_queue_work(hw, &ar->offchan_tx_work); in ath10k_mac_tx()
4090 ret = ath10k_mac_tx_submit(ar, txmode, txpath, skb); in ath10k_mac_tx()
4092 ath10k_warn(ar, "failed to submit frame: %d\n", ret); in ath10k_mac_tx()
4099 void ath10k_offchan_tx_purge(struct ath10k *ar) in ath10k_offchan_tx_purge() argument
4104 skb = skb_dequeue(&ar->offchan_tx_queue); in ath10k_offchan_tx_purge()
4108 ieee80211_free_txskb(ar->hw, skb); in ath10k_offchan_tx_purge()
4114 struct ath10k *ar = container_of(work, struct ath10k, offchan_tx_work); in ath10k_offchan_tx_work() local
4138 skb = skb_dequeue(&ar->offchan_tx_queue); in ath10k_offchan_tx_work()
4142 mutex_lock(&ar->conf_mutex); in ath10k_offchan_tx_work()
4144 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac offchannel skb %pK len %d\n", in ath10k_offchan_tx_work()
4150 spin_lock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4151 vdev_id = ar->scan.vdev_id; in ath10k_offchan_tx_work()
4152 peer = ath10k_peer_find(ar, vdev_id, peer_addr); in ath10k_offchan_tx_work()
4153 spin_unlock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4156 ath10k_warn(ar, "peer %pM on vdev %d already present\n", in ath10k_offchan_tx_work()
4159 ret = ath10k_peer_create(ar, NULL, NULL, vdev_id, in ath10k_offchan_tx_work()
4163 ath10k_warn(ar, "failed to create peer %pM on vdev %d: %d\n", in ath10k_offchan_tx_work()
4168 spin_lock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4169 reinit_completion(&ar->offchan_tx_completed); in ath10k_offchan_tx_work()
4170 ar->offchan_tx_skb = skb; in ath10k_offchan_tx_work()
4171 spin_unlock_bh(&ar->data_lock); in ath10k_offchan_tx_work()
4177 arvif = ath10k_get_arvif(ar, vdev_id); in ath10k_offchan_tx_work()
4186 txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb); in ath10k_offchan_tx_work()
4187 txpath = ath10k_mac_tx_h_get_txpath(ar, skb, txmode); in ath10k_offchan_tx_work()
4189 ret = ath10k_mac_tx(ar, vif, txmode, txpath, skb, true); in ath10k_offchan_tx_work()
4191 ath10k_warn(ar, "failed to transmit offchannel frame: %d\n", in ath10k_offchan_tx_work()
4197 wait_for_completion_timeout(&ar->offchan_tx_completed, 3 * HZ); in ath10k_offchan_tx_work()
4199 ath10k_warn(ar, "timed out waiting for offchannel skb %pK, len: %d\n", in ath10k_offchan_tx_work()
4203 ret = ath10k_peer_delete(ar, vdev_id, peer_addr); in ath10k_offchan_tx_work()
4205 ath10k_warn(ar, "failed to delete peer %pM on vdev %d: %d\n", in ath10k_offchan_tx_work()
4209 mutex_unlock(&ar->conf_mutex); in ath10k_offchan_tx_work()
4213 void ath10k_mgmt_over_wmi_tx_purge(struct ath10k *ar) in ath10k_mgmt_over_wmi_tx_purge() argument
4218 skb = skb_dequeue(&ar->wmi_mgmt_tx_queue); in ath10k_mgmt_over_wmi_tx_purge()
4222 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_purge()
4228 struct ath10k *ar = container_of(work, struct ath10k, wmi_mgmt_tx_work); in ath10k_mgmt_over_wmi_tx_work() local
4234 skb = skb_dequeue(&ar->wmi_mgmt_tx_queue); in ath10k_mgmt_over_wmi_tx_work()
4239 ar->running_fw->fw_file.fw_features)) { in ath10k_mgmt_over_wmi_tx_work()
4240 paddr = dma_map_single(ar->dev, skb->data, in ath10k_mgmt_over_wmi_tx_work()
4242 if (dma_mapping_error(ar->dev, paddr)) { in ath10k_mgmt_over_wmi_tx_work()
4243 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4246 ret = ath10k_wmi_mgmt_tx_send(ar, skb, paddr); in ath10k_mgmt_over_wmi_tx_work()
4248 ath10k_warn(ar, "failed to transmit management frame by ref via WMI: %d\n", in ath10k_mgmt_over_wmi_tx_work()
4251 ath10k_wmi_cleanup_mgmt_tx_send(ar, skb); in ath10k_mgmt_over_wmi_tx_work()
4253 dma_unmap_single(ar->dev, paddr, skb->len, in ath10k_mgmt_over_wmi_tx_work()
4255 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4258 ret = ath10k_wmi_mgmt_tx(ar, skb); in ath10k_mgmt_over_wmi_tx_work()
4260 ath10k_warn(ar, "failed to transmit management frame via WMI: %d\n", in ath10k_mgmt_over_wmi_tx_work()
4262 ieee80211_free_txskb(ar->hw, skb); in ath10k_mgmt_over_wmi_tx_work()
4279 static void ath10k_mac_txq_unref(struct ath10k *ar, struct ieee80211_txq *txq) in ath10k_mac_txq_unref() argument
4288 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_txq_unref()
4289 idr_for_each_entry(&ar->htt.pending_tx, msdu, msdu_id) { in ath10k_mac_txq_unref()
4294 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_txq_unref()
4297 struct ieee80211_txq *ath10k_mac_txq_lookup(struct ath10k *ar, in ath10k_mac_txq_lookup() argument
4303 lockdep_assert_held(&ar->data_lock); in ath10k_mac_txq_lookup()
4305 peer = ar->peer_map[peer_id]; in ath10k_mac_txq_lookup()
4323 struct ath10k *ar = hw->priv; in ath10k_mac_tx_can_push() local
4327 if (ar->htt.tx_q_state.mode == HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_tx_can_push()
4330 if (ar->htt.num_pending_tx < ar->htt.tx_q_state.num_push_allowed) in ath10k_mac_tx_can_push()
4347 static u16 ath10k_mac_update_airtime(struct ath10k *ar, in ath10k_mac_update_airtime() argument
4358 if (test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map)) in ath10k_mac_update_airtime()
4361 spin_lock_bh(&ar->data_lock); in ath10k_mac_update_airtime()
4380 spin_unlock_bh(&ar->data_lock); in ath10k_mac_update_airtime()
4388 struct ath10k *ar = hw->priv; in ath10k_mac_tx_push_txq() local
4389 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_tx_push_txq()
4402 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4404 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4411 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4413 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4418 airtime = ath10k_mac_update_airtime(ar, txq, skb); in ath10k_mac_tx_push_txq()
4419 ath10k_mac_tx_h_fill_cb(ar, vif, txq, sta, skb, airtime); in ath10k_mac_tx_push_txq()
4422 txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb); in ath10k_mac_tx_push_txq()
4423 txpath = ath10k_mac_tx_h_get_txpath(ar, skb, txmode); in ath10k_mac_tx_push_txq()
4430 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4435 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4438 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4441 ret = ath10k_mac_tx(ar, vif, txmode, txpath, skb, false); in ath10k_mac_tx_push_txq()
4443 ath10k_warn(ar, "failed to push frame: %d\n", ret); in ath10k_mac_tx_push_txq()
4445 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4449 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4454 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4456 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_tx_push_txq()
4483 void ath10k_mac_tx_push_pending(struct ath10k *ar) in ath10k_mac_tx_push_pending() argument
4485 struct ieee80211_hw *hw = ar->hw; in ath10k_mac_tx_push_pending()
4488 if (ar->htt.tx_q_state.mode != HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_tx_push_pending()
4491 if (ar->htt.num_pending_tx >= (ar->htt.max_num_pending_tx / 2)) in ath10k_mac_tx_push_pending()
4507 void __ath10k_scan_finish(struct ath10k *ar) in __ath10k_scan_finish() argument
4509 lockdep_assert_held(&ar->data_lock); in __ath10k_scan_finish()
4511 switch (ar->scan.state) { in __ath10k_scan_finish()
4516 if (!ar->scan.is_roc) { in __ath10k_scan_finish()
4518 .aborted = (ar->scan.state == in __ath10k_scan_finish()
4522 ieee80211_scan_completed(ar->hw, &info); in __ath10k_scan_finish()
4523 } else if (ar->scan.roc_notify) { in __ath10k_scan_finish()
4524 ieee80211_remain_on_channel_expired(ar->hw); in __ath10k_scan_finish()
4528 ar->scan.state = ATH10K_SCAN_IDLE; in __ath10k_scan_finish()
4529 ar->scan_channel = NULL; in __ath10k_scan_finish()
4530 ar->scan.roc_freq = 0; in __ath10k_scan_finish()
4531 ath10k_offchan_tx_purge(ar); in __ath10k_scan_finish()
4532 cancel_delayed_work(&ar->scan.timeout); in __ath10k_scan_finish()
4533 complete(&ar->scan.completed); in __ath10k_scan_finish()
4538 void ath10k_scan_finish(struct ath10k *ar) in ath10k_scan_finish() argument
4540 spin_lock_bh(&ar->data_lock); in ath10k_scan_finish()
4541 __ath10k_scan_finish(ar); in ath10k_scan_finish()
4542 spin_unlock_bh(&ar->data_lock); in ath10k_scan_finish()
4545 static int ath10k_scan_stop(struct ath10k *ar) in ath10k_scan_stop() argument
4554 lockdep_assert_held(&ar->conf_mutex); in ath10k_scan_stop()
4556 ret = ath10k_wmi_stop_scan(ar, &arg); in ath10k_scan_stop()
4558 ath10k_warn(ar, "failed to stop wmi scan: %d\n", ret); in ath10k_scan_stop()
4562 ret = wait_for_completion_timeout(&ar->scan.completed, 3 * HZ); in ath10k_scan_stop()
4564 ath10k_warn(ar, "failed to receive scan abortion completion: timed out\n"); in ath10k_scan_stop()
4578 spin_lock_bh(&ar->data_lock); in ath10k_scan_stop()
4579 if (ar->scan.state != ATH10K_SCAN_IDLE) in ath10k_scan_stop()
4580 __ath10k_scan_finish(ar); in ath10k_scan_stop()
4581 spin_unlock_bh(&ar->data_lock); in ath10k_scan_stop()
4586 static void ath10k_scan_abort(struct ath10k *ar) in ath10k_scan_abort() argument
4590 lockdep_assert_held(&ar->conf_mutex); in ath10k_scan_abort()
4592 spin_lock_bh(&ar->data_lock); in ath10k_scan_abort()
4594 switch (ar->scan.state) { in ath10k_scan_abort()
4602 ath10k_warn(ar, "refusing scan abortion due to invalid scan state: %s (%d)\n", in ath10k_scan_abort()
4603 ath10k_scan_state_str(ar->scan.state), in ath10k_scan_abort()
4604 ar->scan.state); in ath10k_scan_abort()
4607 ar->scan.state = ATH10K_SCAN_ABORTING; in ath10k_scan_abort()
4608 spin_unlock_bh(&ar->data_lock); in ath10k_scan_abort()
4610 ret = ath10k_scan_stop(ar); in ath10k_scan_abort()
4612 ath10k_warn(ar, "failed to abort scan: %d\n", ret); in ath10k_scan_abort()
4614 spin_lock_bh(&ar->data_lock); in ath10k_scan_abort()
4618 spin_unlock_bh(&ar->data_lock); in ath10k_scan_abort()
4623 struct ath10k *ar = container_of(work, struct ath10k, in ath10k_scan_timeout_work() local
4626 mutex_lock(&ar->conf_mutex); in ath10k_scan_timeout_work()
4627 ath10k_scan_abort(ar); in ath10k_scan_timeout_work()
4628 mutex_unlock(&ar->conf_mutex); in ath10k_scan_timeout_work()
4631 static int ath10k_start_scan(struct ath10k *ar, in ath10k_start_scan() argument
4636 lockdep_assert_held(&ar->conf_mutex); in ath10k_start_scan()
4638 ret = ath10k_wmi_start_scan(ar, arg); in ath10k_start_scan()
4642 ret = wait_for_completion_timeout(&ar->scan.started, 1 * HZ); in ath10k_start_scan()
4644 ret = ath10k_scan_stop(ar); in ath10k_start_scan()
4646 ath10k_warn(ar, "failed to stop scan: %d\n", ret); in ath10k_start_scan()
4655 spin_lock_bh(&ar->data_lock); in ath10k_start_scan()
4656 if (ar->scan.state == ATH10K_SCAN_IDLE) { in ath10k_start_scan()
4657 spin_unlock_bh(&ar->data_lock); in ath10k_start_scan()
4660 spin_unlock_bh(&ar->data_lock); in ath10k_start_scan()
4673 struct ath10k *ar = hw->priv; in ath10k_mac_op_tx() local
4674 struct ath10k_htt *htt = &ar->htt; in ath10k_mac_op_tx()
4686 airtime = ath10k_mac_update_airtime(ar, txq, skb); in ath10k_mac_op_tx()
4687 ath10k_mac_tx_h_fill_cb(ar, vif, txq, sta, skb, airtime); in ath10k_mac_op_tx()
4689 txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb); in ath10k_mac_op_tx()
4690 txpath = ath10k_mac_tx_h_get_txpath(ar, skb, txmode); in ath10k_mac_op_tx()
4698 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4707 ath10k_warn(ar, "failed to increase tx pending count: %d, dropping\n", in ath10k_mac_op_tx()
4709 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4710 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_op_tx()
4716 ath10k_dbg(ar, ATH10K_DBG_MAC, "failed to increase tx mgmt pending count: %d, dropping\n", in ath10k_mac_op_tx()
4719 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4720 ieee80211_free_txskb(ar->hw, skb); in ath10k_mac_op_tx()
4723 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4726 ret = ath10k_mac_tx(ar, vif, txmode, txpath, skb, false); in ath10k_mac_op_tx()
4728 ath10k_warn(ar, "failed to transmit frame: %d\n", ret); in ath10k_mac_op_tx()
4730 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4734 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_op_tx()
4743 struct ath10k *ar = hw->priv; in ath10k_mac_op_wake_tx_queue() local
4748 if (ar->htt.tx_q_state.mode != HTT_TX_MODE_SWITCH_PUSH) in ath10k_mac_op_wake_tx_queue()
4751 spin_lock_bh(&ar->queue_lock[ac]); in ath10k_mac_op_wake_tx_queue()
4767 spin_unlock_bh(&ar->queue_lock[ac]); in ath10k_mac_op_wake_tx_queue()
4771 void ath10k_drain_tx(struct ath10k *ar) in ath10k_drain_tx() argument
4773 lockdep_assert_not_held(&ar->conf_mutex); in ath10k_drain_tx()
4778 ath10k_offchan_tx_purge(ar); in ath10k_drain_tx()
4779 ath10k_mgmt_over_wmi_tx_purge(ar); in ath10k_drain_tx()
4781 cancel_work_sync(&ar->offchan_tx_work); in ath10k_drain_tx()
4782 cancel_work_sync(&ar->wmi_mgmt_tx_work); in ath10k_drain_tx()
4785 void ath10k_halt(struct ath10k *ar) in ath10k_halt() argument
4789 lockdep_assert_held(&ar->conf_mutex); in ath10k_halt()
4791 clear_bit(ATH10K_CAC_RUNNING, &ar->dev_flags); in ath10k_halt()
4792 ar->filter_flags = 0; in ath10k_halt()
4793 ar->monitor = false; in ath10k_halt()
4794 ar->monitor_arvif = NULL; in ath10k_halt()
4796 if (ar->monitor_started) in ath10k_halt()
4797 ath10k_monitor_stop(ar); in ath10k_halt()
4799 ar->monitor_started = false; in ath10k_halt()
4800 ar->tx_paused = 0; in ath10k_halt()
4802 ath10k_scan_finish(ar); in ath10k_halt()
4803 ath10k_peer_cleanup_all(ar); in ath10k_halt()
4804 ath10k_stop_radar_confirmation(ar); in ath10k_halt()
4805 ath10k_core_stop(ar); in ath10k_halt()
4806 ath10k_hif_power_down(ar); in ath10k_halt()
4808 spin_lock_bh(&ar->data_lock); in ath10k_halt()
4809 list_for_each_entry(arvif, &ar->arvifs, list) in ath10k_halt()
4811 spin_unlock_bh(&ar->data_lock); in ath10k_halt()
4816 struct ath10k *ar = hw->priv; in ath10k_get_antenna() local
4818 mutex_lock(&ar->conf_mutex); in ath10k_get_antenna()
4820 *tx_ant = ar->cfg_tx_chainmask; in ath10k_get_antenna()
4821 *rx_ant = ar->cfg_rx_chainmask; in ath10k_get_antenna()
4823 mutex_unlock(&ar->conf_mutex); in ath10k_get_antenna()
4828 static bool ath10k_check_chain_mask(struct ath10k *ar, u32 cm, const char *dbg) in ath10k_check_chain_mask() argument
4837 …ath10k_warn(ar, "mac %s antenna chainmask is invalid: 0x%x. Suggested values: 15, 7, 3, 1 or 0.\n… in ath10k_check_chain_mask()
4842 static int ath10k_mac_get_vht_cap_bf_sts(struct ath10k *ar) in ath10k_mac_get_vht_cap_bf_sts() argument
4844 int nsts = ar->vht_cap_info; in ath10k_mac_get_vht_cap_bf_sts()
4859 static int ath10k_mac_get_vht_cap_bf_sound_dim(struct ath10k *ar) in ath10k_mac_get_vht_cap_bf_sound_dim() argument
4861 int sound_dim = ar->vht_cap_info; in ath10k_mac_get_vht_cap_bf_sound_dim()
4875 static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar) in ath10k_create_vht_cap() argument
4878 struct ath10k_hw_params *hw = &ar->hw_params; in ath10k_create_vht_cap()
4884 vht_cap.cap = ar->vht_cap_info; in ath10k_create_vht_cap()
4886 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | in ath10k_create_vht_cap()
4888 val = ath10k_mac_get_vht_cap_bf_sts(ar); in ath10k_create_vht_cap()
4895 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | in ath10k_create_vht_cap()
4897 val = ath10k_mac_get_vht_cap_bf_sound_dim(ar); in ath10k_create_vht_cap()
4906 if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i))) in ath10k_create_vht_cap()
4912 if (ar->cfg_tx_chainmask <= 1) in ath10k_create_vht_cap()
4932 static struct ieee80211_sta_ht_cap ath10k_get_ht_cap(struct ath10k *ar) in ath10k_get_ht_cap() argument
4937 if (!(ar->ht_cap_info & WMI_HT_CAP_ENABLED)) in ath10k_get_ht_cap()
4948 if (ar->ht_cap_info & WMI_HT_CAP_HT20_SGI) in ath10k_get_ht_cap()
4951 if (ar->ht_cap_info & WMI_HT_CAP_HT40_SGI) in ath10k_get_ht_cap()
4954 if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) { in ath10k_get_ht_cap()
4963 if (ar->ht_cap_info & WMI_HT_CAP_TX_STBC && (ar->cfg_tx_chainmask > 1)) in ath10k_get_ht_cap()
4966 if (ar->ht_cap_info & WMI_HT_CAP_RX_STBC) { in ath10k_get_ht_cap()
4969 stbc = ar->ht_cap_info; in ath10k_get_ht_cap()
4978 if (ar->ht_cap_info & WMI_HT_CAP_LDPC || (ar->ht_cap_info & in ath10k_get_ht_cap()
4979 WMI_HT_CAP_RX_LDPC && (ar->ht_cap_info & WMI_HT_CAP_TX_LDPC))) in ath10k_get_ht_cap()
4982 if (ar->ht_cap_info & WMI_HT_CAP_L_SIG_TXOP_PROT) in ath10k_get_ht_cap()
4986 if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK) in ath10k_get_ht_cap()
4989 for (i = 0; i < ar->num_rf_chains; i++) { in ath10k_get_ht_cap()
4990 if (ar->cfg_rx_chainmask & BIT(i)) in ath10k_get_ht_cap()
4999 static void ath10k_mac_setup_ht_vht_cap(struct ath10k *ar) in ath10k_mac_setup_ht_vht_cap() argument
5005 ht_cap = ath10k_get_ht_cap(ar); in ath10k_mac_setup_ht_vht_cap()
5006 vht_cap = ath10k_create_vht_cap(ar); in ath10k_mac_setup_ht_vht_cap()
5008 if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) { in ath10k_mac_setup_ht_vht_cap()
5009 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath10k_mac_setup_ht_vht_cap()
5012 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) { in ath10k_mac_setup_ht_vht_cap()
5013 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath10k_mac_setup_ht_vht_cap()
5019 static int __ath10k_set_antenna(struct ath10k *ar, u32 tx_ant, u32 rx_ant) in __ath10k_set_antenna() argument
5024 lockdep_assert_held(&ar->conf_mutex); in __ath10k_set_antenna()
5026 is_valid_tx_chain_mask = ath10k_check_chain_mask(ar, tx_ant, "tx"); in __ath10k_set_antenna()
5027 is_valid_rx_chain_mask = ath10k_check_chain_mask(ar, rx_ant, "rx"); in __ath10k_set_antenna()
5032 ar->cfg_tx_chainmask = tx_ant; in __ath10k_set_antenna()
5033 ar->cfg_rx_chainmask = rx_ant; in __ath10k_set_antenna()
5035 if ((ar->state != ATH10K_STATE_ON) && in __ath10k_set_antenna()
5036 (ar->state != ATH10K_STATE_RESTARTED)) in __ath10k_set_antenna()
5039 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->tx_chain_mask, in __ath10k_set_antenna()
5042 ath10k_warn(ar, "failed to set tx-chainmask: %d, req 0x%x\n", in __ath10k_set_antenna()
5047 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->rx_chain_mask, in __ath10k_set_antenna()
5050 ath10k_warn(ar, "failed to set rx-chainmask: %d, req 0x%x\n", in __ath10k_set_antenna()
5056 ath10k_mac_setup_ht_vht_cap(ar); in __ath10k_set_antenna()
5063 struct ath10k *ar = hw->priv; in ath10k_set_antenna() local
5066 mutex_lock(&ar->conf_mutex); in ath10k_set_antenna()
5067 ret = __ath10k_set_antenna(ar, tx_ant, rx_ant); in ath10k_set_antenna()
5068 mutex_unlock(&ar->conf_mutex); in ath10k_set_antenna()
5072 static int __ath10k_fetch_bb_timing_dt(struct ath10k *ar, in __ath10k_fetch_bb_timing_dt() argument
5080 node = ar->dev->of_node; in __ath10k_fetch_bb_timing_dt()
5100 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot bb_tx_timing 0x%x bb_xpa_timing 0x%x\n", in __ath10k_fetch_bb_timing_dt()
5108 static int ath10k_mac_rfkill_config(struct ath10k *ar) in ath10k_mac_rfkill_config() argument
5113 if (ar->hw_values->rfkill_pin == 0) { in ath10k_mac_rfkill_config()
5114 ath10k_warn(ar, "ath10k does not support hardware rfkill with this device\n"); in ath10k_mac_rfkill_config()
5118 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_mac_rfkill_config()
5120 ar->hw_values->rfkill_pin, ar->hw_values->rfkill_cfg, in ath10k_mac_rfkill_config()
5121 ar->hw_values->rfkill_on_level); in ath10k_mac_rfkill_config()
5124 ar->hw_values->rfkill_on_level) | in ath10k_mac_rfkill_config()
5126 ar->hw_values->rfkill_pin) | in ath10k_mac_rfkill_config()
5128 ar->hw_values->rfkill_cfg); in ath10k_mac_rfkill_config()
5130 ret = ath10k_wmi_pdev_set_param(ar, in ath10k_mac_rfkill_config()
5131 ar->wmi.pdev_param->rfkill_config, in ath10k_mac_rfkill_config()
5134 ath10k_warn(ar, in ath10k_mac_rfkill_config()
5142 int ath10k_mac_rfkill_enable_radio(struct ath10k *ar, bool enable) in ath10k_mac_rfkill_enable_radio() argument
5152 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac rfkill enable %d", param); in ath10k_mac_rfkill_enable_radio()
5154 ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->rfkill_enable, in ath10k_mac_rfkill_enable_radio()
5157 ath10k_warn(ar, "failed to set rfkill enable param %d: %d\n", in ath10k_mac_rfkill_enable_radio()
5167 struct ath10k *ar = hw->priv; in ath10k_start() local
5177 ath10k_drain_tx(ar); in ath10k_start()
5179 mutex_lock(&ar->conf_mutex); in ath10k_start()
5181 switch (ar->state) { in ath10k_start()
5183 ar->state = ATH10K_STATE_ON; in ath10k_start()
5186 ar->state = ATH10K_STATE_RESTARTED; in ath10k_start()
5199 spin_lock_bh(&ar->data_lock); in ath10k_start()
5201 if (ar->hw_rfkill_on) { in ath10k_start()
5202 ar->hw_rfkill_on = false; in ath10k_start()
5203 spin_unlock_bh(&ar->data_lock); in ath10k_start()
5207 spin_unlock_bh(&ar->data_lock); in ath10k_start()
5209 ret = ath10k_hif_power_up(ar, ATH10K_FIRMWARE_MODE_NORMAL); in ath10k_start()
5211 ath10k_err(ar, "Could not init hif: %d\n", ret); in ath10k_start()
5215 ret = ath10k_core_start(ar, ATH10K_FIRMWARE_MODE_NORMAL, in ath10k_start()
5216 &ar->normal_mode_fw); in ath10k_start()
5218 ath10k_err(ar, "Could not init core: %d\n", ret); in ath10k_start()
5222 if (ar->sys_cap_info & WMI_TLV_SYS_CAP_INFO_RFKILL) { in ath10k_start()
5223 ret = ath10k_mac_rfkill_config(ar); in ath10k_start()
5225 ath10k_warn(ar, "failed to configure rfkill: %d", ret); in ath10k_start()
5230 param = ar->wmi.pdev_param->pmf_qos; in ath10k_start()
5231 ret = ath10k_wmi_pdev_set_param(ar, param, 1); in ath10k_start()
5233 ath10k_warn(ar, "failed to enable PMF QOS: %d\n", ret); in ath10k_start()
5237 param = ar->wmi.pdev_param->dynamic_bw; in ath10k_start()
5238 ret = ath10k_wmi_pdev_set_param(ar, param, 1); in ath10k_start()
5240 ath10k_warn(ar, "failed to enable dynamic BW: %d\n", ret); in ath10k_start()
5244 if (test_bit(WMI_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi.svc_map)) { in ath10k_start()
5245 ret = ath10k_wmi_scan_prob_req_oui(ar, ar->mac_addr); in ath10k_start()
5247 ath10k_err(ar, "failed to set prob req oui: %i\n", ret); in ath10k_start()
5252 if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar->wmi.svc_map)) { in ath10k_start()
5253 ret = ath10k_wmi_adaptive_qcs(ar, true); in ath10k_start()
5255 ath10k_warn(ar, "failed to enable adaptive qcs: %d\n", in ath10k_start()
5261 if (test_bit(WMI_SERVICE_BURST, ar->wmi.svc_map)) { in ath10k_start()
5262 param = ar->wmi.pdev_param->burst_enable; in ath10k_start()
5263 ret = ath10k_wmi_pdev_set_param(ar, param, 0); in ath10k_start()
5265 ath10k_warn(ar, "failed to disable burst: %d\n", ret); in ath10k_start()
5270 param = ar->wmi.pdev_param->idle_ps_config; in ath10k_start()
5271 ret = ath10k_wmi_pdev_set_param(ar, param, 1); in ath10k_start()
5273 ath10k_warn(ar, "failed to enable idle_ps_config: %d\n", ret); in ath10k_start()
5277 __ath10k_set_antenna(ar, ar->cfg_tx_chainmask, ar->cfg_rx_chainmask); in ath10k_start()
5288 param = ar->wmi.pdev_param->arp_ac_override; in ath10k_start()
5289 ret = ath10k_wmi_pdev_set_param(ar, param, 0); in ath10k_start()
5291 ath10k_warn(ar, "failed to set arp ac override parameter: %d\n", in ath10k_start()
5297 ar->running_fw->fw_file.fw_features)) { in ath10k_start()
5298 ret = ath10k_wmi_pdev_enable_adaptive_cca(ar, 1, in ath10k_start()
5302 ath10k_warn(ar, "failed to enable adaptive cca: %d\n", in ath10k_start()
5308 param = ar->wmi.pdev_param->ani_enable; in ath10k_start()
5309 ret = ath10k_wmi_pdev_set_param(ar, param, 1); in ath10k_start()
5311 ath10k_warn(ar, "failed to enable ani by default: %d\n", in ath10k_start()
5316 ar->ani_enabled = true; in ath10k_start()
5318 if (ath10k_peer_stats_enabled(ar)) { in ath10k_start()
5319 param = ar->wmi.pdev_param->peer_stats_update_period; in ath10k_start()
5320 ret = ath10k_wmi_pdev_set_param(ar, param, in ath10k_start()
5323 ath10k_warn(ar, in ath10k_start()
5330 param = ar->wmi.pdev_param->enable_btcoex; in ath10k_start()
5331 if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map) && in ath10k_start()
5333 ar->running_fw->fw_file.fw_features) && in ath10k_start()
5334 ar->coex_support) { in ath10k_start()
5335 ret = ath10k_wmi_pdev_set_param(ar, param, 0); in ath10k_start()
5337 ath10k_warn(ar, in ath10k_start()
5341 clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); in ath10k_start()
5344 if (test_bit(WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT, ar->wmi.svc_map)) { in ath10k_start()
5345 ret = __ath10k_fetch_bb_timing_dt(ar, &bb_timing); in ath10k_start()
5347 ret = ath10k_wmi_pdev_bb_timing(ar, &bb_timing); in ath10k_start()
5349 ath10k_warn(ar, in ath10k_start()
5357 ar->num_started_vdevs = 0; in ath10k_start()
5358 ath10k_regd_update(ar); in ath10k_start()
5360 ath10k_spectral_start(ar); in ath10k_start()
5361 ath10k_thermal_set_throttling(ar); in ath10k_start()
5363 ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_IDLE; in ath10k_start()
5365 mutex_unlock(&ar->conf_mutex); in ath10k_start()
5369 ath10k_core_stop(ar); in ath10k_start()
5372 ath10k_hif_power_down(ar); in ath10k_start()
5375 ar->state = ATH10K_STATE_OFF; in ath10k_start()
5378 mutex_unlock(&ar->conf_mutex); in ath10k_start()
5384 struct ath10k *ar = hw->priv; in ath10k_stop() local
5387 ath10k_drain_tx(ar); in ath10k_stop()
5389 mutex_lock(&ar->conf_mutex); in ath10k_stop()
5390 if (ar->state != ATH10K_STATE_OFF) { in ath10k_stop()
5391 if (!ar->hw_rfkill_on) { in ath10k_stop()
5397 if (ar->state != ATH10K_STATE_RESTARTING) { in ath10k_stop()
5398 ath10k_halt(ar); in ath10k_stop()
5405 ath10k_wait_for_suspend(ar, opt); in ath10k_stop()
5408 ar->state = ATH10K_STATE_OFF; in ath10k_stop()
5410 mutex_unlock(&ar->conf_mutex); in ath10k_stop()
5412 cancel_work_sync(&ar->set_coverage_class_work); in ath10k_stop()
5413 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_stop()
5414 cancel_work_sync(&ar->restart_work); in ath10k_stop()
5417 static int ath10k_config_ps(struct ath10k *ar) in ath10k_config_ps() argument
5422 lockdep_assert_held(&ar->conf_mutex); in ath10k_config_ps()
5424 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_config_ps()
5427 ath10k_warn(ar, "failed to setup powersave: %d\n", ret); in ath10k_config_ps()
5437 struct ath10k *ar = hw->priv; in ath10k_config() local
5441 mutex_lock(&ar->conf_mutex); in ath10k_config()
5444 ath10k_config_ps(ar); in ath10k_config()
5447 ar->monitor = conf->flags & IEEE80211_CONF_MONITOR; in ath10k_config()
5448 ret = ath10k_monitor_recalc(ar); in ath10k_config()
5450 ath10k_warn(ar, "failed to recalc monitor: %d\n", ret); in ath10k_config()
5453 mutex_unlock(&ar->conf_mutex); in ath10k_config()
5471 struct ath10k *ar = arvif->ar; in ath10k_mac_set_txbf_conf() local
5475 if (ath10k_wmi_get_txbf_conf_scheme(ar) != WMI_TXBF_CONF_BEFORE_ASSOC) in ath10k_mac_set_txbf_conf()
5478 nsts = ath10k_mac_get_vht_cap_bf_sts(ar); in ath10k_mac_set_txbf_conf()
5479 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | in ath10k_mac_set_txbf_conf()
5483 sound_dim = ath10k_mac_get_vht_cap_bf_sound_dim(ar); in ath10k_mac_set_txbf_conf()
5484 if (ar->vht_cap_info & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE | in ath10k_mac_set_txbf_conf()
5491 if (ar->vht_cap_info & IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE) in ath10k_mac_set_txbf_conf()
5494 if (ar->vht_cap_info & IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE) in ath10k_mac_set_txbf_conf()
5498 if (ar->vht_cap_info & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE) in ath10k_mac_set_txbf_conf()
5501 if (ar->vht_cap_info & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE) in ath10k_mac_set_txbf_conf()
5505 return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_mac_set_txbf_conf()
5506 ar->wmi.vdev_param->txbf, value); in ath10k_mac_set_txbf_conf()
5513 struct ath10k *ar = hw->priv; in ath10k_update_vif_offload() local
5518 ar->wmi.vdev_param->tx_encap_type == WMI_VDEV_PARAM_UNSUPPORTED || in ath10k_update_vif_offload()
5523 vdev_param = ar->wmi.vdev_param->tx_encap_type; in ath10k_update_vif_offload()
5524 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_update_vif_offload()
5528 ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n", in ath10k_update_vif_offload()
5543 struct ath10k *ar = hw->priv; in ath10k_add_interface() local
5555 mutex_lock(&ar->conf_mutex); in ath10k_add_interface()
5560 arvif->ar = ar; in ath10k_add_interface()
5576 if (ar->num_peers >= ar->max_num_peers) { in ath10k_add_interface()
5577 ath10k_warn(ar, "refusing vdev creation due to insufficient peer entry resources in firmware\n"); in ath10k_add_interface()
5582 if (ar->free_vdev_map == 0) { in ath10k_add_interface()
5583 ath10k_warn(ar, "Free vdev map is empty, no more interfaces allowed.\n"); in ath10k_add_interface()
5587 bit = __ffs64(ar->free_vdev_map); in ath10k_add_interface()
5589 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac create vdev %i map %llx\n", in ath10k_add_interface()
5590 bit, ar->free_vdev_map); in ath10k_add_interface()
5594 ath10k_wmi_get_vdev_subtype(ar, WMI_VDEV_SUBTYPE_NONE); in ath10k_add_interface()
5600 (ar, WMI_VDEV_SUBTYPE_P2P_DEVICE); in ath10k_add_interface()
5607 (ar, WMI_VDEV_SUBTYPE_P2P_CLIENT); in ath10k_add_interface()
5613 if (test_bit(WMI_SERVICE_MESH_11S, ar->wmi.svc_map)) { in ath10k_add_interface()
5615 (ar, WMI_VDEV_SUBTYPE_MESH_11S); in ath10k_add_interface()
5616 } else if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { in ath10k_add_interface()
5618 ath10k_warn(ar, "must load driver with rawmode=1 to add mesh interfaces\n"); in ath10k_add_interface()
5628 (ar, WMI_VDEV_SUBTYPE_P2P_GO); in ath10k_add_interface()
5666 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) { in ath10k_add_interface()
5680 dma_alloc_coherent(ar->dev, in ath10k_add_interface()
5687 ath10k_warn(ar, "failed to allocate beacon buffer: %d\n", in ath10k_add_interface()
5692 if (test_bit(ATH10K_FLAG_HW_CRYPTO_DISABLED, &ar->dev_flags)) in ath10k_add_interface()
5696 !test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { in ath10k_add_interface()
5698 ath10k_warn(ar, "cryptmode module param needed for sw crypto\n"); in ath10k_add_interface()
5702 …ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev create %d (add interface) type %d subtype %d bcnmode %s\n… in ath10k_add_interface()
5706 ret = ath10k_wmi_vdev_create(ar, arvif->vdev_id, arvif->vdev_type, in ath10k_add_interface()
5709 ath10k_warn(ar, "failed to create WMI vdev %i: %d\n", in ath10k_add_interface()
5715 ar->wmi.svc_map)) { in ath10k_add_interface()
5716 vdev_param = ar->wmi.vdev_param->disable_4addr_src_lrn; in ath10k_add_interface()
5717 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5720 ath10k_warn(ar, "failed to disable 4addr src lrn vdev %i: %d\n", in ath10k_add_interface()
5725 ar->free_vdev_map &= ~(1LL << arvif->vdev_id); in ath10k_add_interface()
5726 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5727 list_add(&arvif->list, &ar->arvifs); in ath10k_add_interface()
5728 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5735 ath10k_warn(ar, "failed to disable keepalive on vdev %i: %d\n", in ath10k_add_interface()
5747 if (ar->cfg_tx_chainmask && (vif->type != NL80211_IFTYPE_MONITOR)) { in ath10k_add_interface()
5748 u16 nss = get_nss_from_chainmask(ar->cfg_tx_chainmask); in ath10k_add_interface()
5750 vdev_param = ar->wmi.vdev_param->nss; in ath10k_add_interface()
5751 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5754 ath10k_warn(ar, "failed to set vdev %i chainmask 0x%x, nss %i: %d\n", in ath10k_add_interface()
5755 arvif->vdev_id, ar->cfg_tx_chainmask, nss, in ath10k_add_interface()
5763 ret = ath10k_peer_create(ar, vif, NULL, arvif->vdev_id, in ath10k_add_interface()
5766 ath10k_warn(ar, "failed to create vdev %i peer for AP/IBSS: %d\n", in ath10k_add_interface()
5771 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5773 peer = ath10k_peer_find(ar, arvif->vdev_id, vif->addr); in ath10k_add_interface()
5775 ath10k_warn(ar, "failed to lookup peer %pM on vdev %i\n", in ath10k_add_interface()
5777 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5785 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5793 ath10k_warn(ar, "failed to set vdev %i kickout parameters: %d\n", in ath10k_add_interface()
5802 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_add_interface()
5805 ath10k_warn(ar, "failed to set vdev %i RX wake policy: %d\n", in ath10k_add_interface()
5812 ath10k_warn(ar, "failed to recalc ps wake threshold on vdev %i: %d\n", in ath10k_add_interface()
5819 ath10k_warn(ar, "failed to recalc ps poll count on vdev %i: %d\n", in ath10k_add_interface()
5827 ath10k_warn(ar, "failed to set txbf for vdev %d: %d\n", in ath10k_add_interface()
5832 ret = ath10k_mac_set_rts(arvif, ar->hw->wiphy->rts_threshold); in ath10k_add_interface()
5834 ath10k_warn(ar, "failed to set rts threshold for vdev %d: %d\n", in ath10k_add_interface()
5840 ret = ath10k_mac_txpower_recalc(ar); in ath10k_add_interface()
5842 ath10k_warn(ar, "failed to recalc tx power: %d\n", ret); in ath10k_add_interface()
5846 if (test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) { in ath10k_add_interface()
5847 vdev_param = ar->wmi.vdev_param->rtt_responder_role; in ath10k_add_interface()
5848 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_add_interface()
5853 ath10k_warn(ar, "failed to set vdev %i FTM Responder: %d\n", in ath10k_add_interface()
5858 ar->monitor_arvif = arvif; in ath10k_add_interface()
5859 ret = ath10k_monitor_recalc(ar); in ath10k_add_interface()
5861 ath10k_warn(ar, "failed to recalc monitor: %d\n", ret); in ath10k_add_interface()
5866 spin_lock_bh(&ar->htt.tx_lock); in ath10k_add_interface()
5867 if (!ar->tx_paused) in ath10k_add_interface()
5868 ieee80211_wake_queue(ar->hw, arvif->vdev_id); in ath10k_add_interface()
5869 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_add_interface()
5871 mutex_unlock(&ar->conf_mutex); in ath10k_add_interface()
5877 ath10k_wmi_peer_delete(ar, arvif->vdev_id, vif->addr); in ath10k_add_interface()
5878 ath10k_wait_for_peer_delete_done(ar, arvif->vdev_id, in ath10k_add_interface()
5883 ath10k_wmi_vdev_delete(ar, arvif->vdev_id); in ath10k_add_interface()
5884 ar->free_vdev_map |= 1LL << arvif->vdev_id; in ath10k_add_interface()
5885 spin_lock_bh(&ar->data_lock); in ath10k_add_interface()
5887 spin_unlock_bh(&ar->data_lock); in ath10k_add_interface()
5891 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL) in ath10k_add_interface()
5894 dma_free_coherent(ar->dev, IEEE80211_MAX_FRAME_LEN, in ath10k_add_interface()
5900 mutex_unlock(&ar->conf_mutex); in ath10k_add_interface()
5916 struct ath10k *ar = hw->priv; in ath10k_remove_interface() local
5926 mutex_lock(&ar->conf_mutex); in ath10k_remove_interface()
5930 ath10k_warn(ar, "failed to stop spectral for vdev %i: %d\n", in ath10k_remove_interface()
5933 ar->free_vdev_map |= 1LL << arvif->vdev_id; in ath10k_remove_interface()
5934 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5936 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
5940 ret = ath10k_wmi_peer_delete(arvif->ar, arvif->vdev_id, in ath10k_remove_interface()
5943 ath10k_warn(ar, "failed to submit AP/IBSS self-peer removal on vdev %i: %d\n", in ath10k_remove_interface()
5946 ath10k_wait_for_peer_delete_done(ar, arvif->vdev_id, in ath10k_remove_interface()
5951 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %i delete (remove interface)\n", in ath10k_remove_interface()
5954 ret = ath10k_wmi_vdev_delete(ar, arvif->vdev_id); in ath10k_remove_interface()
5956 ath10k_warn(ar, "failed to delete WMI vdev %i: %d\n", in ath10k_remove_interface()
5959 if (test_bit(WMI_SERVICE_SYNC_DELETE_CMDS, ar->wmi.svc_map)) { in ath10k_remove_interface()
5960 time_left = wait_for_completion_timeout(&ar->vdev_delete_done, in ath10k_remove_interface()
5963 ath10k_warn(ar, "Timeout in receiving vdev delete response\n"); in ath10k_remove_interface()
5973 ret = ath10k_wait_for_peer_deleted(ar, arvif->vdev_id, in ath10k_remove_interface()
5976 ath10k_warn(ar, "failed to remove AP self-peer on vdev %i: %d\n", in ath10k_remove_interface()
5979 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5980 ar->num_peers--; in ath10k_remove_interface()
5981 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
5984 spin_lock_bh(&ar->data_lock); in ath10k_remove_interface()
5985 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_remove_interface()
5986 peer = ar->peer_map[i]; in ath10k_remove_interface()
5991 ath10k_warn(ar, "found vif peer %pM entry on vdev %i after it was supposedly removed\n", in ath10k_remove_interface()
6001 spin_unlock_bh(&ar->data_lock); in ath10k_remove_interface()
6003 ath10k_peer_cleanup(ar, arvif->vdev_id); in ath10k_remove_interface()
6004 ath10k_mac_txq_unref(ar, vif->txq); in ath10k_remove_interface()
6007 ar->monitor_arvif = NULL; in ath10k_remove_interface()
6008 ret = ath10k_monitor_recalc(ar); in ath10k_remove_interface()
6010 ath10k_warn(ar, "failed to recalc monitor: %d\n", ret); in ath10k_remove_interface()
6013 ret = ath10k_mac_txpower_recalc(ar); in ath10k_remove_interface()
6015 ath10k_warn(ar, "failed to recalc tx power: %d\n", ret); in ath10k_remove_interface()
6017 spin_lock_bh(&ar->htt.tx_lock); in ath10k_remove_interface()
6019 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_remove_interface()
6021 ath10k_mac_txq_unref(ar, vif->txq); in ath10k_remove_interface()
6024 mutex_unlock(&ar->conf_mutex); in ath10k_remove_interface()
6044 struct ath10k *ar = hw->priv; in ath10k_configure_filter() local
6047 mutex_lock(&ar->conf_mutex); in ath10k_configure_filter()
6050 ar->filter_flags = *total_flags; in ath10k_configure_filter()
6052 ret = ath10k_monitor_recalc(ar); in ath10k_configure_filter()
6054 ath10k_warn(ar, "failed to recalc monitor: %d\n", ret); in ath10k_configure_filter()
6056 mutex_unlock(&ar->conf_mutex); in ath10k_configure_filter()
6059 static void ath10k_recalculate_mgmt_rate(struct ath10k *ar, in ath10k_recalculate_mgmt_rate() argument
6071 lockdep_assert_held(&ar->conf_mutex); in ath10k_recalculate_mgmt_rate()
6073 sband = ar->hw->wiphy->bands[def->chan->band]; in ath10k_recalculate_mgmt_rate()
6079 ath10k_warn(ar, "bitrate not supported %d\n", bitrate); in ath10k_recalculate_mgmt_rate()
6083 vdev_param = ar->wmi.vdev_param->mgmt_rate; in ath10k_recalculate_mgmt_rate()
6084 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_recalculate_mgmt_rate()
6087 ath10k_warn(ar, "failed to set mgmt tx rate %d\n", ret); in ath10k_recalculate_mgmt_rate()
6095 struct ath10k *ar = hw->priv; in ath10k_bss_info_changed() local
6104 mutex_lock(&ar->conf_mutex); in ath10k_bss_info_changed()
6111 vdev_param = ar->wmi.vdev_param->beacon_interval; in ath10k_bss_info_changed()
6112 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6114 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_bss_info_changed()
6119 ath10k_warn(ar, "failed to set beacon interval for vdev %d: %i\n", in ath10k_bss_info_changed()
6124 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_bss_info_changed()
6128 pdev_param = ar->wmi.pdev_param->beacon_tx_mode; in ath10k_bss_info_changed()
6129 ret = ath10k_wmi_pdev_set_param(ar, pdev_param, in ath10k_bss_info_changed()
6132 ath10k_warn(ar, "failed to set beacon mode for vdev %d: %i\n", in ath10k_bss_info_changed()
6137 ath10k_warn(ar, "failed to update beacon template: %d\n", in ath10k_bss_info_changed()
6151 ath10k_warn(ar, "failed to setup probe resp template on vdev %i: %d\n", in ath10k_bss_info_changed()
6158 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_bss_info_changed()
6162 vdev_param = ar->wmi.vdev_param->dtim_period; in ath10k_bss_info_changed()
6163 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6166 ath10k_warn(ar, "failed to set dtim period for vdev %d: %i\n", in ath10k_bss_info_changed()
6184 test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) { in ath10k_bss_info_changed()
6187 vdev_param = ar->wmi.vdev_param->rtt_responder_role; in ath10k_bss_info_changed()
6188 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6191 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_bss_info_changed()
6204 ath10k_warn(ar, "failed to recalculate rts/cts prot for vdev %d: %d\n", in ath10k_bss_info_changed()
6210 ath10k_warn(ar, "failed to set cts protection for vdev %d: %d\n", in ath10k_bss_info_changed()
6222 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %d slot_time %d\n", in ath10k_bss_info_changed()
6225 vdev_param = ar->wmi.vdev_param->slot_time; in ath10k_bss_info_changed()
6226 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6229 ath10k_warn(ar, "failed to set erp slot for vdev %d: %i\n", in ath10k_bss_info_changed()
6239 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_bss_info_changed()
6243 vdev_param = ar->wmi.vdev_param->preamble; in ath10k_bss_info_changed()
6244 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_bss_info_changed()
6247 ath10k_warn(ar, "failed to set preamble for vdev %d: %i\n", in ath10k_bss_info_changed()
6257 if (ar->monitor_started) in ath10k_bss_info_changed()
6258 ath10k_monitor_stop(ar); in ath10k_bss_info_changed()
6260 ath10k_monitor_recalc(ar); in ath10k_bss_info_changed()
6267 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev_id %i txpower %d\n", in ath10k_bss_info_changed()
6271 ret = ath10k_mac_txpower_recalc(ar); in ath10k_bss_info_changed()
6273 ath10k_warn(ar, "failed to recalc tx power: %d\n", ret); in ath10k_bss_info_changed()
6279 ret = ath10k_config_ps(ar); in ath10k_bss_info_changed()
6281 ath10k_warn(ar, "failed to setup ps on vdev %i: %d\n", in ath10k_bss_info_changed()
6294 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_bss_info_changed()
6306 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_bss_info_changed()
6310 vdev_param = ar->wmi.vdev_param->mcast_data_rate; in ath10k_bss_info_changed()
6311 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_bss_info_changed()
6314 ath10k_warn(ar, in ath10k_bss_info_changed()
6318 vdev_param = ar->wmi.vdev_param->bcast_data_rate; in ath10k_bss_info_changed()
6319 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_bss_info_changed()
6322 ath10k_warn(ar, in ath10k_bss_info_changed()
6329 ath10k_recalculate_mgmt_rate(ar, vif, &def); in ath10k_bss_info_changed()
6331 mutex_unlock(&ar->conf_mutex); in ath10k_bss_info_changed()
6336 struct ath10k *ar = hw->priv; in ath10k_mac_op_set_coverage_class() local
6341 if (!ar->hw_params.hw_ops->set_coverage_class) { in ath10k_mac_op_set_coverage_class()
6345 ar->hw_params.hw_ops->set_coverage_class(ar, value); in ath10k_mac_op_set_coverage_class()
6381 struct ath10k *ar = hw->priv; in ath10k_hw_scan() local
6389 mutex_lock(&ar->conf_mutex); in ath10k_hw_scan()
6396 spin_lock_bh(&ar->data_lock); in ath10k_hw_scan()
6397 switch (ar->scan.state) { in ath10k_hw_scan()
6399 reinit_completion(&ar->scan.started); in ath10k_hw_scan()
6400 reinit_completion(&ar->scan.completed); in ath10k_hw_scan()
6401 ar->scan.state = ATH10K_SCAN_STARTING; in ath10k_hw_scan()
6402 ar->scan.is_roc = false; in ath10k_hw_scan()
6403 ar->scan.vdev_id = arvif->vdev_id; in ath10k_hw_scan()
6412 spin_unlock_bh(&ar->data_lock); in ath10k_hw_scan()
6418 ath10k_wmi_start_scan_init(ar, &arg); in ath10k_hw_scan()
6466 ret = ath10k_start_scan(ar, &arg); in ath10k_hw_scan()
6468 ath10k_warn(ar, "failed to start hw scan: %d\n", ret); in ath10k_hw_scan()
6469 spin_lock_bh(&ar->data_lock); in ath10k_hw_scan()
6470 ar->scan.state = ATH10K_SCAN_IDLE; in ath10k_hw_scan()
6471 spin_unlock_bh(&ar->data_lock); in ath10k_hw_scan()
6474 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath10k_hw_scan()
6478 mutex_unlock(&ar->conf_mutex); in ath10k_hw_scan()
6485 struct ath10k *ar = hw->priv; in ath10k_cancel_hw_scan() local
6487 mutex_lock(&ar->conf_mutex); in ath10k_cancel_hw_scan()
6488 ath10k_scan_abort(ar); in ath10k_cancel_hw_scan()
6489 mutex_unlock(&ar->conf_mutex); in ath10k_cancel_hw_scan()
6491 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_cancel_hw_scan()
6494 static void ath10k_set_key_h_def_keyidx(struct ath10k *ar, in ath10k_set_key_h_def_keyidx() argument
6499 u32 vdev_param = arvif->ar->wmi.vdev_param->def_keyid; in ath10k_set_key_h_def_keyidx()
6529 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, in ath10k_set_key_h_def_keyidx()
6532 ath10k_warn(ar, "failed to set vdev %i group key as default key: %d\n", in ath10k_set_key_h_def_keyidx()
6540 struct ath10k *ar = hw->priv; in ath10k_set_key() local
6565 mutex_lock(&ar->conf_mutex); in ath10k_set_key()
6570 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6572 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6591 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6592 peer = ath10k_peer_find(ar, arvif->vdev_id, peer_addr); in ath10k_set_key()
6593 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6597 ath10k_warn(ar, "failed to install key for non-existent peer %pM\n", in ath10k_set_key()
6637 ath10k_warn(ar, "failed to install key for vdev %i peer %pM: %d\n", in ath10k_set_key()
6653 ath10k_warn(ar, "failed to install (ucast) key for vdev %i peer %pM: %d\n", in ath10k_set_key()
6659 ath10k_warn(ar, "failed to disable (mcast) key for vdev %i peer %pM: %d\n", in ath10k_set_key()
6666 ath10k_set_key_h_def_keyidx(ar, arvif, cmd, key); in ath10k_set_key()
6668 spin_lock_bh(&ar->data_lock); in ath10k_set_key()
6669 peer = ath10k_peer_find(ar, arvif->vdev_id, peer_addr); in ath10k_set_key()
6676 ath10k_warn(ar, "Peer %pM disappeared!\n", peer_addr); in ath10k_set_key()
6677 spin_unlock_bh(&ar->data_lock); in ath10k_set_key()
6680 ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_set_key()
6681 ar->wmi.peer_param->authorize, 1); in ath10k_set_key()
6683 ath10k_wmi_peer_set_param(ar, arvif->vdev_id, peer_addr, in ath10k_set_key()
6684 ar->wmi.peer_param->authorize, 1); in ath10k_set_key()
6687 mutex_unlock(&ar->conf_mutex); in ath10k_set_key()
6695 struct ath10k *ar = hw->priv; in ath10k_set_default_unicast_key() local
6699 mutex_lock(&arvif->ar->conf_mutex); in ath10k_set_default_unicast_key()
6701 if (arvif->ar->state != ATH10K_STATE_ON) in ath10k_set_default_unicast_key()
6704 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %d set keyidx %d\n", in ath10k_set_default_unicast_key()
6707 ret = ath10k_wmi_vdev_set_param(arvif->ar, in ath10k_set_default_unicast_key()
6709 arvif->ar->wmi.vdev_param->def_keyid, in ath10k_set_default_unicast_key()
6713 ath10k_warn(ar, "failed to update wep key index for vdev %d: %d\n", in ath10k_set_default_unicast_key()
6722 mutex_unlock(&arvif->ar->conf_mutex); in ath10k_set_default_unicast_key()
6727 struct ath10k *ar; in ath10k_sta_rc_update_wk() local
6741 ar = arvif->ar; in ath10k_sta_rc_update_wk()
6750 spin_lock_bh(&ar->data_lock); in ath10k_sta_rc_update_wk()
6759 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update_wk()
6761 mutex_lock(&ar->conf_mutex); in ath10k_sta_rc_update_wk()
6771 ath10k_dbg(ar, ATH10K_DBG_STA, "mac update sta %pM peer bw %d phymode %d\n", in ath10k_sta_rc_update_wk()
6774 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6775 ar->wmi.peer_param->phymode, mode); in ath10k_sta_rc_update_wk()
6777 ath10k_warn(ar, "failed to update STA %pM peer phymode %d: %d\n", in ath10k_sta_rc_update_wk()
6782 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6783 ar->wmi.peer_param->chan_width, bw); in ath10k_sta_rc_update_wk()
6785 ath10k_warn(ar, "failed to update STA %pM peer bw %d: %d\n", in ath10k_sta_rc_update_wk()
6790 ath10k_dbg(ar, ATH10K_DBG_STA, "mac update sta %pM nss %d\n", in ath10k_sta_rc_update_wk()
6793 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6794 ar->wmi.peer_param->nss, nss); in ath10k_sta_rc_update_wk()
6796 ath10k_warn(ar, "failed to update STA %pM nss %d: %d\n", in ath10k_sta_rc_update_wk()
6801 ath10k_dbg(ar, ATH10K_DBG_STA, "mac update sta %pM smps %d\n", in ath10k_sta_rc_update_wk()
6804 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_rc_update_wk()
6805 ar->wmi.peer_param->smps_state, smps); in ath10k_sta_rc_update_wk()
6807 ath10k_warn(ar, "failed to update STA %pM smps %d: %d\n", in ath10k_sta_rc_update_wk()
6812 ath10k_dbg(ar, ATH10K_DBG_STA, "mac update sta %pM supp rates\n", in ath10k_sta_rc_update_wk()
6815 err = ath10k_station_assoc(ar, arvif->vif, sta, true); in ath10k_sta_rc_update_wk()
6817 ath10k_warn(ar, "failed to reassociate station: %pM\n", in ath10k_sta_rc_update_wk()
6822 mutex_unlock(&ar->conf_mutex); in ath10k_sta_rc_update_wk()
6828 struct ath10k *ar = arvif->ar; in ath10k_mac_inc_num_stations() local
6830 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_inc_num_stations()
6835 if (ar->num_stations >= ar->max_num_stations) in ath10k_mac_inc_num_stations()
6838 ar->num_stations++; in ath10k_mac_inc_num_stations()
6846 struct ath10k *ar = arvif->ar; in ath10k_mac_dec_num_stations() local
6848 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_dec_num_stations()
6853 ar->num_stations--; in ath10k_mac_dec_num_stations()
6860 struct ath10k *ar = hw->priv; in ath10k_sta_set_txpwr() local
6876 mutex_lock(&ar->conf_mutex); in ath10k_sta_set_txpwr()
6878 ret = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_sta_set_txpwr()
6879 ar->wmi.peer_param->use_fixed_power, txpwr); in ath10k_sta_set_txpwr()
6881 ath10k_warn(ar, "failed to set tx power for station ret: %d\n", in ath10k_sta_set_txpwr()
6887 mutex_unlock(&ar->conf_mutex); in ath10k_sta_set_txpwr()
6893 struct ath10k *ar; member
6898 ath10k_mac_bitrate_mask_has_single_rate(struct ath10k *ar, in ath10k_mac_bitrate_mask_has_single_rate() argument
6922 ath10k_mac_bitrate_mask_get_single_rate(struct ath10k *ar, in ath10k_mac_bitrate_mask_get_single_rate() argument
6939 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) in ath10k_mac_bitrate_mask_get_single_rate()
6984 static int ath10k_mac_validate_rate_mask(struct ath10k *ar, in ath10k_mac_validate_rate_mask() argument
6992 ath10k_warn(ar, "Invalid nss field, configured %u limit %u\n", in ath10k_mac_validate_rate_mask()
6999 ath10k_warn(ar, "Invalid VHT rate for sta %pM\n", in ath10k_mac_validate_rate_mask()
7005 ath10k_warn(ar, "Invalid HT rate for sta %pM\n", in ath10k_mac_validate_rate_mask()
7018 ath10k_mac_tid_bitrate_config(struct ath10k *ar, in ath10k_mac_tid_bitrate_config() argument
7041 if (!ath10k_mac_bitrate_mask_has_single_rate(ar, band, mask, in ath10k_mac_tid_bitrate_config()
7046 ret = ath10k_mac_bitrate_mask_get_single_rate(ar, band, mask, in ath10k_mac_tid_bitrate_config()
7049 ath10k_warn(ar, "failed to get single rate: %d\n", in ath10k_mac_tid_bitrate_config()
7056 if (sta && ath10k_mac_validate_rate_mask(ar, sta, *rate_ctrl_flag, nss)) in ath10k_mac_tid_bitrate_config()
7063 ar->wmi.svc_map))) in ath10k_mac_tid_bitrate_config()
7071 static int ath10k_mac_set_tid_config(struct ath10k *ar, struct ieee80211_sta *sta, in ath10k_mac_set_tid_config() argument
7118 ret = ath10k_wmi_set_per_peer_per_tid_cfg(ar, arg); in ath10k_mac_set_tid_config()
7205 ath10k_mac_parse_tid_config(struct ath10k *ar, in ath10k_mac_parse_tid_config() argument
7254 ret = ath10k_mac_tid_bitrate_config(ar, vif, sta, in ath10k_mac_parse_tid_config()
7260 ath10k_warn(ar, "failed to configure bitrate mask %d\n", in ath10k_mac_parse_tid_config()
7274 ret = ath10k_mac_set_tid_config(ar, sta, vif, changed, arg); in ath10k_mac_parse_tid_config()
7283 static int ath10k_mac_reset_tid_config(struct ath10k *ar, in ath10k_mac_reset_tid_config() argument
7309 ret = ath10k_wmi_set_per_peer_per_tid_cfg(ar, &arg); in ath10k_mac_reset_tid_config()
7341 struct ath10k *ar; in ath10k_sta_tid_cfg_wk() local
7350 ar = arvif->ar; in ath10k_sta_tid_cfg_wk()
7352 mutex_lock(&ar->conf_mutex); in ath10k_sta_tid_cfg_wk()
7355 ret = ath10k_mac_reset_tid_config(ar, sta, arvif, in ath10k_sta_tid_cfg_wk()
7402 ret = ath10k_mac_validate_rate_mask(ar, sta, in ath10k_sta_tid_cfg_wk()
7439 ret = ath10k_wmi_set_per_peer_per_tid_cfg(ar, &arg); in ath10k_sta_tid_cfg_wk()
7441 ath10k_warn(ar, "failed to set per tid config for sta %pM: %d\n", in ath10k_sta_tid_cfg_wk()
7453 mutex_unlock(&ar->conf_mutex); in ath10k_sta_tid_cfg_wk()
7466 ieee80211_queue_work(iter_data->ar->hw, &arsta->tid_config_wk); in ath10k_mac_vif_stations_tid_conf()
7475 struct ath10k *ar = hw->priv; in ath10k_sta_state() local
7501 mutex_lock(&ar->conf_mutex); in ath10k_sta_state()
7511 ath10k_dbg(ar, ATH10K_DBG_STA, in ath10k_sta_state()
7514 ar->num_stations + 1, ar->max_num_stations, in ath10k_sta_state()
7515 ar->num_peers + 1, ar->max_num_peers); in ath10k_sta_state()
7520 if (num_tdls_stations >= ar->max_num_tdls_vdevs) { in ath10k_sta_state()
7521 ath10k_warn(ar, "vdev %i exceeded maximum number of tdls vdevs %i\n", in ath10k_sta_state()
7523 ar->max_num_tdls_vdevs); in ath10k_sta_state()
7532 ath10k_warn(ar, "refusing to associate station: too many connected already (%d)\n", in ath10k_sta_state()
7533 ar->max_num_stations); in ath10k_sta_state()
7537 if (ath10k_debug_is_extd_tx_stats_enabled(ar)) { in ath10k_sta_state()
7547 ret = ath10k_peer_create(ar, vif, sta, arvif->vdev_id, in ath10k_sta_state()
7550 ath10k_warn(ar, "failed to add peer %pM for vdev %d when adding a new sta: %i\n", in ath10k_sta_state()
7557 spin_lock_bh(&ar->data_lock); in ath10k_sta_state()
7559 peer = ath10k_peer_find(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7561 ath10k_warn(ar, "failed to lookup peer %pM on vdev %i\n", in ath10k_sta_state()
7563 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7564 ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7574 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7579 ret = ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7582 ath10k_warn(ar, "failed to update fw tdls state on vdev %i: %i\n", in ath10k_sta_state()
7584 ath10k_peer_delete(ar, arvif->vdev_id, in ath10k_sta_state()
7591 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, sta, in ath10k_sta_state()
7594 ath10k_warn(ar, in ath10k_sta_state()
7597 ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7603 ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7611 ath10k_dbg(ar, ATH10K_DBG_STA, in ath10k_sta_state()
7616 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, in ath10k_sta_state()
7620 ath10k_warn(ar, "failed to update tdls peer state for %pM state %d: %i\n", in ath10k_sta_state()
7625 ret = ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath10k_sta_state()
7627 ath10k_warn(ar, "failed to delete peer %pM for vdev %d: %i\n", in ath10k_sta_state()
7632 spin_lock_bh(&ar->data_lock); in ath10k_sta_state()
7633 for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { in ath10k_sta_state()
7634 peer = ar->peer_map[i]; in ath10k_sta_state()
7639 …ath10k_warn(ar, "found sta peer %pM (ptr %pK id %d) entry on vdev %i after it was supposedly remov… in ath10k_sta_state()
7646 ath10k_peer_map_cleanup(ar, peer); in ath10k_sta_state()
7649 spin_unlock_bh(&ar->data_lock); in ath10k_sta_state()
7651 if (ath10k_debug_is_extd_tx_stats_enabled(ar)) { in ath10k_sta_state()
7657 ath10k_mac_txq_unref(ar, sta->txq[i]); in ath10k_sta_state()
7666 ret = ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id, in ath10k_sta_state()
7669 ath10k_warn(ar, "failed to update fw tdls state on vdev %i: %i\n", in ath10k_sta_state()
7680 ath10k_dbg(ar, ATH10K_DBG_STA, "mac sta %pM associated\n", in ath10k_sta_state()
7683 ret = ath10k_station_assoc(ar, vif, sta, false); in ath10k_sta_state()
7685 ath10k_warn(ar, "failed to associate station %pM for vdev %i: %i\n", in ath10k_sta_state()
7693 ath10k_dbg(ar, ATH10K_DBG_STA, "mac tdls sta %pM authorized\n", in ath10k_sta_state()
7696 ret = ath10k_station_assoc(ar, vif, sta, false); in ath10k_sta_state()
7698 ath10k_warn(ar, "failed to associate tdls station %pM for vdev %i: %i\n", in ath10k_sta_state()
7703 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, sta, in ath10k_sta_state()
7706 ath10k_warn(ar, "failed to update tdls peer %pM for vdev %i: %i\n", in ath10k_sta_state()
7716 ath10k_dbg(ar, ATH10K_DBG_STA, "mac sta %pM disassociated\n", in ath10k_sta_state()
7719 ret = ath10k_station_disassoc(ar, vif, sta); in ath10k_sta_state()
7721 ath10k_warn(ar, "failed to disassociate station: %pM vdev %i: %i\n", in ath10k_sta_state()
7725 mutex_unlock(&ar->conf_mutex); in ath10k_sta_state()
7729 static int ath10k_conf_tx_uapsd(struct ath10k *ar, struct ieee80211_vif *vif, in ath10k_conf_tx_uapsd() argument
7738 lockdep_assert_held(&ar->conf_mutex); in ath10k_conf_tx_uapsd()
7775 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7779 ath10k_warn(ar, "failed to set uapsd params: %d\n", ret); in ath10k_conf_tx_uapsd()
7788 ret = ath10k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7792 ath10k_warn(ar, "failed to set rx wake param: %d\n", ret); in ath10k_conf_tx_uapsd()
7796 ath10k_warn(ar, "failed to recalc ps wake threshold on vdev %i: %d\n", in ath10k_conf_tx_uapsd()
7803 ath10k_warn(ar, "failed to recalc ps poll count on vdev %i: %d\n", in ath10k_conf_tx_uapsd()
7808 if (test_bit(WMI_SERVICE_STA_UAPSD_BASIC_AUTO_TRIG, ar->wmi.svc_map) || in ath10k_conf_tx_uapsd()
7809 test_bit(WMI_SERVICE_STA_UAPSD_VAR_AUTO_TRIG, ar->wmi.svc_map)) { in ath10k_conf_tx_uapsd()
7822 ret = ath10k_wmi_vdev_sta_uapsd(ar, arvif->vdev_id, in ath10k_conf_tx_uapsd()
7825 ath10k_warn(ar, "failed to set uapsd auto trigger %d\n", in ath10k_conf_tx_uapsd()
7840 struct ath10k *ar = hw->priv; in ath10k_conf_tx() local
7845 mutex_lock(&ar->conf_mutex); in ath10k_conf_tx()
7878 if (ar->wmi.ops->gen_vdev_wmm_conf) { in ath10k_conf_tx()
7879 ret = ath10k_wmi_vdev_wmm_conf(ar, arvif->vdev_id, in ath10k_conf_tx()
7882 ath10k_warn(ar, "failed to set vdev wmm params on vdev %i: %d\n", in ath10k_conf_tx()
7890 ret = ath10k_wmi_pdev_set_wmm_params(ar, &arvif->wmm_params); in ath10k_conf_tx()
7892 ath10k_warn(ar, "failed to set wmm params: %d\n", ret); in ath10k_conf_tx()
7897 ret = ath10k_conf_tx_uapsd(ar, vif, ac, params->uapsd); in ath10k_conf_tx()
7899 ath10k_warn(ar, "failed to set sta uapsd: %d\n", ret); in ath10k_conf_tx()
7902 mutex_unlock(&ar->conf_mutex); in ath10k_conf_tx()
7912 struct ath10k *ar = hw->priv; in ath10k_remain_on_channel() local
7918 mutex_lock(&ar->conf_mutex); in ath10k_remain_on_channel()
7925 spin_lock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7926 switch (ar->scan.state) { in ath10k_remain_on_channel()
7928 reinit_completion(&ar->scan.started); in ath10k_remain_on_channel()
7929 reinit_completion(&ar->scan.completed); in ath10k_remain_on_channel()
7930 reinit_completion(&ar->scan.on_channel); in ath10k_remain_on_channel()
7931 ar->scan.state = ATH10K_SCAN_STARTING; in ath10k_remain_on_channel()
7932 ar->scan.is_roc = true; in ath10k_remain_on_channel()
7933 ar->scan.vdev_id = arvif->vdev_id; in ath10k_remain_on_channel()
7934 ar->scan.roc_freq = chan->center_freq; in ath10k_remain_on_channel()
7935 ar->scan.roc_notify = true; in ath10k_remain_on_channel()
7944 spin_unlock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7949 scan_time_msec = ar->hw->wiphy->max_remain_on_channel_duration * 2; in ath10k_remain_on_channel()
7952 ath10k_wmi_start_scan_init(ar, &arg); in ath10k_remain_on_channel()
7964 ret = ath10k_start_scan(ar, &arg); in ath10k_remain_on_channel()
7966 ath10k_warn(ar, "failed to start roc scan: %d\n", ret); in ath10k_remain_on_channel()
7967 spin_lock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7968 ar->scan.state = ATH10K_SCAN_IDLE; in ath10k_remain_on_channel()
7969 spin_unlock_bh(&ar->data_lock); in ath10k_remain_on_channel()
7973 ret = wait_for_completion_timeout(&ar->scan.on_channel, 3 * HZ); in ath10k_remain_on_channel()
7975 ath10k_warn(ar, "failed to switch to channel for roc scan\n"); in ath10k_remain_on_channel()
7977 ret = ath10k_scan_stop(ar); in ath10k_remain_on_channel()
7979 ath10k_warn(ar, "failed to stop scan: %d\n", ret); in ath10k_remain_on_channel()
7985 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath10k_remain_on_channel()
7990 mutex_unlock(&ar->conf_mutex); in ath10k_remain_on_channel()
7997 struct ath10k *ar = hw->priv; in ath10k_cancel_remain_on_channel() local
7999 mutex_lock(&ar->conf_mutex); in ath10k_cancel_remain_on_channel()
8001 spin_lock_bh(&ar->data_lock); in ath10k_cancel_remain_on_channel()
8002 ar->scan.roc_notify = false; in ath10k_cancel_remain_on_channel()
8003 spin_unlock_bh(&ar->data_lock); in ath10k_cancel_remain_on_channel()
8005 ath10k_scan_abort(ar); in ath10k_cancel_remain_on_channel()
8007 mutex_unlock(&ar->conf_mutex); in ath10k_cancel_remain_on_channel()
8009 cancel_delayed_work_sync(&ar->scan.timeout); in ath10k_cancel_remain_on_channel()
8021 struct ath10k *ar = hw->priv; in ath10k_set_rts_threshold() local
8025 mutex_lock(&ar->conf_mutex); in ath10k_set_rts_threshold()
8026 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_set_rts_threshold()
8027 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vdev %d rts threshold %d\n", in ath10k_set_rts_threshold()
8032 ath10k_warn(ar, "failed to set rts threshold for vdev %d: %d\n", in ath10k_set_rts_threshold()
8037 mutex_unlock(&ar->conf_mutex); in ath10k_set_rts_threshold()
8057 void ath10k_mac_wait_tx_complete(struct ath10k *ar) in ath10k_mac_wait_tx_complete() argument
8066 if (ar->state == ATH10K_STATE_WEDGED) in ath10k_mac_wait_tx_complete()
8069 time_left = wait_event_timeout(ar->htt.empty_tx_wq, ({ in ath10k_mac_wait_tx_complete()
8072 spin_lock_bh(&ar->htt.tx_lock); in ath10k_mac_wait_tx_complete()
8073 empty = (ar->htt.num_pending_tx == 0); in ath10k_mac_wait_tx_complete()
8074 spin_unlock_bh(&ar->htt.tx_lock); in ath10k_mac_wait_tx_complete()
8076 skip = (ar->state == ATH10K_STATE_WEDGED) || in ath10k_mac_wait_tx_complete()
8078 &ar->dev_flags); in ath10k_mac_wait_tx_complete()
8084 ath10k_warn(ar, "failed to flush transmit queue (skip %i ar-state %i): %ld\n", in ath10k_mac_wait_tx_complete()
8085 skip, ar->state, time_left); in ath10k_mac_wait_tx_complete()
8091 struct ath10k *ar = hw->priv; in ath10k_flush() local
8098 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_flush()
8100 ath10k_wmi_peer_flush(ar, arvif->vdev_id, in ath10k_flush()
8103 ath10k_htt_flush_tx(&ar->htt); in ath10k_flush()
8108 mutex_lock(&ar->conf_mutex); in ath10k_flush()
8109 ath10k_mac_wait_tx_complete(ar); in ath10k_flush()
8110 mutex_unlock(&ar->conf_mutex); in ath10k_flush()
8125 struct ath10k *ar = hw->priv; in ath10k_reconfig_complete() local
8131 mutex_lock(&ar->conf_mutex); in ath10k_reconfig_complete()
8136 if (ar->state == ATH10K_STATE_RESTARTED) { in ath10k_reconfig_complete()
8137 ath10k_info(ar, "device successfully recovered\n"); in ath10k_reconfig_complete()
8138 ar->state = ATH10K_STATE_ON; in ath10k_reconfig_complete()
8139 ieee80211_wake_queues(ar->hw); in ath10k_reconfig_complete()
8140 clear_bit(ATH10K_FLAG_RESTARTING, &ar->dev_flags); in ath10k_reconfig_complete()
8141 if (ar->hw_params.hw_restart_disconnect) { in ath10k_reconfig_complete()
8142 list_for_each_entry(arvif, &ar->arvifs, list) { in ath10k_reconfig_complete()
8149 mutex_unlock(&ar->conf_mutex); in ath10k_reconfig_complete()
8153 ath10k_mac_update_bss_chan_survey(struct ath10k *ar, in ath10k_mac_update_bss_chan_survey() argument
8159 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_bss_chan_survey()
8161 if (!test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map) || in ath10k_mac_update_bss_chan_survey()
8162 (ar->rx_channel != channel)) in ath10k_mac_update_bss_chan_survey()
8165 if (ar->scan.state != ATH10K_SCAN_IDLE) { in ath10k_mac_update_bss_chan_survey()
8166 ath10k_dbg(ar, ATH10K_DBG_MAC, "ignoring bss chan info request while scanning..\n"); in ath10k_mac_update_bss_chan_survey()
8170 reinit_completion(&ar->bss_survey_done); in ath10k_mac_update_bss_chan_survey()
8172 ret = ath10k_wmi_pdev_bss_chan_info_request(ar, type); in ath10k_mac_update_bss_chan_survey()
8174 ath10k_warn(ar, "failed to send pdev bss chan info request\n"); in ath10k_mac_update_bss_chan_survey()
8178 ret = wait_for_completion_timeout(&ar->bss_survey_done, 3 * HZ); in ath10k_mac_update_bss_chan_survey()
8180 ath10k_warn(ar, "bss channel survey timed out\n"); in ath10k_mac_update_bss_chan_survey()
8188 struct ath10k *ar = hw->priv; in ath10k_get_survey() local
8190 struct survey_info *ar_survey = &ar->survey[idx]; in ath10k_get_survey()
8193 mutex_lock(&ar->conf_mutex); in ath10k_get_survey()
8209 ath10k_mac_update_bss_chan_survey(ar, &sband->channels[idx]); in ath10k_get_survey()
8211 spin_lock_bh(&ar->data_lock); in ath10k_get_survey()
8213 spin_unlock_bh(&ar->data_lock); in ath10k_get_survey()
8217 if (ar->rx_channel == survey->channel) in ath10k_get_survey()
8221 mutex_unlock(&ar->conf_mutex); in ath10k_get_survey()
8226 ath10k_mac_bitrate_mask_get_single_nss(struct ath10k *ar, in ath10k_mac_bitrate_mask_get_single_nss() argument
8231 struct ieee80211_supported_band *sband = &ar->mac.sbands[band]; in ath10k_mac_bitrate_mask_get_single_nss()
8277 struct ath10k *ar = arvif->ar; in ath10k_mac_set_fixed_rate_params() local
8281 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_set_fixed_rate_params()
8283 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac set fixed rate params vdev %i rate 0x%02x nss %u sgi %u\n", in ath10k_mac_set_fixed_rate_params()
8286 vdev_param = ar->wmi.vdev_param->fixed_rate; in ath10k_mac_set_fixed_rate_params()
8287 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, rate); in ath10k_mac_set_fixed_rate_params()
8289 ath10k_warn(ar, "failed to set fixed rate param 0x%02x: %d\n", in ath10k_mac_set_fixed_rate_params()
8294 vdev_param = ar->wmi.vdev_param->nss; in ath10k_mac_set_fixed_rate_params()
8295 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, nss); in ath10k_mac_set_fixed_rate_params()
8297 ath10k_warn(ar, "failed to set nss param %d: %d\n", nss, ret); in ath10k_mac_set_fixed_rate_params()
8301 vdev_param = ar->wmi.vdev_param->sgi; in ath10k_mac_set_fixed_rate_params()
8302 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, sgi); in ath10k_mac_set_fixed_rate_params()
8304 ath10k_warn(ar, "failed to set sgi param %d: %d\n", sgi, ret); in ath10k_mac_set_fixed_rate_params()
8308 vdev_param = ar->wmi.vdev_param->ldpc; in ath10k_mac_set_fixed_rate_params()
8309 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, ldpc); in ath10k_mac_set_fixed_rate_params()
8311 ath10k_warn(ar, "failed to set ldpc param %d: %d\n", ldpc, ret); in ath10k_mac_set_fixed_rate_params()
8319 ath10k_mac_can_set_bitrate_mask(struct ath10k *ar, in ath10k_mac_can_set_bitrate_mask() argument
8342 ath10k_warn(ar, "refusing bitrate mask with missing 0-7 VHT MCS rates\n"); in ath10k_mac_can_set_bitrate_mask()
8350 static bool ath10k_mac_set_vht_bitrate_mask_fixup(struct ath10k *ar, in ath10k_mac_set_vht_bitrate_mask_fixup() argument
8361 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_mac_set_vht_bitrate_mask_fixup()
8364 ath10k_warn(ar, "failed to enable STA %pM peer fixed rate: %d\n", in ath10k_mac_set_vht_bitrate_mask_fixup()
8375 struct ath10k *ar = arvif->ar; in ath10k_mac_set_bitrate_mask_iter() local
8380 if (ath10k_mac_set_vht_bitrate_mask_fixup(ar, arvif, sta)) in ath10k_mac_set_bitrate_mask_iter()
8383 spin_lock_bh(&ar->data_lock); in ath10k_mac_set_bitrate_mask_iter()
8385 spin_unlock_bh(&ar->data_lock); in ath10k_mac_set_bitrate_mask_iter()
8387 ieee80211_queue_work(ar->hw, &arsta->update_wk); in ath10k_mac_set_bitrate_mask_iter()
8395 struct ath10k *ar = arvif->ar; in ath10k_mac_clr_bitrate_mask_iter() local
8402 err = ath10k_wmi_peer_set_param(ar, arvif->vdev_id, sta->addr, in ath10k_mac_clr_bitrate_mask_iter()
8406 ath10k_warn(ar, "failed to clear STA %pM peer fixed rate: %d\n", in ath10k_mac_clr_bitrate_mask_iter()
8416 struct ath10k *ar = arvif->ar; in ath10k_mac_op_set_bitrate_mask() local
8436 ldpc = !!(ar->ht_cap_info & WMI_HT_CAP_LDPC); in ath10k_mac_op_set_bitrate_mask()
8443 ar->normal_mode_fw.fw_file.fw_features); in ath10k_mac_op_set_bitrate_mask()
8445 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8446 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_mac_op_set_bitrate_mask()
8449 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8452 if (ath10k_mac_bitrate_mask_has_single_rate(ar, band, mask, in ath10k_mac_op_set_bitrate_mask()
8454 ret = ath10k_mac_bitrate_mask_get_single_rate(ar, band, mask, in ath10k_mac_op_set_bitrate_mask()
8458 ath10k_warn(ar, "failed to get single rate for vdev %i: %d\n", in ath10k_mac_op_set_bitrate_mask()
8462 } else if (ath10k_mac_bitrate_mask_get_single_nss(ar, band, mask, in ath10k_mac_op_set_bitrate_mask()
8468 nss = min(ar->num_rf_chains, in ath10k_mac_op_set_bitrate_mask()
8475 if (!ath10k_mac_can_set_bitrate_mask(ar, band, mask, in ath10k_mac_op_set_bitrate_mask()
8486 ath10k_mac_bitrate_mask_get_single_rate(ar, band, mask, in ath10k_mac_op_set_bitrate_mask()
8497 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8503 ieee80211_iterate_stations_atomic(ar->hw, in ath10k_mac_op_set_bitrate_mask()
8507 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8510 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8514 ath10k_warn(ar, "failed to set fixed rate params on vdev %i: %d\n", in ath10k_mac_op_set_bitrate_mask()
8520 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_bitrate_mask()
8530 struct ath10k *ar = hw->priv; in ath10k_sta_rc_update() local
8536 spin_lock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8538 peer = ath10k_peer_find(ar, arvif->vdev_id, sta->addr); in ath10k_sta_rc_update()
8540 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8541 ath10k_warn(ar, "mac sta rc update failed to find peer %pM on vdev %i\n", in ath10k_sta_rc_update()
8546 ath10k_dbg(ar, ATH10K_DBG_STA, in ath10k_sta_rc_update()
8569 ath10k_warn(ar, "Invalid bandwidth %d in rc update for %pM\n", in ath10k_sta_rc_update()
8596 ath10k_warn(ar, "Invalid smps %d in sta rc update for %pM\n", in ath10k_sta_rc_update()
8607 spin_unlock_bh(&ar->data_lock); in ath10k_sta_rc_update()
8615 struct ath10k *ar = hw->priv; in ath10k_offset_tsf() local
8621 vdev_param = ar->wmi.vdev_param->dec_tsf; in ath10k_offset_tsf()
8624 vdev_param = ar->wmi.vdev_param->inc_tsf; in ath10k_offset_tsf()
8628 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, in ath10k_offset_tsf()
8632 ath10k_warn(ar, "failed to set tsf offset %d cmd %d: %d\n", in ath10k_offset_tsf()
8640 struct ath10k *ar = hw->priv; in ath10k_ampdu_action() local
8646 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac ampdu vdev_id %i sta %pM tid %u action %d\n", in ath10k_ampdu_action()
8674 ath10k_mac_update_rx_channel(struct ath10k *ar, in ath10k_mac_update_rx_channel() argument
8684 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_rx_channel()
8685 lockdep_assert_held(&ar->data_lock); in ath10k_mac_update_rx_channel()
8701 if (!ctx && ath10k_mac_num_chanctxs(ar) == 1) { in ath10k_mac_update_rx_channel()
8702 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath10k_mac_update_rx_channel()
8709 ar->rx_channel = def->chan; in ath10k_mac_update_rx_channel()
8710 } else if ((ctx && ath10k_mac_num_chanctxs(ar) == 0) || in ath10k_mac_update_rx_channel()
8711 (ctx && (ar->state == ATH10K_STATE_RESTARTED))) { in ath10k_mac_update_rx_channel()
8717 ar->rx_channel = ctx->def.chan; in ath10k_mac_update_rx_channel()
8719 ar->rx_channel = NULL; in ath10k_mac_update_rx_channel()
8725 ath10k_mac_update_vif_chan(struct ath10k *ar, in ath10k_mac_update_vif_chan() argument
8733 lockdep_assert_held(&ar->conf_mutex); in ath10k_mac_update_vif_chan()
8738 if (ar->monitor_started) in ath10k_mac_update_vif_chan()
8739 ath10k_monitor_stop(ar); in ath10k_mac_update_vif_chan()
8744 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_mac_update_vif_chan()
8758 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_update_vif_chan()
8760 ath10k_warn(ar, "failed to down vdev %d: %d\n", in ath10k_mac_update_vif_chan()
8770 spin_lock_bh(&ar->data_lock); in ath10k_mac_update_vif_chan()
8771 ath10k_mac_update_rx_channel(ar, NULL, vifs, n_vifs); in ath10k_mac_update_vif_chan()
8772 spin_unlock_bh(&ar->data_lock); in ath10k_mac_update_vif_chan()
8785 ath10k_warn(ar, "failed to update bcn tmpl during csa: %d\n", in ath10k_mac_update_vif_chan()
8790 ath10k_warn(ar, "failed to update prb tmpl during csa: %d\n", in ath10k_mac_update_vif_chan()
8795 ath10k_warn(ar, "failed to restart vdev %d: %d\n", in ath10k_mac_update_vif_chan()
8800 ret = ath10k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath10k_mac_update_vif_chan()
8803 ath10k_warn(ar, "failed to bring vdev up %d: %d\n", in ath10k_mac_update_vif_chan()
8809 ath10k_monitor_recalc(ar); in ath10k_mac_update_vif_chan()
8816 struct ath10k *ar = hw->priv; in ath10k_mac_op_add_chanctx() local
8818 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_mac_op_add_chanctx()
8822 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_add_chanctx()
8824 spin_lock_bh(&ar->data_lock); in ath10k_mac_op_add_chanctx()
8825 ath10k_mac_update_rx_channel(ar, ctx, NULL, 0); in ath10k_mac_op_add_chanctx()
8826 spin_unlock_bh(&ar->data_lock); in ath10k_mac_op_add_chanctx()
8828 ath10k_recalc_radar_detection(ar); in ath10k_mac_op_add_chanctx()
8829 ath10k_monitor_recalc(ar); in ath10k_mac_op_add_chanctx()
8831 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_add_chanctx()
8840 struct ath10k *ar = hw->priv; in ath10k_mac_op_remove_chanctx() local
8842 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_mac_op_remove_chanctx()
8846 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_remove_chanctx()
8848 spin_lock_bh(&ar->data_lock); in ath10k_mac_op_remove_chanctx()
8849 ath10k_mac_update_rx_channel(ar, NULL, NULL, 0); in ath10k_mac_op_remove_chanctx()
8850 spin_unlock_bh(&ar->data_lock); in ath10k_mac_op_remove_chanctx()
8852 ath10k_recalc_radar_detection(ar); in ath10k_mac_op_remove_chanctx()
8853 ath10k_monitor_recalc(ar); in ath10k_mac_op_remove_chanctx()
8855 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_remove_chanctx()
8902 struct ath10k *ar = hw->priv; in ath10k_mac_op_change_chanctx() local
8905 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_change_chanctx()
8907 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_mac_op_change_chanctx()
8936 ath10k_mac_update_vif_chan(ar, arg.vifs, arg.n_vifs); in ath10k_mac_op_change_chanctx()
8941 ath10k_recalc_radar_detection(ar); in ath10k_mac_op_change_chanctx()
8951 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_change_chanctx()
8960 struct ath10k *ar = hw->priv; in ath10k_mac_op_assign_vif_chanctx() local
8964 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8966 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_mac_op_assign_vif_chanctx()
8971 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
8977 ath10k_warn(ar, "failed to start vdev %i addr %pM on freq %d: %d\n", in ath10k_mac_op_assign_vif_chanctx()
8987 ath10k_warn(ar, "failed to update vdev %i ps: %d\n", in ath10k_mac_op_assign_vif_chanctx()
8993 ret = ath10k_wmi_vdev_up(ar, arvif->vdev_id, 0, vif->addr); in ath10k_mac_op_assign_vif_chanctx()
8995 ath10k_warn(ar, "failed to up monitor vdev %i: %d\n", in ath10k_mac_op_assign_vif_chanctx()
9006 ath10k_warn(ar, "failed to set cts protection for vdev %d: %d\n", in ath10k_mac_op_assign_vif_chanctx()
9010 if (ath10k_peer_stats_enabled(ar) && in ath10k_mac_op_assign_vif_chanctx()
9011 ar->hw_params.tx_stats_over_pktlog) { in ath10k_mac_op_assign_vif_chanctx()
9012 ar->pktlog_filter |= ATH10K_PKTLOG_PEER_STATS; in ath10k_mac_op_assign_vif_chanctx()
9013 ret = ath10k_wmi_pdev_pktlog_enable(ar, in ath10k_mac_op_assign_vif_chanctx()
9014 ar->pktlog_filter); in ath10k_mac_op_assign_vif_chanctx()
9016 ath10k_warn(ar, "failed to enable pktlog %d\n", ret); in ath10k_mac_op_assign_vif_chanctx()
9021 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
9030 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_assign_vif_chanctx()
9040 struct ath10k *ar = hw->priv; in ath10k_mac_op_unassign_vif_chanctx() local
9044 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_unassign_vif_chanctx()
9046 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_mac_op_unassign_vif_chanctx()
9055 ret = ath10k_wmi_vdev_down(ar, arvif->vdev_id); in ath10k_mac_op_unassign_vif_chanctx()
9057 ath10k_warn(ar, "failed to down monitor vdev %i: %d\n", in ath10k_mac_op_unassign_vif_chanctx()
9065 ath10k_warn(ar, "failed to stop vdev %i: %d\n", in ath10k_mac_op_unassign_vif_chanctx()
9070 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_unassign_vif_chanctx()
9079 struct ath10k *ar = hw->priv; in ath10k_mac_op_switch_vif_chanctx() local
9081 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_switch_vif_chanctx()
9083 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_mac_op_switch_vif_chanctx()
9086 ath10k_mac_update_vif_chan(ar, vifs, n_vifs); in ath10k_mac_op_switch_vif_chanctx()
9088 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_switch_vif_chanctx()
9096 struct ath10k *ar; in ath10k_mac_op_sta_pre_rcu_remove() local
9099 ar = hw->priv; in ath10k_mac_op_sta_pre_rcu_remove()
9101 list_for_each_entry(peer, &ar->peers, list) in ath10k_mac_op_sta_pre_rcu_remove()
9162 static void ath10k_mac_get_rate_flags_ht(struct ath10k *ar, u32 rate, u8 nss, u8 mcs, in ath10k_mac_get_rate_flags_ht() argument
9175 ath10k_warn(ar, "not supported mcs %d in current rate table", mcs); in ath10k_mac_get_rate_flags_ht()
9203 ath10k_warn(ar, "invalid ht params rate %d 100kbps nss %d mcs %d", in ath10k_mac_get_rate_flags_ht()
9208 static void ath10k_mac_get_rate_flags_vht(struct ath10k *ar, u32 rate, u8 nss, u8 mcs, in ath10k_mac_get_rate_flags_vht() argument
9239 ath10k_warn(ar, "invalid vht params rate %d 100kbps nss %d mcs %d", in ath10k_mac_get_rate_flags_vht()
9244 static void ath10k_mac_get_rate_flags(struct ath10k *ar, u32 rate, in ath10k_mac_get_rate_flags() argument
9250 ath10k_mac_get_rate_flags_ht(ar, rate, nss, mcs, flags, bw); in ath10k_mac_get_rate_flags()
9253 ath10k_mac_get_rate_flags_vht(ar, rate, nss, mcs, flags, bw); in ath10k_mac_get_rate_flags()
9257 static void ath10k_mac_parse_bitrate(struct ath10k *ar, u32 rate_code, in ath10k_mac_parse_bitrate() argument
9266 ath10k_dbg(ar, ATH10K_DBG_MAC, "mac parse rate code 0x%x bitrate %d kbps\n", in ath10k_mac_parse_bitrate()
9274 ath10k_mac_get_rate_flags(ar, bitrate_kbps / 100, mode, nss, mcs, &flags, &bw); in ath10k_mac_parse_bitrate()
9276 ath10k_dbg(ar, ATH10K_DBG_MAC, in ath10k_mac_parse_bitrate()
9287 static void ath10k_mac_sta_get_peer_stats_info(struct ath10k *ar, in ath10k_mac_sta_get_peer_stats_info() argument
9296 if (!(ar->hw_params.supports_peer_stats_info && in ath10k_mac_sta_get_peer_stats_info()
9300 spin_lock_bh(&ar->data_lock); in ath10k_mac_sta_get_peer_stats_info()
9301 peer = ath10k_peer_find(ar, arsta->arvif->vdev_id, sta->addr); in ath10k_mac_sta_get_peer_stats_info()
9302 spin_unlock_bh(&ar->data_lock); in ath10k_mac_sta_get_peer_stats_info()
9306 reinit_completion(&ar->peer_stats_info_complete); in ath10k_mac_sta_get_peer_stats_info()
9308 ret = ath10k_wmi_request_peer_stats_info(ar, in ath10k_mac_sta_get_peer_stats_info()
9314 ath10k_warn(ar, "could not request peer stats info: %d\n", ret); in ath10k_mac_sta_get_peer_stats_info()
9318 time_left = wait_for_completion_timeout(&ar->peer_stats_info_complete, 3 * HZ); in ath10k_mac_sta_get_peer_stats_info()
9320 ath10k_warn(ar, "timed out waiting peer stats info\n"); in ath10k_mac_sta_get_peer_stats_info()
9325 ath10k_mac_parse_bitrate(ar, arsta->rx_rate_code, in ath10k_mac_sta_get_peer_stats_info()
9335 ath10k_mac_parse_bitrate(ar, arsta->tx_rate_code, in ath10k_mac_sta_get_peer_stats_info()
9351 struct ath10k *ar = arsta->arvif->ar; in ath10k_sta_statistics() local
9353 if (!ath10k_peer_stats_enabled(ar)) in ath10k_sta_statistics()
9356 mutex_lock(&ar->conf_mutex); in ath10k_sta_statistics()
9357 ath10k_debug_fw_stats_request(ar); in ath10k_sta_statistics()
9358 mutex_unlock(&ar->conf_mutex); in ath10k_sta_statistics()
9375 if (ar->htt.disable_tx_comp) { in ath10k_sta_statistics()
9383 ath10k_mac_sta_get_peer_stats_info(ar, sta, sinfo); in ath10k_sta_statistics()
9391 struct ath10k *ar = hw->priv; in ath10k_mac_op_set_tid_config() local
9397 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_set_tid_config()
9404 ret = ath10k_mac_parse_tid_config(ar, sta, vif, in ath10k_mac_op_set_tid_config()
9418 data.ar = ar; in ath10k_mac_op_set_tid_config()
9424 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_set_tid_config()
9435 struct ath10k *ar = hw->priv; in ath10k_mac_op_reset_tid_config() local
9438 mutex_lock(&ar->conf_mutex); in ath10k_mac_op_reset_tid_config()
9442 ret = ath10k_mac_reset_tid_config(ar, sta, arvif, tids); in ath10k_mac_op_reset_tid_config()
9448 data.ar = ar; in ath10k_mac_op_reset_tid_config()
9453 mutex_unlock(&ar->conf_mutex); in ath10k_mac_op_reset_tid_config()
9588 struct ath10k *ar; in ath10k_mac_create() local
9600 ar = hw->priv; in ath10k_mac_create()
9601 ar->hw = hw; in ath10k_mac_create()
9602 ar->ops = ops; in ath10k_mac_create()
9604 return ar; in ath10k_mac_create()
9607 void ath10k_mac_destroy(struct ath10k *ar) in ath10k_mac_destroy() argument
9609 struct ieee80211_ops *ops = ar->ops; in ath10k_mac_destroy()
9611 ieee80211_free_hw(ar->hw); in ath10k_mac_destroy()
9835 struct ath10k_vif *ath10k_get_arvif(struct ath10k *ar, u32 vdev_id) in ath10k_get_arvif() argument
9842 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath10k_get_arvif()
9847 ath10k_warn(ar, "No VIF found for vdev %d\n", vdev_id); in ath10k_get_arvif()
9857 static u32 ath10k_mac_wrdd_get_mcc(struct ath10k *ar, union acpi_object *wrdd) argument
9875 ath10k_warn(ar, "ignoring malformed/unsupported wrdd structure\n");
9920 static int ath10k_mac_get_wrdd_regulatory(struct ath10k *ar, u16 *rd) argument
9929 root_handle = ACPI_HANDLE(ar->dev);
9935 ath10k_dbg(ar, ATH10K_DBG_BOOT,
9942 ath10k_dbg(ar, ATH10K_DBG_BOOT,
9948 alpha2_code = ath10k_mac_wrdd_get_mcc(ar, wrdd.pointer);
9951 alpha2_code = ath10k_mac_wrdd_get_mcc(ar, wrdd.Pointer);
9961 ath10k_dbg(ar, ATH10K_DBG_BOOT,
9972 static int ath10k_mac_init_rd(struct ath10k *ar) argument
9977 ret = ath10k_mac_get_wrdd_regulatory(ar, &rd);
9979 ath10k_dbg(ar, ATH10K_DBG_BOOT,
9981 rd = ar->hw_eeprom_rd;
9984 ar->ath_common.regulatory.current_rd = rd;
9988 int ath10k_mac_register(struct ath10k *ar) argument
10016 if (!is_valid_ether_addr(ar->mac_addr)) {
10017 ath10k_warn(ar, "invalid MAC address; choosing random\n");
10018 eth_random_addr(ar->mac_addr);
10020 SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr);
10022 SET_IEEE80211_DEV(ar->hw, ar->dev);
10028 if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) {
10037 band = &ar->mac.sbands[NL80211_BAND_2GHZ];
10041 if (ar->hw_params.cck_rate_map_rev2) {
10049 ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = band;
10052 if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
10061 band = &ar->mac.sbands[NL80211_BAND_5GHZ];
10066 ar->hw->wiphy->bands[NL80211_BAND_5GHZ] = band;
10069 wiphy_read_of_freq_limits(ar->hw->wiphy);
10070 ath10k_mac_setup_ht_vht_cap(ar);
10072 ar->hw->wiphy->interface_modes =
10077 ar->hw->wiphy->available_antennas_rx = ar->cfg_rx_chainmask;
10078 ar->hw->wiphy->available_antennas_tx = ar->cfg_tx_chainmask;
10080 if (!test_bit(ATH10K_FW_FEATURE_NO_P2P, ar->normal_mode_fw.fw_file.fw_features))
10081 ar->hw->wiphy->interface_modes |=
10086 ieee80211_hw_set(ar->hw, SIGNAL_DBM);
10089 ar->running_fw->fw_file.fw_features)) {
10090 ieee80211_hw_set(ar->hw, SUPPORTS_PS);
10091 ieee80211_hw_set(ar->hw, SUPPORTS_DYNAMIC_PS);
10094 ieee80211_hw_set(ar->hw, MFP_CAPABLE);
10095 ieee80211_hw_set(ar->hw, REPORTS_TX_ACK_STATUS);
10096 ieee80211_hw_set(ar->hw, HAS_RATE_CONTROL);
10097 ieee80211_hw_set(ar->hw, AP_LINK_PS);
10098 ieee80211_hw_set(ar->hw, SPECTRUM_MGMT);
10099 ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT);
10100 ieee80211_hw_set(ar->hw, CONNECTION_MONITOR);
10101 ieee80211_hw_set(ar->hw, SUPPORTS_PER_STA_GTK);
10102 ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF);
10103 ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA);
10104 ieee80211_hw_set(ar->hw, QUEUE_CONTROL);
10105 ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG);
10106 ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK);
10108 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags))
10109 ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL);
10111 ar->hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS;
10112 ar->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
10114 if (ar->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS)
10115 ar->hw->wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS;
10117 if (ar->ht_cap_info & WMI_HT_CAP_ENABLED) {
10118 ieee80211_hw_set(ar->hw, AMPDU_AGGREGATION);
10119 ieee80211_hw_set(ar->hw, TX_AMPDU_SETUP_IN_HW);
10122 ar->hw->wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID;
10123 ar->hw->wiphy->max_scan_ie_len = WLAN_SCAN_PARAMS_MAX_IE_LEN;
10125 if (test_bit(WMI_SERVICE_NLO, ar->wmi.svc_map)) {
10126 ar->hw->wiphy->max_sched_scan_ssids = WMI_PNO_MAX_SUPP_NETWORKS;
10127 ar->hw->wiphy->max_match_sets = WMI_PNO_MAX_SUPP_NETWORKS;
10128 ar->hw->wiphy->max_sched_scan_ie_len = WMI_PNO_MAX_IE_LENGTH;
10129 ar->hw->wiphy->max_sched_scan_plans = WMI_PNO_MAX_SCHED_SCAN_PLANS;
10130 ar->hw->wiphy->max_sched_scan_plan_interval =
10132 ar->hw->wiphy->max_sched_scan_plan_iterations =
10134 ar->hw->wiphy->features |= NL80211_FEATURE_ND_RANDOM_MAC_ADDR;
10137 ar->hw->vif_data_size = sizeof(struct ath10k_vif);
10138 ar->hw->sta_data_size = sizeof(struct ath10k_sta);
10139 ar->hw->txq_data_size = sizeof(struct ath10k_txq);
10141 ar->hw->max_listen_interval = ATH10K_MAX_HW_LISTEN_INTERVAL;
10143 if (test_bit(WMI_SERVICE_BEACON_OFFLOAD, ar->wmi.svc_map)) {
10144 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD;
10150 ar->hw->wiphy->probe_resp_offload |=
10156 if (test_bit(WMI_SERVICE_TDLS, ar->wmi.svc_map) ||
10157 test_bit(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY, ar->wmi.svc_map)) {
10158 ar->hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS;
10159 if (test_bit(WMI_SERVICE_TDLS_WIDER_BANDWIDTH, ar->wmi.svc_map))
10160 ieee80211_hw_set(ar->hw, TDLS_WIDER_BW);
10163 if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map))
10164 ieee80211_hw_set(ar->hw, SUPPORTS_TDLS_BUFFER_STA);
10167 if (ar->wmi.vdev_param->tx_encap_type !=
10169 ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD);
10172 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
10173 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
10174 ar->hw->wiphy->max_remain_on_channel_duration = 5000;
10176 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD;
10177 ar->hw->wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE |
10180 ar->hw->wiphy->max_ap_assoc_sta = ar->max_num_stations;
10182 ret = ath10k_wow_init(ar);
10184 ath10k_warn(ar, "failed to init wow: %d\n", ret);
10188 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
10189 wiphy_ext_feature_set(ar->hw->wiphy,
10191 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL);
10193 if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map) ||
10194 test_bit(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ar->wmi.svc_map))
10195 wiphy_ext_feature_set(ar->hw->wiphy,
10198 if (ath10k_peer_stats_enabled(ar) ||
10199 test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map))
10200 wiphy_ext_feature_set(ar->hw->wiphy,
10203 if (test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map))
10204 wiphy_ext_feature_set(ar->hw->wiphy,
10207 if (test_bit(WMI_SERVICE_TX_PWR_PER_PEER, ar->wmi.svc_map))
10208 wiphy_ext_feature_set(ar->hw->wiphy,
10211 if (test_bit(WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT, ar->wmi.svc_map)) {
10212 ar->hw->wiphy->tid_config_support.vif |=
10221 ar->wmi.svc_map)) {
10222 ar->hw->wiphy->tid_config_support.vif |=
10226 ar->hw->wiphy->tid_config_support.peer =
10227 ar->hw->wiphy->tid_config_support.vif;
10228 ar->hw->wiphy->max_data_retry_count = ATH10K_MAX_RETRY_COUNT;
10230 ar->ops->set_tid_config = NULL;
10236 ar->hw->queues = IEEE80211_MAX_QUEUES;
10242 ar->hw->offchannel_tx_hw_queue = IEEE80211_MAX_QUEUES - 1;
10244 switch (ar->running_fw->fw_file.wmi_op_version) {
10246 ar->hw->wiphy->iface_combinations = ath10k_if_comb;
10247 ar->hw->wiphy->n_iface_combinations =
10249 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
10252 if (test_bit(WMI_SERVICE_ADAPTIVE_OCS, ar->wmi.svc_map)) {
10253 ar->hw->wiphy->iface_combinations =
10255 ar->hw->wiphy->n_iface_combinations =
10258 ar->hw->wiphy->iface_combinations = ath10k_tlv_if_comb;
10259 ar->hw->wiphy->n_iface_combinations =
10262 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
10267 ar->hw->wiphy->iface_combinations = ath10k_10x_if_comb;
10268 ar->hw->wiphy->n_iface_combinations =
10272 ar->hw->wiphy->iface_combinations = ath10k_10_4_if_comb;
10273 ar->hw->wiphy->n_iface_combinations =
10276 ar->wmi.svc_map)) {
10277 ar->hw->wiphy->iface_combinations =
10279 ar->hw->wiphy->n_iface_combinations =
10290 if (ar->hw_params.dynamic_sar_support)
10291 ar->hw->wiphy->sar_capa = &ath10k_sar_capa;
10293 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags))
10294 ar->hw->netdev_features = NETIF_F_HW_CSUM;
10298 ar->ath_common.debug_mask = ATH_DBG_DFS;
10299 ar->dfs_detector = dfs_pattern_detector_init(&ar->ath_common,
10302 if (!ar->dfs_detector)
10303 ath10k_warn(ar, "failed to initialise DFS pattern detector\n");
10306 ret = ath10k_mac_init_rd(ar);
10308 ath10k_err(ar, "failed to derive regdom: %d\n", ret);
10313 if (!ar->hw_params.hw_ops->set_coverage_class)
10314 ar->ops->set_coverage_class = NULL;
10316 ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy,
10319 ath10k_err(ar, "failed to initialise regulatory: %i\n", ret);
10323 if (test_bit(WMI_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi.svc_map)) {
10324 ar->hw->wiphy->features |=
10328 ar->hw->wiphy->cipher_suites = cipher_suites;
10334 if (!ar->hw_params.n_cipher_suites ||
10335 ar->hw_params.n_cipher_suites > ARRAY_SIZE(cipher_suites)) {
10336 ath10k_err(ar, "invalid hw_params.n_cipher_suites %d\n",
10337 ar->hw_params.n_cipher_suites);
10338 ar->hw_params.n_cipher_suites = 8;
10340 ar->hw->wiphy->n_cipher_suites = ar->hw_params.n_cipher_suites;
10342 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
10344 ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER;
10346 ret = ieee80211_register_hw(ar->hw);
10348 ath10k_err(ar, "failed to register ieee80211: %d\n", ret);
10352 if (test_bit(WMI_SERVICE_PER_PACKET_SW_ENCRYPT, ar->wmi.svc_map)) {
10353 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
10354 ar->hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN);
10357 if (!ath_is_world_regd(&ar->ath_common.reg_world_copy) &&
10358 !ath_is_world_regd(&ar->ath_common.regulatory)) {
10359 ret = regulatory_hint(ar->hw->wiphy,
10360 ar->ath_common.regulatory.alpha2);
10368 ieee80211_unregister_hw(ar->hw);
10371 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector)
10372 ar->dfs_detector->exit(ar->dfs_detector);
10375 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
10376 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels);
10378 SET_IEEE80211_DEV(ar->hw, NULL);
10382 void ath10k_mac_unregister(struct ath10k *ar) argument
10384 ieee80211_unregister_hw(ar->hw);
10386 if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector)
10387 ar->dfs_detector->exit(ar->dfs_detector);
10389 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
10390 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels);
10392 SET_IEEE80211_DEV(ar->hw, NULL);