Lines Matching +full:assoc +full:- +full:select

1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
231 #define ath11k_a_rates_size (ARRAY_SIZE(ath11k_legacy_rates) - 4)
305 return -EINVAL; in ath11k_mac_hw_ratecode_to_legacy_rate()
326 for (i = 0; i < sband->n_bitrates; i++) in ath11k_mac_bitrate_to_idx()
327 if (sband->bitrates[i].bitrate == bitrate) in ath11k_mac_bitrate_to_idx()
338 for (nss = IEEE80211_HT_MCS_MASK_LEN - 1; nss >= 0; nss--) in ath11k_mac_max_ht_nss()
350 for (nss = NL80211_VHT_NSS_MAX - 1; nss >= 0; nss--) in ath11k_mac_max_vht_nss()
398 conf = rcu_dereference(vif->chanctx_conf); in ath11k_mac_vif_chan()
401 return -ENOENT; in ath11k_mac_vif_chan()
404 *def = conf->def; in ath11k_mac_vif_chan()
429 for (i = 0; i < sband->n_bitrates; i++) { in ath11k_mac_hw_rate_to_idx()
430 rate = &sband->bitrates[i]; in ath11k_mac_hw_rate_to_idx()
432 if (ath11k_mac_bitrate_is_cck(rate->bitrate) != cck) in ath11k_mac_hw_rate_to_idx()
435 if (rate->hw_value == hw_rate) in ath11k_mac_hw_rate_to_idx()
437 else if (rate->flags & IEEE80211_RATE_SHORT_PREAMBLE && in ath11k_mac_hw_rate_to_idx()
438 rate->hw_value_short == hw_rate) in ath11k_mac_hw_rate_to_idx()
455 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_get_arvif_iter()
457 if (arvif->vdev_id == arvif_iter->vdev_id) in ath11k_get_arvif_iter()
458 arvif_iter->arvif = arvif; in ath11k_get_arvif_iter()
470 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_get_arvif()
475 ath11k_warn(ar->ab, "No VIF found for vdev %d\n", vdev_id); in ath11k_mac_get_arvif()
489 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_get_arvif_by_vdev_id()
490 pdev = rcu_dereference(ab->pdevs_active[i]); in ath11k_mac_get_arvif_by_vdev_id()
491 if (pdev && pdev->ar) { in ath11k_mac_get_arvif_by_vdev_id()
492 arvif = ath11k_mac_get_arvif(pdev->ar, vdev_id); in ath11k_mac_get_arvif_by_vdev_id()
506 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_get_ar_by_vdev_id()
507 pdev = rcu_dereference(ab->pdevs_active[i]); in ath11k_mac_get_ar_by_vdev_id()
508 if (pdev && pdev->ar) { in ath11k_mac_get_ar_by_vdev_id()
509 if (pdev->ar->allocated_vdev_map & (1LL << vdev_id)) in ath11k_mac_get_ar_by_vdev_id()
510 return pdev->ar; in ath11k_mac_get_ar_by_vdev_id()
522 if (ab->hw_params.single_pdev_only) { in ath11k_mac_get_ar_by_pdev_id()
523 pdev = rcu_dereference(ab->pdevs_active[0]); in ath11k_mac_get_ar_by_pdev_id()
524 return pdev ? pdev->ar : NULL; in ath11k_mac_get_ar_by_pdev_id()
527 if (WARN_ON(pdev_id > ab->num_radios)) in ath11k_mac_get_ar_by_pdev_id()
530 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_get_ar_by_pdev_id()
531 pdev = rcu_dereference(ab->pdevs_active[i]); in ath11k_mac_get_ar_by_pdev_id()
533 if (pdev && pdev->pdev_id == pdev_id) in ath11k_mac_get_ar_by_pdev_id()
534 return (pdev->ar ? pdev->ar : NULL); in ath11k_mac_get_ar_by_pdev_id()
547 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_get_ar_vdev_stop_status()
548 pdev = rcu_dereference(ab->pdevs_active[i]); in ath11k_mac_get_ar_vdev_stop_status()
549 if (pdev && pdev->ar) { in ath11k_mac_get_ar_vdev_stop_status()
550 ar = pdev->ar; in ath11k_mac_get_ar_vdev_stop_status()
552 spin_lock_bh(&ar->data_lock); in ath11k_mac_get_ar_vdev_stop_status()
553 if (ar->vdev_stop_status.stop_in_progress && in ath11k_mac_get_ar_vdev_stop_status()
554 ar->vdev_stop_status.vdev_id == vdev_id) { in ath11k_mac_get_ar_vdev_stop_status()
555 ar->vdev_stop_status.stop_in_progress = false; in ath11k_mac_get_ar_vdev_stop_status()
556 spin_unlock_bh(&ar->data_lock); in ath11k_mac_get_ar_vdev_stop_status()
559 spin_unlock_bh(&ar->data_lock); in ath11k_mac_get_ar_vdev_stop_status()
567 struct ath11k_base *ab = ar->ab; in ath11k_pdev_caps_update()
569 ar->max_tx_power = ab->target_caps.hw_max_tx_power; in ath11k_pdev_caps_update()
571 /* FIXME Set min_tx_power to ab->target_caps.hw_min_tx_power. in ath11k_pdev_caps_update()
573 * we can set ar->min_tx_power to 0 currently until in ath11k_pdev_caps_update()
576 ar->min_tx_power = 0; in ath11k_pdev_caps_update()
578 ar->txpower_limit_2g = ar->max_tx_power; in ath11k_pdev_caps_update()
579 ar->txpower_limit_5g = ar->max_tx_power; in ath11k_pdev_caps_update()
580 ar->txpower_scale = WMI_HOST_TP_SCALE_MAX; in ath11k_pdev_caps_update()
585 struct ath11k_pdev *pdev = ar->pdev; in ath11k_mac_txpower_recalc()
587 int ret, txpower = -1; in ath11k_mac_txpower_recalc()
590 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_txpower_recalc()
592 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_mac_txpower_recalc()
593 if (arvif->txpower <= 0) in ath11k_mac_txpower_recalc()
596 if (txpower == -1) in ath11k_mac_txpower_recalc()
597 txpower = arvif->txpower; in ath11k_mac_txpower_recalc()
599 txpower = min(txpower, arvif->txpower); in ath11k_mac_txpower_recalc()
602 if (txpower == -1) in ath11k_mac_txpower_recalc()
606 txpower = min_t(u32, max_t(u32, ar->min_tx_power, txpower), in ath11k_mac_txpower_recalc()
607 ar->max_tx_power) * 2; in ath11k_mac_txpower_recalc()
609 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "txpower to set in hw %d\n", in ath11k_mac_txpower_recalc()
612 if ((pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) && in ath11k_mac_txpower_recalc()
613 ar->txpower_limit_2g != txpower) { in ath11k_mac_txpower_recalc()
616 txpower, ar->pdev->pdev_id); in ath11k_mac_txpower_recalc()
619 ar->txpower_limit_2g = txpower; in ath11k_mac_txpower_recalc()
622 if ((pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) && in ath11k_mac_txpower_recalc()
623 ar->txpower_limit_5g != txpower) { in ath11k_mac_txpower_recalc()
626 txpower, ar->pdev->pdev_id); in ath11k_mac_txpower_recalc()
629 ar->txpower_limit_5g = txpower; in ath11k_mac_txpower_recalc()
635 ath11k_warn(ar->ab, "failed to recalc txpower limit %d using pdev param %d: %d\n", in ath11k_mac_txpower_recalc()
642 struct ath11k *ar = arvif->ar; in ath11k_recalc_rtscts_prot()
646 lockdep_assert_held(&ar->conf_mutex); in ath11k_recalc_rtscts_prot()
656 if (arvif->num_legacy_stations > 0) in ath11k_recalc_rtscts_prot()
662 if (arvif->rtscts_prot_mode == rts_cts) in ath11k_recalc_rtscts_prot()
665 arvif->rtscts_prot_mode = rts_cts; in ath11k_recalc_rtscts_prot()
667 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vdev %d recalc rts/cts prot %d\n", in ath11k_recalc_rtscts_prot()
668 arvif->vdev_id, rts_cts); in ath11k_recalc_rtscts_prot()
670 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_recalc_rtscts_prot()
673 ath11k_warn(ar->ab, "failed to recalculate rts/cts prot for vdev %d: %d\n", in ath11k_recalc_rtscts_prot()
674 arvif->vdev_id, ret); in ath11k_recalc_rtscts_prot()
681 struct ath11k *ar = arvif->ar; in ath11k_mac_set_kickout()
687 ar->pdev->pdev_id); in ath11k_mac_set_kickout()
689 ath11k_warn(ar->ab, "failed to set kickout threshold on vdev %i: %d\n", in ath11k_mac_set_kickout()
690 arvif->vdev_id, ret); in ath11k_mac_set_kickout()
695 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, in ath11k_mac_set_kickout()
698 ath11k_warn(ar->ab, "failed to set keepalive minimum idle time on vdev %i: %d\n", in ath11k_mac_set_kickout()
699 arvif->vdev_id, ret); in ath11k_mac_set_kickout()
704 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, in ath11k_mac_set_kickout()
707 ath11k_warn(ar->ab, "failed to set keepalive maximum idle time on vdev %i: %d\n", in ath11k_mac_set_kickout()
708 arvif->vdev_id, ret); in ath11k_mac_set_kickout()
713 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, in ath11k_mac_set_kickout()
716 ath11k_warn(ar->ab, "failed to set keepalive maximum unresponsive time on vdev %i: %d\n", in ath11k_mac_set_kickout()
717 arvif->vdev_id, ret); in ath11k_mac_set_kickout()
727 struct ath11k_base *ab = ar->ab; in ath11k_mac_peer_cleanup_all()
729 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_peer_cleanup_all()
731 spin_lock_bh(&ab->base_lock); in ath11k_mac_peer_cleanup_all()
732 list_for_each_entry_safe(peer, tmp, &ab->peers, list) { in ath11k_mac_peer_cleanup_all()
734 list_del(&peer->list); in ath11k_mac_peer_cleanup_all()
737 spin_unlock_bh(&ab->base_lock); in ath11k_mac_peer_cleanup_all()
739 ar->num_peers = 0; in ath11k_mac_peer_cleanup_all()
740 ar->num_stations = 0; in ath11k_mac_peer_cleanup_all()
747 ret = ath11k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr); in ath11k_monitor_vdev_up()
749 ath11k_warn(ar->ab, "failed to put up monitor vdev %i: %d\n", in ath11k_monitor_vdev_up()
754 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac monitor vdev %i started\n", in ath11k_monitor_vdev_up()
771 struct ath11k *ar = arvif->ar; in ath11k_mac_setup_bcn_tmpl()
772 struct ath11k_base *ab = ar->ab; in ath11k_mac_setup_bcn_tmpl()
773 struct ieee80211_hw *hw = ar->hw; in ath11k_mac_setup_bcn_tmpl()
774 struct ieee80211_vif *vif = arvif->vif; in ath11k_mac_setup_bcn_tmpl()
781 if (arvif->vdev_type != WMI_VDEV_TYPE_AP) in ath11k_mac_setup_bcn_tmpl()
787 return -EPERM; in ath11k_mac_setup_bcn_tmpl()
790 ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn); in ath11k_mac_setup_bcn_tmpl()
791 ies += sizeof(mgmt->u.beacon); in ath11k_mac_setup_bcn_tmpl()
793 if (cfg80211_find_ie(WLAN_EID_RSN, ies, (skb_tail_pointer(bcn) - ies))) in ath11k_mac_setup_bcn_tmpl()
794 arvif->rsnie_present = true; in ath11k_mac_setup_bcn_tmpl()
798 ies, (skb_tail_pointer(bcn) - ies))) in ath11k_mac_setup_bcn_tmpl()
799 arvif->wpaie_present = true; in ath11k_mac_setup_bcn_tmpl()
801 ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); in ath11k_mac_setup_bcn_tmpl()
815 struct ath11k *ar = arvif->ar; in ath11k_control_beaconing()
818 lockdep_assert_held(&arvif->ar->conf_mutex); in ath11k_control_beaconing()
820 if (!info->enable_beacon) { in ath11k_control_beaconing()
821 ret = ath11k_wmi_vdev_down(ar, arvif->vdev_id); in ath11k_control_beaconing()
823 ath11k_warn(ar->ab, "failed to down vdev_id %i: %d\n", in ath11k_control_beaconing()
824 arvif->vdev_id, ret); in ath11k_control_beaconing()
826 arvif->is_up = false; in ath11k_control_beaconing()
833 ath11k_warn(ar->ab, "failed to update bcn tmpl during vdev up: %d\n", in ath11k_control_beaconing()
838 arvif->tx_seq_no = 0x1000; in ath11k_control_beaconing()
840 arvif->aid = 0; in ath11k_control_beaconing()
842 ether_addr_copy(arvif->bssid, info->bssid); in ath11k_control_beaconing()
844 ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath11k_control_beaconing()
845 arvif->bssid); in ath11k_control_beaconing()
847 ath11k_warn(ar->ab, "failed to bring up vdev %d: %i\n", in ath11k_control_beaconing()
848 arvif->vdev_id, ret); in ath11k_control_beaconing()
852 arvif->is_up = true; in ath11k_control_beaconing()
854 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vdev %d up\n", arvif->vdev_id); in ath11k_control_beaconing()
862 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_peer_assoc_h_basic()
865 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_basic()
867 if (vif->type == NL80211_IFTYPE_STATION) in ath11k_peer_assoc_h_basic()
868 aid = vif->bss_conf.aid; in ath11k_peer_assoc_h_basic()
870 aid = sta->aid; in ath11k_peer_assoc_h_basic()
872 ether_addr_copy(arg->peer_mac, sta->addr); in ath11k_peer_assoc_h_basic()
873 arg->vdev_id = arvif->vdev_id; in ath11k_peer_assoc_h_basic()
874 arg->peer_associd = aid; in ath11k_peer_assoc_h_basic()
875 arg->auth_flag = true; in ath11k_peer_assoc_h_basic()
877 arg->peer_listen_intval = ar->hw->conf.listen_interval; in ath11k_peer_assoc_h_basic()
878 arg->peer_nss = 1; in ath11k_peer_assoc_h_basic()
879 arg->peer_caps = vif->bss_conf.assoc_capability; in ath11k_peer_assoc_h_basic()
887 struct ieee80211_bss_conf *info = &vif->bss_conf; in ath11k_peer_assoc_h_crypto()
890 struct ath11k_vif *arvif = (struct ath11k_vif *)vif->drv_priv; in ath11k_peer_assoc_h_crypto()
894 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_crypto()
899 bss = cfg80211_get_bss(ar->hw->wiphy, def.chan, info->bssid, NULL, 0, in ath11k_peer_assoc_h_crypto()
902 if (arvif->rsnie_present || arvif->wpaie_present) { in ath11k_peer_assoc_h_crypto()
903 arg->need_ptk_4_way = true; in ath11k_peer_assoc_h_crypto()
904 if (arvif->wpaie_present) in ath11k_peer_assoc_h_crypto()
905 arg->need_gtk_2_way = true; in ath11k_peer_assoc_h_crypto()
912 ies = rcu_dereference(bss->ies); in ath11k_peer_assoc_h_crypto()
916 ies->data, in ath11k_peer_assoc_h_crypto()
917 ies->len); in ath11k_peer_assoc_h_crypto()
919 cfg80211_put_bss(ar->hw->wiphy, bss); in ath11k_peer_assoc_h_crypto()
924 ath11k_dbg(ar->ab, ATH11K_DBG_WMI, in ath11k_peer_assoc_h_crypto()
926 arg->need_ptk_4_way = true; in ath11k_peer_assoc_h_crypto()
930 ath11k_dbg(ar->ab, ATH11K_DBG_WMI, in ath11k_peer_assoc_h_crypto()
932 arg->need_gtk_2_way = true; in ath11k_peer_assoc_h_crypto()
935 if (sta->mfp) { in ath11k_peer_assoc_h_crypto()
937 arg->is_pmf_enabled = true; in ath11k_peer_assoc_h_crypto()
940 /* TODO: safe_mode_enabled (bypass 4-way handshake) flag req? */ in ath11k_peer_assoc_h_crypto()
948 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_peer_assoc_h_rates()
949 struct wmi_rate_set_arg *rateset = &arg->peer_legacy_rates; in ath11k_peer_assoc_h_rates()
958 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_rates()
963 band = def.chan->band; in ath11k_peer_assoc_h_rates()
964 sband = ar->hw->wiphy->bands[band]; in ath11k_peer_assoc_h_rates()
965 ratemask = sta->supp_rates[band]; in ath11k_peer_assoc_h_rates()
966 ratemask &= arvif->bitrate_mask.control[band].legacy; in ath11k_peer_assoc_h_rates()
967 rates = sband->bitrates; in ath11k_peer_assoc_h_rates()
969 rateset->num_rates = 0; in ath11k_peer_assoc_h_rates()
975 rate = ath11k_mac_bitrate_to_rate(rates->bitrate); in ath11k_peer_assoc_h_rates()
976 rateset->rates[rateset->num_rates] = rate; in ath11k_peer_assoc_h_rates()
977 rateset->num_rates++; in ath11k_peer_assoc_h_rates()
1010 const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; in ath11k_peer_assoc_h_ht()
1011 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_peer_assoc_h_ht()
1019 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_h_ht()
1024 if (!ht_cap->ht_supported) in ath11k_peer_assoc_h_ht()
1027 band = def.chan->band; in ath11k_peer_assoc_h_ht()
1028 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath11k_peer_assoc_h_ht()
1033 arg->ht_flag = true; in ath11k_peer_assoc_h_ht()
1035 arg->peer_max_mpdu = (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + in ath11k_peer_assoc_h_ht()
1036 ht_cap->ampdu_factor)) - 1; in ath11k_peer_assoc_h_ht()
1038 arg->peer_mpdu_density = in ath11k_peer_assoc_h_ht()
1039 ath11k_parse_mpdudensity(ht_cap->ampdu_density); in ath11k_peer_assoc_h_ht()
1041 arg->peer_ht_caps = ht_cap->cap; in ath11k_peer_assoc_h_ht()
1042 arg->peer_rate_caps |= WMI_HOST_RC_HT_FLAG; in ath11k_peer_assoc_h_ht()
1044 if (ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING) in ath11k_peer_assoc_h_ht()
1045 arg->ldpc_flag = true; in ath11k_peer_assoc_h_ht()
1047 if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) { in ath11k_peer_assoc_h_ht()
1048 arg->bw_40 = true; in ath11k_peer_assoc_h_ht()
1049 arg->peer_rate_caps |= WMI_HOST_RC_CW40_FLAG; in ath11k_peer_assoc_h_ht()
1052 if (arvif->bitrate_mask.control[band].gi != NL80211_TXRATE_FORCE_LGI) { in ath11k_peer_assoc_h_ht()
1053 if (ht_cap->cap & (IEEE80211_HT_CAP_SGI_20 | in ath11k_peer_assoc_h_ht()
1055 arg->peer_rate_caps |= WMI_HOST_RC_SGI_FLAG; in ath11k_peer_assoc_h_ht()
1058 if (ht_cap->cap & IEEE80211_HT_CAP_TX_STBC) { in ath11k_peer_assoc_h_ht()
1059 arg->peer_rate_caps |= WMI_HOST_RC_TX_STBC_FLAG; in ath11k_peer_assoc_h_ht()
1060 arg->stbc_flag = true; in ath11k_peer_assoc_h_ht()
1063 if (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC) { in ath11k_peer_assoc_h_ht()
1064 stbc = ht_cap->cap & IEEE80211_HT_CAP_RX_STBC; in ath11k_peer_assoc_h_ht()
1067 arg->peer_rate_caps |= stbc; in ath11k_peer_assoc_h_ht()
1068 arg->stbc_flag = true; in ath11k_peer_assoc_h_ht()
1071 if (ht_cap->mcs.rx_mask[1] && ht_cap->mcs.rx_mask[2]) in ath11k_peer_assoc_h_ht()
1072 arg->peer_rate_caps |= WMI_HOST_RC_TS_FLAG; in ath11k_peer_assoc_h_ht()
1073 else if (ht_cap->mcs.rx_mask[1]) in ath11k_peer_assoc_h_ht()
1074 arg->peer_rate_caps |= WMI_HOST_RC_DS_FLAG; in ath11k_peer_assoc_h_ht()
1077 if ((ht_cap->mcs.rx_mask[i / 8] & BIT(i % 8)) && in ath11k_peer_assoc_h_ht()
1080 arg->peer_ht_rates.rates[n++] = i; in ath11k_peer_assoc_h_ht()
1083 /* This is a workaround for HT-enabled STAs which break the spec in ath11k_peer_assoc_h_ht()
1092 arg->peer_ht_rates.num_rates = 8; in ath11k_peer_assoc_h_ht()
1093 for (i = 0; i < arg->peer_ht_rates.num_rates; i++) in ath11k_peer_assoc_h_ht()
1094 arg->peer_ht_rates.rates[i] = i; in ath11k_peer_assoc_h_ht()
1096 arg->peer_ht_rates.num_rates = n; in ath11k_peer_assoc_h_ht()
1097 arg->peer_nss = min(sta->rx_nss, max_nss); in ath11k_peer_assoc_h_ht()
1100 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac ht peer %pM mcs cnt %d nss %d\n", in ath11k_peer_assoc_h_ht()
1101 arg->peer_mac, in ath11k_peer_assoc_h_ht()
1102 arg->peer_ht_rates.num_rates, in ath11k_peer_assoc_h_ht()
1103 arg->peer_nss); in ath11k_peer_assoc_h_ht()
1109 case IEEE80211_VHT_MCS_SUPPORT_0_7: return BIT(8) - 1; in ath11k_mac_get_max_vht_mcs_map()
1110 case IEEE80211_VHT_MCS_SUPPORT_0_8: return BIT(9) - 1; in ath11k_mac_get_max_vht_mcs_map()
1111 case IEEE80211_VHT_MCS_SUPPORT_0_9: return BIT(10) - 1; in ath11k_mac_get_max_vht_mcs_map()
1130 idx_limit = fls(mcs_map) - 1; in ath11k_peer_assoc_h_vht_limit()
1132 idx_limit = -1; in ath11k_peer_assoc_h_vht_limit()
1154 case -1: in ath11k_peer_assoc_h_vht_limit()
1171 const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; in ath11k_peer_assoc_h_vht()
1172 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_peer_assoc_h_vht()
1183 if (!vht_cap->vht_supported) in ath11k_peer_assoc_h_vht()
1186 band = def.chan->band; in ath11k_peer_assoc_h_vht()
1187 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath11k_peer_assoc_h_vht()
1192 arg->vht_flag = true; in ath11k_peer_assoc_h_vht()
1195 arg->vht_capable = true; in ath11k_peer_assoc_h_vht()
1197 if (def.chan->band == NL80211_BAND_2GHZ) in ath11k_peer_assoc_h_vht()
1198 arg->vht_ng_flag = true; in ath11k_peer_assoc_h_vht()
1200 arg->peer_vht_caps = vht_cap->cap; in ath11k_peer_assoc_h_vht()
1202 ampdu_factor = (vht_cap->cap & in ath11k_peer_assoc_h_vht()
1206 /* Workaround: Some Netgear/Linksys 11ac APs set Rx A-MPDU factor to in ath11k_peer_assoc_h_vht()
1208 * arg->peer_max_mpdu at this point contains HT max_mpdu so keep in ath11k_peer_assoc_h_vht()
1211 arg->peer_max_mpdu = max(arg->peer_max_mpdu, in ath11k_peer_assoc_h_vht()
1213 ampdu_factor)) - 1); in ath11k_peer_assoc_h_vht()
1215 if (sta->bandwidth == IEEE80211_STA_RX_BW_80) in ath11k_peer_assoc_h_vht()
1216 arg->bw_80 = true; in ath11k_peer_assoc_h_vht()
1218 if (sta->bandwidth == IEEE80211_STA_RX_BW_160) in ath11k_peer_assoc_h_vht()
1219 arg->bw_160 = true; in ath11k_peer_assoc_h_vht()
1225 vht_mcs = __le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map) >> in ath11k_peer_assoc_h_vht()
1232 arg->peer_nss = min(sta->rx_nss, max_nss); in ath11k_peer_assoc_h_vht()
1233 arg->rx_max_rate = __le16_to_cpu(vht_cap->vht_mcs.rx_highest); in ath11k_peer_assoc_h_vht()
1234 arg->rx_mcs_set = __le16_to_cpu(vht_cap->vht_mcs.rx_mcs_map); in ath11k_peer_assoc_h_vht()
1235 arg->tx_max_rate = __le16_to_cpu(vht_cap->vht_mcs.tx_highest); in ath11k_peer_assoc_h_vht()
1236 arg->tx_mcs_set = ath11k_peer_assoc_h_vht_limit( in ath11k_peer_assoc_h_vht()
1237 __le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); in ath11k_peer_assoc_h_vht()
1243 arg->tx_mcs_set &= ~IEEE80211_VHT_MCS_SUPPORT_0_11_MASK; in ath11k_peer_assoc_h_vht()
1244 arg->tx_mcs_set |= IEEE80211_DISABLE_VHT_MCS_SUPPORT_0_11; in ath11k_peer_assoc_h_vht()
1246 if ((arg->tx_mcs_set & IEEE80211_VHT_MCS_NOT_SUPPORTED) == in ath11k_peer_assoc_h_vht()
1248 arg->peer_vht_caps &= ~IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; in ath11k_peer_assoc_h_vht()
1251 arg->tx_max_mcs_nss = 0xFF; in ath11k_peer_assoc_h_vht()
1253 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vht peer %pM max_mpdu %d flags 0x%x\n", in ath11k_peer_assoc_h_vht()
1254 sta->addr, arg->peer_max_mpdu, arg->peer_flags); in ath11k_peer_assoc_h_vht()
1264 const struct ieee80211_sta_he_cap *he_cap = &sta->he_cap; in ath11k_peer_assoc_h_he()
1268 if (!he_cap->has_he) in ath11k_peer_assoc_h_he()
1271 arg->he_flag = true; in ath11k_peer_assoc_h_he()
1273 memcpy(&arg->peer_he_cap_macinfo, he_cap->he_cap_elem.mac_cap_info, in ath11k_peer_assoc_h_he()
1274 sizeof(arg->peer_he_cap_macinfo)); in ath11k_peer_assoc_h_he()
1275 memcpy(&arg->peer_he_cap_phyinfo, he_cap->he_cap_elem.phy_cap_info, in ath11k_peer_assoc_h_he()
1276 sizeof(arg->peer_he_cap_phyinfo)); in ath11k_peer_assoc_h_he()
1277 arg->peer_he_ops = vif->bss_conf.he_oper.params; in ath11k_peer_assoc_h_he()
1280 arg->peer_he_ops &= 0xffffff; in ath11k_peer_assoc_h_he()
1283 * in HE cap is zero, use the arg->peer_max_mpdu as calculated while parsing in ath11k_peer_assoc_h_he()
1286 * For non-zero value of Max AMPDU Extponent Extension in HE MAC caps, in ath11k_peer_assoc_h_he()
1287 * if a HE STA sends VHT cap and HE cap IE in assoc request then, use in ath11k_peer_assoc_h_he()
1289 * If a HE STA that does not send VHT cap, but HE and HT cap in assoc in ath11k_peer_assoc_h_he()
1293 ampdu_factor = (he_cap->he_cap_elem.mac_cap_info[3] & in ath11k_peer_assoc_h_he()
1298 if (sta->vht_cap.vht_supported) in ath11k_peer_assoc_h_he()
1299 arg->peer_max_mpdu = (1 << (IEEE80211_HE_VHT_MAX_AMPDU_FACTOR + in ath11k_peer_assoc_h_he()
1300 ampdu_factor)) - 1; in ath11k_peer_assoc_h_he()
1301 else if (sta->ht_cap.ht_supported) in ath11k_peer_assoc_h_he()
1302 arg->peer_max_mpdu = (1 << (IEEE80211_HE_HT_MAX_AMPDU_FACTOR + in ath11k_peer_assoc_h_he()
1303 ampdu_factor)) - 1; in ath11k_peer_assoc_h_he()
1306 if (he_cap->he_cap_elem.phy_cap_info[6] & in ath11k_peer_assoc_h_he()
1311 arg->peer_ppet.numss_m1 = he_cap->ppe_thres[0] & in ath11k_peer_assoc_h_he()
1313 arg->peer_ppet.ru_bit_mask = in ath11k_peer_assoc_h_he()
1314 (he_cap->ppe_thres[0] & in ath11k_peer_assoc_h_he()
1318 for (nss = 0; nss <= arg->peer_ppet.numss_m1; nss++) { in ath11k_peer_assoc_h_he()
1323 if ((arg->peer_ppet.ru_bit_mask & BIT(ru)) == 0) in ath11k_peer_assoc_h_he()
1327 val |= ((he_cap->ppe_thres[bit / 8] >> in ath11k_peer_assoc_h_he()
1331 arg->peer_ppet.ppet16_ppet8_ru3_ru0[nss] |= in ath11k_peer_assoc_h_he()
1337 if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_RES) in ath11k_peer_assoc_h_he()
1338 arg->twt_responder = true; in ath11k_peer_assoc_h_he()
1339 if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_REQ) in ath11k_peer_assoc_h_he()
1340 arg->twt_requester = true; in ath11k_peer_assoc_h_he()
1342 switch (sta->bandwidth) { in ath11k_peer_assoc_h_he()
1344 if (he_cap->he_cap_elem.phy_cap_info[0] & in ath11k_peer_assoc_h_he()
1346 v = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80p80); in ath11k_peer_assoc_h_he()
1347 arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80_80] = v; in ath11k_peer_assoc_h_he()
1349 v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_80p80); in ath11k_peer_assoc_h_he()
1350 arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80_80] = v; in ath11k_peer_assoc_h_he()
1352 arg->peer_he_mcs_count++; in ath11k_peer_assoc_h_he()
1354 v = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_160); in ath11k_peer_assoc_h_he()
1355 arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_160] = v; in ath11k_peer_assoc_h_he()
1357 v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_160); in ath11k_peer_assoc_h_he()
1358 arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_160] = v; in ath11k_peer_assoc_h_he()
1360 arg->peer_he_mcs_count++; in ath11k_peer_assoc_h_he()
1364 v = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80); in ath11k_peer_assoc_h_he()
1365 arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] = v; in ath11k_peer_assoc_h_he()
1367 v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_80); in ath11k_peer_assoc_h_he()
1368 arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] = v; in ath11k_peer_assoc_h_he()
1370 arg->peer_he_mcs_count++; in ath11k_peer_assoc_h_he()
1378 const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; in ath11k_peer_assoc_h_smps()
1381 if (!ht_cap->ht_supported) in ath11k_peer_assoc_h_smps()
1384 smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS; in ath11k_peer_assoc_h_smps()
1389 arg->static_mimops_flag = true; in ath11k_peer_assoc_h_smps()
1392 arg->dynamic_mimops_flag = true; in ath11k_peer_assoc_h_smps()
1395 arg->spatial_mux_flag = true; in ath11k_peer_assoc_h_smps()
1407 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_peer_assoc_h_qos()
1409 switch (arvif->vdev_type) { in ath11k_peer_assoc_h_qos()
1411 if (sta->wme) { in ath11k_peer_assoc_h_qos()
1413 arg->is_wme_set = true; in ath11k_peer_assoc_h_qos()
1414 arg->qos_flag = true; in ath11k_peer_assoc_h_qos()
1417 if (sta->wme && sta->uapsd_queues) { in ath11k_peer_assoc_h_qos()
1419 arg->is_wme_set = true; in ath11k_peer_assoc_h_qos()
1420 arg->apsd_flag = true; in ath11k_peer_assoc_h_qos()
1421 arg->peer_rate_caps |= WMI_HOST_RC_UAPSD_FLAG; in ath11k_peer_assoc_h_qos()
1425 if (sta->wme) { in ath11k_peer_assoc_h_qos()
1426 arg->is_wme_set = true; in ath11k_peer_assoc_h_qos()
1427 arg->qos_flag = true; in ath11k_peer_assoc_h_qos()
1434 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac peer %pM qos %d\n", in ath11k_peer_assoc_h_qos()
1435 sta->addr, arg->qos_flag); in ath11k_peer_assoc_h_qos()
1447 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_qos_ap()
1449 params.vdev_id = arvif->vdev_id; in ath11k_peer_assoc_qos_ap()
1451 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac uapsd_queues 0x%x max_sp %d\n", in ath11k_peer_assoc_qos_ap()
1452 sta->uapsd_queues, sta->max_sp); in ath11k_peer_assoc_qos_ap()
1455 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) in ath11k_peer_assoc_qos_ap()
1458 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VI) in ath11k_peer_assoc_qos_ap()
1461 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BK) in ath11k_peer_assoc_qos_ap()
1464 if (sta->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BE) in ath11k_peer_assoc_qos_ap()
1469 if (sta->max_sp < MAX_WMI_AP_PS_PEER_PARAM_MAX_SP) in ath11k_peer_assoc_qos_ap()
1470 max_sp = sta->max_sp; in ath11k_peer_assoc_qos_ap()
1474 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, &params); in ath11k_peer_assoc_qos_ap()
1480 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, &params); in ath11k_peer_assoc_qos_ap()
1487 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, &params); in ath11k_peer_assoc_qos_ap()
1493 ret = ath11k_wmi_send_set_ap_ps_param_cmd(ar, sta->addr, &params); in ath11k_peer_assoc_qos_ap()
1500 ath11k_warn(ar->ab, "failed to set ap ps peer param %d for vdev %i: %d\n", in ath11k_peer_assoc_qos_ap()
1501 params.param, arvif->vdev_id, ret); in ath11k_peer_assoc_qos_ap()
1507 return sta->supp_rates[NL80211_BAND_2GHZ] >> in ath11k_mac_sta_has_ofdm_only()
1514 if (sta->bandwidth == IEEE80211_STA_RX_BW_160) { in ath11k_mac_get_phymode_vht()
1515 switch (sta->vht_cap.cap & in ath11k_mac_get_phymode_vht()
1527 if (sta->bandwidth == IEEE80211_STA_RX_BW_80) in ath11k_mac_get_phymode_vht()
1530 if (sta->bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_mac_get_phymode_vht()
1533 if (sta->bandwidth == IEEE80211_STA_RX_BW_20) in ath11k_mac_get_phymode_vht()
1542 if (sta->bandwidth == IEEE80211_STA_RX_BW_160) { in ath11k_mac_get_phymode_he()
1543 if (sta->he_cap.he_cap_elem.phy_cap_info[0] & in ath11k_mac_get_phymode_he()
1546 else if (sta->he_cap.he_cap_elem.phy_cap_info[0] & in ath11k_mac_get_phymode_he()
1553 if (sta->bandwidth == IEEE80211_STA_RX_BW_80) in ath11k_mac_get_phymode_he()
1556 if (sta->bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_mac_get_phymode_he()
1559 if (sta->bandwidth == IEEE80211_STA_RX_BW_20) in ath11k_mac_get_phymode_he()
1570 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_peer_assoc_h_phymode()
1580 band = def.chan->band; in ath11k_peer_assoc_h_phymode()
1581 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath11k_peer_assoc_h_phymode()
1582 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath11k_peer_assoc_h_phymode()
1586 if (sta->he_cap.has_he) { in ath11k_peer_assoc_h_phymode()
1587 if (sta->bandwidth == IEEE80211_STA_RX_BW_80) in ath11k_peer_assoc_h_phymode()
1589 else if (sta->bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_peer_assoc_h_phymode()
1593 } else if (sta->vht_cap.vht_supported && in ath11k_peer_assoc_h_phymode()
1595 if (sta->bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_peer_assoc_h_phymode()
1599 } else if (sta->ht_cap.ht_supported && in ath11k_peer_assoc_h_phymode()
1601 if (sta->bandwidth == IEEE80211_STA_RX_BW_40) in ath11k_peer_assoc_h_phymode()
1614 if (sta->he_cap.has_he) { in ath11k_peer_assoc_h_phymode()
1616 } else if (sta->vht_cap.vht_supported && in ath11k_peer_assoc_h_phymode()
1619 } else if (sta->ht_cap.ht_supported && in ath11k_peer_assoc_h_phymode()
1621 if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) in ath11k_peer_assoc_h_phymode()
1633 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac peer %pM phymode %s\n", in ath11k_peer_assoc_h_phymode()
1634 sta->addr, ath11k_wmi_phymode_str(phymode)); in ath11k_peer_assoc_h_phymode()
1636 arg->peer_phymode = phymode; in ath11k_peer_assoc_h_phymode()
1646 lockdep_assert_held(&ar->conf_mutex); in ath11k_peer_assoc_prepare()
1650 reinit_completion(&ar->peer_assoc_done); in ath11k_peer_assoc_prepare()
1652 arg->peer_new_assoc = !reassoc; in ath11k_peer_assoc_prepare()
1672 if (!ht_cap->ht_supported) in ath11k_setup_peer_smps()
1675 smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS; in ath11k_setup_peer_smps()
1679 return -EINVAL; in ath11k_setup_peer_smps()
1681 return ath11k_wmi_set_peer_param(ar, addr, arvif->vdev_id, in ath11k_setup_peer_smps()
1690 struct ath11k *ar = hw->priv; in ath11k_bss_assoc()
1691 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_bss_assoc()
1696 lockdep_assert_held(&ar->conf_mutex); in ath11k_bss_assoc()
1698 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vdev %i assoc bssid %pM aid %d\n", in ath11k_bss_assoc()
1699 arvif->vdev_id, arvif->bssid, arvif->aid); in ath11k_bss_assoc()
1703 ap_sta = ieee80211_find_sta(vif, bss_conf->bssid); in ath11k_bss_assoc()
1705 ath11k_warn(ar->ab, "failed to find station entry for bss %pM vdev %i\n", in ath11k_bss_assoc()
1706 bss_conf->bssid, arvif->vdev_id); in ath11k_bss_assoc()
1717 ath11k_warn(ar->ab, "failed to run peer assoc for %pM vdev %i: %d\n", in ath11k_bss_assoc()
1718 bss_conf->bssid, arvif->vdev_id, ret); in ath11k_bss_assoc()
1722 if (!wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) { in ath11k_bss_assoc()
1723 ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n", in ath11k_bss_assoc()
1724 bss_conf->bssid, arvif->vdev_id); in ath11k_bss_assoc()
1728 ret = ath11k_setup_peer_smps(ar, arvif, bss_conf->bssid, in ath11k_bss_assoc()
1729 &ap_sta->ht_cap); in ath11k_bss_assoc()
1731 ath11k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n", in ath11k_bss_assoc()
1732 arvif->vdev_id, ret); in ath11k_bss_assoc()
1736 WARN_ON(arvif->is_up); in ath11k_bss_assoc()
1738 arvif->aid = bss_conf->aid; in ath11k_bss_assoc()
1739 ether_addr_copy(arvif->bssid, bss_conf->bssid); in ath11k_bss_assoc()
1741 ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid); in ath11k_bss_assoc()
1743 ath11k_warn(ar->ab, "failed to set vdev %d up: %d\n", in ath11k_bss_assoc()
1744 arvif->vdev_id, ret); in ath11k_bss_assoc()
1748 arvif->is_up = true; in ath11k_bss_assoc()
1750 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_bss_assoc()
1752 arvif->vdev_id, bss_conf->bssid, bss_conf->aid); in ath11k_bss_assoc()
1755 ret = ath11k_wmi_set_peer_param(ar, arvif->bssid, in ath11k_bss_assoc()
1756 arvif->vdev_id, in ath11k_bss_assoc()
1760 ath11k_warn(ar->ab, "Unable to authorize BSS peer: %d\n", ret); in ath11k_bss_assoc()
1762 ret = ath11k_wmi_send_obss_spr_cmd(ar, arvif->vdev_id, in ath11k_bss_assoc()
1763 &bss_conf->he_obss_pd); in ath11k_bss_assoc()
1765 ath11k_warn(ar->ab, "failed to set vdev %i OBSS PD parameters: %d\n", in ath11k_bss_assoc()
1766 arvif->vdev_id, ret); in ath11k_bss_assoc()
1772 struct ath11k *ar = hw->priv; in ath11k_bss_disassoc()
1773 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_bss_disassoc()
1776 lockdep_assert_held(&ar->conf_mutex); in ath11k_bss_disassoc()
1778 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vdev %i disassoc bssid %pM\n", in ath11k_bss_disassoc()
1779 arvif->vdev_id, arvif->bssid); in ath11k_bss_disassoc()
1781 ret = ath11k_wmi_vdev_down(ar, arvif->vdev_id); in ath11k_bss_disassoc()
1783 ath11k_warn(ar->ab, "failed to down vdev %i: %d\n", in ath11k_bss_disassoc()
1784 arvif->vdev_id, ret); in ath11k_bss_disassoc()
1786 arvif->is_up = false; in ath11k_bss_disassoc()
1813 return -EINVAL; in ath11k_mac_get_rate_hw_value()
1820 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_recalculate_mgmt_rate()
1828 lockdep_assert_held(&ar->conf_mutex); in ath11k_recalculate_mgmt_rate()
1830 sband = ar->hw->wiphy->bands[def->chan->band]; in ath11k_recalculate_mgmt_rate()
1831 basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; in ath11k_recalculate_mgmt_rate()
1832 bitrate = sband->bitrates[basic_rate_idx].bitrate; in ath11k_recalculate_mgmt_rate()
1836 ath11k_warn(ar->ab, "bitrate not supported %d\n", bitrate); in ath11k_recalculate_mgmt_rate()
1841 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, vdev_param, in ath11k_recalculate_mgmt_rate()
1844 ath11k_warn(ar->ab, "failed to set mgmt tx rate %d\n", ret); in ath11k_recalculate_mgmt_rate()
1847 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, vdev_param, in ath11k_recalculate_mgmt_rate()
1850 ath11k_warn(ar->ab, "failed to set beacon tx rate %d\n", ret); in ath11k_recalculate_mgmt_rate()
1858 struct ath11k *ar = hw->priv; in ath11k_mac_op_bss_info_changed()
1872 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_bss_info_changed()
1875 arvif->beacon_interval = info->beacon_int; in ath11k_mac_op_bss_info_changed()
1878 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
1880 arvif->beacon_interval); in ath11k_mac_op_bss_info_changed()
1882 ath11k_warn(ar->ab, "Failed to set beacon interval for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
1883 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
1885 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
1887 arvif->beacon_interval, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
1894 param_value, ar->pdev->pdev_id); in ath11k_mac_op_bss_info_changed()
1896 ath11k_warn(ar->ab, "Failed to set beacon mode for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
1897 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
1899 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
1901 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
1905 ath11k_warn(ar->ab, "failed to update bcn template: %d\n", in ath11k_mac_op_bss_info_changed()
1908 if (vif->bss_conf.he_support) { in ath11k_mac_op_bss_info_changed()
1909 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
1913 ath11k_warn(ar->ab, in ath11k_mac_op_bss_info_changed()
1915 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
1917 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
1919 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
1924 arvif->dtim_period = info->dtim_period; in ath11k_mac_op_bss_info_changed()
1927 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
1929 arvif->dtim_period); in ath11k_mac_op_bss_info_changed()
1932 ath11k_warn(ar->ab, "Failed to set dtim period for VDEV %d: %i\n", in ath11k_mac_op_bss_info_changed()
1933 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
1935 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
1937 arvif->dtim_period, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
1941 vif->type == NL80211_IFTYPE_AP) { in ath11k_mac_op_bss_info_changed()
1942 arvif->u.ap.ssid_len = info->ssid_len; in ath11k_mac_op_bss_info_changed()
1943 if (info->ssid_len) in ath11k_mac_op_bss_info_changed()
1944 memcpy(arvif->u.ap.ssid, info->ssid, info->ssid_len); in ath11k_mac_op_bss_info_changed()
1945 arvif->u.ap.hidden_ssid = info->hidden_ssid; in ath11k_mac_op_bss_info_changed()
1948 if (changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) in ath11k_mac_op_bss_info_changed()
1949 ether_addr_copy(arvif->bssid, info->bssid); in ath11k_mac_op_bss_info_changed()
1957 cts_prot = !!(info->use_cts_prot); in ath11k_mac_op_bss_info_changed()
1960 if (arvif->is_started) { in ath11k_mac_op_bss_info_changed()
1961 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
1964 ath11k_warn(ar->ab, "Failed to set CTS prot for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
1965 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
1967 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "Set CTS prot: %d for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
1968 cts_prot, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
1970 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "defer protection mode setup, vdev is not ready yet\n"); in ath11k_mac_op_bss_info_changed()
1977 if (info->use_short_slot) in ath11k_mac_op_bss_info_changed()
1984 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
1987 ath11k_warn(ar->ab, "Failed to set erp slot for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
1988 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
1990 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
1992 slottime, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
1998 if (info->use_short_preamble) in ath11k_mac_op_bss_info_changed()
2004 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
2007 ath11k_warn(ar->ab, "Failed to set preamble for VDEV: %d\n", in ath11k_mac_op_bss_info_changed()
2008 arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
2010 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
2012 preamble, arvif->vdev_id); in ath11k_mac_op_bss_info_changed()
2016 if (info->assoc) in ath11k_mac_op_bss_info_changed()
2023 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vdev_id %i txpower %d\n", in ath11k_mac_op_bss_info_changed()
2024 arvif->vdev_id, info->txpower); in ath11k_mac_op_bss_info_changed()
2026 arvif->txpower = info->txpower; in ath11k_mac_op_bss_info_changed()
2031 !ath11k_mac_vif_chan(arvif->vif, &def)) { in ath11k_mac_op_bss_info_changed()
2032 band = def.chan->band; in ath11k_mac_op_bss_info_changed()
2033 mcast_rate = vif->bss_conf.mcast_rate[band]; in ath11k_mac_op_bss_info_changed()
2036 rateidx = mcast_rate - 1; in ath11k_mac_op_bss_info_changed()
2038 rateidx = ffs(vif->bss_conf.basic_rates) - 1; in ath11k_mac_op_bss_info_changed()
2040 if (ar->pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) in ath11k_mac_op_bss_info_changed()
2053 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_bss_info_changed()
2055 arvif->vdev_id, rate); in ath11k_mac_op_bss_info_changed()
2058 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
2061 ath11k_warn(ar->ab, in ath11k_mac_op_bss_info_changed()
2063 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
2066 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
2069 ath11k_warn(ar->ab, in ath11k_mac_op_bss_info_changed()
2071 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
2075 !ath11k_mac_vif_chan(arvif->vif, &def)) in ath11k_mac_op_bss_info_changed()
2079 if (info->twt_requester || info->twt_responder) in ath11k_mac_op_bss_info_changed()
2080 ath11k_wmi_send_twt_enable_cmd(ar, ar->pdev->pdev_id); in ath11k_mac_op_bss_info_changed()
2082 ath11k_wmi_send_twt_disable_cmd(ar, ar->pdev->pdev_id); in ath11k_mac_op_bss_info_changed()
2086 ath11k_wmi_send_obss_spr_cmd(ar, arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
2087 &info->he_obss_pd); in ath11k_mac_op_bss_info_changed()
2090 if (vif->type == NL80211_IFTYPE_AP) { in ath11k_mac_op_bss_info_changed()
2092 ar, arvif->vdev_id, info->he_bss_color.color, in ath11k_mac_op_bss_info_changed()
2094 info->he_bss_color.enabled); in ath11k_mac_op_bss_info_changed()
2096 ath11k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n", in ath11k_mac_op_bss_info_changed()
2097 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
2098 } else if (vif->type == NL80211_IFTYPE_STATION) { in ath11k_mac_op_bss_info_changed()
2100 arvif->vdev_id, in ath11k_mac_op_bss_info_changed()
2103 ath11k_warn(ar->ab, "failed to enable bss color change on vdev %i: %d\n", in ath11k_mac_op_bss_info_changed()
2104 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
2106 ar, arvif->vdev_id, 0, in ath11k_mac_op_bss_info_changed()
2109 ath11k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n", in ath11k_mac_op_bss_info_changed()
2110 arvif->vdev_id, ret); in ath11k_mac_op_bss_info_changed()
2114 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_bss_info_changed()
2119 lockdep_assert_held(&ar->data_lock); in __ath11k_mac_scan_finish()
2121 switch (ar->scan.state) { in __ath11k_mac_scan_finish()
2126 if (!ar->scan.is_roc) { in __ath11k_mac_scan_finish()
2128 .aborted = (ar->scan.state == in __ath11k_mac_scan_finish()
2132 ieee80211_scan_completed(ar->hw, &info); in __ath11k_mac_scan_finish()
2133 } else if (ar->scan.roc_notify) { in __ath11k_mac_scan_finish()
2134 ieee80211_remain_on_channel_expired(ar->hw); in __ath11k_mac_scan_finish()
2138 ar->scan.state = ATH11K_SCAN_IDLE; in __ath11k_mac_scan_finish()
2139 ar->scan_channel = NULL; in __ath11k_mac_scan_finish()
2140 ar->scan.roc_freq = 0; in __ath11k_mac_scan_finish()
2141 cancel_delayed_work(&ar->scan.timeout); in __ath11k_mac_scan_finish()
2142 complete(&ar->scan.completed); in __ath11k_mac_scan_finish()
2149 spin_lock_bh(&ar->data_lock); in ath11k_mac_scan_finish()
2151 spin_unlock_bh(&ar->data_lock); in ath11k_mac_scan_finish()
2162 lockdep_assert_held(&ar->conf_mutex); in ath11k_scan_stop()
2165 arg.pdev_id = ar->pdev->pdev_id; in ath11k_scan_stop()
2169 ath11k_warn(ar->ab, "failed to stop wmi scan: %d\n", ret); in ath11k_scan_stop()
2173 ret = wait_for_completion_timeout(&ar->scan.completed, 3 * HZ); in ath11k_scan_stop()
2175 ath11k_warn(ar->ab, in ath11k_scan_stop()
2177 ret = -ETIMEDOUT; in ath11k_scan_stop()
2190 spin_lock_bh(&ar->data_lock); in ath11k_scan_stop()
2191 if (ar->scan.state != ATH11K_SCAN_IDLE) in ath11k_scan_stop()
2193 spin_unlock_bh(&ar->data_lock); in ath11k_scan_stop()
2202 lockdep_assert_held(&ar->conf_mutex); in ath11k_scan_abort()
2204 spin_lock_bh(&ar->data_lock); in ath11k_scan_abort()
2206 switch (ar->scan.state) { in ath11k_scan_abort()
2214 ath11k_warn(ar->ab, "refusing scan abortion due to invalid scan state: %d\n", in ath11k_scan_abort()
2215 ar->scan.state); in ath11k_scan_abort()
2218 ar->scan.state = ATH11K_SCAN_ABORTING; in ath11k_scan_abort()
2219 spin_unlock_bh(&ar->data_lock); in ath11k_scan_abort()
2223 ath11k_warn(ar->ab, "failed to abort scan: %d\n", ret); in ath11k_scan_abort()
2225 spin_lock_bh(&ar->data_lock); in ath11k_scan_abort()
2229 spin_unlock_bh(&ar->data_lock); in ath11k_scan_abort()
2237 mutex_lock(&ar->conf_mutex); in ath11k_scan_timeout_work()
2239 mutex_unlock(&ar->conf_mutex); in ath11k_scan_timeout_work()
2247 lockdep_assert_held(&ar->conf_mutex); in ath11k_start_scan()
2256 ret = wait_for_completion_timeout(&ar->scan.started, 1 * HZ); in ath11k_start_scan()
2260 ath11k_warn(ar->ab, "failed to stop scan: %d\n", ret); in ath11k_start_scan()
2262 return -ETIMEDOUT; in ath11k_start_scan()
2269 spin_lock_bh(&ar->data_lock); in ath11k_start_scan()
2270 if (ar->scan.state == ATH11K_SCAN_IDLE) { in ath11k_start_scan()
2271 spin_unlock_bh(&ar->data_lock); in ath11k_start_scan()
2272 return -EINVAL; in ath11k_start_scan()
2274 spin_unlock_bh(&ar->data_lock); in ath11k_start_scan()
2283 struct ath11k *ar = hw->priv; in ath11k_mac_op_hw_scan()
2285 struct cfg80211_scan_request *req = &hw_req->req; in ath11k_mac_op_hw_scan()
2290 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_hw_scan()
2292 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
2293 switch (ar->scan.state) { in ath11k_mac_op_hw_scan()
2295 reinit_completion(&ar->scan.started); in ath11k_mac_op_hw_scan()
2296 reinit_completion(&ar->scan.completed); in ath11k_mac_op_hw_scan()
2297 ar->scan.state = ATH11K_SCAN_STARTING; in ath11k_mac_op_hw_scan()
2298 ar->scan.is_roc = false; in ath11k_mac_op_hw_scan()
2299 ar->scan.vdev_id = arvif->vdev_id; in ath11k_mac_op_hw_scan()
2305 ret = -EBUSY; in ath11k_mac_op_hw_scan()
2308 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
2315 arg.vdev_id = arvif->vdev_id; in ath11k_mac_op_hw_scan()
2318 if (req->ie_len) { in ath11k_mac_op_hw_scan()
2319 arg.extraie.len = req->ie_len; in ath11k_mac_op_hw_scan()
2320 arg.extraie.ptr = kzalloc(req->ie_len, GFP_KERNEL); in ath11k_mac_op_hw_scan()
2321 memcpy(arg.extraie.ptr, req->ie, req->ie_len); in ath11k_mac_op_hw_scan()
2324 if (req->n_ssids) { in ath11k_mac_op_hw_scan()
2325 arg.num_ssids = req->n_ssids; in ath11k_mac_op_hw_scan()
2327 arg.ssid[i].length = req->ssids[i].ssid_len; in ath11k_mac_op_hw_scan()
2328 memcpy(&arg.ssid[i].ssid, req->ssids[i].ssid, in ath11k_mac_op_hw_scan()
2329 req->ssids[i].ssid_len); in ath11k_mac_op_hw_scan()
2335 if (req->n_channels) { in ath11k_mac_op_hw_scan()
2336 arg.num_chan = req->n_channels; in ath11k_mac_op_hw_scan()
2338 arg.chan_list[i] = req->channels[i]->center_freq; in ath11k_mac_op_hw_scan()
2343 ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret); in ath11k_mac_op_hw_scan()
2344 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
2345 ar->scan.state = ATH11K_SCAN_IDLE; in ath11k_mac_op_hw_scan()
2346 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_hw_scan()
2350 ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout, in ath11k_mac_op_hw_scan()
2355 if (req->ie_len) in ath11k_mac_op_hw_scan()
2358 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_hw_scan()
2365 struct ath11k *ar = hw->priv; in ath11k_mac_op_cancel_hw_scan()
2367 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_cancel_hw_scan()
2369 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_cancel_hw_scan()
2371 cancel_delayed_work_sync(&ar->scan.timeout); in ath11k_mac_op_cancel_hw_scan()
2380 struct ath11k *ar = arvif->ar; in ath11k_install_key()
2382 .vdev_id = arvif->vdev_id, in ath11k_install_key()
2383 .key_idx = key->keyidx, in ath11k_install_key()
2384 .key_len = key->keylen, in ath11k_install_key()
2385 .key_data = key->key, in ath11k_install_key()
2390 lockdep_assert_held(&arvif->ar->conf_mutex); in ath11k_install_key()
2392 reinit_completion(&ar->install_key_done); in ath11k_install_key()
2394 if (test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ar->ab->dev_flags)) in ath11k_install_key()
2405 switch (key->cipher) { in ath11k_install_key()
2408 /* TODO: Re-check if flag is valid */ in ath11k_install_key()
2409 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; in ath11k_install_key()
2424 ath11k_warn(ar->ab, "cipher %d is not supported\n", key->cipher); in ath11k_install_key()
2425 return -EOPNOTSUPP; in ath11k_install_key()
2428 if (test_bit(ATH11K_FLAG_RAW_MODE, &ar->ab->dev_flags)) in ath11k_install_key()
2429 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV | in ath11k_install_key()
2433 ret = ath11k_wmi_vdev_install_key(arvif->ar, &arg); in ath11k_install_key()
2438 if (!wait_for_completion_timeout(&ar->install_key_done, 1 * HZ)) in ath11k_install_key()
2439 return -ETIMEDOUT; in ath11k_install_key()
2441 return ar->install_key_status ? -EINVAL : 0; in ath11k_install_key()
2447 struct ath11k *ar = arvif->ar; in ath11k_clear_peer_keys()
2448 struct ath11k_base *ab = ar->ab; in ath11k_clear_peer_keys()
2455 lockdep_assert_held(&ar->conf_mutex); in ath11k_clear_peer_keys()
2457 spin_lock_bh(&ab->base_lock); in ath11k_clear_peer_keys()
2458 peer = ath11k_peer_find(ab, arvif->vdev_id, addr); in ath11k_clear_peer_keys()
2459 spin_unlock_bh(&ab->base_lock); in ath11k_clear_peer_keys()
2462 return -ENOENT; in ath11k_clear_peer_keys()
2464 for (i = 0; i < ARRAY_SIZE(peer->keys); i++) { in ath11k_clear_peer_keys()
2465 if (!peer->keys[i]) in ath11k_clear_peer_keys()
2469 ret = ath11k_install_key(arvif, peer->keys[i], in ath11k_clear_peer_keys()
2478 spin_lock_bh(&ab->base_lock); in ath11k_clear_peer_keys()
2479 peer->keys[i] = NULL; in ath11k_clear_peer_keys()
2480 spin_unlock_bh(&ab->base_lock); in ath11k_clear_peer_keys()
2490 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_key()
2491 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_set_key()
2500 if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || in ath11k_mac_op_set_key()
2501 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || in ath11k_mac_op_set_key()
2502 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 || in ath11k_mac_op_set_key()
2503 key->cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256) in ath11k_mac_op_set_key()
2506 if (test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ar->ab->dev_flags)) in ath11k_mac_op_set_key()
2509 if (key->keyidx > WMI_MAX_KEY_INDEX) in ath11k_mac_op_set_key()
2510 return -ENOSPC; in ath11k_mac_op_set_key()
2512 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_key()
2515 peer_addr = sta->addr; in ath11k_mac_op_set_key()
2516 else if (arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath11k_mac_op_set_key()
2517 peer_addr = vif->bss_conf.bssid; in ath11k_mac_op_set_key()
2519 peer_addr = vif->addr; in ath11k_mac_op_set_key()
2521 key->hw_key_idx = key->keyidx; in ath11k_mac_op_set_key()
2523 /* the peer should not disappear in mid-way (unless FW goes awry) since in ath11k_mac_op_set_key()
2526 spin_lock_bh(&ab->base_lock); in ath11k_mac_op_set_key()
2527 peer = ath11k_peer_find(ab, arvif->vdev_id, peer_addr); in ath11k_mac_op_set_key()
2528 spin_unlock_bh(&ab->base_lock); in ath11k_mac_op_set_key()
2532 ath11k_warn(ab, "cannot install key for non-existent peer %pM\n", in ath11k_mac_op_set_key()
2534 ret = -EOPNOTSUPP; in ath11k_mac_op_set_key()
2544 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath11k_mac_op_set_key()
2561 spin_lock_bh(&ab->base_lock); in ath11k_mac_op_set_key()
2562 peer = ath11k_peer_find(ab, arvif->vdev_id, peer_addr); in ath11k_mac_op_set_key()
2564 peer->keys[key->keyidx] = key; in ath11k_mac_op_set_key()
2565 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { in ath11k_mac_op_set_key()
2566 peer->ucast_keyidx = key->keyidx; in ath11k_mac_op_set_key()
2567 peer->sec_type = ath11k_dp_tx_get_encrypt_type(key->cipher); in ath11k_mac_op_set_key()
2569 peer->mcast_keyidx = key->keyidx; in ath11k_mac_op_set_key()
2570 peer->sec_type_grp = ath11k_dp_tx_get_encrypt_type(key->cipher); in ath11k_mac_op_set_key()
2573 peer->keys[key->keyidx] = NULL; in ath11k_mac_op_set_key()
2574 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in ath11k_mac_op_set_key()
2575 peer->ucast_keyidx = 0; in ath11k_mac_op_set_key()
2577 peer->mcast_keyidx = 0; in ath11k_mac_op_set_key()
2583 arsta = (struct ath11k_sta *)sta->drv_priv; in ath11k_mac_op_set_key()
2585 switch (key->cipher) { in ath11k_mac_op_set_key()
2592 arsta->pn_type = HAL_PN_TYPE_WPA; in ath11k_mac_op_set_key()
2594 arsta->pn_type = HAL_PN_TYPE_NONE; in ath11k_mac_op_set_key()
2597 arsta->pn_type = HAL_PN_TYPE_NONE; in ath11k_mac_op_set_key()
2602 spin_unlock_bh(&ab->base_lock); in ath11k_mac_op_set_key()
2605 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_key()
2617 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) in ath11k_mac_bitrate_mask_num_vht_rates()
2618 num_rates += hweight16(mask->control[band].vht_mcs[i]); in ath11k_mac_bitrate_mask_num_vht_rates()
2629 struct ath11k *ar = arvif->ar; in ath11k_mac_set_peer_vht_fixed_rate()
2634 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_set_peer_vht_fixed_rate()
2638 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath11k_mac_set_peer_vht_fixed_rate()
2639 if (hweight16(mask->control[band].vht_mcs[i]) == 1) { in ath11k_mac_set_peer_vht_fixed_rate()
2641 vht_rate = ffs(mask->control[band].vht_mcs[i]) - 1; in ath11k_mac_set_peer_vht_fixed_rate()
2646 ath11k_warn(ar->ab, "No single VHT Fixed rate found to set for %pM", in ath11k_mac_set_peer_vht_fixed_rate()
2647 sta->addr); in ath11k_mac_set_peer_vht_fixed_rate()
2648 return -EINVAL; in ath11k_mac_set_peer_vht_fixed_rate()
2651 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_set_peer_vht_fixed_rate()
2653 sta->addr); in ath11k_mac_set_peer_vht_fixed_rate()
2655 rate_code = ATH11K_HW_RATE_CODE(vht_rate, nss - 1, in ath11k_mac_set_peer_vht_fixed_rate()
2657 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_set_peer_vht_fixed_rate()
2658 arvif->vdev_id, in ath11k_mac_set_peer_vht_fixed_rate()
2662 ath11k_warn(ar->ab, in ath11k_mac_set_peer_vht_fixed_rate()
2664 sta->addr, rate_code, ret); in ath11k_mac_set_peer_vht_fixed_rate()
2682 lockdep_assert_held(&ar->conf_mutex); in ath11k_station_assoc()
2685 return -EPERM; in ath11k_station_assoc()
2687 band = def.chan->band; in ath11k_station_assoc()
2688 mask = &arvif->bitrate_mask; in ath11k_station_assoc()
2694 ath11k_warn(ar->ab, "failed to run peer assoc for STA %pM vdev %i: %d\n", in ath11k_station_assoc()
2695 sta->addr, arvif->vdev_id, ret); in ath11k_station_assoc()
2699 if (!wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) { in ath11k_station_assoc()
2700 ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n", in ath11k_station_assoc()
2701 sta->addr, arvif->vdev_id); in ath11k_station_assoc()
2702 return -ETIMEDOUT; in ath11k_station_assoc()
2712 if (sta->vht_cap.vht_supported && num_vht_rates == 1) { in ath11k_station_assoc()
2719 /* Re-assoc is run only to update supported rates for given station. It in ath11k_station_assoc()
2725 ret = ath11k_setup_peer_smps(ar, arvif, sta->addr, in ath11k_station_assoc()
2726 &sta->ht_cap); in ath11k_station_assoc()
2728 ath11k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n", in ath11k_station_assoc()
2729 arvif->vdev_id, ret); in ath11k_station_assoc()
2733 if (!sta->wme) { in ath11k_station_assoc()
2734 arvif->num_legacy_stations++; in ath11k_station_assoc()
2740 if (sta->wme && sta->uapsd_queues) { in ath11k_station_assoc()
2743 ath11k_warn(ar->ab, "failed to set qos params for STA %pM for vdev %i: %d\n", in ath11k_station_assoc()
2744 sta->addr, arvif->vdev_id, ret); in ath11k_station_assoc()
2756 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_station_disassoc()
2759 lockdep_assert_held(&ar->conf_mutex); in ath11k_station_disassoc()
2761 if (!sta->wme) { in ath11k_station_disassoc()
2762 arvif->num_legacy_stations--; in ath11k_station_disassoc()
2768 ret = ath11k_clear_peer_keys(arvif, sta->addr); in ath11k_station_disassoc()
2770 ath11k_warn(ar->ab, "failed to clear all peer keys for vdev %i: %d\n", in ath11k_station_disassoc()
2771 arvif->vdev_id, ret); in ath11k_station_disassoc()
2794 arvif = arsta->arvif; in ath11k_sta_rc_update_wk()
2795 ar = arvif->ar; in ath11k_sta_rc_update_wk()
2797 if (WARN_ON(ath11k_mac_vif_chan(arvif->vif, &def))) in ath11k_sta_rc_update_wk()
2800 band = def.chan->band; in ath11k_sta_rc_update_wk()
2801 ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; in ath11k_sta_rc_update_wk()
2802 vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; in ath11k_sta_rc_update_wk()
2804 spin_lock_bh(&ar->data_lock); in ath11k_sta_rc_update_wk()
2806 changed = arsta->changed; in ath11k_sta_rc_update_wk()
2807 arsta->changed = 0; in ath11k_sta_rc_update_wk()
2809 bw = arsta->bw; in ath11k_sta_rc_update_wk()
2810 nss = arsta->nss; in ath11k_sta_rc_update_wk()
2811 smps = arsta->smps; in ath11k_sta_rc_update_wk()
2813 spin_unlock_bh(&ar->data_lock); in ath11k_sta_rc_update_wk()
2815 mutex_lock(&ar->conf_mutex); in ath11k_sta_rc_update_wk()
2822 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
2825 ath11k_warn(ar->ab, "failed to update STA %pM peer bw %d: %d\n", in ath11k_sta_rc_update_wk()
2826 sta->addr, bw, err); in ath11k_sta_rc_update_wk()
2830 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac update sta %pM nss %d\n", in ath11k_sta_rc_update_wk()
2831 sta->addr, nss); in ath11k_sta_rc_update_wk()
2833 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
2836 ath11k_warn(ar->ab, "failed to update STA %pM nss %d: %d\n", in ath11k_sta_rc_update_wk()
2837 sta->addr, nss, err); in ath11k_sta_rc_update_wk()
2841 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac update sta %pM smps %d\n", in ath11k_sta_rc_update_wk()
2842 sta->addr, smps); in ath11k_sta_rc_update_wk()
2844 err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_sta_rc_update_wk()
2847 ath11k_warn(ar->ab, "failed to update STA %pM smps %d: %d\n", in ath11k_sta_rc_update_wk()
2848 sta->addr, smps, err); in ath11k_sta_rc_update_wk()
2852 mask = &arvif->bitrate_mask; in ath11k_sta_rc_update_wk()
2860 * But, Single rate in VHT mask can be set as per-peer in ath11k_sta_rc_update_wk()
2863 * when per-peer Fixed rate is set. in ath11k_sta_rc_update_wk()
2867 if (sta->vht_cap.vht_supported && num_vht_rates == 1) { in ath11k_sta_rc_update_wk()
2871 /* If the peer is non-VHT or no fixed VHT rate in ath11k_sta_rc_update_wk()
2875 ath11k_peer_assoc_prepare(ar, arvif->vif, sta, in ath11k_sta_rc_update_wk()
2880 ath11k_warn(ar->ab, "failed to run peer assoc for STA %pM vdev %i: %d\n", in ath11k_sta_rc_update_wk()
2881 sta->addr, arvif->vdev_id, err); in ath11k_sta_rc_update_wk()
2883 if (!wait_for_completion_timeout(&ar->peer_assoc_done, 1 * HZ)) in ath11k_sta_rc_update_wk()
2884 ath11k_warn(ar->ab, "failed to get peer assoc conf event for %pM vdev %i\n", in ath11k_sta_rc_update_wk()
2885 sta->addr, arvif->vdev_id); in ath11k_sta_rc_update_wk()
2889 mutex_unlock(&ar->conf_mutex); in ath11k_sta_rc_update_wk()
2895 struct ath11k *ar = arvif->ar; in ath11k_mac_inc_num_stations()
2897 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_inc_num_stations()
2899 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath11k_mac_inc_num_stations()
2902 if (ar->num_stations >= ar->max_num_stations) in ath11k_mac_inc_num_stations()
2903 return -ENOBUFS; in ath11k_mac_inc_num_stations()
2905 ar->num_stations++; in ath11k_mac_inc_num_stations()
2913 struct ath11k *ar = arvif->ar; in ath11k_mac_dec_num_stations()
2915 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_dec_num_stations()
2917 if (arvif->vdev_type == WMI_VDEV_TYPE_STA && !sta->tdls) in ath11k_mac_dec_num_stations()
2920 ar->num_stations--; in ath11k_mac_dec_num_stations()
2927 struct ath11k_base *ab = ar->ab; in ath11k_mac_station_add()
2929 struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; in ath11k_mac_station_add()
2933 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_station_add()
2938 ar->max_num_stations); in ath11k_mac_station_add()
2942 arsta->rx_stats = kzalloc(sizeof(*arsta->rx_stats), GFP_KERNEL); in ath11k_mac_station_add()
2943 if (!arsta->rx_stats) { in ath11k_mac_station_add()
2944 ret = -ENOMEM; in ath11k_mac_station_add()
2948 peer_param.vdev_id = arvif->vdev_id; in ath11k_mac_station_add()
2949 peer_param.peer_addr = sta->addr; in ath11k_mac_station_add()
2955 sta->addr, arvif->vdev_id); in ath11k_mac_station_add()
2960 sta->addr, arvif->vdev_id); in ath11k_mac_station_add()
2963 arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), GFP_KERNEL); in ath11k_mac_station_add()
2964 if (!arsta->tx_stats) { in ath11k_mac_station_add()
2965 ret = -ENOMEM; in ath11k_mac_station_add()
2971 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_station_add()
2972 arvif->vdev_id, in ath11k_mac_station_add()
2976 sta->addr, ret); in ath11k_mac_station_add()
2981 ret = ath11k_dp_peer_setup(ar, arvif->vdev_id, sta->addr); in ath11k_mac_station_add()
2984 sta->addr, arvif->vdev_id, ret); in ath11k_mac_station_add()
2988 if (ab->hw_params.vdev_start_delay && in ath11k_mac_station_add()
2989 arvif->vdev_type != WMI_VDEV_TYPE_AP) { in ath11k_mac_station_add()
2990 ret = ath11k_start_vdev_delay(ar->hw, vif); in ath11k_mac_station_add()
3000 kfree(arsta->tx_stats); in ath11k_mac_station_add()
3001 arsta->tx_stats = NULL; in ath11k_mac_station_add()
3003 ath11k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath11k_mac_station_add()
3005 kfree(arsta->rx_stats); in ath11k_mac_station_add()
3006 arsta->rx_stats = NULL; in ath11k_mac_station_add()
3019 struct ath11k *ar = hw->priv; in ath11k_mac_op_sta_state()
3021 struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; in ath11k_mac_op_sta_state()
3028 cancel_work_sync(&arsta->update_wk); in ath11k_mac_op_sta_state()
3030 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_sta_state()
3035 arsta->arvif = arvif; in ath11k_mac_op_sta_state()
3036 INIT_WORK(&arsta->update_wk, ath11k_sta_rc_update_wk); in ath11k_mac_op_sta_state()
3040 ath11k_warn(ar->ab, "Failed to add station: %pM for VDEV: %d\n", in ath11k_mac_op_sta_state()
3041 sta->addr, arvif->vdev_id); in ath11k_mac_op_sta_state()
3044 ath11k_dp_peer_cleanup(ar, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_state()
3046 ret = ath11k_peer_delete(ar, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_state()
3048 ath11k_warn(ar->ab, "Failed to delete peer: %pM for VDEV: %d\n", in ath11k_mac_op_sta_state()
3049 sta->addr, arvif->vdev_id); in ath11k_mac_op_sta_state()
3051 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "Removed peer: %pM for VDEV: %d\n", in ath11k_mac_op_sta_state()
3052 sta->addr, arvif->vdev_id); in ath11k_mac_op_sta_state()
3055 spin_lock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
3056 peer = ath11k_peer_find(ar->ab, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_state()
3057 if (peer && peer->sta == sta) { in ath11k_mac_op_sta_state()
3058 ath11k_warn(ar->ab, "Found peer entry %pM n vdev %i after it was supposedly removed\n", in ath11k_mac_op_sta_state()
3059 vif->addr, arvif->vdev_id); in ath11k_mac_op_sta_state()
3060 peer->sta = NULL; in ath11k_mac_op_sta_state()
3061 list_del(&peer->list); in ath11k_mac_op_sta_state()
3063 ar->num_peers--; in ath11k_mac_op_sta_state()
3065 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_state()
3067 kfree(arsta->tx_stats); in ath11k_mac_op_sta_state()
3068 arsta->tx_stats = NULL; in ath11k_mac_op_sta_state()
3070 kfree(arsta->rx_stats); in ath11k_mac_op_sta_state()
3071 arsta->rx_stats = NULL; in ath11k_mac_op_sta_state()
3074 (vif->type == NL80211_IFTYPE_AP || in ath11k_mac_op_sta_state()
3075 vif->type == NL80211_IFTYPE_MESH_POINT || in ath11k_mac_op_sta_state()
3076 vif->type == NL80211_IFTYPE_ADHOC)) { in ath11k_mac_op_sta_state()
3079 ath11k_warn(ar->ab, "Failed to associate station: %pM\n", in ath11k_mac_op_sta_state()
3080 sta->addr); in ath11k_mac_op_sta_state()
3083 (vif->type == NL80211_IFTYPE_AP || in ath11k_mac_op_sta_state()
3084 vif->type == NL80211_IFTYPE_MESH_POINT || in ath11k_mac_op_sta_state()
3085 vif->type == NL80211_IFTYPE_ADHOC)) { in ath11k_mac_op_sta_state()
3088 ath11k_warn(ar->ab, "Failed to disassociate station: %pM\n", in ath11k_mac_op_sta_state()
3089 sta->addr); in ath11k_mac_op_sta_state()
3092 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_sta_state()
3100 struct ath11k *ar = hw->priv; in ath11k_mac_op_sta_set_txpwr()
3101 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_op_sta_set_txpwr()
3105 if (sta->txpwr.type == NL80211_TX_POWER_AUTOMATIC) { in ath11k_mac_op_sta_set_txpwr()
3108 txpwr = sta->txpwr.power; in ath11k_mac_op_sta_set_txpwr()
3110 return -EINVAL; in ath11k_mac_op_sta_set_txpwr()
3114 return -EINVAL; in ath11k_mac_op_sta_set_txpwr()
3116 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_sta_set_txpwr()
3118 ret = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, in ath11k_mac_op_sta_set_txpwr()
3121 ath11k_warn(ar->ab, "failed to set tx power for station ret: %d\n", in ath11k_mac_op_sta_set_txpwr()
3127 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_sta_set_txpwr()
3136 struct ath11k *ar = hw->priv; in ath11k_mac_op_sta_rc_update()
3137 struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; in ath11k_mac_op_sta_rc_update()
3138 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_op_sta_rc_update()
3142 spin_lock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_rc_update()
3144 peer = ath11k_peer_find(ar->ab, arvif->vdev_id, sta->addr); in ath11k_mac_op_sta_rc_update()
3146 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_rc_update()
3147 ath11k_warn(ar->ab, "mac sta rc update failed to find peer %pM on vdev %i\n", in ath11k_mac_op_sta_rc_update()
3148 sta->addr, arvif->vdev_id); in ath11k_mac_op_sta_rc_update()
3152 spin_unlock_bh(&ar->ab->base_lock); in ath11k_mac_op_sta_rc_update()
3154 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_sta_rc_update()
3156 sta->addr, changed, sta->bandwidth, sta->rx_nss, in ath11k_mac_op_sta_rc_update()
3157 sta->smps_mode); in ath11k_mac_op_sta_rc_update()
3159 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_sta_rc_update()
3164 switch (sta->bandwidth) { in ath11k_mac_op_sta_rc_update()
3178 ath11k_warn(ar->ab, "Invalid bandwidth %d in rc update for %pM\n", in ath11k_mac_op_sta_rc_update()
3179 sta->bandwidth, sta->addr); in ath11k_mac_op_sta_rc_update()
3184 arsta->bw = bw; in ath11k_mac_op_sta_rc_update()
3188 arsta->nss = sta->rx_nss; in ath11k_mac_op_sta_rc_update()
3193 switch (sta->smps_mode) { in ath11k_mac_op_sta_rc_update()
3205 ath11k_warn(ar->ab, "Invalid smps %d in sta rc update for %pM\n", in ath11k_mac_op_sta_rc_update()
3206 sta->smps_mode, sta->addr); in ath11k_mac_op_sta_rc_update()
3211 arsta->smps = smps; in ath11k_mac_op_sta_rc_update()
3214 arsta->changed |= changed; in ath11k_mac_op_sta_rc_update()
3216 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_sta_rc_update()
3218 ieee80211_queue_work(hw, &arsta->update_wk); in ath11k_mac_op_sta_rc_update()
3228 if (arvif->vdev_type != WMI_VDEV_TYPE_STA) in ath11k_conf_tx_uapsd()
3251 arvif->u.sta.uapsd |= value; in ath11k_conf_tx_uapsd()
3253 arvif->u.sta.uapsd &= ~value; in ath11k_conf_tx_uapsd()
3255 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_conf_tx_uapsd()
3257 arvif->u.sta.uapsd); in ath11k_conf_tx_uapsd()
3259 ath11k_warn(ar->ab, "could not set uapsd params %d\n", ret); in ath11k_conf_tx_uapsd()
3263 if (arvif->u.sta.uapsd) in ath11k_conf_tx_uapsd()
3268 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_conf_tx_uapsd()
3272 ath11k_warn(ar->ab, "could not set rx wake param %d\n", ret); in ath11k_conf_tx_uapsd()
3282 struct ath11k *ar = hw->priv; in ath11k_mac_op_conf_tx()
3283 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_op_conf_tx()
3287 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_conf_tx()
3291 p = &arvif->wmm_params.ac_vo; in ath11k_mac_op_conf_tx()
3294 p = &arvif->wmm_params.ac_vi; in ath11k_mac_op_conf_tx()
3297 p = &arvif->wmm_params.ac_be; in ath11k_mac_op_conf_tx()
3300 p = &arvif->wmm_params.ac_bk; in ath11k_mac_op_conf_tx()
3305 ret = -EINVAL; in ath11k_mac_op_conf_tx()
3309 p->cwmin = params->cw_min; in ath11k_mac_op_conf_tx()
3310 p->cwmax = params->cw_max; in ath11k_mac_op_conf_tx()
3311 p->aifs = params->aifs; in ath11k_mac_op_conf_tx()
3312 p->txop = params->txop; in ath11k_mac_op_conf_tx()
3314 ret = ath11k_wmi_send_wmm_update_cmd_tlv(ar, arvif->vdev_id, in ath11k_mac_op_conf_tx()
3315 &arvif->wmm_params); in ath11k_mac_op_conf_tx()
3317 ath11k_warn(ar->ab, "failed to set wmm params: %d\n", ret); in ath11k_mac_op_conf_tx()
3321 ret = ath11k_conf_tx_uapsd(ar, vif, ac, params->uapsd); in ath11k_mac_op_conf_tx()
3324 ath11k_warn(ar->ab, "failed to set sta uapsd: %d\n", ret); in ath11k_mac_op_conf_tx()
3327 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_conf_tx()
3336 u32 ar_vht_cap = ar->pdev->cap.vht_cap; in ath11k_create_ht_cap()
3387 for (i = 0; i < ar->num_rx_chains; i++) { in ath11k_create_ht_cap()
3400 struct ath11k *ar = arvif->ar; in ath11k_mac_set_txbf_conf()
3403 u32 vht_cap = ar->pdev->cap.vht_cap; in ath11k_mac_set_txbf_conf()
3416 if (sound_dim > (ar->num_tx_chains - 1)) in ath11k_mac_set_txbf_conf()
3417 sound_dim = ar->num_tx_chains - 1; in ath11k_mac_set_txbf_conf()
3428 arvif->vdev_type == WMI_VDEV_TYPE_AP) in ath11k_mac_set_txbf_conf()
3438 arvif->vdev_type == WMI_VDEV_TYPE_STA) in ath11k_mac_set_txbf_conf()
3442 return ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_txbf_conf()
3454 if (ar->num_tx_chains < 2) { in ath11k_set_vht_txbf_cap()
3475 if (sound_dim > (ar->num_tx_chains - 1)) in ath11k_set_vht_txbf_cap()
3476 sound_dim = ar->num_tx_chains - 1; in ath11k_set_vht_txbf_cap()
3497 vht_cap.cap = ar->pdev->cap.vht_cap; in ath11k_create_vht_cap()
3509 if (i < ar->num_tx_chains && rate_cap_tx_chainmask & BIT(i)) in ath11k_create_vht_cap()
3514 if (i < ar->num_rx_chains && rate_cap_rx_chainmask & BIT(i)) in ath11k_create_vht_cap()
3538 rate_cap_tx_chainmask = ar->cfg_tx_chainmask >> cap->tx_chain_mask_shift; in ath11k_mac_setup_ht_vht_cap()
3539 rate_cap_rx_chainmask = ar->cfg_rx_chainmask >> cap->rx_chain_mask_shift; in ath11k_mac_setup_ht_vht_cap()
3541 if (cap->supported_bands & WMI_HOST_WLAN_2G_CAP) { in ath11k_mac_setup_ht_vht_cap()
3542 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath11k_mac_setup_ht_vht_cap()
3543 ht_cap = cap->band[NL80211_BAND_2GHZ].ht_cap_info; in ath11k_mac_setup_ht_vht_cap()
3546 band->ht_cap = ath11k_create_ht_cap(ar, ht_cap, in ath11k_mac_setup_ht_vht_cap()
3550 if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP && !ar->supports_6ghz) { in ath11k_mac_setup_ht_vht_cap()
3551 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath11k_mac_setup_ht_vht_cap()
3552 ht_cap = cap->band[NL80211_BAND_5GHZ].ht_cap_info; in ath11k_mac_setup_ht_vht_cap()
3555 band->ht_cap = ath11k_create_ht_cap(ar, ht_cap, in ath11k_mac_setup_ht_vht_cap()
3557 band->vht_cap = ath11k_create_vht_cap(ar, rate_cap_tx_chainmask, in ath11k_mac_setup_ht_vht_cap()
3577 he_ppet[0] = fw_ppet->numss_m1 & IEEE80211_PPE_THRES_NSS_MASK; in ath11k_gen_ppe_thresh()
3578 he_ppet[0] |= (fw_ppet->ru_bit_mask << in ath11k_gen_ppe_thresh()
3581 for (nss = 0; nss <= fw_ppet->numss_m1; nss++) { in ath11k_gen_ppe_thresh()
3586 if ((fw_ppet->ru_bit_mask & BIT(ru)) == 0) in ath11k_gen_ppe_thresh()
3588 val = (fw_ppet->ppet16_ppet8_ru3_ru0[nss] >> (ru * 6)) & in ath11k_gen_ppe_thresh()
3591 for (i = 5; i >= 0; i--) { in ath11k_gen_ppe_thresh()
3607 he_cap_elem->mac_cap_info[0] &= ~m; in ath11k_mac_filter_he_cap_mesh()
3612 he_cap_elem->mac_cap_info[2] &= ~m; in ath11k_mac_filter_he_cap_mesh()
3617 he_cap_elem->mac_cap_info[3] &= ~m; in ath11k_mac_filter_he_cap_mesh()
3621 he_cap_elem->mac_cap_info[4] &= ~m; in ath11k_mac_filter_he_cap_mesh()
3627 he_cap_elem->mac_cap_info[5] &= ~m; in ath11k_mac_filter_he_cap_mesh()
3631 he_cap_elem->phy_cap_info[2] &= ~m; in ath11k_mac_filter_he_cap_mesh()
3636 he_cap_elem->phy_cap_info[3] &= ~m; in ath11k_mac_filter_he_cap_mesh()
3639 he_cap_elem->phy_cap_info[4] &= ~m; in ath11k_mac_filter_he_cap_mesh()
3642 he_cap_elem->phy_cap_info[5] &= ~m; in ath11k_mac_filter_he_cap_mesh()
3648 he_cap_elem->phy_cap_info[6] &= ~m; in ath11k_mac_filter_he_cap_mesh()
3654 he_cap_elem->phy_cap_info[7] &= ~m; in ath11k_mac_filter_he_cap_mesh()
3660 he_cap_elem->phy_cap_info[8] &= ~m; in ath11k_mac_filter_he_cap_mesh()
3668 he_cap_elem->phy_cap_info[9] &= ~m; in ath11k_mac_filter_he_cap_mesh()
3676 bcap->he_6ghz_capa = IEEE80211_HT_MPDU_DENSITY_NONE; in ath11k_mac_setup_he_6ghz_cap()
3677 if (bcap->ht_cap_info & WMI_HT_CAP_DYNAMIC_SMPS) in ath11k_mac_setup_he_6ghz_cap()
3678 bcap->he_6ghz_capa |= in ath11k_mac_setup_he_6ghz_cap()
3682 bcap->he_6ghz_capa |= in ath11k_mac_setup_he_6ghz_cap()
3686 pcap->vht_cap); in ath11k_mac_setup_he_6ghz_cap()
3687 bcap->he_6ghz_capa |= in ath11k_mac_setup_he_6ghz_cap()
3689 val = FIELD_GET(IEEE80211_VHT_CAP_MAX_MPDU_MASK, pcap->vht_cap); in ath11k_mac_setup_he_6ghz_cap()
3690 bcap->he_6ghz_capa |= in ath11k_mac_setup_he_6ghz_cap()
3692 if (pcap->vht_cap & IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN) in ath11k_mac_setup_he_6ghz_cap()
3693 bcap->he_6ghz_capa |= IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS; in ath11k_mac_setup_he_6ghz_cap()
3694 if (pcap->vht_cap & IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN) in ath11k_mac_setup_he_6ghz_cap()
3695 bcap->he_6ghz_capa |= IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS; in ath11k_mac_setup_he_6ghz_cap()
3697 return cpu_to_le16(bcap->he_6ghz_capa); in ath11k_mac_setup_he_6ghz_cap()
3709 struct ath11k_band_cap *band_cap = &cap->band[band]; in ath11k_mac_copy_he_cap()
3711 &he_cap->he_cap_elem; in ath11k_mac_copy_he_cap()
3724 he_cap->has_he = true; in ath11k_mac_copy_he_cap()
3725 memcpy(he_cap_elem->mac_cap_info, band_cap->he_cap_info, in ath11k_mac_copy_he_cap()
3726 sizeof(he_cap_elem->mac_cap_info)); in ath11k_mac_copy_he_cap()
3727 memcpy(he_cap_elem->phy_cap_info, band_cap->he_cap_phy_info, in ath11k_mac_copy_he_cap()
3728 sizeof(he_cap_elem->phy_cap_info)); in ath11k_mac_copy_he_cap()
3730 he_cap_elem->mac_cap_info[1] &= in ath11k_mac_copy_he_cap()
3732 he_cap_elem->phy_cap_info[4] &= in ath11k_mac_copy_he_cap()
3734 he_cap_elem->phy_cap_info[4] &= in ath11k_mac_copy_he_cap()
3736 he_cap_elem->phy_cap_info[4] |= (ar->num_tx_chains - 1) << 2; in ath11k_mac_copy_he_cap()
3738 he_cap_elem->phy_cap_info[5] &= in ath11k_mac_copy_he_cap()
3740 he_cap_elem->phy_cap_info[5] &= in ath11k_mac_copy_he_cap()
3742 he_cap_elem->phy_cap_info[5] |= ar->num_tx_chains - 1; in ath11k_mac_copy_he_cap()
3746 he_cap_elem->phy_cap_info[3] &= in ath11k_mac_copy_he_cap()
3748 he_cap_elem->phy_cap_info[9] |= in ath11k_mac_copy_he_cap()
3752 he_cap_elem->mac_cap_info[0] &= in ath11k_mac_copy_he_cap()
3754 he_cap_elem->mac_cap_info[0] |= in ath11k_mac_copy_he_cap()
3756 he_cap_elem->phy_cap_info[9] |= in ath11k_mac_copy_he_cap()
3764 he_cap->he_mcs_nss_supp.rx_mcs_80 = in ath11k_mac_copy_he_cap()
3765 cpu_to_le16(band_cap->he_mcs & 0xffff); in ath11k_mac_copy_he_cap()
3766 he_cap->he_mcs_nss_supp.tx_mcs_80 = in ath11k_mac_copy_he_cap()
3767 cpu_to_le16(band_cap->he_mcs & 0xffff); in ath11k_mac_copy_he_cap()
3768 he_cap->he_mcs_nss_supp.rx_mcs_160 = in ath11k_mac_copy_he_cap()
3769 cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); in ath11k_mac_copy_he_cap()
3770 he_cap->he_mcs_nss_supp.tx_mcs_160 = in ath11k_mac_copy_he_cap()
3771 cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); in ath11k_mac_copy_he_cap()
3772 he_cap->he_mcs_nss_supp.rx_mcs_80p80 = in ath11k_mac_copy_he_cap()
3773 cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); in ath11k_mac_copy_he_cap()
3774 he_cap->he_mcs_nss_supp.tx_mcs_80p80 = in ath11k_mac_copy_he_cap()
3775 cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff); in ath11k_mac_copy_he_cap()
3777 memset(he_cap->ppe_thres, 0, sizeof(he_cap->ppe_thres)); in ath11k_mac_copy_he_cap()
3778 if (he_cap_elem->phy_cap_info[6] & in ath11k_mac_copy_he_cap()
3780 ath11k_gen_ppe_thresh(&band_cap->he_ppet, in ath11k_mac_copy_he_cap()
3781 he_cap->ppe_thres); in ath11k_mac_copy_he_cap()
3799 if (cap->supported_bands & WMI_HOST_WLAN_2G_CAP) { in ath11k_mac_setup_he_cap()
3801 ar->mac.iftype[NL80211_BAND_2GHZ], in ath11k_mac_setup_he_cap()
3803 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath11k_mac_setup_he_cap()
3804 band->iftype_data = ar->mac.iftype[NL80211_BAND_2GHZ]; in ath11k_mac_setup_he_cap()
3805 band->n_iftype_data = count; in ath11k_mac_setup_he_cap()
3808 if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP) { in ath11k_mac_setup_he_cap()
3810 ar->mac.iftype[NL80211_BAND_5GHZ], in ath11k_mac_setup_he_cap()
3812 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath11k_mac_setup_he_cap()
3813 band->iftype_data = ar->mac.iftype[NL80211_BAND_5GHZ]; in ath11k_mac_setup_he_cap()
3814 band->n_iftype_data = count; in ath11k_mac_setup_he_cap()
3817 if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP && in ath11k_mac_setup_he_cap()
3818 ar->supports_6ghz) { in ath11k_mac_setup_he_cap()
3820 ar->mac.iftype[NL80211_BAND_6GHZ], in ath11k_mac_setup_he_cap()
3822 band = &ar->mac.sbands[NL80211_BAND_6GHZ]; in ath11k_mac_setup_he_cap()
3823 band->iftype_data = ar->mac.iftype[NL80211_BAND_6GHZ]; in ath11k_mac_setup_he_cap()
3824 band->n_iftype_data = count; in ath11k_mac_setup_he_cap()
3832 lockdep_assert_held(&ar->conf_mutex); in __ath11k_set_antenna()
3835 return -EINVAL; in __ath11k_set_antenna()
3838 return -EINVAL; in __ath11k_set_antenna()
3840 ar->cfg_tx_chainmask = tx_ant; in __ath11k_set_antenna()
3841 ar->cfg_rx_chainmask = rx_ant; in __ath11k_set_antenna()
3843 if (ar->state != ATH11K_STATE_ON && in __ath11k_set_antenna()
3844 ar->state != ATH11K_STATE_RESTARTED) in __ath11k_set_antenna()
3848 tx_ant, ar->pdev->pdev_id); in __ath11k_set_antenna()
3850 ath11k_warn(ar->ab, "failed to set tx-chainmask: %d, req 0x%x\n", in __ath11k_set_antenna()
3855 ar->num_tx_chains = get_num_chains(tx_ant); in __ath11k_set_antenna()
3858 rx_ant, ar->pdev->pdev_id); in __ath11k_set_antenna()
3860 ath11k_warn(ar->ab, "failed to set rx-chainmask: %d, req 0x%x\n", in __ath11k_set_antenna()
3865 ar->num_rx_chains = get_num_chains(rx_ant); in __ath11k_set_antenna()
3868 ath11k_mac_setup_ht_vht_cap(ar, &ar->pdev->cap, NULL); in __ath11k_set_antenna()
3869 ath11k_mac_setup_he_cap(ar, &ar->pdev->cap); in __ath11k_set_antenna()
3879 struct ath11k_base *ab = ar->ab; in ath11k_mac_tx_mgmt_pending_free()
3881 spin_lock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_tx_mgmt_pending_free()
3882 idr_remove(&ar->txmgmt_idr, buf_id); in ath11k_mac_tx_mgmt_pending_free()
3883 spin_unlock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_tx_mgmt_pending_free()
3884 dma_unmap_single(ab->dev, ATH11K_SKB_CB(msdu)->paddr, msdu->len, in ath11k_mac_tx_mgmt_pending_free()
3888 memset(&info->status, 0, sizeof(info->status)); in ath11k_mac_tx_mgmt_pending_free()
3890 ieee80211_free_txskb(ar->hw, msdu); in ath11k_mac_tx_mgmt_pending_free()
3900 struct ath11k *ar = skb_cb->ar; in ath11k_mac_vif_txmgmt_idr_remove()
3901 struct ath11k_base *ab = ar->ab; in ath11k_mac_vif_txmgmt_idr_remove()
3903 if (skb_cb->vif == vif) { in ath11k_mac_vif_txmgmt_idr_remove()
3904 spin_lock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_vif_txmgmt_idr_remove()
3905 idr_remove(&ar->txmgmt_idr, buf_id); in ath11k_mac_vif_txmgmt_idr_remove()
3906 spin_unlock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_vif_txmgmt_idr_remove()
3907 dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, in ath11k_mac_vif_txmgmt_idr_remove()
3917 struct ath11k_base *ab = ar->ab; in ath11k_mac_mgmt_tx_wmi()
3918 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in ath11k_mac_mgmt_tx_wmi()
3924 spin_lock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
3925 buf_id = idr_alloc(&ar->txmgmt_idr, skb, 0, in ath11k_mac_mgmt_tx_wmi()
3927 spin_unlock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
3929 return -ENOSPC; in ath11k_mac_mgmt_tx_wmi()
3932 if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) { in ath11k_mac_mgmt_tx_wmi()
3933 if ((ieee80211_is_action(hdr->frame_control) || in ath11k_mac_mgmt_tx_wmi()
3934 ieee80211_is_deauth(hdr->frame_control) || in ath11k_mac_mgmt_tx_wmi()
3935 ieee80211_is_disassoc(hdr->frame_control)) && in ath11k_mac_mgmt_tx_wmi()
3936 ieee80211_has_protected(hdr->frame_control)) { in ath11k_mac_mgmt_tx_wmi()
3941 paddr = dma_map_single(ab->dev, skb->data, skb->len, DMA_TO_DEVICE); in ath11k_mac_mgmt_tx_wmi()
3942 if (dma_mapping_error(ab->dev, paddr)) { in ath11k_mac_mgmt_tx_wmi()
3944 ret = -EIO; in ath11k_mac_mgmt_tx_wmi()
3948 ATH11K_SKB_CB(skb)->paddr = paddr; in ath11k_mac_mgmt_tx_wmi()
3950 ret = ath11k_wmi_mgmt_send(ar, arvif->vdev_id, buf_id, skb); in ath11k_mac_mgmt_tx_wmi()
3952 ath11k_warn(ar->ab, "failed to send mgmt frame: %d\n", ret); in ath11k_mac_mgmt_tx_wmi()
3959 dma_unmap_single(ab->dev, ATH11K_SKB_CB(skb)->paddr, in ath11k_mac_mgmt_tx_wmi()
3960 skb->len, DMA_TO_DEVICE); in ath11k_mac_mgmt_tx_wmi()
3962 spin_lock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
3963 idr_remove(&ar->txmgmt_idr, buf_id); in ath11k_mac_mgmt_tx_wmi()
3964 spin_unlock_bh(&ar->txmgmt_idr_lock); in ath11k_mac_mgmt_tx_wmi()
3973 while ((skb = skb_dequeue(&ar->wmi_mgmt_tx_queue)) != NULL) in ath11k_mgmt_over_wmi_tx_purge()
3974 ieee80211_free_txskb(ar->hw, skb); in ath11k_mgmt_over_wmi_tx_purge()
3985 while ((skb = skb_dequeue(&ar->wmi_mgmt_tx_queue)) != NULL) { in ath11k_mgmt_over_wmi_tx_work()
3987 if (!info->control.vif) { in ath11k_mgmt_over_wmi_tx_work()
3988 ath11k_warn(ar->ab, "no vif found for mgmt frame, flags 0x%x\n", in ath11k_mgmt_over_wmi_tx_work()
3989 info->control.flags); in ath11k_mgmt_over_wmi_tx_work()
3990 ieee80211_free_txskb(ar->hw, skb); in ath11k_mgmt_over_wmi_tx_work()
3994 arvif = ath11k_vif_to_arvif(info->control.vif); in ath11k_mgmt_over_wmi_tx_work()
3995 if (ar->allocated_vdev_map & (1LL << arvif->vdev_id) && in ath11k_mgmt_over_wmi_tx_work()
3996 arvif->is_started) { in ath11k_mgmt_over_wmi_tx_work()
3999 ath11k_warn(ar->ab, "failed to tx mgmt frame, vdev_id %d :%d\n", in ath11k_mgmt_over_wmi_tx_work()
4000 arvif->vdev_id, ret); in ath11k_mgmt_over_wmi_tx_work()
4001 ieee80211_free_txskb(ar->hw, skb); in ath11k_mgmt_over_wmi_tx_work()
4003 atomic_inc(&ar->num_pending_mgmt_tx); in ath11k_mgmt_over_wmi_tx_work()
4006 ath11k_warn(ar->ab, in ath11k_mgmt_over_wmi_tx_work()
4008 arvif->vdev_id, info->control.flags, in ath11k_mgmt_over_wmi_tx_work()
4009 arvif->is_started); in ath11k_mgmt_over_wmi_tx_work()
4010 ieee80211_free_txskb(ar->hw, skb); in ath11k_mgmt_over_wmi_tx_work()
4018 struct sk_buff_head *q = &ar->wmi_mgmt_tx_queue; in ath11k_mac_mgmt_tx()
4020 if (test_bit(ATH11K_FLAG_CRASH_FLUSH, &ar->ab->dev_flags)) in ath11k_mac_mgmt_tx()
4021 return -ESHUTDOWN; in ath11k_mac_mgmt_tx()
4025 * other mgmt packets like auth and assoc to be sent on time in ath11k_mac_mgmt_tx()
4029 atomic_read(&ar->num_pending_mgmt_tx) > ATH11K_PRB_RSP_DROP_THRESHOLD) { in ath11k_mac_mgmt_tx()
4030 ath11k_warn(ar->ab, in ath11k_mac_mgmt_tx()
4032 return -ENOSPC; in ath11k_mac_mgmt_tx()
4036 ath11k_warn(ar->ab, "mgmt tx queue is full\n"); in ath11k_mac_mgmt_tx()
4037 return -ENOSPC; in ath11k_mac_mgmt_tx()
4041 ieee80211_queue_work(ar->hw, &ar->wmi_mgmt_tx_work); in ath11k_mac_mgmt_tx()
4051 struct ath11k *ar = hw->priv; in ath11k_mac_op_tx()
4053 struct ieee80211_vif *vif = info->control.vif; in ath11k_mac_op_tx()
4055 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in ath11k_mac_op_tx()
4059 if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { in ath11k_mac_op_tx()
4060 skb_cb->flags |= ATH11K_SKB_HW_80211_ENCAP; in ath11k_mac_op_tx()
4061 } else if (ieee80211_is_mgmt(hdr->frame_control)) { in ath11k_mac_op_tx()
4062 is_prb_rsp = ieee80211_is_probe_resp(hdr->frame_control); in ath11k_mac_op_tx()
4065 ath11k_warn(ar->ab, "failed to queue management frame %d\n", in ath11k_mac_op_tx()
4067 ieee80211_free_txskb(ar->hw, skb); in ath11k_mac_op_tx()
4074 ath11k_warn(ar->ab, "failed to transmit frame %d\n", ret); in ath11k_mac_op_tx()
4075 ieee80211_free_txskb(ar->hw, skb); in ath11k_mac_op_tx()
4081 /* make sure rcu-protected mac80211 tx path itself is drained */ in ath11k_mac_drain_tx()
4084 cancel_work_sync(&ar->wmi_mgmt_tx_work); in ath11k_mac_drain_tx()
4091 struct ath11k_base *ab = ar->ab; in ath11k_mac_config_mon_status_default()
4100 for (i = 0; i < ab->hw_params.num_rxmda_per_pdev; i++) { in ath11k_mac_config_mon_status_default()
4101 ring_id = ar->dp.rx_mon_status_refill_ring[i].refill_buf_ring.ring_id; in ath11k_mac_config_mon_status_default()
4102 ret = ath11k_dp_tx_htt_rx_filter_setup(ar->ab, ring_id, in ath11k_mac_config_mon_status_default()
4103 ar->dp.mac_id + i, in ath11k_mac_config_mon_status_default()
4114 struct ath11k *ar = hw->priv; in ath11k_mac_op_start()
4115 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_start()
4116 struct ath11k_pdev *pdev = ar->pdev; in ath11k_mac_op_start()
4120 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_start()
4122 switch (ar->state) { in ath11k_mac_op_start()
4124 ar->state = ATH11K_STATE_ON; in ath11k_mac_op_start()
4127 ar->state = ATH11K_STATE_RESTARTED; in ath11k_mac_op_start()
4133 ret = -EINVAL; in ath11k_mac_op_start()
4138 1, pdev->pdev_id); in ath11k_mac_op_start()
4141 ath11k_err(ar->ab, "failed to enable PMF QOS: (%d\n", ret); in ath11k_mac_op_start()
4146 pdev->pdev_id); in ath11k_mac_op_start()
4148 ath11k_err(ar->ab, "failed to enable dynamic bw: %d\n", ret); in ath11k_mac_op_start()
4153 0, pdev->pdev_id); in ath11k_mac_op_start()
4160 ret = ath11k_wmi_send_dfs_phyerr_offload_enable_cmd(ar, pdev->pdev_id); in ath11k_mac_op_start()
4175 1, pdev->pdev_id); in ath11k_mac_op_start()
4178 ath11k_err(ar->ab, "failed to enable MESH MCAST ENABLE: (%d\n", ret); in ath11k_mac_op_start()
4182 __ath11k_set_antenna(ar, ar->cfg_tx_chainmask, ar->cfg_rx_chainmask); in ath11k_mac_op_start()
4188 ar->num_started_vdevs = 0; in ath11k_mac_op_start()
4189 ar->num_created_vdevs = 0; in ath11k_mac_op_start()
4190 ar->num_peers = 0; in ath11k_mac_op_start()
4191 ar->allocated_vdev_map = 0; in ath11k_mac_op_start()
4204 ath11k_wmi_pdev_lro_cfg(ar, ar->pdev->pdev_id); in ath11k_mac_op_start()
4206 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_start()
4208 rcu_assign_pointer(ab->pdevs_active[ar->pdev_idx], in ath11k_mac_op_start()
4209 &ab->pdevs[ar->pdev_idx]); in ath11k_mac_op_start()
4212 if (ab->hw_params.idle_ps) { in ath11k_mac_op_start()
4214 1, pdev->pdev_id); in ath11k_mac_op_start()
4223 ar->state = ATH11K_STATE_OFF; in ath11k_mac_op_start()
4224 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_start()
4231 struct ath11k *ar = hw->priv; in ath11k_mac_op_stop()
4237 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_stop()
4240 ath11k_err(ar->ab, "failed to clear rx_filter for monitor status ring: (%d)\n", in ath11k_mac_op_stop()
4243 clear_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); in ath11k_mac_op_stop()
4244 ar->state = ATH11K_STATE_OFF; in ath11k_mac_op_stop()
4245 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_stop()
4247 cancel_delayed_work_sync(&ar->scan.timeout); in ath11k_mac_op_stop()
4248 cancel_work_sync(&ar->regd_update_work); in ath11k_mac_op_stop()
4250 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_stop()
4251 list_for_each_entry_safe(ppdu_stats, tmp, &ar->ppdu_stats_info, list) { in ath11k_mac_op_stop()
4252 list_del(&ppdu_stats->list); in ath11k_mac_op_stop()
4255 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_stop()
4257 rcu_assign_pointer(ar->ab->pdevs_active[ar->pdev_idx], NULL); in ath11k_mac_op_stop()
4261 atomic_set(&ar->num_pending_mgmt_tx, 0); in ath11k_mac_op_stop()
4268 struct ath11k *ar = arvif->ar; in ath11k_mac_setup_vdev_create_params()
4269 struct ath11k_pdev *pdev = ar->pdev; in ath11k_mac_setup_vdev_create_params()
4271 params->if_id = arvif->vdev_id; in ath11k_mac_setup_vdev_create_params()
4272 params->type = arvif->vdev_type; in ath11k_mac_setup_vdev_create_params()
4273 params->subtype = arvif->vdev_subtype; in ath11k_mac_setup_vdev_create_params()
4274 params->pdev_id = pdev->pdev_id; in ath11k_mac_setup_vdev_create_params()
4276 if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) { in ath11k_mac_setup_vdev_create_params()
4277 params->chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains; in ath11k_mac_setup_vdev_create_params()
4278 params->chains[NL80211_BAND_2GHZ].rx = ar->num_rx_chains; in ath11k_mac_setup_vdev_create_params()
4280 if (pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP) { in ath11k_mac_setup_vdev_create_params()
4281 params->chains[NL80211_BAND_5GHZ].tx = ar->num_tx_chains; in ath11k_mac_setup_vdev_create_params()
4282 params->chains[NL80211_BAND_5GHZ].rx = ar->num_rx_chains; in ath11k_mac_setup_vdev_create_params()
4284 if (pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP && in ath11k_mac_setup_vdev_create_params()
4285 ar->supports_6ghz) { in ath11k_mac_setup_vdev_create_params()
4286 params->chains[NL80211_BAND_6GHZ].tx = ar->num_tx_chains; in ath11k_mac_setup_vdev_create_params()
4287 params->chains[NL80211_BAND_6GHZ].rx = ar->num_rx_chains; in ath11k_mac_setup_vdev_create_params()
4294 struct ath11k_pdev_cap *pdev_cap = &pdev->cap; in ath11k_mac_prepare_he_mode()
4299 if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) in ath11k_mac_prepare_he_mode()
4300 cap_band = &pdev_cap->band[NL80211_BAND_2GHZ]; in ath11k_mac_prepare_he_mode()
4302 cap_band = &pdev_cap->band[NL80211_BAND_5GHZ]; in ath11k_mac_prepare_he_mode()
4304 hecap_phy_ptr = &cap_band->he_cap_phy_info[0]; in ath11k_mac_prepare_he_mode()
4327 struct ath11k_base *ab = ar->ab; in ath11k_set_he_mu_sounding_mode()
4331 param_value = ath11k_mac_prepare_he_mode(ar->pdev, arvif->vif->type); in ath11k_set_he_mu_sounding_mode()
4332 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_set_he_mu_sounding_mode()
4336 arvif->vdev_id, ret, param_value); in ath11k_set_he_mu_sounding_mode()
4344 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_set_he_mu_sounding_mode()
4348 arvif->vdev_id, ret); in ath11k_set_he_mu_sounding_mode()
4357 struct ath11k *ar = hw->priv; in ath11k_mac_op_update_vif_offload()
4358 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_update_vif_offload()
4365 (vif->type != NL80211_IFTYPE_STATION && in ath11k_mac_op_update_vif_offload()
4366 vif->type != NL80211_IFTYPE_AP)) in ath11k_mac_op_update_vif_offload()
4367 vif->offload_flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED; in ath11k_mac_op_update_vif_offload()
4369 if (vif->offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED) in ath11k_mac_op_update_vif_offload()
4371 else if (test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) in ath11k_mac_op_update_vif_offload()
4376 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_update_vif_offload()
4380 arvif->vdev_id, ret); in ath11k_mac_op_update_vif_offload()
4381 vif->offload_flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED; in ath11k_mac_op_update_vif_offload()
4388 struct ath11k *ar = hw->priv; in ath11k_mac_op_add_interface()
4389 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_add_interface()
4399 vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; in ath11k_mac_op_add_interface()
4401 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_add_interface()
4403 if (vif->type == NL80211_IFTYPE_AP && in ath11k_mac_op_add_interface()
4404 ar->num_peers > (ar->max_num_peers - 1)) { in ath11k_mac_op_add_interface()
4406 ret = -ENOBUFS; in ath11k_mac_op_add_interface()
4410 if (ar->num_created_vdevs > (TARGET_NUM_VDEVS - 1)) { in ath11k_mac_op_add_interface()
4413 ret = -EBUSY; in ath11k_mac_op_add_interface()
4419 arvif->ar = ar; in ath11k_mac_op_add_interface()
4420 arvif->vif = vif; in ath11k_mac_op_add_interface()
4422 INIT_LIST_HEAD(&arvif->list); in ath11k_mac_op_add_interface()
4428 for (i = 0; i < ARRAY_SIZE(arvif->bitrate_mask.control); i++) { in ath11k_mac_op_add_interface()
4429 arvif->bitrate_mask.control[i].legacy = 0xffffffff; in ath11k_mac_op_add_interface()
4430 memset(arvif->bitrate_mask.control[i].ht_mcs, 0xff, in ath11k_mac_op_add_interface()
4431 sizeof(arvif->bitrate_mask.control[i].ht_mcs)); in ath11k_mac_op_add_interface()
4432 memset(arvif->bitrate_mask.control[i].vht_mcs, 0xff, in ath11k_mac_op_add_interface()
4433 sizeof(arvif->bitrate_mask.control[i].vht_mcs)); in ath11k_mac_op_add_interface()
4436 bit = __ffs64(ab->free_vdev_map); in ath11k_mac_op_add_interface()
4438 arvif->vdev_id = bit; in ath11k_mac_op_add_interface()
4439 arvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE; in ath11k_mac_op_add_interface()
4441 switch (vif->type) { in ath11k_mac_op_add_interface()
4444 arvif->vdev_type = WMI_VDEV_TYPE_STA; in ath11k_mac_op_add_interface()
4447 arvif->vdev_subtype = WMI_VDEV_SUBTYPE_MESH_11S; in ath11k_mac_op_add_interface()
4450 arvif->vdev_type = WMI_VDEV_TYPE_AP; in ath11k_mac_op_add_interface()
4453 arvif->vdev_type = WMI_VDEV_TYPE_MONITOR; in ath11k_mac_op_add_interface()
4460 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac add interface id %d type %d subtype %d map %llx\n", in ath11k_mac_op_add_interface()
4461 arvif->vdev_id, arvif->vdev_type, arvif->vdev_subtype, in ath11k_mac_op_add_interface()
4462 ab->free_vdev_map); in ath11k_mac_op_add_interface()
4464 vif->cab_queue = arvif->vdev_id % (ATH11K_HW_MAX_QUEUES - 1); in ath11k_mac_op_add_interface()
4465 for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++) in ath11k_mac_op_add_interface()
4466 vif->hw_queue[i] = i % (ATH11K_HW_MAX_QUEUES - 1); in ath11k_mac_op_add_interface()
4470 ret = ath11k_wmi_vdev_create(ar, vif->addr, &vdev_param); in ath11k_mac_op_add_interface()
4473 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
4477 ar->num_created_vdevs++; in ath11k_mac_op_add_interface()
4479 vif->addr, arvif->vdev_id); in ath11k_mac_op_add_interface()
4480 ar->allocated_vdev_map |= 1LL << arvif->vdev_id; in ath11k_mac_op_add_interface()
4481 ab->free_vdev_map &= ~(1LL << arvif->vdev_id); in ath11k_mac_op_add_interface()
4483 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
4484 list_add(&arvif->list, &ar->arvifs); in ath11k_mac_op_add_interface()
4485 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
4489 nss = get_num_chains(ar->cfg_tx_chainmask) ? : 1; in ath11k_mac_op_add_interface()
4490 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
4494 arvif->vdev_id, ar->cfg_tx_chainmask, nss, ret); in ath11k_mac_op_add_interface()
4498 switch (arvif->vdev_type) { in ath11k_mac_op_add_interface()
4500 peer_param.vdev_id = arvif->vdev_id; in ath11k_mac_op_add_interface()
4501 peer_param.peer_addr = vif->addr; in ath11k_mac_op_add_interface()
4506 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
4512 ath11k_warn(ar->ab, "failed to set vdev %i kickout parameters: %d\n", in ath11k_mac_op_add_interface()
4513 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
4520 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
4523 ath11k_warn(ar->ab, "failed to set vdev %d RX wake policy: %d\n", in ath11k_mac_op_add_interface()
4524 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
4530 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
4533 ath11k_warn(ar->ab, "failed to set vdev %d TX wake threshold: %d\n", in ath11k_mac_op_add_interface()
4534 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
4540 ret = ath11k_wmi_set_sta_ps_param(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
4543 ath11k_warn(ar->ab, "failed to set vdev %d pspoll count: %d\n", in ath11k_mac_op_add_interface()
4544 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
4548 ret = ath11k_wmi_pdev_set_ps_mode(ar, arvif->vdev_id, false); in ath11k_mac_op_add_interface()
4550 ath11k_warn(ar->ab, "failed to disable vdev %d ps mode: %d\n", in ath11k_mac_op_add_interface()
4551 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
4559 arvif->txpower = vif->bss_conf.txpower; in ath11k_mac_op_add_interface()
4565 param_value = ar->hw->wiphy->rts_threshold; in ath11k_mac_op_add_interface()
4566 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_op_add_interface()
4569 ath11k_warn(ar->ab, "failed to set rts threshold for vdev %d: %d\n", in ath11k_mac_op_add_interface()
4570 arvif->vdev_id, ret); in ath11k_mac_op_add_interface()
4575 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_add_interface()
4580 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath11k_mac_op_add_interface()
4581 ar->num_peers--; in ath11k_mac_op_add_interface()
4582 ath11k_wmi_send_peer_delete_cmd(ar, vif->addr, arvif->vdev_id); in ath11k_mac_op_add_interface()
4586 ath11k_wmi_vdev_delete(ar, arvif->vdev_id); in ath11k_mac_op_add_interface()
4587 ar->num_created_vdevs--; in ath11k_mac_op_add_interface()
4588 ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id); in ath11k_mac_op_add_interface()
4589 ab->free_vdev_map |= 1LL << arvif->vdev_id; in ath11k_mac_op_add_interface()
4590 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
4591 list_del(&arvif->list); in ath11k_mac_op_add_interface()
4592 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_add_interface()
4595 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_add_interface()
4605 if (skb_cb->vif == vif) in ath11k_mac_vif_unref()
4606 skb_cb->vif = NULL; in ath11k_mac_vif_unref()
4614 struct ath11k *ar = hw->priv; in ath11k_mac_op_remove_interface()
4616 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_remove_interface()
4620 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_remove_interface()
4623 arvif->vdev_id); in ath11k_mac_op_remove_interface()
4625 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_remove_interface()
4626 list_del(&arvif->list); in ath11k_mac_op_remove_interface()
4627 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_remove_interface()
4629 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath11k_mac_op_remove_interface()
4630 ret = ath11k_peer_delete(ar, arvif->vdev_id, vif->addr); in ath11k_mac_op_remove_interface()
4632 ath11k_warn(ab, "failed to submit AP self-peer removal on vdev %d: %d\n", in ath11k_mac_op_remove_interface()
4633 arvif->vdev_id, ret); in ath11k_mac_op_remove_interface()
4636 ret = ath11k_wmi_vdev_delete(ar, arvif->vdev_id); in ath11k_mac_op_remove_interface()
4639 arvif->vdev_id, ret); in ath11k_mac_op_remove_interface()
4641 ar->num_created_vdevs--; in ath11k_mac_op_remove_interface()
4643 vif->addr, arvif->vdev_id); in ath11k_mac_op_remove_interface()
4644 ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id); in ath11k_mac_op_remove_interface()
4645 ab->free_vdev_map |= 1LL << (arvif->vdev_id); in ath11k_mac_op_remove_interface()
4647 ath11k_peer_cleanup(ar, arvif->vdev_id); in ath11k_mac_op_remove_interface()
4649 idr_for_each(&ar->txmgmt_idr, in ath11k_mac_op_remove_interface()
4653 spin_lock_bh(&ab->dp.tx_ring[i].tx_idr_lock); in ath11k_mac_op_remove_interface()
4654 idr_for_each(&ab->dp.tx_ring[i].txbuf_idr, in ath11k_mac_op_remove_interface()
4656 spin_unlock_bh(&ab->dp.tx_ring[i].tx_idr_lock); in ath11k_mac_op_remove_interface()
4661 clear_bit(ATH11K_FLAG_MONITOR_ENABLED, &ar->monitor_flags); in ath11k_mac_op_remove_interface()
4665 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_remove_interface()
4683 struct ath11k *ar = hw->priv; in ath11k_mac_op_configure_filter()
4687 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_configure_filter()
4691 ar->filter_flags = *total_flags; in ath11k_mac_op_configure_filter()
4694 reset_flag = !(ar->filter_flags & FIF_BCN_PRBRESP_PROMISC); in ath11k_mac_op_configure_filter()
4699 set_bit(ATH11K_FLAG_MONITOR_ENABLED, &ar->monitor_flags); in ath11k_mac_op_configure_filter()
4701 clear_bit(ATH11K_FLAG_MONITOR_ENABLED, &ar->monitor_flags); in ath11k_mac_op_configure_filter()
4703 ath11k_warn(ar->ab, in ath11k_mac_op_configure_filter()
4706 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_configure_filter()
4710 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_configure_filter()
4715 struct ath11k *ar = hw->priv; in ath11k_mac_op_get_antenna()
4717 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_get_antenna()
4719 *tx_ant = ar->cfg_tx_chainmask; in ath11k_mac_op_get_antenna()
4720 *rx_ant = ar->cfg_rx_chainmask; in ath11k_mac_op_get_antenna()
4722 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_get_antenna()
4729 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_antenna()
4732 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_antenna()
4734 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_antenna()
4743 struct ath11k *ar = hw->priv; in ath11k_mac_op_ampdu_action()
4744 int ret = -EINVAL; in ath11k_mac_op_ampdu_action()
4746 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_ampdu_action()
4748 switch (params->action) { in ath11k_mac_op_ampdu_action()
4760 /* Tx A-MPDU aggregation offloaded to hw/fw so deny mac80211 in ath11k_mac_op_ampdu_action()
4763 ret = -EOPNOTSUPP; in ath11k_mac_op_ampdu_action()
4767 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_ampdu_action()
4775 struct ath11k *ar = hw->priv; in ath11k_mac_op_add_chanctx()
4776 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_add_chanctx()
4780 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath11k_mac_op_add_chanctx()
4782 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_add_chanctx()
4784 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_add_chanctx()
4788 ar->rx_channel = ctx->def.chan; in ath11k_mac_op_add_chanctx()
4789 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_add_chanctx()
4791 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_add_chanctx()
4799 struct ath11k *ar = hw->priv; in ath11k_mac_op_remove_chanctx()
4800 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_remove_chanctx()
4804 ctx->def.chan->center_freq, ctx->def.width, ctx); in ath11k_mac_op_remove_chanctx()
4806 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_remove_chanctx()
4808 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_remove_chanctx()
4812 ar->rx_channel = NULL; in ath11k_mac_op_remove_chanctx()
4813 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_remove_chanctx()
4815 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_remove_chanctx()
4820 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vdev_setup_sync()
4822 if (test_bit(ATH11K_FLAG_CRASH_FLUSH, &ar->ab->dev_flags)) in ath11k_mac_vdev_setup_sync()
4823 return -ESHUTDOWN; in ath11k_mac_vdev_setup_sync()
4825 if (!wait_for_completion_timeout(&ar->vdev_setup_done, in ath11k_mac_vdev_setup_sync()
4827 return -ETIMEDOUT; in ath11k_mac_vdev_setup_sync()
4829 return ar->last_wmi_vdev_start_status ? -EINVAL : 0; in ath11k_mac_vdev_setup_sync()
4837 struct ath11k *ar = arvif->ar; in ath11k_mac_vdev_start_restart()
4838 struct ath11k_base *ab = ar->ab; in ath11k_mac_vdev_start_restart()
4840 int he_support = arvif->vif->bss_conf.he_support; in ath11k_mac_vdev_start_restart()
4843 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vdev_start_restart()
4845 reinit_completion(&ar->vdev_setup_done); in ath11k_mac_vdev_start_restart()
4847 arg.vdev_id = arvif->vdev_id; in ath11k_mac_vdev_start_restart()
4848 arg.dtim_period = arvif->dtim_period; in ath11k_mac_vdev_start_restart()
4849 arg.bcn_intval = arvif->beacon_interval; in ath11k_mac_vdev_start_restart()
4851 arg.channel.freq = chandef->chan->center_freq; in ath11k_mac_vdev_start_restart()
4852 arg.channel.band_center_freq1 = chandef->center_freq1; in ath11k_mac_vdev_start_restart()
4853 arg.channel.band_center_freq2 = chandef->center_freq2; in ath11k_mac_vdev_start_restart()
4855 ath11k_phymodes[chandef->chan->band][chandef->width]; in ath11k_mac_vdev_start_restart()
4858 arg.channel.max_power = chandef->chan->max_power * 2; in ath11k_mac_vdev_start_restart()
4859 arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; in ath11k_mac_vdev_start_restart()
4860 arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain * 2; in ath11k_mac_vdev_start_restart()
4862 arg.pref_tx_streams = ar->num_tx_chains; in ath11k_mac_vdev_start_restart()
4863 arg.pref_rx_streams = ar->num_rx_chains; in ath11k_mac_vdev_start_restart()
4865 if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { in ath11k_mac_vdev_start_restart()
4866 arg.ssid = arvif->u.ap.ssid; in ath11k_mac_vdev_start_restart()
4867 arg.ssid_len = arvif->u.ap.ssid_len; in ath11k_mac_vdev_start_restart()
4868 arg.hidden_ssid = arvif->u.ap.hidden_ssid; in ath11k_mac_vdev_start_restart()
4872 !!(chandef->chan->flags & IEEE80211_CHAN_RADAR); in ath11k_mac_vdev_start_restart()
4876 spin_lock_bh(&ab->base_lock); in ath11k_mac_vdev_start_restart()
4877 arg.regdomain = ar->ab->dfs_region; in ath11k_mac_vdev_start_restart()
4878 spin_unlock_bh(&ab->base_lock); in ath11k_mac_vdev_start_restart()
4884 ath11k_warn(ar->ab, "failed to set he mode vdev %i\n", in ath11k_mac_vdev_start_restart()
4891 arg.channel.passive |= !!(chandef->chan->flags & IEEE80211_CHAN_NO_IR); in ath11k_mac_vdev_start_restart()
4900 ath11k_warn(ar->ab, "failed to %s WMI vdev %i\n", in ath11k_mac_vdev_start_restart()
4912 ar->num_started_vdevs++; in ath11k_mac_vdev_start_restart()
4914 arvif->vif->addr, arvif->vdev_id); in ath11k_mac_vdev_start_restart()
4923 if (arvif->vdev_type == WMI_VDEV_TYPE_AP && in ath11k_mac_vdev_start_restart()
4924 chandef->chan->dfs_cac_ms && in ath11k_mac_vdev_start_restart()
4925 chandef->chan->dfs_state == NL80211_DFS_USABLE) { in ath11k_mac_vdev_start_restart()
4926 set_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); in ath11k_mac_vdev_start_restart()
4935 arvif->vdev_id, ret); in ath11k_mac_vdev_start_restart()
4942 struct ath11k *ar = arvif->ar; in ath11k_mac_vdev_stop()
4945 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_vdev_stop()
4947 reinit_completion(&ar->vdev_setup_done); in ath11k_mac_vdev_stop()
4949 spin_lock_bh(&ar->data_lock); in ath11k_mac_vdev_stop()
4951 ar->vdev_stop_status.stop_in_progress = true; in ath11k_mac_vdev_stop()
4952 ar->vdev_stop_status.vdev_id = arvif->vdev_id; in ath11k_mac_vdev_stop()
4954 spin_unlock_bh(&ar->data_lock); in ath11k_mac_vdev_stop()
4956 ret = ath11k_wmi_vdev_stop(ar, arvif->vdev_id); in ath11k_mac_vdev_stop()
4958 ath11k_warn(ar->ab, "failed to stop WMI vdev %i: %d\n", in ath11k_mac_vdev_stop()
4959 arvif->vdev_id, ret); in ath11k_mac_vdev_stop()
4965 ath11k_warn(ar->ab, "failed to synchronize setup for vdev %i: %d\n", in ath11k_mac_vdev_stop()
4966 arvif->vdev_id, ret); in ath11k_mac_vdev_stop()
4970 WARN_ON(ar->num_started_vdevs == 0); in ath11k_mac_vdev_stop()
4972 ar->num_started_vdevs--; in ath11k_mac_vdev_stop()
4973 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %pM stopped, vdev_id %d\n", in ath11k_mac_vdev_stop()
4974 arvif->vif->addr, arvif->vdev_id); in ath11k_mac_vdev_stop()
4976 if (test_bit(ATH11K_CAC_RUNNING, &ar->dev_flags)) { in ath11k_mac_vdev_stop()
4977 clear_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); in ath11k_mac_vdev_stop()
4978 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "CAC Stopped for vdev %d\n", in ath11k_mac_vdev_stop()
4979 arvif->vdev_id); in ath11k_mac_vdev_stop()
4984 spin_lock_bh(&ar->data_lock); in ath11k_mac_vdev_stop()
4985 ar->vdev_stop_status.stop_in_progress = false; in ath11k_mac_vdev_stop()
4986 spin_unlock_bh(&ar->data_lock); in ath11k_mac_vdev_stop()
5016 if (rcu_access_pointer(vif->chanctx_conf) != arg->ctx) in ath11k_mac_change_chanctx_cnt_iter()
5019 arg->n_vifs++; in ath11k_mac_change_chanctx_cnt_iter()
5029 ctx = rcu_access_pointer(vif->chanctx_conf); in ath11k_mac_change_chanctx_fill_iter()
5030 if (ctx != arg->ctx) in ath11k_mac_change_chanctx_fill_iter()
5033 if (WARN_ON(arg->next_vif == arg->n_vifs)) in ath11k_mac_change_chanctx_fill_iter()
5036 arg->vifs[arg->next_vif].vif = vif; in ath11k_mac_change_chanctx_fill_iter()
5037 arg->vifs[arg->next_vif].old_ctx = ctx; in ath11k_mac_change_chanctx_fill_iter()
5038 arg->vifs[arg->next_vif].new_ctx = ctx; in ath11k_mac_change_chanctx_fill_iter()
5039 arg->next_vif++; in ath11k_mac_change_chanctx_fill_iter()
5047 struct ath11k_base *ab = ar->ab; in ath11k_mac_update_vif_chan()
5052 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_update_vif_chan()
5055 arvif = (void *)vifs[i].vif->drv_priv; in ath11k_mac_update_vif_chan()
5058 "mac chanctx switch vdev_id %i freq %hu->%hu width %d->%d\n", in ath11k_mac_update_vif_chan()
5059 arvif->vdev_id, in ath11k_mac_update_vif_chan()
5060 vifs[i].old_ctx->def.chan->center_freq, in ath11k_mac_update_vif_chan()
5061 vifs[i].new_ctx->def.chan->center_freq, in ath11k_mac_update_vif_chan()
5062 vifs[i].old_ctx->def.width, in ath11k_mac_update_vif_chan()
5063 vifs[i].new_ctx->def.width); in ath11k_mac_update_vif_chan()
5065 if (WARN_ON(!arvif->is_started)) in ath11k_mac_update_vif_chan()
5068 if (WARN_ON(!arvif->is_up)) in ath11k_mac_update_vif_chan()
5071 ret = ath11k_wmi_vdev_down(ar, arvif->vdev_id); in ath11k_mac_update_vif_chan()
5074 arvif->vdev_id, ret); in ath11k_mac_update_vif_chan()
5083 /* TODO: Update ar->rx_channel */ in ath11k_mac_update_vif_chan()
5086 arvif = (void *)vifs[i].vif->drv_priv; in ath11k_mac_update_vif_chan()
5088 if (WARN_ON(!arvif->is_started)) in ath11k_mac_update_vif_chan()
5091 if (WARN_ON(!arvif->is_up)) in ath11k_mac_update_vif_chan()
5099 ret = ath11k_mac_vdev_restart(arvif, &vifs[i].new_ctx->def); in ath11k_mac_update_vif_chan()
5102 arvif->vdev_id, ret); in ath11k_mac_update_vif_chan()
5106 ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, in ath11k_mac_update_vif_chan()
5107 arvif->bssid); in ath11k_mac_update_vif_chan()
5110 arvif->vdev_id, ret); in ath11k_mac_update_vif_chan()
5122 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_update_active_vif_chan()
5124 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_update_active_vif_chan()
5135 ieee80211_iterate_active_interfaces_atomic(ar->hw, in ath11k_mac_update_active_vif_chan()
5149 struct ath11k *ar = hw->priv; in ath11k_mac_op_change_chanctx()
5150 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_change_chanctx()
5152 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_change_chanctx()
5156 ctx->def.chan->center_freq, ctx->def.width, ctx, changed); in ath11k_mac_op_change_chanctx()
5170 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_change_chanctx()
5176 struct ath11k *ar = hw->priv; in ath11k_start_vdev_delay()
5177 struct ath11k_base *ab = ar->ab; in ath11k_start_vdev_delay()
5178 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_start_vdev_delay()
5181 if (WARN_ON(arvif->is_started)) in ath11k_start_vdev_delay()
5182 return -EBUSY; in ath11k_start_vdev_delay()
5184 ret = ath11k_mac_vdev_start(arvif, &arvif->chanctx.def); in ath11k_start_vdev_delay()
5187 arvif->vdev_id, vif->addr, in ath11k_start_vdev_delay()
5188 arvif->chanctx.def.chan->center_freq, ret); in ath11k_start_vdev_delay()
5192 if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { in ath11k_start_vdev_delay()
5193 ret = ath11k_monitor_vdev_up(ar, arvif->vdev_id); in ath11k_start_vdev_delay()
5200 arvif->is_started = true; in ath11k_start_vdev_delay()
5211 struct ath11k *ar = hw->priv; in ath11k_mac_op_assign_vif_chanctx()
5212 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_assign_vif_chanctx()
5213 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_op_assign_vif_chanctx()
5217 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_assign_vif_chanctx()
5221 ctx, arvif->vdev_id); in ath11k_mac_op_assign_vif_chanctx()
5224 if (ab->hw_params.vdev_start_delay && in ath11k_mac_op_assign_vif_chanctx()
5225 arvif->vdev_type != WMI_VDEV_TYPE_AP && in ath11k_mac_op_assign_vif_chanctx()
5226 arvif->vdev_type != WMI_VDEV_TYPE_MONITOR) { in ath11k_mac_op_assign_vif_chanctx()
5227 memcpy(&arvif->chanctx, ctx, sizeof(*ctx)); in ath11k_mac_op_assign_vif_chanctx()
5228 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_assign_vif_chanctx()
5232 if (WARN_ON(arvif->is_started)) { in ath11k_mac_op_assign_vif_chanctx()
5233 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_assign_vif_chanctx()
5234 return -EBUSY; in ath11k_mac_op_assign_vif_chanctx()
5237 if (ab->hw_params.vdev_start_delay) { in ath11k_mac_op_assign_vif_chanctx()
5238 param.vdev_id = arvif->vdev_id; in ath11k_mac_op_assign_vif_chanctx()
5240 param.peer_addr = ar->mac_addr; in ath11k_mac_op_assign_vif_chanctx()
5244 ret = ath11k_mac_vdev_start(arvif, &ctx->def); in ath11k_mac_op_assign_vif_chanctx()
5247 arvif->vdev_id, vif->addr, in ath11k_mac_op_assign_vif_chanctx()
5248 ctx->def.chan->center_freq, ret); in ath11k_mac_op_assign_vif_chanctx()
5251 if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { in ath11k_mac_op_assign_vif_chanctx()
5252 ret = ath11k_monitor_vdev_up(ar, arvif->vdev_id); in ath11k_mac_op_assign_vif_chanctx()
5257 arvif->is_started = true; in ath11k_mac_op_assign_vif_chanctx()
5261 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_assign_vif_chanctx()
5266 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_assign_vif_chanctx()
5276 struct ath11k *ar = hw->priv; in ath11k_mac_op_unassign_vif_chanctx()
5277 struct ath11k_base *ab = ar->ab; in ath11k_mac_op_unassign_vif_chanctx()
5278 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_op_unassign_vif_chanctx()
5281 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_unassign_vif_chanctx()
5285 ctx, arvif->vdev_id); in ath11k_mac_op_unassign_vif_chanctx()
5287 WARN_ON(!arvif->is_started); in ath11k_mac_op_unassign_vif_chanctx()
5289 if (ab->hw_params.vdev_start_delay && in ath11k_mac_op_unassign_vif_chanctx()
5290 arvif->vdev_type == WMI_VDEV_TYPE_MONITOR && in ath11k_mac_op_unassign_vif_chanctx()
5291 ath11k_peer_find_by_addr(ab, ar->mac_addr)) in ath11k_mac_op_unassign_vif_chanctx()
5292 ath11k_peer_delete(ar, arvif->vdev_id, ar->mac_addr); in ath11k_mac_op_unassign_vif_chanctx()
5297 arvif->vdev_id, ret); in ath11k_mac_op_unassign_vif_chanctx()
5299 arvif->is_started = false; in ath11k_mac_op_unassign_vif_chanctx()
5301 if (ab->hw_params.vdev_start_delay && in ath11k_mac_op_unassign_vif_chanctx()
5302 arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) in ath11k_mac_op_unassign_vif_chanctx()
5303 ath11k_wmi_vdev_down(ar, arvif->vdev_id); in ath11k_mac_op_unassign_vif_chanctx()
5305 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_unassign_vif_chanctx()
5314 struct ath11k *ar = hw->priv; in ath11k_mac_op_switch_vif_chanctx()
5316 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_switch_vif_chanctx()
5318 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_op_switch_vif_chanctx()
5323 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_switch_vif_chanctx()
5334 mutex_lock(&ar->conf_mutex); in ath11k_set_vdev_param_to_all_vifs()
5335 list_for_each_entry(arvif, &ar->arvifs, list) { in ath11k_set_vdev_param_to_all_vifs()
5336 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "setting mac vdev %d param %d value %d\n", in ath11k_set_vdev_param_to_all_vifs()
5337 param, arvif->vdev_id, value); in ath11k_set_vdev_param_to_all_vifs()
5339 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_set_vdev_param_to_all_vifs()
5342 ath11k_warn(ar->ab, "failed to set param %d for vdev %d: %d\n", in ath11k_set_vdev_param_to_all_vifs()
5343 param, arvif->vdev_id, ret); in ath11k_set_vdev_param_to_all_vifs()
5347 mutex_unlock(&ar->conf_mutex); in ath11k_set_vdev_param_to_all_vifs()
5356 struct ath11k *ar = hw->priv; in ath11k_mac_op_set_rts_threshold()
5374 return -EOPNOTSUPP; in ath11k_mac_op_set_frag_threshold()
5380 struct ath11k *ar = hw->priv; in ath11k_mac_op_flush()
5386 time_left = wait_event_timeout(ar->dp.tx_empty_waitq, in ath11k_mac_op_flush()
5387 (atomic_read(&ar->dp.num_tx_pending) == 0), in ath11k_mac_op_flush()
5390 ath11k_warn(ar->ab, "failed to flush transmit queue %ld\n", time_left); in ath11k_mac_op_flush()
5401 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) in ath11k_mac_bitrate_mask_num_ht_rates()
5402 num_rates += hweight16(mask->control[band].ht_mcs[i]); in ath11k_mac_bitrate_mask_num_ht_rates()
5414 num_rates = hweight32(mask->control[band].legacy); in ath11k_mac_has_single_legacy_rate()
5431 struct ieee80211_supported_band *sband = &ar->mac.sbands[band]; in ath11k_mac_bitrate_mask_get_single_nss()
5432 u16 vht_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map); in ath11k_mac_bitrate_mask_get_single_nss()
5441 for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) { in ath11k_mac_bitrate_mask_get_single_nss()
5442 if (mask->control[band].ht_mcs[i] == 0) in ath11k_mac_bitrate_mask_get_single_nss()
5444 else if (mask->control[band].ht_mcs[i] == in ath11k_mac_bitrate_mask_get_single_nss()
5445 sband->ht_cap.mcs.rx_mask[i]) in ath11k_mac_bitrate_mask_get_single_nss()
5451 for (i = 0; i < ARRAY_SIZE(mask->control[band].vht_mcs); i++) { in ath11k_mac_bitrate_mask_get_single_nss()
5452 if (mask->control[band].vht_mcs[i] == 0) in ath11k_mac_bitrate_mask_get_single_nss()
5454 else if (mask->control[band].vht_mcs[i] == in ath11k_mac_bitrate_mask_get_single_nss()
5467 if (BIT(fls(ht_nss_mask)) - 1 != ht_nss_mask) in ath11k_mac_bitrate_mask_get_single_nss()
5486 if (hweight32(mask->control[band].legacy) != 1) in ath11k_mac_get_single_legacy_rate()
5487 return -EINVAL; in ath11k_mac_get_single_legacy_rate()
5489 rate_idx = ffs(mask->control[band].legacy) - 1; in ath11k_mac_get_single_legacy_rate()
5511 struct ath11k *ar = arvif->ar; in ath11k_mac_set_fixed_rate_params()
5515 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_set_fixed_rate_params()
5517 …ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac set fixed rate params vdev %i rate 0x%02hhx nss %hhu sgi %… in ath11k_mac_set_fixed_rate_params()
5518 arvif->vdev_id, rate, nss, sgi); in ath11k_mac_set_fixed_rate_params()
5521 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_fixed_rate_params()
5524 ath11k_warn(ar->ab, "failed to set fixed rate param 0x%02x: %d\n", in ath11k_mac_set_fixed_rate_params()
5530 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_fixed_rate_params()
5533 ath11k_warn(ar->ab, "failed to set nss param %d: %d\n", in ath11k_mac_set_fixed_rate_params()
5539 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_fixed_rate_params()
5542 ath11k_warn(ar->ab, "failed to set sgi param %d: %d\n", in ath11k_mac_set_fixed_rate_params()
5548 ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, in ath11k_mac_set_fixed_rate_params()
5551 ath11k_warn(ar->ab, "failed to set ldpc param %d: %d\n", in ath11k_mac_set_fixed_rate_params()
5568 vht_mcs = mask->control[band].vht_mcs[i]; in ath11k_mac_vht_mcs_range_present()
5572 case BIT(8) - 1: in ath11k_mac_vht_mcs_range_present()
5573 case BIT(9) - 1: in ath11k_mac_vht_mcs_range_present()
5574 case BIT(10) - 1: in ath11k_mac_vht_mcs_range_present()
5588 struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; in ath11k_mac_set_bitrate_mask_iter()
5589 struct ath11k *ar = arvif->ar; in ath11k_mac_set_bitrate_mask_iter()
5591 spin_lock_bh(&ar->data_lock); in ath11k_mac_set_bitrate_mask_iter()
5592 arsta->changed |= IEEE80211_RC_SUPP_RATES_CHANGED; in ath11k_mac_set_bitrate_mask_iter()
5593 spin_unlock_bh(&ar->data_lock); in ath11k_mac_set_bitrate_mask_iter()
5595 ieee80211_queue_work(ar->hw, &arsta->update_wk); in ath11k_mac_set_bitrate_mask_iter()
5602 struct ath11k *ar = arvif->ar; in ath11k_mac_disable_peer_fixed_rate()
5605 ret = ath11k_wmi_set_peer_param(ar, sta->addr, in ath11k_mac_disable_peer_fixed_rate()
5606 arvif->vdev_id, in ath11k_mac_disable_peer_fixed_rate()
5610 ath11k_warn(ar->ab, in ath11k_mac_disable_peer_fixed_rate()
5612 sta->addr, ret); in ath11k_mac_disable_peer_fixed_rate()
5620 struct ath11k_vif *arvif = (void *)vif->drv_priv; in ath11k_mac_op_set_bitrate_mask()
5622 struct ath11k *ar = arvif->ar; in ath11k_mac_op_set_bitrate_mask()
5635 return -EPERM; in ath11k_mac_op_set_bitrate_mask()
5637 band = def.chan->band; in ath11k_mac_op_set_bitrate_mask()
5638 ht_mcs_mask = mask->control[band].ht_mcs; in ath11k_mac_op_set_bitrate_mask()
5639 vht_mcs_mask = mask->control[band].vht_mcs; in ath11k_mac_op_set_bitrate_mask()
5640 ldpc = !!(ar->ht_cap_info & WMI_HT_CAP_LDPC); in ath11k_mac_op_set_bitrate_mask()
5642 sgi = mask->control[band].gi; in ath11k_mac_op_set_bitrate_mask()
5644 return -EINVAL; in ath11k_mac_op_set_bitrate_mask()
5658 ath11k_warn(ar->ab, "failed to get single legacy rate for vdev %i: %d\n", in ath11k_mac_op_set_bitrate_mask()
5659 arvif->vdev_id, ret); in ath11k_mac_op_set_bitrate_mask()
5662 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_mac_op_set_bitrate_mask()
5671 nss = min_t(u32, ar->num_tx_chains, in ath11k_mac_op_set_bitrate_mask()
5678 * - Single VHT Rate : peer_assoc command accommodates only MCS in ath11k_mac_op_set_bitrate_mask()
5679 * range values i.e 0-7, 0-8, 0-9 for VHT. Though mac80211 in ath11k_mac_op_set_bitrate_mask()
5685 * If single VHT rate is passed along with HT rates, we select in ath11k_mac_op_set_bitrate_mask()
5687 * - Multiple VHT Rates : When Multiple VHT rates are given,this in ath11k_mac_op_set_bitrate_mask()
5688 * can be set using RATEMASK CMD which uses FW rate-ctl alg. in ath11k_mac_op_set_bitrate_mask()
5703 ath11k_warn(ar->ab, in ath11k_mac_op_set_bitrate_mask()
5705 return -EINVAL; in ath11k_mac_op_set_bitrate_mask()
5708 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_mac_op_set_bitrate_mask()
5712 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
5714 arvif->bitrate_mask = *mask; in ath11k_mac_op_set_bitrate_mask()
5715 ieee80211_iterate_stations_atomic(ar->hw, in ath11k_mac_op_set_bitrate_mask()
5719 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
5722 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
5726 ath11k_warn(ar->ab, "failed to set fixed rate params on vdev %i: %d\n", in ath11k_mac_op_set_bitrate_mask()
5727 arvif->vdev_id, ret); in ath11k_mac_op_set_bitrate_mask()
5730 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_set_bitrate_mask()
5739 struct ath11k *ar = hw->priv; in ath11k_mac_op_reconfig_complete()
5744 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_reconfig_complete()
5746 if (ar->state == ATH11K_STATE_RESTARTED) { in ath11k_mac_op_reconfig_complete()
5747 ath11k_warn(ar->ab, "pdev %d successfully recovered\n", in ath11k_mac_op_reconfig_complete()
5748 ar->pdev->pdev_id); in ath11k_mac_op_reconfig_complete()
5749 ar->state = ATH11K_STATE_ON; in ath11k_mac_op_reconfig_complete()
5750 ieee80211_wake_queues(ar->hw); in ath11k_mac_op_reconfig_complete()
5753 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_reconfig_complete()
5763 lockdep_assert_held(&ar->conf_mutex); in ath11k_mac_update_bss_chan_survey()
5765 if (!test_bit(WMI_TLV_SERVICE_BSS_CHANNEL_INFO_64, ar->ab->wmi_ab.svc_map) || in ath11k_mac_update_bss_chan_survey()
5766 ar->rx_channel != channel) in ath11k_mac_update_bss_chan_survey()
5769 if (ar->scan.state != ATH11K_SCAN_IDLE) { in ath11k_mac_update_bss_chan_survey()
5770 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, in ath11k_mac_update_bss_chan_survey()
5775 reinit_completion(&ar->bss_survey_done); in ath11k_mac_update_bss_chan_survey()
5779 ath11k_warn(ar->ab, "failed to send pdev bss chan info request\n"); in ath11k_mac_update_bss_chan_survey()
5783 ret = wait_for_completion_timeout(&ar->bss_survey_done, 3 * HZ); in ath11k_mac_update_bss_chan_survey()
5785 ath11k_warn(ar->ab, "bss channel survey timed out\n"); in ath11k_mac_update_bss_chan_survey()
5791 struct ath11k *ar = hw->priv; in ath11k_mac_op_get_survey()
5797 return -ENOENT; in ath11k_mac_op_get_survey()
5799 ar_survey = &ar->survey[idx]; in ath11k_mac_op_get_survey()
5801 mutex_lock(&ar->conf_mutex); in ath11k_mac_op_get_survey()
5803 sband = hw->wiphy->bands[NL80211_BAND_2GHZ]; in ath11k_mac_op_get_survey()
5804 if (sband && idx >= sband->n_channels) { in ath11k_mac_op_get_survey()
5805 idx -= sband->n_channels; in ath11k_mac_op_get_survey()
5810 sband = hw->wiphy->bands[NL80211_BAND_5GHZ]; in ath11k_mac_op_get_survey()
5812 if (!sband || idx >= sband->n_channels) { in ath11k_mac_op_get_survey()
5813 ret = -ENOENT; in ath11k_mac_op_get_survey()
5817 ath11k_mac_update_bss_chan_survey(ar, &sband->channels[idx]); in ath11k_mac_op_get_survey()
5819 spin_lock_bh(&ar->data_lock); in ath11k_mac_op_get_survey()
5821 spin_unlock_bh(&ar->data_lock); in ath11k_mac_op_get_survey()
5823 survey->channel = &sband->channels[idx]; in ath11k_mac_op_get_survey()
5825 if (ar->rx_channel == survey->channel) in ath11k_mac_op_get_survey()
5826 survey->filled |= SURVEY_INFO_IN_USE; in ath11k_mac_op_get_survey()
5829 mutex_unlock(&ar->conf_mutex); in ath11k_mac_op_get_survey()
5838 struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; in ath11k_mac_op_sta_statistics()
5840 sinfo->rx_duration = arsta->rx_duration; in ath11k_mac_op_sta_statistics()
5841 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION); in ath11k_mac_op_sta_statistics()
5843 sinfo->tx_duration = arsta->tx_duration; in ath11k_mac_op_sta_statistics()
5844 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_DURATION); in ath11k_mac_op_sta_statistics()
5846 if (!arsta->txrate.legacy && !arsta->txrate.nss) in ath11k_mac_op_sta_statistics()
5849 if (arsta->txrate.legacy) { in ath11k_mac_op_sta_statistics()
5850 sinfo->txrate.legacy = arsta->txrate.legacy; in ath11k_mac_op_sta_statistics()
5852 sinfo->txrate.mcs = arsta->txrate.mcs; in ath11k_mac_op_sta_statistics()
5853 sinfo->txrate.nss = arsta->txrate.nss; in ath11k_mac_op_sta_statistics()
5854 sinfo->txrate.bw = arsta->txrate.bw; in ath11k_mac_op_sta_statistics()
5855 sinfo->txrate.he_gi = arsta->txrate.he_gi; in ath11k_mac_op_sta_statistics()
5856 sinfo->txrate.he_dcm = arsta->txrate.he_dcm; in ath11k_mac_op_sta_statistics()
5857 sinfo->txrate.he_ru_alloc = arsta->txrate.he_ru_alloc; in ath11k_mac_op_sta_statistics()
5859 sinfo->txrate.flags = arsta->txrate.flags; in ath11k_mac_op_sta_statistics()
5860 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in ath11k_mac_op_sta_statistics()
5863 sinfo->signal = arsta->rssi_comb + ATH11K_DEFAULT_NOISE_FLOOR; in ath11k_mac_op_sta_statistics()
5914 for (i = 0; i < band->n_channels; i++) { in ath11k_mac_update_ch_list()
5915 if (band->channels[i].center_freq < freq_low || in ath11k_mac_update_ch_list()
5916 band->channels[i].center_freq > freq_high) in ath11k_mac_update_ch_list()
5917 band->channels[i].flags |= IEEE80211_CHAN_DISABLED; in ath11k_mac_update_ch_list()
5923 struct ath11k_pdev *pdev = ar->pdev; in ath11k_get_phy_id()
5924 struct ath11k_pdev_cap *pdev_cap = &pdev->cap; in ath11k_get_phy_id()
5927 return pdev_cap->band[NL80211_BAND_2GHZ].phy_id; in ath11k_get_phy_id()
5930 return pdev_cap->band[NL80211_BAND_5GHZ].phy_id; in ath11k_get_phy_id()
5932 ath11k_warn(ar->ab, "unsupported phy cap:%d\n", band); in ath11k_get_phy_id()
5950 reg_cap = &ar->ab->hal_reg_cap[ar->pdev_idx]; in ath11k_mac_setup_channels_rates()
5957 return -ENOMEM; in ath11k_mac_setup_channels_rates()
5959 band = &ar->mac.sbands[NL80211_BAND_2GHZ]; in ath11k_mac_setup_channels_rates()
5960 band->band = NL80211_BAND_2GHZ; in ath11k_mac_setup_channels_rates()
5961 band->n_channels = ARRAY_SIZE(ath11k_2ghz_channels); in ath11k_mac_setup_channels_rates()
5962 band->channels = channels; in ath11k_mac_setup_channels_rates()
5963 band->n_bitrates = ath11k_g_rates_size; in ath11k_mac_setup_channels_rates()
5964 band->bitrates = ath11k_g_rates; in ath11k_mac_setup_channels_rates()
5965 ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = band; in ath11k_mac_setup_channels_rates()
5967 if (ar->ab->hw_params.single_pdev_only) { in ath11k_mac_setup_channels_rates()
5969 reg_cap = &ar->ab->hal_reg_cap[phy_id]; in ath11k_mac_setup_channels_rates()
5972 reg_cap->low_2ghz_chan, in ath11k_mac_setup_channels_rates()
5973 reg_cap->high_2ghz_chan); in ath11k_mac_setup_channels_rates()
5977 if (reg_cap->high_5ghz_chan >= ATH11K_MAX_6G_FREQ) { in ath11k_mac_setup_channels_rates()
5981 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath11k_mac_setup_channels_rates()
5982 return -ENOMEM; in ath11k_mac_setup_channels_rates()
5985 ar->supports_6ghz = true; in ath11k_mac_setup_channels_rates()
5986 band = &ar->mac.sbands[NL80211_BAND_6GHZ]; in ath11k_mac_setup_channels_rates()
5987 band->band = NL80211_BAND_6GHZ; in ath11k_mac_setup_channels_rates()
5988 band->n_channels = ARRAY_SIZE(ath11k_6ghz_channels); in ath11k_mac_setup_channels_rates()
5989 band->channels = channels; in ath11k_mac_setup_channels_rates()
5990 band->n_bitrates = ath11k_a_rates_size; in ath11k_mac_setup_channels_rates()
5991 band->bitrates = ath11k_a_rates; in ath11k_mac_setup_channels_rates()
5992 ar->hw->wiphy->bands[NL80211_BAND_6GHZ] = band; in ath11k_mac_setup_channels_rates()
5994 reg_cap->low_5ghz_chan, in ath11k_mac_setup_channels_rates()
5995 reg_cap->high_5ghz_chan); in ath11k_mac_setup_channels_rates()
5998 if (reg_cap->low_5ghz_chan < ATH11K_MIN_6G_FREQ) { in ath11k_mac_setup_channels_rates()
6003 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in ath11k_mac_setup_channels_rates()
6004 kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels); in ath11k_mac_setup_channels_rates()
6005 return -ENOMEM; in ath11k_mac_setup_channels_rates()
6008 band = &ar->mac.sbands[NL80211_BAND_5GHZ]; in ath11k_mac_setup_channels_rates()
6009 band->band = NL80211_BAND_5GHZ; in ath11k_mac_setup_channels_rates()
6010 band->n_channels = ARRAY_SIZE(ath11k_5ghz_channels); in ath11k_mac_setup_channels_rates()
6011 band->channels = channels; in ath11k_mac_setup_channels_rates()
6012 band->n_bitrates = ath11k_a_rates_size; in ath11k_mac_setup_channels_rates()
6013 band->bitrates = ath11k_a_rates; in ath11k_mac_setup_channels_rates()
6014 ar->hw->wiphy->bands[NL80211_BAND_5GHZ] = band; in ath11k_mac_setup_channels_rates()
6016 if (ar->ab->hw_params.single_pdev_only) { in ath11k_mac_setup_channels_rates()
6018 reg_cap = &ar->ab->hal_reg_cap[phy_id]; in ath11k_mac_setup_channels_rates()
6022 reg_cap->low_5ghz_chan, in ath11k_mac_setup_channels_rates()
6023 reg_cap->high_5ghz_chan); in ath11k_mac_setup_channels_rates()
6032 struct ath11k_base *ab = ar->ab; in ath11k_mac_setup_iface_combinations()
6039 return -ENOMEM; in ath11k_mac_setup_iface_combinations()
6046 return -ENOMEM; in ath11k_mac_setup_iface_combinations()
6056 ab->hw_params.interface_modes & BIT(NL80211_IFTYPE_MESH_POINT)) in ath11k_mac_setup_iface_combinations()
6070 ar->hw->wiphy->iface_combinations = combinations; in ath11k_mac_setup_iface_combinations()
6071 ar->hw->wiphy->n_iface_combinations = 1; in ath11k_mac_setup_iface_combinations()
6115 cancel_work_sync(&ar->regd_update_work); in __ath11k_mac_unregister()
6117 ieee80211_unregister_hw(ar->hw); in __ath11k_mac_unregister()
6119 idr_for_each(&ar->txmgmt_idr, ath11k_mac_tx_mgmt_pending_free, ar); in __ath11k_mac_unregister()
6120 idr_destroy(&ar->txmgmt_idr); in __ath11k_mac_unregister()
6122 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in __ath11k_mac_unregister()
6123 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in __ath11k_mac_unregister()
6124 kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels); in __ath11k_mac_unregister()
6126 kfree(ar->hw->wiphy->iface_combinations[0].limits); in __ath11k_mac_unregister()
6127 kfree(ar->hw->wiphy->iface_combinations); in __ath11k_mac_unregister()
6129 SET_IEEE80211_DEV(ar->hw, NULL); in __ath11k_mac_unregister()
6138 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_unregister()
6139 pdev = &ab->pdevs[i]; in ath11k_mac_unregister()
6140 ar = pdev->ar; in ath11k_mac_unregister()
6150 struct ath11k_base *ab = ar->ab; in __ath11k_mac_register()
6151 struct ath11k_pdev_cap *cap = &ar->pdev->cap; in __ath11k_mac_register()
6168 SET_IEEE80211_PERM_ADDR(ar->hw, ar->mac_addr); in __ath11k_mac_register()
6170 SET_IEEE80211_DEV(ar->hw, ab->dev); in __ath11k_mac_register()
6173 cap->supported_bands); in __ath11k_mac_register()
6182 ath11k_err(ar->ab, "failed to setup interface combinations: %d\n", ret); in __ath11k_mac_register()
6186 ar->hw->wiphy->available_antennas_rx = cap->rx_chain_mask; in __ath11k_mac_register()
6187 ar->hw->wiphy->available_antennas_tx = cap->tx_chain_mask; in __ath11k_mac_register()
6189 ar->hw->wiphy->interface_modes = ab->hw_params.interface_modes; in __ath11k_mac_register()
6191 ieee80211_hw_set(ar->hw, SIGNAL_DBM); in __ath11k_mac_register()
6192 ieee80211_hw_set(ar->hw, SUPPORTS_PS); in __ath11k_mac_register()
6193 ieee80211_hw_set(ar->hw, SUPPORTS_DYNAMIC_PS); in __ath11k_mac_register()
6194 ieee80211_hw_set(ar->hw, MFP_CAPABLE); in __ath11k_mac_register()
6195 ieee80211_hw_set(ar->hw, REPORTS_TX_ACK_STATUS); in __ath11k_mac_register()
6196 ieee80211_hw_set(ar->hw, HAS_RATE_CONTROL); in __ath11k_mac_register()
6197 ieee80211_hw_set(ar->hw, AP_LINK_PS); in __ath11k_mac_register()
6198 ieee80211_hw_set(ar->hw, SPECTRUM_MGMT); in __ath11k_mac_register()
6199 ieee80211_hw_set(ar->hw, CONNECTION_MONITOR); in __ath11k_mac_register()
6200 ieee80211_hw_set(ar->hw, SUPPORTS_PER_STA_GTK); in __ath11k_mac_register()
6201 ieee80211_hw_set(ar->hw, WANT_MONITOR_VIF); in __ath11k_mac_register()
6202 ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); in __ath11k_mac_register()
6203 ieee80211_hw_set(ar->hw, QUEUE_CONTROL); in __ath11k_mac_register()
6204 ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); in __ath11k_mac_register()
6205 ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); in __ath11k_mac_register()
6206 ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD); in __ath11k_mac_register()
6208 ieee80211_hw_set(ar->hw, AMPDU_AGGREGATION); in __ath11k_mac_register()
6209 ieee80211_hw_set(ar->hw, TX_AMPDU_SETUP_IN_HW); in __ath11k_mac_register()
6210 ieee80211_hw_set(ar->hw, SUPPORTS_REORDERING_BUFFER); in __ath11k_mac_register()
6211 ieee80211_hw_set(ar->hw, SUPPORTS_AMSDU_IN_AMPDU); in __ath11k_mac_register()
6212 ieee80211_hw_set(ar->hw, USES_RSS); in __ath11k_mac_register()
6215 ar->hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS; in __ath11k_mac_register()
6216 ar->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in __ath11k_mac_register()
6223 ar->hw->wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS; in __ath11k_mac_register()
6225 ar->hw->wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID; in __ath11k_mac_register()
6226 ar->hw->wiphy->max_scan_ie_len = WLAN_SCAN_PARAMS_MAX_IE_LEN; in __ath11k_mac_register()
6228 ar->hw->max_listen_interval = ATH11K_MAX_HW_LISTEN_INTERVAL; in __ath11k_mac_register()
6230 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; in __ath11k_mac_register()
6231 ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; in __ath11k_mac_register()
6232 ar->hw->wiphy->max_remain_on_channel_duration = 5000; in __ath11k_mac_register()
6234 ar->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; in __ath11k_mac_register()
6235 ar->hw->wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE | in __ath11k_mac_register()
6238 ar->max_num_stations = TARGET_NUM_STATIONS; in __ath11k_mac_register()
6239 ar->max_num_peers = TARGET_NUM_PEERS_PDEV; in __ath11k_mac_register()
6241 ar->hw->wiphy->max_ap_assoc_sta = ar->max_num_stations; in __ath11k_mac_register()
6243 ar->hw->queues = ATH11K_HW_MAX_QUEUES; in __ath11k_mac_register()
6244 ar->hw->wiphy->tx_queue_len = ATH11K_QUEUE_LEN; in __ath11k_mac_register()
6245 ar->hw->offchannel_tx_hw_queue = ATH11K_HW_MAX_QUEUES - 1; in __ath11k_mac_register()
6246 ar->hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; in __ath11k_mac_register()
6248 ar->hw->vif_data_size = sizeof(struct ath11k_vif); in __ath11k_mac_register()
6249 ar->hw->sta_data_size = sizeof(struct ath11k_sta); in __ath11k_mac_register()
6251 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); in __ath11k_mac_register()
6252 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_STA_TX_PWR); in __ath11k_mac_register()
6254 ar->hw->wiphy->cipher_suites = cipher_suites; in __ath11k_mac_register()
6255 ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); in __ath11k_mac_register()
6257 ar->hw->wiphy->iftype_ext_capab = ath11k_iftypes_ext_capa; in __ath11k_mac_register()
6258 ar->hw->wiphy->num_iftype_ext_capab = in __ath11k_mac_register()
6263 if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) { in __ath11k_mac_register()
6264 ar->hw->netdev_features = NETIF_F_HW_CSUM; in __ath11k_mac_register()
6265 ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL); in __ath11k_mac_register()
6266 ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT); in __ath11k_mac_register()
6269 ret = ieee80211_register_hw(ar->hw); in __ath11k_mac_register()
6271 ath11k_err(ar->ab, "ieee80211 registration failed: %d\n", ret); in __ath11k_mac_register()
6275 if (!ab->hw_params.supports_monitor) in __ath11k_mac_register()
6281 ar->hw->wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MONITOR); in __ath11k_mac_register()
6286 ath11k_err(ar->ab, "ath11k regd update failed: %d\n", ret); in __ath11k_mac_register()
6292 ath11k_err(ar->ab, "debugfs registration failed: %d\n", ret); in __ath11k_mac_register()
6299 kfree(ar->hw->wiphy->iface_combinations[0].limits); in __ath11k_mac_register()
6300 kfree(ar->hw->wiphy->iface_combinations); in __ath11k_mac_register()
6303 kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); in __ath11k_mac_register()
6304 kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels); in __ath11k_mac_register()
6305 kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels); in __ath11k_mac_register()
6308 SET_IEEE80211_DEV(ar->hw, NULL); in __ath11k_mac_register()
6319 if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) in ath11k_mac_register()
6322 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_register()
6323 pdev = &ab->pdevs[i]; in ath11k_mac_register()
6324 ar = pdev->ar; in ath11k_mac_register()
6325 if (ab->pdevs_macaddr_valid) { in ath11k_mac_register()
6326 ether_addr_copy(ar->mac_addr, pdev->mac_addr); in ath11k_mac_register()
6328 ether_addr_copy(ar->mac_addr, ab->mac_addr); in ath11k_mac_register()
6329 ar->mac_addr[4] += i; in ath11k_mac_register()
6336 idr_init(&ar->txmgmt_idr); in ath11k_mac_register()
6337 spin_lock_init(&ar->txmgmt_idr_lock); in ath11k_mac_register()
6341 ab->cc_freq_hz = IPQ8074_CC_FREQ_HERTZ; in ath11k_mac_register()
6342 ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS)) - 1; in ath11k_mac_register()
6347 for (i = i - 1; i >= 0; i--) { in ath11k_mac_register()
6348 pdev = &ab->pdevs[i]; in ath11k_mac_register()
6349 ar = pdev->ar; in ath11k_mac_register()
6364 if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) in ath11k_mac_allocate()
6367 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_allocate()
6368 pdev = &ab->pdevs[i]; in ath11k_mac_allocate()
6372 ret = -ENOMEM; in ath11k_mac_allocate()
6376 ar = hw->priv; in ath11k_mac_allocate()
6377 ar->hw = hw; in ath11k_mac_allocate()
6378 ar->ab = ab; in ath11k_mac_allocate()
6379 ar->pdev = pdev; in ath11k_mac_allocate()
6380 ar->pdev_idx = i; in ath11k_mac_allocate()
6381 ar->lmac_id = ath11k_hw_get_mac_from_pdev_id(&ab->hw_params, i); in ath11k_mac_allocate()
6383 ar->wmi = &ab->wmi_ab.wmi[i]; in ath11k_mac_allocate()
6389 ar->cfg_tx_chainmask = pdev->cap.tx_chain_mask; in ath11k_mac_allocate()
6390 ar->cfg_rx_chainmask = pdev->cap.rx_chain_mask; in ath11k_mac_allocate()
6391 ar->num_tx_chains = get_num_chains(pdev->cap.tx_chain_mask); in ath11k_mac_allocate()
6392 ar->num_rx_chains = get_num_chains(pdev->cap.rx_chain_mask); in ath11k_mac_allocate()
6394 pdev->ar = ar; in ath11k_mac_allocate()
6395 spin_lock_init(&ar->data_lock); in ath11k_mac_allocate()
6396 INIT_LIST_HEAD(&ar->arvifs); in ath11k_mac_allocate()
6397 INIT_LIST_HEAD(&ar->ppdu_stats_info); in ath11k_mac_allocate()
6398 mutex_init(&ar->conf_mutex); in ath11k_mac_allocate()
6399 init_completion(&ar->vdev_setup_done); in ath11k_mac_allocate()
6400 init_completion(&ar->peer_assoc_done); in ath11k_mac_allocate()
6401 init_completion(&ar->install_key_done); in ath11k_mac_allocate()
6402 init_completion(&ar->bss_survey_done); in ath11k_mac_allocate()
6403 init_completion(&ar->scan.started); in ath11k_mac_allocate()
6404 init_completion(&ar->scan.completed); in ath11k_mac_allocate()
6405 init_completion(&ar->thermal.wmi_sync); in ath11k_mac_allocate()
6407 INIT_DELAYED_WORK(&ar->scan.timeout, ath11k_scan_timeout_work); in ath11k_mac_allocate()
6408 INIT_WORK(&ar->regd_update_work, ath11k_regd_update_work); in ath11k_mac_allocate()
6410 INIT_WORK(&ar->wmi_mgmt_tx_work, ath11k_mgmt_over_wmi_tx_work); in ath11k_mac_allocate()
6411 skb_queue_head_init(&ar->wmi_mgmt_tx_queue); in ath11k_mac_allocate()
6412 clear_bit(ATH11K_FLAG_MONITOR_ENABLED, &ar->monitor_flags); in ath11k_mac_allocate()
6429 for (i = 0; i < ab->num_radios; i++) { in ath11k_mac_destroy()
6430 pdev = &ab->pdevs[i]; in ath11k_mac_destroy()
6431 ar = pdev->ar; in ath11k_mac_destroy()
6435 ieee80211_free_hw(ar->hw); in ath11k_mac_destroy()
6436 pdev->ar = NULL; in ath11k_mac_destroy()