Lines Matching refs:mvm

91 static void iwl_mvm_reset_phy_ctxts(struct iwl_mvm *mvm)  in iwl_mvm_reset_phy_ctxts()  argument
95 memset(mvm->phy_ctxts, 0, sizeof(mvm->phy_ctxts)); in iwl_mvm_reset_phy_ctxts()
97 mvm->phy_ctxts[i].id = i; in iwl_mvm_reset_phy_ctxts()
98 mvm->phy_ctxts[i].ref = 0; in iwl_mvm_reset_phy_ctxts()
109 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_get_regdomain() local
113 IWL_DEBUG_LAR(mvm, "Getting regdomain data for %s from FW\n", alpha2); in iwl_mvm_get_regdomain()
115 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_regdomain()
117 resp = iwl_mvm_update_mcc(mvm, alpha2, src_id); in iwl_mvm_get_regdomain()
119 IWL_DEBUG_LAR(mvm, "Could not get update from FW %d\n", in iwl_mvm_get_regdomain()
131 resp_ver = iwl_fw_lookup_notif_ver(mvm->fw, IWL_ALWAYS_LONG_GROUP, in iwl_mvm_get_regdomain()
133 IWL_DEBUG_LAR(mvm, "MCC update response version: %d\n", resp_ver); in iwl_mvm_get_regdomain()
135 regd = iwl_parse_nvm_mcc_info(mvm->trans->dev, mvm->cfg, in iwl_mvm_get_regdomain()
144 IWL_DEBUG_LAR(mvm, "Could not get parse update from FW %d\n", in iwl_mvm_get_regdomain()
149 IWL_DEBUG_LAR(mvm, "setting alpha2 from FW to %s (0x%x, 0x%x) src=%d\n", in iwl_mvm_get_regdomain()
151 mvm->lar_regdom_set = true; in iwl_mvm_get_regdomain()
152 mvm->mcc_src = src_id; in iwl_mvm_get_regdomain()
161 void iwl_mvm_update_changed_regdom(struct iwl_mvm *mvm) in iwl_mvm_update_changed_regdom() argument
166 if (!iwl_mvm_is_lar_supported(mvm)) in iwl_mvm_update_changed_regdom()
169 regd = iwl_mvm_get_current_regdomain(mvm, &changed); in iwl_mvm_update_changed_regdom()
173 regulatory_set_wiphy_regd(mvm->hw->wiphy, regd); in iwl_mvm_update_changed_regdom()
179 struct ieee80211_regdomain *iwl_mvm_get_current_regdomain(struct iwl_mvm *mvm, in iwl_mvm_get_current_regdomain() argument
182 return iwl_mvm_get_regdomain(mvm->hw->wiphy, "ZZ", in iwl_mvm_get_current_regdomain()
183 iwl_mvm_is_wifi_mcc_supported(mvm) ? in iwl_mvm_get_current_regdomain()
188 int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm) in iwl_mvm_init_fw_regd() argument
195 wiphy_dereference(mvm->hw->wiphy, mvm->hw->wiphy->regd); in iwl_mvm_init_fw_regd()
201 used_src = mvm->mcc_src; in iwl_mvm_init_fw_regd()
202 if (iwl_mvm_is_wifi_mcc_supported(mvm)) { in iwl_mvm_init_fw_regd()
204 regd = iwl_mvm_get_current_regdomain(mvm, NULL); in iwl_mvm_init_fw_regd()
210 regd = iwl_mvm_get_regdomain(mvm->hw->wiphy, r->alpha2, used_src, in iwl_mvm_init_fw_regd()
217 ret = regulatory_set_wiphy_regd_sync(mvm->hw->wiphy, regd); in iwl_mvm_init_fw_regd()
243 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_op_get_antenna() local
244 *tx_ant = iwl_mvm_get_valid_tx_ant(mvm); in iwl_mvm_op_get_antenna()
245 *rx_ant = iwl_mvm_get_valid_rx_ant(mvm); in iwl_mvm_op_get_antenna()
249 int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) in iwl_mvm_mac_setup_register() argument
251 struct ieee80211_hw *hw = mvm->hw; in iwl_mvm_mac_setup_register()
260 bool unified = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
294 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_9000) in iwl_mvm_mac_setup_register()
298 if (iwl_mvm_has_tlc_offload(mvm)) { in iwl_mvm_mac_setup_register()
303 if (iwl_mvm_has_new_rx_api(mvm)) in iwl_mvm_mac_setup_register()
306 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
309 } else if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) { in iwl_mvm_mac_setup_register()
318 if (mvm->trans->num_rx_queues > 1) in iwl_mvm_mac_setup_register()
321 if (mvm->trans->max_skb_frags) in iwl_mvm_mac_setup_register()
337 if (!iwl_mvm_has_tlc_offload(mvm)) in iwl_mvm_mac_setup_register()
342 hw->max_tx_fragments = mvm->trans->max_skb_frags; in iwl_mvm_mac_setup_register()
344 BUILD_BUG_ON(ARRAY_SIZE(mvm->ciphers) < ARRAY_SIZE(mvm_ciphers) + 6); in iwl_mvm_mac_setup_register()
345 memcpy(mvm->ciphers, mvm_ciphers, sizeof(mvm_ciphers)); in iwl_mvm_mac_setup_register()
347 hw->wiphy->cipher_suites = mvm->ciphers; in iwl_mvm_mac_setup_register()
349 if (iwl_mvm_has_new_rx_api(mvm)) { in iwl_mvm_mac_setup_register()
350 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
353 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
359 IWL_ERR(mvm, in iwl_mvm_mac_setup_register()
362 IWL_ERR(mvm, in iwl_mvm_mac_setup_register()
366 mvm->ciphers[hw->wiphy->n_cipher_suites] = WLAN_CIPHER_SUITE_AES_CMAC; in iwl_mvm_mac_setup_register()
368 if (iwl_mvm_has_new_rx_api(mvm)) { in iwl_mvm_mac_setup_register()
369 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
372 mvm->ciphers[hw->wiphy->n_cipher_suites] = in iwl_mvm_mac_setup_register()
377 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
384 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
414 if (!iwl_mvm_has_new_tx_api(mvm)) in iwl_mvm_mac_setup_register()
420 if (iwl_mvm_is_lar_supported(mvm)) in iwl_mvm_mac_setup_register()
438 memcpy(mvm->addresses[0].addr, mvm->nvm_data->hw_addr, ETH_ALEN); in iwl_mvm_mac_setup_register()
439 hw->wiphy->addresses = mvm->addresses; in iwl_mvm_mac_setup_register()
443 num_mac = (mvm->nvm_data->n_hw_addrs > 1) ? in iwl_mvm_mac_setup_register()
444 min(IWL_MVM_MAX_ADDRESSES, mvm->nvm_data->n_hw_addrs) : 1; in iwl_mvm_mac_setup_register()
447 memcpy(mvm->addresses[i].addr, mvm->addresses[i-1].addr, in iwl_mvm_mac_setup_register()
449 mvm->addresses[i].addr[5]++; in iwl_mvm_mac_setup_register()
453 iwl_mvm_reset_phy_ctxts(mvm); in iwl_mvm_mac_setup_register()
455 hw->wiphy->max_scan_ie_len = iwl_mvm_max_scan_ie_len(mvm); in iwl_mvm_mac_setup_register()
463 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) in iwl_mvm_mac_setup_register()
464 mvm->max_scans = IWL_MVM_MAX_UMAC_SCANS; in iwl_mvm_mac_setup_register()
466 mvm->max_scans = IWL_MVM_MAX_LMAC_SCANS; in iwl_mvm_mac_setup_register()
468 if (mvm->nvm_data->bands[NL80211_BAND_2GHZ].n_channels) in iwl_mvm_mac_setup_register()
470 &mvm->nvm_data->bands[NL80211_BAND_2GHZ]; in iwl_mvm_mac_setup_register()
471 if (mvm->nvm_data->bands[NL80211_BAND_5GHZ].n_channels) { in iwl_mvm_mac_setup_register()
473 &mvm->nvm_data->bands[NL80211_BAND_5GHZ]; in iwl_mvm_mac_setup_register()
475 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
477 fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
482 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
484 mvm->nvm_data->bands[NL80211_BAND_6GHZ].n_channels) in iwl_mvm_mac_setup_register()
486 &mvm->nvm_data->bands[NL80211_BAND_6GHZ]; in iwl_mvm_mac_setup_register()
488 hw->wiphy->hw_version = mvm->trans->hw_id; in iwl_mvm_mac_setup_register()
497 hw->wiphy->max_match_sets = iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_mac_setup_register()
518 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
521 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
525 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
530 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
534 if (iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_KEK_KCK_MATERIAL, in iwl_mvm_mac_setup_register()
538 if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
546 if (iwl_mvm_is_oce_supported(mvm)) { in iwl_mvm_mac_setup_register()
547 u8 scan_ver = iwl_fw_lookup_cmd_ver(mvm->fw, SCAN_REQ_UMAC, 0); in iwl_mvm_mac_setup_register()
562 if (mvm->nvm_data->sku_cap_11ax_enable && in iwl_mvm_mac_setup_register()
572 mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; in iwl_mvm_mac_setup_register()
575 if ((unified || mvm->fw->img[IWL_UCODE_WOWLAN].num_sec) && in iwl_mvm_mac_setup_register()
576 mvm->trans->ops->d3_suspend && in iwl_mvm_mac_setup_register()
577 mvm->trans->ops->d3_resume && in iwl_mvm_mac_setup_register()
578 device_can_wakeup(mvm->trans->dev)) { in iwl_mvm_mac_setup_register()
579 mvm->wowlan.flags |= WIPHY_WOWLAN_MAGIC_PKT | in iwl_mvm_mac_setup_register()
584 mvm->wowlan.flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | in iwl_mvm_mac_setup_register()
588 mvm->wowlan.n_patterns = IWL_WOWLAN_MAX_PATTERNS; in iwl_mvm_mac_setup_register()
589 mvm->wowlan.pattern_min_len = IWL_WOWLAN_MIN_PATTERN_LEN; in iwl_mvm_mac_setup_register()
590 mvm->wowlan.pattern_max_len = IWL_WOWLAN_MAX_PATTERN_LEN; in iwl_mvm_mac_setup_register()
591 mvm->wowlan.max_nd_match_sets = in iwl_mvm_mac_setup_register()
592 iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_mac_setup_register()
593 hw->wiphy->wowlan = &mvm->wowlan; in iwl_mvm_mac_setup_register()
597 ret = iwl_mvm_leds_init(mvm); in iwl_mvm_mac_setup_register()
601 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
603 IWL_DEBUG_TDLS(mvm, "TDLS supported\n"); in iwl_mvm_mac_setup_register()
608 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_setup_register()
610 IWL_DEBUG_TDLS(mvm, "TDLS channel switch supported\n"); in iwl_mvm_mac_setup_register()
614 hw->netdev_features |= mvm->cfg->features; in iwl_mvm_mac_setup_register()
615 if (!iwl_mvm_is_csum_supported(mvm)) in iwl_mvm_mac_setup_register()
618 if (mvm->cfg->vht_mu_mimo_supported) in iwl_mvm_mac_setup_register()
622 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_PROTECTED_TWT)) in iwl_mvm_mac_setup_register()
626 iwl_mvm_vendor_cmds_register(mvm); in iwl_mvm_mac_setup_register()
628 hw->wiphy->available_antennas_tx = iwl_mvm_get_valid_tx_ant(mvm); in iwl_mvm_mac_setup_register()
629 hw->wiphy->available_antennas_rx = iwl_mvm_get_valid_rx_ant(mvm); in iwl_mvm_mac_setup_register()
631 ret = ieee80211_register_hw(mvm->hw); in iwl_mvm_mac_setup_register()
633 iwl_mvm_leds_exit(mvm); in iwl_mvm_mac_setup_register()
639 static void iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb, in iwl_mvm_tx_skb() argument
643 if (likely(iwl_mvm_tx_skb_sta(mvm, skb, sta) == 0)) in iwl_mvm_tx_skb()
646 if (likely(iwl_mvm_tx_skb_non_sta(mvm, skb) == 0)) in iwl_mvm_tx_skb()
650 ieee80211_free_txskb(mvm->hw, skb); in iwl_mvm_tx_skb()
657 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_tx() local
664 if (iwl_mvm_is_radio_killed(mvm)) { in iwl_mvm_mac_tx()
665 IWL_DEBUG_DROP(mvm, "Dropping - RF/CT KILL\n"); in iwl_mvm_mac_tx()
670 !test_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status) && in iwl_mvm_mac_tx()
671 !test_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status)) in iwl_mvm_mac_tx()
688 if (ap_sta_id < mvm->fw->ucode_capa.num_stations) { in iwl_mvm_mac_tx()
690 sta = rcu_dereference(mvm->fw_id_to_mac_id[ap_sta_id]); in iwl_mvm_mac_tx()
696 iwl_mvm_tx_skb(mvm, skb, sta); in iwl_mvm_mac_tx()
704 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_itxq_xmit() local
733 !test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status))) { in iwl_mvm_mac_itxq_xmit()
738 IWL_DEBUG_TX(mvm, in iwl_mvm_mac_itxq_xmit()
745 iwl_mvm_tx_skb(mvm, skb, txq->sta); in iwl_mvm_mac_itxq_xmit()
754 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_wake_tx_queue() local
791 list_add_tail(&mvmtxq->list, &mvm->add_stream_txqs); in iwl_mvm_mac_wake_tx_queue()
792 schedule_work(&mvm->add_stream_wk); in iwl_mvm_mac_wake_tx_queue()
803 iwl_mvm_ampdu_check_trigger(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_ampdu_check_trigger() argument
810 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_ampdu_check_trigger()
822 CHECK_BA_TRIGGER(mvm, trig, ba_trig->tx_ba_start, tid, in iwl_mvm_ampdu_check_trigger()
828 CHECK_BA_TRIGGER(mvm, trig, ba_trig->tx_ba_stop, tid, in iwl_mvm_ampdu_check_trigger()
833 CHECK_BA_TRIGGER(mvm, trig, ba_trig->rx_ba_start, tid, in iwl_mvm_ampdu_check_trigger()
838 CHECK_BA_TRIGGER(mvm, trig, ba_trig->rx_ba_stop, tid, in iwl_mvm_ampdu_check_trigger()
851 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_ampdu_action() local
861 IWL_DEBUG_HT(mvm, "A-MPDU action on addr %pM tid %d: action %d\n", in iwl_mvm_mac_ampdu_action()
864 if (!(mvm->nvm_data->sku_cap_11n_enable)) in iwl_mvm_mac_ampdu_action()
867 mutex_lock(&mvm->mutex); in iwl_mvm_mac_ampdu_action()
875 struct iwl_mvm_tcm_mac *mdata = &mvm->tcm.data[macid]; in iwl_mvm_mac_ampdu_action()
885 ret = iwl_mvm_sta_rx_agg(mvm, sta, tid, *ssn, true, buf_size, in iwl_mvm_mac_ampdu_action()
889 ret = iwl_mvm_sta_rx_agg(mvm, sta, tid, 0, false, buf_size, in iwl_mvm_mac_ampdu_action()
897 ret = iwl_mvm_sta_tx_agg_start(mvm, vif, sta, tid, ssn); in iwl_mvm_mac_ampdu_action()
900 ret = iwl_mvm_sta_tx_agg_stop(mvm, vif, sta, tid); in iwl_mvm_mac_ampdu_action()
904 ret = iwl_mvm_sta_tx_agg_flush(mvm, vif, sta, tid); in iwl_mvm_mac_ampdu_action()
907 ret = iwl_mvm_sta_tx_agg_oper(mvm, vif, sta, tid, in iwl_mvm_mac_ampdu_action()
922 iwl_mvm_ampdu_check_trigger(mvm, vif, sta, tid, in iwl_mvm_mac_ampdu_action()
925 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_ampdu_action()
933 struct iwl_mvm *mvm = data; in iwl_mvm_cleanup_iterator() local
939 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_cleanup_iterator()
940 iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data); in iwl_mvm_cleanup_iterator()
941 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_cleanup_iterator()
948 static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) in iwl_mvm_restart_cleanup() argument
950 iwl_mvm_stop_device(mvm); in iwl_mvm_restart_cleanup()
952 mvm->cur_aid = 0; in iwl_mvm_restart_cleanup()
954 mvm->scan_status = 0; in iwl_mvm_restart_cleanup()
955 mvm->ps_disabled = false; in iwl_mvm_restart_cleanup()
956 mvm->rfkill_safe_init_done = false; in iwl_mvm_restart_cleanup()
959 iwl_mvm_cleanup_roc_te(mvm); in iwl_mvm_restart_cleanup()
960 ieee80211_remain_on_channel_expired(mvm->hw); in iwl_mvm_restart_cleanup()
962 iwl_mvm_ftm_restart(mvm); in iwl_mvm_restart_cleanup()
968 ieee80211_iterate_interfaces(mvm->hw, 0, iwl_mvm_cleanup_iterator, mvm); in iwl_mvm_restart_cleanup()
970 mvm->p2p_device_vif = NULL; in iwl_mvm_restart_cleanup()
972 iwl_mvm_reset_phy_ctxts(mvm); in iwl_mvm_restart_cleanup()
973 memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table)); in iwl_mvm_restart_cleanup()
974 memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif)); in iwl_mvm_restart_cleanup()
975 memset(&mvm->last_bt_ci_cmd, 0, sizeof(mvm->last_bt_ci_cmd)); in iwl_mvm_restart_cleanup()
977 ieee80211_wake_queues(mvm->hw); in iwl_mvm_restart_cleanup()
979 mvm->rx_ba_sessions = 0; in iwl_mvm_restart_cleanup()
980 mvm->fwrt.dump.conf = FW_DBG_INVALID; in iwl_mvm_restart_cleanup()
981 mvm->monitor_on = false; in iwl_mvm_restart_cleanup()
984 iwl_mvm_accu_radio_stats(mvm); in iwl_mvm_restart_cleanup()
987 int __iwl_mvm_mac_start(struct iwl_mvm *mvm) in __iwl_mvm_mac_start() argument
991 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_mac_start()
993 ret = iwl_mvm_mei_get_ownership(mvm); in __iwl_mvm_mac_start()
997 if (mvm->mei_nvm_data) { in __iwl_mvm_mac_start()
999 kfree(mvm->mei_nvm_data); in __iwl_mvm_mac_start()
1000 mvm->mei_nvm_data = NULL; in __iwl_mvm_mac_start()
1010 mvm->temp_nvm_data = mvm->nvm_data; in __iwl_mvm_mac_start()
1011 mvm->nvm_data = NULL; in __iwl_mvm_mac_start()
1014 if (test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status)) { in __iwl_mvm_mac_start()
1019 set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in __iwl_mvm_mac_start()
1020 clear_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status); in __iwl_mvm_mac_start()
1022 iwl_mvm_restart_cleanup(mvm); in __iwl_mvm_mac_start()
1024 ret = iwl_mvm_up(mvm); in __iwl_mvm_mac_start()
1026 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_POST_INIT, in __iwl_mvm_mac_start()
1028 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_PERIODIC, in __iwl_mvm_mac_start()
1031 mvm->last_reset_or_resume_time_jiffies = jiffies; in __iwl_mvm_mac_start()
1033 if (ret && test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in __iwl_mvm_mac_start()
1038 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in __iwl_mvm_mac_start()
1046 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_start() local
1050 mutex_lock(&mvm->mutex); in iwl_mvm_mac_start()
1053 if (!test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status) && in iwl_mvm_mac_start()
1060 set_bit(IWL_MVM_STATUS_STARTING, &mvm->status); in iwl_mvm_mac_start()
1064 ret = __iwl_mvm_mac_start(mvm); in iwl_mvm_mac_start()
1068 IWL_ERR(mvm, "mac start retry %d\n", retry); in iwl_mvm_mac_start()
1070 clear_bit(IWL_MVM_STATUS_STARTING, &mvm->status); in iwl_mvm_mac_start()
1072 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_start()
1074 iwl_mvm_mei_set_sw_rfkill_state(mvm); in iwl_mvm_mac_start()
1079 static void iwl_mvm_restart_complete(struct iwl_mvm *mvm) in iwl_mvm_restart_complete() argument
1083 mutex_lock(&mvm->mutex); in iwl_mvm_restart_complete()
1085 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in iwl_mvm_restart_complete()
1087 ret = iwl_mvm_update_quotas(mvm, true, NULL); in iwl_mvm_restart_complete()
1089 IWL_ERR(mvm, "Failed to update quotas after restart (%d)\n", in iwl_mvm_restart_complete()
1092 iwl_mvm_send_recovery_cmd(mvm, ERROR_RECOVERY_END_OF_RECOVERY); in iwl_mvm_restart_complete()
1098 iwl_mvm_teardown_tdls_peers(mvm); in iwl_mvm_restart_complete()
1100 mutex_unlock(&mvm->mutex); in iwl_mvm_restart_complete()
1107 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_reconfig_complete() local
1111 iwl_mvm_restart_complete(mvm); in iwl_mvm_mac_reconfig_complete()
1118 void __iwl_mvm_mac_stop(struct iwl_mvm *mvm) in __iwl_mvm_mac_stop() argument
1120 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_mac_stop()
1122 iwl_mvm_ftm_initiator_smooth_stop(mvm); in __iwl_mvm_mac_stop()
1127 memset(&mvm->accu_radio_stats, 0, sizeof(mvm->accu_radio_stats)); in __iwl_mvm_mac_stop()
1131 if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) < 12) in __iwl_mvm_mac_stop()
1132 iwl_mvm_rm_aux_sta(mvm); in __iwl_mvm_mac_stop()
1134 iwl_mvm_stop_device(mvm); in __iwl_mvm_mac_stop()
1136 iwl_mvm_async_handlers_purge(mvm); in __iwl_mvm_mac_stop()
1146 if (test_and_clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) || in __iwl_mvm_mac_stop()
1148 &mvm->status)) in __iwl_mvm_mac_stop()
1149 ieee80211_iterate_interfaces(mvm->hw, 0, in __iwl_mvm_mac_stop()
1150 iwl_mvm_cleanup_iterator, mvm); in __iwl_mvm_mac_stop()
1155 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in __iwl_mvm_mac_stop()
1158 for (i = 0; i < mvm->max_scans; i++) { in __iwl_mvm_mac_stop()
1159 if (WARN_ONCE(mvm->scan_uid_status[i], in __iwl_mvm_mac_stop()
1162 mvm->scan_uid_status[i] = 0; in __iwl_mvm_mac_stop()
1169 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_stop() local
1171 flush_work(&mvm->async_handlers_wk); in iwl_mvm_mac_stop()
1172 flush_work(&mvm->add_stream_wk); in iwl_mvm_mac_stop()
1182 clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); in iwl_mvm_mac_stop()
1184 cancel_delayed_work_sync(&mvm->cs_tx_unblock_dwork); in iwl_mvm_mac_stop()
1185 cancel_delayed_work_sync(&mvm->scan_timeout_dwork); in iwl_mvm_mac_stop()
1191 flush_work(&mvm->roc_done_wk); in iwl_mvm_mac_stop()
1193 iwl_mvm_mei_set_sw_rfkill_state(mvm); in iwl_mvm_mac_stop()
1195 mutex_lock(&mvm->mutex); in iwl_mvm_mac_stop()
1196 __iwl_mvm_mac_stop(mvm); in iwl_mvm_mac_stop()
1197 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_stop()
1203 cancel_work_sync(&mvm->async_handlers_wk); in iwl_mvm_mac_stop()
1206 static struct iwl_mvm_phy_ctxt *iwl_mvm_get_free_phy_ctxt(struct iwl_mvm *mvm) in iwl_mvm_get_free_phy_ctxt() argument
1210 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_free_phy_ctxt()
1213 if (!mvm->phy_ctxts[i].ref) in iwl_mvm_get_free_phy_ctxt()
1214 return &mvm->phy_ctxts[i]; in iwl_mvm_get_free_phy_ctxt()
1216 IWL_ERR(mvm, "No available PHY context\n"); in iwl_mvm_get_free_phy_ctxt()
1220 static int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_set_tx_power() argument
1231 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, in iwl_mvm_set_tx_power()
1241 else if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_set_tx_power()
1244 else if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_set_tx_power()
1253 return iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, len, &cmd); in iwl_mvm_set_tx_power()
1260 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_post_channel_switch() local
1263 mutex_lock(&mvm->mutex); in iwl_mvm_post_channel_switch()
1269 mvmsta = iwl_mvm_sta_from_staid_protected(mvm, in iwl_mvm_post_channel_switch()
1277 iwl_mvm_sta_modify_disable_tx(mvm, mvmsta, false); in iwl_mvm_post_channel_switch()
1279 iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); in iwl_mvm_post_channel_switch()
1281 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_post_channel_switch()
1283 ret = iwl_mvm_enable_beacon_filter(mvm, vif, 0); in iwl_mvm_post_channel_switch()
1287 iwl_mvm_stop_session_protection(mvm, vif); in iwl_mvm_post_channel_switch()
1293 ret = iwl_mvm_power_update_ps(mvm); in iwl_mvm_post_channel_switch()
1298 mutex_unlock(&mvm->mutex); in iwl_mvm_post_channel_switch()
1306 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_abort_channel_switch() local
1319 if (iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, in iwl_mvm_abort_channel_switch()
1323 IWL_DEBUG_MAC80211(mvm, "Abort CSA on mac %d\n", mvmvif->id); in iwl_mvm_abort_channel_switch()
1325 mutex_lock(&mvm->mutex); in iwl_mvm_abort_channel_switch()
1326 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_abort_channel_switch()
1328 iwl_mvm_remove_csa_period(mvm, vif); in iwl_mvm_abort_channel_switch()
1330 WARN_ON(iwl_mvm_send_cmd_pdu(mvm, in iwl_mvm_abort_channel_switch()
1335 mutex_unlock(&mvm->mutex); in iwl_mvm_abort_channel_switch()
1355 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_add_interface() local
1359 mvmvif->mvm = mvm; in iwl_mvm_mac_add_interface()
1368 mutex_lock(&mvm->mutex); in iwl_mvm_mac_add_interface()
1371 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mac_add_interface()
1376 ret = iwl_mvm_mac_ctxt_init(mvm, vif); in iwl_mvm_mac_add_interface()
1380 rcu_assign_pointer(mvm->vif_id_to_mac[mvmvif->id], vif); in iwl_mvm_mac_add_interface()
1395 ret = iwl_mvm_alloc_bcast_sta(mvm, vif); in iwl_mvm_mac_add_interface()
1397 IWL_ERR(mvm, "Failed to allocate bcast sta\n"); in iwl_mvm_mac_add_interface()
1405 ret = iwl_mvm_allocate_int_sta(mvm, &mvmvif->mcast_sta, in iwl_mvm_mac_add_interface()
1411 iwl_mvm_vif_dbgfs_register(mvm, vif); in iwl_mvm_mac_add_interface()
1417 ret = iwl_mvm_mac_ctxt_add(mvm, vif); in iwl_mvm_mac_add_interface()
1421 ret = iwl_mvm_power_update_mac(mvm); in iwl_mvm_mac_add_interface()
1426 ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0); in iwl_mvm_mac_add_interface()
1430 if (!mvm->bf_allowed_vif && in iwl_mvm_mac_add_interface()
1432 mvm->bf_allowed_vif = mvmvif; in iwl_mvm_mac_add_interface()
1444 mvmvif->phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm); in iwl_mvm_mac_add_interface()
1450 iwl_mvm_phy_ctxt_ref(mvm, mvmvif->phy_ctxt); in iwl_mvm_mac_add_interface()
1451 ret = iwl_mvm_binding_add_vif(mvm, vif); in iwl_mvm_mac_add_interface()
1455 ret = iwl_mvm_add_p2p_bcast_sta(mvm, vif); in iwl_mvm_mac_add_interface()
1461 mvm->p2p_device_vif = vif; in iwl_mvm_mac_add_interface()
1464 iwl_mvm_tcm_add_vif(mvm, vif); in iwl_mvm_mac_add_interface()
1469 mvm->monitor_on = true; in iwl_mvm_mac_add_interface()
1471 iwl_mvm_vif_dbgfs_register(mvm, vif); in iwl_mvm_mac_add_interface()
1473 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in iwl_mvm_mac_add_interface()
1475 !mvm->csme_vif && mvm->mei_registered) { in iwl_mvm_mac_add_interface()
1476 iwl_mei_set_nic_info(vif->addr, mvm->nvm_data->hw_addr); in iwl_mvm_mac_add_interface()
1478 mvm->csme_vif = vif; in iwl_mvm_mac_add_interface()
1484 iwl_mvm_binding_remove_vif(mvm, vif); in iwl_mvm_mac_add_interface()
1486 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->phy_ctxt); in iwl_mvm_mac_add_interface()
1488 if (mvm->bf_allowed_vif == mvmvif) { in iwl_mvm_mac_add_interface()
1489 mvm->bf_allowed_vif = NULL; in iwl_mvm_mac_add_interface()
1495 iwl_mvm_mac_ctxt_remove(mvm, vif); in iwl_mvm_mac_add_interface()
1497 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_add_interface()
1502 static void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm, in iwl_mvm_prepare_mac_removal() argument
1511 flush_work(&mvm->roc_done_wk); in iwl_mvm_prepare_mac_removal()
1518 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_remove_interface() local
1522 iwl_mvm_prepare_mac_removal(mvm, vif); in iwl_mvm_mac_remove_interface()
1526 iwl_mvm_tcm_rm_vif(mvm, vif); in iwl_mvm_mac_remove_interface()
1528 mutex_lock(&mvm->mutex); in iwl_mvm_mac_remove_interface()
1530 if (vif == mvm->csme_vif) { in iwl_mvm_mac_remove_interface()
1532 mvm->csme_vif = NULL; in iwl_mvm_mac_remove_interface()
1536 lockdep_is_held(&mvm->mutex)); in iwl_mvm_mac_remove_interface()
1541 if (mvm->bf_allowed_vif == mvmvif) { in iwl_mvm_mac_remove_interface()
1542 mvm->bf_allowed_vif = NULL; in iwl_mvm_mac_remove_interface()
1548 memset(&mvm->ftm_resp_stats, 0, sizeof(mvm->ftm_resp_stats)); in iwl_mvm_mac_remove_interface()
1550 iwl_mvm_vif_dbgfs_clean(mvm, vif); in iwl_mvm_mac_remove_interface()
1559 if (vif == mvm->noa_vif) { in iwl_mvm_mac_remove_interface()
1560 mvm->noa_vif = NULL; in iwl_mvm_mac_remove_interface()
1561 mvm->noa_duration = 0; in iwl_mvm_mac_remove_interface()
1564 iwl_mvm_dealloc_int_sta(mvm, &mvmvif->mcast_sta); in iwl_mvm_mac_remove_interface()
1565 iwl_mvm_dealloc_bcast_sta(mvm, vif); in iwl_mvm_mac_remove_interface()
1570 mvm->p2p_device_vif = NULL; in iwl_mvm_mac_remove_interface()
1571 iwl_mvm_rm_p2p_bcast_sta(mvm, vif); in iwl_mvm_mac_remove_interface()
1572 iwl_mvm_binding_remove_vif(mvm, vif); in iwl_mvm_mac_remove_interface()
1573 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->phy_ctxt); in iwl_mvm_mac_remove_interface()
1577 iwl_mvm_power_update_mac(mvm); in iwl_mvm_mac_remove_interface()
1578 iwl_mvm_mac_ctxt_remove(mvm, vif); in iwl_mvm_mac_remove_interface()
1580 RCU_INIT_POINTER(mvm->vif_id_to_mac[mvmvif->id], NULL); in iwl_mvm_mac_remove_interface()
1583 mvm->monitor_on = false; in iwl_mvm_mac_remove_interface()
1586 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_remove_interface()
1595 struct iwl_mvm *mvm; member
1603 struct iwl_mvm *mvm = data->mvm; in iwl_mvm_mc_iface_iterator() local
1604 struct iwl_mcast_filter_cmd *cmd = mvm->mcast_filter_cmd; in iwl_mvm_mc_iface_iterator()
1627 ret = iwl_mvm_send_cmd(mvm, &hcmd); in iwl_mvm_mc_iface_iterator()
1629 IWL_ERR(mvm, "mcast filter cmd error. ret=%d\n", ret); in iwl_mvm_mc_iface_iterator()
1632 static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm) in iwl_mvm_recalc_multicast() argument
1635 .mvm = mvm, in iwl_mvm_recalc_multicast()
1639 lockdep_assert_held(&mvm->mutex); in iwl_mvm_recalc_multicast()
1641 if (WARN_ON_ONCE(!mvm->mcast_filter_cmd)) in iwl_mvm_recalc_multicast()
1645 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_recalc_multicast()
1660 ret = iwl_mvm_send_cmd_pdu(mvm, ECHO_CMD, 0, 0, NULL); in iwl_mvm_recalc_multicast()
1662 IWL_ERR(mvm, "Failed to synchronize multicast groups update\n"); in iwl_mvm_recalc_multicast()
1668 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_prepare_multicast() local
1692 IWL_DEBUG_MAC80211(mvm, "mcast addr (%d): %pM\n", in iwl_mvm_prepare_multicast()
1707 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_configure_filter() local
1710 mutex_lock(&mvm->mutex); in iwl_mvm_configure_filter()
1713 kfree(mvm->mcast_filter_cmd); in iwl_mvm_configure_filter()
1714 mvm->mcast_filter_cmd = cmd; in iwl_mvm_configure_filter()
1725 iwl_mvm_recalc_multicast(mvm); in iwl_mvm_configure_filter()
1727 mutex_unlock(&mvm->mutex); in iwl_mvm_configure_filter()
1736 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_config_iface_filter() local
1747 mutex_lock(&mvm->mutex); in iwl_mvm_config_iface_filter()
1748 iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); in iwl_mvm_config_iface_filter()
1749 mutex_unlock(&mvm->mutex); in iwl_mvm_config_iface_filter()
1752 static int iwl_mvm_update_mu_groups(struct iwl_mvm *mvm, in iwl_mvm_update_mu_groups() argument
1762 return iwl_mvm_send_cmd_pdu(mvm, in iwl_mvm_update_mu_groups()
1785 void iwl_mvm_mu_mimo_grp_notif(struct iwl_mvm *mvm, in iwl_mvm_mu_mimo_grp_notif() argument
1792 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_mu_mimo_grp_notif()
1823 static void iwl_mvm_parse_ppe(struct iwl_mvm *mvm, in iwl_mvm_parse_ppe() argument
1836 IWL_DEBUG_INFO(mvm, "Got NSS = %d - trimming to %d\n", nss, in iwl_mvm_parse_ppe()
1865 static void iwl_mvm_set_pkt_ext_from_he_ppe(struct iwl_mvm *mvm, in iwl_mvm_set_pkt_ext_from_he_ppe() argument
1877 iwl_mvm_parse_ppe(mvm, pkt_ext, nss, ru_index_bitmap, ppe, ppe_pos_bit); in iwl_mvm_set_pkt_ext_from_he_ppe()
1920 static void iwl_mvm_cfg_he_sta(struct iwl_mvm *mvm, in iwl_mvm_cfg_he_sta() argument
1934 u8 ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 2); in iwl_mvm_cfg_he_sta()
1944 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_MBSSID_HE)) in iwl_mvm_cfg_he_sta()
1962 IWL_ERR(mvm, "bad STA_HE_CTXT_CMD version %d\n", ver); in iwl_mvm_cfg_he_sta()
1974 sband = mvm->hw->wiphy->bands[chanctx_conf->def.chan->band]; in iwl_mvm_cfg_he_sta()
1978 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_ctxt_cmd.sta_id]); in iwl_mvm_cfg_he_sta()
2035 iwl_mvm_set_pkt_ext_from_he_ppe(mvm, sta, in iwl_mvm_cfg_he_sta()
2149 if (iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, size, cmd)) in iwl_mvm_cfg_he_sta()
2150 IWL_ERR(mvm, "Failed to config FW to work HE!\n"); in iwl_mvm_cfg_he_sta()
2153 static void iwl_mvm_protect_assoc(struct iwl_mvm *mvm, in iwl_mvm_protect_assoc() argument
2172 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_protect_assoc()
2174 iwl_mvm_schedule_session_protection(mvm, vif, 900, in iwl_mvm_protect_assoc()
2177 iwl_mvm_protect_session(mvm, vif, duration, in iwl_mvm_protect_assoc()
2181 static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, in iwl_mvm_bss_info_changed_station() argument
2197 iwl_mvm_cfg_he_sta(mvm, vif, mvmvif->ap_sta_id); in iwl_mvm_bss_info_changed_station()
2199 iwl_mvm_mac_ctxt_recalc_tsf_id(mvm, vif); in iwl_mvm_bss_info_changed_station()
2206 iwl_mvm_cfg_he_sta(mvm, vif, mvmvif->ap_sta_id); in iwl_mvm_bss_info_changed_station()
2217 ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false, mvmvif->bssid); in iwl_mvm_bss_info_changed_station()
2219 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); in iwl_mvm_bss_info_changed_station()
2228 iwl_mvm_request_statistics(mvm, true); in iwl_mvm_bss_info_changed_station()
2233 ret = iwl_mvm_update_quotas(mvm, true, NULL); in iwl_mvm_bss_info_changed_station()
2235 IWL_ERR(mvm, "failed to update quotas\n"); in iwl_mvm_bss_info_changed_station()
2240 &mvm->status) && in iwl_mvm_bss_info_changed_station()
2241 !fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_bss_info_changed_station()
2262 iwl_mvm_protect_session(mvm, vif, dur, dur, in iwl_mvm_bss_info_changed_station()
2265 &mvm->status) && in iwl_mvm_bss_info_changed_station()
2277 iwl_mvm_protect_assoc(mvm, vif, 0); in iwl_mvm_bss_info_changed_station()
2280 iwl_mvm_sf_update(mvm, vif, false); in iwl_mvm_bss_info_changed_station()
2281 iwl_mvm_power_vif_assoc(mvm, vif); in iwl_mvm_bss_info_changed_station()
2283 iwl_mvm_update_smps(mvm, vif, in iwl_mvm_bss_info_changed_station()
2288 iwl_mvm_mei_host_disassociated(mvm); in iwl_mvm_bss_info_changed_station()
2293 ret = iwl_mvm_sf_update(mvm, vif, false); in iwl_mvm_bss_info_changed_station()
2296 &mvm->status), in iwl_mvm_bss_info_changed_station()
2308 &mvm->status)) { in iwl_mvm_bss_info_changed_station()
2313 ret = iwl_mvm_rm_sta_id(mvm, vif, in iwl_mvm_bss_info_changed_station()
2316 IWL_ERR(mvm, in iwl_mvm_bss_info_changed_station()
2323 ret = iwl_mvm_update_quotas(mvm, false, NULL); in iwl_mvm_bss_info_changed_station()
2325 IWL_ERR(mvm, "failed to update quotas\n"); in iwl_mvm_bss_info_changed_station()
2328 ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); in iwl_mvm_bss_info_changed_station()
2330 IWL_ERR(mvm, in iwl_mvm_bss_info_changed_station()
2339 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in iwl_mvm_bss_info_changed_station()
2341 ret = iwl_mvm_update_mu_groups(mvm, vif); in iwl_mvm_bss_info_changed_station()
2343 IWL_ERR(mvm, in iwl_mvm_bss_info_changed_station()
2347 iwl_mvm_recalc_multicast(mvm); in iwl_mvm_bss_info_changed_station()
2352 iwl_mvm_bt_coex_vif_change(mvm); in iwl_mvm_bss_info_changed_station()
2353 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_TT, in iwl_mvm_bss_info_changed_station()
2355 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_bss_info_changed_station()
2357 iwl_mvm_config_scan(mvm); in iwl_mvm_bss_info_changed_station()
2365 iwl_mvm_stop_session_protection(mvm, vif); in iwl_mvm_bss_info_changed_station()
2367 iwl_mvm_sf_update(mvm, vif, false); in iwl_mvm_bss_info_changed_station()
2368 WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); in iwl_mvm_bss_info_changed_station()
2377 ret = iwl_mvm_power_update_mac(mvm); in iwl_mvm_bss_info_changed_station()
2379 IWL_ERR(mvm, "failed to update power mode\n"); in iwl_mvm_bss_info_changed_station()
2383 IWL_DEBUG_MAC80211(mvm, "cqm info_changed\n"); in iwl_mvm_bss_info_changed_station()
2387 ret = iwl_mvm_enable_beacon_filter(mvm, vif, 0); in iwl_mvm_bss_info_changed_station()
2389 IWL_ERR(mvm, in iwl_mvm_bss_info_changed_station()
2402 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_start_ap_ibss() local
2406 mutex_lock(&mvm->mutex); in iwl_mvm_start_ap_ibss()
2409 ret = iwl_mvm_mac_ctxt_beacon_changed(mvm, vif); in iwl_mvm_start_ap_ibss()
2419 iwl_mvm_mac_ctxt_recalc_tsf_id(mvm, vif); in iwl_mvm_start_ap_ibss()
2424 ret = iwl_mvm_mac_ctxt_add(mvm, vif); in iwl_mvm_start_ap_ibss()
2429 ret = iwl_mvm_binding_add_vif(mvm, vif); in iwl_mvm_start_ap_ibss()
2440 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) { in iwl_mvm_start_ap_ibss()
2441 ret = iwl_mvm_add_mcast_sta(mvm, vif); in iwl_mvm_start_ap_ibss()
2448 ret = iwl_mvm_send_add_bcast_sta(mvm, vif); in iwl_mvm_start_ap_ibss()
2450 iwl_mvm_rm_mcast_sta(mvm, vif); in iwl_mvm_start_ap_ibss()
2458 ret = iwl_mvm_send_add_bcast_sta(mvm, vif); in iwl_mvm_start_ap_ibss()
2461 ret = iwl_mvm_add_mcast_sta(mvm, vif); in iwl_mvm_start_ap_ibss()
2463 iwl_mvm_send_rm_bcast_sta(mvm, vif); in iwl_mvm_start_ap_ibss()
2488 iwl_mvm_send_low_latency_cmd(mvm, true, mvmvif->id); in iwl_mvm_start_ap_ibss()
2492 iwl_mvm_power_update_mac(mvm); in iwl_mvm_start_ap_ibss()
2494 ret = iwl_mvm_update_quotas(mvm, false, NULL); in iwl_mvm_start_ap_ibss()
2499 if (vif->p2p && mvm->p2p_device_vif) in iwl_mvm_start_ap_ibss()
2500 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false, NULL); in iwl_mvm_start_ap_ibss()
2502 iwl_mvm_bt_coex_vif_change(mvm); in iwl_mvm_start_ap_ibss()
2505 if (iwl_mvm_phy_ctx_count(mvm) > 1) in iwl_mvm_start_ap_ibss()
2506 iwl_mvm_teardown_tdls_peers(mvm); in iwl_mvm_start_ap_ibss()
2508 iwl_mvm_ftm_restart_responder(mvm, vif); in iwl_mvm_start_ap_ibss()
2513 iwl_mvm_power_update_mac(mvm); in iwl_mvm_start_ap_ibss()
2515 iwl_mvm_send_rm_bcast_sta(mvm, vif); in iwl_mvm_start_ap_ibss()
2516 iwl_mvm_rm_mcast_sta(mvm, vif); in iwl_mvm_start_ap_ibss()
2518 iwl_mvm_binding_remove_vif(mvm, vif); in iwl_mvm_start_ap_ibss()
2520 iwl_mvm_mac_ctxt_remove(mvm, vif); in iwl_mvm_start_ap_ibss()
2522 mutex_unlock(&mvm->mutex); in iwl_mvm_start_ap_ibss()
2543 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_stop_ap_ibss() local
2546 iwl_mvm_prepare_mac_removal(mvm, vif); in iwl_mvm_stop_ap_ibss()
2548 mutex_lock(&mvm->mutex); in iwl_mvm_stop_ap_ibss()
2551 if (rcu_access_pointer(mvm->csa_vif) == vif) { in iwl_mvm_stop_ap_ibss()
2552 iwl_mvm_remove_time_event(mvm, mvmvif, in iwl_mvm_stop_ap_ibss()
2554 RCU_INIT_POINTER(mvm->csa_vif, NULL); in iwl_mvm_stop_ap_ibss()
2558 if (rcu_access_pointer(mvm->csa_tx_blocked_vif) == vif) { in iwl_mvm_stop_ap_ibss()
2559 RCU_INIT_POINTER(mvm->csa_tx_blocked_vif, NULL); in iwl_mvm_stop_ap_ibss()
2560 mvm->csa_tx_block_bcn_timeout = 0; in iwl_mvm_stop_ap_ibss()
2564 mvm->ap_last_beacon_gp2 = 0; in iwl_mvm_stop_ap_ibss()
2569 iwl_mvm_send_low_latency_cmd(mvm, false, mvmvif->id); in iwl_mvm_stop_ap_ibss()
2572 iwl_mvm_bt_coex_vif_change(mvm); in iwl_mvm_stop_ap_ibss()
2575 if (vif->p2p && mvm->p2p_device_vif) in iwl_mvm_stop_ap_ibss()
2576 iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false, NULL); in iwl_mvm_stop_ap_ibss()
2578 iwl_mvm_update_quotas(mvm, false, NULL); in iwl_mvm_stop_ap_ibss()
2580 iwl_mvm_ftm_responder_clear(mvm, vif); in iwl_mvm_stop_ap_ibss()
2590 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) in iwl_mvm_stop_ap_ibss()
2591 iwl_mvm_rm_mcast_sta(mvm, vif); in iwl_mvm_stop_ap_ibss()
2592 iwl_mvm_send_rm_bcast_sta(mvm, vif); in iwl_mvm_stop_ap_ibss()
2593 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) in iwl_mvm_stop_ap_ibss()
2594 iwl_mvm_rm_mcast_sta(mvm, vif); in iwl_mvm_stop_ap_ibss()
2595 iwl_mvm_binding_remove_vif(mvm, vif); in iwl_mvm_stop_ap_ibss()
2597 iwl_mvm_power_update_mac(mvm); in iwl_mvm_stop_ap_ibss()
2599 iwl_mvm_mac_ctxt_remove(mvm, vif); in iwl_mvm_stop_ap_ibss()
2601 mutex_unlock(&mvm->mutex); in iwl_mvm_stop_ap_ibss()
2618 iwl_mvm_bss_info_changed_ap_ibss(struct iwl_mvm *mvm, in iwl_mvm_bss_info_changed_ap_ibss() argument
2631 iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL)) in iwl_mvm_bss_info_changed_ap_ibss()
2632 IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); in iwl_mvm_bss_info_changed_ap_ibss()
2636 iwl_mvm_mac_ctxt_beacon_changed(mvm, vif)) in iwl_mvm_bss_info_changed_ap_ibss()
2637 IWL_WARN(mvm, "Failed updating beacon data\n"); in iwl_mvm_bss_info_changed_ap_ibss()
2640 int ret = iwl_mvm_ftm_start_responder(mvm, vif); in iwl_mvm_bss_info_changed_ap_ibss()
2643 IWL_WARN(mvm, "Failed to enable FTM responder (%d)\n", in iwl_mvm_bss_info_changed_ap_ibss()
2654 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_bss_info_changed() local
2656 mutex_lock(&mvm->mutex); in iwl_mvm_bss_info_changed()
2659 iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED, true); in iwl_mvm_bss_info_changed()
2663 iwl_mvm_bss_info_changed_station(mvm, vif, bss_conf, changes); in iwl_mvm_bss_info_changed()
2667 iwl_mvm_bss_info_changed_ap_ibss(mvm, vif, bss_conf, changes); in iwl_mvm_bss_info_changed()
2671 iwl_mvm_update_mu_groups(mvm, vif); in iwl_mvm_bss_info_changed()
2679 IWL_DEBUG_CALIB(mvm, "Changing TX Power to %d dBm\n", in iwl_mvm_bss_info_changed()
2681 iwl_mvm_set_tx_power(mvm, vif, bss_conf->txpower); in iwl_mvm_bss_info_changed()
2684 mutex_unlock(&mvm->mutex); in iwl_mvm_bss_info_changed()
2691 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_hw_scan() local
2695 hw_req->req.n_channels > mvm->fw->ucode_capa.n_scan_channels) in iwl_mvm_mac_hw_scan()
2698 mutex_lock(&mvm->mutex); in iwl_mvm_mac_hw_scan()
2699 ret = iwl_mvm_reg_scan_start(mvm, vif, &hw_req->req, &hw_req->ies); in iwl_mvm_mac_hw_scan()
2700 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_hw_scan()
2708 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_cancel_hw_scan() local
2710 mutex_lock(&mvm->mutex); in iwl_mvm_mac_cancel_hw_scan()
2719 if (mvm->scan_status & IWL_MVM_SCAN_REGULAR) in iwl_mvm_mac_cancel_hw_scan()
2720 iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_REGULAR, true); in iwl_mvm_mac_cancel_hw_scan()
2722 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_cancel_hw_scan()
2732 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_allow_buffered_frames() local
2736 iwl_mvm_sta_modify_sleep_tx_count(mvm, sta, reason, num_frames, in iwl_mvm_mac_allow_buffered_frames()
2747 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_release_buffered_frames() local
2751 iwl_mvm_sta_modify_sleep_tx_count(mvm, sta, reason, num_frames, in iwl_mvm_mac_release_buffered_frames()
2759 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in __iwl_mvm_mac_sta_notify() local
2769 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in __iwl_mvm_mac_sta_notify()
2781 if (iwl_mvm_tid_queued(mvm, tid_data) == 0) in __iwl_mvm_mac_sta_notify()
2793 iwl_trans_freeze_txq_timer(mvm->trans, txqs, true); in __iwl_mvm_mac_sta_notify()
2805 iwl_trans_freeze_txq_timer(mvm->trans, txqs, false); in __iwl_mvm_mac_sta_notify()
2806 iwl_mvm_sta_modify_ps_wake(mvm, sta); in __iwl_mvm_mac_sta_notify()
2822 void iwl_mvm_sta_pm_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) in iwl_mvm_sta_pm_notif() argument
2830 if (WARN_ON(notif->sta_id >= mvm->fw->ucode_capa.num_stations)) in iwl_mvm_sta_pm_notif()
2834 sta = rcu_dereference(mvm->fw_id_to_mac_id[notif->sta_id]); in iwl_mvm_sta_pm_notif()
2850 __iwl_mvm_mac_sta_notify(mvm->hw, in iwl_mvm_sta_pm_notif()
2879 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_sta_pre_rcu_remove() local
2890 mutex_lock(&mvm->mutex); in iwl_mvm_sta_pre_rcu_remove()
2891 if (sta == rcu_access_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id])) in iwl_mvm_sta_pre_rcu_remove()
2892 rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], in iwl_mvm_sta_pre_rcu_remove()
2895 mutex_unlock(&mvm->mutex); in iwl_mvm_sta_pre_rcu_remove()
2898 static void iwl_mvm_check_uapsd(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_check_uapsd() argument
2903 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in iwl_mvm_check_uapsd()
2906 mdata = &mvm->tcm.data[iwl_mvm_vif_from_mac80211(vif)->id]; in iwl_mvm_check_uapsd()
2911 if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT)) in iwl_mvm_check_uapsd()
2914 if (vif->p2p && !iwl_mvm_is_p2p_scm_uapsd_supported(mvm)) { in iwl_mvm_check_uapsd()
2926 if (ether_addr_equal(mvm->uapsd_noagg_bssids[i].addr, bssid)) { in iwl_mvm_check_uapsd()
2936 iwl_mvm_tdls_check_trigger(struct iwl_mvm *mvm, in iwl_mvm_tdls_check_trigger() argument
2943 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_tdls_check_trigger()
2957 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, in iwl_mvm_tdls_check_trigger()
3011 static void iwl_mvm_reset_cca_40mhz_workaround(struct iwl_mvm *mvm, in iwl_mvm_reset_cca_40mhz_workaround() argument
3020 if (!mvm->cca_40mhz_workaround) in iwl_mvm_reset_cca_40mhz_workaround()
3024 mvm->cca_40mhz_workaround--; in iwl_mvm_reset_cca_40mhz_workaround()
3025 if (mvm->cca_40mhz_workaround) in iwl_mvm_reset_cca_40mhz_workaround()
3028 sband = mvm->hw->wiphy->bands[NL80211_BAND_2GHZ]; in iwl_mvm_reset_cca_40mhz_workaround()
3044 static void iwl_mvm_mei_host_associated(struct iwl_mvm *mvm, in iwl_mvm_mei_host_associated() argument
3055 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_mei_host_associated()
3058 if (!mvm->mei_registered) in iwl_mvm_mei_host_associated()
3113 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_sta_state() local
3118 IWL_DEBUG_MAC80211(mvm, "station %pM state change %d->%d\n", in iwl_mvm_mac_sta_state()
3123 return test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status) ? 0 : -EINVAL; in iwl_mvm_mac_sta_state()
3140 flush_work(&mvm->add_stream_wk); in iwl_mvm_mac_sta_state()
3151 iwl_mvm_reset_cca_40mhz_workaround(mvm, vif); in iwl_mvm_mac_sta_state()
3154 mutex_lock(&mvm->mutex); in iwl_mvm_mac_sta_state()
3169 IWL_ERR(mvm, in iwl_mvm_mac_sta_state()
3181 iwl_mvm_tdls_sta_count(mvm, NULL) == in iwl_mvm_mac_sta_state()
3183 iwl_mvm_phy_ctx_count(mvm) > 1)) { in iwl_mvm_mac_sta_state()
3184 IWL_DEBUG_MAC80211(mvm, "refusing TDLS sta\n"); in iwl_mvm_mac_sta_state()
3189 ret = iwl_mvm_add_sta(mvm, vif, sta); in iwl_mvm_mac_sta_state()
3191 iwl_mvm_recalc_tdls_state(mvm, vif, true); in iwl_mvm_mac_sta_state()
3192 iwl_mvm_tdls_check_trigger(mvm, vif, sta->addr, in iwl_mvm_mac_sta_state()
3203 mvm->last_ebs_successful = true; in iwl_mvm_mac_sta_state()
3204 iwl_mvm_check_uapsd(mvm, vif, sta->addr); in iwl_mvm_mac_sta_state()
3211 iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); in iwl_mvm_mac_sta_state()
3214 iwl_mvm_cfg_he_sta(mvm, vif, mvm_sta->sta_id); in iwl_mvm_mac_sta_state()
3222 iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); in iwl_mvm_mac_sta_state()
3225 iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band, in iwl_mvm_mac_sta_state()
3227 ret = iwl_mvm_update_sta(mvm, vif, sta); in iwl_mvm_mac_sta_state()
3233 if (iwl_mvm_phy_ctx_count(mvm) > 1) in iwl_mvm_mac_sta_state()
3234 iwl_mvm_teardown_tdls_peers(mvm); in iwl_mvm_mac_sta_state()
3237 iwl_mvm_tdls_check_trigger(mvm, vif, sta->addr, in iwl_mvm_mac_sta_state()
3241 WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); in iwl_mvm_mac_sta_state()
3250 iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); in iwl_mvm_mac_sta_state()
3251 iwl_mvm_mei_host_associated(mvm, vif, mvm_sta); in iwl_mvm_mac_sta_state()
3254 iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band, in iwl_mvm_mac_sta_state()
3261 iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band, in iwl_mvm_mac_sta_state()
3265 iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); in iwl_mvm_mac_sta_state()
3274 ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0); in iwl_mvm_mac_sta_state()
3277 &mvm->status)); in iwl_mvm_mac_sta_state()
3284 iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); in iwl_mvm_mac_sta_state()
3286 iwl_mvm_stop_session_protection(mvm, vif); in iwl_mvm_mac_sta_state()
3294 iwl_mvm_stop_session_protection(mvm, vif); in iwl_mvm_mac_sta_state()
3295 ret = iwl_mvm_rm_sta(mvm, vif, sta); in iwl_mvm_mac_sta_state()
3297 iwl_mvm_recalc_tdls_state(mvm, vif, false); in iwl_mvm_mac_sta_state()
3298 iwl_mvm_tdls_check_trigger(mvm, vif, sta->addr, in iwl_mvm_mac_sta_state()
3304 &mvm->status))) in iwl_mvm_mac_sta_state()
3310 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sta_state()
3326 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_set_rts_threshold() local
3328 mvm->rts_threshold = value; in iwl_mvm_mac_set_rts_threshold()
3337 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_sta_rc_update() local
3343 iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band, in iwl_mvm_sta_rc_update()
3348 iwl_mvm_sf_update(mvm, vif, false); in iwl_mvm_sta_rc_update()
3356 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_conf_tx() local
3368 mutex_lock(&mvm->mutex); in iwl_mvm_mac_conf_tx()
3369 ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); in iwl_mvm_mac_conf_tx()
3370 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_conf_tx()
3380 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_mgd_prepare_tx() local
3382 mutex_lock(&mvm->mutex); in iwl_mvm_mac_mgd_prepare_tx()
3383 iwl_mvm_protect_assoc(mvm, vif, info->duration); in iwl_mvm_mac_mgd_prepare_tx()
3384 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_mgd_prepare_tx()
3391 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_mgd_complete_tx() local
3397 mutex_lock(&mvm->mutex); in iwl_mvm_mac_mgd_complete_tx()
3398 iwl_mvm_stop_session_protection(mvm, vif); in iwl_mvm_mac_mgd_complete_tx()
3399 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_mgd_complete_tx()
3407 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_sched_scan_start() local
3411 mutex_lock(&mvm->mutex); in iwl_mvm_mac_sched_scan_start()
3418 ret = iwl_mvm_sched_scan_start(mvm, vif, req, ies, IWL_MVM_SCAN_SCHED); in iwl_mvm_mac_sched_scan_start()
3421 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sched_scan_start()
3428 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_sched_scan_stop() local
3431 mutex_lock(&mvm->mutex); in iwl_mvm_mac_sched_scan_stop()
3441 if (!(mvm->scan_status & IWL_MVM_SCAN_SCHED)) { in iwl_mvm_mac_sched_scan_stop()
3442 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sched_scan_stop()
3446 ret = iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED, false); in iwl_mvm_mac_sched_scan_stop()
3447 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sched_scan_stop()
3448 iwl_mvm_wait_for_async_handlers(mvm); in iwl_mvm_mac_sched_scan_stop()
3460 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in __iwl_mvm_mac_set_key() local
3472 if (!mvm->trans->trans_cfg->gen2) { in __iwl_mvm_mac_set_key()
3478 IWL_DEBUG_MAC80211(mvm, "Use SW encryption for TKIP\n"); in __iwl_mvm_mac_set_key()
3485 if (!iwl_mvm_has_new_tx_api(mvm)) in __iwl_mvm_mac_set_key()
3497 if (iwl_mvm_has_new_tx_api(mvm)) in __iwl_mvm_mac_set_key()
3528 !iwl_mvm_has_new_tx_api(mvm)) { in __iwl_mvm_mac_set_key()
3556 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in __iwl_mvm_mac_set_key()
3558 IWL_DEBUG_MAC80211(mvm, in __iwl_mvm_mac_set_key()
3564 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in __iwl_mvm_mac_set_key()
3565 mvmsta && iwl_mvm_has_new_rx_api(mvm) && in __iwl_mvm_mac_set_key()
3575 mvm->trans->num_rx_queues), in __iwl_mvm_mac_set_key()
3584 for (q = 0; q < mvm->trans->num_rx_queues; q++) in __iwl_mvm_mac_set_key()
3594 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in __iwl_mvm_mac_set_key()
3602 IWL_DEBUG_MAC80211(mvm, "set hwcrypto key\n"); in __iwl_mvm_mac_set_key()
3603 ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, key_offset); in __iwl_mvm_mac_set_key()
3605 IWL_WARN(mvm, "set key failed\n"); in __iwl_mvm_mac_set_key()
3613 if (iwl_mvm_has_new_tx_api(mvm)) in __iwl_mvm_mac_set_key()
3642 if (mvmsta && iwl_mvm_has_new_rx_api(mvm) && in __iwl_mvm_mac_set_key()
3649 lockdep_is_held(&mvm->mutex)); in __iwl_mvm_mac_set_key()
3655 IWL_DEBUG_MAC80211(mvm, "disable hwcrypto key\n"); in __iwl_mvm_mac_set_key()
3656 ret = iwl_mvm_remove_sta_key(mvm, vif, sta, key); in __iwl_mvm_mac_set_key()
3671 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_set_key() local
3674 mutex_lock(&mvm->mutex); in iwl_mvm_mac_set_key()
3676 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_set_key()
3687 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_update_tkip_key() local
3692 iwl_mvm_update_tkip_key(mvm, vif, keyconf, sta, iv32, phase1key); in iwl_mvm_mac_update_tkip_key()
3699 struct iwl_mvm *mvm = in iwl_mvm_rx_aux_roc() local
3709 IWL_ERR(mvm, "Invalid HOT_SPOT_CMD response\n"); in iwl_mvm_rx_aux_roc()
3715 IWL_DEBUG_TE(mvm, in iwl_mvm_rx_aux_roc()
3720 IWL_DEBUG_TE(mvm, "TIME_EVENT_CMD response - UID = 0x%x\n", in iwl_mvm_rx_aux_roc()
3723 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_rx_aux_roc()
3724 list_add_tail(&te_data->list, &mvm->aux_roc_te_list); in iwl_mvm_rx_aux_roc()
3725 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_rx_aux_roc()
3735 static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm, in iwl_mvm_send_aux_roc_cmd() argument
3752 .sta_id_and_color = cpu_to_le32(mvm->aux_sta.sta_id), in iwl_mvm_send_aux_roc_cmd()
3754 struct iwl_hs20_roc_req_tail *tail = iwl_mvm_chan_info_cmd_tail(mvm, in iwl_mvm_send_aux_roc_cmd()
3756 u16 len = sizeof(aux_roc_req) - iwl_mvm_chan_info_padding(mvm); in iwl_mvm_send_aux_roc_cmd()
3759 iwl_mvm_set_chan_info(mvm, &aux_roc_req.channel_info, channel->hw_value, in iwl_mvm_send_aux_roc_cmd()
3765 tail->apply_time = cpu_to_le32(iwl_mvm_get_systime(mvm)); in iwl_mvm_send_aux_roc_cmd()
3793 IWL_DEBUG_TE(mvm, in iwl_mvm_send_aux_roc_cmd()
3796 IWL_DEBUG_TE(mvm, in iwl_mvm_send_aux_roc_cmd()
3803 lockdep_assert_held(&mvm->mutex); in iwl_mvm_send_aux_roc_cmd()
3805 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
3808 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
3816 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
3827 iwl_init_notification_wait(&mvm->notif_wait, &wait_time_event, in iwl_mvm_send_aux_roc_cmd()
3832 res = iwl_mvm_send_cmd_pdu(mvm, HOT_SPOT_CMD, 0, len, in iwl_mvm_send_aux_roc_cmd()
3836 IWL_ERR(mvm, "Couldn't send HOT_SPOT_CMD: %d\n", res); in iwl_mvm_send_aux_roc_cmd()
3837 iwl_remove_notification(&mvm->notif_wait, &wait_time_event); in iwl_mvm_send_aux_roc_cmd()
3842 res = iwl_wait_notification(&mvm->notif_wait, &wait_time_event, 1); in iwl_mvm_send_aux_roc_cmd()
3848 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
3849 iwl_mvm_te_clear_data(mvm, te_data); in iwl_mvm_send_aux_roc_cmd()
3850 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_send_aux_roc_cmd()
3862 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_roc() local
3869 IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value, in iwl_mvm_roc()
3876 flush_work(&mvm->roc_done_wk); in iwl_mvm_roc()
3878 mutex_lock(&mvm->mutex); in iwl_mvm_roc()
3882 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_roc()
3885 if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) >= 12) { in iwl_mvm_roc()
3888 lmac_id = iwl_mvm_get_lmac_id(mvm->fw, in iwl_mvm_roc()
3890 ret = iwl_mvm_add_aux_sta(mvm, lmac_id); in iwl_mvm_roc()
3895 ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, in iwl_mvm_roc()
3899 IWL_ERR(mvm, "hotspot not supported\n"); in iwl_mvm_roc()
3906 IWL_ERR(mvm, "vif isn't P2P_DEVICE: %d\n", vif->type); in iwl_mvm_roc()
3912 phy_ctxt = &mvm->phy_ctxts[i]; in iwl_mvm_roc()
3921 ret = iwl_mvm_binding_remove_vif(mvm, vif); in iwl_mvm_roc()
3925 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->phy_ctxt); in iwl_mvm_roc()
3930 ret = iwl_mvm_binding_add_vif(mvm, vif); in iwl_mvm_roc()
3934 iwl_mvm_phy_ctxt_ref(mvm, mvmvif->phy_ctxt); in iwl_mvm_roc()
3952 fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_roc()
3961 ret = iwl_mvm_phy_ctxt_changed(mvm, mvmvif->phy_ctxt, in iwl_mvm_roc()
3971 phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm); in iwl_mvm_roc()
3977 ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &chandef, in iwl_mvm_roc()
3980 IWL_ERR(mvm, "Failed to change PHY context\n"); in iwl_mvm_roc()
3985 ret = iwl_mvm_binding_remove_vif(mvm, vif); in iwl_mvm_roc()
3989 iwl_mvm_phy_ctxt_unref(mvm, mvmvif->phy_ctxt); in iwl_mvm_roc()
3994 ret = iwl_mvm_binding_add_vif(mvm, vif); in iwl_mvm_roc()
3998 iwl_mvm_phy_ctxt_ref(mvm, mvmvif->phy_ctxt); in iwl_mvm_roc()
4003 ret = iwl_mvm_start_p2p_roc(mvm, vif, duration, type); in iwl_mvm_roc()
4006 mutex_unlock(&mvm->mutex); in iwl_mvm_roc()
4007 IWL_DEBUG_MAC80211(mvm, "leave\n"); in iwl_mvm_roc()
4014 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_cancel_roc() local
4016 IWL_DEBUG_MAC80211(mvm, "enter\n"); in iwl_mvm_cancel_roc()
4018 mutex_lock(&mvm->mutex); in iwl_mvm_cancel_roc()
4019 iwl_mvm_stop_roc(mvm, vif); in iwl_mvm_cancel_roc()
4020 mutex_unlock(&mvm->mutex); in iwl_mvm_cancel_roc()
4022 IWL_DEBUG_MAC80211(mvm, "leave\n"); in iwl_mvm_cancel_roc()
4041 static bool iwl_mvm_is_ftm_responder_chanctx(struct iwl_mvm *mvm, in iwl_mvm_is_ftm_responder_chanctx() argument
4049 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in iwl_mvm_is_ftm_responder_chanctx()
4056 static int __iwl_mvm_add_chanctx(struct iwl_mvm *mvm, in __iwl_mvm_add_chanctx() argument
4061 bool responder = iwl_mvm_is_ftm_responder_chanctx(mvm, ctx); in __iwl_mvm_add_chanctx()
4065 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_add_chanctx()
4067 IWL_DEBUG_MAC80211(mvm, "Add channel context\n"); in __iwl_mvm_add_chanctx()
4069 phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm); in __iwl_mvm_add_chanctx()
4075 ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, def, in __iwl_mvm_add_chanctx()
4079 IWL_ERR(mvm, "Failed to add PHY context\n"); in __iwl_mvm_add_chanctx()
4083 iwl_mvm_phy_ctxt_ref(mvm, phy_ctxt); in __iwl_mvm_add_chanctx()
4092 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_add_chanctx() local
4095 mutex_lock(&mvm->mutex); in iwl_mvm_add_chanctx()
4096 ret = __iwl_mvm_add_chanctx(mvm, ctx); in iwl_mvm_add_chanctx()
4097 mutex_unlock(&mvm->mutex); in iwl_mvm_add_chanctx()
4102 static void __iwl_mvm_remove_chanctx(struct iwl_mvm *mvm, in __iwl_mvm_remove_chanctx() argument
4106 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; in __iwl_mvm_remove_chanctx()
4108 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_remove_chanctx()
4110 iwl_mvm_phy_ctxt_unref(mvm, phy_ctxt); in __iwl_mvm_remove_chanctx()
4116 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_remove_chanctx() local
4118 mutex_lock(&mvm->mutex); in iwl_mvm_remove_chanctx()
4119 __iwl_mvm_remove_chanctx(mvm, ctx); in iwl_mvm_remove_chanctx()
4120 mutex_unlock(&mvm->mutex); in iwl_mvm_remove_chanctx()
4127 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_change_chanctx() local
4129 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; in iwl_mvm_change_chanctx()
4130 bool responder = iwl_mvm_is_ftm_responder_chanctx(mvm, ctx); in iwl_mvm_change_chanctx()
4142 mutex_lock(&mvm->mutex); in iwl_mvm_change_chanctx()
4155 iwl_mvm_bt_coex_vif_change(mvm); in iwl_mvm_change_chanctx()
4156 iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, def, in iwl_mvm_change_chanctx()
4161 mutex_unlock(&mvm->mutex); in iwl_mvm_change_chanctx()
4164 static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm, in __iwl_mvm_assign_vif_chanctx() argument
4170 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; in __iwl_mvm_assign_vif_chanctx()
4174 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_assign_vif_chanctx()
4205 ret = iwl_mvm_binding_add_vif(mvm, vif); in __iwl_mvm_assign_vif_chanctx()
4213 iwl_mvm_power_update_mac(mvm); in __iwl_mvm_assign_vif_chanctx()
4221 ret = iwl_mvm_update_quotas(mvm, false, NULL); in __iwl_mvm_assign_vif_chanctx()
4225 ret = iwl_mvm_add_snif_sta(mvm, vif); in __iwl_mvm_assign_vif_chanctx()
4233 iwl_mvm_update_quotas(mvm, false, NULL); in __iwl_mvm_assign_vif_chanctx()
4234 iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); in __iwl_mvm_assign_vif_chanctx()
4240 if (!fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_assign_vif_chanctx()
4247 iwl_mvm_protect_session(mvm, vif, duration, duration, in __iwl_mvm_assign_vif_chanctx()
4252 iwl_mvm_update_quotas(mvm, false, NULL); in __iwl_mvm_assign_vif_chanctx()
4258 iwl_mvm_binding_remove_vif(mvm, vif); in __iwl_mvm_assign_vif_chanctx()
4259 iwl_mvm_power_update_mac(mvm); in __iwl_mvm_assign_vif_chanctx()
4270 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_assign_vif_chanctx() local
4273 mutex_lock(&mvm->mutex); in iwl_mvm_assign_vif_chanctx()
4274 ret = __iwl_mvm_assign_vif_chanctx(mvm, vif, ctx, false); in iwl_mvm_assign_vif_chanctx()
4275 mutex_unlock(&mvm->mutex); in iwl_mvm_assign_vif_chanctx()
4280 static void __iwl_mvm_unassign_vif_chanctx(struct iwl_mvm *mvm, in __iwl_mvm_unassign_vif_chanctx() argument
4288 lockdep_assert_held(&mvm->mutex); in __iwl_mvm_unassign_vif_chanctx()
4289 iwl_mvm_remove_time_event(mvm, mvmvif, &mvmvif->time_event_data); in __iwl_mvm_unassign_vif_chanctx()
4297 iwl_mvm_rm_snif_sta(mvm, vif); in __iwl_mvm_unassign_vif_chanctx()
4307 iwl_mvm_modify_all_sta_disable_tx(mvm, mvmvif, true); in __iwl_mvm_unassign_vif_chanctx()
4310 rcu_assign_pointer(mvm->csa_tx_blocked_vif, vif); in __iwl_mvm_unassign_vif_chanctx()
4320 if (!fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_unassign_vif_chanctx()
4322 iwl_mvm_mac_ctxt_changed(mvm, vif, true, NULL); in __iwl_mvm_unassign_vif_chanctx()
4328 iwl_mvm_update_quotas(mvm, false, disabled_vif); in __iwl_mvm_unassign_vif_chanctx()
4329 iwl_mvm_binding_remove_vif(mvm, vif); in __iwl_mvm_unassign_vif_chanctx()
4332 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_CHANNEL_SWITCH_CMD) && in __iwl_mvm_unassign_vif_chanctx()
4336 iwl_mvm_power_update_mac(mvm); in __iwl_mvm_unassign_vif_chanctx()
4344 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_unassign_vif_chanctx() local
4346 mutex_lock(&mvm->mutex); in iwl_mvm_unassign_vif_chanctx()
4347 __iwl_mvm_unassign_vif_chanctx(mvm, vif, ctx, false); in iwl_mvm_unassign_vif_chanctx()
4348 mutex_unlock(&mvm->mutex); in iwl_mvm_unassign_vif_chanctx()
4352 iwl_mvm_switch_vif_chanctx_swap(struct iwl_mvm *mvm, in iwl_mvm_switch_vif_chanctx_swap() argument
4357 mutex_lock(&mvm->mutex); in iwl_mvm_switch_vif_chanctx_swap()
4358 __iwl_mvm_unassign_vif_chanctx(mvm, vifs[0].vif, vifs[0].old_ctx, true); in iwl_mvm_switch_vif_chanctx_swap()
4359 __iwl_mvm_remove_chanctx(mvm, vifs[0].old_ctx); in iwl_mvm_switch_vif_chanctx_swap()
4361 ret = __iwl_mvm_add_chanctx(mvm, vifs[0].new_ctx); in iwl_mvm_switch_vif_chanctx_swap()
4363 IWL_ERR(mvm, "failed to add new_ctx during channel switch\n"); in iwl_mvm_switch_vif_chanctx_swap()
4367 ret = __iwl_mvm_assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].new_ctx, in iwl_mvm_switch_vif_chanctx_swap()
4370 IWL_ERR(mvm, in iwl_mvm_switch_vif_chanctx_swap()
4376 if (iwl_mvm_phy_ctx_count(mvm) > 1) in iwl_mvm_switch_vif_chanctx_swap()
4377 iwl_mvm_teardown_tdls_peers(mvm); in iwl_mvm_switch_vif_chanctx_swap()
4382 __iwl_mvm_remove_chanctx(mvm, vifs[0].new_ctx); in iwl_mvm_switch_vif_chanctx_swap()
4385 if (__iwl_mvm_add_chanctx(mvm, vifs[0].old_ctx)) { in iwl_mvm_switch_vif_chanctx_swap()
4386 IWL_ERR(mvm, "failed to add old_ctx back after failure.\n"); in iwl_mvm_switch_vif_chanctx_swap()
4390 if (__iwl_mvm_assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].old_ctx, in iwl_mvm_switch_vif_chanctx_swap()
4392 IWL_ERR(mvm, "failed to reassign old_ctx after failure.\n"); in iwl_mvm_switch_vif_chanctx_swap()
4400 iwl_mvm_nic_restart(mvm, false); in iwl_mvm_switch_vif_chanctx_swap()
4403 mutex_unlock(&mvm->mutex); in iwl_mvm_switch_vif_chanctx_swap()
4409 iwl_mvm_switch_vif_chanctx_reassign(struct iwl_mvm *mvm, in iwl_mvm_switch_vif_chanctx_reassign() argument
4414 mutex_lock(&mvm->mutex); in iwl_mvm_switch_vif_chanctx_reassign()
4415 __iwl_mvm_unassign_vif_chanctx(mvm, vifs[0].vif, vifs[0].old_ctx, true); in iwl_mvm_switch_vif_chanctx_reassign()
4417 ret = __iwl_mvm_assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].new_ctx, in iwl_mvm_switch_vif_chanctx_reassign()
4420 IWL_ERR(mvm, in iwl_mvm_switch_vif_chanctx_reassign()
4428 if (__iwl_mvm_assign_vif_chanctx(mvm, vifs[0].vif, vifs[0].old_ctx, in iwl_mvm_switch_vif_chanctx_reassign()
4430 IWL_ERR(mvm, "failed to reassign old_ctx after failure.\n"); in iwl_mvm_switch_vif_chanctx_reassign()
4438 iwl_mvm_nic_restart(mvm, false); in iwl_mvm_switch_vif_chanctx_reassign()
4441 mutex_unlock(&mvm->mutex); in iwl_mvm_switch_vif_chanctx_reassign()
4451 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_switch_vif_chanctx() local
4460 ret = iwl_mvm_switch_vif_chanctx_swap(mvm, vifs); in iwl_mvm_switch_vif_chanctx()
4463 ret = iwl_mvm_switch_vif_chanctx_reassign(mvm, vifs); in iwl_mvm_switch_vif_chanctx()
4475 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_tx_last_beacon() local
4477 return mvm->ibss_manager; in iwl_mvm_tx_last_beacon()
4484 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_set_tim() local
4488 IWL_ERR(mvm, "Station is not associated to a vif\n"); in iwl_mvm_set_tim()
4492 return iwl_mvm_mac_ctxt_beacon_changed(mvm, mvm_sta->vif); in iwl_mvm_set_tim()
4502 static int __iwl_mvm_mac_testmode_cmd(struct iwl_mvm *mvm, in __iwl_mvm_mac_testmode_cmd() argument
4529 mvm->noa_duration = noa_duration; in __iwl_mvm_mac_testmode_cmd()
4530 mvm->noa_vif = vif; in __iwl_mvm_mac_testmode_cmd()
4532 return iwl_mvm_update_quotas(mvm, true, NULL); in __iwl_mvm_mac_testmode_cmd()
4541 return iwl_mvm_enable_beacon_filter(mvm, vif, 0); in __iwl_mvm_mac_testmode_cmd()
4542 return iwl_mvm_disable_beacon_filter(mvm, vif, 0); in __iwl_mvm_mac_testmode_cmd()
4552 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_testmode_cmd() local
4555 mutex_lock(&mvm->mutex); in iwl_mvm_mac_testmode_cmd()
4556 err = __iwl_mvm_mac_testmode_cmd(mvm, vif, data, len); in iwl_mvm_mac_testmode_cmd()
4557 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_testmode_cmd()
4577 static int iwl_mvm_schedule_client_csa(struct iwl_mvm *mvm, in iwl_mvm_schedule_client_csa() argument
4591 lockdep_assert_held(&mvm->mutex); in iwl_mvm_schedule_client_csa()
4597 return iwl_mvm_send_cmd_pdu(mvm, in iwl_mvm_schedule_client_csa()
4603 static int iwl_mvm_old_pre_chan_sw_sta(struct iwl_mvm *mvm, in iwl_mvm_old_pre_chan_sw_sta() argument
4624 iwl_mvm_csa_client_absent(mvm, vif); in iwl_mvm_old_pre_chan_sw_sta()
4627 int ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0); in iwl_mvm_old_pre_chan_sw_sta()
4633 iwl_mvm_schedule_csa_period(mvm, vif, vif->bss_conf.beacon_int, in iwl_mvm_old_pre_chan_sw_sta()
4644 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_pre_channel_switch() local
4649 mutex_lock(&mvm->mutex); in iwl_mvm_pre_channel_switch()
4653 IWL_DEBUG_MAC80211(mvm, "pre CSA to freq %d\n", in iwl_mvm_pre_channel_switch()
4656 iwl_fw_dbg_trigger_simple_stop(&mvm->fwrt, in iwl_mvm_pre_channel_switch()
4663 rcu_dereference_protected(mvm->csa_vif, in iwl_mvm_pre_channel_switch()
4664 lockdep_is_held(&mvm->mutex)); in iwl_mvm_pre_channel_switch()
4672 if (rcu_dereference_protected(mvm->csa_tx_blocked_vif, in iwl_mvm_pre_channel_switch()
4673 lockdep_is_held(&mvm->mutex))) { in iwl_mvm_pre_channel_switch()
4678 rcu_assign_pointer(mvm->csa_vif, vif); in iwl_mvm_pre_channel_switch()
4694 if (iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, in iwl_mvm_pre_channel_switch()
4724 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_pre_channel_switch()
4726 ret = iwl_mvm_old_pre_chan_sw_sta(mvm, vif, chsw); in iwl_mvm_pre_channel_switch()
4730 iwl_mvm_schedule_client_csa(mvm, vif, chsw); in iwl_mvm_pre_channel_switch()
4742 ret = iwl_mvm_power_update_ps(mvm); in iwl_mvm_pre_channel_switch()
4747 iwl_mvm_teardown_tdls_peers(mvm); in iwl_mvm_pre_channel_switch()
4750 mutex_unlock(&mvm->mutex); in iwl_mvm_pre_channel_switch()
4759 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_channel_switch_rx_beacon() local
4774 if (iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP, in iwl_mvm_channel_switch_rx_beacon()
4778 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_CS_MODIFY)) in iwl_mvm_channel_switch_rx_beacon()
4781 IWL_DEBUG_MAC80211(mvm, "Modify CSA on mac %d count = %d (old %d) mode = %d\n", in iwl_mvm_channel_switch_rx_beacon()
4796 mutex_lock(&mvm->mutex); in iwl_mvm_channel_switch_rx_beacon()
4800 WARN_ON(iwl_mvm_send_cmd_pdu(mvm, in iwl_mvm_channel_switch_rx_beacon()
4805 mutex_unlock(&mvm->mutex); in iwl_mvm_channel_switch_rx_beacon()
4808 static void iwl_mvm_flush_no_vif(struct iwl_mvm *mvm, u32 queues, bool drop) in iwl_mvm_flush_no_vif() argument
4812 if (!iwl_mvm_has_new_tx_api(mvm)) { in iwl_mvm_flush_no_vif()
4814 mutex_lock(&mvm->mutex); in iwl_mvm_flush_no_vif()
4815 iwl_mvm_flush_tx_path(mvm, in iwl_mvm_flush_no_vif()
4816 iwl_mvm_flushable_queues(mvm) & queues); in iwl_mvm_flush_no_vif()
4817 mutex_unlock(&mvm->mutex); in iwl_mvm_flush_no_vif()
4819 iwl_trans_wait_tx_queues_empty(mvm->trans, queues); in iwl_mvm_flush_no_vif()
4824 mutex_lock(&mvm->mutex); in iwl_mvm_flush_no_vif()
4825 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { in iwl_mvm_flush_no_vif()
4828 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_flush_no_vif()
4829 lockdep_is_held(&mvm->mutex)); in iwl_mvm_flush_no_vif()
4834 iwl_mvm_flush_sta_tids(mvm, i, 0xFFFF); in iwl_mvm_flush_no_vif()
4836 iwl_mvm_wait_sta_queues_empty(mvm, in iwl_mvm_flush_no_vif()
4839 mutex_unlock(&mvm->mutex); in iwl_mvm_flush_no_vif()
4845 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_flush() local
4853 iwl_mvm_flush_no_vif(mvm, queues, drop); in iwl_mvm_mac_flush()
4861 flush_work(&mvm->add_stream_wk); in iwl_mvm_mac_flush()
4863 mutex_lock(&mvm->mutex); in iwl_mvm_mac_flush()
4867 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { in iwl_mvm_mac_flush()
4868 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_mac_flush()
4869 lockdep_is_held(&mvm->mutex)); in iwl_mvm_mac_flush()
4881 if (iwl_mvm_flush_sta(mvm, mvmsta, false)) in iwl_mvm_mac_flush()
4882 IWL_ERR(mvm, "flush request fail\n"); in iwl_mvm_mac_flush()
4885 if (iwl_mvm_has_new_tx_api(mvm)) in iwl_mvm_mac_flush()
4886 iwl_mvm_wait_sta_queues_empty(mvm, mvmsta); in iwl_mvm_mac_flush()
4890 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_flush()
4895 if (!drop && !iwl_mvm_has_new_tx_api(mvm)) in iwl_mvm_mac_flush()
4896 iwl_trans_wait_tx_queues_empty(mvm->trans, msk); in iwl_mvm_mac_flush()
4902 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_get_survey() local
4911 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_get_survey()
4915 mutex_lock(&mvm->mutex); in iwl_mvm_mac_get_survey()
4917 if (iwl_mvm_firmware_running(mvm)) { in iwl_mvm_mac_get_survey()
4918 ret = iwl_mvm_request_statistics(mvm, false); in iwl_mvm_mac_get_survey()
4927 survey->time = mvm->accu_radio_stats.on_time_rf + in iwl_mvm_mac_get_survey()
4928 mvm->radio_stats.on_time_rf; in iwl_mvm_mac_get_survey()
4931 survey->time_rx = mvm->accu_radio_stats.rx_time + in iwl_mvm_mac_get_survey()
4932 mvm->radio_stats.rx_time; in iwl_mvm_mac_get_survey()
4935 survey->time_tx = mvm->accu_radio_stats.tx_time + in iwl_mvm_mac_get_survey()
4936 mvm->radio_stats.tx_time; in iwl_mvm_mac_get_survey()
4939 survey->time_scan = mvm->accu_radio_stats.on_time_scan + in iwl_mvm_mac_get_survey()
4940 mvm->radio_stats.on_time_scan; in iwl_mvm_mac_get_survey()
4945 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_get_survey()
5082 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_sta_statistics() local
5091 if (iwl_mvm_has_tlc_offload(mvm)) { in iwl_mvm_mac_sta_statistics()
5105 mutex_lock(&mvm->mutex); in iwl_mvm_mac_sta_statistics()
5110 if (iwl_mvm_request_statistics(mvm, false)) in iwl_mvm_mac_sta_statistics()
5122 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_sta_statistics()
5125 static void iwl_mvm_event_mlme_callback_ini(struct iwl_mvm *mvm, in iwl_mvm_event_mlme_callback_ini() argument
5131 iwl_dbg_tlv_time_point(&mvm->fwrt, in iwl_mvm_event_mlme_callback_ini()
5138 iwl_dbg_tlv_time_point(&mvm->fwrt, in iwl_mvm_event_mlme_callback_ini()
5145 static void iwl_mvm_event_mlme_callback(struct iwl_mvm *mvm, in iwl_mvm_event_mlme_callback() argument
5153 iwl_fw_dbg_collect_trig(&(mvm)->fwrt, trig, _fmt); \ in iwl_mvm_event_mlme_callback()
5159 if (iwl_trans_dbg_ini_valid(mvm->trans)) { in iwl_mvm_event_mlme_callback()
5160 iwl_mvm_event_mlme_callback_ini(mvm, vif, &event->u.mlme); in iwl_mvm_event_mlme_callback()
5164 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_event_mlme_callback()
5197 static void iwl_mvm_event_bar_rx_callback(struct iwl_mvm *mvm, in iwl_mvm_event_bar_rx_callback() argument
5204 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_event_bar_rx_callback()
5214 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, in iwl_mvm_event_bar_rx_callback()
5224 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_event_callback() local
5228 iwl_mvm_event_mlme_callback(mvm, vif, event); in iwl_mvm_mac_event_callback()
5231 iwl_mvm_event_bar_rx_callback(mvm, vif, event); in iwl_mvm_mac_event_callback()
5234 iwl_mvm_event_frame_timeout_callback(mvm, vif, event->u.ba.sta, in iwl_mvm_mac_event_callback()
5242 void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm, in iwl_mvm_sync_rx_queues_internal() argument
5251 .cmd.rxq_mask = cpu_to_le32(BIT(mvm->trans->num_rx_queues) - 1), in iwl_mvm_sync_rx_queues_internal()
5272 if (!iwl_mvm_has_new_rx_api(mvm)) in iwl_mvm_sync_rx_queues_internal()
5276 cmd.notif.cookie = mvm->queue_sync_cookie; in iwl_mvm_sync_rx_queues_internal()
5277 mvm->queue_sync_state = (1 << mvm->trans->num_rx_queues) - 1; in iwl_mvm_sync_rx_queues_internal()
5280 ret = iwl_mvm_send_cmd(mvm, &hcmd); in iwl_mvm_sync_rx_queues_internal()
5282 IWL_ERR(mvm, "Failed to trigger RX queues sync (%d)\n", ret); in iwl_mvm_sync_rx_queues_internal()
5287 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sync_rx_queues_internal()
5288 ret = wait_event_timeout(mvm->rx_sync_waitq, in iwl_mvm_sync_rx_queues_internal()
5289 READ_ONCE(mvm->queue_sync_state) == 0 || in iwl_mvm_sync_rx_queues_internal()
5290 iwl_mvm_is_radio_killed(mvm), in iwl_mvm_sync_rx_queues_internal()
5292 WARN_ONCE(!ret && !iwl_mvm_is_radio_killed(mvm), in iwl_mvm_sync_rx_queues_internal()
5294 mvm->queue_sync_state); in iwl_mvm_sync_rx_queues_internal()
5299 mvm->queue_sync_state = 0; in iwl_mvm_sync_rx_queues_internal()
5300 mvm->queue_sync_cookie++; in iwl_mvm_sync_rx_queues_internal()
5306 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_sync_rx_queues() local
5308 mutex_lock(&mvm->mutex); in iwl_mvm_sync_rx_queues()
5309 iwl_mvm_sync_rx_queues_internal(mvm, IWL_MVM_RXQ_EMPTY, true, NULL, 0); in iwl_mvm_sync_rx_queues()
5310 mutex_unlock(&mvm->mutex); in iwl_mvm_sync_rx_queues()
5318 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_get_ftm_responder_stats() local
5325 mutex_lock(&mvm->mutex); in iwl_mvm_mac_get_ftm_responder_stats()
5326 *stats = mvm->ftm_resp_stats; in iwl_mvm_mac_get_ftm_responder_stats()
5327 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_get_ftm_responder_stats()
5346 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_start_pmsr() local
5349 mutex_lock(&mvm->mutex); in iwl_mvm_start_pmsr()
5350 ret = iwl_mvm_ftm_start(mvm, vif, request); in iwl_mvm_start_pmsr()
5351 mutex_unlock(&mvm->mutex); in iwl_mvm_start_pmsr()
5360 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_abort_pmsr() local
5362 mutex_lock(&mvm->mutex); in iwl_mvm_abort_pmsr()
5363 iwl_mvm_ftm_abort(mvm, request); in iwl_mvm_abort_pmsr()
5364 mutex_unlock(&mvm->mutex); in iwl_mvm_abort_pmsr()
5381 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_can_aggregate() local
5383 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) in iwl_mvm_mac_can_aggregate()
5384 return iwl_mvm_tx_csum_bz(mvm, head, true) == in iwl_mvm_mac_can_aggregate()
5385 iwl_mvm_tx_csum_bz(mvm, skb, true); in iwl_mvm_mac_can_aggregate()
5391 if (!iwl_mvm_is_csum_supported(mvm)) in iwl_mvm_mac_can_aggregate()