Lines Matching +full:assoc +full:- +full:select
1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
164 /* new addition in IEEE Std 802.11ax-2021 */
244 #define ath11k_a_rates_size (ARRAY_SIZE(ath11k_legacy_rates) - 4)
405 return -EINVAL; in ath11k_mac_hw_ratecode_to_legacy_rate()
426 for (i = 0; i < sband->n_bitrates; i++) in ath11k_mac_bitrate_to_idx()
427 if (sband->bitrates[i].bitrate == bitrate) in ath11k_mac_bitrate_to_idx()
438 for (nss = IEEE80211_HT_MCS_MASK_LEN - 1; nss >= 0; nss--) in ath11k_mac_max_ht_nss()
450 for (nss = NL80211_VHT_NSS_MAX - 1; nss >= 0; nss--) in ath11k_mac_max_vht_nss()
462 for (nss = NL80211_HE_NSS_MAX - 1; nss >= 0; nss--) in ath11k_mac_max_he_nss()
510 conf = rcu_dereference(vif->bss_conf.chanctx_conf); in ath11k_mac_vif_chan()
513 return -ENOENT; in ath11k_mac_vif_chan()
516 *def = conf->def; in ath11k_mac_vif_chan()
541 for (i = 0; i < sband->n_bitrates; i++) { in ath11k_mac_hw_rate_to_idx()
542 rate = &sband->bitrates[i]; in ath11k_mac_hw_rate_to_idx()
544 if (ath11k_mac_bitrate_is_cck(rate->bitrate) != cck) in ath11k_mac_hw_rate_to_idx()
547 if (rate->hw_value == hw_rate) in ath11k_mac_hw_rate_to_idx()
549 else if (rate->flags & IEEE80211_RATE_SHORT_PREAMBLE && in ath11k_mac_hw_rate_to_idx()
550 rate->hw_value_short == hw_rate) in ath11k_mac_hw_rate_to_idx()
569 if (arvif->vdev_id == arvif_iter->vdev_id) in ath11k_get_arvif_iter()
570 arvif_iter->arvif = arvif; in ath11k_get_arvif_iter()
582 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_get_arvif()
587 ath11k_warn(ar->ab, "No VIF found for vdev %d\n", vdev_id); in ath11k_mac_get_arvif()
601 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_get_arvif_by_vdev_id()
602 pdev = rcu_dereference(ab->pdevs_active[i]); in ath11k_mac_get_arvif_by_vdev_id()
603 if (pdev && pdev->ar && in ath11k_mac_get_arvif_by_vdev_id()
604 (pdev->ar->allocated_vdev_map & (1LL << vdev_id))) { in ath11k_mac_get_arvif_by_vdev_id()
605 arvif = ath11k_mac_get_arvif(pdev->ar, vdev_id); in ath11k_mac_get_arvif_by_vdev_id()
619 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_get_ar_by_vdev_id()
620 pdev = rcu_dereference(ab->pdevs_active[i]); in ath11k_mac_get_ar_by_vdev_id()
621 if (pdev && pdev->ar) { in ath11k_mac_get_ar_by_vdev_id()
622 if (pdev->ar->allocated_vdev_map & (1LL << vdev_id)) in ath11k_mac_get_ar_by_vdev_id()
623 return pdev->ar; in ath11k_mac_get_ar_by_vdev_id()
635 if (ab->hw_params.single_pdev_only) { in ath11k_mac_get_ar_by_pdev_id()
636 pdev = rcu_dereference(ab->pdevs_active[0]); in ath11k_mac_get_ar_by_pdev_id()
637 return pdev ? pdev->ar : NULL; in ath11k_mac_get_ar_by_pdev_id()
640 if (WARN_ON(pdev_id > ab->num_radios)) in ath11k_mac_get_ar_by_pdev_id()
643 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_get_ar_by_pdev_id()
644 if (ab->fw_mode == ATH11K_FIRMWARE_MODE_FTM) in ath11k_mac_get_ar_by_pdev_id()
645 pdev = &ab->pdevs[i]; in ath11k_mac_get_ar_by_pdev_id()
647 pdev = rcu_dereference(ab->pdevs_active[i]); in ath11k_mac_get_ar_by_pdev_id()
649 if (pdev && pdev->pdev_id == pdev_id) in ath11k_mac_get_ar_by_pdev_id()
650 return (pdev->ar ? pdev->ar : NULL); in ath11k_mac_get_ar_by_pdev_id()
663 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_get_vif_up()
664 pdev = &ab->pdevs[i]; in ath11k_mac_get_vif_up()
665 ar = pdev->ar; in ath11k_mac_get_vif_up()
666 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_mac_get_vif_up()
667 if (arvif->is_up) in ath11k_mac_get_vif_up()
684 struct ath11k *ar = arvif->ar; in ath11k_mac_get_target_pdev_id_from_vif()
685 struct ath11k_base *ab = ar->ab; in ath11k_mac_get_target_pdev_id_from_vif()
686 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_get_target_pdev_id_from_vif()
689 u8 pdev_id = ab->target_pdev_ids[0].pdev_id; in ath11k_mac_get_target_pdev_id_from_vif()
695 band = def.chan->band; in ath11k_mac_get_target_pdev_id_from_vif()
697 for (i = 0; i < ab->target_pdev_count; i++) { in ath11k_mac_get_target_pdev_id_from_vif()
698 if (ath11k_mac_band_match(band, ab->target_pdev_ids[i].supported_bands)) in ath11k_mac_get_target_pdev_id_from_vif()
699 return ab->target_pdev_ids[i].pdev_id; in ath11k_mac_get_target_pdev_id_from_vif()
709 arvif = ath11k_mac_get_vif_up(ar->ab); in ath11k_mac_get_target_pdev_id()
714 return ar->ab->target_pdev_ids[0].pdev_id; in ath11k_mac_get_target_pdev_id()
719 struct ath11k_base *ab = ar->ab; in ath11k_pdev_caps_update()
721 ar->max_tx_power = ab->target_caps.hw_max_tx_power; in ath11k_pdev_caps_update()
723 /* FIXME Set min_tx_power to ab->target_caps.hw_min_tx_power. in ath11k_pdev_caps_update()
725 * we can set ar->min_tx_power to 0 currently until in ath11k_pdev_caps_update()
728 ar->min_tx_power = 0; in ath11k_pdev_caps_update()
730 ar->txpower_limit_2g = ar->max_tx_power; in ath11k_pdev_caps_update()
731 ar->txpower_limit_5g = ar->max_tx_power; in ath11k_pdev_caps_update()
732 ar->txpower_scale = WMI_HOST_TP_SCALE_MAX; in ath11k_pdev_caps_update()
737 struct ath11k_pdev *pdev = ar->pdev; in ath11k_mac_txpower_recalc()
739 int ret, txpower = -1; in ath11k_mac_txpower_recalc()
742 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_txpower_recalc()
744 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_mac_txpower_recalc()
745 if (arvif->txpower <= 0) in ath11k_mac_txpower_recalc()
748 if (txpower == -1) in ath11k_mac_txpower_recalc()
749 txpower = arvif->txpower; in ath11k_mac_txpower_recalc()
751 txpower = min(txpower, arvif->txpower); in ath11k_mac_txpower_recalc()
754 if (txpower == -1) in ath11k_mac_txpower_recalc()
758 txpower = min_t(u32, max_t(u32, ar->min_tx_power, txpower), in ath11k_mac_txpower_recalc()
759 ar->max_tx_power) * 2; in ath11k_mac_txpower_recalc()
761 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "txpower to set in hw %d\n", in ath11k_mac_txpower_recalc()
764 if ((pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) && in ath11k_mac_txpower_recalc()
765 ar->txpower_limit_2g != txpower) { in ath11k_mac_txpower_recalc()
768 txpower, ar->pdev->pdev_id); in ath11k_mac_txpower_recalc()
771 ar->txpower_limit_2g = txpower; in ath11k_mac_txpower_recalc()
774 if ((pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) && in ath11k_mac_txpower_recalc()
775 ar->txpower_limit_5g != txpower) { in ath11k_mac_txpower_recalc()
778 txpower, ar->pdev->pdev_id); in ath11k_mac_txpower_recalc()
781 ar->txpower_limit_5g = txpower; in ath11k_mac_txpower_recalc()
787 ath11k_warn(ar->ab, "failed to recalc txpower limit %d using pdev param %d: %d\n", in ath11k_mac_txpower_recalc()
794 struct ath11k *ar = arvif->ar; in ath11k_recalc_rtscts_prot()
798 lockdep_assert_held(&ar->conf_mutex); in ath11k_recalc_rtscts_prot()
808 if (arvif->num_legacy_stations > 0) in ath11k_recalc_rtscts_prot()
814 if (arvif->rtscts_prot_mode == rts_cts) in ath11k_recalc_rtscts_prot()
817 arvif->rtscts_prot_mode = rts_cts; in ath11k_recalc_rtscts_prot()
819 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %d recalc rts/cts prot %d\n", in ath11k_recalc_rtscts_prot()
820 arvif->vdev_id, rts_cts); in ath11k_recalc_rtscts_prot()
822 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_recalc_rtscts_prot()
825 ath11k_warn(ar->ab, "failed to recalculate rts/cts prot for vdev %d: %d\n", in ath11k_recalc_rtscts_prot()
826 arvif->vdev_id, ret); in ath11k_recalc_rtscts_prot()
833 struct ath11k *ar = arvif->ar; in ath11k_mac_set_kickout()
839 ar->pdev->pdev_id); in ath11k_mac_set_kickout()
841 ath11k_warn(ar->ab, "failed to set kickout threshold on vdev %i: %d\n", in ath11k_mac_set_kickout()
842 arvif->vdev_id, ret); in ath11k_mac_set_kickout()
847 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, in ath11k_mac_set_kickout()
850 ath11k_warn(ar->ab, "failed to set keepalive minimum idle time on vdev %i: %d\n", in ath11k_mac_set_kickout()
851 arvif->vdev_id, ret); in ath11k_mac_set_kickout()
856 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, in ath11k_mac_set_kickout()
859 ath11k_warn(ar->ab, "failed to set keepalive maximum idle time on vdev %i: %d\n", in ath11k_mac_set_kickout()
860 arvif->vdev_id, ret); in ath11k_mac_set_kickout()
865 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, in ath11k_mac_set_kickout()
868 ath11k_warn(ar->ab, "failed to set keepalive maximum unresponsive time on vdev %i: %d\n", in ath11k_mac_set_kickout()
869 arvif->vdev_id, ret); in ath11k_mac_set_kickout()
879 struct ath11k_base *ab = ar->ab; in ath11k_mac_peer_cleanup_all()
881 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_peer_cleanup_all()
883 mutex_lock(&ab->tbl_mtx_lock); in ath11k_mac_peer_cleanup_all()
884 spin_lock_bh(&ab->base_lock); in ath11k_mac_peer_cleanup_all()
885 list_for_each_entry_safe(peer, tmp, &ab->peers, list) { in ath11k_mac_peer_cleanup_all()
888 list_del(&peer->list); in ath11k_mac_peer_cleanup_all()
891 spin_unlock_bh(&ab->base_lock); in ath11k_mac_peer_cleanup_all()
892 mutex_unlock(&ab->tbl_mtx_lock); in ath11k_mac_peer_cleanup_all()
894 ar->num_peers = 0; in ath11k_mac_peer_cleanup_all()
895 ar->num_stations = 0; in ath11k_mac_peer_cleanup_all()
900 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vdev_setup_sync()
902 if (test_bit(ATH11K_FLAG_CRASH_FLUSH, &ar->ab->dev_flags)) in ath11k_mac_vdev_setup_sync()
903 return -ESHUTDOWN; in ath11k_mac_vdev_setup_sync()
905 if (!wait_for_completion_timeout(&ar->vdev_setup_done, in ath11k_mac_vdev_setup_sync()
907 return -ETIMEDOUT; in ath11k_mac_vdev_setup_sync()
909 return ar->last_wmi_vdev_start_status ? -EINVAL : 0; in ath11k_mac_vdev_setup_sync()
919 *def = &conf->def; in ath11k_mac_get_any_chandef_iter()
929 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_monitor_vdev_start()
931 channel = chandef->chan; in ath11k_mac_monitor_vdev_start()
934 arg.channel.freq = channel->center_freq; in ath11k_mac_monitor_vdev_start()
935 arg.channel.band_center_freq1 = chandef->center_freq1; in ath11k_mac_monitor_vdev_start()
936 arg.channel.band_center_freq2 = chandef->center_freq2; in ath11k_mac_monitor_vdev_start()
938 arg.channel.mode = ath11k_phymodes[chandef->chan->band][chandef->width]; in ath11k_mac_monitor_vdev_start()
939 arg.channel.chan_radar = !!(channel->flags & IEEE80211_CHAN_RADAR); in ath11k_mac_monitor_vdev_start()
942 arg.channel.max_power = channel->max_power; in ath11k_mac_monitor_vdev_start()
943 arg.channel.max_reg_power = channel->max_reg_power; in ath11k_mac_monitor_vdev_start()
944 arg.channel.max_antenna_gain = channel->max_antenna_gain; in ath11k_mac_monitor_vdev_start()
946 arg.pref_tx_streams = ar->num_tx_chains; in ath11k_mac_monitor_vdev_start()
947 arg.pref_rx_streams = ar->num_rx_chains; in ath11k_mac_monitor_vdev_start()
949 arg.channel.passive = !!(chandef->chan->flags & IEEE80211_CHAN_NO_IR); in ath11k_mac_monitor_vdev_start()
951 reinit_completion(&ar->vdev_setup_done); in ath11k_mac_monitor_vdev_start()
952 reinit_completion(&ar->vdev_delete_done); in ath11k_mac_monitor_vdev_start()
956 ath11k_warn(ar->ab, "failed to request monitor vdev %i start: %d\n", in ath11k_mac_monitor_vdev_start()
963 ath11k_warn(ar->ab, "failed to synchronize setup for monitor vdev %i start: %d\n", in ath11k_mac_monitor_vdev_start()
968 ret = ath11k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr, NULL, 0, 0); in ath11k_mac_monitor_vdev_start()
970 ath11k_warn(ar->ab, "failed to put up monitor vdev %i: %d\n", in ath11k_mac_monitor_vdev_start()
975 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "monitor vdev %i started\n", in ath11k_mac_monitor_vdev_start()
981 reinit_completion(&ar->vdev_setup_done); in ath11k_mac_monitor_vdev_start()
985 ath11k_warn(ar->ab, "failed to stop monitor vdev %i after start failure: %d\n", in ath11k_mac_monitor_vdev_start()
992 ath11k_warn(ar->ab, "failed to synchronize setup for vdev %i stop: %d\n", in ath11k_mac_monitor_vdev_start()
997 return -EIO; in ath11k_mac_monitor_vdev_start()
1004 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_monitor_vdev_stop()
1006 reinit_completion(&ar->vdev_setup_done); in ath11k_mac_monitor_vdev_stop()
1008 ret = ath11k_wmi_vdev_stop(ar, ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_stop()
1010 ath11k_warn(ar->ab, "failed to request monitor vdev %i stop: %d\n", in ath11k_mac_monitor_vdev_stop()
1011 ar->monitor_vdev_id, ret); in ath11k_mac_monitor_vdev_stop()
1017 ath11k_warn(ar->ab, "failed to synchronize monitor vdev %i stop: %d\n", in ath11k_mac_monitor_vdev_stop()
1018 ar->monitor_vdev_id, ret); in ath11k_mac_monitor_vdev_stop()
1022 ret = ath11k_wmi_vdev_down(ar, ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_stop()
1024 ath11k_warn(ar->ab, "failed to put down monitor vdev %i: %d\n", in ath11k_mac_monitor_vdev_stop()
1025 ar->monitor_vdev_id, ret); in ath11k_mac_monitor_vdev_stop()
1029 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "monitor vdev %i stopped\n", in ath11k_mac_monitor_vdev_stop()
1030 ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_stop()
1037 struct ath11k_pdev *pdev = ar->pdev; in ath11k_mac_monitor_vdev_create()
1043 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_monitor_vdev_create()
1045 if (test_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags)) in ath11k_mac_monitor_vdev_create()
1048 if (ar->ab->free_vdev_map == 0) { in ath11k_mac_monitor_vdev_create()
1049 ath11k_warn(ar->ab, "failed to find free vdev id for monitor vdev\n"); in ath11k_mac_monitor_vdev_create()
1050 return -ENOMEM; in ath11k_mac_monitor_vdev_create()
1053 bit = __ffs64(ar->ab->free_vdev_map); in ath11k_mac_monitor_vdev_create()
1055 ar->monitor_vdev_id = bit; in ath11k_mac_monitor_vdev_create()
1057 param.if_id = ar->monitor_vdev_id; in ath11k_mac_monitor_vdev_create()
1060 param.pdev_id = pdev->pdev_id; in ath11k_mac_monitor_vdev_create()
1062 if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) { in ath11k_mac_monitor_vdev_create()
1063 param.chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains; in ath11k_mac_monitor_vdev_create()
1064 param.chains[NL80211_BAND_2GHZ].rx = ar->num_rx_chains; in ath11k_mac_monitor_vdev_create()
1066 if (pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) { in ath11k_mac_monitor_vdev_create()
1067 param.chains[NL80211_BAND_5GHZ].tx = ar->num_tx_chains; in ath11k_mac_monitor_vdev_create()
1068 param.chains[NL80211_BAND_5GHZ].rx = ar->num_rx_chains; in ath11k_mac_monitor_vdev_create()
1073 ath11k_warn(ar->ab, "failed to request monitor vdev %i creation: %d\n", in ath11k_mac_monitor_vdev_create()
1074 ar->monitor_vdev_id, ret); in ath11k_mac_monitor_vdev_create()
1075 ar->monitor_vdev_id = -1; in ath11k_mac_monitor_vdev_create()
1079 nss = get_num_chains(ar->cfg_tx_chainmask) ? : 1; in ath11k_mac_monitor_vdev_create()
1080 ret = ath11k_wmi_vdev_set_param_cmd(ar, ar->monitor_vdev_id, in ath11k_mac_monitor_vdev_create()
1083 ath11k_warn(ar->ab, "failed to set vdev %d chainmask 0x%x, nss %d :%d\n", in ath11k_mac_monitor_vdev_create()
1084 ar->monitor_vdev_id, ar->cfg_tx_chainmask, nss, ret); in ath11k_mac_monitor_vdev_create()
1090 ath11k_warn(ar->ab, "failed to recalc txpower for monitor vdev %d: %d\n", in ath11k_mac_monitor_vdev_create()
1091 ar->monitor_vdev_id, ret); in ath11k_mac_monitor_vdev_create()
1095 ar->allocated_vdev_map |= 1LL << ar->monitor_vdev_id; in ath11k_mac_monitor_vdev_create()
1096 ar->ab->free_vdev_map &= ~(1LL << ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_create()
1097 ar->num_created_vdevs++; in ath11k_mac_monitor_vdev_create()
1098 set_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); in ath11k_mac_monitor_vdev_create()
1100 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "monitor vdev %d created\n", in ath11k_mac_monitor_vdev_create()
1101 ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_create()
1106 ath11k_wmi_vdev_delete(ar, ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_create()
1107 ar->monitor_vdev_id = -1; in ath11k_mac_monitor_vdev_create()
1116 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_monitor_vdev_delete()
1118 if (!test_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags)) in ath11k_mac_monitor_vdev_delete()
1121 reinit_completion(&ar->vdev_delete_done); in ath11k_mac_monitor_vdev_delete()
1123 ret = ath11k_wmi_vdev_delete(ar, ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_delete()
1125 ath11k_warn(ar->ab, "failed to request wmi monitor vdev %i removal: %d\n", in ath11k_mac_monitor_vdev_delete()
1126 ar->monitor_vdev_id, ret); in ath11k_mac_monitor_vdev_delete()
1130 time_left = wait_for_completion_timeout(&ar->vdev_delete_done, in ath11k_mac_monitor_vdev_delete()
1133 ath11k_warn(ar->ab, "Timeout in receiving vdev delete response\n"); in ath11k_mac_monitor_vdev_delete()
1135 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "monitor vdev %d deleted\n", in ath11k_mac_monitor_vdev_delete()
1136 ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_delete()
1138 ar->allocated_vdev_map &= ~(1LL << ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_delete()
1139 ar->ab->free_vdev_map |= 1LL << (ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_delete()
1140 ar->num_created_vdevs--; in ath11k_mac_monitor_vdev_delete()
1141 ar->monitor_vdev_id = -1; in ath11k_mac_monitor_vdev_delete()
1142 clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); in ath11k_mac_monitor_vdev_delete()
1153 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_monitor_start()
1155 if (test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags)) in ath11k_mac_monitor_start()
1158 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath11k_mac_monitor_start()
1164 ret = ath11k_mac_monitor_vdev_start(ar, ar->monitor_vdev_id, chandef); in ath11k_mac_monitor_start()
1166 ath11k_warn(ar->ab, "failed to start monitor vdev: %d\n", ret); in ath11k_mac_monitor_start()
1171 set_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags); in ath11k_mac_monitor_start()
1173 ar->num_started_vdevs++; in ath11k_mac_monitor_start()
1176 ath11k_warn(ar->ab, "failed to configure htt monitor mode ring during start: %d", in ath11k_mac_monitor_start()
1181 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "monitor started\n"); in ath11k_mac_monitor_start()
1190 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_monitor_stop()
1192 if (!test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags)) in ath11k_mac_monitor_stop()
1197 ath11k_warn(ar->ab, "failed to stop monitor vdev: %d\n", ret); in ath11k_mac_monitor_stop()
1201 clear_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags); in ath11k_mac_monitor_stop()
1202 ar->num_started_vdevs--; in ath11k_mac_monitor_stop()
1206 ath11k_warn(ar->ab, "failed to configure htt monitor mode ring during stop: %d", in ath11k_mac_monitor_stop()
1211 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "monitor stopped ret %d\n", ret); in ath11k_mac_monitor_stop()
1218 struct ath11k *ar = arvif->ar; in ath11k_mac_vif_setup_ps()
1219 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_vif_setup_ps()
1220 struct ieee80211_conf *conf = &ar->hw->conf; in ath11k_mac_vif_setup_ps()
1227 lockdep_assert_held(&arvif->ar->conf_mutex); in ath11k_mac_vif_setup_ps()
1229 if (arvif->vif->type != NL80211_IFTYPE_STATION) in ath11k_mac_vif_setup_ps()
1232 enable_ps = arvif->ps; in ath11k_mac_vif_setup_ps()
1238 timeout = conf->dynamic_ps_timeout; in ath11k_mac_vif_setup_ps()
1241 timeout = ieee80211_tu_to_usec(vif->bss_conf.beacon_int) / 1000; in ath11k_mac_vif_setup_ps()
1244 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, in ath11k_mac_vif_setup_ps()
1247 ath11k_warn(ar->ab, "failed to set inactivity time for vdev %d: %i\n", in ath11k_mac_vif_setup_ps()
1248 arvif->vdev_id, ret); in ath11k_mac_vif_setup_ps()
1255 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %d psmode %s\n", in ath11k_mac_vif_setup_ps()
1256 arvif->vdev_id, psmode ? "enable" : "disable"); in ath11k_mac_vif_setup_ps()
1258 ret = ath11k_wmi_pdev_set_ps_mode(ar, arvif->vdev_id, psmode); in ath11k_mac_vif_setup_ps()
1260 ath11k_warn(ar->ab, "failed to set sta power save mode %d for vdev %d: %d\n", in ath11k_mac_vif_setup_ps()
1261 psmode, arvif->vdev_id, ret); in ath11k_mac_vif_setup_ps()
1273 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_config_ps()
1275 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_mac_config_ps()
1278 ath11k_warn(ar->ab, "failed to setup powersave: %d\n", ret); in ath11k_mac_config_ps()
1288 struct ath11k *ar = hw->priv; in ath11k_mac_op_config()
1289 struct ieee80211_conf *conf = &hw->conf; in ath11k_mac_op_config()
1292 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_config()
1295 if (conf->flags & IEEE80211_CONF_MONITOR) { in ath11k_mac_op_config()
1296 set_bit(ATH11K_FLAG_MONITOR_CONF_ENABLED, &ar->monitor_flags); in ath11k_mac_op_config()
1299 &ar->monitor_flags)) in ath11k_mac_op_config()
1304 ath11k_warn(ar->ab, "failed to create monitor vdev: %d", in ath11k_mac_op_config()
1311 ath11k_warn(ar->ab, "failed to start monitor: %d", in ath11k_mac_op_config()
1316 clear_bit(ATH11K_FLAG_MONITOR_CONF_ENABLED, &ar->monitor_flags); in ath11k_mac_op_config()
1319 &ar->monitor_flags)) in ath11k_mac_op_config()
1324 ath11k_warn(ar->ab, "failed to stop monitor: %d", in ath11k_mac_op_config()
1331 ath11k_warn(ar->ab, "failed to delete monitor vdev: %d", in ath11k_mac_op_config()
1339 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_config()
1344 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_config()
1353 arvif->rsnie_present = true; in ath11k_mac_setup_nontx_vif_rsnie()
1366 arvif->rsnie_present = false; in ath11k_mac_setup_nontx_vif_rsnie()
1381 ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn); in ath11k_mac_set_nontx_vif_params()
1382 mgmt = (struct ieee80211_mgmt *)bcn->data; in ath11k_mac_set_nontx_vif_params()
1383 ies += sizeof(mgmt->u.beacon); in ath11k_mac_set_nontx_vif_params()
1384 ies_len = skb_tail_pointer(bcn) - ies; in ath11k_mac_set_nontx_vif_params()
1387 arvif->rsnie_present = tx_arvif->rsnie_present; in ath11k_mac_set_nontx_vif_params()
1392 ies_len -= (2 + ies[1]); in ath11k_mac_set_nontx_vif_params()
1393 mbssid_len = ies[1] - 1; in ath11k_mac_set_nontx_vif_params()
1401 mbssid_len -= (2 + profile_len); in ath11k_mac_set_nontx_vif_params()
1404 profile_len -= (2 + profile[1]); in ath11k_mac_set_nontx_vif_params()
1406 profile_len -= (2 + profile[1]); in ath11k_mac_set_nontx_vif_params()
1408 if (profile[2] == arvif->vif->bss_conf.bssid_index) { in ath11k_mac_set_nontx_vif_params()
1409 profile_len -= 5; in ath11k_mac_set_nontx_vif_params()
1412 tx_arvif->rsnie_present, in ath11k_mac_set_nontx_vif_params()
1429 struct ath11k *ar = arvif->ar; in ath11k_mac_setup_bcn_p2p_ie()
1434 mgmt = (void *)bcn->data; in ath11k_mac_setup_bcn_p2p_ie()
1436 mgmt->u.beacon.variable, in ath11k_mac_setup_bcn_p2p_ie()
1437 bcn->len - (mgmt->u.beacon.variable - in ath11k_mac_setup_bcn_p2p_ie()
1438 bcn->data)); in ath11k_mac_setup_bcn_p2p_ie()
1440 return -ENOENT; in ath11k_mac_setup_bcn_p2p_ie()
1442 ret = ath11k_wmi_p2p_go_bcn_ie(ar, arvif->vdev_id, p2p_ie); in ath11k_mac_setup_bcn_p2p_ie()
1444 ath11k_warn(ar->ab, "failed to submit P2P GO bcn ie for vdev %i: %d\n", in ath11k_mac_setup_bcn_p2p_ie()
1445 arvif->vdev_id, ret); in ath11k_mac_setup_bcn_p2p_ie()
1459 if (WARN_ON(skb->len < ie_offset)) in ath11k_mac_remove_vendor_ie()
1460 return -EINVAL; in ath11k_mac_remove_vendor_ie()
1463 skb->data + ie_offset, in ath11k_mac_remove_vendor_ie()
1464 skb->len - ie_offset); in ath11k_mac_remove_vendor_ie()
1466 return -ENOENT; in ath11k_mac_remove_vendor_ie()
1469 end = skb->data + skb->len; in ath11k_mac_remove_vendor_ie()
1473 return -EINVAL; in ath11k_mac_remove_vendor_ie()
1475 memmove(ie, next, end - next); in ath11k_mac_remove_vendor_ie()
1476 skb_trim(skb, skb->len - len); in ath11k_mac_remove_vendor_ie()
1484 struct ath11k_base *ab = arvif->ar->ab; in ath11k_mac_set_vif_params()
1489 ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn); in ath11k_mac_set_vif_params()
1490 mgmt = (struct ieee80211_mgmt *)bcn->data; in ath11k_mac_set_vif_params()
1491 ies += sizeof(mgmt->u.beacon); in ath11k_mac_set_vif_params()
1493 if (cfg80211_find_ie(WLAN_EID_RSN, ies, (skb_tail_pointer(bcn) - ies))) in ath11k_mac_set_vif_params()
1494 arvif->rsnie_present = true; in ath11k_mac_set_vif_params()
1496 arvif->rsnie_present = false; in ath11k_mac_set_vif_params()
1500 ies, (skb_tail_pointer(bcn) - ies))) in ath11k_mac_set_vif_params()
1501 arvif->wpaie_present = true; in ath11k_mac_set_vif_params()
1503 arvif->wpaie_present = false; in ath11k_mac_set_vif_params()
1505 if (arvif->vdev_subtype != WMI_VDEV_SUBTYPE_P2P_GO) in ath11k_mac_set_vif_params()
1541 tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif); in ath11k_mac_setup_bcn_tmpl_ema()
1543 beacons = ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw, in ath11k_mac_setup_bcn_tmpl_ema()
1544 tx_arvif->vif, 0); in ath11k_mac_setup_bcn_tmpl_ema()
1545 if (!beacons || !beacons->cnt) { in ath11k_mac_setup_bcn_tmpl_ema()
1546 ath11k_warn(arvif->ar->ab, in ath11k_mac_setup_bcn_tmpl_ema()
1548 return -EPERM; in ath11k_mac_setup_bcn_tmpl_ema()
1552 if (ath11k_mac_set_vif_params(tx_arvif, beacons->bcn[0].skb)) in ath11k_mac_setup_bcn_tmpl_ema()
1553 return -EINVAL; in ath11k_mac_setup_bcn_tmpl_ema()
1555 arvif->wpaie_present = tx_arvif->wpaie_present; in ath11k_mac_setup_bcn_tmpl_ema()
1558 for (i = 0; i < beacons->cnt; i++) { in ath11k_mac_setup_bcn_tmpl_ema()
1562 beacons->bcn[i].skb); in ath11k_mac_setup_bcn_tmpl_ema()
1564 params = beacons->cnt; in ath11k_mac_setup_bcn_tmpl_ema()
1567 params |= ((i + 1 == beacons->cnt ? 1 : 0) << WMI_EMA_LAST_TMPL_SHIFT); in ath11k_mac_setup_bcn_tmpl_ema()
1569 ret = ath11k_wmi_bcn_tmpl(tx_arvif->ar, tx_arvif->vdev_id, in ath11k_mac_setup_bcn_tmpl_ema()
1570 &beacons->bcn[i].offs, in ath11k_mac_setup_bcn_tmpl_ema()
1571 beacons->bcn[i].skb, params); in ath11k_mac_setup_bcn_tmpl_ema()
1573 ath11k_warn(tx_arvif->ar->ab, in ath11k_mac_setup_bcn_tmpl_ema()
1583 return -EINVAL; /* Profile not found in the beacons */ in ath11k_mac_setup_bcn_tmpl_ema()
1590 struct ath11k *ar = arvif->ar; in ath11k_mac_setup_bcn_tmpl_mbssid()
1591 struct ath11k_base *ab = ar->ab; in ath11k_mac_setup_bcn_tmpl_mbssid()
1593 struct ieee80211_hw *hw = ar->hw; in ath11k_mac_setup_bcn_tmpl_mbssid()
1594 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_setup_bcn_tmpl_mbssid()
1599 if (vif->mbssid_tx_vif) { in ath11k_mac_setup_bcn_tmpl_mbssid()
1600 tx_arvif = ath11k_vif_to_arvif(vif->mbssid_tx_vif); in ath11k_mac_setup_bcn_tmpl_mbssid()
1602 ar = tx_arvif->ar; in ath11k_mac_setup_bcn_tmpl_mbssid()
1603 ab = ar->ab; in ath11k_mac_setup_bcn_tmpl_mbssid()
1604 hw = ar->hw; in ath11k_mac_setup_bcn_tmpl_mbssid()
1605 vif = tx_arvif->vif; in ath11k_mac_setup_bcn_tmpl_mbssid()
1612 return -EPERM; in ath11k_mac_setup_bcn_tmpl_mbssid()
1617 return -EINVAL; in ath11k_mac_setup_bcn_tmpl_mbssid()
1619 return -EINVAL; in ath11k_mac_setup_bcn_tmpl_mbssid()
1622 ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn, 0); in ath11k_mac_setup_bcn_tmpl_mbssid()
1634 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_setup_bcn_tmpl()
1636 if (arvif->vdev_type != WMI_VDEV_TYPE_AP) in ath11k_mac_setup_bcn_tmpl()
1640 * non-transmitting interfaces, and results in a crash if sent. in ath11k_mac_setup_bcn_tmpl()
1642 if (vif->mbssid_tx_vif && in ath11k_mac_setup_bcn_tmpl()
1643 arvif != ath11k_vif_to_arvif(vif->mbssid_tx_vif) && arvif->is_up) in ath11k_mac_setup_bcn_tmpl()
1646 if (vif->bss_conf.ema_ap && vif->mbssid_tx_vif) in ath11k_mac_setup_bcn_tmpl()
1654 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_bcn_tx_event()
1656 if (!vif->bss_conf.color_change_active && !arvif->bcca_zero_sent) in ath11k_mac_bcn_tx_event()
1659 if (vif->bss_conf.color_change_active && in ath11k_mac_bcn_tx_event()
1661 arvif->bcca_zero_sent = true; in ath11k_mac_bcn_tx_event()
1666 arvif->bcca_zero_sent = false; in ath11k_mac_bcn_tx_event()
1668 if (vif->bss_conf.color_change_active) in ath11k_mac_bcn_tx_event()
1676 struct ath11k *ar = arvif->ar; in ath11k_control_beaconing()
1680 lockdep_assert_held(&arvif->ar->conf_mutex); in ath11k_control_beaconing()
1682 if (!info->enable_beacon) { in ath11k_control_beaconing()
1683 ret = ath11k_wmi_vdev_down(ar, arvif->vdev_id); in ath11k_control_beaconing()
1685 ath11k_warn(ar->ab, "failed to down vdev_id %i: %d\n", in ath11k_control_beaconing()
1686 arvif->vdev_id, ret); in ath11k_control_beaconing()
1688 arvif->is_up = false; in ath11k_control_beaconing()
1695 ath11k_warn(ar->ab, "failed to update bcn tmpl during vdev up: %d\n", in ath11k_control_beaconing()
1700 arvif->tx_seq_no = 0x1000; in ath11k_control_beaconing()
1702 arvif->aid = 0; in ath11k_control_beaconing()
1704 ether_addr_copy(arvif->bssid, info->bssid); in ath11k_control_beaconing()
1706 if (arvif->vif->mbssid_tx_vif) in ath11k_control_beaconing()
1707 tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif); in ath11k_control_beaconing()
1709 ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath11k_control_beaconing()
1710 arvif->bssid, in ath11k_control_beaconing()
1711 tx_arvif ? tx_arvif->bssid : NULL, in ath11k_control_beaconing()
1712 info->bssid_index, in ath11k_control_beaconing()
1713 1 << info->bssid_indicator); in ath11k_control_beaconing()
1715 ath11k_warn(ar->ab, "failed to bring up vdev %d: %i\n", in ath11k_control_beaconing()
1716 arvif->vdev_id, ret); in ath11k_control_beaconing()
1720 arvif->is_up = true; in ath11k_control_beaconing()
1722 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %d up\n", arvif->vdev_id); in ath11k_control_beaconing()
1729 struct ieee80211_mgmt *mgmt = (void *)skb->data; in ath11k_mac_handle_beacon_iter()
1732 if (vif->type != NL80211_IFTYPE_STATION) in ath11k_mac_handle_beacon_iter()
1735 if (!ether_addr_equal(mgmt->bssid, vif->bss_conf.bssid)) in ath11k_mac_handle_beacon_iter()
1738 cancel_delayed_work(&arvif->connection_loss_work); in ath11k_mac_handle_beacon_iter()
1743 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_handle_beacon()
1754 struct ath11k *ar = arvif->ar; in ath11k_mac_handle_beacon_miss_iter()
1755 struct ieee80211_hw *hw = ar->hw; in ath11k_mac_handle_beacon_miss_iter()
1757 if (arvif->vdev_id != *vdev_id) in ath11k_mac_handle_beacon_miss_iter()
1760 if (!arvif->is_up) in ath11k_mac_handle_beacon_miss_iter()
1770 ieee80211_queue_delayed_work(hw, &arvif->connection_loss_work, in ath11k_mac_handle_beacon_miss_iter()
1776 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_handle_beacon_miss()
1786 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_vif_sta_connection_loss_work()
1788 if (!arvif->is_up) in ath11k_mac_vif_sta_connection_loss_work()
1802 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_basic()
1804 if (vif->type == NL80211_IFTYPE_STATION) in ath11k_peer_assoc_h_basic()
1805 aid = vif->cfg.aid; in ath11k_peer_assoc_h_basic()
1807 aid = sta->aid; in ath11k_peer_assoc_h_basic()
1809 ether_addr_copy(arg->peer_mac, sta->addr); in ath11k_peer_assoc_h_basic()
1810 arg->vdev_id = arvif->vdev_id; in ath11k_peer_assoc_h_basic()
1811 arg->peer_associd = aid; in ath11k_peer_assoc_h_basic()
1812 arg->auth_flag = true; in ath11k_peer_assoc_h_basic()
1814 arg->peer_listen_intval = ar->hw->conf.listen_interval; in ath11k_peer_assoc_h_basic()
1815 arg->peer_nss = 1; in ath11k_peer_assoc_h_basic()
1816 arg->peer_caps = vif->bss_conf.assoc_capability; in ath11k_peer_assoc_h_basic()
1824 struct ieee80211_bss_conf *info = &vif->bss_conf; in ath11k_peer_assoc_h_crypto()
1831 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_crypto()
1836 bss = cfg80211_get_bss(ar->hw->wiphy, def.chan, info->bssid, NULL, 0, in ath11k_peer_assoc_h_crypto()
1839 if (arvif->rsnie_present || arvif->wpaie_present) { in ath11k_peer_assoc_h_crypto()
1840 arg->need_ptk_4_way = true; in ath11k_peer_assoc_h_crypto()
1841 if (arvif->wpaie_present) in ath11k_peer_assoc_h_crypto()
1842 arg->need_gtk_2_way = true; in ath11k_peer_assoc_h_crypto()
1849 ies = rcu_dereference(bss->ies); in ath11k_peer_assoc_h_crypto()
1853 ies->data, in ath11k_peer_assoc_h_crypto()
1854 ies->len); in ath11k_peer_assoc_h_crypto()
1856 cfg80211_put_bss(ar->hw->wiphy, bss); in ath11k_peer_assoc_h_crypto()
1861 ath11k_dbg(ar->ab, ATH11K_DBG_WMI, in ath11k_peer_assoc_h_crypto()
1863 arg->need_ptk_4_way = true; in ath11k_peer_assoc_h_crypto()
1867 ath11k_dbg(ar->ab, ATH11K_DBG_WMI, in ath11k_peer_assoc_h_crypto()
1869 arg->need_gtk_2_way = true; in ath11k_peer_assoc_h_crypto()
1872 if (sta->mfp) { in ath11k_peer_assoc_h_crypto()
1874 arg->is_pmf_enabled = true; in ath11k_peer_assoc_h_crypto()
1877 /* TODO: safe_mode_enabled (bypass 4-way handshake) flag req? */ in ath11k_peer_assoc_h_crypto()
1886 struct wmi_rate_set_arg *rateset = &arg->peer_legacy_rates; in ath11k_peer_assoc_h_rates()
1895 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_rates()
1900 band = def.chan->band; in ath11k_peer_assoc_h_rates()
1901 sband = ar->hw->wiphy->bands[band]; in ath11k_peer_assoc_h_rates()
1902 ratemask = sta->deflink.supp_rates[band]; in ath11k_peer_assoc_h_rates()
1903 ratemask &= arvif->bitrate_mask.control[band].legacy; in ath11k_peer_assoc_h_rates()
1904 rates = sband->bitrates; in ath11k_peer_assoc_h_rates()
1906 rateset->num_rates = 0; in ath11k_peer_assoc_h_rates()
1912 rate = ath11k_mac_bitrate_to_rate(rates->bitrate); in ath11k_peer_assoc_h_rates()
1913 rateset->rates[rateset->num_rates] = rate; in ath11k_peer_assoc_h_rates()
1914 rateset->num_rates++; in ath11k_peer_assoc_h_rates()
1947 const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; in ath11k_peer_assoc_h_ht()
1956 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_ht()
1961 if (!ht_cap->ht_supported) in ath11k_peer_assoc_h_ht()
1964 band = def.chan->band; in ath11k_peer_assoc_h_ht()
1965 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath11k_peer_assoc_h_ht()
1970 arg->ht_flag = true; in ath11k_peer_assoc_h_ht()
1972 arg->peer_max_mpdu = (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + in ath11k_peer_assoc_h_ht()
1973 ht_cap->ampdu_factor)) - 1; in ath11k_peer_assoc_h_ht()
1975 arg->peer_mpdu_density = in ath11k_peer_assoc_h_ht()
1976 ath11k_parse_mpdudensity(ht_cap->ampdu_density); in ath11k_peer_assoc_h_ht()
1978 arg->peer_ht_caps = ht_cap->cap; in ath11k_peer_assoc_h_ht()
1979 arg->peer_rate_caps |= WMI_HOST_RC_HT_FLAG; in ath11k_peer_assoc_h_ht()
1981 if (ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING) in ath11k_peer_assoc_h_ht()
1982 arg->ldpc_flag = true; in ath11k_peer_assoc_h_ht()
1984 if (sta->deflink.bandwidth >= IEEE80211_STA_RX_BW_40) { in ath11k_peer_assoc_h_ht()
1985 arg->bw_40 = true; in ath11k_peer_assoc_h_ht()
1986 arg->peer_rate_caps |= WMI_HOST_RC_CW40_FLAG; in ath11k_peer_assoc_h_ht()
1993 if (arvif->bitrate_mask.control[band].gi == NL80211_TXRATE_DEFAULT_GI) in ath11k_peer_assoc_h_ht()
1994 arg->peer_ht_caps &= ~(IEEE80211_HT_CAP_SGI_20 | in ath11k_peer_assoc_h_ht()
1997 if (arvif->bitrate_mask.control[band].gi != NL80211_TXRATE_FORCE_LGI) { in ath11k_peer_assoc_h_ht()
1998 if (ht_cap->cap & (IEEE80211_HT_CAP_SGI_20 | in ath11k_peer_assoc_h_ht()
2000 arg->peer_rate_caps |= WMI_HOST_RC_SGI_FLAG; in ath11k_peer_assoc_h_ht()
2003 if (ht_cap->cap & IEEE80211_HT_CAP_TX_STBC) { in ath11k_peer_assoc_h_ht()
2004 arg->peer_rate_caps |= WMI_HOST_RC_TX_STBC_FLAG; in ath11k_peer_assoc_h_ht()
2005 arg->stbc_flag = true; in ath11k_peer_assoc_h_ht()
2008 if (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC) { in ath11k_peer_assoc_h_ht()
2009 stbc = ht_cap->cap & IEEE80211_HT_CAP_RX_STBC; in ath11k_peer_assoc_h_ht()
2012 arg->peer_rate_caps |= stbc; in ath11k_peer_assoc_h_ht()
2013 arg->stbc_flag = true; in ath11k_peer_assoc_h_ht()
2016 if (ht_cap->mcs.rx_mask[1] && ht_cap->mcs.rx_mask[2]) in ath11k_peer_assoc_h_ht()
2017 arg->peer_rate_caps |= WMI_HOST_RC_TS_FLAG; in ath11k_peer_assoc_h_ht()
2018 else if (ht_cap->mcs.rx_mask[1]) in ath11k_peer_assoc_h_ht()
2019 arg->peer_rate_caps |= WMI_HOST_RC_DS_FLAG; in ath11k_peer_assoc_h_ht()
2022 if ((ht_cap->mcs.rx_mask[i / 8] & BIT(i % 8)) && in ath11k_peer_assoc_h_ht()
2025 arg->peer_ht_rates.rates[n++] = i; in ath11k_peer_assoc_h_ht()
2028 /* This is a workaround for HT-enabled STAs which break the spec in ath11k_peer_assoc_h_ht()
2037 arg->peer_ht_rates.num_rates = 8; in ath11k_peer_assoc_h_ht()
2038 for (i = 0; i < arg->peer_ht_rates.num_rates; i++) in ath11k_peer_assoc_h_ht()
2039 arg->peer_ht_rates.rates[i] = i; in ath11k_peer_assoc_h_ht()
2041 arg->peer_ht_rates.num_rates = n; in ath11k_peer_assoc_h_ht()
2042 arg->peer_nss = min(sta->deflink.rx_nss, max_nss); in ath11k_peer_assoc_h_ht()
2045 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "ht peer %pM mcs cnt %d nss %d\n", in ath11k_peer_assoc_h_ht()
2046 arg->peer_mac, in ath11k_peer_assoc_h_ht()
2047 arg->peer_ht_rates.num_rates, in ath11k_peer_assoc_h_ht()
2048 arg->peer_nss); in ath11k_peer_assoc_h_ht()
2054 case IEEE80211_VHT_MCS_SUPPORT_0_7: return BIT(8) - 1; in ath11k_mac_get_max_vht_mcs_map()
2055 case IEEE80211_VHT_MCS_SUPPORT_0_8: return BIT(9) - 1; in ath11k_mac_get_max_vht_mcs_map()
2056 case IEEE80211_VHT_MCS_SUPPORT_0_9: return BIT(10) - 1; in ath11k_mac_get_max_vht_mcs_map()
2075 idx_limit = fls(mcs_map) - 1; in ath11k_peer_assoc_h_vht_limit()
2077 idx_limit = -1; in ath11k_peer_assoc_h_vht_limit()
2099 case -1: in ath11k_peer_assoc_h_vht_limit()
2114 u8 nss_ratio_info = ar->pdev->cap.nss_ratio_info; in ath11k_get_nss_160mhz()
2122 ath11k_warn(ar->ab, "WMI_NSS_RATIO_3BY4_NSS not supported\n"); in ath11k_get_nss_160mhz()
2128 ath11k_warn(ar->ab, "WMI_NSS_RATIO_2_NSS not supported\n"); in ath11k_get_nss_160mhz()
2131 ath11k_warn(ar->ab, "invalid nss ratio received from firmware: %d\n", in ath11k_get_nss_160mhz()
2144 const struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; in ath11k_peer_assoc_h_vht()
2158 if (!vht_cap->vht_supported) in ath11k_peer_assoc_h_vht()
2161 band = def.chan->band; in ath11k_peer_assoc_h_vht()
2162 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath11k_peer_assoc_h_vht()
2167 arg->vht_flag = true; in ath11k_peer_assoc_h_vht()
2170 arg->vht_capable = true; in ath11k_peer_assoc_h_vht()
2172 if (def.chan->band == NL80211_BAND_2GHZ) in ath11k_peer_assoc_h_vht()
2173 arg->vht_ng_flag = true; in ath11k_peer_assoc_h_vht()
2175 arg->peer_vht_caps = vht_cap->cap; in ath11k_peer_assoc_h_vht()
2177 ampdu_factor = (vht_cap->cap & in ath11k_peer_assoc_h_vht()
2181 /* Workaround: Some Netgear/Linksys 11ac APs set Rx A-MPDU factor to in ath11k_peer_assoc_h_vht()
2183 * arg->peer_max_mpdu at this point contains HT max_mpdu so keep in ath11k_peer_assoc_h_vht()
2186 arg->peer_max_mpdu = max(arg->peer_max_mpdu, in ath11k_peer_assoc_h_vht()
2188 ampdu_factor)) - 1); in ath11k_peer_assoc_h_vht()
2190 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) in ath11k_peer_assoc_h_vht()
2191 arg->bw_80 = true; in ath11k_peer_assoc_h_vht()
2193 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) in ath11k_peer_assoc_h_vht()
2194 arg->bw_160 = true; in ath11k_peer_assoc_h_vht()
2198 if (vht_nss > sta->deflink.rx_nss) { in ath11k_peer_assoc_h_vht()
2200 for (nss_idx = sta->deflink.rx_nss - 1; nss_idx >= 0; nss_idx--) { in ath11k_peer_assoc_h_vht()
2209 …ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "setting vht range mcs value to peer supported nss %d for peer … in ath11k_peer_assoc_h_vht()
2210 sta->deflink.rx_nss, sta->addr); in ath11k_peer_assoc_h_vht()
2211 vht_mcs_mask[sta->deflink.rx_nss - 1] = vht_mcs_mask[vht_nss - 1]; in ath11k_peer_assoc_h_vht()
2218 vht_mcs = __le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map) >> in ath11k_peer_assoc_h_vht()
2225 arg->peer_nss = min(sta->deflink.rx_nss, max_nss); in ath11k_peer_assoc_h_vht()
2226 arg->rx_max_rate = __le16_to_cpu(vht_cap->vht_mcs.rx_highest); in ath11k_peer_assoc_h_vht()
2227 arg->rx_mcs_set = __le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map); in ath11k_peer_assoc_h_vht()
2228 arg->tx_max_rate = __le16_to_cpu(vht_cap->vht_mcs.tx_highest); in ath11k_peer_assoc_h_vht()
2229 arg->tx_mcs_set = ath11k_peer_assoc_h_vht_limit( in ath11k_peer_assoc_h_vht()
2230 __le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); in ath11k_peer_assoc_h_vht()
2236 arg->tx_mcs_set &= ~IEEE80211_VHT_MCS_SUPPORT_0_11_MASK; in ath11k_peer_assoc_h_vht()
2237 arg->tx_mcs_set |= IEEE80211_DISABLE_VHT_MCS_SUPPORT_0_11; in ath11k_peer_assoc_h_vht()
2239 if ((arg->tx_mcs_set & IEEE80211_VHT_MCS_NOT_SUPPORTED) == in ath11k_peer_assoc_h_vht()
2241 arg->peer_vht_caps &= ~IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; in ath11k_peer_assoc_h_vht()
2244 arg->tx_max_mcs_nss = 0xFF; in ath11k_peer_assoc_h_vht()
2246 if (arg->peer_phymode == MODE_11AC_VHT160 || in ath11k_peer_assoc_h_vht()
2247 arg->peer_phymode == MODE_11AC_VHT80_80) { in ath11k_peer_assoc_h_vht()
2249 rx_nss = min(arg->peer_nss, tx_nss); in ath11k_peer_assoc_h_vht()
2250 arg->peer_bw_rxnss_override = ATH11K_BW_NSS_MAP_ENABLE; in ath11k_peer_assoc_h_vht()
2253 ath11k_warn(ar->ab, "invalid max_nss\n"); in ath11k_peer_assoc_h_vht()
2257 if (arg->peer_phymode == MODE_11AC_VHT160) in ath11k_peer_assoc_h_vht()
2258 nss_160 = FIELD_PREP(ATH11K_PEER_RX_NSS_160MHZ, rx_nss - 1); in ath11k_peer_assoc_h_vht()
2260 nss_160 = FIELD_PREP(ATH11K_PEER_RX_NSS_80_80MHZ, rx_nss - 1); in ath11k_peer_assoc_h_vht()
2262 arg->peer_bw_rxnss_override |= nss_160; in ath11k_peer_assoc_h_vht()
2265 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_peer_assoc_h_vht()
2267 sta->addr, arg->peer_max_mpdu, arg->peer_flags, in ath11k_peer_assoc_h_vht()
2268 arg->peer_bw_rxnss_override); in ath11k_peer_assoc_h_vht()
2274 case IEEE80211_HE_MCS_SUPPORT_0_7: return BIT(8) - 1; in ath11k_mac_get_max_he_mcs_map()
2275 case IEEE80211_HE_MCS_SUPPORT_0_9: return BIT(10) - 1; in ath11k_mac_get_max_he_mcs_map()
2276 case IEEE80211_HE_MCS_SUPPORT_0_11: return BIT(12) - 1; in ath11k_mac_get_max_he_mcs_map()
2294 idx_limit = fls(mcs_map) - 1; in ath11k_peer_assoc_h_he_limit()
2296 idx_limit = -1; in ath11k_peer_assoc_h_he_limit()
2313 case -1: in ath11k_peer_assoc_h_he_limit()
2344 const struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap; in ath11k_peer_assoc_h_he()
2359 if (!he_cap->has_he) in ath11k_peer_assoc_h_he()
2362 band = def.chan->band; in ath11k_peer_assoc_h_he()
2363 memcpy(he_mcs_mask, arvif->bitrate_mask.control[band].he_mcs, in ath11k_peer_assoc_h_he()
2369 arg->he_flag = true; in ath11k_peer_assoc_h_he()
2370 support_160 = !!(he_cap->he_cap_elem.phy_cap_info[0] & in ath11k_peer_assoc_h_he()
2373 /* Supported HE-MCS and NSS Set of peer he_cap is intersection with self he_cp */ in ath11k_peer_assoc_h_he()
2374 mcs_160_map = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_160); in ath11k_peer_assoc_h_he()
2375 mcs_80_map = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80); in ath11k_peer_assoc_h_he()
2380 for (i = 7; i >= 0; i--) { in ath11k_peer_assoc_h_he()
2392 for (i = 7; i >= 0; i--) { in ath11k_peer_assoc_h_he()
2406 arg->peer_nss = min(sta->deflink.rx_nss, max_nss); in ath11k_peer_assoc_h_he()
2408 memcpy_and_pad(&arg->peer_he_cap_macinfo, in ath11k_peer_assoc_h_he()
2409 sizeof(arg->peer_he_cap_macinfo), in ath11k_peer_assoc_h_he()
2410 he_cap->he_cap_elem.mac_cap_info, in ath11k_peer_assoc_h_he()
2411 sizeof(he_cap->he_cap_elem.mac_cap_info), in ath11k_peer_assoc_h_he()
2413 memcpy_and_pad(&arg->peer_he_cap_phyinfo, in ath11k_peer_assoc_h_he()
2414 sizeof(arg->peer_he_cap_phyinfo), in ath11k_peer_assoc_h_he()
2415 he_cap->he_cap_elem.phy_cap_info, in ath11k_peer_assoc_h_he()
2416 sizeof(he_cap->he_cap_elem.phy_cap_info), in ath11k_peer_assoc_h_he()
2418 arg->peer_he_ops = vif->bss_conf.he_oper.params; in ath11k_peer_assoc_h_he()
2421 arg->peer_he_ops &= 0xffffff; in ath11k_peer_assoc_h_he()
2424 * in HE cap is zero, use the arg->peer_max_mpdu as calculated while parsing in ath11k_peer_assoc_h_he()
2427 * For non-zero value of Max AMPDU Extponent Extension in HE MAC caps, in ath11k_peer_assoc_h_he()
2428 * if a HE STA sends VHT cap and HE cap IE in assoc request then, use in ath11k_peer_assoc_h_he()
2430 * If a HE STA that does not send VHT cap, but HE and HT cap in assoc in ath11k_peer_assoc_h_he()
2434 ampdu_factor = u8_get_bits(he_cap->he_cap_elem.mac_cap_info[3], in ath11k_peer_assoc_h_he()
2438 if (sta->deflink.vht_cap.vht_supported) in ath11k_peer_assoc_h_he()
2439 arg->peer_max_mpdu = (1 << (IEEE80211_HE_VHT_MAX_AMPDU_FACTOR + in ath11k_peer_assoc_h_he()
2440 ampdu_factor)) - 1; in ath11k_peer_assoc_h_he()
2441 else if (sta->deflink.ht_cap.ht_supported) in ath11k_peer_assoc_h_he()
2442 arg->peer_max_mpdu = (1 << (IEEE80211_HE_HT_MAX_AMPDU_FACTOR + in ath11k_peer_assoc_h_he()
2443 ampdu_factor)) - 1; in ath11k_peer_assoc_h_he()
2446 if (he_cap->he_cap_elem.phy_cap_info[6] & in ath11k_peer_assoc_h_he()
2451 arg->peer_ppet.numss_m1 = he_cap->ppe_thres[0] & in ath11k_peer_assoc_h_he()
2453 arg->peer_ppet.ru_bit_mask = in ath11k_peer_assoc_h_he()
2454 (he_cap->ppe_thres[0] & in ath11k_peer_assoc_h_he()
2458 for (nss = 0; nss <= arg->peer_ppet.numss_m1; nss++) { in ath11k_peer_assoc_h_he()
2463 if ((arg->peer_ppet.ru_bit_mask & BIT(ru)) == 0) in ath11k_peer_assoc_h_he()
2467 val |= ((he_cap->ppe_thres[bit / 8] >> in ath11k_peer_assoc_h_he()
2471 arg->peer_ppet.ppet16_ppet8_ru3_ru0[nss] |= in ath11k_peer_assoc_h_he()
2477 if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_RES) in ath11k_peer_assoc_h_he()
2478 arg->twt_responder = true; in ath11k_peer_assoc_h_he()
2479 if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_REQ) in ath11k_peer_assoc_h_he()
2480 arg->twt_requester = true; in ath11k_peer_assoc_h_he()
2484 if (he_nss > sta->deflink.rx_nss) { in ath11k_peer_assoc_h_he()
2486 for (nss_idx = sta->deflink.rx_nss - 1; nss_idx >= 0; nss_idx--) { in ath11k_peer_assoc_h_he()
2495 …ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "setting he range mcs value to peer supported nss %d for peer %… in ath11k_peer_assoc_h_he()
2496 sta->deflink.rx_nss, sta->addr); in ath11k_peer_assoc_h_he()
2497 he_mcs_mask[sta->deflink.rx_nss - 1] = he_mcs_mask[he_nss - 1]; in ath11k_peer_assoc_h_he()
2500 switch (sta->deflink.bandwidth) { in ath11k_peer_assoc_h_he()
2502 if (he_cap->he_cap_elem.phy_cap_info[0] & in ath11k_peer_assoc_h_he()
2504 v = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80p80); in ath11k_peer_assoc_h_he()
2506 arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80_80] = v; in ath11k_peer_assoc_h_he()
2508 v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_80p80); in ath11k_peer_assoc_h_he()
2509 arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80_80] = v; in ath11k_peer_assoc_h_he()
2511 arg->peer_he_mcs_count++; in ath11k_peer_assoc_h_he()
2514 v = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_160); in ath11k_peer_assoc_h_he()
2515 arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_160] = v; in ath11k_peer_assoc_h_he()
2517 v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_160); in ath11k_peer_assoc_h_he()
2519 arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_160] = v; in ath11k_peer_assoc_h_he()
2521 arg->peer_he_mcs_count++; in ath11k_peer_assoc_h_he()
2527 v = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80); in ath11k_peer_assoc_h_he()
2528 arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] = v; in ath11k_peer_assoc_h_he()
2530 v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_80); in ath11k_peer_assoc_h_he()
2532 arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] = v; in ath11k_peer_assoc_h_he()
2534 arg->peer_he_mcs_count++; in ath11k_peer_assoc_h_he()
2554 arg->peer_nss = min(sta->deflink.rx_nss, max_nss); in ath11k_peer_assoc_h_he()
2556 if (arg->peer_phymode == MODE_11AX_HE160 || in ath11k_peer_assoc_h_he()
2557 arg->peer_phymode == MODE_11AX_HE80_80) { in ath11k_peer_assoc_h_he()
2559 rx_nss = min(arg->peer_nss, tx_nss); in ath11k_peer_assoc_h_he()
2560 arg->peer_bw_rxnss_override = ATH11K_BW_NSS_MAP_ENABLE; in ath11k_peer_assoc_h_he()
2563 ath11k_warn(ar->ab, "invalid max_nss\n"); in ath11k_peer_assoc_h_he()
2567 if (arg->peer_phymode == MODE_11AX_HE160) in ath11k_peer_assoc_h_he()
2568 nss_160 = FIELD_PREP(ATH11K_PEER_RX_NSS_160MHZ, rx_nss - 1); in ath11k_peer_assoc_h_he()
2570 nss_160 = FIELD_PREP(ATH11K_PEER_RX_NSS_80_80MHZ, rx_nss - 1); in ath11k_peer_assoc_h_he()
2572 arg->peer_bw_rxnss_override |= nss_160; in ath11k_peer_assoc_h_he()
2575 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_peer_assoc_h_he()
2577 sta->addr, arg->peer_nss, in ath11k_peer_assoc_h_he()
2578 arg->peer_he_mcs_count, in ath11k_peer_assoc_h_he()
2579 arg->peer_bw_rxnss_override); in ath11k_peer_assoc_h_he()
2587 const struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap; in ath11k_peer_assoc_h_he_6ghz()
2595 band = def.chan->band; in ath11k_peer_assoc_h_he_6ghz()
2597 if (!arg->he_flag || band != NL80211_BAND_6GHZ || !sta->deflink.he_6ghz_capa.capa) in ath11k_peer_assoc_h_he_6ghz()
2600 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_peer_assoc_h_he_6ghz()
2601 arg->bw_40 = true; in ath11k_peer_assoc_h_he_6ghz()
2603 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) in ath11k_peer_assoc_h_he_6ghz()
2604 arg->bw_80 = true; in ath11k_peer_assoc_h_he_6ghz()
2606 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) in ath11k_peer_assoc_h_he_6ghz()
2607 arg->bw_160 = true; in ath11k_peer_assoc_h_he_6ghz()
2609 arg->peer_he_caps_6ghz = le16_to_cpu(sta->deflink.he_6ghz_capa.capa); in ath11k_peer_assoc_h_he_6ghz()
2610 arg->peer_mpdu_density = in ath11k_peer_assoc_h_he_6ghz()
2612 arg->peer_he_caps_6ghz)); in ath11k_peer_assoc_h_he_6ghz()
2614 /* From IEEE Std 802.11ax-2021 - Section 10.12.2: An HE STA shall be capable of in ath11k_peer_assoc_h_he_6ghz()
2615 * receiving A-MPDU where the A-MPDU pre-EOF padding length is up to the value in ath11k_peer_assoc_h_he_6ghz()
2616 * indicated by the Maximum A-MPDU Length Exponent Extension field in the HE in ath11k_peer_assoc_h_he_6ghz()
2617 * Capabilities element and the Maximum A-MPDU Length Exponent field in HE 6 GHz in ath11k_peer_assoc_h_he_6ghz()
2620 * Here, we are extracting the Max A-MPDU Exponent Extension from HE caps and in ath11k_peer_assoc_h_he_6ghz()
2621 * factor is the Maximum A-MPDU Length Exponent from HE 6 GHZ Band capability. in ath11k_peer_assoc_h_he_6ghz()
2624 he_cap->he_cap_elem.mac_cap_info[3]) + in ath11k_peer_assoc_h_he_6ghz()
2626 arg->peer_he_caps_6ghz); in ath11k_peer_assoc_h_he_6ghz()
2628 arg->peer_max_mpdu = (1u << (IEEE80211_HE_6GHZ_MAX_AMPDU_FACTOR + in ath11k_peer_assoc_h_he_6ghz()
2629 ampdu_factor)) - 1; in ath11k_peer_assoc_h_he_6ghz()
2635 const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; in ath11k_peer_assoc_h_smps()
2638 if (!ht_cap->ht_supported && !sta->deflink.he_6ghz_capa.capa) in ath11k_peer_assoc_h_smps()
2641 if (ht_cap->ht_supported) { in ath11k_peer_assoc_h_smps()
2642 smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS; in ath11k_peer_assoc_h_smps()
2645 smps = le16_get_bits(sta->deflink.he_6ghz_capa.capa, in ath11k_peer_assoc_h_smps()
2651 arg->static_mimops_flag = true; in ath11k_peer_assoc_h_smps()
2654 arg->dynamic_mimops_flag = true; in ath11k_peer_assoc_h_smps()
2657 arg->spatial_mux_flag = true; in ath11k_peer_assoc_h_smps()
2671 switch (arvif->vdev_type) { in ath11k_peer_assoc_h_qos()
2673 if (sta->wme) { in ath11k_peer_assoc_h_qos()
2675 arg->is_wme_set = true; in ath11k_peer_assoc_h_qos()
2676 arg->qos_flag = true; in ath11k_peer_assoc_h_qos()
2679 if (sta->wme && sta->uapsd_queues) { in ath11k_peer_assoc_h_qos()
2681 arg->is_wme_set = true; in ath11k_peer_assoc_h_qos()
2682 arg->apsd_flag = true; in ath11k_peer_assoc_h_qos()
2683 arg->peer_rate_caps |= WMI_HOST_RC_UAPSD_FLAG; in ath11k_peer_assoc_h_qos()
2687 if (sta->wme) { in ath11k_peer_assoc_h_qos()
2688 arg->is_wme_set = true; in ath11k_peer_assoc_h_qos()
2689 arg->qos_flag = true; in ath11k_peer_assoc_h_qos()
2696 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "peer %pM qos %d\n", in ath11k_peer_assoc_h_qos()
2697 sta->addr, arg->qos_flag); in ath11k_peer_assoc_h_qos()
2709 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_qos_ap()
2711 params.vdev_id = arvif->vdev_id; in ath11k_peer_assoc_qos_ap()
2713 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "uapsd_queues 0x%x max_sp %d\n", in ath11k_peer_assoc_qos_ap()
2714 sta->uapsd_queues, sta->max_sp); in ath11k_peer_assoc_qos_ap()
2717 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) in ath11k_peer_assoc_qos_ap()
2720 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VI) in ath11k_peer_assoc_qos_ap()
2723 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BK) in ath11k_peer_assoc_qos_ap()
2726 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BE) in ath11k_peer_assoc_qos_ap()
2731 if (sta->max_sp < MAX_WMI_AP_PS_PEER_PARAM_MAX_SP) in ath11k_peer_assoc_qos_ap()
2732 max_sp = sta->max_sp; in ath11k_peer_assoc_qos_ap()
2736 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, ¶ms); in ath11k_peer_assoc_qos_ap()
2742 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, ¶ms); in ath11k_peer_assoc_qos_ap()
2749 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, ¶ms); in ath11k_peer_assoc_qos_ap()
2755 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, ¶ms); in ath11k_peer_assoc_qos_ap()
2762 ath11k_warn(ar->ab, "failed to set ap ps peer param %d for vdev %i: %d\n", in ath11k_peer_assoc_qos_ap()
2763 params.param, arvif->vdev_id, ret); in ath11k_peer_assoc_qos_ap()
2769 return sta->deflink.supp_rates[NL80211_BAND_2GHZ] >> in ath11k_mac_sta_has_ofdm_only()
2776 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) { in ath11k_mac_get_phymode_vht()
2777 switch (sta->deflink.vht_cap.cap & in ath11k_mac_get_phymode_vht()
2789 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) in ath11k_mac_get_phymode_vht()
2792 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_mac_get_phymode_vht()
2795 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_20) in ath11k_mac_get_phymode_vht()
2804 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) { in ath11k_mac_get_phymode_he()
2805 if (sta->deflink.he_cap.he_cap_elem.phy_cap_info[0] & in ath11k_mac_get_phymode_he()
2808 else if (sta->deflink.he_cap.he_cap_elem.phy_cap_info[0] & in ath11k_mac_get_phymode_he()
2815 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) in ath11k_mac_get_phymode_he()
2818 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_mac_get_phymode_he()
2821 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_20) in ath11k_mac_get_phymode_he()
2843 band = def.chan->band; in ath11k_peer_assoc_h_phymode()
2844 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath11k_peer_assoc_h_phymode()
2845 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath11k_peer_assoc_h_phymode()
2846 he_mcs_mask = arvif->bitrate_mask.control[band].he_mcs; in ath11k_peer_assoc_h_phymode()
2850 if (sta->deflink.he_cap.has_he && in ath11k_peer_assoc_h_phymode()
2852 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) in ath11k_peer_assoc_h_phymode()
2854 else if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_peer_assoc_h_phymode()
2858 } else if (sta->deflink.vht_cap.vht_supported && in ath11k_peer_assoc_h_phymode()
2860 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_peer_assoc_h_phymode()
2864 } else if (sta->deflink.ht_cap.ht_supported && in ath11k_peer_assoc_h_phymode()
2866 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_peer_assoc_h_phymode()
2879 if (sta->deflink.he_cap.has_he && in ath11k_peer_assoc_h_phymode()
2882 } else if (sta->deflink.vht_cap.vht_supported && in ath11k_peer_assoc_h_phymode()
2885 } else if (sta->deflink.ht_cap.ht_supported && in ath11k_peer_assoc_h_phymode()
2887 if (sta->deflink.bandwidth >= IEEE80211_STA_RX_BW_40) in ath11k_peer_assoc_h_phymode()
2899 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "peer %pM phymode %s\n", in ath11k_peer_assoc_h_phymode()
2900 sta->addr, ath11k_wmi_phymode_str(phymode)); in ath11k_peer_assoc_h_phymode()
2902 arg->peer_phymode = phymode; in ath11k_peer_assoc_h_phymode()
2914 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_prepare()
2920 reinit_completion(&ar->peer_assoc_done); in ath11k_peer_assoc_prepare()
2922 arg->peer_new_assoc = !reassoc; in ath11k_peer_assoc_prepare()
2934 arsta->peer_nss = arg->peer_nss; in ath11k_peer_assoc_prepare()
2946 if (!ht_cap->ht_supported && !he_6ghz_capa) in ath11k_setup_peer_smps()
2949 if (ht_cap->ht_supported) { in ath11k_setup_peer_smps()
2950 smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS; in ath11k_setup_peer_smps()
2957 return -EINVAL; in ath11k_setup_peer_smps()
2959 return ath11k_wmi_set_peer_param(ar, addr, arvif->vdev_id, in ath11k_setup_peer_smps()
2966 struct ath11k *ar = arvif->ar; in ath11k_mac_set_he_txbf_conf()
2970 if (!arvif->vif->bss_conf.he_support) in ath11k_mac_set_he_txbf_conf()
2975 if (arvif->vif->bss_conf.he_su_beamformer) { in ath11k_mac_set_he_txbf_conf()
2977 if (arvif->vif->bss_conf.he_mu_beamformer && in ath11k_mac_set_he_txbf_conf()
2978 arvif->vdev_type == WMI_VDEV_TYPE_AP) in ath11k_mac_set_he_txbf_conf()
2982 if (arvif->vif->type != NL80211_IFTYPE_MESH_POINT) { in ath11k_mac_set_he_txbf_conf()
2986 if (arvif->vif->bss_conf.he_full_ul_mumimo) in ath11k_mac_set_he_txbf_conf()
2989 if (arvif->vif->bss_conf.he_su_beamformee) in ath11k_mac_set_he_txbf_conf()
2993 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, value); in ath11k_mac_set_he_txbf_conf()
2995 ath11k_warn(ar->ab, "failed to set vdev %d HE MU mode: %d\n", in ath11k_mac_set_he_txbf_conf()
2996 arvif->vdev_id, ret); in ath11k_mac_set_he_txbf_conf()
3004 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_he_txbf_conf()
3007 ath11k_warn(ar->ab, "failed to set vdev %d sounding mode: %d\n", in ath11k_mac_set_he_txbf_conf()
3008 arvif->vdev_id, ret); in ath11k_mac_set_he_txbf_conf()
3026 if (!vif->bss_conf.he_support) in ath11k_mac_vif_recalc_sta_he_txbf()
3029 if (vif->type != NL80211_IFTYPE_STATION) in ath11k_mac_vif_recalc_sta_he_txbf()
3035 if (def.chan->band == NL80211_BAND_2GHZ) in ath11k_mac_vif_recalc_sta_he_txbf()
3036 cap_band = &ar->mac.iftype[NL80211_BAND_2GHZ][vif->type].he_cap; in ath11k_mac_vif_recalc_sta_he_txbf()
3038 cap_band = &ar->mac.iftype[NL80211_BAND_5GHZ][vif->type].he_cap; in ath11k_mac_vif_recalc_sta_he_txbf()
3040 memcpy(&he_cap_elem, &cap_band->he_cap_elem, sizeof(he_cap_elem)); in ath11k_mac_vif_recalc_sta_he_txbf()
3043 if (HECAP_PHY_SUBFMR_GET(he_cap->he_cap_elem.phy_cap_info)) in ath11k_mac_vif_recalc_sta_he_txbf()
3045 if (HECAP_PHY_MUBFMR_GET(he_cap->he_cap_elem.phy_cap_info)) in ath11k_mac_vif_recalc_sta_he_txbf()
3049 if (vif->type != NL80211_IFTYPE_MESH_POINT) { in ath11k_mac_vif_recalc_sta_he_txbf()
3054 if (HECAP_PHY_ULMUMIMO_GET(he_cap->he_cap_elem.phy_cap_info)) in ath11k_mac_vif_recalc_sta_he_txbf()
3065 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, hemode); in ath11k_mac_vif_recalc_sta_he_txbf()
3067 ath11k_warn(ar->ab, "failed to submit vdev param txbf 0x%x: %d\n", in ath11k_mac_vif_recalc_sta_he_txbf()
3079 struct ath11k *ar = hw->priv; in ath11k_bss_assoc()
3088 lockdep_assert_held(&ar->conf_mutex); in ath11k_bss_assoc()
3090 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %i assoc bssid %pM aid %d\n", in ath11k_bss_assoc()
3091 arvif->vdev_id, arvif->bssid, arvif->aid); in ath11k_bss_assoc()
3095 ap_sta = ieee80211_find_sta(vif, bss_conf->bssid); in ath11k_bss_assoc()
3097 ath11k_warn(ar->ab, "failed to find station entry for bss %pM vdev %i\n", in ath11k_bss_assoc()
3098 bss_conf->bssid, arvif->vdev_id); in ath11k_bss_assoc()
3103 /* he_cap here is updated at assoc success for sta mode only */ in ath11k_bss_assoc()
3104 he_cap = ap_sta->deflink.he_cap; in ath11k_bss_assoc()
3111 ath11k_warn(ar->ab, "failed to recalc he txbf for vdev %i on bss %pM\n", in ath11k_bss_assoc()
3112 arvif->vdev_id, bss_conf->bssid); in ath11k_bss_assoc()
3120 ath11k_warn(ar->ab, "failed to run peer assoc for %pM vdev %i: %d\n", in ath11k_bss_assoc()
3121 bss_conf->bssid, arvif->vdev_id, ret); in ath11k_bss_assoc()
3125 if (!wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) { in ath11k_bss_assoc()
3126 ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n", in ath11k_bss_assoc()
3127 bss_conf->bssid, arvif->vdev_id); in ath11k_bss_assoc()
3131 ret = ath11k_setup_peer_smps(ar, arvif, bss_conf->bssid, in ath11k_bss_assoc()
3132 &ap_sta->deflink.ht_cap, in ath11k_bss_assoc()
3133 le16_to_cpu(ap_sta->deflink.he_6ghz_capa.capa)); in ath11k_bss_assoc()
3135 ath11k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n", in ath11k_bss_assoc()
3136 arvif->vdev_id, ret); in ath11k_bss_assoc()
3140 WARN_ON(arvif->is_up); in ath11k_bss_assoc()
3142 arvif->aid = vif->cfg.aid; in ath11k_bss_assoc()
3143 ether_addr_copy(arvif->bssid, bss_conf->bssid); in ath11k_bss_assoc()
3145 ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid, in ath11k_bss_assoc()
3148 ath11k_warn(ar->ab, "failed to set vdev %d up: %d\n", in ath11k_bss_assoc()
3149 arvif->vdev_id, ret); in ath11k_bss_assoc()
3153 arvif->is_up = true; in ath11k_bss_assoc()
3154 arvif->rekey_data.enable_offload = false; in ath11k_bss_assoc()
3156 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_bss_assoc()
3158 arvif->vdev_id, bss_conf->bssid, vif->cfg.aid); in ath11k_bss_assoc()
3160 spin_lock_bh(&ar->ab->base_lock); in ath11k_bss_assoc()
3162 peer = ath11k_peer_find(ar->ab, arvif->vdev_id, arvif->bssid); in ath11k_bss_assoc()
3163 if (peer && peer->is_authorized) in ath11k_bss_assoc()
3166 spin_unlock_bh(&ar->ab->base_lock); in ath11k_bss_assoc()
3169 ret = ath11k_wmi_set_peer_param(ar, arvif->bssid, in ath11k_bss_assoc()
3170 arvif->vdev_id, in ath11k_bss_assoc()
3174 ath11k_warn(ar->ab, "Unable to authorize BSS peer: %d\n", ret); in ath11k_bss_assoc()
3177 ret = ath11k_wmi_send_obss_spr_cmd(ar, arvif->vdev_id, in ath11k_bss_assoc()
3178 &bss_conf->he_obss_pd); in ath11k_bss_assoc()
3180 ath11k_warn(ar->ab, "failed to set vdev %i OBSS PD parameters: %d\n", in ath11k_bss_assoc()
3181 arvif->vdev_id, ret); in ath11k_bss_assoc()
3183 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_bss_assoc()
3187 ath11k_warn(ar->ab, "failed to set vdev %d dtim policy: %d\n", in ath11k_bss_assoc()
3188 arvif->vdev_id, ret); in ath11k_bss_assoc()
3190 ath11k_mac_11d_scan_stop_all(ar->ab); in ath11k_bss_assoc()
3196 struct ath11k *ar = hw->priv; in ath11k_bss_disassoc()
3200 lockdep_assert_held(&ar->conf_mutex); in ath11k_bss_disassoc()
3202 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %i disassoc bssid %pM\n", in ath11k_bss_disassoc()
3203 arvif->vdev_id, arvif->bssid); in ath11k_bss_disassoc()
3205 ret = ath11k_wmi_vdev_down(ar, arvif->vdev_id); in ath11k_bss_disassoc()
3207 ath11k_warn(ar->ab, "failed to down vdev %i: %d\n", in ath11k_bss_disassoc()
3208 arvif->vdev_id, ret); in ath11k_bss_disassoc()
3210 arvif->is_up = false; in ath11k_bss_disassoc()
3212 memset(&arvif->rekey_data, 0, sizeof(arvif->rekey_data)); in ath11k_bss_disassoc()
3214 cancel_delayed_work_sync(&arvif->connection_loss_work); in ath11k_bss_disassoc()
3239 return -EINVAL; in ath11k_mac_get_rate_hw_value()
3254 lockdep_assert_held(&ar->conf_mutex); in ath11k_recalculate_mgmt_rate()
3256 sband = ar->hw->wiphy->bands[def->chan->band]; in ath11k_recalculate_mgmt_rate()
3257 basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; in ath11k_recalculate_mgmt_rate()
3258 bitrate = sband->bitrates[basic_rate_idx].bitrate; in ath11k_recalculate_mgmt_rate()
3262 ath11k_warn(ar->ab, "bitrate not supported %d\n", bitrate); in ath11k_recalculate_mgmt_rate()
3267 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, vdev_param, in ath11k_recalculate_mgmt_rate()
3270 ath11k_warn(ar->ab, "failed to set mgmt tx rate %d\n", ret); in ath11k_recalculate_mgmt_rate()
3275 ar->hw_rate_code = hw_rate_code; in ath11k_recalculate_mgmt_rate()
3278 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, vdev_param, in ath11k_recalculate_mgmt_rate()
3281 ath11k_warn(ar->ab, "failed to set beacon tx rate %d\n", ret); in ath11k_recalculate_mgmt_rate()
3287 struct ath11k *ar = arvif->ar; in ath11k_mac_fils_discovery()
3293 if (info->fils_discovery.max_interval) { in ath11k_mac_fils_discovery()
3294 interval = info->fils_discovery.max_interval; in ath11k_mac_fils_discovery()
3296 tmpl = ieee80211_get_fils_discovery_tmpl(ar->hw, arvif->vif); in ath11k_mac_fils_discovery()
3298 ret = ath11k_wmi_fils_discovery_tmpl(ar, arvif->vdev_id, in ath11k_mac_fils_discovery()
3300 } else if (info->unsol_bcast_probe_resp_interval) { in ath11k_mac_fils_discovery()
3302 interval = info->unsol_bcast_probe_resp_interval; in ath11k_mac_fils_discovery()
3304 tmpl = ieee80211_get_unsol_bcast_probe_resp_tmpl(ar->hw, in ath11k_mac_fils_discovery()
3305 arvif->vif); in ath11k_mac_fils_discovery()
3307 ret = ath11k_wmi_probe_resp_tmpl(ar, arvif->vdev_id, in ath11k_mac_fils_discovery()
3310 return ath11k_wmi_fils_discovery(ar, arvif->vdev_id, 0, false); in ath11k_mac_fils_discovery()
3314 ath11k_warn(ar->ab, in ath11k_mac_fils_discovery()
3316 arvif->vdev_id, (unsol_bcast_probe_resp_enabled ? in ath11k_mac_fils_discovery()
3319 return -EPERM; in ath11k_mac_fils_discovery()
3324 ret = ath11k_wmi_fils_discovery(ar, arvif->vdev_id, interval, in ath11k_mac_fils_discovery()
3337 pdev_id = ar->pdev->pdev_id; in ath11k_mac_config_obss_pd()
3339 /* Set and enable SRG/non-SRG OBSS PD Threshold */ in ath11k_mac_config_obss_pd()
3341 if (test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags)) { in ath11k_mac_config_obss_pd()
3344 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3350 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_config_obss_pd()
3352 he_obss_pd->sr_ctrl, he_obss_pd->non_srg_max_offset, in ath11k_mac_config_obss_pd()
3353 he_obss_pd->max_offset); in ath11k_mac_config_obss_pd()
3357 if (he_obss_pd->sr_ctrl & in ath11k_mac_config_obss_pd()
3361 if (he_obss_pd->sr_ctrl & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT) in ath11k_mac_config_obss_pd()
3363 he_obss_pd->non_srg_max_offset); in ath11k_mac_config_obss_pd()
3370 if (he_obss_pd->sr_ctrl & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT) { in ath11k_mac_config_obss_pd()
3371 srg_th = ATH11K_OBSS_PD_MAX_THRESHOLD + he_obss_pd->max_offset; in ath11k_mac_config_obss_pd()
3376 ar->ab->wmi_ab.svc_map)) { in ath11k_mac_config_obss_pd()
3380 non_srg_th -= ATH11K_DEFAULT_NOISE_FLOOR; in ath11k_mac_config_obss_pd()
3389 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3400 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3408 param_val = !!(he_obss_pd->sr_ctrl & in ath11k_mac_config_obss_pd()
3412 ath11k_warn(ar->ab, "failed to set sr_prohibit for pdev: %u\n", in ath11k_mac_config_obss_pd()
3418 ar->ab->wmi_ab.svc_map)) in ath11k_mac_config_obss_pd()
3422 memcpy(bitmap, he_obss_pd->bss_color_bitmap, sizeof(bitmap)); in ath11k_mac_config_obss_pd()
3425 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3432 memcpy(bitmap, he_obss_pd->partial_bssid_bitmap, sizeof(bitmap)); in ath11k_mac_config_obss_pd()
3435 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3446 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3455 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3461 /* Enable all BSS Colors for non-SRG */ in ath11k_mac_config_obss_pd()
3464 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3470 /* Enable all partial BSSID mask for non-SRG */ in ath11k_mac_config_obss_pd()
3473 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3487 test_bit(WMI_TLV_SERVICE_EXT_TPC_REG_SUPPORT, ar->ab->wmi_ab.svc_map) && in ath11k_mac_supports_station_tpc()
3488 arvif->vdev_type == WMI_VDEV_TYPE_STA && in ath11k_mac_supports_station_tpc()
3489 arvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE && in ath11k_mac_supports_station_tpc()
3490 chandef->chan && in ath11k_mac_supports_station_tpc()
3491 chandef->chan->band == NL80211_BAND_6GHZ; in ath11k_mac_supports_station_tpc()
3499 struct ath11k *ar = hw->priv; in ath11k_mac_op_bss_info_changed()
3514 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_bss_info_changed()
3517 arvif->beacon_interval = info->beacon_int; in ath11k_mac_op_bss_info_changed()
3520 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3522 arvif->beacon_interval); in ath11k_mac_op_bss_info_changed()
3524 ath11k_warn(ar->ab, "Failed to set beacon interval for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
3525 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3527 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3529 arvif->beacon_interval, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3536 param_value, ar->pdev->pdev_id); in ath11k_mac_op_bss_info_changed()
3538 ath11k_warn(ar->ab, "Failed to set beacon mode for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
3539 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3541 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3543 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3545 if (!arvif->do_not_send_tmpl || !arvif->bcca_zero_sent) { in ath11k_mac_op_bss_info_changed()
3548 ath11k_warn(ar->ab, "failed to update bcn template: %d\n", in ath11k_mac_op_bss_info_changed()
3552 if (arvif->bcca_zero_sent) in ath11k_mac_op_bss_info_changed()
3553 arvif->do_not_send_tmpl = true; in ath11k_mac_op_bss_info_changed()
3555 arvif->do_not_send_tmpl = false; in ath11k_mac_op_bss_info_changed()
3557 if (vif->bss_conf.he_support) { in ath11k_mac_op_bss_info_changed()
3558 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3562 ath11k_warn(ar->ab, in ath11k_mac_op_bss_info_changed()
3564 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3566 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3568 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3573 arvif->dtim_period = info->dtim_period; in ath11k_mac_op_bss_info_changed()
3576 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3578 arvif->dtim_period); in ath11k_mac_op_bss_info_changed()
3581 ath11k_warn(ar->ab, "Failed to set dtim period for VDEV %d: %i\n", in ath11k_mac_op_bss_info_changed()
3582 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3584 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3586 arvif->dtim_period, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3590 vif->type == NL80211_IFTYPE_AP) { in ath11k_mac_op_bss_info_changed()
3591 arvif->u.ap.ssid_len = vif->cfg.ssid_len; in ath11k_mac_op_bss_info_changed()
3592 if (vif->cfg.ssid_len) in ath11k_mac_op_bss_info_changed()
3593 memcpy(arvif->u.ap.ssid, vif->cfg.ssid, in ath11k_mac_op_bss_info_changed()
3594 vif->cfg.ssid_len); in ath11k_mac_op_bss_info_changed()
3595 arvif->u.ap.hidden_ssid = info->hidden_ssid; in ath11k_mac_op_bss_info_changed()
3598 if (changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) in ath11k_mac_op_bss_info_changed()
3599 ether_addr_copy(arvif->bssid, info->bssid); in ath11k_mac_op_bss_info_changed()
3602 if (info->enable_beacon) in ath11k_mac_op_bss_info_changed()
3606 if (arvif->is_up && vif->bss_conf.he_support && in ath11k_mac_op_bss_info_changed()
3607 vif->bss_conf.he_oper.params) { in ath11k_mac_op_bss_info_changed()
3609 param_value = vif->bss_conf.he_oper.params; in ath11k_mac_op_bss_info_changed()
3610 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3612 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3614 param_value, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3617 ath11k_warn(ar->ab, "Failed to set he oper params %x for VDEV %d: %i\n", in ath11k_mac_op_bss_info_changed()
3618 param_value, arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3625 cts_prot = !!(info->use_cts_prot); in ath11k_mac_op_bss_info_changed()
3628 if (arvif->is_started) { in ath11k_mac_op_bss_info_changed()
3629 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3632 ath11k_warn(ar->ab, "Failed to set CTS prot for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
3633 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3635 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "Set CTS prot: %d for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
3636 cts_prot, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3638 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "defer protection mode setup, vdev is not ready yet\n"); in ath11k_mac_op_bss_info_changed()
3645 if (info->use_short_slot) in ath11k_mac_op_bss_info_changed()
3652 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3655 ath11k_warn(ar->ab, "Failed to set erp slot for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
3656 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3658 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3660 slottime, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3666 if (info->use_short_preamble) in ath11k_mac_op_bss_info_changed()
3672 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3675 ath11k_warn(ar->ab, "Failed to set preamble for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
3676 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3678 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3680 preamble, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3684 if (vif->cfg.assoc) in ath11k_mac_op_bss_info_changed()
3691 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev_id %i txpower %d\n", in ath11k_mac_op_bss_info_changed()
3692 arvif->vdev_id, info->txpower); in ath11k_mac_op_bss_info_changed()
3693 arvif->txpower = info->txpower; in ath11k_mac_op_bss_info_changed()
3698 ar->ab->hw_params.supports_sta_ps) { in ath11k_mac_op_bss_info_changed()
3699 arvif->ps = vif->cfg.ps; in ath11k_mac_op_bss_info_changed()
3703 ath11k_warn(ar->ab, "failed to setup ps on vdev %i: %d\n", in ath11k_mac_op_bss_info_changed()
3704 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3708 !ath11k_mac_vif_chan(arvif->vif, &def)) { in ath11k_mac_op_bss_info_changed()
3709 band = def.chan->band; in ath11k_mac_op_bss_info_changed()
3710 mcast_rate = vif->bss_conf.mcast_rate[band]; in ath11k_mac_op_bss_info_changed()
3713 rateidx = mcast_rate - 1; in ath11k_mac_op_bss_info_changed()
3715 rateidx = ffs(vif->bss_conf.basic_rates) - 1; in ath11k_mac_op_bss_info_changed()
3717 if (ar->pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) in ath11k_mac_op_bss_info_changed()
3730 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3732 arvif->vdev_id, rate); in ath11k_mac_op_bss_info_changed()
3735 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3738 ath11k_warn(ar->ab, in ath11k_mac_op_bss_info_changed()
3740 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3743 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3746 ath11k_warn(ar->ab, in ath11k_mac_op_bss_info_changed()
3748 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3752 !ath11k_mac_vif_chan(arvif->vif, &def)) in ath11k_mac_op_bss_info_changed()
3758 if (info->twt_requester || info->twt_responder) { in ath11k_mac_op_bss_info_changed()
3760 ath11k_wmi_send_twt_enable_cmd(ar, ar->pdev->pdev_id, in ath11k_mac_op_bss_info_changed()
3763 ath11k_wmi_send_twt_disable_cmd(ar, ar->pdev->pdev_id); in ath11k_mac_op_bss_info_changed()
3768 ath11k_mac_config_obss_pd(ar, &info->he_obss_pd); in ath11k_mac_op_bss_info_changed()
3771 if (vif->type == NL80211_IFTYPE_AP) { in ath11k_mac_op_bss_info_changed()
3773 ar, arvif->vdev_id, info->he_bss_color.color, in ath11k_mac_op_bss_info_changed()
3775 info->he_bss_color.enabled); in ath11k_mac_op_bss_info_changed()
3777 ath11k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n", in ath11k_mac_op_bss_info_changed()
3778 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3781 if (info->he_bss_color.enabled) in ath11k_mac_op_bss_info_changed()
3782 param_value = info->he_bss_color.color << in ath11k_mac_op_bss_info_changed()
3787 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3791 ath11k_warn(ar->ab, in ath11k_mac_op_bss_info_changed()
3793 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3795 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3797 param_value, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3798 } else if (vif->type == NL80211_IFTYPE_STATION) { in ath11k_mac_op_bss_info_changed()
3800 arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3803 ath11k_warn(ar->ab, "failed to enable bss color change on vdev %i: %d\n", in ath11k_mac_op_bss_info_changed()
3804 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3806 ar, arvif->vdev_id, 0, in ath11k_mac_op_bss_info_changed()
3809 ath11k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n", in ath11k_mac_op_bss_info_changed()
3810 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3815 arvif->ftm_responder != info->ftm_responder && in ath11k_mac_op_bss_info_changed()
3816 test_bit(WMI_TLV_SERVICE_RTT, ar->ab->wmi_ab.svc_map) && in ath11k_mac_op_bss_info_changed()
3817 (vif->type == NL80211_IFTYPE_AP || in ath11k_mac_op_bss_info_changed()
3818 vif->type == NL80211_IFTYPE_MESH_POINT)) { in ath11k_mac_op_bss_info_changed()
3819 arvif->ftm_responder = info->ftm_responder; in ath11k_mac_op_bss_info_changed()
3821 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, in ath11k_mac_op_bss_info_changed()
3822 arvif->ftm_responder); in ath11k_mac_op_bss_info_changed()
3824 ath11k_warn(ar->ab, "Failed to set ftm responder %i: %d\n", in ath11k_mac_op_bss_info_changed()
3825 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3833 ipv4_cnt = min(vif->cfg.arp_addr_cnt, ATH11K_IPV4_MAX_COUNT); in ath11k_mac_op_bss_info_changed()
3834 memcpy(arvif->arp_ns_offload.ipv4_addr, in ath11k_mac_op_bss_info_changed()
3835 vif->cfg.arp_addr_list, in ath11k_mac_op_bss_info_changed()
3837 memcpy(arvif->arp_ns_offload.mac_addr, vif->addr, ETH_ALEN); in ath11k_mac_op_bss_info_changed()
3838 arvif->arp_ns_offload.ipv4_count = ipv4_cnt; in ath11k_mac_op_bss_info_changed()
3840 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "arp_addr_cnt %d vif->addr %pM, offload_addr %pI4\n", in ath11k_mac_op_bss_info_changed()
3841 vif->cfg.arp_addr_cnt, in ath11k_mac_op_bss_info_changed()
3842 vif->addr, arvif->arp_ns_offload.ipv4_addr); in ath11k_mac_op_bss_info_changed()
3845 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_bss_info_changed()
3850 lockdep_assert_held(&ar->data_lock); in __ath11k_mac_scan_finish()
3852 switch (ar->scan.state) { in __ath11k_mac_scan_finish()
3857 if (ar->scan.is_roc && ar->scan.roc_notify) in __ath11k_mac_scan_finish()
3858 ieee80211_remain_on_channel_expired(ar->hw); in __ath11k_mac_scan_finish()
3861 if (!ar->scan.is_roc) { in __ath11k_mac_scan_finish()
3863 .aborted = ((ar->scan.state == in __ath11k_mac_scan_finish()
3865 (ar->scan.state == in __ath11k_mac_scan_finish()
3869 ieee80211_scan_completed(ar->hw, &info); in __ath11k_mac_scan_finish()
3872 ar->scan.state = ATH11K_SCAN_IDLE; in __ath11k_mac_scan_finish()
3873 ar->scan_channel = NULL; in __ath11k_mac_scan_finish()
3874 ar->scan.roc_freq = 0; in __ath11k_mac_scan_finish()
3875 cancel_delayed_work(&ar->scan.timeout); in __ath11k_mac_scan_finish()
3876 complete_all(&ar->scan.completed); in __ath11k_mac_scan_finish()
3883 spin_lock_bh(&ar->data_lock); in ath11k_mac_scan_finish()
3885 spin_unlock_bh(&ar->data_lock); in ath11k_mac_scan_finish()
3896 lockdep_assert_held(&ar->conf_mutex); in ath11k_scan_stop()
3899 arg.pdev_id = ar->pdev->pdev_id; in ath11k_scan_stop()
3903 ath11k_warn(ar->ab, "failed to stop wmi scan: %d\n", ret); in ath11k_scan_stop()
3907 ret = wait_for_completion_timeout(&ar->scan.completed, 3 * HZ); in ath11k_scan_stop()
3909 ath11k_warn(ar->ab, in ath11k_scan_stop()
3911 ret = -ETIMEDOUT; in ath11k_scan_stop()
3924 spin_lock_bh(&ar->data_lock); in ath11k_scan_stop()
3925 if (ar->scan.state != ATH11K_SCAN_IDLE) in ath11k_scan_stop()
3927 spin_unlock_bh(&ar->data_lock); in ath11k_scan_stop()
3936 lockdep_assert_held(&ar->conf_mutex); in ath11k_scan_abort()
3938 spin_lock_bh(&ar->data_lock); in ath11k_scan_abort()
3940 switch (ar->scan.state) { in ath11k_scan_abort()
3948 ath11k_warn(ar->ab, "refusing scan abortion due to invalid scan state: %d\n", in ath11k_scan_abort()
3949 ar->scan.state); in ath11k_scan_abort()
3952 ar->scan.state = ATH11K_SCAN_ABORTING; in ath11k_scan_abort()
3953 spin_unlock_bh(&ar->data_lock); in ath11k_scan_abort()
3957 ath11k_warn(ar->ab, "failed to abort scan: %d\n", ret); in ath11k_scan_abort()
3959 spin_lock_bh(&ar->data_lock); in ath11k_scan_abort()
3963 spin_unlock_bh(&ar->data_lock); in ath11k_scan_abort()
3971 mutex_lock(&ar->conf_mutex); in ath11k_scan_timeout_work()
3973 mutex_unlock(&ar->conf_mutex); in ath11k_scan_timeout_work()
3982 lockdep_assert_held(&ar->conf_mutex); in ath11k_start_scan()
3991 if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map)) { in ath11k_start_scan()
3994 if (ar->supports_6ghz) in ath11k_start_scan()
3998 ret = wait_for_completion_timeout(&ar->scan.started, timeout); in ath11k_start_scan()
4002 ath11k_warn(ar->ab, "failed to stop scan: %d\n", ret); in ath11k_start_scan()
4004 return -ETIMEDOUT; in ath11k_start_scan()
4011 spin_lock_bh(&ar->data_lock); in ath11k_start_scan()
4012 if (ar->scan.state == ATH11K_SCAN_IDLE) { in ath11k_start_scan()
4013 spin_unlock_bh(&ar->data_lock); in ath11k_start_scan()
4014 return -EINVAL; in ath11k_start_scan()
4016 spin_unlock_bh(&ar->data_lock); in ath11k_start_scan()
4025 struct ath11k *ar = hw->priv; in ath11k_mac_op_hw_scan()
4027 struct cfg80211_scan_request *req = &hw_req->req; in ath11k_mac_op_hw_scan()
4040 if (ar->state_11d == ATH11K_11D_PREPARING && in ath11k_mac_op_hw_scan()
4042 ar->ab->wmi_ab.svc_map)) in ath11k_mac_op_hw_scan()
4043 ath11k_mac_11d_scan_start(ar, arvif->vdev_id); in ath11k_mac_op_hw_scan()
4045 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_hw_scan()
4047 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
4048 switch (ar->scan.state) { in ath11k_mac_op_hw_scan()
4050 reinit_completion(&ar->scan.started); in ath11k_mac_op_hw_scan()
4051 reinit_completion(&ar->scan.completed); in ath11k_mac_op_hw_scan()
4052 ar->scan.state = ATH11K_SCAN_STARTING; in ath11k_mac_op_hw_scan()
4053 ar->scan.is_roc = false; in ath11k_mac_op_hw_scan()
4054 ar->scan.vdev_id = arvif->vdev_id; in ath11k_mac_op_hw_scan()
4060 ret = -EBUSY; in ath11k_mac_op_hw_scan()
4063 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
4071 ret = -ENOMEM; in ath11k_mac_op_hw_scan()
4076 arg->vdev_id = arvif->vdev_id; in ath11k_mac_op_hw_scan()
4077 arg->scan_id = ATH11K_SCAN_ID; in ath11k_mac_op_hw_scan()
4079 if (ar->ab->hw_params.single_pdev_only) in ath11k_mac_op_hw_scan()
4080 arg->scan_f_filter_prb_req = 1; in ath11k_mac_op_hw_scan()
4082 if (req->ie_len) { in ath11k_mac_op_hw_scan()
4083 arg->extraie.ptr = kmemdup(req->ie, req->ie_len, GFP_KERNEL); in ath11k_mac_op_hw_scan()
4084 if (!arg->extraie.ptr) { in ath11k_mac_op_hw_scan()
4085 ret = -ENOMEM; in ath11k_mac_op_hw_scan()
4088 arg->extraie.len = req->ie_len; in ath11k_mac_op_hw_scan()
4091 if (req->n_ssids) { in ath11k_mac_op_hw_scan()
4092 arg->num_ssids = req->n_ssids; in ath11k_mac_op_hw_scan()
4093 for (i = 0; i < arg->num_ssids; i++) { in ath11k_mac_op_hw_scan()
4094 arg->ssid[i].length = req->ssids[i].ssid_len; in ath11k_mac_op_hw_scan()
4095 memcpy(&arg->ssid[i].ssid, req->ssids[i].ssid, in ath11k_mac_op_hw_scan()
4096 req->ssids[i].ssid_len); in ath11k_mac_op_hw_scan()
4099 arg->scan_f_passive = 1; in ath11k_mac_op_hw_scan()
4102 if (req->n_channels) { in ath11k_mac_op_hw_scan()
4103 arg->num_chan = req->n_channels; in ath11k_mac_op_hw_scan()
4104 arg->chan_list = kcalloc(arg->num_chan, sizeof(*arg->chan_list), in ath11k_mac_op_hw_scan()
4107 if (!arg->chan_list) { in ath11k_mac_op_hw_scan()
4108 ret = -ENOMEM; in ath11k_mac_op_hw_scan()
4112 for (i = 0; i < arg->num_chan; i++) { in ath11k_mac_op_hw_scan()
4114 ar->ab->wmi_ab.svc_map)) { in ath11k_mac_op_hw_scan()
4115 arg->chan_list[i] = in ath11k_mac_op_hw_scan()
4116 u32_encode_bits(req->channels[i]->center_freq, in ath11k_mac_op_hw_scan()
4121 * those non-PSC channels where RNR IE is found during in ath11k_mac_op_hw_scan()
4126 if (req->channels[i]->band == NL80211_BAND_6GHZ && in ath11k_mac_op_hw_scan()
4127 req->flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ && in ath11k_mac_op_hw_scan()
4128 !cfg80211_channel_is_psc(req->channels[i])) in ath11k_mac_op_hw_scan()
4129 arg->chan_list[i] |= in ath11k_mac_op_hw_scan()
4132 arg->chan_list[i] = req->channels[i]->center_freq; in ath11k_mac_op_hw_scan()
4137 if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { in ath11k_mac_op_hw_scan()
4138 arg->scan_f_add_spoofed_mac_in_probe = 1; in ath11k_mac_op_hw_scan()
4139 ether_addr_copy(arg->mac_addr.addr, req->mac_addr); in ath11k_mac_op_hw_scan()
4140 ether_addr_copy(arg->mac_mask.addr, req->mac_addr_mask); in ath11k_mac_op_hw_scan()
4144 if (req->duration) { in ath11k_mac_op_hw_scan()
4145 arg->dwell_time_active = req->duration; in ath11k_mac_op_hw_scan()
4146 arg->dwell_time_active_2g = req->duration; in ath11k_mac_op_hw_scan()
4147 arg->dwell_time_active_6g = req->duration; in ath11k_mac_op_hw_scan()
4148 arg->dwell_time_passive = req->duration; in ath11k_mac_op_hw_scan()
4149 arg->dwell_time_passive_6g = req->duration; in ath11k_mac_op_hw_scan()
4150 arg->burst_duration = req->duration; in ath11k_mac_op_hw_scan()
4152 scan_timeout = min_t(u32, arg->max_rest_time * in ath11k_mac_op_hw_scan()
4153 (arg->num_chan - 1) + (req->duration + in ath11k_mac_op_hw_scan()
4155 arg->num_chan, arg->max_scan_time); in ath11k_mac_op_hw_scan()
4157 scan_timeout = arg->max_scan_time; in ath11k_mac_op_hw_scan()
4165 ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret); in ath11k_mac_op_hw_scan()
4166 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
4167 ar->scan.state = ATH11K_SCAN_IDLE; in ath11k_mac_op_hw_scan()
4168 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
4171 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath11k_mac_op_hw_scan()
4176 kfree(arg->chan_list); in ath11k_mac_op_hw_scan()
4177 kfree(arg->extraie.ptr); in ath11k_mac_op_hw_scan()
4181 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_hw_scan()
4183 if (ar->state_11d == ATH11K_11D_PREPARING) in ath11k_mac_op_hw_scan()
4184 ath11k_mac_11d_scan_start(ar, arvif->vdev_id); in ath11k_mac_op_hw_scan()
4192 struct ath11k *ar = hw->priv; in ath11k_mac_op_cancel_hw_scan()
4194 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_cancel_hw_scan()
4196 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_cancel_hw_scan()
4198 cancel_delayed_work_sync(&ar->scan.timeout); in ath11k_mac_op_cancel_hw_scan()
4207 struct ath11k *ar = arvif->ar; in ath11k_install_key()
4209 .vdev_id = arvif->vdev_id, in ath11k_install_key()
4210 .key_idx = key->keyidx, in ath11k_install_key()
4211 .key_len = key->keylen, in ath11k_install_key()
4212 .key_data = key->key, in ath11k_install_key()
4217 lockdep_assert_held(&arvif->ar->conf_mutex); in ath11k_install_key()
4219 reinit_completion(&ar->install_key_done); in ath11k_install_key()
4221 if (test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ar->ab->dev_flags)) in ath11k_install_key()
4230 switch (key->cipher) { in ath11k_install_key()
4234 /* TODO: Re-check if flag is valid */ in ath11k_install_key()
4235 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; in ath11k_install_key()
4245 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; in ath11k_install_key()
4248 ath11k_warn(ar->ab, "cipher %d is not supported\n", key->cipher); in ath11k_install_key()
4249 return -EOPNOTSUPP; in ath11k_install_key()
4252 if (test_bit(ATH11K_FLAG_RAW_MODE, &ar->ab->dev_flags)) in ath11k_install_key()
4253 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV | in ath11k_install_key()
4257 ret = ath11k_wmi_vdev_install_key(arvif->ar, &arg); in ath11k_install_key()
4262 if (!wait_for_completion_timeout(&ar->install_key_done, 1 * HZ)) in ath11k_install_key()
4263 return -ETIMEDOUT; in ath11k_install_key()
4265 return ar->install_key_status ? -EINVAL : 0; in ath11k_install_key()
4271 struct ath11k *ar = arvif->ar; in ath11k_clear_peer_keys()
4272 struct ath11k_base *ab = ar->ab; in ath11k_clear_peer_keys()
4279 lockdep_assert_held(&ar->conf_mutex); in ath11k_clear_peer_keys()
4281 spin_lock_bh(&ab->base_lock); in ath11k_clear_peer_keys()
4282 peer = ath11k_peer_find(ab, arvif->vdev_id, addr); in ath11k_clear_peer_keys()
4283 spin_unlock_bh(&ab->base_lock); in ath11k_clear_peer_keys()
4286 return -ENOENT; in ath11k_clear_peer_keys()
4288 for (i = 0; i < ARRAY_SIZE(peer->keys); i++) { in ath11k_clear_peer_keys()
4289 if (!peer->keys[i]) in ath11k_clear_peer_keys()
4293 ret = ath11k_install_key(arvif, peer->keys[i], in ath11k_clear_peer_keys()
4302 spin_lock_bh(&ab->base_lock); in ath11k_clear_peer_keys()
4303 peer->keys[i] = NULL; in ath11k_clear_peer_keys()
4304 spin_unlock_bh(&ab->base_lock); in ath11k_clear_peer_keys()
4314 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_key()
4315 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_set_key()
4324 if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || in ath11k_mac_op_set_key()
4325 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || in ath11k_mac_op_set_key()
4326 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 || in ath11k_mac_op_set_key()
4327 key->cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256) in ath11k_mac_op_set_key()
4330 if (test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ar->ab->dev_flags)) in ath11k_mac_op_set_key()
4333 if (key->keyidx > WMI_MAX_KEY_INDEX) in ath11k_mac_op_set_key()
4334 return -ENOSPC; in ath11k_mac_op_set_key()
4336 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_key()
4339 peer_addr = sta->addr; in ath11k_mac_op_set_key()
4340 else if (arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath11k_mac_op_set_key()
4341 peer_addr = vif->bss_conf.bssid; in ath11k_mac_op_set_key()
4343 peer_addr = vif->addr; in ath11k_mac_op_set_key()
4345 key->hw_key_idx = key->keyidx; in ath11k_mac_op_set_key()
4347 /* the peer should not disappear in mid-way (unless FW goes awry) since in ath11k_mac_op_set_key()
4350 spin_lock_bh(&ab->base_lock); in ath11k_mac_op_set_key()
4351 peer = ath11k_peer_find(ab, arvif->vdev_id, peer_addr); in ath11k_mac_op_set_key()
4358 spin_unlock_bh(&ab->base_lock); in ath11k_mac_op_set_key()
4362 ath11k_warn(ab, "cannot install key for non-existent peer %pM\n", in ath11k_mac_op_set_key()
4364 ret = -EOPNOTSUPP; in ath11k_mac_op_set_key()
4374 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath11k_mac_op_set_key()
4391 spin_lock_bh(&ab->base_lock); in ath11k_mac_op_set_key()
4392 peer = ath11k_peer_find(ab, arvif->vdev_id, peer_addr); in ath11k_mac_op_set_key()
4394 peer->keys[key->keyidx] = key; in ath11k_mac_op_set_key()
4395 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { in ath11k_mac_op_set_key()
4396 peer->ucast_keyidx = key->keyidx; in ath11k_mac_op_set_key()
4397 peer->sec_type = ath11k_dp_tx_get_encrypt_type(key->cipher); in ath11k_mac_op_set_key()
4399 peer->mcast_keyidx = key->keyidx; in ath11k_mac_op_set_key()
4400 peer->sec_type_grp = ath11k_dp_tx_get_encrypt_type(key->cipher); in ath11k_mac_op_set_key()
4403 peer->keys[key->keyidx] = NULL; in ath11k_mac_op_set_key()
4404 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath11k_mac_op_set_key()
4405 peer->ucast_keyidx = 0; in ath11k_mac_op_set_key()
4407 peer->mcast_keyidx = 0; in ath11k_mac_op_set_key()
4415 switch (key->cipher) { in ath11k_mac_op_set_key()
4422 arsta->pn_type = HAL_PN_TYPE_WPA; in ath11k_mac_op_set_key()
4424 arsta->pn_type = HAL_PN_TYPE_NONE; in ath11k_mac_op_set_key()
4427 arsta->pn_type = HAL_PN_TYPE_NONE; in ath11k_mac_op_set_key()
4432 spin_unlock_bh(&ab->base_lock); in ath11k_mac_op_set_key()
4435 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_key()
4447 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) in ath11k_mac_bitrate_mask_num_ht_rates()
4448 num_rates += hweight8(mask->control[band].ht_mcs[i]); in ath11k_mac_bitrate_mask_num_ht_rates()
4461 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) in ath11k_mac_bitrate_mask_num_vht_rates()
4462 num_rates += hweight16(mask->control[band].vht_mcs[i]); in ath11k_mac_bitrate_mask_num_vht_rates()
4475 for (i = 0; i < ARRAY_SIZE(mask->control[band].he_mcs); i++) in ath11k_mac_bitrate_mask_num_he_rates()
4476 num_rates += hweight16(mask->control[band].he_mcs[i]); in ath11k_mac_bitrate_mask_num_he_rates()
4487 struct ath11k *ar = arvif->ar; in ath11k_mac_set_peer_vht_fixed_rate()
4492 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_set_peer_vht_fixed_rate()
4496 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath11k_mac_set_peer_vht_fixed_rate()
4497 if (hweight16(mask->control[band].vht_mcs[i]) == 1) { in ath11k_mac_set_peer_vht_fixed_rate()
4499 vht_rate = ffs(mask->control[band].vht_mcs[i]) - 1; in ath11k_mac_set_peer_vht_fixed_rate()
4504 ath11k_warn(ar->ab, "No single VHT Fixed rate found to set for %pM", in ath11k_mac_set_peer_vht_fixed_rate()
4505 sta->addr); in ath11k_mac_set_peer_vht_fixed_rate()
4506 return -EINVAL; in ath11k_mac_set_peer_vht_fixed_rate()
4510 if (nss > sta->deflink.rx_nss) in ath11k_mac_set_peer_vht_fixed_rate()
4511 return -EINVAL; in ath11k_mac_set_peer_vht_fixed_rate()
4513 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_set_peer_vht_fixed_rate()
4515 sta->addr); in ath11k_mac_set_peer_vht_fixed_rate()
4517 rate_code = ATH11K_HW_RATE_CODE(vht_rate, nss - 1, in ath11k_mac_set_peer_vht_fixed_rate()
4519 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_set_peer_vht_fixed_rate()
4520 arvif->vdev_id, in ath11k_mac_set_peer_vht_fixed_rate()
4524 ath11k_warn(ar->ab, in ath11k_mac_set_peer_vht_fixed_rate()
4526 sta->addr, rate_code, ret); in ath11k_mac_set_peer_vht_fixed_rate()
4537 struct ath11k *ar = arvif->ar; in ath11k_mac_set_peer_he_fixed_rate()
4542 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_set_peer_he_fixed_rate()
4546 for (i = 0; i < ARRAY_SIZE(mask->control[band].he_mcs); i++) { in ath11k_mac_set_peer_he_fixed_rate()
4547 if (hweight16(mask->control[band].he_mcs[i]) == 1) { in ath11k_mac_set_peer_he_fixed_rate()
4549 he_rate = ffs(mask->control[band].he_mcs[i]) - 1; in ath11k_mac_set_peer_he_fixed_rate()
4554 ath11k_warn(ar->ab, "No single he fixed rate found to set for %pM", in ath11k_mac_set_peer_he_fixed_rate()
4555 sta->addr); in ath11k_mac_set_peer_he_fixed_rate()
4556 return -EINVAL; in ath11k_mac_set_peer_he_fixed_rate()
4560 if (nss > sta->deflink.rx_nss) in ath11k_mac_set_peer_he_fixed_rate()
4561 return -EINVAL; in ath11k_mac_set_peer_he_fixed_rate()
4563 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_set_peer_he_fixed_rate()
4565 sta->addr); in ath11k_mac_set_peer_he_fixed_rate()
4567 rate_code = ATH11K_HW_RATE_CODE(he_rate, nss - 1, in ath11k_mac_set_peer_he_fixed_rate()
4570 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_set_peer_he_fixed_rate()
4571 arvif->vdev_id, in ath11k_mac_set_peer_he_fixed_rate()
4575 ath11k_warn(ar->ab, in ath11k_mac_set_peer_he_fixed_rate()
4577 sta->addr, rate_code, ret); in ath11k_mac_set_peer_he_fixed_rate()
4588 struct ath11k *ar = arvif->ar; in ath11k_mac_set_peer_ht_fixed_rate()
4593 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_set_peer_ht_fixed_rate()
4595 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath11k_mac_set_peer_ht_fixed_rate()
4596 if (hweight8(mask->control[band].ht_mcs[i]) == 1) { in ath11k_mac_set_peer_ht_fixed_rate()
4598 ht_rate = ffs(mask->control[band].ht_mcs[i]) - 1; in ath11k_mac_set_peer_ht_fixed_rate()
4603 ath11k_warn(ar->ab, "No single HT Fixed rate found to set for %pM", in ath11k_mac_set_peer_ht_fixed_rate()
4604 sta->addr); in ath11k_mac_set_peer_ht_fixed_rate()
4605 return -EINVAL; in ath11k_mac_set_peer_ht_fixed_rate()
4609 if (nss > sta->deflink.rx_nss) in ath11k_mac_set_peer_ht_fixed_rate()
4610 return -EINVAL; in ath11k_mac_set_peer_ht_fixed_rate()
4612 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_set_peer_ht_fixed_rate()
4614 sta->addr); in ath11k_mac_set_peer_ht_fixed_rate()
4616 rate_code = ATH11K_HW_RATE_CODE(ht_rate, nss - 1, in ath11k_mac_set_peer_ht_fixed_rate()
4618 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_set_peer_ht_fixed_rate()
4619 arvif->vdev_id, in ath11k_mac_set_peer_ht_fixed_rate()
4623 ath11k_warn(ar->ab, in ath11k_mac_set_peer_ht_fixed_rate()
4625 sta->addr, rate_code, ret); in ath11k_mac_set_peer_ht_fixed_rate()
4643 lockdep_assert_held(&ar->conf_mutex); in ath11k_station_assoc()
4646 return -EPERM; in ath11k_station_assoc()
4648 band = def.chan->band; in ath11k_station_assoc()
4649 mask = &arvif->bitrate_mask; in ath11k_station_assoc()
4656 ath11k_warn(ar->ab, "failed to run peer assoc for STA %pM vdev %i: %d\n", in ath11k_station_assoc()
4657 sta->addr, arvif->vdev_id, ret); in ath11k_station_assoc()
4661 if (!wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) { in ath11k_station_assoc()
4662 ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n", in ath11k_station_assoc()
4663 sta->addr, arvif->vdev_id); in ath11k_station_assoc()
4664 return -ETIMEDOUT; in ath11k_station_assoc()
4676 if (sta->deflink.vht_cap.vht_supported && num_vht_rates == 1) { in ath11k_station_assoc()
4681 } else if (sta->deflink.he_cap.has_he && num_he_rates == 1) { in ath11k_station_assoc()
4686 } else if (sta->deflink.ht_cap.ht_supported && num_ht_rates == 1) { in ath11k_station_assoc()
4693 /* Re-assoc is run only to update supported rates for given station. It in ath11k_station_assoc()
4699 ret = ath11k_setup_peer_smps(ar, arvif, sta->addr, in ath11k_station_assoc()
4700 &sta->deflink.ht_cap, in ath11k_station_assoc()
4701 le16_to_cpu(sta->deflink.he_6ghz_capa.capa)); in ath11k_station_assoc()
4703 ath11k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n", in ath11k_station_assoc()
4704 arvif->vdev_id, ret); in ath11k_station_assoc()
4708 if (!sta->wme) { in ath11k_station_assoc()
4709 arvif->num_legacy_stations++; in ath11k_station_assoc()
4715 if (sta->wme && sta->uapsd_queues) { in ath11k_station_assoc()
4718 ath11k_warn(ar->ab, "failed to set qos params for STA %pM for vdev %i: %d\n", in ath11k_station_assoc()
4719 sta->addr, arvif->vdev_id, ret); in ath11k_station_assoc()
4734 lockdep_assert_held(&ar->conf_mutex); in ath11k_station_disassoc()
4736 if (!sta->wme) { in ath11k_station_disassoc()
4737 arvif->num_legacy_stations--; in ath11k_station_disassoc()
4743 ret = ath11k_clear_peer_keys(arvif, sta->addr); in ath11k_station_disassoc()
4745 ath11k_warn(ar->ab, "failed to clear all peer keys for vdev %i: %d\n", in ath11k_station_disassoc()
4746 arvif->vdev_id, ret); in ath11k_station_disassoc()
4779 arvif = arsta->arvif; in ath11k_sta_rc_update_wk()
4780 ar = arvif->ar; in ath11k_sta_rc_update_wk()
4782 if (WARN_ON(ath11k_mac_vif_chan(arvif->vif, &def))) in ath11k_sta_rc_update_wk()
4785 band = def.chan->band; in ath11k_sta_rc_update_wk()
4786 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath11k_sta_rc_update_wk()
4787 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath11k_sta_rc_update_wk()
4788 he_mcs_mask = arvif->bitrate_mask.control[band].he_mcs; in ath11k_sta_rc_update_wk()
4790 spin_lock_bh(&ar->data_lock); in ath11k_sta_rc_update_wk()
4792 changed = arsta->changed; in ath11k_sta_rc_update_wk()
4793 arsta->changed = 0; in ath11k_sta_rc_update_wk()
4795 bw = arsta->bw; in ath11k_sta_rc_update_wk()
4796 bw_prev = arsta->bw_prev; in ath11k_sta_rc_update_wk()
4797 nss = arsta->nss; in ath11k_sta_rc_update_wk()
4798 smps = arsta->smps; in ath11k_sta_rc_update_wk()
4800 spin_unlock_bh(&ar->data_lock); in ath11k_sta_rc_update_wk()
4802 mutex_lock(&ar->conf_mutex); in ath11k_sta_rc_update_wk()
4809 ath11k_peer_assoc_h_phymode(ar, arvif->vif, sta, &peer_arg); in ath11k_sta_rc_update_wk()
4812 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "update sta %pM peer bw %d phymode %d\n", in ath11k_sta_rc_update_wk()
4813 sta->addr, bw, peer_phymode); in ath11k_sta_rc_update_wk()
4819 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "BW upgrade for sta %pM new BW %d, old BW %d\n", in ath11k_sta_rc_update_wk()
4820 sta->addr, bw, bw_prev); in ath11k_sta_rc_update_wk()
4822 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
4826 ath11k_warn(ar->ab, "failed to update STA %pM peer phymode %d: %d\n", in ath11k_sta_rc_update_wk()
4827 sta->addr, peer_phymode, err); in ath11k_sta_rc_update_wk()
4831 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
4835 ath11k_warn(ar->ab, "failed to update STA %pM peer bw %d: %d\n", in ath11k_sta_rc_update_wk()
4836 sta->addr, bw, err); in ath11k_sta_rc_update_wk()
4841 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "BW downgrade for sta %pM new BW %d,old BW %d\n", in ath11k_sta_rc_update_wk()
4842 sta->addr, bw, bw_prev); in ath11k_sta_rc_update_wk()
4844 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
4848 ath11k_warn(ar->ab, "failed to update STA %pM peer bw %d: %d\n", in ath11k_sta_rc_update_wk()
4849 sta->addr, bw, err); in ath11k_sta_rc_update_wk()
4853 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
4857 ath11k_warn(ar->ab, "failed to update STA %pM peer phymode %d: %d\n", in ath11k_sta_rc_update_wk()
4858 sta->addr, peer_phymode, err); in ath11k_sta_rc_update_wk()
4863 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "update sta %pM nss %d\n", in ath11k_sta_rc_update_wk()
4864 sta->addr, nss); in ath11k_sta_rc_update_wk()
4866 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
4869 ath11k_warn(ar->ab, "failed to update STA %pM nss %d: %d\n", in ath11k_sta_rc_update_wk()
4870 sta->addr, nss, err); in ath11k_sta_rc_update_wk()
4874 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "update sta %pM smps %d\n", in ath11k_sta_rc_update_wk()
4875 sta->addr, smps); in ath11k_sta_rc_update_wk()
4877 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
4880 ath11k_warn(ar->ab, "failed to update STA %pM smps %d: %d\n", in ath11k_sta_rc_update_wk()
4881 sta->addr, smps, err); in ath11k_sta_rc_update_wk()
4885 mask = &arvif->bitrate_mask; in ath11k_sta_rc_update_wk()
4897 * But, Single rate in VHT mask can be set as per-peer in ath11k_sta_rc_update_wk()
4900 * when per-peer Fixed rate is set. in ath11k_sta_rc_update_wk()
4904 if (sta->deflink.vht_cap.vht_supported && num_vht_rates == 1) { in ath11k_sta_rc_update_wk()
4907 } else if (sta->deflink.he_cap.has_he && num_he_rates == 1) { in ath11k_sta_rc_update_wk()
4910 } else if (sta->deflink.ht_cap.ht_supported && num_ht_rates == 1) { in ath11k_sta_rc_update_wk()
4914 /* If the peer is non-VHT/HE or no fixed VHT/HE rate in ath11k_sta_rc_update_wk()
4918 * than peer assoc in ath11k_sta_rc_update_wk()
4920 err = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_sta_rc_update_wk()
4921 arvif->vdev_id, in ath11k_sta_rc_update_wk()
4925 ath11k_warn(ar->ab, in ath11k_sta_rc_update_wk()
4927 sta->addr, err); in ath11k_sta_rc_update_wk()
4929 ath11k_peer_assoc_prepare(ar, arvif->vif, sta, in ath11k_sta_rc_update_wk()
4935 ath11k_warn(ar->ab, "failed to run peer assoc for STA %pM vdev %i: %d\n", in ath11k_sta_rc_update_wk()
4936 sta->addr, arvif->vdev_id, err); in ath11k_sta_rc_update_wk()
4938 if (!wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) in ath11k_sta_rc_update_wk()
4939 ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n", in ath11k_sta_rc_update_wk()
4940 sta->addr, arvif->vdev_id); in ath11k_sta_rc_update_wk()
4945 mutex_unlock(&ar->conf_mutex); in ath11k_sta_rc_update_wk()
4958 arvif = arsta->arvif; in ath11k_sta_set_4addr_wk()
4959 ar = arvif->ar; in ath11k_sta_set_4addr_wk()
4961 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_sta_set_4addr_wk()
4962 "setting USE_4ADDR for peer %pM\n", sta->addr); in ath11k_sta_set_4addr_wk()
4964 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_sta_set_4addr_wk()
4965 arvif->vdev_id, in ath11k_sta_set_4addr_wk()
4969 ath11k_warn(ar->ab, "failed to set peer %pM 4addr capability: %d\n", in ath11k_sta_set_4addr_wk()
4970 sta->addr, ret); in ath11k_sta_set_4addr_wk()
4976 struct ath11k *ar = arvif->ar; in ath11k_mac_inc_num_stations()
4978 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_inc_num_stations()
4980 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath11k_mac_inc_num_stations()
4983 if (ar->num_stations >= ar->max_num_stations) in ath11k_mac_inc_num_stations()
4984 return -ENOBUFS; in ath11k_mac_inc_num_stations()
4986 ar->num_stations++; in ath11k_mac_inc_num_stations()
4994 struct ath11k *ar = arvif->ar; in ath11k_mac_dec_num_stations()
4996 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_dec_num_stations()
4998 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath11k_mac_dec_num_stations()
5001 ar->num_stations--; in ath11k_mac_dec_num_stations()
5009 switch (sta->deflink.bandwidth) { in ath11k_mac_ieee80211_sta_bw_to_wmi()
5023 ath11k_warn(ar->ab, "Invalid bandwidth %d for %pM\n", in ath11k_mac_ieee80211_sta_bw_to_wmi()
5024 sta->deflink.bandwidth, sta->addr); in ath11k_mac_ieee80211_sta_bw_to_wmi()
5036 struct ath11k *ar = hw->priv; in ath11k_mac_op_sta_set_txpwr()
5041 if (sta->deflink.txpwr.type == NL80211_TX_POWER_AUTOMATIC) { in ath11k_mac_op_sta_set_txpwr()
5044 txpwr = sta->deflink.txpwr.power; in ath11k_mac_op_sta_set_txpwr()
5046 return -EINVAL; in ath11k_mac_op_sta_set_txpwr()
5050 return -EINVAL; in ath11k_mac_op_sta_set_txpwr()
5052 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_sta_set_txpwr()
5054 ret = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_mac_op_sta_set_txpwr()
5057 ath11k_warn(ar->ab, "failed to set tx power for station ret: %d\n", in ath11k_mac_op_sta_set_txpwr()
5063 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_sta_set_txpwr()
5071 struct ath11k *ar = hw->priv; in ath11k_mac_op_sta_set_4addr()
5074 if (enabled && !arsta->use_4addr_set) { in ath11k_mac_op_sta_set_4addr()
5075 ieee80211_queue_work(ar->hw, &arsta->set_4addr_wk); in ath11k_mac_op_sta_set_4addr()
5076 arsta->use_4addr_set = true; in ath11k_mac_op_sta_set_4addr()
5085 struct ath11k *ar = hw->priv; in ath11k_mac_op_sta_rc_update()
5091 spin_lock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_rc_update()
5093 peer = ath11k_peer_find(ar->ab, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_rc_update()
5095 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_rc_update()
5096 ath11k_warn(ar->ab, "mac sta rc update failed to find peer %pM on vdev %i\n", in ath11k_mac_op_sta_rc_update()
5097 sta->addr, arvif->vdev_id); in ath11k_mac_op_sta_rc_update()
5101 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_rc_update()
5103 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_sta_rc_update()
5105 sta->addr, changed, sta->deflink.bandwidth, in ath11k_mac_op_sta_rc_update()
5106 sta->deflink.rx_nss, in ath11k_mac_op_sta_rc_update()
5107 sta->deflink.smps_mode); in ath11k_mac_op_sta_rc_update()
5109 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_sta_rc_update()
5113 arsta->bw_prev = arsta->bw; in ath11k_mac_op_sta_rc_update()
5114 arsta->bw = bw; in ath11k_mac_op_sta_rc_update()
5118 arsta->nss = sta->deflink.rx_nss; in ath11k_mac_op_sta_rc_update()
5123 switch (sta->deflink.smps_mode) { in ath11k_mac_op_sta_rc_update()
5135 ath11k_warn(ar->ab, "Invalid smps %d in sta rc update for %pM\n", in ath11k_mac_op_sta_rc_update()
5136 sta->deflink.smps_mode, sta->addr); in ath11k_mac_op_sta_rc_update()
5141 arsta->smps = smps; in ath11k_mac_op_sta_rc_update()
5144 arsta->changed |= changed; in ath11k_mac_op_sta_rc_update()
5146 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_sta_rc_update()
5148 ieee80211_queue_work(hw, &arsta->update_wk); in ath11k_mac_op_sta_rc_update()
5158 if (arvif->vdev_type != WMI_VDEV_TYPE_STA) in ath11k_conf_tx_uapsd()
5181 arvif->u.sta.uapsd |= value; in ath11k_conf_tx_uapsd()
5183 arvif->u.sta.uapsd &= ~value; in ath11k_conf_tx_uapsd()
5185 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_conf_tx_uapsd()
5187 arvif->u.sta.uapsd); in ath11k_conf_tx_uapsd()
5189 ath11k_warn(ar->ab, "could not set uapsd params %d\n", ret); in ath11k_conf_tx_uapsd()
5193 if (arvif->u.sta.uapsd) in ath11k_conf_tx_uapsd()
5198 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_conf_tx_uapsd()
5202 ath11k_warn(ar->ab, "could not set rx wake param %d\n", ret); in ath11k_conf_tx_uapsd()
5213 struct ath11k *ar = hw->priv; in ath11k_mac_op_conf_tx()
5218 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_conf_tx()
5222 p = &arvif->wmm_params.ac_vo; in ath11k_mac_op_conf_tx()
5225 p = &arvif->wmm_params.ac_vi; in ath11k_mac_op_conf_tx()
5228 p = &arvif->wmm_params.ac_be; in ath11k_mac_op_conf_tx()
5231 p = &arvif->wmm_params.ac_bk; in ath11k_mac_op_conf_tx()
5236 ret = -EINVAL; in ath11k_mac_op_conf_tx()
5240 p->cwmin = params->cw_min; in ath11k_mac_op_conf_tx()
5241 p->cwmax = params->cw_max; in ath11k_mac_op_conf_tx()
5242 p->aifs = params->aifs; in ath11k_mac_op_conf_tx()
5243 p->txop = params->txop; in ath11k_mac_op_conf_tx()
5245 ret = ath11k_wmi_send_wmm_update_cmd_tlv(ar, arvif->vdev_id, in ath11k_mac_op_conf_tx()
5246 &arvif->wmm_params); in ath11k_mac_op_conf_tx()
5248 ath11k_warn(ar->ab, "failed to set wmm params: %d\n", ret); in ath11k_mac_op_conf_tx()
5252 ret = ath11k_conf_tx_uapsd(ar, vif, ac, params->uapsd); in ath11k_mac_op_conf_tx()
5255 ath11k_warn(ar->ab, "failed to set sta uapsd: %d\n", ret); in ath11k_mac_op_conf_tx()
5258 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_conf_tx()
5267 u32 ar_vht_cap = ar->pdev->cap.vht_cap; in ath11k_create_ht_cap()
5318 for (i = 0; i < ar->num_rx_chains; i++) { in ath11k_create_ht_cap()
5331 struct ath11k *ar = arvif->ar; in ath11k_mac_set_txbf_conf()
5334 u32 vht_cap = ar->pdev->cap.vht_cap; in ath11k_mac_set_txbf_conf()
5340 if (nsts > (ar->num_rx_chains - 1)) in ath11k_mac_set_txbf_conf()
5341 nsts = ar->num_rx_chains - 1; in ath11k_mac_set_txbf_conf()
5349 if (sound_dim > (ar->num_tx_chains - 1)) in ath11k_mac_set_txbf_conf()
5350 sound_dim = ar->num_tx_chains - 1; in ath11k_mac_set_txbf_conf()
5361 arvif->vdev_type == WMI_VDEV_TYPE_AP) in ath11k_mac_set_txbf_conf()
5371 arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath11k_mac_set_txbf_conf()
5375 return ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_txbf_conf()
5387 if (ar->num_tx_chains < 2) { in ath11k_set_vht_txbf_cap()
5392 if (ar->num_rx_chains < 2) { in ath11k_set_vht_txbf_cap()
5415 if (sound_dim > (ar->num_tx_chains - 1)) in ath11k_set_vht_txbf_cap()
5416 sound_dim = ar->num_tx_chains - 1; in ath11k_set_vht_txbf_cap()
5425 if (nsts > (ar->num_rx_chains - 1)) in ath11k_set_vht_txbf_cap()
5426 nsts = ar->num_rx_chains - 1; in ath11k_set_vht_txbf_cap()
5443 vht_cap.cap = ar->pdev->cap.vht_cap; in ath11k_create_vht_cap()
5445 if (ar->pdev->cap.nss_ratio_enabled) in ath11k_create_vht_cap()
5454 if (i < ar->num_tx_chains && rate_cap_tx_chainmask & BIT(i)) in ath11k_create_vht_cap()
5459 if (i < ar->num_rx_chains && rate_cap_rx_chainmask & BIT(i)) in ath11k_create_vht_cap()
5483 rate_cap_tx_chainmask = ar->cfg_tx_chainmask >> cap->tx_chain_mask_shift; in ath11k_mac_setup_ht_vht_cap()
5484 rate_cap_rx_chainmask = ar->cfg_rx_chainmask >> cap->rx_chain_mask_shift; in ath11k_mac_setup_ht_vht_cap()
5486 if (cap->supported_bands & WMI_HOST_WLAN_2G_CAP) { in ath11k_mac_setup_ht_vht_cap()
5487 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath11k_mac_setup_ht_vht_cap()
5488 ht_cap = cap->band[NL80211_BAND_2GHZ].ht_cap_info; in ath11k_mac_setup_ht_vht_cap()
5491 band->ht_cap = ath11k_create_ht_cap(ar, ht_cap, in ath11k_mac_setup_ht_vht_cap()
5495 if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP && in ath11k_mac_setup_ht_vht_cap()
5496 (ar->ab->hw_params.single_pdev_only || in ath11k_mac_setup_ht_vht_cap()
5497 !ar->supports_6ghz)) { in ath11k_mac_setup_ht_vht_cap()
5498 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath11k_mac_setup_ht_vht_cap()
5499 ht_cap = cap->band[NL80211_BAND_5GHZ].ht_cap_info; in ath11k_mac_setup_ht_vht_cap()
5502 band->ht_cap = ath11k_create_ht_cap(ar, ht_cap, in ath11k_mac_setup_ht_vht_cap()
5504 band->vht_cap = ath11k_create_vht_cap(ar, rate_cap_tx_chainmask, in ath11k_mac_setup_ht_vht_cap()
5524 he_ppet[0] = fw_ppet->numss_m1 & IEEE80211_PPE_THRES_NSS_MASK; in ath11k_gen_ppe_thresh()
5525 he_ppet[0] |= (fw_ppet->ru_bit_mask << in ath11k_gen_ppe_thresh()
5528 for (nss = 0; nss <= fw_ppet->numss_m1; nss++) { in ath11k_gen_ppe_thresh()
5533 if ((fw_ppet->ru_bit_mask & BIT(ru)) == 0) in ath11k_gen_ppe_thresh()
5535 val = (fw_ppet->ppet16_ppet8_ru3_ru0[nss] >> (ru * 6)) & in ath11k_gen_ppe_thresh()
5538 for (i = 5; i >= 0; i--) { in ath11k_gen_ppe_thresh()
5554 he_cap_elem->mac_cap_info[0] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5559 he_cap_elem->mac_cap_info[2] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5564 he_cap_elem->mac_cap_info[3] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5568 he_cap_elem->mac_cap_info[4] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5574 he_cap_elem->mac_cap_info[5] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5578 he_cap_elem->phy_cap_info[2] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5583 he_cap_elem->phy_cap_info[3] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5586 he_cap_elem->phy_cap_info[4] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5589 he_cap_elem->phy_cap_info[5] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5595 he_cap_elem->phy_cap_info[6] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5601 he_cap_elem->phy_cap_info[7] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5607 he_cap_elem->phy_cap_info[8] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5615 he_cap_elem->phy_cap_info[9] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5623 bcap->he_6ghz_capa = IEEE80211_HT_MPDU_DENSITY_NONE; in ath11k_mac_setup_he_6ghz_cap()
5624 if (bcap->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) in ath11k_mac_setup_he_6ghz_cap()
5625 bcap->he_6ghz_capa |= in ath11k_mac_setup_he_6ghz_cap()
5629 bcap->he_6ghz_capa |= in ath11k_mac_setup_he_6ghz_cap()
5633 pcap->vht_cap); in ath11k_mac_setup_he_6ghz_cap()
5634 bcap->he_6ghz_capa |= in ath11k_mac_setup_he_6ghz_cap()
5636 val = FIELD_GET(IEEE80211_VHT_CAP_MAX_MPDU_MASK, pcap->vht_cap); in ath11k_mac_setup_he_6ghz_cap()
5637 bcap->he_6ghz_capa |= in ath11k_mac_setup_he_6ghz_cap()
5639 if (pcap->vht_cap & IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN) in ath11k_mac_setup_he_6ghz_cap()
5640 bcap->he_6ghz_capa |= IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS; in ath11k_mac_setup_he_6ghz_cap()
5641 if (pcap->vht_cap & IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN) in ath11k_mac_setup_he_6ghz_cap()
5642 bcap->he_6ghz_capa |= IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS; in ath11k_mac_setup_he_6ghz_cap()
5644 return cpu_to_le16(bcap->he_6ghz_capa); in ath11k_mac_setup_he_6ghz_cap()
5658 if (i < ar->num_tx_chains && in ath11k_mac_set_hemcsmap()
5659 (ar->cfg_tx_chainmask >> cap->tx_chain_mask_shift) & BIT(i)) in ath11k_mac_set_hemcsmap()
5664 if (i < ar->num_rx_chains && in ath11k_mac_set_hemcsmap()
5665 (ar->cfg_rx_chainmask >> cap->tx_chain_mask_shift) & BIT(i)) in ath11k_mac_set_hemcsmap()
5670 he_cap->he_mcs_nss_supp.rx_mcs_80 = in ath11k_mac_set_hemcsmap()
5672 he_cap->he_mcs_nss_supp.tx_mcs_80 = in ath11k_mac_set_hemcsmap()
5674 he_cap->he_mcs_nss_supp.rx_mcs_160 = in ath11k_mac_set_hemcsmap()
5676 he_cap->he_mcs_nss_supp.tx_mcs_160 = in ath11k_mac_set_hemcsmap()
5678 he_cap->he_mcs_nss_supp.rx_mcs_80p80 = in ath11k_mac_set_hemcsmap()
5680 he_cap->he_mcs_nss_supp.tx_mcs_80p80 = in ath11k_mac_set_hemcsmap()
5693 struct ath11k_band_cap *band_cap = &cap->band[band]; in ath11k_mac_copy_he_cap()
5695 &he_cap->he_cap_elem; in ath11k_mac_copy_he_cap()
5708 he_cap->has_he = true; in ath11k_mac_copy_he_cap()
5709 memcpy(he_cap_elem->mac_cap_info, band_cap->he_cap_info, in ath11k_mac_copy_he_cap()
5710 sizeof(he_cap_elem->mac_cap_info)); in ath11k_mac_copy_he_cap()
5711 memcpy(he_cap_elem->phy_cap_info, band_cap->he_cap_phy_info, in ath11k_mac_copy_he_cap()
5712 sizeof(he_cap_elem->phy_cap_info)); in ath11k_mac_copy_he_cap()
5714 he_cap_elem->mac_cap_info[1] &= in ath11k_mac_copy_he_cap()
5717 he_cap_elem->phy_cap_info[5] &= in ath11k_mac_copy_he_cap()
5719 he_cap_elem->phy_cap_info[5] |= ar->num_tx_chains - 1; in ath11k_mac_copy_he_cap()
5723 he_cap_elem->phy_cap_info[3] &= in ath11k_mac_copy_he_cap()
5725 he_cap_elem->phy_cap_info[9] |= in ath11k_mac_copy_he_cap()
5729 he_cap_elem->mac_cap_info[0] &= in ath11k_mac_copy_he_cap()
5731 he_cap_elem->mac_cap_info[0] |= in ath11k_mac_copy_he_cap()
5733 he_cap_elem->phy_cap_info[9] |= in ath11k_mac_copy_he_cap()
5743 memset(he_cap->ppe_thres, 0, sizeof(he_cap->ppe_thres)); in ath11k_mac_copy_he_cap()
5744 if (he_cap_elem->phy_cap_info[6] & in ath11k_mac_copy_he_cap()
5746 ath11k_gen_ppe_thresh(&band_cap->he_ppet, in ath11k_mac_copy_he_cap()
5747 he_cap->ppe_thres); in ath11k_mac_copy_he_cap()
5765 if (cap->supported_bands & WMI_HOST_WLAN_2G_CAP) { in ath11k_mac_setup_he_cap()
5767 ar->mac.iftype[NL80211_BAND_2GHZ], in ath11k_mac_setup_he_cap()
5769 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath11k_mac_setup_he_cap()
5771 ar->mac.iftype[NL80211_BAND_2GHZ], in ath11k_mac_setup_he_cap()
5775 if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP) { in ath11k_mac_setup_he_cap()
5777 ar->mac.iftype[NL80211_BAND_5GHZ], in ath11k_mac_setup_he_cap()
5779 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath11k_mac_setup_he_cap()
5781 ar->mac.iftype[NL80211_BAND_5GHZ], in ath11k_mac_setup_he_cap()
5785 if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP && in ath11k_mac_setup_he_cap()
5786 ar->supports_6ghz) { in ath11k_mac_setup_he_cap()
5788 ar->mac.iftype[NL80211_BAND_6GHZ], in ath11k_mac_setup_he_cap()
5790 band = &ar->mac.sbands[NL80211_BAND_6GHZ]; in ath11k_mac_setup_he_cap()
5792 ar->mac.iftype[NL80211_BAND_6GHZ], in ath11k_mac_setup_he_cap()
5801 lockdep_assert_held(&ar->conf_mutex); in __ath11k_set_antenna()
5804 return -EINVAL; in __ath11k_set_antenna()
5807 return -EINVAL; in __ath11k_set_antenna()
5809 ar->cfg_tx_chainmask = tx_ant; in __ath11k_set_antenna()
5810 ar->cfg_rx_chainmask = rx_ant; in __ath11k_set_antenna()
5812 if (ar->state != ATH11K_STATE_ON && in __ath11k_set_antenna()
5813 ar->state != ATH11K_STATE_RESTARTED) in __ath11k_set_antenna()
5817 tx_ant, ar->pdev->pdev_id); in __ath11k_set_antenna()
5819 ath11k_warn(ar->ab, "failed to set tx-chainmask: %d, req 0x%x\n", in __ath11k_set_antenna()
5824 ar->num_tx_chains = get_num_chains(tx_ant); in __ath11k_set_antenna()
5827 rx_ant, ar->pdev->pdev_id); in __ath11k_set_antenna()
5829 ath11k_warn(ar->ab, "failed to set rx-chainmask: %d, req 0x%x\n", in __ath11k_set_antenna()
5834 ar->num_rx_chains = get_num_chains(rx_ant); in __ath11k_set_antenna()
5837 ath11k_mac_setup_ht_vht_cap(ar, &ar->pdev->cap, NULL); in __ath11k_set_antenna()
5838 ath11k_mac_setup_he_cap(ar, &ar->pdev->cap); in __ath11k_set_antenna()
5847 ieee80211_free_txskb(ar->hw, skb); in ath11k_mgmt_over_wmi_tx_drop()
5849 num_mgmt = atomic_dec_if_positive(&ar->num_pending_mgmt_tx); in ath11k_mgmt_over_wmi_tx_drop()
5855 wake_up(&ar->txmgmt_empty_waitq); in ath11k_mgmt_over_wmi_tx_drop()
5863 spin_lock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_tx_mgmt_free()
5864 msdu = idr_remove(&ar->txmgmt_idr, buf_id); in ath11k_mac_tx_mgmt_free()
5865 spin_unlock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_tx_mgmt_free()
5870 dma_unmap_single(ar->ab->dev, ATH11K_SKB_CB(msdu)->paddr, msdu->len, in ath11k_mac_tx_mgmt_free()
5874 memset(&info->status, 0, sizeof(info->status)); in ath11k_mac_tx_mgmt_free()
5892 struct ath11k *ar = skb_cb->ar; in ath11k_mac_vif_txmgmt_idr_remove()
5894 if (skb_cb->vif == vif) in ath11k_mac_vif_txmgmt_idr_remove()
5903 struct ath11k_base *ab = ar->ab; in ath11k_mac_mgmt_tx_wmi()
5904 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in ath11k_mac_mgmt_tx_wmi()
5913 ATH11K_SKB_CB(skb)->ar = ar; in ath11k_mac_mgmt_tx_wmi()
5915 spin_lock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
5916 buf_id = idr_alloc(&ar->txmgmt_idr, skb, 0, in ath11k_mac_mgmt_tx_wmi()
5918 spin_unlock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
5920 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_mgmt_tx_wmi()
5924 return -ENOSPC; in ath11k_mac_mgmt_tx_wmi()
5927 if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) { in ath11k_mac_mgmt_tx_wmi()
5928 if ((ieee80211_is_action(hdr->frame_control) || in ath11k_mac_mgmt_tx_wmi()
5929 ieee80211_is_deauth(hdr->frame_control) || in ath11k_mac_mgmt_tx_wmi()
5930 ieee80211_is_disassoc(hdr->frame_control)) && in ath11k_mac_mgmt_tx_wmi()
5931 ieee80211_has_protected(hdr->frame_control)) { in ath11k_mac_mgmt_tx_wmi()
5932 if (!(skb_cb->flags & ATH11K_SKB_CIPHER_SET)) in ath11k_mac_mgmt_tx_wmi()
5935 enctype = ath11k_dp_tx_get_encrypt_type(skb_cb->cipher); in ath11k_mac_mgmt_tx_wmi()
5941 paddr = dma_map_single(ab->dev, skb->data, skb->len, DMA_TO_DEVICE); in ath11k_mac_mgmt_tx_wmi()
5942 if (dma_mapping_error(ab->dev, paddr)) { in ath11k_mac_mgmt_tx_wmi()
5944 ret = -EIO; in ath11k_mac_mgmt_tx_wmi()
5948 ATH11K_SKB_CB(skb)->paddr = paddr; in ath11k_mac_mgmt_tx_wmi()
5950 ret = ath11k_wmi_mgmt_send(ar, arvif->vdev_id, buf_id, skb); in ath11k_mac_mgmt_tx_wmi()
5952 ath11k_warn(ar->ab, "failed to send mgmt frame: %d\n", ret); in ath11k_mac_mgmt_tx_wmi()
5959 dma_unmap_single(ab->dev, ATH11K_SKB_CB(skb)->paddr, in ath11k_mac_mgmt_tx_wmi()
5960 skb->len, DMA_TO_DEVICE); in ath11k_mac_mgmt_tx_wmi()
5962 spin_lock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
5963 idr_remove(&ar->txmgmt_idr, buf_id); in ath11k_mac_mgmt_tx_wmi()
5964 spin_unlock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
5973 while ((skb = skb_dequeue(&ar->wmi_mgmt_tx_queue)) != NULL) in ath11k_mgmt_over_wmi_tx_purge()
5985 while ((skb = skb_dequeue(&ar->wmi_mgmt_tx_queue)) != NULL) { in ath11k_mgmt_over_wmi_tx_work()
5987 if (!skb_cb->vif) { in ath11k_mgmt_over_wmi_tx_work()
5988 ath11k_warn(ar->ab, "no vif found for mgmt frame\n"); in ath11k_mgmt_over_wmi_tx_work()
5993 arvif = ath11k_vif_to_arvif(skb_cb->vif); in ath11k_mgmt_over_wmi_tx_work()
5994 mutex_lock(&ar->conf_mutex); in ath11k_mgmt_over_wmi_tx_work()
5995 if (ar->allocated_vdev_map & (1LL << arvif->vdev_id)) { in ath11k_mgmt_over_wmi_tx_work()
5998 ath11k_warn(ar->ab, "failed to tx mgmt frame, vdev_id %d :%d\n", in ath11k_mgmt_over_wmi_tx_work()
5999 arvif->vdev_id, ret); in ath11k_mgmt_over_wmi_tx_work()
6002 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mgmt_over_wmi_tx_work()
6004 arvif->vdev_id); in ath11k_mgmt_over_wmi_tx_work()
6007 ath11k_warn(ar->ab, in ath11k_mgmt_over_wmi_tx_work()
6009 arvif->vdev_id, in ath11k_mgmt_over_wmi_tx_work()
6010 arvif->is_started); in ath11k_mgmt_over_wmi_tx_work()
6013 mutex_unlock(&ar->conf_mutex); in ath11k_mgmt_over_wmi_tx_work()
6020 struct sk_buff_head *q = &ar->wmi_mgmt_tx_queue; in ath11k_mac_mgmt_tx()
6022 if (test_bit(ATH11K_FLAG_CRASH_FLUSH, &ar->ab->dev_flags)) in ath11k_mac_mgmt_tx()
6023 return -ESHUTDOWN; in ath11k_mac_mgmt_tx()
6027 * other mgmt packets like auth and assoc to be sent on time in ath11k_mac_mgmt_tx()
6031 atomic_read(&ar->num_pending_mgmt_tx) > ATH11K_PRB_RSP_DROP_THRESHOLD) { in ath11k_mac_mgmt_tx()
6032 ath11k_warn(ar->ab, in ath11k_mac_mgmt_tx()
6034 return -ENOSPC; in ath11k_mac_mgmt_tx()
6038 ath11k_warn(ar->ab, "mgmt tx queue is full\n"); in ath11k_mac_mgmt_tx()
6039 return -ENOSPC; in ath11k_mac_mgmt_tx()
6043 atomic_inc(&ar->num_pending_mgmt_tx); in ath11k_mac_mgmt_tx()
6044 queue_work(ar->ab->workqueue_aux, &ar->wmi_mgmt_tx_work); in ath11k_mac_mgmt_tx()
6054 struct ath11k *ar = hw->priv; in ath11k_mac_op_tx()
6056 struct ieee80211_vif *vif = info->control.vif; in ath11k_mac_op_tx()
6058 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in ath11k_mac_op_tx()
6059 struct ieee80211_key_conf *key = info->control.hw_key; in ath11k_mac_op_tx()
6061 u32 info_flags = info->flags; in ath11k_mac_op_tx()
6066 skb_cb->vif = vif; in ath11k_mac_op_tx()
6069 skb_cb->cipher = key->cipher; in ath11k_mac_op_tx()
6070 skb_cb->flags |= ATH11K_SKB_CIPHER_SET; in ath11k_mac_op_tx()
6074 skb_cb->flags |= ATH11K_SKB_HW_80211_ENCAP; in ath11k_mac_op_tx()
6075 } else if (ieee80211_is_mgmt(hdr->frame_control)) { in ath11k_mac_op_tx()
6076 is_prb_rsp = ieee80211_is_probe_resp(hdr->frame_control); in ath11k_mac_op_tx()
6079 ath11k_warn(ar->ab, "failed to queue management frame %d\n", in ath11k_mac_op_tx()
6081 ieee80211_free_txskb(ar->hw, skb); in ath11k_mac_op_tx()
6086 if (control->sta) in ath11k_mac_op_tx()
6087 arsta = ath11k_sta_to_arsta(control->sta); in ath11k_mac_op_tx()
6091 ath11k_warn(ar->ab, "failed to transmit frame %d\n", ret); in ath11k_mac_op_tx()
6092 ieee80211_free_txskb(ar->hw, skb); in ath11k_mac_op_tx()
6098 /* make sure rcu-protected mac80211 tx path itself is drained */ in ath11k_mac_drain_tx()
6101 cancel_work_sync(&ar->wmi_mgmt_tx_work); in ath11k_mac_drain_tx()
6108 struct ath11k_base *ab = ar->ab; in ath11k_mac_config_mon_status_default()
6118 for (i = 0; i < ab->hw_params.num_rxdma_per_pdev; i++) { in ath11k_mac_config_mon_status_default()
6119 ring_id = ar->dp.rx_mon_status_refill_ring[i].refill_buf_ring.ring_id; in ath11k_mac_config_mon_status_default()
6120 ret = ath11k_dp_tx_htt_rx_filter_setup(ar->ab, ring_id, in ath11k_mac_config_mon_status_default()
6121 ar->dp.mac_id + i, in ath11k_mac_config_mon_status_default()
6127 if (enable && !ar->ab->hw_params.rxdma1_enable) in ath11k_mac_config_mon_status_default()
6128 mod_timer(&ar->ab->mon_reap_timer, jiffies + in ath11k_mac_config_mon_status_default()
6138 if (!ab->is_reset) in ath11k_mac_wait_reconfigure()
6141 recovery_start_count = atomic_inc_return(&ab->recovery_start_count); in ath11k_mac_wait_reconfigure()
6144 if (recovery_start_count == ab->num_radios) { in ath11k_mac_wait_reconfigure()
6145 complete(&ab->recovery_start); in ath11k_mac_wait_reconfigure()
6151 wait_for_completion_timeout(&ab->reconfigure_complete, in ath11k_mac_wait_reconfigure()
6157 struct ath11k *ar = hw->priv; in ath11k_mac_op_start()
6158 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_start()
6159 struct ath11k_pdev *pdev = ar->pdev; in ath11k_mac_op_start()
6164 return -EOPNOTSUPP; in ath11k_mac_op_start()
6168 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_start()
6170 switch (ar->state) { in ath11k_mac_op_start()
6172 ar->state = ATH11K_STATE_ON; in ath11k_mac_op_start()
6175 ar->state = ATH11K_STATE_RESTARTED; in ath11k_mac_op_start()
6183 ret = -EINVAL; in ath11k_mac_op_start()
6188 1, pdev->pdev_id); in ath11k_mac_op_start()
6191 ath11k_err(ar->ab, "failed to enable PMF QOS: (%d\n", ret); in ath11k_mac_op_start()
6196 pdev->pdev_id); in ath11k_mac_op_start()
6198 ath11k_err(ar->ab, "failed to enable dynamic bw: %d\n", ret); in ath11k_mac_op_start()
6202 if (test_bit(WMI_TLV_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi->wmi_ab->svc_map)) { in ath11k_mac_op_start()
6203 ret = ath11k_wmi_scan_prob_req_oui(ar, ar->mac_addr); in ath11k_mac_op_start()
6211 0, pdev->pdev_id); in ath11k_mac_op_start()
6218 ret = ath11k_wmi_send_dfs_phyerr_offload_enable_cmd(ar, pdev->pdev_id); in ath11k_mac_op_start()
6233 1, pdev->pdev_id); in ath11k_mac_op_start()
6236 ath11k_err(ar->ab, "failed to enable MESH MCAST ENABLE: (%d\n", ret); in ath11k_mac_op_start()
6240 __ath11k_set_antenna(ar, ar->cfg_tx_chainmask, ar->cfg_rx_chainmask); in ath11k_mac_op_start()
6246 ar->num_started_vdevs = 0; in ath11k_mac_op_start()
6247 ar->num_created_vdevs = 0; in ath11k_mac_op_start()
6248 ar->num_peers = 0; in ath11k_mac_op_start()
6249 ar->allocated_vdev_map = 0; in ath11k_mac_op_start()
6262 ath11k_wmi_pdev_lro_cfg(ar, ar->pdev->pdev_id); in ath11k_mac_op_start()
6265 if (ab->hw_params.idle_ps) { in ath11k_mac_op_start()
6267 1, pdev->pdev_id); in ath11k_mac_op_start()
6274 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_start()
6276 rcu_assign_pointer(ab->pdevs_active[ar->pdev_idx], in ath11k_mac_op_start()
6277 &ab->pdevs[ar->pdev_idx]); in ath11k_mac_op_start()
6282 ar->state = ATH11K_STATE_OFF; in ath11k_mac_op_start()
6283 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_start()
6290 struct ath11k *ar = hw->priv; in ath11k_mac_op_stop()
6296 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_stop()
6299 ath11k_err(ar->ab, "failed to clear rx_filter for monitor status ring: (%d)\n", in ath11k_mac_op_stop()
6302 clear_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); in ath11k_mac_op_stop()
6303 ar->state = ATH11K_STATE_OFF; in ath11k_mac_op_stop()
6304 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_stop()
6306 cancel_delayed_work_sync(&ar->scan.timeout); in ath11k_mac_op_stop()
6307 cancel_work_sync(&ar->regd_update_work); in ath11k_mac_op_stop()
6308 cancel_work_sync(&ar->ab->update_11d_work); in ath11k_mac_op_stop()
6310 if (ar->state_11d == ATH11K_11D_PREPARING) { in ath11k_mac_op_stop()
6311 ar->state_11d = ATH11K_11D_IDLE; in ath11k_mac_op_stop()
6312 complete(&ar->completed_11d_scan); in ath11k_mac_op_stop()
6315 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_stop()
6316 list_for_each_entry_safe(ppdu_stats, tmp, &ar->ppdu_stats_info, list) { in ath11k_mac_op_stop()
6317 list_del(&ppdu_stats->list); in ath11k_mac_op_stop()
6320 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_stop()
6322 rcu_assign_pointer(ar->ab->pdevs_active[ar->pdev_idx], NULL); in ath11k_mac_op_stop()
6326 atomic_set(&ar->num_pending_mgmt_tx, 0); in ath11k_mac_op_stop()
6332 struct ath11k *ar = arvif->ar; in ath11k_mac_setup_vdev_params_mbssid()
6337 tx_vif = arvif->vif->mbssid_tx_vif; in ath11k_mac_setup_vdev_params_mbssid()
6345 if (arvif->vif->bss_conf.nontransmitted) { in ath11k_mac_setup_vdev_params_mbssid()
6346 if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy) in ath11k_mac_setup_vdev_params_mbssid()
6347 return -EINVAL; in ath11k_mac_setup_vdev_params_mbssid()
6350 *tx_vdev_id = ath11k_vif_to_arvif(tx_vif)->vdev_id; in ath11k_mac_setup_vdev_params_mbssid()
6354 return -EINVAL; in ath11k_mac_setup_vdev_params_mbssid()
6357 if (arvif->vif->bss_conf.ema_ap) in ath11k_mac_setup_vdev_params_mbssid()
6366 struct ath11k *ar = arvif->ar; in ath11k_mac_setup_vdev_create_params()
6367 struct ath11k_pdev *pdev = ar->pdev; in ath11k_mac_setup_vdev_create_params()
6370 params->if_id = arvif->vdev_id; in ath11k_mac_setup_vdev_create_params()
6371 params->type = arvif->vdev_type; in ath11k_mac_setup_vdev_create_params()
6372 params->subtype = arvif->vdev_subtype; in ath11k_mac_setup_vdev_create_params()
6373 params->pdev_id = pdev->pdev_id; in ath11k_mac_setup_vdev_create_params()
6374 params->mbssid_flags = 0; in ath11k_mac_setup_vdev_create_params()
6375 params->mbssid_tx_vdev_id = 0; in ath11k_mac_setup_vdev_create_params()
6378 ar->ab->wmi_ab.svc_map)) { in ath11k_mac_setup_vdev_create_params()
6380 ¶ms->mbssid_flags, in ath11k_mac_setup_vdev_create_params()
6381 ¶ms->mbssid_tx_vdev_id); in ath11k_mac_setup_vdev_create_params()
6386 if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) { in ath11k_mac_setup_vdev_create_params()
6387 params->chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains; in ath11k_mac_setup_vdev_create_params()
6388 params->chains[NL80211_BAND_2GHZ].rx = ar->num_rx_chains; in ath11k_mac_setup_vdev_create_params()
6390 if (pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) { in ath11k_mac_setup_vdev_create_params()
6391 params->chains[NL80211_BAND_5GHZ].tx = ar->num_tx_chains; in ath11k_mac_setup_vdev_create_params()
6392 params->chains[NL80211_BAND_5GHZ].rx = ar->num_rx_chains; in ath11k_mac_setup_vdev_create_params()
6394 if (pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP && in ath11k_mac_setup_vdev_create_params()
6395 ar->supports_6ghz) { in ath11k_mac_setup_vdev_create_params()
6396 params->chains[NL80211_BAND_6GHZ].tx = ar->num_tx_chains; in ath11k_mac_setup_vdev_create_params()
6397 params->chains[NL80211_BAND_6GHZ].rx = ar->num_rx_chains; in ath11k_mac_setup_vdev_create_params()
6405 struct ath11k *ar = hw->priv; in ath11k_mac_op_update_vif_offload()
6406 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_update_vif_offload()
6413 (vif->type != NL80211_IFTYPE_STATION && in ath11k_mac_op_update_vif_offload()
6414 vif->type != NL80211_IFTYPE_AP)) in ath11k_mac_op_update_vif_offload()
6415 vif->offload_flags &= ~(IEEE80211_OFFLOAD_ENCAP_ENABLED | in ath11k_mac_op_update_vif_offload()
6418 if (vif->offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED) in ath11k_mac_op_update_vif_offload()
6420 else if (test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) in ath11k_mac_op_update_vif_offload()
6425 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_update_vif_offload()
6429 arvif->vdev_id, ret); in ath11k_mac_op_update_vif_offload()
6430 vif->offload_flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED; in ath11k_mac_op_update_vif_offload()
6434 if (vif->offload_flags & IEEE80211_OFFLOAD_DECAP_ENABLED) in ath11k_mac_op_update_vif_offload()
6436 else if (test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) in ath11k_mac_op_update_vif_offload()
6441 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_update_vif_offload()
6445 arvif->vdev_id, ret); in ath11k_mac_op_update_vif_offload()
6446 vif->offload_flags &= ~IEEE80211_OFFLOAD_DECAP_ENABLED; in ath11k_mac_op_update_vif_offload()
6457 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_vif_ap_active_any()
6458 pdev = &ab->pdevs[i]; in ath11k_mac_vif_ap_active_any()
6459 ar = pdev->ar; in ath11k_mac_vif_ap_active_any()
6460 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_mac_vif_ap_active_any()
6461 if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_AP) in ath11k_mac_vif_ap_active_any()
6473 mutex_lock(&ar->ab->vdev_id_11d_lock); in ath11k_mac_11d_scan_start()
6475 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev id for 11d scan %d\n", in ath11k_mac_11d_scan_start()
6476 ar->vdev_id_11d_scan); in ath11k_mac_11d_scan_start()
6478 if (ar->regdom_set_by_user) in ath11k_mac_11d_scan_start()
6481 if (ar->vdev_id_11d_scan != ATH11K_11D_INVALID_VDEV_ID) in ath11k_mac_11d_scan_start()
6484 if (!test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map)) in ath11k_mac_11d_scan_start()
6487 if (ath11k_mac_vif_ap_active_any(ar->ab)) in ath11k_mac_11d_scan_start()
6494 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "start 11d scan\n"); in ath11k_mac_11d_scan_start()
6498 ath11k_warn(ar->ab, "failed to start 11d scan vdev %d ret: %d\n", in ath11k_mac_11d_scan_start()
6501 ar->vdev_id_11d_scan = vdev_id; in ath11k_mac_11d_scan_start()
6502 if (ar->state_11d == ATH11K_11D_PREPARING) in ath11k_mac_11d_scan_start()
6503 ar->state_11d = ATH11K_11D_RUNNING; in ath11k_mac_11d_scan_start()
6507 if (ar->state_11d == ATH11K_11D_PREPARING) { in ath11k_mac_11d_scan_start()
6508 ar->state_11d = ATH11K_11D_IDLE; in ath11k_mac_11d_scan_start()
6509 complete(&ar->completed_11d_scan); in ath11k_mac_11d_scan_start()
6512 mutex_unlock(&ar->ab->vdev_id_11d_lock); in ath11k_mac_11d_scan_start()
6520 if (!test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map)) in ath11k_mac_11d_scan_stop()
6523 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "stop 11d scan\n"); in ath11k_mac_11d_scan_stop()
6525 mutex_lock(&ar->ab->vdev_id_11d_lock); in ath11k_mac_11d_scan_stop()
6527 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "stop 11d vdev id %d\n", in ath11k_mac_11d_scan_stop()
6528 ar->vdev_id_11d_scan); in ath11k_mac_11d_scan_stop()
6530 if (ar->state_11d == ATH11K_11D_PREPARING) { in ath11k_mac_11d_scan_stop()
6531 ar->state_11d = ATH11K_11D_IDLE; in ath11k_mac_11d_scan_stop()
6532 complete(&ar->completed_11d_scan); in ath11k_mac_11d_scan_stop()
6535 if (ar->vdev_id_11d_scan != ATH11K_11D_INVALID_VDEV_ID) { in ath11k_mac_11d_scan_stop()
6536 vdev_id = ar->vdev_id_11d_scan; in ath11k_mac_11d_scan_stop()
6540 ath11k_warn(ar->ab, in ath11k_mac_11d_scan_stop()
6544 ar->vdev_id_11d_scan = ATH11K_11D_INVALID_VDEV_ID; in ath11k_mac_11d_scan_stop()
6545 ar->state_11d = ATH11K_11D_IDLE; in ath11k_mac_11d_scan_stop()
6546 complete(&ar->completed_11d_scan); in ath11k_mac_11d_scan_stop()
6549 mutex_unlock(&ar->ab->vdev_id_11d_lock); in ath11k_mac_11d_scan_stop()
6560 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_11d_scan_stop_all()
6561 pdev = &ab->pdevs[i]; in ath11k_mac_11d_scan_stop_all()
6562 ar = pdev->ar; in ath11k_mac_11d_scan_stop_all()
6571 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_vdev_delete()
6574 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vdev_delete()
6576 reinit_completion(&ar->vdev_delete_done); in ath11k_mac_vdev_delete()
6578 ret = ath11k_wmi_vdev_delete(ar, arvif->vdev_id); in ath11k_mac_vdev_delete()
6580 ath11k_warn(ar->ab, "failed to delete WMI vdev %d: %d\n", in ath11k_mac_vdev_delete()
6581 arvif->vdev_id, ret); in ath11k_mac_vdev_delete()
6585 time_left = wait_for_completion_timeout(&ar->vdev_delete_done, in ath11k_mac_vdev_delete()
6588 ath11k_warn(ar->ab, "Timeout in receiving vdev delete response\n"); in ath11k_mac_vdev_delete()
6589 return -ETIMEDOUT; in ath11k_mac_vdev_delete()
6592 ar->ab->free_vdev_map |= 1LL << (arvif->vdev_id); in ath11k_mac_vdev_delete()
6593 ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id); in ath11k_mac_vdev_delete()
6594 ar->num_created_vdevs--; in ath11k_mac_vdev_delete()
6596 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %pM deleted, vdev_id %d\n", in ath11k_mac_vdev_delete()
6597 vif->addr, arvif->vdev_id); in ath11k_mac_vdev_delete()
6607 mutex_lock(&arvif->ar->conf_mutex); in ath11k_mac_bcn_tx_work()
6609 mutex_unlock(&arvif->ar->conf_mutex); in ath11k_mac_bcn_tx_work()
6615 struct ath11k *ar = hw->priv; in ath11k_mac_op_add_interface()
6616 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_add_interface()
6626 vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; in ath11k_mac_op_add_interface()
6628 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_add_interface()
6630 if (vif->type == NL80211_IFTYPE_AP && in ath11k_mac_op_add_interface()
6631 ar->num_peers > (ar->max_num_peers - 1)) { in ath11k_mac_op_add_interface()
6633 ret = -ENOBUFS; in ath11k_mac_op_add_interface()
6637 if (ar->num_created_vdevs > (TARGET_NUM_VDEVS(ab) - 1)) { in ath11k_mac_op_add_interface()
6639 ar->num_created_vdevs, TARGET_NUM_VDEVS(ab)); in ath11k_mac_op_add_interface()
6640 ret = -EBUSY; in ath11k_mac_op_add_interface()
6646 arvif->ar = ar; in ath11k_mac_op_add_interface()
6647 arvif->vif = vif; in ath11k_mac_op_add_interface()
6649 INIT_LIST_HEAD(&arvif->list); in ath11k_mac_op_add_interface()
6650 INIT_WORK(&arvif->bcn_tx_work, ath11k_mac_bcn_tx_work); in ath11k_mac_op_add_interface()
6651 INIT_DELAYED_WORK(&arvif->connection_loss_work, in ath11k_mac_op_add_interface()
6654 for (i = 0; i < ARRAY_SIZE(arvif->bitrate_mask.control); i++) { in ath11k_mac_op_add_interface()
6655 arvif->bitrate_mask.control[i].legacy = 0xffffffff; in ath11k_mac_op_add_interface()
6656 arvif->bitrate_mask.control[i].gi = NL80211_TXRATE_FORCE_SGI; in ath11k_mac_op_add_interface()
6657 memset(arvif->bitrate_mask.control[i].ht_mcs, 0xff, in ath11k_mac_op_add_interface()
6658 sizeof(arvif->bitrate_mask.control[i].ht_mcs)); in ath11k_mac_op_add_interface()
6659 memset(arvif->bitrate_mask.control[i].vht_mcs, 0xff, in ath11k_mac_op_add_interface()
6660 sizeof(arvif->bitrate_mask.control[i].vht_mcs)); in ath11k_mac_op_add_interface()
6661 memset(arvif->bitrate_mask.control[i].he_mcs, 0xff, in ath11k_mac_op_add_interface()
6662 sizeof(arvif->bitrate_mask.control[i].he_mcs)); in ath11k_mac_op_add_interface()
6665 bit = __ffs64(ab->free_vdev_map); in ath11k_mac_op_add_interface()
6667 arvif->vdev_id = bit; in ath11k_mac_op_add_interface()
6668 arvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE; in ath11k_mac_op_add_interface()
6670 switch (vif->type) { in ath11k_mac_op_add_interface()
6673 arvif->vdev_type = WMI_VDEV_TYPE_STA; in ath11k_mac_op_add_interface()
6674 if (vif->p2p) in ath11k_mac_op_add_interface()
6675 arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_CLIENT; in ath11k_mac_op_add_interface()
6678 arvif->vdev_subtype = WMI_VDEV_SUBTYPE_MESH_11S; in ath11k_mac_op_add_interface()
6681 arvif->vdev_type = WMI_VDEV_TYPE_AP; in ath11k_mac_op_add_interface()
6682 if (vif->p2p) in ath11k_mac_op_add_interface()
6683 arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_GO; in ath11k_mac_op_add_interface()
6686 arvif->vdev_type = WMI_VDEV_TYPE_MONITOR; in ath11k_mac_op_add_interface()
6687 ar->monitor_vdev_id = bit; in ath11k_mac_op_add_interface()
6690 arvif->vdev_type = WMI_VDEV_TYPE_STA; in ath11k_mac_op_add_interface()
6691 arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_DEVICE; in ath11k_mac_op_add_interface()
6699 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "add interface id %d type %d subtype %d map %llx\n", in ath11k_mac_op_add_interface()
6700 arvif->vdev_id, arvif->vdev_type, arvif->vdev_subtype, in ath11k_mac_op_add_interface()
6701 ab->free_vdev_map); in ath11k_mac_op_add_interface()
6703 vif->cab_queue = arvif->vdev_id % (ATH11K_HW_MAX_QUEUES - 1); in ath11k_mac_op_add_interface()
6704 for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++) in ath11k_mac_op_add_interface()
6705 vif->hw_queue[i] = i % (ATH11K_HW_MAX_QUEUES - 1); in ath11k_mac_op_add_interface()
6710 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6714 ret = ath11k_wmi_vdev_create(ar, vif->addr, &vdev_param); in ath11k_mac_op_add_interface()
6717 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6721 ar->num_created_vdevs++; in ath11k_mac_op_add_interface()
6723 vif->addr, arvif->vdev_id); in ath11k_mac_op_add_interface()
6724 ar->allocated_vdev_map |= 1LL << arvif->vdev_id; in ath11k_mac_op_add_interface()
6725 ab->free_vdev_map &= ~(1LL << arvif->vdev_id); in ath11k_mac_op_add_interface()
6727 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
6728 list_add(&arvif->list, &ar->arvifs); in ath11k_mac_op_add_interface()
6729 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
6733 nss = get_num_chains(ar->cfg_tx_chainmask) ? : 1; in ath11k_mac_op_add_interface()
6734 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
6738 arvif->vdev_id, ar->cfg_tx_chainmask, nss, ret); in ath11k_mac_op_add_interface()
6742 switch (arvif->vdev_type) { in ath11k_mac_op_add_interface()
6744 peer_param.vdev_id = arvif->vdev_id; in ath11k_mac_op_add_interface()
6745 peer_param.peer_addr = vif->addr; in ath11k_mac_op_add_interface()
6750 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6756 ath11k_warn(ar->ab, "failed to set vdev %i kickout parameters: %d\n", in ath11k_mac_op_add_interface()
6757 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6761 ath11k_mac_11d_scan_stop_all(ar->ab); in ath11k_mac_op_add_interface()
6766 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
6769 ath11k_warn(ar->ab, "failed to set vdev %d RX wake policy: %d\n", in ath11k_mac_op_add_interface()
6770 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6776 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
6779 ath11k_warn(ar->ab, "failed to set vdev %d TX wake threshold: %d\n", in ath11k_mac_op_add_interface()
6780 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6786 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
6789 ath11k_warn(ar->ab, "failed to set vdev %d pspoll count: %d\n", in ath11k_mac_op_add_interface()
6790 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6794 ret = ath11k_wmi_pdev_set_ps_mode(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
6797 ath11k_warn(ar->ab, "failed to disable vdev %d ps mode: %d\n", in ath11k_mac_op_add_interface()
6798 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6802 if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ab->wmi_ab.svc_map)) { in ath11k_mac_op_add_interface()
6803 reinit_completion(&ar->completed_11d_scan); in ath11k_mac_op_add_interface()
6804 ar->state_11d = ATH11K_11D_PREPARING; in ath11k_mac_op_add_interface()
6808 set_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); in ath11k_mac_op_add_interface()
6814 arvif->txpower = vif->bss_conf.txpower; in ath11k_mac_op_add_interface()
6820 param_value = ar->hw->wiphy->rts_threshold; in ath11k_mac_op_add_interface()
6821 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
6824 ath11k_warn(ar->ab, "failed to set rts threshold for vdev %d: %d\n", in ath11k_mac_op_add_interface()
6825 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6830 if (vif->type != NL80211_IFTYPE_MONITOR && in ath11k_mac_op_add_interface()
6831 test_bit(ATH11K_FLAG_MONITOR_CONF_ENABLED, &ar->monitor_flags)) { in ath11k_mac_op_add_interface()
6834 ath11k_warn(ar->ab, "failed to create monitor vdev during add interface: %d", in ath11k_mac_op_add_interface()
6841 reg_info = &ab->reg_info_store[ar->pdev_idx]; in ath11k_mac_op_add_interface()
6846 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_add_interface()
6851 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath11k_mac_op_add_interface()
6852 fbret = ath11k_peer_delete(ar, arvif->vdev_id, vif->addr); in ath11k_mac_op_add_interface()
6854 ath11k_warn(ar->ab, "fallback fail to delete peer addr %pM vdev_id %d ret %d\n", in ath11k_mac_op_add_interface()
6855 vif->addr, arvif->vdev_id, fbret); in ath11k_mac_op_add_interface()
6862 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
6863 list_del(&arvif->list); in ath11k_mac_op_add_interface()
6864 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
6867 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_add_interface()
6877 if (skb_cb->vif == vif) in ath11k_mac_vif_unref()
6878 skb_cb->vif = NULL; in ath11k_mac_vif_unref()
6886 struct ath11k *ar = hw->priv; in ath11k_mac_op_remove_interface()
6888 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_remove_interface()
6892 cancel_delayed_work_sync(&arvif->connection_loss_work); in ath11k_mac_op_remove_interface()
6893 cancel_work_sync(&arvif->bcn_tx_work); in ath11k_mac_op_remove_interface()
6895 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_remove_interface()
6898 arvif->vdev_id); in ath11k_mac_op_remove_interface()
6903 arvif->vdev_id, ret); in ath11k_mac_op_remove_interface()
6905 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath11k_mac_op_remove_interface()
6908 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath11k_mac_op_remove_interface()
6909 ret = ath11k_peer_delete(ar, arvif->vdev_id, vif->addr); in ath11k_mac_op_remove_interface()
6911 ath11k_warn(ab, "failed to submit AP self-peer removal on vdev %d: %d\n", in ath11k_mac_op_remove_interface()
6912 arvif->vdev_id, ret); in ath11k_mac_op_remove_interface()
6918 arvif->vdev_id, ret); in ath11k_mac_op_remove_interface()
6922 if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { in ath11k_mac_op_remove_interface()
6923 clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); in ath11k_mac_op_remove_interface()
6924 ar->monitor_vdev_id = -1; in ath11k_mac_op_remove_interface()
6925 } else if (test_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags) && in ath11k_mac_op_remove_interface()
6926 !test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags)) { in ath11k_mac_op_remove_interface()
6930 ath11k_warn(ar->ab, "failed to delete vdev monitor during remove interface: %d", in ath11k_mac_op_remove_interface()
6935 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_remove_interface()
6936 list_del(&arvif->list); in ath11k_mac_op_remove_interface()
6937 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_remove_interface()
6939 ath11k_peer_cleanup(ar, arvif->vdev_id); in ath11k_mac_op_remove_interface()
6941 idr_for_each(&ar->txmgmt_idr, in ath11k_mac_op_remove_interface()
6944 for (i = 0; i < ab->hw_params.max_tx_ring; i++) { in ath11k_mac_op_remove_interface()
6945 spin_lock_bh(&ab->dp.tx_ring[i].tx_idr_lock); in ath11k_mac_op_remove_interface()
6946 idr_for_each(&ab->dp.tx_ring[i].txbuf_idr, in ath11k_mac_op_remove_interface()
6948 spin_unlock_bh(&ab->dp.tx_ring[i].tx_idr_lock); in ath11k_mac_op_remove_interface()
6956 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_remove_interface()
6974 struct ath11k *ar = hw->priv; in ath11k_mac_op_configure_filter()
6976 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_configure_filter()
6979 ar->filter_flags = *total_flags; in ath11k_mac_op_configure_filter()
6981 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_configure_filter()
6986 struct ath11k *ar = hw->priv; in ath11k_mac_op_get_antenna()
6988 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_get_antenna()
6990 *tx_ant = ar->cfg_tx_chainmask; in ath11k_mac_op_get_antenna()
6991 *rx_ant = ar->cfg_rx_chainmask; in ath11k_mac_op_get_antenna()
6993 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_get_antenna()
7000 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_antenna()
7003 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_antenna()
7005 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_antenna()
7014 struct ath11k *ar = hw->priv; in ath11k_mac_op_ampdu_action()
7015 int ret = -EINVAL; in ath11k_mac_op_ampdu_action()
7017 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_ampdu_action()
7019 switch (params->action) { in ath11k_mac_op_ampdu_action()
7031 /* Tx A-MPDU aggregation offloaded to hw/fw so deny mac80211 in ath11k_mac_op_ampdu_action()
7034 ret = -EOPNOTSUPP; in ath11k_mac_op_ampdu_action()
7038 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_ampdu_action()
7046 struct ath11k *ar = hw->priv; in ath11k_mac_op_add_chanctx()
7047 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_add_chanctx()
7051 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath11k_mac_op_add_chanctx()
7053 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_add_chanctx()
7055 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_add_chanctx()
7059 ar->rx_channel = ctx->def.chan; in ath11k_mac_op_add_chanctx()
7060 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_add_chanctx()
7062 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_add_chanctx()
7070 struct ath11k *ar = hw->priv; in ath11k_mac_op_remove_chanctx()
7071 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_remove_chanctx()
7075 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath11k_mac_op_remove_chanctx()
7077 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_remove_chanctx()
7079 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_remove_chanctx()
7083 ar->rx_channel = NULL; in ath11k_mac_op_remove_chanctx()
7084 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_remove_chanctx()
7086 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_remove_chanctx()
7094 struct ath11k *ar = arvif->ar; in ath11k_mac_vdev_start_restart()
7095 struct ath11k_base *ab = ar->ab; in ath11k_mac_vdev_start_restart()
7097 const struct cfg80211_chan_def *chandef = &ctx->def; in ath11k_mac_vdev_start_restart()
7101 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vdev_start_restart()
7103 reinit_completion(&ar->vdev_setup_done); in ath11k_mac_vdev_start_restart()
7105 arg.vdev_id = arvif->vdev_id; in ath11k_mac_vdev_start_restart()
7106 arg.dtim_period = arvif->dtim_period; in ath11k_mac_vdev_start_restart()
7107 arg.bcn_intval = arvif->beacon_interval; in ath11k_mac_vdev_start_restart()
7109 arg.channel.freq = chandef->chan->center_freq; in ath11k_mac_vdev_start_restart()
7110 arg.channel.band_center_freq1 = chandef->center_freq1; in ath11k_mac_vdev_start_restart()
7111 arg.channel.band_center_freq2 = chandef->center_freq2; in ath11k_mac_vdev_start_restart()
7113 ath11k_phymodes[chandef->chan->band][chandef->width]; in ath11k_mac_vdev_start_restart()
7116 arg.channel.max_power = chandef->chan->max_power; in ath11k_mac_vdev_start_restart()
7117 arg.channel.max_reg_power = chandef->chan->max_reg_power; in ath11k_mac_vdev_start_restart()
7118 arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain; in ath11k_mac_vdev_start_restart()
7120 arg.pref_tx_streams = ar->num_tx_chains; in ath11k_mac_vdev_start_restart()
7121 arg.pref_rx_streams = ar->num_rx_chains; in ath11k_mac_vdev_start_restart()
7126 ar->ab->wmi_ab.svc_map)) { in ath11k_mac_vdev_start_restart()
7134 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath11k_mac_vdev_start_restart()
7135 arg.ssid = arvif->u.ap.ssid; in ath11k_mac_vdev_start_restart()
7136 arg.ssid_len = arvif->u.ap.ssid_len; in ath11k_mac_vdev_start_restart()
7137 arg.hidden_ssid = arvif->u.ap.hidden_ssid; in ath11k_mac_vdev_start_restart()
7141 !!(chandef->chan->flags & IEEE80211_CHAN_RADAR); in ath11k_mac_vdev_start_restart()
7143 arg.channel.freq2_radar = ctx->radar_enabled; in ath11k_mac_vdev_start_restart()
7147 spin_lock_bh(&ab->base_lock); in ath11k_mac_vdev_start_restart()
7148 arg.regdomain = ar->ab->dfs_region; in ath11k_mac_vdev_start_restart()
7149 spin_unlock_bh(&ab->base_lock); in ath11k_mac_vdev_start_restart()
7152 arg.channel.passive |= !!(chandef->chan->flags & IEEE80211_CHAN_NO_IR); in ath11k_mac_vdev_start_restart()
7161 ath11k_warn(ar->ab, "failed to %s WMI vdev %i\n", in ath11k_mac_vdev_start_restart()
7177 ath11k_mac_fill_reg_tpc_info(ar, arvif->vif, &arvif->chanctx); in ath11k_mac_vdev_start_restart()
7178 ath11k_wmi_send_vdev_set_tpc_power(ar, arvif->vdev_id, in ath11k_mac_vdev_start_restart()
7179 &arvif->reg_tpc_info); in ath11k_mac_vdev_start_restart()
7183 ar->num_started_vdevs++; in ath11k_mac_vdev_start_restart()
7186 arvif->vif->addr, arvif->vdev_id); in ath11k_mac_vdev_start_restart()
7188 /* Enable CAC Flag in the driver by checking the all sub-channel's DFS in ath11k_mac_vdev_start_restart()
7194 if (arvif->vdev_type == WMI_VDEV_TYPE_AP && ctx->radar_enabled && in ath11k_mac_vdev_start_restart()
7195 cfg80211_chandef_dfs_usable(ar->hw->wiphy, chandef)) { in ath11k_mac_vdev_start_restart()
7196 set_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); in ath11k_mac_vdev_start_restart()
7197 dfs_cac_time = cfg80211_chandef_dfs_cac_time(ar->hw->wiphy, in ath11k_mac_vdev_start_restart()
7201 dfs_cac_time, arg.channel.freq, chandef->center_freq1, in ath11k_mac_vdev_start_restart()
7208 arvif->vdev_id, ret); in ath11k_mac_vdev_start_restart()
7215 struct ath11k *ar = arvif->ar; in ath11k_mac_vdev_stop()
7218 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vdev_stop()
7220 reinit_completion(&ar->vdev_setup_done); in ath11k_mac_vdev_stop()
7222 ret = ath11k_wmi_vdev_stop(ar, arvif->vdev_id); in ath11k_mac_vdev_stop()
7224 ath11k_warn(ar->ab, "failed to stop WMI vdev %i: %d\n", in ath11k_mac_vdev_stop()
7225 arvif->vdev_id, ret); in ath11k_mac_vdev_stop()
7231 ath11k_warn(ar->ab, "failed to synchronize setup for vdev %i: %d\n", in ath11k_mac_vdev_stop()
7232 arvif->vdev_id, ret); in ath11k_mac_vdev_stop()
7236 WARN_ON(ar->num_started_vdevs == 0); in ath11k_mac_vdev_stop()
7238 ar->num_started_vdevs--; in ath11k_mac_vdev_stop()
7239 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %pM stopped, vdev_id %d\n", in ath11k_mac_vdev_stop()
7240 arvif->vif->addr, arvif->vdev_id); in ath11k_mac_vdev_stop()
7242 if (test_bit(ATH11K_CAC_RUNNING, &ar->dev_flags)) { in ath11k_mac_vdev_stop()
7243 clear_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); in ath11k_mac_vdev_stop()
7244 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "CAC Stopped for vdev %d\n", in ath11k_mac_vdev_stop()
7245 arvif->vdev_id); in ath11k_mac_vdev_stop()
7278 if (rcu_access_pointer(vif->bss_conf.chanctx_conf) != arg->ctx) in ath11k_mac_change_chanctx_cnt_iter()
7281 arg->n_vifs++; in ath11k_mac_change_chanctx_cnt_iter()
7291 ctx = rcu_access_pointer(vif->bss_conf.chanctx_conf); in ath11k_mac_change_chanctx_fill_iter()
7292 if (ctx != arg->ctx) in ath11k_mac_change_chanctx_fill_iter()
7295 if (WARN_ON(arg->next_vif == arg->n_vifs)) in ath11k_mac_change_chanctx_fill_iter()
7298 arg->vifs[arg->next_vif].vif = vif; in ath11k_mac_change_chanctx_fill_iter()
7299 arg->vifs[arg->next_vif].old_ctx = ctx; in ath11k_mac_change_chanctx_fill_iter()
7300 arg->vifs[arg->next_vif].new_ctx = ctx; in ath11k_mac_change_chanctx_fill_iter()
7301 arg->next_vif++; in ath11k_mac_change_chanctx_fill_iter()
7309 struct ath11k_base *ab = ar->ab; in ath11k_mac_update_vif_chan()
7316 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_update_vif_chan()
7322 /* TODO: Update ar->rx_channel */ in ath11k_mac_update_vif_chan()
7327 if (WARN_ON(!arvif->is_started)) in ath11k_mac_update_vif_chan()
7331 * ieee80211_start_ap->ieee80211_vif_use_channel-> in ath11k_mac_update_vif_chan()
7335 * If vdev is down then it expect vdev_stop->vdev_start. in ath11k_mac_update_vif_chan()
7337 if (arvif->is_up) { in ath11k_mac_update_vif_chan()
7341 arvif->vdev_id, ret); in ath11k_mac_update_vif_chan()
7348 arvif->vdev_id, ret); in ath11k_mac_update_vif_chan()
7355 arvif->vdev_id, ret); in ath11k_mac_update_vif_chan()
7365 mbssid_tx_vif = arvif->vif->mbssid_tx_vif; in ath11k_mac_update_vif_chan()
7369 ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath11k_mac_update_vif_chan()
7370 arvif->bssid, in ath11k_mac_update_vif_chan()
7371 tx_arvif ? tx_arvif->bssid : NULL, in ath11k_mac_update_vif_chan()
7372 arvif->vif->bss_conf.bssid_index, in ath11k_mac_update_vif_chan()
7373 1 << arvif->vif->bss_conf.bssid_indicator); in ath11k_mac_update_vif_chan()
7376 arvif->vdev_id, ret); in ath11k_mac_update_vif_chan()
7383 test_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags)) { in ath11k_mac_update_vif_chan()
7386 ath11k_warn(ar->ab, "failed to stop monitor during vif channel update: %d", in ath11k_mac_update_vif_chan()
7393 ath11k_warn(ar->ab, "failed to start monitor during vif channel update: %d", in ath11k_mac_update_vif_chan()
7406 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_update_active_vif_chan()
7408 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_update_active_vif_chan()
7419 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_update_active_vif_chan()
7433 struct ath11k *ar = hw->priv; in ath11k_mac_op_change_chanctx()
7434 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_change_chanctx()
7436 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_change_chanctx()
7440 ctx->def.chan->center_freq, ctx->def.width, ctx, changed); in ath11k_mac_op_change_chanctx()
7455 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_change_chanctx()
7461 struct ath11k *ar = hw->priv; in ath11k_mac_start_vdev_delay()
7462 struct ath11k_base *ab = ar->ab; in ath11k_mac_start_vdev_delay()
7466 if (WARN_ON(arvif->is_started)) in ath11k_mac_start_vdev_delay()
7467 return -EBUSY; in ath11k_mac_start_vdev_delay()
7469 ret = ath11k_mac_vdev_start(arvif, &arvif->chanctx); in ath11k_mac_start_vdev_delay()
7472 arvif->vdev_id, vif->addr, in ath11k_mac_start_vdev_delay()
7473 arvif->chanctx.def.chan->center_freq, ret); in ath11k_mac_start_vdev_delay()
7479 if (ar->hw_rate_code > 0) { in ath11k_mac_start_vdev_delay()
7482 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, vdev_param, in ath11k_mac_start_vdev_delay()
7483 ar->hw_rate_code); in ath11k_mac_start_vdev_delay()
7485 ath11k_warn(ar->ab, "failed to set mgmt tx rate %d\n", ret); in ath11k_mac_start_vdev_delay()
7490 if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { in ath11k_mac_start_vdev_delay()
7491 ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, 0, ar->mac_addr, in ath11k_mac_start_vdev_delay()
7499 arvif->is_started = true; in ath11k_mac_start_vdev_delay()
7508 struct ath11k *ar = hw->priv; in ath11k_mac_stop_vdev_early()
7509 struct ath11k_base *ab = ar->ab; in ath11k_mac_stop_vdev_early()
7513 if (WARN_ON(!arvif->is_started)) in ath11k_mac_stop_vdev_early()
7514 return -EBUSY; in ath11k_mac_stop_vdev_early()
7519 arvif->vdev_id, ret); in ath11k_mac_stop_vdev_early()
7523 arvif->is_started = false; in ath11k_mac_stop_vdev_early()
7531 if (chan_def->chan->flags & IEEE80211_CHAN_PSD) { in ath11k_mac_get_num_pwr_levels()
7532 switch (chan_def->width) { in ath11k_mac_get_num_pwr_levels()
7546 switch (chan_def->width) { in ath11k_mac_get_num_pwr_levels()
7569 * with center frequency 5955, its diff is 5965 - 5955 = 10. in ath11k_mac_get_6ghz_start_frequency()
7571 * with center frequency 5955, its diff is 5985 - 5955 = 30. in ath11k_mac_get_6ghz_start_frequency()
7573 * with center frequency 5955, its diff is 6025 - 5955 = 70. in ath11k_mac_get_6ghz_start_frequency()
7575 switch (chan_def->width) { in ath11k_mac_get_6ghz_start_frequency()
7590 return chan_def->center_freq1 - diff_seq; in ath11k_mac_get_6ghz_start_frequency()
7603 * center frequency is 5955 when bandwidth=20 MHz, its diff is 5955 - 5955 = 0. in ath11k_mac_get_seg_freq()
7605 * center frequency is 5965 when bandwidth=40 MHz, its diff is 5965 - 5955 = 10. in ath11k_mac_get_seg_freq()
7607 * center frequency is 5985 when bandwidth=80 MHz, its diff is 5985 - 5955 = 30. in ath11k_mac_get_seg_freq()
7609 * center frequency is 6025 when bandwidth=160 MHz, its diff is 6025 - 5955 = 70. in ath11k_mac_get_seg_freq()
7611 if (chan_def->width == NL80211_CHAN_WIDTH_80P80 && seq == 3) in ath11k_mac_get_seg_freq()
7612 return chan_def->center_freq2; in ath11k_mac_get_seg_freq()
7614 seg_seq = 10 * (BIT(seq) - 1); in ath11k_mac_get_seg_freq()
7638 *temp_chan = ieee80211_get_channel(ar->hw->wiphy, *center_freq); in ath11k_mac_get_psd_channel()
7639 *tx_power = (*temp_chan)->max_reg_power; in ath11k_mac_get_psd_channel()
7669 *temp_chan = ieee80211_get_channel(ar->hw->wiphy, *center_freq); in ath11k_mac_get_eirp_power()
7670 *tx_power = (*temp_chan)->max_reg_power; in ath11k_mac_get_eirp_power()
7677 struct ath11k_base *ab = ar->ab; in ath11k_mac_fill_reg_tpc_info()
7679 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; in ath11k_mac_fill_reg_tpc_info()
7680 struct ath11k_reg_tpc_power_info *reg_tpc_info = &arvif->reg_tpc_info; in ath11k_mac_fill_reg_tpc_info()
7689 chan = ctx->def.chan; in ath11k_mac_fill_reg_tpc_info()
7690 start_freq = ath11k_mac_get_6ghz_start_frequency(&ctx->def); in ath11k_mac_fill_reg_tpc_info()
7691 pwr_reduction = bss_conf->pwr_reduction; in ath11k_mac_fill_reg_tpc_info()
7693 if (arvif->reg_tpc_info.num_pwr_levels) { in ath11k_mac_fill_reg_tpc_info()
7695 num_pwr_levels = arvif->reg_tpc_info.num_pwr_levels; in ath11k_mac_fill_reg_tpc_info()
7698 ath11k_mac_get_num_pwr_levels(&bss_conf->chanreq.oper); in ath11k_mac_fill_reg_tpc_info()
7705 if (chan->flags & IEEE80211_CHAN_PSD) { in ath11k_mac_fill_reg_tpc_info()
7707 if (reg_tpc_info->is_psd_power) { in ath11k_mac_fill_reg_tpc_info()
7715 psd_power = temp_chan->psd; in ath11k_mac_fill_reg_tpc_info()
7720 reg_tpc_info->tpe[pwr_lvl_idx]); in ath11k_mac_fill_reg_tpc_info()
7728 &ctx->def, in ath11k_mac_fill_reg_tpc_info()
7730 psd_power = temp_chan->psd; in ath11k_mac_fill_reg_tpc_info()
7740 reg_tpc_info->tpe[pwr_lvl_idx]); in ath11k_mac_fill_reg_tpc_info()
7745 if (reg_tpc_info->is_psd_power) { in ath11k_mac_fill_reg_tpc_info()
7755 reg_tpc_info->tpe[pwr_lvl_idx]; in ath11k_mac_fill_reg_tpc_info()
7763 &ctx->def, in ath11k_mac_fill_reg_tpc_info()
7768 reg_tpc_info->tpe[pwr_lvl_idx]); in ath11k_mac_fill_reg_tpc_info()
7774 if (chan->flags & IEEE80211_CHAN_PSD) { in ath11k_mac_fill_reg_tpc_info()
7782 psd_power = temp_chan->psd; in ath11k_mac_fill_reg_tpc_info()
7791 &ctx->def, in ath11k_mac_fill_reg_tpc_info()
7800 eirp_power = eirp_power - pwr_reduction; in ath11k_mac_fill_reg_tpc_info()
7808 eirp_power, ar->max_allowed_tx_power); in ath11k_mac_fill_reg_tpc_info()
7817 if (ar->max_allowed_tx_power && ab->hw_params.idle_ps) in ath11k_mac_fill_reg_tpc_info()
7820 ar->max_allowed_tx_power); in ath11k_mac_fill_reg_tpc_info()
7825 max_tx_power[pwr_lvl_idx] - pwr_reduction; in ath11k_mac_fill_reg_tpc_info()
7830 if (ar->max_allowed_tx_power && ab->hw_params.idle_ps) in ath11k_mac_fill_reg_tpc_info()
7834 ar->max_allowed_tx_power); in ath11k_mac_fill_reg_tpc_info()
7836 reg_tpc_info->chan_power_info[pwr_lvl_idx].chan_cfreq = center_freq; in ath11k_mac_fill_reg_tpc_info()
7837 reg_tpc_info->chan_power_info[pwr_lvl_idx].tx_power = in ath11k_mac_fill_reg_tpc_info()
7841 reg_tpc_info->num_pwr_levels = num_pwr_levels; in ath11k_mac_fill_reg_tpc_info()
7842 reg_tpc_info->is_psd_power = is_psd_power; in ath11k_mac_fill_reg_tpc_info()
7843 reg_tpc_info->eirp_power = eirp_power; in ath11k_mac_fill_reg_tpc_info()
7844 reg_tpc_info->ap_power_type = in ath11k_mac_fill_reg_tpc_info()
7845 ath11k_reg_ap_pwr_convert(vif->bss_conf.power_type); in ath11k_mac_fill_reg_tpc_info()
7852 struct ath11k_base *ab = ar->ab; in ath11k_mac_parse_tx_pwr_env()
7854 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; in ath11k_mac_parse_tx_pwr_env()
7863 reg_info = &ab->reg_info_store[ar->pdev_idx]; in ath11k_mac_parse_tx_pwr_env()
7864 client_type = reg_info->client_type; in ath11k_mac_parse_tx_pwr_env()
7867 bss_conf->tpe.max_local[client_type].valid + in ath11k_mac_parse_tx_pwr_env()
7868 bss_conf->tpe.psd_local[client_type].valid; in ath11k_mac_parse_tx_pwr_env()
7870 bss_conf->tpe.max_reg_client[client_type].valid + in ath11k_mac_parse_tx_pwr_env()
7871 bss_conf->tpe.psd_reg_client[client_type].valid; in ath11k_mac_parse_tx_pwr_env()
7885 psd = &bss_conf->tpe.psd_local[client_type]; in ath11k_mac_parse_tx_pwr_env()
7886 if (!psd->valid) in ath11k_mac_parse_tx_pwr_env()
7888 non_psd = &bss_conf->tpe.max_local[client_type]; in ath11k_mac_parse_tx_pwr_env()
7889 if (!non_psd->valid) in ath11k_mac_parse_tx_pwr_env()
7892 psd = &bss_conf->tpe.psd_reg_client[client_type]; in ath11k_mac_parse_tx_pwr_env()
7893 if (!psd->valid) in ath11k_mac_parse_tx_pwr_env()
7895 non_psd = &bss_conf->tpe.max_reg_client[client_type]; in ath11k_mac_parse_tx_pwr_env()
7896 if (!non_psd->valid) in ath11k_mac_parse_tx_pwr_env()
7901 arvif->reg_tpc_info.is_psd_power = false; in ath11k_mac_parse_tx_pwr_env()
7902 arvif->reg_tpc_info.eirp_power = 0; in ath11k_mac_parse_tx_pwr_env()
7904 arvif->reg_tpc_info.num_pwr_levels = non_psd->count; in ath11k_mac_parse_tx_pwr_env()
7906 for (i = 0; i < arvif->reg_tpc_info.num_pwr_levels; i++) { in ath11k_mac_parse_tx_pwr_env()
7909 i, non_psd->power[i]); in ath11k_mac_parse_tx_pwr_env()
7910 arvif->reg_tpc_info.tpe[i] = non_psd->power[i] / 2; in ath11k_mac_parse_tx_pwr_env()
7915 arvif->reg_tpc_info.is_psd_power = true; in ath11k_mac_parse_tx_pwr_env()
7916 arvif->reg_tpc_info.num_pwr_levels = psd->count; in ath11k_mac_parse_tx_pwr_env()
7918 for (i = 0; i < arvif->reg_tpc_info.num_pwr_levels; i++) { in ath11k_mac_parse_tx_pwr_env()
7921 i, psd->power[i]); in ath11k_mac_parse_tx_pwr_env()
7922 arvif->reg_tpc_info.tpe[i] = psd->power[i] / 2; in ath11k_mac_parse_tx_pwr_env()
7933 struct ath11k *ar = hw->priv; in ath11k_mac_op_assign_vif_chanctx()
7934 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_assign_vif_chanctx()
7938 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_assign_vif_chanctx()
7942 ctx, arvif->vdev_id); in ath11k_mac_op_assign_vif_chanctx()
7945 ctx->def.chan->band == NL80211_BAND_6GHZ && in ath11k_mac_op_assign_vif_chanctx()
7946 arvif->vdev_type == WMI_VDEV_TYPE_STA) { in ath11k_mac_op_assign_vif_chanctx()
7947 arvif->chanctx = *ctx; in ath11k_mac_op_assign_vif_chanctx()
7952 if (ab->hw_params.vdev_start_delay && in ath11k_mac_op_assign_vif_chanctx()
7953 arvif->vdev_type != WMI_VDEV_TYPE_AP && in ath11k_mac_op_assign_vif_chanctx()
7954 arvif->vdev_type != WMI_VDEV_TYPE_MONITOR && in ath11k_mac_op_assign_vif_chanctx()
7955 !ath11k_peer_find_by_vdev_id(ab, arvif->vdev_id)) { in ath11k_mac_op_assign_vif_chanctx()
7956 memcpy(&arvif->chanctx, ctx, sizeof(*ctx)); in ath11k_mac_op_assign_vif_chanctx()
7961 if (WARN_ON(arvif->is_started)) { in ath11k_mac_op_assign_vif_chanctx()
7962 ret = -EBUSY; in ath11k_mac_op_assign_vif_chanctx()
7966 if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { in ath11k_mac_op_assign_vif_chanctx()
7969 ath11k_warn(ar->ab, "failed to start monitor during vif channel context assignment: %d", in ath11k_mac_op_assign_vif_chanctx()
7974 arvif->is_started = true; in ath11k_mac_op_assign_vif_chanctx()
7978 if (!arvif->is_started) { in ath11k_mac_op_assign_vif_chanctx()
7982 arvif->vdev_id, vif->addr, in ath11k_mac_op_assign_vif_chanctx()
7983 ctx->def.chan->center_freq, ret); in ath11k_mac_op_assign_vif_chanctx()
7987 arvif->is_started = true; in ath11k_mac_op_assign_vif_chanctx()
7990 if (arvif->vdev_type != WMI_VDEV_TYPE_MONITOR && in ath11k_mac_op_assign_vif_chanctx()
7991 test_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags)) { in ath11k_mac_op_assign_vif_chanctx()
7994 ath11k_warn(ar->ab, "failed to start monitor during vif channel context assignment: %d", in ath11k_mac_op_assign_vif_chanctx()
8005 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_assign_vif_chanctx()
8016 struct ath11k *ar = hw->priv; in ath11k_mac_op_unassign_vif_chanctx()
8017 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_unassign_vif_chanctx()
8022 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_unassign_vif_chanctx()
8026 ctx, arvif->vdev_id); in ath11k_mac_op_unassign_vif_chanctx()
8028 if (ab->hw_params.vdev_start_delay && in ath11k_mac_op_unassign_vif_chanctx()
8029 arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { in ath11k_mac_op_unassign_vif_chanctx()
8030 spin_lock_bh(&ab->base_lock); in ath11k_mac_op_unassign_vif_chanctx()
8031 peer = ath11k_peer_find_by_addr(ab, ar->mac_addr); in ath11k_mac_op_unassign_vif_chanctx()
8032 spin_unlock_bh(&ab->base_lock); in ath11k_mac_op_unassign_vif_chanctx()
8034 ath11k_peer_delete(ar, arvif->vdev_id, ar->mac_addr); in ath11k_mac_op_unassign_vif_chanctx()
8037 if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { in ath11k_mac_op_unassign_vif_chanctx()
8040 ath11k_warn(ar->ab, "failed to stop monitor during vif channel context unassignment: %d", in ath11k_mac_op_unassign_vif_chanctx()
8042 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_unassign_vif_chanctx()
8046 arvif->is_started = false; in ath11k_mac_op_unassign_vif_chanctx()
8047 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_unassign_vif_chanctx()
8051 if (arvif->is_started) { in ath11k_mac_op_unassign_vif_chanctx()
8055 arvif->vdev_id, ret); in ath11k_mac_op_unassign_vif_chanctx()
8057 arvif->is_started = false; in ath11k_mac_op_unassign_vif_chanctx()
8060 if (ab->hw_params.vdev_start_delay && in ath11k_mac_op_unassign_vif_chanctx()
8061 arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) in ath11k_mac_op_unassign_vif_chanctx()
8062 ath11k_wmi_vdev_down(ar, arvif->vdev_id); in ath11k_mac_op_unassign_vif_chanctx()
8064 if (arvif->vdev_type != WMI_VDEV_TYPE_MONITOR && in ath11k_mac_op_unassign_vif_chanctx()
8065 ar->num_started_vdevs == 1 && in ath11k_mac_op_unassign_vif_chanctx()
8066 test_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags)) { in ath11k_mac_op_unassign_vif_chanctx()
8070 ath11k_warn(ar->ab, "failed to stop monitor during vif channel context unassignment: %d", in ath11k_mac_op_unassign_vif_chanctx()
8074 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath11k_mac_op_unassign_vif_chanctx()
8075 ath11k_mac_11d_scan_start(ar, arvif->vdev_id); in ath11k_mac_op_unassign_vif_chanctx()
8077 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_unassign_vif_chanctx()
8086 struct ath11k *ar = hw->priv; in ath11k_mac_op_switch_vif_chanctx()
8088 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_switch_vif_chanctx()
8090 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_switch_vif_chanctx()
8095 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_switch_vif_chanctx()
8106 mutex_lock(&ar->conf_mutex); in ath11k_set_vdev_param_to_all_vifs()
8107 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_set_vdev_param_to_all_vifs()
8108 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "setting mac vdev %d param %d value %d\n", in ath11k_set_vdev_param_to_all_vifs()
8109 param, arvif->vdev_id, value); in ath11k_set_vdev_param_to_all_vifs()
8111 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_set_vdev_param_to_all_vifs()
8114 ath11k_warn(ar->ab, "failed to set param %d for vdev %d: %d\n", in ath11k_set_vdev_param_to_all_vifs()
8115 param, arvif->vdev_id, ret); in ath11k_set_vdev_param_to_all_vifs()
8119 mutex_unlock(&ar->conf_mutex); in ath11k_set_vdev_param_to_all_vifs()
8128 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_rts_threshold()
8146 return -EOPNOTSUPP; in ath11k_mac_op_set_frag_threshold()
8154 time_left = wait_event_timeout(ar->dp.tx_empty_waitq, in ath11k_mac_flush_tx_complete()
8155 (atomic_read(&ar->dp.num_tx_pending) == 0), in ath11k_mac_flush_tx_complete()
8158 ath11k_warn(ar->ab, "failed to flush transmit queue, data pkts pending %d\n", in ath11k_mac_flush_tx_complete()
8159 atomic_read(&ar->dp.num_tx_pending)); in ath11k_mac_flush_tx_complete()
8160 ret = -ETIMEDOUT; in ath11k_mac_flush_tx_complete()
8163 time_left = wait_event_timeout(ar->txmgmt_empty_waitq, in ath11k_mac_flush_tx_complete()
8164 (atomic_read(&ar->num_pending_mgmt_tx) == 0), in ath11k_mac_flush_tx_complete()
8167 ath11k_warn(ar->ab, "failed to flush mgmt transmit queue, mgmt pkts pending %d\n", in ath11k_mac_flush_tx_complete()
8168 atomic_read(&ar->num_pending_mgmt_tx)); in ath11k_mac_flush_tx_complete()
8169 ret = -ETIMEDOUT; in ath11k_mac_flush_tx_complete()
8184 struct ath11k *ar = hw->priv; in ath11k_mac_op_flush()
8199 num_rates = hweight32(mask->control[band].legacy); in ath11k_mac_has_single_legacy_rate()
8216 if (he_cap->he_cap_elem.phy_cap_info[0] & in ath11k_mac_get_tx_mcs_map()
8218 return he_cap->he_mcs_nss_supp.tx_mcs_80p80; in ath11k_mac_get_tx_mcs_map()
8220 if (he_cap->he_cap_elem.phy_cap_info[0] & in ath11k_mac_get_tx_mcs_map()
8222 return he_cap->he_mcs_nss_supp.tx_mcs_160; in ath11k_mac_get_tx_mcs_map()
8224 return he_cap->he_mcs_nss_supp.tx_mcs_80; in ath11k_mac_get_tx_mcs_map()
8234 struct ieee80211_supported_band *sband = &ar->mac.sbands[band]; in ath11k_mac_bitrate_mask_get_single_nss()
8235 u16 vht_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map); in ath11k_mac_bitrate_mask_get_single_nss()
8247 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath11k_mac_bitrate_mask_get_single_nss()
8248 if (mask->control[band].ht_mcs[i] == 0) in ath11k_mac_bitrate_mask_get_single_nss()
8250 else if (mask->control[band].ht_mcs[i] == in ath11k_mac_bitrate_mask_get_single_nss()
8251 sband->ht_cap.mcs.rx_mask[i]) in ath11k_mac_bitrate_mask_get_single_nss()
8257 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath11k_mac_bitrate_mask_get_single_nss()
8258 if (mask->control[band].vht_mcs[i] == 0) in ath11k_mac_bitrate_mask_get_single_nss()
8260 else if (mask->control[band].vht_mcs[i] == in ath11k_mac_bitrate_mask_get_single_nss()
8267 he_cap = ieee80211_get_he_iftype_cap_vif(sband, arvif->vif); in ath11k_mac_bitrate_mask_get_single_nss()
8273 for (i = 0; i < ARRAY_SIZE(mask->control[band].he_mcs); i++) { in ath11k_mac_bitrate_mask_get_single_nss()
8274 if (mask->control[band].he_mcs[i] == 0) in ath11k_mac_bitrate_mask_get_single_nss()
8277 if (mask->control[band].he_mcs[i] == in ath11k_mac_bitrate_mask_get_single_nss()
8290 if (BIT(fls(ht_nss_mask)) - 1 != ht_nss_mask) in ath11k_mac_bitrate_mask_get_single_nss()
8309 if (hweight32(mask->control[band].legacy) != 1) in ath11k_mac_get_single_legacy_rate()
8310 return -EINVAL; in ath11k_mac_get_single_legacy_rate()
8312 rate_idx = ffs(mask->control[band].legacy) - 1; in ath11k_mac_get_single_legacy_rate()
8334 struct ath11k *ar = arvif->ar; in ath11k_mac_set_fixed_rate_gi_ltf()
8341 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_fixed_rate_gi_ltf()
8344 ath11k_warn(ar->ab, "failed to set he gi %d: %d\n", in ath11k_mac_set_fixed_rate_gi_ltf()
8352 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_fixed_rate_gi_ltf()
8355 ath11k_warn(ar->ab, "failed to set he ltf %d: %d\n", in ath11k_mac_set_fixed_rate_gi_ltf()
8366 struct ath11k *ar = arvif->ar; in ath11k_mac_set_auto_rate_gi_ltf()
8382 ath11k_warn(ar->ab, "invalid he gi: %d\n", he_gi); in ath11k_mac_set_auto_rate_gi_ltf()
8383 return -EINVAL; in ath11k_mac_set_auto_rate_gi_ltf()
8399 ath11k_warn(ar->ab, "invalid he ltf: %d\n", he_ltf); in ath11k_mac_set_auto_rate_gi_ltf()
8400 return -EINVAL; in ath11k_mac_set_auto_rate_gi_ltf()
8405 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_auto_rate_gi_ltf()
8409 ath11k_warn(ar->ab, in ath11k_mac_set_auto_rate_gi_ltf()
8422 struct ath11k *ar = arvif->ar; in ath11k_mac_set_rate_params()
8426 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_set_rate_params()
8428 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_set_rate_params()
8430 arvif->vdev_id, rate, nss, sgi, ldpc, he_gi, in ath11k_mac_set_rate_params()
8433 if (!arvif->vif->bss_conf.he_support) { in ath11k_mac_set_rate_params()
8435 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_rate_params()
8438 ath11k_warn(ar->ab, "failed to set fixed rate param 0x%02x: %d\n", in ath11k_mac_set_rate_params()
8445 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_rate_params()
8448 ath11k_warn(ar->ab, "failed to set nss param %d: %d\n", in ath11k_mac_set_rate_params()
8454 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_rate_params()
8457 ath11k_warn(ar->ab, "failed to set ldpc param %d: %d\n", in ath11k_mac_set_rate_params()
8462 if (arvif->vif->bss_conf.he_support) { in ath11k_mac_set_rate_params()
8467 ath11k_warn(ar->ab, "failed to set fixed rate gi ltf: %d\n", in ath11k_mac_set_rate_params()
8475 ath11k_warn(ar->ab, "failed to set auto rate gi ltf: %d\n", in ath11k_mac_set_rate_params()
8482 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_rate_params()
8485 ath11k_warn(ar->ab, "failed to set sgi param %d: %d\n", in ath11k_mac_set_rate_params()
8503 vht_mcs = mask->control[band].vht_mcs[i]; in ath11k_mac_vht_mcs_range_present()
8507 case BIT(8) - 1: in ath11k_mac_vht_mcs_range_present()
8508 case BIT(9) - 1: in ath11k_mac_vht_mcs_range_present()
8509 case BIT(10) - 1: in ath11k_mac_vht_mcs_range_present()
8528 he_mcs = mask->control[band].he_mcs[i]; in ath11k_mac_he_mcs_range_present()
8532 case BIT(8) - 1: in ath11k_mac_he_mcs_range_present()
8533 case BIT(10) - 1: in ath11k_mac_he_mcs_range_present()
8534 case BIT(12) - 1: in ath11k_mac_he_mcs_range_present()
8549 struct ath11k *ar = arvif->ar; in ath11k_mac_set_bitrate_mask_iter()
8551 spin_lock_bh(&ar->data_lock); in ath11k_mac_set_bitrate_mask_iter()
8552 arsta->changed |= IEEE80211_RC_SUPP_RATES_CHANGED; in ath11k_mac_set_bitrate_mask_iter()
8553 spin_unlock_bh(&ar->data_lock); in ath11k_mac_set_bitrate_mask_iter()
8555 ieee80211_queue_work(ar->hw, &arsta->update_wk); in ath11k_mac_set_bitrate_mask_iter()
8562 struct ath11k *ar = arvif->ar; in ath11k_mac_disable_peer_fixed_rate()
8565 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_disable_peer_fixed_rate()
8566 arvif->vdev_id, in ath11k_mac_disable_peer_fixed_rate()
8570 ath11k_warn(ar->ab, in ath11k_mac_disable_peer_fixed_rate()
8572 sta->addr, ret); in ath11k_mac_disable_peer_fixed_rate()
8586 vht_mcs_mask = mask->control[band].vht_mcs; in ath11k_mac_validate_vht_he_fixed_rate_settings()
8587 he_mcs_mask = mask->control[band].he_mcs; in ath11k_mac_validate_vht_he_fixed_rate_settings()
8602 spin_lock_bh(&ar->ab->base_lock); in ath11k_mac_validate_vht_he_fixed_rate_settings()
8603 list_for_each_entry(peer, &ar->ab->peers, list) { in ath11k_mac_validate_vht_he_fixed_rate_settings()
8604 if (peer->sta) { in ath11k_mac_validate_vht_he_fixed_rate_settings()
8605 deflink = &peer->sta->deflink; in ath11k_mac_validate_vht_he_fixed_rate_settings()
8607 if (vht_fixed_rate && (!deflink->vht_cap.vht_supported || in ath11k_mac_validate_vht_he_fixed_rate_settings()
8608 deflink->rx_nss < vht_nss)) { in ath11k_mac_validate_vht_he_fixed_rate_settings()
8613 if (he_fixed_rate && (!deflink->he_cap.has_he || in ath11k_mac_validate_vht_he_fixed_rate_settings()
8614 deflink->rx_nss < he_nss)) { in ath11k_mac_validate_vht_he_fixed_rate_settings()
8622 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_validate_vht_he_fixed_rate_settings()
8635 struct ath11k *ar = arvif->ar; in ath11k_mac_op_set_bitrate_mask()
8652 return -EPERM; in ath11k_mac_op_set_bitrate_mask()
8654 band = def.chan->band; in ath11k_mac_op_set_bitrate_mask()
8655 cap = &ar->pdev->cap; in ath11k_mac_op_set_bitrate_mask()
8656 ht_mcs_mask = mask->control[band].ht_mcs; in ath11k_mac_op_set_bitrate_mask()
8657 vht_mcs_mask = mask->control[band].vht_mcs; in ath11k_mac_op_set_bitrate_mask()
8658 he_mcs_mask = mask->control[band].he_mcs; in ath11k_mac_op_set_bitrate_mask()
8659 ldpc = !!(cap->band[band].ht_cap_info & WMI_HT_CAP_TX_LDPC); in ath11k_mac_op_set_bitrate_mask()
8661 sgi = mask->control[band].gi; in ath11k_mac_op_set_bitrate_mask()
8663 return -EINVAL; in ath11k_mac_op_set_bitrate_mask()
8665 he_gi = mask->control[band].he_gi; in ath11k_mac_op_set_bitrate_mask()
8666 he_ltf = mask->control[band].he_ltf; in ath11k_mac_op_set_bitrate_mask()
8680 ath11k_warn(ar->ab, "failed to get single legacy rate for vdev %i: %d\n", in ath11k_mac_op_set_bitrate_mask()
8681 arvif->vdev_id, ret); in ath11k_mac_op_set_bitrate_mask()
8684 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_mac_op_set_bitrate_mask()
8691 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
8692 arvif->bitrate_mask = *mask; in ath11k_mac_op_set_bitrate_mask()
8693 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_mac_op_set_bitrate_mask()
8696 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
8701 ath11k_warn(ar->ab, in ath11k_mac_op_set_bitrate_mask()
8703 nss = min_t(u32, ar->num_tx_chains, in ath11k_mac_op_set_bitrate_mask()
8709 * - Single VHT Rate : peer_assoc command accommodates only MCS in ath11k_mac_op_set_bitrate_mask()
8710 * range values i.e 0-7, 0-8, 0-9 for VHT. Though mac80211 in ath11k_mac_op_set_bitrate_mask()
8716 * If single VHT rate is passed along with HT rates, we select in ath11k_mac_op_set_bitrate_mask()
8718 * - Multiple VHT Rates : When Multiple VHT rates are given,this in ath11k_mac_op_set_bitrate_mask()
8719 * can be set using RATEMASK CMD which uses FW rate-ctl alg. in ath11k_mac_op_set_bitrate_mask()
8734 ath11k_warn(ar->ab, in ath11k_mac_op_set_bitrate_mask()
8737 return -EINVAL; in ath11k_mac_op_set_bitrate_mask()
8747 ath11k_warn(ar->ab, in ath11k_mac_op_set_bitrate_mask()
8749 return -EINVAL; in ath11k_mac_op_set_bitrate_mask()
8752 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
8753 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_mac_op_set_bitrate_mask()
8757 arvif->bitrate_mask = *mask; in ath11k_mac_op_set_bitrate_mask()
8758 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_mac_op_set_bitrate_mask()
8762 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
8765 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
8770 ath11k_warn(ar->ab, "failed to set rate params on vdev %i: %d\n", in ath11k_mac_op_set_bitrate_mask()
8771 arvif->vdev_id, ret); in ath11k_mac_op_set_bitrate_mask()
8774 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
8783 struct ath11k *ar = hw->priv; in ath11k_mac_op_reconfig_complete()
8784 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_reconfig_complete()
8791 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_reconfig_complete()
8793 if (ar->state == ATH11K_STATE_RESTARTED) { in ath11k_mac_op_reconfig_complete()
8794 ath11k_warn(ar->ab, "pdev %d successfully recovered\n", in ath11k_mac_op_reconfig_complete()
8795 ar->pdev->pdev_id); in ath11k_mac_op_reconfig_complete()
8796 ar->state = ATH11K_STATE_ON; in ath11k_mac_op_reconfig_complete()
8797 ieee80211_wake_queues(ar->hw); in ath11k_mac_op_reconfig_complete()
8799 if (ar->ab->hw_params.current_cc_support && in ath11k_mac_op_reconfig_complete()
8800 ar->alpha2[0] != 0 && ar->alpha2[1] != 0) in ath11k_mac_op_reconfig_complete()
8803 if (ab->is_reset) { in ath11k_mac_op_reconfig_complete()
8804 recovery_count = atomic_inc_return(&ab->recovery_count); in ath11k_mac_op_reconfig_complete()
8810 if (recovery_count == ab->num_radios) { in ath11k_mac_op_reconfig_complete()
8811 atomic_dec(&ab->reset_count); in ath11k_mac_op_reconfig_complete()
8812 complete(&ab->reset_complete); in ath11k_mac_op_reconfig_complete()
8813 ab->is_reset = false; in ath11k_mac_op_reconfig_complete()
8814 atomic_set(&ab->fail_cont_count, 0); in ath11k_mac_op_reconfig_complete()
8818 if (ar->ab->hw_params.support_fw_mac_sequence) { in ath11k_mac_op_reconfig_complete()
8819 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_mac_op_reconfig_complete()
8820 if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath11k_mac_op_reconfig_complete()
8821 ieee80211_hw_restart_disconnect(arvif->vif); in ath11k_mac_op_reconfig_complete()
8826 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_reconfig_complete()
8836 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_update_bss_chan_survey()
8838 if (!test_bit(WMI_TLV_SERVICE_BSS_CHANNEL_INFO_64, ar->ab->wmi_ab.svc_map) || in ath11k_mac_update_bss_chan_survey()
8839 ar->rx_channel != channel) in ath11k_mac_update_bss_chan_survey()
8842 if (ar->scan.state != ATH11K_SCAN_IDLE) { in ath11k_mac_update_bss_chan_survey()
8843 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_update_bss_chan_survey()
8848 reinit_completion(&ar->bss_survey_done); in ath11k_mac_update_bss_chan_survey()
8852 ath11k_warn(ar->ab, "failed to send pdev bss chan info request\n"); in ath11k_mac_update_bss_chan_survey()
8856 ret = wait_for_completion_timeout(&ar->bss_survey_done, 3 * HZ); in ath11k_mac_update_bss_chan_survey()
8858 ath11k_warn(ar->ab, "bss channel survey timed out\n"); in ath11k_mac_update_bss_chan_survey()
8864 struct ath11k *ar = hw->priv; in ath11k_mac_op_get_survey()
8870 return -ENOENT; in ath11k_mac_op_get_survey()
8872 ar_survey = &ar->survey[idx]; in ath11k_mac_op_get_survey()
8874 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_get_survey()
8876 sband = hw->wiphy->bands[NL80211_BAND_2GHZ]; in ath11k_mac_op_get_survey()
8877 if (sband && idx >= sband->n_channels) { in ath11k_mac_op_get_survey()
8878 idx -= sband->n_channels; in ath11k_mac_op_get_survey()
8883 sband = hw->wiphy->bands[NL80211_BAND_5GHZ]; in ath11k_mac_op_get_survey()
8884 if (sband && idx >= sband->n_channels) { in ath11k_mac_op_get_survey()
8885 idx -= sband->n_channels; in ath11k_mac_op_get_survey()
8890 sband = hw->wiphy->bands[NL80211_BAND_6GHZ]; in ath11k_mac_op_get_survey()
8891 if (!sband || idx >= sband->n_channels) { in ath11k_mac_op_get_survey()
8892 ret = -ENOENT; in ath11k_mac_op_get_survey()
8896 ath11k_mac_update_bss_chan_survey(ar, &sband->channels[idx]); in ath11k_mac_op_get_survey()
8898 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_get_survey()
8900 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_get_survey()
8902 survey->channel = &sband->channels[idx]; in ath11k_mac_op_get_survey()
8904 if (ar->rx_channel == survey->channel) in ath11k_mac_op_get_survey()
8905 survey->filled |= SURVEY_INFO_IN_USE; in ath11k_mac_op_get_survey()
8908 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_get_survey()
8917 struct ath11k *ar = arsta->arvif->ar; in ath11k_mac_put_chain_rssi()
8921 for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) { in ath11k_mac_put_chain_rssi()
8922 sinfo->chains &= ~BIT(i); in ath11k_mac_put_chain_rssi()
8923 rssi = arsta->chain_signal[i]; in ath11k_mac_put_chain_rssi()
8925 arsta->chain_signal[i] = ATH11K_INVALID_RSSI_FULL; in ath11k_mac_put_chain_rssi()
8927 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_put_chain_rssi()
8934 sinfo->chain_signal[i] = rssi; in ath11k_mac_put_chain_rssi()
8935 sinfo->chains |= BIT(i); in ath11k_mac_put_chain_rssi()
8936 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); in ath11k_mac_put_chain_rssi()
8947 struct ath11k *ar = arsta->arvif->ar; in ath11k_mac_op_sta_statistics()
8950 ar->ab->wmi_ab.svc_map); in ath11k_mac_op_sta_statistics()
8952 sinfo->rx_duration = arsta->rx_duration; in ath11k_mac_op_sta_statistics()
8953 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION); in ath11k_mac_op_sta_statistics()
8955 sinfo->tx_duration = arsta->tx_duration; in ath11k_mac_op_sta_statistics()
8956 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_DURATION); in ath11k_mac_op_sta_statistics()
8958 if (arsta->txrate.legacy || arsta->txrate.nss) { in ath11k_mac_op_sta_statistics()
8959 if (arsta->txrate.legacy) { in ath11k_mac_op_sta_statistics()
8960 sinfo->txrate.legacy = arsta->txrate.legacy; in ath11k_mac_op_sta_statistics()
8962 sinfo->txrate.mcs = arsta->txrate.mcs; in ath11k_mac_op_sta_statistics()
8963 sinfo->txrate.nss = arsta->txrate.nss; in ath11k_mac_op_sta_statistics()
8964 sinfo->txrate.bw = arsta->txrate.bw; in ath11k_mac_op_sta_statistics()
8965 sinfo->txrate.he_gi = arsta->txrate.he_gi; in ath11k_mac_op_sta_statistics()
8966 sinfo->txrate.he_dcm = arsta->txrate.he_dcm; in ath11k_mac_op_sta_statistics()
8967 sinfo->txrate.he_ru_alloc = arsta->txrate.he_ru_alloc; in ath11k_mac_op_sta_statistics()
8969 sinfo->txrate.flags = arsta->txrate.flags; in ath11k_mac_op_sta_statistics()
8970 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in ath11k_mac_op_sta_statistics()
8975 if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL)) && in ath11k_mac_op_sta_statistics()
8976 arsta->arvif->vdev_type == WMI_VDEV_TYPE_STA && in ath11k_mac_op_sta_statistics()
8977 ar->ab->hw_params.supports_rssi_stats && in ath11k_mac_op_sta_statistics()
8978 !ath11k_debugfs_get_fw_stats(ar, ar->pdev->pdev_id, 0, in ath11k_mac_op_sta_statistics()
8983 signal = arsta->rssi_comb; in ath11k_mac_op_sta_statistics()
8985 arsta->arvif->vdev_type == WMI_VDEV_TYPE_STA && in ath11k_mac_op_sta_statistics()
8986 ar->ab->hw_params.supports_rssi_stats && in ath11k_mac_op_sta_statistics()
8987 !(ath11k_debugfs_get_fw_stats(ar, ar->pdev->pdev_id, 0, in ath11k_mac_op_sta_statistics()
8989 signal = arsta->rssi_beacon; in ath11k_mac_op_sta_statistics()
8991 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_sta_statistics()
8993 db2dbm, arsta->rssi_comb, arsta->rssi_beacon); in ath11k_mac_op_sta_statistics()
8996 sinfo->signal = db2dbm ? signal : signal + ATH11K_DEFAULT_NOISE_FLOOR; in ath11k_mac_op_sta_statistics()
8997 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); in ath11k_mac_op_sta_statistics()
9000 sinfo->signal_avg = ewma_avg_rssi_read(&arsta->avg_rssi); in ath11k_mac_op_sta_statistics()
9003 sinfo->signal_avg += ATH11K_DEFAULT_NOISE_FLOOR; in ath11k_mac_op_sta_statistics()
9005 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); in ath11k_mac_op_sta_statistics()
9014 for (i = 0; i < offload->ipv6_count; i++) { in ath11k_generate_ns_mc_addr()
9015 offload->self_ipv6_addr[i][0] = 0xff; in ath11k_generate_ns_mc_addr()
9016 offload->self_ipv6_addr[i][1] = 0x02; in ath11k_generate_ns_mc_addr()
9017 offload->self_ipv6_addr[i][11] = 0x01; in ath11k_generate_ns_mc_addr()
9018 offload->self_ipv6_addr[i][12] = 0xff; in ath11k_generate_ns_mc_addr()
9019 offload->self_ipv6_addr[i][13] = in ath11k_generate_ns_mc_addr()
9020 offload->ipv6_addr[i][13]; in ath11k_generate_ns_mc_addr()
9021 offload->self_ipv6_addr[i][14] = in ath11k_generate_ns_mc_addr()
9022 offload->ipv6_addr[i][14]; in ath11k_generate_ns_mc_addr()
9023 offload->self_ipv6_addr[i][15] = in ath11k_generate_ns_mc_addr()
9024 offload->ipv6_addr[i][15]; in ath11k_generate_ns_mc_addr()
9025 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "NS solicited addr %pI6\n", in ath11k_generate_ns_mc_addr()
9026 offload->self_ipv6_addr[i]); in ath11k_generate_ns_mc_addr()
9034 struct ath11k *ar = hw->priv; in ath11k_mac_op_ipv6_changed()
9041 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "op ipv6 changed\n"); in ath11k_mac_op_ipv6_changed()
9043 offload = &arvif->arp_ns_offload; in ath11k_mac_op_ipv6_changed()
9052 read_lock_bh(&idev->lock); in ath11k_mac_op_ipv6_changed()
9054 memset(offload->ipv6_addr, 0, sizeof(offload->ipv6_addr)); in ath11k_mac_op_ipv6_changed()
9055 memset(offload->self_ipv6_addr, 0, sizeof(offload->self_ipv6_addr)); in ath11k_mac_op_ipv6_changed()
9056 memcpy(offload->mac_addr, vif->addr, ETH_ALEN); in ath11k_mac_op_ipv6_changed()
9059 list_for_each_entry(ifa6, &idev->addr_list, if_list) { in ath11k_mac_op_ipv6_changed()
9063 if (ifa6->flags & IFA_F_DADFAILED) in ath11k_mac_op_ipv6_changed()
9065 scope = ipv6_addr_src_scope(&ifa6->addr); in ath11k_mac_op_ipv6_changed()
9068 memcpy(offload->ipv6_addr[count], &ifa6->addr.s6_addr, in ath11k_mac_op_ipv6_changed()
9069 sizeof(ifa6->addr.s6_addr)); in ath11k_mac_op_ipv6_changed()
9070 offload->ipv6_type[count] = ATH11K_IPV6_UC_TYPE; in ath11k_mac_op_ipv6_changed()
9071 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "count %d ipv6 uc %pI6 scope %d\n", in ath11k_mac_op_ipv6_changed()
9072 count, offload->ipv6_addr[count], in ath11k_mac_op_ipv6_changed()
9076 ath11k_warn(ar->ab, "Unsupported ipv6 scope: %d\n", scope); in ath11k_mac_op_ipv6_changed()
9081 for (ifaca6 = rcu_dereference(idev->ac_list); ifaca6; in ath11k_mac_op_ipv6_changed()
9082 ifaca6 = rcu_dereference(ifaca6->aca_next)) { in ath11k_mac_op_ipv6_changed()
9086 scope = ipv6_addr_src_scope(&ifaca6->aca_addr); in ath11k_mac_op_ipv6_changed()
9089 memcpy(offload->ipv6_addr[count], &ifaca6->aca_addr, in ath11k_mac_op_ipv6_changed()
9090 sizeof(ifaca6->aca_addr)); in ath11k_mac_op_ipv6_changed()
9091 offload->ipv6_type[count] = ATH11K_IPV6_AC_TYPE; in ath11k_mac_op_ipv6_changed()
9092 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "count %d ipv6 ac %pI6 scope %d\n", in ath11k_mac_op_ipv6_changed()
9093 count, offload->ipv6_addr[count], in ath11k_mac_op_ipv6_changed()
9097 ath11k_warn(ar->ab, "Unsupported ipv scope: %d\n", scope); in ath11k_mac_op_ipv6_changed()
9102 offload->ipv6_count = count; in ath11k_mac_op_ipv6_changed()
9103 read_unlock_bh(&idev->lock); in ath11k_mac_op_ipv6_changed()
9114 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_rekey_data()
9116 struct ath11k_rekey_data *rekey_data = &arvif->rekey_data; in ath11k_mac_op_set_rekey_data()
9118 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "set rekey data vdev %d\n", in ath11k_mac_op_set_rekey_data()
9119 arvif->vdev_id); in ath11k_mac_op_set_rekey_data()
9121 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_rekey_data()
9123 memcpy(rekey_data->kck, data->kck, NL80211_KCK_LEN); in ath11k_mac_op_set_rekey_data()
9124 memcpy(rekey_data->kek, data->kek, NL80211_KEK_LEN); in ath11k_mac_op_set_rekey_data()
9126 /* The supplicant works on big-endian, the firmware expects it on in ath11k_mac_op_set_rekey_data()
9129 rekey_data->replay_ctr = get_unaligned_be64(data->replay_ctr); in ath11k_mac_op_set_rekey_data()
9131 arvif->rekey_data.enable_offload = true; in ath11k_mac_op_set_rekey_data()
9133 ath11k_dbg_dump(ar->ab, ATH11K_DBG_MAC, "kck", NULL, in ath11k_mac_op_set_rekey_data()
9134 rekey_data->kck, NL80211_KCK_LEN); in ath11k_mac_op_set_rekey_data()
9135 ath11k_dbg_dump(ar->ab, ATH11K_DBG_MAC, "kek", NULL, in ath11k_mac_op_set_rekey_data()
9136 rekey_data->kck, NL80211_KEK_LEN); in ath11k_mac_op_set_rekey_data()
9137 ath11k_dbg_dump(ar->ab, ATH11K_DBG_MAC, "replay ctr", NULL, in ath11k_mac_op_set_rekey_data()
9138 &rekey_data->replay_ctr, sizeof(rekey_data->replay_ctr)); in ath11k_mac_op_set_rekey_data()
9140 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_rekey_data()
9146 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_bios_sar_specs()
9152 if (!sar || sar->type != NL80211_SAR_TYPE_POWER || in ath11k_mac_op_set_bios_sar_specs()
9153 sar->num_sub_specs == 0) in ath11k_mac_op_set_bios_sar_specs()
9154 return -EINVAL; in ath11k_mac_op_set_bios_sar_specs()
9156 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_bios_sar_specs()
9158 if (!test_bit(WMI_TLV_SERVICE_BIOS_SAR_SUPPORT, ar->ab->wmi_ab.svc_map) || in ath11k_mac_op_set_bios_sar_specs()
9159 !ar->ab->hw_params.bios_sar_capa) { in ath11k_mac_op_set_bios_sar_specs()
9160 ret = -EOPNOTSUPP; in ath11k_mac_op_set_bios_sar_specs()
9166 ath11k_warn(ar->ab, "failed to set geo table: %d\n", ret); in ath11k_mac_op_set_bios_sar_specs()
9172 ret = -ENOMEM; in ath11k_mac_op_set_bios_sar_specs()
9176 sspec = sar->sub_specs; in ath11k_mac_op_set_bios_sar_specs()
9177 for (i = 0; i < sar->num_sub_specs; i++) { in ath11k_mac_op_set_bios_sar_specs()
9178 if (sspec->freq_range_index >= (BIOS_SAR_TABLE_LEN >> 1)) { in ath11k_mac_op_set_bios_sar_specs()
9179 ath11k_warn(ar->ab, "Ignore bad frequency index %u, max allowed %u\n", in ath11k_mac_op_set_bios_sar_specs()
9180 sspec->freq_range_index, BIOS_SAR_TABLE_LEN >> 1); in ath11k_mac_op_set_bios_sar_specs()
9185 sar_tbl[sspec->freq_range_index] = sspec->power; in ath11k_mac_op_set_bios_sar_specs()
9186 index = sspec->freq_range_index + (BIOS_SAR_TABLE_LEN >> 1); in ath11k_mac_op_set_bios_sar_specs()
9187 sar_tbl[index] = sspec->power; in ath11k_mac_op_set_bios_sar_specs()
9188 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "sar tbl[%d] = %d\n", in ath11k_mac_op_set_bios_sar_specs()
9189 sspec->freq_range_index, sar_tbl[sspec->freq_range_index]); in ath11k_mac_op_set_bios_sar_specs()
9195 ath11k_warn(ar->ab, "failed to set sar power: %d", ret); in ath11k_mac_op_set_bios_sar_specs()
9199 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_bios_sar_specs()
9207 struct ath11k *ar = hw->priv; in ath11k_mac_op_cancel_remain_on_channel()
9209 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_cancel_remain_on_channel()
9211 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_cancel_remain_on_channel()
9212 ar->scan.roc_notify = false; in ath11k_mac_op_cancel_remain_on_channel()
9213 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_cancel_remain_on_channel()
9217 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_cancel_remain_on_channel()
9219 cancel_delayed_work_sync(&ar->scan.timeout); in ath11k_mac_op_cancel_remain_on_channel()
9230 struct ath11k *ar = hw->priv; in ath11k_mac_op_remain_on_channel()
9236 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_remain_on_channel()
9238 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_remain_on_channel()
9239 switch (ar->scan.state) { in ath11k_mac_op_remain_on_channel()
9241 reinit_completion(&ar->scan.started); in ath11k_mac_op_remain_on_channel()
9242 reinit_completion(&ar->scan.completed); in ath11k_mac_op_remain_on_channel()
9243 reinit_completion(&ar->scan.on_channel); in ath11k_mac_op_remain_on_channel()
9244 ar->scan.state = ATH11K_SCAN_STARTING; in ath11k_mac_op_remain_on_channel()
9245 ar->scan.is_roc = true; in ath11k_mac_op_remain_on_channel()
9246 ar->scan.vdev_id = arvif->vdev_id; in ath11k_mac_op_remain_on_channel()
9247 ar->scan.roc_freq = chan->center_freq; in ath11k_mac_op_remain_on_channel()
9248 ar->scan.roc_notify = true; in ath11k_mac_op_remain_on_channel()
9254 ret = -EBUSY; in ath11k_mac_op_remain_on_channel()
9257 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_remain_on_channel()
9262 scan_time_msec = ar->hw->wiphy->max_remain_on_channel_duration * 2; in ath11k_mac_op_remain_on_channel()
9266 ret = -ENOMEM; in ath11k_mac_op_remain_on_channel()
9270 arg->num_chan = 1; in ath11k_mac_op_remain_on_channel()
9271 arg->chan_list = kcalloc(arg->num_chan, sizeof(*arg->chan_list), in ath11k_mac_op_remain_on_channel()
9273 if (!arg->chan_list) { in ath11k_mac_op_remain_on_channel()
9274 ret = -ENOMEM; in ath11k_mac_op_remain_on_channel()
9278 arg->vdev_id = arvif->vdev_id; in ath11k_mac_op_remain_on_channel()
9279 arg->scan_id = ATH11K_SCAN_ID; in ath11k_mac_op_remain_on_channel()
9280 arg->chan_list[0] = chan->center_freq; in ath11k_mac_op_remain_on_channel()
9281 arg->dwell_time_active = scan_time_msec; in ath11k_mac_op_remain_on_channel()
9282 arg->dwell_time_passive = scan_time_msec; in ath11k_mac_op_remain_on_channel()
9283 arg->max_scan_time = scan_time_msec; in ath11k_mac_op_remain_on_channel()
9284 arg->scan_f_passive = 1; in ath11k_mac_op_remain_on_channel()
9285 arg->burst_duration = duration; in ath11k_mac_op_remain_on_channel()
9287 if (!ar->ab->hw_params.single_pdev_only) in ath11k_mac_op_remain_on_channel()
9288 arg->scan_f_filter_prb_req = 1; in ath11k_mac_op_remain_on_channel()
9292 ath11k_warn(ar->ab, "failed to start roc scan: %d\n", ret); in ath11k_mac_op_remain_on_channel()
9294 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_remain_on_channel()
9295 ar->scan.state = ATH11K_SCAN_IDLE; in ath11k_mac_op_remain_on_channel()
9296 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_remain_on_channel()
9300 ret = wait_for_completion_timeout(&ar->scan.on_channel, 3 * HZ); in ath11k_mac_op_remain_on_channel()
9302 ath11k_warn(ar->ab, "failed to switch to channel for roc scan\n"); in ath11k_mac_op_remain_on_channel()
9305 ath11k_warn(ar->ab, "failed to stop scan: %d\n", ret); in ath11k_mac_op_remain_on_channel()
9306 ret = -ETIMEDOUT; in ath11k_mac_op_remain_on_channel()
9310 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath11k_mac_op_remain_on_channel()
9316 kfree(arg->chan_list); in ath11k_mac_op_remain_on_channel()
9320 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_remain_on_channel()
9327 struct ath11k_base *ab = ar->ab; in ath11k_fw_stats_request()
9331 lockdep_assert_held(&ar->conf_mutex); in ath11k_fw_stats_request()
9333 spin_lock_bh(&ar->data_lock); in ath11k_fw_stats_request()
9334 ar->fw_stats_done = false; in ath11k_fw_stats_request()
9335 ath11k_fw_stats_pdevs_free(&ar->fw_stats.pdevs); in ath11k_fw_stats_request()
9336 spin_unlock_bh(&ar->data_lock); in ath11k_fw_stats_request()
9338 reinit_completion(&ar->fw_stats_complete); in ath11k_fw_stats_request()
9347 time_left = wait_for_completion_timeout(&ar->fw_stats_complete, in ath11k_fw_stats_request()
9351 return -ETIMEDOUT; in ath11k_fw_stats_request()
9360 struct ath11k *ar = hw->priv; in ath11k_mac_op_get_txpower()
9361 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_get_txpower()
9372 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_get_txpower()
9374 if (ar->state != ATH11K_STATE_ON) in ath11k_mac_op_get_txpower()
9380 if (test_bit(ATH11K_CAC_RUNNING, &ar->dev_flags)) { in ath11k_mac_op_get_txpower()
9381 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_get_txpower()
9382 return -EAGAIN; in ath11k_mac_op_get_txpower()
9385 req_param.pdev_id = ar->pdev->pdev_id; in ath11k_mac_op_get_txpower()
9394 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_get_txpower()
9395 pdev = list_first_entry_or_null(&ar->fw_stats.pdevs, in ath11k_mac_op_get_txpower()
9398 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_get_txpower()
9403 *dbm = pdev->chan_tx_power / 2; in ath11k_mac_op_get_txpower()
9405 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_get_txpower()
9406 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_get_txpower()
9408 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "txpower from firmware %d, reported %d dBm\n", in ath11k_mac_op_get_txpower()
9409 pdev->chan_tx_power, *dbm); in ath11k_mac_op_get_txpower()
9413 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_get_txpower()
9414 /* We didn't get txpower from FW. Hence, relying on vif->bss_conf.txpower */ in ath11k_mac_op_get_txpower()
9415 *dbm = vif->bss_conf.txpower; in ath11k_mac_op_get_txpower()
9416 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "txpower from firmware NaN, reported %d dBm\n", in ath11k_mac_op_get_txpower()
9425 struct ath11k_base *ab = ar->ab; in ath11k_mac_station_add()
9431 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_station_add()
9436 ar->max_num_stations); in ath11k_mac_station_add()
9440 arsta->rx_stats = kzalloc(sizeof(*arsta->rx_stats), GFP_KERNEL); in ath11k_mac_station_add()
9441 if (!arsta->rx_stats) { in ath11k_mac_station_add()
9442 ret = -ENOMEM; in ath11k_mac_station_add()
9446 peer_param.vdev_id = arvif->vdev_id; in ath11k_mac_station_add()
9447 peer_param.peer_addr = sta->addr; in ath11k_mac_station_add()
9453 sta->addr, arvif->vdev_id); in ath11k_mac_station_add()
9458 sta->addr, arvif->vdev_id); in ath11k_mac_station_add()
9461 arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), GFP_KERNEL); in ath11k_mac_station_add()
9462 if (!arsta->tx_stats) { in ath11k_mac_station_add()
9463 ret = -ENOMEM; in ath11k_mac_station_add()
9470 "setting USE_4ADDR for mesh STA %pM\n", sta->addr); in ath11k_mac_station_add()
9471 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_station_add()
9472 arvif->vdev_id, in ath11k_mac_station_add()
9476 sta->addr, ret); in ath11k_mac_station_add()
9481 ret = ath11k_dp_peer_setup(ar, arvif->vdev_id, sta->addr); in ath11k_mac_station_add()
9484 sta->addr, arvif->vdev_id, ret); in ath11k_mac_station_add()
9488 if (ab->hw_params.vdev_start_delay && in ath11k_mac_station_add()
9489 !arvif->is_started && in ath11k_mac_station_add()
9490 arvif->vdev_type != WMI_VDEV_TYPE_AP) { in ath11k_mac_station_add()
9491 ret = ath11k_mac_start_vdev_delay(ar->hw, vif); in ath11k_mac_station_add()
9498 ewma_avg_rssi_init(&arsta->avg_rssi); in ath11k_mac_station_add()
9502 kfree(arsta->tx_stats); in ath11k_mac_station_add()
9503 arsta->tx_stats = NULL; in ath11k_mac_station_add()
9505 ath11k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath11k_mac_station_add()
9507 kfree(arsta->rx_stats); in ath11k_mac_station_add()
9508 arsta->rx_stats = NULL; in ath11k_mac_station_add()
9519 struct ath11k_base *ab = ar->ab; in ath11k_mac_station_remove()
9524 if (ab->hw_params.vdev_start_delay && in ath11k_mac_station_remove()
9525 arvif->is_started && in ath11k_mac_station_remove()
9526 arvif->vdev_type != WMI_VDEV_TYPE_AP) { in ath11k_mac_station_remove()
9527 ret = ath11k_mac_stop_vdev_early(ar->hw, vif); in ath11k_mac_station_remove()
9534 ath11k_dp_peer_cleanup(ar, arvif->vdev_id, sta->addr); in ath11k_mac_station_remove()
9536 ret = ath11k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath11k_mac_station_remove()
9539 sta->addr, arvif->vdev_id); in ath11k_mac_station_remove()
9542 sta->addr, arvif->vdev_id); in ath11k_mac_station_remove()
9546 kfree(arsta->tx_stats); in ath11k_mac_station_remove()
9547 arsta->tx_stats = NULL; in ath11k_mac_station_remove()
9549 kfree(arsta->rx_stats); in ath11k_mac_station_remove()
9550 arsta->rx_stats = NULL; in ath11k_mac_station_remove()
9561 struct ath11k *ar = hw->priv; in ath11k_mac_op_sta_state()
9572 cancel_work_sync(&arsta->update_wk); in ath11k_mac_op_sta_state()
9573 cancel_work_sync(&arsta->set_4addr_wk); in ath11k_mac_op_sta_state()
9576 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_sta_state()
9581 arsta->arvif = arvif; in ath11k_mac_op_sta_state()
9582 arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED; in ath11k_mac_op_sta_state()
9583 INIT_WORK(&arsta->update_wk, ath11k_sta_rc_update_wk); in ath11k_mac_op_sta_state()
9584 INIT_WORK(&arsta->set_4addr_wk, ath11k_sta_set_4addr_wk); in ath11k_mac_op_sta_state()
9588 ath11k_warn(ar->ab, "Failed to add station: %pM for VDEV: %d\n", in ath11k_mac_op_sta_state()
9589 sta->addr, arvif->vdev_id); in ath11k_mac_op_sta_state()
9594 ath11k_warn(ar->ab, "Failed to remove station: %pM for VDEV: %d\n", in ath11k_mac_op_sta_state()
9595 sta->addr, arvif->vdev_id); in ath11k_mac_op_sta_state()
9597 mutex_lock(&ar->ab->tbl_mtx_lock); in ath11k_mac_op_sta_state()
9598 spin_lock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
9599 peer = ath11k_peer_find(ar->ab, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_state()
9600 if (peer && peer->sta == sta) { in ath11k_mac_op_sta_state()
9601 ath11k_warn(ar->ab, "Found peer entry %pM n vdev %i after it was supposedly removed\n", in ath11k_mac_op_sta_state()
9602 vif->addr, arvif->vdev_id); in ath11k_mac_op_sta_state()
9603 ath11k_peer_rhash_delete(ar->ab, peer); in ath11k_mac_op_sta_state()
9604 peer->sta = NULL; in ath11k_mac_op_sta_state()
9605 list_del(&peer->list); in ath11k_mac_op_sta_state()
9607 ar->num_peers--; in ath11k_mac_op_sta_state()
9609 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
9610 mutex_unlock(&ar->ab->tbl_mtx_lock); in ath11k_mac_op_sta_state()
9613 (vif->type == NL80211_IFTYPE_AP || in ath11k_mac_op_sta_state()
9614 vif->type == NL80211_IFTYPE_MESH_POINT || in ath11k_mac_op_sta_state()
9615 vif->type == NL80211_IFTYPE_ADHOC)) { in ath11k_mac_op_sta_state()
9618 ath11k_warn(ar->ab, "Failed to associate station: %pM\n", in ath11k_mac_op_sta_state()
9619 sta->addr); in ath11k_mac_op_sta_state()
9621 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_sta_state()
9623 arsta->bw = ath11k_mac_ieee80211_sta_bw_to_wmi(ar, sta); in ath11k_mac_op_sta_state()
9624 arsta->bw_prev = arsta->bw; in ath11k_mac_op_sta_state()
9625 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_sta_state()
9628 spin_lock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
9630 peer = ath11k_peer_find(ar->ab, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_state()
9632 peer->is_authorized = true; in ath11k_mac_op_sta_state()
9634 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
9636 if (vif->type == NL80211_IFTYPE_STATION && arvif->is_up) { in ath11k_mac_op_sta_state()
9637 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_op_sta_state()
9638 arvif->vdev_id, in ath11k_mac_op_sta_state()
9642 ath11k_warn(ar->ab, "Unable to authorize peer %pM vdev %d: %d\n", in ath11k_mac_op_sta_state()
9643 sta->addr, arvif->vdev_id, ret); in ath11k_mac_op_sta_state()
9648 arvif->vdev_type == WMI_VDEV_TYPE_STA && in ath11k_mac_op_sta_state()
9649 arvif->chanctx.def.chan && in ath11k_mac_op_sta_state()
9650 arvif->chanctx.def.chan->band == NL80211_BAND_6GHZ) { in ath11k_mac_op_sta_state()
9651 reg_info = &ar->ab->reg_info_store[ar->pdev_idx]; in ath11k_mac_op_sta_state()
9652 power_type = vif->bss_conf.power_type; in ath11k_mac_op_sta_state()
9655 ath11k_warn(ar->ab, "invalid power type %d\n", in ath11k_mac_op_sta_state()
9657 ret = -EINVAL; in ath11k_mac_op_sta_state()
9659 ret = ath11k_reg_handle_chan_list(ar->ab, in ath11k_mac_op_sta_state()
9663 ath11k_warn(ar->ab, in ath11k_mac_op_sta_state()
9670 spin_lock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
9672 peer = ath11k_peer_find(ar->ab, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_state()
9674 peer->is_authorized = false; in ath11k_mac_op_sta_state()
9676 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
9679 (vif->type == NL80211_IFTYPE_AP || in ath11k_mac_op_sta_state()
9680 vif->type == NL80211_IFTYPE_MESH_POINT || in ath11k_mac_op_sta_state()
9681 vif->type == NL80211_IFTYPE_ADHOC)) { in ath11k_mac_op_sta_state()
9684 ath11k_warn(ar->ab, "Failed to disassociate station: %pM\n", in ath11k_mac_op_sta_state()
9685 sta->addr); in ath11k_mac_op_sta_state()
9688 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_sta_state()
9760 for (i = 0; i < band->n_channels; i++) { in ath11k_mac_update_ch_list()
9761 if (band->channels[i].center_freq < freq_low || in ath11k_mac_update_ch_list()
9762 band->channels[i].center_freq > freq_high) in ath11k_mac_update_ch_list()
9763 band->channels[i].flags |= IEEE80211_CHAN_DISABLED; in ath11k_mac_update_ch_list()
9769 struct ath11k_pdev *pdev = ar->pdev; in ath11k_get_phy_id()
9770 struct ath11k_pdev_cap *pdev_cap = &pdev->cap; in ath11k_get_phy_id()
9773 return pdev_cap->band[NL80211_BAND_2GHZ].phy_id; in ath11k_get_phy_id()
9776 return pdev_cap->band[NL80211_BAND_5GHZ].phy_id; in ath11k_get_phy_id()
9778 ath11k_warn(ar->ab, "unsupported phy cap:%d\n", band); in ath11k_get_phy_id()
9796 reg_cap = &ar->ab->hal_reg_cap[ar->pdev_idx]; in ath11k_mac_setup_channels_rates()
9804 return -ENOMEM; in ath11k_mac_setup_channels_rates()
9806 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath11k_mac_setup_channels_rates()
9807 band->band = NL80211_BAND_2GHZ; in ath11k_mac_setup_channels_rates()
9808 band->n_channels = ARRAY_SIZE(ath11k_2ghz_channels); in ath11k_mac_setup_channels_rates()
9809 band->channels = channels; in ath11k_mac_setup_channels_rates()
9810 band->n_bitrates = ath11k_g_rates_size; in ath11k_mac_setup_channels_rates()
9811 band->bitrates = ath11k_g_rates; in ath11k_mac_setup_channels_rates()
9812 ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = band; in ath11k_mac_setup_channels_rates()
9814 if (ar->ab->hw_params.single_pdev_only) { in ath11k_mac_setup_channels_rates()
9816 temp_reg_cap = &ar->ab->hal_reg_cap[phy_id]; in ath11k_mac_setup_channels_rates()
9819 temp_reg_cap->low_2ghz_chan, in ath11k_mac_setup_channels_rates()
9820 temp_reg_cap->high_2ghz_chan); in ath11k_mac_setup_channels_rates()
9824 if (reg_cap->high_5ghz_chan >= ATH11K_MIN_6G_FREQ) { in ath11k_mac_setup_channels_rates()
9828 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath11k_mac_setup_channels_rates()
9829 return -ENOMEM; in ath11k_mac_setup_channels_rates()
9832 ar->supports_6ghz = true; in ath11k_mac_setup_channels_rates()
9833 band = &ar->mac.sbands[NL80211_BAND_6GHZ]; in ath11k_mac_setup_channels_rates()
9834 band->band = NL80211_BAND_6GHZ; in ath11k_mac_setup_channels_rates()
9835 band->n_channels = ARRAY_SIZE(ath11k_6ghz_channels); in ath11k_mac_setup_channels_rates()
9836 band->channels = channels; in ath11k_mac_setup_channels_rates()
9837 band->n_bitrates = ath11k_a_rates_size; in ath11k_mac_setup_channels_rates()
9838 band->bitrates = ath11k_a_rates; in ath11k_mac_setup_channels_rates()
9839 ar->hw->wiphy->bands[NL80211_BAND_6GHZ] = band; in ath11k_mac_setup_channels_rates()
9841 if (ar->ab->hw_params.single_pdev_only) { in ath11k_mac_setup_channels_rates()
9843 temp_reg_cap = &ar->ab->hal_reg_cap[phy_id]; in ath11k_mac_setup_channels_rates()
9847 temp_reg_cap->low_5ghz_chan, in ath11k_mac_setup_channels_rates()
9848 temp_reg_cap->high_5ghz_chan); in ath11k_mac_setup_channels_rates()
9851 if (reg_cap->low_5ghz_chan < ATH11K_MIN_6G_FREQ) { in ath11k_mac_setup_channels_rates()
9856 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath11k_mac_setup_channels_rates()
9857 kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels); in ath11k_mac_setup_channels_rates()
9858 return -ENOMEM; in ath11k_mac_setup_channels_rates()
9861 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath11k_mac_setup_channels_rates()
9862 band->band = NL80211_BAND_5GHZ; in ath11k_mac_setup_channels_rates()
9863 band->n_channels = ARRAY_SIZE(ath11k_5ghz_channels); in ath11k_mac_setup_channels_rates()
9864 band->channels = channels; in ath11k_mac_setup_channels_rates()
9865 band->n_bitrates = ath11k_a_rates_size; in ath11k_mac_setup_channels_rates()
9866 band->bitrates = ath11k_a_rates; in ath11k_mac_setup_channels_rates()
9867 ar->hw->wiphy->bands[NL80211_BAND_5GHZ] = band; in ath11k_mac_setup_channels_rates()
9869 if (ar->ab->hw_params.single_pdev_only) { in ath11k_mac_setup_channels_rates()
9871 temp_reg_cap = &ar->ab->hal_reg_cap[phy_id]; in ath11k_mac_setup_channels_rates()
9875 temp_reg_cap->low_5ghz_chan, in ath11k_mac_setup_channels_rates()
9876 temp_reg_cap->high_5ghz_chan); in ath11k_mac_setup_channels_rates()
9889 if (!ar->ab->hw_params.support_dual_stations) in ath11k_mac_setup_mac_address_list()
9892 n_addresses = ar->ab->hw_params.num_vdevs; in ath11k_mac_setup_mac_address_list()
9897 memcpy(addresses[0].addr, ar->mac_addr, ETH_ALEN); in ath11k_mac_setup_mac_address_list()
9899 memcpy(addresses[i].addr, ar->mac_addr, ETH_ALEN); in ath11k_mac_setup_mac_address_list()
9903 addresses[i].addr[0] += (i - 1) << 4; in ath11k_mac_setup_mac_address_list()
9906 ar->hw->wiphy->addresses = addresses; in ath11k_mac_setup_mac_address_list()
9907 ar->hw->wiphy->n_addresses = n_addresses; in ath11k_mac_setup_mac_address_list()
9912 struct ath11k_base *ab = ar->ab; in ath11k_mac_setup_iface_combinations()
9918 p2p = ab->hw_params.interface_modes & BIT(NL80211_IFTYPE_P2P_DEVICE); in ath11k_mac_setup_iface_combinations()
9922 return -ENOMEM; in ath11k_mac_setup_iface_combinations()
9932 return -ENOMEM; in ath11k_mac_setup_iface_combinations()
9938 ab->hw_params.interface_modes & BIT(NL80211_IFTYPE_MESH_POINT)) in ath11k_mac_setup_iface_combinations()
9946 if (ab->hw_params.support_dual_stations) { in ath11k_mac_setup_iface_combinations()
9950 combinations[0].max_interfaces = ab->hw_params.num_vdevs; in ath11k_mac_setup_iface_combinations()
9973 ar->hw->wiphy->iface_combinations = combinations; in ath11k_mac_setup_iface_combinations()
9974 ar->hw->wiphy->n_iface_combinations = 1; in ath11k_mac_setup_iface_combinations()
10022 cancel_work_sync(&ar->regd_update_work); in __ath11k_mac_unregister()
10024 ieee80211_unregister_hw(ar->hw); in __ath11k_mac_unregister()
10026 idr_for_each(&ar->txmgmt_idr, ath11k_mac_tx_mgmt_pending_free, ar); in __ath11k_mac_unregister()
10027 idr_destroy(&ar->txmgmt_idr); in __ath11k_mac_unregister()
10029 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in __ath11k_mac_unregister()
10030 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in __ath11k_mac_unregister()
10031 kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels); in __ath11k_mac_unregister()
10033 kfree(ar->hw->wiphy->iface_combinations[0].limits); in __ath11k_mac_unregister()
10034 kfree(ar->hw->wiphy->iface_combinations); in __ath11k_mac_unregister()
10036 kfree(ar->hw->wiphy->addresses); in __ath11k_mac_unregister()
10038 SET_IEEE80211_DEV(ar->hw, NULL); in __ath11k_mac_unregister()
10047 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_unregister()
10048 pdev = &ab->pdevs[i]; in ath11k_mac_unregister()
10049 ar = pdev->ar; in ath11k_mac_unregister()
10061 struct ath11k_base *ab = ar->ab; in __ath11k_mac_register()
10062 struct ath11k_pdev_cap *cap = &ar->pdev->cap; in __ath11k_mac_register()
10079 SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr); in __ath11k_mac_register()
10082 SET_IEEE80211_DEV(ar->hw, ab->dev); in __ath11k_mac_register()
10085 cap->supported_bands); in __ath11k_mac_register()
10089 wiphy_read_of_freq_limits(ar->hw->wiphy); in __ath11k_mac_register()
10095 ath11k_err(ar->ab, "failed to setup interface combinations: %d\n", ret); in __ath11k_mac_register()
10099 ar->hw->wiphy->available_antennas_rx = cap->rx_chain_mask; in __ath11k_mac_register()
10100 ar->hw->wiphy->available_antennas_tx = cap->tx_chain_mask; in __ath11k_mac_register()
10102 ar->hw->wiphy->interface_modes = ab->hw_params.interface_modes; in __ath11k_mac_register()
10104 if (ab->hw_params.single_pdev_only && ar->supports_6ghz) in __ath11k_mac_register()
10105 ieee80211_hw_set(ar->hw, SINGLE_SCAN_ON_ALL_BANDS); in __ath11k_mac_register()
10107 if (ab->hw_params.supports_multi_bssid) { in __ath11k_mac_register()
10108 ieee80211_hw_set(ar->hw, SUPPORTS_MULTI_BSSID); in __ath11k_mac_register()
10109 ieee80211_hw_set(ar->hw, SUPPORTS_ONLY_HE_MULTI_BSSID); in __ath11k_mac_register()
10112 ieee80211_hw_set(ar->hw, SIGNAL_DBM); in __ath11k_mac_register()
10113 ieee80211_hw_set(ar->hw, SUPPORTS_PS); in __ath11k_mac_register()
10114 ieee80211_hw_set(ar->hw, SUPPORTS_DYNAMIC_PS); in __ath11k_mac_register()
10115 ieee80211_hw_set(ar->hw, MFP_CAPABLE); in __ath11k_mac_register()
10116 ieee80211_hw_set(ar->hw, REPORTS_TX_ACK_STATUS); in __ath11k_mac_register()
10117 ieee80211_hw_set(ar->hw, HAS_RATE_CONTROL); in __ath11k_mac_register()
10118 ieee80211_hw_set(ar->hw, AP_LINK_PS); in __ath11k_mac_register()
10119 ieee80211_hw_set(ar->hw, SPECTRUM_MGMT); in __ath11k_mac_register()
10120 ieee80211_hw_set(ar->hw, CONNECTION_MONITOR); in __ath11k_mac_register()
10121 ieee80211_hw_set(ar->hw, SUPPORTS_PER_STA_GTK); in __ath11k_mac_register()
10122 ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF); in __ath11k_mac_register()
10123 ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); in __ath11k_mac_register()
10124 ieee80211_hw_set(ar->hw, QUEUE_CONTROL); in __ath11k_mac_register()
10125 ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); in __ath11k_mac_register()
10126 ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); in __ath11k_mac_register()
10129 ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD); in __ath11k_mac_register()
10130 ieee80211_hw_set(ar->hw, SUPPORTS_RX_DECAP_OFFLOAD); in __ath11k_mac_register()
10133 if (cap->nss_ratio_enabled) in __ath11k_mac_register()
10134 ieee80211_hw_set(ar->hw, SUPPORTS_VHT_EXT_NSS_BW); in __ath11k_mac_register()
10136 if ((ht_cap & WMI_HT_CAP_ENABLED) || ar->supports_6ghz) { in __ath11k_mac_register()
10137 ieee80211_hw_set(ar->hw, AMPDU_AGGREGATION); in __ath11k_mac_register()
10138 ieee80211_hw_set(ar->hw, TX_AMPDU_SETUP_IN_HW); in __ath11k_mac_register()
10139 ieee80211_hw_set(ar->hw, SUPPORTS_REORDERING_BUFFER); in __ath11k_mac_register()
10140 ieee80211_hw_set(ar->hw, SUPPORTS_AMSDU_IN_AMPDU); in __ath11k_mac_register()
10141 ieee80211_hw_set(ar->hw, USES_RSS); in __ath11k_mac_register()
10144 ar->hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS; in __ath11k_mac_register()
10145 ar->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in __ath11k_mac_register()
10152 (ar->supports_6ghz && ab->hw_params.supports_dynamic_smps_6ghz)) in __ath11k_mac_register()
10153 ar->hw->wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS; in __ath11k_mac_register()
10155 ar->hw->wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID; in __ath11k_mac_register()
10156 ar->hw->wiphy->max_scan_ie_len = WLAN_SCAN_PARAMS_MAX_IE_LEN; in __ath11k_mac_register()
10158 ar->hw->max_listen_interval = ATH11K_MAX_HW_LISTEN_INTERVAL; in __ath11k_mac_register()
10160 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; in __ath11k_mac_register()
10161 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; in __ath11k_mac_register()
10162 ar->hw->wiphy->max_remain_on_channel_duration = 5000; in __ath11k_mac_register()
10164 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; in __ath11k_mac_register()
10165 ar->hw->wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE | in __ath11k_mac_register()
10168 ar->max_num_stations = TARGET_NUM_STATIONS(ab); in __ath11k_mac_register()
10169 ar->max_num_peers = TARGET_NUM_PEERS_PDEV(ab); in __ath11k_mac_register()
10171 ar->hw->wiphy->max_ap_assoc_sta = ar->max_num_stations; in __ath11k_mac_register()
10173 if (test_bit(WMI_TLV_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi->wmi_ab->svc_map)) { in __ath11k_mac_register()
10174 ar->hw->wiphy->features |= in __ath11k_mac_register()
10178 if (test_bit(WMI_TLV_SERVICE_NLO, ar->wmi->wmi_ab->svc_map)) { in __ath11k_mac_register()
10179 ar->hw->wiphy->max_sched_scan_ssids = WMI_PNO_MAX_SUPP_NETWORKS; in __ath11k_mac_register()
10180 ar->hw->wiphy->max_match_sets = WMI_PNO_MAX_SUPP_NETWORKS; in __ath11k_mac_register()
10181 ar->hw->wiphy->max_sched_scan_ie_len = WMI_PNO_MAX_IE_LENGTH; in __ath11k_mac_register()
10182 ar->hw->wiphy->max_sched_scan_plans = WMI_PNO_MAX_SCHED_SCAN_PLANS; in __ath11k_mac_register()
10183 ar->hw->wiphy->max_sched_scan_plan_interval = in __ath11k_mac_register()
10185 ar->hw->wiphy->max_sched_scan_plan_iterations = in __ath11k_mac_register()
10187 ar->hw->wiphy->features |= NL80211_FEATURE_ND_RANDOM_MAC_ADDR; in __ath11k_mac_register()
10192 ath11k_warn(ar->ab, "failed to init wow: %d\n", ret); in __ath11k_mac_register()
10197 ar->ab->wmi_ab.svc_map)) in __ath11k_mac_register()
10198 wiphy_ext_feature_set(ar->hw->wiphy, in __ath11k_mac_register()
10201 ar->hw->queues = ATH11K_HW_MAX_QUEUES; in __ath11k_mac_register()
10202 ar->hw->wiphy->tx_queue_len = ATH11K_QUEUE_LEN; in __ath11k_mac_register()
10203 ar->hw->offchannel_tx_hw_queue = ATH11K_HW_MAX_QUEUES - 1; in __ath11k_mac_register()
10204 ar->hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE; in __ath11k_mac_register()
10206 ar->hw->vif_data_size = sizeof(struct ath11k_vif); in __ath11k_mac_register()
10207 ar->hw->sta_data_size = sizeof(struct ath11k_sta); in __ath11k_mac_register()
10209 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); in __ath11k_mac_register()
10210 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_STA_TX_PWR); in __ath11k_mac_register()
10212 ar->ab->wmi_ab.svc_map)) { in __ath11k_mac_register()
10213 wiphy_ext_feature_set(ar->hw->wiphy, in __ath11k_mac_register()
10215 ieee80211_hw_set(ar->hw, DETECTS_COLOR_COLLISION); in __ath11k_mac_register()
10218 ar->hw->wiphy->cipher_suites = cipher_suites; in __ath11k_mac_register()
10219 ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); in __ath11k_mac_register()
10221 ar->hw->wiphy->iftype_ext_capab = ath11k_iftypes_ext_capa; in __ath11k_mac_register()
10222 ar->hw->wiphy->num_iftype_ext_capab = in __ath11k_mac_register()
10225 if (ar->supports_6ghz) { in __ath11k_mac_register()
10226 wiphy_ext_feature_set(ar->hw->wiphy, in __ath11k_mac_register()
10228 wiphy_ext_feature_set(ar->hw->wiphy, in __ath11k_mac_register()
10232 wiphy_ext_feature_set(ar->hw->wiphy, in __ath11k_mac_register()
10235 if (test_bit(WMI_TLV_SERVICE_RTT, ar->ab->wmi_ab.svc_map)) in __ath11k_mac_register()
10236 wiphy_ext_feature_set(ar->hw->wiphy, in __ath11k_mac_register()
10239 ar->hw->wiphy->mbssid_max_interfaces = TARGET_NUM_VDEVS(ab); in __ath11k_mac_register()
10240 ar->hw->wiphy->ema_max_profile_periodicity = TARGET_EMA_MAX_PROFILE_PERIOD; in __ath11k_mac_register()
10244 if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { in __ath11k_mac_register()
10245 ar->hw->netdev_features = NETIF_F_HW_CSUM; in __ath11k_mac_register()
10246 ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); in __ath11k_mac_register()
10247 ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT); in __ath11k_mac_register()
10250 if (test_bit(WMI_TLV_SERVICE_BIOS_SAR_SUPPORT, ar->ab->wmi_ab.svc_map) && in __ath11k_mac_register()
10251 ab->hw_params.bios_sar_capa) in __ath11k_mac_register()
10252 ar->hw->wiphy->sar_capa = ab->hw_params.bios_sar_capa; in __ath11k_mac_register()
10254 ret = ieee80211_register_hw(ar->hw); in __ath11k_mac_register()
10256 ath11k_err(ar->ab, "ieee80211 registration failed: %d\n", ret); in __ath11k_mac_register()
10260 if (!ab->hw_params.supports_monitor) in __ath11k_mac_register()
10266 ar->hw->wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MONITOR); in __ath11k_mac_register()
10271 ath11k_err(ar->ab, "ath11k regd update failed: %d\n", ret); in __ath11k_mac_register()
10275 if (ab->hw_params.current_cc_support && ab->new_alpha2[0]) { in __ath11k_mac_register()
10276 memcpy(&ar->alpha2, ab->new_alpha2, 2); in __ath11k_mac_register()
10279 ath11k_warn(ar->ab, in __ath11k_mac_register()
10285 ath11k_err(ar->ab, "debugfs registration failed: %d\n", ret); in __ath11k_mac_register()
10292 ieee80211_unregister_hw(ar->hw); in __ath11k_mac_register()
10295 kfree(ar->hw->wiphy->iface_combinations[0].limits); in __ath11k_mac_register()
10296 kfree(ar->hw->wiphy->iface_combinations); in __ath11k_mac_register()
10299 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in __ath11k_mac_register()
10300 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in __ath11k_mac_register()
10301 kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels); in __ath11k_mac_register()
10304 SET_IEEE80211_DEV(ar->hw, NULL); in __ath11k_mac_register()
10316 if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) in ath11k_mac_register()
10320 ab->cc_freq_hz = IPQ8074_CC_FREQ_HERTZ; in ath11k_mac_register()
10321 ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS(ab))) - 1; in ath11k_mac_register()
10327 device_get_mac_address(ab->dev, mac_addr); in ath11k_mac_register()
10329 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_register()
10330 pdev = &ab->pdevs[i]; in ath11k_mac_register()
10331 ar = pdev->ar; in ath11k_mac_register()
10332 if (ab->pdevs_macaddr_valid) { in ath11k_mac_register()
10333 ether_addr_copy(ar->mac_addr, pdev->mac_addr); in ath11k_mac_register()
10336 ether_addr_copy(ar->mac_addr, ab->mac_addr); in ath11k_mac_register()
10338 ether_addr_copy(ar->mac_addr, mac_addr); in ath11k_mac_register()
10339 ar->mac_addr[4] += i; in ath11k_mac_register()
10342 idr_init(&ar->txmgmt_idr); in ath11k_mac_register()
10343 spin_lock_init(&ar->txmgmt_idr_lock); in ath11k_mac_register()
10349 init_waitqueue_head(&ar->txmgmt_empty_waitq); in ath11k_mac_register()
10355 for (i = i - 1; i >= 0; i--) { in ath11k_mac_register()
10356 pdev = &ab->pdevs[i]; in ath11k_mac_register()
10357 ar = pdev->ar; in ath11k_mac_register()
10374 if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) in ath11k_mac_allocate()
10377 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_allocate()
10378 pdev = &ab->pdevs[i]; in ath11k_mac_allocate()
10382 ret = -ENOMEM; in ath11k_mac_allocate()
10386 ar = hw->priv; in ath11k_mac_allocate()
10387 ar->hw = hw; in ath11k_mac_allocate()
10388 ar->ab = ab; in ath11k_mac_allocate()
10389 ar->pdev = pdev; in ath11k_mac_allocate()
10390 ar->pdev_idx = i; in ath11k_mac_allocate()
10391 ar->lmac_id = ath11k_hw_get_mac_from_pdev_id(&ab->hw_params, i); in ath11k_mac_allocate()
10393 ar->wmi = &ab->wmi_ab.wmi[i]; in ath11k_mac_allocate()
10399 ar->cfg_tx_chainmask = pdev->cap.tx_chain_mask; in ath11k_mac_allocate()
10400 ar->cfg_rx_chainmask = pdev->cap.rx_chain_mask; in ath11k_mac_allocate()
10401 ar->num_tx_chains = get_num_chains(pdev->cap.tx_chain_mask); in ath11k_mac_allocate()
10402 ar->num_rx_chains = get_num_chains(pdev->cap.rx_chain_mask); in ath11k_mac_allocate()
10404 pdev->ar = ar; in ath11k_mac_allocate()
10405 spin_lock_init(&ar->data_lock); in ath11k_mac_allocate()
10406 INIT_LIST_HEAD(&ar->arvifs); in ath11k_mac_allocate()
10407 INIT_LIST_HEAD(&ar->ppdu_stats_info); in ath11k_mac_allocate()
10408 mutex_init(&ar->conf_mutex); in ath11k_mac_allocate()
10409 init_completion(&ar->vdev_setup_done); in ath11k_mac_allocate()
10410 init_completion(&ar->vdev_delete_done); in ath11k_mac_allocate()
10411 init_completion(&ar->peer_assoc_done); in ath11k_mac_allocate()
10412 init_completion(&ar->peer_delete_done); in ath11k_mac_allocate()
10413 init_completion(&ar->install_key_done); in ath11k_mac_allocate()
10414 init_completion(&ar->bss_survey_done); in ath11k_mac_allocate()
10415 init_completion(&ar->scan.started); in ath11k_mac_allocate()
10416 init_completion(&ar->scan.completed); in ath11k_mac_allocate()
10417 init_completion(&ar->scan.on_channel); in ath11k_mac_allocate()
10418 init_completion(&ar->thermal.wmi_sync); in ath11k_mac_allocate()
10420 INIT_DELAYED_WORK(&ar->scan.timeout, ath11k_scan_timeout_work); in ath11k_mac_allocate()
10421 INIT_WORK(&ar->regd_update_work, ath11k_regd_update_work); in ath11k_mac_allocate()
10423 INIT_WORK(&ar->wmi_mgmt_tx_work, ath11k_mgmt_over_wmi_tx_work); in ath11k_mac_allocate()
10424 skb_queue_head_init(&ar->wmi_mgmt_tx_queue); in ath11k_mac_allocate()
10426 clear_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags); in ath11k_mac_allocate()
10428 ar->monitor_vdev_id = -1; in ath11k_mac_allocate()
10429 clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); in ath11k_mac_allocate()
10430 ar->vdev_id_11d_scan = ATH11K_11D_INVALID_VDEV_ID; in ath11k_mac_allocate()
10431 init_completion(&ar->completed_11d_scan); in ath11k_mac_allocate()
10450 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_destroy()
10451 pdev = &ab->pdevs[i]; in ath11k_mac_destroy()
10452 ar = pdev->ar; in ath11k_mac_destroy()
10456 ath11k_fw_stats_free(&ar->fw_stats); in ath11k_mac_destroy()
10457 ieee80211_free_hw(ar->hw); in ath11k_mac_destroy()
10458 pdev->ar = NULL; in ath11k_mac_destroy()
10466 struct ath11k *ar = arvif->ar; in ath11k_mac_vif_set_keepalive()
10470 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vif_set_keepalive()
10472 if (arvif->vdev_type != WMI_VDEV_TYPE_STA) in ath11k_mac_vif_set_keepalive()
10475 if (!test_bit(WMI_TLV_SERVICE_STA_KEEP_ALIVE, ar->ab->wmi_ab.svc_map)) in ath11k_mac_vif_set_keepalive()
10478 arg.vdev_id = arvif->vdev_id; in ath11k_mac_vif_set_keepalive()
10485 ath11k_warn(ar->ab, "failed to set keepalive on vdev %i: %d\n", in ath11k_mac_vif_set_keepalive()
10486 arvif->vdev_id, ret); in ath11k_mac_vif_set_keepalive()