Lines Matching +full:in +full:- +full:band

1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
28 .band = NL80211_BAND_2GHZ, \
37 .band = NL80211_BAND_5GHZ, \
46 .band = NL80211_BAND_6GHZ, \
163 /* new addition in IEEE Std 802.11ax-2021 */
243 #define ath11k_a_rates_size (ARRAY_SIZE(ath11k_legacy_rates) - 4)
245 #define ATH11K_MAC_SCAN_CMD_EVT_OVERHEAD 200 /* in msecs */
248 #define ATH11K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD 10 /* in msecs */
407 return -EINVAL; in ath11k_mac_hw_ratecode_to_legacy_rate()
428 for (i = 0; i < sband->n_bitrates; i++) in ath11k_mac_bitrate_to_idx()
429 if (sband->bitrates[i].bitrate == bitrate) in ath11k_mac_bitrate_to_idx()
440 for (nss = IEEE80211_HT_MCS_MASK_LEN - 1; nss >= 0; nss--) in ath11k_mac_max_ht_nss()
452 for (nss = NL80211_VHT_NSS_MAX - 1; nss >= 0; nss--) in ath11k_mac_max_vht_nss()
464 for (nss = NL80211_HE_NSS_MAX - 1; nss >= 0; nss--) in ath11k_mac_max_he_nss()
512 conf = rcu_dereference(vif->bss_conf.chanctx_conf); in ath11k_mac_vif_chan()
515 return -ENOENT; in ath11k_mac_vif_chan()
518 *def = conf->def; in ath11k_mac_vif_chan()
543 for (i = 0; i < sband->n_bitrates; i++) { in ath11k_mac_hw_rate_to_idx()
544 rate = &sband->bitrates[i]; in ath11k_mac_hw_rate_to_idx()
546 if (ath11k_mac_bitrate_is_cck(rate->bitrate) != cck) in ath11k_mac_hw_rate_to_idx()
549 if (rate->hw_value == hw_rate) in ath11k_mac_hw_rate_to_idx()
551 else if (rate->flags & IEEE80211_RATE_SHORT_PREAMBLE && in ath11k_mac_hw_rate_to_idx()
552 rate->hw_value_short == hw_rate) in ath11k_mac_hw_rate_to_idx()
569 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_get_arvif_iter()
571 if (arvif->vdev_id == arvif_iter->vdev_id) in ath11k_get_arvif_iter()
572 arvif_iter->arvif = arvif; in ath11k_get_arvif_iter()
584 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_get_arvif()
589 ath11k_warn(ar->ab, "No VIF found for vdev %d\n", vdev_id); in ath11k_mac_get_arvif()
603 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_get_arvif_by_vdev_id()
604 pdev = rcu_dereference(ab->pdevs_active[i]); in ath11k_mac_get_arvif_by_vdev_id()
605 if (pdev && pdev->ar && in ath11k_mac_get_arvif_by_vdev_id()
606 (pdev->ar->allocated_vdev_map & (1LL << vdev_id))) { in ath11k_mac_get_arvif_by_vdev_id()
607 arvif = ath11k_mac_get_arvif(pdev->ar, vdev_id); in ath11k_mac_get_arvif_by_vdev_id()
621 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_get_ar_by_vdev_id()
622 pdev = rcu_dereference(ab->pdevs_active[i]); in ath11k_mac_get_ar_by_vdev_id()
623 if (pdev && pdev->ar) { in ath11k_mac_get_ar_by_vdev_id()
624 if (pdev->ar->allocated_vdev_map & (1LL << vdev_id)) in ath11k_mac_get_ar_by_vdev_id()
625 return pdev->ar; in ath11k_mac_get_ar_by_vdev_id()
637 if (ab->hw_params.single_pdev_only) { in ath11k_mac_get_ar_by_pdev_id()
638 pdev = rcu_dereference(ab->pdevs_active[0]); in ath11k_mac_get_ar_by_pdev_id()
639 return pdev ? pdev->ar : NULL; in ath11k_mac_get_ar_by_pdev_id()
642 if (WARN_ON(pdev_id > ab->num_radios)) in ath11k_mac_get_ar_by_pdev_id()
645 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_get_ar_by_pdev_id()
646 if (ab->fw_mode == ATH11K_FIRMWARE_MODE_FTM) in ath11k_mac_get_ar_by_pdev_id()
647 pdev = &ab->pdevs[i]; in ath11k_mac_get_ar_by_pdev_id()
649 pdev = rcu_dereference(ab->pdevs_active[i]); in ath11k_mac_get_ar_by_pdev_id()
651 if (pdev && pdev->pdev_id == pdev_id) in ath11k_mac_get_ar_by_pdev_id()
652 return (pdev->ar ? pdev->ar : NULL); in ath11k_mac_get_ar_by_pdev_id()
665 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_get_vif_up()
666 pdev = &ab->pdevs[i]; in ath11k_mac_get_vif_up()
667 ar = pdev->ar; in ath11k_mac_get_vif_up()
668 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_mac_get_vif_up()
669 if (arvif->is_up) in ath11k_mac_get_vif_up()
686 struct ath11k *ar = arvif->ar; in ath11k_mac_get_target_pdev_id_from_vif()
687 struct ath11k_base *ab = ar->ab; in ath11k_mac_get_target_pdev_id_from_vif()
688 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_get_target_pdev_id_from_vif()
690 enum nl80211_band band; in ath11k_mac_get_target_pdev_id_from_vif() local
691 u8 pdev_id = ab->target_pdev_ids[0].pdev_id; in ath11k_mac_get_target_pdev_id_from_vif()
697 band = def.chan->band; in ath11k_mac_get_target_pdev_id_from_vif()
699 for (i = 0; i < ab->target_pdev_count; i++) { in ath11k_mac_get_target_pdev_id_from_vif()
700 if (ath11k_mac_band_match(band, ab->target_pdev_ids[i].supported_bands)) in ath11k_mac_get_target_pdev_id_from_vif()
701 return ab->target_pdev_ids[i].pdev_id; in ath11k_mac_get_target_pdev_id_from_vif()
711 arvif = ath11k_mac_get_vif_up(ar->ab); in ath11k_mac_get_target_pdev_id()
716 return ar->ab->target_pdev_ids[0].pdev_id; in ath11k_mac_get_target_pdev_id()
721 struct ath11k_base *ab = ar->ab; in ath11k_pdev_caps_update()
723 ar->max_tx_power = ab->target_caps.hw_max_tx_power; in ath11k_pdev_caps_update()
725 /* FIXME Set min_tx_power to ab->target_caps.hw_min_tx_power. in ath11k_pdev_caps_update()
726 * But since the received value in svcrdy is same as hw_max_tx_power, in ath11k_pdev_caps_update()
727 * we can set ar->min_tx_power to 0 currently until in ath11k_pdev_caps_update()
728 * this is fixed in firmware in ath11k_pdev_caps_update()
730 ar->min_tx_power = 0; in ath11k_pdev_caps_update()
732 ar->txpower_limit_2g = ar->max_tx_power; in ath11k_pdev_caps_update()
733 ar->txpower_limit_5g = ar->max_tx_power; in ath11k_pdev_caps_update()
734 ar->txpower_scale = WMI_HOST_TP_SCALE_MAX; in ath11k_pdev_caps_update()
739 struct ath11k_pdev *pdev = ar->pdev; in ath11k_mac_txpower_recalc()
741 int ret, txpower = -1; in ath11k_mac_txpower_recalc()
744 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_txpower_recalc()
746 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_mac_txpower_recalc()
747 if (arvif->txpower <= 0) in ath11k_mac_txpower_recalc()
750 if (txpower == -1) in ath11k_mac_txpower_recalc()
751 txpower = arvif->txpower; in ath11k_mac_txpower_recalc()
753 txpower = min(txpower, arvif->txpower); in ath11k_mac_txpower_recalc()
756 if (txpower == -1) in ath11k_mac_txpower_recalc()
759 /* txpwr is set as 2 units per dBm in FW*/ in ath11k_mac_txpower_recalc()
760 txpower = min_t(u32, max_t(u32, ar->min_tx_power, txpower), in ath11k_mac_txpower_recalc()
761 ar->max_tx_power) * 2; in ath11k_mac_txpower_recalc()
763 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "txpower to set in hw %d\n", in ath11k_mac_txpower_recalc()
766 if ((pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) && in ath11k_mac_txpower_recalc()
767 ar->txpower_limit_2g != txpower) { in ath11k_mac_txpower_recalc()
770 txpower, ar->pdev->pdev_id); in ath11k_mac_txpower_recalc()
773 ar->txpower_limit_2g = txpower; in ath11k_mac_txpower_recalc()
776 if ((pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) && in ath11k_mac_txpower_recalc()
777 ar->txpower_limit_5g != txpower) { in ath11k_mac_txpower_recalc()
780 txpower, ar->pdev->pdev_id); in ath11k_mac_txpower_recalc()
783 ar->txpower_limit_5g = txpower; in ath11k_mac_txpower_recalc()
789 ath11k_warn(ar->ab, "failed to recalc txpower limit %d using pdev param %d: %d\n", in ath11k_mac_txpower_recalc()
796 struct ath11k *ar = arvif->ar; in ath11k_recalc_rtscts_prot()
800 lockdep_assert_held(&ar->conf_mutex); in ath11k_recalc_rtscts_prot()
805 * are in BSS) or by default only for second rate series. in ath11k_recalc_rtscts_prot()
806 * TODO: Check if we need to enable CTS 2 Self in any case in ath11k_recalc_rtscts_prot()
810 if (arvif->num_legacy_stations > 0) in ath11k_recalc_rtscts_prot()
816 if (arvif->rtscts_prot_mode == rts_cts) in ath11k_recalc_rtscts_prot()
819 arvif->rtscts_prot_mode = rts_cts; in ath11k_recalc_rtscts_prot()
821 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %d recalc rts/cts prot %d\n", in ath11k_recalc_rtscts_prot()
822 arvif->vdev_id, rts_cts); in ath11k_recalc_rtscts_prot()
824 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_recalc_rtscts_prot()
827 ath11k_warn(ar->ab, "failed to recalculate rts/cts prot for vdev %d: %d\n", in ath11k_recalc_rtscts_prot()
828 arvif->vdev_id, ret); in ath11k_recalc_rtscts_prot()
835 struct ath11k *ar = arvif->ar; in ath11k_mac_set_kickout()
841 ar->pdev->pdev_id); in ath11k_mac_set_kickout()
843 ath11k_warn(ar->ab, "failed to set kickout threshold on vdev %i: %d\n", in ath11k_mac_set_kickout()
844 arvif->vdev_id, ret); in ath11k_mac_set_kickout()
849 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, in ath11k_mac_set_kickout()
852 ath11k_warn(ar->ab, "failed to set keepalive minimum idle time on vdev %i: %d\n", in ath11k_mac_set_kickout()
853 arvif->vdev_id, ret); in ath11k_mac_set_kickout()
858 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, in ath11k_mac_set_kickout()
861 ath11k_warn(ar->ab, "failed to set keepalive maximum idle time on vdev %i: %d\n", in ath11k_mac_set_kickout()
862 arvif->vdev_id, ret); in ath11k_mac_set_kickout()
867 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, in ath11k_mac_set_kickout()
870 ath11k_warn(ar->ab, "failed to set keepalive maximum unresponsive time on vdev %i: %d\n", in ath11k_mac_set_kickout()
871 arvif->vdev_id, ret); in ath11k_mac_set_kickout()
881 struct ath11k_base *ab = ar->ab; in ath11k_mac_peer_cleanup_all()
883 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_peer_cleanup_all()
885 mutex_lock(&ab->tbl_mtx_lock); in ath11k_mac_peer_cleanup_all()
886 spin_lock_bh(&ab->base_lock); in ath11k_mac_peer_cleanup_all()
887 list_for_each_entry_safe(peer, tmp, &ab->peers, list) { in ath11k_mac_peer_cleanup_all()
890 list_del(&peer->list); in ath11k_mac_peer_cleanup_all()
893 spin_unlock_bh(&ab->base_lock); in ath11k_mac_peer_cleanup_all()
894 mutex_unlock(&ab->tbl_mtx_lock); in ath11k_mac_peer_cleanup_all()
896 ar->num_peers = 0; in ath11k_mac_peer_cleanup_all()
897 ar->num_stations = 0; in ath11k_mac_peer_cleanup_all()
902 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vdev_setup_sync()
904 if (test_bit(ATH11K_FLAG_CRASH_FLUSH, &ar->ab->dev_flags)) in ath11k_mac_vdev_setup_sync()
905 return -ESHUTDOWN; in ath11k_mac_vdev_setup_sync()
907 if (!wait_for_completion_timeout(&ar->vdev_setup_done, in ath11k_mac_vdev_setup_sync()
909 return -ETIMEDOUT; in ath11k_mac_vdev_setup_sync()
911 return ar->last_wmi_vdev_start_status ? -EINVAL : 0; in ath11k_mac_vdev_setup_sync()
921 *def = &conf->def; in ath11k_mac_get_any_chandef_iter()
931 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_monitor_vdev_start()
933 channel = chandef->chan; in ath11k_mac_monitor_vdev_start()
936 arg.channel.freq = channel->center_freq; in ath11k_mac_monitor_vdev_start()
937 arg.channel.band_center_freq1 = chandef->center_freq1; in ath11k_mac_monitor_vdev_start()
938 arg.channel.band_center_freq2 = chandef->center_freq2; in ath11k_mac_monitor_vdev_start()
940 arg.channel.mode = ath11k_phymodes[chandef->chan->band][chandef->width]; in ath11k_mac_monitor_vdev_start()
941 arg.channel.chan_radar = !!(channel->flags & IEEE80211_CHAN_RADAR); in ath11k_mac_monitor_vdev_start()
944 arg.channel.max_power = channel->max_power; in ath11k_mac_monitor_vdev_start()
945 arg.channel.max_reg_power = channel->max_reg_power; in ath11k_mac_monitor_vdev_start()
946 arg.channel.max_antenna_gain = channel->max_antenna_gain; in ath11k_mac_monitor_vdev_start()
948 arg.pref_tx_streams = ar->num_tx_chains; in ath11k_mac_monitor_vdev_start()
949 arg.pref_rx_streams = ar->num_rx_chains; in ath11k_mac_monitor_vdev_start()
951 arg.channel.passive = !!(chandef->chan->flags & IEEE80211_CHAN_NO_IR); in ath11k_mac_monitor_vdev_start()
953 reinit_completion(&ar->vdev_setup_done); in ath11k_mac_monitor_vdev_start()
954 reinit_completion(&ar->vdev_delete_done); in ath11k_mac_monitor_vdev_start()
958 ath11k_warn(ar->ab, "failed to request monitor vdev %i start: %d\n", in ath11k_mac_monitor_vdev_start()
965 ath11k_warn(ar->ab, "failed to synchronize setup for monitor vdev %i start: %d\n", in ath11k_mac_monitor_vdev_start()
970 ret = ath11k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr, NULL, 0, 0); in ath11k_mac_monitor_vdev_start()
972 ath11k_warn(ar->ab, "failed to put up monitor vdev %i: %d\n", in ath11k_mac_monitor_vdev_start()
977 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "monitor vdev %i started\n", in ath11k_mac_monitor_vdev_start()
983 reinit_completion(&ar->vdev_setup_done); in ath11k_mac_monitor_vdev_start()
987 ath11k_warn(ar->ab, "failed to stop monitor vdev %i after start failure: %d\n", in ath11k_mac_monitor_vdev_start()
994 ath11k_warn(ar->ab, "failed to synchronize setup for vdev %i stop: %d\n", in ath11k_mac_monitor_vdev_start()
999 return -EIO; in ath11k_mac_monitor_vdev_start()
1006 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_monitor_vdev_stop()
1008 reinit_completion(&ar->vdev_setup_done); in ath11k_mac_monitor_vdev_stop()
1010 ret = ath11k_wmi_vdev_stop(ar, ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_stop()
1012 ath11k_warn(ar->ab, "failed to request monitor vdev %i stop: %d\n", in ath11k_mac_monitor_vdev_stop()
1013 ar->monitor_vdev_id, ret); in ath11k_mac_monitor_vdev_stop()
1019 ath11k_warn(ar->ab, "failed to synchronize monitor vdev %i stop: %d\n", in ath11k_mac_monitor_vdev_stop()
1020 ar->monitor_vdev_id, ret); in ath11k_mac_monitor_vdev_stop()
1024 ret = ath11k_wmi_vdev_down(ar, ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_stop()
1026 ath11k_warn(ar->ab, "failed to put down monitor vdev %i: %d\n", in ath11k_mac_monitor_vdev_stop()
1027 ar->monitor_vdev_id, ret); in ath11k_mac_monitor_vdev_stop()
1031 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "monitor vdev %i stopped\n", in ath11k_mac_monitor_vdev_stop()
1032 ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_stop()
1039 struct ath11k_pdev *pdev = ar->pdev; in ath11k_mac_monitor_vdev_create()
1045 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_monitor_vdev_create()
1047 if (test_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags)) in ath11k_mac_monitor_vdev_create()
1050 if (ar->ab->free_vdev_map == 0) { in ath11k_mac_monitor_vdev_create()
1051 ath11k_warn(ar->ab, "failed to find free vdev id for monitor vdev\n"); in ath11k_mac_monitor_vdev_create()
1052 return -ENOMEM; in ath11k_mac_monitor_vdev_create()
1055 bit = __ffs64(ar->ab->free_vdev_map); in ath11k_mac_monitor_vdev_create()
1057 ar->monitor_vdev_id = bit; in ath11k_mac_monitor_vdev_create()
1059 param.if_id = ar->monitor_vdev_id; in ath11k_mac_monitor_vdev_create()
1062 param.pdev_id = pdev->pdev_id; in ath11k_mac_monitor_vdev_create()
1064 if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) { in ath11k_mac_monitor_vdev_create()
1065 param.chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains; in ath11k_mac_monitor_vdev_create()
1066 param.chains[NL80211_BAND_2GHZ].rx = ar->num_rx_chains; in ath11k_mac_monitor_vdev_create()
1068 if (pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) { in ath11k_mac_monitor_vdev_create()
1069 param.chains[NL80211_BAND_5GHZ].tx = ar->num_tx_chains; in ath11k_mac_monitor_vdev_create()
1070 param.chains[NL80211_BAND_5GHZ].rx = ar->num_rx_chains; in ath11k_mac_monitor_vdev_create()
1075 ath11k_warn(ar->ab, "failed to request monitor vdev %i creation: %d\n", in ath11k_mac_monitor_vdev_create()
1076 ar->monitor_vdev_id, ret); in ath11k_mac_monitor_vdev_create()
1077 ar->monitor_vdev_id = -1; in ath11k_mac_monitor_vdev_create()
1081 nss = get_num_chains(ar->cfg_tx_chainmask) ? : 1; in ath11k_mac_monitor_vdev_create()
1082 ret = ath11k_wmi_vdev_set_param_cmd(ar, ar->monitor_vdev_id, in ath11k_mac_monitor_vdev_create()
1085 ath11k_warn(ar->ab, "failed to set vdev %d chainmask 0x%x, nss %d :%d\n", in ath11k_mac_monitor_vdev_create()
1086 ar->monitor_vdev_id, ar->cfg_tx_chainmask, nss, ret); in ath11k_mac_monitor_vdev_create()
1092 ath11k_warn(ar->ab, "failed to recalc txpower for monitor vdev %d: %d\n", in ath11k_mac_monitor_vdev_create()
1093 ar->monitor_vdev_id, ret); in ath11k_mac_monitor_vdev_create()
1097 ar->allocated_vdev_map |= 1LL << ar->monitor_vdev_id; in ath11k_mac_monitor_vdev_create()
1098 ar->ab->free_vdev_map &= ~(1LL << ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_create()
1099 ar->num_created_vdevs++; in ath11k_mac_monitor_vdev_create()
1100 set_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); in ath11k_mac_monitor_vdev_create()
1102 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "monitor vdev %d created\n", in ath11k_mac_monitor_vdev_create()
1103 ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_create()
1108 ath11k_wmi_vdev_delete(ar, ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_create()
1109 ar->monitor_vdev_id = -1; in ath11k_mac_monitor_vdev_create()
1118 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_monitor_vdev_delete()
1120 if (!test_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags)) in ath11k_mac_monitor_vdev_delete()
1123 reinit_completion(&ar->vdev_delete_done); in ath11k_mac_monitor_vdev_delete()
1125 ret = ath11k_wmi_vdev_delete(ar, ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_delete()
1127 ath11k_warn(ar->ab, "failed to request wmi monitor vdev %i removal: %d\n", in ath11k_mac_monitor_vdev_delete()
1128 ar->monitor_vdev_id, ret); in ath11k_mac_monitor_vdev_delete()
1132 time_left = wait_for_completion_timeout(&ar->vdev_delete_done, in ath11k_mac_monitor_vdev_delete()
1135 ath11k_warn(ar->ab, "Timeout in receiving vdev delete response\n"); in ath11k_mac_monitor_vdev_delete()
1137 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "monitor vdev %d deleted\n", in ath11k_mac_monitor_vdev_delete()
1138 ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_delete()
1140 ar->allocated_vdev_map &= ~(1LL << ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_delete()
1141 ar->ab->free_vdev_map |= 1LL << (ar->monitor_vdev_id); in ath11k_mac_monitor_vdev_delete()
1142 ar->num_created_vdevs--; in ath11k_mac_monitor_vdev_delete()
1143 ar->monitor_vdev_id = -1; in ath11k_mac_monitor_vdev_delete()
1144 clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); in ath11k_mac_monitor_vdev_delete()
1155 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_monitor_start()
1157 if (test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags)) in ath11k_mac_monitor_start()
1160 ieee80211_iter_chan_contexts_atomic(ar->hw, in ath11k_mac_monitor_start()
1166 ret = ath11k_mac_monitor_vdev_start(ar, ar->monitor_vdev_id, chandef); in ath11k_mac_monitor_start()
1168 ath11k_warn(ar->ab, "failed to start monitor vdev: %d\n", ret); in ath11k_mac_monitor_start()
1173 set_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags); in ath11k_mac_monitor_start()
1175 ar->num_started_vdevs++; in ath11k_mac_monitor_start()
1178 ath11k_warn(ar->ab, "failed to configure htt monitor mode ring during start: %d", in ath11k_mac_monitor_start()
1183 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "monitor started\n"); in ath11k_mac_monitor_start()
1192 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_monitor_stop()
1194 if (!test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags)) in ath11k_mac_monitor_stop()
1199 ath11k_warn(ar->ab, "failed to stop monitor vdev: %d\n", ret); in ath11k_mac_monitor_stop()
1203 clear_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags); in ath11k_mac_monitor_stop()
1204 ar->num_started_vdevs--; in ath11k_mac_monitor_stop()
1208 ath11k_warn(ar->ab, "failed to configure htt monitor mode ring during stop: %d", in ath11k_mac_monitor_stop()
1213 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "monitor stopped ret %d\n", ret); in ath11k_mac_monitor_stop()
1220 struct ath11k *ar = arvif->ar; in ath11k_mac_vif_setup_ps()
1221 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_vif_setup_ps()
1222 struct ieee80211_conf *conf = &ar->hw->conf; in ath11k_mac_vif_setup_ps()
1229 lockdep_assert_held(&arvif->ar->conf_mutex); in ath11k_mac_vif_setup_ps()
1231 if (arvif->vif->type != NL80211_IFTYPE_STATION) in ath11k_mac_vif_setup_ps()
1234 enable_ps = arvif->ps; in ath11k_mac_vif_setup_ps()
1236 if (!arvif->is_started) { in ath11k_mac_vif_setup_ps()
1239 * necessary if PS is disabled on a non-started vdev. Hence in ath11k_mac_vif_setup_ps()
1240 * force-enable PS for non-running vdevs. in ath11k_mac_vif_setup_ps()
1247 timeout = conf->dynamic_ps_timeout; in ath11k_mac_vif_setup_ps()
1250 timeout = ieee80211_tu_to_usec(vif->bss_conf.beacon_int) / 1000; in ath11k_mac_vif_setup_ps()
1253 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, param, in ath11k_mac_vif_setup_ps()
1256 ath11k_warn(ar->ab, "failed to set inactivity time for vdev %d: %i\n", in ath11k_mac_vif_setup_ps()
1257 arvif->vdev_id, ret); in ath11k_mac_vif_setup_ps()
1264 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %d psmode %s\n", in ath11k_mac_vif_setup_ps()
1265 arvif->vdev_id, psmode ? "enable" : "disable"); in ath11k_mac_vif_setup_ps()
1267 ret = ath11k_wmi_pdev_set_ps_mode(ar, arvif->vdev_id, psmode); in ath11k_mac_vif_setup_ps()
1269 ath11k_warn(ar->ab, "failed to set sta power save mode %d for vdev %d: %d\n", in ath11k_mac_vif_setup_ps()
1270 psmode, arvif->vdev_id, ret); in ath11k_mac_vif_setup_ps()
1282 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_config_ps()
1284 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_mac_config_ps()
1287 ath11k_warn(ar->ab, "failed to setup powersave: %d\n", ret); in ath11k_mac_config_ps()
1297 struct ath11k *ar = hw->priv; in ath11k_mac_op_config()
1298 struct ieee80211_conf *conf = &hw->conf; in ath11k_mac_op_config()
1301 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_config()
1304 if (conf->flags & IEEE80211_CONF_MONITOR) { in ath11k_mac_op_config()
1305 set_bit(ATH11K_FLAG_MONITOR_CONF_ENABLED, &ar->monitor_flags); in ath11k_mac_op_config()
1308 &ar->monitor_flags)) in ath11k_mac_op_config()
1313 ath11k_warn(ar->ab, "failed to create monitor vdev: %d", in ath11k_mac_op_config()
1320 ath11k_warn(ar->ab, "failed to start monitor: %d", in ath11k_mac_op_config()
1325 clear_bit(ATH11K_FLAG_MONITOR_CONF_ENABLED, &ar->monitor_flags); in ath11k_mac_op_config()
1328 &ar->monitor_flags)) in ath11k_mac_op_config()
1333 ath11k_warn(ar->ab, "failed to stop monitor: %d", in ath11k_mac_op_config()
1340 ath11k_warn(ar->ab, "failed to delete monitor vdev: %d", in ath11k_mac_op_config()
1348 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_config()
1353 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_config()
1362 arvif->rsnie_present = true; in ath11k_mac_setup_nontx_vif_rsnie()
1375 arvif->rsnie_present = false; in ath11k_mac_setup_nontx_vif_rsnie()
1390 ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn); in ath11k_mac_set_nontx_vif_params()
1391 mgmt = (struct ieee80211_mgmt *)bcn->data; in ath11k_mac_set_nontx_vif_params()
1392 ies += sizeof(mgmt->u.beacon); in ath11k_mac_set_nontx_vif_params()
1393 ies_len = skb_tail_pointer(bcn) - ies; in ath11k_mac_set_nontx_vif_params()
1396 arvif->rsnie_present = tx_arvif->rsnie_present; in ath11k_mac_set_nontx_vif_params()
1401 ies_len -= (2 + ies[1]); in ath11k_mac_set_nontx_vif_params()
1402 mbssid_len = ies[1] - 1; in ath11k_mac_set_nontx_vif_params()
1410 mbssid_len -= (2 + profile_len); in ath11k_mac_set_nontx_vif_params()
1413 profile_len -= (2 + profile[1]); in ath11k_mac_set_nontx_vif_params()
1415 profile_len -= (2 + profile[1]); in ath11k_mac_set_nontx_vif_params()
1417 if (profile[2] == arvif->vif->bss_conf.bssid_index) { in ath11k_mac_set_nontx_vif_params()
1418 profile_len -= 5; in ath11k_mac_set_nontx_vif_params()
1421 tx_arvif->rsnie_present, in ath11k_mac_set_nontx_vif_params()
1441 ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn); in ath11k_mac_set_vif_params()
1442 mgmt = (struct ieee80211_mgmt *)bcn->data; in ath11k_mac_set_vif_params()
1443 ies += sizeof(mgmt->u.beacon); in ath11k_mac_set_vif_params()
1445 if (cfg80211_find_ie(WLAN_EID_RSN, ies, (skb_tail_pointer(bcn) - ies))) in ath11k_mac_set_vif_params()
1446 arvif->rsnie_present = true; in ath11k_mac_set_vif_params()
1448 arvif->rsnie_present = false; in ath11k_mac_set_vif_params()
1452 ies, (skb_tail_pointer(bcn) - ies))) in ath11k_mac_set_vif_params()
1453 arvif->wpaie_present = true; in ath11k_mac_set_vif_params()
1455 arvif->wpaie_present = false; in ath11k_mac_set_vif_params()
1467 tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; in ath11k_mac_setup_bcn_tmpl_ema()
1469 beacons = ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw, in ath11k_mac_setup_bcn_tmpl_ema()
1470 tx_arvif->vif, 0); in ath11k_mac_setup_bcn_tmpl_ema()
1471 if (!beacons || !beacons->cnt) { in ath11k_mac_setup_bcn_tmpl_ema()
1472 ath11k_warn(arvif->ar->ab, in ath11k_mac_setup_bcn_tmpl_ema()
1474 return -EPERM; in ath11k_mac_setup_bcn_tmpl_ema()
1478 ath11k_mac_set_vif_params(tx_arvif, beacons->bcn[0].skb); in ath11k_mac_setup_bcn_tmpl_ema()
1480 arvif->wpaie_present = tx_arvif->wpaie_present; in ath11k_mac_setup_bcn_tmpl_ema()
1482 for (i = 0; i < beacons->cnt; i++) { in ath11k_mac_setup_bcn_tmpl_ema()
1486 beacons->bcn[i].skb); in ath11k_mac_setup_bcn_tmpl_ema()
1488 params = beacons->cnt; in ath11k_mac_setup_bcn_tmpl_ema()
1491 params |= ((i + 1 == beacons->cnt ? 1 : 0) << WMI_EMA_LAST_TMPL_SHIFT); in ath11k_mac_setup_bcn_tmpl_ema()
1493 ret = ath11k_wmi_bcn_tmpl(tx_arvif->ar, tx_arvif->vdev_id, in ath11k_mac_setup_bcn_tmpl_ema()
1494 &beacons->bcn[i].offs, in ath11k_mac_setup_bcn_tmpl_ema()
1495 beacons->bcn[i].skb, params); in ath11k_mac_setup_bcn_tmpl_ema()
1497 ath11k_warn(tx_arvif->ar->ab, in ath11k_mac_setup_bcn_tmpl_ema()
1507 return -EINVAL; /* Profile not found in the beacons */ in ath11k_mac_setup_bcn_tmpl_ema()
1514 struct ath11k *ar = arvif->ar; in ath11k_mac_setup_bcn_tmpl_mbssid()
1515 struct ath11k_base *ab = ar->ab; in ath11k_mac_setup_bcn_tmpl_mbssid()
1517 struct ieee80211_hw *hw = ar->hw; in ath11k_mac_setup_bcn_tmpl_mbssid()
1518 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_setup_bcn_tmpl_mbssid()
1523 if (arvif->vif->mbssid_tx_vif) { in ath11k_mac_setup_bcn_tmpl_mbssid()
1524 tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; in ath11k_mac_setup_bcn_tmpl_mbssid()
1526 ar = tx_arvif->ar; in ath11k_mac_setup_bcn_tmpl_mbssid()
1527 ab = ar->ab; in ath11k_mac_setup_bcn_tmpl_mbssid()
1528 hw = ar->hw; in ath11k_mac_setup_bcn_tmpl_mbssid()
1529 vif = tx_arvif->vif; in ath11k_mac_setup_bcn_tmpl_mbssid()
1536 return -EPERM; in ath11k_mac_setup_bcn_tmpl_mbssid()
1542 return -EINVAL; in ath11k_mac_setup_bcn_tmpl_mbssid()
1544 ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn, 0); in ath11k_mac_setup_bcn_tmpl_mbssid()
1556 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_setup_bcn_tmpl()
1558 if (arvif->vdev_type != WMI_VDEV_TYPE_AP) in ath11k_mac_setup_bcn_tmpl()
1562 * non-transmitting interfaces, and results in a crash if sent. in ath11k_mac_setup_bcn_tmpl()
1564 if (vif->mbssid_tx_vif && in ath11k_mac_setup_bcn_tmpl()
1565 arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up) in ath11k_mac_setup_bcn_tmpl()
1568 if (vif->bss_conf.ema_ap && vif->mbssid_tx_vif) in ath11k_mac_setup_bcn_tmpl()
1576 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_bcn_tx_event()
1578 if (!vif->bss_conf.color_change_active && !arvif->bcca_zero_sent) in ath11k_mac_bcn_tx_event()
1581 if (vif->bss_conf.color_change_active && in ath11k_mac_bcn_tx_event()
1583 arvif->bcca_zero_sent = true; in ath11k_mac_bcn_tx_event()
1588 arvif->bcca_zero_sent = false; in ath11k_mac_bcn_tx_event()
1590 if (vif->bss_conf.color_change_active) in ath11k_mac_bcn_tx_event()
1598 struct ath11k *ar = arvif->ar; in ath11k_control_beaconing()
1602 lockdep_assert_held(&arvif->ar->conf_mutex); in ath11k_control_beaconing()
1604 if (!info->enable_beacon) { in ath11k_control_beaconing()
1605 ret = ath11k_wmi_vdev_down(ar, arvif->vdev_id); in ath11k_control_beaconing()
1607 ath11k_warn(ar->ab, "failed to down vdev_id %i: %d\n", in ath11k_control_beaconing()
1608 arvif->vdev_id, ret); in ath11k_control_beaconing()
1610 arvif->is_up = false; in ath11k_control_beaconing()
1617 ath11k_warn(ar->ab, "failed to update bcn tmpl during vdev up: %d\n", in ath11k_control_beaconing()
1622 arvif->tx_seq_no = 0x1000; in ath11k_control_beaconing()
1624 arvif->aid = 0; in ath11k_control_beaconing()
1626 ether_addr_copy(arvif->bssid, info->bssid); in ath11k_control_beaconing()
1628 if (arvif->vif->mbssid_tx_vif) in ath11k_control_beaconing()
1629 tx_arvif = (struct ath11k_vif *)arvif->vif->mbssid_tx_vif->drv_priv; in ath11k_control_beaconing()
1631 ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath11k_control_beaconing()
1632 arvif->bssid, in ath11k_control_beaconing()
1633 tx_arvif ? tx_arvif->bssid : NULL, in ath11k_control_beaconing()
1634 info->bssid_index, in ath11k_control_beaconing()
1635 1 << info->bssid_indicator); in ath11k_control_beaconing()
1637 ath11k_warn(ar->ab, "failed to bring up vdev %d: %i\n", in ath11k_control_beaconing()
1638 arvif->vdev_id, ret); in ath11k_control_beaconing()
1642 arvif->is_up = true; in ath11k_control_beaconing()
1644 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %d up\n", arvif->vdev_id); in ath11k_control_beaconing()
1651 struct ieee80211_mgmt *mgmt = (void *)skb->data; in ath11k_mac_handle_beacon_iter()
1652 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_handle_beacon_iter()
1654 if (vif->type != NL80211_IFTYPE_STATION) in ath11k_mac_handle_beacon_iter()
1657 if (!ether_addr_equal(mgmt->bssid, vif->bss_conf.bssid)) in ath11k_mac_handle_beacon_iter()
1660 cancel_delayed_work(&arvif->connection_loss_work); in ath11k_mac_handle_beacon_iter()
1665 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_handle_beacon()
1675 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_handle_beacon_miss_iter()
1676 struct ath11k *ar = arvif->ar; in ath11k_mac_handle_beacon_miss_iter()
1677 struct ieee80211_hw *hw = ar->hw; in ath11k_mac_handle_beacon_miss_iter()
1679 if (arvif->vdev_id != *vdev_id) in ath11k_mac_handle_beacon_miss_iter()
1682 if (!arvif->is_up) in ath11k_mac_handle_beacon_miss_iter()
1692 ieee80211_queue_delayed_work(hw, &arvif->connection_loss_work, in ath11k_mac_handle_beacon_miss_iter()
1698 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_handle_beacon_miss()
1708 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_vif_sta_connection_loss_work()
1710 if (!arvif->is_up) in ath11k_mac_vif_sta_connection_loss_work()
1721 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_peer_assoc_h_basic()
1724 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_basic()
1726 if (vif->type == NL80211_IFTYPE_STATION) in ath11k_peer_assoc_h_basic()
1727 aid = vif->cfg.aid; in ath11k_peer_assoc_h_basic()
1729 aid = sta->aid; in ath11k_peer_assoc_h_basic()
1731 ether_addr_copy(arg->peer_mac, sta->addr); in ath11k_peer_assoc_h_basic()
1732 arg->vdev_id = arvif->vdev_id; in ath11k_peer_assoc_h_basic()
1733 arg->peer_associd = aid; in ath11k_peer_assoc_h_basic()
1734 arg->auth_flag = true; in ath11k_peer_assoc_h_basic()
1735 /* TODO: STA WAR in ath10k for listen interval required? */ in ath11k_peer_assoc_h_basic()
1736 arg->peer_listen_intval = ar->hw->conf.listen_interval; in ath11k_peer_assoc_h_basic()
1737 arg->peer_nss = 1; in ath11k_peer_assoc_h_basic()
1738 arg->peer_caps = vif->bss_conf.assoc_capability; in ath11k_peer_assoc_h_basic()
1746 struct ieee80211_bss_conf *info = &vif->bss_conf; in ath11k_peer_assoc_h_crypto()
1749 struct ath11k_vif *arvif = (struct ath11k_vif *)vif->drv_priv; in ath11k_peer_assoc_h_crypto()
1753 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_crypto()
1758 bss = cfg80211_get_bss(ar->hw->wiphy, def.chan, info->bssid, NULL, 0, in ath11k_peer_assoc_h_crypto()
1761 if (arvif->rsnie_present || arvif->wpaie_present) { in ath11k_peer_assoc_h_crypto()
1762 arg->need_ptk_4_way = true; in ath11k_peer_assoc_h_crypto()
1763 if (arvif->wpaie_present) in ath11k_peer_assoc_h_crypto()
1764 arg->need_gtk_2_way = true; in ath11k_peer_assoc_h_crypto()
1771 ies = rcu_dereference(bss->ies); in ath11k_peer_assoc_h_crypto()
1775 ies->data, in ath11k_peer_assoc_h_crypto()
1776 ies->len); in ath11k_peer_assoc_h_crypto()
1778 cfg80211_put_bss(ar->hw->wiphy, bss); in ath11k_peer_assoc_h_crypto()
1783 ath11k_dbg(ar->ab, ATH11K_DBG_WMI, in ath11k_peer_assoc_h_crypto()
1785 arg->need_ptk_4_way = true; in ath11k_peer_assoc_h_crypto()
1789 ath11k_dbg(ar->ab, ATH11K_DBG_WMI, in ath11k_peer_assoc_h_crypto()
1791 arg->need_gtk_2_way = true; in ath11k_peer_assoc_h_crypto()
1794 if (sta->mfp) { in ath11k_peer_assoc_h_crypto()
1796 arg->is_pmf_enabled = true; in ath11k_peer_assoc_h_crypto()
1799 /* TODO: safe_mode_enabled (bypass 4-way handshake) flag req? */ in ath11k_peer_assoc_h_crypto()
1807 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_peer_assoc_h_rates()
1808 struct wmi_rate_set_arg *rateset = &arg->peer_legacy_rates; in ath11k_peer_assoc_h_rates()
1812 enum nl80211_band band; in ath11k_peer_assoc_h_rates() local
1817 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_rates()
1822 band = def.chan->band; in ath11k_peer_assoc_h_rates()
1823 sband = ar->hw->wiphy->bands[band]; in ath11k_peer_assoc_h_rates()
1824 ratemask = sta->deflink.supp_rates[band]; in ath11k_peer_assoc_h_rates()
1825 ratemask &= arvif->bitrate_mask.control[band].legacy; in ath11k_peer_assoc_h_rates()
1826 rates = sband->bitrates; in ath11k_peer_assoc_h_rates()
1828 rateset->num_rates = 0; in ath11k_peer_assoc_h_rates()
1834 rate = ath11k_mac_bitrate_to_rate(rates->bitrate); in ath11k_peer_assoc_h_rates()
1835 rateset->rates[rateset->num_rates] = rate; in ath11k_peer_assoc_h_rates()
1836 rateset->num_rates++; in ath11k_peer_assoc_h_rates()
1869 const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; in ath11k_peer_assoc_h_ht()
1870 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_peer_assoc_h_ht()
1872 enum nl80211_band band; in ath11k_peer_assoc_h_ht() local
1878 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_ht()
1883 if (!ht_cap->ht_supported) in ath11k_peer_assoc_h_ht()
1886 band = def.chan->band; in ath11k_peer_assoc_h_ht()
1887 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath11k_peer_assoc_h_ht()
1892 arg->ht_flag = true; in ath11k_peer_assoc_h_ht()
1894 arg->peer_max_mpdu = (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + in ath11k_peer_assoc_h_ht()
1895 ht_cap->ampdu_factor)) - 1; in ath11k_peer_assoc_h_ht()
1897 arg->peer_mpdu_density = in ath11k_peer_assoc_h_ht()
1898 ath11k_parse_mpdudensity(ht_cap->ampdu_density); in ath11k_peer_assoc_h_ht()
1900 arg->peer_ht_caps = ht_cap->cap; in ath11k_peer_assoc_h_ht()
1901 arg->peer_rate_caps |= WMI_HOST_RC_HT_FLAG; in ath11k_peer_assoc_h_ht()
1903 if (ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING) in ath11k_peer_assoc_h_ht()
1904 arg->ldpc_flag = true; in ath11k_peer_assoc_h_ht()
1906 if (sta->deflink.bandwidth >= IEEE80211_STA_RX_BW_40) { in ath11k_peer_assoc_h_ht()
1907 arg->bw_40 = true; in ath11k_peer_assoc_h_ht()
1908 arg->peer_rate_caps |= WMI_HOST_RC_CW40_FLAG; in ath11k_peer_assoc_h_ht()
1915 if (arvif->bitrate_mask.control[band].gi == NL80211_TXRATE_DEFAULT_GI) in ath11k_peer_assoc_h_ht()
1916 arg->peer_ht_caps &= ~(IEEE80211_HT_CAP_SGI_20 | in ath11k_peer_assoc_h_ht()
1919 if (arvif->bitrate_mask.control[band].gi != NL80211_TXRATE_FORCE_LGI) { in ath11k_peer_assoc_h_ht()
1920 if (ht_cap->cap & (IEEE80211_HT_CAP_SGI_20 | in ath11k_peer_assoc_h_ht()
1922 arg->peer_rate_caps |= WMI_HOST_RC_SGI_FLAG; in ath11k_peer_assoc_h_ht()
1925 if (ht_cap->cap & IEEE80211_HT_CAP_TX_STBC) { in ath11k_peer_assoc_h_ht()
1926 arg->peer_rate_caps |= WMI_HOST_RC_TX_STBC_FLAG; in ath11k_peer_assoc_h_ht()
1927 arg->stbc_flag = true; in ath11k_peer_assoc_h_ht()
1930 if (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC) { in ath11k_peer_assoc_h_ht()
1931 stbc = ht_cap->cap & IEEE80211_HT_CAP_RX_STBC; in ath11k_peer_assoc_h_ht()
1934 arg->peer_rate_caps |= stbc; in ath11k_peer_assoc_h_ht()
1935 arg->stbc_flag = true; in ath11k_peer_assoc_h_ht()
1938 if (ht_cap->mcs.rx_mask[1] && ht_cap->mcs.rx_mask[2]) in ath11k_peer_assoc_h_ht()
1939 arg->peer_rate_caps |= WMI_HOST_RC_TS_FLAG; in ath11k_peer_assoc_h_ht()
1940 else if (ht_cap->mcs.rx_mask[1]) in ath11k_peer_assoc_h_ht()
1941 arg->peer_rate_caps |= WMI_HOST_RC_DS_FLAG; in ath11k_peer_assoc_h_ht()
1944 if ((ht_cap->mcs.rx_mask[i / 8] & BIT(i % 8)) && in ath11k_peer_assoc_h_ht()
1947 arg->peer_ht_rates.rates[n++] = i; in ath11k_peer_assoc_h_ht()
1950 /* This is a workaround for HT-enabled STAs which break the spec in ath11k_peer_assoc_h_ht()
1953 * As per spec, in section 20.3.5 Modulation and coding scheme (MCS), in ath11k_peer_assoc_h_ht()
1954 * MCS 0 through 7 are mandatory in 20MHz with 800 ns GI at all STAs. in ath11k_peer_assoc_h_ht()
1959 arg->peer_ht_rates.num_rates = 8; in ath11k_peer_assoc_h_ht()
1960 for (i = 0; i < arg->peer_ht_rates.num_rates; i++) in ath11k_peer_assoc_h_ht()
1961 arg->peer_ht_rates.rates[i] = i; in ath11k_peer_assoc_h_ht()
1963 arg->peer_ht_rates.num_rates = n; in ath11k_peer_assoc_h_ht()
1964 arg->peer_nss = min(sta->deflink.rx_nss, max_nss); in ath11k_peer_assoc_h_ht()
1967 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "ht peer %pM mcs cnt %d nss %d\n", in ath11k_peer_assoc_h_ht()
1968 arg->peer_mac, in ath11k_peer_assoc_h_ht()
1969 arg->peer_ht_rates.num_rates, in ath11k_peer_assoc_h_ht()
1970 arg->peer_nss); in ath11k_peer_assoc_h_ht()
1976 case IEEE80211_VHT_MCS_SUPPORT_0_7: return BIT(8) - 1; in ath11k_mac_get_max_vht_mcs_map()
1977 case IEEE80211_VHT_MCS_SUPPORT_0_8: return BIT(9) - 1; in ath11k_mac_get_max_vht_mcs_map()
1978 case IEEE80211_VHT_MCS_SUPPORT_0_9: return BIT(10) - 1; in ath11k_mac_get_max_vht_mcs_map()
1997 idx_limit = fls(mcs_map) - 1; in ath11k_peer_assoc_h_vht_limit()
1999 idx_limit = -1; in ath11k_peer_assoc_h_vht_limit()
2021 case -1: in ath11k_peer_assoc_h_vht_limit()
2036 u8 nss_ratio_info = ar->pdev->cap.nss_ratio_info; in ath11k_get_nss_160mhz()
2044 ath11k_warn(ar->ab, "WMI_NSS_RATIO_3BY4_NSS not supported\n"); in ath11k_get_nss_160mhz()
2050 ath11k_warn(ar->ab, "WMI_NSS_RATIO_2_NSS not supported\n"); in ath11k_get_nss_160mhz()
2053 ath11k_warn(ar->ab, "invalid nss ratio received from firmware: %d\n", in ath11k_get_nss_160mhz()
2066 const struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; in ath11k_peer_assoc_h_vht()
2067 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_peer_assoc_h_vht()
2069 enum nl80211_band band; in ath11k_peer_assoc_h_vht() local
2080 if (!vht_cap->vht_supported) in ath11k_peer_assoc_h_vht()
2083 band = def.chan->band; in ath11k_peer_assoc_h_vht()
2084 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath11k_peer_assoc_h_vht()
2089 arg->vht_flag = true; in ath11k_peer_assoc_h_vht()
2092 arg->vht_capable = true; in ath11k_peer_assoc_h_vht()
2094 if (def.chan->band == NL80211_BAND_2GHZ) in ath11k_peer_assoc_h_vht()
2095 arg->vht_ng_flag = true; in ath11k_peer_assoc_h_vht()
2097 arg->peer_vht_caps = vht_cap->cap; in ath11k_peer_assoc_h_vht()
2099 ampdu_factor = (vht_cap->cap & in ath11k_peer_assoc_h_vht()
2103 /* Workaround: Some Netgear/Linksys 11ac APs set Rx A-MPDU factor to in ath11k_peer_assoc_h_vht()
2104 * zero in VHT IE. Using it would result in degraded throughput. in ath11k_peer_assoc_h_vht()
2105 * arg->peer_max_mpdu at this point contains HT max_mpdu so keep in ath11k_peer_assoc_h_vht()
2108 arg->peer_max_mpdu = max(arg->peer_max_mpdu, in ath11k_peer_assoc_h_vht()
2110 ampdu_factor)) - 1); in ath11k_peer_assoc_h_vht()
2112 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) in ath11k_peer_assoc_h_vht()
2113 arg->bw_80 = true; in ath11k_peer_assoc_h_vht()
2115 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) in ath11k_peer_assoc_h_vht()
2116 arg->bw_160 = true; in ath11k_peer_assoc_h_vht()
2120 if (vht_nss > sta->deflink.rx_nss) { in ath11k_peer_assoc_h_vht()
2122 for (nss_idx = sta->deflink.rx_nss - 1; nss_idx >= 0; nss_idx--) { in ath11k_peer_assoc_h_vht()
2131 …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()
2132 sta->deflink.rx_nss, sta->addr); in ath11k_peer_assoc_h_vht()
2133 vht_mcs_mask[sta->deflink.rx_nss - 1] = vht_mcs_mask[vht_nss - 1]; in ath11k_peer_assoc_h_vht()
2140 vht_mcs = __le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map) >> in ath11k_peer_assoc_h_vht()
2147 arg->peer_nss = min(sta->deflink.rx_nss, max_nss); in ath11k_peer_assoc_h_vht()
2148 arg->rx_max_rate = __le16_to_cpu(vht_cap->vht_mcs.rx_highest); in ath11k_peer_assoc_h_vht()
2149 arg->rx_mcs_set = __le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map); in ath11k_peer_assoc_h_vht()
2150 arg->tx_max_rate = __le16_to_cpu(vht_cap->vht_mcs.tx_highest); in ath11k_peer_assoc_h_vht()
2151 arg->tx_mcs_set = ath11k_peer_assoc_h_vht_limit( in ath11k_peer_assoc_h_vht()
2152 __le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); in ath11k_peer_assoc_h_vht()
2154 /* In IPQ8074 platform, VHT mcs rate 10 and 11 is enabled by default. in ath11k_peer_assoc_h_vht()
2155 * VHT mcs rate 10 and 11 is not suppoerted in 11ac standard. in ath11k_peer_assoc_h_vht()
2156 * so explicitly disable the VHT MCS rate 10 and 11 in 11ac mode. in ath11k_peer_assoc_h_vht()
2158 arg->tx_mcs_set &= ~IEEE80211_VHT_MCS_SUPPORT_0_11_MASK; in ath11k_peer_assoc_h_vht()
2159 arg->tx_mcs_set |= IEEE80211_DISABLE_VHT_MCS_SUPPORT_0_11; in ath11k_peer_assoc_h_vht()
2161 if ((arg->tx_mcs_set & IEEE80211_VHT_MCS_NOT_SUPPORTED) == in ath11k_peer_assoc_h_vht()
2163 arg->peer_vht_caps &= ~IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; in ath11k_peer_assoc_h_vht()
2166 arg->tx_max_mcs_nss = 0xFF; in ath11k_peer_assoc_h_vht()
2168 if (arg->peer_phymode == MODE_11AC_VHT160 || in ath11k_peer_assoc_h_vht()
2169 arg->peer_phymode == MODE_11AC_VHT80_80) { in ath11k_peer_assoc_h_vht()
2171 rx_nss = min(arg->peer_nss, tx_nss); in ath11k_peer_assoc_h_vht()
2172 arg->peer_bw_rxnss_override = ATH11K_BW_NSS_MAP_ENABLE; in ath11k_peer_assoc_h_vht()
2175 ath11k_warn(ar->ab, "invalid max_nss\n"); in ath11k_peer_assoc_h_vht()
2179 if (arg->peer_phymode == MODE_11AC_VHT160) in ath11k_peer_assoc_h_vht()
2180 nss_160 = FIELD_PREP(ATH11K_PEER_RX_NSS_160MHZ, rx_nss - 1); in ath11k_peer_assoc_h_vht()
2182 nss_160 = FIELD_PREP(ATH11K_PEER_RX_NSS_80_80MHZ, rx_nss - 1); in ath11k_peer_assoc_h_vht()
2184 arg->peer_bw_rxnss_override |= nss_160; in ath11k_peer_assoc_h_vht()
2187 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_peer_assoc_h_vht()
2189 sta->addr, arg->peer_max_mpdu, arg->peer_flags, in ath11k_peer_assoc_h_vht()
2190 arg->peer_bw_rxnss_override); in ath11k_peer_assoc_h_vht()
2196 case IEEE80211_HE_MCS_SUPPORT_0_7: return BIT(8) - 1; in ath11k_mac_get_max_he_mcs_map()
2197 case IEEE80211_HE_MCS_SUPPORT_0_9: return BIT(10) - 1; in ath11k_mac_get_max_he_mcs_map()
2198 case IEEE80211_HE_MCS_SUPPORT_0_11: return BIT(12) - 1; in ath11k_mac_get_max_he_mcs_map()
2216 idx_limit = fls(mcs_map) - 1; in ath11k_peer_assoc_h_he_limit()
2218 idx_limit = -1; in ath11k_peer_assoc_h_he_limit()
2235 case -1: in ath11k_peer_assoc_h_he_limit()
2264 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_peer_assoc_h_he()
2266 const struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap; in ath11k_peer_assoc_h_he()
2267 enum nl80211_band band; in ath11k_peer_assoc_h_he() local
2281 if (!he_cap->has_he) in ath11k_peer_assoc_h_he()
2284 band = def.chan->band; in ath11k_peer_assoc_h_he()
2285 memcpy(he_mcs_mask, arvif->bitrate_mask.control[band].he_mcs, in ath11k_peer_assoc_h_he()
2291 arg->he_flag = true; in ath11k_peer_assoc_h_he()
2292 support_160 = !!(he_cap->he_cap_elem.phy_cap_info[0] & in ath11k_peer_assoc_h_he()
2295 /* Supported HE-MCS and NSS Set of peer he_cap is intersection with self he_cp */ in ath11k_peer_assoc_h_he()
2296 mcs_160_map = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_160); in ath11k_peer_assoc_h_he()
2297 mcs_80_map = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80); in ath11k_peer_assoc_h_he()
2300 for (i = 7; i >= 0; i--) { in ath11k_peer_assoc_h_he()
2310 for (i = 7; i >= 0; i--) { in ath11k_peer_assoc_h_he()
2324 arg->peer_nss = min(sta->deflink.rx_nss, max_nss); in ath11k_peer_assoc_h_he()
2326 memcpy_and_pad(&arg->peer_he_cap_macinfo, in ath11k_peer_assoc_h_he()
2327 sizeof(arg->peer_he_cap_macinfo), in ath11k_peer_assoc_h_he()
2328 he_cap->he_cap_elem.mac_cap_info, in ath11k_peer_assoc_h_he()
2329 sizeof(he_cap->he_cap_elem.mac_cap_info), in ath11k_peer_assoc_h_he()
2331 memcpy_and_pad(&arg->peer_he_cap_phyinfo, in ath11k_peer_assoc_h_he()
2332 sizeof(arg->peer_he_cap_phyinfo), in ath11k_peer_assoc_h_he()
2333 he_cap->he_cap_elem.phy_cap_info, in ath11k_peer_assoc_h_he()
2334 sizeof(he_cap->he_cap_elem.phy_cap_info), in ath11k_peer_assoc_h_he()
2336 arg->peer_he_ops = vif->bss_conf.he_oper.params; in ath11k_peer_assoc_h_he()
2339 arg->peer_he_ops &= 0xffffff; in ath11k_peer_assoc_h_he()
2342 * in HE cap is zero, use the arg->peer_max_mpdu as calculated while parsing in ath11k_peer_assoc_h_he()
2345 * For non-zero value of Max AMPDU Extponent Extension in HE MAC caps, in ath11k_peer_assoc_h_he()
2346 * if a HE STA sends VHT cap and HE cap IE in assoc request then, use in ath11k_peer_assoc_h_he()
2348 * If a HE STA that does not send VHT cap, but HE and HT cap in assoc in ath11k_peer_assoc_h_he()
2352 ampdu_factor = u8_get_bits(he_cap->he_cap_elem.mac_cap_info[3], in ath11k_peer_assoc_h_he()
2356 if (sta->deflink.vht_cap.vht_supported) in ath11k_peer_assoc_h_he()
2357 arg->peer_max_mpdu = (1 << (IEEE80211_HE_VHT_MAX_AMPDU_FACTOR + in ath11k_peer_assoc_h_he()
2358 ampdu_factor)) - 1; in ath11k_peer_assoc_h_he()
2359 else if (sta->deflink.ht_cap.ht_supported) in ath11k_peer_assoc_h_he()
2360 arg->peer_max_mpdu = (1 << (IEEE80211_HE_HT_MAX_AMPDU_FACTOR + in ath11k_peer_assoc_h_he()
2361 ampdu_factor)) - 1; in ath11k_peer_assoc_h_he()
2364 if (he_cap->he_cap_elem.phy_cap_info[6] & in ath11k_peer_assoc_h_he()
2369 arg->peer_ppet.numss_m1 = he_cap->ppe_thres[0] & in ath11k_peer_assoc_h_he()
2371 arg->peer_ppet.ru_bit_mask = in ath11k_peer_assoc_h_he()
2372 (he_cap->ppe_thres[0] & in ath11k_peer_assoc_h_he()
2376 for (nss = 0; nss <= arg->peer_ppet.numss_m1; nss++) { in ath11k_peer_assoc_h_he()
2381 if ((arg->peer_ppet.ru_bit_mask & BIT(ru)) == 0) in ath11k_peer_assoc_h_he()
2385 val |= ((he_cap->ppe_thres[bit / 8] >> in ath11k_peer_assoc_h_he()
2389 arg->peer_ppet.ppet16_ppet8_ru3_ru0[nss] |= in ath11k_peer_assoc_h_he()
2395 if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_RES) in ath11k_peer_assoc_h_he()
2396 arg->twt_responder = true; in ath11k_peer_assoc_h_he()
2397 if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_REQ) in ath11k_peer_assoc_h_he()
2398 arg->twt_requester = true; in ath11k_peer_assoc_h_he()
2402 if (he_nss > sta->deflink.rx_nss) { in ath11k_peer_assoc_h_he()
2404 for (nss_idx = sta->deflink.rx_nss - 1; nss_idx >= 0; nss_idx--) { in ath11k_peer_assoc_h_he()
2413 …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()
2414 sta->deflink.rx_nss, sta->addr); in ath11k_peer_assoc_h_he()
2415 he_mcs_mask[sta->deflink.rx_nss - 1] = he_mcs_mask[he_nss - 1]; in ath11k_peer_assoc_h_he()
2418 switch (sta->deflink.bandwidth) { in ath11k_peer_assoc_h_he()
2420 if (he_cap->he_cap_elem.phy_cap_info[0] & in ath11k_peer_assoc_h_he()
2422 v = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80p80); in ath11k_peer_assoc_h_he()
2424 arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80_80] = v; in ath11k_peer_assoc_h_he()
2426 v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_80p80); in ath11k_peer_assoc_h_he()
2427 arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80_80] = v; in ath11k_peer_assoc_h_he()
2429 arg->peer_he_mcs_count++; in ath11k_peer_assoc_h_he()
2432 v = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_160); in ath11k_peer_assoc_h_he()
2433 arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_160] = v; in ath11k_peer_assoc_h_he()
2435 v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_160); in ath11k_peer_assoc_h_he()
2437 arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_160] = v; in ath11k_peer_assoc_h_he()
2439 arg->peer_he_mcs_count++; in ath11k_peer_assoc_h_he()
2445 v = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80); in ath11k_peer_assoc_h_he()
2446 arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] = v; in ath11k_peer_assoc_h_he()
2448 v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_80); in ath11k_peer_assoc_h_he()
2450 arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] = v; in ath11k_peer_assoc_h_he()
2452 arg->peer_he_mcs_count++; in ath11k_peer_assoc_h_he()
2464 /* In case of fixed rates, MCS Range in he_tx_mcs might have in ath11k_peer_assoc_h_he()
2472 arg->peer_nss = min(sta->deflink.rx_nss, max_nss); in ath11k_peer_assoc_h_he()
2474 if (arg->peer_phymode == MODE_11AX_HE160 || in ath11k_peer_assoc_h_he()
2475 arg->peer_phymode == MODE_11AX_HE80_80) { in ath11k_peer_assoc_h_he()
2477 rx_nss = min(arg->peer_nss, tx_nss); in ath11k_peer_assoc_h_he()
2478 arg->peer_bw_rxnss_override = ATH11K_BW_NSS_MAP_ENABLE; in ath11k_peer_assoc_h_he()
2481 ath11k_warn(ar->ab, "invalid max_nss\n"); in ath11k_peer_assoc_h_he()
2485 if (arg->peer_phymode == MODE_11AX_HE160) in ath11k_peer_assoc_h_he()
2486 nss_160 = FIELD_PREP(ATH11K_PEER_RX_NSS_160MHZ, rx_nss - 1); in ath11k_peer_assoc_h_he()
2488 nss_160 = FIELD_PREP(ATH11K_PEER_RX_NSS_80_80MHZ, rx_nss - 1); in ath11k_peer_assoc_h_he()
2490 arg->peer_bw_rxnss_override |= nss_160; in ath11k_peer_assoc_h_he()
2493 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_peer_assoc_h_he()
2495 sta->addr, arg->peer_nss, in ath11k_peer_assoc_h_he()
2496 arg->peer_he_mcs_count, in ath11k_peer_assoc_h_he()
2497 arg->peer_bw_rxnss_override); in ath11k_peer_assoc_h_he()
2505 const struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap; in ath11k_peer_assoc_h_he_6ghz()
2507 enum nl80211_band band; in ath11k_peer_assoc_h_he_6ghz() local
2513 band = def.chan->band; in ath11k_peer_assoc_h_he_6ghz()
2515 if (!arg->he_flag || band != NL80211_BAND_6GHZ || !sta->deflink.he_6ghz_capa.capa) in ath11k_peer_assoc_h_he_6ghz()
2518 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_peer_assoc_h_he_6ghz()
2519 arg->bw_40 = true; in ath11k_peer_assoc_h_he_6ghz()
2521 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) in ath11k_peer_assoc_h_he_6ghz()
2522 arg->bw_80 = true; in ath11k_peer_assoc_h_he_6ghz()
2524 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) in ath11k_peer_assoc_h_he_6ghz()
2525 arg->bw_160 = true; in ath11k_peer_assoc_h_he_6ghz()
2527 arg->peer_he_caps_6ghz = le16_to_cpu(sta->deflink.he_6ghz_capa.capa); in ath11k_peer_assoc_h_he_6ghz()
2528 arg->peer_mpdu_density = in ath11k_peer_assoc_h_he_6ghz()
2530 arg->peer_he_caps_6ghz)); in ath11k_peer_assoc_h_he_6ghz()
2532 /* From IEEE Std 802.11ax-2021 - Section 10.12.2: An HE STA shall be capable of in ath11k_peer_assoc_h_he_6ghz()
2533 * receiving A-MPDU where the A-MPDU pre-EOF padding length is up to the value in ath11k_peer_assoc_h_he_6ghz()
2534 * indicated by the Maximum A-MPDU Length Exponent Extension field in the HE in ath11k_peer_assoc_h_he_6ghz()
2535 * Capabilities element and the Maximum A-MPDU Length Exponent field in HE 6 GHz in ath11k_peer_assoc_h_he_6ghz()
2536 * Band Capabilities element in the 6 GHz band. in ath11k_peer_assoc_h_he_6ghz()
2538 * Here, we are extracting the Max A-MPDU Exponent Extension from HE caps and in ath11k_peer_assoc_h_he_6ghz()
2539 * factor is the Maximum A-MPDU Length Exponent from HE 6 GHZ Band capability. in ath11k_peer_assoc_h_he_6ghz()
2542 he_cap->he_cap_elem.mac_cap_info[3]) + in ath11k_peer_assoc_h_he_6ghz()
2544 arg->peer_he_caps_6ghz); in ath11k_peer_assoc_h_he_6ghz()
2546 arg->peer_max_mpdu = (1u << (IEEE80211_HE_6GHZ_MAX_AMPDU_FACTOR + in ath11k_peer_assoc_h_he_6ghz()
2547 ampdu_factor)) - 1; in ath11k_peer_assoc_h_he_6ghz()
2553 const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; in ath11k_peer_assoc_h_smps()
2556 if (!ht_cap->ht_supported && !sta->deflink.he_6ghz_capa.capa) in ath11k_peer_assoc_h_smps()
2559 if (ht_cap->ht_supported) { in ath11k_peer_assoc_h_smps()
2560 smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS; in ath11k_peer_assoc_h_smps()
2563 smps = le16_get_bits(sta->deflink.he_6ghz_capa.capa, in ath11k_peer_assoc_h_smps()
2569 arg->static_mimops_flag = true; in ath11k_peer_assoc_h_smps()
2572 arg->dynamic_mimops_flag = true; in ath11k_peer_assoc_h_smps()
2575 arg->spatial_mux_flag = true; in ath11k_peer_assoc_h_smps()
2587 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_peer_assoc_h_qos()
2589 switch (arvif->vdev_type) { in ath11k_peer_assoc_h_qos()
2591 if (sta->wme) { in ath11k_peer_assoc_h_qos()
2593 arg->is_wme_set = true; in ath11k_peer_assoc_h_qos()
2594 arg->qos_flag = true; in ath11k_peer_assoc_h_qos()
2597 if (sta->wme && sta->uapsd_queues) { in ath11k_peer_assoc_h_qos()
2599 arg->is_wme_set = true; in ath11k_peer_assoc_h_qos()
2600 arg->apsd_flag = true; in ath11k_peer_assoc_h_qos()
2601 arg->peer_rate_caps |= WMI_HOST_RC_UAPSD_FLAG; in ath11k_peer_assoc_h_qos()
2605 if (sta->wme) { in ath11k_peer_assoc_h_qos()
2606 arg->is_wme_set = true; in ath11k_peer_assoc_h_qos()
2607 arg->qos_flag = true; in ath11k_peer_assoc_h_qos()
2614 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "peer %pM qos %d\n", in ath11k_peer_assoc_h_qos()
2615 sta->addr, arg->qos_flag); in ath11k_peer_assoc_h_qos()
2627 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_qos_ap()
2629 params.vdev_id = arvif->vdev_id; in ath11k_peer_assoc_qos_ap()
2631 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "uapsd_queues 0x%x max_sp %d\n", in ath11k_peer_assoc_qos_ap()
2632 sta->uapsd_queues, sta->max_sp); in ath11k_peer_assoc_qos_ap()
2635 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) in ath11k_peer_assoc_qos_ap()
2638 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VI) in ath11k_peer_assoc_qos_ap()
2641 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BK) in ath11k_peer_assoc_qos_ap()
2644 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BE) in ath11k_peer_assoc_qos_ap()
2649 if (sta->max_sp < MAX_WMI_AP_PS_PEER_PARAM_MAX_SP) in ath11k_peer_assoc_qos_ap()
2650 max_sp = sta->max_sp; in ath11k_peer_assoc_qos_ap()
2654 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, &params); in ath11k_peer_assoc_qos_ap()
2660 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, &params); in ath11k_peer_assoc_qos_ap()
2667 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, &params); in ath11k_peer_assoc_qos_ap()
2673 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, &params); in ath11k_peer_assoc_qos_ap()
2680 ath11k_warn(ar->ab, "failed to set ap ps peer param %d for vdev %i: %d\n", in ath11k_peer_assoc_qos_ap()
2681 params.param, arvif->vdev_id, ret); in ath11k_peer_assoc_qos_ap()
2687 return sta->deflink.supp_rates[NL80211_BAND_2GHZ] >> in ath11k_mac_sta_has_ofdm_only()
2694 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) { in ath11k_mac_get_phymode_vht()
2695 switch (sta->deflink.vht_cap.cap & in ath11k_mac_get_phymode_vht()
2707 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) in ath11k_mac_get_phymode_vht()
2710 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_mac_get_phymode_vht()
2713 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_20) in ath11k_mac_get_phymode_vht()
2722 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160) { in ath11k_mac_get_phymode_he()
2723 if (sta->deflink.he_cap.he_cap_elem.phy_cap_info[0] & in ath11k_mac_get_phymode_he()
2726 else if (sta->deflink.he_cap.he_cap_elem.phy_cap_info[0] & in ath11k_mac_get_phymode_he()
2733 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) in ath11k_mac_get_phymode_he()
2736 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_mac_get_phymode_he()
2739 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_20) in ath11k_mac_get_phymode_he()
2750 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_peer_assoc_h_phymode()
2752 enum nl80211_band band; in ath11k_peer_assoc_h_phymode() local
2761 band = def.chan->band; in ath11k_peer_assoc_h_phymode()
2762 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath11k_peer_assoc_h_phymode()
2763 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath11k_peer_assoc_h_phymode()
2764 he_mcs_mask = arvif->bitrate_mask.control[band].he_mcs; in ath11k_peer_assoc_h_phymode()
2766 switch (band) { in ath11k_peer_assoc_h_phymode()
2768 if (sta->deflink.he_cap.has_he && in ath11k_peer_assoc_h_phymode()
2770 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80) in ath11k_peer_assoc_h_phymode()
2772 else if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_peer_assoc_h_phymode()
2776 } else if (sta->deflink.vht_cap.vht_supported && in ath11k_peer_assoc_h_phymode()
2778 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_peer_assoc_h_phymode()
2782 } else if (sta->deflink.ht_cap.ht_supported && in ath11k_peer_assoc_h_phymode()
2784 if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_peer_assoc_h_phymode()
2797 if (sta->deflink.he_cap.has_he && in ath11k_peer_assoc_h_phymode()
2800 } else if (sta->deflink.vht_cap.vht_supported && in ath11k_peer_assoc_h_phymode()
2803 } else if (sta->deflink.ht_cap.ht_supported && in ath11k_peer_assoc_h_phymode()
2805 if (sta->deflink.bandwidth >= IEEE80211_STA_RX_BW_40) in ath11k_peer_assoc_h_phymode()
2817 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "peer %pM phymode %s\n", in ath11k_peer_assoc_h_phymode()
2818 sta->addr, ath11k_wmi_phymode_str(phymode)); in ath11k_peer_assoc_h_phymode()
2820 arg->peer_phymode = phymode; in ath11k_peer_assoc_h_phymode()
2832 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_prepare()
2834 arsta = (struct ath11k_sta *)sta->drv_priv; in ath11k_peer_assoc_prepare()
2838 reinit_completion(&ar->peer_assoc_done); in ath11k_peer_assoc_prepare()
2840 arg->peer_new_assoc = !reassoc; in ath11k_peer_assoc_prepare()
2852 arsta->peer_nss = arg->peer_nss; in ath11k_peer_assoc_prepare()
2864 if (!ht_cap->ht_supported && !he_6ghz_capa) in ath11k_setup_peer_smps()
2867 if (ht_cap->ht_supported) { in ath11k_setup_peer_smps()
2868 smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS; in ath11k_setup_peer_smps()
2875 return -EINVAL; in ath11k_setup_peer_smps()
2877 return ath11k_wmi_set_peer_param(ar, addr, arvif->vdev_id, in ath11k_setup_peer_smps()
2884 struct ath11k *ar = arvif->ar; in ath11k_mac_set_he_txbf_conf()
2888 if (!arvif->vif->bss_conf.he_support) in ath11k_mac_set_he_txbf_conf()
2893 if (arvif->vif->bss_conf.he_su_beamformer) { in ath11k_mac_set_he_txbf_conf()
2895 if (arvif->vif->bss_conf.he_mu_beamformer && in ath11k_mac_set_he_txbf_conf()
2896 arvif->vdev_type == WMI_VDEV_TYPE_AP) in ath11k_mac_set_he_txbf_conf()
2900 if (arvif->vif->type != NL80211_IFTYPE_MESH_POINT) { in ath11k_mac_set_he_txbf_conf()
2904 if (arvif->vif->bss_conf.he_full_ul_mumimo) in ath11k_mac_set_he_txbf_conf()
2907 if (arvif->vif->bss_conf.he_su_beamformee) in ath11k_mac_set_he_txbf_conf()
2911 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, value); in ath11k_mac_set_he_txbf_conf()
2913 ath11k_warn(ar->ab, "failed to set vdev %d HE MU mode: %d\n", in ath11k_mac_set_he_txbf_conf()
2914 arvif->vdev_id, ret); in ath11k_mac_set_he_txbf_conf()
2922 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_he_txbf_conf()
2925 ath11k_warn(ar->ab, "failed to set vdev %d sounding mode: %d\n", in ath11k_mac_set_he_txbf_conf()
2926 arvif->vdev_id, ret); in ath11k_mac_set_he_txbf_conf()
2936 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_vif_recalc_sta_he_txbf()
2944 if (!vif->bss_conf.he_support) in ath11k_mac_vif_recalc_sta_he_txbf()
2947 if (vif->type != NL80211_IFTYPE_STATION) in ath11k_mac_vif_recalc_sta_he_txbf()
2953 if (def.chan->band == NL80211_BAND_2GHZ) in ath11k_mac_vif_recalc_sta_he_txbf()
2954 cap_band = &ar->mac.iftype[NL80211_BAND_2GHZ][vif->type].he_cap; in ath11k_mac_vif_recalc_sta_he_txbf()
2956 cap_band = &ar->mac.iftype[NL80211_BAND_5GHZ][vif->type].he_cap; in ath11k_mac_vif_recalc_sta_he_txbf()
2958 memcpy(&he_cap_elem, &cap_band->he_cap_elem, sizeof(he_cap_elem)); in ath11k_mac_vif_recalc_sta_he_txbf()
2961 if (HECAP_PHY_SUBFMR_GET(he_cap->he_cap_elem.phy_cap_info)) in ath11k_mac_vif_recalc_sta_he_txbf()
2963 if (HECAP_PHY_MUBFMR_GET(he_cap->he_cap_elem.phy_cap_info)) in ath11k_mac_vif_recalc_sta_he_txbf()
2967 if (vif->type != NL80211_IFTYPE_MESH_POINT) { in ath11k_mac_vif_recalc_sta_he_txbf()
2972 if (HECAP_PHY_ULMUMIMO_GET(he_cap->he_cap_elem.phy_cap_info)) in ath11k_mac_vif_recalc_sta_he_txbf()
2983 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, hemode); in ath11k_mac_vif_recalc_sta_he_txbf()
2985 ath11k_warn(ar->ab, "failed to submit vdev param txbf 0x%x: %d\n", in ath11k_mac_vif_recalc_sta_he_txbf()
2997 struct ath11k *ar = hw->priv; in ath11k_bss_assoc()
2998 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_bss_assoc()
3006 lockdep_assert_held(&ar->conf_mutex); in ath11k_bss_assoc()
3008 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %i assoc bssid %pM aid %d\n", in ath11k_bss_assoc()
3009 arvif->vdev_id, arvif->bssid, arvif->aid); in ath11k_bss_assoc()
3013 ap_sta = ieee80211_find_sta(vif, bss_conf->bssid); in ath11k_bss_assoc()
3015 ath11k_warn(ar->ab, "failed to find station entry for bss %pM vdev %i\n", in ath11k_bss_assoc()
3016 bss_conf->bssid, arvif->vdev_id); in ath11k_bss_assoc()
3022 he_cap = ap_sta->deflink.he_cap; in ath11k_bss_assoc()
3031 ath11k_warn(ar->ab, "failed to run peer assoc for %pM vdev %i: %d\n", in ath11k_bss_assoc()
3032 bss_conf->bssid, arvif->vdev_id, ret); in ath11k_bss_assoc()
3036 if (!wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) { in ath11k_bss_assoc()
3037 ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n", in ath11k_bss_assoc()
3038 bss_conf->bssid, arvif->vdev_id); in ath11k_bss_assoc()
3042 ret = ath11k_setup_peer_smps(ar, arvif, bss_conf->bssid, in ath11k_bss_assoc()
3043 &ap_sta->deflink.ht_cap, in ath11k_bss_assoc()
3044 le16_to_cpu(ap_sta->deflink.he_6ghz_capa.capa)); in ath11k_bss_assoc()
3046 ath11k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n", in ath11k_bss_assoc()
3047 arvif->vdev_id, ret); in ath11k_bss_assoc()
3052 ath11k_warn(ar->ab, "failed to recalc he txbf for vdev %i on bss %pM\n", in ath11k_bss_assoc()
3053 arvif->vdev_id, bss_conf->bssid); in ath11k_bss_assoc()
3057 WARN_ON(arvif->is_up); in ath11k_bss_assoc()
3059 arvif->aid = vif->cfg.aid; in ath11k_bss_assoc()
3060 ether_addr_copy(arvif->bssid, bss_conf->bssid); in ath11k_bss_assoc()
3062 ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid, in ath11k_bss_assoc()
3065 ath11k_warn(ar->ab, "failed to set vdev %d up: %d\n", in ath11k_bss_assoc()
3066 arvif->vdev_id, ret); in ath11k_bss_assoc()
3070 arvif->is_up = true; in ath11k_bss_assoc()
3071 arvif->rekey_data.enable_offload = false; in ath11k_bss_assoc()
3073 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_bss_assoc()
3075 arvif->vdev_id, bss_conf->bssid, vif->cfg.aid); in ath11k_bss_assoc()
3077 spin_lock_bh(&ar->ab->base_lock); in ath11k_bss_assoc()
3079 peer = ath11k_peer_find(ar->ab, arvif->vdev_id, arvif->bssid); in ath11k_bss_assoc()
3080 if (peer && peer->is_authorized) in ath11k_bss_assoc()
3083 spin_unlock_bh(&ar->ab->base_lock); in ath11k_bss_assoc()
3086 ret = ath11k_wmi_set_peer_param(ar, arvif->bssid, in ath11k_bss_assoc()
3087 arvif->vdev_id, in ath11k_bss_assoc()
3091 ath11k_warn(ar->ab, "Unable to authorize BSS peer: %d\n", ret); in ath11k_bss_assoc()
3094 ret = ath11k_wmi_send_obss_spr_cmd(ar, arvif->vdev_id, in ath11k_bss_assoc()
3095 &bss_conf->he_obss_pd); in ath11k_bss_assoc()
3097 ath11k_warn(ar->ab, "failed to set vdev %i OBSS PD parameters: %d\n", in ath11k_bss_assoc()
3098 arvif->vdev_id, ret); in ath11k_bss_assoc()
3100 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_bss_assoc()
3104 ath11k_warn(ar->ab, "failed to set vdev %d dtim policy: %d\n", in ath11k_bss_assoc()
3105 arvif->vdev_id, ret); in ath11k_bss_assoc()
3107 ath11k_mac_11d_scan_stop_all(ar->ab); in ath11k_bss_assoc()
3113 struct ath11k *ar = hw->priv; in ath11k_bss_disassoc()
3114 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_bss_disassoc()
3117 lockdep_assert_held(&ar->conf_mutex); in ath11k_bss_disassoc()
3119 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %i disassoc bssid %pM\n", in ath11k_bss_disassoc()
3120 arvif->vdev_id, arvif->bssid); in ath11k_bss_disassoc()
3122 ret = ath11k_wmi_vdev_down(ar, arvif->vdev_id); in ath11k_bss_disassoc()
3124 ath11k_warn(ar->ab, "failed to down vdev %i: %d\n", in ath11k_bss_disassoc()
3125 arvif->vdev_id, ret); in ath11k_bss_disassoc()
3127 arvif->is_up = false; in ath11k_bss_disassoc()
3129 memset(&arvif->rekey_data, 0, sizeof(arvif->rekey_data)); in ath11k_bss_disassoc()
3131 cancel_delayed_work_sync(&arvif->connection_loss_work); in ath11k_bss_disassoc()
3156 return -EINVAL; in ath11k_mac_get_rate_hw_value()
3163 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_recalculate_mgmt_rate()
3171 lockdep_assert_held(&ar->conf_mutex); in ath11k_recalculate_mgmt_rate()
3173 sband = ar->hw->wiphy->bands[def->chan->band]; in ath11k_recalculate_mgmt_rate()
3174 basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; in ath11k_recalculate_mgmt_rate()
3175 bitrate = sband->bitrates[basic_rate_idx].bitrate; in ath11k_recalculate_mgmt_rate()
3179 ath11k_warn(ar->ab, "bitrate not supported %d\n", bitrate); in ath11k_recalculate_mgmt_rate()
3184 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, vdev_param, in ath11k_recalculate_mgmt_rate()
3187 ath11k_warn(ar->ab, "failed to set mgmt tx rate %d\n", ret); in ath11k_recalculate_mgmt_rate()
3192 ar->hw_rate_code = hw_rate_code; in ath11k_recalculate_mgmt_rate()
3195 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, vdev_param, in ath11k_recalculate_mgmt_rate()
3198 ath11k_warn(ar->ab, "failed to set beacon tx rate %d\n", ret); in ath11k_recalculate_mgmt_rate()
3204 struct ath11k *ar = arvif->ar; in ath11k_mac_fils_discovery()
3210 if (info->fils_discovery.max_interval) { in ath11k_mac_fils_discovery()
3211 interval = info->fils_discovery.max_interval; in ath11k_mac_fils_discovery()
3213 tmpl = ieee80211_get_fils_discovery_tmpl(ar->hw, arvif->vif); in ath11k_mac_fils_discovery()
3215 ret = ath11k_wmi_fils_discovery_tmpl(ar, arvif->vdev_id, in ath11k_mac_fils_discovery()
3217 } else if (info->unsol_bcast_probe_resp_interval) { in ath11k_mac_fils_discovery()
3219 interval = info->unsol_bcast_probe_resp_interval; in ath11k_mac_fils_discovery()
3221 tmpl = ieee80211_get_unsol_bcast_probe_resp_tmpl(ar->hw, in ath11k_mac_fils_discovery()
3222 arvif->vif); in ath11k_mac_fils_discovery()
3224 ret = ath11k_wmi_probe_resp_tmpl(ar, arvif->vdev_id, in ath11k_mac_fils_discovery()
3227 return ath11k_wmi_fils_discovery(ar, arvif->vdev_id, 0, false); in ath11k_mac_fils_discovery()
3231 ath11k_warn(ar->ab, in ath11k_mac_fils_discovery()
3233 arvif->vdev_id, (unsol_bcast_probe_resp_enabled ? in ath11k_mac_fils_discovery()
3236 return -EPERM; in ath11k_mac_fils_discovery()
3241 ret = ath11k_wmi_fils_discovery(ar, arvif->vdev_id, interval, in ath11k_mac_fils_discovery()
3254 pdev_id = ar->pdev->pdev_id; in ath11k_mac_config_obss_pd()
3256 /* Set and enable SRG/non-SRG OBSS PD Threshold */ in ath11k_mac_config_obss_pd()
3258 if (test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags)) { in ath11k_mac_config_obss_pd()
3261 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3267 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_config_obss_pd()
3269 he_obss_pd->sr_ctrl, he_obss_pd->non_srg_max_offset, in ath11k_mac_config_obss_pd()
3270 he_obss_pd->max_offset); in ath11k_mac_config_obss_pd()
3274 if (he_obss_pd->sr_ctrl & in ath11k_mac_config_obss_pd()
3278 if (he_obss_pd->sr_ctrl & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT) in ath11k_mac_config_obss_pd()
3280 he_obss_pd->non_srg_max_offset); in ath11k_mac_config_obss_pd()
3287 if (he_obss_pd->sr_ctrl & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT) { in ath11k_mac_config_obss_pd()
3288 srg_th = ATH11K_OBSS_PD_MAX_THRESHOLD + he_obss_pd->max_offset; in ath11k_mac_config_obss_pd()
3293 ar->ab->wmi_ab.svc_map)) { in ath11k_mac_config_obss_pd()
3297 non_srg_th -= ATH11K_DEFAULT_NOISE_FLOOR; in ath11k_mac_config_obss_pd()
3298 /* SRG not supported and threshold in dB */ in ath11k_mac_config_obss_pd()
3306 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3317 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3325 param_val = !!(he_obss_pd->sr_ctrl & in ath11k_mac_config_obss_pd()
3329 ath11k_warn(ar->ab, "failed to set sr_prohibit for pdev: %u\n", in ath11k_mac_config_obss_pd()
3335 ar->ab->wmi_ab.svc_map)) in ath11k_mac_config_obss_pd()
3339 memcpy(bitmap, he_obss_pd->bss_color_bitmap, sizeof(bitmap)); in ath11k_mac_config_obss_pd()
3342 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3349 memcpy(bitmap, he_obss_pd->partial_bssid_bitmap, sizeof(bitmap)); in ath11k_mac_config_obss_pd()
3352 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3363 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3372 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3378 /* Enable all BSS Colors for non-SRG */ in ath11k_mac_config_obss_pd()
3381 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3387 /* Enable all partial BSSID mask for non-SRG */ in ath11k_mac_config_obss_pd()
3390 ath11k_warn(ar->ab, in ath11k_mac_config_obss_pd()
3404 struct ath11k *ar = hw->priv; in ath11k_mac_op_bss_info_changed()
3408 enum nl80211_band band; in ath11k_mac_op_bss_info_changed() local
3419 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_bss_info_changed()
3422 arvif->beacon_interval = info->beacon_int; in ath11k_mac_op_bss_info_changed()
3425 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3427 arvif->beacon_interval); in ath11k_mac_op_bss_info_changed()
3429 ath11k_warn(ar->ab, "Failed to set beacon interval for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
3430 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3432 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3434 arvif->beacon_interval, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3441 param_value, ar->pdev->pdev_id); in ath11k_mac_op_bss_info_changed()
3443 ath11k_warn(ar->ab, "Failed to set beacon mode for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
3444 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3446 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3448 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3450 if (!arvif->do_not_send_tmpl || !arvif->bcca_zero_sent) { in ath11k_mac_op_bss_info_changed()
3453 ath11k_warn(ar->ab, "failed to update bcn template: %d\n", in ath11k_mac_op_bss_info_changed()
3457 if (arvif->bcca_zero_sent) in ath11k_mac_op_bss_info_changed()
3458 arvif->do_not_send_tmpl = true; in ath11k_mac_op_bss_info_changed()
3460 arvif->do_not_send_tmpl = false; in ath11k_mac_op_bss_info_changed()
3462 if (vif->bss_conf.he_support) { in ath11k_mac_op_bss_info_changed()
3463 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3467 ath11k_warn(ar->ab, in ath11k_mac_op_bss_info_changed()
3469 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3471 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3473 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3478 arvif->dtim_period = info->dtim_period; in ath11k_mac_op_bss_info_changed()
3481 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3483 arvif->dtim_period); in ath11k_mac_op_bss_info_changed()
3486 ath11k_warn(ar->ab, "Failed to set dtim period for VDEV %d: %i\n", in ath11k_mac_op_bss_info_changed()
3487 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3489 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3491 arvif->dtim_period, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3495 vif->type == NL80211_IFTYPE_AP) { in ath11k_mac_op_bss_info_changed()
3496 arvif->u.ap.ssid_len = vif->cfg.ssid_len; in ath11k_mac_op_bss_info_changed()
3497 if (vif->cfg.ssid_len) in ath11k_mac_op_bss_info_changed()
3498 memcpy(arvif->u.ap.ssid, vif->cfg.ssid, in ath11k_mac_op_bss_info_changed()
3499 vif->cfg.ssid_len); in ath11k_mac_op_bss_info_changed()
3500 arvif->u.ap.hidden_ssid = info->hidden_ssid; in ath11k_mac_op_bss_info_changed()
3503 if (changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) in ath11k_mac_op_bss_info_changed()
3504 ether_addr_copy(arvif->bssid, info->bssid); in ath11k_mac_op_bss_info_changed()
3507 if (info->enable_beacon) in ath11k_mac_op_bss_info_changed()
3511 if (arvif->is_up && vif->bss_conf.he_support && in ath11k_mac_op_bss_info_changed()
3512 vif->bss_conf.he_oper.params) { in ath11k_mac_op_bss_info_changed()
3514 param_value = vif->bss_conf.he_oper.params; in ath11k_mac_op_bss_info_changed()
3515 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3517 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3519 param_value, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3522 ath11k_warn(ar->ab, "Failed to set he oper params %x for VDEV %d: %i\n", in ath11k_mac_op_bss_info_changed()
3523 param_value, arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3530 cts_prot = !!(info->use_cts_prot); in ath11k_mac_op_bss_info_changed()
3533 if (arvif->is_started) { in ath11k_mac_op_bss_info_changed()
3534 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3537 ath11k_warn(ar->ab, "Failed to set CTS prot for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
3538 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3540 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "Set CTS prot: %d for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
3541 cts_prot, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3543 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "defer protection mode setup, vdev is not ready yet\n"); in ath11k_mac_op_bss_info_changed()
3550 if (info->use_short_slot) in ath11k_mac_op_bss_info_changed()
3557 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3560 ath11k_warn(ar->ab, "Failed to set erp slot for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
3561 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3563 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3565 slottime, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3571 if (info->use_short_preamble) in ath11k_mac_op_bss_info_changed()
3577 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3580 ath11k_warn(ar->ab, "Failed to set preamble for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
3581 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3583 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3585 preamble, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3589 if (vif->cfg.assoc) in ath11k_mac_op_bss_info_changed()
3596 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev_id %i txpower %d\n", in ath11k_mac_op_bss_info_changed()
3597 arvif->vdev_id, info->txpower); in ath11k_mac_op_bss_info_changed()
3599 arvif->txpower = info->txpower; in ath11k_mac_op_bss_info_changed()
3604 ar->ab->hw_params.supports_sta_ps) { in ath11k_mac_op_bss_info_changed()
3605 arvif->ps = vif->cfg.ps; in ath11k_mac_op_bss_info_changed()
3609 ath11k_warn(ar->ab, "failed to setup ps on vdev %i: %d\n", in ath11k_mac_op_bss_info_changed()
3610 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3614 !ath11k_mac_vif_chan(arvif->vif, &def)) { in ath11k_mac_op_bss_info_changed()
3615 band = def.chan->band; in ath11k_mac_op_bss_info_changed()
3616 mcast_rate = vif->bss_conf.mcast_rate[band]; in ath11k_mac_op_bss_info_changed()
3619 rateidx = mcast_rate - 1; in ath11k_mac_op_bss_info_changed()
3621 rateidx = ffs(vif->bss_conf.basic_rates) - 1; in ath11k_mac_op_bss_info_changed()
3623 if (ar->pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) in ath11k_mac_op_bss_info_changed()
3636 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3638 arvif->vdev_id, rate); in ath11k_mac_op_bss_info_changed()
3641 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3644 ath11k_warn(ar->ab, in ath11k_mac_op_bss_info_changed()
3646 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3649 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3652 ath11k_warn(ar->ab, in ath11k_mac_op_bss_info_changed()
3654 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3658 !ath11k_mac_vif_chan(arvif->vif, &def)) in ath11k_mac_op_bss_info_changed()
3664 if (info->twt_requester || info->twt_responder) { in ath11k_mac_op_bss_info_changed()
3666 ath11k_wmi_send_twt_enable_cmd(ar, ar->pdev->pdev_id, in ath11k_mac_op_bss_info_changed()
3669 ath11k_wmi_send_twt_disable_cmd(ar, ar->pdev->pdev_id); in ath11k_mac_op_bss_info_changed()
3674 ath11k_mac_config_obss_pd(ar, &info->he_obss_pd); in ath11k_mac_op_bss_info_changed()
3677 if (vif->type == NL80211_IFTYPE_AP) { in ath11k_mac_op_bss_info_changed()
3679 ar, arvif->vdev_id, info->he_bss_color.color, in ath11k_mac_op_bss_info_changed()
3681 info->he_bss_color.enabled); in ath11k_mac_op_bss_info_changed()
3683 ath11k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n", in ath11k_mac_op_bss_info_changed()
3684 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3687 if (info->he_bss_color.enabled) in ath11k_mac_op_bss_info_changed()
3688 param_value = info->he_bss_color.color << in ath11k_mac_op_bss_info_changed()
3693 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3697 ath11k_warn(ar->ab, in ath11k_mac_op_bss_info_changed()
3699 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3701 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
3703 param_value, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
3704 } else if (vif->type == NL80211_IFTYPE_STATION) { in ath11k_mac_op_bss_info_changed()
3706 arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
3709 ath11k_warn(ar->ab, "failed to enable bss color change on vdev %i: %d\n", in ath11k_mac_op_bss_info_changed()
3710 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3712 ar, arvif->vdev_id, 0, in ath11k_mac_op_bss_info_changed()
3715 ath11k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n", in ath11k_mac_op_bss_info_changed()
3716 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3721 arvif->ftm_responder != info->ftm_responder && in ath11k_mac_op_bss_info_changed()
3722 test_bit(WMI_TLV_SERVICE_RTT, ar->ab->wmi_ab.svc_map) && in ath11k_mac_op_bss_info_changed()
3723 (vif->type == NL80211_IFTYPE_AP || in ath11k_mac_op_bss_info_changed()
3724 vif->type == NL80211_IFTYPE_MESH_POINT)) { in ath11k_mac_op_bss_info_changed()
3725 arvif->ftm_responder = info->ftm_responder; in ath11k_mac_op_bss_info_changed()
3727 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, in ath11k_mac_op_bss_info_changed()
3728 arvif->ftm_responder); in ath11k_mac_op_bss_info_changed()
3730 ath11k_warn(ar->ab, "Failed to set ftm responder %i: %d\n", in ath11k_mac_op_bss_info_changed()
3731 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
3739 ipv4_cnt = min(vif->cfg.arp_addr_cnt, ATH11K_IPV4_MAX_COUNT); in ath11k_mac_op_bss_info_changed()
3740 memcpy(arvif->arp_ns_offload.ipv4_addr, in ath11k_mac_op_bss_info_changed()
3741 vif->cfg.arp_addr_list, in ath11k_mac_op_bss_info_changed()
3743 memcpy(arvif->arp_ns_offload.mac_addr, vif->addr, ETH_ALEN); in ath11k_mac_op_bss_info_changed()
3744 arvif->arp_ns_offload.ipv4_count = ipv4_cnt; in ath11k_mac_op_bss_info_changed()
3746 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()
3747 vif->cfg.arp_addr_cnt, in ath11k_mac_op_bss_info_changed()
3748 vif->addr, arvif->arp_ns_offload.ipv4_addr); in ath11k_mac_op_bss_info_changed()
3751 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_bss_info_changed()
3756 lockdep_assert_held(&ar->data_lock); in __ath11k_mac_scan_finish()
3758 switch (ar->scan.state) { in __ath11k_mac_scan_finish()
3763 if (ar->scan.is_roc && ar->scan.roc_notify) in __ath11k_mac_scan_finish()
3764 ieee80211_remain_on_channel_expired(ar->hw); in __ath11k_mac_scan_finish()
3767 if (!ar->scan.is_roc) { in __ath11k_mac_scan_finish()
3769 .aborted = ((ar->scan.state == in __ath11k_mac_scan_finish()
3771 (ar->scan.state == in __ath11k_mac_scan_finish()
3775 ieee80211_scan_completed(ar->hw, &info); in __ath11k_mac_scan_finish()
3778 ar->scan.state = ATH11K_SCAN_IDLE; in __ath11k_mac_scan_finish()
3779 ar->scan_channel = NULL; in __ath11k_mac_scan_finish()
3780 ar->scan.roc_freq = 0; in __ath11k_mac_scan_finish()
3781 cancel_delayed_work(&ar->scan.timeout); in __ath11k_mac_scan_finish()
3782 complete_all(&ar->scan.completed); in __ath11k_mac_scan_finish()
3789 spin_lock_bh(&ar->data_lock); in ath11k_mac_scan_finish()
3791 spin_unlock_bh(&ar->data_lock); in ath11k_mac_scan_finish()
3802 lockdep_assert_held(&ar->conf_mutex); in ath11k_scan_stop()
3805 arg.pdev_id = ar->pdev->pdev_id; in ath11k_scan_stop()
3809 ath11k_warn(ar->ab, "failed to stop wmi scan: %d\n", ret); in ath11k_scan_stop()
3813 ret = wait_for_completion_timeout(&ar->scan.completed, 3 * HZ); in ath11k_scan_stop()
3815 ath11k_warn(ar->ab, in ath11k_scan_stop()
3817 ret = -ETIMEDOUT; in ath11k_scan_stop()
3823 /* Scan state should be updated upon scan completion but in case in ath11k_scan_stop()
3830 spin_lock_bh(&ar->data_lock); in ath11k_scan_stop()
3831 if (ar->scan.state != ATH11K_SCAN_IDLE) in ath11k_scan_stop()
3833 spin_unlock_bh(&ar->data_lock); in ath11k_scan_stop()
3842 lockdep_assert_held(&ar->conf_mutex); in ath11k_scan_abort()
3844 spin_lock_bh(&ar->data_lock); in ath11k_scan_abort()
3846 switch (ar->scan.state) { in ath11k_scan_abort()
3848 /* This can happen if timeout worker kicked in and called in ath11k_scan_abort()
3854 ath11k_warn(ar->ab, "refusing scan abortion due to invalid scan state: %d\n", in ath11k_scan_abort()
3855 ar->scan.state); in ath11k_scan_abort()
3858 ar->scan.state = ATH11K_SCAN_ABORTING; in ath11k_scan_abort()
3859 spin_unlock_bh(&ar->data_lock); in ath11k_scan_abort()
3863 ath11k_warn(ar->ab, "failed to abort scan: %d\n", ret); in ath11k_scan_abort()
3865 spin_lock_bh(&ar->data_lock); in ath11k_scan_abort()
3869 spin_unlock_bh(&ar->data_lock); in ath11k_scan_abort()
3877 mutex_lock(&ar->conf_mutex); in ath11k_scan_timeout_work()
3879 mutex_unlock(&ar->conf_mutex); in ath11k_scan_timeout_work()
3888 lockdep_assert_held(&ar->conf_mutex); in ath11k_start_scan()
3897 if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map)) { in ath11k_start_scan()
3900 if (ar->supports_6ghz) in ath11k_start_scan()
3904 ret = wait_for_completion_timeout(&ar->scan.started, timeout); in ath11k_start_scan()
3908 ath11k_warn(ar->ab, "failed to stop scan: %d\n", ret); in ath11k_start_scan()
3910 return -ETIMEDOUT; in ath11k_start_scan()
3914 * this point. This is probably due to some issue in the in ath11k_start_scan()
3917 spin_lock_bh(&ar->data_lock); in ath11k_start_scan()
3918 if (ar->scan.state == ATH11K_SCAN_IDLE) { in ath11k_start_scan()
3919 spin_unlock_bh(&ar->data_lock); in ath11k_start_scan()
3920 return -EINVAL; in ath11k_start_scan()
3922 spin_unlock_bh(&ar->data_lock); in ath11k_start_scan()
3931 struct ath11k *ar = hw->priv; in ath11k_mac_op_hw_scan()
3933 struct cfg80211_scan_request *req = &hw_req->req; in ath11k_mac_op_hw_scan()
3946 if (ar->state_11d == ATH11K_11D_PREPARING && in ath11k_mac_op_hw_scan()
3948 ar->ab->wmi_ab.svc_map)) in ath11k_mac_op_hw_scan()
3949 ath11k_mac_11d_scan_start(ar, arvif->vdev_id); in ath11k_mac_op_hw_scan()
3951 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_hw_scan()
3953 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
3954 switch (ar->scan.state) { in ath11k_mac_op_hw_scan()
3956 reinit_completion(&ar->scan.started); in ath11k_mac_op_hw_scan()
3957 reinit_completion(&ar->scan.completed); in ath11k_mac_op_hw_scan()
3958 ar->scan.state = ATH11K_SCAN_STARTING; in ath11k_mac_op_hw_scan()
3959 ar->scan.is_roc = false; in ath11k_mac_op_hw_scan()
3960 ar->scan.vdev_id = arvif->vdev_id; in ath11k_mac_op_hw_scan()
3966 ret = -EBUSY; in ath11k_mac_op_hw_scan()
3969 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
3977 ret = -ENOMEM; in ath11k_mac_op_hw_scan()
3982 arg->vdev_id = arvif->vdev_id; in ath11k_mac_op_hw_scan()
3983 arg->scan_id = ATH11K_SCAN_ID; in ath11k_mac_op_hw_scan()
3985 if (req->ie_len) { in ath11k_mac_op_hw_scan()
3986 arg->extraie.ptr = kmemdup(req->ie, req->ie_len, GFP_KERNEL); in ath11k_mac_op_hw_scan()
3987 if (!arg->extraie.ptr) { in ath11k_mac_op_hw_scan()
3988 ret = -ENOMEM; in ath11k_mac_op_hw_scan()
3991 arg->extraie.len = req->ie_len; in ath11k_mac_op_hw_scan()
3994 if (req->n_ssids) { in ath11k_mac_op_hw_scan()
3995 arg->num_ssids = req->n_ssids; in ath11k_mac_op_hw_scan()
3996 for (i = 0; i < arg->num_ssids; i++) { in ath11k_mac_op_hw_scan()
3997 arg->ssid[i].length = req->ssids[i].ssid_len; in ath11k_mac_op_hw_scan()
3998 memcpy(&arg->ssid[i].ssid, req->ssids[i].ssid, in ath11k_mac_op_hw_scan()
3999 req->ssids[i].ssid_len); in ath11k_mac_op_hw_scan()
4002 arg->scan_flags |= WMI_SCAN_FLAG_PASSIVE; in ath11k_mac_op_hw_scan()
4005 if (req->n_channels) { in ath11k_mac_op_hw_scan()
4006 arg->num_chan = req->n_channels; in ath11k_mac_op_hw_scan()
4007 arg->chan_list = kcalloc(arg->num_chan, sizeof(*arg->chan_list), in ath11k_mac_op_hw_scan()
4010 if (!arg->chan_list) { in ath11k_mac_op_hw_scan()
4011 ret = -ENOMEM; in ath11k_mac_op_hw_scan()
4015 for (i = 0; i < arg->num_chan; i++) { in ath11k_mac_op_hw_scan()
4017 ar->ab->wmi_ab.svc_map)) { in ath11k_mac_op_hw_scan()
4018 arg->chan_list[i] = in ath11k_mac_op_hw_scan()
4019 u32_encode_bits(req->channels[i]->center_freq, in ath11k_mac_op_hw_scan()
4022 /* If NL80211_SCAN_FLAG_COLOCATED_6GHZ is set in scan in ath11k_mac_op_hw_scan()
4023 * flags, then scan all PSC channels in 6 GHz band and in ath11k_mac_op_hw_scan()
4024 * those non-PSC channels where RNR IE is found during in ath11k_mac_op_hw_scan()
4027 * then all channels in 6 GHz will be scanned. in ath11k_mac_op_hw_scan()
4029 if (req->channels[i]->band == NL80211_BAND_6GHZ && in ath11k_mac_op_hw_scan()
4030 req->flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ && in ath11k_mac_op_hw_scan()
4031 !cfg80211_channel_is_psc(req->channels[i])) in ath11k_mac_op_hw_scan()
4032 arg->chan_list[i] |= in ath11k_mac_op_hw_scan()
4035 arg->chan_list[i] = req->channels[i]->center_freq; in ath11k_mac_op_hw_scan()
4040 if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { in ath11k_mac_op_hw_scan()
4041 arg->scan_f_add_spoofed_mac_in_probe = 1; in ath11k_mac_op_hw_scan()
4042 ether_addr_copy(arg->mac_addr.addr, req->mac_addr); in ath11k_mac_op_hw_scan()
4043 ether_addr_copy(arg->mac_mask.addr, req->mac_addr_mask); in ath11k_mac_op_hw_scan()
4047 if (req->duration) { in ath11k_mac_op_hw_scan()
4048 arg->dwell_time_active = req->duration; in ath11k_mac_op_hw_scan()
4049 arg->dwell_time_active_2g = req->duration; in ath11k_mac_op_hw_scan()
4050 arg->dwell_time_active_6g = req->duration; in ath11k_mac_op_hw_scan()
4051 arg->dwell_time_passive = req->duration; in ath11k_mac_op_hw_scan()
4052 arg->dwell_time_passive_6g = req->duration; in ath11k_mac_op_hw_scan()
4053 arg->burst_duration = req->duration; in ath11k_mac_op_hw_scan()
4055 scan_timeout = min_t(u32, arg->max_rest_time * in ath11k_mac_op_hw_scan()
4056 (arg->num_chan - 1) + (req->duration + in ath11k_mac_op_hw_scan()
4058 arg->num_chan, arg->max_scan_time); in ath11k_mac_op_hw_scan()
4060 scan_timeout = arg->max_scan_time; in ath11k_mac_op_hw_scan()
4068 ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret); in ath11k_mac_op_hw_scan()
4069 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
4070 ar->scan.state = ATH11K_SCAN_IDLE; in ath11k_mac_op_hw_scan()
4071 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
4074 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath11k_mac_op_hw_scan()
4079 kfree(arg->chan_list); in ath11k_mac_op_hw_scan()
4080 kfree(arg->extraie.ptr); in ath11k_mac_op_hw_scan()
4084 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_hw_scan()
4086 if (ar->state_11d == ATH11K_11D_PREPARING) in ath11k_mac_op_hw_scan()
4087 ath11k_mac_11d_scan_start(ar, arvif->vdev_id); in ath11k_mac_op_hw_scan()
4095 struct ath11k *ar = hw->priv; in ath11k_mac_op_cancel_hw_scan()
4097 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_cancel_hw_scan()
4099 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_cancel_hw_scan()
4101 cancel_delayed_work_sync(&ar->scan.timeout); in ath11k_mac_op_cancel_hw_scan()
4110 struct ath11k *ar = arvif->ar; in ath11k_install_key()
4112 .vdev_id = arvif->vdev_id, in ath11k_install_key()
4113 .key_idx = key->keyidx, in ath11k_install_key()
4114 .key_len = key->keylen, in ath11k_install_key()
4115 .key_data = key->key, in ath11k_install_key()
4120 lockdep_assert_held(&arvif->ar->conf_mutex); in ath11k_install_key()
4122 reinit_completion(&ar->install_key_done); in ath11k_install_key()
4124 if (test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ar->ab->dev_flags)) in ath11k_install_key()
4133 switch (key->cipher) { in ath11k_install_key()
4136 /* TODO: Re-check if flag is valid */ in ath11k_install_key()
4137 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; in ath11k_install_key()
4152 ath11k_warn(ar->ab, "cipher %d is not supported\n", key->cipher); in ath11k_install_key()
4153 return -EOPNOTSUPP; in ath11k_install_key()
4156 if (test_bit(ATH11K_FLAG_RAW_MODE, &ar->ab->dev_flags)) in ath11k_install_key()
4157 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV | in ath11k_install_key()
4161 ret = ath11k_wmi_vdev_install_key(arvif->ar, &arg); in ath11k_install_key()
4166 if (!wait_for_completion_timeout(&ar->install_key_done, 1 * HZ)) in ath11k_install_key()
4167 return -ETIMEDOUT; in ath11k_install_key()
4169 return ar->install_key_status ? -EINVAL : 0; in ath11k_install_key()
4175 struct ath11k *ar = arvif->ar; in ath11k_clear_peer_keys()
4176 struct ath11k_base *ab = ar->ab; in ath11k_clear_peer_keys()
4183 lockdep_assert_held(&ar->conf_mutex); in ath11k_clear_peer_keys()
4185 spin_lock_bh(&ab->base_lock); in ath11k_clear_peer_keys()
4186 peer = ath11k_peer_find(ab, arvif->vdev_id, addr); in ath11k_clear_peer_keys()
4187 spin_unlock_bh(&ab->base_lock); in ath11k_clear_peer_keys()
4190 return -ENOENT; in ath11k_clear_peer_keys()
4192 for (i = 0; i < ARRAY_SIZE(peer->keys); i++) { in ath11k_clear_peer_keys()
4193 if (!peer->keys[i]) in ath11k_clear_peer_keys()
4197 ret = ath11k_install_key(arvif, peer->keys[i], in ath11k_clear_peer_keys()
4206 spin_lock_bh(&ab->base_lock); in ath11k_clear_peer_keys()
4207 peer->keys[i] = NULL; in ath11k_clear_peer_keys()
4208 spin_unlock_bh(&ab->base_lock); in ath11k_clear_peer_keys()
4218 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_key()
4219 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_set_key()
4227 /* BIP needs to be done in software */ in ath11k_mac_op_set_key()
4228 if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || in ath11k_mac_op_set_key()
4229 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || in ath11k_mac_op_set_key()
4230 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 || in ath11k_mac_op_set_key()
4231 key->cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256) in ath11k_mac_op_set_key()
4234 if (test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ar->ab->dev_flags)) in ath11k_mac_op_set_key()
4237 if (key->keyidx > WMI_MAX_KEY_INDEX) in ath11k_mac_op_set_key()
4238 return -ENOSPC; in ath11k_mac_op_set_key()
4240 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_key()
4243 peer_addr = sta->addr; in ath11k_mac_op_set_key()
4244 else if (arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath11k_mac_op_set_key()
4245 peer_addr = vif->bss_conf.bssid; in ath11k_mac_op_set_key()
4247 peer_addr = vif->addr; in ath11k_mac_op_set_key()
4249 key->hw_key_idx = key->keyidx; in ath11k_mac_op_set_key()
4251 /* the peer should not disappear in mid-way (unless FW goes awry) since in ath11k_mac_op_set_key()
4254 spin_lock_bh(&ab->base_lock); in ath11k_mac_op_set_key()
4255 peer = ath11k_peer_find(ab, arvif->vdev_id, peer_addr); in ath11k_mac_op_set_key()
4258 * ensure all frags in the new frag list belong to the same key. in ath11k_mac_op_set_key()
4262 spin_unlock_bh(&ab->base_lock); in ath11k_mac_op_set_key()
4266 ath11k_warn(ab, "cannot install key for non-existent peer %pM\n", in ath11k_mac_op_set_key()
4268 ret = -EOPNOTSUPP; in ath11k_mac_op_set_key()
4278 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath11k_mac_op_set_key()
4295 spin_lock_bh(&ab->base_lock); in ath11k_mac_op_set_key()
4296 peer = ath11k_peer_find(ab, arvif->vdev_id, peer_addr); in ath11k_mac_op_set_key()
4298 peer->keys[key->keyidx] = key; in ath11k_mac_op_set_key()
4299 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { in ath11k_mac_op_set_key()
4300 peer->ucast_keyidx = key->keyidx; in ath11k_mac_op_set_key()
4301 peer->sec_type = ath11k_dp_tx_get_encrypt_type(key->cipher); in ath11k_mac_op_set_key()
4303 peer->mcast_keyidx = key->keyidx; in ath11k_mac_op_set_key()
4304 peer->sec_type_grp = ath11k_dp_tx_get_encrypt_type(key->cipher); in ath11k_mac_op_set_key()
4307 peer->keys[key->keyidx] = NULL; in ath11k_mac_op_set_key()
4308 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath11k_mac_op_set_key()
4309 peer->ucast_keyidx = 0; in ath11k_mac_op_set_key()
4311 peer->mcast_keyidx = 0; in ath11k_mac_op_set_key()
4317 arsta = (struct ath11k_sta *)sta->drv_priv; in ath11k_mac_op_set_key()
4319 switch (key->cipher) { in ath11k_mac_op_set_key()
4326 arsta->pn_type = HAL_PN_TYPE_WPA; in ath11k_mac_op_set_key()
4328 arsta->pn_type = HAL_PN_TYPE_NONE; in ath11k_mac_op_set_key()
4331 arsta->pn_type = HAL_PN_TYPE_NONE; in ath11k_mac_op_set_key()
4336 spin_unlock_bh(&ab->base_lock); in ath11k_mac_op_set_key()
4339 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_key()
4345 enum nl80211_band band, in ath11k_mac_bitrate_mask_num_ht_rates() argument
4351 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) in ath11k_mac_bitrate_mask_num_ht_rates()
4352 num_rates += hweight8(mask->control[band].ht_mcs[i]); in ath11k_mac_bitrate_mask_num_ht_rates()
4359 enum nl80211_band band, in ath11k_mac_bitrate_mask_num_vht_rates() argument
4365 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) in ath11k_mac_bitrate_mask_num_vht_rates()
4366 num_rates += hweight16(mask->control[band].vht_mcs[i]); in ath11k_mac_bitrate_mask_num_vht_rates()
4373 enum nl80211_band band, in ath11k_mac_bitrate_mask_num_he_rates() argument
4379 for (i = 0; i < ARRAY_SIZE(mask->control[band].he_mcs); i++) in ath11k_mac_bitrate_mask_num_he_rates()
4380 num_rates += hweight16(mask->control[band].he_mcs[i]); in ath11k_mac_bitrate_mask_num_he_rates()
4389 enum nl80211_band band) in ath11k_mac_set_peer_vht_fixed_rate() argument
4391 struct ath11k *ar = arvif->ar; in ath11k_mac_set_peer_vht_fixed_rate()
4396 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_set_peer_vht_fixed_rate()
4400 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath11k_mac_set_peer_vht_fixed_rate()
4401 if (hweight16(mask->control[band].vht_mcs[i]) == 1) { in ath11k_mac_set_peer_vht_fixed_rate()
4403 vht_rate = ffs(mask->control[band].vht_mcs[i]) - 1; in ath11k_mac_set_peer_vht_fixed_rate()
4408 ath11k_warn(ar->ab, "No single VHT Fixed rate found to set for %pM", in ath11k_mac_set_peer_vht_fixed_rate()
4409 sta->addr); in ath11k_mac_set_peer_vht_fixed_rate()
4410 return -EINVAL; in ath11k_mac_set_peer_vht_fixed_rate()
4414 if (nss > sta->deflink.rx_nss) in ath11k_mac_set_peer_vht_fixed_rate()
4415 return -EINVAL; in ath11k_mac_set_peer_vht_fixed_rate()
4417 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_set_peer_vht_fixed_rate()
4419 sta->addr); in ath11k_mac_set_peer_vht_fixed_rate()
4421 rate_code = ATH11K_HW_RATE_CODE(vht_rate, nss - 1, in ath11k_mac_set_peer_vht_fixed_rate()
4423 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_set_peer_vht_fixed_rate()
4424 arvif->vdev_id, in ath11k_mac_set_peer_vht_fixed_rate()
4428 ath11k_warn(ar->ab, in ath11k_mac_set_peer_vht_fixed_rate()
4430 sta->addr, rate_code, ret); in ath11k_mac_set_peer_vht_fixed_rate()
4439 enum nl80211_band band) in ath11k_mac_set_peer_he_fixed_rate() argument
4441 struct ath11k *ar = arvif->ar; in ath11k_mac_set_peer_he_fixed_rate()
4446 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_set_peer_he_fixed_rate()
4450 for (i = 0; i < ARRAY_SIZE(mask->control[band].he_mcs); i++) { in ath11k_mac_set_peer_he_fixed_rate()
4451 if (hweight16(mask->control[band].he_mcs[i]) == 1) { in ath11k_mac_set_peer_he_fixed_rate()
4453 he_rate = ffs(mask->control[band].he_mcs[i]) - 1; in ath11k_mac_set_peer_he_fixed_rate()
4458 ath11k_warn(ar->ab, "No single he fixed rate found to set for %pM", in ath11k_mac_set_peer_he_fixed_rate()
4459 sta->addr); in ath11k_mac_set_peer_he_fixed_rate()
4460 return -EINVAL; in ath11k_mac_set_peer_he_fixed_rate()
4464 if (nss > sta->deflink.rx_nss) in ath11k_mac_set_peer_he_fixed_rate()
4465 return -EINVAL; in ath11k_mac_set_peer_he_fixed_rate()
4467 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_set_peer_he_fixed_rate()
4469 sta->addr); in ath11k_mac_set_peer_he_fixed_rate()
4471 rate_code = ATH11K_HW_RATE_CODE(he_rate, nss - 1, in ath11k_mac_set_peer_he_fixed_rate()
4474 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_set_peer_he_fixed_rate()
4475 arvif->vdev_id, in ath11k_mac_set_peer_he_fixed_rate()
4479 ath11k_warn(ar->ab, in ath11k_mac_set_peer_he_fixed_rate()
4481 sta->addr, rate_code, ret); in ath11k_mac_set_peer_he_fixed_rate()
4490 enum nl80211_band band) in ath11k_mac_set_peer_ht_fixed_rate() argument
4492 struct ath11k *ar = arvif->ar; in ath11k_mac_set_peer_ht_fixed_rate()
4497 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_set_peer_ht_fixed_rate()
4499 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath11k_mac_set_peer_ht_fixed_rate()
4500 if (hweight8(mask->control[band].ht_mcs[i]) == 1) { in ath11k_mac_set_peer_ht_fixed_rate()
4502 ht_rate = ffs(mask->control[band].ht_mcs[i]) - 1; in ath11k_mac_set_peer_ht_fixed_rate()
4507 ath11k_warn(ar->ab, "No single HT Fixed rate found to set for %pM", in ath11k_mac_set_peer_ht_fixed_rate()
4508 sta->addr); in ath11k_mac_set_peer_ht_fixed_rate()
4509 return -EINVAL; in ath11k_mac_set_peer_ht_fixed_rate()
4513 if (nss > sta->deflink.rx_nss) in ath11k_mac_set_peer_ht_fixed_rate()
4514 return -EINVAL; in ath11k_mac_set_peer_ht_fixed_rate()
4516 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_set_peer_ht_fixed_rate()
4518 sta->addr); in ath11k_mac_set_peer_ht_fixed_rate()
4520 rate_code = ATH11K_HW_RATE_CODE(ht_rate, nss - 1, in ath11k_mac_set_peer_ht_fixed_rate()
4522 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_set_peer_ht_fixed_rate()
4523 arvif->vdev_id, in ath11k_mac_set_peer_ht_fixed_rate()
4527 ath11k_warn(ar->ab, in ath11k_mac_set_peer_ht_fixed_rate()
4529 sta->addr, rate_code, ret); in ath11k_mac_set_peer_ht_fixed_rate()
4543 enum nl80211_band band; in ath11k_station_assoc() local
4547 lockdep_assert_held(&ar->conf_mutex); in ath11k_station_assoc()
4550 return -EPERM; in ath11k_station_assoc()
4552 band = def.chan->band; in ath11k_station_assoc()
4553 mask = &arvif->bitrate_mask; in ath11k_station_assoc()
4560 ath11k_warn(ar->ab, "failed to run peer assoc for STA %pM vdev %i: %d\n", in ath11k_station_assoc()
4561 sta->addr, arvif->vdev_id, ret); in ath11k_station_assoc()
4565 if (!wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) { in ath11k_station_assoc()
4566 ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n", in ath11k_station_assoc()
4567 sta->addr, arvif->vdev_id); in ath11k_station_assoc()
4568 return -ETIMEDOUT; in ath11k_station_assoc()
4571 num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, mask); in ath11k_station_assoc()
4572 num_he_rates = ath11k_mac_bitrate_mask_num_he_rates(ar, band, mask); in ath11k_station_assoc()
4573 num_ht_rates = ath11k_mac_bitrate_mask_num_ht_rates(ar, band, mask); in ath11k_station_assoc()
4580 if (sta->deflink.vht_cap.vht_supported && num_vht_rates == 1) { in ath11k_station_assoc()
4582 band); in ath11k_station_assoc()
4585 } else if (sta->deflink.he_cap.has_he && num_he_rates == 1) { in ath11k_station_assoc()
4587 band); in ath11k_station_assoc()
4590 } else if (sta->deflink.ht_cap.ht_supported && num_ht_rates == 1) { in ath11k_station_assoc()
4592 band); in ath11k_station_assoc()
4597 /* Re-assoc is run only to update supported rates for given station. It in ath11k_station_assoc()
4603 ret = ath11k_setup_peer_smps(ar, arvif, sta->addr, in ath11k_station_assoc()
4604 &sta->deflink.ht_cap, in ath11k_station_assoc()
4605 le16_to_cpu(sta->deflink.he_6ghz_capa.capa)); in ath11k_station_assoc()
4607 ath11k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n", in ath11k_station_assoc()
4608 arvif->vdev_id, ret); in ath11k_station_assoc()
4612 if (!sta->wme) { in ath11k_station_assoc()
4613 arvif->num_legacy_stations++; in ath11k_station_assoc()
4619 if (sta->wme && sta->uapsd_queues) { in ath11k_station_assoc()
4622 ath11k_warn(ar->ab, "failed to set qos params for STA %pM for vdev %i: %d\n", in ath11k_station_assoc()
4623 sta->addr, arvif->vdev_id, ret); in ath11k_station_assoc()
4635 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_station_disassoc()
4638 lockdep_assert_held(&ar->conf_mutex); in ath11k_station_disassoc()
4640 if (!sta->wme) { in ath11k_station_disassoc()
4641 arvif->num_legacy_stations--; in ath11k_station_disassoc()
4647 ret = ath11k_clear_peer_keys(arvif, sta->addr); in ath11k_station_disassoc()
4649 ath11k_warn(ar->ab, "failed to clear all peer keys for vdev %i: %d\n", in ath11k_station_disassoc()
4650 arvif->vdev_id, ret); in ath11k_station_disassoc()
4663 enum nl80211_band band; in ath11k_sta_rc_update_wk() local
4675 arvif = arsta->arvif; in ath11k_sta_rc_update_wk()
4676 ar = arvif->ar; in ath11k_sta_rc_update_wk()
4678 if (WARN_ON(ath11k_mac_vif_chan(arvif->vif, &def))) in ath11k_sta_rc_update_wk()
4681 band = def.chan->band; in ath11k_sta_rc_update_wk()
4682 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath11k_sta_rc_update_wk()
4683 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath11k_sta_rc_update_wk()
4684 he_mcs_mask = arvif->bitrate_mask.control[band].he_mcs; in ath11k_sta_rc_update_wk()
4686 spin_lock_bh(&ar->data_lock); in ath11k_sta_rc_update_wk()
4688 changed = arsta->changed; in ath11k_sta_rc_update_wk()
4689 arsta->changed = 0; in ath11k_sta_rc_update_wk()
4691 bw = arsta->bw; in ath11k_sta_rc_update_wk()
4692 bw_prev = arsta->bw_prev; in ath11k_sta_rc_update_wk()
4693 nss = arsta->nss; in ath11k_sta_rc_update_wk()
4694 smps = arsta->smps; in ath11k_sta_rc_update_wk()
4696 spin_unlock_bh(&ar->data_lock); in ath11k_sta_rc_update_wk()
4698 mutex_lock(&ar->conf_mutex); in ath11k_sta_rc_update_wk()
4707 ath11k_peer_assoc_h_phymode(ar, arvif->vif, sta, &peer_arg); in ath11k_sta_rc_update_wk()
4710 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "update sta %pM peer bw %d phymode %d\n", in ath11k_sta_rc_update_wk()
4711 sta->addr, bw, peer_phymode); in ath11k_sta_rc_update_wk()
4714 /* BW is upgraded. In this case we send WMI_PEER_PHYMODE in ath11k_sta_rc_update_wk()
4717 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()
4718 sta->addr, bw, bw_prev); in ath11k_sta_rc_update_wk()
4720 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
4724 ath11k_warn(ar->ab, "failed to update STA %pM peer phymode %d: %d\n", in ath11k_sta_rc_update_wk()
4725 sta->addr, peer_phymode, err); in ath11k_sta_rc_update_wk()
4729 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
4733 ath11k_warn(ar->ab, "failed to update STA %pM peer bw %d: %d\n", in ath11k_sta_rc_update_wk()
4734 sta->addr, bw, err); in ath11k_sta_rc_update_wk()
4736 /* BW is downgraded. In this case we send WMI_PEER_CHWIDTH in ath11k_sta_rc_update_wk()
4739 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()
4740 sta->addr, bw, bw_prev); in ath11k_sta_rc_update_wk()
4742 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
4746 ath11k_warn(ar->ab, "failed to update STA %pM peer bw %d: %d\n", in ath11k_sta_rc_update_wk()
4747 sta->addr, bw, err); in ath11k_sta_rc_update_wk()
4751 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
4755 ath11k_warn(ar->ab, "failed to update STA %pM peer phymode %d: %d\n", in ath11k_sta_rc_update_wk()
4756 sta->addr, peer_phymode, err); in ath11k_sta_rc_update_wk()
4761 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "update sta %pM nss %d\n", in ath11k_sta_rc_update_wk()
4762 sta->addr, nss); in ath11k_sta_rc_update_wk()
4764 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
4767 ath11k_warn(ar->ab, "failed to update STA %pM nss %d: %d\n", in ath11k_sta_rc_update_wk()
4768 sta->addr, nss, err); in ath11k_sta_rc_update_wk()
4772 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "update sta %pM smps %d\n", in ath11k_sta_rc_update_wk()
4773 sta->addr, smps); in ath11k_sta_rc_update_wk()
4775 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
4778 ath11k_warn(ar->ab, "failed to update STA %pM smps %d: %d\n", in ath11k_sta_rc_update_wk()
4779 sta->addr, smps, err); in ath11k_sta_rc_update_wk()
4783 mask = &arvif->bitrate_mask; in ath11k_sta_rc_update_wk()
4784 num_ht_rates = ath11k_mac_bitrate_mask_num_ht_rates(ar, band, in ath11k_sta_rc_update_wk()
4786 num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, in ath11k_sta_rc_update_wk()
4788 num_he_rates = ath11k_mac_bitrate_mask_num_he_rates(ar, band, in ath11k_sta_rc_update_wk()
4791 /* Peer_assoc_prepare will reject vht rates in in ath11k_sta_rc_update_wk()
4792 * bitrate_mask if its not available in range format and in ath11k_sta_rc_update_wk()
4795 * But, Single rate in VHT mask can be set as per-peer in ath11k_sta_rc_update_wk()
4796 * fixed rate. But even if any HT rates are configured in in ath11k_sta_rc_update_wk()
4798 * when per-peer Fixed rate is set. in ath11k_sta_rc_update_wk()
4802 if (sta->deflink.vht_cap.vht_supported && num_vht_rates == 1) { in ath11k_sta_rc_update_wk()
4804 band); in ath11k_sta_rc_update_wk()
4805 } else if (sta->deflink.he_cap.has_he && num_he_rates == 1) { in ath11k_sta_rc_update_wk()
4807 band); in ath11k_sta_rc_update_wk()
4808 } else if (sta->deflink.ht_cap.ht_supported && num_ht_rates == 1) { in ath11k_sta_rc_update_wk()
4810 band); in ath11k_sta_rc_update_wk()
4812 /* If the peer is non-VHT/HE or no fixed VHT/HE rate in ath11k_sta_rc_update_wk()
4813 * is provided in the new bitrate mask we set the in ath11k_sta_rc_update_wk()
4818 err = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_sta_rc_update_wk()
4819 arvif->vdev_id, in ath11k_sta_rc_update_wk()
4823 ath11k_warn(ar->ab, in ath11k_sta_rc_update_wk()
4825 sta->addr, err); in ath11k_sta_rc_update_wk()
4827 ath11k_peer_assoc_prepare(ar, arvif->vif, sta, in ath11k_sta_rc_update_wk()
4833 ath11k_warn(ar->ab, "failed to run peer assoc for STA %pM vdev %i: %d\n", in ath11k_sta_rc_update_wk()
4834 sta->addr, arvif->vdev_id, err); in ath11k_sta_rc_update_wk()
4836 if (!wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) in ath11k_sta_rc_update_wk()
4837 ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n", in ath11k_sta_rc_update_wk()
4838 sta->addr, arvif->vdev_id); in ath11k_sta_rc_update_wk()
4843 mutex_unlock(&ar->conf_mutex); in ath11k_sta_rc_update_wk()
4856 arvif = arsta->arvif; in ath11k_sta_set_4addr_wk()
4857 ar = arvif->ar; in ath11k_sta_set_4addr_wk()
4859 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_sta_set_4addr_wk()
4860 "setting USE_4ADDR for peer %pM\n", sta->addr); in ath11k_sta_set_4addr_wk()
4862 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_sta_set_4addr_wk()
4863 arvif->vdev_id, in ath11k_sta_set_4addr_wk()
4867 ath11k_warn(ar->ab, "failed to set peer %pM 4addr capability: %d\n", in ath11k_sta_set_4addr_wk()
4868 sta->addr, ret); in ath11k_sta_set_4addr_wk()
4874 struct ath11k *ar = arvif->ar; in ath11k_mac_inc_num_stations()
4876 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_inc_num_stations()
4878 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath11k_mac_inc_num_stations()
4881 if (ar->num_stations >= ar->max_num_stations) in ath11k_mac_inc_num_stations()
4882 return -ENOBUFS; in ath11k_mac_inc_num_stations()
4884 ar->num_stations++; in ath11k_mac_inc_num_stations()
4892 struct ath11k *ar = arvif->ar; in ath11k_mac_dec_num_stations()
4894 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_dec_num_stations()
4896 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath11k_mac_dec_num_stations()
4899 ar->num_stations--; in ath11k_mac_dec_num_stations()
4906 struct ath11k_base *ab = ar->ab; in ath11k_mac_station_add()
4908 struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; in ath11k_mac_station_add()
4912 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_station_add()
4917 ar->max_num_stations); in ath11k_mac_station_add()
4921 arsta->rx_stats = kzalloc(sizeof(*arsta->rx_stats), GFP_KERNEL); in ath11k_mac_station_add()
4922 if (!arsta->rx_stats) { in ath11k_mac_station_add()
4923 ret = -ENOMEM; in ath11k_mac_station_add()
4927 peer_param.vdev_id = arvif->vdev_id; in ath11k_mac_station_add()
4928 peer_param.peer_addr = sta->addr; in ath11k_mac_station_add()
4934 sta->addr, arvif->vdev_id); in ath11k_mac_station_add()
4939 sta->addr, arvif->vdev_id); in ath11k_mac_station_add()
4942 arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), GFP_KERNEL); in ath11k_mac_station_add()
4943 if (!arsta->tx_stats) { in ath11k_mac_station_add()
4944 ret = -ENOMEM; in ath11k_mac_station_add()
4951 "setting USE_4ADDR for mesh STA %pM\n", sta->addr); in ath11k_mac_station_add()
4952 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_station_add()
4953 arvif->vdev_id, in ath11k_mac_station_add()
4957 sta->addr, ret); in ath11k_mac_station_add()
4962 ret = ath11k_dp_peer_setup(ar, arvif->vdev_id, sta->addr); in ath11k_mac_station_add()
4965 sta->addr, arvif->vdev_id, ret); in ath11k_mac_station_add()
4969 if (ab->hw_params.vdev_start_delay && in ath11k_mac_station_add()
4970 !arvif->is_started && in ath11k_mac_station_add()
4971 arvif->vdev_type != WMI_VDEV_TYPE_AP) { in ath11k_mac_station_add()
4972 ret = ath11k_start_vdev_delay(ar->hw, vif); in ath11k_mac_station_add()
4979 ewma_avg_rssi_init(&arsta->avg_rssi); in ath11k_mac_station_add()
4983 kfree(arsta->tx_stats); in ath11k_mac_station_add()
4984 arsta->tx_stats = NULL; in ath11k_mac_station_add()
4986 ath11k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath11k_mac_station_add()
4988 kfree(arsta->rx_stats); in ath11k_mac_station_add()
4989 arsta->rx_stats = NULL; in ath11k_mac_station_add()
5001 switch (sta->deflink.bandwidth) { in ath11k_mac_ieee80211_sta_bw_to_wmi()
5015 ath11k_warn(ar->ab, "Invalid bandwidth %d for %pM\n", in ath11k_mac_ieee80211_sta_bw_to_wmi()
5016 sta->deflink.bandwidth, sta->addr); in ath11k_mac_ieee80211_sta_bw_to_wmi()
5030 struct ath11k *ar = hw->priv; in ath11k_mac_op_sta_state()
5032 struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; in ath11k_mac_op_sta_state()
5039 cancel_work_sync(&arsta->update_wk); in ath11k_mac_op_sta_state()
5040 cancel_work_sync(&arsta->set_4addr_wk); in ath11k_mac_op_sta_state()
5043 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_sta_state()
5048 arsta->arvif = arvif; in ath11k_mac_op_sta_state()
5049 arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED; in ath11k_mac_op_sta_state()
5050 INIT_WORK(&arsta->update_wk, ath11k_sta_rc_update_wk); in ath11k_mac_op_sta_state()
5051 INIT_WORK(&arsta->set_4addr_wk, ath11k_sta_set_4addr_wk); in ath11k_mac_op_sta_state()
5055 ath11k_warn(ar->ab, "Failed to add station: %pM for VDEV: %d\n", in ath11k_mac_op_sta_state()
5056 sta->addr, arvif->vdev_id); in ath11k_mac_op_sta_state()
5059 bool skip_peer_delete = ar->ab->hw_params.vdev_start_delay && in ath11k_mac_op_sta_state()
5060 vif->type == NL80211_IFTYPE_STATION; in ath11k_mac_op_sta_state()
5062 ath11k_dp_peer_cleanup(ar, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_state()
5065 ret = ath11k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_state()
5067 ath11k_warn(ar->ab, in ath11k_mac_op_sta_state()
5069 sta->addr, arvif->vdev_id); in ath11k_mac_op_sta_state()
5071 ath11k_dbg(ar->ab, in ath11k_mac_op_sta_state()
5074 sta->addr, arvif->vdev_id); in ath11k_mac_op_sta_state()
5078 mutex_lock(&ar->ab->tbl_mtx_lock); in ath11k_mac_op_sta_state()
5079 spin_lock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
5080 peer = ath11k_peer_find(ar->ab, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_state()
5082 peer->sta = NULL; in ath11k_mac_op_sta_state()
5083 } else if (peer && peer->sta == sta) { in ath11k_mac_op_sta_state()
5084 ath11k_warn(ar->ab, "Found peer entry %pM n vdev %i after it was supposedly removed\n", in ath11k_mac_op_sta_state()
5085 vif->addr, arvif->vdev_id); in ath11k_mac_op_sta_state()
5086 ath11k_peer_rhash_delete(ar->ab, peer); in ath11k_mac_op_sta_state()
5087 peer->sta = NULL; in ath11k_mac_op_sta_state()
5088 list_del(&peer->list); in ath11k_mac_op_sta_state()
5090 ar->num_peers--; in ath11k_mac_op_sta_state()
5092 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
5093 mutex_unlock(&ar->ab->tbl_mtx_lock); in ath11k_mac_op_sta_state()
5095 kfree(arsta->tx_stats); in ath11k_mac_op_sta_state()
5096 arsta->tx_stats = NULL; in ath11k_mac_op_sta_state()
5098 kfree(arsta->rx_stats); in ath11k_mac_op_sta_state()
5099 arsta->rx_stats = NULL; in ath11k_mac_op_sta_state()
5102 (vif->type == NL80211_IFTYPE_AP || in ath11k_mac_op_sta_state()
5103 vif->type == NL80211_IFTYPE_MESH_POINT || in ath11k_mac_op_sta_state()
5104 vif->type == NL80211_IFTYPE_ADHOC)) { in ath11k_mac_op_sta_state()
5107 ath11k_warn(ar->ab, "Failed to associate station: %pM\n", in ath11k_mac_op_sta_state()
5108 sta->addr); in ath11k_mac_op_sta_state()
5110 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_sta_state()
5112 arsta->bw = ath11k_mac_ieee80211_sta_bw_to_wmi(ar, sta); in ath11k_mac_op_sta_state()
5113 arsta->bw_prev = arsta->bw; in ath11k_mac_op_sta_state()
5114 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_sta_state()
5117 spin_lock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
5119 peer = ath11k_peer_find(ar->ab, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_state()
5121 peer->is_authorized = true; in ath11k_mac_op_sta_state()
5123 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
5125 if (vif->type == NL80211_IFTYPE_STATION && arvif->is_up) { in ath11k_mac_op_sta_state()
5126 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_op_sta_state()
5127 arvif->vdev_id, in ath11k_mac_op_sta_state()
5131 ath11k_warn(ar->ab, "Unable to authorize peer %pM vdev %d: %d\n", in ath11k_mac_op_sta_state()
5132 sta->addr, arvif->vdev_id, ret); in ath11k_mac_op_sta_state()
5136 spin_lock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
5138 peer = ath11k_peer_find(ar->ab, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_state()
5140 peer->is_authorized = false; in ath11k_mac_op_sta_state()
5142 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
5145 (vif->type == NL80211_IFTYPE_AP || in ath11k_mac_op_sta_state()
5146 vif->type == NL80211_IFTYPE_MESH_POINT || in ath11k_mac_op_sta_state()
5147 vif->type == NL80211_IFTYPE_ADHOC)) { in ath11k_mac_op_sta_state()
5150 ath11k_warn(ar->ab, "Failed to disassociate station: %pM\n", in ath11k_mac_op_sta_state()
5151 sta->addr); in ath11k_mac_op_sta_state()
5154 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_sta_state()
5162 struct ath11k *ar = hw->priv; in ath11k_mac_op_sta_set_txpwr()
5163 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_op_sta_set_txpwr()
5167 if (sta->deflink.txpwr.type == NL80211_TX_POWER_AUTOMATIC) { in ath11k_mac_op_sta_set_txpwr()
5170 txpwr = sta->deflink.txpwr.power; in ath11k_mac_op_sta_set_txpwr()
5172 return -EINVAL; in ath11k_mac_op_sta_set_txpwr()
5176 return -EINVAL; in ath11k_mac_op_sta_set_txpwr()
5178 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_sta_set_txpwr()
5180 ret = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_mac_op_sta_set_txpwr()
5183 ath11k_warn(ar->ab, "failed to set tx power for station ret: %d\n", in ath11k_mac_op_sta_set_txpwr()
5189 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_sta_set_txpwr()
5197 struct ath11k *ar = hw->priv; in ath11k_mac_op_sta_set_4addr()
5198 struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; in ath11k_mac_op_sta_set_4addr()
5200 if (enabled && !arsta->use_4addr_set) { in ath11k_mac_op_sta_set_4addr()
5201 ieee80211_queue_work(ar->hw, &arsta->set_4addr_wk); in ath11k_mac_op_sta_set_4addr()
5202 arsta->use_4addr_set = true; in ath11k_mac_op_sta_set_4addr()
5211 struct ath11k *ar = hw->priv; in ath11k_mac_op_sta_rc_update()
5212 struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; in ath11k_mac_op_sta_rc_update()
5213 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_op_sta_rc_update()
5217 spin_lock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_rc_update()
5219 peer = ath11k_peer_find(ar->ab, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_rc_update()
5221 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_rc_update()
5222 ath11k_warn(ar->ab, "mac sta rc update failed to find peer %pM on vdev %i\n", in ath11k_mac_op_sta_rc_update()
5223 sta->addr, arvif->vdev_id); in ath11k_mac_op_sta_rc_update()
5227 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_rc_update()
5229 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_sta_rc_update()
5231 sta->addr, changed, sta->deflink.bandwidth, in ath11k_mac_op_sta_rc_update()
5232 sta->deflink.rx_nss, in ath11k_mac_op_sta_rc_update()
5233 sta->deflink.smps_mode); in ath11k_mac_op_sta_rc_update()
5235 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_sta_rc_update()
5239 arsta->bw_prev = arsta->bw; in ath11k_mac_op_sta_rc_update()
5240 arsta->bw = bw; in ath11k_mac_op_sta_rc_update()
5244 arsta->nss = sta->deflink.rx_nss; in ath11k_mac_op_sta_rc_update()
5249 switch (sta->deflink.smps_mode) { in ath11k_mac_op_sta_rc_update()
5261 ath11k_warn(ar->ab, "Invalid smps %d in sta rc update for %pM\n", in ath11k_mac_op_sta_rc_update()
5262 sta->deflink.smps_mode, sta->addr); in ath11k_mac_op_sta_rc_update()
5267 arsta->smps = smps; in ath11k_mac_op_sta_rc_update()
5270 arsta->changed |= changed; in ath11k_mac_op_sta_rc_update()
5272 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_sta_rc_update()
5274 ieee80211_queue_work(hw, &arsta->update_wk); in ath11k_mac_op_sta_rc_update()
5284 if (arvif->vdev_type != WMI_VDEV_TYPE_STA) in ath11k_conf_tx_uapsd()
5307 arvif->u.sta.uapsd |= value; in ath11k_conf_tx_uapsd()
5309 arvif->u.sta.uapsd &= ~value; in ath11k_conf_tx_uapsd()
5311 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_conf_tx_uapsd()
5313 arvif->u.sta.uapsd); in ath11k_conf_tx_uapsd()
5315 ath11k_warn(ar->ab, "could not set uapsd params %d\n", ret); in ath11k_conf_tx_uapsd()
5319 if (arvif->u.sta.uapsd) in ath11k_conf_tx_uapsd()
5324 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_conf_tx_uapsd()
5328 ath11k_warn(ar->ab, "could not set rx wake param %d\n", ret); in ath11k_conf_tx_uapsd()
5339 struct ath11k *ar = hw->priv; in ath11k_mac_op_conf_tx()
5340 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_op_conf_tx()
5344 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_conf_tx()
5348 p = &arvif->wmm_params.ac_vo; in ath11k_mac_op_conf_tx()
5351 p = &arvif->wmm_params.ac_vi; in ath11k_mac_op_conf_tx()
5354 p = &arvif->wmm_params.ac_be; in ath11k_mac_op_conf_tx()
5357 p = &arvif->wmm_params.ac_bk; in ath11k_mac_op_conf_tx()
5362 ret = -EINVAL; in ath11k_mac_op_conf_tx()
5366 p->cwmin = params->cw_min; in ath11k_mac_op_conf_tx()
5367 p->cwmax = params->cw_max; in ath11k_mac_op_conf_tx()
5368 p->aifs = params->aifs; in ath11k_mac_op_conf_tx()
5369 p->txop = params->txop; in ath11k_mac_op_conf_tx()
5371 ret = ath11k_wmi_send_wmm_update_cmd_tlv(ar, arvif->vdev_id, in ath11k_mac_op_conf_tx()
5372 &arvif->wmm_params); in ath11k_mac_op_conf_tx()
5374 ath11k_warn(ar->ab, "failed to set wmm params: %d\n", ret); in ath11k_mac_op_conf_tx()
5378 ret = ath11k_conf_tx_uapsd(ar, vif, ac, params->uapsd); in ath11k_mac_op_conf_tx()
5381 ath11k_warn(ar->ab, "failed to set sta uapsd: %d\n", ret); in ath11k_mac_op_conf_tx()
5384 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_conf_tx()
5393 u32 ar_vht_cap = ar->pdev->cap.vht_cap; in ath11k_create_ht_cap()
5444 for (i = 0; i < ar->num_rx_chains; i++) { in ath11k_create_ht_cap()
5457 struct ath11k *ar = arvif->ar; in ath11k_mac_set_txbf_conf()
5460 u32 vht_cap = ar->pdev->cap.vht_cap; in ath11k_mac_set_txbf_conf()
5466 if (nsts > (ar->num_rx_chains - 1)) in ath11k_mac_set_txbf_conf()
5467 nsts = ar->num_rx_chains - 1; in ath11k_mac_set_txbf_conf()
5475 if (sound_dim > (ar->num_tx_chains - 1)) in ath11k_mac_set_txbf_conf()
5476 sound_dim = ar->num_tx_chains - 1; in ath11k_mac_set_txbf_conf()
5487 arvif->vdev_type == WMI_VDEV_TYPE_AP) in ath11k_mac_set_txbf_conf()
5491 /* TODO: SUBFEE not validated in HK, disable here until validated? */ in ath11k_mac_set_txbf_conf()
5497 arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath11k_mac_set_txbf_conf()
5501 return ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_txbf_conf()
5513 if (ar->num_tx_chains < 2) { in ath11k_set_vht_txbf_cap()
5518 if (ar->num_rx_chains < 2) { in ath11k_set_vht_txbf_cap()
5541 if (sound_dim > (ar->num_tx_chains - 1)) in ath11k_set_vht_txbf_cap()
5542 sound_dim = ar->num_tx_chains - 1; in ath11k_set_vht_txbf_cap()
5551 if (nsts > (ar->num_rx_chains - 1)) in ath11k_set_vht_txbf_cap()
5552 nsts = ar->num_rx_chains - 1; in ath11k_set_vht_txbf_cap()
5569 vht_cap.cap = ar->pdev->cap.vht_cap; in ath11k_create_vht_cap()
5571 if (ar->pdev->cap.nss_ratio_enabled) in ath11k_create_vht_cap()
5580 if (i < ar->num_tx_chains && rate_cap_tx_chainmask & BIT(i)) in ath11k_create_vht_cap()
5585 if (i < ar->num_rx_chains && rate_cap_rx_chainmask & BIT(i)) in ath11k_create_vht_cap()
5604 struct ieee80211_supported_band *band; in ath11k_mac_setup_ht_vht_cap() local
5609 rate_cap_tx_chainmask = ar->cfg_tx_chainmask >> cap->tx_chain_mask_shift; in ath11k_mac_setup_ht_vht_cap()
5610 rate_cap_rx_chainmask = ar->cfg_rx_chainmask >> cap->rx_chain_mask_shift; in ath11k_mac_setup_ht_vht_cap()
5612 if (cap->supported_bands & WMI_HOST_WLAN_2G_CAP) { in ath11k_mac_setup_ht_vht_cap()
5613 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath11k_mac_setup_ht_vht_cap()
5614 ht_cap = cap->band[NL80211_BAND_2GHZ].ht_cap_info; in ath11k_mac_setup_ht_vht_cap()
5617 band->ht_cap = ath11k_create_ht_cap(ar, ht_cap, in ath11k_mac_setup_ht_vht_cap()
5621 if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP && in ath11k_mac_setup_ht_vht_cap()
5622 (ar->ab->hw_params.single_pdev_only || in ath11k_mac_setup_ht_vht_cap()
5623 !ar->supports_6ghz)) { in ath11k_mac_setup_ht_vht_cap()
5624 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath11k_mac_setup_ht_vht_cap()
5625 ht_cap = cap->band[NL80211_BAND_5GHZ].ht_cap_info; in ath11k_mac_setup_ht_vht_cap()
5628 band->ht_cap = ath11k_create_ht_cap(ar, ht_cap, in ath11k_mac_setup_ht_vht_cap()
5630 band->vht_cap = ath11k_create_vht_cap(ar, rate_cap_tx_chainmask, in ath11k_mac_setup_ht_vht_cap()
5638 * chainmask table which is advertised in extented_service_ready event in ath11k_check_chain_mask()
5650 he_ppet[0] = fw_ppet->numss_m1 & IEEE80211_PPE_THRES_NSS_MASK; in ath11k_gen_ppe_thresh()
5651 he_ppet[0] |= (fw_ppet->ru_bit_mask << in ath11k_gen_ppe_thresh()
5654 for (nss = 0; nss <= fw_ppet->numss_m1; nss++) { in ath11k_gen_ppe_thresh()
5659 if ((fw_ppet->ru_bit_mask & BIT(ru)) == 0) in ath11k_gen_ppe_thresh()
5661 val = (fw_ppet->ppet16_ppet8_ru3_ru0[nss] >> (ru * 6)) & in ath11k_gen_ppe_thresh()
5664 for (i = 5; i >= 0; i--) { in ath11k_gen_ppe_thresh()
5680 he_cap_elem->mac_cap_info[0] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5685 he_cap_elem->mac_cap_info[2] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5690 he_cap_elem->mac_cap_info[3] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5694 he_cap_elem->mac_cap_info[4] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5700 he_cap_elem->mac_cap_info[5] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5704 he_cap_elem->phy_cap_info[2] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5709 he_cap_elem->phy_cap_info[3] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5712 he_cap_elem->phy_cap_info[4] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5715 he_cap_elem->phy_cap_info[5] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5721 he_cap_elem->phy_cap_info[6] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5727 he_cap_elem->phy_cap_info[7] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5733 he_cap_elem->phy_cap_info[8] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5741 he_cap_elem->phy_cap_info[9] &= ~m; in ath11k_mac_filter_he_cap_mesh()
5749 bcap->he_6ghz_capa = IEEE80211_HT_MPDU_DENSITY_NONE; in ath11k_mac_setup_he_6ghz_cap()
5750 if (bcap->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) in ath11k_mac_setup_he_6ghz_cap()
5751 bcap->he_6ghz_capa |= in ath11k_mac_setup_he_6ghz_cap()
5755 bcap->he_6ghz_capa |= in ath11k_mac_setup_he_6ghz_cap()
5759 pcap->vht_cap); in ath11k_mac_setup_he_6ghz_cap()
5760 bcap->he_6ghz_capa |= in ath11k_mac_setup_he_6ghz_cap()
5762 val = FIELD_GET(IEEE80211_VHT_CAP_MAX_MPDU_MASK, pcap->vht_cap); in ath11k_mac_setup_he_6ghz_cap()
5763 bcap->he_6ghz_capa |= in ath11k_mac_setup_he_6ghz_cap()
5765 if (pcap->vht_cap & IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN) in ath11k_mac_setup_he_6ghz_cap()
5766 bcap->he_6ghz_capa |= IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS; in ath11k_mac_setup_he_6ghz_cap()
5767 if (pcap->vht_cap & IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN) in ath11k_mac_setup_he_6ghz_cap()
5768 bcap->he_6ghz_capa |= IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS; in ath11k_mac_setup_he_6ghz_cap()
5770 return cpu_to_le16(bcap->he_6ghz_capa); in ath11k_mac_setup_he_6ghz_cap()
5776 int band) in ath11k_mac_set_hemcsmap() argument
5784 if (i < ar->num_tx_chains && in ath11k_mac_set_hemcsmap()
5785 (ar->cfg_tx_chainmask >> cap->tx_chain_mask_shift) & BIT(i)) in ath11k_mac_set_hemcsmap()
5790 if (i < ar->num_rx_chains && in ath11k_mac_set_hemcsmap()
5791 (ar->cfg_rx_chainmask >> cap->tx_chain_mask_shift) & BIT(i)) in ath11k_mac_set_hemcsmap()
5796 he_cap->he_mcs_nss_supp.rx_mcs_80 = in ath11k_mac_set_hemcsmap()
5798 he_cap->he_mcs_nss_supp.tx_mcs_80 = in ath11k_mac_set_hemcsmap()
5800 he_cap->he_mcs_nss_supp.rx_mcs_160 = in ath11k_mac_set_hemcsmap()
5802 he_cap->he_mcs_nss_supp.tx_mcs_160 = in ath11k_mac_set_hemcsmap()
5804 he_cap->he_mcs_nss_supp.rx_mcs_80p80 = in ath11k_mac_set_hemcsmap()
5806 he_cap->he_mcs_nss_supp.tx_mcs_80p80 = in ath11k_mac_set_hemcsmap()
5813 int band) in ath11k_mac_copy_he_cap() argument
5819 struct ath11k_band_cap *band_cap = &cap->band[band]; in ath11k_mac_copy_he_cap()
5821 &he_cap->he_cap_elem; in ath11k_mac_copy_he_cap()
5834 he_cap->has_he = true; in ath11k_mac_copy_he_cap()
5835 memcpy(he_cap_elem->mac_cap_info, band_cap->he_cap_info, in ath11k_mac_copy_he_cap()
5836 sizeof(he_cap_elem->mac_cap_info)); in ath11k_mac_copy_he_cap()
5837 memcpy(he_cap_elem->phy_cap_info, band_cap->he_cap_phy_info, in ath11k_mac_copy_he_cap()
5838 sizeof(he_cap_elem->phy_cap_info)); in ath11k_mac_copy_he_cap()
5840 he_cap_elem->mac_cap_info[1] &= in ath11k_mac_copy_he_cap()
5843 he_cap_elem->phy_cap_info[5] &= in ath11k_mac_copy_he_cap()
5845 he_cap_elem->phy_cap_info[5] |= ar->num_tx_chains - 1; in ath11k_mac_copy_he_cap()
5849 he_cap_elem->phy_cap_info[3] &= in ath11k_mac_copy_he_cap()
5851 he_cap_elem->phy_cap_info[9] |= in ath11k_mac_copy_he_cap()
5855 he_cap_elem->mac_cap_info[0] &= in ath11k_mac_copy_he_cap()
5857 he_cap_elem->mac_cap_info[0] |= in ath11k_mac_copy_he_cap()
5859 he_cap_elem->phy_cap_info[9] |= in ath11k_mac_copy_he_cap()
5867 ath11k_mac_set_hemcsmap(ar, cap, he_cap, band); in ath11k_mac_copy_he_cap()
5869 memset(he_cap->ppe_thres, 0, sizeof(he_cap->ppe_thres)); in ath11k_mac_copy_he_cap()
5870 if (he_cap_elem->phy_cap_info[6] & in ath11k_mac_copy_he_cap()
5872 ath11k_gen_ppe_thresh(&band_cap->he_ppet, in ath11k_mac_copy_he_cap()
5873 he_cap->ppe_thres); in ath11k_mac_copy_he_cap()
5875 if (band == NL80211_BAND_6GHZ) { in ath11k_mac_copy_he_cap()
5888 struct ieee80211_supported_band *band; in ath11k_mac_setup_he_cap() local
5891 if (cap->supported_bands & WMI_HOST_WLAN_2G_CAP) { in ath11k_mac_setup_he_cap()
5893 ar->mac.iftype[NL80211_BAND_2GHZ], in ath11k_mac_setup_he_cap()
5895 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath11k_mac_setup_he_cap()
5896 band->iftype_data = ar->mac.iftype[NL80211_BAND_2GHZ]; in ath11k_mac_setup_he_cap()
5897 band->n_iftype_data = count; in ath11k_mac_setup_he_cap()
5900 if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP) { in ath11k_mac_setup_he_cap()
5902 ar->mac.iftype[NL80211_BAND_5GHZ], in ath11k_mac_setup_he_cap()
5904 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath11k_mac_setup_he_cap()
5905 band->iftype_data = ar->mac.iftype[NL80211_BAND_5GHZ]; in ath11k_mac_setup_he_cap()
5906 band->n_iftype_data = count; in ath11k_mac_setup_he_cap()
5909 if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP && in ath11k_mac_setup_he_cap()
5910 ar->supports_6ghz) { in ath11k_mac_setup_he_cap()
5912 ar->mac.iftype[NL80211_BAND_6GHZ], in ath11k_mac_setup_he_cap()
5914 band = &ar->mac.sbands[NL80211_BAND_6GHZ]; in ath11k_mac_setup_he_cap()
5915 band->iftype_data = ar->mac.iftype[NL80211_BAND_6GHZ]; in ath11k_mac_setup_he_cap()
5916 band->n_iftype_data = count; in ath11k_mac_setup_he_cap()
5924 lockdep_assert_held(&ar->conf_mutex); in __ath11k_set_antenna()
5927 return -EINVAL; in __ath11k_set_antenna()
5930 return -EINVAL; in __ath11k_set_antenna()
5932 ar->cfg_tx_chainmask = tx_ant; in __ath11k_set_antenna()
5933 ar->cfg_rx_chainmask = rx_ant; in __ath11k_set_antenna()
5935 if (ar->state != ATH11K_STATE_ON && in __ath11k_set_antenna()
5936 ar->state != ATH11K_STATE_RESTARTED) in __ath11k_set_antenna()
5940 tx_ant, ar->pdev->pdev_id); in __ath11k_set_antenna()
5942 ath11k_warn(ar->ab, "failed to set tx-chainmask: %d, req 0x%x\n", in __ath11k_set_antenna()
5947 ar->num_tx_chains = get_num_chains(tx_ant); in __ath11k_set_antenna()
5950 rx_ant, ar->pdev->pdev_id); in __ath11k_set_antenna()
5952 ath11k_warn(ar->ab, "failed to set rx-chainmask: %d, req 0x%x\n", in __ath11k_set_antenna()
5957 ar->num_rx_chains = get_num_chains(rx_ant); in __ath11k_set_antenna()
5960 ath11k_mac_setup_ht_vht_cap(ar, &ar->pdev->cap, NULL); in __ath11k_set_antenna()
5961 ath11k_mac_setup_he_cap(ar, &ar->pdev->cap); in __ath11k_set_antenna()
5970 ieee80211_free_txskb(ar->hw, skb); in ath11k_mgmt_over_wmi_tx_drop()
5972 num_mgmt = atomic_dec_if_positive(&ar->num_pending_mgmt_tx); in ath11k_mgmt_over_wmi_tx_drop()
5978 wake_up(&ar->txmgmt_empty_waitq); in ath11k_mgmt_over_wmi_tx_drop()
5986 spin_lock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_tx_mgmt_free()
5987 msdu = idr_remove(&ar->txmgmt_idr, buf_id); in ath11k_mac_tx_mgmt_free()
5988 spin_unlock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_tx_mgmt_free()
5993 dma_unmap_single(ar->ab->dev, ATH11K_SKB_CB(msdu)->paddr, msdu->len, in ath11k_mac_tx_mgmt_free()
5997 memset(&info->status, 0, sizeof(info->status)); in ath11k_mac_tx_mgmt_free()
6015 struct ath11k *ar = skb_cb->ar; in ath11k_mac_vif_txmgmt_idr_remove()
6017 if (skb_cb->vif == vif) in ath11k_mac_vif_txmgmt_idr_remove()
6026 struct ath11k_base *ab = ar->ab; in ath11k_mac_mgmt_tx_wmi()
6027 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in ath11k_mac_mgmt_tx_wmi()
6033 ATH11K_SKB_CB(skb)->ar = ar; in ath11k_mac_mgmt_tx_wmi()
6035 spin_lock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
6036 buf_id = idr_alloc(&ar->txmgmt_idr, skb, 0, in ath11k_mac_mgmt_tx_wmi()
6038 spin_unlock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
6040 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_mgmt_tx_wmi()
6044 return -ENOSPC; in ath11k_mac_mgmt_tx_wmi()
6047 if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) { in ath11k_mac_mgmt_tx_wmi()
6048 if ((ieee80211_is_action(hdr->frame_control) || in ath11k_mac_mgmt_tx_wmi()
6049 ieee80211_is_deauth(hdr->frame_control) || in ath11k_mac_mgmt_tx_wmi()
6050 ieee80211_is_disassoc(hdr->frame_control)) && in ath11k_mac_mgmt_tx_wmi()
6051 ieee80211_has_protected(hdr->frame_control)) { in ath11k_mac_mgmt_tx_wmi()
6056 paddr = dma_map_single(ab->dev, skb->data, skb->len, DMA_TO_DEVICE); in ath11k_mac_mgmt_tx_wmi()
6057 if (dma_mapping_error(ab->dev, paddr)) { in ath11k_mac_mgmt_tx_wmi()
6059 ret = -EIO; in ath11k_mac_mgmt_tx_wmi()
6063 ATH11K_SKB_CB(skb)->paddr = paddr; in ath11k_mac_mgmt_tx_wmi()
6065 ret = ath11k_wmi_mgmt_send(ar, arvif->vdev_id, buf_id, skb); in ath11k_mac_mgmt_tx_wmi()
6067 ath11k_warn(ar->ab, "failed to send mgmt frame: %d\n", ret); in ath11k_mac_mgmt_tx_wmi()
6074 dma_unmap_single(ab->dev, ATH11K_SKB_CB(skb)->paddr, in ath11k_mac_mgmt_tx_wmi()
6075 skb->len, DMA_TO_DEVICE); in ath11k_mac_mgmt_tx_wmi()
6077 spin_lock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
6078 idr_remove(&ar->txmgmt_idr, buf_id); in ath11k_mac_mgmt_tx_wmi()
6079 spin_unlock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
6088 while ((skb = skb_dequeue(&ar->wmi_mgmt_tx_queue)) != NULL) in ath11k_mgmt_over_wmi_tx_purge()
6100 while ((skb = skb_dequeue(&ar->wmi_mgmt_tx_queue)) != NULL) { in ath11k_mgmt_over_wmi_tx_work()
6102 if (!skb_cb->vif) { in ath11k_mgmt_over_wmi_tx_work()
6103 ath11k_warn(ar->ab, "no vif found for mgmt frame\n"); in ath11k_mgmt_over_wmi_tx_work()
6108 arvif = ath11k_vif_to_arvif(skb_cb->vif); in ath11k_mgmt_over_wmi_tx_work()
6109 mutex_lock(&ar->conf_mutex); in ath11k_mgmt_over_wmi_tx_work()
6110 if (ar->allocated_vdev_map & (1LL << arvif->vdev_id)) { in ath11k_mgmt_over_wmi_tx_work()
6113 ath11k_warn(ar->ab, "failed to tx mgmt frame, vdev_id %d :%d\n", in ath11k_mgmt_over_wmi_tx_work()
6114 arvif->vdev_id, ret); in ath11k_mgmt_over_wmi_tx_work()
6117 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mgmt_over_wmi_tx_work()
6119 arvif->vdev_id); in ath11k_mgmt_over_wmi_tx_work()
6122 ath11k_warn(ar->ab, in ath11k_mgmt_over_wmi_tx_work()
6124 arvif->vdev_id, in ath11k_mgmt_over_wmi_tx_work()
6125 arvif->is_started); in ath11k_mgmt_over_wmi_tx_work()
6128 mutex_unlock(&ar->conf_mutex); in ath11k_mgmt_over_wmi_tx_work()
6135 struct sk_buff_head *q = &ar->wmi_mgmt_tx_queue; in ath11k_mac_mgmt_tx()
6137 if (test_bit(ATH11K_FLAG_CRASH_FLUSH, &ar->ab->dev_flags)) in ath11k_mac_mgmt_tx()
6138 return -ESHUTDOWN; in ath11k_mac_mgmt_tx()
6146 atomic_read(&ar->num_pending_mgmt_tx) > ATH11K_PRB_RSP_DROP_THRESHOLD) { in ath11k_mac_mgmt_tx()
6147 ath11k_warn(ar->ab, in ath11k_mac_mgmt_tx()
6149 return -ENOSPC; in ath11k_mac_mgmt_tx()
6153 ath11k_warn(ar->ab, "mgmt tx queue is full\n"); in ath11k_mac_mgmt_tx()
6154 return -ENOSPC; in ath11k_mac_mgmt_tx()
6158 atomic_inc(&ar->num_pending_mgmt_tx); in ath11k_mac_mgmt_tx()
6159 queue_work(ar->ab->workqueue_aux, &ar->wmi_mgmt_tx_work); in ath11k_mac_mgmt_tx()
6169 struct ath11k *ar = hw->priv; in ath11k_mac_op_tx()
6171 struct ieee80211_vif *vif = info->control.vif; in ath11k_mac_op_tx()
6173 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in ath11k_mac_op_tx()
6174 struct ieee80211_key_conf *key = info->control.hw_key; in ath11k_mac_op_tx()
6176 u32 info_flags = info->flags; in ath11k_mac_op_tx()
6181 skb_cb->vif = vif; in ath11k_mac_op_tx()
6184 skb_cb->cipher = key->cipher; in ath11k_mac_op_tx()
6185 skb_cb->flags |= ATH11K_SKB_CIPHER_SET; in ath11k_mac_op_tx()
6189 skb_cb->flags |= ATH11K_SKB_HW_80211_ENCAP; in ath11k_mac_op_tx()
6190 } else if (ieee80211_is_mgmt(hdr->frame_control)) { in ath11k_mac_op_tx()
6191 is_prb_rsp = ieee80211_is_probe_resp(hdr->frame_control); in ath11k_mac_op_tx()
6194 ath11k_warn(ar->ab, "failed to queue management frame %d\n", in ath11k_mac_op_tx()
6196 ieee80211_free_txskb(ar->hw, skb); in ath11k_mac_op_tx()
6201 if (control->sta) in ath11k_mac_op_tx()
6202 arsta = (struct ath11k_sta *)control->sta->drv_priv; in ath11k_mac_op_tx()
6206 ath11k_warn(ar->ab, "failed to transmit frame %d\n", ret); in ath11k_mac_op_tx()
6207 ieee80211_free_txskb(ar->hw, skb); in ath11k_mac_op_tx()
6213 /* make sure rcu-protected mac80211 tx path itself is drained */ in ath11k_mac_drain_tx()
6216 cancel_work_sync(&ar->wmi_mgmt_tx_work); in ath11k_mac_drain_tx()
6223 struct ath11k_base *ab = ar->ab; in ath11k_mac_config_mon_status_default()
6233 for (i = 0; i < ab->hw_params.num_rxmda_per_pdev; i++) { in ath11k_mac_config_mon_status_default()
6234 ring_id = ar->dp.rx_mon_status_refill_ring[i].refill_buf_ring.ring_id; in ath11k_mac_config_mon_status_default()
6235 ret = ath11k_dp_tx_htt_rx_filter_setup(ar->ab, ring_id, in ath11k_mac_config_mon_status_default()
6236 ar->dp.mac_id + i, in ath11k_mac_config_mon_status_default()
6242 if (enable && !ar->ab->hw_params.rxdma1_enable) in ath11k_mac_config_mon_status_default()
6243 mod_timer(&ar->ab->mon_reap_timer, jiffies + in ath11k_mac_config_mon_status_default()
6253 if (!ab->is_reset) in ath11k_mac_wait_reconfigure()
6256 recovery_start_count = atomic_inc_return(&ab->recovery_start_count); in ath11k_mac_wait_reconfigure()
6259 if (recovery_start_count == ab->num_radios) { in ath11k_mac_wait_reconfigure()
6260 complete(&ab->recovery_start); in ath11k_mac_wait_reconfigure()
6266 wait_for_completion_timeout(&ab->reconfigure_complete, in ath11k_mac_wait_reconfigure()
6272 struct ath11k *ar = hw->priv; in ath11k_mac_op_start()
6273 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_start()
6274 struct ath11k_pdev *pdev = ar->pdev; in ath11k_mac_op_start()
6278 ath11k_warn(ab, "mac operations not supported in factory test mode\n"); in ath11k_mac_op_start()
6279 return -EOPNOTSUPP; in ath11k_mac_op_start()
6283 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_start()
6285 switch (ar->state) { in ath11k_mac_op_start()
6287 ar->state = ATH11K_STATE_ON; in ath11k_mac_op_start()
6290 ar->state = ATH11K_STATE_RESTARTED; in ath11k_mac_op_start()
6298 ret = -EINVAL; in ath11k_mac_op_start()
6303 1, pdev->pdev_id); in ath11k_mac_op_start()
6306 ath11k_err(ar->ab, "failed to enable PMF QOS: (%d\n", ret); in ath11k_mac_op_start()
6311 pdev->pdev_id); in ath11k_mac_op_start()
6313 ath11k_err(ar->ab, "failed to enable dynamic bw: %d\n", ret); in ath11k_mac_op_start()
6317 if (test_bit(WMI_TLV_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi->wmi_ab->svc_map)) { in ath11k_mac_op_start()
6318 ret = ath11k_wmi_scan_prob_req_oui(ar, ar->mac_addr); in ath11k_mac_op_start()
6326 0, pdev->pdev_id); in ath11k_mac_op_start()
6333 ret = ath11k_wmi_send_dfs_phyerr_offload_enable_cmd(ar, pdev->pdev_id); in ath11k_mac_op_start()
6348 1, pdev->pdev_id); in ath11k_mac_op_start()
6351 ath11k_err(ar->ab, "failed to enable MESH MCAST ENABLE: (%d\n", ret); in ath11k_mac_op_start()
6355 __ath11k_set_antenna(ar, ar->cfg_tx_chainmask, ar->cfg_rx_chainmask); in ath11k_mac_op_start()
6361 ar->num_started_vdevs = 0; in ath11k_mac_op_start()
6362 ar->num_created_vdevs = 0; in ath11k_mac_op_start()
6363 ar->num_peers = 0; in ath11k_mac_op_start()
6364 ar->allocated_vdev_map = 0; in ath11k_mac_op_start()
6377 ath11k_wmi_pdev_lro_cfg(ar, ar->pdev->pdev_id); in ath11k_mac_op_start()
6380 if (ab->hw_params.idle_ps) { in ath11k_mac_op_start()
6382 1, pdev->pdev_id); in ath11k_mac_op_start()
6389 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_start()
6391 rcu_assign_pointer(ab->pdevs_active[ar->pdev_idx], in ath11k_mac_op_start()
6392 &ab->pdevs[ar->pdev_idx]); in ath11k_mac_op_start()
6397 ar->state = ATH11K_STATE_OFF; in ath11k_mac_op_start()
6398 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_start()
6405 struct ath11k *ar = hw->priv; in ath11k_mac_op_stop()
6411 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_stop()
6414 ath11k_err(ar->ab, "failed to clear rx_filter for monitor status ring: (%d)\n", in ath11k_mac_op_stop()
6417 clear_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); in ath11k_mac_op_stop()
6418 ar->state = ATH11K_STATE_OFF; in ath11k_mac_op_stop()
6419 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_stop()
6421 cancel_delayed_work_sync(&ar->scan.timeout); in ath11k_mac_op_stop()
6422 cancel_work_sync(&ar->regd_update_work); in ath11k_mac_op_stop()
6423 cancel_work_sync(&ar->ab->update_11d_work); in ath11k_mac_op_stop()
6425 if (ar->state_11d == ATH11K_11D_PREPARING) { in ath11k_mac_op_stop()
6426 ar->state_11d = ATH11K_11D_IDLE; in ath11k_mac_op_stop()
6427 complete(&ar->completed_11d_scan); in ath11k_mac_op_stop()
6430 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_stop()
6431 list_for_each_entry_safe(ppdu_stats, tmp, &ar->ppdu_stats_info, list) { in ath11k_mac_op_stop()
6432 list_del(&ppdu_stats->list); in ath11k_mac_op_stop()
6435 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_stop()
6437 rcu_assign_pointer(ar->ab->pdevs_active[ar->pdev_idx], NULL); in ath11k_mac_op_stop()
6441 atomic_set(&ar->num_pending_mgmt_tx, 0); in ath11k_mac_op_stop()
6447 struct ath11k *ar = arvif->ar; in ath11k_mac_setup_vdev_params_mbssid()
6452 tx_vif = arvif->vif->mbssid_tx_vif; in ath11k_mac_setup_vdev_params_mbssid()
6458 tx_arvif = (void *)tx_vif->drv_priv; in ath11k_mac_setup_vdev_params_mbssid()
6460 if (arvif->vif->bss_conf.nontransmitted) { in ath11k_mac_setup_vdev_params_mbssid()
6461 if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy) in ath11k_mac_setup_vdev_params_mbssid()
6462 return -EINVAL; in ath11k_mac_setup_vdev_params_mbssid()
6465 *tx_vdev_id = ath11k_vif_to_arvif(tx_vif)->vdev_id; in ath11k_mac_setup_vdev_params_mbssid()
6469 return -EINVAL; in ath11k_mac_setup_vdev_params_mbssid()
6472 if (arvif->vif->bss_conf.ema_ap) in ath11k_mac_setup_vdev_params_mbssid()
6481 struct ath11k *ar = arvif->ar; in ath11k_mac_setup_vdev_create_params()
6482 struct ath11k_pdev *pdev = ar->pdev; in ath11k_mac_setup_vdev_create_params()
6485 params->if_id = arvif->vdev_id; in ath11k_mac_setup_vdev_create_params()
6486 params->type = arvif->vdev_type; in ath11k_mac_setup_vdev_create_params()
6487 params->subtype = arvif->vdev_subtype; in ath11k_mac_setup_vdev_create_params()
6488 params->pdev_id = pdev->pdev_id; in ath11k_mac_setup_vdev_create_params()
6489 params->mbssid_flags = 0; in ath11k_mac_setup_vdev_create_params()
6490 params->mbssid_tx_vdev_id = 0; in ath11k_mac_setup_vdev_create_params()
6493 ar->ab->wmi_ab.svc_map)) { in ath11k_mac_setup_vdev_create_params()
6495 &params->mbssid_flags, in ath11k_mac_setup_vdev_create_params()
6496 &params->mbssid_tx_vdev_id); in ath11k_mac_setup_vdev_create_params()
6501 if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) { in ath11k_mac_setup_vdev_create_params()
6502 params->chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains; in ath11k_mac_setup_vdev_create_params()
6503 params->chains[NL80211_BAND_2GHZ].rx = ar->num_rx_chains; in ath11k_mac_setup_vdev_create_params()
6505 if (pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) { in ath11k_mac_setup_vdev_create_params()
6506 params->chains[NL80211_BAND_5GHZ].tx = ar->num_tx_chains; in ath11k_mac_setup_vdev_create_params()
6507 params->chains[NL80211_BAND_5GHZ].rx = ar->num_rx_chains; in ath11k_mac_setup_vdev_create_params()
6509 if (pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP && in ath11k_mac_setup_vdev_create_params()
6510 ar->supports_6ghz) { in ath11k_mac_setup_vdev_create_params()
6511 params->chains[NL80211_BAND_6GHZ].tx = ar->num_tx_chains; in ath11k_mac_setup_vdev_create_params()
6512 params->chains[NL80211_BAND_6GHZ].rx = ar->num_rx_chains; in ath11k_mac_setup_vdev_create_params()
6520 struct ath11k *ar = hw->priv; in ath11k_mac_op_update_vif_offload()
6521 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_update_vif_offload()
6528 (vif->type != NL80211_IFTYPE_STATION && in ath11k_mac_op_update_vif_offload()
6529 vif->type != NL80211_IFTYPE_AP)) in ath11k_mac_op_update_vif_offload()
6530 vif->offload_flags &= ~(IEEE80211_OFFLOAD_ENCAP_ENABLED | in ath11k_mac_op_update_vif_offload()
6533 if (vif->offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED) in ath11k_mac_op_update_vif_offload()
6535 else if (test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) in ath11k_mac_op_update_vif_offload()
6540 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_update_vif_offload()
6544 arvif->vdev_id, ret); in ath11k_mac_op_update_vif_offload()
6545 vif->offload_flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED; in ath11k_mac_op_update_vif_offload()
6549 if (vif->offload_flags & IEEE80211_OFFLOAD_DECAP_ENABLED) in ath11k_mac_op_update_vif_offload()
6551 else if (test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) in ath11k_mac_op_update_vif_offload()
6556 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_update_vif_offload()
6560 arvif->vdev_id, ret); in ath11k_mac_op_update_vif_offload()
6561 vif->offload_flags &= ~IEEE80211_OFFLOAD_DECAP_ENABLED; in ath11k_mac_op_update_vif_offload()
6572 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_vif_ap_active_any()
6573 pdev = &ab->pdevs[i]; in ath11k_mac_vif_ap_active_any()
6574 ar = pdev->ar; in ath11k_mac_vif_ap_active_any()
6575 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_mac_vif_ap_active_any()
6576 if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_AP) in ath11k_mac_vif_ap_active_any()
6588 mutex_lock(&ar->ab->vdev_id_11d_lock); in ath11k_mac_11d_scan_start()
6590 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev id for 11d scan %d\n", in ath11k_mac_11d_scan_start()
6591 ar->vdev_id_11d_scan); in ath11k_mac_11d_scan_start()
6593 if (ar->regdom_set_by_user) in ath11k_mac_11d_scan_start()
6596 if (ar->vdev_id_11d_scan != ATH11K_11D_INVALID_VDEV_ID) in ath11k_mac_11d_scan_start()
6599 if (!test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map)) in ath11k_mac_11d_scan_start()
6602 if (ath11k_mac_vif_ap_active_any(ar->ab)) in ath11k_mac_11d_scan_start()
6609 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "start 11d scan\n"); in ath11k_mac_11d_scan_start()
6613 ath11k_warn(ar->ab, "failed to start 11d scan vdev %d ret: %d\n", in ath11k_mac_11d_scan_start()
6616 ar->vdev_id_11d_scan = vdev_id; in ath11k_mac_11d_scan_start()
6617 if (ar->state_11d == ATH11K_11D_PREPARING) in ath11k_mac_11d_scan_start()
6618 ar->state_11d = ATH11K_11D_RUNNING; in ath11k_mac_11d_scan_start()
6622 if (ar->state_11d == ATH11K_11D_PREPARING) { in ath11k_mac_11d_scan_start()
6623 ar->state_11d = ATH11K_11D_IDLE; in ath11k_mac_11d_scan_start()
6624 complete(&ar->completed_11d_scan); in ath11k_mac_11d_scan_start()
6627 mutex_unlock(&ar->ab->vdev_id_11d_lock); in ath11k_mac_11d_scan_start()
6635 if (!test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map)) in ath11k_mac_11d_scan_stop()
6638 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "stop 11d scan\n"); in ath11k_mac_11d_scan_stop()
6640 mutex_lock(&ar->ab->vdev_id_11d_lock); in ath11k_mac_11d_scan_stop()
6642 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "stop 11d vdev id %d\n", in ath11k_mac_11d_scan_stop()
6643 ar->vdev_id_11d_scan); in ath11k_mac_11d_scan_stop()
6645 if (ar->state_11d == ATH11K_11D_PREPARING) { in ath11k_mac_11d_scan_stop()
6646 ar->state_11d = ATH11K_11D_IDLE; in ath11k_mac_11d_scan_stop()
6647 complete(&ar->completed_11d_scan); in ath11k_mac_11d_scan_stop()
6650 if (ar->vdev_id_11d_scan != ATH11K_11D_INVALID_VDEV_ID) { in ath11k_mac_11d_scan_stop()
6651 vdev_id = ar->vdev_id_11d_scan; in ath11k_mac_11d_scan_stop()
6655 ath11k_warn(ar->ab, in ath11k_mac_11d_scan_stop()
6659 ar->vdev_id_11d_scan = ATH11K_11D_INVALID_VDEV_ID; in ath11k_mac_11d_scan_stop()
6660 ar->state_11d = ATH11K_11D_IDLE; in ath11k_mac_11d_scan_stop()
6661 complete(&ar->completed_11d_scan); in ath11k_mac_11d_scan_stop()
6664 mutex_unlock(&ar->ab->vdev_id_11d_lock); in ath11k_mac_11d_scan_stop()
6675 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_11d_scan_stop_all()
6676 pdev = &ab->pdevs[i]; in ath11k_mac_11d_scan_stop_all()
6677 ar = pdev->ar; in ath11k_mac_11d_scan_stop_all()
6686 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_vdev_delete()
6689 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vdev_delete()
6691 reinit_completion(&ar->vdev_delete_done); in ath11k_mac_vdev_delete()
6693 ret = ath11k_wmi_vdev_delete(ar, arvif->vdev_id); in ath11k_mac_vdev_delete()
6695 ath11k_warn(ar->ab, "failed to delete WMI vdev %d: %d\n", in ath11k_mac_vdev_delete()
6696 arvif->vdev_id, ret); in ath11k_mac_vdev_delete()
6700 time_left = wait_for_completion_timeout(&ar->vdev_delete_done, in ath11k_mac_vdev_delete()
6703 ath11k_warn(ar->ab, "Timeout in receiving vdev delete response\n"); in ath11k_mac_vdev_delete()
6704 return -ETIMEDOUT; in ath11k_mac_vdev_delete()
6707 ar->ab->free_vdev_map |= 1LL << (arvif->vdev_id); in ath11k_mac_vdev_delete()
6708 ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id); in ath11k_mac_vdev_delete()
6709 ar->num_created_vdevs--; in ath11k_mac_vdev_delete()
6711 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %pM deleted, vdev_id %d\n", in ath11k_mac_vdev_delete()
6712 vif->addr, arvif->vdev_id); in ath11k_mac_vdev_delete()
6720 struct ath11k *ar = hw->priv; in ath11k_mac_op_add_interface()
6721 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_add_interface()
6731 vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; in ath11k_mac_op_add_interface()
6733 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_add_interface()
6735 if (vif->type == NL80211_IFTYPE_AP && in ath11k_mac_op_add_interface()
6736 ar->num_peers > (ar->max_num_peers - 1)) { in ath11k_mac_op_add_interface()
6737 ath11k_warn(ab, "failed to create vdev due to insufficient peer entry resource in firmware\n"); in ath11k_mac_op_add_interface()
6738 ret = -ENOBUFS; in ath11k_mac_op_add_interface()
6742 if (ar->num_created_vdevs > (TARGET_NUM_VDEVS(ab) - 1)) { in ath11k_mac_op_add_interface()
6744 ar->num_created_vdevs, TARGET_NUM_VDEVS(ab)); in ath11k_mac_op_add_interface()
6745 ret = -EBUSY; in ath11k_mac_op_add_interface()
6749 /* In the case of hardware recovery, debugfs files are in ath11k_mac_op_add_interface()
6751 * not invoked. In such cases, try to delete the files. in ath11k_mac_op_add_interface()
6752 * These will be re-created later. in ath11k_mac_op_add_interface()
6758 arvif->ar = ar; in ath11k_mac_op_add_interface()
6759 arvif->vif = vif; in ath11k_mac_op_add_interface()
6761 INIT_LIST_HEAD(&arvif->list); in ath11k_mac_op_add_interface()
6762 INIT_DELAYED_WORK(&arvif->connection_loss_work, in ath11k_mac_op_add_interface()
6765 for (i = 0; i < ARRAY_SIZE(arvif->bitrate_mask.control); i++) { in ath11k_mac_op_add_interface()
6766 arvif->bitrate_mask.control[i].legacy = 0xffffffff; in ath11k_mac_op_add_interface()
6767 arvif->bitrate_mask.control[i].gi = NL80211_TXRATE_FORCE_SGI; in ath11k_mac_op_add_interface()
6768 memset(arvif->bitrate_mask.control[i].ht_mcs, 0xff, in ath11k_mac_op_add_interface()
6769 sizeof(arvif->bitrate_mask.control[i].ht_mcs)); in ath11k_mac_op_add_interface()
6770 memset(arvif->bitrate_mask.control[i].vht_mcs, 0xff, in ath11k_mac_op_add_interface()
6771 sizeof(arvif->bitrate_mask.control[i].vht_mcs)); in ath11k_mac_op_add_interface()
6772 memset(arvif->bitrate_mask.control[i].he_mcs, 0xff, in ath11k_mac_op_add_interface()
6773 sizeof(arvif->bitrate_mask.control[i].he_mcs)); in ath11k_mac_op_add_interface()
6776 bit = __ffs64(ab->free_vdev_map); in ath11k_mac_op_add_interface()
6778 arvif->vdev_id = bit; in ath11k_mac_op_add_interface()
6779 arvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE; in ath11k_mac_op_add_interface()
6781 switch (vif->type) { in ath11k_mac_op_add_interface()
6784 arvif->vdev_type = WMI_VDEV_TYPE_STA; in ath11k_mac_op_add_interface()
6787 arvif->vdev_subtype = WMI_VDEV_SUBTYPE_MESH_11S; in ath11k_mac_op_add_interface()
6790 arvif->vdev_type = WMI_VDEV_TYPE_AP; in ath11k_mac_op_add_interface()
6793 arvif->vdev_type = WMI_VDEV_TYPE_MONITOR; in ath11k_mac_op_add_interface()
6794 ar->monitor_vdev_id = bit; in ath11k_mac_op_add_interface()
6801 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "add interface id %d type %d subtype %d map %llx\n", in ath11k_mac_op_add_interface()
6802 arvif->vdev_id, arvif->vdev_type, arvif->vdev_subtype, in ath11k_mac_op_add_interface()
6803 ab->free_vdev_map); in ath11k_mac_op_add_interface()
6805 vif->cab_queue = arvif->vdev_id % (ATH11K_HW_MAX_QUEUES - 1); in ath11k_mac_op_add_interface()
6806 for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++) in ath11k_mac_op_add_interface()
6807 vif->hw_queue[i] = i % (ATH11K_HW_MAX_QUEUES - 1); in ath11k_mac_op_add_interface()
6812 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6816 ret = ath11k_wmi_vdev_create(ar, vif->addr, &vdev_param); in ath11k_mac_op_add_interface()
6819 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6823 ar->num_created_vdevs++; in ath11k_mac_op_add_interface()
6825 vif->addr, arvif->vdev_id); in ath11k_mac_op_add_interface()
6826 ar->allocated_vdev_map |= 1LL << arvif->vdev_id; in ath11k_mac_op_add_interface()
6827 ab->free_vdev_map &= ~(1LL << arvif->vdev_id); in ath11k_mac_op_add_interface()
6829 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
6830 list_add(&arvif->list, &ar->arvifs); in ath11k_mac_op_add_interface()
6831 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
6835 nss = get_num_chains(ar->cfg_tx_chainmask) ? : 1; in ath11k_mac_op_add_interface()
6836 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
6840 arvif->vdev_id, ar->cfg_tx_chainmask, nss, ret); in ath11k_mac_op_add_interface()
6844 switch (arvif->vdev_type) { in ath11k_mac_op_add_interface()
6846 peer_param.vdev_id = arvif->vdev_id; in ath11k_mac_op_add_interface()
6847 peer_param.peer_addr = vif->addr; in ath11k_mac_op_add_interface()
6852 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6858 ath11k_warn(ar->ab, "failed to set vdev %i kickout parameters: %d\n", in ath11k_mac_op_add_interface()
6859 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6863 ath11k_mac_11d_scan_stop_all(ar->ab); in ath11k_mac_op_add_interface()
6868 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
6871 ath11k_warn(ar->ab, "failed to set vdev %d RX wake policy: %d\n", in ath11k_mac_op_add_interface()
6872 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6878 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
6881 ath11k_warn(ar->ab, "failed to set vdev %d TX wake threshold: %d\n", in ath11k_mac_op_add_interface()
6882 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6888 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
6891 ath11k_warn(ar->ab, "failed to set vdev %d pspoll count: %d\n", in ath11k_mac_op_add_interface()
6892 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6896 ret = ath11k_wmi_pdev_set_ps_mode(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
6899 ath11k_warn(ar->ab, "failed to disable vdev %d ps mode: %d\n", in ath11k_mac_op_add_interface()
6900 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6904 if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ab->wmi_ab.svc_map)) { in ath11k_mac_op_add_interface()
6905 reinit_completion(&ar->completed_11d_scan); in ath11k_mac_op_add_interface()
6906 ar->state_11d = ATH11K_11D_PREPARING; in ath11k_mac_op_add_interface()
6910 set_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); in ath11k_mac_op_add_interface()
6916 arvif->txpower = vif->bss_conf.txpower; in ath11k_mac_op_add_interface()
6922 param_value = ar->hw->wiphy->rts_threshold; in ath11k_mac_op_add_interface()
6923 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
6926 ath11k_warn(ar->ab, "failed to set rts threshold for vdev %d: %d\n", in ath11k_mac_op_add_interface()
6927 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
6934 if (vif->type != NL80211_IFTYPE_MONITOR && in ath11k_mac_op_add_interface()
6935 test_bit(ATH11K_FLAG_MONITOR_CONF_ENABLED, &ar->monitor_flags)) { in ath11k_mac_op_add_interface()
6938 ath11k_warn(ar->ab, "failed to create monitor vdev during add interface: %d", in ath11k_mac_op_add_interface()
6942 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_add_interface()
6947 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath11k_mac_op_add_interface()
6948 fbret = ath11k_peer_delete(ar, arvif->vdev_id, vif->addr); in ath11k_mac_op_add_interface()
6950 ath11k_warn(ar->ab, "fallback fail to delete peer addr %pM vdev_id %d ret %d\n", in ath11k_mac_op_add_interface()
6951 vif->addr, arvif->vdev_id, fbret); in ath11k_mac_op_add_interface()
6958 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
6959 list_del(&arvif->list); in ath11k_mac_op_add_interface()
6960 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
6963 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_add_interface()
6973 if (skb_cb->vif == vif) in ath11k_mac_vif_unref()
6974 skb_cb->vif = NULL; in ath11k_mac_vif_unref()
6982 struct ath11k *ar = hw->priv; in ath11k_mac_op_remove_interface()
6984 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_remove_interface()
6988 cancel_delayed_work_sync(&arvif->connection_loss_work); in ath11k_mac_op_remove_interface()
6990 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_remove_interface()
6993 arvif->vdev_id); in ath11k_mac_op_remove_interface()
6998 arvif->vdev_id, ret); in ath11k_mac_op_remove_interface()
7000 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath11k_mac_op_remove_interface()
7003 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath11k_mac_op_remove_interface()
7004 ret = ath11k_peer_delete(ar, arvif->vdev_id, vif->addr); in ath11k_mac_op_remove_interface()
7006 ath11k_warn(ab, "failed to submit AP self-peer removal on vdev %d: %d\n", in ath11k_mac_op_remove_interface()
7007 arvif->vdev_id, ret); in ath11k_mac_op_remove_interface()
7013 arvif->vdev_id, ret); in ath11k_mac_op_remove_interface()
7017 if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { in ath11k_mac_op_remove_interface()
7018 clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); in ath11k_mac_op_remove_interface()
7019 ar->monitor_vdev_id = -1; in ath11k_mac_op_remove_interface()
7020 } else if (test_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags) && in ath11k_mac_op_remove_interface()
7021 !test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags)) { in ath11k_mac_op_remove_interface()
7025 ath11k_warn(ar->ab, "failed to delete vdev monitor during remove interface: %d", in ath11k_mac_op_remove_interface()
7030 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_remove_interface()
7031 list_del(&arvif->list); in ath11k_mac_op_remove_interface()
7032 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_remove_interface()
7034 ath11k_peer_cleanup(ar, arvif->vdev_id); in ath11k_mac_op_remove_interface()
7036 idr_for_each(&ar->txmgmt_idr, in ath11k_mac_op_remove_interface()
7039 for (i = 0; i < ab->hw_params.max_tx_ring; i++) { in ath11k_mac_op_remove_interface()
7040 spin_lock_bh(&ab->dp.tx_ring[i].tx_idr_lock); in ath11k_mac_op_remove_interface()
7041 idr_for_each(&ab->dp.tx_ring[i].txbuf_idr, in ath11k_mac_op_remove_interface()
7043 spin_unlock_bh(&ab->dp.tx_ring[i].tx_idr_lock); in ath11k_mac_op_remove_interface()
7053 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_remove_interface()
7071 struct ath11k *ar = hw->priv; in ath11k_mac_op_configure_filter()
7073 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_configure_filter()
7076 ar->filter_flags = *total_flags; in ath11k_mac_op_configure_filter()
7078 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_configure_filter()
7083 struct ath11k *ar = hw->priv; in ath11k_mac_op_get_antenna()
7085 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_get_antenna()
7087 *tx_ant = ar->cfg_tx_chainmask; in ath11k_mac_op_get_antenna()
7088 *rx_ant = ar->cfg_rx_chainmask; in ath11k_mac_op_get_antenna()
7090 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_get_antenna()
7097 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_antenna()
7100 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_antenna()
7102 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_antenna()
7111 struct ath11k *ar = hw->priv; in ath11k_mac_op_ampdu_action()
7112 int ret = -EINVAL; in ath11k_mac_op_ampdu_action()
7114 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_ampdu_action()
7116 switch (params->action) { in ath11k_mac_op_ampdu_action()
7128 /* Tx A-MPDU aggregation offloaded to hw/fw so deny mac80211 in ath11k_mac_op_ampdu_action()
7131 ret = -EOPNOTSUPP; in ath11k_mac_op_ampdu_action()
7135 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_ampdu_action()
7143 struct ath11k *ar = hw->priv; in ath11k_mac_op_add_chanctx()
7144 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_add_chanctx()
7148 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath11k_mac_op_add_chanctx()
7150 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_add_chanctx()
7152 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_add_chanctx()
7153 /* TODO: In case of multiple channel context, populate rx_channel from in ath11k_mac_op_add_chanctx()
7156 ar->rx_channel = ctx->def.chan; in ath11k_mac_op_add_chanctx()
7157 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_add_chanctx()
7159 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_add_chanctx()
7167 struct ath11k *ar = hw->priv; in ath11k_mac_op_remove_chanctx()
7168 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_remove_chanctx()
7172 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath11k_mac_op_remove_chanctx()
7174 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_remove_chanctx()
7176 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_remove_chanctx()
7177 /* TODO: In case of there is one more channel context left, populate in ath11k_mac_op_remove_chanctx()
7180 ar->rx_channel = NULL; in ath11k_mac_op_remove_chanctx()
7181 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_remove_chanctx()
7183 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_remove_chanctx()
7191 struct ath11k *ar = arvif->ar; in ath11k_mac_vdev_start_restart()
7192 struct ath11k_base *ab = ar->ab; in ath11k_mac_vdev_start_restart()
7194 const struct cfg80211_chan_def *chandef = &ctx->def; in ath11k_mac_vdev_start_restart()
7197 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vdev_start_restart()
7199 reinit_completion(&ar->vdev_setup_done); in ath11k_mac_vdev_start_restart()
7201 arg.vdev_id = arvif->vdev_id; in ath11k_mac_vdev_start_restart()
7202 arg.dtim_period = arvif->dtim_period; in ath11k_mac_vdev_start_restart()
7203 arg.bcn_intval = arvif->beacon_interval; in ath11k_mac_vdev_start_restart()
7205 arg.channel.freq = chandef->chan->center_freq; in ath11k_mac_vdev_start_restart()
7206 arg.channel.band_center_freq1 = chandef->center_freq1; in ath11k_mac_vdev_start_restart()
7207 arg.channel.band_center_freq2 = chandef->center_freq2; in ath11k_mac_vdev_start_restart()
7209 ath11k_phymodes[chandef->chan->band][chandef->width]; in ath11k_mac_vdev_start_restart()
7212 arg.channel.max_power = chandef->chan->max_power; in ath11k_mac_vdev_start_restart()
7213 arg.channel.max_reg_power = chandef->chan->max_reg_power; in ath11k_mac_vdev_start_restart()
7214 arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain; in ath11k_mac_vdev_start_restart()
7216 arg.pref_tx_streams = ar->num_tx_chains; in ath11k_mac_vdev_start_restart()
7217 arg.pref_rx_streams = ar->num_rx_chains; in ath11k_mac_vdev_start_restart()
7222 ar->ab->wmi_ab.svc_map)) { in ath11k_mac_vdev_start_restart()
7230 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath11k_mac_vdev_start_restart()
7231 arg.ssid = arvif->u.ap.ssid; in ath11k_mac_vdev_start_restart()
7232 arg.ssid_len = arvif->u.ap.ssid_len; in ath11k_mac_vdev_start_restart()
7233 arg.hidden_ssid = arvif->u.ap.hidden_ssid; in ath11k_mac_vdev_start_restart()
7237 !!(chandef->chan->flags & IEEE80211_CHAN_RADAR); in ath11k_mac_vdev_start_restart()
7239 arg.channel.freq2_radar = ctx->radar_enabled; in ath11k_mac_vdev_start_restart()
7243 spin_lock_bh(&ab->base_lock); in ath11k_mac_vdev_start_restart()
7244 arg.regdomain = ar->ab->dfs_region; in ath11k_mac_vdev_start_restart()
7245 spin_unlock_bh(&ab->base_lock); in ath11k_mac_vdev_start_restart()
7248 arg.channel.passive |= !!(chandef->chan->flags & IEEE80211_CHAN_NO_IR); in ath11k_mac_vdev_start_restart()
7257 ath11k_warn(ar->ab, "failed to %s WMI vdev %i\n", in ath11k_mac_vdev_start_restart()
7270 ar->num_started_vdevs++; in ath11k_mac_vdev_start_restart()
7273 arvif->vif->addr, arvif->vdev_id); in ath11k_mac_vdev_start_restart()
7275 /* Enable CAC Flag in the driver by checking the channel DFS cac time, in ath11k_mac_vdev_start_restart()
7282 if (arvif->vdev_type == WMI_VDEV_TYPE_AP && in ath11k_mac_vdev_start_restart()
7283 chandef->chan->dfs_cac_ms && in ath11k_mac_vdev_start_restart()
7284 chandef->chan->dfs_state == NL80211_DFS_USABLE) { in ath11k_mac_vdev_start_restart()
7285 set_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); in ath11k_mac_vdev_start_restart()
7287 "CAC Started in chan_freq %d for vdev %d\n", in ath11k_mac_vdev_start_restart()
7294 arvif->vdev_id, ret); in ath11k_mac_vdev_start_restart()
7301 struct ath11k *ar = arvif->ar; in ath11k_mac_vdev_stop()
7304 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vdev_stop()
7306 reinit_completion(&ar->vdev_setup_done); in ath11k_mac_vdev_stop()
7308 ret = ath11k_wmi_vdev_stop(ar, arvif->vdev_id); in ath11k_mac_vdev_stop()
7310 ath11k_warn(ar->ab, "failed to stop WMI vdev %i: %d\n", in ath11k_mac_vdev_stop()
7311 arvif->vdev_id, ret); in ath11k_mac_vdev_stop()
7317 ath11k_warn(ar->ab, "failed to synchronize setup for vdev %i: %d\n", in ath11k_mac_vdev_stop()
7318 arvif->vdev_id, ret); in ath11k_mac_vdev_stop()
7322 WARN_ON(ar->num_started_vdevs == 0); in ath11k_mac_vdev_stop()
7324 ar->num_started_vdevs--; in ath11k_mac_vdev_stop()
7325 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %pM stopped, vdev_id %d\n", in ath11k_mac_vdev_stop()
7326 arvif->vif->addr, arvif->vdev_id); in ath11k_mac_vdev_stop()
7328 if (test_bit(ATH11K_CAC_RUNNING, &ar->dev_flags)) { in ath11k_mac_vdev_stop()
7329 clear_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); in ath11k_mac_vdev_stop()
7330 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "CAC Stopped for vdev %d\n", in ath11k_mac_vdev_stop()
7331 arvif->vdev_id); in ath11k_mac_vdev_stop()
7364 if (rcu_access_pointer(vif->bss_conf.chanctx_conf) != arg->ctx) in ath11k_mac_change_chanctx_cnt_iter()
7367 arg->n_vifs++; in ath11k_mac_change_chanctx_cnt_iter()
7377 ctx = rcu_access_pointer(vif->bss_conf.chanctx_conf); in ath11k_mac_change_chanctx_fill_iter()
7378 if (ctx != arg->ctx) in ath11k_mac_change_chanctx_fill_iter()
7381 if (WARN_ON(arg->next_vif == arg->n_vifs)) in ath11k_mac_change_chanctx_fill_iter()
7384 arg->vifs[arg->next_vif].vif = vif; in ath11k_mac_change_chanctx_fill_iter()
7385 arg->vifs[arg->next_vif].old_ctx = ctx; in ath11k_mac_change_chanctx_fill_iter()
7386 arg->vifs[arg->next_vif].new_ctx = ctx; in ath11k_mac_change_chanctx_fill_iter()
7387 arg->next_vif++; in ath11k_mac_change_chanctx_fill_iter()
7395 struct ath11k_base *ab = ar->ab; in ath11k_mac_update_vif_chan()
7402 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_update_vif_chan()
7408 /* TODO: Update ar->rx_channel */ in ath11k_mac_update_vif_chan()
7411 arvif = (void *)vifs[i].vif->drv_priv; in ath11k_mac_update_vif_chan()
7413 if (WARN_ON(!arvif->is_started)) in ath11k_mac_update_vif_chan()
7417 * ieee80211_start_ap->ieee80211_vif_use_channel-> in ath11k_mac_update_vif_chan()
7421 * If vdev is down then it expect vdev_stop->vdev_start. in ath11k_mac_update_vif_chan()
7423 if (arvif->is_up) { in ath11k_mac_update_vif_chan()
7427 arvif->vdev_id, ret); in ath11k_mac_update_vif_chan()
7434 arvif->vdev_id, ret); in ath11k_mac_update_vif_chan()
7441 arvif->vdev_id, ret); in ath11k_mac_update_vif_chan()
7451 mbssid_tx_vif = arvif->vif->mbssid_tx_vif; in ath11k_mac_update_vif_chan()
7453 tx_arvif = (struct ath11k_vif *)mbssid_tx_vif->drv_priv; in ath11k_mac_update_vif_chan()
7455 ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath11k_mac_update_vif_chan()
7456 arvif->bssid, in ath11k_mac_update_vif_chan()
7457 tx_arvif ? tx_arvif->bssid : NULL, in ath11k_mac_update_vif_chan()
7458 arvif->vif->bss_conf.bssid_index, in ath11k_mac_update_vif_chan()
7459 1 << arvif->vif->bss_conf.bssid_indicator); in ath11k_mac_update_vif_chan()
7462 arvif->vdev_id, ret); in ath11k_mac_update_vif_chan()
7469 test_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags)) { in ath11k_mac_update_vif_chan()
7472 ath11k_warn(ar->ab, "failed to stop monitor during vif channel update: %d", in ath11k_mac_update_vif_chan()
7479 ath11k_warn(ar->ab, "failed to start monitor during vif channel update: %d", in ath11k_mac_update_vif_chan()
7492 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_update_active_vif_chan()
7494 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_update_active_vif_chan()
7505 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_update_active_vif_chan()
7519 struct ath11k *ar = hw->priv; in ath11k_mac_op_change_chanctx()
7520 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_change_chanctx()
7522 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_change_chanctx()
7526 ctx->def.chan->center_freq, ctx->def.width, ctx, changed); in ath11k_mac_op_change_chanctx()
7541 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_change_chanctx()
7547 struct ath11k *ar = hw->priv; in ath11k_start_vdev_delay()
7548 struct ath11k_base *ab = ar->ab; in ath11k_start_vdev_delay()
7549 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_start_vdev_delay()
7552 if (WARN_ON(arvif->is_started)) in ath11k_start_vdev_delay()
7553 return -EBUSY; in ath11k_start_vdev_delay()
7555 ret = ath11k_mac_vdev_start(arvif, &arvif->chanctx); in ath11k_start_vdev_delay()
7558 arvif->vdev_id, vif->addr, in ath11k_start_vdev_delay()
7559 arvif->chanctx.def.chan->center_freq, ret); in ath11k_start_vdev_delay()
7565 if (ar->hw_rate_code > 0) { in ath11k_start_vdev_delay()
7568 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, vdev_param, in ath11k_start_vdev_delay()
7569 ar->hw_rate_code); in ath11k_start_vdev_delay()
7571 ath11k_warn(ar->ab, "failed to set mgmt tx rate %d\n", ret); in ath11k_start_vdev_delay()
7576 if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { in ath11k_start_vdev_delay()
7577 ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, 0, ar->mac_addr, in ath11k_start_vdev_delay()
7585 arvif->is_started = true; in ath11k_start_vdev_delay()
7597 struct ath11k *ar = hw->priv; in ath11k_mac_op_assign_vif_chanctx()
7598 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_assign_vif_chanctx()
7599 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_op_assign_vif_chanctx()
7603 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_assign_vif_chanctx()
7607 ctx, arvif->vdev_id); in ath11k_mac_op_assign_vif_chanctx()
7610 if (ab->hw_params.vdev_start_delay && in ath11k_mac_op_assign_vif_chanctx()
7611 arvif->vdev_type != WMI_VDEV_TYPE_AP && in ath11k_mac_op_assign_vif_chanctx()
7612 arvif->vdev_type != WMI_VDEV_TYPE_MONITOR && in ath11k_mac_op_assign_vif_chanctx()
7613 !ath11k_peer_find_by_vdev_id(ab, arvif->vdev_id)) { in ath11k_mac_op_assign_vif_chanctx()
7614 memcpy(&arvif->chanctx, ctx, sizeof(*ctx)); in ath11k_mac_op_assign_vif_chanctx()
7619 if (WARN_ON(arvif->is_started)) { in ath11k_mac_op_assign_vif_chanctx()
7620 ret = -EBUSY; in ath11k_mac_op_assign_vif_chanctx()
7624 if (ab->hw_params.vdev_start_delay && in ath11k_mac_op_assign_vif_chanctx()
7625 arvif->vdev_type != WMI_VDEV_TYPE_AP && in ath11k_mac_op_assign_vif_chanctx()
7626 arvif->vdev_type != WMI_VDEV_TYPE_MONITOR) { in ath11k_mac_op_assign_vif_chanctx()
7627 param.vdev_id = arvif->vdev_id; in ath11k_mac_op_assign_vif_chanctx()
7629 param.peer_addr = ar->mac_addr; in ath11k_mac_op_assign_vif_chanctx()
7639 if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { in ath11k_mac_op_assign_vif_chanctx()
7642 ath11k_warn(ar->ab, "failed to start monitor during vif channel context assignment: %d", in ath11k_mac_op_assign_vif_chanctx()
7647 arvif->is_started = true; in ath11k_mac_op_assign_vif_chanctx()
7654 arvif->vdev_id, vif->addr, in ath11k_mac_op_assign_vif_chanctx()
7655 ctx->def.chan->center_freq, ret); in ath11k_mac_op_assign_vif_chanctx()
7659 arvif->is_started = true; in ath11k_mac_op_assign_vif_chanctx()
7661 if (arvif->vdev_type != WMI_VDEV_TYPE_MONITOR && in ath11k_mac_op_assign_vif_chanctx()
7662 test_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags)) { in ath11k_mac_op_assign_vif_chanctx()
7665 ath11k_warn(ar->ab, "failed to start monitor during vif channel context assignment: %d", in ath11k_mac_op_assign_vif_chanctx()
7676 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_assign_vif_chanctx()
7687 struct ath11k *ar = hw->priv; in ath11k_mac_op_unassign_vif_chanctx()
7688 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_unassign_vif_chanctx()
7689 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_op_unassign_vif_chanctx()
7693 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_unassign_vif_chanctx()
7697 ctx, arvif->vdev_id); in ath11k_mac_op_unassign_vif_chanctx()
7699 WARN_ON(!arvif->is_started); in ath11k_mac_op_unassign_vif_chanctx()
7701 if (ab->hw_params.vdev_start_delay && in ath11k_mac_op_unassign_vif_chanctx()
7702 arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { in ath11k_mac_op_unassign_vif_chanctx()
7703 spin_lock_bh(&ab->base_lock); in ath11k_mac_op_unassign_vif_chanctx()
7704 peer = ath11k_peer_find_by_addr(ab, ar->mac_addr); in ath11k_mac_op_unassign_vif_chanctx()
7705 spin_unlock_bh(&ab->base_lock); in ath11k_mac_op_unassign_vif_chanctx()
7707 ath11k_peer_delete(ar, arvif->vdev_id, ar->mac_addr); in ath11k_mac_op_unassign_vif_chanctx()
7710 if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { in ath11k_mac_op_unassign_vif_chanctx()
7713 ath11k_warn(ar->ab, "failed to stop monitor during vif channel context unassignment: %d", in ath11k_mac_op_unassign_vif_chanctx()
7715 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_unassign_vif_chanctx()
7719 arvif->is_started = false; in ath11k_mac_op_unassign_vif_chanctx()
7720 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_unassign_vif_chanctx()
7727 arvif->vdev_id, ret); in ath11k_mac_op_unassign_vif_chanctx()
7729 arvif->is_started = false; in ath11k_mac_op_unassign_vif_chanctx()
7731 if (ab->hw_params.vdev_start_delay && in ath11k_mac_op_unassign_vif_chanctx()
7732 arvif->vdev_type == WMI_VDEV_TYPE_STA) { in ath11k_mac_op_unassign_vif_chanctx()
7733 ret = ath11k_peer_delete(ar, arvif->vdev_id, arvif->bssid); in ath11k_mac_op_unassign_vif_chanctx()
7735 ath11k_warn(ar->ab, in ath11k_mac_op_unassign_vif_chanctx()
7737 arvif->bssid, arvif->vdev_id, ret); in ath11k_mac_op_unassign_vif_chanctx()
7739 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_unassign_vif_chanctx()
7741 arvif->bssid, arvif->vdev_id); in ath11k_mac_op_unassign_vif_chanctx()
7744 if (ab->hw_params.vdev_start_delay && in ath11k_mac_op_unassign_vif_chanctx()
7745 arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) in ath11k_mac_op_unassign_vif_chanctx()
7746 ath11k_wmi_vdev_down(ar, arvif->vdev_id); in ath11k_mac_op_unassign_vif_chanctx()
7748 if (arvif->vdev_type != WMI_VDEV_TYPE_MONITOR && in ath11k_mac_op_unassign_vif_chanctx()
7749 ar->num_started_vdevs == 1 && in ath11k_mac_op_unassign_vif_chanctx()
7750 test_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags)) { in ath11k_mac_op_unassign_vif_chanctx()
7754 ath11k_warn(ar->ab, "failed to stop monitor during vif channel context unassignment: %d", in ath11k_mac_op_unassign_vif_chanctx()
7758 if (arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath11k_mac_op_unassign_vif_chanctx()
7759 ath11k_mac_11d_scan_start(ar, arvif->vdev_id); in ath11k_mac_op_unassign_vif_chanctx()
7761 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_unassign_vif_chanctx()
7770 struct ath11k *ar = hw->priv; in ath11k_mac_op_switch_vif_chanctx()
7772 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_switch_vif_chanctx()
7774 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_switch_vif_chanctx()
7779 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_switch_vif_chanctx()
7790 mutex_lock(&ar->conf_mutex); in ath11k_set_vdev_param_to_all_vifs()
7791 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_set_vdev_param_to_all_vifs()
7792 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "setting mac vdev %d param %d value %d\n", in ath11k_set_vdev_param_to_all_vifs()
7793 param, arvif->vdev_id, value); in ath11k_set_vdev_param_to_all_vifs()
7795 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_set_vdev_param_to_all_vifs()
7798 ath11k_warn(ar->ab, "failed to set param %d for vdev %d: %d\n", in ath11k_set_vdev_param_to_all_vifs()
7799 param, arvif->vdev_id, ret); in ath11k_set_vdev_param_to_all_vifs()
7803 mutex_unlock(&ar->conf_mutex); in ath11k_set_vdev_param_to_all_vifs()
7812 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_rts_threshold()
7823 * "more fragments" bit in frame control making it impossible for remote in ath11k_mac_op_set_frag_threshold()
7828 * fragmentation in software. in ath11k_mac_op_set_frag_threshold()
7830 return -EOPNOTSUPP; in ath11k_mac_op_set_frag_threshold()
7838 time_left = wait_event_timeout(ar->dp.tx_empty_waitq, in ath11k_mac_flush_tx_complete()
7839 (atomic_read(&ar->dp.num_tx_pending) == 0), in ath11k_mac_flush_tx_complete()
7842 ath11k_warn(ar->ab, "failed to flush transmit queue, data pkts pending %d\n", in ath11k_mac_flush_tx_complete()
7843 atomic_read(&ar->dp.num_tx_pending)); in ath11k_mac_flush_tx_complete()
7844 ret = -ETIMEDOUT; in ath11k_mac_flush_tx_complete()
7847 time_left = wait_event_timeout(ar->txmgmt_empty_waitq, in ath11k_mac_flush_tx_complete()
7848 (atomic_read(&ar->num_pending_mgmt_tx) == 0), in ath11k_mac_flush_tx_complete()
7851 ath11k_warn(ar->ab, "failed to flush mgmt transmit queue, mgmt pkts pending %d\n", in ath11k_mac_flush_tx_complete()
7852 atomic_read(&ar->num_pending_mgmt_tx)); in ath11k_mac_flush_tx_complete()
7853 ret = -ETIMEDOUT; in ath11k_mac_flush_tx_complete()
7868 struct ath11k *ar = hw->priv; in ath11k_mac_op_flush()
7878 enum nl80211_band band, in ath11k_mac_has_single_legacy_rate() argument
7883 num_rates = hweight32(mask->control[band].legacy); in ath11k_mac_has_single_legacy_rate()
7885 if (ath11k_mac_bitrate_mask_num_ht_rates(ar, band, mask)) in ath11k_mac_has_single_legacy_rate()
7888 if (ath11k_mac_bitrate_mask_num_vht_rates(ar, band, mask)) in ath11k_mac_has_single_legacy_rate()
7891 if (ath11k_mac_bitrate_mask_num_he_rates(ar, band, mask)) in ath11k_mac_has_single_legacy_rate()
7900 if (he_cap->he_cap_elem.phy_cap_info[0] & in ath11k_mac_get_tx_mcs_map()
7902 return he_cap->he_mcs_nss_supp.tx_mcs_80p80; in ath11k_mac_get_tx_mcs_map()
7904 if (he_cap->he_cap_elem.phy_cap_info[0] & in ath11k_mac_get_tx_mcs_map()
7906 return he_cap->he_mcs_nss_supp.tx_mcs_160; in ath11k_mac_get_tx_mcs_map()
7908 return he_cap->he_mcs_nss_supp.tx_mcs_80; in ath11k_mac_get_tx_mcs_map()
7913 enum nl80211_band band, in ath11k_mac_bitrate_mask_get_single_nss() argument
7917 struct ieee80211_supported_band *sband = &ar->mac.sbands[band]; in ath11k_mac_bitrate_mask_get_single_nss()
7918 u16 vht_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map); in ath11k_mac_bitrate_mask_get_single_nss()
7926 * in bitrate mask in ath11k_mac_bitrate_mask_get_single_nss()
7929 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath11k_mac_bitrate_mask_get_single_nss()
7930 if (mask->control[band].ht_mcs[i] == 0) in ath11k_mac_bitrate_mask_get_single_nss()
7932 else if (mask->control[band].ht_mcs[i] == in ath11k_mac_bitrate_mask_get_single_nss()
7933 sband->ht_cap.mcs.rx_mask[i]) in ath11k_mac_bitrate_mask_get_single_nss()
7939 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath11k_mac_bitrate_mask_get_single_nss()
7940 if (mask->control[band].vht_mcs[i] == 0) in ath11k_mac_bitrate_mask_get_single_nss()
7942 else if (mask->control[band].vht_mcs[i] == in ath11k_mac_bitrate_mask_get_single_nss()
7949 he_mcs_map = le16_to_cpu(ath11k_mac_get_tx_mcs_map(&sband->iftype_data->he_cap)); in ath11k_mac_bitrate_mask_get_single_nss()
7951 for (i = 0; i < ARRAY_SIZE(mask->control[band].he_mcs); i++) { in ath11k_mac_bitrate_mask_get_single_nss()
7952 if (mask->control[band].he_mcs[i] == 0) in ath11k_mac_bitrate_mask_get_single_nss()
7955 if (mask->control[band].he_mcs[i] == in ath11k_mac_bitrate_mask_get_single_nss()
7968 if (BIT(fls(ht_nss_mask)) - 1 != ht_nss_mask) in ath11k_mac_bitrate_mask_get_single_nss()
7978 enum nl80211_band band, in ath11k_mac_get_single_legacy_rate() argument
7987 if (hweight32(mask->control[band].legacy) != 1) in ath11k_mac_get_single_legacy_rate()
7988 return -EINVAL; in ath11k_mac_get_single_legacy_rate()
7990 rate_idx = ffs(mask->control[band].legacy) - 1; in ath11k_mac_get_single_legacy_rate()
7992 if (band == NL80211_BAND_5GHZ || band == NL80211_BAND_6GHZ) in ath11k_mac_get_single_legacy_rate()
8012 struct ath11k *ar = arvif->ar; in ath11k_mac_set_fixed_rate_gi_ltf()
8019 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_fixed_rate_gi_ltf()
8022 ath11k_warn(ar->ab, "failed to set he gi %d: %d\n", in ath11k_mac_set_fixed_rate_gi_ltf()
8030 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_fixed_rate_gi_ltf()
8033 ath11k_warn(ar->ab, "failed to set he ltf %d: %d\n", in ath11k_mac_set_fixed_rate_gi_ltf()
8044 struct ath11k *ar = arvif->ar; in ath11k_mac_set_auto_rate_gi_ltf()
8060 ath11k_warn(ar->ab, "invalid he gi: %d\n", he_gi); in ath11k_mac_set_auto_rate_gi_ltf()
8061 return -EINVAL; in ath11k_mac_set_auto_rate_gi_ltf()
8077 ath11k_warn(ar->ab, "invalid he ltf: %d\n", he_ltf); in ath11k_mac_set_auto_rate_gi_ltf()
8078 return -EINVAL; in ath11k_mac_set_auto_rate_gi_ltf()
8083 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_auto_rate_gi_ltf()
8087 ath11k_warn(ar->ab, in ath11k_mac_set_auto_rate_gi_ltf()
8100 struct ath11k *ar = arvif->ar; in ath11k_mac_set_rate_params()
8104 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_set_rate_params()
8106 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_set_rate_params()
8108 arvif->vdev_id, rate, nss, sgi, ldpc, he_gi, in ath11k_mac_set_rate_params()
8111 if (!arvif->vif->bss_conf.he_support) { in ath11k_mac_set_rate_params()
8113 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_rate_params()
8116 ath11k_warn(ar->ab, "failed to set fixed rate param 0x%02x: %d\n", in ath11k_mac_set_rate_params()
8123 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_rate_params()
8126 ath11k_warn(ar->ab, "failed to set nss param %d: %d\n", in ath11k_mac_set_rate_params()
8132 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_rate_params()
8135 ath11k_warn(ar->ab, "failed to set ldpc param %d: %d\n", in ath11k_mac_set_rate_params()
8140 if (arvif->vif->bss_conf.he_support) { in ath11k_mac_set_rate_params()
8145 ath11k_warn(ar->ab, "failed to set fixed rate gi ltf: %d\n", in ath11k_mac_set_rate_params()
8153 ath11k_warn(ar->ab, "failed to set auto rate gi ltf: %d\n", in ath11k_mac_set_rate_params()
8160 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_rate_params()
8163 ath11k_warn(ar->ab, "failed to set sgi param %d: %d\n", in ath11k_mac_set_rate_params()
8174 enum nl80211_band band, in ath11k_mac_vht_mcs_range_present() argument
8181 vht_mcs = mask->control[band].vht_mcs[i]; in ath11k_mac_vht_mcs_range_present()
8185 case BIT(8) - 1: in ath11k_mac_vht_mcs_range_present()
8186 case BIT(9) - 1: in ath11k_mac_vht_mcs_range_present()
8187 case BIT(10) - 1: in ath11k_mac_vht_mcs_range_present()
8199 enum nl80211_band band, in ath11k_mac_he_mcs_range_present() argument
8206 he_mcs = mask->control[band].he_mcs[i]; in ath11k_mac_he_mcs_range_present()
8210 case BIT(8) - 1: in ath11k_mac_he_mcs_range_present()
8211 case BIT(10) - 1: in ath11k_mac_he_mcs_range_present()
8212 case BIT(12) - 1: in ath11k_mac_he_mcs_range_present()
8226 struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; in ath11k_mac_set_bitrate_mask_iter()
8227 struct ath11k *ar = arvif->ar; in ath11k_mac_set_bitrate_mask_iter()
8229 spin_lock_bh(&ar->data_lock); in ath11k_mac_set_bitrate_mask_iter()
8230 arsta->changed |= IEEE80211_RC_SUPP_RATES_CHANGED; in ath11k_mac_set_bitrate_mask_iter()
8231 spin_unlock_bh(&ar->data_lock); in ath11k_mac_set_bitrate_mask_iter()
8233 ieee80211_queue_work(ar->hw, &arsta->update_wk); in ath11k_mac_set_bitrate_mask_iter()
8240 struct ath11k *ar = arvif->ar; in ath11k_mac_disable_peer_fixed_rate()
8243 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_disable_peer_fixed_rate()
8244 arvif->vdev_id, in ath11k_mac_disable_peer_fixed_rate()
8248 ath11k_warn(ar->ab, in ath11k_mac_disable_peer_fixed_rate()
8250 sta->addr, ret); in ath11k_mac_disable_peer_fixed_rate()
8254 ath11k_mac_validate_vht_he_fixed_rate_settings(struct ath11k *ar, enum nl80211_band band, in ath11k_mac_validate_vht_he_fixed_rate_settings() argument
8264 vht_mcs_mask = mask->control[band].vht_mcs; in ath11k_mac_validate_vht_he_fixed_rate_settings()
8265 he_mcs_mask = mask->control[band].he_mcs; in ath11k_mac_validate_vht_he_fixed_rate_settings()
8267 if (ath11k_mac_bitrate_mask_num_vht_rates(ar, band, mask) == 1) in ath11k_mac_validate_vht_he_fixed_rate_settings()
8270 if (ath11k_mac_bitrate_mask_num_he_rates(ar, band, mask) == 1) in ath11k_mac_validate_vht_he_fixed_rate_settings()
8280 spin_lock_bh(&ar->ab->base_lock); in ath11k_mac_validate_vht_he_fixed_rate_settings()
8281 list_for_each_entry(peer, &ar->ab->peers, list) { in ath11k_mac_validate_vht_he_fixed_rate_settings()
8282 if (peer->sta) { in ath11k_mac_validate_vht_he_fixed_rate_settings()
8283 deflink = &peer->sta->deflink; in ath11k_mac_validate_vht_he_fixed_rate_settings()
8285 if (vht_fixed_rate && (!deflink->vht_cap.vht_supported || in ath11k_mac_validate_vht_he_fixed_rate_settings()
8286 deflink->rx_nss < vht_nss)) { in ath11k_mac_validate_vht_he_fixed_rate_settings()
8291 if (he_fixed_rate && (!deflink->he_cap.has_he || in ath11k_mac_validate_vht_he_fixed_rate_settings()
8292 deflink->rx_nss < he_nss)) { in ath11k_mac_validate_vht_he_fixed_rate_settings()
8300 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_validate_vht_he_fixed_rate_settings()
8310 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_op_set_bitrate_mask()
8313 struct ath11k *ar = arvif->ar; in ath11k_mac_op_set_bitrate_mask()
8314 enum nl80211_band band; in ath11k_mac_op_set_bitrate_mask() local
8330 return -EPERM; in ath11k_mac_op_set_bitrate_mask()
8332 band = def.chan->band; in ath11k_mac_op_set_bitrate_mask()
8333 cap = &ar->pdev->cap; in ath11k_mac_op_set_bitrate_mask()
8334 ht_mcs_mask = mask->control[band].ht_mcs; in ath11k_mac_op_set_bitrate_mask()
8335 vht_mcs_mask = mask->control[band].vht_mcs; in ath11k_mac_op_set_bitrate_mask()
8336 he_mcs_mask = mask->control[band].he_mcs; in ath11k_mac_op_set_bitrate_mask()
8337 ldpc = !!(cap->band[band].ht_cap_info & WMI_HT_CAP_TX_LDPC); in ath11k_mac_op_set_bitrate_mask()
8339 sgi = mask->control[band].gi; in ath11k_mac_op_set_bitrate_mask()
8341 return -EINVAL; in ath11k_mac_op_set_bitrate_mask()
8343 he_gi = mask->control[band].he_gi; in ath11k_mac_op_set_bitrate_mask()
8344 he_ltf = mask->control[band].he_ltf; in ath11k_mac_op_set_bitrate_mask()
8354 if (ath11k_mac_has_single_legacy_rate(ar, band, mask)) { in ath11k_mac_op_set_bitrate_mask()
8355 ret = ath11k_mac_get_single_legacy_rate(ar, band, mask, &rate, in ath11k_mac_op_set_bitrate_mask()
8358 ath11k_warn(ar->ab, "failed to get single legacy rate for vdev %i: %d\n", in ath11k_mac_op_set_bitrate_mask()
8359 arvif->vdev_id, ret); in ath11k_mac_op_set_bitrate_mask()
8362 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_mac_op_set_bitrate_mask()
8365 } else if (ath11k_mac_bitrate_mask_get_single_nss(ar, band, mask, in ath11k_mac_op_set_bitrate_mask()
8369 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
8370 arvif->bitrate_mask = *mask; in ath11k_mac_op_set_bitrate_mask()
8371 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_mac_op_set_bitrate_mask()
8374 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
8378 if (!ath11k_mac_validate_vht_he_fixed_rate_settings(ar, band, mask)) in ath11k_mac_op_set_bitrate_mask()
8379 ath11k_warn(ar->ab, in ath11k_mac_op_set_bitrate_mask()
8381 nss = min_t(u32, ar->num_tx_chains, in ath11k_mac_op_set_bitrate_mask()
8389 * - Single VHT Rate : peer_assoc command accommodates only MCS in ath11k_mac_op_set_bitrate_mask()
8390 * range values i.e 0-7, 0-8, 0-9 for VHT. Though mac80211 in ath11k_mac_op_set_bitrate_mask()
8398 * - Multiple VHT Rates : When Multiple VHT rates are given,this in ath11k_mac_op_set_bitrate_mask()
8399 * can be set using RATEMASK CMD which uses FW rate-ctl alg. in ath11k_mac_op_set_bitrate_mask()
8406 num_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, in ath11k_mac_op_set_bitrate_mask()
8409 if (!ath11k_mac_vht_mcs_range_present(ar, band, mask) && in ath11k_mac_op_set_bitrate_mask()
8414 ath11k_warn(ar->ab, in ath11k_mac_op_set_bitrate_mask()
8415 "setting %d mcs values in bitrate mask not supported\n", in ath11k_mac_op_set_bitrate_mask()
8417 return -EINVAL; in ath11k_mac_op_set_bitrate_mask()
8420 num_rates = ath11k_mac_bitrate_mask_num_he_rates(ar, band, in ath11k_mac_op_set_bitrate_mask()
8425 if (!ath11k_mac_he_mcs_range_present(ar, band, mask) && in ath11k_mac_op_set_bitrate_mask()
8427 ath11k_warn(ar->ab, in ath11k_mac_op_set_bitrate_mask()
8428 "Setting more than one HE MCS Value in bitrate mask not supported\n"); in ath11k_mac_op_set_bitrate_mask()
8429 return -EINVAL; in ath11k_mac_op_set_bitrate_mask()
8432 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
8433 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_mac_op_set_bitrate_mask()
8437 arvif->bitrate_mask = *mask; in ath11k_mac_op_set_bitrate_mask()
8438 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_mac_op_set_bitrate_mask()
8442 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
8445 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
8450 ath11k_warn(ar->ab, "failed to set rate params on vdev %i: %d\n", in ath11k_mac_op_set_bitrate_mask()
8451 arvif->vdev_id, ret); in ath11k_mac_op_set_bitrate_mask()
8454 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
8463 struct ath11k *ar = hw->priv; in ath11k_mac_op_reconfig_complete()
8464 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_reconfig_complete()
8471 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_reconfig_complete()
8473 if (ar->state == ATH11K_STATE_RESTARTED) { in ath11k_mac_op_reconfig_complete()
8474 ath11k_warn(ar->ab, "pdev %d successfully recovered\n", in ath11k_mac_op_reconfig_complete()
8475 ar->pdev->pdev_id); in ath11k_mac_op_reconfig_complete()
8476 ar->state = ATH11K_STATE_ON; in ath11k_mac_op_reconfig_complete()
8477 ieee80211_wake_queues(ar->hw); in ath11k_mac_op_reconfig_complete()
8479 if (ar->ab->hw_params.current_cc_support && in ath11k_mac_op_reconfig_complete()
8480 ar->alpha2[0] != 0 && ar->alpha2[1] != 0) { in ath11k_mac_op_reconfig_complete()
8483 memcpy(&set_current_param.alpha2, ar->alpha2, 2); in ath11k_mac_op_reconfig_complete()
8487 if (ab->is_reset) { in ath11k_mac_op_reconfig_complete()
8488 recovery_count = atomic_inc_return(&ab->recovery_count); in ath11k_mac_op_reconfig_complete()
8491 /* When there are multiple radios in an SOC, in ath11k_mac_op_reconfig_complete()
8494 if (recovery_count == ab->num_radios) { in ath11k_mac_op_reconfig_complete()
8495 atomic_dec(&ab->reset_count); in ath11k_mac_op_reconfig_complete()
8496 complete(&ab->reset_complete); in ath11k_mac_op_reconfig_complete()
8497 ab->is_reset = false; in ath11k_mac_op_reconfig_complete()
8498 atomic_set(&ab->fail_cont_count, 0); in ath11k_mac_op_reconfig_complete()
8502 if (ar->ab->hw_params.support_fw_mac_sequence) { in ath11k_mac_op_reconfig_complete()
8503 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_mac_op_reconfig_complete()
8504 if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath11k_mac_op_reconfig_complete()
8505 ieee80211_hw_restart_disconnect(arvif->vif); in ath11k_mac_op_reconfig_complete()
8510 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_reconfig_complete()
8520 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_update_bss_chan_survey()
8522 if (!test_bit(WMI_TLV_SERVICE_BSS_CHANNEL_INFO_64, ar->ab->wmi_ab.svc_map) || in ath11k_mac_update_bss_chan_survey()
8523 ar->rx_channel != channel) in ath11k_mac_update_bss_chan_survey()
8526 if (ar->scan.state != ATH11K_SCAN_IDLE) { in ath11k_mac_update_bss_chan_survey()
8527 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_update_bss_chan_survey()
8532 reinit_completion(&ar->bss_survey_done); in ath11k_mac_update_bss_chan_survey()
8536 ath11k_warn(ar->ab, "failed to send pdev bss chan info request\n"); in ath11k_mac_update_bss_chan_survey()
8540 ret = wait_for_completion_timeout(&ar->bss_survey_done, 3 * HZ); in ath11k_mac_update_bss_chan_survey()
8542 ath11k_warn(ar->ab, "bss channel survey timed out\n"); in ath11k_mac_update_bss_chan_survey()
8548 struct ath11k *ar = hw->priv; in ath11k_mac_op_get_survey()
8554 return -ENOENT; in ath11k_mac_op_get_survey()
8556 ar_survey = &ar->survey[idx]; in ath11k_mac_op_get_survey()
8558 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_get_survey()
8560 sband = hw->wiphy->bands[NL80211_BAND_2GHZ]; in ath11k_mac_op_get_survey()
8561 if (sband && idx >= sband->n_channels) { in ath11k_mac_op_get_survey()
8562 idx -= sband->n_channels; in ath11k_mac_op_get_survey()
8567 sband = hw->wiphy->bands[NL80211_BAND_5GHZ]; in ath11k_mac_op_get_survey()
8568 if (sband && idx >= sband->n_channels) { in ath11k_mac_op_get_survey()
8569 idx -= sband->n_channels; in ath11k_mac_op_get_survey()
8574 sband = hw->wiphy->bands[NL80211_BAND_6GHZ]; in ath11k_mac_op_get_survey()
8575 if (!sband || idx >= sband->n_channels) { in ath11k_mac_op_get_survey()
8576 ret = -ENOENT; in ath11k_mac_op_get_survey()
8580 ath11k_mac_update_bss_chan_survey(ar, &sband->channels[idx]); in ath11k_mac_op_get_survey()
8582 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_get_survey()
8584 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_get_survey()
8586 survey->channel = &sband->channels[idx]; in ath11k_mac_op_get_survey()
8588 if (ar->rx_channel == survey->channel) in ath11k_mac_op_get_survey()
8589 survey->filled |= SURVEY_INFO_IN_USE; in ath11k_mac_op_get_survey()
8592 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_get_survey()
8601 struct ath11k *ar = arsta->arvif->ar; in ath11k_mac_put_chain_rssi()
8605 for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) { in ath11k_mac_put_chain_rssi()
8606 sinfo->chains &= ~BIT(i); in ath11k_mac_put_chain_rssi()
8607 rssi = arsta->chain_signal[i]; in ath11k_mac_put_chain_rssi()
8609 arsta->chain_signal[i] = ATH11K_INVALID_RSSI_FULL; in ath11k_mac_put_chain_rssi()
8611 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_put_chain_rssi()
8618 sinfo->chain_signal[i] = rssi; in ath11k_mac_put_chain_rssi()
8619 sinfo->chains |= BIT(i); in ath11k_mac_put_chain_rssi()
8620 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); in ath11k_mac_put_chain_rssi()
8630 struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; in ath11k_mac_op_sta_statistics()
8631 struct ath11k *ar = arsta->arvif->ar; in ath11k_mac_op_sta_statistics()
8634 ar->ab->wmi_ab.svc_map); in ath11k_mac_op_sta_statistics()
8636 sinfo->rx_duration = arsta->rx_duration; in ath11k_mac_op_sta_statistics()
8637 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION); in ath11k_mac_op_sta_statistics()
8639 sinfo->tx_duration = arsta->tx_duration; in ath11k_mac_op_sta_statistics()
8640 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_DURATION); in ath11k_mac_op_sta_statistics()
8642 if (arsta->txrate.legacy || arsta->txrate.nss) { in ath11k_mac_op_sta_statistics()
8643 if (arsta->txrate.legacy) { in ath11k_mac_op_sta_statistics()
8644 sinfo->txrate.legacy = arsta->txrate.legacy; in ath11k_mac_op_sta_statistics()
8646 sinfo->txrate.mcs = arsta->txrate.mcs; in ath11k_mac_op_sta_statistics()
8647 sinfo->txrate.nss = arsta->txrate.nss; in ath11k_mac_op_sta_statistics()
8648 sinfo->txrate.bw = arsta->txrate.bw; in ath11k_mac_op_sta_statistics()
8649 sinfo->txrate.he_gi = arsta->txrate.he_gi; in ath11k_mac_op_sta_statistics()
8650 sinfo->txrate.he_dcm = arsta->txrate.he_dcm; in ath11k_mac_op_sta_statistics()
8651 sinfo->txrate.he_ru_alloc = arsta->txrate.he_ru_alloc; in ath11k_mac_op_sta_statistics()
8653 sinfo->txrate.flags = arsta->txrate.flags; in ath11k_mac_op_sta_statistics()
8654 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in ath11k_mac_op_sta_statistics()
8659 if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL)) && in ath11k_mac_op_sta_statistics()
8660 arsta->arvif->vdev_type == WMI_VDEV_TYPE_STA && in ath11k_mac_op_sta_statistics()
8661 ar->ab->hw_params.supports_rssi_stats && in ath11k_mac_op_sta_statistics()
8662 !ath11k_debugfs_get_fw_stats(ar, ar->pdev->pdev_id, 0, in ath11k_mac_op_sta_statistics()
8667 signal = arsta->rssi_comb; in ath11k_mac_op_sta_statistics()
8669 arsta->arvif->vdev_type == WMI_VDEV_TYPE_STA && in ath11k_mac_op_sta_statistics()
8670 ar->ab->hw_params.supports_rssi_stats && in ath11k_mac_op_sta_statistics()
8671 !(ath11k_debugfs_get_fw_stats(ar, ar->pdev->pdev_id, 0, in ath11k_mac_op_sta_statistics()
8673 signal = arsta->rssi_beacon; in ath11k_mac_op_sta_statistics()
8675 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_sta_statistics()
8677 db2dbm, arsta->rssi_comb, arsta->rssi_beacon); in ath11k_mac_op_sta_statistics()
8680 sinfo->signal = db2dbm ? signal : signal + ATH11K_DEFAULT_NOISE_FLOOR; in ath11k_mac_op_sta_statistics()
8681 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); in ath11k_mac_op_sta_statistics()
8684 sinfo->signal_avg = ewma_avg_rssi_read(&arsta->avg_rssi) + in ath11k_mac_op_sta_statistics()
8686 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); in ath11k_mac_op_sta_statistics()
8695 for (i = 0; i < offload->ipv6_count; i++) { in ath11k_generate_ns_mc_addr()
8696 offload->self_ipv6_addr[i][0] = 0xff; in ath11k_generate_ns_mc_addr()
8697 offload->self_ipv6_addr[i][1] = 0x02; in ath11k_generate_ns_mc_addr()
8698 offload->self_ipv6_addr[i][11] = 0x01; in ath11k_generate_ns_mc_addr()
8699 offload->self_ipv6_addr[i][12] = 0xff; in ath11k_generate_ns_mc_addr()
8700 offload->self_ipv6_addr[i][13] = in ath11k_generate_ns_mc_addr()
8701 offload->ipv6_addr[i][13]; in ath11k_generate_ns_mc_addr()
8702 offload->self_ipv6_addr[i][14] = in ath11k_generate_ns_mc_addr()
8703 offload->ipv6_addr[i][14]; in ath11k_generate_ns_mc_addr()
8704 offload->self_ipv6_addr[i][15] = in ath11k_generate_ns_mc_addr()
8705 offload->ipv6_addr[i][15]; in ath11k_generate_ns_mc_addr()
8706 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "NS solicited addr %pI6\n", in ath11k_generate_ns_mc_addr()
8707 offload->self_ipv6_addr[i]); in ath11k_generate_ns_mc_addr()
8715 struct ath11k *ar = hw->priv; in ath11k_mac_op_ipv6_changed()
8723 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "op ipv6 changed\n"); in ath11k_mac_op_ipv6_changed()
8725 offload = &arvif->arp_ns_offload; in ath11k_mac_op_ipv6_changed()
8728 read_lock_bh(&idev->lock); in ath11k_mac_op_ipv6_changed()
8730 memset(offload->ipv6_addr, 0, sizeof(offload->ipv6_addr)); in ath11k_mac_op_ipv6_changed()
8731 memset(offload->self_ipv6_addr, 0, sizeof(offload->self_ipv6_addr)); in ath11k_mac_op_ipv6_changed()
8732 memcpy(offload->mac_addr, vif->addr, ETH_ALEN); in ath11k_mac_op_ipv6_changed()
8735 list_for_each(p, &idev->addr_list) { in ath11k_mac_op_ipv6_changed()
8740 if (ifa6->flags & IFA_F_DADFAILED) in ath11k_mac_op_ipv6_changed()
8742 scope = ipv6_addr_src_scope(&ifa6->addr); in ath11k_mac_op_ipv6_changed()
8745 memcpy(offload->ipv6_addr[count], &ifa6->addr.s6_addr, in ath11k_mac_op_ipv6_changed()
8746 sizeof(ifa6->addr.s6_addr)); in ath11k_mac_op_ipv6_changed()
8747 offload->ipv6_type[count] = ATH11K_IPV6_UC_TYPE; in ath11k_mac_op_ipv6_changed()
8748 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "count %d ipv6 uc %pI6 scope %d\n", in ath11k_mac_op_ipv6_changed()
8749 count, offload->ipv6_addr[count], in ath11k_mac_op_ipv6_changed()
8753 ath11k_warn(ar->ab, "Unsupported ipv6 scope: %d\n", scope); in ath11k_mac_op_ipv6_changed()
8758 for (ifaca6 = idev->ac_list; ifaca6; ifaca6 = ifaca6->aca_next) { in ath11k_mac_op_ipv6_changed()
8762 scope = ipv6_addr_src_scope(&ifaca6->aca_addr); in ath11k_mac_op_ipv6_changed()
8765 memcpy(offload->ipv6_addr[count], &ifaca6->aca_addr, in ath11k_mac_op_ipv6_changed()
8766 sizeof(ifaca6->aca_addr)); in ath11k_mac_op_ipv6_changed()
8767 offload->ipv6_type[count] = ATH11K_IPV6_AC_TYPE; in ath11k_mac_op_ipv6_changed()
8768 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "count %d ipv6 ac %pI6 scope %d\n", in ath11k_mac_op_ipv6_changed()
8769 count, offload->ipv6_addr[count], in ath11k_mac_op_ipv6_changed()
8773 ath11k_warn(ar->ab, "Unsupported ipv scope: %d\n", scope); in ath11k_mac_op_ipv6_changed()
8778 offload->ipv6_count = count; in ath11k_mac_op_ipv6_changed()
8779 read_unlock_bh(&idev->lock); in ath11k_mac_op_ipv6_changed()
8790 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_rekey_data()
8792 struct ath11k_rekey_data *rekey_data = &arvif->rekey_data; in ath11k_mac_op_set_rekey_data()
8794 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "set rekey data vdev %d\n", in ath11k_mac_op_set_rekey_data()
8795 arvif->vdev_id); in ath11k_mac_op_set_rekey_data()
8797 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_rekey_data()
8799 memcpy(rekey_data->kck, data->kck, NL80211_KCK_LEN); in ath11k_mac_op_set_rekey_data()
8800 memcpy(rekey_data->kek, data->kek, NL80211_KEK_LEN); in ath11k_mac_op_set_rekey_data()
8802 /* The supplicant works on big-endian, the firmware expects it on in ath11k_mac_op_set_rekey_data()
8805 rekey_data->replay_ctr = get_unaligned_be64(data->replay_ctr); in ath11k_mac_op_set_rekey_data()
8807 arvif->rekey_data.enable_offload = true; in ath11k_mac_op_set_rekey_data()
8809 ath11k_dbg_dump(ar->ab, ATH11K_DBG_MAC, "kck", NULL, in ath11k_mac_op_set_rekey_data()
8810 rekey_data->kck, NL80211_KCK_LEN); in ath11k_mac_op_set_rekey_data()
8811 ath11k_dbg_dump(ar->ab, ATH11K_DBG_MAC, "kek", NULL, in ath11k_mac_op_set_rekey_data()
8812 rekey_data->kck, NL80211_KEK_LEN); in ath11k_mac_op_set_rekey_data()
8813 ath11k_dbg_dump(ar->ab, ATH11K_DBG_MAC, "replay ctr", NULL, in ath11k_mac_op_set_rekey_data()
8814 &rekey_data->replay_ctr, sizeof(rekey_data->replay_ctr)); in ath11k_mac_op_set_rekey_data()
8816 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_rekey_data()
8822 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_bios_sar_specs()
8828 if (!sar || sar->type != NL80211_SAR_TYPE_POWER || in ath11k_mac_op_set_bios_sar_specs()
8829 sar->num_sub_specs == 0) in ath11k_mac_op_set_bios_sar_specs()
8830 return -EINVAL; in ath11k_mac_op_set_bios_sar_specs()
8832 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_bios_sar_specs()
8834 if (!test_bit(WMI_TLV_SERVICE_BIOS_SAR_SUPPORT, ar->ab->wmi_ab.svc_map) || in ath11k_mac_op_set_bios_sar_specs()
8835 !ar->ab->hw_params.bios_sar_capa) { in ath11k_mac_op_set_bios_sar_specs()
8836 ret = -EOPNOTSUPP; in ath11k_mac_op_set_bios_sar_specs()
8842 ath11k_warn(ar->ab, "failed to set geo table: %d\n", ret); in ath11k_mac_op_set_bios_sar_specs()
8848 ret = -ENOMEM; in ath11k_mac_op_set_bios_sar_specs()
8852 sspec = sar->sub_specs; in ath11k_mac_op_set_bios_sar_specs()
8853 for (i = 0; i < sar->num_sub_specs; i++) { in ath11k_mac_op_set_bios_sar_specs()
8854 if (sspec->freq_range_index >= (BIOS_SAR_TABLE_LEN >> 1)) { in ath11k_mac_op_set_bios_sar_specs()
8855 ath11k_warn(ar->ab, "Ignore bad frequency index %u, max allowed %u\n", in ath11k_mac_op_set_bios_sar_specs()
8856 sspec->freq_range_index, BIOS_SAR_TABLE_LEN >> 1); in ath11k_mac_op_set_bios_sar_specs()
8861 sar_tbl[sspec->freq_range_index] = sspec->power; in ath11k_mac_op_set_bios_sar_specs()
8862 index = sspec->freq_range_index + (BIOS_SAR_TABLE_LEN >> 1); in ath11k_mac_op_set_bios_sar_specs()
8863 sar_tbl[index] = sspec->power; in ath11k_mac_op_set_bios_sar_specs()
8864 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "sar tbl[%d] = %d\n", in ath11k_mac_op_set_bios_sar_specs()
8865 sspec->freq_range_index, sar_tbl[sspec->freq_range_index]); in ath11k_mac_op_set_bios_sar_specs()
8871 ath11k_warn(ar->ab, "failed to set sar power: %d", ret); in ath11k_mac_op_set_bios_sar_specs()
8875 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_bios_sar_specs()
8883 struct ath11k *ar = hw->priv; in ath11k_mac_op_cancel_remain_on_channel()
8885 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_cancel_remain_on_channel()
8887 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_cancel_remain_on_channel()
8888 ar->scan.roc_notify = false; in ath11k_mac_op_cancel_remain_on_channel()
8889 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_cancel_remain_on_channel()
8893 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_cancel_remain_on_channel()
8895 cancel_delayed_work_sync(&ar->scan.timeout); in ath11k_mac_op_cancel_remain_on_channel()
8906 struct ath11k *ar = hw->priv; in ath11k_mac_op_remain_on_channel()
8907 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_op_remain_on_channel()
8912 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_remain_on_channel()
8914 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_remain_on_channel()
8915 switch (ar->scan.state) { in ath11k_mac_op_remain_on_channel()
8917 reinit_completion(&ar->scan.started); in ath11k_mac_op_remain_on_channel()
8918 reinit_completion(&ar->scan.completed); in ath11k_mac_op_remain_on_channel()
8919 reinit_completion(&ar->scan.on_channel); in ath11k_mac_op_remain_on_channel()
8920 ar->scan.state = ATH11K_SCAN_STARTING; in ath11k_mac_op_remain_on_channel()
8921 ar->scan.is_roc = true; in ath11k_mac_op_remain_on_channel()
8922 ar->scan.vdev_id = arvif->vdev_id; in ath11k_mac_op_remain_on_channel()
8923 ar->scan.roc_freq = chan->center_freq; in ath11k_mac_op_remain_on_channel()
8924 ar->scan.roc_notify = true; in ath11k_mac_op_remain_on_channel()
8930 ret = -EBUSY; in ath11k_mac_op_remain_on_channel()
8933 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_remain_on_channel()
8938 scan_time_msec = ar->hw->wiphy->max_remain_on_channel_duration * 2; in ath11k_mac_op_remain_on_channel()
8946 ret = -ENOMEM; in ath11k_mac_op_remain_on_channel()
8950 arg.vdev_id = arvif->vdev_id; in ath11k_mac_op_remain_on_channel()
8952 arg.chan_list[0] = chan->center_freq; in ath11k_mac_op_remain_on_channel()
8962 ath11k_warn(ar->ab, "failed to start roc scan: %d\n", ret); in ath11k_mac_op_remain_on_channel()
8964 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_remain_on_channel()
8965 ar->scan.state = ATH11K_SCAN_IDLE; in ath11k_mac_op_remain_on_channel()
8966 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_remain_on_channel()
8970 ret = wait_for_completion_timeout(&ar->scan.on_channel, 3 * HZ); in ath11k_mac_op_remain_on_channel()
8972 ath11k_warn(ar->ab, "failed to switch to channel for roc scan\n"); in ath11k_mac_op_remain_on_channel()
8975 ath11k_warn(ar->ab, "failed to stop scan: %d\n", ret); in ath11k_mac_op_remain_on_channel()
8976 ret = -ETIMEDOUT; in ath11k_mac_op_remain_on_channel()
8980 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath11k_mac_op_remain_on_channel()
8988 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_remain_on_channel()
8995 struct ath11k_base *ab = ar->ab; in ath11k_fw_stats_request()
8999 lockdep_assert_held(&ar->conf_mutex); in ath11k_fw_stats_request()
9001 spin_lock_bh(&ar->data_lock); in ath11k_fw_stats_request()
9002 ar->fw_stats_done = false; in ath11k_fw_stats_request()
9003 ath11k_fw_stats_pdevs_free(&ar->fw_stats.pdevs); in ath11k_fw_stats_request()
9004 spin_unlock_bh(&ar->data_lock); in ath11k_fw_stats_request()
9006 reinit_completion(&ar->fw_stats_complete); in ath11k_fw_stats_request()
9015 time_left = wait_for_completion_timeout(&ar->fw_stats_complete, in ath11k_fw_stats_request()
9019 return -ETIMEDOUT; in ath11k_fw_stats_request()
9028 struct ath11k *ar = hw->priv; in ath11k_mac_op_get_txpower()
9029 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_get_txpower()
9037 * of these. Hence, we request the FW pdev stats in which FW reports in ath11k_mac_op_get_txpower()
9040 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_get_txpower()
9042 if (ar->state != ATH11K_STATE_ON) in ath11k_mac_op_get_txpower()
9045 req_param.pdev_id = ar->pdev->pdev_id; in ath11k_mac_op_get_txpower()
9054 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_get_txpower()
9055 pdev = list_first_entry_or_null(&ar->fw_stats.pdevs, in ath11k_mac_op_get_txpower()
9058 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_get_txpower()
9062 /* tx power is set as 2 units per dBm in FW. */ in ath11k_mac_op_get_txpower()
9063 *dbm = pdev->chan_tx_power / 2; in ath11k_mac_op_get_txpower()
9065 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_get_txpower()
9066 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_get_txpower()
9068 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "txpower from firmware %d, reported %d dBm\n", in ath11k_mac_op_get_txpower()
9069 pdev->chan_tx_power, *dbm); in ath11k_mac_op_get_txpower()
9073 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_get_txpower()
9074 /* We didn't get txpower from FW. Hence, relying on vif->bss_conf.txpower */ in ath11k_mac_op_get_txpower()
9075 *dbm = vif->bss_conf.txpower; in ath11k_mac_op_get_txpower()
9076 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "txpower from firmware NaN, reported %d dBm\n", in ath11k_mac_op_get_txpower()
9140 struct ieee80211_supported_band *band, in ath11k_mac_update_ch_list() argument
9148 for (i = 0; i < band->n_channels; i++) { in ath11k_mac_update_ch_list()
9149 if (band->channels[i].center_freq < freq_low || in ath11k_mac_update_ch_list()
9150 band->channels[i].center_freq > freq_high) in ath11k_mac_update_ch_list()
9151 band->channels[i].flags |= IEEE80211_CHAN_DISABLED; in ath11k_mac_update_ch_list()
9155 static u32 ath11k_get_phy_id(struct ath11k *ar, u32 band) in ath11k_get_phy_id() argument
9157 struct ath11k_pdev *pdev = ar->pdev; in ath11k_get_phy_id()
9158 struct ath11k_pdev_cap *pdev_cap = &pdev->cap; in ath11k_get_phy_id()
9160 if (band == WMI_HOST_WLAN_2G_CAP) in ath11k_get_phy_id()
9161 return pdev_cap->band[NL80211_BAND_2GHZ].phy_id; in ath11k_get_phy_id()
9163 if (band == WMI_HOST_WLAN_5G_CAP) in ath11k_get_phy_id()
9164 return pdev_cap->band[NL80211_BAND_5GHZ].phy_id; in ath11k_get_phy_id()
9166 ath11k_warn(ar->ab, "unsupported phy cap:%d\n", band); in ath11k_get_phy_id()
9174 struct ieee80211_supported_band *band; in ath11k_mac_setup_channels_rates() local
9184 reg_cap = &ar->ab->hal_reg_cap[ar->pdev_idx]; in ath11k_mac_setup_channels_rates()
9192 return -ENOMEM; in ath11k_mac_setup_channels_rates()
9194 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath11k_mac_setup_channels_rates()
9195 band->band = NL80211_BAND_2GHZ; in ath11k_mac_setup_channels_rates()
9196 band->n_channels = ARRAY_SIZE(ath11k_2ghz_channels); in ath11k_mac_setup_channels_rates()
9197 band->channels = channels; in ath11k_mac_setup_channels_rates()
9198 band->n_bitrates = ath11k_g_rates_size; in ath11k_mac_setup_channels_rates()
9199 band->bitrates = ath11k_g_rates; in ath11k_mac_setup_channels_rates()
9200 ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = band; in ath11k_mac_setup_channels_rates()
9202 if (ar->ab->hw_params.single_pdev_only) { in ath11k_mac_setup_channels_rates()
9204 temp_reg_cap = &ar->ab->hal_reg_cap[phy_id]; in ath11k_mac_setup_channels_rates()
9206 ath11k_mac_update_ch_list(ar, band, in ath11k_mac_setup_channels_rates()
9207 temp_reg_cap->low_2ghz_chan, in ath11k_mac_setup_channels_rates()
9208 temp_reg_cap->high_2ghz_chan); in ath11k_mac_setup_channels_rates()
9212 if (reg_cap->high_5ghz_chan >= ATH11K_MIN_6G_FREQ) { in ath11k_mac_setup_channels_rates()
9216 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath11k_mac_setup_channels_rates()
9217 return -ENOMEM; in ath11k_mac_setup_channels_rates()
9220 ar->supports_6ghz = true; in ath11k_mac_setup_channels_rates()
9221 band = &ar->mac.sbands[NL80211_BAND_6GHZ]; in ath11k_mac_setup_channels_rates()
9222 band->band = NL80211_BAND_6GHZ; in ath11k_mac_setup_channels_rates()
9223 band->n_channels = ARRAY_SIZE(ath11k_6ghz_channels); in ath11k_mac_setup_channels_rates()
9224 band->channels = channels; in ath11k_mac_setup_channels_rates()
9225 band->n_bitrates = ath11k_a_rates_size; in ath11k_mac_setup_channels_rates()
9226 band->bitrates = ath11k_a_rates; in ath11k_mac_setup_channels_rates()
9227 ar->hw->wiphy->bands[NL80211_BAND_6GHZ] = band; in ath11k_mac_setup_channels_rates()
9229 if (ar->ab->hw_params.single_pdev_only) { in ath11k_mac_setup_channels_rates()
9231 temp_reg_cap = &ar->ab->hal_reg_cap[phy_id]; in ath11k_mac_setup_channels_rates()
9234 ath11k_mac_update_ch_list(ar, band, in ath11k_mac_setup_channels_rates()
9235 temp_reg_cap->low_5ghz_chan, in ath11k_mac_setup_channels_rates()
9236 temp_reg_cap->high_5ghz_chan); in ath11k_mac_setup_channels_rates()
9239 if (reg_cap->low_5ghz_chan < ATH11K_MIN_6G_FREQ) { in ath11k_mac_setup_channels_rates()
9244 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath11k_mac_setup_channels_rates()
9245 kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels); in ath11k_mac_setup_channels_rates()
9246 return -ENOMEM; in ath11k_mac_setup_channels_rates()
9249 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath11k_mac_setup_channels_rates()
9250 band->band = NL80211_BAND_5GHZ; in ath11k_mac_setup_channels_rates()
9251 band->n_channels = ARRAY_SIZE(ath11k_5ghz_channels); in ath11k_mac_setup_channels_rates()
9252 band->channels = channels; in ath11k_mac_setup_channels_rates()
9253 band->n_bitrates = ath11k_a_rates_size; in ath11k_mac_setup_channels_rates()
9254 band->bitrates = ath11k_a_rates; in ath11k_mac_setup_channels_rates()
9255 ar->hw->wiphy->bands[NL80211_BAND_5GHZ] = band; in ath11k_mac_setup_channels_rates()
9257 if (ar->ab->hw_params.single_pdev_only) { in ath11k_mac_setup_channels_rates()
9259 temp_reg_cap = &ar->ab->hal_reg_cap[phy_id]; in ath11k_mac_setup_channels_rates()
9262 ath11k_mac_update_ch_list(ar, band, in ath11k_mac_setup_channels_rates()
9263 temp_reg_cap->low_5ghz_chan, in ath11k_mac_setup_channels_rates()
9264 temp_reg_cap->high_5ghz_chan); in ath11k_mac_setup_channels_rates()
9273 struct ath11k_base *ab = ar->ab; in ath11k_mac_setup_iface_combinations()
9280 return -ENOMEM; in ath11k_mac_setup_iface_combinations()
9287 return -ENOMEM; in ath11k_mac_setup_iface_combinations()
9297 ab->hw_params.interface_modes & BIT(NL80211_IFTYPE_MESH_POINT)) in ath11k_mac_setup_iface_combinations()
9313 ar->hw->wiphy->iface_combinations = combinations; in ath11k_mac_setup_iface_combinations()
9314 ar->hw->wiphy->n_iface_combinations = 1; in ath11k_mac_setup_iface_combinations()
9362 cancel_work_sync(&ar->regd_update_work); in __ath11k_mac_unregister()
9364 ieee80211_unregister_hw(ar->hw); in __ath11k_mac_unregister()
9366 idr_for_each(&ar->txmgmt_idr, ath11k_mac_tx_mgmt_pending_free, ar); in __ath11k_mac_unregister()
9367 idr_destroy(&ar->txmgmt_idr); in __ath11k_mac_unregister()
9369 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in __ath11k_mac_unregister()
9370 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in __ath11k_mac_unregister()
9371 kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels); in __ath11k_mac_unregister()
9373 kfree(ar->hw->wiphy->iface_combinations[0].limits); in __ath11k_mac_unregister()
9374 kfree(ar->hw->wiphy->iface_combinations); in __ath11k_mac_unregister()
9376 SET_IEEE80211_DEV(ar->hw, NULL); in __ath11k_mac_unregister()
9385 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_unregister()
9386 pdev = &ab->pdevs[i]; in ath11k_mac_unregister()
9387 ar = pdev->ar; in ath11k_mac_unregister()
9399 struct ath11k_base *ab = ar->ab; in __ath11k_mac_register()
9400 struct ath11k_pdev_cap *cap = &ar->pdev->cap; in __ath11k_mac_register()
9417 SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr); in __ath11k_mac_register()
9419 SET_IEEE80211_DEV(ar->hw, ab->dev); in __ath11k_mac_register()
9422 cap->supported_bands); in __ath11k_mac_register()
9431 ath11k_err(ar->ab, "failed to setup interface combinations: %d\n", ret); in __ath11k_mac_register()
9435 ar->hw->wiphy->available_antennas_rx = cap->rx_chain_mask; in __ath11k_mac_register()
9436 ar->hw->wiphy->available_antennas_tx = cap->tx_chain_mask; in __ath11k_mac_register()
9438 ar->hw->wiphy->interface_modes = ab->hw_params.interface_modes; in __ath11k_mac_register()
9440 if (ab->hw_params.single_pdev_only && ar->supports_6ghz) in __ath11k_mac_register()
9441 ieee80211_hw_set(ar->hw, SINGLE_SCAN_ON_ALL_BANDS); in __ath11k_mac_register()
9443 if (ab->hw_params.supports_multi_bssid) { in __ath11k_mac_register()
9444 ieee80211_hw_set(ar->hw, SUPPORTS_MULTI_BSSID); in __ath11k_mac_register()
9445 ieee80211_hw_set(ar->hw, SUPPORTS_ONLY_HE_MULTI_BSSID); in __ath11k_mac_register()
9448 ieee80211_hw_set(ar->hw, SIGNAL_DBM); in __ath11k_mac_register()
9449 ieee80211_hw_set(ar->hw, SUPPORTS_PS); in __ath11k_mac_register()
9450 ieee80211_hw_set(ar->hw, SUPPORTS_DYNAMIC_PS); in __ath11k_mac_register()
9451 ieee80211_hw_set(ar->hw, MFP_CAPABLE); in __ath11k_mac_register()
9452 ieee80211_hw_set(ar->hw, REPORTS_TX_ACK_STATUS); in __ath11k_mac_register()
9453 ieee80211_hw_set(ar->hw, HAS_RATE_CONTROL); in __ath11k_mac_register()
9454 ieee80211_hw_set(ar->hw, AP_LINK_PS); in __ath11k_mac_register()
9455 ieee80211_hw_set(ar->hw, SPECTRUM_MGMT); in __ath11k_mac_register()
9456 ieee80211_hw_set(ar->hw, CONNECTION_MONITOR); in __ath11k_mac_register()
9457 ieee80211_hw_set(ar->hw, SUPPORTS_PER_STA_GTK); in __ath11k_mac_register()
9458 ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF); in __ath11k_mac_register()
9459 ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); in __ath11k_mac_register()
9460 ieee80211_hw_set(ar->hw, QUEUE_CONTROL); in __ath11k_mac_register()
9461 ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); in __ath11k_mac_register()
9462 ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); in __ath11k_mac_register()
9465 ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD); in __ath11k_mac_register()
9466 ieee80211_hw_set(ar->hw, SUPPORTS_RX_DECAP_OFFLOAD); in __ath11k_mac_register()
9469 if (cap->nss_ratio_enabled) in __ath11k_mac_register()
9470 ieee80211_hw_set(ar->hw, SUPPORTS_VHT_EXT_NSS_BW); in __ath11k_mac_register()
9472 if ((ht_cap & WMI_HT_CAP_ENABLED) || ar->supports_6ghz) { in __ath11k_mac_register()
9473 ieee80211_hw_set(ar->hw, AMPDU_AGGREGATION); in __ath11k_mac_register()
9474 ieee80211_hw_set(ar->hw, TX_AMPDU_SETUP_IN_HW); in __ath11k_mac_register()
9475 ieee80211_hw_set(ar->hw, SUPPORTS_REORDERING_BUFFER); in __ath11k_mac_register()
9476 ieee80211_hw_set(ar->hw, SUPPORTS_AMSDU_IN_AMPDU); in __ath11k_mac_register()
9477 ieee80211_hw_set(ar->hw, USES_RSS); in __ath11k_mac_register()
9480 ar->hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS; in __ath11k_mac_register()
9481 ar->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in __ath11k_mac_register()
9484 * for each band for a dual band capable radio. It will be tricky to in __ath11k_mac_register()
9485 * handle it when the ht capability different for each band. in __ath11k_mac_register()
9488 (ar->supports_6ghz && ab->hw_params.supports_dynamic_smps_6ghz)) in __ath11k_mac_register()
9489 ar->hw->wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS; in __ath11k_mac_register()
9491 ar->hw->wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID; in __ath11k_mac_register()
9492 ar->hw->wiphy->max_scan_ie_len = WLAN_SCAN_PARAMS_MAX_IE_LEN; in __ath11k_mac_register()
9494 ar->hw->max_listen_interval = ATH11K_MAX_HW_LISTEN_INTERVAL; in __ath11k_mac_register()
9496 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; in __ath11k_mac_register()
9497 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; in __ath11k_mac_register()
9498 ar->hw->wiphy->max_remain_on_channel_duration = 5000; in __ath11k_mac_register()
9500 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; in __ath11k_mac_register()
9501 ar->hw->wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE | in __ath11k_mac_register()
9504 ar->max_num_stations = TARGET_NUM_STATIONS(ab); in __ath11k_mac_register()
9505 ar->max_num_peers = TARGET_NUM_PEERS_PDEV(ab); in __ath11k_mac_register()
9507 ar->hw->wiphy->max_ap_assoc_sta = ar->max_num_stations; in __ath11k_mac_register()
9509 if (test_bit(WMI_TLV_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi->wmi_ab->svc_map)) { in __ath11k_mac_register()
9510 ar->hw->wiphy->features |= in __ath11k_mac_register()
9514 if (test_bit(WMI_TLV_SERVICE_NLO, ar->wmi->wmi_ab->svc_map)) { in __ath11k_mac_register()
9515 ar->hw->wiphy->max_sched_scan_ssids = WMI_PNO_MAX_SUPP_NETWORKS; in __ath11k_mac_register()
9516 ar->hw->wiphy->max_match_sets = WMI_PNO_MAX_SUPP_NETWORKS; in __ath11k_mac_register()
9517 ar->hw->wiphy->max_sched_scan_ie_len = WMI_PNO_MAX_IE_LENGTH; in __ath11k_mac_register()
9518 ar->hw->wiphy->max_sched_scan_plans = WMI_PNO_MAX_SCHED_SCAN_PLANS; in __ath11k_mac_register()
9519 ar->hw->wiphy->max_sched_scan_plan_interval = in __ath11k_mac_register()
9521 ar->hw->wiphy->max_sched_scan_plan_iterations = in __ath11k_mac_register()
9523 ar->hw->wiphy->features |= NL80211_FEATURE_ND_RANDOM_MAC_ADDR; in __ath11k_mac_register()
9528 ath11k_warn(ar->ab, "failed to init wow: %d\n", ret); in __ath11k_mac_register()
9533 ar->ab->wmi_ab.svc_map)) in __ath11k_mac_register()
9534 wiphy_ext_feature_set(ar->hw->wiphy, in __ath11k_mac_register()
9537 ar->hw->queues = ATH11K_HW_MAX_QUEUES; in __ath11k_mac_register()
9538 ar->hw->wiphy->tx_queue_len = ATH11K_QUEUE_LEN; in __ath11k_mac_register()
9539 ar->hw->offchannel_tx_hw_queue = ATH11K_HW_MAX_QUEUES - 1; in __ath11k_mac_register()
9540 ar->hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE; in __ath11k_mac_register()
9542 ar->hw->vif_data_size = sizeof(struct ath11k_vif); in __ath11k_mac_register()
9543 ar->hw->sta_data_size = sizeof(struct ath11k_sta); in __ath11k_mac_register()
9545 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); in __ath11k_mac_register()
9546 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_STA_TX_PWR); in __ath11k_mac_register()
9548 ar->ab->wmi_ab.svc_map)) { in __ath11k_mac_register()
9549 wiphy_ext_feature_set(ar->hw->wiphy, in __ath11k_mac_register()
9551 ieee80211_hw_set(ar->hw, DETECTS_COLOR_COLLISION); in __ath11k_mac_register()
9554 ar->hw->wiphy->cipher_suites = cipher_suites; in __ath11k_mac_register()
9555 ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); in __ath11k_mac_register()
9557 ar->hw->wiphy->iftype_ext_capab = ath11k_iftypes_ext_capa; in __ath11k_mac_register()
9558 ar->hw->wiphy->num_iftype_ext_capab = in __ath11k_mac_register()
9561 if (ar->supports_6ghz) { in __ath11k_mac_register()
9562 wiphy_ext_feature_set(ar->hw->wiphy, in __ath11k_mac_register()
9564 wiphy_ext_feature_set(ar->hw->wiphy, in __ath11k_mac_register()
9568 wiphy_ext_feature_set(ar->hw->wiphy, in __ath11k_mac_register()
9571 if (test_bit(WMI_TLV_SERVICE_RTT, ar->ab->wmi_ab.svc_map)) in __ath11k_mac_register()
9572 wiphy_ext_feature_set(ar->hw->wiphy, in __ath11k_mac_register()
9575 ar->hw->wiphy->mbssid_max_interfaces = TARGET_NUM_VDEVS(ab); in __ath11k_mac_register()
9576 ar->hw->wiphy->ema_max_profile_periodicity = TARGET_EMA_MAX_PROFILE_PERIOD; in __ath11k_mac_register()
9580 if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { in __ath11k_mac_register()
9581 ar->hw->netdev_features = NETIF_F_HW_CSUM; in __ath11k_mac_register()
9582 ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); in __ath11k_mac_register()
9583 ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT); in __ath11k_mac_register()
9586 if (test_bit(WMI_TLV_SERVICE_BIOS_SAR_SUPPORT, ar->ab->wmi_ab.svc_map) && in __ath11k_mac_register()
9587 ab->hw_params.bios_sar_capa) in __ath11k_mac_register()
9588 ar->hw->wiphy->sar_capa = ab->hw_params.bios_sar_capa; in __ath11k_mac_register()
9590 ret = ieee80211_register_hw(ar->hw); in __ath11k_mac_register()
9592 ath11k_err(ar->ab, "ieee80211 registration failed: %d\n", ret); in __ath11k_mac_register()
9596 if (!ab->hw_params.supports_monitor) in __ath11k_mac_register()
9599 * while. But that time is so short and in practise it make in __ath11k_mac_register()
9600 * a difference in real life. in __ath11k_mac_register()
9602 ar->hw->wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MONITOR); in __ath11k_mac_register()
9607 ath11k_err(ar->ab, "ath11k regd update failed: %d\n", ret); in __ath11k_mac_register()
9611 if (ab->hw_params.current_cc_support && ab->new_alpha2[0]) { in __ath11k_mac_register()
9614 memcpy(&set_current_param.alpha2, ab->new_alpha2, 2); in __ath11k_mac_register()
9615 memcpy(&ar->alpha2, ab->new_alpha2, 2); in __ath11k_mac_register()
9618 ath11k_warn(ar->ab, in __ath11k_mac_register()
9624 ath11k_err(ar->ab, "debugfs registration failed: %d\n", ret); in __ath11k_mac_register()
9631 ieee80211_unregister_hw(ar->hw); in __ath11k_mac_register()
9634 kfree(ar->hw->wiphy->iface_combinations[0].limits); in __ath11k_mac_register()
9635 kfree(ar->hw->wiphy->iface_combinations); in __ath11k_mac_register()
9638 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in __ath11k_mac_register()
9639 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in __ath11k_mac_register()
9640 kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels); in __ath11k_mac_register()
9643 SET_IEEE80211_DEV(ar->hw, NULL); in __ath11k_mac_register()
9655 if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) in ath11k_mac_register()
9658 /* Initialize channel counters frequency value in hertz */ in ath11k_mac_register()
9659 ab->cc_freq_hz = IPQ8074_CC_FREQ_HERTZ; in ath11k_mac_register()
9660 ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS(ab))) - 1; in ath11k_mac_register()
9666 device_get_mac_address(ab->dev, mac_addr); in ath11k_mac_register()
9668 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_register()
9669 pdev = &ab->pdevs[i]; in ath11k_mac_register()
9670 ar = pdev->ar; in ath11k_mac_register()
9671 if (ab->pdevs_macaddr_valid) { in ath11k_mac_register()
9672 ether_addr_copy(ar->mac_addr, pdev->mac_addr); in ath11k_mac_register()
9675 ether_addr_copy(ar->mac_addr, ab->mac_addr); in ath11k_mac_register()
9677 ether_addr_copy(ar->mac_addr, mac_addr); in ath11k_mac_register()
9678 ar->mac_addr[4] += i; in ath11k_mac_register()
9681 idr_init(&ar->txmgmt_idr); in ath11k_mac_register()
9682 spin_lock_init(&ar->txmgmt_idr_lock); in ath11k_mac_register()
9688 init_waitqueue_head(&ar->txmgmt_empty_waitq); in ath11k_mac_register()
9694 for (i = i - 1; i >= 0; i--) { in ath11k_mac_register()
9695 pdev = &ab->pdevs[i]; in ath11k_mac_register()
9696 ar = pdev->ar; in ath11k_mac_register()
9713 if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) in ath11k_mac_allocate()
9716 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_allocate()
9717 pdev = &ab->pdevs[i]; in ath11k_mac_allocate()
9721 ret = -ENOMEM; in ath11k_mac_allocate()
9725 ar = hw->priv; in ath11k_mac_allocate()
9726 ar->hw = hw; in ath11k_mac_allocate()
9727 ar->ab = ab; in ath11k_mac_allocate()
9728 ar->pdev = pdev; in ath11k_mac_allocate()
9729 ar->pdev_idx = i; in ath11k_mac_allocate()
9730 ar->lmac_id = ath11k_hw_get_mac_from_pdev_id(&ab->hw_params, i); in ath11k_mac_allocate()
9732 ar->wmi = &ab->wmi_ab.wmi[i]; in ath11k_mac_allocate()
9738 ar->cfg_tx_chainmask = pdev->cap.tx_chain_mask; in ath11k_mac_allocate()
9739 ar->cfg_rx_chainmask = pdev->cap.rx_chain_mask; in ath11k_mac_allocate()
9740 ar->num_tx_chains = get_num_chains(pdev->cap.tx_chain_mask); in ath11k_mac_allocate()
9741 ar->num_rx_chains = get_num_chains(pdev->cap.rx_chain_mask); in ath11k_mac_allocate()
9743 pdev->ar = ar; in ath11k_mac_allocate()
9744 spin_lock_init(&ar->data_lock); in ath11k_mac_allocate()
9745 INIT_LIST_HEAD(&ar->arvifs); in ath11k_mac_allocate()
9746 INIT_LIST_HEAD(&ar->ppdu_stats_info); in ath11k_mac_allocate()
9747 mutex_init(&ar->conf_mutex); in ath11k_mac_allocate()
9748 init_completion(&ar->vdev_setup_done); in ath11k_mac_allocate()
9749 init_completion(&ar->vdev_delete_done); in ath11k_mac_allocate()
9750 init_completion(&ar->peer_assoc_done); in ath11k_mac_allocate()
9751 init_completion(&ar->peer_delete_done); in ath11k_mac_allocate()
9752 init_completion(&ar->install_key_done); in ath11k_mac_allocate()
9753 init_completion(&ar->bss_survey_done); in ath11k_mac_allocate()
9754 init_completion(&ar->scan.started); in ath11k_mac_allocate()
9755 init_completion(&ar->scan.completed); in ath11k_mac_allocate()
9756 init_completion(&ar->scan.on_channel); in ath11k_mac_allocate()
9757 init_completion(&ar->thermal.wmi_sync); in ath11k_mac_allocate()
9759 INIT_DELAYED_WORK(&ar->scan.timeout, ath11k_scan_timeout_work); in ath11k_mac_allocate()
9760 INIT_WORK(&ar->regd_update_work, ath11k_regd_update_work); in ath11k_mac_allocate()
9762 INIT_WORK(&ar->wmi_mgmt_tx_work, ath11k_mgmt_over_wmi_tx_work); in ath11k_mac_allocate()
9763 skb_queue_head_init(&ar->wmi_mgmt_tx_queue); in ath11k_mac_allocate()
9765 clear_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags); in ath11k_mac_allocate()
9767 ar->monitor_vdev_id = -1; in ath11k_mac_allocate()
9768 clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); in ath11k_mac_allocate()
9769 ar->vdev_id_11d_scan = ATH11K_11D_INVALID_VDEV_ID; in ath11k_mac_allocate()
9770 init_completion(&ar->completed_11d_scan); in ath11k_mac_allocate()
9789 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_destroy()
9790 pdev = &ab->pdevs[i]; in ath11k_mac_destroy()
9791 ar = pdev->ar; in ath11k_mac_destroy()
9795 ath11k_fw_stats_free(&ar->fw_stats); in ath11k_mac_destroy()
9796 ieee80211_free_hw(ar->hw); in ath11k_mac_destroy()
9797 pdev->ar = NULL; in ath11k_mac_destroy()
9805 struct ath11k *ar = arvif->ar; in ath11k_mac_vif_set_keepalive()
9809 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vif_set_keepalive()
9811 if (arvif->vdev_type != WMI_VDEV_TYPE_STA) in ath11k_mac_vif_set_keepalive()
9814 if (!test_bit(WMI_TLV_SERVICE_STA_KEEP_ALIVE, ar->ab->wmi_ab.svc_map)) in ath11k_mac_vif_set_keepalive()
9817 arg.vdev_id = arvif->vdev_id; in ath11k_mac_vif_set_keepalive()
9824 ath11k_warn(ar->ab, "failed to set keepalive on vdev %i: %d\n", in ath11k_mac_vif_set_keepalive()
9825 arvif->vdev_id, ret); in ath11k_mac_vif_set_keepalive()