Lines Matching +full:ftm +full:- +full:src

1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2012-2014, 2018-2024 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
19 #include "iwl-drv.h"
20 #include "iwl-op-mode.h"
21 #include "iwl-io.h"
24 #include "time-event.h"
25 #include "iwl-nvm-utils.h"
26 #include "iwl-phy-db.h"
28 #include "fw/error-dump.h"
29 #include "iwl-prph.h"
30 #include "iwl-nvm-parse.h"
31 #include "time-sync.h"
77 .ftm = {
85 .max_bursts_exponent = -1, /* all supported */
109 memset(mvm->phy_ctxts, 0, sizeof(mvm->phy_ctxts)); in iwl_mvm_reset_phy_ctxts()
111 mvm->phy_ctxts[i].id = i; in iwl_mvm_reset_phy_ctxts()
112 mvm->phy_ctxts[i].ref = 0; in iwl_mvm_reset_phy_ctxts()
129 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_regdomain()
140 u32 status = le32_to_cpu(resp->status); in iwl_mvm_get_regdomain()
145 resp_ver = iwl_fw_lookup_notif_ver(mvm->fw, IWL_ALWAYS_LONG_GROUP, in iwl_mvm_get_regdomain()
149 regd = iwl_parse_nvm_mcc_info(mvm->trans->dev, mvm->cfg, in iwl_mvm_get_regdomain()
150 __le32_to_cpu(resp->n_channels), in iwl_mvm_get_regdomain()
151 resp->channels, in iwl_mvm_get_regdomain()
152 __le16_to_cpu(resp->mcc), in iwl_mvm_get_regdomain()
153 __le16_to_cpu(resp->geo_info), in iwl_mvm_get_regdomain()
154 le32_to_cpu(resp->cap), resp_ver); in iwl_mvm_get_regdomain()
156 src_id = resp->source_id; in iwl_mvm_get_regdomain()
163 IWL_DEBUG_LAR(mvm, "setting alpha2 from FW to %s (0x%x, 0x%x) src=%d\n", in iwl_mvm_get_regdomain()
164 regd->alpha2, regd->alpha2[0], regd->alpha2[1], src_id); in iwl_mvm_get_regdomain()
165 mvm->lar_regdom_set = true; in iwl_mvm_get_regdomain()
166 mvm->mcc_src = src_id; in iwl_mvm_get_regdomain()
168 if (!iwl_puncturing_is_allowed_in_bios(mvm->bios_enable_puncturing, in iwl_mvm_get_regdomain()
169 le16_to_cpu(resp->mcc))) in iwl_mvm_get_regdomain()
170 ieee80211_hw_set(mvm->hw, DISALLOW_PUNCTURING); in iwl_mvm_get_regdomain()
172 __clear_bit(IEEE80211_HW_DISALLOW_PUNCTURING, mvm->hw->flags); in iwl_mvm_get_regdomain()
174 iwl_mei_set_country_code(__le16_to_cpu(resp->mcc)); in iwl_mvm_get_regdomain()
193 regulatory_set_wiphy_regd(mvm->hw->wiphy, regd); in iwl_mvm_update_changed_regdom()
202 return iwl_mvm_get_regdomain(mvm->hw->wiphy, "ZZ", in iwl_mvm_get_current_regdomain()
215 wiphy_dereference(mvm->hw->wiphy, mvm->hw->wiphy->regd); in iwl_mvm_init_fw_regd()
218 return -ENOENT; in iwl_mvm_init_fw_regd()
221 used_src = mvm->mcc_src; in iwl_mvm_init_fw_regd()
230 regd = iwl_mvm_get_regdomain(mvm->hw->wiphy, r->alpha2, used_src, in iwl_mvm_init_fw_regd()
233 return -EIO; in iwl_mvm_init_fw_regd()
239 ret = regulatory_set_wiphy_regd_sync(mvm->hw->wiphy, regd); in iwl_mvm_init_fw_regd()
313 if (mvm->trans->trans_cfg->device_family != IWL_DEVICE_FAMILY_9000 && in iwl_mvm_op_set_antenna()
314 mvm->trans->trans_cfg->device_family != IWL_DEVICE_FAMILY_22000) in iwl_mvm_op_set_antenna()
315 return -EOPNOTSUPP; in iwl_mvm_op_set_antenna()
317 if (!mvm->nvm_data) in iwl_mvm_op_set_antenna()
318 return -EBUSY; in iwl_mvm_op_set_antenna()
324 mvm->set_tx_ant = tx_ant; in iwl_mvm_op_set_antenna()
325 mvm->set_rx_ant = rx_ant; in iwl_mvm_op_set_antenna()
327 iwl_reinit_cab(mvm->trans, mvm->nvm_data, tx_ant, rx_ant, mvm->fw); in iwl_mvm_op_set_antenna()
334 struct ieee80211_hw *hw = mvm->hw; in iwl_mvm_mac_setup_register()
343 bool unified = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
347 u8 sec_key_ver = iwl_fw_lookup_cmd_ver(mvm->fw, sec_key_id, 0); in iwl_mvm_mac_setup_register()
368 if (mvm->mld_api_is_used && mvm->nvm_data->sku_cap_11be_enable && in iwl_mvm_mac_setup_register()
371 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO; in iwl_mvm_mac_setup_register()
379 if (!mvm->mld_api_is_used) in iwl_mvm_mac_setup_register()
383 * On older devices, enabling TX A-MSDU occasionally leads to in iwl_mvm_mac_setup_register()
389 * support A-MSDU until moving the mac80211 iTXQs, just leave it in iwl_mvm_mac_setup_register()
393 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_9000) in iwl_mvm_mac_setup_register()
404 mvm->trans->trans_cfg->device_family > IWL_DEVICE_FAMILY_9000) in iwl_mvm_mac_setup_register()
407 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
416 return -EINVAL; in iwl_mvm_mac_setup_register()
419 if (mvm->trans->num_rx_queues > 1) in iwl_mvm_mac_setup_register()
422 if (mvm->trans->max_skb_frags) in iwl_mvm_mac_setup_register()
423 hw->netdev_features = NETIF_F_HIGHDMA | NETIF_F_SG; in iwl_mvm_mac_setup_register()
425 hw->queues = IEEE80211_NUM_ACS; in iwl_mvm_mac_setup_register()
426 hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE; in iwl_mvm_mac_setup_register()
427 hw->radiotap_mcs_details |= IEEE80211_RADIOTAP_MCS_HAVE_FEC | in iwl_mvm_mac_setup_register()
429 hw->radiotap_vht_details |= IEEE80211_RADIOTAP_VHT_KNOWN_STBC | in iwl_mvm_mac_setup_register()
432 hw->radiotap_timestamp.units_pos = in iwl_mvm_mac_setup_register()
436 hw->radiotap_timestamp.accuracy = 22; in iwl_mvm_mac_setup_register()
439 hw->rate_control_algorithm = RS_NAME; in iwl_mvm_mac_setup_register()
441 hw->uapsd_queues = IWL_MVM_UAPSD_QUEUES; in iwl_mvm_mac_setup_register()
442 hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; in iwl_mvm_mac_setup_register()
443 hw->max_tx_fragments = mvm->trans->max_skb_frags; in iwl_mvm_mac_setup_register()
445 BUILD_BUG_ON(ARRAY_SIZE(mvm->ciphers) < ARRAY_SIZE(mvm_ciphers) + 6); in iwl_mvm_mac_setup_register()
446 memcpy(mvm->ciphers, mvm_ciphers, sizeof(mvm_ciphers)); in iwl_mvm_mac_setup_register()
447 hw->wiphy->n_cipher_suites = ARRAY_SIZE(mvm_ciphers); in iwl_mvm_mac_setup_register()
448 hw->wiphy->cipher_suites = mvm->ciphers; in iwl_mvm_mac_setup_register()
451 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
453 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
454 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
456 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
467 mvm->ciphers[hw->wiphy->n_cipher_suites] = WLAN_CIPHER_SUITE_AES_CMAC; in iwl_mvm_mac_setup_register()
468 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
470 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
472 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
473 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
475 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
478 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
480 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
483 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
485 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
487 hw->wiphy->pmsr_capa = &iwl_mvm_pmsr_capa; in iwl_mvm_mac_setup_register()
491 fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
493 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
495 else if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
497 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
500 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
502 hw->wiphy->hw_timestamp_max_peers = 1; in iwl_mvm_mac_setup_register()
504 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
506 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
510 hw->wiphy->features |= in iwl_mvm_mac_setup_register()
515 hw->sta_data_size = sizeof(struct iwl_mvm_sta); in iwl_mvm_mac_setup_register()
516 hw->vif_data_size = sizeof(struct iwl_mvm_vif); in iwl_mvm_mac_setup_register()
517 hw->chanctx_data_size = sizeof(u16); in iwl_mvm_mac_setup_register()
518 hw->txq_data_size = sizeof(struct iwl_mvm_txq); in iwl_mvm_mac_setup_register()
520 hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | in iwl_mvm_mac_setup_register()
527 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in iwl_mvm_mac_setup_register()
528 wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS); in iwl_mvm_mac_setup_register()
535 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
537 hw->wiphy->features |= NL80211_FEATURE_HT_IBSS; in iwl_mvm_mac_setup_register()
539 hw->wiphy->regulatory_flags |= REGULATORY_ENABLE_RELAX_NO_IR; in iwl_mvm_mac_setup_register()
541 hw->wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED; in iwl_mvm_mac_setup_register()
543 hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | in iwl_mvm_mac_setup_register()
546 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) in iwl_mvm_mac_setup_register()
547 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
550 hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; in iwl_mvm_mac_setup_register()
551 hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; in iwl_mvm_mac_setup_register()
552 hw->wiphy->flags |= WIPHY_FLAG_SPLIT_SCAN_6GHZ; in iwl_mvm_mac_setup_register()
554 hw->wiphy->iface_combinations = iwl_mvm_iface_combinations; in iwl_mvm_mac_setup_register()
555 hw->wiphy->n_iface_combinations = in iwl_mvm_mac_setup_register()
558 hw->wiphy->max_remain_on_channel_duration = 10000; in iwl_mvm_mac_setup_register()
559 hw->max_listen_interval = IWL_MVM_CONN_LISTEN_INTERVAL; in iwl_mvm_mac_setup_register()
562 memcpy(mvm->addresses[0].addr, mvm->nvm_data->hw_addr, ETH_ALEN); in iwl_mvm_mac_setup_register()
563 hw->wiphy->addresses = mvm->addresses; in iwl_mvm_mac_setup_register()
564 hw->wiphy->n_addresses = 1; in iwl_mvm_mac_setup_register()
567 num_mac = (mvm->nvm_data->n_hw_addrs > 1) ? in iwl_mvm_mac_setup_register()
568 min(IWL_MVM_MAX_ADDRESSES, mvm->nvm_data->n_hw_addrs) : 1; in iwl_mvm_mac_setup_register()
571 memcpy(mvm->addresses[i].addr, mvm->addresses[i-1].addr, in iwl_mvm_mac_setup_register()
573 mvm->addresses[i].addr[5]++; in iwl_mvm_mac_setup_register()
574 hw->wiphy->n_addresses++; in iwl_mvm_mac_setup_register()
579 hw->wiphy->max_scan_ie_len = iwl_mvm_max_scan_ie_len(mvm); in iwl_mvm_mac_setup_register()
581 hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; in iwl_mvm_mac_setup_register()
587 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) in iwl_mvm_mac_setup_register()
588 mvm->max_scans = IWL_MAX_UMAC_SCANS; in iwl_mvm_mac_setup_register()
590 mvm->max_scans = IWL_MAX_LMAC_SCANS; in iwl_mvm_mac_setup_register()
592 if (mvm->nvm_data->bands[NL80211_BAND_2GHZ].n_channels) in iwl_mvm_mac_setup_register()
593 hw->wiphy->bands[NL80211_BAND_2GHZ] = in iwl_mvm_mac_setup_register()
594 &mvm->nvm_data->bands[NL80211_BAND_2GHZ]; in iwl_mvm_mac_setup_register()
595 if (mvm->nvm_data->bands[NL80211_BAND_5GHZ].n_channels) { in iwl_mvm_mac_setup_register()
596 hw->wiphy->bands[NL80211_BAND_5GHZ] = in iwl_mvm_mac_setup_register()
597 &mvm->nvm_data->bands[NL80211_BAND_5GHZ]; in iwl_mvm_mac_setup_register()
599 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
601 fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
603 hw->wiphy->bands[NL80211_BAND_5GHZ]->vht_cap.cap |= in iwl_mvm_mac_setup_register()
606 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
608 mvm->nvm_data->bands[NL80211_BAND_6GHZ].n_channels) in iwl_mvm_mac_setup_register()
609 hw->wiphy->bands[NL80211_BAND_6GHZ] = in iwl_mvm_mac_setup_register()
610 &mvm->nvm_data->bands[NL80211_BAND_6GHZ]; in iwl_mvm_mac_setup_register()
612 hw->wiphy->hw_version = mvm->trans->hw_id; in iwl_mvm_mac_setup_register()
615 hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; in iwl_mvm_mac_setup_register()
617 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; in iwl_mvm_mac_setup_register()
619 hw->wiphy->max_sched_scan_reqs = 1; in iwl_mvm_mac_setup_register()
620 hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX; in iwl_mvm_mac_setup_register()
621 hw->wiphy->max_match_sets = iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_mac_setup_register()
623 hw->wiphy->max_sched_scan_ie_len = in iwl_mvm_mac_setup_register()
624 SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2; in iwl_mvm_mac_setup_register()
625 hw->wiphy->max_sched_scan_plans = IWL_MAX_SCHED_SCAN_PLANS; in iwl_mvm_mac_setup_register()
626 hw->wiphy->max_sched_scan_plan_interval = U16_MAX; in iwl_mvm_mac_setup_register()
632 hw->wiphy->max_sched_scan_plan_iterations = 254; in iwl_mvm_mac_setup_register()
634 hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | in iwl_mvm_mac_setup_register()
644 hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS | in iwl_mvm_mac_setup_register()
647 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
649 hw->wiphy->features |= NL80211_FEATURE_TX_POWER_INSERTION; in iwl_mvm_mac_setup_register()
650 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
652 hw->wiphy->features |= NL80211_FEATURE_QUIET; in iwl_mvm_mac_setup_register()
654 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
656 hw->wiphy->features |= in iwl_mvm_mac_setup_register()
659 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
661 hw->wiphy->features |= NL80211_FEATURE_WFA_TPC_IE_IN_PROBES; in iwl_mvm_mac_setup_register()
663 if (iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_KEK_KCK_MATERIAL, in iwl_mvm_mac_setup_register()
665 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK; in iwl_mvm_mac_setup_register()
667 if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
669 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
671 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
676 u8 scan_ver = iwl_fw_lookup_cmd_ver(mvm->fw, SCAN_REQ_UMAC, 0); in iwl_mvm_mac_setup_register()
678 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
680 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
682 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
687 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
691 hw->wiphy->iftype_ext_capab = NULL; in iwl_mvm_mac_setup_register()
692 hw->wiphy->num_iftype_ext_capab = 0; in iwl_mvm_mac_setup_register()
694 if (mvm->nvm_data->sku_cap_11ax_enable && in iwl_mvm_mac_setup_register()
696 hw->wiphy->iftype_ext_capab = add_iftypes_ext_capa; in iwl_mvm_mac_setup_register()
697 hw->wiphy->num_iftype_ext_capab = in iwl_mvm_mac_setup_register()
698 ARRAY_SIZE(add_iftypes_ext_capa) - 1; in iwl_mvm_mac_setup_register()
704 if (iwl_fw_lookup_cmd_ver(mvm->fw, in iwl_mvm_mac_setup_register()
708 IWL_DEBUG_INFO(mvm->trans, "Timing measurement supported\n"); in iwl_mvm_mac_setup_register()
710 if (!hw->wiphy->iftype_ext_capab) { in iwl_mvm_mac_setup_register()
711 hw->wiphy->num_iftype_ext_capab = 1; in iwl_mvm_mac_setup_register()
712 hw->wiphy->iftype_ext_capab = add_iftypes_ext_capa + in iwl_mvm_mac_setup_register()
713 ARRAY_SIZE(add_iftypes_ext_capa) - 1; in iwl_mvm_mac_setup_register()
715 hw->wiphy->iftype_ext_capab = add_iftypes_ext_capa + 1; in iwl_mvm_mac_setup_register()
719 if (iwl_fw_lookup_cmd_ver(mvm->fw, WIDE_ID(LOCATION_GROUP, in iwl_mvm_mac_setup_register()
722 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
725 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
727 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
731 mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; in iwl_mvm_mac_setup_register()
736 if ((unified || mvm->fw->img[IWL_UCODE_WOWLAN].num_sec) && in iwl_mvm_mac_setup_register()
737 device_can_wakeup(mvm->trans->dev)) { in iwl_mvm_mac_setup_register()
738 mvm->wowlan.flags |= WIPHY_WOWLAN_MAGIC_PKT | in iwl_mvm_mac_setup_register()
743 mvm->wowlan.flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | in iwl_mvm_mac_setup_register()
747 mvm->wowlan.n_patterns = IWL_WOWLAN_MAX_PATTERNS; in iwl_mvm_mac_setup_register()
748 mvm->wowlan.pattern_min_len = IWL_WOWLAN_MIN_PATTERN_LEN; in iwl_mvm_mac_setup_register()
749 mvm->wowlan.pattern_max_len = IWL_WOWLAN_MAX_PATTERN_LEN; in iwl_mvm_mac_setup_register()
750 mvm->wowlan.max_nd_match_sets = in iwl_mvm_mac_setup_register()
751 iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_mac_setup_register()
752 hw->wiphy->wowlan = &mvm->wowlan; in iwl_mvm_mac_setup_register()
760 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
763 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; in iwl_mvm_mac_setup_register()
767 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
770 hw->wiphy->features |= NL80211_FEATURE_TDLS_CHANNEL_SWITCH; in iwl_mvm_mac_setup_register()
773 hw->netdev_features |= mvm->cfg->features; in iwl_mvm_mac_setup_register()
775 hw->netdev_features &= ~IWL_CSUM_NETIF_FLAGS_MASK; in iwl_mvm_mac_setup_register()
777 if (mvm->cfg->vht_mu_mimo_supported) in iwl_mvm_mac_setup_register()
778 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
781 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_PROTECTED_TWT)) in iwl_mvm_mac_setup_register()
782 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
787 hw->wiphy->available_antennas_tx = iwl_mvm_get_valid_tx_ant(mvm); in iwl_mvm_mac_setup_register()
788 hw->wiphy->available_antennas_rx = iwl_mvm_get_valid_rx_ant(mvm); in iwl_mvm_mac_setup_register()
790 ret = ieee80211_register_hw(mvm->hw); in iwl_mvm_mac_setup_register()
809 ieee80211_free_txskb(mvm->hw, skb); in iwl_mvm_tx_skb()
816 struct ieee80211_sta *sta = control->sta; in iwl_mvm_mac_tx()
818 struct ieee80211_hdr *hdr = (void *)skb->data; in iwl_mvm_mac_tx()
819 bool offchannel = IEEE80211_SKB_CB(skb)->flags & in iwl_mvm_mac_tx()
821 u32 link_id = u32_get_bits(info->control.flags, in iwl_mvm_mac_tx()
826 IWL_DEBUG_DROP(mvm, "Dropping - RF/CT KILL\n"); in iwl_mvm_mac_tx()
831 !test_bit(IWL_MVM_STATUS_ROC_P2P_RUNNING, &mvm->status) && in iwl_mvm_mac_tx()
832 !test_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status)) in iwl_mvm_mac_tx()
839 if (ieee80211_is_mgmt(hdr->frame_control)) in iwl_mvm_mac_tx()
843 if (!sta && info->control.vif->type == NL80211_IFTYPE_STATION && in iwl_mvm_mac_tx()
848 !ieee80211_is_probe_resp(hdr->frame_control)) { in iwl_mvm_mac_tx()
851 rcu_dereference(tmp_sta->link[link_id]); in iwl_mvm_mac_tx()
853 rcu_dereference(info->control.vif->link_conf[link_id]); in iwl_mvm_mac_tx()
861 memcpy(mgmt->da, link_sta->addr, ETH_ALEN); in iwl_mvm_mac_tx()
862 memcpy(mgmt->sa, link_conf->addr, ETH_ALEN); in iwl_mvm_mac_tx()
863 memcpy(mgmt->bssid, link_conf->bssid, ETH_ALEN); in iwl_mvm_mac_tx()
882 * mvmtxq->tx_request logic: in iwl_mvm_mac_itxq_xmit()
897 if (atomic_fetch_add_unless(&mvmtxq->tx_request, 1, 2)) in iwl_mvm_mac_itxq_xmit()
903 &mvmtxq->state) && in iwl_mvm_mac_itxq_xmit()
905 &mvmtxq->state) && in iwl_mvm_mac_itxq_xmit()
907 &mvmtxq->state) && in iwl_mvm_mac_itxq_xmit()
908 !test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status))) { in iwl_mvm_mac_itxq_xmit()
912 if (txq->sta) in iwl_mvm_mac_itxq_xmit()
915 txq->sta->addr, in iwl_mvm_mac_itxq_xmit()
916 txq->tid); in iwl_mvm_mac_itxq_xmit()
920 iwl_mvm_tx_skb(mvm, skb, txq->sta); in iwl_mvm_mac_itxq_xmit()
922 } while (atomic_dec_return(&mvmtxq->tx_request)); in iwl_mvm_mac_itxq_xmit()
932 if (likely(test_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state)) || in iwl_mvm_mac_wake_tx_queue()
933 !txq->sta) { in iwl_mvm_mac_wake_tx_queue()
942 spin_lock_bh(&mvm->add_stream_lock); in iwl_mvm_mac_wake_tx_queue()
944 if (list_empty(&mvmtxq->list) && in iwl_mvm_mac_wake_tx_queue()
946 !test_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state)) { in iwl_mvm_mac_wake_tx_queue()
947 list_add_tail(&mvmtxq->list, &mvm->add_stream_txqs); in iwl_mvm_mac_wake_tx_queue()
948 schedule_work(&mvm->add_stream_wk); in iwl_mvm_mac_wake_tx_queue()
950 spin_unlock_bh(&mvm->add_stream_lock); in iwl_mvm_mac_wake_tx_queue()
957 iwl_fw_dbg_collect_trig(&(_mvm)->fwrt, _trig, _fmt); \
968 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_ampdu_check_trigger()
973 ba_trig = (void *)trig->data; in iwl_mvm_ampdu_check_trigger()
978 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; in iwl_mvm_ampdu_check_trigger()
980 CHECK_BA_TRIGGER(mvm, trig, ba_trig->tx_ba_start, tid, in iwl_mvm_ampdu_check_trigger()
982 sta->addr, tid, tid_data->ssn); in iwl_mvm_ampdu_check_trigger()
986 CHECK_BA_TRIGGER(mvm, trig, ba_trig->tx_ba_stop, tid, in iwl_mvm_ampdu_check_trigger()
988 sta->addr, tid); in iwl_mvm_ampdu_check_trigger()
991 CHECK_BA_TRIGGER(mvm, trig, ba_trig->rx_ba_start, tid, in iwl_mvm_ampdu_check_trigger()
993 sta->addr, tid, rx_ba_ssn); in iwl_mvm_ampdu_check_trigger()
996 CHECK_BA_TRIGGER(mvm, trig, ba_trig->rx_ba_stop, tid, in iwl_mvm_ampdu_check_trigger()
998 sta->addr, tid); in iwl_mvm_ampdu_check_trigger()
1011 struct ieee80211_sta *sta = params->sta; in iwl_mvm_mac_ampdu_action()
1012 enum ieee80211_ampdu_mlme_action action = params->action; in iwl_mvm_mac_ampdu_action()
1013 u16 tid = params->tid; in iwl_mvm_mac_ampdu_action()
1014 u16 *ssn = &params->ssn; in iwl_mvm_mac_ampdu_action()
1015 u16 buf_size = params->buf_size; in iwl_mvm_mac_ampdu_action()
1016 bool amsdu = params->amsdu; in iwl_mvm_mac_ampdu_action()
1017 u16 timeout = params->timeout; in iwl_mvm_mac_ampdu_action()
1019 IWL_DEBUG_HT(mvm, "A-MPDU action on addr %pM tid %d: action %d\n", in iwl_mvm_mac_ampdu_action()
1020 sta->addr, tid, action); in iwl_mvm_mac_ampdu_action()
1022 if (!(mvm->nvm_data->sku_cap_11n_enable)) in iwl_mvm_mac_ampdu_action()
1023 return -EACCES; in iwl_mvm_mac_ampdu_action()
1025 mutex_lock(&mvm->mutex); in iwl_mvm_mac_ampdu_action()
1029 if (iwl_mvm_vif_from_mac80211(vif)->deflink.ap_sta_id == in iwl_mvm_mac_ampdu_action()
1030 iwl_mvm_sta_from_mac80211(sta)->deflink.sta_id) { in iwl_mvm_mac_ampdu_action()
1032 u16 macid = iwl_mvm_vif_from_mac80211(vif)->id; in iwl_mvm_mac_ampdu_action()
1033 struct iwl_mvm_tcm_mac *mdata = &mvm->tcm.data[macid]; in iwl_mvm_mac_ampdu_action()
1035 mdata->opened_rx_ba_sessions = true; in iwl_mvm_mac_ampdu_action()
1037 cancel_delayed_work(&mvmvif->uapsd_nonagg_detected_wk); in iwl_mvm_mac_ampdu_action()
1040 ret = -EINVAL; in iwl_mvm_mac_ampdu_action()
1052 ret = -EINVAL; in iwl_mvm_mac_ampdu_action()
1070 ret = -EINVAL; in iwl_mvm_mac_ampdu_action()
1083 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_ampdu_action()
1096 mvmvif->uploaded = false; in iwl_mvm_cleanup_iterator()
1098 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_cleanup_iterator()
1099 iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data); in iwl_mvm_cleanup_iterator()
1100 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_cleanup_iterator()
1102 mvmvif->roc_activity = ROC_NUM_ACTIVITIES; in iwl_mvm_cleanup_iterator()
1104 mvmvif->bf_enabled = false; in iwl_mvm_cleanup_iterator()
1105 mvmvif->ba_enabled = false; in iwl_mvm_cleanup_iterator()
1106 mvmvif->ap_sta = NULL; in iwl_mvm_cleanup_iterator()
1108 mvmvif->esr_active = false; in iwl_mvm_cleanup_iterator()
1109 vif->driver_flags &= ~IEEE80211_VIF_EML_ACTIVE; in iwl_mvm_cleanup_iterator()
1112 mvmvif->link[link_id]->ap_sta_id = IWL_INVALID_STA; in iwl_mvm_cleanup_iterator()
1113 mvmvif->link[link_id]->fw_link_id = IWL_MVM_FW_LINK_ID_INVALID; in iwl_mvm_cleanup_iterator()
1114 mvmvif->link[link_id]->phy_ctxt = NULL; in iwl_mvm_cleanup_iterator()
1115 mvmvif->link[link_id]->active = 0; in iwl_mvm_cleanup_iterator()
1116 mvmvif->link[link_id]->igtk = NULL; in iwl_mvm_cleanup_iterator()
1117 memset(&mvmvif->link[link_id]->bf_data, 0, in iwl_mvm_cleanup_iterator()
1118 sizeof(mvmvif->link[link_id]->bf_data)); in iwl_mvm_cleanup_iterator()
1121 probe_data = rcu_dereference_protected(mvmvif->deflink.probe_resp_data, in iwl_mvm_cleanup_iterator()
1122 lockdep_is_held(&mvm->mutex)); in iwl_mvm_cleanup_iterator()
1125 RCU_INIT_POINTER(mvmvif->deflink.probe_resp_data, NULL); in iwl_mvm_cleanup_iterator()
1136 vif = mvm_sta->vif; in iwl_mvm_cleanup_sta_iterator()
1138 if (!sta->valid_links) in iwl_mvm_cleanup_sta_iterator()
1141 for (link_id = 0; link_id < ARRAY_SIZE((sta)->link); link_id++) { in iwl_mvm_cleanup_sta_iterator()
1145 rcu_dereference_check(mvm_sta->link[link_id], in iwl_mvm_cleanup_sta_iterator()
1146 lockdep_is_held(&mvm->mutex)); in iwl_mvm_cleanup_sta_iterator()
1147 if (mvm_link_sta && !(vif->active_links & BIT(link_id))) { in iwl_mvm_cleanup_sta_iterator()
1165 mvm->cur_aid = 0; in iwl_mvm_restart_cleanup()
1167 mvm->scan_status = 0; in iwl_mvm_restart_cleanup()
1168 mvm->ps_disabled = false; in iwl_mvm_restart_cleanup()
1169 mvm->rfkill_safe_init_done = false; in iwl_mvm_restart_cleanup()
1173 ieee80211_remain_on_channel_expired(mvm->hw); in iwl_mvm_restart_cleanup()
1181 ieee80211_iterate_interfaces(mvm->hw, 0, iwl_mvm_cleanup_iterator, mvm); in iwl_mvm_restart_cleanup()
1184 ieee80211_iterate_stations_atomic(mvm->hw, in iwl_mvm_restart_cleanup()
1187 mvm->p2p_device_vif = NULL; in iwl_mvm_restart_cleanup()
1190 memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table)); in iwl_mvm_restart_cleanup()
1191 memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif)); in iwl_mvm_restart_cleanup()
1192 memset(&mvm->last_bt_ci_cmd, 0, sizeof(mvm->last_bt_ci_cmd)); in iwl_mvm_restart_cleanup()
1194 ieee80211_wake_queues(mvm->hw); in iwl_mvm_restart_cleanup()
1196 mvm->rx_ba_sessions = 0; in iwl_mvm_restart_cleanup()
1197 mvm->fwrt.dump.conf = FW_DBG_INVALID; in iwl_mvm_restart_cleanup()
1198 mvm->monitor_on = false; in iwl_mvm_restart_cleanup()
1200 mvm->beacon_inject_active = false; in iwl_mvm_restart_cleanup()
1212 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_mac_start()
1218 if (mvm->mei_nvm_data) { in __iwl_mvm_mac_start()
1220 kfree(mvm->mei_nvm_data); in __iwl_mvm_mac_start()
1221 mvm->mei_nvm_data = NULL; in __iwl_mvm_mac_start()
1226 * allocated on mvm->nvm_data. Keep a pointer in temp_nvm_data in __iwl_mvm_mac_start()
1231 mvm->temp_nvm_data = mvm->nvm_data; in __iwl_mvm_mac_start()
1232 mvm->nvm_data = NULL; in __iwl_mvm_mac_start()
1237 fast_resume = mvm->fast_resume; in __iwl_mvm_mac_start()
1255 set_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); in __iwl_mvm_mac_start()
1260 if (test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status)) { in __iwl_mvm_mac_start()
1263 * so later code will - from now on - see that we're doing it. in __iwl_mvm_mac_start()
1265 set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in __iwl_mvm_mac_start()
1266 clear_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status); in __iwl_mvm_mac_start()
1275 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_POST_INIT, in __iwl_mvm_mac_start()
1277 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_PERIODIC, in __iwl_mvm_mac_start()
1280 mvm->last_reset_or_resume_time_jiffies = jiffies; in __iwl_mvm_mac_start()
1282 if (ret && test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in __iwl_mvm_mac_start()
1283 /* Something went wrong - we need to finish some cleanup in __iwl_mvm_mac_start()
1287 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in __iwl_mvm_mac_start()
1299 mutex_lock(&mvm->mutex); in iwl_mvm_mac_start()
1302 if (!test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status) && in iwl_mvm_mac_start()
1308 if (ret != -ETIMEDOUT) in iwl_mvm_mac_start()
1314 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_start()
1327 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in iwl_mvm_restart_complete()
1343 iwl_trans_finish_sw_reset(mvm->trans); in iwl_mvm_restart_complete()
1346 if (!list_empty(&mvm->add_stream_txqs)) in iwl_mvm_restart_complete()
1347 schedule_work(&mvm->add_stream_wk); in iwl_mvm_restart_complete()
1366 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_mac_stop()
1373 memset(&mvm->accu_radio_stats, 0, sizeof(mvm->accu_radio_stats)); in __iwl_mvm_mac_stop()
1377 if (!iwl_mvm_has_new_station_api(mvm->fw)) in __iwl_mvm_mac_stop()
1381 mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000) { in __iwl_mvm_mac_stop()
1399 if (test_and_clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) || in __iwl_mvm_mac_stop()
1401 &mvm->status)) in __iwl_mvm_mac_stop()
1402 ieee80211_iterate_interfaces(mvm->hw, 0, in __iwl_mvm_mac_stop()
1408 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in __iwl_mvm_mac_stop()
1411 for (i = 0; i < mvm->max_scans; i++) { in __iwl_mvm_mac_stop()
1412 if (WARN_ONCE(mvm->scan_uid_status[i], in __iwl_mvm_mac_stop()
1415 mvm->scan_uid_status[i] = 0; in __iwl_mvm_mac_stop()
1425 mutex_lock(&mvm->mutex); in iwl_mvm_mac_stop()
1427 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_stop()
1429 wiphy_work_cancel(mvm->hw->wiphy, &mvm->trig_link_selection_wk); in iwl_mvm_mac_stop()
1430 wiphy_work_flush(mvm->hw->wiphy, &mvm->async_handlers_wiphy_wk); in iwl_mvm_mac_stop()
1431 flush_work(&mvm->async_handlers_wk); in iwl_mvm_mac_stop()
1432 flush_work(&mvm->add_stream_wk); in iwl_mvm_mac_stop()
1442 clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); in iwl_mvm_mac_stop()
1444 cancel_delayed_work_sync(&mvm->cs_tx_unblock_dwork); in iwl_mvm_mac_stop()
1445 cancel_delayed_work_sync(&mvm->scan_timeout_dwork); in iwl_mvm_mac_stop()
1451 flush_work(&mvm->roc_done_wk); in iwl_mvm_mac_stop()
1455 mutex_lock(&mvm->mutex); in iwl_mvm_mac_stop()
1457 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_stop()
1463 cancel_work_sync(&mvm->async_handlers_wk); in iwl_mvm_mac_stop()
1464 wiphy_work_cancel(hw->wiphy, &mvm->async_handlers_wiphy_wk); in iwl_mvm_mac_stop()
1471 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_free_phy_ctxt()
1474 if (!mvm->phy_ctxts[i].ref) in iwl_mvm_get_free_phy_ctxt()
1475 return &mvm->phy_ctxts[i]; in iwl_mvm_get_free_phy_ctxt()
1486 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(link_conf->vif); in iwl_mvm_set_tx_power()
1487 u32 mac_id = mvmvif->id; in iwl_mvm_set_tx_power()
1494 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 3); in iwl_mvm_set_tx_power()
1504 if (WARN_ON(!mvmvif->link[link_conf->link_id])) in iwl_mvm_set_tx_power()
1505 return -ENODEV; in iwl_mvm_set_tx_power()
1507 link_id = mvmvif->link[link_conf->link_id]->fw_link_id; in iwl_mvm_set_tx_power()
1526 else if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_set_tx_power()
1529 else if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_set_tx_power()
1550 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) { in iwl_mvm_post_csa_tx()
1552 iwl_mvm_txq_from_mac80211(sta->txq[i]); in iwl_mvm_post_csa_tx()
1554 clear_bit(IWL_MVM_TXQ_STATE_STOP_AP_CSA, &mvmtxq->state); in iwl_mvm_post_csa_tx()
1555 iwl_mvm_mac_itxq_xmit(hw, sta->txq[i]); in iwl_mvm_post_csa_tx()
1567 mutex_lock(&mvm->mutex); in iwl_mvm_post_channel_switch()
1569 if (vif->type == NL80211_IFTYPE_STATION) { in iwl_mvm_post_channel_switch()
1571 unsigned int link_id = link_conf->link_id; in iwl_mvm_post_channel_switch()
1572 u8 ap_sta_id = mvmvif->link[link_id]->ap_sta_id; in iwl_mvm_post_channel_switch()
1574 mvmvif->csa_bcn_pending = false; in iwl_mvm_post_channel_switch()
1575 mvmvif->csa_blocks_tx = false; in iwl_mvm_post_channel_switch()
1579 ret = -EIO; in iwl_mvm_post_channel_switch()
1584 if (mvm->mld_api_is_used) in iwl_mvm_post_channel_switch()
1589 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_post_channel_switch()
1597 } else if (vif->type == NL80211_IFTYPE_AP && mvmvif->csa_blocks_tx) { in iwl_mvm_post_channel_switch()
1599 iwl_mvm_txq_from_mac80211(vif->txq); in iwl_mvm_post_channel_switch()
1601 clear_bit(IWL_MVM_TXQ_STATE_STOP_AP_CSA, &mvmtxq->state); in iwl_mvm_post_channel_switch()
1604 iwl_mvm_mac_itxq_xmit(hw, vif->txq); in iwl_mvm_post_channel_switch()
1608 mvmvif->csa_blocks_tx = false; in iwl_mvm_post_channel_switch()
1611 mvmvif->ps_disabled = false; in iwl_mvm_post_channel_switch()
1616 if (mvmvif->csa_failed) in iwl_mvm_post_channel_switch()
1617 ret = -EIO; in iwl_mvm_post_channel_switch()
1618 mutex_unlock(&mvm->mutex); in iwl_mvm_post_channel_switch()
1630 .mac_id = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, in iwl_mvm_abort_channel_switch()
1631 mvmvif->color)), in iwl_mvm_abort_channel_switch()
1640 if (iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, in iwl_mvm_abort_channel_switch()
1644 IWL_DEBUG_MAC80211(mvm, "Abort CSA on mac %d\n", mvmvif->id); in iwl_mvm_abort_channel_switch()
1646 mutex_lock(&mvm->mutex); in iwl_mvm_abort_channel_switch()
1647 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_abort_channel_switch()
1655 mvmvif->csa_failed = true; in iwl_mvm_abort_channel_switch()
1656 mutex_unlock(&mvm->mutex); in iwl_mvm_abort_channel_switch()
1659 iwl_mvm_post_channel_switch(hw, vif, &vif->bss_conf); in iwl_mvm_abort_channel_switch()
1681 if (chandef->width == NL80211_CHAN_WIDTH_320) in iwl_mvm_chandef_get_primary_80()
1683 else if (chandef->width == NL80211_CHAN_WIDTH_160) in iwl_mvm_chandef_get_primary_80()
1689 data_start = chandef->center_freq1 - bw / 2; in iwl_mvm_chandef_get_primary_80()
1691 control_start = chandef->chan->center_freq - 10; in iwl_mvm_chandef_get_primary_80()
1693 return (control_start - data_start) / 80; in iwl_mvm_chandef_get_primary_80()
1702 lockdep_assert_held(&mvm->mutex); in iwl_mvm_alloc_bcast_mcast_sta()
1713 return iwl_mvm_allocate_int_sta(mvm, &mvmvif->deflink.mcast_sta, 0, in iwl_mvm_alloc_bcast_mcast_sta()
1714 vif->type, in iwl_mvm_alloc_bcast_mcast_sta()
1723 struct iwl_mvm *mvm = mvmvif->mvm; in iwl_mvm_prevent_esr_done_wk()
1738 guard(mvm)(mvmvif->mvm); in iwl_mvm_mlo_int_scan_wk()
1739 iwl_mvm_int_mlo_scan(mvmvif->mvm, vif); in iwl_mvm_mlo_int_scan_wk()
1746 struct iwl_mvm *mvm = mvmvif->mvm; in iwl_mvm_unblock_esr_tpt()
1760 struct iwl_mvm *mvm = mvmvif->mvm; in iwl_mvm_unblock_esr_tmp_non_bss()
1764 mutex_lock(&mvm->mutex); in iwl_mvm_unblock_esr_tmp_non_bss()
1766 mutex_unlock(&mvm->mutex); in iwl_mvm_unblock_esr_tmp_non_bss()
1771 lockdep_assert_held(&mvm->mutex); in iwl_mvm_mac_init_mvmvif()
1773 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mac_init_mvmvif()
1776 INIT_DELAYED_WORK(&mvmvif->csa_work, in iwl_mvm_mac_init_mvmvif()
1779 wiphy_delayed_work_init(&mvmvif->prevent_esr_done_wk, in iwl_mvm_mac_init_mvmvif()
1782 wiphy_delayed_work_init(&mvmvif->mlo_int_scan_wk, in iwl_mvm_mac_init_mvmvif()
1785 wiphy_work_init(&mvmvif->unblock_esr_tpt_wk, in iwl_mvm_mac_init_mvmvif()
1788 wiphy_delayed_work_init(&mvmvif->unblock_esr_tmp_non_bss_wk, in iwl_mvm_mac_init_mvmvif()
1800 mutex_lock(&mvm->mutex); in iwl_mvm_mac_add_interface()
1804 mvmvif->mvm = mvm; in iwl_mvm_mac_add_interface()
1807 mvmvif->deflink.fw_link_id = IWL_MVM_FW_LINK_ID_INVALID; in iwl_mvm_mac_add_interface()
1808 mvmvif->deflink.active = 0; in iwl_mvm_mac_add_interface()
1809 mvmvif->link[0] = &mvmvif->deflink; in iwl_mvm_mac_add_interface()
1811 vif->driver_flags = IEEE80211_VIF_REMOVE_AP_AFTER_DISASSOC; in iwl_mvm_mac_add_interface()
1813 ret = iwl_mvm_set_link_mapping(mvm, vif, &vif->bss_conf); in iwl_mvm_mac_add_interface()
1824 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mac_add_interface()
1826 mvmvif->link[i]->beacon_stats.accu_num_beacons += in iwl_mvm_mac_add_interface()
1827 mvmvif->link[i]->beacon_stats.num_beacons; in iwl_mvm_mac_add_interface()
1834 rcu_assign_pointer(mvm->vif_id_to_mac[mvmvif->id], vif); in iwl_mvm_mac_add_interface()
1837 if (vif->type == NL80211_IFTYPE_NAN) { in iwl_mvm_mac_add_interface()
1853 if (vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_add_interface()
1854 vif->type == NL80211_IFTYPE_ADHOC) { in iwl_mvm_mac_add_interface()
1855 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mac_add_interface()
1861 mvmvif->features |= hw->netdev_features; in iwl_mvm_mac_add_interface()
1876 if (!mvm->bf_allowed_vif && in iwl_mvm_mac_add_interface()
1877 vif->type == NL80211_IFTYPE_STATION && !vif->p2p) { in iwl_mvm_mac_add_interface()
1878 mvm->bf_allowed_vif = mvmvif; in iwl_mvm_mac_add_interface()
1879 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | in iwl_mvm_mac_add_interface()
1883 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) in iwl_mvm_mac_add_interface()
1884 mvm->p2p_device_vif = vif; in iwl_mvm_mac_add_interface()
1888 if (vif->type == NL80211_IFTYPE_MONITOR) { in iwl_mvm_mac_add_interface()
1889 mvm->monitor_on = true; in iwl_mvm_mac_add_interface()
1890 mvm->monitor_p80 = in iwl_mvm_mac_add_interface()
1891 iwl_mvm_chandef_get_primary_80(&vif->bss_conf.chanreq.oper); in iwl_mvm_mac_add_interface()
1894 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mac_add_interface()
1897 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in iwl_mvm_mac_add_interface()
1898 vif->type == NL80211_IFTYPE_STATION && !vif->p2p && in iwl_mvm_mac_add_interface()
1899 !mvm->csme_vif && mvm->mei_registered) { in iwl_mvm_mac_add_interface()
1900 iwl_mei_set_nic_info(vif->addr, mvm->nvm_data->hw_addr); in iwl_mvm_mac_add_interface()
1901 iwl_mei_set_netdev(ieee80211_vif_to_wdev(vif)->netdev); in iwl_mvm_mac_add_interface()
1902 mvm->csme_vif = vif; in iwl_mvm_mac_add_interface()
1906 if (!ret && (vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_add_interface()
1907 vif->type == NL80211_IFTYPE_ADHOC)) in iwl_mvm_mac_add_interface()
1913 mvmvif->deflink.phy_ctxt = NULL; in iwl_mvm_mac_add_interface()
1916 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_add_interface()
1926 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { in iwl_mvm_prepare_mac_removal()
1932 flush_work(&mvm->roc_done_wk); in iwl_mvm_prepare_mac_removal()
1935 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_prepare_mac_removal()
1936 &mvmvif->prevent_esr_done_wk); in iwl_mvm_prepare_mac_removal()
1938 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_prepare_mac_removal()
1939 &mvmvif->mlo_int_scan_wk); in iwl_mvm_prepare_mac_removal()
1941 wiphy_work_cancel(mvm->hw->wiphy, &mvmvif->unblock_esr_tpt_wk); in iwl_mvm_prepare_mac_removal()
1942 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_prepare_mac_removal()
1943 &mvmvif->unblock_esr_tmp_non_bss_wk); in iwl_mvm_prepare_mac_removal()
1945 cancel_delayed_work_sync(&mvmvif->csa_work); in iwl_mvm_prepare_mac_removal()
1957 if (!(vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_remove_interface()
1958 vif->type == NL80211_IFTYPE_ADHOC)) in iwl_mvm_mac_remove_interface()
1961 mutex_lock(&mvm->mutex); in iwl_mvm_mac_remove_interface()
1963 if (vif == mvm->csme_vif) { in iwl_mvm_mac_remove_interface()
1965 mvm->csme_vif = NULL; in iwl_mvm_mac_remove_interface()
1968 probe_data = rcu_dereference_protected(mvmvif->deflink.probe_resp_data, in iwl_mvm_mac_remove_interface()
1969 lockdep_is_held(&mvm->mutex)); in iwl_mvm_mac_remove_interface()
1970 RCU_INIT_POINTER(mvmvif->deflink.probe_resp_data, NULL); in iwl_mvm_mac_remove_interface()
1974 if (mvm->bf_allowed_vif == mvmvif) { in iwl_mvm_mac_remove_interface()
1975 mvm->bf_allowed_vif = NULL; in iwl_mvm_mac_remove_interface()
1976 vif->driver_flags &= ~(IEEE80211_VIF_BEACON_FILTER | in iwl_mvm_mac_remove_interface()
1980 if (vif->bss_conf.ftm_responder) in iwl_mvm_mac_remove_interface()
1981 memset(&mvm->ftm_resp_stats, 0, sizeof(mvm->ftm_resp_stats)); in iwl_mvm_mac_remove_interface()
1989 if (vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_remove_interface()
1990 vif->type == NL80211_IFTYPE_ADHOC) { in iwl_mvm_mac_remove_interface()
1992 if (vif == mvm->noa_vif) { in iwl_mvm_mac_remove_interface()
1993 mvm->noa_vif = NULL; in iwl_mvm_mac_remove_interface()
1994 mvm->noa_duration = 0; in iwl_mvm_mac_remove_interface()
2007 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { in iwl_mvm_mac_remove_interface()
2008 if (mvmvif->deflink.phy_ctxt) { in iwl_mvm_mac_remove_interface()
2009 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); in iwl_mvm_mac_remove_interface()
2010 mvmvif->deflink.phy_ctxt = NULL; in iwl_mvm_mac_remove_interface()
2012 mvm->p2p_device_vif = NULL; in iwl_mvm_mac_remove_interface()
2017 RCU_INIT_POINTER(mvm->vif_id_to_mac[mvmvif->id], NULL); in iwl_mvm_mac_remove_interface()
2019 if (vif->type == NL80211_IFTYPE_MONITOR) in iwl_mvm_mac_remove_interface()
2020 mvm->monitor_on = false; in iwl_mvm_mac_remove_interface()
2023 iwl_mvm_unset_link_mapping(mvm, vif, &vif->bss_conf); in iwl_mvm_mac_remove_interface()
2024 if (vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_remove_interface()
2025 vif->type == NL80211_IFTYPE_ADHOC) { in iwl_mvm_mac_remove_interface()
2026 iwl_mvm_dealloc_int_sta(mvm, &mvmvif->deflink.mcast_sta); in iwl_mvm_mac_remove_interface()
2030 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_remove_interface()
2042 struct iwl_mvm *mvm = data->mvm; in iwl_mvm_mc_iface_iterator()
2043 struct iwl_mcast_filter_cmd *cmd = mvm->mcast_filter_cmd; in iwl_mvm_mc_iface_iterator()
2052 if (WARN_ON_ONCE(data->port_id >= MAX_PORT_ID_NUM)) in iwl_mvm_mc_iface_iterator()
2055 if (vif->type != NL80211_IFTYPE_STATION || in iwl_mvm_mc_iface_iterator()
2056 !vif->cfg.assoc) in iwl_mvm_mc_iface_iterator()
2059 cmd->port_id = data->port_id++; in iwl_mvm_mc_iface_iterator()
2060 memcpy(cmd->bssid, vif->bss_conf.bssid, ETH_ALEN); in iwl_mvm_mc_iface_iterator()
2061 len = roundup(sizeof(*cmd) + cmd->count * ETH_ALEN, 4); in iwl_mvm_mc_iface_iterator()
2078 lockdep_assert_held(&mvm->mutex); in iwl_mvm_recalc_multicast()
2080 if (WARN_ON_ONCE(!mvm->mcast_filter_cmd)) in iwl_mvm_recalc_multicast()
2084 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_recalc_multicast()
2094 * Note that the CPU is still faster - but with this we'll in iwl_mvm_recalc_multicast()
2126 cmd->pass_all = 1; in iwl_mvm_prepare_multicast()
2132 cmd->count, addr->addr); in iwl_mvm_prepare_multicast()
2133 memcpy(&cmd->addr_list[cmd->count * ETH_ALEN], in iwl_mvm_prepare_multicast()
2134 addr->addr, ETH_ALEN); in iwl_mvm_prepare_multicast()
2135 cmd->count++; in iwl_mvm_prepare_multicast()
2151 kfree(mvm->mcast_filter_cmd); in iwl_mvm_configure_filter()
2152 mvm->mcast_filter_cmd = cmd; in iwl_mvm_configure_filter()
2158 cmd->pass_all = !!(*total_flags & FIF_ALLMULTI); in iwl_mvm_configure_filter()
2160 if (cmd->pass_all) in iwl_mvm_configure_filter()
2161 cmd->count = 0; in iwl_mvm_configure_filter()
2180 if (vif->type != NL80211_IFTYPE_STATION || !vif->cfg.assoc || in iwl_mvm_config_iface_filter()
2181 !vif->p2p) in iwl_mvm_config_iface_filter()
2192 memcpy(cmd.membership_status, vif->bss_conf.mu_group.membership, in iwl_mvm_update_mu_groups()
2194 memcpy(cmd.user_position, vif->bss_conf.mu_group.position, in iwl_mvm_update_mu_groups()
2206 if (vif->bss_conf.mu_mimo_owner) { in iwl_mvm_mu_mimo_iface_iterator()
2210 * MU-MIMO Group Id action frame is little endian. We treat in iwl_mvm_mu_mimo_iface_iterator()
2215 (u8 *)&notif->membership_status, in iwl_mvm_mu_mimo_iface_iterator()
2216 (u8 *)&notif->user_position); in iwl_mvm_mu_mimo_iface_iterator()
2224 struct iwl_mu_group_mgmt_notif *notif = (void *)pkt->data; in iwl_mvm_mu_mimo_grp_notif()
2227 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_mu_mimo_grp_notif()
2240 (BIT(IEEE80211_PPE_THRES_INFO_PPET_SIZE) - 1); in iwl_mvm_he_get_ppe_val()
2248 residue_bits = 8 - bit_num; in iwl_mvm_he_get_ppe_val()
2251 (BIT(IEEE80211_PPE_THRES_INFO_PPET_SIZE - residue_bits) - 1)) << in iwl_mvm_he_get_ppe_val()
2253 res += (ppe[byte_num] >> bit_num) & (BIT(residue_bits) - 1); in iwl_mvm_he_get_ppe_val()
2272 IWL_DEBUG_INFO(mvm, "Got NSS = %d - trimming to %d\n", nss, in iwl_mvm_parse_ppe()
2283 bw < ARRAY_SIZE(pkt_ext->pkt_ext_qam_th[i]); in iwl_mvm_parse_ppe()
2289 * isn't present - it should inherit the thresholds from the last in iwl_mvm_parse_ppe()
2291 * this inheritance - continue in this case in iwl_mvm_parse_ppe()
2306 pkt_ext->pkt_ext_qam_th[i][bw][0] = low_th; in iwl_mvm_parse_ppe()
2307 pkt_ext->pkt_ext_qam_th[i][bw][1] = high_th; in iwl_mvm_parse_ppe()
2317 u8 nss = (link_sta->he_cap.ppe_thres[0] & in iwl_mvm_set_pkt_ext_from_he_ppe()
2319 u8 *ppe = &link_sta->he_cap.ppe_thres[0]; in iwl_mvm_set_pkt_ext_from_he_ppe()
2334 int low_th = -1; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2335 int high_th = -1; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2356 return -EINVAL; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2363 bw < ARRAY_SIZE(pkt_ext->pkt_ext_qam_th[i]); in iwl_mvm_set_pkt_ext_from_nominal_padding()
2365 pkt_ext->pkt_ext_qam_th[i][bw][0] = low_th; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2366 pkt_ext->pkt_ext_qam_th[i][bw][1] = high_th; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2381 for (bw = 0; bw < ARRAY_SIZE(pkt_ext->pkt_ext_qam_th[i]); in iwl_mvm_get_optimal_ppe_info()
2383 u8 *qam_th = &pkt_ext->pkt_ext_qam_th[i][bw][0]; in iwl_mvm_get_optimal_ppe_info()
2407 return -EINVAL; in iwl_mvm_set_sta_pkt_ext()
2410 * 9-262ac of 80211.ax/D3.0. in iwl_mvm_set_sta_pkt_ext()
2415 if (link_sta->eht_cap.has_eht) { in iwl_mvm_set_sta_pkt_ext()
2417 u8_get_bits(link_sta->eht_cap.eht_cap_elem.phy_cap_info[5], in iwl_mvm_set_sta_pkt_ext()
2420 /* If PPE Thresholds exists, parse them into a FW-familiar in iwl_mvm_set_sta_pkt_ext()
2423 if (link_sta->eht_cap.eht_cap_elem.phy_cap_info[5] & in iwl_mvm_set_sta_pkt_ext()
2425 u8 nss = (link_sta->eht_cap.eht_ppe_thres[0] & in iwl_mvm_set_sta_pkt_ext()
2427 u8 *ppe = &link_sta->eht_cap.eht_ppe_thres[0]; in iwl_mvm_set_sta_pkt_ext()
2436 /* EHT PPE Thresholds doesn't exist - set the API according to in iwl_mvm_set_sta_pkt_ext()
2439 } else if (link_sta->he_cap.he_cap_elem.phy_cap_info[6] & in iwl_mvm_set_sta_pkt_ext()
2449 /* According to the requirements, for MCSs 12-13 the in iwl_mvm_set_sta_pkt_ext()
2455 /* if PPE Thresholds doesn't present in both EHT IE and HE IE - in iwl_mvm_set_sta_pkt_ext()
2462 } else if (link_sta->he_cap.has_he) { in iwl_mvm_set_sta_pkt_ext()
2463 /* If PPE Thresholds exist, parse them into a FW-familiar format. */ in iwl_mvm_set_sta_pkt_ext()
2464 if (link_sta->he_cap.he_cap_elem.phy_cap_info[6] & in iwl_mvm_set_sta_pkt_ext()
2468 /* PPE Thresholds doesn't exist - set the API PPE values in iwl_mvm_set_sta_pkt_ext()
2473 u8_get_bits(link_sta->he_cap.he_cap_elem.phy_cap_info[9], in iwl_mvm_set_sta_pkt_ext()
2485 bw < ARRAY_SIZE(*pkt_ext->pkt_ext_qam_th[i]); in iwl_mvm_set_sta_pkt_ext()
2488 &pkt_ext->pkt_ext_qam_th[i][bw][0]; in iwl_mvm_set_sta_pkt_ext()
2512 &link_info->queue_params[i].mu_edca_param_rec; in iwl_mvm_set_fw_mu_edca_params()
2515 if (!link_info->queue_params[i].mu_edca) { in iwl_mvm_set_fw_mu_edca_params()
2521 cpu_to_le16(mu_edca->ecw_min_max & 0xf); in iwl_mvm_set_fw_mu_edca_params()
2523 cpu_to_le16((mu_edca->ecw_min_max & 0xf0) >> 4); in iwl_mvm_set_fw_mu_edca_params()
2525 cpu_to_le16(mu_edca->aifsn & 0xf); in iwl_mvm_set_fw_mu_edca_params()
2527 cpu_to_le16(mu_edca->mu_edca_timer); in iwl_mvm_set_fw_mu_edca_params()
2541 sband = mvm->hw->wiphy->bands[NL80211_BAND_2GHZ]; in iwl_mvm_is_nic_ack_enabled()
2544 return (own_he_cap && (own_he_cap->he_cap_elem.mac_cap_info[2] & in iwl_mvm_is_nic_ack_enabled()
2552 &link_sta->he_cap.he_cap_elem.mac_cap_info[0]; in iwl_mvm_get_sta_htc_flags()
2588 .bss_color = vif->bss_conf.he_bss_color.color, in iwl_mvm_cfg_he_sta()
2589 .htc_trig_based_pkt_ext = vif->bss_conf.htc_trig_based_pkt_ext, in iwl_mvm_cfg_he_sta()
2591 cpu_to_le16(vif->bss_conf.frame_time_rts_th), in iwl_mvm_cfg_he_sta()
2595 u8 ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 2); in iwl_mvm_cfg_he_sta()
2602 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_MBSSID_HE)) in iwl_mvm_cfg_he_sta()
2626 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_ctxt_cmd.sta_id]); in iwl_mvm_cfg_he_sta()
2633 if (!sta->deflink.he_cap.has_he) { in iwl_mvm_cfg_he_sta()
2640 /* Block 26-tone RU OFDMA transmissions */ in iwl_mvm_cfg_he_sta()
2641 if (mvmvif->deflink.he_ru_2mhz_block) in iwl_mvm_cfg_he_sta()
2645 sta_ctxt_cmd.htc_flags = iwl_mvm_get_sta_htc_flags(sta, &sta->deflink); in iwl_mvm_cfg_he_sta()
2648 if (!iwl_mvm_set_sta_pkt_ext(mvm, &sta->deflink, &sta_ctxt_cmd.pkt_ext)) in iwl_mvm_cfg_he_sta()
2651 if (sta->deflink.he_cap.he_cap_elem.mac_cap_info[2] & in iwl_mvm_cfg_he_sta()
2655 if (sta->deflink.he_cap.he_cap_elem.mac_cap_info[2] & in iwl_mvm_cfg_he_sta()
2661 if (iwl_mvm_set_fw_mu_edca_params(mvm, &mvmvif->deflink, in iwl_mvm_cfg_he_sta()
2665 if (vif->bss_conf.uora_exists) { in iwl_mvm_cfg_he_sta()
2669 vif->bss_conf.uora_ocw_range & 0x7; in iwl_mvm_cfg_he_sta()
2671 (vif->bss_conf.uora_ocw_range >> 3) & 0x7; in iwl_mvm_cfg_he_sta()
2677 if (vif->bss_conf.nontransmitted) { in iwl_mvm_cfg_he_sta()
2680 vif->bss_conf.transmitter_bssid); in iwl_mvm_cfg_he_sta()
2682 vif->bss_conf.bssid_indicator; in iwl_mvm_cfg_he_sta()
2683 sta_ctxt_cmd.bssid_index = vif->bss_conf.bssid_index; in iwl_mvm_cfg_he_sta()
2684 sta_ctxt_cmd.ema_ap = vif->bss_conf.ema_ap; in iwl_mvm_cfg_he_sta()
2686 vif->bss_conf.profile_periodicity; in iwl_mvm_cfg_he_sta()
2717 BUILD_BUG_ON(sizeof(sta_ctxt_cmd) - in iwl_mvm_cfg_he_sta()
2719 sizeof(sta_ctxt_cmd_v2) - in iwl_mvm_cfg_he_sta()
2725 sizeof(sta_ctxt_cmd) - in iwl_mvm_cfg_he_sta()
2752 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_protect_assoc()
2762 /* Handle association common part to MLD and non-MLD modes */
2771 /* The firmware tracks the MU-MIMO group on its own. in iwl_mvm_bss_info_changed_station_assoc()
2774 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in iwl_mvm_bss_info_changed_station_assoc()
2775 (changes & BSS_CHANGED_MU_GROUPS) && vif->bss_conf.mu_mimo_owner) { in iwl_mvm_bss_info_changed_station_assoc()
2786 mvmvif->link[link_id]->bf_data.ave_beacon_signal = 0; in iwl_mvm_bss_info_changed_station_assoc()
2791 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_bss_info_changed_station_assoc()
2796 /* Execute the common part for MLD and non-MLD modes */
2828 mvmvif->link[link_conf->link_id]; in iwl_mvm_bss_info_changed_station_common()
2832 link_info->bf_data.last_cqm_event = 0; in iwl_mvm_bss_info_changed_station_common()
2834 if (mvmvif->bf_enabled) { in iwl_mvm_bss_info_changed_station_common()
2866 * Re-calculate the tsf id, as the leader-follower relations depend in iwl_mvm_bss_info_changed_station()
2870 if (changes & BSS_CHANGED_ASSOC && vif->cfg.assoc) { in iwl_mvm_bss_info_changed_station()
2871 if ((vif->bss_conf.he_support && in iwl_mvm_bss_info_changed_station()
2873 iwl_mvm_cfg_he_sta(mvm, vif, mvmvif->deflink.ap_sta_id); in iwl_mvm_bss_info_changed_station()
2879 if (changes & BSS_CHANGED_QOS && mvmvif->associated && in iwl_mvm_bss_info_changed_station()
2880 vif->cfg.assoc && in iwl_mvm_bss_info_changed_station()
2881 (vif->bss_conf.he_support && !iwlwifi_mod_params.disable_11ax)) in iwl_mvm_bss_info_changed_station()
2882 iwl_mvm_cfg_he_sta(mvm, vif, mvmvif->deflink.ap_sta_id); in iwl_mvm_bss_info_changed_station()
2890 if (changes & BSS_CHANGED_BSSID && !mvmvif->associated) in iwl_mvm_bss_info_changed_station()
2891 memcpy(mvmvif->deflink.bssid, bss_conf->bssid, ETH_ALEN); in iwl_mvm_bss_info_changed_station()
2893 ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false, mvmvif->deflink.bssid); in iwl_mvm_bss_info_changed_station()
2895 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); in iwl_mvm_bss_info_changed_station()
2898 memcpy(mvmvif->deflink.bssid, bss_conf->bssid, ETH_ALEN); in iwl_mvm_bss_info_changed_station()
2899 mvmvif->associated = vif->cfg.assoc; in iwl_mvm_bss_info_changed_station()
2902 if (vif->cfg.assoc) { in iwl_mvm_bss_info_changed_station()
2903 mvmvif->session_prot_connection_loss = false; in iwl_mvm_bss_info_changed_station()
2908 memset(&mvmvif->link[i]->beacon_stats, 0, in iwl_mvm_bss_info_changed_station()
2909 sizeof(mvmvif->link[i]->beacon_stats)); in iwl_mvm_bss_info_changed_station()
2919 &mvm->status) && in iwl_mvm_bss_info_changed_station()
2920 !fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_bss_info_changed_station()
2940 u32 dur = (11 * vif->bss_conf.beacon_int) / 10; in iwl_mvm_bss_info_changed_station()
2944 &mvm->status) && in iwl_mvm_bss_info_changed_station()
2945 !vif->bss_conf.dtim_period) { in iwl_mvm_bss_info_changed_station()
2961 if (vif->p2p) { in iwl_mvm_bss_info_changed_station()
2966 } else if (mvmvif->deflink.ap_sta_id != IWL_INVALID_STA) { in iwl_mvm_bss_info_changed_station()
2969 * If update fails - SF might be running in associated in iwl_mvm_bss_info_changed_station()
2970 * mode while disassociated - which is forbidden. in iwl_mvm_bss_info_changed_station()
2975 &mvm->status), in iwl_mvm_bss_info_changed_station()
2988 vif->addr); in iwl_mvm_bss_info_changed_station()
2994 iwl_mvm_bss_info_changed_station_common(mvm, vif, &vif->bss_conf, in iwl_mvm_bss_info_changed_station()
3006 lockdep_assert_held(&mvm->mutex); in iwl_mvm_start_ap_ibss_common()
3008 mvmvif->ap_assoc_sta_count = 0; in iwl_mvm_start_ap_ibss_common()
3011 mvmvif->ap_ibss_active = true; in iwl_mvm_start_ap_ibss_common()
3014 for (i = 0; i < ARRAY_SIZE(mvmvif->ap_early_keys); i++) { in iwl_mvm_start_ap_ibss_common()
3015 struct ieee80211_key_conf *key = mvmvif->ap_early_keys[i]; in iwl_mvm_start_ap_ibss_common()
3020 mvmvif->ap_early_keys[i] = NULL; in iwl_mvm_start_ap_ibss_common()
3027 if (vif->type == NL80211_IFTYPE_AP && !vif->p2p) { in iwl_mvm_start_ap_ibss_common()
3030 iwl_mvm_send_low_latency_cmd(mvm, true, mvmvif->id); in iwl_mvm_start_ap_ibss_common()
3047 mutex_lock(&mvm->mutex); in iwl_mvm_start_ap_ibss()
3050 * Re-calculate the tsf id, as the leader-follower relations depend on in iwl_mvm_start_ap_ibss()
3054 if (vif->type == NL80211_IFTYPE_AP) in iwl_mvm_start_ap_ibss()
3061 if (mvm->trans->trans_cfg->device_family > IWL_DEVICE_FAMILY_22000) { in iwl_mvm_start_ap_ibss()
3095 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) { in iwl_mvm_start_ap_ibss()
3131 if (vif->p2p && mvm->p2p_device_vif) in iwl_mvm_start_ap_ibss()
3132 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false, NULL); in iwl_mvm_start_ap_ibss()
3140 iwl_mvm_ftm_restart_responder(mvm, vif, &vif->bss_conf); in iwl_mvm_start_ap_ibss()
3146 mvmvif->ap_ibss_active = false; in iwl_mvm_start_ap_ibss()
3154 mutex_unlock(&mvm->mutex); in iwl_mvm_start_ap_ibss()
3168 return iwl_mvm_start_ap_ibss(hw, vif, &vif->bss_conf); in iwl_mvm_start_ibss()
3171 /* Common part for MLD and non-MLD ops */
3177 lockdep_assert_held(&mvm->mutex); in iwl_mvm_stop_ap_ibss_common()
3182 if (rcu_access_pointer(mvm->csa_vif) == vif) { in iwl_mvm_stop_ap_ibss_common()
3184 &mvmvif->time_event_data); in iwl_mvm_stop_ap_ibss_common()
3185 RCU_INIT_POINTER(mvm->csa_vif, NULL); in iwl_mvm_stop_ap_ibss_common()
3186 mvmvif->csa_countdown = false; in iwl_mvm_stop_ap_ibss_common()
3189 if (rcu_access_pointer(mvm->csa_tx_blocked_vif) == vif) { in iwl_mvm_stop_ap_ibss_common()
3190 RCU_INIT_POINTER(mvm->csa_tx_blocked_vif, NULL); in iwl_mvm_stop_ap_ibss_common()
3191 mvm->csa_tx_block_bcn_timeout = 0; in iwl_mvm_stop_ap_ibss_common()
3194 mvmvif->ap_ibss_active = false; in iwl_mvm_stop_ap_ibss_common()
3195 mvm->ap_last_beacon_gp2 = 0; in iwl_mvm_stop_ap_ibss_common()
3197 if (vif->type == NL80211_IFTYPE_AP && !vif->p2p) { in iwl_mvm_stop_ap_ibss_common()
3200 iwl_mvm_send_low_latency_cmd(mvm, false, mvmvif->id); in iwl_mvm_stop_ap_ibss_common()
3217 if (vif->p2p && mvm->p2p_device_vif) in iwl_mvm_stop_ap_ibss()
3218 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false, NULL); in iwl_mvm_stop_ap_ibss()
3232 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) in iwl_mvm_stop_ap_ibss()
3235 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) in iwl_mvm_stop_ap_ibss()
3254 iwl_mvm_stop_ap_ibss(hw, vif, &vif->bss_conf); in iwl_mvm_stop_ibss()
3266 if (!mvmvif->ap_ibss_active) in iwl_mvm_bss_info_changed_ap_ibss()
3272 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); in iwl_mvm_bss_info_changed_ap_ibss()
3276 iwl_mvm_mac_ctxt_beacon_changed(mvm, vif, &vif->bss_conf)) in iwl_mvm_bss_info_changed_ap_ibss()
3280 int ret = iwl_mvm_ftm_start_responder(mvm, vif, &vif->bss_conf); in iwl_mvm_bss_info_changed_ap_ibss()
3283 IWL_WARN(mvm, "Failed to enable FTM responder (%d)\n", in iwl_mvm_bss_info_changed_ap_ibss()
3298 if (changes & BSS_CHANGED_IDLE && !vif->cfg.idle) in iwl_mvm_bss_info_changed()
3301 switch (vif->type) { in iwl_mvm_bss_info_changed()
3320 bss_conf->txpower); in iwl_mvm_bss_info_changed()
3321 iwl_mvm_set_tx_power(mvm, bss_conf, bss_conf->txpower); in iwl_mvm_bss_info_changed()
3330 if (hw_req->req.n_channels == 0 || in iwl_mvm_mac_hw_scan()
3331 hw_req->req.n_channels > mvm->fw->ucode_capa.n_scan_channels) in iwl_mvm_mac_hw_scan()
3332 return -EINVAL; in iwl_mvm_mac_hw_scan()
3335 return iwl_mvm_reg_scan_start(mvm, vif, &hw_req->req, &hw_req->ies); in iwl_mvm_mac_hw_scan()
3352 if (mvm->scan_status & IWL_MVM_SCAN_REGULAR) in iwl_mvm_mac_cancel_hw_scan()
3396 * If we have TVQM then we get too high queue numbers - luckily in __iwl_mvm_mac_sta_notify()
3403 spin_lock_bh(&mvmsta->lock); in __iwl_mvm_mac_sta_notify()
3404 for (tid = 0; tid < ARRAY_SIZE(mvmsta->tid_data); tid++) { in __iwl_mvm_mac_sta_notify()
3405 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; in __iwl_mvm_mac_sta_notify()
3407 if (tid_data->txq_id == IWL_MVM_INVALID_QUEUE) in __iwl_mvm_mac_sta_notify()
3410 __set_bit(tid_data->txq_id, &txqs); in __iwl_mvm_mac_sta_notify()
3424 iwl_trans_freeze_txq_timer(mvm->trans, txqs, true); in __iwl_mvm_mac_sta_notify()
3432 if (WARN_ON(mvmsta->deflink.sta_id == IWL_INVALID_STA)) in __iwl_mvm_mac_sta_notify()
3436 iwl_trans_freeze_txq_timer(mvm->trans, txqs, false); in __iwl_mvm_mac_sta_notify()
3442 spin_unlock_bh(&mvmsta->lock); in __iwl_mvm_mac_sta_notify()
3454 struct iwl_mvm_pm_state_notification *notif = (void *)pkt->data; in iwl_mvm_sta_pm_notif()
3457 bool sleeping = (notif->type != IWL_MVM_PM_EVENT_AWAKE); in iwl_mvm_sta_pm_notif()
3459 if (WARN_ON(notif->sta_id >= mvm->fw->ucode_capa.num_stations)) in iwl_mvm_sta_pm_notif()
3463 sta = rcu_dereference(mvm->fw_id_to_mac_id[notif->sta_id]); in iwl_mvm_sta_pm_notif()
3471 if (!mvmsta->vif || in iwl_mvm_sta_pm_notif()
3472 mvmsta->vif->type != NL80211_IFTYPE_AP) { in iwl_mvm_sta_pm_notif()
3477 if (mvmsta->sleeping != sleeping) { in iwl_mvm_sta_pm_notif()
3478 mvmsta->sleeping = sleeping; in iwl_mvm_sta_pm_notif()
3479 __iwl_mvm_mac_sta_notify(mvm->hw, in iwl_mvm_sta_pm_notif()
3486 switch (notif->type) { in iwl_mvm_sta_pm_notif()
3512 lockdep_assert_wiphy(mvm->hw->wiphy); in iwl_mvm_sta_pre_rcu_remove()
3516 * so here we already invalidate our internal RCU-protected in iwl_mvm_sta_pre_rcu_remove()
3521 * Since there's mvm->mutex here, no need to have RCU lock for in iwl_mvm_sta_pre_rcu_remove()
3522 * mvm_sta->link access. in iwl_mvm_sta_pre_rcu_remove()
3525 for (link_id = 0; link_id < ARRAY_SIZE(mvm_sta->link); link_id++) { in iwl_mvm_sta_pre_rcu_remove()
3529 if (!mvm_sta->link[link_id]) in iwl_mvm_sta_pre_rcu_remove()
3532 link_sta = rcu_dereference_protected(mvm_sta->link[link_id], in iwl_mvm_sta_pre_rcu_remove()
3533 lockdep_is_held(&mvm->mutex)); in iwl_mvm_sta_pre_rcu_remove()
3534 sta_id = link_sta->sta_id; in iwl_mvm_sta_pre_rcu_remove()
3535 if (sta == rcu_access_pointer(mvm->fw_id_to_mac_id[sta_id])) { in iwl_mvm_sta_pre_rcu_remove()
3536 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_sta_pre_rcu_remove()
3537 ERR_PTR(-ENOENT)); in iwl_mvm_sta_pre_rcu_remove()
3538 RCU_INIT_POINTER(mvm->fw_id_to_link_sta[sta_id], NULL); in iwl_mvm_sta_pre_rcu_remove()
3548 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in iwl_mvm_check_uapsd()
3551 mdata = &mvm->tcm.data[iwl_mvm_vif_from_mac80211(vif)->id]; in iwl_mvm_check_uapsd()
3552 ewma_rate_init(&mdata->uapsd_nonagg_detect.rate); in iwl_mvm_check_uapsd()
3553 mdata->opened_rx_ba_sessions = false; in iwl_mvm_check_uapsd()
3556 if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT)) in iwl_mvm_check_uapsd()
3559 if (vif->p2p && !iwl_mvm_is_p2p_scm_uapsd_supported(mvm)) { in iwl_mvm_check_uapsd()
3560 vif->driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; in iwl_mvm_check_uapsd()
3564 if (!vif->p2p && in iwl_mvm_check_uapsd()
3566 vif->driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; in iwl_mvm_check_uapsd()
3571 if (ether_addr_equal(mvm->uapsd_noagg_bssids[i].addr, bssid)) { in iwl_mvm_check_uapsd()
3572 vif->driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; in iwl_mvm_check_uapsd()
3577 vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; in iwl_mvm_check_uapsd()
3588 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_tdls_check_trigger()
3593 tdls_trig = (void *)trig->data; in iwl_mvm_tdls_check_trigger()
3595 if (!(tdls_trig->action_bitmap & BIT(action))) in iwl_mvm_tdls_check_trigger()
3598 if (tdls_trig->peer_mode && in iwl_mvm_tdls_check_trigger()
3599 memcmp(tdls_trig->peer, peer_addr, ETH_ALEN) != 0) in iwl_mvm_tdls_check_trigger()
3602 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, in iwl_mvm_tdls_check_trigger()
3620 ies = rcu_dereference(bss->ies); in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3621 elem = cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY, ies->data, in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3622 ies->len); in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3624 if (!elem || elem->datalen < 10 || in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3625 !(elem->data[10] & in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3627 data->tolerated = false; in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3643 if (WARN_ON_ONCE(!link_conf->chanreq.oper.chan || in iwl_mvm_check_he_obss_narrow_bw_ru()
3644 !mvmvif->link[link_id])) in iwl_mvm_check_he_obss_narrow_bw_ru()
3647 if (!(link_conf->chanreq.oper.chan->flags & IEEE80211_CHAN_RADAR)) { in iwl_mvm_check_he_obss_narrow_bw_ru()
3648 mvmvif->link[link_id]->he_ru_2mhz_block = false; in iwl_mvm_check_he_obss_narrow_bw_ru()
3652 cfg80211_bss_iter(hw->wiphy, &link_conf->chanreq.oper, in iwl_mvm_check_he_obss_narrow_bw_ru()
3658 * tolerate 26-tone RU UL OFDMA transmissions using HE TB PPDU. in iwl_mvm_check_he_obss_narrow_bw_ru()
3660 mvmvif->link[link_id]->he_ru_2mhz_block = !iter_data.tolerated; in iwl_mvm_check_he_obss_narrow_bw_ru()
3669 if (vif->type != NL80211_IFTYPE_STATION) in iwl_mvm_reset_cca_40mhz_workaround()
3672 if (!mvm->cca_40mhz_workaround) in iwl_mvm_reset_cca_40mhz_workaround()
3676 mvm->cca_40mhz_workaround--; in iwl_mvm_reset_cca_40mhz_workaround()
3677 if (mvm->cca_40mhz_workaround) in iwl_mvm_reset_cca_40mhz_workaround()
3680 sband = mvm->hw->wiphy->bands[NL80211_BAND_2GHZ]; in iwl_mvm_reset_cca_40mhz_workaround()
3682 sband->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; in iwl_mvm_reset_cca_40mhz_workaround()
3690 he->he_cap_elem.phy_cap_info[0] |= in iwl_mvm_reset_cca_40mhz_workaround()
3702 .ssid_len = vif->cfg.ssid_len, in iwl_mvm_mei_host_associated()
3705 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mei_host_associated()
3708 if (!mvm->mei_registered) in iwl_mvm_mei_host_associated()
3712 if (!vif->bss_conf.chanreq.oper.chan) in iwl_mvm_mei_host_associated()
3715 conn_info.channel = vif->bss_conf.chanreq.oper.chan->hw_value; in iwl_mvm_mei_host_associated()
3717 switch (mvm_sta->pairwise_cipher) { in iwl_mvm_mei_host_associated()
3738 switch (mvmvif->rekey_data.akm) { in iwl_mvm_mei_host_associated()
3758 memcpy(conn_info.ssid, vif->cfg.ssid, vif->cfg.ssid_len); in iwl_mvm_mei_host_associated()
3759 memcpy(conn_info.bssid, vif->bss_conf.bssid, ETH_ALEN); in iwl_mvm_mei_host_associated()
3808 if (!conf || !link_sta || !mvmvif->link[link_id]->phy_ctxt) in iwl_mvm_rs_rate_init_all_links()
3812 mvmvif->link[link_id]->phy_ctxt->channel->band); in iwl_mvm_rs_rate_init_all_links()
3823 /* Beacon interval check - firmware will crash if the beacon in iwl_mvm_vif_conf_from_sta()
3837 if (link_conf->beacon_int < IWL_MVM_MIN_BEACON_INTERVAL_TU) { in iwl_mvm_vif_conf_from_sta()
3840 link_conf->beacon_int, link_sta->addr); in iwl_mvm_vif_conf_from_sta()
3844 link_conf->he_support = link_sta->he_cap.has_he; in iwl_mvm_vif_conf_from_sta()
3863 if (!link_conf || !mvmvif->link[link_id]) in iwl_mvm_vif_set_he_support()
3866 link_conf->he_support = link_sta->he_cap.has_he; in iwl_mvm_vif_set_he_support()
3869 mvmvif->link[link_id]->he_ru_2mhz_block = false; in iwl_mvm_vif_set_he_support()
3870 if (link_sta->he_cap.has_he) in iwl_mvm_vif_set_he_support()
3889 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_state_notexist_to_none()
3891 if (vif->type == NL80211_IFTYPE_STATION && in iwl_mvm_sta_state_notexist_to_none()
3893 return -EINVAL; in iwl_mvm_sta_state_notexist_to_none()
3895 if (sta->tdls && in iwl_mvm_sta_state_notexist_to_none()
3896 (vif->p2p || in iwl_mvm_sta_state_notexist_to_none()
3900 return -EBUSY; in iwl_mvm_sta_state_notexist_to_none()
3903 ret = callbacks->add_sta(mvm, vif, sta); in iwl_mvm_sta_state_notexist_to_none()
3904 if (sta->tdls && ret == 0) { in iwl_mvm_sta_state_notexist_to_none()
3906 iwl_mvm_tdls_check_trigger(mvm, vif, sta->addr, in iwl_mvm_sta_state_notexist_to_none()
3914 link_sta->agg.max_rc_amsdu_len = 1; in iwl_mvm_sta_state_notexist_to_none()
3918 if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) in iwl_mvm_sta_state_notexist_to_none()
3919 mvmvif->ap_sta = sta; in iwl_mvm_sta_state_notexist_to_none()
3922 * Initialize the rates here already - this really tells in iwl_mvm_sta_state_notexist_to_none()
3949 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_state_auth_to_assoc()
3951 if (vif->type == NL80211_IFTYPE_AP) { in iwl_mvm_sta_state_auth_to_assoc()
3953 mvmvif->ap_assoc_sta_count++; in iwl_mvm_sta_state_auth_to_assoc()
3954 callbacks->mac_ctxt_changed(mvm, vif, false); in iwl_mvm_sta_state_auth_to_assoc()
3959 if (!mvm->mld_api_is_used && in iwl_mvm_sta_state_auth_to_assoc()
3960 (vif->bss_conf.he_support && in iwl_mvm_sta_state_auth_to_assoc()
3962 iwl_mvm_cfg_he_sta(mvm, vif, mvm_sta->deflink.sta_id); in iwl_mvm_sta_state_auth_to_assoc()
3963 } else if (vif->type == NL80211_IFTYPE_STATION) { in iwl_mvm_sta_state_auth_to_assoc()
3966 callbacks->mac_ctxt_changed(mvm, vif, false); in iwl_mvm_sta_state_auth_to_assoc()
3968 if (!mvm->mld_api_is_used) in iwl_mvm_sta_state_auth_to_assoc()
3976 return -EINVAL; in iwl_mvm_sta_state_auth_to_assoc()
3977 if (!mvmvif->link[link_id]) in iwl_mvm_sta_state_auth_to_assoc()
3990 return callbacks->update_sta(mvm, vif, sta); in iwl_mvm_sta_state_auth_to_assoc()
4002 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_state_assoc_to_authorized()
4008 if (sta->tdls) { in iwl_mvm_sta_state_assoc_to_authorized()
4009 iwl_mvm_tdls_check_trigger(mvm, vif, sta->addr, in iwl_mvm_sta_state_assoc_to_authorized()
4015 mvmvif->authorized = 1; in iwl_mvm_sta_state_assoc_to_authorized()
4017 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in iwl_mvm_sta_state_assoc_to_authorized()
4018 mvmvif->link_selection_res = vif->active_links; in iwl_mvm_sta_state_assoc_to_authorized()
4019 mvmvif->link_selection_primary = in iwl_mvm_sta_state_assoc_to_authorized()
4020 vif->active_links ? __ffs(vif->active_links) : 0; in iwl_mvm_sta_state_assoc_to_authorized()
4023 callbacks->mac_ctxt_changed(mvm, vif, false); in iwl_mvm_sta_state_assoc_to_authorized()
4026 memset(&mvmvif->last_esr_exit, 0, in iwl_mvm_sta_state_assoc_to_authorized()
4027 sizeof(mvmvif->last_esr_exit)); in iwl_mvm_sta_state_assoc_to_authorized()
4037 if (vif->type == NL80211_IFTYPE_STATION && in iwl_mvm_sta_state_assoc_to_authorized()
4038 !test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_sta_state_assoc_to_authorized()
4042 mvm_sta->authorized = true; in iwl_mvm_sta_state_assoc_to_authorized()
4047 if (!sta->mfp) { in iwl_mvm_sta_state_assoc_to_authorized()
4048 int ret = callbacks->update_sta(mvm, vif, sta); in iwl_mvm_sta_state_assoc_to_authorized()
4068 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_state_authorized_to_assoc()
4070 mvmsta->authorized = false; in iwl_mvm_sta_state_authorized_to_assoc()
4077 if (!sta->tdls) { in iwl_mvm_sta_state_authorized_to_assoc()
4082 mvmvif->authorized = 0; in iwl_mvm_sta_state_authorized_to_assoc()
4083 mvmvif->link_selection_res = 0; in iwl_mvm_sta_state_authorized_to_assoc()
4088 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_sta_state_authorized_to_assoc()
4089 &mvmvif->prevent_esr_done_wk); in iwl_mvm_sta_state_authorized_to_assoc()
4091 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_sta_state_authorized_to_assoc()
4092 &mvmvif->mlo_int_scan_wk); in iwl_mvm_sta_state_authorized_to_assoc()
4094 wiphy_work_cancel(mvm->hw->wiphy, &mvmvif->unblock_esr_tpt_wk); in iwl_mvm_sta_state_authorized_to_assoc()
4095 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_sta_state_authorized_to_assoc()
4096 &mvmvif->unblock_esr_tmp_non_bss_wk); in iwl_mvm_sta_state_authorized_to_assoc()
4102 /* Common part for MLD and non-MLD modes */
4117 IWL_DEBUG_MAC80211(mvm, "station %pM state change %d->%d\n", in iwl_mvm_mac_sta_state_common()
4118 sta->addr, old_state, new_state); in iwl_mvm_mac_sta_state_common()
4130 * Drop any still-queued deferred-frame before removing the STA, and in iwl_mvm_mac_sta_state_common()
4135 flush_work(&mvm->add_stream_wk); in iwl_mvm_mac_sta_state_common()
4149 kfree(mvm_sta->dup_data); in iwl_mvm_mac_sta_state_common()
4152 mutex_lock(&mvm->mutex); in iwl_mvm_mac_sta_state_common()
4160 if (WARN_ON_ONCE(!mvmvif->link[link_id] || in iwl_mvm_mac_sta_state_common()
4161 !mvmvif->link[link_id]->phy_ctxt)) { in iwl_mvm_mac_sta_state_common()
4162 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sta_state_common()
4164 &mvm->status) ? 0 : -EINVAL; in iwl_mvm_mac_sta_state_common()
4169 mvm_sta->sta_state = new_state; in iwl_mvm_mac_sta_state_common()
4183 mvm->last_ebs_successful = true; in iwl_mvm_mac_sta_state_common()
4184 iwl_mvm_check_uapsd(mvm, vif, sta->addr); in iwl_mvm_mac_sta_state_common()
4200 if (vif->type == NL80211_IFTYPE_AP) { in iwl_mvm_mac_sta_state_common()
4201 mvmvif->ap_assoc_sta_count--; in iwl_mvm_mac_sta_state_common()
4202 callbacks->mac_ctxt_changed(mvm, vif, false); in iwl_mvm_mac_sta_state_common()
4203 } else if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) in iwl_mvm_mac_sta_state_common()
4211 if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) { in iwl_mvm_mac_sta_state_common()
4213 mvmvif->ap_sta = NULL; in iwl_mvm_mac_sta_state_common()
4215 ret = callbacks->rm_sta(mvm, vif, sta); in iwl_mvm_mac_sta_state_common()
4216 if (sta->tdls) { in iwl_mvm_mac_sta_state_common()
4218 iwl_mvm_tdls_check_trigger(mvm, vif, sta->addr, in iwl_mvm_mac_sta_state_common()
4224 &mvm->status))) in iwl_mvm_mac_sta_state_common()
4227 ret = -EIO; in iwl_mvm_mac_sta_state_common()
4230 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sta_state_common()
4232 if (sta->tdls && ret == 0) { in iwl_mvm_mac_sta_state_common()
4248 mvm->rts_threshold = value; in iwl_mvm_mac_set_rts_threshold()
4256 struct ieee80211_sta *sta = link_sta->sta; in iwl_mvm_sta_rc_update()
4264 if (vif->type == NL80211_IFTYPE_STATION && in iwl_mvm_sta_rc_update()
4277 mvmvif->deflink.queue_params[ac] = *params; in iwl_mvm_mac_conf_tx()
4283 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { in iwl_mvm_mac_conf_tx()
4297 if (info->was_assoc && !mvmvif->session_prot_connection_loss) in iwl_mvm_mac_mgd_prepare_tx()
4301 iwl_mvm_protect_assoc(mvm, vif, info->duration, info->link_id); in iwl_mvm_mac_mgd_prepare_tx()
4311 if (info->success) in iwl_mvm_mac_mgd_complete_tx()
4327 if (!vif->cfg.idle) in iwl_mvm_mac_sched_scan_start()
4328 return -EBUSY; in iwl_mvm_mac_sched_scan_start()
4339 mutex_lock(&mvm->mutex); in iwl_mvm_mac_sched_scan_stop()
4349 if (!(mvm->scan_status & IWL_MVM_SCAN_SCHED)) { in iwl_mvm_mac_sched_scan_stop()
4350 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sched_scan_stop()
4355 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sched_scan_stop()
4371 int keyidx = key->keyidx; in __iwl_mvm_mac_set_key()
4373 u8 sec_key_ver = iwl_fw_lookup_cmd_ver(mvm->fw, sec_key_id, 0); in __iwl_mvm_mac_set_key()
4380 switch (key->cipher) { in __iwl_mvm_mac_set_key()
4382 if (!mvm->trans->trans_cfg->gen2) { in __iwl_mvm_mac_set_key()
4383 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; in __iwl_mvm_mac_set_key()
4384 key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE; in __iwl_mvm_mac_set_key()
4385 } else if (vif->type == NL80211_IFTYPE_STATION) { in __iwl_mvm_mac_set_key()
4386 key->flags |= IEEE80211_KEY_FLAG_PUT_MIC_SPACE; in __iwl_mvm_mac_set_key()
4389 return -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4396 key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE; in __iwl_mvm_mac_set_key()
4405 if (vif->type == NL80211_IFTYPE_STATION) in __iwl_mvm_mac_set_key()
4408 return -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4412 return -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4417 if (vif->type == NL80211_IFTYPE_STATION && in __iwl_mvm_mac_set_key()
4419 rcu_assign_pointer(mvmvif->bcn_prot.keys[keyidx - 6], in __iwl_mvm_mac_set_key()
4422 if ((vif->type == NL80211_IFTYPE_ADHOC || in __iwl_mvm_mac_set_key()
4423 vif->type == NL80211_IFTYPE_AP) && !sta) { in __iwl_mvm_mac_set_key()
4425 * GTK on AP interface is a TX-only key, return 0; in __iwl_mvm_mac_set_key()
4426 * on IBSS they're per-station and because we're lazy in __iwl_mvm_mac_set_key()
4431 * Except, of course, beacon protection - it must be in __iwl_mvm_mac_set_key()
4436 * So just check for beacon protection - if we don't in __iwl_mvm_mac_set_key()
4441 if (!wiphy_ext_feature_isset(hw->wiphy, in __iwl_mvm_mac_set_key()
4443 (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || in __iwl_mvm_mac_set_key()
4444 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || in __iwl_mvm_mac_set_key()
4445 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256)) { in __iwl_mvm_mac_set_key()
4446 ret = -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4450 if (key->cipher != WLAN_CIPHER_SUITE_GCMP && in __iwl_mvm_mac_set_key()
4451 key->cipher != WLAN_CIPHER_SUITE_GCMP_256 && in __iwl_mvm_mac_set_key()
4453 key->hw_key_idx = STA_KEY_IDX_INVALID; in __iwl_mvm_mac_set_key()
4458 if (!mvmvif->ap_ibss_active) { in __iwl_mvm_mac_set_key()
4460 i < ARRAY_SIZE(mvmvif->ap_early_keys); in __iwl_mvm_mac_set_key()
4462 if (!mvmvif->ap_early_keys[i]) { in __iwl_mvm_mac_set_key()
4463 mvmvif->ap_early_keys[i] = key; in __iwl_mvm_mac_set_key()
4468 if (i >= ARRAY_SIZE(mvmvif->ap_early_keys)) in __iwl_mvm_mac_set_key()
4469 ret = -ENOSPC; in __iwl_mvm_mac_set_key()
4480 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in __iwl_mvm_mac_set_key()
4481 key->hw_key_idx == STA_KEY_IDX_INVALID) { in __iwl_mvm_mac_set_key()
4488 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in __iwl_mvm_mac_set_key()
4490 key->flags & IEEE80211_KEY_FLAG_PAIRWISE && in __iwl_mvm_mac_set_key()
4491 (key->cipher == WLAN_CIPHER_SUITE_CCMP || in __iwl_mvm_mac_set_key()
4492 key->cipher == WLAN_CIPHER_SUITE_GCMP || in __iwl_mvm_mac_set_key()
4493 key->cipher == WLAN_CIPHER_SUITE_GCMP_256)) { in __iwl_mvm_mac_set_key()
4497 WARN_ON(rcu_access_pointer(mvmsta->ptk_pn[keyidx])); in __iwl_mvm_mac_set_key()
4499 mvm->trans->num_rx_queues), in __iwl_mvm_mac_set_key()
4502 ret = -ENOMEM; in __iwl_mvm_mac_set_key()
4508 for (q = 0; q < mvm->trans->num_rx_queues; q++) in __iwl_mvm_mac_set_key()
4509 memcpy(ptk_pn->q[q].pn[tid], in __iwl_mvm_mac_set_key()
4514 rcu_assign_pointer(mvmsta->ptk_pn[keyidx], ptk_pn); in __iwl_mvm_mac_set_key()
4518 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in __iwl_mvm_mac_set_key()
4519 key_offset = key->hw_key_idx; in __iwl_mvm_mac_set_key()
4523 if (mvmsta && key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in __iwl_mvm_mac_set_key()
4524 mvmsta->pairwise_cipher = key->cipher; in __iwl_mvm_mac_set_key()
4527 sta ? sta->addr : NULL, key->keyidx); in __iwl_mvm_mac_set_key()
4536 key->hw_key_idx = STA_KEY_IDX_INVALID; in __iwl_mvm_mac_set_key()
4538 RCU_INIT_POINTER(mvmsta->ptk_pn[keyidx], NULL); in __iwl_mvm_mac_set_key()
4548 ret = -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4555 if (vif->type == NL80211_IFTYPE_STATION && in __iwl_mvm_mac_set_key()
4557 RCU_INIT_POINTER(mvmvif->bcn_prot.keys[keyidx - 6], in __iwl_mvm_mac_set_key()
4560 ret = -ENOENT; in __iwl_mvm_mac_set_key()
4561 for (i = 0; i < ARRAY_SIZE(mvmvif->ap_early_keys); i++) { in __iwl_mvm_mac_set_key()
4562 if (mvmvif->ap_early_keys[i] == key) { in __iwl_mvm_mac_set_key()
4563 mvmvif->ap_early_keys[i] = NULL; in __iwl_mvm_mac_set_key()
4568 /* found in pending list - don't do anything else */ in __iwl_mvm_mac_set_key()
4572 if (key->hw_key_idx == STA_KEY_IDX_INVALID) { in __iwl_mvm_mac_set_key()
4578 key->flags & IEEE80211_KEY_FLAG_PAIRWISE && in __iwl_mvm_mac_set_key()
4579 (key->cipher == WLAN_CIPHER_SUITE_CCMP || in __iwl_mvm_mac_set_key()
4580 key->cipher == WLAN_CIPHER_SUITE_GCMP || in __iwl_mvm_mac_set_key()
4581 key->cipher == WLAN_CIPHER_SUITE_GCMP_256)) { in __iwl_mvm_mac_set_key()
4583 mvmsta->ptk_pn[keyidx], in __iwl_mvm_mac_set_key()
4584 lockdep_is_held(&mvm->mutex)); in __iwl_mvm_mac_set_key()
4585 RCU_INIT_POINTER(mvmsta->ptk_pn[keyidx], NULL); in __iwl_mvm_mac_set_key()
4597 ret = -EINVAL; in __iwl_mvm_mac_set_key()
4621 if (keyconf->hw_key_idx == STA_KEY_IDX_INVALID) in iwl_mvm_mac_update_tkip_key()
4637 if (WARN_ON(pkt->hdr.cmd != HOT_SPOT_CMD)) in iwl_mvm_rx_aux_roc()
4645 resp = (void *)pkt->data; in iwl_mvm_rx_aux_roc()
4649 resp->status, resp->event_unique_id); in iwl_mvm_rx_aux_roc()
4651 te_data->uid = le32_to_cpu(resp->event_unique_id); in iwl_mvm_rx_aux_roc()
4652 IWL_DEBUG_TE(mvm, "TIME_EVENT_CMD response - UID = 0x%x\n", in iwl_mvm_rx_aux_roc()
4653 te_data->uid); in iwl_mvm_rx_aux_roc()
4655 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_rx_aux_roc()
4656 list_add_tail(&te_data->list, &mvm->aux_roc_te_list); in iwl_mvm_rx_aux_roc()
4657 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_rx_aux_roc()
4669 struct iwl_mvm_time_event_data *te_data = &mvmvif->hs_time_event_data; in iwl_mvm_send_aux_roc_cmd()
4677 .sta_id_and_color = cpu_to_le32(mvm->aux_sta.sta_id), in iwl_mvm_send_aux_roc_cmd()
4681 u16 len = sizeof(aux_roc_req) - iwl_mvm_chan_info_padding(mvm); in iwl_mvm_send_aux_roc_cmd()
4684 iwl_mvm_set_chan_info(mvm, &aux_roc_req.channel_info, channel->hw_value, in iwl_mvm_send_aux_roc_cmd()
4685 iwl_mvm_phy_band_from_nl80211(channel->band), in iwl_mvm_send_aux_roc_cmd()
4690 tail->apply_time = cpu_to_le32(iwl_mvm_get_systime(mvm)); in iwl_mvm_send_aux_roc_cmd()
4693 tail->duration = cpu_to_le32(req_dur); in iwl_mvm_send_aux_roc_cmd()
4694 tail->apply_time_max_delay = cpu_to_le32(delay); in iwl_mvm_send_aux_roc_cmd()
4698 channel->hw_value, req_dur); in iwl_mvm_send_aux_roc_cmd()
4704 memcpy(tail->node_addr, vif->addr, ETH_ALEN); in iwl_mvm_send_aux_roc_cmd()
4706 lockdep_assert_held(&mvm->mutex); in iwl_mvm_send_aux_roc_cmd()
4708 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4710 if (WARN_ON(te_data->id == HOT_SPOT_CMD)) { in iwl_mvm_send_aux_roc_cmd()
4711 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4712 return -EIO; in iwl_mvm_send_aux_roc_cmd()
4715 te_data->vif = vif; in iwl_mvm_send_aux_roc_cmd()
4716 te_data->duration = duration; in iwl_mvm_send_aux_roc_cmd()
4717 te_data->id = HOT_SPOT_CMD; in iwl_mvm_send_aux_roc_cmd()
4719 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4730 iwl_init_notification_wait(&mvm->notif_wait, &wait_time_event, in iwl_mvm_send_aux_roc_cmd()
4740 iwl_remove_notification(&mvm->notif_wait, &wait_time_event); in iwl_mvm_send_aux_roc_cmd()
4745 res = iwl_wait_notification(&mvm->notif_wait, &wait_time_event, 1); in iwl_mvm_send_aux_roc_cmd()
4751 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4753 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4763 lockdep_assert_held(&mvm->mutex); in iwl_mvm_add_aux_sta_for_hs20()
4765 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_add_aux_sta_for_hs20()
4768 return -EINVAL; in iwl_mvm_add_aux_sta_for_hs20()
4771 if (iwl_mvm_has_new_station_api(mvm->fw)) { in iwl_mvm_add_aux_sta_for_hs20()
4783 lockdep_assert_held(&mvm->mutex); in iwl_mvm_roc_link()
4816 u8 fw_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, in iwl_mvm_roc_station()
4825 ret = -EOPNOTSUPP; in iwl_mvm_roc_station()
4841 lockdep_assert_held(&mvm->mutex); in iwl_mvm_roc_p2p()
4852 return -EINVAL; in iwl_mvm_roc_p2p()
4856 iwl_mvm_get_lmac_id(mvm, channel->band)); in iwl_mvm_roc_p2p()
4871 lockdep_assert_held(&mvm->mutex); in iwl_mvm_p2p_find_phy_ctxt()
4873 if (mvmvif->deflink.phy_ctxt && in iwl_mvm_p2p_find_phy_ctxt()
4874 channel == mvmvif->deflink.phy_ctxt->channel) in iwl_mvm_p2p_find_phy_ctxt()
4879 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[i]; in iwl_mvm_p2p_find_phy_ctxt()
4881 if (!phy_ctxt->ref || mvmvif->deflink.phy_ctxt == phy_ctxt) in iwl_mvm_p2p_find_phy_ctxt()
4884 if (channel == phy_ctxt->channel) { in iwl_mvm_p2p_find_phy_ctxt()
4885 if (mvmvif->deflink.phy_ctxt) in iwl_mvm_p2p_find_phy_ctxt()
4887 mvmvif->deflink.phy_ctxt); in iwl_mvm_p2p_find_phy_ctxt()
4889 mvmvif->deflink.phy_ctxt = phy_ctxt; in iwl_mvm_p2p_find_phy_ctxt()
4890 iwl_mvm_phy_ctxt_ref(mvm, mvmvif->deflink.phy_ctxt); in iwl_mvm_p2p_find_phy_ctxt()
4896 if (mvmvif->deflink.phy_ctxt) in iwl_mvm_p2p_find_phy_ctxt()
4897 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); in iwl_mvm_p2p_find_phy_ctxt()
4899 mvmvif->deflink.phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm); in iwl_mvm_p2p_find_phy_ctxt()
4900 if (!mvmvif->deflink.phy_ctxt) in iwl_mvm_p2p_find_phy_ctxt()
4901 return -ENOSPC; in iwl_mvm_p2p_find_phy_ctxt()
4905 return iwl_mvm_phy_ctxt_add(mvm, mvmvif->deflink.phy_ctxt, in iwl_mvm_p2p_find_phy_ctxt()
4909 /* Execute the common part for MLD and non-MLD modes */
4920 IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value, in iwl_mvm_roc_common()
4927 flush_work(&mvm->roc_done_wk); in iwl_mvm_roc_common()
4938 switch (vif->type) { in iwl_mvm_roc_common()
4940 lmac_id = iwl_mvm_get_lmac_id(mvm, channel->band); in iwl_mvm_roc_common()
4943 ret = ops->add_aux_sta_for_hs20(mvm, lmac_id); in iwl_mvm_roc_common()
4951 IWL_ERR(mvm, "ROC: Invalid vif type=%u\n", vif->type); in iwl_mvm_roc_common()
4952 return -EINVAL; in iwl_mvm_roc_common()
4964 ret = ops->link(mvm, vif); in iwl_mvm_roc_common()
4998 if (rcu_access_pointer(link_conf->chanctx_conf) != data->ctx) in iwl_mvm_chanctx_usage_iter()
5001 if (iwl_mvm_enable_fils(data->mvm, vif, data->ctx)) in iwl_mvm_chanctx_usage_iter()
5002 data->use_def = true; in iwl_mvm_chanctx_usage_iter()
5004 if (vif->type == NL80211_IFTYPE_AP && link_conf->ftmr_params) in iwl_mvm_chanctx_usage_iter()
5005 data->use_def = true; in iwl_mvm_chanctx_usage_iter()
5018 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in iwl_mvm_chanctx_def()
5023 return data.use_def ? &ctx->def : &ctx->min_def; in iwl_mvm_chanctx_def()
5029 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; in __iwl_mvm_add_chanctx()
5034 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_add_chanctx()
5040 ret = -ENOSPC; in __iwl_mvm_add_chanctx()
5044 ret = iwl_mvm_phy_ctxt_add(mvm, phy_ctxt, def, &ctx->ap, in __iwl_mvm_add_chanctx()
5045 ctx->rx_chains_static, in __iwl_mvm_add_chanctx()
5046 ctx->rx_chains_dynamic); in __iwl_mvm_add_chanctx()
5052 *phy_ctxt_id = phy_ctxt->id; in __iwl_mvm_add_chanctx()
5069 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; in __iwl_mvm_remove_chanctx()
5070 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; in __iwl_mvm_remove_chanctx()
5072 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_remove_chanctx()
5090 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; in iwl_mvm_change_chanctx()
5091 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; in iwl_mvm_change_chanctx()
5094 if (WARN_ONCE((phy_ctxt->ref > 1) && in iwl_mvm_change_chanctx()
5100 phy_ctxt->ref, changed)) in iwl_mvm_change_chanctx()
5107 if (phy_ctxt->width == def->width) in iwl_mvm_change_chanctx()
5111 if (phy_ctxt->width <= NL80211_CHAN_WIDTH_20 && in iwl_mvm_change_chanctx()
5112 def->width <= NL80211_CHAN_WIDTH_20) in iwl_mvm_change_chanctx()
5117 iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, def, &ctx->ap, in iwl_mvm_change_chanctx()
5118 ctx->rx_chains_static, in iwl_mvm_change_chanctx()
5119 ctx->rx_chains_dynamic); in iwl_mvm_change_chanctx()
5123 * This function executes the common part for MLD and non-MLD modes.
5134 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; in __iwl_mvm_assign_vif_chanctx_common()
5135 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; in __iwl_mvm_assign_vif_chanctx_common()
5138 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_assign_vif_chanctx_common()
5140 mvmvif->deflink.phy_ctxt = phy_ctxt; in __iwl_mvm_assign_vif_chanctx_common()
5142 switch (vif->type) { in __iwl_mvm_assign_vif_chanctx_common()
5146 mvmvif->ap_ibss_active = true; in __iwl_mvm_assign_vif_chanctx_common()
5161 mvmvif->ps_disabled = true; in __iwl_mvm_assign_vif_chanctx_common()
5164 *ret = -EINVAL; in __iwl_mvm_assign_vif_chanctx_common()
5180 return -EINVAL; in __iwl_mvm_assign_vif_chanctx()
5200 if (vif->type == NL80211_IFTYPE_MONITOR) { in __iwl_mvm_assign_vif_chanctx()
5201 mvmvif->monitor_active = true; in __iwl_mvm_assign_vif_chanctx()
5213 if (vif->type == NL80211_IFTYPE_AP) { in __iwl_mvm_assign_vif_chanctx()
5218 if (vif->type == NL80211_IFTYPE_STATION) { in __iwl_mvm_assign_vif_chanctx()
5220 mvmvif->csa_bcn_pending = false; in __iwl_mvm_assign_vif_chanctx()
5224 mvmvif->csa_bcn_pending = true; in __iwl_mvm_assign_vif_chanctx()
5226 if (!fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_assign_vif_chanctx()
5228 u32 duration = 5 * vif->bss_conf.beacon_int; in __iwl_mvm_assign_vif_chanctx()
5234 vif->bss_conf.beacon_int / 2, in __iwl_mvm_assign_vif_chanctx()
5252 mvmvif->deflink.phy_ctxt = NULL; in __iwl_mvm_assign_vif_chanctx()
5268 * This function executes the common part for MLD and non-MLD modes.
5279 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_unassign_vif_chanctx_common()
5281 &mvmvif->time_event_data); in __iwl_mvm_unassign_vif_chanctx_common()
5283 switch (vif->type) { in __iwl_mvm_unassign_vif_chanctx_common()
5287 mvmvif->monitor_active = false; in __iwl_mvm_unassign_vif_chanctx_common()
5288 mvmvif->ps_disabled = false; in __iwl_mvm_unassign_vif_chanctx_common()
5292 if (!switching_chanctx || !mvmvif->ap_ibss_active) in __iwl_mvm_unassign_vif_chanctx_common()
5295 mvmvif->csa_countdown = false; in __iwl_mvm_unassign_vif_chanctx_common()
5301 rcu_assign_pointer(mvm->csa_tx_blocked_vif, vif); in __iwl_mvm_unassign_vif_chanctx_common()
5303 mvmvif->ap_ibss_active = false; in __iwl_mvm_unassign_vif_chanctx_common()
5323 if (vif->type == NL80211_IFTYPE_MONITOR) in __iwl_mvm_unassign_vif_chanctx()
5327 if (vif->type == NL80211_IFTYPE_STATION && switching_chanctx) { in __iwl_mvm_unassign_vif_chanctx()
5329 if (!fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_unassign_vif_chanctx()
5338 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_CHANNEL_SWITCH_CMD) && in __iwl_mvm_unassign_vif_chanctx()
5341 mvmvif->deflink.phy_ctxt = NULL; in __iwl_mvm_unassign_vif_chanctx()
5364 ops->__unassign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_swap()
5374 ret = ops->__assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_swap()
5382 /* we don't support TDLS during DCM - can be caused by channel switch */ in iwl_mvm_switch_vif_chanctx_swap()
5397 if (ops->__assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_swap()
5407 iwl_force_nmi(mvm->trans); in iwl_mvm_switch_vif_chanctx_swap()
5419 ops->__unassign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_reassign()
5422 ret = ops->__assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_reassign()
5433 if (ops->__assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_reassign()
5443 iwl_force_nmi(mvm->trans); in iwl_mvm_switch_vif_chanctx_reassign()
5447 /* Execute the common part for both MLD and non-MLD modes */
5458 /* we only support a single-vif right now */ in iwl_mvm_switch_vif_chanctx_common()
5460 return -EOPNOTSUPP; in iwl_mvm_switch_vif_chanctx_common()
5470 ret = -EOPNOTSUPP; in iwl_mvm_switch_vif_chanctx_common()
5494 return mvm->ibss_manager; in iwl_mvm_tx_last_beacon()
5503 if (!mvm_sta || !mvm_sta->vif) { in iwl_mvm_set_tim()
5505 return -EINVAL; in iwl_mvm_set_tim()
5508 return iwl_mvm_mac_ctxt_beacon_changed(mvm, mvm_sta->vif, in iwl_mvm_set_tim()
5509 &mvm_sta->vif->bss_conf); in iwl_mvm_set_tim()
5533 return -EINVAL; in __iwl_mvm_mac_testmode_cmd()
5537 if (!vif || vif->type != NL80211_IFTYPE_AP || !vif->p2p || in __iwl_mvm_mac_testmode_cmd()
5538 !vif->bss_conf.enable_beacon || in __iwl_mvm_mac_testmode_cmd()
5540 return -EINVAL; in __iwl_mvm_mac_testmode_cmd()
5543 if (noa_duration >= vif->bss_conf.beacon_int) in __iwl_mvm_mac_testmode_cmd()
5544 return -EINVAL; in __iwl_mvm_mac_testmode_cmd()
5546 mvm->noa_duration = noa_duration; in __iwl_mvm_mac_testmode_cmd()
5547 mvm->noa_vif = vif; in __iwl_mvm_mac_testmode_cmd()
5551 /* must be associated client vif - ignore authorized */ in __iwl_mvm_mac_testmode_cmd()
5552 if (!vif || vif->type != NL80211_IFTYPE_STATION || in __iwl_mvm_mac_testmode_cmd()
5553 !vif->cfg.assoc || !vif->bss_conf.dtim_period || in __iwl_mvm_mac_testmode_cmd()
5555 return -EINVAL; in __iwl_mvm_mac_testmode_cmd()
5562 return -EOPNOTSUPP; in __iwl_mvm_mac_testmode_cmd()
5595 .mac_id = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, in iwl_mvm_schedule_client_csa()
5596 mvmvif->color)), in iwl_mvm_schedule_client_csa()
5598 .tsf = cpu_to_le32(chsw->timestamp), in iwl_mvm_schedule_client_csa()
5599 .cs_count = chsw->count, in iwl_mvm_schedule_client_csa()
5600 .cs_mode = chsw->block_tx, in iwl_mvm_schedule_client_csa()
5603 lockdep_assert_held(&mvm->mutex); in iwl_mvm_schedule_client_csa()
5605 if (chsw->delay) in iwl_mvm_schedule_client_csa()
5607 DIV_ROUND_UP(chsw->delay, vif->bss_conf.beacon_int); in iwl_mvm_schedule_client_csa()
5628 if (chsw->count <= 1) in iwl_mvm_old_pre_chan_sw_sta()
5631 apply_time = chsw->device_timestamp + in iwl_mvm_old_pre_chan_sw_sta()
5632 ((vif->bss_conf.beacon_int * (chsw->count - 1) - in iwl_mvm_old_pre_chan_sw_sta()
5635 if (chsw->block_tx) in iwl_mvm_old_pre_chan_sw_sta()
5638 if (mvmvif->bf_enabled) { in iwl_mvm_old_pre_chan_sw_sta()
5645 iwl_mvm_schedule_csa_period(mvm, vif, vif->bss_conf.beacon_int, in iwl_mvm_old_pre_chan_sw_sta()
5655 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) { in iwl_mvm_csa_block_txqs()
5657 iwl_mvm_txq_from_mac80211(sta->txq[i]); in iwl_mvm_csa_block_txqs()
5659 set_bit(IWL_MVM_TXQ_STATE_STOP_AP_CSA, &mvmtxq->state); in iwl_mvm_csa_block_txqs()
5673 lockdep_assert_held(&mvm->mutex); in iwl_mvm_pre_channel_switch()
5675 mvmvif->csa_failed = false; in iwl_mvm_pre_channel_switch()
5676 mvmvif->csa_blocks_tx = false; in iwl_mvm_pre_channel_switch()
5679 chsw->chandef.center_freq1); in iwl_mvm_pre_channel_switch()
5681 iwl_fw_dbg_trigger_simple_stop(&mvm->fwrt, in iwl_mvm_pre_channel_switch()
5685 switch (vif->type) { in iwl_mvm_pre_channel_switch()
5688 rcu_dereference_protected(mvm->csa_vif, in iwl_mvm_pre_channel_switch()
5689 lockdep_is_held(&mvm->mutex)); in iwl_mvm_pre_channel_switch()
5690 if (WARN_ONCE(csa_vif && csa_vif->bss_conf.csa_active, in iwl_mvm_pre_channel_switch()
5692 return -EBUSY; in iwl_mvm_pre_channel_switch()
5695 if (rcu_dereference_protected(mvm->csa_tx_blocked_vif, in iwl_mvm_pre_channel_switch()
5696 lockdep_is_held(&mvm->mutex))) in iwl_mvm_pre_channel_switch()
5697 return -EBUSY; in iwl_mvm_pre_channel_switch()
5699 rcu_assign_pointer(mvm->csa_vif, vif); in iwl_mvm_pre_channel_switch()
5701 if (WARN_ONCE(mvmvif->csa_countdown, in iwl_mvm_pre_channel_switch()
5703 return -EBUSY; in iwl_mvm_pre_channel_switch()
5705 mvmvif->csa_target_freq = chsw->chandef.chan->center_freq; in iwl_mvm_pre_channel_switch()
5707 if (!chsw->block_tx) in iwl_mvm_pre_channel_switch()
5709 /* don't need blocking in driver otherwise - mac80211 will do */ in iwl_mvm_pre_channel_switch()
5710 if (!ieee80211_hw_check(mvm->hw, HANDLES_QUIET_CSA)) in iwl_mvm_pre_channel_switch()
5713 mvmvif->csa_blocks_tx = true; in iwl_mvm_pre_channel_switch()
5714 mvmtxq = iwl_mvm_txq_from_mac80211(vif->txq); in iwl_mvm_pre_channel_switch()
5715 set_bit(IWL_MVM_TXQ_STATE_STOP_AP_CSA, &mvmtxq->state); in iwl_mvm_pre_channel_switch()
5716 ieee80211_iterate_stations_atomic(mvm->hw, in iwl_mvm_pre_channel_switch()
5721 mvmvif->csa_blocks_tx = chsw->block_tx; in iwl_mvm_pre_channel_switch()
5727 if (iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, in iwl_mvm_pre_channel_switch()
5737 if (!vif->cfg.assoc || !vif->bss_conf.dtim_period) in iwl_mvm_pre_channel_switch()
5738 return -EBUSY; in iwl_mvm_pre_channel_switch()
5740 if (chsw->delay > IWL_MAX_CSA_BLOCK_TX && in iwl_mvm_pre_channel_switch()
5741 hweight16(vif->valid_links) <= 1) in iwl_mvm_pre_channel_switch()
5742 schedule_delayed_work(&mvmvif->csa_work, 0); in iwl_mvm_pre_channel_switch()
5744 if (chsw->block_tx) { in iwl_mvm_pre_channel_switch()
5749 if (!chsw->count || in iwl_mvm_pre_channel_switch()
5750 chsw->count * vif->bss_conf.beacon_int > in iwl_mvm_pre_channel_switch()
5752 schedule_delayed_work(&mvmvif->csa_work, in iwl_mvm_pre_channel_switch()
5756 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_pre_channel_switch()
5765 mvmvif->csa_count = chsw->count; in iwl_mvm_pre_channel_switch()
5766 mvmvif->csa_misbehave = false; in iwl_mvm_pre_channel_switch()
5772 mvmvif->ps_disabled = true; in iwl_mvm_pre_channel_switch()
5801 .mac_id = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, in iwl_mvm_channel_switch_rx_beacon()
5802 mvmvif->color)), in iwl_mvm_channel_switch_rx_beacon()
5804 .tsf = cpu_to_le32(chsw->timestamp), in iwl_mvm_channel_switch_rx_beacon()
5805 .cs_count = chsw->count, in iwl_mvm_channel_switch_rx_beacon()
5806 .cs_mode = chsw->block_tx, in iwl_mvm_channel_switch_rx_beacon()
5813 if (iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, in iwl_mvm_channel_switch_rx_beacon()
5817 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_CS_MODIFY)) in iwl_mvm_channel_switch_rx_beacon()
5821 mvmvif->id, chsw->count, mvmvif->csa_count, chsw->block_tx); in iwl_mvm_channel_switch_rx_beacon()
5823 if (chsw->count >= mvmvif->csa_count && chsw->block_tx) { in iwl_mvm_channel_switch_rx_beacon()
5824 if (mvmvif->csa_misbehave) { in iwl_mvm_channel_switch_rx_beacon()
5829 link_conf = wiphy_dereference(hw->wiphy, in iwl_mvm_channel_switch_rx_beacon()
5830 vif->link_conf[chsw->link_id]); in iwl_mvm_channel_switch_rx_beacon()
5836 mvmvif->csa_misbehave = false; in iwl_mvm_channel_switch_rx_beacon()
5839 mvmvif->csa_misbehave = true; in iwl_mvm_channel_switch_rx_beacon()
5841 mvmvif->csa_count = chsw->count; in iwl_mvm_channel_switch_rx_beacon()
5844 if (mvmvif->csa_failed) in iwl_mvm_channel_switch_rx_beacon()
5860 &mvm->status)) in iwl_mvm_flush_no_vif()
5867 iwl_trans_wait_tx_queues_empty(mvm->trans, queues); in iwl_mvm_flush_no_vif()
5873 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { in iwl_mvm_flush_no_vif()
5876 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_flush_no_vif()
5877 lockdep_is_held(&mvm->mutex)); in iwl_mvm_flush_no_vif()
5905 if (!drop && hweight16(vif->active_links) <= 1) { in iwl_mvm_mac_flush()
5906 int link_id = vif->active_links ? __ffs(vif->active_links) : 0; in iwl_mvm_mac_flush()
5909 link_conf = wiphy_dereference(hw->wiphy, in iwl_mvm_mac_flush()
5910 vif->link_conf[link_id]); in iwl_mvm_mac_flush()
5913 if (link_conf->csa_active && mvmvif->csa_blocks_tx) in iwl_mvm_mac_flush()
5918 flush_work(&mvm->add_stream_wk); in iwl_mvm_mac_flush()
5920 mutex_lock(&mvm->mutex); in iwl_mvm_mac_flush()
5922 /* flush the AP-station and all TDLS peers */ in iwl_mvm_mac_flush()
5923 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { in iwl_mvm_mac_flush()
5924 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_mac_flush()
5925 lockdep_is_held(&mvm->mutex)); in iwl_mvm_mac_flush()
5930 if (mvmsta->vif != vif) in iwl_mvm_mac_flush()
5933 if (sta == mvmvif->ap_sta) { in iwl_mvm_mac_flush()
5940 if (iwl_mvm_flush_sta(mvm, mvmsta->deflink.sta_id, in iwl_mvm_mac_flush()
5941 mvmsta->tfd_queue_msk)) in iwl_mvm_mac_flush()
5947 msk |= mvmsta->tfd_queue_msk; in iwl_mvm_mac_flush()
5951 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_flush()
5959 &mvm->status)) in iwl_mvm_mac_flush()
5960 iwl_trans_wait_tx_queues_empty(mvm->trans, msk); in iwl_mvm_mac_flush()
5974 mvm_link_sta = rcu_dereference_protected(mvmsta->link[link_id], in iwl_mvm_mac_flush_sta()
5975 lockdep_is_held(&mvm->mutex)); in iwl_mvm_mac_flush_sta()
5979 if (iwl_mvm_flush_sta(mvm, mvm_link_sta->sta_id, in iwl_mvm_mac_flush_sta()
5980 mvmsta->tfd_queue_msk)) in iwl_mvm_mac_flush_sta()
5992 mutex_lock(&mvm->mutex); in iwl_mvm_mac_get_acs_survey()
5994 if (!mvm->acs_survey) { in iwl_mvm_mac_get_acs_survey()
5995 ret = -ENOENT; in iwl_mvm_mac_get_acs_survey()
5999 /* Find and return the next entry that has a non-zero active time */ in iwl_mvm_mac_get_acs_survey()
6002 mvm->hw->wiphy->bands[band]; in iwl_mvm_mac_get_acs_survey()
6007 for (chan_idx = 0; chan_idx < sband->n_channels; chan_idx++) { in iwl_mvm_mac_get_acs_survey()
6009 &mvm->acs_survey->bands[band][chan_idx]; in iwl_mvm_mac_get_acs_survey()
6011 if (!info->time) in iwl_mvm_mac_get_acs_survey()
6015 survey->channel = &sband->channels[chan_idx]; in iwl_mvm_mac_get_acs_survey()
6016 survey->filled = SURVEY_INFO_TIME | in iwl_mvm_mac_get_acs_survey()
6020 survey->time = info->time; in iwl_mvm_mac_get_acs_survey()
6021 survey->time_busy = info->time_busy; in iwl_mvm_mac_get_acs_survey()
6022 survey->time_rx = info->time_rx; in iwl_mvm_mac_get_acs_survey()
6023 survey->time_tx = info->time_tx; in iwl_mvm_mac_get_acs_survey()
6024 survey->noise = info->noise; in iwl_mvm_mac_get_acs_survey()
6025 if (survey->noise < 0) in iwl_mvm_mac_get_acs_survey()
6026 survey->filled |= SURVEY_INFO_NOISE_DBM; in iwl_mvm_mac_get_acs_survey()
6029 info->time = 0; in iwl_mvm_mac_get_acs_survey()
6036 ret = -ENOENT; in iwl_mvm_mac_get_acs_survey()
6039 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_get_acs_survey()
6048 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, in iwl_mvm_mac_get_survey()
6055 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_get_survey()
6057 return -ENOENT; in iwl_mvm_mac_get_survey()
6065 return iwl_mvm_mac_get_acs_survey(mvm, idx - 1, survey); in iwl_mvm_mac_get_survey()
6076 survey->filled = SURVEY_INFO_TIME_RX | in iwl_mvm_mac_get_survey()
6079 survey->time_rx = mvm->accu_radio_stats.rx_time + in iwl_mvm_mac_get_survey()
6080 mvm->radio_stats.rx_time; in iwl_mvm_mac_get_survey()
6081 do_div(survey->time_rx, USEC_PER_MSEC); in iwl_mvm_mac_get_survey()
6083 survey->time_tx = mvm->accu_radio_stats.tx_time + in iwl_mvm_mac_get_survey()
6084 mvm->radio_stats.tx_time; in iwl_mvm_mac_get_survey()
6085 do_div(survey->time_tx, USEC_PER_MSEC); in iwl_mvm_mac_get_survey()
6091 survey->filled |= SURVEY_INFO_TIME | in iwl_mvm_mac_get_survey()
6093 survey->time = mvm->accu_radio_stats.on_time_rf + in iwl_mvm_mac_get_survey()
6094 mvm->radio_stats.on_time_rf; in iwl_mvm_mac_get_survey()
6095 do_div(survey->time, USEC_PER_MSEC); in iwl_mvm_mac_get_survey()
6097 survey->time_scan = mvm->accu_radio_stats.on_time_scan + in iwl_mvm_mac_get_survey()
6098 mvm->radio_stats.on_time_scan; in iwl_mvm_mac_get_survey()
6099 do_div(survey->time_scan, USEC_PER_MSEC); in iwl_mvm_mac_get_survey()
6111 rinfo->bw = RATE_INFO_BW_20; in iwl_mvm_set_sta_rate()
6114 rinfo->bw = RATE_INFO_BW_40; in iwl_mvm_set_sta_rate()
6117 rinfo->bw = RATE_INFO_BW_80; in iwl_mvm_set_sta_rate()
6120 rinfo->bw = RATE_INFO_BW_160; in iwl_mvm_set_sta_rate()
6123 rinfo->bw = RATE_INFO_BW_320; in iwl_mvm_set_sta_rate()
6137 rinfo->legacy = 10; in iwl_mvm_set_sta_rate()
6140 rinfo->legacy = 20; in iwl_mvm_set_sta_rate()
6143 rinfo->legacy = 55; in iwl_mvm_set_sta_rate()
6146 rinfo->legacy = 110; in iwl_mvm_set_sta_rate()
6149 rinfo->legacy = 60; in iwl_mvm_set_sta_rate()
6152 rinfo->legacy = 90; in iwl_mvm_set_sta_rate()
6155 rinfo->legacy = 120; in iwl_mvm_set_sta_rate()
6158 rinfo->legacy = 180; in iwl_mvm_set_sta_rate()
6161 rinfo->legacy = 240; in iwl_mvm_set_sta_rate()
6164 rinfo->legacy = 360; in iwl_mvm_set_sta_rate()
6167 rinfo->legacy = 480; in iwl_mvm_set_sta_rate()
6170 rinfo->legacy = 540; in iwl_mvm_set_sta_rate()
6175 rinfo->nss = u32_get_bits(rate_n_flags, in iwl_mvm_set_sta_rate()
6177 rinfo->mcs = format == RATE_MCS_HT_MSK ? in iwl_mvm_set_sta_rate()
6182 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; in iwl_mvm_set_sta_rate()
6187 rinfo->flags |= RATE_INFO_FLAGS_EHT_MCS; in iwl_mvm_set_sta_rate()
6192 rinfo->flags |= RATE_INFO_FLAGS_HE_MCS; in iwl_mvm_set_sta_rate()
6195 rinfo->bw = RATE_INFO_BW_HE_RU; in iwl_mvm_set_sta_rate()
6196 rinfo->he_ru_alloc = NL80211_RATE_INFO_HE_RU_ALLOC_106; in iwl_mvm_set_sta_rate()
6203 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_0_8; in iwl_mvm_set_sta_rate()
6205 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_1_6; in iwl_mvm_set_sta_rate()
6207 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_3_2; in iwl_mvm_set_sta_rate()
6209 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_0_8; in iwl_mvm_set_sta_rate()
6213 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_0_8; in iwl_mvm_set_sta_rate()
6215 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_1_6; in iwl_mvm_set_sta_rate()
6217 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_3_2; in iwl_mvm_set_sta_rate()
6221 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_1_6; in iwl_mvm_set_sta_rate()
6223 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_3_2; in iwl_mvm_set_sta_rate()
6228 rinfo->he_dcm = 1; in iwl_mvm_set_sta_rate()
6231 rinfo->flags |= RATE_INFO_FLAGS_MCS; in iwl_mvm_set_sta_rate()
6234 rinfo->flags |= RATE_INFO_FLAGS_VHT_MCS; in iwl_mvm_set_sta_rate()
6249 if (mvmsta->deflink.avg_energy) { in iwl_mvm_mac_sta_statistics()
6250 sinfo->signal_avg = -(s8)mvmsta->deflink.avg_energy; in iwl_mvm_mac_sta_statistics()
6251 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); in iwl_mvm_mac_sta_statistics()
6255 struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->deflink.lq_sta.rs_fw; in iwl_mvm_mac_sta_statistics()
6257 iwl_mvm_set_sta_rate(lq_sta->last_rate_n_flags, &sinfo->txrate); in iwl_mvm_mac_sta_statistics()
6258 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in iwl_mvm_mac_sta_statistics()
6262 if (!(vif->driver_flags & IEEE80211_VIF_BEACON_FILTER)) in iwl_mvm_mac_sta_statistics()
6265 if (!vif->cfg.assoc) in iwl_mvm_mac_sta_statistics()
6270 if (sta != mvmvif->ap_sta) in iwl_mvm_mac_sta_statistics()
6276 sinfo->rx_beacon = 0; in iwl_mvm_mac_sta_statistics()
6278 sinfo->rx_beacon += mvmvif->link[i]->beacon_stats.num_beacons + in iwl_mvm_mac_sta_statistics()
6279 mvmvif->link[i]->beacon_stats.accu_num_beacons; in iwl_mvm_mac_sta_statistics()
6281 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_RX); in iwl_mvm_mac_sta_statistics()
6282 if (mvmvif->deflink.beacon_stats.avg_signal) { in iwl_mvm_mac_sta_statistics()
6284 sinfo->rx_beacon_signal_avg = in iwl_mvm_mac_sta_statistics()
6285 mvmvif->deflink.beacon_stats.avg_signal; in iwl_mvm_mac_sta_statistics()
6286 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_SIGNAL_AVG); in iwl_mvm_mac_sta_statistics()
6294 if ((mlme->data == ASSOC_EVENT || mlme->data == AUTH_EVENT) && in iwl_mvm_event_mlme_callback_ini()
6295 (mlme->status == MLME_DENIED || mlme->status == MLME_TIMEOUT)) { in iwl_mvm_event_mlme_callback_ini()
6296 iwl_dbg_tlv_time_point(&mvm->fwrt, in iwl_mvm_event_mlme_callback_ini()
6302 if (mlme->data == DEAUTH_RX_EVENT || mlme->data == DEAUTH_TX_EVENT) { in iwl_mvm_event_mlme_callback_ini()
6303 iwl_dbg_tlv_time_point(&mvm->fwrt, in iwl_mvm_event_mlme_callback_ini()
6316 if ((trig_mlme->_cnt) && --(trig_mlme->_cnt)) \ in iwl_mvm_event_mlme_callback()
6318 iwl_fw_dbg_collect_trig(&(mvm)->fwrt, trig, _fmt); \ in iwl_mvm_event_mlme_callback()
6324 if (iwl_trans_dbg_ini_valid(mvm->trans)) { in iwl_mvm_event_mlme_callback()
6325 iwl_mvm_event_mlme_callback_ini(mvm, vif, &event->u.mlme); in iwl_mvm_event_mlme_callback()
6329 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_event_mlme_callback()
6334 trig_mlme = (void *)trig->data; in iwl_mvm_event_mlme_callback()
6336 if (event->u.mlme.data == ASSOC_EVENT) { in iwl_mvm_event_mlme_callback()
6337 if (event->u.mlme.status == MLME_DENIED) in iwl_mvm_event_mlme_callback()
6340 event->u.mlme.reason); in iwl_mvm_event_mlme_callback()
6341 else if (event->u.mlme.status == MLME_TIMEOUT) in iwl_mvm_event_mlme_callback()
6344 } else if (event->u.mlme.data == AUTH_EVENT) { in iwl_mvm_event_mlme_callback()
6345 if (event->u.mlme.status == MLME_DENIED) in iwl_mvm_event_mlme_callback()
6348 event->u.mlme.reason); in iwl_mvm_event_mlme_callback()
6349 else if (event->u.mlme.status == MLME_TIMEOUT) in iwl_mvm_event_mlme_callback()
6352 } else if (event->u.mlme.data == DEAUTH_RX_EVENT) { in iwl_mvm_event_mlme_callback()
6354 "DEAUTH RX %d", event->u.mlme.reason); in iwl_mvm_event_mlme_callback()
6355 } else if (event->u.mlme.data == DEAUTH_TX_EVENT) { in iwl_mvm_event_mlme_callback()
6357 "DEAUTH TX %d", event->u.mlme.reason); in iwl_mvm_event_mlme_callback()
6369 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_event_bar_rx_callback()
6374 ba_trig = (void *)trig->data; in iwl_mvm_event_bar_rx_callback()
6376 if (!(le16_to_cpu(ba_trig->rx_bar) & BIT(event->u.ba.tid))) in iwl_mvm_event_bar_rx_callback()
6379 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, in iwl_mvm_event_bar_rx_callback()
6381 event->u.ba.sta->addr, event->u.ba.tid, in iwl_mvm_event_bar_rx_callback()
6382 event->u.ba.ssn); in iwl_mvm_event_bar_rx_callback()
6391 switch (event->type) { in iwl_mvm_mac_event_callback()
6399 iwl_mvm_event_frame_timeout_callback(mvm, vif, event->u.ba.sta, in iwl_mvm_mac_event_callback()
6400 event->u.ba.tid); in iwl_mvm_mac_event_callback()
6417 .cmd.rxq_mask = cpu_to_le32(BIT(mvm->trans->num_rx_queues) - 1), in iwl_mvm_sync_rx_queues_internal()
6442 cmd.notif.cookie = mvm->queue_sync_cookie; in iwl_mvm_sync_rx_queues_internal()
6443 mvm->queue_sync_state = (1 << mvm->trans->num_rx_queues) - 1; in iwl_mvm_sync_rx_queues_internal()
6453 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sync_rx_queues_internal()
6454 ret = wait_event_timeout(mvm->rx_sync_waitq, in iwl_mvm_sync_rx_queues_internal()
6455 READ_ONCE(mvm->queue_sync_state) == 0, in iwl_mvm_sync_rx_queues_internal()
6458 mvm->queue_sync_state, in iwl_mvm_sync_rx_queues_internal()
6459 mvm->queue_sync_cookie); in iwl_mvm_sync_rx_queues_internal()
6464 mvm->queue_sync_state = 0; in iwl_mvm_sync_rx_queues_internal()
6465 mvm->queue_sync_cookie++; in iwl_mvm_sync_rx_queues_internal()
6485 if (vif->p2p || vif->type != NL80211_IFTYPE_AP || in iwl_mvm_mac_get_ftm_responder_stats()
6486 !mvmvif->ap_ibss_active || !vif->bss_conf.ftm_responder) in iwl_mvm_mac_get_ftm_responder_stats()
6487 return -EINVAL; in iwl_mvm_mac_get_ftm_responder_stats()
6489 mutex_lock(&mvm->mutex); in iwl_mvm_mac_get_ftm_responder_stats()
6490 *stats = mvm->ftm_resp_stats; in iwl_mvm_mac_get_ftm_responder_stats()
6491 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_get_ftm_responder_stats()
6493 stats->filled = BIT(NL80211_FTM_STATS_SUCCESS_NUM) | in iwl_mvm_mac_get_ftm_responder_stats()
6526 u8 protocol = ip_hdr(skb)->protocol; in iwl_mvm_can_hw_csum()
6541 if (skb->protocol != htons(ETH_P_IP)) in iwl_mvm_mac_can_aggregate()
6558 if (!hwts->macaddr) in iwl_mvm_set_hw_timestamp()
6559 return -EOPNOTSUPP; in iwl_mvm_set_hw_timestamp()
6561 if (hwts->enable) in iwl_mvm_set_hw_timestamp()
6566 return iwl_mvm_time_sync_config(mvm, hwts->macaddr, protocols); in iwl_mvm_set_hw_timestamp()