Lines Matching refs:mvm

103 static inline void *iwl_mvm_get_scan_req_umac_data(struct iwl_mvm *mvm)  in iwl_mvm_get_scan_req_umac_data()  argument
105 struct iwl_scan_req_umac *cmd = mvm->scan_cmd; in iwl_mvm_get_scan_req_umac_data()
107 if (iwl_mvm_is_adaptive_dwell_v2_supported(mvm)) in iwl_mvm_get_scan_req_umac_data()
110 if (iwl_mvm_is_adaptive_dwell_supported(mvm)) in iwl_mvm_get_scan_req_umac_data()
113 if (iwl_mvm_cdb_scan_api(mvm)) in iwl_mvm_get_scan_req_umac_data()
120 iwl_mvm_get_scan_req_umac_channel(struct iwl_mvm *mvm) in iwl_mvm_get_scan_req_umac_channel() argument
122 struct iwl_scan_req_umac *cmd = mvm->scan_cmd; in iwl_mvm_get_scan_req_umac_channel()
124 if (iwl_mvm_is_adaptive_dwell_v2_supported(mvm)) in iwl_mvm_get_scan_req_umac_channel()
127 if (iwl_mvm_is_adaptive_dwell_supported(mvm)) in iwl_mvm_get_scan_req_umac_channel()
130 if (iwl_mvm_cdb_scan_api(mvm)) in iwl_mvm_get_scan_req_umac_channel()
136 static u8 iwl_mvm_scan_rx_ant(struct iwl_mvm *mvm) in iwl_mvm_scan_rx_ant() argument
138 if (mvm->scan_rx_ant != ANT_NONE) in iwl_mvm_scan_rx_ant()
139 return mvm->scan_rx_ant; in iwl_mvm_scan_rx_ant()
140 return iwl_mvm_get_valid_rx_ant(mvm); in iwl_mvm_scan_rx_ant()
143 static inline __le16 iwl_mvm_scan_rx_chain(struct iwl_mvm *mvm) in iwl_mvm_scan_rx_chain() argument
148 rx_ant = iwl_mvm_scan_rx_ant(mvm); in iwl_mvm_scan_rx_chain()
157 iwl_mvm_scan_rate_n_flags(struct iwl_mvm *mvm, enum nl80211_band band, in iwl_mvm_scan_rate_n_flags() argument
162 iwl_mvm_toggle_tx_ant(mvm, &mvm->scan_last_antenna_idx); in iwl_mvm_scan_rate_n_flags()
163 tx_ant = BIT(mvm->scan_last_antenna_idx) << RATE_MCS_ANT_POS; in iwl_mvm_scan_rate_n_flags()
172 static enum iwl_mvm_traffic_load iwl_mvm_get_traffic_load(struct iwl_mvm *mvm) in iwl_mvm_get_traffic_load() argument
174 return mvm->tcm.result.global_load; in iwl_mvm_get_traffic_load()
178 iwl_mvm_get_traffic_load_band(struct iwl_mvm *mvm, enum nl80211_band band) in iwl_mvm_get_traffic_load_band() argument
180 return mvm->tcm.result.band_load[band]; in iwl_mvm_get_traffic_load_band()
212 iwl_mvm_scan_type _iwl_mvm_get_scan_type(struct iwl_mvm *mvm, in _iwl_mvm_get_scan_type() argument
223 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in _iwl_mvm_get_scan_type()
231 if (fw_has_api(&mvm->fw->ucode_capa, in _iwl_mvm_get_scan_type()
254 iwl_mvm_scan_type iwl_mvm_get_scan_type(struct iwl_mvm *mvm, in iwl_mvm_get_scan_type() argument
260 load = iwl_mvm_get_traffic_load(mvm); in iwl_mvm_get_scan_type()
261 low_latency = iwl_mvm_low_latency(mvm); in iwl_mvm_get_scan_type()
263 return _iwl_mvm_get_scan_type(mvm, vif, load, low_latency); in iwl_mvm_get_scan_type()
267 iwl_mvm_scan_type iwl_mvm_get_scan_type_band(struct iwl_mvm *mvm, in iwl_mvm_get_scan_type_band() argument
274 load = iwl_mvm_get_traffic_load_band(mvm, band); in iwl_mvm_get_scan_type_band()
275 low_latency = iwl_mvm_low_latency_band(mvm, band); in iwl_mvm_get_scan_type_band()
277 return _iwl_mvm_get_scan_type(mvm, vif, load, low_latency); in iwl_mvm_get_scan_type_band()
280 static inline bool iwl_mvm_rrm_scan_needed(struct iwl_mvm *mvm) in iwl_mvm_rrm_scan_needed() argument
283 return fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_rrm_scan_needed()
287 static int iwl_mvm_max_scan_ie_fw_cmd_room(struct iwl_mvm *mvm) in iwl_mvm_max_scan_ie_fw_cmd_room() argument
297 if (iwl_mvm_rrm_scan_needed(mvm)) in iwl_mvm_max_scan_ie_fw_cmd_room()
303 int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm) in iwl_mvm_max_scan_ie_len() argument
305 int max_ie_len = iwl_mvm_max_scan_ie_fw_cmd_room(mvm); in iwl_mvm_max_scan_ie_len()
320 void iwl_mvm_rx_lmac_scan_iter_complete_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_lmac_scan_iter_complete_notif() argument
326 IWL_DEBUG_SCAN(mvm, in iwl_mvm_rx_lmac_scan_iter_complete_notif()
330 if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_FOUND) { in iwl_mvm_rx_lmac_scan_iter_complete_notif()
331 IWL_DEBUG_SCAN(mvm, "Pass all scheduled scan results found\n"); in iwl_mvm_rx_lmac_scan_iter_complete_notif()
332 ieee80211_sched_scan_results(mvm->hw); in iwl_mvm_rx_lmac_scan_iter_complete_notif()
333 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_ENABLED; in iwl_mvm_rx_lmac_scan_iter_complete_notif()
337 void iwl_mvm_rx_scan_match_found(struct iwl_mvm *mvm, in iwl_mvm_rx_scan_match_found() argument
340 IWL_DEBUG_SCAN(mvm, "Scheduled scan results\n"); in iwl_mvm_rx_scan_match_found()
341 ieee80211_sched_scan_results(mvm->hw); in iwl_mvm_rx_scan_match_found()
358 void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_lmac_scan_complete_notif() argument
368 if (WARN_ON_ONCE(fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_rx_lmac_scan_complete_notif()
373 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rx_lmac_scan_complete_notif()
385 if (mvm->scan_status & IWL_MVM_SCAN_STOPPING_SCHED) { in iwl_mvm_rx_lmac_scan_complete_notif()
386 WARN_ON_ONCE(mvm->scan_status & IWL_MVM_SCAN_STOPPING_REGULAR); in iwl_mvm_rx_lmac_scan_complete_notif()
388 IWL_DEBUG_SCAN(mvm, "Scheduled scan %s, EBS status %s\n", in iwl_mvm_rx_lmac_scan_complete_notif()
391 IWL_DEBUG_SCAN(mvm, in iwl_mvm_rx_lmac_scan_complete_notif()
397 mvm->scan_status &= ~IWL_MVM_SCAN_STOPPING_SCHED; in iwl_mvm_rx_lmac_scan_complete_notif()
398 } else if (mvm->scan_status & IWL_MVM_SCAN_STOPPING_REGULAR) { in iwl_mvm_rx_lmac_scan_complete_notif()
399 IWL_DEBUG_SCAN(mvm, "Regular scan %s, EBS status %s\n", in iwl_mvm_rx_lmac_scan_complete_notif()
403 mvm->scan_status &= ~IWL_MVM_SCAN_STOPPING_REGULAR; in iwl_mvm_rx_lmac_scan_complete_notif()
404 } else if (mvm->scan_status & IWL_MVM_SCAN_SCHED) { in iwl_mvm_rx_lmac_scan_complete_notif()
405 WARN_ON_ONCE(mvm->scan_status & IWL_MVM_SCAN_REGULAR); in iwl_mvm_rx_lmac_scan_complete_notif()
407 IWL_DEBUG_SCAN(mvm, "Scheduled scan %s, EBS status %s\n", in iwl_mvm_rx_lmac_scan_complete_notif()
410 IWL_DEBUG_SCAN(mvm, in iwl_mvm_rx_lmac_scan_complete_notif()
416 mvm->scan_status &= ~IWL_MVM_SCAN_SCHED; in iwl_mvm_rx_lmac_scan_complete_notif()
417 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_rx_lmac_scan_complete_notif()
418 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_rx_lmac_scan_complete_notif()
419 } else if (mvm->scan_status & IWL_MVM_SCAN_REGULAR) { in iwl_mvm_rx_lmac_scan_complete_notif()
424 IWL_DEBUG_SCAN(mvm, "Regular scan %s, EBS status %s (FW)\n", in iwl_mvm_rx_lmac_scan_complete_notif()
428 mvm->scan_status &= ~IWL_MVM_SCAN_REGULAR; in iwl_mvm_rx_lmac_scan_complete_notif()
429 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_rx_lmac_scan_complete_notif()
430 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_rx_lmac_scan_complete_notif()
431 iwl_mvm_resume_tcm(mvm); in iwl_mvm_rx_lmac_scan_complete_notif()
433 IWL_ERR(mvm, in iwl_mvm_rx_lmac_scan_complete_notif()
437 mvm->last_ebs_successful = in iwl_mvm_rx_lmac_scan_complete_notif()
506 iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm, in iwl_mvm_config_sched_scan_profiles() argument
513 int max_profiles = iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_config_sched_scan_profiles()
529 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_SHORT_BL) in iwl_mvm_config_sched_scan_profiles()
580 IWL_DEBUG_SCAN(mvm, "Sending scheduled scan profile config\n"); in iwl_mvm_config_sched_scan_profiles()
582 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_config_sched_scan_profiles()
590 static bool iwl_mvm_scan_pass_all(struct iwl_mvm *mvm, in iwl_mvm_scan_pass_all() argument
594 IWL_DEBUG_SCAN(mvm, in iwl_mvm_scan_pass_all()
597 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_scan_pass_all()
601 IWL_DEBUG_SCAN(mvm, "Sending Scheduled scan without filtering\n"); in iwl_mvm_scan_pass_all()
603 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_ENABLED; in iwl_mvm_scan_pass_all()
607 static int iwl_mvm_lmac_scan_abort(struct iwl_mvm *mvm) in iwl_mvm_lmac_scan_abort() argument
615 ret = iwl_mvm_send_cmd_status(mvm, &cmd, &status); in iwl_mvm_lmac_scan_abort()
627 IWL_DEBUG_SCAN(mvm, "SCAN OFFLOAD ABORT ret %d.\n", status); in iwl_mvm_lmac_scan_abort()
634 static void iwl_mvm_scan_fill_tx_cmd(struct iwl_mvm *mvm, in iwl_mvm_scan_fill_tx_cmd() argument
640 tx_cmd[0].rate_n_flags = iwl_mvm_scan_rate_n_flags(mvm, in iwl_mvm_scan_fill_tx_cmd()
644 if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) < 12) { in iwl_mvm_scan_fill_tx_cmd()
645 tx_cmd[0].sta_id = mvm->aux_sta.sta_id; in iwl_mvm_scan_fill_tx_cmd()
646 tx_cmd[1].sta_id = mvm->aux_sta.sta_id; in iwl_mvm_scan_fill_tx_cmd()
660 tx_cmd[1].rate_n_flags = iwl_mvm_scan_rate_n_flags(mvm, in iwl_mvm_scan_fill_tx_cmd()
666 iwl_mvm_lmac_scan_cfg_channels(struct iwl_mvm *mvm, in iwl_mvm_lmac_scan_cfg_channels() argument
685 static u8 *iwl_mvm_copy_and_insert_ds_elem(struct iwl_mvm *mvm, const u8 *ies, in iwl_mvm_copy_and_insert_ds_elem() argument
697 if (!iwl_mvm_rrm_scan_needed(mvm)) { in iwl_mvm_copy_and_insert_ds_elem()
738 iwl_mvm_build_scan_probe(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_build_scan_probe() argument
772 newpos = iwl_mvm_copy_and_insert_ds_elem(mvm, in iwl_mvm_build_scan_probe()
796 if (iwl_mvm_rrm_scan_needed(mvm) && in iwl_mvm_build_scan_probe()
797 !fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_build_scan_probe()
807 static void iwl_mvm_scan_lmac_dwell(struct iwl_mvm *mvm, in iwl_mvm_scan_lmac_dwell() argument
820 static inline bool iwl_mvm_scan_fits(struct iwl_mvm *mvm, int n_ssids, in iwl_mvm_scan_fits() argument
825 (n_channels <= mvm->fw->ucode_capa.n_scan_channels) & in iwl_mvm_scan_fits()
829 iwl_mvm_max_scan_ie_fw_cmd_room(mvm))); in iwl_mvm_scan_fits()
832 static inline bool iwl_mvm_scan_use_ebs(struct iwl_mvm *mvm, in iwl_mvm_scan_use_ebs() argument
835 const struct iwl_ucode_capabilities *capa = &mvm->fw->ucode_capa; in iwl_mvm_scan_use_ebs()
838 if (iwl_mvm_is_cdb_supported(mvm)) in iwl_mvm_scan_use_ebs()
839 low_latency = iwl_mvm_low_latency_band(mvm, NL80211_BAND_5GHZ); in iwl_mvm_scan_use_ebs()
841 low_latency = iwl_mvm_low_latency(mvm); in iwl_mvm_scan_use_ebs()
852 mvm->last_ebs_successful && IWL_MVM_ENABLE_EBS && in iwl_mvm_scan_use_ebs()
854 (!low_latency || iwl_mvm_is_frag_ebs_supported(mvm))); in iwl_mvm_scan_use_ebs()
869 static int iwl_mvm_scan_lmac_flags(struct iwl_mvm *mvm, in iwl_mvm_scan_lmac_flags() argument
884 if (iwl_mvm_rrm_scan_needed(mvm) && in iwl_mvm_scan_lmac_flags()
885 fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_scan_lmac_flags()
895 if (mvm->scan_iter_notif_enabled) in iwl_mvm_scan_lmac_flags()
899 if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_ENABLED) in iwl_mvm_scan_lmac_flags()
923 static int iwl_mvm_scan_lmac(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_scan_lmac() argument
926 struct iwl_scan_req_lmac *cmd = mvm->scan_cmd; in iwl_mvm_scan_lmac()
929 mvm->fw->ucode_capa.n_scan_channels); in iwl_mvm_scan_lmac()
937 iwl_mvm_scan_lmac_dwell(mvm, cmd, params); in iwl_mvm_scan_lmac()
939 cmd->rx_chain_select = iwl_mvm_scan_rx_chain(mvm); in iwl_mvm_scan_lmac()
945 cmd->scan_flags = cpu_to_le32(iwl_mvm_scan_lmac_flags(mvm, params, in iwl_mvm_scan_lmac()
952 iwl_mvm_scan_fill_tx_cmd(mvm, cmd->tx_cmd, params->no_cck); in iwl_mvm_scan_lmac()
977 if (iwl_mvm_scan_use_ebs(mvm, vif)) { in iwl_mvm_scan_lmac()
992 iwl_mvm_lmac_scan_cfg_channels(mvm, params->channels, in iwl_mvm_scan_lmac()
1020 static __le32 iwl_mvm_scan_config_rates(struct iwl_mvm *mvm) in iwl_mvm_scan_config_rates() argument
1026 band = &mvm->nvm_data->bands[NL80211_BAND_2GHZ]; in iwl_mvm_scan_config_rates()
1029 band = &mvm->nvm_data->bands[NL80211_BAND_5GHZ]; in iwl_mvm_scan_config_rates()
1039 static void iwl_mvm_fill_scan_dwell(struct iwl_mvm *mvm, in iwl_mvm_fill_scan_dwell() argument
1048 static void iwl_mvm_fill_channels(struct iwl_mvm *mvm, u8 *channels, in iwl_mvm_fill_channels() argument
1054 band = &mvm->nvm_data->bands[NL80211_BAND_2GHZ]; in iwl_mvm_fill_channels()
1057 band = &mvm->nvm_data->bands[NL80211_BAND_5GHZ]; in iwl_mvm_fill_channels()
1062 static void iwl_mvm_fill_scan_config_v1(struct iwl_mvm *mvm, void *config, in iwl_mvm_fill_scan_config_v1() argument
1066 enum iwl_mvm_scan_type type = iwl_mvm_get_scan_type(mvm, NULL); in iwl_mvm_fill_scan_config_v1()
1070 cfg->tx_chains = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm)); in iwl_mvm_fill_scan_config_v1()
1071 cfg->rx_chains = cpu_to_le32(iwl_mvm_scan_rx_ant(mvm)); in iwl_mvm_fill_scan_config_v1()
1072 cfg->legacy_rates = iwl_mvm_scan_config_rates(mvm); in iwl_mvm_fill_scan_config_v1()
1076 iwl_mvm_fill_scan_dwell(mvm, &cfg->dwell); in iwl_mvm_fill_scan_config_v1()
1078 memcpy(&cfg->mac_addr, &mvm->addresses[0].addr, ETH_ALEN); in iwl_mvm_fill_scan_config_v1()
1081 WARN_ON_ONCE(iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) >= 12); in iwl_mvm_fill_scan_config_v1()
1083 cfg->bcast_sta_id = mvm->aux_sta.sta_id; in iwl_mvm_fill_scan_config_v1()
1086 iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels); in iwl_mvm_fill_scan_config_v1()
1089 static void iwl_mvm_fill_scan_config_v2(struct iwl_mvm *mvm, void *config, in iwl_mvm_fill_scan_config_v2() argument
1096 cfg->tx_chains = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm)); in iwl_mvm_fill_scan_config_v2()
1097 cfg->rx_chains = cpu_to_le32(iwl_mvm_scan_rx_ant(mvm)); in iwl_mvm_fill_scan_config_v2()
1098 cfg->legacy_rates = iwl_mvm_scan_config_rates(mvm); in iwl_mvm_fill_scan_config_v2()
1100 if (iwl_mvm_is_cdb_supported(mvm)) { in iwl_mvm_fill_scan_config_v2()
1103 lb_type = iwl_mvm_get_scan_type_band(mvm, NULL, in iwl_mvm_fill_scan_config_v2()
1105 hb_type = iwl_mvm_get_scan_type_band(mvm, NULL, in iwl_mvm_fill_scan_config_v2()
1119 iwl_mvm_get_scan_type(mvm, NULL); in iwl_mvm_fill_scan_config_v2()
1127 iwl_mvm_fill_scan_dwell(mvm, &cfg->dwell); in iwl_mvm_fill_scan_config_v2()
1129 memcpy(&cfg->mac_addr, &mvm->addresses[0].addr, ETH_ALEN); in iwl_mvm_fill_scan_config_v2()
1132 WARN_ON_ONCE(iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) >= 12); in iwl_mvm_fill_scan_config_v2()
1134 cfg->bcast_sta_id = mvm->aux_sta.sta_id; in iwl_mvm_fill_scan_config_v2()
1137 iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels); in iwl_mvm_fill_scan_config_v2()
1140 static int iwl_mvm_legacy_config_scan(struct iwl_mvm *mvm) in iwl_mvm_legacy_config_scan() argument
1150 mvm->nvm_data->bands[NL80211_BAND_2GHZ].n_channels + in iwl_mvm_legacy_config_scan()
1151 mvm->nvm_data->bands[NL80211_BAND_5GHZ].n_channels; in iwl_mvm_legacy_config_scan()
1155 if (WARN_ON(num_channels > mvm->fw->ucode_capa.n_scan_channels)) in iwl_mvm_legacy_config_scan()
1156 num_channels = mvm->fw->ucode_capa.n_scan_channels; in iwl_mvm_legacy_config_scan()
1158 if (iwl_mvm_is_cdb_supported(mvm)) { in iwl_mvm_legacy_config_scan()
1159 type = iwl_mvm_get_scan_type_band(mvm, NULL, in iwl_mvm_legacy_config_scan()
1161 hb_type = iwl_mvm_get_scan_type_band(mvm, NULL, in iwl_mvm_legacy_config_scan()
1163 if (type == mvm->scan_type && hb_type == mvm->hb_scan_type) in iwl_mvm_legacy_config_scan()
1166 type = iwl_mvm_get_scan_type(mvm, NULL); in iwl_mvm_legacy_config_scan()
1167 if (type == mvm->scan_type) in iwl_mvm_legacy_config_scan()
1171 if (iwl_mvm_cdb_scan_api(mvm)) in iwl_mvm_legacy_config_scan()
1175 cmd_size += mvm->fw->ucode_capa.n_scan_channels; in iwl_mvm_legacy_config_scan()
1204 if (iwl_mvm_cdb_scan_api(mvm)) { in iwl_mvm_legacy_config_scan()
1205 if (iwl_mvm_is_cdb_supported(mvm)) in iwl_mvm_legacy_config_scan()
1209 iwl_mvm_fill_scan_config_v2(mvm, cfg, flags, channel_flags, in iwl_mvm_legacy_config_scan()
1212 iwl_mvm_fill_scan_config_v1(mvm, cfg, flags, channel_flags, in iwl_mvm_legacy_config_scan()
1220 IWL_DEBUG_SCAN(mvm, "Sending UMAC scan config\n"); in iwl_mvm_legacy_config_scan()
1222 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_legacy_config_scan()
1224 mvm->scan_type = type; in iwl_mvm_legacy_config_scan()
1225 mvm->hb_scan_type = hb_type; in iwl_mvm_legacy_config_scan()
1232 int iwl_mvm_config_scan(struct iwl_mvm *mvm) in iwl_mvm_config_scan() argument
1242 if (!iwl_mvm_is_reduced_config_scan_supported(mvm)) in iwl_mvm_config_scan()
1243 return iwl_mvm_legacy_config_scan(mvm); in iwl_mvm_config_scan()
1247 if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) < 12) { in iwl_mvm_config_scan()
1248 cfg.bcast_sta_id = mvm->aux_sta.sta_id; in iwl_mvm_config_scan()
1249 } else if (iwl_fw_lookup_cmd_ver(mvm->fw, SCAN_CFG_CMD, 0) < 5) { in iwl_mvm_config_scan()
1257 cfg.tx_chains = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm)); in iwl_mvm_config_scan()
1258 cfg.rx_chains = cpu_to_le32(iwl_mvm_scan_rx_ant(mvm)); in iwl_mvm_config_scan()
1260 IWL_DEBUG_SCAN(mvm, "Sending UMAC scan config\n"); in iwl_mvm_config_scan()
1262 return iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_config_scan()
1265 static int iwl_mvm_scan_uid_by_status(struct iwl_mvm *mvm, int status) in iwl_mvm_scan_uid_by_status() argument
1269 for (i = 0; i < mvm->max_scans; i++) in iwl_mvm_scan_uid_by_status()
1270 if (mvm->scan_uid_status[i] == status) in iwl_mvm_scan_uid_by_status()
1276 static void iwl_mvm_scan_umac_dwell(struct iwl_mvm *mvm, in iwl_mvm_scan_umac_dwell() argument
1287 if (iwl_mvm_is_adaptive_dwell_supported(mvm)) { in iwl_mvm_scan_umac_dwell()
1293 if (iwl_mvm_is_adwell_hb_ap_num_supported(mvm)) in iwl_mvm_scan_umac_dwell()
1314 if (iwl_mvm_is_cdb_supported(mvm)) { in iwl_mvm_scan_umac_dwell()
1323 if (!iwl_mvm_is_adaptive_dwell_v2_supported(mvm)) { in iwl_mvm_scan_umac_dwell()
1330 if (iwl_mvm_is_cdb_supported(mvm)) { in iwl_mvm_scan_umac_dwell()
1343 if (iwl_mvm_is_cdb_supported(mvm)) { in iwl_mvm_scan_umac_dwell()
1352 if (iwl_mvm_cdb_scan_api(mvm)) { in iwl_mvm_scan_umac_dwell()
1383 iwl_mvm_scan_umac_dwell_v11(struct iwl_mvm *mvm, in iwl_mvm_scan_umac_dwell_v11() argument
1570 iwl_mvm_umac_scan_cfg_channels(struct iwl_mvm *mvm, in iwl_mvm_umac_scan_cfg_channels() argument
1580 if (iwl_mvm_is_scan_ext_chan_supported(mvm)) { in iwl_mvm_umac_scan_cfg_channels()
1595 iwl_mvm_umac_scan_cfg_channels_v4(struct iwl_mvm *mvm, in iwl_mvm_umac_scan_cfg_channels_v4() argument
1624 iwl_mvm_umac_scan_cfg_channels_v6(struct iwl_mvm *mvm, in iwl_mvm_umac_scan_cfg_channels_v6() argument
1650 iwl_mvm_umac_scan_fill_6g_chan_list(struct iwl_mvm *mvm, in iwl_mvm_umac_scan_fill_6g_chan_list() argument
1657 bool hidden_supported = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_umac_scan_fill_6g_chan_list()
1722 iwl_mvm_umac_scan_cfg_channels_v6_6g(struct iwl_mvm *mvm, in iwl_mvm_umac_scan_cfg_channels_v6_6g() argument
1876 IWL_DEBUG_SCAN(mvm, in iwl_mvm_umac_scan_cfg_channels_v6_6g()
1883 static u8 iwl_mvm_scan_umac_chan_flags_v2(struct iwl_mvm *mvm, in iwl_mvm_scan_umac_chan_flags_v2() argument
1891 if (iwl_mvm_scan_use_ebs(mvm, vif)) in iwl_mvm_scan_umac_chan_flags_v2()
1897 if ((!iwl_mvm_is_cdb_supported(mvm) && in iwl_mvm_scan_umac_chan_flags_v2()
1899 (iwl_mvm_is_cdb_supported(mvm) && in iwl_mvm_scan_umac_chan_flags_v2()
1907 if ((!iwl_mvm_is_cdb_supported(mvm) && in iwl_mvm_scan_umac_chan_flags_v2()
1909 (iwl_mvm_is_cdb_supported(mvm) && in iwl_mvm_scan_umac_chan_flags_v2()
1912 IWL_DEBUG_SCAN(mvm, "Respect P2P GO. Force EBS\n"); in iwl_mvm_scan_umac_chan_flags_v2()
1919 static void iwl_mvm_scan_6ghz_passive_scan(struct iwl_mvm *mvm, in iwl_mvm_scan_6ghz_passive_scan() argument
1924 &mvm->nvm_data->bands[NL80211_BAND_6GHZ]; in iwl_mvm_scan_6ghz_passive_scan()
1932 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_scan_6ghz_passive_scan()
1934 IWL_DEBUG_SCAN(mvm, in iwl_mvm_scan_6ghz_passive_scan()
1941 IWL_DEBUG_SCAN(mvm, in iwl_mvm_scan_6ghz_passive_scan()
1952 time_after(mvm->last_6ghz_passive_scan_jiffies + in iwl_mvm_scan_6ghz_passive_scan()
1954 (time_before(mvm->last_reset_or_resume_time_jiffies + in iwl_mvm_scan_6ghz_passive_scan()
1957 IWL_DEBUG_SCAN(mvm, "6GHz passive scan: %s\n", in iwl_mvm_scan_6ghz_passive_scan()
1965 IWL_DEBUG_SCAN(mvm, in iwl_mvm_scan_6ghz_passive_scan()
1977 IWL_DEBUG_SCAN(mvm, in iwl_mvm_scan_6ghz_passive_scan()
1983 IWL_DEBUG_SCAN(mvm, in iwl_mvm_scan_6ghz_passive_scan()
1998 IWL_DEBUG_SCAN(mvm, in iwl_mvm_scan_6ghz_passive_scan()
2004 IWL_DEBUG_SCAN(mvm, "6GHz passive scan: can be enabled\n"); in iwl_mvm_scan_6ghz_passive_scan()
2008 static u16 iwl_mvm_scan_umac_flags_v2(struct iwl_mvm *mvm, in iwl_mvm_scan_umac_flags_v2() argument
2041 mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_ENABLED) in iwl_mvm_scan_umac_flags_v2()
2057 if (iwl_mvm_is_oce_supported(mvm) && in iwl_mvm_scan_umac_flags_v2()
2066 static u8 iwl_mvm_scan_umac_flags2(struct iwl_mvm *mvm, in iwl_mvm_scan_umac_flags2() argument
2072 if (iwl_mvm_is_cdb_supported(mvm)) { in iwl_mvm_scan_umac_flags2()
2086 static u16 iwl_mvm_scan_umac_flags(struct iwl_mvm *mvm, in iwl_mvm_scan_umac_flags() argument
2101 if (iwl_mvm_is_cdb_supported(mvm) && in iwl_mvm_scan_umac_flags()
2105 if (iwl_mvm_rrm_scan_needed(mvm) && in iwl_mvm_scan_umac_flags()
2106 fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_scan_umac_flags()
2122 if (mvm->scan_iter_notif_enabled) in iwl_mvm_scan_umac_flags()
2126 if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_ENABLED) in iwl_mvm_scan_umac_flags()
2129 if (iwl_mvm_is_adaptive_dwell_supported(mvm) && IWL_MVM_ADWELL_ENABLE) in iwl_mvm_scan_umac_flags()
2140 !iwl_mvm_is_adaptive_dwell_supported(mvm) && in iwl_mvm_scan_umac_flags()
2141 !iwl_mvm_is_oce_supported(mvm)) in iwl_mvm_scan_umac_flags()
2144 if (iwl_mvm_is_oce_supported(mvm)) { in iwl_mvm_scan_umac_flags()
2155 !WARN_ON_ONCE(!iwl_mvm_is_adaptive_dwell_supported(mvm))) in iwl_mvm_scan_umac_flags()
2197 static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_scan_umac() argument
2201 struct iwl_scan_req_umac *cmd = mvm->scan_cmd; in iwl_mvm_scan_umac()
2203 void *cmd_data = iwl_mvm_get_scan_req_umac_data(mvm); in iwl_mvm_scan_umac()
2205 mvm->fw->ucode_capa.n_scan_channels; in iwl_mvm_scan_umac()
2216 chan_param = iwl_mvm_get_scan_req_umac_channel(mvm); in iwl_mvm_scan_umac()
2218 iwl_mvm_scan_umac_dwell(mvm, cmd, params); in iwl_mvm_scan_umac()
2220 mvm->scan_uid_status[uid] = type; in iwl_mvm_scan_umac()
2223 gen_flags = iwl_mvm_scan_umac_flags(mvm, params, vif); in iwl_mvm_scan_umac()
2225 if (iwl_mvm_is_adaptive_dwell_v2_supported(mvm)) { in iwl_mvm_scan_umac()
2242 if (iwl_mvm_scan_use_ebs(mvm, vif)) { in iwl_mvm_scan_umac()
2248 if (iwl_mvm_is_frag_ebs_supported(mvm)) { in iwl_mvm_scan_umac()
2251 (!iwl_mvm_is_cdb_supported(mvm) && in iwl_mvm_scan_umac()
2263 mvm->scan_uid_status[uid] = 0; in iwl_mvm_scan_umac()
2267 if (iwl_mvm_is_scan_ext_chan_supported(mvm)) { in iwl_mvm_scan_umac()
2277 iwl_mvm_umac_scan_cfg_channels(mvm, params->channels, in iwl_mvm_scan_umac()
2284 iwl_mvm_scan_umac_fill_general_p_v11(struct iwl_mvm *mvm, in iwl_mvm_scan_umac_fill_general_p_v11() argument
2292 iwl_mvm_scan_umac_dwell_v11(mvm, gp, params); in iwl_mvm_scan_umac_fill_general_p_v11()
2294 IWL_DEBUG_SCAN(mvm, "Gerenal: flags=0x%x, flags2=0x%x\n", in iwl_mvm_scan_umac_fill_general_p_v11()
2327 iwl_mvm_scan_umac_fill_ch_p_v4(struct iwl_mvm *mvm, in iwl_mvm_scan_umac_fill_ch_p_v4() argument
2333 cp->flags = iwl_mvm_scan_umac_chan_flags_v2(mvm, params, vif); in iwl_mvm_scan_umac_fill_ch_p_v4()
2337 iwl_mvm_umac_scan_cfg_channels_v4(mvm, params->channels, cp, in iwl_mvm_scan_umac_fill_ch_p_v4()
2344 iwl_mvm_scan_umac_fill_ch_p_v6(struct iwl_mvm *mvm, in iwl_mvm_scan_umac_fill_ch_p_v6() argument
2350 cp->flags = iwl_mvm_scan_umac_chan_flags_v2(mvm, params, vif); in iwl_mvm_scan_umac_fill_ch_p_v6()
2355 iwl_mvm_umac_scan_cfg_channels_v6(mvm, params->channels, cp, in iwl_mvm_scan_umac_fill_ch_p_v6()
2362 &mvm->nvm_data->bands[NL80211_BAND_6GHZ]; in iwl_mvm_scan_umac_fill_ch_p_v6()
2385 static int iwl_mvm_scan_umac_v12(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_scan_umac_v12() argument
2389 struct iwl_scan_req_umac_v12 *cmd = mvm->scan_cmd; in iwl_mvm_scan_umac_v12()
2394 mvm->scan_uid_status[uid] = type; in iwl_mvm_scan_umac_v12()
2399 gen_flags = iwl_mvm_scan_umac_flags_v2(mvm, params, vif, type); in iwl_mvm_scan_umac_v12()
2400 iwl_mvm_scan_umac_fill_general_p_v11(mvm, params, vif, in iwl_mvm_scan_umac_v12()
2411 iwl_mvm_scan_umac_fill_ch_p_v4(mvm, params, vif, in iwl_mvm_scan_umac_v12()
2417 static int iwl_mvm_scan_umac_v14_and_above(struct iwl_mvm *mvm, in iwl_mvm_scan_umac_v14_and_above() argument
2422 struct iwl_scan_req_umac_v15 *cmd = mvm->scan_cmd; in iwl_mvm_scan_umac_v14_and_above()
2431 mvm->scan_uid_status[uid] = type; in iwl_mvm_scan_umac_v14_and_above()
2436 gen_flags = iwl_mvm_scan_umac_flags_v2(mvm, params, vif, type); in iwl_mvm_scan_umac_v14_and_above()
2439 gen_flags2 = iwl_mvm_scan_umac_flags2(mvm, params, vif, type); in iwl_mvm_scan_umac_v14_and_above()
2443 iwl_mvm_scan_umac_fill_general_p_v11(mvm, params, vif, in iwl_mvm_scan_umac_v14_and_above()
2456 iwl_mvm_scan_umac_fill_ch_p_v6(mvm, params, vif, in iwl_mvm_scan_umac_v14_and_above()
2464 cp->flags = iwl_mvm_scan_umac_chan_flags_v2(mvm, params, vif); in iwl_mvm_scan_umac_v14_and_above()
2468 iwl_mvm_umac_scan_fill_6g_chan_list(mvm, params, pb); in iwl_mvm_scan_umac_v14_and_above()
2470 cp->count = iwl_mvm_umac_scan_cfg_channels_v6_6g(mvm, params, in iwl_mvm_scan_umac_v14_and_above()
2474 mvm->scan_uid_status[uid] = 0; in iwl_mvm_scan_umac_v14_and_above()
2485 static int iwl_mvm_scan_umac_v14(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_scan_umac_v14() argument
2489 return iwl_mvm_scan_umac_v14_and_above(mvm, vif, params, type, uid, 14); in iwl_mvm_scan_umac_v14()
2492 static int iwl_mvm_scan_umac_v15(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_scan_umac_v15() argument
2496 return iwl_mvm_scan_umac_v14_and_above(mvm, vif, params, type, uid, 15); in iwl_mvm_scan_umac_v15()
2499 static int iwl_mvm_num_scans(struct iwl_mvm *mvm) in iwl_mvm_num_scans() argument
2501 return hweight32(mvm->scan_status & IWL_MVM_SCAN_MASK); in iwl_mvm_num_scans()
2504 static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type) in iwl_mvm_check_running_scans() argument
2506 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_check_running_scans()
2521 mvm->scan_status & (IWL_MVM_SCAN_SCHED | IWL_MVM_SCAN_NETDETECT)) in iwl_mvm_check_running_scans()
2524 if (iwl_mvm_num_scans(mvm) < mvm->max_scans) in iwl_mvm_check_running_scans()
2532 if (mvm->scan_status & IWL_MVM_SCAN_REGULAR_MASK) in iwl_mvm_check_running_scans()
2534 return iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED, true); in iwl_mvm_check_running_scans()
2536 if (mvm->scan_status & IWL_MVM_SCAN_SCHED_MASK) in iwl_mvm_check_running_scans()
2538 return iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_REGULAR, true); in iwl_mvm_check_running_scans()
2554 if (mvm->scan_status & IWL_MVM_SCAN_REGULAR_MASK) in iwl_mvm_check_running_scans()
2555 return iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_REGULAR, in iwl_mvm_check_running_scans()
2557 if (mvm->scan_status & IWL_MVM_SCAN_SCHED_MASK) in iwl_mvm_check_running_scans()
2558 return iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED, in iwl_mvm_check_running_scans()
2577 struct iwl_mvm *mvm = container_of(delayed_work, struct iwl_mvm, in iwl_mvm_scan_timeout_wk() local
2580 IWL_ERR(mvm, "regular scan timed out\n"); in iwl_mvm_scan_timeout_wk()
2582 iwl_force_nmi(mvm->trans); in iwl_mvm_scan_timeout_wk()
2585 static void iwl_mvm_fill_scan_type(struct iwl_mvm *mvm, in iwl_mvm_fill_scan_type() argument
2589 if (iwl_mvm_is_cdb_supported(mvm)) { in iwl_mvm_fill_scan_type()
2591 iwl_mvm_get_scan_type_band(mvm, vif, in iwl_mvm_fill_scan_type()
2594 iwl_mvm_get_scan_type_band(mvm, vif, in iwl_mvm_fill_scan_type()
2597 params->type = iwl_mvm_get_scan_type(mvm, vif); in iwl_mvm_fill_scan_type()
2603 int (*handler)(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2619 static int iwl_mvm_build_scan_cmd(struct iwl_mvm *mvm, in iwl_mvm_build_scan_cmd() argument
2628 lockdep_assert_held(&mvm->mutex); in iwl_mvm_build_scan_cmd()
2629 memset(mvm->scan_cmd, 0, mvm->scan_cmd_size); in iwl_mvm_build_scan_cmd()
2631 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in iwl_mvm_build_scan_cmd()
2634 return iwl_mvm_scan_lmac(mvm, vif, params); in iwl_mvm_build_scan_cmd()
2637 uid = iwl_mvm_scan_uid_by_status(mvm, 0); in iwl_mvm_build_scan_cmd()
2643 scan_ver = iwl_fw_lookup_cmd_ver(mvm->fw, SCAN_REQ_UMAC, in iwl_mvm_build_scan_cmd()
2653 return ver_handler->handler(mvm, vif, params, type, uid); in iwl_mvm_build_scan_cmd()
2656 err = iwl_mvm_scan_umac(mvm, vif, params, type, uid); in iwl_mvm_build_scan_cmd()
2686 static bool _iwl_mvm_get_respect_p2p_go(struct iwl_mvm *mvm, in _iwl_mvm_get_respect_p2p_go() argument
2700 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in _iwl_mvm_get_respect_p2p_go()
2708 static bool iwl_mvm_get_respect_p2p_go_band(struct iwl_mvm *mvm, in iwl_mvm_get_respect_p2p_go_band() argument
2712 bool low_latency = iwl_mvm_low_latency_band(mvm, band); in iwl_mvm_get_respect_p2p_go_band()
2714 return _iwl_mvm_get_respect_p2p_go(mvm, vif, low_latency, band); in iwl_mvm_get_respect_p2p_go_band()
2717 static bool iwl_mvm_get_respect_p2p_go(struct iwl_mvm *mvm, in iwl_mvm_get_respect_p2p_go() argument
2720 bool low_latency = iwl_mvm_low_latency(mvm); in iwl_mvm_get_respect_p2p_go()
2722 return _iwl_mvm_get_respect_p2p_go(mvm, vif, low_latency, in iwl_mvm_get_respect_p2p_go()
2726 static void iwl_mvm_fill_respect_p2p_go(struct iwl_mvm *mvm, in iwl_mvm_fill_respect_p2p_go() argument
2730 if (iwl_mvm_is_cdb_supported(mvm)) { in iwl_mvm_fill_respect_p2p_go()
2732 iwl_mvm_get_respect_p2p_go_band(mvm, vif, in iwl_mvm_fill_respect_p2p_go()
2735 iwl_mvm_get_respect_p2p_go_band(mvm, vif, in iwl_mvm_fill_respect_p2p_go()
2738 params->respect_p2p_go = iwl_mvm_get_respect_p2p_go(mvm, vif); in iwl_mvm_fill_respect_p2p_go()
2742 int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_reg_scan_start() argument
2747 .len = { iwl_mvm_scan_size(mvm), }, in iwl_mvm_reg_scan_start()
2748 .data = { mvm->scan_cmd, }, in iwl_mvm_reg_scan_start()
2755 lockdep_assert_held(&mvm->mutex); in iwl_mvm_reg_scan_start()
2757 if (iwl_mvm_is_lar_supported(mvm) && !mvm->lar_regdom_set) { in iwl_mvm_reg_scan_start()
2758 IWL_ERR(mvm, "scan while LAR regdomain is not set\n"); in iwl_mvm_reg_scan_start()
2762 ret = iwl_mvm_check_running_scans(mvm, IWL_MVM_SCAN_REGULAR); in iwl_mvm_reg_scan_start()
2767 if (WARN_ON(!mvm->scan_cmd)) in iwl_mvm_reg_scan_start()
2770 if (!iwl_mvm_scan_fits(mvm, req->n_ssids, ies, req->n_channels)) in iwl_mvm_reg_scan_start()
2792 iwl_mvm_fill_scan_type(mvm, &params, vif); in iwl_mvm_reg_scan_start()
2793 iwl_mvm_fill_respect_p2p_go(mvm, &params, vif); in iwl_mvm_reg_scan_start()
2798 iwl_mvm_build_scan_probe(mvm, vif, ies, &params); in iwl_mvm_reg_scan_start()
2800 iwl_mvm_scan_6ghz_passive_scan(mvm, &params, vif); in iwl_mvm_reg_scan_start()
2802 uid = iwl_mvm_build_scan_cmd(mvm, vif, &hcmd, &params, in iwl_mvm_reg_scan_start()
2808 iwl_mvm_pause_tcm(mvm, false); in iwl_mvm_reg_scan_start()
2810 ret = iwl_mvm_send_cmd(mvm, &hcmd); in iwl_mvm_reg_scan_start()
2816 IWL_ERR(mvm, "Scan failed! ret %d\n", ret); in iwl_mvm_reg_scan_start()
2817 iwl_mvm_resume_tcm(mvm); in iwl_mvm_reg_scan_start()
2818 mvm->scan_uid_status[uid] = 0; in iwl_mvm_reg_scan_start()
2822 IWL_DEBUG_SCAN(mvm, "Scan request was sent successfully\n"); in iwl_mvm_reg_scan_start()
2823 mvm->scan_status |= IWL_MVM_SCAN_REGULAR; in iwl_mvm_reg_scan_start()
2824 mvm->scan_vif = iwl_mvm_vif_from_mac80211(vif); in iwl_mvm_reg_scan_start()
2827 mvm->last_6ghz_passive_scan_jiffies = jiffies; in iwl_mvm_reg_scan_start()
2829 schedule_delayed_work(&mvm->scan_timeout_dwork, in iwl_mvm_reg_scan_start()
2835 int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, in iwl_mvm_sched_scan_start() argument
2842 .len = { iwl_mvm_scan_size(mvm), }, in iwl_mvm_sched_scan_start()
2843 .data = { mvm->scan_cmd, }, in iwl_mvm_sched_scan_start()
2851 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sched_scan_start()
2853 if (iwl_mvm_is_lar_supported(mvm) && !mvm->lar_regdom_set) { in iwl_mvm_sched_scan_start()
2854 IWL_ERR(mvm, "sched-scan while LAR regdomain is not set\n"); in iwl_mvm_sched_scan_start()
2858 ret = iwl_mvm_check_running_scans(mvm, type); in iwl_mvm_sched_scan_start()
2863 if (WARN_ON(!mvm->scan_cmd)) in iwl_mvm_sched_scan_start()
2875 params.pass_all = iwl_mvm_scan_pass_all(mvm, req); in iwl_mvm_sched_scan_start()
2884 iwl_mvm_fill_scan_type(mvm, &params, vif); in iwl_mvm_sched_scan_start()
2885 iwl_mvm_fill_respect_p2p_go(mvm, &params, vif); in iwl_mvm_sched_scan_start()
2893 IWL_DEBUG_SCAN(mvm, in iwl_mvm_sched_scan_start()
2900 ret = iwl_mvm_config_sched_scan_profiles(mvm, req); in iwl_mvm_sched_scan_start()
2904 iwl_mvm_build_scan_probe(mvm, vif, ies, &params); in iwl_mvm_sched_scan_start()
2935 !iwl_mvm_scan_fits(mvm, req->n_ssids, ies, params.n_channels)) { in iwl_mvm_sched_scan_start()
2940 uid = iwl_mvm_build_scan_cmd(mvm, vif, &hcmd, &params, type); in iwl_mvm_sched_scan_start()
2947 ret = iwl_mvm_send_cmd(mvm, &hcmd); in iwl_mvm_sched_scan_start()
2949 IWL_DEBUG_SCAN(mvm, in iwl_mvm_sched_scan_start()
2951 mvm->scan_status |= type; in iwl_mvm_sched_scan_start()
2957 IWL_ERR(mvm, "Sched scan failed! ret %d\n", ret); in iwl_mvm_sched_scan_start()
2958 mvm->scan_uid_status[uid] = 0; in iwl_mvm_sched_scan_start()
2959 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_sched_scan_start()
2965 void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_umac_scan_complete_notif() argument
2973 if (WARN_ON(!(mvm->scan_uid_status[uid] & mvm->scan_status))) in iwl_mvm_rx_umac_scan_complete_notif()
2977 if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_REGULAR) { in iwl_mvm_rx_umac_scan_complete_notif()
2980 .scan_start_tsf = mvm->scan_start, in iwl_mvm_rx_umac_scan_complete_notif()
2983 memcpy(info.tsf_bssid, mvm->scan_vif->bssid, ETH_ALEN); in iwl_mvm_rx_umac_scan_complete_notif()
2984 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_rx_umac_scan_complete_notif()
2985 mvm->scan_vif = NULL; in iwl_mvm_rx_umac_scan_complete_notif()
2986 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_rx_umac_scan_complete_notif()
2987 iwl_mvm_resume_tcm(mvm); in iwl_mvm_rx_umac_scan_complete_notif()
2988 } else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_SCHED) { in iwl_mvm_rx_umac_scan_complete_notif()
2989 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_rx_umac_scan_complete_notif()
2990 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_rx_umac_scan_complete_notif()
2993 mvm->scan_status &= ~mvm->scan_uid_status[uid]; in iwl_mvm_rx_umac_scan_complete_notif()
2994 IWL_DEBUG_SCAN(mvm, in iwl_mvm_rx_umac_scan_complete_notif()
2996 uid, mvm->scan_uid_status[uid], in iwl_mvm_rx_umac_scan_complete_notif()
3000 IWL_DEBUG_SCAN(mvm, in iwl_mvm_rx_umac_scan_complete_notif()
3007 mvm->last_ebs_successful = false; in iwl_mvm_rx_umac_scan_complete_notif()
3009 mvm->scan_uid_status[uid] = 0; in iwl_mvm_rx_umac_scan_complete_notif()
3012 void iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_umac_scan_iter_complete_notif() argument
3018 mvm->scan_start = le64_to_cpu(notif->start_tsf); in iwl_mvm_rx_umac_scan_iter_complete_notif()
3020 IWL_DEBUG_SCAN(mvm, in iwl_mvm_rx_umac_scan_iter_complete_notif()
3024 if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_FOUND) { in iwl_mvm_rx_umac_scan_iter_complete_notif()
3025 IWL_DEBUG_SCAN(mvm, "Pass all scheduled scan results found\n"); in iwl_mvm_rx_umac_scan_iter_complete_notif()
3026 ieee80211_sched_scan_results(mvm->hw); in iwl_mvm_rx_umac_scan_iter_complete_notif()
3027 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_ENABLED; in iwl_mvm_rx_umac_scan_iter_complete_notif()
3030 IWL_DEBUG_SCAN(mvm, in iwl_mvm_rx_umac_scan_iter_complete_notif()
3032 mvm->scan_start); in iwl_mvm_rx_umac_scan_iter_complete_notif()
3035 static int iwl_mvm_umac_scan_abort(struct iwl_mvm *mvm, int type) in iwl_mvm_umac_scan_abort() argument
3040 lockdep_assert_held(&mvm->mutex); in iwl_mvm_umac_scan_abort()
3046 uid = iwl_mvm_scan_uid_by_status(mvm, type); in iwl_mvm_umac_scan_abort()
3052 IWL_DEBUG_SCAN(mvm, "Sending scan abort, uid %u\n", uid); in iwl_mvm_umac_scan_abort()
3054 ret = iwl_mvm_send_cmd_pdu(mvm, in iwl_mvm_umac_scan_abort()
3058 mvm->scan_uid_status[uid] = type << IWL_MVM_SCAN_STOPPING_SHIFT; in iwl_mvm_umac_scan_abort()
3063 static int iwl_mvm_scan_stop_wait(struct iwl_mvm *mvm, int type) in iwl_mvm_scan_stop_wait() argument
3070 lockdep_assert_held(&mvm->mutex); in iwl_mvm_scan_stop_wait()
3072 iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_done, in iwl_mvm_scan_stop_wait()
3077 IWL_DEBUG_SCAN(mvm, "Preparing to stop scan, type %x\n", type); in iwl_mvm_scan_stop_wait()
3079 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) in iwl_mvm_scan_stop_wait()
3080 ret = iwl_mvm_umac_scan_abort(mvm, type); in iwl_mvm_scan_stop_wait()
3082 ret = iwl_mvm_lmac_scan_abort(mvm); in iwl_mvm_scan_stop_wait()
3085 IWL_DEBUG_SCAN(mvm, "couldn't stop scan type %d\n", type); in iwl_mvm_scan_stop_wait()
3086 iwl_remove_notification(&mvm->notif_wait, &wait_scan_done); in iwl_mvm_scan_stop_wait()
3090 return iwl_wait_notification(&mvm->notif_wait, &wait_scan_done, in iwl_mvm_scan_stop_wait()
3107 size_t iwl_mvm_scan_size(struct iwl_mvm *mvm) in iwl_mvm_scan_size() argument
3110 u8 scan_ver = iwl_fw_lookup_cmd_ver(mvm->fw, SCAN_REQ_UMAC, in iwl_mvm_scan_size()
3118 if (iwl_mvm_is_adaptive_dwell_v2_supported(mvm)) in iwl_mvm_scan_size()
3120 else if (iwl_mvm_is_adaptive_dwell_supported(mvm)) in iwl_mvm_scan_size()
3122 else if (iwl_mvm_cdb_scan_api(mvm)) in iwl_mvm_scan_size()
3127 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in iwl_mvm_scan_size()
3128 if (iwl_mvm_is_scan_ext_chan_supported(mvm)) in iwl_mvm_scan_size()
3135 mvm->fw->ucode_capa.n_scan_channels + in iwl_mvm_scan_size()
3140 mvm->fw->ucode_capa.n_scan_channels + in iwl_mvm_scan_size()
3148 void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm) in iwl_mvm_report_scan_aborted() argument
3150 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in iwl_mvm_report_scan_aborted()
3153 uid = iwl_mvm_scan_uid_by_status(mvm, IWL_MVM_SCAN_REGULAR); in iwl_mvm_report_scan_aborted()
3159 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_report_scan_aborted()
3161 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_report_scan_aborted()
3162 mvm->scan_uid_status[uid] = 0; in iwl_mvm_report_scan_aborted()
3164 uid = iwl_mvm_scan_uid_by_status(mvm, IWL_MVM_SCAN_SCHED); in iwl_mvm_report_scan_aborted()
3170 if (!mvm->fw_restart) in iwl_mvm_report_scan_aborted()
3171 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_report_scan_aborted()
3172 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_report_scan_aborted()
3173 mvm->scan_uid_status[uid] = 0; in iwl_mvm_report_scan_aborted()
3175 uid = iwl_mvm_scan_uid_by_status(mvm, in iwl_mvm_report_scan_aborted()
3178 mvm->scan_uid_status[uid] = 0; in iwl_mvm_report_scan_aborted()
3180 uid = iwl_mvm_scan_uid_by_status(mvm, in iwl_mvm_report_scan_aborted()
3183 mvm->scan_uid_status[uid] = 0; in iwl_mvm_report_scan_aborted()
3189 for (i = 0; i < mvm->max_scans; i++) { in iwl_mvm_report_scan_aborted()
3190 if (WARN_ONCE(mvm->scan_uid_status[i], in iwl_mvm_report_scan_aborted()
3193 mvm->scan_uid_status[i] = 0; in iwl_mvm_report_scan_aborted()
3196 if (mvm->scan_status & IWL_MVM_SCAN_REGULAR) { in iwl_mvm_report_scan_aborted()
3201 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_report_scan_aborted()
3202 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_report_scan_aborted()
3209 if ((mvm->scan_status & IWL_MVM_SCAN_SCHED) && in iwl_mvm_report_scan_aborted()
3210 !mvm->fw_restart) { in iwl_mvm_report_scan_aborted()
3211 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_report_scan_aborted()
3212 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_report_scan_aborted()
3217 int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify) in iwl_mvm_scan_stop() argument
3221 if (!(mvm->scan_status & type)) in iwl_mvm_scan_stop()
3224 if (iwl_mvm_is_radio_killed(mvm)) { in iwl_mvm_scan_stop()
3229 ret = iwl_mvm_scan_stop_wait(mvm, type); in iwl_mvm_scan_stop()
3231 mvm->scan_status |= type << IWL_MVM_SCAN_STOPPING_SHIFT; in iwl_mvm_scan_stop()
3238 mvm->scan_status &= ~type; in iwl_mvm_scan_stop()
3241 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_scan_stop()
3247 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_scan_stop()
3250 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_scan_stop()
3251 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_scan_stop()