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

1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2012-2014, 2018-2025 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()
314 if (mvm->trans->trans_cfg->device_family != IWL_DEVICE_FAMILY_9000 && in iwl_mvm_op_set_antenna()
315 mvm->trans->trans_cfg->device_family != IWL_DEVICE_FAMILY_22000) in iwl_mvm_op_set_antenna()
316 return -EOPNOTSUPP; in iwl_mvm_op_set_antenna()
318 if (!mvm->nvm_data) in iwl_mvm_op_set_antenna()
319 return -EBUSY; in iwl_mvm_op_set_antenna()
325 mvm->set_tx_ant = tx_ant; in iwl_mvm_op_set_antenna()
326 mvm->set_rx_ant = rx_ant; in iwl_mvm_op_set_antenna()
328 iwl_reinit_cab(mvm->trans, mvm->nvm_data, tx_ant, rx_ant, mvm->fw); in iwl_mvm_op_set_antenna()
335 struct ieee80211_hw *hw = mvm->hw; in iwl_mvm_mac_setup_register()
344 bool unified = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
348 u8 sec_key_ver = iwl_fw_lookup_cmd_ver(mvm->fw, sec_key_id, 0); in iwl_mvm_mac_setup_register()
369 if (mvm->mld_api_is_used && mvm->nvm_data->sku_cap_11be_enable && in iwl_mvm_mac_setup_register()
372 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO; in iwl_mvm_mac_setup_register()
380 if (!mvm->mld_api_is_used) in iwl_mvm_mac_setup_register()
384 * On older devices, enabling TX A-MSDU occasionally leads to in iwl_mvm_mac_setup_register()
390 * support A-MSDU until moving the mac80211 iTXQs, just leave it in iwl_mvm_mac_setup_register()
394 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_9000) in iwl_mvm_mac_setup_register()
405 mvm->trans->trans_cfg->device_family > IWL_DEVICE_FAMILY_9000) in iwl_mvm_mac_setup_register()
408 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
417 return -EINVAL; in iwl_mvm_mac_setup_register()
420 if (mvm->trans->num_rx_queues > 1) in iwl_mvm_mac_setup_register()
423 if (mvm->trans->max_skb_frags) in iwl_mvm_mac_setup_register()
424 hw->netdev_features = NETIF_F_HIGHDMA | NETIF_F_SG; in iwl_mvm_mac_setup_register()
426 hw->queues = IEEE80211_NUM_ACS; in iwl_mvm_mac_setup_register()
427 hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE; in iwl_mvm_mac_setup_register()
428 hw->radiotap_mcs_details |= IEEE80211_RADIOTAP_MCS_HAVE_FEC | in iwl_mvm_mac_setup_register()
430 hw->radiotap_vht_details |= IEEE80211_RADIOTAP_VHT_KNOWN_STBC | in iwl_mvm_mac_setup_register()
433 hw->radiotap_timestamp.units_pos = in iwl_mvm_mac_setup_register()
437 hw->radiotap_timestamp.accuracy = 22; in iwl_mvm_mac_setup_register()
440 hw->rate_control_algorithm = RS_NAME; in iwl_mvm_mac_setup_register()
442 hw->uapsd_queues = IWL_MVM_UAPSD_QUEUES; in iwl_mvm_mac_setup_register()
443 hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; in iwl_mvm_mac_setup_register()
444 hw->max_tx_fragments = mvm->trans->max_skb_frags; in iwl_mvm_mac_setup_register()
446 BUILD_BUG_ON(ARRAY_SIZE(mvm->ciphers) < ARRAY_SIZE(mvm_ciphers) + 6); in iwl_mvm_mac_setup_register()
447 memcpy(mvm->ciphers, mvm_ciphers, sizeof(mvm_ciphers)); in iwl_mvm_mac_setup_register()
448 hw->wiphy->n_cipher_suites = ARRAY_SIZE(mvm_ciphers); in iwl_mvm_mac_setup_register()
449 hw->wiphy->cipher_suites = mvm->ciphers; in iwl_mvm_mac_setup_register()
452 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
454 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
455 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
457 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
468 mvm->ciphers[hw->wiphy->n_cipher_suites] = WLAN_CIPHER_SUITE_AES_CMAC; in iwl_mvm_mac_setup_register()
469 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
471 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
473 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
474 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
476 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
479 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
481 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
484 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
486 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
488 hw->wiphy->pmsr_capa = &iwl_mvm_pmsr_capa; in iwl_mvm_mac_setup_register()
492 fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
494 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
496 else if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
498 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
501 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
503 hw->wiphy->hw_timestamp_max_peers = 1; in iwl_mvm_mac_setup_register()
505 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
507 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
511 hw->wiphy->features |= in iwl_mvm_mac_setup_register()
516 hw->sta_data_size = sizeof(struct iwl_mvm_sta); in iwl_mvm_mac_setup_register()
517 hw->vif_data_size = sizeof(struct iwl_mvm_vif); in iwl_mvm_mac_setup_register()
518 hw->chanctx_data_size = sizeof(u16); in iwl_mvm_mac_setup_register()
519 hw->txq_data_size = sizeof(struct iwl_mvm_txq); in iwl_mvm_mac_setup_register()
521 hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | in iwl_mvm_mac_setup_register()
528 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in iwl_mvm_mac_setup_register()
529 wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS); in iwl_mvm_mac_setup_register()
536 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
538 hw->wiphy->features |= NL80211_FEATURE_HT_IBSS; in iwl_mvm_mac_setup_register()
540 hw->wiphy->regulatory_flags |= REGULATORY_ENABLE_RELAX_NO_IR; in iwl_mvm_mac_setup_register()
542 hw->wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED; in iwl_mvm_mac_setup_register()
544 hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | in iwl_mvm_mac_setup_register()
547 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) in iwl_mvm_mac_setup_register()
548 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
551 hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; in iwl_mvm_mac_setup_register()
552 hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; in iwl_mvm_mac_setup_register()
553 hw->wiphy->flags |= WIPHY_FLAG_SPLIT_SCAN_6GHZ; in iwl_mvm_mac_setup_register()
555 hw->wiphy->iface_combinations = iwl_mvm_iface_combinations; in iwl_mvm_mac_setup_register()
556 hw->wiphy->n_iface_combinations = in iwl_mvm_mac_setup_register()
559 hw->wiphy->max_remain_on_channel_duration = 10000; in iwl_mvm_mac_setup_register()
560 hw->max_listen_interval = IWL_MVM_CONN_LISTEN_INTERVAL; in iwl_mvm_mac_setup_register()
563 memcpy(mvm->addresses[0].addr, mvm->nvm_data->hw_addr, ETH_ALEN); in iwl_mvm_mac_setup_register()
564 hw->wiphy->addresses = mvm->addresses; in iwl_mvm_mac_setup_register()
565 hw->wiphy->n_addresses = 1; in iwl_mvm_mac_setup_register()
568 num_mac = (mvm->nvm_data->n_hw_addrs > 1) ? in iwl_mvm_mac_setup_register()
569 min(IWL_MVM_MAX_ADDRESSES, mvm->nvm_data->n_hw_addrs) : 1; in iwl_mvm_mac_setup_register()
572 memcpy(mvm->addresses[i].addr, mvm->addresses[i-1].addr, in iwl_mvm_mac_setup_register()
574 mvm->addresses[i].addr[5]++; in iwl_mvm_mac_setup_register()
575 hw->wiphy->n_addresses++; in iwl_mvm_mac_setup_register()
580 hw->wiphy->max_scan_ie_len = iwl_mvm_max_scan_ie_len(mvm); in iwl_mvm_mac_setup_register()
582 hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; in iwl_mvm_mac_setup_register()
588 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) in iwl_mvm_mac_setup_register()
589 mvm->max_scans = IWL_MAX_UMAC_SCANS; in iwl_mvm_mac_setup_register()
591 mvm->max_scans = IWL_MAX_LMAC_SCANS; in iwl_mvm_mac_setup_register()
593 if (mvm->nvm_data->bands[NL80211_BAND_2GHZ].n_channels) in iwl_mvm_mac_setup_register()
594 hw->wiphy->bands[NL80211_BAND_2GHZ] = in iwl_mvm_mac_setup_register()
595 &mvm->nvm_data->bands[NL80211_BAND_2GHZ]; in iwl_mvm_mac_setup_register()
596 if (mvm->nvm_data->bands[NL80211_BAND_5GHZ].n_channels) { in iwl_mvm_mac_setup_register()
597 hw->wiphy->bands[NL80211_BAND_5GHZ] = in iwl_mvm_mac_setup_register()
598 &mvm->nvm_data->bands[NL80211_BAND_5GHZ]; in iwl_mvm_mac_setup_register()
600 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
602 fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
604 hw->wiphy->bands[NL80211_BAND_5GHZ]->vht_cap.cap |= in iwl_mvm_mac_setup_register()
607 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
609 mvm->nvm_data->bands[NL80211_BAND_6GHZ].n_channels) in iwl_mvm_mac_setup_register()
610 hw->wiphy->bands[NL80211_BAND_6GHZ] = in iwl_mvm_mac_setup_register()
611 &mvm->nvm_data->bands[NL80211_BAND_6GHZ]; in iwl_mvm_mac_setup_register()
613 hw->wiphy->hw_version = mvm->trans->hw_id; in iwl_mvm_mac_setup_register()
616 hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; in iwl_mvm_mac_setup_register()
618 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; in iwl_mvm_mac_setup_register()
620 hw->wiphy->max_sched_scan_reqs = 1; in iwl_mvm_mac_setup_register()
621 hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX; in iwl_mvm_mac_setup_register()
622 hw->wiphy->max_match_sets = iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_mac_setup_register()
624 hw->wiphy->max_sched_scan_ie_len = in iwl_mvm_mac_setup_register()
625 SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2; in iwl_mvm_mac_setup_register()
626 hw->wiphy->max_sched_scan_plans = IWL_MAX_SCHED_SCAN_PLANS; in iwl_mvm_mac_setup_register()
627 hw->wiphy->max_sched_scan_plan_interval = U16_MAX; in iwl_mvm_mac_setup_register()
633 hw->wiphy->max_sched_scan_plan_iterations = 254; in iwl_mvm_mac_setup_register()
635 hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | in iwl_mvm_mac_setup_register()
645 hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS | in iwl_mvm_mac_setup_register()
648 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
650 hw->wiphy->features |= NL80211_FEATURE_TX_POWER_INSERTION; in iwl_mvm_mac_setup_register()
651 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
653 hw->wiphy->features |= NL80211_FEATURE_QUIET; in iwl_mvm_mac_setup_register()
655 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
657 hw->wiphy->features |= in iwl_mvm_mac_setup_register()
660 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
662 hw->wiphy->features |= NL80211_FEATURE_WFA_TPC_IE_IN_PROBES; in iwl_mvm_mac_setup_register()
664 if (iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_KEK_KCK_MATERIAL, in iwl_mvm_mac_setup_register()
666 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK; in iwl_mvm_mac_setup_register()
668 if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
670 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
672 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
677 u8 scan_ver = iwl_fw_lookup_cmd_ver(mvm->fw, SCAN_REQ_UMAC, 0); in iwl_mvm_mac_setup_register()
679 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
681 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
683 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
688 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
692 hw->wiphy->iftype_ext_capab = NULL; in iwl_mvm_mac_setup_register()
693 hw->wiphy->num_iftype_ext_capab = 0; in iwl_mvm_mac_setup_register()
695 if (mvm->nvm_data->sku_cap_11ax_enable && in iwl_mvm_mac_setup_register()
697 hw->wiphy->iftype_ext_capab = add_iftypes_ext_capa; in iwl_mvm_mac_setup_register()
698 hw->wiphy->num_iftype_ext_capab = in iwl_mvm_mac_setup_register()
699 ARRAY_SIZE(add_iftypes_ext_capa) - 1; in iwl_mvm_mac_setup_register()
705 if (iwl_fw_lookup_cmd_ver(mvm->fw, in iwl_mvm_mac_setup_register()
709 IWL_DEBUG_INFO(mvm->trans, "Timing measurement supported\n"); in iwl_mvm_mac_setup_register()
711 if (!hw->wiphy->iftype_ext_capab) { in iwl_mvm_mac_setup_register()
712 hw->wiphy->num_iftype_ext_capab = 1; in iwl_mvm_mac_setup_register()
713 hw->wiphy->iftype_ext_capab = add_iftypes_ext_capa + in iwl_mvm_mac_setup_register()
714 ARRAY_SIZE(add_iftypes_ext_capa) - 1; in iwl_mvm_mac_setup_register()
716 hw->wiphy->iftype_ext_capab = add_iftypes_ext_capa + 1; in iwl_mvm_mac_setup_register()
720 if (iwl_fw_lookup_cmd_ver(mvm->fw, WIDE_ID(LOCATION_GROUP, in iwl_mvm_mac_setup_register()
723 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
726 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
728 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
732 mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; in iwl_mvm_mac_setup_register()
737 if ((unified || mvm->fw->img[IWL_UCODE_WOWLAN].num_sec) && in iwl_mvm_mac_setup_register()
738 device_can_wakeup(mvm->trans->dev)) { in iwl_mvm_mac_setup_register()
739 mvm->wowlan.flags |= WIPHY_WOWLAN_MAGIC_PKT | in iwl_mvm_mac_setup_register()
744 mvm->wowlan.flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | in iwl_mvm_mac_setup_register()
748 mvm->wowlan.n_patterns = IWL_WOWLAN_MAX_PATTERNS; in iwl_mvm_mac_setup_register()
749 mvm->wowlan.pattern_min_len = IWL_WOWLAN_MIN_PATTERN_LEN; in iwl_mvm_mac_setup_register()
750 mvm->wowlan.pattern_max_len = IWL_WOWLAN_MAX_PATTERN_LEN; in iwl_mvm_mac_setup_register()
751 mvm->wowlan.max_nd_match_sets = in iwl_mvm_mac_setup_register()
752 iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_mac_setup_register()
753 hw->wiphy->wowlan = &mvm->wowlan; in iwl_mvm_mac_setup_register()
761 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
764 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; in iwl_mvm_mac_setup_register()
768 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
771 hw->wiphy->features |= NL80211_FEATURE_TDLS_CHANNEL_SWITCH; in iwl_mvm_mac_setup_register()
774 hw->netdev_features |= mvm->cfg->features; in iwl_mvm_mac_setup_register()
776 hw->netdev_features &= ~IWL_CSUM_NETIF_FLAGS_MASK; in iwl_mvm_mac_setup_register()
778 if (mvm->cfg->vht_mu_mimo_supported) in iwl_mvm_mac_setup_register()
779 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
782 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_PROTECTED_TWT)) in iwl_mvm_mac_setup_register()
783 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
788 hw->wiphy->available_antennas_tx = iwl_mvm_get_valid_tx_ant(mvm); in iwl_mvm_mac_setup_register()
789 hw->wiphy->available_antennas_rx = iwl_mvm_get_valid_rx_ant(mvm); in iwl_mvm_mac_setup_register()
791 ret = ieee80211_register_hw(mvm->hw); in iwl_mvm_mac_setup_register()
810 ieee80211_free_txskb(mvm->hw, skb); in iwl_mvm_tx_skb()
817 struct ieee80211_sta *sta = control->sta; in iwl_mvm_mac_tx()
819 struct ieee80211_hdr *hdr = (void *)skb->data; in iwl_mvm_mac_tx()
820 bool offchannel = IEEE80211_SKB_CB(skb)->flags & in iwl_mvm_mac_tx()
822 u32 link_id = u32_get_bits(info->control.flags, in iwl_mvm_mac_tx()
827 IWL_DEBUG_DROP(mvm, "Dropping - RF/CT KILL\n"); in iwl_mvm_mac_tx()
832 !test_bit(IWL_MVM_STATUS_ROC_P2P_RUNNING, &mvm->status) && in iwl_mvm_mac_tx()
833 !test_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status)) in iwl_mvm_mac_tx()
840 if (ieee80211_is_mgmt(hdr->frame_control)) in iwl_mvm_mac_tx()
844 if (!sta && info->control.vif->type == NL80211_IFTYPE_STATION && in iwl_mvm_mac_tx()
849 !ieee80211_is_probe_resp(hdr->frame_control)) { in iwl_mvm_mac_tx()
852 rcu_dereference(tmp_sta->link[link_id]); in iwl_mvm_mac_tx()
854 rcu_dereference(info->control.vif->link_conf[link_id]); in iwl_mvm_mac_tx()
862 memcpy(mgmt->da, link_sta->addr, ETH_ALEN); in iwl_mvm_mac_tx()
863 memcpy(mgmt->sa, link_conf->addr, ETH_ALEN); in iwl_mvm_mac_tx()
864 memcpy(mgmt->bssid, link_conf->bssid, ETH_ALEN); in iwl_mvm_mac_tx()
883 * mvmtxq->tx_request logic: in iwl_mvm_mac_itxq_xmit()
898 if (atomic_fetch_add_unless(&mvmtxq->tx_request, 1, 2)) in iwl_mvm_mac_itxq_xmit()
904 &mvmtxq->state) && in iwl_mvm_mac_itxq_xmit()
906 &mvmtxq->state) && in iwl_mvm_mac_itxq_xmit()
908 &mvmtxq->state) && in iwl_mvm_mac_itxq_xmit()
909 !test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status))) { in iwl_mvm_mac_itxq_xmit()
913 if (txq->sta) in iwl_mvm_mac_itxq_xmit()
916 txq->sta->addr, in iwl_mvm_mac_itxq_xmit()
917 txq->tid); in iwl_mvm_mac_itxq_xmit()
921 iwl_mvm_tx_skb(mvm, skb, txq->sta); in iwl_mvm_mac_itxq_xmit()
923 } while (atomic_dec_return(&mvmtxq->tx_request)); in iwl_mvm_mac_itxq_xmit()
933 if (likely(test_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state)) || in iwl_mvm_mac_wake_tx_queue()
934 !txq->sta) { in iwl_mvm_mac_wake_tx_queue()
943 spin_lock_bh(&mvm->add_stream_lock); in iwl_mvm_mac_wake_tx_queue()
945 if (list_empty(&mvmtxq->list) && in iwl_mvm_mac_wake_tx_queue()
947 !test_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state)) { in iwl_mvm_mac_wake_tx_queue()
948 list_add_tail(&mvmtxq->list, &mvm->add_stream_txqs); in iwl_mvm_mac_wake_tx_queue()
949 schedule_work(&mvm->add_stream_wk); in iwl_mvm_mac_wake_tx_queue()
951 spin_unlock_bh(&mvm->add_stream_lock); in iwl_mvm_mac_wake_tx_queue()
958 iwl_fw_dbg_collect_trig(&(_mvm)->fwrt, _trig, _fmt); \
969 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_ampdu_check_trigger()
974 ba_trig = (void *)trig->data; in iwl_mvm_ampdu_check_trigger()
979 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; in iwl_mvm_ampdu_check_trigger()
981 CHECK_BA_TRIGGER(mvm, trig, ba_trig->tx_ba_start, tid, in iwl_mvm_ampdu_check_trigger()
983 sta->addr, tid, tid_data->ssn); in iwl_mvm_ampdu_check_trigger()
987 CHECK_BA_TRIGGER(mvm, trig, ba_trig->tx_ba_stop, tid, in iwl_mvm_ampdu_check_trigger()
989 sta->addr, tid); in iwl_mvm_ampdu_check_trigger()
992 CHECK_BA_TRIGGER(mvm, trig, ba_trig->rx_ba_start, tid, in iwl_mvm_ampdu_check_trigger()
994 sta->addr, tid, rx_ba_ssn); in iwl_mvm_ampdu_check_trigger()
997 CHECK_BA_TRIGGER(mvm, trig, ba_trig->rx_ba_stop, tid, in iwl_mvm_ampdu_check_trigger()
999 sta->addr, tid); in iwl_mvm_ampdu_check_trigger()
1012 struct ieee80211_sta *sta = params->sta; in iwl_mvm_mac_ampdu_action()
1013 enum ieee80211_ampdu_mlme_action action = params->action; in iwl_mvm_mac_ampdu_action()
1014 u16 tid = params->tid; in iwl_mvm_mac_ampdu_action()
1015 u16 *ssn = &params->ssn; in iwl_mvm_mac_ampdu_action()
1016 u16 buf_size = params->buf_size; in iwl_mvm_mac_ampdu_action()
1017 bool amsdu = params->amsdu; in iwl_mvm_mac_ampdu_action()
1018 u16 timeout = params->timeout; in iwl_mvm_mac_ampdu_action()
1020 IWL_DEBUG_HT(mvm, "A-MPDU action on addr %pM tid %d: action %d\n", in iwl_mvm_mac_ampdu_action()
1021 sta->addr, tid, action); in iwl_mvm_mac_ampdu_action()
1023 if (!(mvm->nvm_data->sku_cap_11n_enable)) in iwl_mvm_mac_ampdu_action()
1024 return -EACCES; in iwl_mvm_mac_ampdu_action()
1026 mutex_lock(&mvm->mutex); in iwl_mvm_mac_ampdu_action()
1030 if (iwl_mvm_vif_from_mac80211(vif)->deflink.ap_sta_id == in iwl_mvm_mac_ampdu_action()
1031 iwl_mvm_sta_from_mac80211(sta)->deflink.sta_id) { in iwl_mvm_mac_ampdu_action()
1033 u16 macid = iwl_mvm_vif_from_mac80211(vif)->id; in iwl_mvm_mac_ampdu_action()
1034 struct iwl_mvm_tcm_mac *mdata = &mvm->tcm.data[macid]; in iwl_mvm_mac_ampdu_action()
1036 mdata->opened_rx_ba_sessions = true; in iwl_mvm_mac_ampdu_action()
1038 cancel_delayed_work(&mvmvif->uapsd_nonagg_detected_wk); in iwl_mvm_mac_ampdu_action()
1041 ret = -EINVAL; in iwl_mvm_mac_ampdu_action()
1053 ret = -EINVAL; in iwl_mvm_mac_ampdu_action()
1071 ret = -EINVAL; in iwl_mvm_mac_ampdu_action()
1084 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_ampdu_action()
1097 mvmvif->uploaded = false; in iwl_mvm_cleanup_iterator()
1099 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_cleanup_iterator()
1100 iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data); in iwl_mvm_cleanup_iterator()
1101 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_cleanup_iterator()
1103 mvmvif->roc_activity = ROC_NUM_ACTIVITIES; in iwl_mvm_cleanup_iterator()
1105 mvmvif->bf_enabled = false; in iwl_mvm_cleanup_iterator()
1106 mvmvif->ba_enabled = false; in iwl_mvm_cleanup_iterator()
1107 mvmvif->ap_sta = NULL; in iwl_mvm_cleanup_iterator()
1109 mvmvif->esr_active = false; in iwl_mvm_cleanup_iterator()
1110 vif->driver_flags &= ~IEEE80211_VIF_EML_ACTIVE; in iwl_mvm_cleanup_iterator()
1113 mvmvif->link[link_id]->ap_sta_id = IWL_INVALID_STA; in iwl_mvm_cleanup_iterator()
1114 mvmvif->link[link_id]->fw_link_id = IWL_MVM_FW_LINK_ID_INVALID; in iwl_mvm_cleanup_iterator()
1115 mvmvif->link[link_id]->phy_ctxt = NULL; in iwl_mvm_cleanup_iterator()
1116 mvmvif->link[link_id]->active = 0; in iwl_mvm_cleanup_iterator()
1117 mvmvif->link[link_id]->igtk = NULL; in iwl_mvm_cleanup_iterator()
1118 memset(&mvmvif->link[link_id]->bf_data, 0, in iwl_mvm_cleanup_iterator()
1119 sizeof(mvmvif->link[link_id]->bf_data)); in iwl_mvm_cleanup_iterator()
1122 probe_data = rcu_dereference_protected(mvmvif->deflink.probe_resp_data, in iwl_mvm_cleanup_iterator()
1123 lockdep_is_held(&mvm->mutex)); in iwl_mvm_cleanup_iterator()
1126 RCU_INIT_POINTER(mvmvif->deflink.probe_resp_data, NULL); in iwl_mvm_cleanup_iterator()
1137 vif = mvm_sta->vif; in iwl_mvm_cleanup_sta_iterator()
1139 if (!sta->valid_links) in iwl_mvm_cleanup_sta_iterator()
1142 for (link_id = 0; link_id < ARRAY_SIZE((sta)->link); link_id++) { in iwl_mvm_cleanup_sta_iterator()
1146 rcu_dereference_check(mvm_sta->link[link_id], in iwl_mvm_cleanup_sta_iterator()
1147 lockdep_is_held(&mvm->mutex)); in iwl_mvm_cleanup_sta_iterator()
1148 if (mvm_link_sta && !(vif->active_links & BIT(link_id))) { in iwl_mvm_cleanup_sta_iterator()
1166 mvm->cur_aid = 0; in iwl_mvm_restart_cleanup()
1168 mvm->scan_status = 0; in iwl_mvm_restart_cleanup()
1169 mvm->ps_disabled = false; in iwl_mvm_restart_cleanup()
1170 mvm->rfkill_safe_init_done = false; in iwl_mvm_restart_cleanup()
1174 ieee80211_remain_on_channel_expired(mvm->hw); in iwl_mvm_restart_cleanup()
1182 ieee80211_iterate_interfaces(mvm->hw, 0, iwl_mvm_cleanup_iterator, mvm); in iwl_mvm_restart_cleanup()
1185 ieee80211_iterate_stations_atomic(mvm->hw, in iwl_mvm_restart_cleanup()
1188 mvm->p2p_device_vif = NULL; in iwl_mvm_restart_cleanup()
1191 memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table)); in iwl_mvm_restart_cleanup()
1192 memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif)); in iwl_mvm_restart_cleanup()
1193 memset(&mvm->last_bt_ci_cmd, 0, sizeof(mvm->last_bt_ci_cmd)); in iwl_mvm_restart_cleanup()
1195 ieee80211_wake_queues(mvm->hw); in iwl_mvm_restart_cleanup()
1197 mvm->rx_ba_sessions = 0; in iwl_mvm_restart_cleanup()
1198 mvm->fwrt.dump.conf = FW_DBG_INVALID; in iwl_mvm_restart_cleanup()
1199 mvm->monitor_on = false; in iwl_mvm_restart_cleanup()
1201 mvm->beacon_inject_active = false; in iwl_mvm_restart_cleanup()
1213 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_mac_start()
1219 if (mvm->mei_nvm_data) { in __iwl_mvm_mac_start()
1221 kfree(mvm->mei_nvm_data); in __iwl_mvm_mac_start()
1222 mvm->mei_nvm_data = NULL; in __iwl_mvm_mac_start()
1227 * allocated on mvm->nvm_data. Keep a pointer in temp_nvm_data in __iwl_mvm_mac_start()
1232 mvm->temp_nvm_data = mvm->nvm_data; in __iwl_mvm_mac_start()
1233 mvm->nvm_data = NULL; in __iwl_mvm_mac_start()
1238 fast_resume = mvm->fast_resume; in __iwl_mvm_mac_start()
1256 set_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); in __iwl_mvm_mac_start()
1261 if (test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status)) { in __iwl_mvm_mac_start()
1264 * so later code will - from now on - see that we're doing it. in __iwl_mvm_mac_start()
1266 set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in __iwl_mvm_mac_start()
1267 clear_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status); in __iwl_mvm_mac_start()
1276 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_POST_INIT, in __iwl_mvm_mac_start()
1278 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_PERIODIC, in __iwl_mvm_mac_start()
1281 mvm->last_reset_or_resume_time_jiffies = jiffies; in __iwl_mvm_mac_start()
1283 if (ret && test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in __iwl_mvm_mac_start()
1284 /* Something went wrong - we need to finish some cleanup in __iwl_mvm_mac_start()
1288 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in __iwl_mvm_mac_start()
1300 mutex_lock(&mvm->mutex); in iwl_mvm_mac_start()
1303 if (!test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status) && in iwl_mvm_mac_start()
1309 if (ret != -ETIMEDOUT) in iwl_mvm_mac_start()
1315 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_start()
1328 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in iwl_mvm_restart_complete()
1344 iwl_trans_finish_sw_reset(mvm->trans); in iwl_mvm_restart_complete()
1347 if (!list_empty(&mvm->add_stream_txqs)) in iwl_mvm_restart_complete()
1348 schedule_work(&mvm->add_stream_wk); in iwl_mvm_restart_complete()
1367 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_mac_stop()
1374 memset(&mvm->accu_radio_stats, 0, sizeof(mvm->accu_radio_stats)); in __iwl_mvm_mac_stop()
1378 if (!iwl_mvm_has_new_station_api(mvm->fw)) in __iwl_mvm_mac_stop()
1382 mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000) { in __iwl_mvm_mac_stop()
1400 if (test_and_clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) || in __iwl_mvm_mac_stop()
1402 &mvm->status)) in __iwl_mvm_mac_stop()
1403 ieee80211_iterate_interfaces(mvm->hw, 0, in __iwl_mvm_mac_stop()
1409 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in __iwl_mvm_mac_stop()
1412 for (i = 0; i < mvm->max_scans; i++) { in __iwl_mvm_mac_stop()
1413 if (WARN_ONCE(mvm->scan_uid_status[i], in __iwl_mvm_mac_stop()
1416 mvm->scan_uid_status[i] = 0; in __iwl_mvm_mac_stop()
1426 mutex_lock(&mvm->mutex); in iwl_mvm_mac_stop()
1428 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_stop()
1430 wiphy_work_cancel(mvm->hw->wiphy, &mvm->trig_link_selection_wk); in iwl_mvm_mac_stop()
1431 wiphy_work_flush(mvm->hw->wiphy, &mvm->async_handlers_wiphy_wk); in iwl_mvm_mac_stop()
1432 flush_work(&mvm->async_handlers_wk); in iwl_mvm_mac_stop()
1433 flush_work(&mvm->add_stream_wk); in iwl_mvm_mac_stop()
1443 clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); in iwl_mvm_mac_stop()
1445 cancel_delayed_work_sync(&mvm->cs_tx_unblock_dwork); in iwl_mvm_mac_stop()
1446 cancel_delayed_work_sync(&mvm->scan_timeout_dwork); in iwl_mvm_mac_stop()
1452 flush_work(&mvm->roc_done_wk); in iwl_mvm_mac_stop()
1456 mutex_lock(&mvm->mutex); in iwl_mvm_mac_stop()
1458 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_stop()
1464 cancel_work_sync(&mvm->async_handlers_wk); in iwl_mvm_mac_stop()
1465 wiphy_work_cancel(hw->wiphy, &mvm->async_handlers_wiphy_wk); in iwl_mvm_mac_stop()
1472 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_free_phy_ctxt()
1475 if (!mvm->phy_ctxts[i].ref) in iwl_mvm_get_free_phy_ctxt()
1476 return &mvm->phy_ctxts[i]; in iwl_mvm_get_free_phy_ctxt()
1487 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(link_conf->vif); in iwl_mvm_set_tx_power()
1488 u32 mac_id = mvmvif->id; in iwl_mvm_set_tx_power()
1495 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 3); in iwl_mvm_set_tx_power()
1505 if (WARN_ON(!mvmvif->link[link_conf->link_id])) in iwl_mvm_set_tx_power()
1506 return -ENODEV; in iwl_mvm_set_tx_power()
1508 link_id = mvmvif->link[link_conf->link_id]->fw_link_id; in iwl_mvm_set_tx_power()
1527 else if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_set_tx_power()
1530 else if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_set_tx_power()
1551 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) { in iwl_mvm_post_csa_tx()
1553 iwl_mvm_txq_from_mac80211(sta->txq[i]); in iwl_mvm_post_csa_tx()
1555 clear_bit(IWL_MVM_TXQ_STATE_STOP_AP_CSA, &mvmtxq->state); in iwl_mvm_post_csa_tx()
1556 iwl_mvm_mac_itxq_xmit(hw, sta->txq[i]); in iwl_mvm_post_csa_tx()
1568 mutex_lock(&mvm->mutex); in iwl_mvm_post_channel_switch()
1570 if (vif->type == NL80211_IFTYPE_STATION) { in iwl_mvm_post_channel_switch()
1572 unsigned int link_id = link_conf->link_id; in iwl_mvm_post_channel_switch()
1573 u8 ap_sta_id = mvmvif->link[link_id]->ap_sta_id; in iwl_mvm_post_channel_switch()
1575 mvmvif->csa_bcn_pending = false; in iwl_mvm_post_channel_switch()
1576 mvmvif->csa_blocks_tx = false; in iwl_mvm_post_channel_switch()
1580 ret = -EIO; in iwl_mvm_post_channel_switch()
1585 if (mvm->mld_api_is_used) in iwl_mvm_post_channel_switch()
1590 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_post_channel_switch()
1598 } else if (vif->type == NL80211_IFTYPE_AP && mvmvif->csa_blocks_tx) { in iwl_mvm_post_channel_switch()
1600 iwl_mvm_txq_from_mac80211(vif->txq); in iwl_mvm_post_channel_switch()
1602 clear_bit(IWL_MVM_TXQ_STATE_STOP_AP_CSA, &mvmtxq->state); in iwl_mvm_post_channel_switch()
1605 iwl_mvm_mac_itxq_xmit(hw, vif->txq); in iwl_mvm_post_channel_switch()
1609 mvmvif->csa_blocks_tx = false; in iwl_mvm_post_channel_switch()
1612 mvmvif->ps_disabled = false; in iwl_mvm_post_channel_switch()
1617 if (mvmvif->csa_failed) in iwl_mvm_post_channel_switch()
1618 ret = -EIO; in iwl_mvm_post_channel_switch()
1619 mutex_unlock(&mvm->mutex); in iwl_mvm_post_channel_switch()
1631 .mac_id = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, in iwl_mvm_abort_channel_switch()
1632 mvmvif->color)), in iwl_mvm_abort_channel_switch()
1641 if (iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, in iwl_mvm_abort_channel_switch()
1645 IWL_DEBUG_MAC80211(mvm, "Abort CSA on mac %d\n", mvmvif->id); in iwl_mvm_abort_channel_switch()
1647 mutex_lock(&mvm->mutex); in iwl_mvm_abort_channel_switch()
1648 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_abort_channel_switch()
1656 mvmvif->csa_failed = true; in iwl_mvm_abort_channel_switch()
1657 mutex_unlock(&mvm->mutex); in iwl_mvm_abort_channel_switch()
1660 iwl_mvm_post_channel_switch(hw, vif, &vif->bss_conf); in iwl_mvm_abort_channel_switch()
1682 if (chandef->width == NL80211_CHAN_WIDTH_320) in iwl_mvm_chandef_get_primary_80()
1684 else if (chandef->width == NL80211_CHAN_WIDTH_160) in iwl_mvm_chandef_get_primary_80()
1690 data_start = chandef->center_freq1 - bw / 2; in iwl_mvm_chandef_get_primary_80()
1692 control_start = chandef->chan->center_freq - 10; in iwl_mvm_chandef_get_primary_80()
1694 return (control_start - data_start) / 80; in iwl_mvm_chandef_get_primary_80()
1703 lockdep_assert_held(&mvm->mutex); in iwl_mvm_alloc_bcast_mcast_sta()
1714 return iwl_mvm_allocate_int_sta(mvm, &mvmvif->deflink.mcast_sta, 0, in iwl_mvm_alloc_bcast_mcast_sta()
1715 vif->type, in iwl_mvm_alloc_bcast_mcast_sta()
1724 struct iwl_mvm *mvm = mvmvif->mvm; in iwl_mvm_prevent_esr_done_wk()
1739 guard(mvm)(mvmvif->mvm); in iwl_mvm_mlo_int_scan_wk()
1740 iwl_mvm_int_mlo_scan(mvmvif->mvm, vif); in iwl_mvm_mlo_int_scan_wk()
1747 struct iwl_mvm *mvm = mvmvif->mvm; in iwl_mvm_unblock_esr_tpt()
1761 struct iwl_mvm *mvm = mvmvif->mvm; in iwl_mvm_unblock_esr_tmp_non_bss()
1765 mutex_lock(&mvm->mutex); in iwl_mvm_unblock_esr_tmp_non_bss()
1767 mutex_unlock(&mvm->mutex); in iwl_mvm_unblock_esr_tmp_non_bss()
1772 lockdep_assert_held(&mvm->mutex); in iwl_mvm_mac_init_mvmvif()
1774 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mac_init_mvmvif()
1777 INIT_DELAYED_WORK(&mvmvif->csa_work, in iwl_mvm_mac_init_mvmvif()
1780 wiphy_delayed_work_init(&mvmvif->prevent_esr_done_wk, in iwl_mvm_mac_init_mvmvif()
1783 wiphy_delayed_work_init(&mvmvif->mlo_int_scan_wk, in iwl_mvm_mac_init_mvmvif()
1786 wiphy_work_init(&mvmvif->unblock_esr_tpt_wk, in iwl_mvm_mac_init_mvmvif()
1789 wiphy_delayed_work_init(&mvmvif->unblock_esr_tmp_non_bss_wk, in iwl_mvm_mac_init_mvmvif()
1801 mutex_lock(&mvm->mutex); in iwl_mvm_mac_add_interface()
1805 mvmvif->mvm = mvm; in iwl_mvm_mac_add_interface()
1808 mvmvif->deflink.fw_link_id = IWL_MVM_FW_LINK_ID_INVALID; in iwl_mvm_mac_add_interface()
1809 mvmvif->deflink.active = 0; in iwl_mvm_mac_add_interface()
1810 mvmvif->link[0] = &mvmvif->deflink; in iwl_mvm_mac_add_interface()
1812 vif->driver_flags = IEEE80211_VIF_REMOVE_AP_AFTER_DISASSOC; in iwl_mvm_mac_add_interface()
1814 ret = iwl_mvm_set_link_mapping(mvm, vif, &vif->bss_conf); in iwl_mvm_mac_add_interface()
1825 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mac_add_interface()
1827 mvmvif->link[i]->beacon_stats.accu_num_beacons += in iwl_mvm_mac_add_interface()
1828 mvmvif->link[i]->beacon_stats.num_beacons; in iwl_mvm_mac_add_interface()
1835 rcu_assign_pointer(mvm->vif_id_to_mac[mvmvif->id], vif); in iwl_mvm_mac_add_interface()
1838 if (vif->type == NL80211_IFTYPE_NAN) { in iwl_mvm_mac_add_interface()
1854 if (vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_add_interface()
1855 vif->type == NL80211_IFTYPE_ADHOC) { in iwl_mvm_mac_add_interface()
1856 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mac_add_interface()
1862 mvmvif->features |= hw->netdev_features; in iwl_mvm_mac_add_interface()
1877 if (!mvm->bf_allowed_vif && in iwl_mvm_mac_add_interface()
1878 vif->type == NL80211_IFTYPE_STATION && !vif->p2p) { in iwl_mvm_mac_add_interface()
1879 mvm->bf_allowed_vif = mvmvif; in iwl_mvm_mac_add_interface()
1880 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | in iwl_mvm_mac_add_interface()
1884 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) in iwl_mvm_mac_add_interface()
1885 mvm->p2p_device_vif = vif; in iwl_mvm_mac_add_interface()
1889 if (vif->type == NL80211_IFTYPE_MONITOR) { in iwl_mvm_mac_add_interface()
1890 mvm->monitor_on = true; in iwl_mvm_mac_add_interface()
1891 mvm->monitor_p80 = in iwl_mvm_mac_add_interface()
1892 iwl_mvm_chandef_get_primary_80(&vif->bss_conf.chanreq.oper); in iwl_mvm_mac_add_interface()
1895 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mac_add_interface()
1898 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in iwl_mvm_mac_add_interface()
1899 vif->type == NL80211_IFTYPE_STATION && !vif->p2p && in iwl_mvm_mac_add_interface()
1900 !mvm->csme_vif && mvm->mei_registered) { in iwl_mvm_mac_add_interface()
1901 iwl_mei_set_nic_info(vif->addr, mvm->nvm_data->hw_addr); in iwl_mvm_mac_add_interface()
1902 iwl_mei_set_netdev(ieee80211_vif_to_wdev(vif)->netdev); in iwl_mvm_mac_add_interface()
1903 mvm->csme_vif = vif; in iwl_mvm_mac_add_interface()
1907 if (!ret && (vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_add_interface()
1908 vif->type == NL80211_IFTYPE_ADHOC)) in iwl_mvm_mac_add_interface()
1914 mvmvif->deflink.phy_ctxt = NULL; in iwl_mvm_mac_add_interface()
1917 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_add_interface()
1927 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { in iwl_mvm_prepare_mac_removal()
1933 flush_work(&mvm->roc_done_wk); in iwl_mvm_prepare_mac_removal()
1936 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_prepare_mac_removal()
1937 &mvmvif->prevent_esr_done_wk); in iwl_mvm_prepare_mac_removal()
1939 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_prepare_mac_removal()
1940 &mvmvif->mlo_int_scan_wk); in iwl_mvm_prepare_mac_removal()
1942 wiphy_work_cancel(mvm->hw->wiphy, &mvmvif->unblock_esr_tpt_wk); in iwl_mvm_prepare_mac_removal()
1943 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_prepare_mac_removal()
1944 &mvmvif->unblock_esr_tmp_non_bss_wk); in iwl_mvm_prepare_mac_removal()
1946 cancel_delayed_work_sync(&mvmvif->csa_work); in iwl_mvm_prepare_mac_removal()
1958 if (!(vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_remove_interface()
1959 vif->type == NL80211_IFTYPE_ADHOC)) in iwl_mvm_mac_remove_interface()
1962 mutex_lock(&mvm->mutex); in iwl_mvm_mac_remove_interface()
1964 if (vif == mvm->csme_vif) { in iwl_mvm_mac_remove_interface()
1966 mvm->csme_vif = NULL; in iwl_mvm_mac_remove_interface()
1969 probe_data = rcu_dereference_protected(mvmvif->deflink.probe_resp_data, in iwl_mvm_mac_remove_interface()
1970 lockdep_is_held(&mvm->mutex)); in iwl_mvm_mac_remove_interface()
1971 RCU_INIT_POINTER(mvmvif->deflink.probe_resp_data, NULL); in iwl_mvm_mac_remove_interface()
1975 if (mvm->bf_allowed_vif == mvmvif) { in iwl_mvm_mac_remove_interface()
1976 mvm->bf_allowed_vif = NULL; in iwl_mvm_mac_remove_interface()
1977 vif->driver_flags &= ~(IEEE80211_VIF_BEACON_FILTER | in iwl_mvm_mac_remove_interface()
1981 if (vif->bss_conf.ftm_responder) in iwl_mvm_mac_remove_interface()
1982 memset(&mvm->ftm_resp_stats, 0, sizeof(mvm->ftm_resp_stats)); in iwl_mvm_mac_remove_interface()
1990 if (vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_remove_interface()
1991 vif->type == NL80211_IFTYPE_ADHOC) { in iwl_mvm_mac_remove_interface()
1993 if (vif == mvm->noa_vif) { in iwl_mvm_mac_remove_interface()
1994 mvm->noa_vif = NULL; in iwl_mvm_mac_remove_interface()
1995 mvm->noa_duration = 0; in iwl_mvm_mac_remove_interface()
2008 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { in iwl_mvm_mac_remove_interface()
2009 if (mvmvif->deflink.phy_ctxt) { in iwl_mvm_mac_remove_interface()
2010 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); in iwl_mvm_mac_remove_interface()
2011 mvmvif->deflink.phy_ctxt = NULL; in iwl_mvm_mac_remove_interface()
2013 mvm->p2p_device_vif = NULL; in iwl_mvm_mac_remove_interface()
2018 RCU_INIT_POINTER(mvm->vif_id_to_mac[mvmvif->id], NULL); in iwl_mvm_mac_remove_interface()
2020 if (vif->type == NL80211_IFTYPE_MONITOR) in iwl_mvm_mac_remove_interface()
2021 mvm->monitor_on = false; in iwl_mvm_mac_remove_interface()
2024 iwl_mvm_unset_link_mapping(mvm, vif, &vif->bss_conf); in iwl_mvm_mac_remove_interface()
2025 if (vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_remove_interface()
2026 vif->type == NL80211_IFTYPE_ADHOC) { in iwl_mvm_mac_remove_interface()
2027 iwl_mvm_dealloc_int_sta(mvm, &mvmvif->deflink.mcast_sta); in iwl_mvm_mac_remove_interface()
2031 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_remove_interface()
2043 struct iwl_mvm *mvm = data->mvm; in iwl_mvm_mc_iface_iterator()
2044 struct iwl_mcast_filter_cmd *cmd = mvm->mcast_filter_cmd; in iwl_mvm_mc_iface_iterator()
2053 if (WARN_ON_ONCE(data->port_id >= MAX_PORT_ID_NUM)) in iwl_mvm_mc_iface_iterator()
2056 if (vif->type != NL80211_IFTYPE_STATION || in iwl_mvm_mc_iface_iterator()
2057 !vif->cfg.assoc) in iwl_mvm_mc_iface_iterator()
2060 cmd->port_id = data->port_id++; in iwl_mvm_mc_iface_iterator()
2061 memcpy(cmd->bssid, vif->bss_conf.bssid, ETH_ALEN); in iwl_mvm_mc_iface_iterator()
2062 len = roundup(sizeof(*cmd) + cmd->count * ETH_ALEN, 4); in iwl_mvm_mc_iface_iterator()
2079 lockdep_assert_held(&mvm->mutex); in iwl_mvm_recalc_multicast()
2081 if (WARN_ON_ONCE(!mvm->mcast_filter_cmd)) in iwl_mvm_recalc_multicast()
2085 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_recalc_multicast()
2095 * Note that the CPU is still faster - but with this we'll in iwl_mvm_recalc_multicast()
2127 cmd->pass_all = 1; in iwl_mvm_prepare_multicast()
2133 cmd->count, addr->addr); in iwl_mvm_prepare_multicast()
2134 memcpy(&cmd->addr_list[cmd->count * ETH_ALEN], in iwl_mvm_prepare_multicast()
2135 addr->addr, ETH_ALEN); in iwl_mvm_prepare_multicast()
2136 cmd->count++; in iwl_mvm_prepare_multicast()
2152 kfree(mvm->mcast_filter_cmd); in iwl_mvm_configure_filter()
2153 mvm->mcast_filter_cmd = cmd; in iwl_mvm_configure_filter()
2159 cmd->pass_all = !!(*total_flags & FIF_ALLMULTI); in iwl_mvm_configure_filter()
2161 if (cmd->pass_all) in iwl_mvm_configure_filter()
2162 cmd->count = 0; in iwl_mvm_configure_filter()
2181 if (vif->type != NL80211_IFTYPE_STATION || !vif->cfg.assoc || in iwl_mvm_config_iface_filter()
2182 !vif->p2p) in iwl_mvm_config_iface_filter()
2193 memcpy(cmd.membership_status, vif->bss_conf.mu_group.membership, in iwl_mvm_update_mu_groups()
2195 memcpy(cmd.user_position, vif->bss_conf.mu_group.position, in iwl_mvm_update_mu_groups()
2207 if (vif->bss_conf.mu_mimo_owner) { in iwl_mvm_mu_mimo_iface_iterator()
2211 * MU-MIMO Group Id action frame is little endian. We treat in iwl_mvm_mu_mimo_iface_iterator()
2216 (u8 *)&notif->membership_status, in iwl_mvm_mu_mimo_iface_iterator()
2217 (u8 *)&notif->user_position); in iwl_mvm_mu_mimo_iface_iterator()
2225 struct iwl_mu_group_mgmt_notif *notif = (void *)pkt->data; in iwl_mvm_mu_mimo_grp_notif()
2228 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_mu_mimo_grp_notif()
2241 (BIT(IEEE80211_PPE_THRES_INFO_PPET_SIZE) - 1); in iwl_mvm_he_get_ppe_val()
2249 residue_bits = 8 - bit_num; in iwl_mvm_he_get_ppe_val()
2252 (BIT(IEEE80211_PPE_THRES_INFO_PPET_SIZE - residue_bits) - 1)) << in iwl_mvm_he_get_ppe_val()
2254 res += (ppe[byte_num] >> bit_num) & (BIT(residue_bits) - 1); in iwl_mvm_he_get_ppe_val()
2273 IWL_DEBUG_INFO(mvm, "Got NSS = %d - trimming to %d\n", nss, in iwl_mvm_parse_ppe()
2284 bw < ARRAY_SIZE(pkt_ext->pkt_ext_qam_th[i]); in iwl_mvm_parse_ppe()
2290 * isn't present - it should inherit the thresholds from the last in iwl_mvm_parse_ppe()
2292 * this inheritance - continue in this case in iwl_mvm_parse_ppe()
2307 pkt_ext->pkt_ext_qam_th[i][bw][0] = low_th; in iwl_mvm_parse_ppe()
2308 pkt_ext->pkt_ext_qam_th[i][bw][1] = high_th; in iwl_mvm_parse_ppe()
2318 u8 nss = (link_sta->he_cap.ppe_thres[0] & in iwl_mvm_set_pkt_ext_from_he_ppe()
2320 u8 *ppe = &link_sta->he_cap.ppe_thres[0]; in iwl_mvm_set_pkt_ext_from_he_ppe()
2335 int low_th = -1; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2336 int high_th = -1; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2357 return -EINVAL; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2364 bw < ARRAY_SIZE(pkt_ext->pkt_ext_qam_th[i]); in iwl_mvm_set_pkt_ext_from_nominal_padding()
2366 pkt_ext->pkt_ext_qam_th[i][bw][0] = low_th; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2367 pkt_ext->pkt_ext_qam_th[i][bw][1] = high_th; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2382 for (bw = 0; bw < ARRAY_SIZE(pkt_ext->pkt_ext_qam_th[i]); in iwl_mvm_get_optimal_ppe_info()
2384 u8 *qam_th = &pkt_ext->pkt_ext_qam_th[i][bw][0]; in iwl_mvm_get_optimal_ppe_info()
2408 return -EINVAL; in iwl_mvm_set_sta_pkt_ext()
2411 * 9-262ac of 80211.ax/D3.0. in iwl_mvm_set_sta_pkt_ext()
2416 if (link_sta->eht_cap.has_eht) { in iwl_mvm_set_sta_pkt_ext()
2418 u8_get_bits(link_sta->eht_cap.eht_cap_elem.phy_cap_info[5], in iwl_mvm_set_sta_pkt_ext()
2421 /* If PPE Thresholds exists, parse them into a FW-familiar in iwl_mvm_set_sta_pkt_ext()
2424 if (link_sta->eht_cap.eht_cap_elem.phy_cap_info[5] & in iwl_mvm_set_sta_pkt_ext()
2426 u8 nss = (link_sta->eht_cap.eht_ppe_thres[0] & in iwl_mvm_set_sta_pkt_ext()
2428 u8 *ppe = &link_sta->eht_cap.eht_ppe_thres[0]; in iwl_mvm_set_sta_pkt_ext()
2437 /* EHT PPE Thresholds doesn't exist - set the API according to in iwl_mvm_set_sta_pkt_ext()
2440 } else if (link_sta->he_cap.he_cap_elem.phy_cap_info[6] & in iwl_mvm_set_sta_pkt_ext()
2450 /* According to the requirements, for MCSs 12-13 the in iwl_mvm_set_sta_pkt_ext()
2456 /* if PPE Thresholds doesn't present in both EHT IE and HE IE - in iwl_mvm_set_sta_pkt_ext()
2463 } else if (link_sta->he_cap.has_he) { in iwl_mvm_set_sta_pkt_ext()
2464 /* If PPE Thresholds exist, parse them into a FW-familiar format. */ in iwl_mvm_set_sta_pkt_ext()
2465 if (link_sta->he_cap.he_cap_elem.phy_cap_info[6] & in iwl_mvm_set_sta_pkt_ext()
2469 /* PPE Thresholds doesn't exist - set the API PPE values in iwl_mvm_set_sta_pkt_ext()
2474 u8_get_bits(link_sta->he_cap.he_cap_elem.phy_cap_info[9], in iwl_mvm_set_sta_pkt_ext()
2486 bw < ARRAY_SIZE(*pkt_ext->pkt_ext_qam_th[i]); in iwl_mvm_set_sta_pkt_ext()
2489 &pkt_ext->pkt_ext_qam_th[i][bw][0]; in iwl_mvm_set_sta_pkt_ext()
2513 &link_info->queue_params[i].mu_edca_param_rec; in iwl_mvm_set_fw_mu_edca_params()
2516 if (!link_info->queue_params[i].mu_edca) { in iwl_mvm_set_fw_mu_edca_params()
2522 cpu_to_le16(mu_edca->ecw_min_max & 0xf); in iwl_mvm_set_fw_mu_edca_params()
2524 cpu_to_le16((mu_edca->ecw_min_max & 0xf0) >> 4); in iwl_mvm_set_fw_mu_edca_params()
2526 cpu_to_le16(mu_edca->aifsn & 0xf); in iwl_mvm_set_fw_mu_edca_params()
2528 cpu_to_le16(mu_edca->mu_edca_timer); in iwl_mvm_set_fw_mu_edca_params()
2542 sband = mvm->hw->wiphy->bands[NL80211_BAND_2GHZ]; in iwl_mvm_is_nic_ack_enabled()
2545 return (own_he_cap && (own_he_cap->he_cap_elem.mac_cap_info[2] & in iwl_mvm_is_nic_ack_enabled()
2553 &link_sta->he_cap.he_cap_elem.mac_cap_info[0]; in iwl_mvm_get_sta_htc_flags()
2589 .bss_color = vif->bss_conf.he_bss_color.color, in iwl_mvm_cfg_he_sta()
2590 .htc_trig_based_pkt_ext = vif->bss_conf.htc_trig_based_pkt_ext, in iwl_mvm_cfg_he_sta()
2592 cpu_to_le16(vif->bss_conf.frame_time_rts_th), in iwl_mvm_cfg_he_sta()
2596 u8 ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 2); in iwl_mvm_cfg_he_sta()
2603 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_MBSSID_HE)) in iwl_mvm_cfg_he_sta()
2627 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_ctxt_cmd.sta_id]); in iwl_mvm_cfg_he_sta()
2634 if (!sta->deflink.he_cap.has_he) { in iwl_mvm_cfg_he_sta()
2641 /* Block 26-tone RU OFDMA transmissions */ in iwl_mvm_cfg_he_sta()
2642 if (mvmvif->deflink.he_ru_2mhz_block) in iwl_mvm_cfg_he_sta()
2646 sta_ctxt_cmd.htc_flags = iwl_mvm_get_sta_htc_flags(sta, &sta->deflink); in iwl_mvm_cfg_he_sta()
2649 if (!iwl_mvm_set_sta_pkt_ext(mvm, &sta->deflink, &sta_ctxt_cmd.pkt_ext)) in iwl_mvm_cfg_he_sta()
2652 if (sta->deflink.he_cap.he_cap_elem.mac_cap_info[2] & in iwl_mvm_cfg_he_sta()
2656 if (sta->deflink.he_cap.he_cap_elem.mac_cap_info[2] & in iwl_mvm_cfg_he_sta()
2662 if (iwl_mvm_set_fw_mu_edca_params(mvm, &mvmvif->deflink, in iwl_mvm_cfg_he_sta()
2666 if (vif->bss_conf.uora_exists) { in iwl_mvm_cfg_he_sta()
2670 vif->bss_conf.uora_ocw_range & 0x7; in iwl_mvm_cfg_he_sta()
2672 (vif->bss_conf.uora_ocw_range >> 3) & 0x7; in iwl_mvm_cfg_he_sta()
2678 if (vif->bss_conf.nontransmitted) { in iwl_mvm_cfg_he_sta()
2681 vif->bss_conf.transmitter_bssid); in iwl_mvm_cfg_he_sta()
2683 vif->bss_conf.bssid_indicator; in iwl_mvm_cfg_he_sta()
2684 sta_ctxt_cmd.bssid_index = vif->bss_conf.bssid_index; in iwl_mvm_cfg_he_sta()
2685 sta_ctxt_cmd.ema_ap = vif->bss_conf.ema_ap; in iwl_mvm_cfg_he_sta()
2687 vif->bss_conf.profile_periodicity; in iwl_mvm_cfg_he_sta()
2718 BUILD_BUG_ON(sizeof(sta_ctxt_cmd) - in iwl_mvm_cfg_he_sta()
2720 sizeof(sta_ctxt_cmd_v2) - in iwl_mvm_cfg_he_sta()
2726 sizeof(sta_ctxt_cmd) - in iwl_mvm_cfg_he_sta()
2753 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_protect_assoc()
2763 /* Handle association common part to MLD and non-MLD modes */
2772 /* The firmware tracks the MU-MIMO group on its own. in iwl_mvm_bss_info_changed_station_assoc()
2775 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in iwl_mvm_bss_info_changed_station_assoc()
2776 (changes & BSS_CHANGED_MU_GROUPS) && vif->bss_conf.mu_mimo_owner) { in iwl_mvm_bss_info_changed_station_assoc()
2787 mvmvif->link[link_id]->bf_data.ave_beacon_signal = 0; in iwl_mvm_bss_info_changed_station_assoc()
2792 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_bss_info_changed_station_assoc()
2797 /* Execute the common part for MLD and non-MLD modes */
2829 mvmvif->link[link_conf->link_id]; in iwl_mvm_bss_info_changed_station_common()
2833 link_info->bf_data.last_cqm_event = 0; in iwl_mvm_bss_info_changed_station_common()
2835 if (mvmvif->bf_enabled) { in iwl_mvm_bss_info_changed_station_common()
2867 * Re-calculate the tsf id, as the leader-follower relations depend in iwl_mvm_bss_info_changed_station()
2871 if (changes & BSS_CHANGED_ASSOC && vif->cfg.assoc) { in iwl_mvm_bss_info_changed_station()
2872 if ((vif->bss_conf.he_support && in iwl_mvm_bss_info_changed_station()
2874 iwl_mvm_cfg_he_sta(mvm, vif, mvmvif->deflink.ap_sta_id); in iwl_mvm_bss_info_changed_station()
2880 if (changes & BSS_CHANGED_QOS && mvmvif->associated && in iwl_mvm_bss_info_changed_station()
2881 vif->cfg.assoc && in iwl_mvm_bss_info_changed_station()
2882 (vif->bss_conf.he_support && !iwlwifi_mod_params.disable_11ax)) in iwl_mvm_bss_info_changed_station()
2883 iwl_mvm_cfg_he_sta(mvm, vif, mvmvif->deflink.ap_sta_id); in iwl_mvm_bss_info_changed_station()
2891 if (changes & BSS_CHANGED_BSSID && !mvmvif->associated) in iwl_mvm_bss_info_changed_station()
2892 memcpy(mvmvif->deflink.bssid, bss_conf->bssid, ETH_ALEN); in iwl_mvm_bss_info_changed_station()
2894 ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false, mvmvif->deflink.bssid); in iwl_mvm_bss_info_changed_station()
2896 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); in iwl_mvm_bss_info_changed_station()
2899 memcpy(mvmvif->deflink.bssid, bss_conf->bssid, ETH_ALEN); in iwl_mvm_bss_info_changed_station()
2900 mvmvif->associated = vif->cfg.assoc; in iwl_mvm_bss_info_changed_station()
2903 if (vif->cfg.assoc) { in iwl_mvm_bss_info_changed_station()
2904 mvmvif->session_prot_connection_loss = false; in iwl_mvm_bss_info_changed_station()
2909 memset(&mvmvif->link[i]->beacon_stats, 0, in iwl_mvm_bss_info_changed_station()
2910 sizeof(mvmvif->link[i]->beacon_stats)); in iwl_mvm_bss_info_changed_station()
2920 &mvm->status) && in iwl_mvm_bss_info_changed_station()
2921 !fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_bss_info_changed_station()
2941 u32 dur = (11 * vif->bss_conf.beacon_int) / 10; in iwl_mvm_bss_info_changed_station()
2945 &mvm->status) && in iwl_mvm_bss_info_changed_station()
2946 !vif->bss_conf.dtim_period) { in iwl_mvm_bss_info_changed_station()
2962 if (vif->p2p) { in iwl_mvm_bss_info_changed_station()
2967 } else if (mvmvif->deflink.ap_sta_id != IWL_INVALID_STA) { in iwl_mvm_bss_info_changed_station()
2970 * If update fails - SF might be running in associated in iwl_mvm_bss_info_changed_station()
2971 * mode while disassociated - which is forbidden. in iwl_mvm_bss_info_changed_station()
2976 &mvm->status), in iwl_mvm_bss_info_changed_station()
2989 vif->addr); in iwl_mvm_bss_info_changed_station()
2995 iwl_mvm_bss_info_changed_station_common(mvm, vif, &vif->bss_conf, in iwl_mvm_bss_info_changed_station()
3007 lockdep_assert_held(&mvm->mutex); in iwl_mvm_start_ap_ibss_common()
3009 mvmvif->ap_assoc_sta_count = 0; in iwl_mvm_start_ap_ibss_common()
3012 mvmvif->ap_ibss_active = true; in iwl_mvm_start_ap_ibss_common()
3015 for (i = 0; i < ARRAY_SIZE(mvmvif->ap_early_keys); i++) { in iwl_mvm_start_ap_ibss_common()
3016 struct ieee80211_key_conf *key = mvmvif->ap_early_keys[i]; in iwl_mvm_start_ap_ibss_common()
3021 mvmvif->ap_early_keys[i] = NULL; in iwl_mvm_start_ap_ibss_common()
3028 if (vif->type == NL80211_IFTYPE_AP && !vif->p2p) { in iwl_mvm_start_ap_ibss_common()
3031 iwl_mvm_send_low_latency_cmd(mvm, true, mvmvif->id); in iwl_mvm_start_ap_ibss_common()
3048 mutex_lock(&mvm->mutex); in iwl_mvm_start_ap_ibss()
3051 * Re-calculate the tsf id, as the leader-follower relations depend on in iwl_mvm_start_ap_ibss()
3055 if (vif->type == NL80211_IFTYPE_AP) in iwl_mvm_start_ap_ibss()
3062 if (mvm->trans->trans_cfg->device_family > IWL_DEVICE_FAMILY_22000) { in iwl_mvm_start_ap_ibss()
3096 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) { in iwl_mvm_start_ap_ibss()
3132 if (vif->p2p && mvm->p2p_device_vif) in iwl_mvm_start_ap_ibss()
3133 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false, NULL); in iwl_mvm_start_ap_ibss()
3141 iwl_mvm_ftm_restart_responder(mvm, vif, &vif->bss_conf); in iwl_mvm_start_ap_ibss()
3147 mvmvif->ap_ibss_active = false; in iwl_mvm_start_ap_ibss()
3155 mutex_unlock(&mvm->mutex); in iwl_mvm_start_ap_ibss()
3169 return iwl_mvm_start_ap_ibss(hw, vif, &vif->bss_conf); in iwl_mvm_start_ibss()
3172 /* Common part for MLD and non-MLD ops */
3178 lockdep_assert_held(&mvm->mutex); in iwl_mvm_stop_ap_ibss_common()
3183 if (rcu_access_pointer(mvm->csa_vif) == vif) { in iwl_mvm_stop_ap_ibss_common()
3185 &mvmvif->time_event_data); in iwl_mvm_stop_ap_ibss_common()
3186 RCU_INIT_POINTER(mvm->csa_vif, NULL); in iwl_mvm_stop_ap_ibss_common()
3187 mvmvif->csa_countdown = false; in iwl_mvm_stop_ap_ibss_common()
3190 if (rcu_access_pointer(mvm->csa_tx_blocked_vif) == vif) { in iwl_mvm_stop_ap_ibss_common()
3191 RCU_INIT_POINTER(mvm->csa_tx_blocked_vif, NULL); in iwl_mvm_stop_ap_ibss_common()
3192 mvm->csa_tx_block_bcn_timeout = 0; in iwl_mvm_stop_ap_ibss_common()
3195 mvmvif->ap_ibss_active = false; in iwl_mvm_stop_ap_ibss_common()
3196 mvm->ap_last_beacon_gp2 = 0; in iwl_mvm_stop_ap_ibss_common()
3198 if (vif->type == NL80211_IFTYPE_AP && !vif->p2p) { in iwl_mvm_stop_ap_ibss_common()
3201 iwl_mvm_send_low_latency_cmd(mvm, false, mvmvif->id); in iwl_mvm_stop_ap_ibss_common()
3218 if (vif->p2p && mvm->p2p_device_vif) in iwl_mvm_stop_ap_ibss()
3219 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false, NULL); in iwl_mvm_stop_ap_ibss()
3233 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) in iwl_mvm_stop_ap_ibss()
3236 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) in iwl_mvm_stop_ap_ibss()
3255 iwl_mvm_stop_ap_ibss(hw, vif, &vif->bss_conf); in iwl_mvm_stop_ibss()
3267 if (!mvmvif->ap_ibss_active) in iwl_mvm_bss_info_changed_ap_ibss()
3273 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); in iwl_mvm_bss_info_changed_ap_ibss()
3277 iwl_mvm_mac_ctxt_beacon_changed(mvm, vif, &vif->bss_conf)) in iwl_mvm_bss_info_changed_ap_ibss()
3281 int ret = iwl_mvm_ftm_start_responder(mvm, vif, &vif->bss_conf); in iwl_mvm_bss_info_changed_ap_ibss()
3284 IWL_WARN(mvm, "Failed to enable FTM responder (%d)\n", in iwl_mvm_bss_info_changed_ap_ibss()
3299 if (changes & BSS_CHANGED_IDLE && !vif->cfg.idle) in iwl_mvm_bss_info_changed()
3302 switch (vif->type) { in iwl_mvm_bss_info_changed()
3321 bss_conf->txpower); in iwl_mvm_bss_info_changed()
3322 iwl_mvm_set_tx_power(mvm, bss_conf, bss_conf->txpower); in iwl_mvm_bss_info_changed()
3331 if (hw_req->req.n_channels == 0 || in iwl_mvm_mac_hw_scan()
3332 hw_req->req.n_channels > mvm->fw->ucode_capa.n_scan_channels) in iwl_mvm_mac_hw_scan()
3333 return -EINVAL; in iwl_mvm_mac_hw_scan()
3336 return iwl_mvm_reg_scan_start(mvm, vif, &hw_req->req, &hw_req->ies); in iwl_mvm_mac_hw_scan()
3353 if (mvm->scan_status & IWL_MVM_SCAN_REGULAR) in iwl_mvm_mac_cancel_hw_scan()
3397 * If we have TVQM then we get too high queue numbers - luckily in __iwl_mvm_mac_sta_notify()
3404 spin_lock_bh(&mvmsta->lock); in __iwl_mvm_mac_sta_notify()
3405 for (tid = 0; tid < ARRAY_SIZE(mvmsta->tid_data); tid++) { in __iwl_mvm_mac_sta_notify()
3406 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; in __iwl_mvm_mac_sta_notify()
3408 if (tid_data->txq_id == IWL_MVM_INVALID_QUEUE) in __iwl_mvm_mac_sta_notify()
3411 __set_bit(tid_data->txq_id, &txqs); in __iwl_mvm_mac_sta_notify()
3425 iwl_trans_freeze_txq_timer(mvm->trans, txqs, true); in __iwl_mvm_mac_sta_notify()
3433 if (WARN_ON(mvmsta->deflink.sta_id == IWL_INVALID_STA)) in __iwl_mvm_mac_sta_notify()
3437 iwl_trans_freeze_txq_timer(mvm->trans, txqs, false); in __iwl_mvm_mac_sta_notify()
3443 spin_unlock_bh(&mvmsta->lock); in __iwl_mvm_mac_sta_notify()
3455 struct iwl_mvm_pm_state_notification *notif = (void *)pkt->data; in iwl_mvm_sta_pm_notif()
3458 bool sleeping = (notif->type != IWL_MVM_PM_EVENT_AWAKE); in iwl_mvm_sta_pm_notif()
3460 if (WARN_ON(notif->sta_id >= mvm->fw->ucode_capa.num_stations)) in iwl_mvm_sta_pm_notif()
3464 sta = rcu_dereference(mvm->fw_id_to_mac_id[notif->sta_id]); in iwl_mvm_sta_pm_notif()
3472 if (!mvmsta->vif || in iwl_mvm_sta_pm_notif()
3473 mvmsta->vif->type != NL80211_IFTYPE_AP) { in iwl_mvm_sta_pm_notif()
3478 if (mvmsta->sleeping != sleeping) { in iwl_mvm_sta_pm_notif()
3479 mvmsta->sleeping = sleeping; in iwl_mvm_sta_pm_notif()
3480 __iwl_mvm_mac_sta_notify(mvm->hw, in iwl_mvm_sta_pm_notif()
3487 switch (notif->type) { in iwl_mvm_sta_pm_notif()
3513 lockdep_assert_wiphy(mvm->hw->wiphy); in iwl_mvm_sta_pre_rcu_remove()
3517 * so here we already invalidate our internal RCU-protected in iwl_mvm_sta_pre_rcu_remove()
3522 * Since there's mvm->mutex here, no need to have RCU lock for in iwl_mvm_sta_pre_rcu_remove()
3523 * mvm_sta->link access. in iwl_mvm_sta_pre_rcu_remove()
3526 for (link_id = 0; link_id < ARRAY_SIZE(mvm_sta->link); link_id++) { in iwl_mvm_sta_pre_rcu_remove()
3530 if (!mvm_sta->link[link_id]) in iwl_mvm_sta_pre_rcu_remove()
3533 link_sta = rcu_dereference_protected(mvm_sta->link[link_id], in iwl_mvm_sta_pre_rcu_remove()
3534 lockdep_is_held(&mvm->mutex)); in iwl_mvm_sta_pre_rcu_remove()
3535 sta_id = link_sta->sta_id; in iwl_mvm_sta_pre_rcu_remove()
3536 if (sta == rcu_access_pointer(mvm->fw_id_to_mac_id[sta_id])) { in iwl_mvm_sta_pre_rcu_remove()
3537 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_sta_pre_rcu_remove()
3538 ERR_PTR(-ENOENT)); in iwl_mvm_sta_pre_rcu_remove()
3539 RCU_INIT_POINTER(mvm->fw_id_to_link_sta[sta_id], NULL); in iwl_mvm_sta_pre_rcu_remove()
3549 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in iwl_mvm_check_uapsd()
3552 mdata = &mvm->tcm.data[iwl_mvm_vif_from_mac80211(vif)->id]; in iwl_mvm_check_uapsd()
3553 ewma_rate_init(&mdata->uapsd_nonagg_detect.rate); in iwl_mvm_check_uapsd()
3554 mdata->opened_rx_ba_sessions = false; in iwl_mvm_check_uapsd()
3557 if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT)) in iwl_mvm_check_uapsd()
3560 if (vif->p2p && !iwl_mvm_is_p2p_scm_uapsd_supported(mvm)) { in iwl_mvm_check_uapsd()
3561 vif->driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; in iwl_mvm_check_uapsd()
3565 if (!vif->p2p && in iwl_mvm_check_uapsd()
3567 vif->driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; in iwl_mvm_check_uapsd()
3572 if (ether_addr_equal(mvm->uapsd_noagg_bssids[i].addr, bssid)) { in iwl_mvm_check_uapsd()
3573 vif->driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; in iwl_mvm_check_uapsd()
3578 vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; in iwl_mvm_check_uapsd()
3589 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_tdls_check_trigger()
3594 tdls_trig = (void *)trig->data; in iwl_mvm_tdls_check_trigger()
3596 if (!(tdls_trig->action_bitmap & BIT(action))) in iwl_mvm_tdls_check_trigger()
3599 if (tdls_trig->peer_mode && in iwl_mvm_tdls_check_trigger()
3600 memcmp(tdls_trig->peer, peer_addr, ETH_ALEN) != 0) in iwl_mvm_tdls_check_trigger()
3603 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, in iwl_mvm_tdls_check_trigger()
3621 ies = rcu_dereference(bss->ies); in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3622 elem = cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY, ies->data, in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3623 ies->len); in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3625 if (!elem || elem->datalen < 10 || in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3626 !(elem->data[10] & in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3628 data->tolerated = false; in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3644 if (WARN_ON_ONCE(!link_conf->chanreq.oper.chan || in iwl_mvm_check_he_obss_narrow_bw_ru()
3645 !mvmvif->link[link_id])) in iwl_mvm_check_he_obss_narrow_bw_ru()
3648 if (!(link_conf->chanreq.oper.chan->flags & IEEE80211_CHAN_RADAR)) { in iwl_mvm_check_he_obss_narrow_bw_ru()
3649 mvmvif->link[link_id]->he_ru_2mhz_block = false; in iwl_mvm_check_he_obss_narrow_bw_ru()
3653 cfg80211_bss_iter(hw->wiphy, &link_conf->chanreq.oper, in iwl_mvm_check_he_obss_narrow_bw_ru()
3659 * tolerate 26-tone RU UL OFDMA transmissions using HE TB PPDU. in iwl_mvm_check_he_obss_narrow_bw_ru()
3661 mvmvif->link[link_id]->he_ru_2mhz_block = !iter_data.tolerated; in iwl_mvm_check_he_obss_narrow_bw_ru()
3670 if (vif->type != NL80211_IFTYPE_STATION) in iwl_mvm_reset_cca_40mhz_workaround()
3673 if (!mvm->cca_40mhz_workaround) in iwl_mvm_reset_cca_40mhz_workaround()
3677 mvm->cca_40mhz_workaround--; in iwl_mvm_reset_cca_40mhz_workaround()
3678 if (mvm->cca_40mhz_workaround) in iwl_mvm_reset_cca_40mhz_workaround()
3681 sband = mvm->hw->wiphy->bands[NL80211_BAND_2GHZ]; in iwl_mvm_reset_cca_40mhz_workaround()
3683 sband->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; in iwl_mvm_reset_cca_40mhz_workaround()
3691 he->he_cap_elem.phy_cap_info[0] |= in iwl_mvm_reset_cca_40mhz_workaround()
3703 .ssid_len = vif->cfg.ssid_len, in iwl_mvm_mei_host_associated()
3706 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mei_host_associated()
3709 if (!mvm->mei_registered) in iwl_mvm_mei_host_associated()
3713 if (!vif->bss_conf.chanreq.oper.chan) in iwl_mvm_mei_host_associated()
3716 conn_info.channel = vif->bss_conf.chanreq.oper.chan->hw_value; in iwl_mvm_mei_host_associated()
3718 switch (mvm_sta->pairwise_cipher) { in iwl_mvm_mei_host_associated()
3739 switch (mvmvif->rekey_data.akm) { in iwl_mvm_mei_host_associated()
3759 memcpy(conn_info.ssid, vif->cfg.ssid, vif->cfg.ssid_len); in iwl_mvm_mei_host_associated()
3760 memcpy(conn_info.bssid, vif->bss_conf.bssid, ETH_ALEN); in iwl_mvm_mei_host_associated()
3809 if (!conf || !link_sta || !mvmvif->link[link_id]->phy_ctxt) in iwl_mvm_rs_rate_init_all_links()
3813 mvmvif->link[link_id]->phy_ctxt->channel->band); in iwl_mvm_rs_rate_init_all_links()
3824 /* Beacon interval check - firmware will crash if the beacon in iwl_mvm_vif_conf_from_sta()
3838 if (link_conf->beacon_int < IWL_MVM_MIN_BEACON_INTERVAL_TU) { in iwl_mvm_vif_conf_from_sta()
3841 link_conf->beacon_int, link_sta->addr); in iwl_mvm_vif_conf_from_sta()
3845 link_conf->he_support = link_sta->he_cap.has_he; in iwl_mvm_vif_conf_from_sta()
3864 if (!link_conf || !mvmvif->link[link_id]) in iwl_mvm_vif_set_he_support()
3867 link_conf->he_support = link_sta->he_cap.has_he; in iwl_mvm_vif_set_he_support()
3870 mvmvif->link[link_id]->he_ru_2mhz_block = false; in iwl_mvm_vif_set_he_support()
3871 if (link_sta->he_cap.has_he) in iwl_mvm_vif_set_he_support()
3890 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_state_notexist_to_none()
3892 if (vif->type == NL80211_IFTYPE_STATION && in iwl_mvm_sta_state_notexist_to_none()
3894 return -EINVAL; in iwl_mvm_sta_state_notexist_to_none()
3896 if (sta->tdls && in iwl_mvm_sta_state_notexist_to_none()
3897 (vif->p2p || in iwl_mvm_sta_state_notexist_to_none()
3901 return -EBUSY; in iwl_mvm_sta_state_notexist_to_none()
3904 ret = callbacks->add_sta(mvm, vif, sta); in iwl_mvm_sta_state_notexist_to_none()
3905 if (sta->tdls && ret == 0) { in iwl_mvm_sta_state_notexist_to_none()
3907 iwl_mvm_tdls_check_trigger(mvm, vif, sta->addr, in iwl_mvm_sta_state_notexist_to_none()
3915 link_sta->agg.max_rc_amsdu_len = 1; in iwl_mvm_sta_state_notexist_to_none()
3919 if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) in iwl_mvm_sta_state_notexist_to_none()
3920 mvmvif->ap_sta = sta; in iwl_mvm_sta_state_notexist_to_none()
3923 * Initialize the rates here already - this really tells in iwl_mvm_sta_state_notexist_to_none()
3950 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_state_auth_to_assoc()
3952 if (vif->type == NL80211_IFTYPE_AP) { in iwl_mvm_sta_state_auth_to_assoc()
3954 mvmvif->ap_assoc_sta_count++; in iwl_mvm_sta_state_auth_to_assoc()
3955 callbacks->mac_ctxt_changed(mvm, vif, false); in iwl_mvm_sta_state_auth_to_assoc()
3960 if (!mvm->mld_api_is_used && in iwl_mvm_sta_state_auth_to_assoc()
3961 (vif->bss_conf.he_support && in iwl_mvm_sta_state_auth_to_assoc()
3963 iwl_mvm_cfg_he_sta(mvm, vif, mvm_sta->deflink.sta_id); in iwl_mvm_sta_state_auth_to_assoc()
3964 } else if (vif->type == NL80211_IFTYPE_STATION) { in iwl_mvm_sta_state_auth_to_assoc()
3967 callbacks->mac_ctxt_changed(mvm, vif, false); in iwl_mvm_sta_state_auth_to_assoc()
3969 if (!mvm->mld_api_is_used) in iwl_mvm_sta_state_auth_to_assoc()
3977 return -EINVAL; in iwl_mvm_sta_state_auth_to_assoc()
3978 if (!mvmvif->link[link_id]) in iwl_mvm_sta_state_auth_to_assoc()
3991 return callbacks->update_sta(mvm, vif, sta); in iwl_mvm_sta_state_auth_to_assoc()
4003 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_state_assoc_to_authorized()
4009 if (sta->tdls) { in iwl_mvm_sta_state_assoc_to_authorized()
4010 iwl_mvm_tdls_check_trigger(mvm, vif, sta->addr, in iwl_mvm_sta_state_assoc_to_authorized()
4016 mvmvif->authorized = 1; in iwl_mvm_sta_state_assoc_to_authorized()
4018 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in iwl_mvm_sta_state_assoc_to_authorized()
4019 mvmvif->link_selection_res = vif->active_links; in iwl_mvm_sta_state_assoc_to_authorized()
4020 mvmvif->link_selection_primary = in iwl_mvm_sta_state_assoc_to_authorized()
4021 vif->active_links ? __ffs(vif->active_links) : 0; in iwl_mvm_sta_state_assoc_to_authorized()
4024 callbacks->mac_ctxt_changed(mvm, vif, false); in iwl_mvm_sta_state_assoc_to_authorized()
4027 memset(&mvmvif->last_esr_exit, 0, in iwl_mvm_sta_state_assoc_to_authorized()
4028 sizeof(mvmvif->last_esr_exit)); in iwl_mvm_sta_state_assoc_to_authorized()
4038 if (vif->type == NL80211_IFTYPE_STATION && in iwl_mvm_sta_state_assoc_to_authorized()
4039 !test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_sta_state_assoc_to_authorized()
4043 mvm_sta->authorized = true; in iwl_mvm_sta_state_assoc_to_authorized()
4048 if (!sta->mfp) { in iwl_mvm_sta_state_assoc_to_authorized()
4049 int ret = callbacks->update_sta(mvm, vif, sta); in iwl_mvm_sta_state_assoc_to_authorized()
4069 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_state_authorized_to_assoc()
4071 mvmsta->authorized = false; in iwl_mvm_sta_state_authorized_to_assoc()
4078 if (!sta->tdls) { in iwl_mvm_sta_state_authorized_to_assoc()
4083 mvmvif->authorized = 0; in iwl_mvm_sta_state_authorized_to_assoc()
4084 mvmvif->link_selection_res = 0; in iwl_mvm_sta_state_authorized_to_assoc()
4089 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_sta_state_authorized_to_assoc()
4090 &mvmvif->prevent_esr_done_wk); in iwl_mvm_sta_state_authorized_to_assoc()
4092 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_sta_state_authorized_to_assoc()
4093 &mvmvif->mlo_int_scan_wk); in iwl_mvm_sta_state_authorized_to_assoc()
4095 wiphy_work_cancel(mvm->hw->wiphy, &mvmvif->unblock_esr_tpt_wk); in iwl_mvm_sta_state_authorized_to_assoc()
4096 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_sta_state_authorized_to_assoc()
4097 &mvmvif->unblock_esr_tmp_non_bss_wk); in iwl_mvm_sta_state_authorized_to_assoc()
4111 mvmvif->ps_disabled = !vif->cfg.ps; in iwl_mvm_smps_workaround()
4117 /* Common part for MLD and non-MLD modes */
4132 IWL_DEBUG_MAC80211(mvm, "station %pM state change %d->%d\n", in iwl_mvm_mac_sta_state_common()
4133 sta->addr, old_state, new_state); in iwl_mvm_mac_sta_state_common()
4145 * Drop any still-queued deferred-frame before removing the STA, and in iwl_mvm_mac_sta_state_common()
4150 flush_work(&mvm->add_stream_wk); in iwl_mvm_mac_sta_state_common()
4164 kfree(mvm_sta->dup_data); in iwl_mvm_mac_sta_state_common()
4167 mutex_lock(&mvm->mutex); in iwl_mvm_mac_sta_state_common()
4175 if (WARN_ON_ONCE(!mvmvif->link[link_id] || in iwl_mvm_mac_sta_state_common()
4176 !mvmvif->link[link_id]->phy_ctxt)) { in iwl_mvm_mac_sta_state_common()
4177 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sta_state_common()
4179 &mvm->status) ? 0 : -EINVAL; in iwl_mvm_mac_sta_state_common()
4184 mvm_sta->sta_state = new_state; in iwl_mvm_mac_sta_state_common()
4198 mvm->last_ebs_successful = true; in iwl_mvm_mac_sta_state_common()
4199 iwl_mvm_check_uapsd(mvm, vif, sta->addr); in iwl_mvm_mac_sta_state_common()
4216 if (vif->type == NL80211_IFTYPE_AP) { in iwl_mvm_mac_sta_state_common()
4217 mvmvif->ap_assoc_sta_count--; in iwl_mvm_mac_sta_state_common()
4218 callbacks->mac_ctxt_changed(mvm, vif, false); in iwl_mvm_mac_sta_state_common()
4219 } else if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) in iwl_mvm_mac_sta_state_common()
4227 if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) { in iwl_mvm_mac_sta_state_common()
4229 mvmvif->ap_sta = NULL; in iwl_mvm_mac_sta_state_common()
4231 ret = callbacks->rm_sta(mvm, vif, sta); in iwl_mvm_mac_sta_state_common()
4232 if (sta->tdls) { in iwl_mvm_mac_sta_state_common()
4234 iwl_mvm_tdls_check_trigger(mvm, vif, sta->addr, in iwl_mvm_mac_sta_state_common()
4240 &mvm->status))) in iwl_mvm_mac_sta_state_common()
4243 ret = -EIO; in iwl_mvm_mac_sta_state_common()
4246 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sta_state_common()
4248 if (sta->tdls && ret == 0) { in iwl_mvm_mac_sta_state_common()
4264 mvm->rts_threshold = value; in iwl_mvm_mac_set_rts_threshold()
4272 struct ieee80211_sta *sta = link_sta->sta; in iwl_mvm_sta_rc_update()
4280 if (vif->type == NL80211_IFTYPE_STATION && in iwl_mvm_sta_rc_update()
4293 mvmvif->deflink.queue_params[ac] = *params; in iwl_mvm_mac_conf_tx()
4299 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { in iwl_mvm_mac_conf_tx()
4313 if (info->was_assoc && !mvmvif->session_prot_connection_loss) in iwl_mvm_mac_mgd_prepare_tx()
4317 iwl_mvm_protect_assoc(mvm, vif, info->duration, info->link_id); in iwl_mvm_mac_mgd_prepare_tx()
4327 if (info->success) in iwl_mvm_mac_mgd_complete_tx()
4343 if (!vif->cfg.idle) in iwl_mvm_mac_sched_scan_start()
4344 return -EBUSY; in iwl_mvm_mac_sched_scan_start()
4355 mutex_lock(&mvm->mutex); in iwl_mvm_mac_sched_scan_stop()
4365 if (!(mvm->scan_status & IWL_MVM_SCAN_SCHED)) { in iwl_mvm_mac_sched_scan_stop()
4366 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sched_scan_stop()
4371 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sched_scan_stop()
4387 int keyidx = key->keyidx; in __iwl_mvm_mac_set_key()
4389 u8 sec_key_ver = iwl_fw_lookup_cmd_ver(mvm->fw, sec_key_id, 0); in __iwl_mvm_mac_set_key()
4396 switch (key->cipher) { in __iwl_mvm_mac_set_key()
4398 if (!mvm->trans->trans_cfg->gen2) { in __iwl_mvm_mac_set_key()
4399 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; in __iwl_mvm_mac_set_key()
4400 key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE; in __iwl_mvm_mac_set_key()
4401 } else if (vif->type == NL80211_IFTYPE_STATION) { in __iwl_mvm_mac_set_key()
4402 key->flags |= IEEE80211_KEY_FLAG_PUT_MIC_SPACE; in __iwl_mvm_mac_set_key()
4405 return -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4412 key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE; in __iwl_mvm_mac_set_key()
4421 if (vif->type == NL80211_IFTYPE_STATION) in __iwl_mvm_mac_set_key()
4424 return -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4428 return -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4433 if (vif->type == NL80211_IFTYPE_STATION && in __iwl_mvm_mac_set_key()
4435 rcu_assign_pointer(mvmvif->bcn_prot.keys[keyidx - 6], in __iwl_mvm_mac_set_key()
4438 if ((vif->type == NL80211_IFTYPE_ADHOC || in __iwl_mvm_mac_set_key()
4439 vif->type == NL80211_IFTYPE_AP) && !sta) { in __iwl_mvm_mac_set_key()
4441 * GTK on AP interface is a TX-only key, return 0; in __iwl_mvm_mac_set_key()
4442 * on IBSS they're per-station and because we're lazy in __iwl_mvm_mac_set_key()
4447 * Except, of course, beacon protection - it must be in __iwl_mvm_mac_set_key()
4452 * So just check for beacon protection - if we don't in __iwl_mvm_mac_set_key()
4457 if (!wiphy_ext_feature_isset(hw->wiphy, in __iwl_mvm_mac_set_key()
4459 (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || in __iwl_mvm_mac_set_key()
4460 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || in __iwl_mvm_mac_set_key()
4461 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256)) { in __iwl_mvm_mac_set_key()
4462 ret = -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4466 if (key->cipher != WLAN_CIPHER_SUITE_GCMP && in __iwl_mvm_mac_set_key()
4467 key->cipher != WLAN_CIPHER_SUITE_GCMP_256 && in __iwl_mvm_mac_set_key()
4469 key->hw_key_idx = STA_KEY_IDX_INVALID; in __iwl_mvm_mac_set_key()
4474 if (!mvmvif->ap_ibss_active) { in __iwl_mvm_mac_set_key()
4476 i < ARRAY_SIZE(mvmvif->ap_early_keys); in __iwl_mvm_mac_set_key()
4478 if (!mvmvif->ap_early_keys[i]) { in __iwl_mvm_mac_set_key()
4479 mvmvif->ap_early_keys[i] = key; in __iwl_mvm_mac_set_key()
4484 if (i >= ARRAY_SIZE(mvmvif->ap_early_keys)) in __iwl_mvm_mac_set_key()
4485 ret = -ENOSPC; in __iwl_mvm_mac_set_key()
4496 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in __iwl_mvm_mac_set_key()
4497 key->hw_key_idx == STA_KEY_IDX_INVALID) { in __iwl_mvm_mac_set_key()
4504 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in __iwl_mvm_mac_set_key()
4506 key->flags & IEEE80211_KEY_FLAG_PAIRWISE && in __iwl_mvm_mac_set_key()
4507 (key->cipher == WLAN_CIPHER_SUITE_CCMP || in __iwl_mvm_mac_set_key()
4508 key->cipher == WLAN_CIPHER_SUITE_GCMP || in __iwl_mvm_mac_set_key()
4509 key->cipher == WLAN_CIPHER_SUITE_GCMP_256)) { in __iwl_mvm_mac_set_key()
4513 WARN_ON(rcu_access_pointer(mvmsta->ptk_pn[keyidx])); in __iwl_mvm_mac_set_key()
4515 mvm->trans->num_rx_queues), in __iwl_mvm_mac_set_key()
4518 ret = -ENOMEM; in __iwl_mvm_mac_set_key()
4524 for (q = 0; q < mvm->trans->num_rx_queues; q++) in __iwl_mvm_mac_set_key()
4525 memcpy(ptk_pn->q[q].pn[tid], in __iwl_mvm_mac_set_key()
4530 rcu_assign_pointer(mvmsta->ptk_pn[keyidx], ptk_pn); in __iwl_mvm_mac_set_key()
4534 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in __iwl_mvm_mac_set_key()
4535 key_offset = key->hw_key_idx; in __iwl_mvm_mac_set_key()
4539 if (mvmsta && key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in __iwl_mvm_mac_set_key()
4540 mvmsta->pairwise_cipher = key->cipher; in __iwl_mvm_mac_set_key()
4543 sta ? sta->addr : NULL, key->keyidx); in __iwl_mvm_mac_set_key()
4552 key->hw_key_idx = STA_KEY_IDX_INVALID; in __iwl_mvm_mac_set_key()
4554 RCU_INIT_POINTER(mvmsta->ptk_pn[keyidx], NULL); in __iwl_mvm_mac_set_key()
4564 ret = -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4571 if (vif->type == NL80211_IFTYPE_STATION && in __iwl_mvm_mac_set_key()
4573 RCU_INIT_POINTER(mvmvif->bcn_prot.keys[keyidx - 6], in __iwl_mvm_mac_set_key()
4576 ret = -ENOENT; in __iwl_mvm_mac_set_key()
4577 for (i = 0; i < ARRAY_SIZE(mvmvif->ap_early_keys); i++) { in __iwl_mvm_mac_set_key()
4578 if (mvmvif->ap_early_keys[i] == key) { in __iwl_mvm_mac_set_key()
4579 mvmvif->ap_early_keys[i] = NULL; in __iwl_mvm_mac_set_key()
4584 /* found in pending list - don't do anything else */ in __iwl_mvm_mac_set_key()
4588 if (key->hw_key_idx == STA_KEY_IDX_INVALID) { in __iwl_mvm_mac_set_key()
4594 key->flags & IEEE80211_KEY_FLAG_PAIRWISE && in __iwl_mvm_mac_set_key()
4595 (key->cipher == WLAN_CIPHER_SUITE_CCMP || in __iwl_mvm_mac_set_key()
4596 key->cipher == WLAN_CIPHER_SUITE_GCMP || in __iwl_mvm_mac_set_key()
4597 key->cipher == WLAN_CIPHER_SUITE_GCMP_256)) { in __iwl_mvm_mac_set_key()
4599 mvmsta->ptk_pn[keyidx], in __iwl_mvm_mac_set_key()
4600 lockdep_is_held(&mvm->mutex)); in __iwl_mvm_mac_set_key()
4601 RCU_INIT_POINTER(mvmsta->ptk_pn[keyidx], NULL); in __iwl_mvm_mac_set_key()
4613 ret = -EINVAL; in __iwl_mvm_mac_set_key()
4637 if (keyconf->hw_key_idx == STA_KEY_IDX_INVALID) in iwl_mvm_mac_update_tkip_key()
4653 if (WARN_ON(pkt->hdr.cmd != HOT_SPOT_CMD)) in iwl_mvm_rx_aux_roc()
4661 resp = (void *)pkt->data; in iwl_mvm_rx_aux_roc()
4665 resp->status, resp->event_unique_id); in iwl_mvm_rx_aux_roc()
4667 te_data->uid = le32_to_cpu(resp->event_unique_id); in iwl_mvm_rx_aux_roc()
4668 IWL_DEBUG_TE(mvm, "TIME_EVENT_CMD response - UID = 0x%x\n", in iwl_mvm_rx_aux_roc()
4669 te_data->uid); in iwl_mvm_rx_aux_roc()
4671 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_rx_aux_roc()
4672 list_add_tail(&te_data->list, &mvm->aux_roc_te_list); in iwl_mvm_rx_aux_roc()
4673 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_rx_aux_roc()
4685 struct iwl_mvm_time_event_data *te_data = &mvmvif->hs_time_event_data; in iwl_mvm_send_aux_roc_cmd()
4693 .sta_id_and_color = cpu_to_le32(mvm->aux_sta.sta_id), in iwl_mvm_send_aux_roc_cmd()
4697 u16 len = sizeof(aux_roc_req) - iwl_mvm_chan_info_padding(mvm); in iwl_mvm_send_aux_roc_cmd()
4700 iwl_mvm_set_chan_info(mvm, &aux_roc_req.channel_info, channel->hw_value, in iwl_mvm_send_aux_roc_cmd()
4701 iwl_mvm_phy_band_from_nl80211(channel->band), in iwl_mvm_send_aux_roc_cmd()
4706 tail->apply_time = cpu_to_le32(iwl_mvm_get_systime(mvm)); in iwl_mvm_send_aux_roc_cmd()
4709 tail->duration = cpu_to_le32(req_dur); in iwl_mvm_send_aux_roc_cmd()
4710 tail->apply_time_max_delay = cpu_to_le32(delay); in iwl_mvm_send_aux_roc_cmd()
4714 channel->hw_value, req_dur); in iwl_mvm_send_aux_roc_cmd()
4720 memcpy(tail->node_addr, vif->addr, ETH_ALEN); in iwl_mvm_send_aux_roc_cmd()
4722 lockdep_assert_held(&mvm->mutex); in iwl_mvm_send_aux_roc_cmd()
4724 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4726 if (WARN_ON(te_data->id == HOT_SPOT_CMD)) { in iwl_mvm_send_aux_roc_cmd()
4727 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4728 return -EIO; in iwl_mvm_send_aux_roc_cmd()
4731 te_data->vif = vif; in iwl_mvm_send_aux_roc_cmd()
4732 te_data->duration = duration; in iwl_mvm_send_aux_roc_cmd()
4733 te_data->id = HOT_SPOT_CMD; in iwl_mvm_send_aux_roc_cmd()
4735 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4746 iwl_init_notification_wait(&mvm->notif_wait, &wait_time_event, in iwl_mvm_send_aux_roc_cmd()
4756 iwl_remove_notification(&mvm->notif_wait, &wait_time_event); in iwl_mvm_send_aux_roc_cmd()
4761 res = iwl_wait_notification(&mvm->notif_wait, &wait_time_event, 1); in iwl_mvm_send_aux_roc_cmd()
4767 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4769 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4779 lockdep_assert_held(&mvm->mutex); in iwl_mvm_add_aux_sta_for_hs20()
4781 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_add_aux_sta_for_hs20()
4784 return -EINVAL; in iwl_mvm_add_aux_sta_for_hs20()
4787 if (iwl_mvm_has_new_station_api(mvm->fw)) { in iwl_mvm_add_aux_sta_for_hs20()
4799 lockdep_assert_held(&mvm->mutex); in iwl_mvm_roc_link()
4832 u8 fw_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, in iwl_mvm_roc_station()
4841 ret = -EOPNOTSUPP; in iwl_mvm_roc_station()
4857 lockdep_assert_held(&mvm->mutex); in iwl_mvm_roc_p2p()
4868 return -EINVAL; in iwl_mvm_roc_p2p()
4872 iwl_mvm_get_lmac_id(mvm, channel->band)); in iwl_mvm_roc_p2p()
4887 lockdep_assert_held(&mvm->mutex); in iwl_mvm_p2p_find_phy_ctxt()
4889 if (mvmvif->deflink.phy_ctxt && in iwl_mvm_p2p_find_phy_ctxt()
4890 channel == mvmvif->deflink.phy_ctxt->channel) in iwl_mvm_p2p_find_phy_ctxt()
4895 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[i]; in iwl_mvm_p2p_find_phy_ctxt()
4897 if (!phy_ctxt->ref || mvmvif->deflink.phy_ctxt == phy_ctxt) in iwl_mvm_p2p_find_phy_ctxt()
4900 if (channel == phy_ctxt->channel) { in iwl_mvm_p2p_find_phy_ctxt()
4901 if (mvmvif->deflink.phy_ctxt) in iwl_mvm_p2p_find_phy_ctxt()
4903 mvmvif->deflink.phy_ctxt); in iwl_mvm_p2p_find_phy_ctxt()
4905 mvmvif->deflink.phy_ctxt = phy_ctxt; in iwl_mvm_p2p_find_phy_ctxt()
4906 iwl_mvm_phy_ctxt_ref(mvm, mvmvif->deflink.phy_ctxt); in iwl_mvm_p2p_find_phy_ctxt()
4912 if (mvmvif->deflink.phy_ctxt) in iwl_mvm_p2p_find_phy_ctxt()
4913 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); in iwl_mvm_p2p_find_phy_ctxt()
4915 mvmvif->deflink.phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm); in iwl_mvm_p2p_find_phy_ctxt()
4916 if (!mvmvif->deflink.phy_ctxt) in iwl_mvm_p2p_find_phy_ctxt()
4917 return -ENOSPC; in iwl_mvm_p2p_find_phy_ctxt()
4921 return iwl_mvm_phy_ctxt_add(mvm, mvmvif->deflink.phy_ctxt, in iwl_mvm_p2p_find_phy_ctxt()
4925 /* Execute the common part for MLD and non-MLD modes */
4936 IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value, in iwl_mvm_roc_common()
4943 flush_work(&mvm->roc_done_wk); in iwl_mvm_roc_common()
4954 switch (vif->type) { in iwl_mvm_roc_common()
4956 lmac_id = iwl_mvm_get_lmac_id(mvm, channel->band); in iwl_mvm_roc_common()
4959 ret = ops->add_aux_sta_for_hs20(mvm, lmac_id); in iwl_mvm_roc_common()
4967 IWL_ERR(mvm, "ROC: Invalid vif type=%u\n", vif->type); in iwl_mvm_roc_common()
4968 return -EINVAL; in iwl_mvm_roc_common()
4980 ret = ops->link(mvm, vif); in iwl_mvm_roc_common()
5014 if (rcu_access_pointer(link_conf->chanctx_conf) != data->ctx) in iwl_mvm_chanctx_usage_iter()
5017 if (iwl_mvm_enable_fils(data->mvm, vif, data->ctx)) in iwl_mvm_chanctx_usage_iter()
5018 data->use_def = true; in iwl_mvm_chanctx_usage_iter()
5020 if (vif->type == NL80211_IFTYPE_AP && link_conf->ftmr_params) in iwl_mvm_chanctx_usage_iter()
5021 data->use_def = true; in iwl_mvm_chanctx_usage_iter()
5034 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in iwl_mvm_chanctx_def()
5039 return data.use_def ? &ctx->def : &ctx->min_def; in iwl_mvm_chanctx_def()
5045 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; in __iwl_mvm_add_chanctx()
5050 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_add_chanctx()
5056 ret = -ENOSPC; in __iwl_mvm_add_chanctx()
5060 ret = iwl_mvm_phy_ctxt_add(mvm, phy_ctxt, def, &ctx->ap, in __iwl_mvm_add_chanctx()
5061 ctx->rx_chains_static, in __iwl_mvm_add_chanctx()
5062 ctx->rx_chains_dynamic); in __iwl_mvm_add_chanctx()
5068 *phy_ctxt_id = phy_ctxt->id; in __iwl_mvm_add_chanctx()
5085 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; in __iwl_mvm_remove_chanctx()
5086 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; in __iwl_mvm_remove_chanctx()
5088 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_remove_chanctx()
5106 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; in iwl_mvm_change_chanctx()
5107 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; in iwl_mvm_change_chanctx()
5110 if (WARN_ONCE((phy_ctxt->ref > 1) && in iwl_mvm_change_chanctx()
5116 phy_ctxt->ref, changed)) in iwl_mvm_change_chanctx()
5123 if (phy_ctxt->width == def->width) in iwl_mvm_change_chanctx()
5127 if (phy_ctxt->width <= NL80211_CHAN_WIDTH_20 && in iwl_mvm_change_chanctx()
5128 def->width <= NL80211_CHAN_WIDTH_20) in iwl_mvm_change_chanctx()
5133 iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, def, &ctx->ap, in iwl_mvm_change_chanctx()
5134 ctx->rx_chains_static, in iwl_mvm_change_chanctx()
5135 ctx->rx_chains_dynamic); in iwl_mvm_change_chanctx()
5139 * This function executes the common part for MLD and non-MLD modes.
5150 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; in __iwl_mvm_assign_vif_chanctx_common()
5151 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; in __iwl_mvm_assign_vif_chanctx_common()
5154 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_assign_vif_chanctx_common()
5156 mvmvif->deflink.phy_ctxt = phy_ctxt; in __iwl_mvm_assign_vif_chanctx_common()
5158 switch (vif->type) { in __iwl_mvm_assign_vif_chanctx_common()
5162 mvmvif->ap_ibss_active = true; in __iwl_mvm_assign_vif_chanctx_common()
5177 mvmvif->ps_disabled = true; in __iwl_mvm_assign_vif_chanctx_common()
5180 *ret = -EINVAL; in __iwl_mvm_assign_vif_chanctx_common()
5196 return -EINVAL; in __iwl_mvm_assign_vif_chanctx()
5216 if (vif->type == NL80211_IFTYPE_MONITOR) { in __iwl_mvm_assign_vif_chanctx()
5217 mvmvif->monitor_active = true; in __iwl_mvm_assign_vif_chanctx()
5229 if (vif->type == NL80211_IFTYPE_AP) { in __iwl_mvm_assign_vif_chanctx()
5234 if (vif->type == NL80211_IFTYPE_STATION) { in __iwl_mvm_assign_vif_chanctx()
5236 mvmvif->csa_bcn_pending = false; in __iwl_mvm_assign_vif_chanctx()
5240 mvmvif->csa_bcn_pending = true; in __iwl_mvm_assign_vif_chanctx()
5242 if (!fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_assign_vif_chanctx()
5244 u32 duration = 5 * vif->bss_conf.beacon_int; in __iwl_mvm_assign_vif_chanctx()
5250 vif->bss_conf.beacon_int / 2, in __iwl_mvm_assign_vif_chanctx()
5268 mvmvif->deflink.phy_ctxt = NULL; in __iwl_mvm_assign_vif_chanctx()
5284 * This function executes the common part for MLD and non-MLD modes.
5295 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_unassign_vif_chanctx_common()
5297 &mvmvif->time_event_data); in __iwl_mvm_unassign_vif_chanctx_common()
5299 switch (vif->type) { in __iwl_mvm_unassign_vif_chanctx_common()
5303 mvmvif->monitor_active = false; in __iwl_mvm_unassign_vif_chanctx_common()
5304 mvmvif->ps_disabled = false; in __iwl_mvm_unassign_vif_chanctx_common()
5308 if (!switching_chanctx || !mvmvif->ap_ibss_active) in __iwl_mvm_unassign_vif_chanctx_common()
5311 mvmvif->csa_countdown = false; in __iwl_mvm_unassign_vif_chanctx_common()
5317 rcu_assign_pointer(mvm->csa_tx_blocked_vif, vif); in __iwl_mvm_unassign_vif_chanctx_common()
5319 mvmvif->ap_ibss_active = false; in __iwl_mvm_unassign_vif_chanctx_common()
5339 if (vif->type == NL80211_IFTYPE_MONITOR) in __iwl_mvm_unassign_vif_chanctx()
5343 if (vif->type == NL80211_IFTYPE_STATION && switching_chanctx) { in __iwl_mvm_unassign_vif_chanctx()
5345 if (!fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_unassign_vif_chanctx()
5354 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_CHANNEL_SWITCH_CMD) && in __iwl_mvm_unassign_vif_chanctx()
5357 mvmvif->deflink.phy_ctxt = NULL; in __iwl_mvm_unassign_vif_chanctx()
5380 ops->__unassign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_swap()
5390 ret = ops->__assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_swap()
5398 /* we don't support TDLS during DCM - can be caused by channel switch */ in iwl_mvm_switch_vif_chanctx_swap()
5413 if (ops->__assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_swap()
5423 iwl_force_nmi(mvm->trans); in iwl_mvm_switch_vif_chanctx_swap()
5435 ops->__unassign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_reassign()
5438 ret = ops->__assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_reassign()
5449 if (ops->__assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_reassign()
5459 iwl_force_nmi(mvm->trans); in iwl_mvm_switch_vif_chanctx_reassign()
5463 /* Execute the common part for both MLD and non-MLD modes */
5474 /* we only support a single-vif right now */ in iwl_mvm_switch_vif_chanctx_common()
5476 return -EOPNOTSUPP; in iwl_mvm_switch_vif_chanctx_common()
5486 ret = -EOPNOTSUPP; in iwl_mvm_switch_vif_chanctx_common()
5510 return mvm->ibss_manager; in iwl_mvm_tx_last_beacon()
5519 if (!mvm_sta || !mvm_sta->vif) { in iwl_mvm_set_tim()
5521 return -EINVAL; in iwl_mvm_set_tim()
5524 return iwl_mvm_mac_ctxt_beacon_changed(mvm, mvm_sta->vif, in iwl_mvm_set_tim()
5525 &mvm_sta->vif->bss_conf); in iwl_mvm_set_tim()
5549 return -EINVAL; in __iwl_mvm_mac_testmode_cmd()
5553 if (!vif || vif->type != NL80211_IFTYPE_AP || !vif->p2p || in __iwl_mvm_mac_testmode_cmd()
5554 !vif->bss_conf.enable_beacon || in __iwl_mvm_mac_testmode_cmd()
5556 return -EINVAL; in __iwl_mvm_mac_testmode_cmd()
5559 if (noa_duration >= vif->bss_conf.beacon_int) in __iwl_mvm_mac_testmode_cmd()
5560 return -EINVAL; in __iwl_mvm_mac_testmode_cmd()
5562 mvm->noa_duration = noa_duration; in __iwl_mvm_mac_testmode_cmd()
5563 mvm->noa_vif = vif; in __iwl_mvm_mac_testmode_cmd()
5567 /* must be associated client vif - ignore authorized */ in __iwl_mvm_mac_testmode_cmd()
5568 if (!vif || vif->type != NL80211_IFTYPE_STATION || in __iwl_mvm_mac_testmode_cmd()
5569 !vif->cfg.assoc || !vif->bss_conf.dtim_period || in __iwl_mvm_mac_testmode_cmd()
5571 return -EINVAL; in __iwl_mvm_mac_testmode_cmd()
5578 return -EOPNOTSUPP; in __iwl_mvm_mac_testmode_cmd()
5611 .mac_id = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, in iwl_mvm_schedule_client_csa()
5612 mvmvif->color)), in iwl_mvm_schedule_client_csa()
5614 .tsf = cpu_to_le32(chsw->timestamp), in iwl_mvm_schedule_client_csa()
5615 .cs_count = chsw->count, in iwl_mvm_schedule_client_csa()
5616 .cs_mode = chsw->block_tx, in iwl_mvm_schedule_client_csa()
5619 lockdep_assert_held(&mvm->mutex); in iwl_mvm_schedule_client_csa()
5621 if (chsw->delay) in iwl_mvm_schedule_client_csa()
5623 DIV_ROUND_UP(chsw->delay, vif->bss_conf.beacon_int); in iwl_mvm_schedule_client_csa()
5644 if (chsw->count <= 1) in iwl_mvm_old_pre_chan_sw_sta()
5647 apply_time = chsw->device_timestamp + in iwl_mvm_old_pre_chan_sw_sta()
5648 ((vif->bss_conf.beacon_int * (chsw->count - 1) - in iwl_mvm_old_pre_chan_sw_sta()
5651 if (chsw->block_tx) in iwl_mvm_old_pre_chan_sw_sta()
5654 if (mvmvif->bf_enabled) { in iwl_mvm_old_pre_chan_sw_sta()
5661 iwl_mvm_schedule_csa_period(mvm, vif, vif->bss_conf.beacon_int, in iwl_mvm_old_pre_chan_sw_sta()
5671 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) { in iwl_mvm_csa_block_txqs()
5673 iwl_mvm_txq_from_mac80211(sta->txq[i]); in iwl_mvm_csa_block_txqs()
5675 set_bit(IWL_MVM_TXQ_STATE_STOP_AP_CSA, &mvmtxq->state); in iwl_mvm_csa_block_txqs()
5689 lockdep_assert_held(&mvm->mutex); in iwl_mvm_pre_channel_switch()
5691 mvmvif->csa_failed = false; in iwl_mvm_pre_channel_switch()
5692 mvmvif->csa_blocks_tx = false; in iwl_mvm_pre_channel_switch()
5695 chsw->chandef.center_freq1); in iwl_mvm_pre_channel_switch()
5697 iwl_fw_dbg_trigger_simple_stop(&mvm->fwrt, in iwl_mvm_pre_channel_switch()
5701 switch (vif->type) { in iwl_mvm_pre_channel_switch()
5704 rcu_dereference_protected(mvm->csa_vif, in iwl_mvm_pre_channel_switch()
5705 lockdep_is_held(&mvm->mutex)); in iwl_mvm_pre_channel_switch()
5706 if (WARN_ONCE(csa_vif && csa_vif->bss_conf.csa_active, in iwl_mvm_pre_channel_switch()
5708 return -EBUSY; in iwl_mvm_pre_channel_switch()
5711 if (rcu_dereference_protected(mvm->csa_tx_blocked_vif, in iwl_mvm_pre_channel_switch()
5712 lockdep_is_held(&mvm->mutex))) in iwl_mvm_pre_channel_switch()
5713 return -EBUSY; in iwl_mvm_pre_channel_switch()
5715 rcu_assign_pointer(mvm->csa_vif, vif); in iwl_mvm_pre_channel_switch()
5717 if (WARN_ONCE(mvmvif->csa_countdown, in iwl_mvm_pre_channel_switch()
5719 return -EBUSY; in iwl_mvm_pre_channel_switch()
5721 mvmvif->csa_target_freq = chsw->chandef.chan->center_freq; in iwl_mvm_pre_channel_switch()
5723 if (!chsw->block_tx) in iwl_mvm_pre_channel_switch()
5725 /* don't need blocking in driver otherwise - mac80211 will do */ in iwl_mvm_pre_channel_switch()
5726 if (!ieee80211_hw_check(mvm->hw, HANDLES_QUIET_CSA)) in iwl_mvm_pre_channel_switch()
5729 mvmvif->csa_blocks_tx = true; in iwl_mvm_pre_channel_switch()
5730 mvmtxq = iwl_mvm_txq_from_mac80211(vif->txq); in iwl_mvm_pre_channel_switch()
5731 set_bit(IWL_MVM_TXQ_STATE_STOP_AP_CSA, &mvmtxq->state); in iwl_mvm_pre_channel_switch()
5732 ieee80211_iterate_stations_atomic(mvm->hw, in iwl_mvm_pre_channel_switch()
5737 mvmvif->csa_blocks_tx = chsw->block_tx; in iwl_mvm_pre_channel_switch()
5743 if (iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, in iwl_mvm_pre_channel_switch()
5753 if (!vif->cfg.assoc || !vif->bss_conf.dtim_period) in iwl_mvm_pre_channel_switch()
5754 return -EBUSY; in iwl_mvm_pre_channel_switch()
5756 if (chsw->delay > IWL_MAX_CSA_BLOCK_TX && in iwl_mvm_pre_channel_switch()
5757 hweight16(vif->valid_links) <= 1) in iwl_mvm_pre_channel_switch()
5758 schedule_delayed_work(&mvmvif->csa_work, 0); in iwl_mvm_pre_channel_switch()
5760 if (chsw->block_tx) { in iwl_mvm_pre_channel_switch()
5765 if (!chsw->count || in iwl_mvm_pre_channel_switch()
5766 chsw->count * vif->bss_conf.beacon_int > in iwl_mvm_pre_channel_switch()
5768 schedule_delayed_work(&mvmvif->csa_work, in iwl_mvm_pre_channel_switch()
5772 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_pre_channel_switch()
5781 mvmvif->csa_count = chsw->count; in iwl_mvm_pre_channel_switch()
5782 mvmvif->csa_misbehave = false; in iwl_mvm_pre_channel_switch()
5788 mvmvif->ps_disabled = true; in iwl_mvm_pre_channel_switch()
5817 .mac_id = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, in iwl_mvm_channel_switch_rx_beacon()
5818 mvmvif->color)), in iwl_mvm_channel_switch_rx_beacon()
5820 .tsf = cpu_to_le32(chsw->timestamp), in iwl_mvm_channel_switch_rx_beacon()
5821 .cs_count = chsw->count, in iwl_mvm_channel_switch_rx_beacon()
5822 .cs_mode = chsw->block_tx, in iwl_mvm_channel_switch_rx_beacon()
5829 if (iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, in iwl_mvm_channel_switch_rx_beacon()
5833 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_CS_MODIFY)) in iwl_mvm_channel_switch_rx_beacon()
5837 mvmvif->id, chsw->count, mvmvif->csa_count, chsw->block_tx); in iwl_mvm_channel_switch_rx_beacon()
5839 if (chsw->count >= mvmvif->csa_count && chsw->block_tx) { in iwl_mvm_channel_switch_rx_beacon()
5840 if (mvmvif->csa_misbehave) { in iwl_mvm_channel_switch_rx_beacon()
5845 link_conf = wiphy_dereference(hw->wiphy, in iwl_mvm_channel_switch_rx_beacon()
5846 vif->link_conf[chsw->link_id]); in iwl_mvm_channel_switch_rx_beacon()
5852 mvmvif->csa_misbehave = false; in iwl_mvm_channel_switch_rx_beacon()
5855 mvmvif->csa_misbehave = true; in iwl_mvm_channel_switch_rx_beacon()
5857 mvmvif->csa_count = chsw->count; in iwl_mvm_channel_switch_rx_beacon()
5860 if (mvmvif->csa_failed) in iwl_mvm_channel_switch_rx_beacon()
5876 &mvm->status)) in iwl_mvm_flush_no_vif()
5883 iwl_trans_wait_tx_queues_empty(mvm->trans, queues); in iwl_mvm_flush_no_vif()
5889 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { in iwl_mvm_flush_no_vif()
5892 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_flush_no_vif()
5893 lockdep_is_held(&mvm->mutex)); in iwl_mvm_flush_no_vif()
5921 if (!drop && hweight16(vif->active_links) <= 1) { in iwl_mvm_mac_flush()
5922 int link_id = vif->active_links ? __ffs(vif->active_links) : 0; in iwl_mvm_mac_flush()
5925 link_conf = wiphy_dereference(hw->wiphy, in iwl_mvm_mac_flush()
5926 vif->link_conf[link_id]); in iwl_mvm_mac_flush()
5929 if (link_conf->csa_active && mvmvif->csa_blocks_tx) in iwl_mvm_mac_flush()
5934 flush_work(&mvm->add_stream_wk); in iwl_mvm_mac_flush()
5936 mutex_lock(&mvm->mutex); in iwl_mvm_mac_flush()
5938 /* flush the AP-station and all TDLS peers */ in iwl_mvm_mac_flush()
5939 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { in iwl_mvm_mac_flush()
5940 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_mac_flush()
5941 lockdep_is_held(&mvm->mutex)); in iwl_mvm_mac_flush()
5946 if (mvmsta->vif != vif) in iwl_mvm_mac_flush()
5949 if (sta == mvmvif->ap_sta) { in iwl_mvm_mac_flush()
5956 if (iwl_mvm_flush_sta(mvm, mvmsta->deflink.sta_id, in iwl_mvm_mac_flush()
5957 mvmsta->tfd_queue_msk)) in iwl_mvm_mac_flush()
5963 msk |= mvmsta->tfd_queue_msk; in iwl_mvm_mac_flush()
5967 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_flush()
5975 &mvm->status)) in iwl_mvm_mac_flush()
5976 iwl_trans_wait_tx_queues_empty(mvm->trans, msk); in iwl_mvm_mac_flush()
5990 mvm_link_sta = rcu_dereference_protected(mvmsta->link[link_id], in iwl_mvm_mac_flush_sta()
5991 lockdep_is_held(&mvm->mutex)); in iwl_mvm_mac_flush_sta()
5995 if (iwl_mvm_flush_sta(mvm, mvm_link_sta->sta_id, in iwl_mvm_mac_flush_sta()
5996 mvmsta->tfd_queue_msk)) in iwl_mvm_mac_flush_sta()
6008 mutex_lock(&mvm->mutex); in iwl_mvm_mac_get_acs_survey()
6010 if (!mvm->acs_survey) { in iwl_mvm_mac_get_acs_survey()
6011 ret = -ENOENT; in iwl_mvm_mac_get_acs_survey()
6015 /* Find and return the next entry that has a non-zero active time */ in iwl_mvm_mac_get_acs_survey()
6018 mvm->hw->wiphy->bands[band]; in iwl_mvm_mac_get_acs_survey()
6023 for (chan_idx = 0; chan_idx < sband->n_channels; chan_idx++) { in iwl_mvm_mac_get_acs_survey()
6025 &mvm->acs_survey->bands[band][chan_idx]; in iwl_mvm_mac_get_acs_survey()
6027 if (!info->time) in iwl_mvm_mac_get_acs_survey()
6031 survey->channel = &sband->channels[chan_idx]; in iwl_mvm_mac_get_acs_survey()
6032 survey->filled = SURVEY_INFO_TIME | in iwl_mvm_mac_get_acs_survey()
6036 survey->time = info->time; in iwl_mvm_mac_get_acs_survey()
6037 survey->time_busy = info->time_busy; in iwl_mvm_mac_get_acs_survey()
6038 survey->time_rx = info->time_rx; in iwl_mvm_mac_get_acs_survey()
6039 survey->time_tx = info->time_tx; in iwl_mvm_mac_get_acs_survey()
6040 survey->noise = info->noise; in iwl_mvm_mac_get_acs_survey()
6041 if (survey->noise < 0) in iwl_mvm_mac_get_acs_survey()
6042 survey->filled |= SURVEY_INFO_NOISE_DBM; in iwl_mvm_mac_get_acs_survey()
6045 info->time = 0; in iwl_mvm_mac_get_acs_survey()
6052 ret = -ENOENT; in iwl_mvm_mac_get_acs_survey()
6055 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_get_acs_survey()
6064 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, in iwl_mvm_mac_get_survey()
6071 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_get_survey()
6073 return -ENOENT; in iwl_mvm_mac_get_survey()
6081 return iwl_mvm_mac_get_acs_survey(mvm, idx - 1, survey); in iwl_mvm_mac_get_survey()
6092 survey->filled = SURVEY_INFO_TIME_RX | in iwl_mvm_mac_get_survey()
6095 survey->time_rx = mvm->accu_radio_stats.rx_time + in iwl_mvm_mac_get_survey()
6096 mvm->radio_stats.rx_time; in iwl_mvm_mac_get_survey()
6097 do_div(survey->time_rx, USEC_PER_MSEC); in iwl_mvm_mac_get_survey()
6099 survey->time_tx = mvm->accu_radio_stats.tx_time + in iwl_mvm_mac_get_survey()
6100 mvm->radio_stats.tx_time; in iwl_mvm_mac_get_survey()
6101 do_div(survey->time_tx, USEC_PER_MSEC); in iwl_mvm_mac_get_survey()
6107 survey->filled |= SURVEY_INFO_TIME | in iwl_mvm_mac_get_survey()
6109 survey->time = mvm->accu_radio_stats.on_time_rf + in iwl_mvm_mac_get_survey()
6110 mvm->radio_stats.on_time_rf; in iwl_mvm_mac_get_survey()
6111 do_div(survey->time, USEC_PER_MSEC); in iwl_mvm_mac_get_survey()
6113 survey->time_scan = mvm->accu_radio_stats.on_time_scan + in iwl_mvm_mac_get_survey()
6114 mvm->radio_stats.on_time_scan; in iwl_mvm_mac_get_survey()
6115 do_div(survey->time_scan, USEC_PER_MSEC); in iwl_mvm_mac_get_survey()
6127 rinfo->bw = RATE_INFO_BW_20; in iwl_mvm_set_sta_rate()
6130 rinfo->bw = RATE_INFO_BW_40; in iwl_mvm_set_sta_rate()
6133 rinfo->bw = RATE_INFO_BW_80; in iwl_mvm_set_sta_rate()
6136 rinfo->bw = RATE_INFO_BW_160; in iwl_mvm_set_sta_rate()
6139 rinfo->bw = RATE_INFO_BW_320; in iwl_mvm_set_sta_rate()
6153 rinfo->legacy = 10; in iwl_mvm_set_sta_rate()
6156 rinfo->legacy = 20; in iwl_mvm_set_sta_rate()
6159 rinfo->legacy = 55; in iwl_mvm_set_sta_rate()
6162 rinfo->legacy = 110; in iwl_mvm_set_sta_rate()
6165 rinfo->legacy = 60; in iwl_mvm_set_sta_rate()
6168 rinfo->legacy = 90; in iwl_mvm_set_sta_rate()
6171 rinfo->legacy = 120; in iwl_mvm_set_sta_rate()
6174 rinfo->legacy = 180; in iwl_mvm_set_sta_rate()
6177 rinfo->legacy = 240; in iwl_mvm_set_sta_rate()
6180 rinfo->legacy = 360; in iwl_mvm_set_sta_rate()
6183 rinfo->legacy = 480; in iwl_mvm_set_sta_rate()
6186 rinfo->legacy = 540; in iwl_mvm_set_sta_rate()
6191 rinfo->nss = u32_get_bits(rate_n_flags, in iwl_mvm_set_sta_rate()
6193 rinfo->mcs = format == RATE_MCS_HT_MSK ? in iwl_mvm_set_sta_rate()
6198 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; in iwl_mvm_set_sta_rate()
6203 rinfo->flags |= RATE_INFO_FLAGS_EHT_MCS; in iwl_mvm_set_sta_rate()
6208 rinfo->flags |= RATE_INFO_FLAGS_HE_MCS; in iwl_mvm_set_sta_rate()
6211 rinfo->bw = RATE_INFO_BW_HE_RU; in iwl_mvm_set_sta_rate()
6212 rinfo->he_ru_alloc = NL80211_RATE_INFO_HE_RU_ALLOC_106; in iwl_mvm_set_sta_rate()
6219 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_0_8; 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()
6225 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_0_8; in iwl_mvm_set_sta_rate()
6229 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_0_8; in iwl_mvm_set_sta_rate()
6231 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_1_6; in iwl_mvm_set_sta_rate()
6233 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_3_2; in iwl_mvm_set_sta_rate()
6237 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_1_6; in iwl_mvm_set_sta_rate()
6239 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_3_2; in iwl_mvm_set_sta_rate()
6244 rinfo->he_dcm = 1; in iwl_mvm_set_sta_rate()
6247 rinfo->flags |= RATE_INFO_FLAGS_MCS; in iwl_mvm_set_sta_rate()
6250 rinfo->flags |= RATE_INFO_FLAGS_VHT_MCS; in iwl_mvm_set_sta_rate()
6265 if (mvmsta->deflink.avg_energy) { in iwl_mvm_mac_sta_statistics()
6266 sinfo->signal_avg = -(s8)mvmsta->deflink.avg_energy; in iwl_mvm_mac_sta_statistics()
6267 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); in iwl_mvm_mac_sta_statistics()
6271 struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->deflink.lq_sta.rs_fw; in iwl_mvm_mac_sta_statistics()
6273 iwl_mvm_set_sta_rate(lq_sta->last_rate_n_flags, &sinfo->txrate); in iwl_mvm_mac_sta_statistics()
6274 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in iwl_mvm_mac_sta_statistics()
6278 if (!(vif->driver_flags & IEEE80211_VIF_BEACON_FILTER)) in iwl_mvm_mac_sta_statistics()
6281 if (!vif->cfg.assoc) in iwl_mvm_mac_sta_statistics()
6286 if (sta != mvmvif->ap_sta) in iwl_mvm_mac_sta_statistics()
6292 sinfo->rx_beacon = 0; in iwl_mvm_mac_sta_statistics()
6294 sinfo->rx_beacon += mvmvif->link[i]->beacon_stats.num_beacons + in iwl_mvm_mac_sta_statistics()
6295 mvmvif->link[i]->beacon_stats.accu_num_beacons; in iwl_mvm_mac_sta_statistics()
6297 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_RX); in iwl_mvm_mac_sta_statistics()
6298 if (mvmvif->deflink.beacon_stats.avg_signal) { in iwl_mvm_mac_sta_statistics()
6300 sinfo->rx_beacon_signal_avg = in iwl_mvm_mac_sta_statistics()
6301 mvmvif->deflink.beacon_stats.avg_signal; in iwl_mvm_mac_sta_statistics()
6302 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_SIGNAL_AVG); in iwl_mvm_mac_sta_statistics()
6310 if ((mlme->data == ASSOC_EVENT || mlme->data == AUTH_EVENT) && in iwl_mvm_event_mlme_callback_ini()
6311 (mlme->status == MLME_DENIED || mlme->status == MLME_TIMEOUT)) { in iwl_mvm_event_mlme_callback_ini()
6312 iwl_dbg_tlv_time_point(&mvm->fwrt, in iwl_mvm_event_mlme_callback_ini()
6318 if (mlme->data == DEAUTH_RX_EVENT || mlme->data == DEAUTH_TX_EVENT) { in iwl_mvm_event_mlme_callback_ini()
6319 iwl_dbg_tlv_time_point(&mvm->fwrt, in iwl_mvm_event_mlme_callback_ini()
6332 if ((trig_mlme->_cnt) && --(trig_mlme->_cnt)) \ in iwl_mvm_event_mlme_callback()
6334 iwl_fw_dbg_collect_trig(&(mvm)->fwrt, trig, _fmt); \ in iwl_mvm_event_mlme_callback()
6340 if (iwl_trans_dbg_ini_valid(mvm->trans)) { in iwl_mvm_event_mlme_callback()
6341 iwl_mvm_event_mlme_callback_ini(mvm, vif, &event->u.mlme); in iwl_mvm_event_mlme_callback()
6345 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_event_mlme_callback()
6350 trig_mlme = (void *)trig->data; in iwl_mvm_event_mlme_callback()
6352 if (event->u.mlme.data == ASSOC_EVENT) { in iwl_mvm_event_mlme_callback()
6353 if (event->u.mlme.status == MLME_DENIED) in iwl_mvm_event_mlme_callback()
6356 event->u.mlme.reason); in iwl_mvm_event_mlme_callback()
6357 else if (event->u.mlme.status == MLME_TIMEOUT) in iwl_mvm_event_mlme_callback()
6360 } else if (event->u.mlme.data == AUTH_EVENT) { in iwl_mvm_event_mlme_callback()
6361 if (event->u.mlme.status == MLME_DENIED) in iwl_mvm_event_mlme_callback()
6364 event->u.mlme.reason); in iwl_mvm_event_mlme_callback()
6365 else if (event->u.mlme.status == MLME_TIMEOUT) in iwl_mvm_event_mlme_callback()
6368 } else if (event->u.mlme.data == DEAUTH_RX_EVENT) { in iwl_mvm_event_mlme_callback()
6370 "DEAUTH RX %d", event->u.mlme.reason); in iwl_mvm_event_mlme_callback()
6371 } else if (event->u.mlme.data == DEAUTH_TX_EVENT) { in iwl_mvm_event_mlme_callback()
6373 "DEAUTH TX %d", event->u.mlme.reason); in iwl_mvm_event_mlme_callback()
6385 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_event_bar_rx_callback()
6390 ba_trig = (void *)trig->data; in iwl_mvm_event_bar_rx_callback()
6392 if (!(le16_to_cpu(ba_trig->rx_bar) & BIT(event->u.ba.tid))) in iwl_mvm_event_bar_rx_callback()
6395 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, in iwl_mvm_event_bar_rx_callback()
6397 event->u.ba.sta->addr, event->u.ba.tid, in iwl_mvm_event_bar_rx_callback()
6398 event->u.ba.ssn); in iwl_mvm_event_bar_rx_callback()
6407 switch (event->type) { in iwl_mvm_mac_event_callback()
6415 iwl_mvm_event_frame_timeout_callback(mvm, vif, event->u.ba.sta, in iwl_mvm_mac_event_callback()
6416 event->u.ba.tid); in iwl_mvm_mac_event_callback()
6433 .cmd.rxq_mask = cpu_to_le32(BIT(mvm->trans->num_rx_queues) - 1), in iwl_mvm_sync_rx_queues_internal()
6458 cmd.notif.cookie = mvm->queue_sync_cookie; in iwl_mvm_sync_rx_queues_internal()
6459 mvm->queue_sync_state = (1 << mvm->trans->num_rx_queues) - 1; in iwl_mvm_sync_rx_queues_internal()
6469 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sync_rx_queues_internal()
6470 ret = wait_event_timeout(mvm->rx_sync_waitq, in iwl_mvm_sync_rx_queues_internal()
6471 READ_ONCE(mvm->queue_sync_state) == 0, in iwl_mvm_sync_rx_queues_internal()
6474 mvm->queue_sync_state, in iwl_mvm_sync_rx_queues_internal()
6475 mvm->queue_sync_cookie); in iwl_mvm_sync_rx_queues_internal()
6480 mvm->queue_sync_state = 0; in iwl_mvm_sync_rx_queues_internal()
6481 mvm->queue_sync_cookie++; in iwl_mvm_sync_rx_queues_internal()
6501 if (vif->p2p || vif->type != NL80211_IFTYPE_AP || in iwl_mvm_mac_get_ftm_responder_stats()
6502 !mvmvif->ap_ibss_active || !vif->bss_conf.ftm_responder) in iwl_mvm_mac_get_ftm_responder_stats()
6503 return -EINVAL; in iwl_mvm_mac_get_ftm_responder_stats()
6505 mutex_lock(&mvm->mutex); in iwl_mvm_mac_get_ftm_responder_stats()
6506 *stats = mvm->ftm_resp_stats; in iwl_mvm_mac_get_ftm_responder_stats()
6507 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_get_ftm_responder_stats()
6509 stats->filled = BIT(NL80211_FTM_STATS_SUCCESS_NUM) | in iwl_mvm_mac_get_ftm_responder_stats()
6542 u8 protocol = ip_hdr(skb)->protocol; in iwl_mvm_can_hw_csum()
6557 if (skb->protocol != htons(ETH_P_IP)) in iwl_mvm_mac_can_aggregate()
6574 if (!hwts->macaddr) in iwl_mvm_set_hw_timestamp()
6575 return -EOPNOTSUPP; in iwl_mvm_set_hw_timestamp()
6577 if (hwts->enable) in iwl_mvm_set_hw_timestamp()
6582 return iwl_mvm_time_sync_config(mvm, hwts->macaddr, protocols); in iwl_mvm_set_hw_timestamp()