Lines Matching +full:ps +full:- +full:seq +full:- +full:loop
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
26 #include "iwl-drv.h"
27 #include "iwl-op-mode.h"
28 #include "iwl-io.h"
31 #include "time-event.h"
32 #include "iwl-nvm-utils.h"
33 #include "iwl-phy-db.h"
37 #include "fw/error-dump.h"
38 #include "iwl-prph.h"
39 #include "iwl-nvm-parse.h"
40 #include "time-sync.h"
94 .max_bursts_exponent = -1, /* all supported */
118 memset(mvm->phy_ctxts, 0, sizeof(mvm->phy_ctxts)); in iwl_mvm_reset_phy_ctxts()
120 mvm->phy_ctxts[i].id = i; in iwl_mvm_reset_phy_ctxts()
121 mvm->phy_ctxts[i].ref = 0; in iwl_mvm_reset_phy_ctxts()
138 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_regdomain()
149 u32 status = le32_to_cpu(resp->status); in iwl_mvm_get_regdomain()
154 resp_ver = iwl_fw_lookup_notif_ver(mvm->fw, IWL_ALWAYS_LONG_GROUP, in iwl_mvm_get_regdomain()
158 regd = iwl_parse_nvm_mcc_info(mvm->trans, in iwl_mvm_get_regdomain()
159 __le32_to_cpu(resp->n_channels), in iwl_mvm_get_regdomain()
160 resp->channels, in iwl_mvm_get_regdomain()
161 __le16_to_cpu(resp->mcc), in iwl_mvm_get_regdomain()
162 __le16_to_cpu(resp->geo_info), in iwl_mvm_get_regdomain()
163 le32_to_cpu(resp->cap), resp_ver); in iwl_mvm_get_regdomain()
165 src_id = resp->source_id; in iwl_mvm_get_regdomain()
173 regd->alpha2, regd->alpha2[0], regd->alpha2[1], src_id); in iwl_mvm_get_regdomain()
174 mvm->lar_regdom_set = true; in iwl_mvm_get_regdomain()
175 mvm->mcc_src = src_id; in iwl_mvm_get_regdomain()
177 iwl_mei_set_country_code(__le16_to_cpu(resp->mcc)); in iwl_mvm_get_regdomain()
196 regulatory_set_wiphy_regd(mvm->hw->wiphy, regd); in iwl_mvm_update_changed_regdom()
205 return iwl_mvm_get_regdomain(mvm->hw->wiphy, "ZZ", in iwl_mvm_get_current_regdomain()
218 wiphy_dereference(mvm->hw->wiphy, mvm->hw->wiphy->regd); in iwl_mvm_init_fw_regd()
221 return -ENOENT; in iwl_mvm_init_fw_regd()
224 used_src = mvm->mcc_src; in iwl_mvm_init_fw_regd()
233 regd = iwl_mvm_get_regdomain(mvm->hw->wiphy, r->alpha2, used_src, in iwl_mvm_init_fw_regd()
236 return -EIO; in iwl_mvm_init_fw_regd()
242 ret = regulatory_set_wiphy_regd_sync(mvm->hw->wiphy, regd); in iwl_mvm_init_fw_regd()
319 if (mvm->trans->mac_cfg->device_family != IWL_DEVICE_FAMILY_9000 && in iwl_mvm_op_set_antenna()
320 mvm->trans->mac_cfg->device_family != IWL_DEVICE_FAMILY_22000 && in iwl_mvm_op_set_antenna()
321 mvm->trans->mac_cfg->device_family != IWL_DEVICE_FAMILY_AX210) in iwl_mvm_op_set_antenna()
322 return -EOPNOTSUPP; in iwl_mvm_op_set_antenna()
324 if (!mvm->nvm_data) in iwl_mvm_op_set_antenna()
325 return -EBUSY; in iwl_mvm_op_set_antenna()
331 mvm->set_tx_ant = tx_ant; in iwl_mvm_op_set_antenna()
332 mvm->set_rx_ant = rx_ant; in iwl_mvm_op_set_antenna()
334 iwl_reinit_cab(mvm->trans, mvm->nvm_data, tx_ant, rx_ant, mvm->fw); in iwl_mvm_op_set_antenna()
341 struct ieee80211_hw *hw = mvm->hw; in iwl_mvm_mac_setup_register()
350 bool unified = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
354 u8 sec_key_ver = iwl_fw_lookup_cmd_ver(mvm->fw, sec_key_id, 0); in iwl_mvm_mac_setup_register()
375 if (mvm->mld_api_is_used && mvm->nvm_data->sku_cap_11be_enable && in iwl_mvm_mac_setup_register()
378 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO; in iwl_mvm_mac_setup_register()
386 if (!mvm->mld_api_is_used) in iwl_mvm_mac_setup_register()
390 * On older devices, enabling TX A-MSDU occasionally leads to in iwl_mvm_mac_setup_register()
396 * support A-MSDU until moving the mac80211 iTXQs, just leave it in iwl_mvm_mac_setup_register()
400 if (mvm->trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_9000) in iwl_mvm_mac_setup_register()
411 mvm->trans->mac_cfg->device_family > IWL_DEVICE_FAMILY_9000) in iwl_mvm_mac_setup_register()
414 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
423 return -EINVAL; in iwl_mvm_mac_setup_register()
426 if (mvm->trans->info.num_rxqs > 1) in iwl_mvm_mac_setup_register()
429 if (mvm->trans->info.max_skb_frags) in iwl_mvm_mac_setup_register()
430 hw->netdev_features = NETIF_F_HIGHDMA | NETIF_F_SG; in iwl_mvm_mac_setup_register()
432 hw->queues = IEEE80211_NUM_ACS; in iwl_mvm_mac_setup_register()
433 hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE; in iwl_mvm_mac_setup_register()
434 hw->radiotap_mcs_details |= IEEE80211_RADIOTAP_MCS_HAVE_FEC | in iwl_mvm_mac_setup_register()
436 hw->radiotap_vht_details |= IEEE80211_RADIOTAP_VHT_KNOWN_STBC | in iwl_mvm_mac_setup_register()
439 hw->radiotap_timestamp.units_pos = in iwl_mvm_mac_setup_register()
443 hw->radiotap_timestamp.accuracy = 22; in iwl_mvm_mac_setup_register()
446 hw->rate_control_algorithm = RS_NAME; in iwl_mvm_mac_setup_register()
448 hw->uapsd_queues = IWL_MVM_UAPSD_QUEUES; in iwl_mvm_mac_setup_register()
449 hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP; in iwl_mvm_mac_setup_register()
450 hw->max_tx_fragments = mvm->trans->info.max_skb_frags; in iwl_mvm_mac_setup_register()
452 BUILD_BUG_ON(ARRAY_SIZE(mvm->ciphers) < ARRAY_SIZE(mvm_ciphers) + 6); in iwl_mvm_mac_setup_register()
453 memcpy(mvm->ciphers, mvm_ciphers, sizeof(mvm_ciphers)); in iwl_mvm_mac_setup_register()
454 hw->wiphy->n_cipher_suites = ARRAY_SIZE(mvm_ciphers); in iwl_mvm_mac_setup_register()
455 hw->wiphy->cipher_suites = mvm->ciphers; in iwl_mvm_mac_setup_register()
458 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
460 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
461 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
463 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
476 mvm->ciphers[hw->wiphy->n_cipher_suites] = WLAN_CIPHER_SUITE_AES_CMAC; in iwl_mvm_mac_setup_register()
477 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
479 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
481 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
482 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
484 hw->wiphy->n_cipher_suites++; in iwl_mvm_mac_setup_register()
487 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
489 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
492 if (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 hw->wiphy->pmsr_capa = &iwl_mvm_pmsr_capa; in iwl_mvm_mac_setup_register()
504 fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
506 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
509 fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
511 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
514 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
516 hw->wiphy->hw_timestamp_max_peers = 1; in iwl_mvm_mac_setup_register()
518 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
520 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
524 hw->wiphy->features |= in iwl_mvm_mac_setup_register()
529 hw->sta_data_size = sizeof(struct iwl_mvm_sta); in iwl_mvm_mac_setup_register()
530 hw->vif_data_size = sizeof(struct iwl_mvm_vif); in iwl_mvm_mac_setup_register()
531 hw->chanctx_data_size = sizeof(u16); in iwl_mvm_mac_setup_register()
532 hw->txq_data_size = sizeof(struct iwl_mvm_txq); in iwl_mvm_mac_setup_register()
534 hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | in iwl_mvm_mac_setup_register()
541 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in iwl_mvm_mac_setup_register()
542 wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS); in iwl_mvm_mac_setup_register()
549 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
551 hw->wiphy->features |= NL80211_FEATURE_HT_IBSS; in iwl_mvm_mac_setup_register()
553 hw->wiphy->regulatory_flags |= REGULATORY_ENABLE_RELAX_NO_IR; in iwl_mvm_mac_setup_register()
555 hw->wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED; in iwl_mvm_mac_setup_register()
557 hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | in iwl_mvm_mac_setup_register()
560 if (mvm->trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) in iwl_mvm_mac_setup_register()
561 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
564 hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; in iwl_mvm_mac_setup_register()
565 hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; in iwl_mvm_mac_setup_register()
566 hw->wiphy->flags |= WIPHY_FLAG_SPLIT_SCAN_6GHZ; in iwl_mvm_mac_setup_register()
568 hw->wiphy->iface_combinations = iwl_mvm_iface_combinations; in iwl_mvm_mac_setup_register()
569 hw->wiphy->n_iface_combinations = in iwl_mvm_mac_setup_register()
572 hw->wiphy->max_remain_on_channel_duration = 10000; in iwl_mvm_mac_setup_register()
573 hw->max_listen_interval = IWL_MVM_CONN_LISTEN_INTERVAL; in iwl_mvm_mac_setup_register()
576 memcpy(mvm->addresses[0].addr, mvm->nvm_data->hw_addr, ETH_ALEN); in iwl_mvm_mac_setup_register()
577 hw->wiphy->addresses = mvm->addresses; in iwl_mvm_mac_setup_register()
578 hw->wiphy->n_addresses = 1; in iwl_mvm_mac_setup_register()
581 num_mac = (mvm->nvm_data->n_hw_addrs > 1) ? in iwl_mvm_mac_setup_register()
582 min(IWL_MVM_MAX_ADDRESSES, mvm->nvm_data->n_hw_addrs) : 1; in iwl_mvm_mac_setup_register()
585 memcpy(mvm->addresses[i].addr, mvm->addresses[i-1].addr, in iwl_mvm_mac_setup_register()
587 mvm->addresses[i].addr[5]++; in iwl_mvm_mac_setup_register()
588 hw->wiphy->n_addresses++; in iwl_mvm_mac_setup_register()
593 hw->wiphy->max_scan_ie_len = iwl_mvm_max_scan_ie_len(mvm); in iwl_mvm_mac_setup_register()
595 hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; in iwl_mvm_mac_setup_register()
601 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) in iwl_mvm_mac_setup_register()
602 mvm->max_scans = IWL_MAX_UMAC_SCANS; in iwl_mvm_mac_setup_register()
604 mvm->max_scans = IWL_MAX_LMAC_SCANS; in iwl_mvm_mac_setup_register()
606 if (mvm->nvm_data->bands[NL80211_BAND_2GHZ].n_channels) in iwl_mvm_mac_setup_register()
607 hw->wiphy->bands[NL80211_BAND_2GHZ] = in iwl_mvm_mac_setup_register()
608 &mvm->nvm_data->bands[NL80211_BAND_2GHZ]; in iwl_mvm_mac_setup_register()
609 if (mvm->nvm_data->bands[NL80211_BAND_5GHZ].n_channels) { in iwl_mvm_mac_setup_register()
610 hw->wiphy->bands[NL80211_BAND_5GHZ] = in iwl_mvm_mac_setup_register()
611 &mvm->nvm_data->bands[NL80211_BAND_5GHZ]; in iwl_mvm_mac_setup_register()
613 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
615 fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
617 hw->wiphy->bands[NL80211_BAND_5GHZ]->vht_cap.cap |= in iwl_mvm_mac_setup_register()
620 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
622 mvm->nvm_data->bands[NL80211_BAND_6GHZ].n_channels) in iwl_mvm_mac_setup_register()
623 hw->wiphy->bands[NL80211_BAND_6GHZ] = in iwl_mvm_mac_setup_register()
624 &mvm->nvm_data->bands[NL80211_BAND_6GHZ]; in iwl_mvm_mac_setup_register()
626 hw->wiphy->hw_version = mvm->trans->info.hw_id; in iwl_mvm_mac_setup_register()
629 hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; in iwl_mvm_mac_setup_register()
631 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; in iwl_mvm_mac_setup_register()
633 hw->wiphy->max_sched_scan_reqs = 1; in iwl_mvm_mac_setup_register()
634 hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX; in iwl_mvm_mac_setup_register()
635 hw->wiphy->max_match_sets = iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_mac_setup_register()
637 hw->wiphy->max_sched_scan_ie_len = in iwl_mvm_mac_setup_register()
638 SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2; in iwl_mvm_mac_setup_register()
639 hw->wiphy->max_sched_scan_plans = IWL_MAX_SCHED_SCAN_PLANS; in iwl_mvm_mac_setup_register()
640 hw->wiphy->max_sched_scan_plan_interval = U16_MAX; in iwl_mvm_mac_setup_register()
644 * infinite loop, so the maximum number of iterations is actually 254. in iwl_mvm_mac_setup_register()
646 hw->wiphy->max_sched_scan_plan_iterations = 254; in iwl_mvm_mac_setup_register()
648 hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | in iwl_mvm_mac_setup_register()
658 hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS | in iwl_mvm_mac_setup_register()
661 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
663 hw->wiphy->features |= NL80211_FEATURE_TX_POWER_INSERTION; in iwl_mvm_mac_setup_register()
664 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
666 hw->wiphy->features |= NL80211_FEATURE_QUIET; in iwl_mvm_mac_setup_register()
668 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
670 hw->wiphy->features |= in iwl_mvm_mac_setup_register()
673 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
675 hw->wiphy->features |= NL80211_FEATURE_WFA_TPC_IE_IN_PROBES; in iwl_mvm_mac_setup_register()
677 if (iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_KEK_KCK_MATERIAL, in iwl_mvm_mac_setup_register()
679 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK; in iwl_mvm_mac_setup_register()
681 if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
683 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
685 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
690 u8 scan_ver = iwl_fw_lookup_cmd_ver(mvm->fw, SCAN_REQ_UMAC, 0); in iwl_mvm_mac_setup_register()
692 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
694 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
696 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
701 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
705 hw->wiphy->iftype_ext_capab = NULL; in iwl_mvm_mac_setup_register()
706 hw->wiphy->num_iftype_ext_capab = 0; in iwl_mvm_mac_setup_register()
708 if (mvm->nvm_data->sku_cap_11ax_enable && in iwl_mvm_mac_setup_register()
710 hw->wiphy->iftype_ext_capab = add_iftypes_ext_capa; in iwl_mvm_mac_setup_register()
711 hw->wiphy->num_iftype_ext_capab = in iwl_mvm_mac_setup_register()
712 ARRAY_SIZE(add_iftypes_ext_capa) - 1; in iwl_mvm_mac_setup_register()
718 if (iwl_fw_lookup_cmd_ver(mvm->fw, in iwl_mvm_mac_setup_register()
722 IWL_DEBUG_INFO(mvm->trans, "Timing measurement supported\n"); in iwl_mvm_mac_setup_register()
724 if (!hw->wiphy->iftype_ext_capab) { in iwl_mvm_mac_setup_register()
725 hw->wiphy->num_iftype_ext_capab = 1; in iwl_mvm_mac_setup_register()
726 hw->wiphy->iftype_ext_capab = add_iftypes_ext_capa + in iwl_mvm_mac_setup_register()
727 ARRAY_SIZE(add_iftypes_ext_capa) - 1; in iwl_mvm_mac_setup_register()
729 hw->wiphy->iftype_ext_capab = add_iftypes_ext_capa + 1; in iwl_mvm_mac_setup_register()
733 if (iwl_fw_lookup_cmd_ver(mvm->fw, WIDE_ID(LOCATION_GROUP, in iwl_mvm_mac_setup_register()
736 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
739 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
741 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
745 mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; in iwl_mvm_mac_setup_register()
748 if ((unified || mvm->fw->img[IWL_UCODE_WOWLAN].num_sec) && in iwl_mvm_mac_setup_register()
749 device_can_wakeup(mvm->trans->dev) && !fips_enabled) { in iwl_mvm_mac_setup_register()
750 mvm->wowlan.flags |= WIPHY_WOWLAN_MAGIC_PKT | in iwl_mvm_mac_setup_register()
755 mvm->wowlan.flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | in iwl_mvm_mac_setup_register()
759 mvm->wowlan.n_patterns = IWL_WOWLAN_MAX_PATTERNS; in iwl_mvm_mac_setup_register()
760 mvm->wowlan.pattern_min_len = IWL_WOWLAN_MIN_PATTERN_LEN; in iwl_mvm_mac_setup_register()
761 mvm->wowlan.pattern_max_len = IWL_WOWLAN_MAX_PATTERN_LEN; in iwl_mvm_mac_setup_register()
762 mvm->wowlan.max_nd_match_sets = in iwl_mvm_mac_setup_register()
763 iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_mac_setup_register()
764 hw->wiphy->wowlan = &mvm->wowlan; in iwl_mvm_mac_setup_register()
772 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
775 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; in iwl_mvm_mac_setup_register()
779 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
782 hw->wiphy->features |= NL80211_FEATURE_TDLS_CHANNEL_SWITCH; in iwl_mvm_mac_setup_register()
785 hw->netdev_features |= mvm->trans->mac_cfg->base->features; in iwl_mvm_mac_setup_register()
787 hw->netdev_features &= ~IWL_CSUM_NETIF_FLAGS_MASK; in iwl_mvm_mac_setup_register()
789 if (mvm->cfg->vht_mu_mimo_supported) in iwl_mvm_mac_setup_register()
790 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
793 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_PROTECTED_TWT)) in iwl_mvm_mac_setup_register()
794 wiphy_ext_feature_set(hw->wiphy, in iwl_mvm_mac_setup_register()
799 hw->wiphy->available_antennas_tx = iwl_mvm_get_valid_tx_ant(mvm); in iwl_mvm_mac_setup_register()
800 hw->wiphy->available_antennas_rx = iwl_mvm_get_valid_rx_ant(mvm); in iwl_mvm_mac_setup_register()
802 ret = ieee80211_register_hw(mvm->hw); in iwl_mvm_mac_setup_register()
821 ieee80211_free_txskb(mvm->hw, skb); in iwl_mvm_tx_skb()
828 struct ieee80211_sta *sta = control->sta; in iwl_mvm_mac_tx()
830 struct ieee80211_hdr *hdr = (void *)skb->data; in iwl_mvm_mac_tx()
831 bool offchannel = IEEE80211_SKB_CB(skb)->flags & in iwl_mvm_mac_tx()
833 u32 link_id = u32_get_bits(info->control.flags, in iwl_mvm_mac_tx()
838 IWL_DEBUG_DROP(mvm, "Dropping - RF/CT KILL\n"); in iwl_mvm_mac_tx()
843 !test_bit(IWL_MVM_STATUS_ROC_P2P_RUNNING, &mvm->status) && in iwl_mvm_mac_tx()
844 !test_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status)) in iwl_mvm_mac_tx()
851 if (ieee80211_is_mgmt(hdr->frame_control)) in iwl_mvm_mac_tx()
855 if (!sta && info->control.vif->type == NL80211_IFTYPE_STATION && in iwl_mvm_mac_tx()
860 !ieee80211_is_probe_resp(hdr->frame_control)) { in iwl_mvm_mac_tx()
863 rcu_dereference(tmp_sta->link[link_id]); in iwl_mvm_mac_tx()
865 rcu_dereference(info->control.vif->link_conf[link_id]); in iwl_mvm_mac_tx()
873 memcpy(mgmt->da, link_sta->addr, ETH_ALEN); in iwl_mvm_mac_tx()
874 memcpy(mgmt->sa, link_conf->addr, ETH_ALEN); in iwl_mvm_mac_tx()
875 memcpy(mgmt->bssid, link_conf->bssid, ETH_ALEN); in iwl_mvm_mac_tx()
894 * mvmtxq->tx_request logic: in iwl_mvm_mac_itxq_xmit()
909 if (atomic_fetch_add_unless(&mvmtxq->tx_request, 1, 2)) in iwl_mvm_mac_itxq_xmit()
915 &mvmtxq->state) && in iwl_mvm_mac_itxq_xmit()
917 &mvmtxq->state) && in iwl_mvm_mac_itxq_xmit()
919 &mvmtxq->state) && in iwl_mvm_mac_itxq_xmit()
920 !test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status))) { in iwl_mvm_mac_itxq_xmit()
924 if (txq->sta) in iwl_mvm_mac_itxq_xmit()
927 txq->sta->addr, in iwl_mvm_mac_itxq_xmit()
928 txq->tid); in iwl_mvm_mac_itxq_xmit()
932 iwl_mvm_tx_skb(mvm, skb, txq->sta); in iwl_mvm_mac_itxq_xmit()
934 } while (atomic_dec_return(&mvmtxq->tx_request)); in iwl_mvm_mac_itxq_xmit()
944 if (likely(test_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state)) || in iwl_mvm_mac_wake_tx_queue()
945 !txq->sta) { in iwl_mvm_mac_wake_tx_queue()
954 spin_lock_bh(&mvm->add_stream_lock); in iwl_mvm_mac_wake_tx_queue()
956 if (list_empty(&mvmtxq->list) && in iwl_mvm_mac_wake_tx_queue()
958 !test_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state)) { in iwl_mvm_mac_wake_tx_queue()
959 list_add_tail(&mvmtxq->list, &mvm->add_stream_txqs); in iwl_mvm_mac_wake_tx_queue()
960 schedule_work(&mvm->add_stream_wk); in iwl_mvm_mac_wake_tx_queue()
962 spin_unlock_bh(&mvm->add_stream_lock); in iwl_mvm_mac_wake_tx_queue()
969 iwl_fw_dbg_collect_trig(&(_mvm)->fwrt, _trig, _fmt); \
980 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_ampdu_check_trigger()
985 ba_trig = (void *)trig->data; in iwl_mvm_ampdu_check_trigger()
990 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; in iwl_mvm_ampdu_check_trigger()
992 CHECK_BA_TRIGGER(mvm, trig, ba_trig->tx_ba_start, tid, in iwl_mvm_ampdu_check_trigger()
994 sta->addr, tid, tid_data->ssn); in iwl_mvm_ampdu_check_trigger()
998 CHECK_BA_TRIGGER(mvm, trig, ba_trig->tx_ba_stop, tid, in iwl_mvm_ampdu_check_trigger()
1000 sta->addr, tid); in iwl_mvm_ampdu_check_trigger()
1003 CHECK_BA_TRIGGER(mvm, trig, ba_trig->rx_ba_start, tid, in iwl_mvm_ampdu_check_trigger()
1005 sta->addr, tid, rx_ba_ssn); in iwl_mvm_ampdu_check_trigger()
1008 CHECK_BA_TRIGGER(mvm, trig, ba_trig->rx_ba_stop, tid, in iwl_mvm_ampdu_check_trigger()
1010 sta->addr, tid); in iwl_mvm_ampdu_check_trigger()
1023 struct ieee80211_sta *sta = params->sta; in iwl_mvm_mac_ampdu_action()
1024 enum ieee80211_ampdu_mlme_action action = params->action; in iwl_mvm_mac_ampdu_action()
1025 u16 tid = params->tid; in iwl_mvm_mac_ampdu_action()
1026 u16 *ssn = ¶ms->ssn; in iwl_mvm_mac_ampdu_action()
1027 u16 buf_size = params->buf_size; in iwl_mvm_mac_ampdu_action()
1028 bool amsdu = params->amsdu; in iwl_mvm_mac_ampdu_action()
1029 u16 timeout = params->timeout; in iwl_mvm_mac_ampdu_action()
1031 IWL_DEBUG_HT(mvm, "A-MPDU action on addr %pM tid %d: action %d\n", in iwl_mvm_mac_ampdu_action()
1032 sta->addr, tid, action); in iwl_mvm_mac_ampdu_action()
1034 if (!(mvm->nvm_data->sku_cap_11n_enable)) in iwl_mvm_mac_ampdu_action()
1035 return -EACCES; in iwl_mvm_mac_ampdu_action()
1037 mutex_lock(&mvm->mutex); in iwl_mvm_mac_ampdu_action()
1041 if (iwl_mvm_vif_from_mac80211(vif)->deflink.ap_sta_id == in iwl_mvm_mac_ampdu_action()
1042 iwl_mvm_sta_from_mac80211(sta)->deflink.sta_id) { in iwl_mvm_mac_ampdu_action()
1044 u16 macid = iwl_mvm_vif_from_mac80211(vif)->id; in iwl_mvm_mac_ampdu_action()
1045 struct iwl_mvm_tcm_mac *mdata = &mvm->tcm.data[macid]; in iwl_mvm_mac_ampdu_action()
1047 mdata->opened_rx_ba_sessions = true; in iwl_mvm_mac_ampdu_action()
1049 cancel_delayed_work(&mvmvif->uapsd_nonagg_detected_wk); in iwl_mvm_mac_ampdu_action()
1052 ret = -EINVAL; in iwl_mvm_mac_ampdu_action()
1064 ret = -EINVAL; in iwl_mvm_mac_ampdu_action()
1082 ret = -EINVAL; in iwl_mvm_mac_ampdu_action()
1095 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_ampdu_action()
1108 mvmvif->uploaded = false; in iwl_mvm_cleanup_iterator()
1110 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_cleanup_iterator()
1111 iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data); in iwl_mvm_cleanup_iterator()
1112 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_cleanup_iterator()
1114 mvmvif->roc_activity = ROC_NUM_ACTIVITIES; in iwl_mvm_cleanup_iterator()
1116 mvmvif->bf_enabled = false; in iwl_mvm_cleanup_iterator()
1117 mvmvif->ba_enabled = false; in iwl_mvm_cleanup_iterator()
1118 mvmvif->ap_sta = NULL; in iwl_mvm_cleanup_iterator()
1120 mvmvif->esr_active = false; in iwl_mvm_cleanup_iterator()
1121 vif->driver_flags &= ~IEEE80211_VIF_EML_ACTIVE; in iwl_mvm_cleanup_iterator()
1124 mvmvif->link[link_id]->ap_sta_id = IWL_INVALID_STA; in iwl_mvm_cleanup_iterator()
1125 mvmvif->link[link_id]->fw_link_id = IWL_MVM_FW_LINK_ID_INVALID; in iwl_mvm_cleanup_iterator()
1126 mvmvif->link[link_id]->phy_ctxt = NULL; in iwl_mvm_cleanup_iterator()
1127 mvmvif->link[link_id]->active = 0; in iwl_mvm_cleanup_iterator()
1128 mvmvif->link[link_id]->igtk = NULL; in iwl_mvm_cleanup_iterator()
1129 memset(&mvmvif->link[link_id]->bf_data, 0, in iwl_mvm_cleanup_iterator()
1130 sizeof(mvmvif->link[link_id]->bf_data)); in iwl_mvm_cleanup_iterator()
1133 probe_data = rcu_dereference_protected(mvmvif->deflink.probe_resp_data, in iwl_mvm_cleanup_iterator()
1134 lockdep_is_held(&mvm->mutex)); in iwl_mvm_cleanup_iterator()
1137 RCU_INIT_POINTER(mvmvif->deflink.probe_resp_data, NULL); in iwl_mvm_cleanup_iterator()
1148 vif = mvm_sta->vif; in iwl_mvm_cleanup_sta_iterator()
1150 if (!sta->valid_links) in iwl_mvm_cleanup_sta_iterator()
1153 for (link_id = 0; link_id < ARRAY_SIZE((sta)->link); link_id++) { in iwl_mvm_cleanup_sta_iterator()
1157 rcu_dereference_check(mvm_sta->link[link_id], in iwl_mvm_cleanup_sta_iterator()
1158 lockdep_is_held(&mvm->mutex)); in iwl_mvm_cleanup_sta_iterator()
1159 if (mvm_link_sta && !(vif->active_links & BIT(link_id))) { in iwl_mvm_cleanup_sta_iterator()
1177 mvm->cur_aid = 0; in iwl_mvm_restart_cleanup()
1179 mvm->scan_status = 0; in iwl_mvm_restart_cleanup()
1180 mvm->ps_disabled = false; in iwl_mvm_restart_cleanup()
1181 mvm->rfkill_safe_init_done = false; in iwl_mvm_restart_cleanup()
1185 ieee80211_remain_on_channel_expired(mvm->hw); in iwl_mvm_restart_cleanup()
1193 ieee80211_iterate_interfaces(mvm->hw, 0, iwl_mvm_cleanup_iterator, mvm); in iwl_mvm_restart_cleanup()
1196 ieee80211_iterate_stations_atomic(mvm->hw, in iwl_mvm_restart_cleanup()
1199 mvm->p2p_device_vif = NULL; in iwl_mvm_restart_cleanup()
1202 memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table)); in iwl_mvm_restart_cleanup()
1203 memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif)); in iwl_mvm_restart_cleanup()
1204 memset(&mvm->last_bt_ci_cmd, 0, sizeof(mvm->last_bt_ci_cmd)); in iwl_mvm_restart_cleanup()
1206 ieee80211_wake_queues(mvm->hw); in iwl_mvm_restart_cleanup()
1208 mvm->rx_ba_sessions = 0; in iwl_mvm_restart_cleanup()
1209 mvm->fwrt.dump.conf = FW_DBG_INVALID; in iwl_mvm_restart_cleanup()
1210 mvm->monitor_on = false; in iwl_mvm_restart_cleanup()
1212 mvm->beacon_inject_active = false; in iwl_mvm_restart_cleanup()
1224 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_mac_start()
1230 if (mvm->mei_nvm_data) { in __iwl_mvm_mac_start()
1232 kfree(mvm->mei_nvm_data); in __iwl_mvm_mac_start()
1233 mvm->mei_nvm_data = NULL; in __iwl_mvm_mac_start()
1238 * allocated on mvm->nvm_data. Keep a pointer in temp_nvm_data in __iwl_mvm_mac_start()
1243 mvm->temp_nvm_data = mvm->nvm_data; in __iwl_mvm_mac_start()
1244 mvm->nvm_data = NULL; in __iwl_mvm_mac_start()
1249 fast_resume = mvm->fast_resume; in __iwl_mvm_mac_start()
1267 set_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); in __iwl_mvm_mac_start()
1272 if (test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status)) { in __iwl_mvm_mac_start()
1275 * so later code will - from now on - see that we're doing it. in __iwl_mvm_mac_start()
1277 set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in __iwl_mvm_mac_start()
1278 clear_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status); in __iwl_mvm_mac_start()
1287 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_POST_INIT, in __iwl_mvm_mac_start()
1289 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_PERIODIC, in __iwl_mvm_mac_start()
1292 mvm->last_reset_or_resume_time_jiffies = jiffies; in __iwl_mvm_mac_start()
1294 if (ret && test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in __iwl_mvm_mac_start()
1295 /* Something went wrong - we need to finish some cleanup in __iwl_mvm_mac_start()
1299 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in __iwl_mvm_mac_start()
1311 mutex_lock(&mvm->mutex); in iwl_mvm_mac_start()
1314 if (!test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status) && in iwl_mvm_mac_start()
1320 if (ret != -ETIMEDOUT) in iwl_mvm_mac_start()
1326 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_start()
1339 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in iwl_mvm_restart_complete()
1355 iwl_trans_finish_sw_reset(mvm->trans); in iwl_mvm_restart_complete()
1358 if (!list_empty(&mvm->add_stream_txqs)) in iwl_mvm_restart_complete()
1359 schedule_work(&mvm->add_stream_wk); in iwl_mvm_restart_complete()
1378 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_mac_stop()
1385 memset(&mvm->accu_radio_stats, 0, sizeof(mvm->accu_radio_stats)); in __iwl_mvm_mac_stop()
1389 if (!iwl_mvm_has_new_station_api(mvm->fw)) in __iwl_mvm_mac_stop()
1393 mvm->trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_22000) { in __iwl_mvm_mac_stop()
1411 if (test_and_clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) || in __iwl_mvm_mac_stop()
1413 &mvm->status)) in __iwl_mvm_mac_stop()
1414 ieee80211_iterate_interfaces(mvm->hw, 0, in __iwl_mvm_mac_stop()
1417 /* We shouldn't have any UIDs still set. Loop over all the UIDs to in __iwl_mvm_mac_stop()
1420 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in __iwl_mvm_mac_stop()
1423 for (i = 0; i < mvm->max_scans; i++) { in __iwl_mvm_mac_stop()
1424 if (WARN_ONCE(mvm->scan_uid_status[i], in __iwl_mvm_mac_stop()
1427 mvm->scan_uid_status[i] = 0; in __iwl_mvm_mac_stop()
1437 mutex_lock(&mvm->mutex); in iwl_mvm_mac_stop()
1439 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_stop()
1441 wiphy_work_cancel(mvm->hw->wiphy, &mvm->trig_link_selection_wk); in iwl_mvm_mac_stop()
1442 wiphy_work_flush(mvm->hw->wiphy, &mvm->async_handlers_wiphy_wk); in iwl_mvm_mac_stop()
1443 flush_work(&mvm->async_handlers_wk); in iwl_mvm_mac_stop()
1444 flush_work(&mvm->add_stream_wk); in iwl_mvm_mac_stop()
1454 clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); in iwl_mvm_mac_stop()
1456 cancel_delayed_work_sync(&mvm->cs_tx_unblock_dwork); in iwl_mvm_mac_stop()
1457 cancel_delayed_work_sync(&mvm->scan_timeout_dwork); in iwl_mvm_mac_stop()
1463 flush_work(&mvm->roc_done_wk); in iwl_mvm_mac_stop()
1467 mutex_lock(&mvm->mutex); in iwl_mvm_mac_stop()
1469 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_stop()
1475 cancel_work_sync(&mvm->async_handlers_wk); in iwl_mvm_mac_stop()
1476 wiphy_work_cancel(hw->wiphy, &mvm->async_handlers_wiphy_wk); in iwl_mvm_mac_stop()
1483 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_free_phy_ctxt()
1486 if (!mvm->phy_ctxts[i].ref) in iwl_mvm_get_free_phy_ctxt()
1487 return &mvm->phy_ctxts[i]; in iwl_mvm_get_free_phy_ctxt()
1498 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(link_conf->vif); in iwl_mvm_set_tx_power()
1499 u32 mac_id = mvmvif->id; in iwl_mvm_set_tx_power()
1506 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 3); in iwl_mvm_set_tx_power()
1516 if (WARN_ON(!mvmvif->link[link_conf->link_id])) in iwl_mvm_set_tx_power()
1517 return -ENODEV; in iwl_mvm_set_tx_power()
1519 link_id = mvmvif->link[link_conf->link_id]->fw_link_id; in iwl_mvm_set_tx_power()
1534 else if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_set_tx_power()
1537 else if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_set_tx_power()
1558 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) { in iwl_mvm_post_csa_tx()
1560 iwl_mvm_txq_from_mac80211(sta->txq[i]); in iwl_mvm_post_csa_tx()
1562 clear_bit(IWL_MVM_TXQ_STATE_STOP_AP_CSA, &mvmtxq->state); in iwl_mvm_post_csa_tx()
1563 iwl_mvm_mac_itxq_xmit(hw, sta->txq[i]); in iwl_mvm_post_csa_tx()
1575 mutex_lock(&mvm->mutex); in iwl_mvm_post_channel_switch()
1577 if (vif->type == NL80211_IFTYPE_STATION) { in iwl_mvm_post_channel_switch()
1579 unsigned int link_id = link_conf->link_id; in iwl_mvm_post_channel_switch()
1580 u8 ap_sta_id = mvmvif->link[link_id]->ap_sta_id; in iwl_mvm_post_channel_switch()
1582 mvmvif->csa_bcn_pending = false; in iwl_mvm_post_channel_switch()
1583 mvmvif->csa_blocks_tx = false; in iwl_mvm_post_channel_switch()
1587 ret = -EIO; in iwl_mvm_post_channel_switch()
1592 if (mvm->mld_api_is_used) in iwl_mvm_post_channel_switch()
1597 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_post_channel_switch()
1605 } else if (vif->type == NL80211_IFTYPE_AP && mvmvif->csa_blocks_tx) { in iwl_mvm_post_channel_switch()
1607 iwl_mvm_txq_from_mac80211(vif->txq); in iwl_mvm_post_channel_switch()
1609 clear_bit(IWL_MVM_TXQ_STATE_STOP_AP_CSA, &mvmtxq->state); in iwl_mvm_post_channel_switch()
1612 iwl_mvm_mac_itxq_xmit(hw, vif->txq); in iwl_mvm_post_channel_switch()
1616 mvmvif->csa_blocks_tx = false; in iwl_mvm_post_channel_switch()
1619 mvmvif->ps_disabled = false; in iwl_mvm_post_channel_switch()
1624 if (mvmvif->csa_failed) in iwl_mvm_post_channel_switch()
1625 ret = -EIO; in iwl_mvm_post_channel_switch()
1626 mutex_unlock(&mvm->mutex); in iwl_mvm_post_channel_switch()
1638 .mac_id = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, in iwl_mvm_abort_channel_switch()
1639 mvmvif->color)), in iwl_mvm_abort_channel_switch()
1648 if (iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, in iwl_mvm_abort_channel_switch()
1652 IWL_DEBUG_MAC80211(mvm, "Abort CSA on mac %d\n", mvmvif->id); in iwl_mvm_abort_channel_switch()
1654 mutex_lock(&mvm->mutex); in iwl_mvm_abort_channel_switch()
1655 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_abort_channel_switch()
1663 mvmvif->csa_failed = true; in iwl_mvm_abort_channel_switch()
1664 mutex_unlock(&mvm->mutex); in iwl_mvm_abort_channel_switch()
1667 iwl_mvm_post_channel_switch(hw, vif, &vif->bss_conf); in iwl_mvm_abort_channel_switch()
1689 if (chandef->width == NL80211_CHAN_WIDTH_320) in iwl_mvm_chandef_get_primary_80()
1691 else if (chandef->width == NL80211_CHAN_WIDTH_160) in iwl_mvm_chandef_get_primary_80()
1697 data_start = chandef->center_freq1 - bw / 2; in iwl_mvm_chandef_get_primary_80()
1699 control_start = chandef->chan->center_freq - 10; in iwl_mvm_chandef_get_primary_80()
1701 return (control_start - data_start) / 80; in iwl_mvm_chandef_get_primary_80()
1710 lockdep_assert_held(&mvm->mutex); in iwl_mvm_alloc_bcast_mcast_sta()
1721 return iwl_mvm_allocate_int_sta(mvm, &mvmvif->deflink.mcast_sta, 0, in iwl_mvm_alloc_bcast_mcast_sta()
1722 vif->type, in iwl_mvm_alloc_bcast_mcast_sta()
1731 struct iwl_mvm *mvm = mvmvif->mvm; in iwl_mvm_prevent_esr_done_wk()
1746 guard(mvm)(mvmvif->mvm); in iwl_mvm_mlo_int_scan_wk()
1747 iwl_mvm_int_mlo_scan(mvmvif->mvm, vif); in iwl_mvm_mlo_int_scan_wk()
1754 struct iwl_mvm *mvm = mvmvif->mvm; in iwl_mvm_unblock_esr_tpt()
1768 struct iwl_mvm *mvm = mvmvif->mvm; in iwl_mvm_unblock_esr_tmp_non_bss()
1772 mutex_lock(&mvm->mutex); in iwl_mvm_unblock_esr_tmp_non_bss()
1774 mutex_unlock(&mvm->mutex); in iwl_mvm_unblock_esr_tmp_non_bss()
1779 lockdep_assert_held(&mvm->mutex); in iwl_mvm_mac_init_mvmvif()
1781 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mac_init_mvmvif()
1784 mvmvif->deflink.average_beacon_energy = 0; in iwl_mvm_mac_init_mvmvif()
1786 INIT_DELAYED_WORK(&mvmvif->csa_work, in iwl_mvm_mac_init_mvmvif()
1789 wiphy_delayed_work_init(&mvmvif->prevent_esr_done_wk, in iwl_mvm_mac_init_mvmvif()
1792 wiphy_delayed_work_init(&mvmvif->mlo_int_scan_wk, in iwl_mvm_mac_init_mvmvif()
1795 wiphy_work_init(&mvmvif->unblock_esr_tpt_wk, in iwl_mvm_mac_init_mvmvif()
1798 wiphy_delayed_work_init(&mvmvif->unblock_esr_tmp_non_bss_wk, in iwl_mvm_mac_init_mvmvif()
1810 mutex_lock(&mvm->mutex); in iwl_mvm_mac_add_interface()
1814 mvmvif->mvm = mvm; in iwl_mvm_mac_add_interface()
1817 mvmvif->deflink.fw_link_id = IWL_MVM_FW_LINK_ID_INVALID; in iwl_mvm_mac_add_interface()
1818 mvmvif->deflink.active = 0; in iwl_mvm_mac_add_interface()
1819 mvmvif->link[0] = &mvmvif->deflink; in iwl_mvm_mac_add_interface()
1821 vif->driver_flags = IEEE80211_VIF_REMOVE_AP_AFTER_DISASSOC; in iwl_mvm_mac_add_interface()
1823 iwl_mvm_set_link_fw_id(mvm, vif, &vif->bss_conf); in iwl_mvm_mac_add_interface()
1832 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mac_add_interface()
1834 mvmvif->link[i]->beacon_stats.accu_num_beacons += in iwl_mvm_mac_add_interface()
1835 mvmvif->link[i]->beacon_stats.num_beacons; in iwl_mvm_mac_add_interface()
1842 rcu_assign_pointer(mvm->vif_id_to_mac[mvmvif->id], vif); in iwl_mvm_mac_add_interface()
1855 if (vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_add_interface()
1856 vif->type == NL80211_IFTYPE_ADHOC) { in iwl_mvm_mac_add_interface()
1857 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mac_add_interface()
1863 mvmvif->features |= hw->netdev_features; in iwl_mvm_mac_add_interface()
1878 if (!mvm->bf_allowed_vif && in iwl_mvm_mac_add_interface()
1879 vif->type == NL80211_IFTYPE_STATION && !vif->p2p) { in iwl_mvm_mac_add_interface()
1880 mvm->bf_allowed_vif = mvmvif; in iwl_mvm_mac_add_interface()
1881 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | in iwl_mvm_mac_add_interface()
1885 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) in iwl_mvm_mac_add_interface()
1886 mvm->p2p_device_vif = vif; in iwl_mvm_mac_add_interface()
1890 if (vif->type == NL80211_IFTYPE_MONITOR) { in iwl_mvm_mac_add_interface()
1891 mvm->monitor_on = true; in iwl_mvm_mac_add_interface()
1892 mvm->monitor_p80 = in iwl_mvm_mac_add_interface()
1893 iwl_mvm_chandef_get_primary_80(&vif->bss_conf.chanreq.oper); in iwl_mvm_mac_add_interface()
1896 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mac_add_interface()
1899 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in iwl_mvm_mac_add_interface()
1900 vif->type == NL80211_IFTYPE_STATION && !vif->p2p && in iwl_mvm_mac_add_interface()
1901 !mvm->csme_vif && mvm->mei_registered) { in iwl_mvm_mac_add_interface()
1902 iwl_mei_set_nic_info(vif->addr, mvm->nvm_data->hw_addr); in iwl_mvm_mac_add_interface()
1903 iwl_mei_set_netdev(ieee80211_vif_to_wdev(vif)->netdev); in iwl_mvm_mac_add_interface()
1904 mvm->csme_vif = vif; in iwl_mvm_mac_add_interface()
1908 if (!ret && (vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_add_interface()
1909 vif->type == NL80211_IFTYPE_ADHOC)) in iwl_mvm_mac_add_interface()
1915 mvmvif->deflink.phy_ctxt = NULL; in iwl_mvm_mac_add_interface()
1918 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_add_interface()
1928 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { in iwl_mvm_prepare_mac_removal()
1934 flush_work(&mvm->roc_done_wk); in iwl_mvm_prepare_mac_removal()
1937 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_prepare_mac_removal()
1938 &mvmvif->prevent_esr_done_wk); in iwl_mvm_prepare_mac_removal()
1940 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_prepare_mac_removal()
1941 &mvmvif->mlo_int_scan_wk); in iwl_mvm_prepare_mac_removal()
1943 wiphy_work_cancel(mvm->hw->wiphy, &mvmvif->unblock_esr_tpt_wk); in iwl_mvm_prepare_mac_removal()
1944 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_prepare_mac_removal()
1945 &mvmvif->unblock_esr_tmp_non_bss_wk); in iwl_mvm_prepare_mac_removal()
1947 cancel_delayed_work_sync(&mvmvif->csa_work); in iwl_mvm_prepare_mac_removal()
1959 if (!(vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_remove_interface()
1960 vif->type == NL80211_IFTYPE_ADHOC)) in iwl_mvm_mac_remove_interface()
1963 mutex_lock(&mvm->mutex); in iwl_mvm_mac_remove_interface()
1965 if (vif == mvm->csme_vif) { in iwl_mvm_mac_remove_interface()
1967 mvm->csme_vif = NULL; in iwl_mvm_mac_remove_interface()
1970 probe_data = rcu_dereference_protected(mvmvif->deflink.probe_resp_data, in iwl_mvm_mac_remove_interface()
1971 lockdep_is_held(&mvm->mutex)); in iwl_mvm_mac_remove_interface()
1972 RCU_INIT_POINTER(mvmvif->deflink.probe_resp_data, NULL); in iwl_mvm_mac_remove_interface()
1976 if (mvm->bf_allowed_vif == mvmvif) { in iwl_mvm_mac_remove_interface()
1977 mvm->bf_allowed_vif = NULL; in iwl_mvm_mac_remove_interface()
1978 vif->driver_flags &= ~(IEEE80211_VIF_BEACON_FILTER | in iwl_mvm_mac_remove_interface()
1982 if (vif->bss_conf.ftm_responder) in iwl_mvm_mac_remove_interface()
1983 memset(&mvm->ftm_resp_stats, 0, sizeof(mvm->ftm_resp_stats)); in iwl_mvm_mac_remove_interface()
1991 if (vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_remove_interface()
1992 vif->type == NL80211_IFTYPE_ADHOC) in iwl_mvm_mac_remove_interface()
2002 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { in iwl_mvm_mac_remove_interface()
2003 if (mvmvif->deflink.phy_ctxt) { in iwl_mvm_mac_remove_interface()
2004 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); in iwl_mvm_mac_remove_interface()
2005 mvmvif->deflink.phy_ctxt = NULL; in iwl_mvm_mac_remove_interface()
2007 mvm->p2p_device_vif = NULL; in iwl_mvm_mac_remove_interface()
2012 RCU_INIT_POINTER(mvm->vif_id_to_mac[mvmvif->id], NULL); in iwl_mvm_mac_remove_interface()
2014 if (vif->type == NL80211_IFTYPE_MONITOR) in iwl_mvm_mac_remove_interface()
2015 mvm->monitor_on = false; in iwl_mvm_mac_remove_interface()
2018 if (vif->type == NL80211_IFTYPE_AP || in iwl_mvm_mac_remove_interface()
2019 vif->type == NL80211_IFTYPE_ADHOC) { in iwl_mvm_mac_remove_interface()
2020 iwl_mvm_dealloc_int_sta(mvm, &mvmvif->deflink.mcast_sta); in iwl_mvm_mac_remove_interface()
2024 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_remove_interface()
2036 struct iwl_mvm *mvm = data->mvm; in iwl_mvm_mc_iface_iterator()
2037 struct iwl_mcast_filter_cmd *cmd = mvm->mcast_filter_cmd; in iwl_mvm_mc_iface_iterator()
2046 if (WARN_ON_ONCE(data->port_id >= MAX_PORT_ID_NUM)) in iwl_mvm_mc_iface_iterator()
2049 if (vif->type != NL80211_IFTYPE_STATION || in iwl_mvm_mc_iface_iterator()
2050 !vif->cfg.assoc) in iwl_mvm_mc_iface_iterator()
2053 cmd->port_id = data->port_id++; in iwl_mvm_mc_iface_iterator()
2054 memcpy(cmd->bssid, vif->bss_conf.bssid, ETH_ALEN); in iwl_mvm_mc_iface_iterator()
2055 len = roundup(sizeof(*cmd) + cmd->count * ETH_ALEN, 4); in iwl_mvm_mc_iface_iterator()
2072 lockdep_assert_held(&mvm->mutex); in iwl_mvm_recalc_multicast()
2074 if (WARN_ON_ONCE(!mvm->mcast_filter_cmd)) in iwl_mvm_recalc_multicast()
2078 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_recalc_multicast()
2088 * Note that the CPU is still faster - but with this we'll in iwl_mvm_recalc_multicast()
2120 cmd->pass_all = 1; in iwl_mvm_prepare_multicast()
2131 cmd->count, addr->addr); in iwl_mvm_prepare_multicast()
2134 cmd->count, addr->addr, ":"); in iwl_mvm_prepare_multicast()
2136 memcpy(&cmd->addr_list[cmd->count * ETH_ALEN], in iwl_mvm_prepare_multicast()
2137 addr->addr, ETH_ALEN); in iwl_mvm_prepare_multicast()
2138 cmd->count++; in iwl_mvm_prepare_multicast()
2162 kfree(mvm->mcast_filter_cmd); in iwl_mvm_configure_filter()
2163 mvm->mcast_filter_cmd = cmd; in iwl_mvm_configure_filter()
2169 cmd->pass_all = !!(*total_flags & FIF_ALLMULTI); in iwl_mvm_configure_filter()
2171 if (cmd->pass_all) in iwl_mvm_configure_filter()
2172 cmd->count = 0; in iwl_mvm_configure_filter()
2191 if (vif->type != NL80211_IFTYPE_STATION || !vif->cfg.assoc || in iwl_mvm_config_iface_filter()
2192 !vif->p2p) in iwl_mvm_config_iface_filter()
2203 memcpy(cmd.membership_status, vif->bss_conf.mu_group.membership, in iwl_mvm_update_mu_groups()
2205 memcpy(cmd.user_position, vif->bss_conf.mu_group.position, in iwl_mvm_update_mu_groups()
2217 if (vif->bss_conf.mu_mimo_owner) { in iwl_mvm_mu_mimo_iface_iterator()
2221 * MU-MIMO Group Id action frame is little endian. We treat in iwl_mvm_mu_mimo_iface_iterator()
2226 (u8 *)¬if->membership_status, in iwl_mvm_mu_mimo_iface_iterator()
2227 (u8 *)¬if->user_position); in iwl_mvm_mu_mimo_iface_iterator()
2235 struct iwl_mu_group_mgmt_notif *notif = (void *)pkt->data; in iwl_mvm_mu_mimo_grp_notif()
2238 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_mu_mimo_grp_notif()
2251 (BIT(IEEE80211_PPE_THRES_INFO_PPET_SIZE) - 1); in iwl_mvm_he_get_ppe_val()
2259 residue_bits = 8 - bit_num; in iwl_mvm_he_get_ppe_val()
2262 (BIT(IEEE80211_PPE_THRES_INFO_PPET_SIZE - residue_bits) - 1)) << in iwl_mvm_he_get_ppe_val()
2264 res += (ppe[byte_num] >> bit_num) & (BIT(residue_bits) - 1); in iwl_mvm_he_get_ppe_val()
2283 IWL_DEBUG_INFO(mvm, "Got NSS = %d - trimming to %d\n", nss, in iwl_mvm_parse_ppe()
2294 bw < ARRAY_SIZE(pkt_ext->pkt_ext_qam_th[i]); in iwl_mvm_parse_ppe()
2300 * isn't present - it should inherit the thresholds from the last in iwl_mvm_parse_ppe()
2302 * this inheritance - continue in this case in iwl_mvm_parse_ppe()
2317 pkt_ext->pkt_ext_qam_th[i][bw][0] = low_th; in iwl_mvm_parse_ppe()
2318 pkt_ext->pkt_ext_qam_th[i][bw][1] = high_th; in iwl_mvm_parse_ppe()
2328 u8 nss = (link_sta->he_cap.ppe_thres[0] & in iwl_mvm_set_pkt_ext_from_he_ppe()
2330 u8 *ppe = &link_sta->he_cap.ppe_thres[0]; in iwl_mvm_set_pkt_ext_from_he_ppe()
2345 int low_th = -1; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2346 int high_th = -1; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2367 return -EINVAL; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2374 bw < ARRAY_SIZE(pkt_ext->pkt_ext_qam_th[i]); in iwl_mvm_set_pkt_ext_from_nominal_padding()
2376 pkt_ext->pkt_ext_qam_th[i][bw][0] = low_th; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2377 pkt_ext->pkt_ext_qam_th[i][bw][1] = high_th; in iwl_mvm_set_pkt_ext_from_nominal_padding()
2392 for (bw = 0; bw < ARRAY_SIZE(pkt_ext->pkt_ext_qam_th[i]); in iwl_mvm_get_optimal_ppe_info()
2394 u8 *qam_th = &pkt_ext->pkt_ext_qam_th[i][bw][0]; in iwl_mvm_get_optimal_ppe_info()
2418 return -EINVAL; in iwl_mvm_set_sta_pkt_ext()
2421 * 9-262ac of 80211.ax/D3.0. in iwl_mvm_set_sta_pkt_ext()
2426 if (link_sta->eht_cap.has_eht) { in iwl_mvm_set_sta_pkt_ext()
2428 u8_get_bits(link_sta->eht_cap.eht_cap_elem.phy_cap_info[5], in iwl_mvm_set_sta_pkt_ext()
2431 /* If PPE Thresholds exists, parse them into a FW-familiar in iwl_mvm_set_sta_pkt_ext()
2434 if (link_sta->eht_cap.eht_cap_elem.phy_cap_info[5] & in iwl_mvm_set_sta_pkt_ext()
2436 u8 nss = (link_sta->eht_cap.eht_ppe_thres[0] & in iwl_mvm_set_sta_pkt_ext()
2438 u8 *ppe = &link_sta->eht_cap.eht_ppe_thres[0]; in iwl_mvm_set_sta_pkt_ext()
2447 /* EHT PPE Thresholds doesn't exist - set the API according to in iwl_mvm_set_sta_pkt_ext()
2450 } else if (link_sta->he_cap.he_cap_elem.phy_cap_info[6] & in iwl_mvm_set_sta_pkt_ext()
2460 /* According to the requirements, for MCSs 12-13 the in iwl_mvm_set_sta_pkt_ext()
2466 /* if PPE Thresholds doesn't present in both EHT IE and HE IE - in iwl_mvm_set_sta_pkt_ext()
2473 } else if (link_sta->he_cap.has_he) { in iwl_mvm_set_sta_pkt_ext()
2474 /* If PPE Thresholds exist, parse them into a FW-familiar format. */ in iwl_mvm_set_sta_pkt_ext()
2475 if (link_sta->he_cap.he_cap_elem.phy_cap_info[6] & in iwl_mvm_set_sta_pkt_ext()
2479 /* PPE Thresholds doesn't exist - set the API PPE values in iwl_mvm_set_sta_pkt_ext()
2484 u8_get_bits(link_sta->he_cap.he_cap_elem.phy_cap_info[9], in iwl_mvm_set_sta_pkt_ext()
2496 bw < ARRAY_SIZE(*pkt_ext->pkt_ext_qam_th[i]); in iwl_mvm_set_sta_pkt_ext()
2499 &pkt_ext->pkt_ext_qam_th[i][bw][0]; in iwl_mvm_set_sta_pkt_ext()
2523 &link_info->queue_params[i].mu_edca_param_rec; in iwl_mvm_set_fw_mu_edca_params()
2526 if (!link_info->queue_params[i].mu_edca) { in iwl_mvm_set_fw_mu_edca_params()
2532 cpu_to_le16(mu_edca->ecw_min_max & 0xf); in iwl_mvm_set_fw_mu_edca_params()
2534 cpu_to_le16((mu_edca->ecw_min_max & 0xf0) >> 4); in iwl_mvm_set_fw_mu_edca_params()
2536 cpu_to_le16(mu_edca->aifsn & 0xf); in iwl_mvm_set_fw_mu_edca_params()
2538 cpu_to_le16(mu_edca->mu_edca_timer); in iwl_mvm_set_fw_mu_edca_params()
2552 sband = mvm->hw->wiphy->bands[NL80211_BAND_2GHZ]; in iwl_mvm_is_nic_ack_enabled()
2555 return (own_he_cap && (own_he_cap->he_cap_elem.mac_cap_info[2] & in iwl_mvm_is_nic_ack_enabled()
2563 &link_sta->he_cap.he_cap_elem.mac_cap_info[0]; in iwl_mvm_get_sta_htc_flags()
2599 .bss_color = vif->bss_conf.he_bss_color.color, in iwl_mvm_cfg_he_sta()
2600 .htc_trig_based_pkt_ext = vif->bss_conf.htc_trig_based_pkt_ext, in iwl_mvm_cfg_he_sta()
2602 cpu_to_le16(vif->bss_conf.frame_time_rts_th), in iwl_mvm_cfg_he_sta()
2606 u8 ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 2); in iwl_mvm_cfg_he_sta()
2613 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_MBSSID_HE)) in iwl_mvm_cfg_he_sta()
2637 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_ctxt_cmd.sta_id]); in iwl_mvm_cfg_he_sta()
2644 if (!sta->deflink.he_cap.has_he) { in iwl_mvm_cfg_he_sta()
2651 /* Block 26-tone RU OFDMA transmissions */ in iwl_mvm_cfg_he_sta()
2652 if (mvmvif->deflink.he_ru_2mhz_block) in iwl_mvm_cfg_he_sta()
2656 sta_ctxt_cmd.htc_flags = iwl_mvm_get_sta_htc_flags(sta, &sta->deflink); in iwl_mvm_cfg_he_sta()
2659 if (!iwl_mvm_set_sta_pkt_ext(mvm, &sta->deflink, &sta_ctxt_cmd.pkt_ext)) in iwl_mvm_cfg_he_sta()
2662 if (sta->deflink.he_cap.he_cap_elem.mac_cap_info[2] & in iwl_mvm_cfg_he_sta()
2666 if (sta->deflink.he_cap.he_cap_elem.mac_cap_info[2] & in iwl_mvm_cfg_he_sta()
2672 if (iwl_mvm_set_fw_mu_edca_params(mvm, &mvmvif->deflink, in iwl_mvm_cfg_he_sta()
2676 if (vif->bss_conf.uora_exists) { in iwl_mvm_cfg_he_sta()
2680 vif->bss_conf.uora_ocw_range & 0x7; in iwl_mvm_cfg_he_sta()
2682 (vif->bss_conf.uora_ocw_range >> 3) & 0x7; in iwl_mvm_cfg_he_sta()
2688 if (vif->bss_conf.nontransmitted) { in iwl_mvm_cfg_he_sta()
2691 vif->bss_conf.transmitter_bssid); in iwl_mvm_cfg_he_sta()
2693 vif->bss_conf.bssid_indicator; in iwl_mvm_cfg_he_sta()
2694 sta_ctxt_cmd.bssid_index = vif->bss_conf.bssid_index; in iwl_mvm_cfg_he_sta()
2695 sta_ctxt_cmd.ema_ap = vif->bss_conf.ema_ap; in iwl_mvm_cfg_he_sta()
2697 vif->bss_conf.profile_periodicity; in iwl_mvm_cfg_he_sta()
2728 BUILD_BUG_ON(sizeof(sta_ctxt_cmd) - in iwl_mvm_cfg_he_sta()
2730 sizeof(sta_ctxt_cmd_v2) - in iwl_mvm_cfg_he_sta()
2736 sizeof(sta_ctxt_cmd) - in iwl_mvm_cfg_he_sta()
2763 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_protect_assoc()
2773 /* Handle association common part to MLD and non-MLD modes */
2782 /* The firmware tracks the MU-MIMO group on its own. in iwl_mvm_bss_info_changed_station_assoc()
2785 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in iwl_mvm_bss_info_changed_station_assoc()
2786 (changes & BSS_CHANGED_MU_GROUPS) && vif->bss_conf.mu_mimo_owner) { in iwl_mvm_bss_info_changed_station_assoc()
2797 mvmvif->link[link_id]->bf_data.ave_beacon_signal = 0; in iwl_mvm_bss_info_changed_station_assoc()
2802 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_bss_info_changed_station_assoc()
2807 /* Execute the common part for MLD and non-MLD modes */
2839 mvmvif->link[link_conf->link_id]; in iwl_mvm_bss_info_changed_station_common()
2843 link_info->bf_data.last_cqm_event = 0; in iwl_mvm_bss_info_changed_station_common()
2845 if (mvmvif->bf_enabled) { in iwl_mvm_bss_info_changed_station_common()
2877 * Re-calculate the tsf id, as the leader-follower relations depend in iwl_mvm_bss_info_changed_station()
2881 if (changes & BSS_CHANGED_ASSOC && vif->cfg.assoc) { in iwl_mvm_bss_info_changed_station()
2882 if ((vif->bss_conf.he_support && in iwl_mvm_bss_info_changed_station()
2884 iwl_mvm_cfg_he_sta(mvm, vif, mvmvif->deflink.ap_sta_id); in iwl_mvm_bss_info_changed_station()
2890 if (changes & BSS_CHANGED_QOS && mvmvif->associated && in iwl_mvm_bss_info_changed_station()
2891 vif->cfg.assoc && in iwl_mvm_bss_info_changed_station()
2892 (vif->bss_conf.he_support && !iwlwifi_mod_params.disable_11ax)) in iwl_mvm_bss_info_changed_station()
2893 iwl_mvm_cfg_he_sta(mvm, vif, mvmvif->deflink.ap_sta_id); in iwl_mvm_bss_info_changed_station()
2901 if (changes & BSS_CHANGED_BSSID && !mvmvif->associated) in iwl_mvm_bss_info_changed_station()
2902 memcpy(mvmvif->deflink.bssid, bss_conf->bssid, ETH_ALEN); in iwl_mvm_bss_info_changed_station()
2904 ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false, mvmvif->deflink.bssid); in iwl_mvm_bss_info_changed_station()
2906 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); in iwl_mvm_bss_info_changed_station()
2909 memcpy(mvmvif->deflink.bssid, bss_conf->bssid, ETH_ALEN); in iwl_mvm_bss_info_changed_station()
2910 mvmvif->associated = vif->cfg.assoc; in iwl_mvm_bss_info_changed_station()
2913 if (vif->cfg.assoc) { in iwl_mvm_bss_info_changed_station()
2914 mvmvif->session_prot_connection_loss = false; in iwl_mvm_bss_info_changed_station()
2919 memset(&mvmvif->link[i]->beacon_stats, 0, in iwl_mvm_bss_info_changed_station()
2920 sizeof(mvmvif->link[i]->beacon_stats)); in iwl_mvm_bss_info_changed_station()
2930 &mvm->status) && in iwl_mvm_bss_info_changed_station()
2931 !fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_bss_info_changed_station()
2951 u32 dur = (11 * vif->bss_conf.beacon_int) / 10; in iwl_mvm_bss_info_changed_station()
2955 &mvm->status) && in iwl_mvm_bss_info_changed_station()
2956 !vif->bss_conf.dtim_period) { in iwl_mvm_bss_info_changed_station()
2972 if (vif->p2p) { in iwl_mvm_bss_info_changed_station()
2977 } else if (mvmvif->deflink.ap_sta_id != IWL_INVALID_STA) { in iwl_mvm_bss_info_changed_station()
2980 * If update fails - SF might be running in associated in iwl_mvm_bss_info_changed_station()
2981 * mode while disassociated - which is forbidden. in iwl_mvm_bss_info_changed_station()
2986 &mvm->status), in iwl_mvm_bss_info_changed_station()
2999 vif->addr); in iwl_mvm_bss_info_changed_station()
3005 iwl_mvm_bss_info_changed_station_common(mvm, vif, &vif->bss_conf, in iwl_mvm_bss_info_changed_station()
3017 lockdep_assert_held(&mvm->mutex); in iwl_mvm_start_ap_ibss_common()
3019 mvmvif->ap_assoc_sta_count = 0; in iwl_mvm_start_ap_ibss_common()
3022 mvmvif->ap_ibss_active = true; in iwl_mvm_start_ap_ibss_common()
3025 for (i = 0; i < ARRAY_SIZE(mvmvif->ap_early_keys); i++) { in iwl_mvm_start_ap_ibss_common()
3026 struct ieee80211_key_conf *key = mvmvif->ap_early_keys[i]; in iwl_mvm_start_ap_ibss_common()
3031 mvmvif->ap_early_keys[i] = NULL; in iwl_mvm_start_ap_ibss_common()
3038 if (vif->type == NL80211_IFTYPE_AP && !vif->p2p) { in iwl_mvm_start_ap_ibss_common()
3041 iwl_mvm_send_low_latency_cmd(mvm, true, mvmvif->id); in iwl_mvm_start_ap_ibss_common()
3058 mutex_lock(&mvm->mutex); in iwl_mvm_start_ap_ibss()
3061 * Re-calculate the tsf id, as the leader-follower relations depend on in iwl_mvm_start_ap_ibss()
3065 if (vif->type == NL80211_IFTYPE_AP) in iwl_mvm_start_ap_ibss()
3072 if (mvm->trans->mac_cfg->device_family > IWL_DEVICE_FAMILY_22000) { in iwl_mvm_start_ap_ibss()
3106 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) { in iwl_mvm_start_ap_ibss()
3142 if (vif->p2p && mvm->p2p_device_vif) in iwl_mvm_start_ap_ibss()
3143 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false, NULL); in iwl_mvm_start_ap_ibss()
3151 iwl_mvm_ftm_restart_responder(mvm, vif, &vif->bss_conf); in iwl_mvm_start_ap_ibss()
3157 mvmvif->ap_ibss_active = false; in iwl_mvm_start_ap_ibss()
3165 mutex_unlock(&mvm->mutex); in iwl_mvm_start_ap_ibss()
3179 return iwl_mvm_start_ap_ibss(hw, vif, &vif->bss_conf); in iwl_mvm_start_ibss()
3182 /* Common part for MLD and non-MLD ops */
3188 lockdep_assert_held(&mvm->mutex); in iwl_mvm_stop_ap_ibss_common()
3193 if (rcu_access_pointer(mvm->csa_vif) == vif) { in iwl_mvm_stop_ap_ibss_common()
3195 &mvmvif->time_event_data); in iwl_mvm_stop_ap_ibss_common()
3196 RCU_INIT_POINTER(mvm->csa_vif, NULL); in iwl_mvm_stop_ap_ibss_common()
3197 mvmvif->csa_countdown = false; in iwl_mvm_stop_ap_ibss_common()
3200 if (rcu_access_pointer(mvm->csa_tx_blocked_vif) == vif) { in iwl_mvm_stop_ap_ibss_common()
3201 RCU_INIT_POINTER(mvm->csa_tx_blocked_vif, NULL); in iwl_mvm_stop_ap_ibss_common()
3202 mvm->csa_tx_block_bcn_timeout = 0; in iwl_mvm_stop_ap_ibss_common()
3205 mvmvif->ap_ibss_active = false; in iwl_mvm_stop_ap_ibss_common()
3206 mvm->ap_last_beacon_gp2 = 0; in iwl_mvm_stop_ap_ibss_common()
3208 if (vif->type == NL80211_IFTYPE_AP && !vif->p2p) { in iwl_mvm_stop_ap_ibss_common()
3211 iwl_mvm_send_low_latency_cmd(mvm, false, mvmvif->id); in iwl_mvm_stop_ap_ibss_common()
3228 if (vif->p2p && mvm->p2p_device_vif) in iwl_mvm_stop_ap_ibss()
3229 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false, NULL); in iwl_mvm_stop_ap_ibss()
3243 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) in iwl_mvm_stop_ap_ibss()
3246 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) in iwl_mvm_stop_ap_ibss()
3265 iwl_mvm_stop_ap_ibss(hw, vif, &vif->bss_conf); in iwl_mvm_stop_ibss()
3277 if (!mvmvif->ap_ibss_active) in iwl_mvm_bss_info_changed_ap_ibss()
3283 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); in iwl_mvm_bss_info_changed_ap_ibss()
3287 iwl_mvm_mac_ctxt_beacon_changed(mvm, vif, &vif->bss_conf)) in iwl_mvm_bss_info_changed_ap_ibss()
3291 int ret = iwl_mvm_ftm_start_responder(mvm, vif, &vif->bss_conf); in iwl_mvm_bss_info_changed_ap_ibss()
3309 if (changes & BSS_CHANGED_IDLE && !vif->cfg.idle) in iwl_mvm_bss_info_changed()
3312 switch (vif->type) { in iwl_mvm_bss_info_changed()
3331 bss_conf->txpower); in iwl_mvm_bss_info_changed()
3332 iwl_mvm_set_tx_power(mvm, bss_conf, bss_conf->txpower); in iwl_mvm_bss_info_changed()
3341 if (hw_req->req.n_channels == 0 || in iwl_mvm_mac_hw_scan()
3342 hw_req->req.n_channels > mvm->fw->ucode_capa.n_scan_channels) in iwl_mvm_mac_hw_scan()
3343 return -EINVAL; in iwl_mvm_mac_hw_scan()
3346 return iwl_mvm_reg_scan_start(mvm, vif, &hw_req->req, &hw_req->ies); in iwl_mvm_mac_hw_scan()
3363 if (mvm->scan_status & IWL_MVM_SCAN_REGULAR) in iwl_mvm_mac_cancel_hw_scan()
3407 * If we have TVQM then we get too high queue numbers - luckily in __iwl_mvm_mac_sta_notify()
3414 spin_lock_bh(&mvmsta->lock); in __iwl_mvm_mac_sta_notify()
3415 for (tid = 0; tid < ARRAY_SIZE(mvmsta->tid_data); tid++) { in __iwl_mvm_mac_sta_notify()
3416 struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; in __iwl_mvm_mac_sta_notify()
3418 if (tid_data->txq_id == IWL_MVM_INVALID_QUEUE) in __iwl_mvm_mac_sta_notify()
3421 __set_bit(tid_data->txq_id, &txqs); in __iwl_mvm_mac_sta_notify()
3435 iwl_trans_freeze_txq_timer(mvm->trans, txqs, true); in __iwl_mvm_mac_sta_notify()
3443 if (WARN_ON(mvmsta->deflink.sta_id == IWL_INVALID_STA)) in __iwl_mvm_mac_sta_notify()
3447 iwl_trans_freeze_txq_timer(mvm->trans, txqs, false); in __iwl_mvm_mac_sta_notify()
3453 spin_unlock_bh(&mvmsta->lock); in __iwl_mvm_mac_sta_notify()
3465 struct iwl_mvm_pm_state_notification *notif = (void *)pkt->data; in iwl_mvm_sta_pm_notif()
3468 bool sleeping = (notif->type != IWL_MVM_PM_EVENT_AWAKE); in iwl_mvm_sta_pm_notif()
3470 if (WARN_ON(notif->sta_id >= mvm->fw->ucode_capa.num_stations)) in iwl_mvm_sta_pm_notif()
3474 sta = rcu_dereference(mvm->fw_id_to_mac_id[notif->sta_id]); in iwl_mvm_sta_pm_notif()
3482 if (!mvmsta->vif || in iwl_mvm_sta_pm_notif()
3483 mvmsta->vif->type != NL80211_IFTYPE_AP) { in iwl_mvm_sta_pm_notif()
3488 if (mvmsta->sleeping != sleeping) { in iwl_mvm_sta_pm_notif()
3489 mvmsta->sleeping = sleeping; in iwl_mvm_sta_pm_notif()
3490 __iwl_mvm_mac_sta_notify(mvm->hw, in iwl_mvm_sta_pm_notif()
3497 switch (notif->type) { in iwl_mvm_sta_pm_notif()
3523 lockdep_assert_wiphy(mvm->hw->wiphy); in iwl_mvm_sta_pre_rcu_remove()
3527 * so here we already invalidate our internal RCU-protected in iwl_mvm_sta_pre_rcu_remove()
3532 * Since there's mvm->mutex here, no need to have RCU lock for in iwl_mvm_sta_pre_rcu_remove()
3533 * mvm_sta->link access. in iwl_mvm_sta_pre_rcu_remove()
3536 for (link_id = 0; link_id < ARRAY_SIZE(mvm_sta->link); link_id++) { in iwl_mvm_sta_pre_rcu_remove()
3540 if (!mvm_sta->link[link_id]) in iwl_mvm_sta_pre_rcu_remove()
3543 link_sta = rcu_dereference_protected(mvm_sta->link[link_id], in iwl_mvm_sta_pre_rcu_remove()
3544 lockdep_is_held(&mvm->mutex)); in iwl_mvm_sta_pre_rcu_remove()
3545 sta_id = link_sta->sta_id; in iwl_mvm_sta_pre_rcu_remove()
3546 if (sta == rcu_access_pointer(mvm->fw_id_to_mac_id[sta_id])) { in iwl_mvm_sta_pre_rcu_remove()
3547 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_sta_pre_rcu_remove()
3548 ERR_PTR(-ENOENT)); in iwl_mvm_sta_pre_rcu_remove()
3549 RCU_INIT_POINTER(mvm->fw_id_to_link_sta[sta_id], NULL); in iwl_mvm_sta_pre_rcu_remove()
3559 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in iwl_mvm_check_uapsd()
3562 mdata = &mvm->tcm.data[iwl_mvm_vif_from_mac80211(vif)->id]; in iwl_mvm_check_uapsd()
3563 ewma_rate_init(&mdata->uapsd_nonagg_detect.rate); in iwl_mvm_check_uapsd()
3564 mdata->opened_rx_ba_sessions = false; in iwl_mvm_check_uapsd()
3567 if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT)) in iwl_mvm_check_uapsd()
3570 if (vif->p2p && !iwl_mvm_is_p2p_scm_uapsd_supported(mvm)) { in iwl_mvm_check_uapsd()
3571 vif->driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; in iwl_mvm_check_uapsd()
3575 if (!vif->p2p && in iwl_mvm_check_uapsd()
3577 vif->driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; in iwl_mvm_check_uapsd()
3582 if (ether_addr_equal(mvm->uapsd_noagg_bssids[i].addr, bssid)) { in iwl_mvm_check_uapsd()
3583 vif->driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD; in iwl_mvm_check_uapsd()
3588 vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; in iwl_mvm_check_uapsd()
3599 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_tdls_check_trigger()
3604 tdls_trig = (void *)trig->data; in iwl_mvm_tdls_check_trigger()
3606 if (!(tdls_trig->action_bitmap & BIT(action))) in iwl_mvm_tdls_check_trigger()
3609 if (tdls_trig->peer_mode && in iwl_mvm_tdls_check_trigger()
3610 memcmp(tdls_trig->peer, peer_addr, ETH_ALEN) != 0) in iwl_mvm_tdls_check_trigger()
3613 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, in iwl_mvm_tdls_check_trigger()
3631 ies = rcu_dereference(bss->ies); in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3632 elem = cfg80211_find_elem(WLAN_EID_EXT_CAPABILITY, ies->data, in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3633 ies->len); in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3635 if (!elem || elem->datalen < 10 || in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3636 !(elem->data[10] & in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3638 data->tolerated = false; in iwl_mvm_check_he_obss_narrow_bw_ru_iter()
3654 if (WARN_ON_ONCE(!link_conf->chanreq.oper.chan || in iwl_mvm_check_he_obss_narrow_bw_ru()
3655 !mvmvif->link[link_id])) in iwl_mvm_check_he_obss_narrow_bw_ru()
3658 if (!(link_conf->chanreq.oper.chan->flags & IEEE80211_CHAN_RADAR)) { in iwl_mvm_check_he_obss_narrow_bw_ru()
3659 mvmvif->link[link_id]->he_ru_2mhz_block = false; in iwl_mvm_check_he_obss_narrow_bw_ru()
3663 cfg80211_bss_iter(hw->wiphy, &link_conf->chanreq.oper, in iwl_mvm_check_he_obss_narrow_bw_ru()
3669 * tolerate 26-tone RU UL OFDMA transmissions using HE TB PPDU. in iwl_mvm_check_he_obss_narrow_bw_ru()
3671 mvmvif->link[link_id]->he_ru_2mhz_block = !iter_data.tolerated; in iwl_mvm_check_he_obss_narrow_bw_ru()
3680 if (vif->type != NL80211_IFTYPE_STATION) in iwl_mvm_reset_cca_40mhz_workaround()
3683 if (!mvm->cca_40mhz_workaround) in iwl_mvm_reset_cca_40mhz_workaround()
3687 mvm->cca_40mhz_workaround--; in iwl_mvm_reset_cca_40mhz_workaround()
3688 if (mvm->cca_40mhz_workaround) in iwl_mvm_reset_cca_40mhz_workaround()
3691 sband = mvm->hw->wiphy->bands[NL80211_BAND_2GHZ]; in iwl_mvm_reset_cca_40mhz_workaround()
3693 sband->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; in iwl_mvm_reset_cca_40mhz_workaround()
3701 he->he_cap_elem.phy_cap_info[0] |= in iwl_mvm_reset_cca_40mhz_workaround()
3713 .ssid_len = vif->cfg.ssid_len, in iwl_mvm_mei_host_associated()
3716 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mei_host_associated()
3719 if (!mvm->mei_registered) in iwl_mvm_mei_host_associated()
3723 if (!vif->bss_conf.chanreq.oper.chan) in iwl_mvm_mei_host_associated()
3726 conn_info.channel = vif->bss_conf.chanreq.oper.chan->hw_value; in iwl_mvm_mei_host_associated()
3728 switch (mvm_sta->pairwise_cipher) { in iwl_mvm_mei_host_associated()
3749 switch (mvmvif->rekey_data.akm) { in iwl_mvm_mei_host_associated()
3769 memcpy(conn_info.ssid, vif->cfg.ssid, vif->cfg.ssid_len); in iwl_mvm_mei_host_associated()
3770 memcpy(conn_info.bssid, vif->bss_conf.bssid, ETH_ALEN); in iwl_mvm_mei_host_associated()
3819 if (!conf || !link_sta || !mvmvif->link[link_id]->phy_ctxt) in iwl_mvm_rs_rate_init_all_links()
3823 mvmvif->link[link_id]->phy_ctxt->channel->band); in iwl_mvm_rs_rate_init_all_links()
3834 /* Beacon interval check - firmware will crash if the beacon in iwl_mvm_vif_conf_from_sta()
3848 if (link_conf->beacon_int < IWL_MVM_MIN_BEACON_INTERVAL_TU) { in iwl_mvm_vif_conf_from_sta()
3851 link_conf->beacon_int, link_sta->addr); in iwl_mvm_vif_conf_from_sta()
3855 link_conf->he_support = link_sta->he_cap.has_he; in iwl_mvm_vif_conf_from_sta()
3874 if (!link_conf || !mvmvif->link[link_id]) in iwl_mvm_vif_set_he_support()
3877 link_conf->he_support = link_sta->he_cap.has_he; in iwl_mvm_vif_set_he_support()
3880 mvmvif->link[link_id]->he_ru_2mhz_block = false; in iwl_mvm_vif_set_he_support()
3881 if (link_sta->he_cap.has_he) in iwl_mvm_vif_set_he_support()
3900 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_state_notexist_to_none()
3902 if (vif->type == NL80211_IFTYPE_STATION && in iwl_mvm_sta_state_notexist_to_none()
3904 return -EINVAL; in iwl_mvm_sta_state_notexist_to_none()
3906 if (sta->tdls && in iwl_mvm_sta_state_notexist_to_none()
3907 (vif->p2p || in iwl_mvm_sta_state_notexist_to_none()
3911 return -EBUSY; in iwl_mvm_sta_state_notexist_to_none()
3914 ret = callbacks->add_sta(mvm, vif, sta); in iwl_mvm_sta_state_notexist_to_none()
3915 if (sta->tdls && ret == 0) { in iwl_mvm_sta_state_notexist_to_none()
3917 iwl_mvm_tdls_check_trigger(mvm, vif, sta->addr, in iwl_mvm_sta_state_notexist_to_none()
3925 link_sta->agg.max_rc_amsdu_len = 1; in iwl_mvm_sta_state_notexist_to_none()
3929 if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) in iwl_mvm_sta_state_notexist_to_none()
3930 mvmvif->ap_sta = sta; in iwl_mvm_sta_state_notexist_to_none()
3933 * Initialize the rates here already - this really tells in iwl_mvm_sta_state_notexist_to_none()
3960 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_state_auth_to_assoc()
3962 if (vif->type == NL80211_IFTYPE_AP) { in iwl_mvm_sta_state_auth_to_assoc()
3964 mvmvif->ap_assoc_sta_count++; in iwl_mvm_sta_state_auth_to_assoc()
3965 callbacks->mac_ctxt_changed(mvm, vif, false); in iwl_mvm_sta_state_auth_to_assoc()
3970 if (!mvm->mld_api_is_used && in iwl_mvm_sta_state_auth_to_assoc()
3971 (vif->bss_conf.he_support && in iwl_mvm_sta_state_auth_to_assoc()
3973 iwl_mvm_cfg_he_sta(mvm, vif, mvm_sta->deflink.sta_id); in iwl_mvm_sta_state_auth_to_assoc()
3974 } else if (vif->type == NL80211_IFTYPE_STATION) { in iwl_mvm_sta_state_auth_to_assoc()
3977 callbacks->mac_ctxt_changed(mvm, vif, false); in iwl_mvm_sta_state_auth_to_assoc()
3979 if (!mvm->mld_api_is_used) in iwl_mvm_sta_state_auth_to_assoc()
3987 return -EINVAL; in iwl_mvm_sta_state_auth_to_assoc()
3988 if (!mvmvif->link[link_id]) in iwl_mvm_sta_state_auth_to_assoc()
4001 return callbacks->update_sta(mvm, vif, sta); in iwl_mvm_sta_state_auth_to_assoc()
4013 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_state_assoc_to_authorized()
4019 if (sta->tdls) { in iwl_mvm_sta_state_assoc_to_authorized()
4020 iwl_mvm_tdls_check_trigger(mvm, vif, sta->addr, in iwl_mvm_sta_state_assoc_to_authorized()
4026 mvmvif->authorized = 1; in iwl_mvm_sta_state_assoc_to_authorized()
4028 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in iwl_mvm_sta_state_assoc_to_authorized()
4029 mvmvif->link_selection_res = vif->active_links; in iwl_mvm_sta_state_assoc_to_authorized()
4030 mvmvif->link_selection_primary = in iwl_mvm_sta_state_assoc_to_authorized()
4031 vif->active_links ? __ffs(vif->active_links) : 0; in iwl_mvm_sta_state_assoc_to_authorized()
4034 callbacks->mac_ctxt_changed(mvm, vif, false); in iwl_mvm_sta_state_assoc_to_authorized()
4037 memset(&mvmvif->last_esr_exit, 0, in iwl_mvm_sta_state_assoc_to_authorized()
4038 sizeof(mvmvif->last_esr_exit)); in iwl_mvm_sta_state_assoc_to_authorized()
4048 if (vif->type == NL80211_IFTYPE_STATION && in iwl_mvm_sta_state_assoc_to_authorized()
4049 !test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_sta_state_assoc_to_authorized()
4053 mvm_sta->authorized = true; in iwl_mvm_sta_state_assoc_to_authorized()
4058 if (!sta->mfp) { in iwl_mvm_sta_state_assoc_to_authorized()
4059 int ret = callbacks->update_sta(mvm, vif, sta); in iwl_mvm_sta_state_assoc_to_authorized()
4079 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_state_authorized_to_assoc()
4081 mvmsta->authorized = false; in iwl_mvm_sta_state_authorized_to_assoc()
4088 if (!sta->tdls) { in iwl_mvm_sta_state_authorized_to_assoc()
4093 mvmvif->authorized = 0; in iwl_mvm_sta_state_authorized_to_assoc()
4094 mvmvif->link_selection_res = 0; in iwl_mvm_sta_state_authorized_to_assoc()
4099 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_sta_state_authorized_to_assoc()
4100 &mvmvif->prevent_esr_done_wk); in iwl_mvm_sta_state_authorized_to_assoc()
4102 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_sta_state_authorized_to_assoc()
4103 &mvmvif->mlo_int_scan_wk); in iwl_mvm_sta_state_authorized_to_assoc()
4105 wiphy_work_cancel(mvm->hw->wiphy, &mvmvif->unblock_esr_tpt_wk); in iwl_mvm_sta_state_authorized_to_assoc()
4106 wiphy_delayed_work_cancel(mvm->hw->wiphy, in iwl_mvm_sta_state_authorized_to_assoc()
4107 &mvmvif->unblock_esr_tmp_non_bss_wk); in iwl_mvm_sta_state_authorized_to_assoc()
4119 iwl_fw_lookup_cmd_ver(mvm->fw, MAC_PM_POWER_TABLE, 0) >= 2) in iwl_mvm_smps_workaround()
4122 mvmvif->ps_disabled = !vif->cfg.ps; in iwl_mvm_smps_workaround()
4128 /* Common part for MLD and non-MLD modes */
4143 IWL_DEBUG_MAC80211(mvm, "station %pM state change %d->%d\n", in iwl_mvm_mac_sta_state_common()
4144 sta->addr, old_state, new_state); in iwl_mvm_mac_sta_state_common()
4156 * Drop any still-queued deferred-frame before removing the STA, and in iwl_mvm_mac_sta_state_common()
4161 flush_work(&mvm->add_stream_wk); in iwl_mvm_mac_sta_state_common()
4175 kfree(mvm_sta->dup_data); in iwl_mvm_mac_sta_state_common()
4178 mutex_lock(&mvm->mutex); in iwl_mvm_mac_sta_state_common()
4186 if (WARN_ON_ONCE(!mvmvif->link[link_id] || in iwl_mvm_mac_sta_state_common()
4187 !mvmvif->link[link_id]->phy_ctxt)) { in iwl_mvm_mac_sta_state_common()
4188 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sta_state_common()
4190 &mvm->status) ? 0 : -EINVAL; in iwl_mvm_mac_sta_state_common()
4195 mvm_sta->sta_state = new_state; in iwl_mvm_mac_sta_state_common()
4209 mvm->last_ebs_successful = true; in iwl_mvm_mac_sta_state_common()
4210 iwl_mvm_check_uapsd(mvm, vif, sta->addr); in iwl_mvm_mac_sta_state_common()
4227 if (vif->type == NL80211_IFTYPE_AP) { in iwl_mvm_mac_sta_state_common()
4228 mvmvif->ap_assoc_sta_count--; in iwl_mvm_mac_sta_state_common()
4229 callbacks->mac_ctxt_changed(mvm, vif, false); in iwl_mvm_mac_sta_state_common()
4230 } else if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) in iwl_mvm_mac_sta_state_common()
4238 if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) { in iwl_mvm_mac_sta_state_common()
4240 mvmvif->ap_sta = NULL; in iwl_mvm_mac_sta_state_common()
4242 ret = callbacks->rm_sta(mvm, vif, sta); in iwl_mvm_mac_sta_state_common()
4243 if (sta->tdls) { in iwl_mvm_mac_sta_state_common()
4245 iwl_mvm_tdls_check_trigger(mvm, vif, sta->addr, in iwl_mvm_mac_sta_state_common()
4251 &mvm->status))) in iwl_mvm_mac_sta_state_common()
4254 ret = -EIO; in iwl_mvm_mac_sta_state_common()
4257 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sta_state_common()
4259 if (sta->tdls && ret == 0) { in iwl_mvm_mac_sta_state_common()
4276 mvm->rts_threshold = value; in iwl_mvm_mac_set_rts_threshold()
4284 struct ieee80211_sta *sta = link_sta->sta; in iwl_mvm_sta_rc_update()
4292 if (vif->type == NL80211_IFTYPE_STATION && in iwl_mvm_sta_rc_update()
4305 mvmvif->deflink.queue_params[ac] = *params; in iwl_mvm_mac_conf_tx()
4311 if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { in iwl_mvm_mac_conf_tx()
4325 if (info->was_assoc && !mvmvif->session_prot_connection_loss) in iwl_mvm_mac_mgd_prepare_tx()
4329 iwl_mvm_protect_assoc(mvm, vif, info->duration, info->link_id); in iwl_mvm_mac_mgd_prepare_tx()
4339 if (info->success) in iwl_mvm_mac_mgd_complete_tx()
4355 if (!vif->cfg.idle) in iwl_mvm_mac_sched_scan_start()
4356 return -EBUSY; in iwl_mvm_mac_sched_scan_start()
4367 mutex_lock(&mvm->mutex); in iwl_mvm_mac_sched_scan_stop()
4377 if (!(mvm->scan_status & IWL_MVM_SCAN_SCHED)) { in iwl_mvm_mac_sched_scan_stop()
4378 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sched_scan_stop()
4383 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sched_scan_stop()
4399 int keyidx = key->keyidx; in __iwl_mvm_mac_set_key()
4401 u8 sec_key_ver = iwl_fw_lookup_cmd_ver(mvm->fw, sec_key_id, 0); in __iwl_mvm_mac_set_key()
4408 switch (key->cipher) { in __iwl_mvm_mac_set_key()
4410 if (!mvm->trans->mac_cfg->gen2) { in __iwl_mvm_mac_set_key()
4411 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; in __iwl_mvm_mac_set_key()
4412 key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE; in __iwl_mvm_mac_set_key()
4413 } else if (vif->type == NL80211_IFTYPE_STATION) { in __iwl_mvm_mac_set_key()
4414 key->flags |= IEEE80211_KEY_FLAG_PUT_MIC_SPACE; in __iwl_mvm_mac_set_key()
4417 return -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4424 key->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE; in __iwl_mvm_mac_set_key()
4433 if (vif->type == NL80211_IFTYPE_STATION) in __iwl_mvm_mac_set_key()
4436 return -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4440 return -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4445 if (vif->type == NL80211_IFTYPE_STATION && in __iwl_mvm_mac_set_key()
4447 rcu_assign_pointer(mvmvif->bcn_prot.keys[keyidx - 6], in __iwl_mvm_mac_set_key()
4450 if ((vif->type == NL80211_IFTYPE_ADHOC || in __iwl_mvm_mac_set_key()
4451 vif->type == NL80211_IFTYPE_AP) && !sta) { in __iwl_mvm_mac_set_key()
4453 * GTK on AP interface is a TX-only key, return 0; in __iwl_mvm_mac_set_key()
4454 * on IBSS they're per-station and because we're lazy in __iwl_mvm_mac_set_key()
4459 * Except, of course, beacon protection - it must be in __iwl_mvm_mac_set_key()
4464 * So just check for beacon protection - if we don't in __iwl_mvm_mac_set_key()
4469 if (!wiphy_ext_feature_isset(hw->wiphy, in __iwl_mvm_mac_set_key()
4471 (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC || in __iwl_mvm_mac_set_key()
4472 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || in __iwl_mvm_mac_set_key()
4473 key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256)) { in __iwl_mvm_mac_set_key()
4474 ret = -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4478 if (key->cipher != WLAN_CIPHER_SUITE_GCMP && in __iwl_mvm_mac_set_key()
4479 key->cipher != WLAN_CIPHER_SUITE_GCMP_256 && in __iwl_mvm_mac_set_key()
4481 key->hw_key_idx = STA_KEY_IDX_INVALID; in __iwl_mvm_mac_set_key()
4486 if (!mvmvif->ap_ibss_active) { in __iwl_mvm_mac_set_key()
4488 i < ARRAY_SIZE(mvmvif->ap_early_keys); in __iwl_mvm_mac_set_key()
4490 if (!mvmvif->ap_early_keys[i]) { in __iwl_mvm_mac_set_key()
4491 mvmvif->ap_early_keys[i] = key; in __iwl_mvm_mac_set_key()
4496 if (i >= ARRAY_SIZE(mvmvif->ap_early_keys)) in __iwl_mvm_mac_set_key()
4497 ret = -ENOSPC; in __iwl_mvm_mac_set_key()
4508 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in __iwl_mvm_mac_set_key()
4509 key->hw_key_idx == STA_KEY_IDX_INVALID) { in __iwl_mvm_mac_set_key()
4516 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in __iwl_mvm_mac_set_key()
4518 key->flags & IEEE80211_KEY_FLAG_PAIRWISE && in __iwl_mvm_mac_set_key()
4519 (key->cipher == WLAN_CIPHER_SUITE_CCMP || in __iwl_mvm_mac_set_key()
4520 key->cipher == WLAN_CIPHER_SUITE_GCMP || in __iwl_mvm_mac_set_key()
4521 key->cipher == WLAN_CIPHER_SUITE_GCMP_256)) { in __iwl_mvm_mac_set_key()
4522 struct ieee80211_key_seq seq; in __iwl_mvm_mac_set_key() local
4525 WARN_ON(rcu_access_pointer(mvmsta->ptk_pn[keyidx])); in __iwl_mvm_mac_set_key()
4527 mvm->trans->info.num_rxqs), in __iwl_mvm_mac_set_key()
4530 ret = -ENOMEM; in __iwl_mvm_mac_set_key()
4535 ieee80211_get_key_rx_seq(key, tid, &seq); in __iwl_mvm_mac_set_key()
4536 for (q = 0; q < mvm->trans->info.num_rxqs; q++) in __iwl_mvm_mac_set_key()
4537 memcpy(ptk_pn->q[q].pn[tid], in __iwl_mvm_mac_set_key()
4538 seq.ccmp.pn, in __iwl_mvm_mac_set_key()
4542 rcu_assign_pointer(mvmsta->ptk_pn[keyidx], ptk_pn); in __iwl_mvm_mac_set_key()
4546 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in __iwl_mvm_mac_set_key()
4547 key_offset = key->hw_key_idx; in __iwl_mvm_mac_set_key()
4551 if (mvmsta && key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in __iwl_mvm_mac_set_key()
4552 mvmsta->pairwise_cipher = key->cipher; in __iwl_mvm_mac_set_key()
4555 sta ? sta->addr : NULL, key->keyidx); in __iwl_mvm_mac_set_key()
4564 key->hw_key_idx = STA_KEY_IDX_INVALID; in __iwl_mvm_mac_set_key()
4566 RCU_INIT_POINTER(mvmsta->ptk_pn[keyidx], NULL); in __iwl_mvm_mac_set_key()
4576 ret = -EOPNOTSUPP; in __iwl_mvm_mac_set_key()
4583 if (vif->type == NL80211_IFTYPE_STATION && in __iwl_mvm_mac_set_key()
4585 RCU_INIT_POINTER(mvmvif->bcn_prot.keys[keyidx - 6], in __iwl_mvm_mac_set_key()
4588 ret = -ENOENT; in __iwl_mvm_mac_set_key()
4589 for (i = 0; i < ARRAY_SIZE(mvmvif->ap_early_keys); i++) { in __iwl_mvm_mac_set_key()
4590 if (mvmvif->ap_early_keys[i] == key) { in __iwl_mvm_mac_set_key()
4591 mvmvif->ap_early_keys[i] = NULL; in __iwl_mvm_mac_set_key()
4596 /* found in pending list - don't do anything else */ in __iwl_mvm_mac_set_key()
4600 if (key->hw_key_idx == STA_KEY_IDX_INVALID) { in __iwl_mvm_mac_set_key()
4606 key->flags & IEEE80211_KEY_FLAG_PAIRWISE && in __iwl_mvm_mac_set_key()
4607 (key->cipher == WLAN_CIPHER_SUITE_CCMP || in __iwl_mvm_mac_set_key()
4608 key->cipher == WLAN_CIPHER_SUITE_GCMP || in __iwl_mvm_mac_set_key()
4609 key->cipher == WLAN_CIPHER_SUITE_GCMP_256)) { in __iwl_mvm_mac_set_key()
4611 mvmsta->ptk_pn[keyidx], in __iwl_mvm_mac_set_key()
4612 lockdep_is_held(&mvm->mutex)); in __iwl_mvm_mac_set_key()
4613 RCU_INIT_POINTER(mvmsta->ptk_pn[keyidx], NULL); in __iwl_mvm_mac_set_key()
4625 ret = -EINVAL; in __iwl_mvm_mac_set_key()
4638 if (test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status)) in iwl_mvm_mac_set_key()
4653 if (keyconf->hw_key_idx == STA_KEY_IDX_INVALID) in iwl_mvm_mac_update_tkip_key()
4669 if (WARN_ON(pkt->hdr.cmd != HOT_SPOT_CMD)) in iwl_mvm_rx_aux_roc()
4677 resp = (void *)pkt->data; in iwl_mvm_rx_aux_roc()
4681 resp->status, resp->event_unique_id); in iwl_mvm_rx_aux_roc()
4683 te_data->uid = le32_to_cpu(resp->event_unique_id); in iwl_mvm_rx_aux_roc()
4684 IWL_DEBUG_TE(mvm, "TIME_EVENT_CMD response - UID = 0x%x\n", in iwl_mvm_rx_aux_roc()
4685 te_data->uid); in iwl_mvm_rx_aux_roc()
4687 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_rx_aux_roc()
4688 list_add_tail(&te_data->list, &mvm->aux_roc_te_list); in iwl_mvm_rx_aux_roc()
4689 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_rx_aux_roc()
4701 struct iwl_mvm_time_event_data *te_data = &mvmvif->hs_time_event_data; in iwl_mvm_send_aux_roc_cmd()
4709 .sta_id_and_color = cpu_to_le32(mvm->aux_sta.sta_id), in iwl_mvm_send_aux_roc_cmd()
4713 u16 len = sizeof(aux_roc_req) - iwl_mvm_chan_info_padding(mvm); in iwl_mvm_send_aux_roc_cmd()
4716 iwl_mvm_set_chan_info(mvm, &aux_roc_req.channel_info, channel->hw_value, in iwl_mvm_send_aux_roc_cmd()
4717 iwl_mvm_phy_band_from_nl80211(channel->band), in iwl_mvm_send_aux_roc_cmd()
4722 tail->apply_time = cpu_to_le32(iwl_mvm_get_systime(mvm)); in iwl_mvm_send_aux_roc_cmd()
4725 tail->duration = cpu_to_le32(req_dur); in iwl_mvm_send_aux_roc_cmd()
4726 tail->apply_time_max_delay = cpu_to_le32(delay); in iwl_mvm_send_aux_roc_cmd()
4730 channel->hw_value, req_dur); in iwl_mvm_send_aux_roc_cmd()
4736 memcpy(tail->node_addr, vif->addr, ETH_ALEN); in iwl_mvm_send_aux_roc_cmd()
4738 lockdep_assert_held(&mvm->mutex); in iwl_mvm_send_aux_roc_cmd()
4740 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4742 if (WARN_ON(te_data->id == HOT_SPOT_CMD)) { in iwl_mvm_send_aux_roc_cmd()
4743 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4744 return -EIO; in iwl_mvm_send_aux_roc_cmd()
4747 te_data->vif = vif; in iwl_mvm_send_aux_roc_cmd()
4748 te_data->duration = duration; in iwl_mvm_send_aux_roc_cmd()
4749 te_data->id = HOT_SPOT_CMD; in iwl_mvm_send_aux_roc_cmd()
4751 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4762 iwl_init_notification_wait(&mvm->notif_wait, &wait_time_event, in iwl_mvm_send_aux_roc_cmd()
4772 iwl_remove_notification(&mvm->notif_wait, &wait_time_event); in iwl_mvm_send_aux_roc_cmd()
4777 res = iwl_wait_notification(&mvm->notif_wait, &wait_time_event, 1); in iwl_mvm_send_aux_roc_cmd()
4783 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4785 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
4795 lockdep_assert_held(&mvm->mutex); in iwl_mvm_add_aux_sta_for_hs20()
4797 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_add_aux_sta_for_hs20()
4800 return -EINVAL; in iwl_mvm_add_aux_sta_for_hs20()
4803 if (iwl_mvm_has_new_station_api(mvm->fw)) { in iwl_mvm_add_aux_sta_for_hs20()
4815 lockdep_assert_held(&mvm->mutex); in iwl_mvm_roc_link()
4848 u8 fw_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, in iwl_mvm_roc_station()
4857 ret = -EOPNOTSUPP; in iwl_mvm_roc_station()
4873 lockdep_assert_held(&mvm->mutex); in iwl_mvm_roc_p2p()
4884 return -EINVAL; in iwl_mvm_roc_p2p()
4888 iwl_mvm_get_lmac_id(mvm, channel->band)); in iwl_mvm_roc_p2p()
4903 lockdep_assert_held(&mvm->mutex); in iwl_mvm_p2p_find_phy_ctxt()
4905 if (mvmvif->deflink.phy_ctxt && in iwl_mvm_p2p_find_phy_ctxt()
4906 channel == mvmvif->deflink.phy_ctxt->channel) in iwl_mvm_p2p_find_phy_ctxt()
4911 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[i]; in iwl_mvm_p2p_find_phy_ctxt()
4913 if (!phy_ctxt->ref || mvmvif->deflink.phy_ctxt == phy_ctxt) in iwl_mvm_p2p_find_phy_ctxt()
4916 if (channel == phy_ctxt->channel) { in iwl_mvm_p2p_find_phy_ctxt()
4917 if (mvmvif->deflink.phy_ctxt) in iwl_mvm_p2p_find_phy_ctxt()
4919 mvmvif->deflink.phy_ctxt); in iwl_mvm_p2p_find_phy_ctxt()
4921 mvmvif->deflink.phy_ctxt = phy_ctxt; in iwl_mvm_p2p_find_phy_ctxt()
4922 iwl_mvm_phy_ctxt_ref(mvm, mvmvif->deflink.phy_ctxt); in iwl_mvm_p2p_find_phy_ctxt()
4928 if (mvmvif->deflink.phy_ctxt) in iwl_mvm_p2p_find_phy_ctxt()
4929 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->deflink.phy_ctxt); in iwl_mvm_p2p_find_phy_ctxt()
4931 mvmvif->deflink.phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm); in iwl_mvm_p2p_find_phy_ctxt()
4932 if (!mvmvif->deflink.phy_ctxt) in iwl_mvm_p2p_find_phy_ctxt()
4933 return -ENOSPC; in iwl_mvm_p2p_find_phy_ctxt()
4937 return iwl_mvm_phy_ctxt_add(mvm, mvmvif->deflink.phy_ctxt, in iwl_mvm_p2p_find_phy_ctxt()
4941 /* Execute the common part for MLD and non-MLD modes */
4952 IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value, in iwl_mvm_roc_common()
4959 flush_work(&mvm->roc_done_wk); in iwl_mvm_roc_common()
4970 switch (vif->type) { in iwl_mvm_roc_common()
4972 lmac_id = iwl_mvm_get_lmac_id(mvm, channel->band); in iwl_mvm_roc_common()
4975 ret = ops->add_aux_sta_for_hs20(mvm, lmac_id); in iwl_mvm_roc_common()
4983 IWL_ERR(mvm, "ROC: Invalid vif type=%u\n", vif->type); in iwl_mvm_roc_common()
4984 return -EINVAL; in iwl_mvm_roc_common()
4996 ret = ops->link(mvm, vif); in iwl_mvm_roc_common()
5030 if (rcu_access_pointer(link_conf->chanctx_conf) != data->ctx) in iwl_mvm_chanctx_usage_iter()
5033 if (iwl_mvm_enable_fils(data->mvm, vif, data->ctx)) in iwl_mvm_chanctx_usage_iter()
5034 data->use_def = true; in iwl_mvm_chanctx_usage_iter()
5036 if (vif->type == NL80211_IFTYPE_AP && link_conf->ftmr_params) in iwl_mvm_chanctx_usage_iter()
5037 data->use_def = true; in iwl_mvm_chanctx_usage_iter()
5050 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in iwl_mvm_chanctx_def()
5055 return data.use_def ? &ctx->def : &ctx->min_def; in iwl_mvm_chanctx_def()
5061 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; in __iwl_mvm_add_chanctx()
5066 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_add_chanctx()
5072 ret = -ENOSPC; in __iwl_mvm_add_chanctx()
5076 ret = iwl_mvm_phy_ctxt_add(mvm, phy_ctxt, def, &ctx->ap, in __iwl_mvm_add_chanctx()
5077 ctx->rx_chains_static, in __iwl_mvm_add_chanctx()
5078 ctx->rx_chains_dynamic); in __iwl_mvm_add_chanctx()
5084 *phy_ctxt_id = phy_ctxt->id; in __iwl_mvm_add_chanctx()
5101 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; in __iwl_mvm_remove_chanctx()
5102 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; in __iwl_mvm_remove_chanctx()
5104 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_remove_chanctx()
5122 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; in iwl_mvm_change_chanctx()
5123 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; in iwl_mvm_change_chanctx()
5126 if (WARN_ONCE((phy_ctxt->ref > 1) && in iwl_mvm_change_chanctx()
5132 phy_ctxt->ref, changed)) in iwl_mvm_change_chanctx()
5139 if (phy_ctxt->width == def->width) in iwl_mvm_change_chanctx()
5143 if (phy_ctxt->width <= NL80211_CHAN_WIDTH_20 && in iwl_mvm_change_chanctx()
5144 def->width <= NL80211_CHAN_WIDTH_20) in iwl_mvm_change_chanctx()
5149 iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, def, &ctx->ap, in iwl_mvm_change_chanctx()
5150 ctx->rx_chains_static, in iwl_mvm_change_chanctx()
5151 ctx->rx_chains_dynamic); in iwl_mvm_change_chanctx()
5155 * This function executes the common part for MLD and non-MLD modes.
5166 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; in __iwl_mvm_assign_vif_chanctx_common()
5167 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; in __iwl_mvm_assign_vif_chanctx_common()
5170 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_assign_vif_chanctx_common()
5172 mvmvif->deflink.phy_ctxt = phy_ctxt; in __iwl_mvm_assign_vif_chanctx_common()
5174 switch (vif->type) { in __iwl_mvm_assign_vif_chanctx_common()
5178 mvmvif->ap_ibss_active = true; in __iwl_mvm_assign_vif_chanctx_common()
5192 /* always disable PS when a monitor interface is active */ in __iwl_mvm_assign_vif_chanctx_common()
5193 mvmvif->ps_disabled = true; in __iwl_mvm_assign_vif_chanctx_common()
5196 *ret = -EINVAL; in __iwl_mvm_assign_vif_chanctx_common()
5212 return -EINVAL; in __iwl_mvm_assign_vif_chanctx()
5232 if (vif->type == NL80211_IFTYPE_MONITOR) { in __iwl_mvm_assign_vif_chanctx()
5233 mvmvif->monitor_active = true; in __iwl_mvm_assign_vif_chanctx()
5245 if (vif->type == NL80211_IFTYPE_AP) { in __iwl_mvm_assign_vif_chanctx()
5250 if (vif->type == NL80211_IFTYPE_STATION) { in __iwl_mvm_assign_vif_chanctx()
5252 mvmvif->csa_bcn_pending = false; in __iwl_mvm_assign_vif_chanctx()
5256 mvmvif->csa_bcn_pending = true; in __iwl_mvm_assign_vif_chanctx()
5258 if (!fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_assign_vif_chanctx()
5260 u32 duration = 5 * vif->bss_conf.beacon_int; in __iwl_mvm_assign_vif_chanctx()
5266 vif->bss_conf.beacon_int / 2, in __iwl_mvm_assign_vif_chanctx()
5284 mvmvif->deflink.phy_ctxt = NULL; in __iwl_mvm_assign_vif_chanctx()
5300 * This function executes the common part for MLD and non-MLD modes.
5311 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_unassign_vif_chanctx_common()
5313 &mvmvif->time_event_data); in __iwl_mvm_unassign_vif_chanctx_common()
5315 switch (vif->type) { in __iwl_mvm_unassign_vif_chanctx_common()
5319 mvmvif->monitor_active = false; in __iwl_mvm_unassign_vif_chanctx_common()
5320 mvmvif->ps_disabled = false; in __iwl_mvm_unassign_vif_chanctx_common()
5324 if (!switching_chanctx || !mvmvif->ap_ibss_active) in __iwl_mvm_unassign_vif_chanctx_common()
5327 mvmvif->csa_countdown = false; in __iwl_mvm_unassign_vif_chanctx_common()
5333 rcu_assign_pointer(mvm->csa_tx_blocked_vif, vif); in __iwl_mvm_unassign_vif_chanctx_common()
5335 mvmvif->ap_ibss_active = false; in __iwl_mvm_unassign_vif_chanctx_common()
5355 if (vif->type == NL80211_IFTYPE_MONITOR) in __iwl_mvm_unassign_vif_chanctx()
5359 if (vif->type == NL80211_IFTYPE_STATION && switching_chanctx) { in __iwl_mvm_unassign_vif_chanctx()
5361 if (!fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_unassign_vif_chanctx()
5370 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_CHANNEL_SWITCH_CMD) && in __iwl_mvm_unassign_vif_chanctx()
5373 mvmvif->deflink.phy_ctxt = NULL; in __iwl_mvm_unassign_vif_chanctx()
5396 ops->__unassign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_swap()
5406 ret = ops->__assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_swap()
5414 /* we don't support TDLS during DCM - can be caused by channel switch */ in iwl_mvm_switch_vif_chanctx_swap()
5429 if (ops->__assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_swap()
5439 iwl_force_nmi(mvm->trans); in iwl_mvm_switch_vif_chanctx_swap()
5451 ops->__unassign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_reassign()
5454 ret = ops->__assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_reassign()
5465 if (ops->__assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].link_conf, in iwl_mvm_switch_vif_chanctx_reassign()
5475 iwl_force_nmi(mvm->trans); in iwl_mvm_switch_vif_chanctx_reassign()
5479 /* Execute the common part for both MLD and non-MLD modes */
5490 /* we only support a single-vif right now */ in iwl_mvm_switch_vif_chanctx_common()
5492 return -EOPNOTSUPP; in iwl_mvm_switch_vif_chanctx_common()
5502 ret = -EOPNOTSUPP; in iwl_mvm_switch_vif_chanctx_common()
5526 return mvm->ibss_manager; in iwl_mvm_tx_last_beacon()
5535 if (!mvm_sta || !mvm_sta->vif) { in iwl_mvm_set_tim()
5537 return -EINVAL; in iwl_mvm_set_tim()
5540 return iwl_mvm_mac_ctxt_beacon_changed(mvm, mvm_sta->vif, in iwl_mvm_set_tim()
5541 &mvm_sta->vif->bss_conf); in iwl_mvm_set_tim()
5563 .mac_id = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, in iwl_mvm_schedule_client_csa()
5564 mvmvif->color)), in iwl_mvm_schedule_client_csa()
5566 .tsf = cpu_to_le32(chsw->timestamp), in iwl_mvm_schedule_client_csa()
5567 .cs_count = chsw->count, in iwl_mvm_schedule_client_csa()
5568 .cs_mode = chsw->block_tx, in iwl_mvm_schedule_client_csa()
5571 lockdep_assert_held(&mvm->mutex); in iwl_mvm_schedule_client_csa()
5573 if (chsw->delay) in iwl_mvm_schedule_client_csa()
5575 DIV_ROUND_UP(chsw->delay, vif->bss_conf.beacon_int); in iwl_mvm_schedule_client_csa()
5596 if (chsw->count <= 1) in iwl_mvm_old_pre_chan_sw_sta()
5599 apply_time = chsw->device_timestamp + in iwl_mvm_old_pre_chan_sw_sta()
5600 ((vif->bss_conf.beacon_int * (chsw->count - 1) - in iwl_mvm_old_pre_chan_sw_sta()
5603 if (chsw->block_tx) in iwl_mvm_old_pre_chan_sw_sta()
5606 if (mvmvif->bf_enabled) { in iwl_mvm_old_pre_chan_sw_sta()
5613 iwl_mvm_schedule_csa_period(mvm, vif, vif->bss_conf.beacon_int, in iwl_mvm_old_pre_chan_sw_sta()
5623 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) { in iwl_mvm_csa_block_txqs()
5625 iwl_mvm_txq_from_mac80211(sta->txq[i]); in iwl_mvm_csa_block_txqs()
5627 set_bit(IWL_MVM_TXQ_STATE_STOP_AP_CSA, &mvmtxq->state); in iwl_mvm_csa_block_txqs()
5641 lockdep_assert_held(&mvm->mutex); in iwl_mvm_pre_channel_switch()
5643 mvmvif->csa_failed = false; in iwl_mvm_pre_channel_switch()
5644 mvmvif->csa_blocks_tx = false; in iwl_mvm_pre_channel_switch()
5647 chsw->chandef.center_freq1); in iwl_mvm_pre_channel_switch()
5649 iwl_fw_dbg_trigger_simple_stop(&mvm->fwrt, in iwl_mvm_pre_channel_switch()
5653 switch (vif->type) { in iwl_mvm_pre_channel_switch()
5656 rcu_dereference_protected(mvm->csa_vif, in iwl_mvm_pre_channel_switch()
5657 lockdep_is_held(&mvm->mutex)); in iwl_mvm_pre_channel_switch()
5658 if (WARN_ONCE(csa_vif && csa_vif->bss_conf.csa_active, in iwl_mvm_pre_channel_switch()
5660 return -EBUSY; in iwl_mvm_pre_channel_switch()
5663 if (rcu_dereference_protected(mvm->csa_tx_blocked_vif, in iwl_mvm_pre_channel_switch()
5664 lockdep_is_held(&mvm->mutex))) in iwl_mvm_pre_channel_switch()
5665 return -EBUSY; in iwl_mvm_pre_channel_switch()
5667 rcu_assign_pointer(mvm->csa_vif, vif); in iwl_mvm_pre_channel_switch()
5669 if (WARN_ONCE(mvmvif->csa_countdown, in iwl_mvm_pre_channel_switch()
5671 return -EBUSY; in iwl_mvm_pre_channel_switch()
5673 mvmvif->csa_target_freq = chsw->chandef.chan->center_freq; in iwl_mvm_pre_channel_switch()
5675 if (!chsw->block_tx) in iwl_mvm_pre_channel_switch()
5677 /* don't need blocking in driver otherwise - mac80211 will do */ in iwl_mvm_pre_channel_switch()
5678 if (!ieee80211_hw_check(mvm->hw, HANDLES_QUIET_CSA)) in iwl_mvm_pre_channel_switch()
5681 mvmvif->csa_blocks_tx = true; in iwl_mvm_pre_channel_switch()
5682 mvmtxq = iwl_mvm_txq_from_mac80211(vif->txq); in iwl_mvm_pre_channel_switch()
5683 set_bit(IWL_MVM_TXQ_STATE_STOP_AP_CSA, &mvmtxq->state); in iwl_mvm_pre_channel_switch()
5684 ieee80211_iterate_stations_atomic(mvm->hw, in iwl_mvm_pre_channel_switch()
5689 mvmvif->csa_blocks_tx = chsw->block_tx; in iwl_mvm_pre_channel_switch()
5695 if (iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, in iwl_mvm_pre_channel_switch()
5705 if (!vif->cfg.assoc || !vif->bss_conf.dtim_period) in iwl_mvm_pre_channel_switch()
5706 return -EBUSY; in iwl_mvm_pre_channel_switch()
5708 if (chsw->delay > IWL_MAX_CSA_BLOCK_TX && in iwl_mvm_pre_channel_switch()
5709 hweight16(vif->valid_links) <= 1) in iwl_mvm_pre_channel_switch()
5710 schedule_delayed_work(&mvmvif->csa_work, 0); in iwl_mvm_pre_channel_switch()
5712 if (chsw->block_tx) { in iwl_mvm_pre_channel_switch()
5717 if (!chsw->count || in iwl_mvm_pre_channel_switch()
5718 chsw->count * vif->bss_conf.beacon_int > in iwl_mvm_pre_channel_switch()
5720 schedule_delayed_work(&mvmvif->csa_work, in iwl_mvm_pre_channel_switch()
5724 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_pre_channel_switch()
5733 mvmvif->csa_count = chsw->count; in iwl_mvm_pre_channel_switch()
5734 mvmvif->csa_misbehave = false; in iwl_mvm_pre_channel_switch()
5740 mvmvif->ps_disabled = true; in iwl_mvm_pre_channel_switch()
5769 .mac_id = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, in iwl_mvm_channel_switch_rx_beacon()
5770 mvmvif->color)), in iwl_mvm_channel_switch_rx_beacon()
5772 .tsf = cpu_to_le32(chsw->timestamp), in iwl_mvm_channel_switch_rx_beacon()
5773 .cs_count = chsw->count, in iwl_mvm_channel_switch_rx_beacon()
5774 .cs_mode = chsw->block_tx, in iwl_mvm_channel_switch_rx_beacon()
5781 if (iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, in iwl_mvm_channel_switch_rx_beacon()
5785 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_CS_MODIFY)) in iwl_mvm_channel_switch_rx_beacon()
5789 mvmvif->id, chsw->count, mvmvif->csa_count, chsw->block_tx); in iwl_mvm_channel_switch_rx_beacon()
5791 if (chsw->count >= mvmvif->csa_count && chsw->block_tx) { in iwl_mvm_channel_switch_rx_beacon()
5792 if (mvmvif->csa_misbehave) { in iwl_mvm_channel_switch_rx_beacon()
5797 link_conf = wiphy_dereference(hw->wiphy, in iwl_mvm_channel_switch_rx_beacon()
5798 vif->link_conf[chsw->link_id]); in iwl_mvm_channel_switch_rx_beacon()
5804 mvmvif->csa_misbehave = false; in iwl_mvm_channel_switch_rx_beacon()
5807 mvmvif->csa_misbehave = true; in iwl_mvm_channel_switch_rx_beacon()
5809 mvmvif->csa_count = chsw->count; in iwl_mvm_channel_switch_rx_beacon()
5812 if (mvmvif->csa_failed) in iwl_mvm_channel_switch_rx_beacon()
5828 &mvm->status)) in iwl_mvm_flush_no_vif()
5835 iwl_trans_wait_tx_queues_empty(mvm->trans, queues); in iwl_mvm_flush_no_vif()
5841 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { in iwl_mvm_flush_no_vif()
5844 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_flush_no_vif()
5845 lockdep_is_held(&mvm->mutex)); in iwl_mvm_flush_no_vif()
5873 if (!drop && hweight16(vif->active_links) <= 1) { in iwl_mvm_mac_flush()
5874 int link_id = vif->active_links ? __ffs(vif->active_links) : 0; in iwl_mvm_mac_flush()
5877 link_conf = wiphy_dereference(hw->wiphy, in iwl_mvm_mac_flush()
5878 vif->link_conf[link_id]); in iwl_mvm_mac_flush()
5881 if (link_conf->csa_active && mvmvif->csa_blocks_tx) in iwl_mvm_mac_flush()
5886 flush_work(&mvm->add_stream_wk); in iwl_mvm_mac_flush()
5888 mutex_lock(&mvm->mutex); in iwl_mvm_mac_flush()
5890 /* flush the AP-station and all TDLS peers */ in iwl_mvm_mac_flush()
5891 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { in iwl_mvm_mac_flush()
5892 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_mac_flush()
5893 lockdep_is_held(&mvm->mutex)); in iwl_mvm_mac_flush()
5898 if (mvmsta->vif != vif) in iwl_mvm_mac_flush()
5901 if (sta == mvmvif->ap_sta) { in iwl_mvm_mac_flush()
5908 if (iwl_mvm_flush_sta(mvm, mvmsta->deflink.sta_id, in iwl_mvm_mac_flush()
5909 mvmsta->tfd_queue_msk)) in iwl_mvm_mac_flush()
5915 msk |= mvmsta->tfd_queue_msk; in iwl_mvm_mac_flush()
5919 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_flush()
5927 &mvm->status)) in iwl_mvm_mac_flush()
5928 iwl_trans_wait_tx_queues_empty(mvm->trans, msk); in iwl_mvm_mac_flush()
5942 mvm_link_sta = rcu_dereference_protected(mvmsta->link[link_id], in iwl_mvm_mac_flush_sta()
5943 lockdep_is_held(&mvm->mutex)); in iwl_mvm_mac_flush_sta()
5947 if (iwl_mvm_flush_sta(mvm, mvm_link_sta->sta_id, in iwl_mvm_mac_flush_sta()
5948 mvmsta->tfd_queue_msk)) in iwl_mvm_mac_flush_sta()
5960 mutex_lock(&mvm->mutex); in iwl_mvm_mac_get_acs_survey()
5962 if (!mvm->acs_survey) { in iwl_mvm_mac_get_acs_survey()
5963 ret = -ENOENT; in iwl_mvm_mac_get_acs_survey()
5967 /* Find and return the next entry that has a non-zero active time */ in iwl_mvm_mac_get_acs_survey()
5970 mvm->hw->wiphy->bands[band]; in iwl_mvm_mac_get_acs_survey()
5975 for (chan_idx = 0; chan_idx < sband->n_channels; chan_idx++) { in iwl_mvm_mac_get_acs_survey()
5977 &mvm->acs_survey->bands[band][chan_idx]; in iwl_mvm_mac_get_acs_survey()
5979 if (!info->time) in iwl_mvm_mac_get_acs_survey()
5983 survey->channel = &sband->channels[chan_idx]; in iwl_mvm_mac_get_acs_survey()
5984 survey->filled = SURVEY_INFO_TIME | in iwl_mvm_mac_get_acs_survey()
5988 survey->time = info->time; in iwl_mvm_mac_get_acs_survey()
5989 survey->time_busy = info->time_busy; in iwl_mvm_mac_get_acs_survey()
5990 survey->time_rx = info->time_rx; in iwl_mvm_mac_get_acs_survey()
5991 survey->time_tx = info->time_tx; in iwl_mvm_mac_get_acs_survey()
5992 survey->noise = info->noise; in iwl_mvm_mac_get_acs_survey()
5993 if (survey->noise < 0) in iwl_mvm_mac_get_acs_survey()
5994 survey->filled |= SURVEY_INFO_NOISE_DBM; in iwl_mvm_mac_get_acs_survey()
5997 info->time = 0; in iwl_mvm_mac_get_acs_survey()
6004 ret = -ENOENT; in iwl_mvm_mac_get_acs_survey()
6007 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_get_acs_survey()
6016 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, in iwl_mvm_mac_get_survey()
6023 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_get_survey()
6025 return -ENOENT; in iwl_mvm_mac_get_survey()
6033 return iwl_mvm_mac_get_acs_survey(mvm, idx - 1, survey); in iwl_mvm_mac_get_survey()
6044 survey->filled = SURVEY_INFO_TIME_RX | in iwl_mvm_mac_get_survey()
6047 survey->time_rx = mvm->accu_radio_stats.rx_time + in iwl_mvm_mac_get_survey()
6048 mvm->radio_stats.rx_time; in iwl_mvm_mac_get_survey()
6049 do_div(survey->time_rx, USEC_PER_MSEC); in iwl_mvm_mac_get_survey()
6051 survey->time_tx = mvm->accu_radio_stats.tx_time + in iwl_mvm_mac_get_survey()
6052 mvm->radio_stats.tx_time; in iwl_mvm_mac_get_survey()
6053 do_div(survey->time_tx, USEC_PER_MSEC); in iwl_mvm_mac_get_survey()
6059 survey->filled |= SURVEY_INFO_TIME | in iwl_mvm_mac_get_survey()
6061 survey->time = mvm->accu_radio_stats.on_time_rf + in iwl_mvm_mac_get_survey()
6062 mvm->radio_stats.on_time_rf; in iwl_mvm_mac_get_survey()
6063 do_div(survey->time, USEC_PER_MSEC); in iwl_mvm_mac_get_survey()
6065 survey->time_scan = mvm->accu_radio_stats.on_time_scan + in iwl_mvm_mac_get_survey()
6066 mvm->radio_stats.on_time_scan; in iwl_mvm_mac_get_survey()
6067 do_div(survey->time_scan, USEC_PER_MSEC); in iwl_mvm_mac_get_survey()
6079 rinfo->bw = RATE_INFO_BW_20; in iwl_mvm_set_sta_rate()
6082 rinfo->bw = RATE_INFO_BW_40; in iwl_mvm_set_sta_rate()
6085 rinfo->bw = RATE_INFO_BW_80; in iwl_mvm_set_sta_rate()
6088 rinfo->bw = RATE_INFO_BW_160; in iwl_mvm_set_sta_rate()
6091 rinfo->bw = RATE_INFO_BW_320; in iwl_mvm_set_sta_rate()
6105 rinfo->legacy = 10; in iwl_mvm_set_sta_rate()
6108 rinfo->legacy = 20; in iwl_mvm_set_sta_rate()
6111 rinfo->legacy = 55; in iwl_mvm_set_sta_rate()
6114 rinfo->legacy = 110; in iwl_mvm_set_sta_rate()
6117 rinfo->legacy = 60; in iwl_mvm_set_sta_rate()
6120 rinfo->legacy = 90; in iwl_mvm_set_sta_rate()
6123 rinfo->legacy = 120; in iwl_mvm_set_sta_rate()
6126 rinfo->legacy = 180; in iwl_mvm_set_sta_rate()
6129 rinfo->legacy = 240; in iwl_mvm_set_sta_rate()
6132 rinfo->legacy = 360; in iwl_mvm_set_sta_rate()
6135 rinfo->legacy = 480; in iwl_mvm_set_sta_rate()
6138 rinfo->legacy = 540; in iwl_mvm_set_sta_rate()
6143 rinfo->nss = u32_get_bits(rate_n_flags, in iwl_mvm_set_sta_rate()
6145 rinfo->mcs = format == RATE_MCS_MOD_TYPE_HT ? in iwl_mvm_set_sta_rate()
6150 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; in iwl_mvm_set_sta_rate()
6155 rinfo->flags |= RATE_INFO_FLAGS_EHT_MCS; in iwl_mvm_set_sta_rate()
6160 rinfo->flags |= RATE_INFO_FLAGS_HE_MCS; in iwl_mvm_set_sta_rate()
6163 rinfo->bw = RATE_INFO_BW_HE_RU; in iwl_mvm_set_sta_rate()
6164 rinfo->he_ru_alloc = NL80211_RATE_INFO_HE_RU_ALLOC_106; in iwl_mvm_set_sta_rate()
6171 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_0_8; in iwl_mvm_set_sta_rate()
6173 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_1_6; in iwl_mvm_set_sta_rate()
6175 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_3_2; in iwl_mvm_set_sta_rate()
6177 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_0_8; in iwl_mvm_set_sta_rate()
6181 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_0_8; in iwl_mvm_set_sta_rate()
6183 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_1_6; in iwl_mvm_set_sta_rate()
6185 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_3_2; in iwl_mvm_set_sta_rate()
6189 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_1_6; in iwl_mvm_set_sta_rate()
6191 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_3_2; in iwl_mvm_set_sta_rate()
6196 rinfo->he_dcm = 1; in iwl_mvm_set_sta_rate()
6199 rinfo->flags |= RATE_INFO_FLAGS_MCS; in iwl_mvm_set_sta_rate()
6202 rinfo->flags |= RATE_INFO_FLAGS_VHT_MCS; in iwl_mvm_set_sta_rate()
6217 if (mvmsta->deflink.avg_energy) { in iwl_mvm_mac_sta_statistics()
6218 sinfo->signal_avg = -(s8)mvmsta->deflink.avg_energy; in iwl_mvm_mac_sta_statistics()
6219 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); in iwl_mvm_mac_sta_statistics()
6223 struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->deflink.lq_sta.rs_fw; in iwl_mvm_mac_sta_statistics()
6225 iwl_mvm_set_sta_rate(lq_sta->last_rate_n_flags, &sinfo->txrate); in iwl_mvm_mac_sta_statistics()
6226 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in iwl_mvm_mac_sta_statistics()
6230 if (!(vif->driver_flags & IEEE80211_VIF_BEACON_FILTER)) in iwl_mvm_mac_sta_statistics()
6233 if (!vif->cfg.assoc) in iwl_mvm_mac_sta_statistics()
6238 if (sta != mvmvif->ap_sta) in iwl_mvm_mac_sta_statistics()
6244 sinfo->rx_beacon = 0; in iwl_mvm_mac_sta_statistics()
6246 sinfo->rx_beacon += mvmvif->link[i]->beacon_stats.num_beacons + in iwl_mvm_mac_sta_statistics()
6247 mvmvif->link[i]->beacon_stats.accu_num_beacons; in iwl_mvm_mac_sta_statistics()
6249 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_RX); in iwl_mvm_mac_sta_statistics()
6250 if (mvmvif->deflink.beacon_stats.avg_signal) { in iwl_mvm_mac_sta_statistics()
6252 sinfo->rx_beacon_signal_avg = in iwl_mvm_mac_sta_statistics()
6253 mvmvif->deflink.beacon_stats.avg_signal; in iwl_mvm_mac_sta_statistics()
6254 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BEACON_SIGNAL_AVG); in iwl_mvm_mac_sta_statistics()
6262 if ((mlme->data == ASSOC_EVENT || mlme->data == AUTH_EVENT) && in iwl_mvm_event_mlme_callback_ini()
6263 (mlme->status == MLME_DENIED || mlme->status == MLME_TIMEOUT)) { in iwl_mvm_event_mlme_callback_ini()
6264 iwl_dbg_tlv_time_point(&mvm->fwrt, in iwl_mvm_event_mlme_callback_ini()
6270 if (mlme->data == DEAUTH_RX_EVENT || mlme->data == DEAUTH_TX_EVENT) { in iwl_mvm_event_mlme_callback_ini()
6271 iwl_dbg_tlv_time_point(&mvm->fwrt, in iwl_mvm_event_mlme_callback_ini()
6284 if ((trig_mlme->_cnt) && --(trig_mlme->_cnt)) \ in iwl_mvm_event_mlme_callback()
6286 iwl_fw_dbg_collect_trig(&(mvm)->fwrt, trig, _fmt); \ in iwl_mvm_event_mlme_callback()
6292 if (iwl_trans_dbg_ini_valid(mvm->trans)) { in iwl_mvm_event_mlme_callback()
6293 iwl_mvm_event_mlme_callback_ini(mvm, vif, &event->u.mlme); in iwl_mvm_event_mlme_callback()
6297 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_event_mlme_callback()
6302 trig_mlme = (void *)trig->data; in iwl_mvm_event_mlme_callback()
6304 if (event->u.mlme.data == ASSOC_EVENT) { in iwl_mvm_event_mlme_callback()
6305 if (event->u.mlme.status == MLME_DENIED) in iwl_mvm_event_mlme_callback()
6308 event->u.mlme.reason); in iwl_mvm_event_mlme_callback()
6309 else if (event->u.mlme.status == MLME_TIMEOUT) in iwl_mvm_event_mlme_callback()
6312 } else if (event->u.mlme.data == AUTH_EVENT) { in iwl_mvm_event_mlme_callback()
6313 if (event->u.mlme.status == MLME_DENIED) in iwl_mvm_event_mlme_callback()
6316 event->u.mlme.reason); in iwl_mvm_event_mlme_callback()
6317 else if (event->u.mlme.status == MLME_TIMEOUT) in iwl_mvm_event_mlme_callback()
6320 } else if (event->u.mlme.data == DEAUTH_RX_EVENT) { in iwl_mvm_event_mlme_callback()
6322 "DEAUTH RX %d", event->u.mlme.reason); in iwl_mvm_event_mlme_callback()
6323 } else if (event->u.mlme.data == DEAUTH_TX_EVENT) { in iwl_mvm_event_mlme_callback()
6325 "DEAUTH TX %d", event->u.mlme.reason); in iwl_mvm_event_mlme_callback()
6337 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_event_bar_rx_callback()
6342 ba_trig = (void *)trig->data; in iwl_mvm_event_bar_rx_callback()
6344 if (!(le16_to_cpu(ba_trig->rx_bar) & BIT(event->u.ba.tid))) in iwl_mvm_event_bar_rx_callback()
6347 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, in iwl_mvm_event_bar_rx_callback()
6349 event->u.ba.sta->addr, event->u.ba.tid, in iwl_mvm_event_bar_rx_callback()
6350 event->u.ba.ssn); in iwl_mvm_event_bar_rx_callback()
6359 switch (event->type) { in iwl_mvm_mac_event_callback()
6367 iwl_mvm_event_frame_timeout_callback(mvm, vif, event->u.ba.sta, in iwl_mvm_mac_event_callback()
6368 event->u.ba.tid); in iwl_mvm_mac_event_callback()
6384 (struct iwl_mvm_internal_rxq_notif *)cmd->payload; in iwl_mvm_sync_rx_queues_internal()
6395 cmd->rxq_mask = cpu_to_le32(BIT(mvm->trans->info.num_rxqs) - 1); in iwl_mvm_sync_rx_queues_internal()
6396 cmd->count = cpu_to_le32(sizeof(struct iwl_mvm_internal_rxq_notif) + in iwl_mvm_sync_rx_queues_internal()
6398 notif->type = type; in iwl_mvm_sync_rx_queues_internal()
6399 notif->sync = sync; in iwl_mvm_sync_rx_queues_internal()
6402 if (WARN_ON(cmd->count & cpu_to_le32(3))) in iwl_mvm_sync_rx_queues_internal()
6409 notif->cookie = mvm->queue_sync_cookie; in iwl_mvm_sync_rx_queues_internal()
6410 mvm->queue_sync_state = (1 << mvm->trans->info.num_rxqs) - 1; in iwl_mvm_sync_rx_queues_internal()
6420 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sync_rx_queues_internal()
6421 ret = wait_event_timeout(mvm->rx_sync_waitq, in iwl_mvm_sync_rx_queues_internal()
6422 READ_ONCE(mvm->queue_sync_state) == 0, in iwl_mvm_sync_rx_queues_internal()
6425 mvm->queue_sync_state, in iwl_mvm_sync_rx_queues_internal()
6426 mvm->queue_sync_cookie); in iwl_mvm_sync_rx_queues_internal()
6431 mvm->queue_sync_state = 0; in iwl_mvm_sync_rx_queues_internal()
6432 mvm->queue_sync_cookie++; in iwl_mvm_sync_rx_queues_internal()
6452 if (vif->p2p || vif->type != NL80211_IFTYPE_AP || in iwl_mvm_mac_get_ftm_responder_stats()
6453 !mvmvif->ap_ibss_active || !vif->bss_conf.ftm_responder) in iwl_mvm_mac_get_ftm_responder_stats()
6454 return -EINVAL; in iwl_mvm_mac_get_ftm_responder_stats()
6456 mutex_lock(&mvm->mutex); in iwl_mvm_mac_get_ftm_responder_stats()
6457 *stats = mvm->ftm_resp_stats; in iwl_mvm_mac_get_ftm_responder_stats()
6458 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_get_ftm_responder_stats()
6460 stats->filled = BIT(NL80211_FTM_STATS_SUCCESS_NUM) | in iwl_mvm_mac_get_ftm_responder_stats()
6493 u8 protocol = ip_hdr(skb)->protocol; in iwl_mvm_can_hw_csum()
6508 if (skb->protocol != htons(ETH_P_IP)) in iwl_mvm_mac_can_aggregate()
6525 if (!hwts->macaddr) in iwl_mvm_set_hw_timestamp()
6526 return -EOPNOTSUPP; in iwl_mvm_set_hw_timestamp()
6528 if (hwts->enable) in iwl_mvm_set_hw_timestamp()
6533 return iwl_mvm_time_sync_config(mvm, hwts->macaddr, protocols); in iwl_mvm_set_hw_timestamp()