Lines Matching +full:in +full:- +full:band +full:- +full:status

1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2012-2014, 2018-2024 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
13 #include "iwl-io.h"
28 /* adaptive dwell default high band APs number */
30 /* adaptive dwell default low band APs number */
32 /* adaptive dwell default APs number in social channels (1, 6, 11) */
45 /* minimal number of 2GHz and 5GHz channels in the regular scan request */
82 /* For CDB this is low band scan type, for non-CDB - type. */
112 struct iwl_scan_req_umac *cmd = mvm->scan_cmd; in iwl_mvm_get_scan_req_umac_data()
115 return (void *)&cmd->v8.data; in iwl_mvm_get_scan_req_umac_data()
118 return (void *)&cmd->v7.data; in iwl_mvm_get_scan_req_umac_data()
121 return (void *)&cmd->v6.data; in iwl_mvm_get_scan_req_umac_data()
123 return (void *)&cmd->v1.data; in iwl_mvm_get_scan_req_umac_data()
129 struct iwl_scan_req_umac *cmd = mvm->scan_cmd; in iwl_mvm_get_scan_req_umac_channel()
132 return &cmd->v8.channel; in iwl_mvm_get_scan_req_umac_channel()
135 return &cmd->v7.channel; in iwl_mvm_get_scan_req_umac_channel()
138 return &cmd->v6.channel; in iwl_mvm_get_scan_req_umac_channel()
140 return &cmd->v1.channel; in iwl_mvm_get_scan_req_umac_channel()
145 if (mvm->scan_rx_ant != ANT_NONE) in iwl_mvm_scan_rx_ant()
146 return mvm->scan_rx_ant; in iwl_mvm_scan_rx_ant()
164 iwl_mvm_scan_rate_n_flags(struct iwl_mvm *mvm, enum nl80211_band band, in iwl_mvm_scan_rate_n_flags() argument
169 iwl_mvm_toggle_tx_ant(mvm, &mvm->scan_last_antenna_idx); in iwl_mvm_scan_rate_n_flags()
170 tx_ant = BIT(mvm->scan_last_antenna_idx) << RATE_MCS_ANT_POS; in iwl_mvm_scan_rate_n_flags()
172 if (band == NL80211_BAND_2GHZ && !no_cck) in iwl_mvm_scan_rate_n_flags()
181 return mvm->tcm.result.global_load; in iwl_mvm_get_traffic_load()
185 iwl_mvm_get_traffic_load_band(struct iwl_mvm *mvm, enum nl80211_band band) in iwl_mvm_get_traffic_load_band() argument
187 return mvm->tcm.result.band_load[band]; in iwl_mvm_get_traffic_load_band()
203 if (vif->type != NL80211_IFTYPE_P2P_DEVICE && in iwl_mvm_scan_iterator()
204 mvmvif->deflink.phy_ctxt && in iwl_mvm_scan_iterator()
205 mvmvif->deflink.phy_ctxt->id < NUM_PHY_CTX) in iwl_mvm_scan_iterator()
206 data->global_cnt += 1; in iwl_mvm_scan_iterator()
208 if (!data->current_vif || vif == data->current_vif) in iwl_mvm_scan_iterator()
211 curr_mvmvif = iwl_mvm_vif_from_mac80211(data->current_vif); in iwl_mvm_scan_iterator()
214 mvmvif->deflink.phy_ctxt && curr_mvmvif->deflink.phy_ctxt && in iwl_mvm_scan_iterator()
215 mvmvif->deflink.phy_ctxt->id != curr_mvmvif->deflink.phy_ctxt->id) in iwl_mvm_scan_iterator()
216 data->is_dcm_with_p2p_go = true; in iwl_mvm_scan_iterator()
234 * Force a non-fragmented scan in that case. in _iwl_mvm_get_scan_type()
239 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in _iwl_mvm_get_scan_type()
247 if (fw_has_api(&mvm->fw->ucode_capa, in _iwl_mvm_get_scan_type()
250 (!vif || vif->type != NL80211_IFTYPE_P2P_DEVICE)) in _iwl_mvm_get_scan_type()
254 * in case of DCM with P2P GO set all scan requests as in _iwl_mvm_get_scan_type()
255 * fast-balance scan in _iwl_mvm_get_scan_type()
257 if (vif && vif->type == NL80211_IFTYPE_STATION && in _iwl_mvm_get_scan_type()
284 enum nl80211_band band) in iwl_mvm_get_scan_type_band() argument
289 load = iwl_mvm_get_traffic_load_band(mvm, band); in iwl_mvm_get_scan_type_band()
290 low_latency = iwl_mvm_low_latency_band(mvm, band); in iwl_mvm_get_scan_type_band()
298 return fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_rrm_scan_needed()
309 max_probe_len -= 24 + 2 + WFA_TPC_IE_LEN; in iwl_mvm_max_scan_ie_fw_cmd_room()
311 /* DS parameter set element is added on 2.4GHZ band if required */ in iwl_mvm_max_scan_ie_fw_cmd_room()
313 max_probe_len -= 3; in iwl_mvm_max_scan_ie_fw_cmd_room()
324 * in the same command. So the correct implementation of this function in iwl_mvm_max_scan_ie_len()
328 * we will report an incorrect value. This may result in a failure to in iwl_mvm_max_scan_ie_len()
329 * issue a scan in unified_scan_lmac and unified_sched_scan_lmac in iwl_mvm_max_scan_ie_len()
330 * functions with -ENOBUFS, if a large enough probe will be provided. in iwl_mvm_max_scan_ie_len()
339 struct iwl_lmac_scan_complete_notif *notif = (void *)pkt->data; in iwl_mvm_rx_lmac_scan_iter_complete_notif()
342 "Scan offload iteration complete: status=0x%x scanned channels=%d\n", in iwl_mvm_rx_lmac_scan_iter_complete_notif()
343 notif->status, notif->scanned_channels); in iwl_mvm_rx_lmac_scan_iter_complete_notif()
345 if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_FOUND) { in iwl_mvm_rx_lmac_scan_iter_complete_notif()
347 ieee80211_sched_scan_results(mvm->hw); in iwl_mvm_rx_lmac_scan_iter_complete_notif()
348 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_ENABLED; in iwl_mvm_rx_lmac_scan_iter_complete_notif()
356 ieee80211_sched_scan_results(mvm->hw); in iwl_mvm_rx_scan_match_found()
359 static const char *iwl_mvm_ebs_status_str(enum iwl_scan_ebs_status status) in iwl_mvm_ebs_status_str() argument
361 switch (status) { in iwl_mvm_ebs_status_str()
377 struct iwl_periodic_scan_complete *scan_notif = (void *)pkt->data; in iwl_mvm_rx_lmac_scan_complete_notif()
378 bool aborted = (scan_notif->status == IWL_SCAN_OFFLOAD_ABORTED); in iwl_mvm_rx_lmac_scan_complete_notif()
381 * notification during UMAC scans -- warn and ignore it. in iwl_mvm_rx_lmac_scan_complete_notif()
383 if (WARN_ON_ONCE(fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_rx_lmac_scan_complete_notif()
387 /* scan status must be locked for proper checking */ in iwl_mvm_rx_lmac_scan_complete_notif()
388 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rx_lmac_scan_complete_notif()
390 /* We first check if we were stopping a scan, in which case we in iwl_mvm_rx_lmac_scan_complete_notif()
392 * firmware initiated stop, in which case we need to inform in iwl_mvm_rx_lmac_scan_complete_notif()
400 if (mvm->scan_status & IWL_MVM_SCAN_STOPPING_SCHED) { in iwl_mvm_rx_lmac_scan_complete_notif()
401 WARN_ON_ONCE(mvm->scan_status & IWL_MVM_SCAN_STOPPING_REGULAR); in iwl_mvm_rx_lmac_scan_complete_notif()
403 IWL_DEBUG_SCAN(mvm, "Scheduled scan %s, EBS status %s\n", in iwl_mvm_rx_lmac_scan_complete_notif()
405 iwl_mvm_ebs_status_str(scan_notif->ebs_status)); in iwl_mvm_rx_lmac_scan_complete_notif()
408 scan_notif->last_schedule_line, in iwl_mvm_rx_lmac_scan_complete_notif()
409 scan_notif->last_schedule_iteration, in iwl_mvm_rx_lmac_scan_complete_notif()
410 __le32_to_cpu(scan_notif->time_after_last_iter)); in iwl_mvm_rx_lmac_scan_complete_notif()
412 mvm->scan_status &= ~IWL_MVM_SCAN_STOPPING_SCHED; in iwl_mvm_rx_lmac_scan_complete_notif()
413 } else if (mvm->scan_status & IWL_MVM_SCAN_STOPPING_REGULAR) { in iwl_mvm_rx_lmac_scan_complete_notif()
414 IWL_DEBUG_SCAN(mvm, "Regular scan %s, EBS status %s\n", in iwl_mvm_rx_lmac_scan_complete_notif()
416 iwl_mvm_ebs_status_str(scan_notif->ebs_status)); in iwl_mvm_rx_lmac_scan_complete_notif()
418 mvm->scan_status &= ~IWL_MVM_SCAN_STOPPING_REGULAR; in iwl_mvm_rx_lmac_scan_complete_notif()
419 } else if (mvm->scan_status & IWL_MVM_SCAN_SCHED) { in iwl_mvm_rx_lmac_scan_complete_notif()
420 WARN_ON_ONCE(mvm->scan_status & IWL_MVM_SCAN_REGULAR); in iwl_mvm_rx_lmac_scan_complete_notif()
422 IWL_DEBUG_SCAN(mvm, "Scheduled scan %s, EBS status %s\n", in iwl_mvm_rx_lmac_scan_complete_notif()
424 iwl_mvm_ebs_status_str(scan_notif->ebs_status)); in iwl_mvm_rx_lmac_scan_complete_notif()
427 scan_notif->last_schedule_line, in iwl_mvm_rx_lmac_scan_complete_notif()
428 scan_notif->last_schedule_iteration, in iwl_mvm_rx_lmac_scan_complete_notif()
429 __le32_to_cpu(scan_notif->time_after_last_iter)); in iwl_mvm_rx_lmac_scan_complete_notif()
431 mvm->scan_status &= ~IWL_MVM_SCAN_SCHED; in iwl_mvm_rx_lmac_scan_complete_notif()
432 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_rx_lmac_scan_complete_notif()
433 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_rx_lmac_scan_complete_notif()
434 } else if (mvm->scan_status & IWL_MVM_SCAN_REGULAR) { in iwl_mvm_rx_lmac_scan_complete_notif()
439 IWL_DEBUG_SCAN(mvm, "Regular scan %s, EBS status %s (FW)\n", in iwl_mvm_rx_lmac_scan_complete_notif()
441 iwl_mvm_ebs_status_str(scan_notif->ebs_status)); in iwl_mvm_rx_lmac_scan_complete_notif()
443 mvm->scan_status &= ~IWL_MVM_SCAN_REGULAR; in iwl_mvm_rx_lmac_scan_complete_notif()
444 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_rx_lmac_scan_complete_notif()
445 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_rx_lmac_scan_complete_notif()
452 mvm->last_ebs_successful = in iwl_mvm_rx_lmac_scan_complete_notif()
453 scan_notif->ebs_status == IWL_SCAN_EBS_SUCCESS || in iwl_mvm_rx_lmac_scan_complete_notif()
454 scan_notif->ebs_status == IWL_SCAN_EBS_INACTIVE; in iwl_mvm_rx_lmac_scan_complete_notif()
465 !memcmp(ssid_list->ssid, ssid, ssid_len)) in iwl_ssid_exist()
468 return -1; in iwl_ssid_exist()
471 /* We insert the SSIDs in an inverted order, because the FW will
487 for (i = 0, j = params->n_match_sets - 1; in iwl_scan_build_ssids()
489 i++, j--) { in iwl_scan_build_ssids()
491 if (!params->match_sets[j].ssid.ssid_len) in iwl_scan_build_ssids()
494 ssids[i].len = params->match_sets[j].ssid.ssid_len; in iwl_scan_build_ssids()
495 memcpy(ssids[i].ssid, params->match_sets[j].ssid.ssid, in iwl_scan_build_ssids()
500 for (j = params->n_ssids - 1; in iwl_scan_build_ssids()
502 i++, j--) { in iwl_scan_build_ssids()
503 index = iwl_ssid_exist(params->ssids[j].ssid, in iwl_scan_build_ssids()
504 params->ssids[j].ssid_len, in iwl_scan_build_ssids()
508 ssids[i].len = params->ssids[j].ssid_len; in iwl_scan_build_ssids()
509 memcpy(ssids[i].ssid, params->ssids[j].ssid, in iwl_scan_build_ssids()
528 int max_profiles = iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_config_sched_scan_profiles()
541 if (WARN_ON(req->n_match_sets > max_profiles)) in iwl_mvm_config_sched_scan_profiles()
542 return -EIO; in iwl_mvm_config_sched_scan_profiles()
544 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_SHORT_BL) in iwl_mvm_config_sched_scan_profiles()
551 return -ENOMEM; in iwl_mvm_config_sched_scan_profiles()
555 ret = -ENOMEM; in iwl_mvm_config_sched_scan_profiles()
568 data = &profile_cfg->data; in iwl_mvm_config_sched_scan_profiles()
570 data = &profile_cfg_v1->data; in iwl_mvm_config_sched_scan_profiles()
574 data->num_profiles = req->n_match_sets; in iwl_mvm_config_sched_scan_profiles()
575 data->active_clients = SCAN_CLIENT_SCHED_SCAN; in iwl_mvm_config_sched_scan_profiles()
576 data->pass_match = SCAN_CLIENT_SCHED_SCAN; in iwl_mvm_config_sched_scan_profiles()
577 data->match_notify = SCAN_CLIENT_SCHED_SCAN; in iwl_mvm_config_sched_scan_profiles()
579 if (!req->n_match_sets || !req->match_sets[0].ssid.ssid_len) in iwl_mvm_config_sched_scan_profiles()
580 data->any_beacon_notify = SCAN_CLIENT_SCHED_SCAN; in iwl_mvm_config_sched_scan_profiles()
582 for (i = 0; i < req->n_match_sets; i++) { in iwl_mvm_config_sched_scan_profiles()
583 profile = &profile_cfg_v1->profiles[i]; in iwl_mvm_config_sched_scan_profiles()
584 profile->ssid_index = i; in iwl_mvm_config_sched_scan_profiles()
586 profile->unicast_cipher = 0xff; in iwl_mvm_config_sched_scan_profiles()
587 profile->auth_alg = IWL_AUTH_ALGO_UNSUPPORTED | in iwl_mvm_config_sched_scan_profiles()
590 profile->network_type = IWL_NETWORK_TYPE_ANY; in iwl_mvm_config_sched_scan_profiles()
591 profile->band_selection = IWL_SCAN_OFFLOAD_SELECT_ANY; in iwl_mvm_config_sched_scan_profiles()
592 profile->client_bitmap = SCAN_CLIENT_SCHED_SCAN; in iwl_mvm_config_sched_scan_profiles()
608 if (req->n_match_sets && req->match_sets[0].ssid.ssid_len) { in iwl_mvm_scan_pass_all()
611 req->n_match_sets); in iwl_mvm_scan_pass_all()
612 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_scan_pass_all()
618 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_ENABLED; in iwl_mvm_scan_pass_all()
628 u32 status = CAN_ABORT_STATUS; in iwl_mvm_lmac_scan_abort() local
630 ret = iwl_mvm_send_cmd_status(mvm, &cmd, &status); in iwl_mvm_lmac_scan_abort()
634 if (status != CAN_ABORT_STATUS) { in iwl_mvm_lmac_scan_abort()
638 * due to simply not being in an active scan which in iwl_mvm_lmac_scan_abort()
642 IWL_DEBUG_SCAN(mvm, "SCAN OFFLOAD ABORT ret %d.\n", status); in iwl_mvm_lmac_scan_abort()
643 ret = -ENOENT; in iwl_mvm_lmac_scan_abort()
659 if (!iwl_mvm_has_new_station_api(mvm->fw)) { in iwl_mvm_scan_fill_tx_cmd()
660 tx_cmd[0].sta_id = mvm->aux_sta.sta_id; in iwl_mvm_scan_fill_tx_cmd()
661 tx_cmd[1].sta_id = mvm->aux_sta.sta_id; in iwl_mvm_scan_fill_tx_cmd()
686 struct iwl_scan_channel_cfg_lmac *channel_cfg = (void *)&cmd->data; in iwl_mvm_lmac_scan_cfg_channels()
691 cpu_to_le16(channels[i]->hw_value); in iwl_mvm_lmac_scan_cfg_channels()
730 memcpy(newpos, ies + offs, len - offs); in iwl_mvm_copy_and_insert_ds_elem()
731 newpos += len - offs; in iwl_mvm_copy_and_insert_ds_elem()
739 pos[1] = WFA_TPC_IE_LEN - 2; in iwl_mvm_add_tpc_report_ie()
745 /* pos[7] - tx power will be inserted by the FW */ in iwl_mvm_add_tpc_report_ie()
755 struct ieee80211_mgmt *frame = (void *)params->preq.buf; in iwl_mvm_build_scan_probe()
757 const u8 *mac_addr = params->flags & NL80211_SCAN_FLAG_RANDOM_ADDR ? in iwl_mvm_build_scan_probe()
758 params->mac_addr : NULL; in iwl_mvm_build_scan_probe()
763 * it in the driver. This means that the scan iterations won't really be in iwl_mvm_build_scan_probe()
767 get_random_mask_addr(frame->sa, mac_addr, in iwl_mvm_build_scan_probe()
768 params->mac_addr_mask); in iwl_mvm_build_scan_probe()
770 memcpy(frame->sa, vif->addr, ETH_ALEN); in iwl_mvm_build_scan_probe()
772 frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); in iwl_mvm_build_scan_probe()
773 eth_broadcast_addr(frame->da); in iwl_mvm_build_scan_probe()
774 ether_addr_copy(frame->bssid, params->bssid); in iwl_mvm_build_scan_probe()
775 frame->seq_ctrl = 0; in iwl_mvm_build_scan_probe()
777 pos = frame->u.probe_req.variable; in iwl_mvm_build_scan_probe()
781 params->preq.mac_header.offset = 0; in iwl_mvm_build_scan_probe()
782 params->preq.mac_header.len = cpu_to_le16(24 + 2); in iwl_mvm_build_scan_probe()
784 /* Insert ds parameter set element on 2.4 GHz band */ in iwl_mvm_build_scan_probe()
786 ies->ies[NL80211_BAND_2GHZ], in iwl_mvm_build_scan_probe()
787 ies->len[NL80211_BAND_2GHZ], in iwl_mvm_build_scan_probe()
789 params->preq.band_data[0].offset = cpu_to_le16(pos - params->preq.buf); in iwl_mvm_build_scan_probe()
790 params->preq.band_data[0].len = cpu_to_le16(newpos - pos); in iwl_mvm_build_scan_probe()
793 memcpy(pos, ies->ies[NL80211_BAND_5GHZ], in iwl_mvm_build_scan_probe()
794 ies->len[NL80211_BAND_5GHZ]); in iwl_mvm_build_scan_probe()
795 params->preq.band_data[1].offset = cpu_to_le16(pos - params->preq.buf); in iwl_mvm_build_scan_probe()
796 params->preq.band_data[1].len = in iwl_mvm_build_scan_probe()
797 cpu_to_le16(ies->len[NL80211_BAND_5GHZ]); in iwl_mvm_build_scan_probe()
798 pos += ies->len[NL80211_BAND_5GHZ]; in iwl_mvm_build_scan_probe()
800 memcpy(pos, ies->ies[NL80211_BAND_6GHZ], in iwl_mvm_build_scan_probe()
801 ies->len[NL80211_BAND_6GHZ]); in iwl_mvm_build_scan_probe()
802 params->preq.band_data[2].offset = cpu_to_le16(pos - params->preq.buf); in iwl_mvm_build_scan_probe()
803 params->preq.band_data[2].len = in iwl_mvm_build_scan_probe()
804 cpu_to_le16(ies->len[NL80211_BAND_6GHZ]); in iwl_mvm_build_scan_probe()
805 pos += ies->len[NL80211_BAND_6GHZ]; in iwl_mvm_build_scan_probe()
806 memcpy(pos, ies->common_ies, ies->common_ie_len); in iwl_mvm_build_scan_probe()
807 params->preq.common_data.offset = cpu_to_le16(pos - params->preq.buf); in iwl_mvm_build_scan_probe()
810 !fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_build_scan_probe()
812 iwl_mvm_add_tpc_report_ie(pos + ies->common_ie_len); in iwl_mvm_build_scan_probe()
813 params->preq.common_data.len = cpu_to_le16(ies->common_ie_len + in iwl_mvm_build_scan_probe()
816 params->preq.common_data.len = cpu_to_le16(ies->common_ie_len); in iwl_mvm_build_scan_probe()
824 cmd->active_dwell = IWL_SCAN_DWELL_ACTIVE; in iwl_mvm_scan_lmac_dwell()
825 cmd->passive_dwell = IWL_SCAN_DWELL_PASSIVE; in iwl_mvm_scan_lmac_dwell()
826 cmd->fragmented_dwell = IWL_SCAN_DWELL_FRAGMENTED; in iwl_mvm_scan_lmac_dwell()
827 cmd->extended_dwell = IWL_SCAN_DWELL_EXTENDED; in iwl_mvm_scan_lmac_dwell()
828 cmd->max_out_time = cpu_to_le32(scan_timing[params->type].max_out_time); in iwl_mvm_scan_lmac_dwell()
829 cmd->suspend_time = cpu_to_le32(scan_timing[params->type].suspend_time); in iwl_mvm_scan_lmac_dwell()
830 cmd->scan_prio = cpu_to_le32(IWL_SCAN_PRIORITY_EXT_6); in iwl_mvm_scan_lmac_dwell()
838 (n_channels <= mvm->fw->ucode_capa.n_scan_channels) & in iwl_mvm_scan_fits()
839 (ies->common_ie_len + in iwl_mvm_scan_fits()
840 ies->len[NL80211_BAND_2GHZ] + ies->len[NL80211_BAND_5GHZ] + in iwl_mvm_scan_fits()
841 ies->len[NL80211_BAND_6GHZ] <= in iwl_mvm_scan_fits()
848 const struct iwl_ucode_capabilities *capa = &mvm->fw->ucode_capa; in iwl_mvm_scan_use_ebs()
861 * 5. we are not in low latency mode, in iwl_mvm_scan_use_ebs()
865 return ((capa->flags & IWL_UCODE_TLV_FLAGS_EBS_SUPPORT) && in iwl_mvm_scan_use_ebs()
866 mvm->last_ebs_successful && IWL_MVM_ENABLE_EBS && in iwl_mvm_scan_use_ebs()
867 vif->type != NL80211_IFTYPE_P2P_DEVICE && in iwl_mvm_scan_use_ebs()
874 return params->n_scan_plans == 1 && in iwl_mvm_is_regular_scan()
875 params->scan_plans[0].iterations == 1; in iwl_mvm_is_regular_scan()
890 if (params->n_ssids == 0) in iwl_mvm_scan_lmac_flags()
893 if (params->n_ssids == 1 && params->ssids[0].ssid_len != 0) in iwl_mvm_scan_lmac_flags()
896 if (iwl_mvm_is_scan_fragmented(params->type)) in iwl_mvm_scan_lmac_flags()
900 fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_scan_lmac_flags()
904 if (params->pass_all) in iwl_mvm_scan_lmac_flags()
910 if (mvm->scan_iter_notif_enabled) in iwl_mvm_scan_lmac_flags()
914 if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_ENABLED) in iwl_mvm_scan_lmac_flags()
918 vif->type != NL80211_IFTYPE_P2P_DEVICE && in iwl_mvm_scan_lmac_flags()
919 !iwl_mvm_is_scan_fragmented(params->type)) in iwl_mvm_scan_lmac_flags()
931 p_req->mac_header = src_p_req->mac_header; in iwl_mvm_scan_set_legacy_probe_req()
933 p_req->band_data[i] = src_p_req->band_data[i]; in iwl_mvm_scan_set_legacy_probe_req()
934 p_req->common_data = src_p_req->common_data; in iwl_mvm_scan_set_legacy_probe_req()
935 memcpy(p_req->buf, src_p_req->buf, sizeof(p_req->buf)); in iwl_mvm_scan_set_legacy_probe_req()
941 struct iwl_scan_req_lmac *cmd = mvm->scan_cmd; in iwl_mvm_scan_lmac()
943 (void *)(cmd->data + sizeof(struct iwl_scan_channel_cfg_lmac) * in iwl_mvm_scan_lmac()
944 mvm->fw->ucode_capa.n_scan_channels); in iwl_mvm_scan_lmac()
947 u8 band; in iwl_mvm_scan_lmac() local
949 if (WARN_ON(params->n_scan_plans > IWL_MAX_SCHED_SCAN_PLANS)) in iwl_mvm_scan_lmac()
950 return -EINVAL; in iwl_mvm_scan_lmac()
954 cmd->rx_chain_select = iwl_mvm_scan_rx_chain(mvm); in iwl_mvm_scan_lmac()
955 cmd->iter_num = cpu_to_le32(1); in iwl_mvm_scan_lmac()
956 cmd->n_channels = (u8)params->n_channels; in iwl_mvm_scan_lmac()
958 cmd->delay = cpu_to_le32(params->delay); in iwl_mvm_scan_lmac()
960 cmd->scan_flags = cpu_to_le32(iwl_mvm_scan_lmac_flags(mvm, params, in iwl_mvm_scan_lmac()
963 band = iwl_mvm_phy_band_from_nl80211(params->channels[0]->band); in iwl_mvm_scan_lmac()
964 cmd->flags = cpu_to_le32(band); in iwl_mvm_scan_lmac()
965 cmd->filter_flags = cpu_to_le32(MAC_FILTER_ACCEPT_GRP | in iwl_mvm_scan_lmac()
967 iwl_mvm_scan_fill_tx_cmd(mvm, cmd->tx_cmd, params->no_cck); in iwl_mvm_scan_lmac()
968 iwl_scan_build_ssids(params, cmd->direct_scan, &ssid_bitmap); in iwl_mvm_scan_lmac()
970 /* this API uses bits 1-20 instead of 0-19 */ in iwl_mvm_scan_lmac()
973 for (i = 0; i < params->n_scan_plans; i++) { in iwl_mvm_scan_lmac()
975 &params->scan_plans[i]; in iwl_mvm_scan_lmac()
977 cmd->schedule[i].delay = in iwl_mvm_scan_lmac()
978 cpu_to_le16(scan_plan->interval); in iwl_mvm_scan_lmac()
979 cmd->schedule[i].iterations = scan_plan->iterations; in iwl_mvm_scan_lmac()
980 cmd->schedule[i].full_scan_mul = 1; in iwl_mvm_scan_lmac()
989 if (!cmd->schedule[i - 1].iterations) in iwl_mvm_scan_lmac()
990 cmd->schedule[i - 1].iterations = 0xff; in iwl_mvm_scan_lmac()
993 cmd->channel_opt[0].flags = in iwl_mvm_scan_lmac()
997 cmd->channel_opt[0].non_ebs_ratio = in iwl_mvm_scan_lmac()
999 cmd->channel_opt[1].flags = in iwl_mvm_scan_lmac()
1003 cmd->channel_opt[1].non_ebs_ratio = in iwl_mvm_scan_lmac()
1007 iwl_mvm_lmac_scan_cfg_channels(mvm, params->channels, in iwl_mvm_scan_lmac()
1008 params->n_channels, ssid_bitmap, cmd); in iwl_mvm_scan_lmac()
1010 iwl_mvm_scan_set_legacy_probe_req(preq, &params->preq); in iwl_mvm_scan_lmac()
1037 struct ieee80211_supported_band *band; in iwl_mvm_scan_config_rates() local
1041 band = &mvm->nvm_data->bands[NL80211_BAND_2GHZ]; in iwl_mvm_scan_config_rates()
1042 for (i = 0; i < band->n_bitrates; i++) in iwl_mvm_scan_config_rates()
1043 rates |= rate_to_scan_rate_flag(band->bitrates[i].hw_value); in iwl_mvm_scan_config_rates()
1044 band = &mvm->nvm_data->bands[NL80211_BAND_5GHZ]; in iwl_mvm_scan_config_rates()
1045 for (i = 0; i < band->n_bitrates; i++) in iwl_mvm_scan_config_rates()
1046 rates |= rate_to_scan_rate_flag(band->bitrates[i].hw_value); in iwl_mvm_scan_config_rates()
1057 dwell->active = IWL_SCAN_DWELL_ACTIVE; in iwl_mvm_fill_scan_dwell()
1058 dwell->passive = IWL_SCAN_DWELL_PASSIVE; in iwl_mvm_fill_scan_dwell()
1059 dwell->fragmented = IWL_SCAN_DWELL_FRAGMENTED; in iwl_mvm_fill_scan_dwell()
1060 dwell->extended = IWL_SCAN_DWELL_EXTENDED; in iwl_mvm_fill_scan_dwell()
1066 struct ieee80211_supported_band *band; in iwl_mvm_fill_channels() local
1069 band = &mvm->nvm_data->bands[NL80211_BAND_2GHZ]; in iwl_mvm_fill_channels()
1070 for (i = 0; i < band->n_channels && j < max_channels; i++, j++) in iwl_mvm_fill_channels()
1071 channels[j] = band->channels[i].hw_value; in iwl_mvm_fill_channels()
1072 band = &mvm->nvm_data->bands[NL80211_BAND_5GHZ]; in iwl_mvm_fill_channels()
1073 for (i = 0; i < band->n_channels && j < max_channels; i++, j++) in iwl_mvm_fill_channels()
1074 channels[j] = band->channels[i].hw_value; in iwl_mvm_fill_channels()
1084 cfg->flags = cpu_to_le32(flags); in iwl_mvm_fill_scan_config_v1()
1085 cfg->tx_chains = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm)); in iwl_mvm_fill_scan_config_v1()
1086 cfg->rx_chains = cpu_to_le32(iwl_mvm_scan_rx_ant(mvm)); in iwl_mvm_fill_scan_config_v1()
1087 cfg->legacy_rates = iwl_mvm_scan_config_rates(mvm); in iwl_mvm_fill_scan_config_v1()
1088 cfg->out_of_channel_time = cpu_to_le32(scan_timing[type].max_out_time); in iwl_mvm_fill_scan_config_v1()
1089 cfg->suspend_time = cpu_to_le32(scan_timing[type].suspend_time); in iwl_mvm_fill_scan_config_v1()
1091 iwl_mvm_fill_scan_dwell(mvm, &cfg->dwell); in iwl_mvm_fill_scan_config_v1()
1093 memcpy(&cfg->mac_addr, &mvm->addresses[0].addr, ETH_ALEN); in iwl_mvm_fill_scan_config_v1()
1096 WARN_ON_ONCE(iwl_mvm_has_new_station_api(mvm->fw)); in iwl_mvm_fill_scan_config_v1()
1098 cfg->bcast_sta_id = mvm->aux_sta.sta_id; in iwl_mvm_fill_scan_config_v1()
1099 cfg->channel_flags = channel_flags; in iwl_mvm_fill_scan_config_v1()
1101 iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels); in iwl_mvm_fill_scan_config_v1()
1110 cfg->flags = cpu_to_le32(flags); in iwl_mvm_fill_scan_config_v2()
1111 cfg->tx_chains = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm)); in iwl_mvm_fill_scan_config_v2()
1112 cfg->rx_chains = cpu_to_le32(iwl_mvm_scan_rx_ant(mvm)); in iwl_mvm_fill_scan_config_v2()
1113 cfg->legacy_rates = iwl_mvm_scan_config_rates(mvm); in iwl_mvm_fill_scan_config_v2()
1123 cfg->out_of_channel_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_fill_scan_config_v2()
1125 cfg->suspend_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_fill_scan_config_v2()
1128 cfg->out_of_channel_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_fill_scan_config_v2()
1130 cfg->suspend_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_fill_scan_config_v2()
1136 cfg->out_of_channel_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_fill_scan_config_v2()
1138 cfg->suspend_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_fill_scan_config_v2()
1142 iwl_mvm_fill_scan_dwell(mvm, &cfg->dwell); in iwl_mvm_fill_scan_config_v2()
1144 memcpy(&cfg->mac_addr, &mvm->addresses[0].addr, ETH_ALEN); in iwl_mvm_fill_scan_config_v2()
1147 WARN_ON_ONCE(iwl_mvm_has_new_station_api(mvm->fw)); in iwl_mvm_fill_scan_config_v2()
1149 cfg->bcast_sta_id = mvm->aux_sta.sta_id; in iwl_mvm_fill_scan_config_v2()
1150 cfg->channel_flags = channel_flags; in iwl_mvm_fill_scan_config_v2()
1152 iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels); in iwl_mvm_fill_scan_config_v2()
1165 mvm->nvm_data->bands[NL80211_BAND_2GHZ].n_channels + in iwl_mvm_legacy_config_scan()
1166 mvm->nvm_data->bands[NL80211_BAND_5GHZ].n_channels; in iwl_mvm_legacy_config_scan()
1170 if (WARN_ON(num_channels > mvm->fw->ucode_capa.n_scan_channels)) in iwl_mvm_legacy_config_scan()
1171 num_channels = mvm->fw->ucode_capa.n_scan_channels; in iwl_mvm_legacy_config_scan()
1178 if (type == mvm->scan_type && hb_type == mvm->hb_scan_type) in iwl_mvm_legacy_config_scan()
1182 if (type == mvm->scan_type) in iwl_mvm_legacy_config_scan()
1190 cmd_size += mvm->fw->ucode_capa.n_scan_channels; in iwl_mvm_legacy_config_scan()
1194 return -ENOMEM; in iwl_mvm_legacy_config_scan()
1216 * Check for fragmented scan on LMAC2 - high band. in iwl_mvm_legacy_config_scan()
1217 * LMAC1 - low band is checked above. in iwl_mvm_legacy_config_scan()
1239 mvm->scan_type = type; in iwl_mvm_legacy_config_scan()
1240 mvm->hb_scan_type = hb_type; in iwl_mvm_legacy_config_scan()
1262 if (!iwl_mvm_has_new_station_api(mvm->fw)) { in iwl_mvm_config_scan()
1263 cfg.bcast_sta_id = mvm->aux_sta.sta_id; in iwl_mvm_config_scan()
1264 } else if (iwl_fw_lookup_cmd_ver(mvm->fw, SCAN_CFG_CMD, 0) < 5) { in iwl_mvm_config_scan()
1280 static int iwl_mvm_scan_uid_by_status(struct iwl_mvm *mvm, int status) in iwl_mvm_scan_uid_by_status() argument
1284 for (i = 0; i < mvm->max_scans; i++) in iwl_mvm_scan_uid_by_status()
1285 if (mvm->scan_uid_status[i] == status) in iwl_mvm_scan_uid_by_status()
1288 return -ENOENT; in iwl_mvm_scan_uid_by_status()
1298 timing = &scan_timing[params->type]; in iwl_mvm_scan_umac_dwell()
1303 cmd->v7.adwell_default_n_aps_social = in iwl_mvm_scan_umac_dwell()
1305 cmd->v7.adwell_default_n_aps = in iwl_mvm_scan_umac_dwell()
1309 cmd->v9.adwell_default_hb_n_aps = in iwl_mvm_scan_umac_dwell()
1314 cmd->v7.adwell_max_budget = in iwl_mvm_scan_umac_dwell()
1316 else if (params->n_ssids && params->ssids[0].ssid_len) in iwl_mvm_scan_umac_dwell()
1317 cmd->v7.adwell_max_budget = in iwl_mvm_scan_umac_dwell()
1320 cmd->v7.adwell_max_budget = in iwl_mvm_scan_umac_dwell()
1323 cmd->v7.scan_priority = cpu_to_le32(IWL_SCAN_PRIORITY_EXT_6); in iwl_mvm_scan_umac_dwell()
1324 cmd->v7.max_out_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1325 cpu_to_le32(timing->max_out_time); in iwl_mvm_scan_umac_dwell()
1326 cmd->v7.suspend_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1327 cpu_to_le32(timing->suspend_time); in iwl_mvm_scan_umac_dwell()
1330 hb_timing = &scan_timing[params->hb_type]; in iwl_mvm_scan_umac_dwell()
1332 cmd->v7.max_out_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1333 cpu_to_le32(hb_timing->max_out_time); in iwl_mvm_scan_umac_dwell()
1334 cmd->v7.suspend_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1335 cpu_to_le32(hb_timing->suspend_time); in iwl_mvm_scan_umac_dwell()
1339 cmd->v7.active_dwell = active_dwell; in iwl_mvm_scan_umac_dwell()
1340 cmd->v7.passive_dwell = passive_dwell; in iwl_mvm_scan_umac_dwell()
1341 cmd->v7.fragmented_dwell = IWL_SCAN_DWELL_FRAGMENTED; in iwl_mvm_scan_umac_dwell()
1343 cmd->v8.active_dwell[SCAN_LB_LMAC_IDX] = active_dwell; in iwl_mvm_scan_umac_dwell()
1344 cmd->v8.passive_dwell[SCAN_LB_LMAC_IDX] = passive_dwell; in iwl_mvm_scan_umac_dwell()
1346 cmd->v8.active_dwell[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1348 cmd->v8.passive_dwell[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1353 cmd->v1.extended_dwell = IWL_SCAN_DWELL_EXTENDED; in iwl_mvm_scan_umac_dwell()
1354 cmd->v1.active_dwell = active_dwell; in iwl_mvm_scan_umac_dwell()
1355 cmd->v1.passive_dwell = passive_dwell; in iwl_mvm_scan_umac_dwell()
1356 cmd->v1.fragmented_dwell = IWL_SCAN_DWELL_FRAGMENTED; in iwl_mvm_scan_umac_dwell()
1359 hb_timing = &scan_timing[params->hb_type]; in iwl_mvm_scan_umac_dwell()
1361 cmd->v6.max_out_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1362 cpu_to_le32(hb_timing->max_out_time); in iwl_mvm_scan_umac_dwell()
1363 cmd->v6.suspend_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1364 cpu_to_le32(hb_timing->suspend_time); in iwl_mvm_scan_umac_dwell()
1368 cmd->v6.scan_priority = in iwl_mvm_scan_umac_dwell()
1370 cmd->v6.max_out_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1371 cpu_to_le32(timing->max_out_time); in iwl_mvm_scan_umac_dwell()
1372 cmd->v6.suspend_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1373 cpu_to_le32(timing->suspend_time); in iwl_mvm_scan_umac_dwell()
1375 cmd->v1.scan_priority = in iwl_mvm_scan_umac_dwell()
1377 cmd->v1.max_out_time = in iwl_mvm_scan_umac_dwell()
1378 cpu_to_le32(timing->max_out_time); in iwl_mvm_scan_umac_dwell()
1379 cmd->v1.suspend_time = in iwl_mvm_scan_umac_dwell()
1380 cpu_to_le32(timing->suspend_time); in iwl_mvm_scan_umac_dwell()
1385 cmd->ooc_priority = cpu_to_le32(IWL_SCAN_PRIORITY_EXT_6); in iwl_mvm_scan_umac_dwell()
1387 cmd->ooc_priority = cpu_to_le32(IWL_SCAN_PRIORITY_EXT_2); in iwl_mvm_scan_umac_dwell()
1408 timing = &scan_timing[params->type]; in iwl_mvm_scan_umac_dwell_v11()
1412 general_params->adwell_default_social_chn = in iwl_mvm_scan_umac_dwell_v11()
1414 general_params->adwell_default_2g = IWL_SCAN_ADWELL_DEFAULT_LB_N_APS; in iwl_mvm_scan_umac_dwell_v11()
1415 general_params->adwell_default_5g = IWL_SCAN_ADWELL_DEFAULT_HB_N_APS; in iwl_mvm_scan_umac_dwell_v11()
1419 general_params->adwell_max_budget = in iwl_mvm_scan_umac_dwell_v11()
1421 else if (params->n_ssids && params->ssids[0].ssid_len) in iwl_mvm_scan_umac_dwell_v11()
1422 general_params->adwell_max_budget = in iwl_mvm_scan_umac_dwell_v11()
1425 general_params->adwell_max_budget = in iwl_mvm_scan_umac_dwell_v11()
1428 general_params->scan_priority = cpu_to_le32(IWL_SCAN_PRIORITY_EXT_6); in iwl_mvm_scan_umac_dwell_v11()
1429 general_params->max_out_of_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell_v11()
1430 cpu_to_le32(timing->max_out_time); in iwl_mvm_scan_umac_dwell_v11()
1431 general_params->suspend_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell_v11()
1432 cpu_to_le32(timing->suspend_time); in iwl_mvm_scan_umac_dwell_v11()
1434 hb_timing = &scan_timing[params->hb_type]; in iwl_mvm_scan_umac_dwell_v11()
1436 general_params->max_out_of_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell_v11()
1437 cpu_to_le32(hb_timing->max_out_time); in iwl_mvm_scan_umac_dwell_v11()
1438 general_params->suspend_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell_v11()
1439 cpu_to_le32(hb_timing->suspend_time); in iwl_mvm_scan_umac_dwell_v11()
1441 general_params->active_dwell[SCAN_LB_LMAC_IDX] = active_dwell; in iwl_mvm_scan_umac_dwell_v11()
1442 general_params->passive_dwell[SCAN_LB_LMAC_IDX] = passive_dwell; in iwl_mvm_scan_umac_dwell_v11()
1443 general_params->active_dwell[SCAN_HB_LMAC_IDX] = active_dwell; in iwl_mvm_scan_umac_dwell_v11()
1444 general_params->passive_dwell[SCAN_HB_LMAC_IDX] = passive_dwell; in iwl_mvm_scan_umac_dwell_v11()
1453 u8 band; member
1463 .band = PHY_BAND_24
1471 .band = PHY_BAND_5
1479 .band = PHY_BAND_5
1487 .band = PHY_BAND_6
1491 static int iwl_mvm_scan_ch_and_band_to_idx(u8 channel_id, u8 band) in iwl_mvm_scan_ch_and_band_to_idx() argument
1496 return -EINVAL; in iwl_mvm_scan_ch_and_band_to_idx()
1503 if (ch_segment->band != band || in iwl_mvm_scan_ch_and_band_to_idx()
1504 ch_segment->first_channel_id > channel_id || in iwl_mvm_scan_ch_and_band_to_idx()
1505 ch_segment->last_channel_id < channel_id) in iwl_mvm_scan_ch_and_band_to_idx()
1508 ch_offset = (channel_id - ch_segment->first_channel_id) >> in iwl_mvm_scan_ch_and_band_to_idx()
1509 ch_segment->channel_spacing_shift; in iwl_mvm_scan_ch_and_band_to_idx()
1518 return -EINVAL; in iwl_mvm_scan_ch_and_band_to_idx()
1530 u8 ch_id, u8 band, u8 *ch_bitmap, in iwl_mvm_scan_ch_add_n_aps_override() argument
1542 ch_idx = iwl_mvm_scan_ch_and_band_to_idx(ch_id, band); in iwl_mvm_scan_ch_add_n_aps_override()
1597 channel_cfg[i].channel_num = channels[i]->hw_value; in iwl_mvm_umac_scan_cfg_channels()
1599 enum nl80211_band band = channels[i]->band; in iwl_mvm_umac_scan_cfg_channels() local
1601 channel_cfg[i].v2.band = in iwl_mvm_umac_scan_cfg_channels()
1602 iwl_mvm_phy_band_from_nl80211(band); in iwl_mvm_umac_scan_cfg_channels()
1619 u8 *bitmap = cp->adwell_ch_override_bitmap; in iwl_mvm_umac_scan_cfg_channels_v4()
1620 size_t bitmap_n_entries = ARRAY_SIZE(cp->adwell_ch_override_bitmap); in iwl_mvm_umac_scan_cfg_channels_v4()
1624 enum nl80211_band band = channels[i]->band; in iwl_mvm_umac_scan_cfg_channels_v4() local
1626 &cp->channel_config[i]; in iwl_mvm_umac_scan_cfg_channels_v4()
1628 cfg->flags = cpu_to_le32(flags); in iwl_mvm_umac_scan_cfg_channels_v4()
1629 cfg->channel_num = channels[i]->hw_value; in iwl_mvm_umac_scan_cfg_channels_v4()
1630 cfg->v2.band = iwl_mvm_phy_band_from_nl80211(band); in iwl_mvm_umac_scan_cfg_channels_v4()
1631 cfg->v2.iter_count = 1; in iwl_mvm_umac_scan_cfg_channels_v4()
1632 cfg->v2.iter_interval = 0; in iwl_mvm_umac_scan_cfg_channels_v4()
1635 cfg->channel_num, in iwl_mvm_umac_scan_cfg_channels_v4()
1636 cfg->v2.band, bitmap, in iwl_mvm_umac_scan_cfg_channels_v4()
1651 enum nl80211_band band = channels[i]->band; in iwl_mvm_umac_scan_cfg_channels_v7() local
1652 struct iwl_scan_channel_cfg_umac *cfg = &cp->channel_config[i]; in iwl_mvm_umac_scan_cfg_channels_v7()
1655 channels[i]->hw_value); in iwl_mvm_umac_scan_cfg_channels_v7()
1656 u8 iwl_band = iwl_mvm_phy_band_from_nl80211(band); in iwl_mvm_umac_scan_cfg_channels_v7()
1658 cfg->flags = cpu_to_le32(flags | n_aps_flag); in iwl_mvm_umac_scan_cfg_channels_v7()
1659 cfg->channel_num = channels[i]->hw_value; in iwl_mvm_umac_scan_cfg_channels_v7()
1661 cfg->flags = 0; in iwl_mvm_umac_scan_cfg_channels_v7()
1663 if (band == NL80211_BAND_6GHZ) { in iwl_mvm_umac_scan_cfg_channels_v7()
1664 /* 6 GHz channels should only appear in a scan request in iwl_mvm_umac_scan_cfg_channels_v7()
1668 WARN_ON_ONCE(cfg->flags != 0); in iwl_mvm_umac_scan_cfg_channels_v7()
1669 cfg->flags = in iwl_mvm_umac_scan_cfg_channels_v7()
1673 cfg->v2.iter_count = 1; in iwl_mvm_umac_scan_cfg_channels_v7()
1674 cfg->v2.iter_interval = 0; in iwl_mvm_umac_scan_cfg_channels_v7()
1676 cfg->v2.band = iwl_band; in iwl_mvm_umac_scan_cfg_channels_v7()
1678 cfg->flags |= cpu_to_le32((iwl_band << in iwl_mvm_umac_scan_cfg_channels_v7()
1690 params->scan_6ghz_params; in iwl_mvm_umac_scan_fill_6g_chan_list()
1691 bool hidden_supported = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_umac_scan_fill_6g_chan_list()
1694 for (j = 0; j < params->n_ssids && idex_s < SCAN_SHORT_SSID_MAX_SIZE; in iwl_mvm_umac_scan_fill_6g_chan_list()
1696 if (!params->ssids[j].ssid_len) in iwl_mvm_umac_scan_fill_6g_chan_list()
1699 pp->short_ssid[idex_s] = in iwl_mvm_umac_scan_fill_6g_chan_list()
1700 cpu_to_le32(~crc32_le(~0, params->ssids[j].ssid, in iwl_mvm_umac_scan_fill_6g_chan_list()
1701 params->ssids[j].ssid_len)); in iwl_mvm_umac_scan_fill_6g_chan_list()
1704 pp->direct_scan[idex_s].id = WLAN_EID_SSID; in iwl_mvm_umac_scan_fill_6g_chan_list()
1705 pp->direct_scan[idex_s].len = params->ssids[j].ssid_len; in iwl_mvm_umac_scan_fill_6g_chan_list()
1706 memcpy(pp->direct_scan[idex_s].ssid, params->ssids[j].ssid, in iwl_mvm_umac_scan_fill_6g_chan_list()
1707 params->ssids[j].ssid_len); in iwl_mvm_umac_scan_fill_6g_chan_list()
1720 for (j = 0; j < params->n_6ghz_params; j++) { in iwl_mvm_umac_scan_fill_6g_chan_list()
1726 if (pp->short_ssid[k] == in iwl_mvm_umac_scan_fill_6g_chan_list()
1732 pp->short_ssid[idex_s++] = in iwl_mvm_umac_scan_fill_6g_chan_list()
1739 if (!memcmp(&pp->bssid_array[k], in iwl_mvm_umac_scan_fill_6g_chan_list()
1748 memcpy(&pp->bssid_array[idex_b++], in iwl_mvm_umac_scan_fill_6g_chan_list()
1753 pp->short_ssid_num = idex_s; in iwl_mvm_umac_scan_fill_6g_chan_list()
1754 pp->bssid_num = idex_b; in iwl_mvm_umac_scan_fill_6g_chan_list()
1769 params->scan_6ghz_params; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1772 for (i = 0, ch_cnt = 0; i < params->n_channels; i++) { in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1774 &cp->channel_config[ch_cnt]; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1786 * configured in the scan command. in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1788 if (!cfg80211_channel_is_psc(params->channels[i]) && in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1789 !params->n_6ghz_params && params->n_ssids) in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1792 cfg->channel_num = params->channels[i]->hw_value; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1794 cfg->v2.band = PHY_BAND_6; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1796 cfg->flags |= cpu_to_le32(PHY_BAND_6 << in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1799 cfg->v5.iter_count = 1; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1800 cfg->v5.iter_interval = 0; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1802 for (u32 j = 0; j < params->n_6ghz_params; j++) { in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1826 * In the following cases apply passive scan: in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1828 * - PSC channel with NO_LISTEN_FLAG on should be treated in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1830 * - Non PSC channel with more than 3 short SSIDs or more in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1832 * - Non PSC Channel with unsolicited probe response and in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1834 * - PSC channel with more than 2 short SSIDs or more than in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1837 * - PSC channel with more than 1 SSID or 3 BSSIDs. in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1838 * - Non PSC channel with more than 2 SSIDs or 6 BSSIDs. in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1839 * - Non PSC channel with unsolicited probe response and in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1842 if (!iwl_mvm_is_scan_fragmented(params->type)) { in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1843 if (!cfg80211_channel_is_psc(params->channels[i]) || in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1856 } else if (cfg80211_channel_is_psc(params->channels[i])) { in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1876 for (u32 j = 0; j < params->n_6ghz_params; j++) { in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1883 k < pp->short_ssid_num && n_s_ssids < max_s_ssids; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1886 le32_to_cpu(pp->short_ssid[k]) == in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1896 * the short SSID probe can be done in in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1903 !pp->direct_scan[k].len) in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1907 if (pp->direct_scan[k].len) in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1920 for (k = 0; k < pp->bssid_num; k++) { in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1921 if (!memcmp(&pp->bssid_array[k], in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1937 if (cfg80211_channel_is_psc(params->channels[i]) && in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1946 !cfg80211_channel_is_psc(params->channels[i]))) in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1951 cfg->flags |= cpu_to_le32(flags); in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1953 cfg->v5.psd_20 = psd_20; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1958 if (params->n_channels > ch_cnt) in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1960 "6GHz: reducing number channels: (%u->%u)\n", in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1961 params->n_channels, ch_cnt); in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1981 iwl_mvm_is_scan_fragmented(params->type)) || in iwl_mvm_scan_umac_chan_flags_v2()
1983 iwl_mvm_is_scan_fragmented(params->hb_type))) in iwl_mvm_scan_umac_chan_flags_v2()
1987 * force EBS in case the scan is a fragmented and there is a need to take P2P in iwl_mvm_scan_umac_chan_flags_v2()
1991 iwl_mvm_is_scan_fragmented(params->type) && params->respect_p2p_go) || in iwl_mvm_scan_umac_chan_flags_v2()
1993 iwl_mvm_is_scan_fragmented(params->hb_type) && in iwl_mvm_scan_umac_chan_flags_v2()
1994 params->respect_p2p_go_hb)) { in iwl_mvm_scan_umac_chan_flags_v2()
2007 &mvm->nvm_data->bands[NL80211_BAND_6GHZ]; in iwl_mvm_scan_6ghz_passive_scan()
2010 params->enable_6ghz_passive = false; in iwl_mvm_scan_6ghz_passive_scan()
2012 if (params->scan_6ghz) in iwl_mvm_scan_6ghz_passive_scan()
2015 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_scan_6ghz_passive_scan()
2023 if (vif->type != NL80211_IFTYPE_STATION) { in iwl_mvm_scan_6ghz_passive_scan()
2030 * 6GHz passive scan is allowed in a defined time interval following HW in iwl_mvm_scan_6ghz_passive_scan()
2034 if ((vif->cfg.assoc || in iwl_mvm_scan_6ghz_passive_scan()
2035 time_after(mvm->last_6ghz_passive_scan_jiffies + in iwl_mvm_scan_6ghz_passive_scan()
2037 (time_before(mvm->last_reset_or_resume_time_jiffies + in iwl_mvm_scan_6ghz_passive_scan()
2041 vif->cfg.assoc ? "associated" : in iwl_mvm_scan_6ghz_passive_scan()
2046 /* not enough channels in the regular scan request */ in iwl_mvm_scan_6ghz_passive_scan()
2047 if (params->n_channels < IWL_MVM_6GHZ_PASSIVE_SCAN_MIN_CHANS) { in iwl_mvm_scan_6ghz_passive_scan()
2053 for (i = 0; i < params->n_ssids; i++) { in iwl_mvm_scan_6ghz_passive_scan()
2054 if (!params->ssids[i].ssid_len) in iwl_mvm_scan_6ghz_passive_scan()
2059 if (i == params->n_ssids) { in iwl_mvm_scan_6ghz_passive_scan()
2065 if (!sband || !sband->n_channels) { in iwl_mvm_scan_6ghz_passive_scan()
2071 for (i = 0, n_disabled = 0; i < sband->n_channels; i++) { in iwl_mvm_scan_6ghz_passive_scan()
2072 if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED)) in iwl_mvm_scan_6ghz_passive_scan()
2080 if (n_disabled != sband->n_channels) { in iwl_mvm_scan_6ghz_passive_scan()
2088 params->enable_6ghz_passive = true; in iwl_mvm_scan_6ghz_passive_scan()
2104 if (params->n_ssids == 0) in iwl_mvm_scan_umac_flags_v2()
2106 else if (params->n_ssids == 1 && params->ssids[0].ssid_len) in iwl_mvm_scan_umac_flags_v2()
2109 if (iwl_mvm_is_scan_fragmented(params->type)) in iwl_mvm_scan_umac_flags_v2()
2112 if (iwl_mvm_is_scan_fragmented(params->hb_type)) in iwl_mvm_scan_umac_flags_v2()
2115 if (params->pass_all) in iwl_mvm_scan_umac_flags_v2()
2123 if (params->iter_notif || in iwl_mvm_scan_umac_flags_v2()
2124 mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_ENABLED) in iwl_mvm_scan_umac_flags_v2()
2134 params->flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ) in iwl_mvm_scan_umac_flags_v2()
2137 if (params->enable_6ghz_passive) in iwl_mvm_scan_umac_flags_v2()
2141 (params->flags & (NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP | in iwl_mvm_scan_umac_flags_v2()
2157 if (params->respect_p2p_go) in iwl_mvm_scan_umac_flags2()
2159 if (params->respect_p2p_go_hb) in iwl_mvm_scan_umac_flags2()
2162 if (params->respect_p2p_go) in iwl_mvm_scan_umac_flags2()
2167 if (params->scan_6ghz && in iwl_mvm_scan_umac_flags2()
2168 fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_scan_umac_flags2()
2172 /* Passive and AP interface -> ACS (automatic channel selection) */ in iwl_mvm_scan_umac_flags2()
2175 iwl_fw_lookup_notif_ver(mvm->fw, SCAN_GROUP, CHANNEL_SURVEY_NOTIF, in iwl_mvm_scan_umac_flags2()
2188 if (params->n_ssids == 0) in iwl_mvm_scan_umac_flags()
2191 if (params->n_ssids == 1 && params->ssids[0].ssid_len != 0) in iwl_mvm_scan_umac_flags()
2194 if (iwl_mvm_is_scan_fragmented(params->type)) in iwl_mvm_scan_umac_flags()
2198 iwl_mvm_is_scan_fragmented(params->hb_type)) in iwl_mvm_scan_umac_flags()
2202 fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_scan_umac_flags()
2206 if (params->pass_all) in iwl_mvm_scan_umac_flags()
2214 if (params->iter_notif) in iwl_mvm_scan_umac_flags()
2218 if (mvm->scan_iter_notif_enabled) in iwl_mvm_scan_umac_flags()
2222 if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_ENABLED) in iwl_mvm_scan_umac_flags()
2229 * Extended dwell is relevant only for low band to start with, as it is in iwl_mvm_scan_umac_flags()
2231 * only scan type on low band also for CDB. in iwl_mvm_scan_umac_flags()
2234 vif->type != NL80211_IFTYPE_P2P_DEVICE && in iwl_mvm_scan_umac_flags()
2235 !iwl_mvm_is_scan_fragmented(params->type) && in iwl_mvm_scan_umac_flags()
2241 if ((params->flags & in iwl_mvm_scan_umac_flags()
2249 if ((params->flags & in iwl_mvm_scan_umac_flags()
2253 if ((params->flags & NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME)) in iwl_mvm_scan_umac_flags()
2266 if (WARN_ON(!params->n_scan_plans || in iwl_mvm_fill_scan_sched_params()
2267 params->n_scan_plans > IWL_MAX_SCHED_SCAN_PLANS)) in iwl_mvm_fill_scan_sched_params()
2268 return -EINVAL; in iwl_mvm_fill_scan_sched_params()
2270 for (i = 0; i < params->n_scan_plans; i++) { in iwl_mvm_fill_scan_sched_params()
2272 &params->scan_plans[i]; in iwl_mvm_fill_scan_sched_params()
2274 schedule[i].iter_count = scan_plan->iterations; in iwl_mvm_fill_scan_sched_params()
2276 cpu_to_le16(scan_plan->interval); in iwl_mvm_fill_scan_sched_params()
2285 if (!schedule[params->n_scan_plans - 1].iter_count) in iwl_mvm_fill_scan_sched_params()
2286 schedule[params->n_scan_plans - 1].iter_count = 0xff; in iwl_mvm_fill_scan_sched_params()
2288 *delay = cpu_to_le16(params->delay); in iwl_mvm_fill_scan_sched_params()
2297 struct iwl_scan_req_umac *cmd = mvm->scan_cmd; in iwl_mvm_scan_umac()
2301 mvm->fw->ucode_capa.n_scan_channels; in iwl_mvm_scan_umac()
2316 cmd->uid = cpu_to_le32(uid); in iwl_mvm_scan_umac()
2318 cmd->general_flags = cpu_to_le16(gen_flags); in iwl_mvm_scan_umac()
2321 cmd->v8.num_of_fragments[SCAN_LB_LMAC_IDX] = in iwl_mvm_scan_umac()
2324 cmd->v8.num_of_fragments[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac()
2327 cmd->v8.general_flags2 = in iwl_mvm_scan_umac()
2331 cmd->scan_start_mac_id = scan_vif->id; in iwl_mvm_scan_umac()
2334 cmd->flags = cpu_to_le32(IWL_UMAC_SCAN_FLAG_PREEMPTIVE); in iwl_mvm_scan_umac()
2351 chan_param->flags = channel_flags; in iwl_mvm_scan_umac()
2352 chan_param->count = params->n_channels; in iwl_mvm_scan_umac()
2354 ret = iwl_mvm_fill_scan_sched_params(params, tail_v2->schedule, in iwl_mvm_scan_umac()
2355 &tail_v2->delay); in iwl_mvm_scan_umac()
2360 tail_v2->preq = params->preq; in iwl_mvm_scan_umac()
2361 direct_scan = tail_v2->direct_scan; in iwl_mvm_scan_umac()
2364 iwl_mvm_scan_set_legacy_probe_req(&tail_v1->preq, in iwl_mvm_scan_umac()
2365 &params->preq); in iwl_mvm_scan_umac()
2366 direct_scan = tail_v1->direct_scan; in iwl_mvm_scan_umac()
2369 iwl_mvm_umac_scan_cfg_channels(mvm, params->channels, in iwl_mvm_scan_umac()
2370 params->n_channels, ssid_bitmap, in iwl_mvm_scan_umac()
2390 gp->flags = cpu_to_le16(gen_flags); in iwl_mvm_scan_umac_fill_general_p_v12()
2391 gp->flags2 = gen_flags2; in iwl_mvm_scan_umac_fill_general_p_v12()
2394 gp->num_of_fragments[SCAN_LB_LMAC_IDX] = IWL_SCAN_NUM_OF_FRAGS; in iwl_mvm_scan_umac_fill_general_p_v12()
2396 gp->num_of_fragments[SCAN_HB_LMAC_IDX] = IWL_SCAN_NUM_OF_FRAGS; in iwl_mvm_scan_umac_fill_general_p_v12()
2398 mvm->scan_link_id = 0; in iwl_mvm_scan_umac_fill_general_p_v12()
2401 gp->scan_start_mac_or_link_id = scan_vif->id; in iwl_mvm_scan_umac_fill_general_p_v12()
2404 scan_vif->link[params->tsf_report_link_id]; in iwl_mvm_scan_umac_fill_general_p_v12()
2406 mvm->scan_link_id = params->tsf_report_link_id; in iwl_mvm_scan_umac_fill_general_p_v12()
2408 gp->scan_start_mac_or_link_id = link_info->fw_link_id; in iwl_mvm_scan_umac_fill_general_p_v12()
2416 pp->preq = params->preq; in iwl_mvm_scan_umac_fill_probe_p_v3()
2417 pp->ssid_num = params->n_ssids; in iwl_mvm_scan_umac_fill_probe_p_v3()
2418 iwl_scan_build_ssids(params, pp->direct_scan, NULL); in iwl_mvm_scan_umac_fill_probe_p_v3()
2426 pp->preq = params->preq; in iwl_mvm_scan_umac_fill_probe_p_v4()
2427 iwl_scan_build_ssids(params, pp->direct_scan, bitmap_ssid); in iwl_mvm_scan_umac_fill_probe_p_v4()
2437 cp->flags = iwl_mvm_scan_umac_chan_flags_v2(mvm, params, vif); in iwl_mvm_scan_umac_fill_ch_p_v4()
2438 cp->count = params->n_channels; in iwl_mvm_scan_umac_fill_ch_p_v4()
2439 cp->num_of_aps_override = IWL_SCAN_ADWELL_N_APS_GO_FRIENDLY; in iwl_mvm_scan_umac_fill_ch_p_v4()
2441 iwl_mvm_umac_scan_cfg_channels_v4(mvm, params->channels, cp, in iwl_mvm_scan_umac_fill_ch_p_v4()
2442 params->n_channels, in iwl_mvm_scan_umac_fill_ch_p_v4()
2444 vif->type); in iwl_mvm_scan_umac_fill_ch_p_v4()
2455 cp->flags = iwl_mvm_scan_umac_chan_flags_v2(mvm, params, vif); in iwl_mvm_scan_umac_fill_ch_p_v7()
2456 cp->count = params->n_channels; in iwl_mvm_scan_umac_fill_ch_p_v7()
2457 cp->n_aps_override[0] = IWL_SCAN_ADWELL_N_APS_GO_FRIENDLY; in iwl_mvm_scan_umac_fill_ch_p_v7()
2458 cp->n_aps_override[1] = IWL_SCAN_ADWELL_N_APS_SOCIAL_CHS; in iwl_mvm_scan_umac_fill_ch_p_v7()
2460 iwl_mvm_umac_scan_cfg_channels_v7(mvm, params->channels, cp, in iwl_mvm_scan_umac_fill_ch_p_v7()
2461 params->n_channels, in iwl_mvm_scan_umac_fill_ch_p_v7()
2463 vif->type, version); in iwl_mvm_scan_umac_fill_ch_p_v7()
2465 if (params->enable_6ghz_passive) { in iwl_mvm_scan_umac_fill_ch_p_v7()
2467 &mvm->nvm_data->bands[NL80211_BAND_6GHZ]; in iwl_mvm_scan_umac_fill_ch_p_v7()
2470 for (i = 0; i < sband->n_channels; i++) { in iwl_mvm_scan_umac_fill_ch_p_v7()
2472 &sband->channels[i]; in iwl_mvm_scan_umac_fill_ch_p_v7()
2475 &cp->channel_config[cp->count]; in iwl_mvm_scan_umac_fill_ch_p_v7()
2480 cfg->channel_num = channel->hw_value; in iwl_mvm_scan_umac_fill_ch_p_v7()
2481 cfg->v5.iter_count = 1; in iwl_mvm_scan_umac_fill_ch_p_v7()
2482 cfg->v5.iter_interval = 0; in iwl_mvm_scan_umac_fill_ch_p_v7()
2485 cfg->flags = 0; in iwl_mvm_scan_umac_fill_ch_p_v7()
2486 cfg->v2.band = PHY_BAND_6; in iwl_mvm_scan_umac_fill_ch_p_v7()
2488 cfg->flags = cpu_to_le32(PHY_BAND_6 << in iwl_mvm_scan_umac_fill_ch_p_v7()
2490 cfg->v5.psd_20 = in iwl_mvm_scan_umac_fill_ch_p_v7()
2493 cp->count++; in iwl_mvm_scan_umac_fill_ch_p_v7()
2502 struct iwl_scan_req_umac_v12 *cmd = mvm->scan_cmd; in iwl_mvm_scan_umac_v12()
2503 struct iwl_scan_req_params_v12 *scan_p = &cmd->scan_params; in iwl_mvm_scan_umac_v12()
2507 cmd->ooc_priority = cpu_to_le32(iwl_mvm_scan_umac_ooc_priority(type)); in iwl_mvm_scan_umac_v12()
2508 cmd->uid = cpu_to_le32(uid); in iwl_mvm_scan_umac_v12()
2512 &scan_p->general_params, in iwl_mvm_scan_umac_v12()
2516 scan_p->periodic_params.schedule, in iwl_mvm_scan_umac_v12()
2517 &scan_p->periodic_params.delay); in iwl_mvm_scan_umac_v12()
2521 iwl_mvm_scan_umac_fill_probe_p_v3(params, &scan_p->probe_params); in iwl_mvm_scan_umac_v12()
2523 &scan_p->channel_params, 0); in iwl_mvm_scan_umac_v12()
2533 struct iwl_scan_req_umac_v17 *cmd = mvm->scan_cmd; in iwl_mvm_scan_umac_v14_and_above()
2534 struct iwl_scan_req_params_v17 *scan_p = &cmd->scan_params; in iwl_mvm_scan_umac_v14_and_above()
2535 struct iwl_scan_channel_params_v7 *cp = &scan_p->channel_params; in iwl_mvm_scan_umac_v14_and_above()
2536 struct iwl_scan_probe_params_v4 *pb = &scan_p->probe_params; in iwl_mvm_scan_umac_v14_and_above()
2542 cmd->ooc_priority = cpu_to_le32(iwl_mvm_scan_umac_ooc_priority(type)); in iwl_mvm_scan_umac_v14_and_above()
2543 cmd->uid = cpu_to_le32(uid); in iwl_mvm_scan_umac_v14_and_above()
2554 &scan_p->general_params, in iwl_mvm_scan_umac_v14_and_above()
2558 scan_p->periodic_params.schedule, in iwl_mvm_scan_umac_v14_and_above()
2559 &scan_p->periodic_params.delay); in iwl_mvm_scan_umac_v14_and_above()
2563 if (!params->scan_6ghz) { in iwl_mvm_scan_umac_v14_and_above()
2565 &scan_p->probe_params, in iwl_mvm_scan_umac_v14_and_above()
2568 &scan_p->channel_params, in iwl_mvm_scan_umac_v14_and_above()
2573 pb->preq = params->preq; in iwl_mvm_scan_umac_v14_and_above()
2576 cp->flags = iwl_mvm_scan_umac_chan_flags_v2(mvm, params, vif); in iwl_mvm_scan_umac_v14_and_above()
2577 cp->n_aps_override[0] = IWL_SCAN_ADWELL_N_APS_GO_FRIENDLY; in iwl_mvm_scan_umac_v14_and_above()
2578 cp->n_aps_override[1] = IWL_SCAN_ADWELL_N_APS_SOCIAL_CHS; in iwl_mvm_scan_umac_v14_and_above()
2582 cp->count = iwl_mvm_umac_scan_cfg_channels_v7_6g(mvm, params, in iwl_mvm_scan_umac_v14_and_above()
2583 params->n_channels, in iwl_mvm_scan_umac_v14_and_above()
2584 pb, cp, vif->type, in iwl_mvm_scan_umac_v14_and_above()
2586 if (!cp->count) in iwl_mvm_scan_umac_v14_and_above()
2587 return -EINVAL; in iwl_mvm_scan_umac_v14_and_above()
2589 if (!params->n_ssids || in iwl_mvm_scan_umac_v14_and_above()
2590 (params->n_ssids == 1 && !params->ssids[0].ssid_len)) in iwl_mvm_scan_umac_v14_and_above()
2591 cp->flags |= IWL_SCAN_CHANNEL_FLAG_6G_PSC_NO_FILTER; in iwl_mvm_scan_umac_v14_and_above()
2626 return hweight32(mvm->scan_status & IWL_MVM_SCAN_MASK); in iwl_mvm_num_scans()
2631 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_check_running_scans()
2637 * return -EBUSY. But if the userspace wants to start a in iwl_mvm_check_running_scans()
2646 mvm->scan_status & (IWL_MVM_SCAN_SCHED | IWL_MVM_SCAN_NETDETECT)) in iwl_mvm_check_running_scans()
2647 return -EBUSY; in iwl_mvm_check_running_scans()
2649 if (iwl_mvm_num_scans(mvm) < mvm->max_scans) in iwl_mvm_check_running_scans()
2653 * than one bits set will fall in default and we will warn. in iwl_mvm_check_running_scans()
2657 if (mvm->scan_status & IWL_MVM_SCAN_REGULAR_MASK) in iwl_mvm_check_running_scans()
2658 return -EBUSY; in iwl_mvm_check_running_scans()
2661 if (mvm->scan_status & IWL_MVM_SCAN_SCHED_MASK) in iwl_mvm_check_running_scans()
2662 return -EBUSY; in iwl_mvm_check_running_scans()
2665 /* For non-unified images, there's no need to stop in iwl_mvm_check_running_scans()
2666 * anything for net-detect since the firmware is in iwl_mvm_check_running_scans()
2679 if (mvm->scan_status & IWL_MVM_SCAN_REGULAR_MASK) in iwl_mvm_check_running_scans()
2682 if (mvm->scan_status & IWL_MVM_SCAN_SCHED_MASK) in iwl_mvm_check_running_scans()
2694 return -EIO; in iwl_mvm_check_running_scans()
2707 iwl_force_nmi(mvm->trans); in iwl_mvm_scan_timeout_wk()
2715 params->type = in iwl_mvm_fill_scan_type()
2718 params->hb_type = in iwl_mvm_fill_scan_type()
2722 params->type = iwl_mvm_get_scan_type(mvm, vif); in iwl_mvm_fill_scan_type()
2756 mutex_lock(&mvm->mutex); in iwl_mvm_mei_scan_work()
2758 memcpy(bssid, info->conn_info.bssid, ETH_ALEN); in iwl_mvm_mei_scan_work()
2759 mutex_unlock(&mvm->mutex); in iwl_mvm_mei_scan_work()
2761 while ((skb = skb_dequeue(&scan_filter->scan_res))) { in iwl_mvm_mei_scan_work()
2762 struct ieee80211_mgmt *mgmt = (void *)skb->data; in iwl_mvm_mei_scan_work()
2764 if (!memcmp(mgmt->bssid, bssid, ETH_ALEN)) in iwl_mvm_mei_scan_work()
2765 ieee80211_rx_irqsafe(mvm->hw, skb); in iwl_mvm_mei_scan_work()
2773 skb_queue_head_init(&mei_scan_filter->scan_res); in iwl_mvm_mei_scan_filter_init()
2774 INIT_WORK(&mei_scan_filter->scan_work, iwl_mvm_mei_scan_work); in iwl_mvm_mei_scan_filter_init()
2777 /* In case CSME is connected and has link protection set, this function will
2794 conn_info = &info->conn_info; in iwl_mvm_mei_limited_scan()
2795 if (!info->conn_info.lp_state || !info->conn_info.ssid_len) in iwl_mvm_mei_limited_scan()
2798 if (!params->n_channels || !params->n_ssids) in iwl_mvm_mei_limited_scan()
2801 mvm->mei_scan_filter.is_mei_limited_scan = true; in iwl_mvm_mei_limited_scan()
2803 chan = ieee80211_get_channel(mvm->hw->wiphy, in iwl_mvm_mei_limited_scan()
2804 ieee80211_channel_to_frequency(conn_info->channel, in iwl_mvm_mei_limited_scan()
2805 conn_info->band)); in iwl_mvm_mei_limited_scan()
2808 "Failed to get CSME channel (chan=%u band=%u)\n", in iwl_mvm_mei_limited_scan()
2809 conn_info->channel, conn_info->band); in iwl_mvm_mei_limited_scan()
2817 scan_iters = min(IWL_MEI_SCAN_NUM_ITER, params->n_channels); in iwl_mvm_mei_limited_scan()
2818 params->n_channels = scan_iters; in iwl_mvm_mei_limited_scan()
2820 params->channels[i] = chan; in iwl_mvm_mei_limited_scan()
2824 params->n_ssids = 1; in iwl_mvm_mei_limited_scan()
2825 params->ssids[0].ssid_len = conn_info->ssid_len; in iwl_mvm_mei_limited_scan()
2826 memcpy(params->ssids[0].ssid, conn_info->ssid, conn_info->ssid_len); in iwl_mvm_mei_limited_scan()
2838 lockdep_assert_held(&mvm->mutex); in iwl_mvm_build_scan_cmd()
2839 memset(mvm->scan_cmd, 0, mvm->scan_cmd_size); in iwl_mvm_build_scan_cmd()
2843 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in iwl_mvm_build_scan_cmd()
2844 hcmd->id = SCAN_OFFLOAD_REQUEST_CMD; in iwl_mvm_build_scan_cmd()
2853 hcmd->id = WIDE_ID(IWL_ALWAYS_LONG_GROUP, SCAN_REQ_UMAC); in iwl_mvm_build_scan_cmd()
2855 scan_ver = iwl_fw_lookup_cmd_ver(mvm->fw, SCAN_REQ_UMAC, in iwl_mvm_build_scan_cmd()
2862 if (ver_handler->version != scan_ver) in iwl_mvm_build_scan_cmd()
2865 err = ver_handler->handler(mvm, vif, params, type, uid); in iwl_mvm_build_scan_cmd()
2879 enum nl80211_band band; member
2889 if (vif == data->current_vif) in iwl_mvm_scan_respect_p2p_go_iter()
2896 link_id < ARRAY_SIZE(mvmvif->link); in iwl_mvm_scan_respect_p2p_go_iter()
2899 mvmvif->link[link_id]; in iwl_mvm_scan_respect_p2p_go_iter()
2901 if (link && link->phy_ctxt->id < NUM_PHY_CTX && in iwl_mvm_scan_respect_p2p_go_iter()
2902 (data->band == NUM_NL80211_BANDS || in iwl_mvm_scan_respect_p2p_go_iter()
2903 link->phy_ctxt->channel->band == data->band)) { in iwl_mvm_scan_respect_p2p_go_iter()
2904 data->p2p_go = true; in iwl_mvm_scan_respect_p2p_go_iter()
2914 enum nl80211_band band) in _iwl_mvm_get_respect_p2p_go() argument
2919 .band = band, in _iwl_mvm_get_respect_p2p_go()
2925 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in _iwl_mvm_get_respect_p2p_go()
2935 enum nl80211_band band) in iwl_mvm_get_respect_p2p_go_band() argument
2937 bool low_latency = iwl_mvm_low_latency_band(mvm, band); in iwl_mvm_get_respect_p2p_go_band()
2939 return _iwl_mvm_get_respect_p2p_go(mvm, vif, low_latency, band); in iwl_mvm_get_respect_p2p_go_band()
2956 params->respect_p2p_go = in iwl_mvm_fill_respect_p2p_go()
2959 params->respect_p2p_go_hb = in iwl_mvm_fill_respect_p2p_go()
2963 params->respect_p2p_go = iwl_mvm_get_respect_p2p_go(mvm, vif); in iwl_mvm_fill_respect_p2p_go()
2975 .data = { mvm->scan_cmd, }, in _iwl_mvm_single_scan_start()
2982 lockdep_assert_held(&mvm->mutex); in _iwl_mvm_single_scan_start()
2984 if (iwl_mvm_is_lar_supported(mvm) && !mvm->lar_regdom_set) { in _iwl_mvm_single_scan_start()
2986 return -EBUSY; in _iwl_mvm_single_scan_start()
2994 if (WARN_ON(!mvm->scan_cmd)) in _iwl_mvm_single_scan_start()
2995 return -ENOMEM; in _iwl_mvm_single_scan_start()
2997 if (!iwl_mvm_scan_fits(mvm, req->n_ssids, ies, req->n_channels)) in _iwl_mvm_single_scan_start()
2998 return -ENOBUFS; in _iwl_mvm_single_scan_start()
3000 params.n_ssids = req->n_ssids; in _iwl_mvm_single_scan_start()
3001 params.flags = req->flags; in _iwl_mvm_single_scan_start()
3002 params.n_channels = req->n_channels; in _iwl_mvm_single_scan_start()
3004 params.ssids = req->ssids; in _iwl_mvm_single_scan_start()
3005 params.channels = req->channels; in _iwl_mvm_single_scan_start()
3006 params.mac_addr = req->mac_addr; in _iwl_mvm_single_scan_start()
3007 params.mac_addr_mask = req->mac_addr_mask; in _iwl_mvm_single_scan_start()
3008 params.no_cck = req->no_cck; in _iwl_mvm_single_scan_start()
3012 ether_addr_copy(params.bssid, req->bssid); in _iwl_mvm_single_scan_start()
3017 params.n_6ghz_params = req->n_6ghz_params; in _iwl_mvm_single_scan_start()
3018 params.scan_6ghz_params = req->scan_6ghz_params; in _iwl_mvm_single_scan_start()
3019 params.scan_6ghz = req->scan_6ghz; in _iwl_mvm_single_scan_start()
3023 if (req->duration) in _iwl_mvm_single_scan_start()
3026 params.tsf_report_link_id = req->tsf_report_link_id; in _iwl_mvm_single_scan_start()
3028 if (vif->active_links) in _iwl_mvm_single_scan_start()
3029 params.tsf_report_link_id = __ffs(vif->active_links); in _iwl_mvm_single_scan_start()
3059 mvm->scan_uid_status[uid] = type; in _iwl_mvm_single_scan_start()
3060 mvm->scan_status |= type; in _iwl_mvm_single_scan_start()
3063 mvm->scan_vif = iwl_mvm_vif_from_mac80211(vif); in _iwl_mvm_single_scan_start()
3064 schedule_delayed_work(&mvm->scan_timeout_dwork, in _iwl_mvm_single_scan_start()
3069 mvm->last_6ghz_passive_scan_jiffies = jiffies; in _iwl_mvm_single_scan_start()
3090 .data = { mvm->scan_cmd, }, in iwl_mvm_sched_scan_start()
3098 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sched_scan_start()
3100 if (iwl_mvm_is_lar_supported(mvm) && !mvm->lar_regdom_set) { in iwl_mvm_sched_scan_start()
3101 IWL_ERR(mvm, "sched-scan while LAR regdomain is not set\n"); in iwl_mvm_sched_scan_start()
3102 return -EBUSY; in iwl_mvm_sched_scan_start()
3110 if (WARN_ON(!mvm->scan_cmd)) in iwl_mvm_sched_scan_start()
3111 return -ENOMEM; in iwl_mvm_sched_scan_start()
3114 params.n_ssids = req->n_ssids; in iwl_mvm_sched_scan_start()
3115 params.flags = req->flags; in iwl_mvm_sched_scan_start()
3116 params.n_channels = req->n_channels; in iwl_mvm_sched_scan_start()
3117 params.ssids = req->ssids; in iwl_mvm_sched_scan_start()
3118 params.channels = req->channels; in iwl_mvm_sched_scan_start()
3119 params.mac_addr = req->mac_addr; in iwl_mvm_sched_scan_start()
3120 params.mac_addr_mask = req->mac_addr_mask; in iwl_mvm_sched_scan_start()
3123 params.n_match_sets = req->n_match_sets; in iwl_mvm_sched_scan_start()
3124 params.match_sets = req->match_sets; in iwl_mvm_sched_scan_start()
3126 if (!req->n_scan_plans) in iwl_mvm_sched_scan_start()
3127 return -EINVAL; in iwl_mvm_sched_scan_start()
3129 params.n_scan_plans = req->n_scan_plans; in iwl_mvm_sched_scan_start()
3130 params.scan_plans = req->scan_plans; in iwl_mvm_sched_scan_start()
3135 /* In theory, LMAC scans can handle a 32-bit delay, but since in iwl_mvm_sched_scan_start()
3138 * 16-bit delays), trim it down to 16-bits. in iwl_mvm_sched_scan_start()
3140 if (req->delay > U16_MAX) { in iwl_mvm_sched_scan_start()
3142 "delay value is > 16-bits, set to max possible\n"); in iwl_mvm_sched_scan_start()
3145 params.delay = req->delay; in iwl_mvm_sched_scan_start()
3154 /* for 6 GHZ band only PSC channels need to be added */ in iwl_mvm_sched_scan_start()
3158 if (channel->band == NL80211_BAND_6GHZ && in iwl_mvm_sched_scan_start()
3171 return -ENOMEM; in iwl_mvm_sched_scan_start()
3174 if (params.channels[i]->band == NL80211_BAND_6GHZ && in iwl_mvm_sched_scan_start()
3182 if (!iwl_mvm_scan_fits(mvm, req->n_ssids, ies, params.n_channels)) { in iwl_mvm_sched_scan_start()
3183 ret = -ENOBUFS; in iwl_mvm_sched_scan_start()
3198 mvm->scan_uid_status[uid] = type; in iwl_mvm_sched_scan_start()
3199 mvm->scan_status |= type; in iwl_mvm_sched_scan_start()
3206 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_sched_scan_start()
3219 struct iwl_umac_scan_complete *notif = (void *)pkt->data; in iwl_mvm_rx_umac_scan_complete_notif()
3220 u32 uid = __le32_to_cpu(notif->uid); in iwl_mvm_rx_umac_scan_complete_notif()
3221 bool aborted = (notif->status == IWL_SCAN_OFFLOAD_ABORTED); in iwl_mvm_rx_umac_scan_complete_notif()
3224 mvm->mei_scan_filter.is_mei_limited_scan = false; in iwl_mvm_rx_umac_scan_complete_notif()
3227 "Scan completed: uid=%u type=%u, status=%s, EBS=%s\n", in iwl_mvm_rx_umac_scan_complete_notif()
3228 uid, mvm->scan_uid_status[uid], in iwl_mvm_rx_umac_scan_complete_notif()
3229 notif->status == IWL_SCAN_OFFLOAD_COMPLETED ? in iwl_mvm_rx_umac_scan_complete_notif()
3231 iwl_mvm_ebs_status_str(notif->ebs_status)); in iwl_mvm_rx_umac_scan_complete_notif()
3234 mvm->scan_status); in iwl_mvm_rx_umac_scan_complete_notif()
3238 notif->last_schedule, notif->last_iter, in iwl_mvm_rx_umac_scan_complete_notif()
3239 __le32_to_cpu(notif->time_from_last_iter)); in iwl_mvm_rx_umac_scan_complete_notif()
3241 if (WARN_ON(!(mvm->scan_uid_status[uid] & mvm->scan_status))) in iwl_mvm_rx_umac_scan_complete_notif()
3245 if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_REGULAR) { in iwl_mvm_rx_umac_scan_complete_notif()
3248 .scan_start_tsf = mvm->scan_start, in iwl_mvm_rx_umac_scan_complete_notif()
3250 struct iwl_mvm_vif *scan_vif = mvm->scan_vif; in iwl_mvm_rx_umac_scan_complete_notif()
3252 scan_vif->link[mvm->scan_link_id]; in iwl_mvm_rx_umac_scan_complete_notif()
3258 memcpy(info.tsf_bssid, link_info->bssid, ETH_ALEN); in iwl_mvm_rx_umac_scan_complete_notif()
3262 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_rx_umac_scan_complete_notif()
3263 mvm->scan_vif = NULL; in iwl_mvm_rx_umac_scan_complete_notif()
3264 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_rx_umac_scan_complete_notif()
3266 } else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_SCHED) { in iwl_mvm_rx_umac_scan_complete_notif()
3267 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_rx_umac_scan_complete_notif()
3268 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_rx_umac_scan_complete_notif()
3269 } else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_INT_MLO) { in iwl_mvm_rx_umac_scan_complete_notif()
3275 select_links = notif->status == IWL_SCAN_OFFLOAD_COMPLETED; in iwl_mvm_rx_umac_scan_complete_notif()
3278 mvm->scan_status &= ~mvm->scan_uid_status[uid]; in iwl_mvm_rx_umac_scan_complete_notif()
3281 mvm->scan_status); in iwl_mvm_rx_umac_scan_complete_notif()
3283 if (notif->ebs_status != IWL_SCAN_EBS_SUCCESS && in iwl_mvm_rx_umac_scan_complete_notif()
3284 notif->ebs_status != IWL_SCAN_EBS_INACTIVE) in iwl_mvm_rx_umac_scan_complete_notif()
3285 mvm->last_ebs_successful = false; in iwl_mvm_rx_umac_scan_complete_notif()
3287 mvm->scan_uid_status[uid] = 0; in iwl_mvm_rx_umac_scan_complete_notif()
3290 wiphy_work_queue(mvm->hw->wiphy, &mvm->trig_link_selection_wk); in iwl_mvm_rx_umac_scan_complete_notif()
3297 struct iwl_umac_scan_iter_complete_notif *notif = (void *)pkt->data; in iwl_mvm_rx_umac_scan_iter_complete_notif()
3299 mvm->scan_start = le64_to_cpu(notif->start_tsf); in iwl_mvm_rx_umac_scan_iter_complete_notif()
3302 "UMAC Scan iteration complete: status=0x%x scanned_channels=%d\n", in iwl_mvm_rx_umac_scan_iter_complete_notif()
3303 notif->status, notif->scanned_channels); in iwl_mvm_rx_umac_scan_iter_complete_notif()
3305 if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_FOUND) { in iwl_mvm_rx_umac_scan_iter_complete_notif()
3307 ieee80211_sched_scan_results(mvm->hw); in iwl_mvm_rx_umac_scan_iter_complete_notif()
3308 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_ENABLED; in iwl_mvm_rx_umac_scan_iter_complete_notif()
3313 mvm->scan_start); in iwl_mvm_rx_umac_scan_iter_complete_notif()
3327 u32 status = IWL_UMAC_SCAN_ABORT_STATUS_NOT_FOUND; in iwl_mvm_umac_scan_abort() local
3329 lockdep_assert_held(&mvm->mutex); in iwl_mvm_umac_scan_abort()
3334 * checked that this type of scan was running in the generic in iwl_mvm_umac_scan_abort()
3345 ret = iwl_mvm_send_cmd_status(mvm, &cmd, &status); in iwl_mvm_umac_scan_abort()
3347 IWL_DEBUG_SCAN(mvm, "Scan abort: ret=%d, status=%u\n", ret, status); in iwl_mvm_umac_scan_abort()
3349 mvm->scan_uid_status[uid] = type << IWL_MVM_SCAN_STOPPING_SHIFT; in iwl_mvm_umac_scan_abort()
3352 * is to be stopped. In such a case, it is expected that the scan in iwl_mvm_umac_scan_abort()
3354 * In such a case, there is no need to wait for a scan complete in iwl_mvm_umac_scan_abort()
3358 if (status == IWL_UMAC_SCAN_ABORT_STATUS_NOT_FOUND) { in iwl_mvm_umac_scan_abort()
3359 mvm->scan_uid_status[uid] = type << IWL_MVM_SCAN_STOPPING_SHIFT; in iwl_mvm_umac_scan_abort()
3374 lockdep_assert_held(&mvm->mutex); in iwl_mvm_scan_stop_wait()
3376 iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_done, in iwl_mvm_scan_stop_wait()
3383 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) in iwl_mvm_scan_stop_wait()
3390 iwl_remove_notification(&mvm->notif_wait, &wait_scan_done); in iwl_mvm_scan_stop_wait()
3394 iwl_remove_notification(&mvm->notif_wait, &wait_scan_done); in iwl_mvm_scan_stop_wait()
3398 return iwl_wait_notification(&mvm->notif_wait, &wait_scan_done, in iwl_mvm_scan_stop_wait()
3420 u8 scan_ver = iwl_fw_lookup_cmd_ver(mvm->fw, SCAN_REQ_UMAC, in iwl_mvm_scan_size()
3437 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in iwl_mvm_scan_size()
3445 mvm->fw->ucode_capa.n_scan_channels + in iwl_mvm_scan_size()
3450 mvm->fw->ucode_capa.n_scan_channels + in iwl_mvm_scan_size()
3455 * This function is used in nic restart flow, to inform mac80211 about scans
3460 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in iwl_mvm_report_scan_aborted()
3469 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_report_scan_aborted()
3471 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_report_scan_aborted()
3472 mvm->scan_uid_status[uid] = 0; in iwl_mvm_report_scan_aborted()
3476 /* Sched scan will be restarted by mac80211 in in iwl_mvm_report_scan_aborted()
3480 if (!mvm->fw_restart) in iwl_mvm_report_scan_aborted()
3481 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_report_scan_aborted()
3482 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_report_scan_aborted()
3483 mvm->scan_uid_status[uid] = 0; in iwl_mvm_report_scan_aborted()
3488 mvm->scan_uid_status[uid] = 0; in iwl_mvm_report_scan_aborted()
3494 mvm->scan_uid_status[uid] = 0; in iwl_mvm_report_scan_aborted()
3499 mvm->scan_uid_status[uid] = 0; in iwl_mvm_report_scan_aborted()
3504 mvm->scan_uid_status[uid] = 0; in iwl_mvm_report_scan_aborted()
3510 for (i = 0; i < mvm->max_scans; i++) { in iwl_mvm_report_scan_aborted()
3511 if (WARN_ONCE(mvm->scan_uid_status[i], in iwl_mvm_report_scan_aborted()
3512 "UMAC scan UID %d status was not cleaned\n", in iwl_mvm_report_scan_aborted()
3514 mvm->scan_uid_status[i] = 0; in iwl_mvm_report_scan_aborted()
3517 if (mvm->scan_status & IWL_MVM_SCAN_REGULAR) { in iwl_mvm_report_scan_aborted()
3522 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_report_scan_aborted()
3523 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_report_scan_aborted()
3526 /* Sched scan will be restarted by mac80211 in in iwl_mvm_report_scan_aborted()
3530 if ((mvm->scan_status & IWL_MVM_SCAN_SCHED) && in iwl_mvm_report_scan_aborted()
3531 !mvm->fw_restart) { in iwl_mvm_report_scan_aborted()
3532 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_report_scan_aborted()
3533 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_report_scan_aborted()
3543 "Request to stop scan: type=0x%x, status=0x%x\n", in iwl_mvm_scan_stop()
3544 type, mvm->scan_status); in iwl_mvm_scan_stop()
3546 if (!(mvm->scan_status & type)) in iwl_mvm_scan_stop()
3549 if (!test_bit(STATUS_DEVICE_ENABLED, &mvm->trans->status)) { in iwl_mvm_scan_stop()
3556 mvm->scan_status |= type << IWL_MVM_SCAN_STOPPING_SHIFT; in iwl_mvm_scan_stop()
3561 /* Clear the scan status so the next scan requests will in iwl_mvm_scan_stop()
3566 mvm->scan_status &= ~type; in iwl_mvm_scan_stop()
3569 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_scan_stop()
3575 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_scan_stop()
3578 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_scan_stop()
3579 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_scan_stop()
3595 lockdep_assert_held(&mvm->mutex); in iwl_mvm_int_mlo_scan_start()
3600 if (!vif->cfg.assoc || !ieee80211_vif_is_mld(vif)) in iwl_mvm_int_mlo_scan_start()
3601 return -EINVAL; in iwl_mvm_int_mlo_scan_start()
3606 return -ENOMEM; in iwl_mvm_int_mlo_scan_start()
3610 req->channels[i] = channels[i]; in iwl_mvm_int_mlo_scan_start()
3612 req->n_channels = n_channels; in iwl_mvm_int_mlo_scan_start()
3616 if (mvm->hw->wiphy->bands[i]) in iwl_mvm_int_mlo_scan_start()
3617 req->rates[i] = in iwl_mvm_int_mlo_scan_start()
3618 (1 << mvm->hw->wiphy->bands[i]->n_bitrates) - 1; in iwl_mvm_int_mlo_scan_start()
3620 req->wdev = ieee80211_vif_to_wdev(vif); in iwl_mvm_int_mlo_scan_start()
3621 req->wiphy = mvm->hw->wiphy; in iwl_mvm_int_mlo_scan_start()
3622 req->scan_start = jiffies; in iwl_mvm_int_mlo_scan_start()
3623 req->tsf_report_link_id = -1; in iwl_mvm_int_mlo_scan_start()
3640 lockdep_assert_held(&mvm->mutex); in iwl_mvm_int_mlo_scan()
3642 if (mvm->scan_status & IWL_MVM_SCAN_INT_MLO) { in iwl_mvm_int_mlo_scan()
3644 return -EBUSY; in iwl_mvm_int_mlo_scan()
3651 rcu_dereference(vif->link_conf[link_id]); in iwl_mvm_int_mlo_scan()
3656 channels[n_channels++] = link_conf->chanreq.oper.chan; in iwl_mvm_int_mlo_scan()
3662 return -EINVAL; in iwl_mvm_int_mlo_scan()
3668 enum nl80211_band band, in iwl_mvm_chanidx_from_phy() argument
3671 struct ieee80211_supported_band *sband = mvm->hw->wiphy->bands[band]; in iwl_mvm_chanidx_from_phy()
3675 return -EINVAL; in iwl_mvm_chanidx_from_phy()
3677 for (chan_idx = 0; chan_idx < sband->n_channels; chan_idx++) { in iwl_mvm_chanidx_from_phy()
3678 struct ieee80211_channel *channel = &sband->channels[chan_idx]; in iwl_mvm_chanidx_from_phy()
3680 if (channel->hw_value == phy_chan_num) in iwl_mvm_chanidx_from_phy()
3684 return -EINVAL; in iwl_mvm_chanidx_from_phy()
3704 value = (((u64)value) * db_to_val[change - 1]) >> 32; in iwl_mvm_div_by_db()
3706 db -= change; in iwl_mvm_div_by_db()
3717 s8 sum_magnitude = -128; in iwl_mvm_average_dbm_values()
3722 * To properly average the decibel values (signal values given in dBm) in iwl_mvm_average_dbm_values()
3723 * we need to do the math in linear space. Doing a linear average of in iwl_mvm_average_dbm_values()
3725 * at least -10 to -110 dBm that will not fit into a 32 bit integer. in iwl_mvm_average_dbm_values()
3732 * with a 16.16 fixed point integer along with a base in dBm. 16.16 bit in iwl_mvm_average_dbm_values()
3733 * gives us plenty of head-room for adding up a few values and even in iwl_mvm_average_dbm_values()
3735 * (1/2^16 is somewhere around -48 dB, so effectively zero). in iwl_mvm_average_dbm_values()
3747 for (i = 0; i < ARRAY_SIZE(notif->noise); i++) { in iwl_mvm_average_dbm_values()
3751 if (notif->noise[i] == 0xff) in iwl_mvm_average_dbm_values()
3755 val_magnitude = -notif->noise[i]; in iwl_mvm_average_dbm_values()
3758 u8 div_db = sum_magnitude - val_magnitude; in iwl_mvm_average_dbm_values()
3763 u8 div_db = val_magnitude - sum_magnitude; in iwl_mvm_average_dbm_values()
3783 * average_factor is between -0.5 dB and 0.5 dB. in iwl_mvm_average_dbm_values()
3785 * Just do -1 dB steps and find the point where in iwl_mvm_average_dbm_values()
3786 * -0.5 dB * -i dB = 0x10000 * 10^(-0.5/10) / i dB in iwl_mvm_average_dbm_values()
3794 return average_magnitude - i; in iwl_mvm_average_dbm_values()
3803 (void *)pkt->data; in iwl_mvm_rx_channel_survey_notif()
3805 enum nl80211_band band; in iwl_mvm_rx_channel_survey_notif() local
3808 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rx_channel_survey_notif()
3810 if (!mvm->acs_survey) { in iwl_mvm_rx_channel_survey_notif()
3813 for (band = 0; band < NUM_NL80211_BANDS; band++) { in iwl_mvm_rx_channel_survey_notif()
3814 if (!mvm->hw->wiphy->bands[band]) in iwl_mvm_rx_channel_survey_notif()
3817 n_channels += mvm->hw->wiphy->bands[band]->n_channels; in iwl_mvm_rx_channel_survey_notif()
3820 mvm->acs_survey = kzalloc(struct_size(mvm->acs_survey, in iwl_mvm_rx_channel_survey_notif()
3824 if (!mvm->acs_survey) in iwl_mvm_rx_channel_survey_notif()
3827 mvm->acs_survey->n_channels = n_channels; in iwl_mvm_rx_channel_survey_notif()
3829 for (band = 0; band < NUM_NL80211_BANDS; band++) { in iwl_mvm_rx_channel_survey_notif()
3830 if (!mvm->hw->wiphy->bands[band]) in iwl_mvm_rx_channel_survey_notif()
3833 mvm->acs_survey->bands[band] = in iwl_mvm_rx_channel_survey_notif()
3834 &mvm->acs_survey->channels[n_channels]; in iwl_mvm_rx_channel_survey_notif()
3835 n_channels += mvm->hw->wiphy->bands[band]->n_channels; in iwl_mvm_rx_channel_survey_notif()
3839 band = iwl_mvm_nl80211_band_from_phy(le32_to_cpu(notif->band)); in iwl_mvm_rx_channel_survey_notif()
3840 chan_idx = iwl_mvm_chanidx_from_phy(mvm, band, in iwl_mvm_rx_channel_survey_notif()
3841 le32_to_cpu(notif->channel)); in iwl_mvm_rx_channel_survey_notif()
3846 mvm->hw->wiphy->bands[band]->channels[chan_idx].center_freq); in iwl_mvm_rx_channel_survey_notif()
3848 info = &mvm->acs_survey->bands[band][chan_idx]; in iwl_mvm_rx_channel_survey_notif()
3850 /* Times are all in ms */ in iwl_mvm_rx_channel_survey_notif()
3851 info->time = le32_to_cpu(notif->active_time); in iwl_mvm_rx_channel_survey_notif()
3852 info->time_busy = le32_to_cpu(notif->busy_time); in iwl_mvm_rx_channel_survey_notif()
3853 info->time_rx = le32_to_cpu(notif->rx_time); in iwl_mvm_rx_channel_survey_notif()
3854 info->time_tx = le32_to_cpu(notif->tx_time); in iwl_mvm_rx_channel_survey_notif()
3855 info->noise = iwl_mvm_average_dbm_values(notif); in iwl_mvm_rx_channel_survey_notif()