Lines Matching +full:memcpy +full:- +full:channels
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2012-2014, 2018-2023 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
13 #include "iwl-io.h"
32 /* adaptive dwell default APs number in social channels (1, 6, 11) */
34 /* number of scan channels */
38 /* adaptive dwell number of APs override mask for social channels */
40 /* adaptive dwell number of APs override for p2p friendly GO channels */
42 /* adaptive dwell number of APs override for social channels */
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. */
89 struct ieee80211_channel **channels; member
111 struct iwl_scan_req_umac *cmd = mvm->scan_cmd; in iwl_mvm_get_scan_req_umac_data()
114 return (void *)&cmd->v8.data; in iwl_mvm_get_scan_req_umac_data()
117 return (void *)&cmd->v7.data; in iwl_mvm_get_scan_req_umac_data()
120 return (void *)&cmd->v6.data; in iwl_mvm_get_scan_req_umac_data()
122 return (void *)&cmd->v1.data; in iwl_mvm_get_scan_req_umac_data()
128 struct iwl_scan_req_umac *cmd = mvm->scan_cmd; in iwl_mvm_get_scan_req_umac_channel()
131 return &cmd->v8.channel; in iwl_mvm_get_scan_req_umac_channel()
134 return &cmd->v7.channel; in iwl_mvm_get_scan_req_umac_channel()
137 return &cmd->v6.channel; in iwl_mvm_get_scan_req_umac_channel()
139 return &cmd->v1.channel; in iwl_mvm_get_scan_req_umac_channel()
144 if (mvm->scan_rx_ant != ANT_NONE) in iwl_mvm_scan_rx_ant()
145 return mvm->scan_rx_ant; in iwl_mvm_scan_rx_ant()
168 iwl_mvm_toggle_tx_ant(mvm, &mvm->scan_last_antenna_idx); in iwl_mvm_scan_rate_n_flags()
169 tx_ant = BIT(mvm->scan_last_antenna_idx) << RATE_MCS_ANT_POS; in iwl_mvm_scan_rate_n_flags()
180 return mvm->tcm.result.global_load; in iwl_mvm_get_traffic_load()
186 return mvm->tcm.result.band_load[band]; in iwl_mvm_get_traffic_load_band()
202 if (vif->type != NL80211_IFTYPE_P2P_DEVICE && in iwl_mvm_scan_iterator()
203 mvmvif->deflink.phy_ctxt && in iwl_mvm_scan_iterator()
204 mvmvif->deflink.phy_ctxt->id < NUM_PHY_CTX) in iwl_mvm_scan_iterator()
205 data->global_cnt += 1; in iwl_mvm_scan_iterator()
207 if (!data->current_vif || vif == data->current_vif) in iwl_mvm_scan_iterator()
210 curr_mvmvif = iwl_mvm_vif_from_mac80211(data->current_vif); in iwl_mvm_scan_iterator()
212 if (vif->type == NL80211_IFTYPE_AP && vif->p2p && in iwl_mvm_scan_iterator()
213 mvmvif->deflink.phy_ctxt && curr_mvmvif->deflink.phy_ctxt && in iwl_mvm_scan_iterator()
214 mvmvif->deflink.phy_ctxt->id != curr_mvmvif->deflink.phy_ctxt->id) in iwl_mvm_scan_iterator()
215 data->is_dcm_with_p2p_go = true; in iwl_mvm_scan_iterator()
230 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in _iwl_mvm_get_scan_type()
238 if (fw_has_api(&mvm->fw->ucode_capa, in _iwl_mvm_get_scan_type()
241 (!vif || vif->type != NL80211_IFTYPE_P2P_DEVICE)) in _iwl_mvm_get_scan_type()
246 * set all scan requests as fast-balance scan in _iwl_mvm_get_scan_type()
248 if (vif && vif->type == NL80211_IFTYPE_STATION && in _iwl_mvm_get_scan_type()
250 ((vif->bss_conf.beacon_int * in _iwl_mvm_get_scan_type()
251 vif->bss_conf.dtim_period) < 220)) in _iwl_mvm_get_scan_type()
291 return fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_rrm_scan_needed()
302 max_probe_len -= 24 + 2 + WFA_TPC_IE_LEN; in iwl_mvm_max_scan_ie_fw_cmd_room()
306 max_probe_len -= 3; in iwl_mvm_max_scan_ie_fw_cmd_room()
323 * functions with -ENOBUFS, if a large enough probe will be provided. in iwl_mvm_max_scan_ie_len()
332 struct iwl_lmac_scan_complete_notif *notif = (void *)pkt->data; in iwl_mvm_rx_lmac_scan_iter_complete_notif()
335 "Scan offload iteration complete: status=0x%x scanned channels=%d\n", in iwl_mvm_rx_lmac_scan_iter_complete_notif()
336 notif->status, notif->scanned_channels); in iwl_mvm_rx_lmac_scan_iter_complete_notif()
338 if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_FOUND) { in iwl_mvm_rx_lmac_scan_iter_complete_notif()
340 ieee80211_sched_scan_results(mvm->hw); in iwl_mvm_rx_lmac_scan_iter_complete_notif()
341 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_ENABLED; in iwl_mvm_rx_lmac_scan_iter_complete_notif()
349 ieee80211_sched_scan_results(mvm->hw); in iwl_mvm_rx_scan_match_found()
370 struct iwl_periodic_scan_complete *scan_notif = (void *)pkt->data; in iwl_mvm_rx_lmac_scan_complete_notif()
371 bool aborted = (scan_notif->status == IWL_SCAN_OFFLOAD_ABORTED); in iwl_mvm_rx_lmac_scan_complete_notif()
374 * notification during UMAC scans -- warn and ignore it. in iwl_mvm_rx_lmac_scan_complete_notif()
376 if (WARN_ON_ONCE(fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_rx_lmac_scan_complete_notif()
381 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rx_lmac_scan_complete_notif()
393 if (mvm->scan_status & IWL_MVM_SCAN_STOPPING_SCHED) { in iwl_mvm_rx_lmac_scan_complete_notif()
394 WARN_ON_ONCE(mvm->scan_status & IWL_MVM_SCAN_STOPPING_REGULAR); in iwl_mvm_rx_lmac_scan_complete_notif()
398 iwl_mvm_ebs_status_str(scan_notif->ebs_status)); in iwl_mvm_rx_lmac_scan_complete_notif()
401 scan_notif->last_schedule_line, in iwl_mvm_rx_lmac_scan_complete_notif()
402 scan_notif->last_schedule_iteration, in iwl_mvm_rx_lmac_scan_complete_notif()
403 __le32_to_cpu(scan_notif->time_after_last_iter)); in iwl_mvm_rx_lmac_scan_complete_notif()
405 mvm->scan_status &= ~IWL_MVM_SCAN_STOPPING_SCHED; in iwl_mvm_rx_lmac_scan_complete_notif()
406 } else if (mvm->scan_status & IWL_MVM_SCAN_STOPPING_REGULAR) { in iwl_mvm_rx_lmac_scan_complete_notif()
409 iwl_mvm_ebs_status_str(scan_notif->ebs_status)); in iwl_mvm_rx_lmac_scan_complete_notif()
411 mvm->scan_status &= ~IWL_MVM_SCAN_STOPPING_REGULAR; in iwl_mvm_rx_lmac_scan_complete_notif()
412 } else if (mvm->scan_status & IWL_MVM_SCAN_SCHED) { in iwl_mvm_rx_lmac_scan_complete_notif()
413 WARN_ON_ONCE(mvm->scan_status & IWL_MVM_SCAN_REGULAR); in iwl_mvm_rx_lmac_scan_complete_notif()
417 iwl_mvm_ebs_status_str(scan_notif->ebs_status)); in iwl_mvm_rx_lmac_scan_complete_notif()
420 scan_notif->last_schedule_line, in iwl_mvm_rx_lmac_scan_complete_notif()
421 scan_notif->last_schedule_iteration, in iwl_mvm_rx_lmac_scan_complete_notif()
422 __le32_to_cpu(scan_notif->time_after_last_iter)); in iwl_mvm_rx_lmac_scan_complete_notif()
424 mvm->scan_status &= ~IWL_MVM_SCAN_SCHED; in iwl_mvm_rx_lmac_scan_complete_notif()
425 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_rx_lmac_scan_complete_notif()
426 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_rx_lmac_scan_complete_notif()
427 } else if (mvm->scan_status & IWL_MVM_SCAN_REGULAR) { in iwl_mvm_rx_lmac_scan_complete_notif()
434 iwl_mvm_ebs_status_str(scan_notif->ebs_status)); in iwl_mvm_rx_lmac_scan_complete_notif()
436 mvm->scan_status &= ~IWL_MVM_SCAN_REGULAR; in iwl_mvm_rx_lmac_scan_complete_notif()
437 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_rx_lmac_scan_complete_notif()
438 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_rx_lmac_scan_complete_notif()
445 mvm->last_ebs_successful = in iwl_mvm_rx_lmac_scan_complete_notif()
446 scan_notif->ebs_status == IWL_SCAN_EBS_SUCCESS || in iwl_mvm_rx_lmac_scan_complete_notif()
447 scan_notif->ebs_status == IWL_SCAN_EBS_INACTIVE; in iwl_mvm_rx_lmac_scan_complete_notif()
458 !memcmp(ssid_list->ssid, ssid, ssid_len)) in iwl_ssid_exist()
461 return -1; in iwl_ssid_exist()
480 for (i = 0, j = params->n_match_sets - 1; in iwl_scan_build_ssids()
482 i++, j--) { in iwl_scan_build_ssids()
484 if (!params->match_sets[j].ssid.ssid_len) in iwl_scan_build_ssids()
487 ssids[i].len = params->match_sets[j].ssid.ssid_len; in iwl_scan_build_ssids()
488 memcpy(ssids[i].ssid, params->match_sets[j].ssid.ssid, in iwl_scan_build_ssids()
493 for (j = params->n_ssids - 1; in iwl_scan_build_ssids()
495 i++, j--) { in iwl_scan_build_ssids()
496 index = iwl_ssid_exist(params->ssids[j].ssid, in iwl_scan_build_ssids()
497 params->ssids[j].ssid_len, in iwl_scan_build_ssids()
501 ssids[i].len = params->ssids[j].ssid_len; in iwl_scan_build_ssids()
502 memcpy(ssids[i].ssid, params->ssids[j].ssid, in iwl_scan_build_ssids()
521 int max_profiles = iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_config_sched_scan_profiles()
534 if (WARN_ON(req->n_match_sets > max_profiles)) in iwl_mvm_config_sched_scan_profiles()
535 return -EIO; in iwl_mvm_config_sched_scan_profiles()
537 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_SHORT_BL) in iwl_mvm_config_sched_scan_profiles()
544 return -ENOMEM; in iwl_mvm_config_sched_scan_profiles()
548 ret = -ENOMEM; in iwl_mvm_config_sched_scan_profiles()
561 data = &profile_cfg->data; in iwl_mvm_config_sched_scan_profiles()
563 data = &profile_cfg_v1->data; in iwl_mvm_config_sched_scan_profiles()
567 data->num_profiles = req->n_match_sets; in iwl_mvm_config_sched_scan_profiles()
568 data->active_clients = SCAN_CLIENT_SCHED_SCAN; in iwl_mvm_config_sched_scan_profiles()
569 data->pass_match = SCAN_CLIENT_SCHED_SCAN; in iwl_mvm_config_sched_scan_profiles()
570 data->match_notify = SCAN_CLIENT_SCHED_SCAN; in iwl_mvm_config_sched_scan_profiles()
572 if (!req->n_match_sets || !req->match_sets[0].ssid.ssid_len) in iwl_mvm_config_sched_scan_profiles()
573 data->any_beacon_notify = SCAN_CLIENT_SCHED_SCAN; in iwl_mvm_config_sched_scan_profiles()
575 for (i = 0; i < req->n_match_sets; i++) { in iwl_mvm_config_sched_scan_profiles()
576 profile = &profile_cfg_v1->profiles[i]; in iwl_mvm_config_sched_scan_profiles()
577 profile->ssid_index = i; in iwl_mvm_config_sched_scan_profiles()
579 profile->unicast_cipher = 0xff; in iwl_mvm_config_sched_scan_profiles()
580 profile->auth_alg = IWL_AUTH_ALGO_UNSUPPORTED | in iwl_mvm_config_sched_scan_profiles()
583 profile->network_type = IWL_NETWORK_TYPE_ANY; in iwl_mvm_config_sched_scan_profiles()
584 profile->band_selection = IWL_SCAN_OFFLOAD_SELECT_ANY; in iwl_mvm_config_sched_scan_profiles()
585 profile->client_bitmap = SCAN_CLIENT_SCHED_SCAN; in iwl_mvm_config_sched_scan_profiles()
601 if (req->n_match_sets && req->match_sets[0].ssid.ssid_len) { in iwl_mvm_scan_pass_all()
604 req->n_match_sets); in iwl_mvm_scan_pass_all()
605 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_scan_pass_all()
611 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_ENABLED; in iwl_mvm_scan_pass_all()
636 ret = -ENOENT; in iwl_mvm_lmac_scan_abort()
652 if (!iwl_mvm_has_new_station_api(mvm->fw)) { in iwl_mvm_scan_fill_tx_cmd()
653 tx_cmd[0].sta_id = mvm->aux_sta.sta_id; in iwl_mvm_scan_fill_tx_cmd()
654 tx_cmd[1].sta_id = mvm->aux_sta.sta_id; in iwl_mvm_scan_fill_tx_cmd()
675 struct ieee80211_channel **channels, in iwl_mvm_lmac_scan_cfg_channels() argument
679 struct iwl_scan_channel_cfg_lmac *channel_cfg = (void *)&cmd->data; in iwl_mvm_lmac_scan_cfg_channels()
684 cpu_to_le16(channels[i]->hw_value); in iwl_mvm_lmac_scan_cfg_channels()
706 memcpy(newpos, ies, len); in iwl_mvm_copy_and_insert_ds_elem()
715 memcpy(newpos, ies, offs); in iwl_mvm_copy_and_insert_ds_elem()
723 memcpy(newpos, ies + offs, len - offs); in iwl_mvm_copy_and_insert_ds_elem()
724 newpos += len - offs; in iwl_mvm_copy_and_insert_ds_elem()
732 pos[1] = WFA_TPC_IE_LEN - 2; in iwl_mvm_add_tpc_report_ie()
738 /* pos[7] - tx power will be inserted by the FW */ in iwl_mvm_add_tpc_report_ie()
748 struct ieee80211_mgmt *frame = (void *)params->preq.buf; in iwl_mvm_build_scan_probe()
750 const u8 *mac_addr = params->flags & NL80211_SCAN_FLAG_RANDOM_ADDR ? in iwl_mvm_build_scan_probe()
751 params->mac_addr : NULL; in iwl_mvm_build_scan_probe()
760 get_random_mask_addr(frame->sa, mac_addr, in iwl_mvm_build_scan_probe()
761 params->mac_addr_mask); in iwl_mvm_build_scan_probe()
763 memcpy(frame->sa, vif->addr, ETH_ALEN); in iwl_mvm_build_scan_probe()
765 frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); in iwl_mvm_build_scan_probe()
766 eth_broadcast_addr(frame->da); in iwl_mvm_build_scan_probe()
767 ether_addr_copy(frame->bssid, params->bssid); in iwl_mvm_build_scan_probe()
768 frame->seq_ctrl = 0; in iwl_mvm_build_scan_probe()
770 pos = frame->u.probe_req.variable; in iwl_mvm_build_scan_probe()
774 params->preq.mac_header.offset = 0; in iwl_mvm_build_scan_probe()
775 params->preq.mac_header.len = cpu_to_le16(24 + 2); in iwl_mvm_build_scan_probe()
779 ies->ies[NL80211_BAND_2GHZ], in iwl_mvm_build_scan_probe()
780 ies->len[NL80211_BAND_2GHZ], in iwl_mvm_build_scan_probe()
782 params->preq.band_data[0].offset = cpu_to_le16(pos - params->preq.buf); in iwl_mvm_build_scan_probe()
783 params->preq.band_data[0].len = cpu_to_le16(newpos - pos); in iwl_mvm_build_scan_probe()
786 memcpy(pos, ies->ies[NL80211_BAND_5GHZ], in iwl_mvm_build_scan_probe()
787 ies->len[NL80211_BAND_5GHZ]); in iwl_mvm_build_scan_probe()
788 params->preq.band_data[1].offset = cpu_to_le16(pos - params->preq.buf); in iwl_mvm_build_scan_probe()
789 params->preq.band_data[1].len = in iwl_mvm_build_scan_probe()
790 cpu_to_le16(ies->len[NL80211_BAND_5GHZ]); in iwl_mvm_build_scan_probe()
791 pos += ies->len[NL80211_BAND_5GHZ]; in iwl_mvm_build_scan_probe()
793 memcpy(pos, ies->ies[NL80211_BAND_6GHZ], in iwl_mvm_build_scan_probe()
794 ies->len[NL80211_BAND_6GHZ]); in iwl_mvm_build_scan_probe()
795 params->preq.band_data[2].offset = cpu_to_le16(pos - params->preq.buf); in iwl_mvm_build_scan_probe()
796 params->preq.band_data[2].len = in iwl_mvm_build_scan_probe()
797 cpu_to_le16(ies->len[NL80211_BAND_6GHZ]); in iwl_mvm_build_scan_probe()
798 pos += ies->len[NL80211_BAND_6GHZ]; in iwl_mvm_build_scan_probe()
799 memcpy(pos, ies->common_ies, ies->common_ie_len); in iwl_mvm_build_scan_probe()
800 params->preq.common_data.offset = cpu_to_le16(pos - params->preq.buf); in iwl_mvm_build_scan_probe()
803 !fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_build_scan_probe()
805 iwl_mvm_add_tpc_report_ie(pos + ies->common_ie_len); in iwl_mvm_build_scan_probe()
806 params->preq.common_data.len = cpu_to_le16(ies->common_ie_len + in iwl_mvm_build_scan_probe()
809 params->preq.common_data.len = cpu_to_le16(ies->common_ie_len); in iwl_mvm_build_scan_probe()
817 cmd->active_dwell = IWL_SCAN_DWELL_ACTIVE; in iwl_mvm_scan_lmac_dwell()
818 cmd->passive_dwell = IWL_SCAN_DWELL_PASSIVE; in iwl_mvm_scan_lmac_dwell()
819 cmd->fragmented_dwell = IWL_SCAN_DWELL_FRAGMENTED; in iwl_mvm_scan_lmac_dwell()
820 cmd->extended_dwell = IWL_SCAN_DWELL_EXTENDED; in iwl_mvm_scan_lmac_dwell()
821 cmd->max_out_time = cpu_to_le32(scan_timing[params->type].max_out_time); in iwl_mvm_scan_lmac_dwell()
822 cmd->suspend_time = cpu_to_le32(scan_timing[params->type].suspend_time); in iwl_mvm_scan_lmac_dwell()
823 cmd->scan_prio = cpu_to_le32(IWL_SCAN_PRIORITY_EXT_6); in iwl_mvm_scan_lmac_dwell()
831 (n_channels <= mvm->fw->ucode_capa.n_scan_channels) & in iwl_mvm_scan_fits()
832 (ies->common_ie_len + in iwl_mvm_scan_fits()
833 ies->len[NL80211_BAND_2GHZ] + ies->len[NL80211_BAND_5GHZ] + in iwl_mvm_scan_fits()
834 ies->len[NL80211_BAND_6GHZ] <= in iwl_mvm_scan_fits()
841 const struct iwl_ucode_capabilities *capa = &mvm->fw->ucode_capa; in iwl_mvm_scan_use_ebs()
857 return ((capa->flags & IWL_UCODE_TLV_FLAGS_EBS_SUPPORT) && in iwl_mvm_scan_use_ebs()
858 mvm->last_ebs_successful && IWL_MVM_ENABLE_EBS && in iwl_mvm_scan_use_ebs()
859 vif->type != NL80211_IFTYPE_P2P_DEVICE && in iwl_mvm_scan_use_ebs()
865 return params->n_scan_plans == 1 && in iwl_mvm_is_regular_scan()
866 params->scan_plans[0].iterations == 1; in iwl_mvm_is_regular_scan()
881 if (params->n_ssids == 0) in iwl_mvm_scan_lmac_flags()
884 if (params->n_ssids == 1 && params->ssids[0].ssid_len != 0) in iwl_mvm_scan_lmac_flags()
887 if (iwl_mvm_is_scan_fragmented(params->type)) in iwl_mvm_scan_lmac_flags()
891 fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_scan_lmac_flags()
895 if (params->pass_all) in iwl_mvm_scan_lmac_flags()
901 if (mvm->scan_iter_notif_enabled) in iwl_mvm_scan_lmac_flags()
905 if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_ENABLED) in iwl_mvm_scan_lmac_flags()
909 vif->type != NL80211_IFTYPE_P2P_DEVICE && in iwl_mvm_scan_lmac_flags()
910 !iwl_mvm_is_scan_fragmented(params->type)) in iwl_mvm_scan_lmac_flags()
922 p_req->mac_header = src_p_req->mac_header; in iwl_mvm_scan_set_legacy_probe_req()
924 p_req->band_data[i] = src_p_req->band_data[i]; in iwl_mvm_scan_set_legacy_probe_req()
925 p_req->common_data = src_p_req->common_data; in iwl_mvm_scan_set_legacy_probe_req()
926 memcpy(p_req->buf, src_p_req->buf, sizeof(p_req->buf)); in iwl_mvm_scan_set_legacy_probe_req()
932 struct iwl_scan_req_lmac *cmd = mvm->scan_cmd; in iwl_mvm_scan_lmac()
934 (void *)(cmd->data + sizeof(struct iwl_scan_channel_cfg_lmac) * in iwl_mvm_scan_lmac()
935 mvm->fw->ucode_capa.n_scan_channels); in iwl_mvm_scan_lmac()
940 if (WARN_ON(params->n_scan_plans > IWL_MAX_SCHED_SCAN_PLANS)) in iwl_mvm_scan_lmac()
941 return -EINVAL; in iwl_mvm_scan_lmac()
945 cmd->rx_chain_select = iwl_mvm_scan_rx_chain(mvm); in iwl_mvm_scan_lmac()
946 cmd->iter_num = cpu_to_le32(1); in iwl_mvm_scan_lmac()
947 cmd->n_channels = (u8)params->n_channels; in iwl_mvm_scan_lmac()
949 cmd->delay = cpu_to_le32(params->delay); in iwl_mvm_scan_lmac()
951 cmd->scan_flags = cpu_to_le32(iwl_mvm_scan_lmac_flags(mvm, params, in iwl_mvm_scan_lmac()
954 band = iwl_mvm_phy_band_from_nl80211(params->channels[0]->band); in iwl_mvm_scan_lmac()
955 cmd->flags = cpu_to_le32(band); in iwl_mvm_scan_lmac()
956 cmd->filter_flags = cpu_to_le32(MAC_FILTER_ACCEPT_GRP | in iwl_mvm_scan_lmac()
958 iwl_mvm_scan_fill_tx_cmd(mvm, cmd->tx_cmd, params->no_cck); in iwl_mvm_scan_lmac()
959 iwl_scan_build_ssids(params, cmd->direct_scan, &ssid_bitmap); in iwl_mvm_scan_lmac()
961 /* this API uses bits 1-20 instead of 0-19 */ in iwl_mvm_scan_lmac()
964 for (i = 0; i < params->n_scan_plans; i++) { in iwl_mvm_scan_lmac()
966 ¶ms->scan_plans[i]; in iwl_mvm_scan_lmac()
968 cmd->schedule[i].delay = in iwl_mvm_scan_lmac()
969 cpu_to_le16(scan_plan->interval); in iwl_mvm_scan_lmac()
970 cmd->schedule[i].iterations = scan_plan->iterations; in iwl_mvm_scan_lmac()
971 cmd->schedule[i].full_scan_mul = 1; in iwl_mvm_scan_lmac()
980 if (!cmd->schedule[i - 1].iterations) in iwl_mvm_scan_lmac()
981 cmd->schedule[i - 1].iterations = 0xff; in iwl_mvm_scan_lmac()
984 cmd->channel_opt[0].flags = in iwl_mvm_scan_lmac()
988 cmd->channel_opt[0].non_ebs_ratio = in iwl_mvm_scan_lmac()
990 cmd->channel_opt[1].flags = in iwl_mvm_scan_lmac()
994 cmd->channel_opt[1].non_ebs_ratio = in iwl_mvm_scan_lmac()
998 iwl_mvm_lmac_scan_cfg_channels(mvm, params->channels, in iwl_mvm_scan_lmac()
999 params->n_channels, ssid_bitmap, cmd); in iwl_mvm_scan_lmac()
1001 iwl_mvm_scan_set_legacy_probe_req(preq, ¶ms->preq); in iwl_mvm_scan_lmac()
1032 band = &mvm->nvm_data->bands[NL80211_BAND_2GHZ]; in iwl_mvm_scan_config_rates()
1033 for (i = 0; i < band->n_bitrates; i++) in iwl_mvm_scan_config_rates()
1034 rates |= rate_to_scan_rate_flag(band->bitrates[i].hw_value); in iwl_mvm_scan_config_rates()
1035 band = &mvm->nvm_data->bands[NL80211_BAND_5GHZ]; in iwl_mvm_scan_config_rates()
1036 for (i = 0; i < band->n_bitrates; i++) in iwl_mvm_scan_config_rates()
1037 rates |= rate_to_scan_rate_flag(band->bitrates[i].hw_value); in iwl_mvm_scan_config_rates()
1048 dwell->active = IWL_SCAN_DWELL_ACTIVE; in iwl_mvm_fill_scan_dwell()
1049 dwell->passive = IWL_SCAN_DWELL_PASSIVE; in iwl_mvm_fill_scan_dwell()
1050 dwell->fragmented = IWL_SCAN_DWELL_FRAGMENTED; in iwl_mvm_fill_scan_dwell()
1051 dwell->extended = IWL_SCAN_DWELL_EXTENDED; in iwl_mvm_fill_scan_dwell()
1054 static void iwl_mvm_fill_channels(struct iwl_mvm *mvm, u8 *channels, in iwl_mvm_fill_channels() argument
1060 band = &mvm->nvm_data->bands[NL80211_BAND_2GHZ]; in iwl_mvm_fill_channels()
1061 for (i = 0; i < band->n_channels && j < max_channels; i++, j++) in iwl_mvm_fill_channels()
1062 channels[j] = band->channels[i].hw_value; in iwl_mvm_fill_channels()
1063 band = &mvm->nvm_data->bands[NL80211_BAND_5GHZ]; in iwl_mvm_fill_channels()
1064 for (i = 0; i < band->n_channels && j < max_channels; i++, j++) in iwl_mvm_fill_channels()
1065 channels[j] = band->channels[i].hw_value; in iwl_mvm_fill_channels()
1075 cfg->flags = cpu_to_le32(flags); in iwl_mvm_fill_scan_config_v1()
1076 cfg->tx_chains = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm)); in iwl_mvm_fill_scan_config_v1()
1077 cfg->rx_chains = cpu_to_le32(iwl_mvm_scan_rx_ant(mvm)); in iwl_mvm_fill_scan_config_v1()
1078 cfg->legacy_rates = iwl_mvm_scan_config_rates(mvm); in iwl_mvm_fill_scan_config_v1()
1079 cfg->out_of_channel_time = cpu_to_le32(scan_timing[type].max_out_time); in iwl_mvm_fill_scan_config_v1()
1080 cfg->suspend_time = cpu_to_le32(scan_timing[type].suspend_time); in iwl_mvm_fill_scan_config_v1()
1082 iwl_mvm_fill_scan_dwell(mvm, &cfg->dwell); in iwl_mvm_fill_scan_config_v1()
1084 memcpy(&cfg->mac_addr, &mvm->addresses[0].addr, ETH_ALEN); in iwl_mvm_fill_scan_config_v1()
1087 WARN_ON_ONCE(iwl_mvm_has_new_station_api(mvm->fw)); in iwl_mvm_fill_scan_config_v1()
1089 cfg->bcast_sta_id = mvm->aux_sta.sta_id; in iwl_mvm_fill_scan_config_v1()
1090 cfg->channel_flags = channel_flags; in iwl_mvm_fill_scan_config_v1()
1092 iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels); in iwl_mvm_fill_scan_config_v1()
1101 cfg->flags = cpu_to_le32(flags); in iwl_mvm_fill_scan_config_v2()
1102 cfg->tx_chains = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm)); in iwl_mvm_fill_scan_config_v2()
1103 cfg->rx_chains = cpu_to_le32(iwl_mvm_scan_rx_ant(mvm)); in iwl_mvm_fill_scan_config_v2()
1104 cfg->legacy_rates = iwl_mvm_scan_config_rates(mvm); in iwl_mvm_fill_scan_config_v2()
1114 cfg->out_of_channel_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_fill_scan_config_v2()
1116 cfg->suspend_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_fill_scan_config_v2()
1119 cfg->out_of_channel_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_fill_scan_config_v2()
1121 cfg->suspend_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_fill_scan_config_v2()
1127 cfg->out_of_channel_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_fill_scan_config_v2()
1129 cfg->suspend_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_fill_scan_config_v2()
1133 iwl_mvm_fill_scan_dwell(mvm, &cfg->dwell); in iwl_mvm_fill_scan_config_v2()
1135 memcpy(&cfg->mac_addr, &mvm->addresses[0].addr, ETH_ALEN); in iwl_mvm_fill_scan_config_v2()
1138 WARN_ON_ONCE(iwl_mvm_has_new_station_api(mvm->fw)); in iwl_mvm_fill_scan_config_v2()
1140 cfg->bcast_sta_id = mvm->aux_sta.sta_id; in iwl_mvm_fill_scan_config_v2()
1141 cfg->channel_flags = channel_flags; in iwl_mvm_fill_scan_config_v2()
1143 iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels); in iwl_mvm_fill_scan_config_v2()
1156 mvm->nvm_data->bands[NL80211_BAND_2GHZ].n_channels + in iwl_mvm_legacy_config_scan()
1157 mvm->nvm_data->bands[NL80211_BAND_5GHZ].n_channels; in iwl_mvm_legacy_config_scan()
1161 if (WARN_ON(num_channels > mvm->fw->ucode_capa.n_scan_channels)) in iwl_mvm_legacy_config_scan()
1162 num_channels = mvm->fw->ucode_capa.n_scan_channels; in iwl_mvm_legacy_config_scan()
1169 if (type == mvm->scan_type && hb_type == mvm->hb_scan_type) in iwl_mvm_legacy_config_scan()
1173 if (type == mvm->scan_type) in iwl_mvm_legacy_config_scan()
1181 cmd_size += mvm->fw->ucode_capa.n_scan_channels; in iwl_mvm_legacy_config_scan()
1185 return -ENOMEM; in iwl_mvm_legacy_config_scan()
1207 * Check for fragmented scan on LMAC2 - high band. in iwl_mvm_legacy_config_scan()
1208 * LMAC1 - low band is checked above. in iwl_mvm_legacy_config_scan()
1230 mvm->scan_type = type; in iwl_mvm_legacy_config_scan()
1231 mvm->hb_scan_type = hb_type; in iwl_mvm_legacy_config_scan()
1253 if (!iwl_mvm_has_new_station_api(mvm->fw)) { in iwl_mvm_config_scan()
1254 cfg.bcast_sta_id = mvm->aux_sta.sta_id; in iwl_mvm_config_scan()
1255 } else if (iwl_fw_lookup_cmd_ver(mvm->fw, SCAN_CFG_CMD, 0) < 5) { in iwl_mvm_config_scan()
1275 for (i = 0; i < mvm->max_scans; i++) in iwl_mvm_scan_uid_by_status()
1276 if (mvm->scan_uid_status[i] == status) in iwl_mvm_scan_uid_by_status()
1279 return -ENOENT; in iwl_mvm_scan_uid_by_status()
1289 timing = &scan_timing[params->type]; in iwl_mvm_scan_umac_dwell()
1294 cmd->v7.adwell_default_n_aps_social = in iwl_mvm_scan_umac_dwell()
1296 cmd->v7.adwell_default_n_aps = in iwl_mvm_scan_umac_dwell()
1300 cmd->v9.adwell_default_hb_n_aps = in iwl_mvm_scan_umac_dwell()
1305 cmd->v7.adwell_max_budget = in iwl_mvm_scan_umac_dwell()
1307 else if (params->n_ssids && params->ssids[0].ssid_len) in iwl_mvm_scan_umac_dwell()
1308 cmd->v7.adwell_max_budget = in iwl_mvm_scan_umac_dwell()
1311 cmd->v7.adwell_max_budget = in iwl_mvm_scan_umac_dwell()
1314 cmd->v7.scan_priority = cpu_to_le32(IWL_SCAN_PRIORITY_EXT_6); in iwl_mvm_scan_umac_dwell()
1315 cmd->v7.max_out_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1316 cpu_to_le32(timing->max_out_time); in iwl_mvm_scan_umac_dwell()
1317 cmd->v7.suspend_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1318 cpu_to_le32(timing->suspend_time); in iwl_mvm_scan_umac_dwell()
1321 hb_timing = &scan_timing[params->hb_type]; in iwl_mvm_scan_umac_dwell()
1323 cmd->v7.max_out_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1324 cpu_to_le32(hb_timing->max_out_time); in iwl_mvm_scan_umac_dwell()
1325 cmd->v7.suspend_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1326 cpu_to_le32(hb_timing->suspend_time); in iwl_mvm_scan_umac_dwell()
1330 cmd->v7.active_dwell = active_dwell; in iwl_mvm_scan_umac_dwell()
1331 cmd->v7.passive_dwell = passive_dwell; in iwl_mvm_scan_umac_dwell()
1332 cmd->v7.fragmented_dwell = IWL_SCAN_DWELL_FRAGMENTED; in iwl_mvm_scan_umac_dwell()
1334 cmd->v8.active_dwell[SCAN_LB_LMAC_IDX] = active_dwell; in iwl_mvm_scan_umac_dwell()
1335 cmd->v8.passive_dwell[SCAN_LB_LMAC_IDX] = passive_dwell; in iwl_mvm_scan_umac_dwell()
1337 cmd->v8.active_dwell[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1339 cmd->v8.passive_dwell[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1344 cmd->v1.extended_dwell = IWL_SCAN_DWELL_EXTENDED; in iwl_mvm_scan_umac_dwell()
1345 cmd->v1.active_dwell = active_dwell; in iwl_mvm_scan_umac_dwell()
1346 cmd->v1.passive_dwell = passive_dwell; in iwl_mvm_scan_umac_dwell()
1347 cmd->v1.fragmented_dwell = IWL_SCAN_DWELL_FRAGMENTED; in iwl_mvm_scan_umac_dwell()
1350 hb_timing = &scan_timing[params->hb_type]; in iwl_mvm_scan_umac_dwell()
1352 cmd->v6.max_out_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1353 cpu_to_le32(hb_timing->max_out_time); in iwl_mvm_scan_umac_dwell()
1354 cmd->v6.suspend_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1355 cpu_to_le32(hb_timing->suspend_time); in iwl_mvm_scan_umac_dwell()
1359 cmd->v6.scan_priority = in iwl_mvm_scan_umac_dwell()
1361 cmd->v6.max_out_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1362 cpu_to_le32(timing->max_out_time); in iwl_mvm_scan_umac_dwell()
1363 cmd->v6.suspend_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell()
1364 cpu_to_le32(timing->suspend_time); in iwl_mvm_scan_umac_dwell()
1366 cmd->v1.scan_priority = in iwl_mvm_scan_umac_dwell()
1368 cmd->v1.max_out_time = in iwl_mvm_scan_umac_dwell()
1369 cpu_to_le32(timing->max_out_time); in iwl_mvm_scan_umac_dwell()
1370 cmd->v1.suspend_time = in iwl_mvm_scan_umac_dwell()
1371 cpu_to_le32(timing->suspend_time); in iwl_mvm_scan_umac_dwell()
1376 cmd->ooc_priority = cpu_to_le32(IWL_SCAN_PRIORITY_EXT_6); in iwl_mvm_scan_umac_dwell()
1378 cmd->ooc_priority = cpu_to_le32(IWL_SCAN_PRIORITY_EXT_2); in iwl_mvm_scan_umac_dwell()
1396 timing = &scan_timing[params->type]; in iwl_mvm_scan_umac_dwell_v11()
1400 general_params->adwell_default_social_chn = in iwl_mvm_scan_umac_dwell_v11()
1402 general_params->adwell_default_2g = IWL_SCAN_ADWELL_DEFAULT_LB_N_APS; in iwl_mvm_scan_umac_dwell_v11()
1403 general_params->adwell_default_5g = IWL_SCAN_ADWELL_DEFAULT_HB_N_APS; in iwl_mvm_scan_umac_dwell_v11()
1407 general_params->adwell_max_budget = in iwl_mvm_scan_umac_dwell_v11()
1409 else if (params->n_ssids && params->ssids[0].ssid_len) in iwl_mvm_scan_umac_dwell_v11()
1410 general_params->adwell_max_budget = in iwl_mvm_scan_umac_dwell_v11()
1413 general_params->adwell_max_budget = in iwl_mvm_scan_umac_dwell_v11()
1416 general_params->scan_priority = cpu_to_le32(IWL_SCAN_PRIORITY_EXT_6); in iwl_mvm_scan_umac_dwell_v11()
1417 general_params->max_out_of_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell_v11()
1418 cpu_to_le32(timing->max_out_time); in iwl_mvm_scan_umac_dwell_v11()
1419 general_params->suspend_time[SCAN_LB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell_v11()
1420 cpu_to_le32(timing->suspend_time); in iwl_mvm_scan_umac_dwell_v11()
1422 hb_timing = &scan_timing[params->hb_type]; in iwl_mvm_scan_umac_dwell_v11()
1424 general_params->max_out_of_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell_v11()
1425 cpu_to_le32(hb_timing->max_out_time); in iwl_mvm_scan_umac_dwell_v11()
1426 general_params->suspend_time[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac_dwell_v11()
1427 cpu_to_le32(hb_timing->suspend_time); in iwl_mvm_scan_umac_dwell_v11()
1429 general_params->active_dwell[SCAN_LB_LMAC_IDX] = active_dwell; in iwl_mvm_scan_umac_dwell_v11()
1430 general_params->passive_dwell[SCAN_LB_LMAC_IDX] = passive_dwell; in iwl_mvm_scan_umac_dwell_v11()
1431 general_params->active_dwell[SCAN_HB_LMAC_IDX] = active_dwell; in iwl_mvm_scan_umac_dwell_v11()
1432 general_params->passive_dwell[SCAN_HB_LMAC_IDX] = passive_dwell; in iwl_mvm_scan_umac_dwell_v11()
1484 return -EINVAL; in iwl_mvm_scan_ch_and_band_to_idx()
1491 if (ch_segment->band != band || in iwl_mvm_scan_ch_and_band_to_idx()
1492 ch_segment->first_channel_id > channel_id || in iwl_mvm_scan_ch_and_band_to_idx()
1493 ch_segment->last_channel_id < channel_id) in iwl_mvm_scan_ch_and_band_to_idx()
1496 ch_offset = (channel_id - ch_segment->first_channel_id) >> in iwl_mvm_scan_ch_and_band_to_idx()
1497 ch_segment->channel_spacing_shift; in iwl_mvm_scan_ch_and_band_to_idx()
1506 return -EINVAL; in iwl_mvm_scan_ch_and_band_to_idx()
1577 struct ieee80211_channel **channels, in iwl_mvm_umac_scan_cfg_channels() argument
1585 channel_cfg[i].v1.channel_num = channels[i]->hw_value; in iwl_mvm_umac_scan_cfg_channels()
1587 enum nl80211_band band = channels[i]->band; in iwl_mvm_umac_scan_cfg_channels()
1602 struct ieee80211_channel **channels, in iwl_mvm_umac_scan_cfg_channels_v4() argument
1607 u8 *bitmap = cp->adwell_ch_override_bitmap; in iwl_mvm_umac_scan_cfg_channels_v4()
1608 size_t bitmap_n_entries = ARRAY_SIZE(cp->adwell_ch_override_bitmap); in iwl_mvm_umac_scan_cfg_channels_v4()
1612 enum nl80211_band band = channels[i]->band; in iwl_mvm_umac_scan_cfg_channels_v4()
1614 &cp->channel_config[i]; in iwl_mvm_umac_scan_cfg_channels_v4()
1616 cfg->flags = cpu_to_le32(flags); in iwl_mvm_umac_scan_cfg_channels_v4()
1617 cfg->v2.channel_num = channels[i]->hw_value; in iwl_mvm_umac_scan_cfg_channels_v4()
1618 cfg->v2.band = iwl_mvm_phy_band_from_nl80211(band); in iwl_mvm_umac_scan_cfg_channels_v4()
1619 cfg->v2.iter_count = 1; in iwl_mvm_umac_scan_cfg_channels_v4()
1620 cfg->v2.iter_interval = 0; in iwl_mvm_umac_scan_cfg_channels_v4()
1623 cfg->v2.channel_num, in iwl_mvm_umac_scan_cfg_channels_v4()
1624 cfg->v2.band, bitmap, in iwl_mvm_umac_scan_cfg_channels_v4()
1631 struct ieee80211_channel **channels, in iwl_mvm_umac_scan_cfg_channels_v7() argument
1639 enum nl80211_band band = channels[i]->band; in iwl_mvm_umac_scan_cfg_channels_v7()
1640 struct iwl_scan_channel_cfg_umac *cfg = &cp->channel_config[i]; in iwl_mvm_umac_scan_cfg_channels_v7()
1643 channels[i]->hw_value); in iwl_mvm_umac_scan_cfg_channels_v7()
1646 cfg->flags = cpu_to_le32(flags | n_aps_flag); in iwl_mvm_umac_scan_cfg_channels_v7()
1647 cfg->v2.channel_num = channels[i]->hw_value; in iwl_mvm_umac_scan_cfg_channels_v7()
1648 if (cfg80211_channel_is_psc(channels[i])) in iwl_mvm_umac_scan_cfg_channels_v7()
1649 cfg->flags = 0; in iwl_mvm_umac_scan_cfg_channels_v7()
1650 cfg->v2.iter_count = 1; in iwl_mvm_umac_scan_cfg_channels_v7()
1651 cfg->v2.iter_interval = 0; in iwl_mvm_umac_scan_cfg_channels_v7()
1653 cfg->v2.band = iwl_band; in iwl_mvm_umac_scan_cfg_channels_v7()
1655 cfg->flags |= cpu_to_le32((iwl_band << in iwl_mvm_umac_scan_cfg_channels_v7()
1667 params->scan_6ghz_params; in iwl_mvm_umac_scan_fill_6g_chan_list()
1668 bool hidden_supported = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_umac_scan_fill_6g_chan_list()
1671 for (j = 0; j < params->n_ssids && idex_s < SCAN_SHORT_SSID_MAX_SIZE; in iwl_mvm_umac_scan_fill_6g_chan_list()
1673 if (!params->ssids[j].ssid_len) in iwl_mvm_umac_scan_fill_6g_chan_list()
1676 pp->short_ssid[idex_s] = in iwl_mvm_umac_scan_fill_6g_chan_list()
1677 cpu_to_le32(~crc32_le(~0, params->ssids[j].ssid, in iwl_mvm_umac_scan_fill_6g_chan_list()
1678 params->ssids[j].ssid_len)); in iwl_mvm_umac_scan_fill_6g_chan_list()
1681 pp->direct_scan[idex_s].id = WLAN_EID_SSID; in iwl_mvm_umac_scan_fill_6g_chan_list()
1682 pp->direct_scan[idex_s].len = params->ssids[j].ssid_len; in iwl_mvm_umac_scan_fill_6g_chan_list()
1683 memcpy(pp->direct_scan[idex_s].ssid, params->ssids[j].ssid, in iwl_mvm_umac_scan_fill_6g_chan_list()
1684 params->ssids[j].ssid_len); in iwl_mvm_umac_scan_fill_6g_chan_list()
1692 * does not (yet) correspond to the actual channels, so it is possible in iwl_mvm_umac_scan_fill_6g_chan_list()
1697 for (j = 0; j < params->n_6ghz_params; j++) { in iwl_mvm_umac_scan_fill_6g_chan_list()
1703 if (pp->short_ssid[k] == in iwl_mvm_umac_scan_fill_6g_chan_list()
1709 pp->short_ssid[idex_s++] = in iwl_mvm_umac_scan_fill_6g_chan_list()
1716 if (!memcmp(&pp->bssid_array[k], in iwl_mvm_umac_scan_fill_6g_chan_list()
1725 memcpy(&pp->bssid_array[idex_b++], in iwl_mvm_umac_scan_fill_6g_chan_list()
1730 pp->short_ssid_num = idex_s; in iwl_mvm_umac_scan_fill_6g_chan_list()
1731 pp->bssid_num = idex_b; in iwl_mvm_umac_scan_fill_6g_chan_list()
1746 params->scan_6ghz_params; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1749 for (i = 0, ch_cnt = 0; i < params->n_channels; i++) { in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1751 &cp->channel_config[ch_cnt]; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1761 * Avoid performing passive scan on non PSC channels unless the in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1765 if (!cfg80211_channel_is_psc(params->channels[i]) && in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1766 !params->n_6ghz_params && params->n_ssids) in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1769 cfg->v1.channel_num = params->channels[i]->hw_value; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1771 cfg->v2.band = PHY_BAND_6; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1773 cfg->flags |= cpu_to_le32(PHY_BAND_6 << in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1776 cfg->v5.iter_count = 1; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1777 cfg->v5.iter_interval = 0; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1787 for (j = 0; j < params->n_6ghz_params; j++) { in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1809 for (k = 0; k < pp->short_ssid_num; k++) { in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1811 le32_to_cpu(pp->short_ssid[k]) == in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1829 n_used_bssid_entries -= 3; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1832 } else if (pp->direct_scan[k].len) { in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1845 for (k = 0; k < pp->bssid_num; k++) { in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1846 if (!memcmp(&pp->bssid_array[k], in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1859 if (cfg80211_channel_is_psc(params->channels[i]) && in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1869 * - PSC channel with NO_LISTEN_FLAG on should be treated in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1871 * - Non PSC channel with more than 3 short SSIDs or more in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1873 * - Non PSC Channel with unsolicited probe response and in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1875 * - PSC channel with more than 2 short SSIDs or more than in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1878 * - PSC channel with more than 1 SSID or 3 BSSIDs. in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1879 * - Non PSC channel with more than 2 SSIDs or 6 BSSIDs. in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1880 * - Non PSC channel with unsolicited probe response and in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1883 if (!iwl_mvm_is_scan_fragmented(params->type)) { in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1884 if (!cfg80211_channel_is_psc(params->channels[i]) || in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1892 } else if (cfg80211_channel_is_psc(params->channels[i])) { in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1901 !cfg80211_channel_is_psc(params->channels[i]))) in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1906 cfg->flags |= cpu_to_le32(flags); in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1908 cfg->v5.psd_20 = psd_20; in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1913 if (params->n_channels > ch_cnt) in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1915 "6GHz: reducing number channels: (%u->%u)\n", in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1916 params->n_channels, ch_cnt); in iwl_mvm_umac_scan_cfg_channels_v7_6g()
1934 /* set fragmented ebs for fragmented scan on HB channels */ in iwl_mvm_scan_umac_chan_flags_v2()
1936 iwl_mvm_is_scan_fragmented(params->type)) || in iwl_mvm_scan_umac_chan_flags_v2()
1938 iwl_mvm_is_scan_fragmented(params->hb_type))) in iwl_mvm_scan_umac_chan_flags_v2()
1946 iwl_mvm_is_scan_fragmented(params->type) && params->respect_p2p_go) || in iwl_mvm_scan_umac_chan_flags_v2()
1948 iwl_mvm_is_scan_fragmented(params->hb_type) && in iwl_mvm_scan_umac_chan_flags_v2()
1949 params->respect_p2p_go_hb)) { in iwl_mvm_scan_umac_chan_flags_v2()
1962 &mvm->nvm_data->bands[NL80211_BAND_6GHZ]; in iwl_mvm_scan_6ghz_passive_scan()
1965 params->enable_6ghz_passive = false; in iwl_mvm_scan_6ghz_passive_scan()
1967 if (params->scan_6ghz) in iwl_mvm_scan_6ghz_passive_scan()
1970 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_scan_6ghz_passive_scan()
1978 if (vif->type != NL80211_IFTYPE_STATION) { in iwl_mvm_scan_6ghz_passive_scan()
1989 if ((vif->cfg.assoc || in iwl_mvm_scan_6ghz_passive_scan()
1990 time_after(mvm->last_6ghz_passive_scan_jiffies + in iwl_mvm_scan_6ghz_passive_scan()
1992 (time_before(mvm->last_reset_or_resume_time_jiffies + in iwl_mvm_scan_6ghz_passive_scan()
1996 vif->cfg.assoc ? "associated" : in iwl_mvm_scan_6ghz_passive_scan()
2001 /* not enough channels in the regular scan request */ in iwl_mvm_scan_6ghz_passive_scan()
2002 if (params->n_channels < IWL_MVM_6GHZ_PASSIVE_SCAN_MIN_CHANS) { in iwl_mvm_scan_6ghz_passive_scan()
2004 "6GHz passive scan: not enough channels\n"); in iwl_mvm_scan_6ghz_passive_scan()
2008 for (i = 0; i < params->n_ssids; i++) { in iwl_mvm_scan_6ghz_passive_scan()
2009 if (!params->ssids[i].ssid_len) in iwl_mvm_scan_6ghz_passive_scan()
2014 if (i == params->n_ssids) { in iwl_mvm_scan_6ghz_passive_scan()
2020 if (!sband || !sband->n_channels) { in iwl_mvm_scan_6ghz_passive_scan()
2022 "6GHz passive scan: no 6GHz channels\n"); in iwl_mvm_scan_6ghz_passive_scan()
2026 for (i = 0, n_disabled = 0; i < sband->n_channels; i++) { in iwl_mvm_scan_6ghz_passive_scan()
2027 if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED)) in iwl_mvm_scan_6ghz_passive_scan()
2032 * Not all the 6GHz channels are disabled, so no need for 6GHz passive in iwl_mvm_scan_6ghz_passive_scan()
2035 if (n_disabled != sband->n_channels) { in iwl_mvm_scan_6ghz_passive_scan()
2037 "6GHz passive scan: 6GHz channels enabled\n"); in iwl_mvm_scan_6ghz_passive_scan()
2043 params->enable_6ghz_passive = true; in iwl_mvm_scan_6ghz_passive_scan()
2059 if (params->n_ssids == 0) in iwl_mvm_scan_umac_flags_v2()
2061 else if (params->n_ssids == 1 && params->ssids[0].ssid_len) in iwl_mvm_scan_umac_flags_v2()
2064 if (iwl_mvm_is_scan_fragmented(params->type)) in iwl_mvm_scan_umac_flags_v2()
2067 if (iwl_mvm_is_scan_fragmented(params->hb_type)) in iwl_mvm_scan_umac_flags_v2()
2070 if (params->pass_all) in iwl_mvm_scan_umac_flags_v2()
2078 if (params->iter_notif || in iwl_mvm_scan_umac_flags_v2()
2079 mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_ENABLED) in iwl_mvm_scan_umac_flags_v2()
2089 params->flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ) in iwl_mvm_scan_umac_flags_v2()
2092 if (params->enable_6ghz_passive) in iwl_mvm_scan_umac_flags_v2()
2096 (params->flags & (NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP | in iwl_mvm_scan_umac_flags_v2()
2111 if (params->respect_p2p_go) in iwl_mvm_scan_umac_flags2()
2113 if (params->respect_p2p_go_hb) in iwl_mvm_scan_umac_flags2()
2116 if (params->respect_p2p_go) in iwl_mvm_scan_umac_flags2()
2121 if (params->scan_6ghz && in iwl_mvm_scan_umac_flags2()
2122 fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_scan_umac_flags2()
2135 if (params->n_ssids == 0) in iwl_mvm_scan_umac_flags()
2138 if (params->n_ssids == 1 && params->ssids[0].ssid_len != 0) in iwl_mvm_scan_umac_flags()
2141 if (iwl_mvm_is_scan_fragmented(params->type)) in iwl_mvm_scan_umac_flags()
2145 iwl_mvm_is_scan_fragmented(params->hb_type)) in iwl_mvm_scan_umac_flags()
2149 fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_scan_umac_flags()
2153 if (params->pass_all) in iwl_mvm_scan_umac_flags()
2161 if (params->iter_notif) in iwl_mvm_scan_umac_flags()
2165 if (mvm->scan_iter_notif_enabled) in iwl_mvm_scan_umac_flags()
2169 if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_ENABLED) in iwl_mvm_scan_umac_flags()
2181 vif->type != NL80211_IFTYPE_P2P_DEVICE && in iwl_mvm_scan_umac_flags()
2182 !iwl_mvm_is_scan_fragmented(params->type) && in iwl_mvm_scan_umac_flags()
2188 if ((params->flags & in iwl_mvm_scan_umac_flags()
2196 if ((params->flags & in iwl_mvm_scan_umac_flags()
2200 if ((params->flags & NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME)) in iwl_mvm_scan_umac_flags()
2213 if (WARN_ON(!params->n_scan_plans || in iwl_mvm_fill_scan_sched_params()
2214 params->n_scan_plans > IWL_MAX_SCHED_SCAN_PLANS)) in iwl_mvm_fill_scan_sched_params()
2215 return -EINVAL; in iwl_mvm_fill_scan_sched_params()
2217 for (i = 0; i < params->n_scan_plans; i++) { in iwl_mvm_fill_scan_sched_params()
2219 ¶ms->scan_plans[i]; in iwl_mvm_fill_scan_sched_params()
2221 schedule[i].iter_count = scan_plan->iterations; in iwl_mvm_fill_scan_sched_params()
2223 cpu_to_le16(scan_plan->interval); in iwl_mvm_fill_scan_sched_params()
2232 if (!schedule[params->n_scan_plans - 1].iter_count) in iwl_mvm_fill_scan_sched_params()
2233 schedule[params->n_scan_plans - 1].iter_count = 0xff; in iwl_mvm_fill_scan_sched_params()
2235 *delay = cpu_to_le16(params->delay); in iwl_mvm_fill_scan_sched_params()
2244 struct iwl_scan_req_umac *cmd = mvm->scan_cmd; in iwl_mvm_scan_umac()
2248 mvm->fw->ucode_capa.n_scan_channels; in iwl_mvm_scan_umac()
2263 mvm->scan_uid_status[uid] = type; in iwl_mvm_scan_umac()
2265 cmd->uid = cpu_to_le32(uid); in iwl_mvm_scan_umac()
2267 cmd->general_flags = cpu_to_le16(gen_flags); in iwl_mvm_scan_umac()
2270 cmd->v8.num_of_fragments[SCAN_LB_LMAC_IDX] = in iwl_mvm_scan_umac()
2273 cmd->v8.num_of_fragments[SCAN_HB_LMAC_IDX] = in iwl_mvm_scan_umac()
2276 cmd->v8.general_flags2 = in iwl_mvm_scan_umac()
2280 cmd->scan_start_mac_id = scan_vif->id; in iwl_mvm_scan_umac()
2283 cmd->flags = cpu_to_le32(IWL_UMAC_SCAN_FLAG_PREEMPTIVE); in iwl_mvm_scan_umac()
2290 /* set fragmented ebs for fragmented scan on HB channels */ in iwl_mvm_scan_umac()
2300 chan_param->flags = channel_flags; in iwl_mvm_scan_umac()
2301 chan_param->count = params->n_channels; in iwl_mvm_scan_umac()
2303 ret = iwl_mvm_fill_scan_sched_params(params, tail_v2->schedule, in iwl_mvm_scan_umac()
2304 &tail_v2->delay); in iwl_mvm_scan_umac()
2306 mvm->scan_uid_status[uid] = 0; in iwl_mvm_scan_umac()
2311 tail_v2->preq = params->preq; in iwl_mvm_scan_umac()
2312 direct_scan = tail_v2->direct_scan; in iwl_mvm_scan_umac()
2315 iwl_mvm_scan_set_legacy_probe_req(&tail_v1->preq, in iwl_mvm_scan_umac()
2316 ¶ms->preq); in iwl_mvm_scan_umac()
2317 direct_scan = tail_v1->direct_scan; in iwl_mvm_scan_umac()
2320 iwl_mvm_umac_scan_cfg_channels(mvm, params->channels, in iwl_mvm_scan_umac()
2321 params->n_channels, ssid_bitmap, in iwl_mvm_scan_umac()
2341 gp->flags = cpu_to_le16(gen_flags); in iwl_mvm_scan_umac_fill_general_p_v12()
2342 gp->flags2 = gen_flags2; in iwl_mvm_scan_umac_fill_general_p_v12()
2345 gp->num_of_fragments[SCAN_LB_LMAC_IDX] = IWL_SCAN_NUM_OF_FRAGS; in iwl_mvm_scan_umac_fill_general_p_v12()
2347 gp->num_of_fragments[SCAN_HB_LMAC_IDX] = IWL_SCAN_NUM_OF_FRAGS; in iwl_mvm_scan_umac_fill_general_p_v12()
2350 gp->scan_start_mac_or_link_id = scan_vif->id; in iwl_mvm_scan_umac_fill_general_p_v12()
2359 if (vif->active_links) in iwl_mvm_scan_umac_fill_general_p_v12()
2360 link_id = ffs(vif->active_links) - 1; in iwl_mvm_scan_umac_fill_general_p_v12()
2362 link_info = scan_vif->link[link_id]; in iwl_mvm_scan_umac_fill_general_p_v12()
2364 gp->scan_start_mac_or_link_id = link_info->fw_link_id; in iwl_mvm_scan_umac_fill_general_p_v12()
2372 pp->preq = params->preq; in iwl_mvm_scan_umac_fill_probe_p_v3()
2373 pp->ssid_num = params->n_ssids; in iwl_mvm_scan_umac_fill_probe_p_v3()
2374 iwl_scan_build_ssids(params, pp->direct_scan, NULL); in iwl_mvm_scan_umac_fill_probe_p_v3()
2382 pp->preq = params->preq; in iwl_mvm_scan_umac_fill_probe_p_v4()
2383 iwl_scan_build_ssids(params, pp->direct_scan, bitmap_ssid); in iwl_mvm_scan_umac_fill_probe_p_v4()
2393 cp->flags = iwl_mvm_scan_umac_chan_flags_v2(mvm, params, vif); in iwl_mvm_scan_umac_fill_ch_p_v4()
2394 cp->count = params->n_channels; in iwl_mvm_scan_umac_fill_ch_p_v4()
2395 cp->num_of_aps_override = IWL_SCAN_ADWELL_N_APS_GO_FRIENDLY; in iwl_mvm_scan_umac_fill_ch_p_v4()
2397 iwl_mvm_umac_scan_cfg_channels_v4(mvm, params->channels, cp, in iwl_mvm_scan_umac_fill_ch_p_v4()
2398 params->n_channels, in iwl_mvm_scan_umac_fill_ch_p_v4()
2400 vif->type); in iwl_mvm_scan_umac_fill_ch_p_v4()
2411 cp->flags = iwl_mvm_scan_umac_chan_flags_v2(mvm, params, vif); in iwl_mvm_scan_umac_fill_ch_p_v7()
2412 cp->count = params->n_channels; in iwl_mvm_scan_umac_fill_ch_p_v7()
2413 cp->n_aps_override[0] = IWL_SCAN_ADWELL_N_APS_GO_FRIENDLY; in iwl_mvm_scan_umac_fill_ch_p_v7()
2414 cp->n_aps_override[1] = IWL_SCAN_ADWELL_N_APS_SOCIAL_CHS; in iwl_mvm_scan_umac_fill_ch_p_v7()
2416 iwl_mvm_umac_scan_cfg_channels_v7(mvm, params->channels, cp, in iwl_mvm_scan_umac_fill_ch_p_v7()
2417 params->n_channels, in iwl_mvm_scan_umac_fill_ch_p_v7()
2419 vif->type, version); in iwl_mvm_scan_umac_fill_ch_p_v7()
2421 if (params->enable_6ghz_passive) { in iwl_mvm_scan_umac_fill_ch_p_v7()
2423 &mvm->nvm_data->bands[NL80211_BAND_6GHZ]; in iwl_mvm_scan_umac_fill_ch_p_v7()
2426 for (i = 0; i < sband->n_channels; i++) { in iwl_mvm_scan_umac_fill_ch_p_v7()
2428 &sband->channels[i]; in iwl_mvm_scan_umac_fill_ch_p_v7()
2431 &cp->channel_config[cp->count]; in iwl_mvm_scan_umac_fill_ch_p_v7()
2436 cfg->v5.channel_num = channel->hw_value; in iwl_mvm_scan_umac_fill_ch_p_v7()
2437 cfg->v5.iter_count = 1; in iwl_mvm_scan_umac_fill_ch_p_v7()
2438 cfg->v5.iter_interval = 0; in iwl_mvm_scan_umac_fill_ch_p_v7()
2441 cfg->flags = 0; in iwl_mvm_scan_umac_fill_ch_p_v7()
2442 cfg->v2.band = PHY_BAND_6; in iwl_mvm_scan_umac_fill_ch_p_v7()
2444 cfg->flags = cpu_to_le32(PHY_BAND_6 << in iwl_mvm_scan_umac_fill_ch_p_v7()
2446 cfg->v5.psd_20 = in iwl_mvm_scan_umac_fill_ch_p_v7()
2449 cp->count++; in iwl_mvm_scan_umac_fill_ch_p_v7()
2458 struct iwl_scan_req_umac_v12 *cmd = mvm->scan_cmd; in iwl_mvm_scan_umac_v12()
2459 struct iwl_scan_req_params_v12 *scan_p = &cmd->scan_params; in iwl_mvm_scan_umac_v12()
2463 mvm->scan_uid_status[uid] = type; in iwl_mvm_scan_umac_v12()
2465 cmd->ooc_priority = cpu_to_le32(iwl_mvm_scan_umac_ooc_priority(params)); in iwl_mvm_scan_umac_v12()
2466 cmd->uid = cpu_to_le32(uid); in iwl_mvm_scan_umac_v12()
2470 &scan_p->general_params, in iwl_mvm_scan_umac_v12()
2474 scan_p->periodic_params.schedule, in iwl_mvm_scan_umac_v12()
2475 &scan_p->periodic_params.delay); in iwl_mvm_scan_umac_v12()
2479 iwl_mvm_scan_umac_fill_probe_p_v3(params, &scan_p->probe_params); in iwl_mvm_scan_umac_v12()
2481 &scan_p->channel_params, 0); in iwl_mvm_scan_umac_v12()
2491 struct iwl_scan_req_umac_v17 *cmd = mvm->scan_cmd; in iwl_mvm_scan_umac_v14_and_above()
2492 struct iwl_scan_req_params_v17 *scan_p = &cmd->scan_params; in iwl_mvm_scan_umac_v14_and_above()
2493 struct iwl_scan_channel_params_v7 *cp = &scan_p->channel_params; in iwl_mvm_scan_umac_v14_and_above()
2494 struct iwl_scan_probe_params_v4 *pb = &scan_p->probe_params; in iwl_mvm_scan_umac_v14_and_above()
2500 mvm->scan_uid_status[uid] = type; in iwl_mvm_scan_umac_v14_and_above()
2502 cmd->ooc_priority = cpu_to_le32(iwl_mvm_scan_umac_ooc_priority(params)); in iwl_mvm_scan_umac_v14_and_above()
2503 cmd->uid = cpu_to_le32(uid); in iwl_mvm_scan_umac_v14_and_above()
2513 &scan_p->general_params, in iwl_mvm_scan_umac_v14_and_above()
2517 scan_p->periodic_params.schedule, in iwl_mvm_scan_umac_v14_and_above()
2518 &scan_p->periodic_params.delay); in iwl_mvm_scan_umac_v14_and_above()
2522 if (!params->scan_6ghz) { in iwl_mvm_scan_umac_v14_and_above()
2524 &scan_p->probe_params, in iwl_mvm_scan_umac_v14_and_above()
2527 &scan_p->channel_params, in iwl_mvm_scan_umac_v14_and_above()
2532 pb->preq = params->preq; in iwl_mvm_scan_umac_v14_and_above()
2535 cp->flags = iwl_mvm_scan_umac_chan_flags_v2(mvm, params, vif); in iwl_mvm_scan_umac_v14_and_above()
2536 cp->n_aps_override[0] = IWL_SCAN_ADWELL_N_APS_GO_FRIENDLY; in iwl_mvm_scan_umac_v14_and_above()
2537 cp->n_aps_override[1] = IWL_SCAN_ADWELL_N_APS_SOCIAL_CHS; in iwl_mvm_scan_umac_v14_and_above()
2541 cp->count = iwl_mvm_umac_scan_cfg_channels_v7_6g(mvm, params, in iwl_mvm_scan_umac_v14_and_above()
2542 params->n_channels, in iwl_mvm_scan_umac_v14_and_above()
2543 pb, cp, vif->type, in iwl_mvm_scan_umac_v14_and_above()
2545 if (!cp->count) { in iwl_mvm_scan_umac_v14_and_above()
2546 mvm->scan_uid_status[uid] = 0; in iwl_mvm_scan_umac_v14_and_above()
2547 return -EINVAL; in iwl_mvm_scan_umac_v14_and_above()
2550 if (!params->n_ssids || in iwl_mvm_scan_umac_v14_and_above()
2551 (params->n_ssids == 1 && !params->ssids[0].ssid_len)) in iwl_mvm_scan_umac_v14_and_above()
2552 cp->flags |= IWL_SCAN_CHANNEL_FLAG_6G_PSC_NO_FILTER; in iwl_mvm_scan_umac_v14_and_above()
2587 return hweight32(mvm->scan_status & IWL_MVM_SCAN_MASK); in iwl_mvm_num_scans()
2592 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_check_running_scans()
2598 * return -EBUSY. But if the userspace wants to start a in iwl_mvm_check_running_scans()
2607 mvm->scan_status & (IWL_MVM_SCAN_SCHED | IWL_MVM_SCAN_NETDETECT)) in iwl_mvm_check_running_scans()
2608 return -EBUSY; in iwl_mvm_check_running_scans()
2610 if (iwl_mvm_num_scans(mvm) < mvm->max_scans) in iwl_mvm_check_running_scans()
2618 if (mvm->scan_status & IWL_MVM_SCAN_REGULAR_MASK) in iwl_mvm_check_running_scans()
2619 return -EBUSY; in iwl_mvm_check_running_scans()
2622 if (mvm->scan_status & IWL_MVM_SCAN_SCHED_MASK) in iwl_mvm_check_running_scans()
2623 return -EBUSY; in iwl_mvm_check_running_scans()
2626 /* For non-unified images, there's no need to stop in iwl_mvm_check_running_scans()
2627 * anything for net-detect since the firmware is in iwl_mvm_check_running_scans()
2640 if (mvm->scan_status & IWL_MVM_SCAN_REGULAR_MASK) in iwl_mvm_check_running_scans()
2643 if (mvm->scan_status & IWL_MVM_SCAN_SCHED_MASK) in iwl_mvm_check_running_scans()
2655 return -EIO; in iwl_mvm_check_running_scans()
2668 iwl_force_nmi(mvm->trans); in iwl_mvm_scan_timeout_wk()
2676 params->type = in iwl_mvm_fill_scan_type()
2679 params->hb_type = in iwl_mvm_fill_scan_type()
2683 params->type = iwl_mvm_get_scan_type(mvm, vif); in iwl_mvm_fill_scan_type()
2717 mutex_lock(&mvm->mutex); in iwl_mvm_mei_scan_work()
2719 memcpy(bssid, info->conn_info.bssid, ETH_ALEN); in iwl_mvm_mei_scan_work()
2720 mutex_unlock(&mvm->mutex); in iwl_mvm_mei_scan_work()
2722 while ((skb = skb_dequeue(&scan_filter->scan_res))) { in iwl_mvm_mei_scan_work()
2723 struct ieee80211_mgmt *mgmt = (void *)skb->data; in iwl_mvm_mei_scan_work()
2725 if (!memcmp(mgmt->bssid, bssid, ETH_ALEN)) in iwl_mvm_mei_scan_work()
2726 ieee80211_rx_irqsafe(mvm->hw, skb); in iwl_mvm_mei_scan_work()
2734 skb_queue_head_init(&mei_scan_filter->scan_res); in iwl_mvm_mei_scan_filter_init()
2735 INIT_WORK(&mei_scan_filter->scan_work, iwl_mvm_mei_scan_work); in iwl_mvm_mei_scan_filter_init()
2755 conn_info = &info->conn_info; in iwl_mvm_mei_limited_scan()
2756 if (!info->conn_info.lp_state || !info->conn_info.ssid_len) in iwl_mvm_mei_limited_scan()
2759 if (!params->n_channels || !params->n_ssids) in iwl_mvm_mei_limited_scan()
2762 mvm->mei_scan_filter.is_mei_limited_scan = true; in iwl_mvm_mei_limited_scan()
2764 chan = ieee80211_get_channel(mvm->hw->wiphy, in iwl_mvm_mei_limited_scan()
2765 ieee80211_channel_to_frequency(conn_info->channel, in iwl_mvm_mei_limited_scan()
2766 conn_info->band)); in iwl_mvm_mei_limited_scan()
2770 conn_info->channel, conn_info->band); in iwl_mvm_mei_limited_scan()
2778 scan_iters = min(IWL_MEI_SCAN_NUM_ITER, params->n_channels); in iwl_mvm_mei_limited_scan()
2779 params->n_channels = scan_iters; in iwl_mvm_mei_limited_scan()
2781 params->channels[i] = chan; in iwl_mvm_mei_limited_scan()
2785 params->n_ssids = 1; in iwl_mvm_mei_limited_scan()
2786 params->ssids[0].ssid_len = conn_info->ssid_len; in iwl_mvm_mei_limited_scan()
2787 memcpy(params->ssids[0].ssid, conn_info->ssid, conn_info->ssid_len); in iwl_mvm_mei_limited_scan()
2799 lockdep_assert_held(&mvm->mutex); in iwl_mvm_build_scan_cmd()
2800 memset(mvm->scan_cmd, 0, mvm->scan_cmd_size); in iwl_mvm_build_scan_cmd()
2804 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in iwl_mvm_build_scan_cmd()
2805 hcmd->id = SCAN_OFFLOAD_REQUEST_CMD; in iwl_mvm_build_scan_cmd()
2814 hcmd->id = WIDE_ID(IWL_ALWAYS_LONG_GROUP, SCAN_REQ_UMAC); in iwl_mvm_build_scan_cmd()
2816 scan_ver = iwl_fw_lookup_cmd_ver(mvm->fw, SCAN_REQ_UMAC, in iwl_mvm_build_scan_cmd()
2823 if (ver_handler->version != scan_ver) in iwl_mvm_build_scan_cmd()
2826 err = ver_handler->handler(mvm, vif, params, type, uid); in iwl_mvm_build_scan_cmd()
2850 if (vif == data->current_vif) in iwl_mvm_scan_respect_p2p_go_iter()
2853 if (vif->type == NL80211_IFTYPE_AP && vif->p2p) { in iwl_mvm_scan_respect_p2p_go_iter()
2857 link_id < ARRAY_SIZE(mvmvif->link); in iwl_mvm_scan_respect_p2p_go_iter()
2860 mvmvif->link[link_id]; in iwl_mvm_scan_respect_p2p_go_iter()
2862 if (link && link->phy_ctxt->id < NUM_PHY_CTX && in iwl_mvm_scan_respect_p2p_go_iter()
2863 (data->band == NUM_NL80211_BANDS || in iwl_mvm_scan_respect_p2p_go_iter()
2864 link->phy_ctxt->channel->band == data->band)) { in iwl_mvm_scan_respect_p2p_go_iter()
2865 data->p2p_go = true; in iwl_mvm_scan_respect_p2p_go_iter()
2886 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in _iwl_mvm_get_respect_p2p_go()
2917 params->respect_p2p_go = in iwl_mvm_fill_respect_p2p_go()
2920 params->respect_p2p_go_hb = in iwl_mvm_fill_respect_p2p_go()
2924 params->respect_p2p_go = iwl_mvm_get_respect_p2p_go(mvm, vif); in iwl_mvm_fill_respect_p2p_go()
2934 .data = { mvm->scan_cmd, }, in iwl_mvm_reg_scan_start()
2941 lockdep_assert_held(&mvm->mutex); in iwl_mvm_reg_scan_start()
2943 if (iwl_mvm_is_lar_supported(mvm) && !mvm->lar_regdom_set) { in iwl_mvm_reg_scan_start()
2945 return -EBUSY; in iwl_mvm_reg_scan_start()
2953 if (WARN_ON(!mvm->scan_cmd)) in iwl_mvm_reg_scan_start()
2954 return -ENOMEM; in iwl_mvm_reg_scan_start()
2956 if (!iwl_mvm_scan_fits(mvm, req->n_ssids, ies, req->n_channels)) in iwl_mvm_reg_scan_start()
2957 return -ENOBUFS; in iwl_mvm_reg_scan_start()
2959 params.n_ssids = req->n_ssids; in iwl_mvm_reg_scan_start()
2960 params.flags = req->flags; in iwl_mvm_reg_scan_start()
2961 params.n_channels = req->n_channels; in iwl_mvm_reg_scan_start()
2963 params.ssids = req->ssids; in iwl_mvm_reg_scan_start()
2964 params.channels = req->channels; in iwl_mvm_reg_scan_start()
2965 params.mac_addr = req->mac_addr; in iwl_mvm_reg_scan_start()
2966 params.mac_addr_mask = req->mac_addr_mask; in iwl_mvm_reg_scan_start()
2967 params.no_cck = req->no_cck; in iwl_mvm_reg_scan_start()
2971 ether_addr_copy(params.bssid, req->bssid); in iwl_mvm_reg_scan_start()
2976 params.n_6ghz_params = req->n_6ghz_params; in iwl_mvm_reg_scan_start()
2977 params.scan_6ghz_params = req->scan_6ghz_params; in iwl_mvm_reg_scan_start()
2978 params.scan_6ghz = req->scan_6ghz; in iwl_mvm_reg_scan_start()
2982 if (req->duration) in iwl_mvm_reg_scan_start()
3005 mvm->scan_uid_status[uid] = 0; in iwl_mvm_reg_scan_start()
3010 mvm->scan_status |= IWL_MVM_SCAN_REGULAR; in iwl_mvm_reg_scan_start()
3011 mvm->scan_vif = iwl_mvm_vif_from_mac80211(vif); in iwl_mvm_reg_scan_start()
3014 mvm->last_6ghz_passive_scan_jiffies = jiffies; in iwl_mvm_reg_scan_start()
3016 schedule_delayed_work(&mvm->scan_timeout_dwork, in iwl_mvm_reg_scan_start()
3030 .data = { mvm->scan_cmd, }, in iwl_mvm_sched_scan_start()
3038 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sched_scan_start()
3040 if (iwl_mvm_is_lar_supported(mvm) && !mvm->lar_regdom_set) { in iwl_mvm_sched_scan_start()
3041 IWL_ERR(mvm, "sched-scan while LAR regdomain is not set\n"); in iwl_mvm_sched_scan_start()
3042 return -EBUSY; in iwl_mvm_sched_scan_start()
3050 if (WARN_ON(!mvm->scan_cmd)) in iwl_mvm_sched_scan_start()
3051 return -ENOMEM; in iwl_mvm_sched_scan_start()
3054 params.n_ssids = req->n_ssids; in iwl_mvm_sched_scan_start()
3055 params.flags = req->flags; in iwl_mvm_sched_scan_start()
3056 params.n_channels = req->n_channels; in iwl_mvm_sched_scan_start()
3057 params.ssids = req->ssids; in iwl_mvm_sched_scan_start()
3058 params.channels = req->channels; in iwl_mvm_sched_scan_start()
3059 params.mac_addr = req->mac_addr; in iwl_mvm_sched_scan_start()
3060 params.mac_addr_mask = req->mac_addr_mask; in iwl_mvm_sched_scan_start()
3063 params.n_match_sets = req->n_match_sets; in iwl_mvm_sched_scan_start()
3064 params.match_sets = req->match_sets; in iwl_mvm_sched_scan_start()
3066 if (!req->n_scan_plans) in iwl_mvm_sched_scan_start()
3067 return -EINVAL; in iwl_mvm_sched_scan_start()
3069 params.n_scan_plans = req->n_scan_plans; in iwl_mvm_sched_scan_start()
3070 params.scan_plans = req->scan_plans; in iwl_mvm_sched_scan_start()
3075 /* In theory, LMAC scans can handle a 32-bit delay, but since in iwl_mvm_sched_scan_start()
3078 * 16-bit delays), trim it down to 16-bits. in iwl_mvm_sched_scan_start()
3080 if (req->delay > U16_MAX) { in iwl_mvm_sched_scan_start()
3082 "delay value is > 16-bits, set to max possible\n"); in iwl_mvm_sched_scan_start()
3085 params.delay = req->delay; in iwl_mvm_sched_scan_start()
3094 /* for 6 GHZ band only PSC channels need to be added */ in iwl_mvm_sched_scan_start()
3096 struct ieee80211_channel *channel = params.channels[i]; in iwl_mvm_sched_scan_start()
3098 if (channel->band == NL80211_BAND_6GHZ && in iwl_mvm_sched_scan_start()
3106 params.channels = kmemdup(params.channels, in iwl_mvm_sched_scan_start()
3107 sizeof(params.channels[0]) * in iwl_mvm_sched_scan_start()
3110 if (!params.channels) in iwl_mvm_sched_scan_start()
3111 return -ENOMEM; in iwl_mvm_sched_scan_start()
3114 if (params.channels[i]->band == NL80211_BAND_6GHZ && in iwl_mvm_sched_scan_start()
3115 !cfg80211_channel_is_psc(params.channels[i])) in iwl_mvm_sched_scan_start()
3117 params.channels[j++] = params.channels[i]; in iwl_mvm_sched_scan_start()
3122 if (!iwl_mvm_scan_fits(mvm, req->n_ssids, ies, params.n_channels)) { in iwl_mvm_sched_scan_start()
3123 ret = -ENOBUFS; in iwl_mvm_sched_scan_start()
3137 mvm->scan_status |= type; in iwl_mvm_sched_scan_start()
3144 mvm->scan_uid_status[uid] = 0; in iwl_mvm_sched_scan_start()
3145 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_sched_scan_start()
3150 kfree(params.channels); in iwl_mvm_sched_scan_start()
3158 struct iwl_umac_scan_complete *notif = (void *)pkt->data; in iwl_mvm_rx_umac_scan_complete_notif()
3159 u32 uid = __le32_to_cpu(notif->uid); in iwl_mvm_rx_umac_scan_complete_notif()
3160 bool aborted = (notif->status == IWL_SCAN_OFFLOAD_ABORTED); in iwl_mvm_rx_umac_scan_complete_notif()
3162 mvm->mei_scan_filter.is_mei_limited_scan = false; in iwl_mvm_rx_umac_scan_complete_notif()
3164 if (WARN_ON(!(mvm->scan_uid_status[uid] & mvm->scan_status))) in iwl_mvm_rx_umac_scan_complete_notif()
3168 if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_REGULAR) { in iwl_mvm_rx_umac_scan_complete_notif()
3171 .scan_start_tsf = mvm->scan_start, in iwl_mvm_rx_umac_scan_complete_notif()
3174 memcpy(info.tsf_bssid, mvm->scan_vif->deflink.bssid, ETH_ALEN); in iwl_mvm_rx_umac_scan_complete_notif()
3175 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_rx_umac_scan_complete_notif()
3176 mvm->scan_vif = NULL; in iwl_mvm_rx_umac_scan_complete_notif()
3177 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_rx_umac_scan_complete_notif()
3179 } else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_SCHED) { in iwl_mvm_rx_umac_scan_complete_notif()
3180 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_rx_umac_scan_complete_notif()
3181 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_rx_umac_scan_complete_notif()
3184 mvm->scan_status &= ~mvm->scan_uid_status[uid]; in iwl_mvm_rx_umac_scan_complete_notif()
3187 uid, mvm->scan_uid_status[uid], in iwl_mvm_rx_umac_scan_complete_notif()
3188 notif->status == IWL_SCAN_OFFLOAD_COMPLETED ? in iwl_mvm_rx_umac_scan_complete_notif()
3190 iwl_mvm_ebs_status_str(notif->ebs_status)); in iwl_mvm_rx_umac_scan_complete_notif()
3193 notif->last_schedule, notif->last_iter, in iwl_mvm_rx_umac_scan_complete_notif()
3194 __le32_to_cpu(notif->time_from_last_iter)); in iwl_mvm_rx_umac_scan_complete_notif()
3196 if (notif->ebs_status != IWL_SCAN_EBS_SUCCESS && in iwl_mvm_rx_umac_scan_complete_notif()
3197 notif->ebs_status != IWL_SCAN_EBS_INACTIVE) in iwl_mvm_rx_umac_scan_complete_notif()
3198 mvm->last_ebs_successful = false; in iwl_mvm_rx_umac_scan_complete_notif()
3200 mvm->scan_uid_status[uid] = 0; in iwl_mvm_rx_umac_scan_complete_notif()
3207 struct iwl_umac_scan_iter_complete_notif *notif = (void *)pkt->data; in iwl_mvm_rx_umac_scan_iter_complete_notif()
3209 mvm->scan_start = le64_to_cpu(notif->start_tsf); in iwl_mvm_rx_umac_scan_iter_complete_notif()
3213 notif->status, notif->scanned_channels); in iwl_mvm_rx_umac_scan_iter_complete_notif()
3215 if (mvm->sched_scan_pass_all == SCHED_SCAN_PASS_ALL_FOUND) { in iwl_mvm_rx_umac_scan_iter_complete_notif()
3217 ieee80211_sched_scan_results(mvm->hw); in iwl_mvm_rx_umac_scan_iter_complete_notif()
3218 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_ENABLED; in iwl_mvm_rx_umac_scan_iter_complete_notif()
3223 mvm->scan_start); in iwl_mvm_rx_umac_scan_iter_complete_notif()
3239 lockdep_assert_held(&mvm->mutex); in iwl_mvm_umac_scan_abort()
3259 mvm->scan_uid_status[uid] = type << IWL_MVM_SCAN_STOPPING_SHIFT; in iwl_mvm_umac_scan_abort()
3269 mvm->scan_uid_status[uid] = type << IWL_MVM_SCAN_STOPPING_SHIFT; in iwl_mvm_umac_scan_abort()
3284 lockdep_assert_held(&mvm->mutex); in iwl_mvm_scan_stop_wait()
3286 iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_done, in iwl_mvm_scan_stop_wait()
3293 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) in iwl_mvm_scan_stop_wait()
3300 iwl_remove_notification(&mvm->notif_wait, &wait_scan_done); in iwl_mvm_scan_stop_wait()
3304 iwl_remove_notification(&mvm->notif_wait, &wait_scan_done); in iwl_mvm_scan_stop_wait()
3308 return iwl_wait_notification(&mvm->notif_wait, &wait_scan_done, in iwl_mvm_scan_stop_wait()
3330 u8 scan_ver = iwl_fw_lookup_cmd_ver(mvm->fw, SCAN_REQ_UMAC, in iwl_mvm_scan_size()
3347 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in iwl_mvm_scan_size()
3355 mvm->fw->ucode_capa.n_scan_channels + in iwl_mvm_scan_size()
3360 mvm->fw->ucode_capa.n_scan_channels + in iwl_mvm_scan_size()
3370 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { in iwl_mvm_report_scan_aborted()
3379 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_report_scan_aborted()
3381 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_report_scan_aborted()
3382 mvm->scan_uid_status[uid] = 0; in iwl_mvm_report_scan_aborted()
3390 if (!mvm->fw_restart) in iwl_mvm_report_scan_aborted()
3391 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_report_scan_aborted()
3392 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_report_scan_aborted()
3393 mvm->scan_uid_status[uid] = 0; in iwl_mvm_report_scan_aborted()
3398 mvm->scan_uid_status[uid] = 0; in iwl_mvm_report_scan_aborted()
3403 mvm->scan_uid_status[uid] = 0; in iwl_mvm_report_scan_aborted()
3409 for (i = 0; i < mvm->max_scans; i++) { in iwl_mvm_report_scan_aborted()
3410 if (WARN_ONCE(mvm->scan_uid_status[i], in iwl_mvm_report_scan_aborted()
3413 mvm->scan_uid_status[i] = 0; in iwl_mvm_report_scan_aborted()
3416 if (mvm->scan_status & IWL_MVM_SCAN_REGULAR) { in iwl_mvm_report_scan_aborted()
3421 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_report_scan_aborted()
3422 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_report_scan_aborted()
3429 if ((mvm->scan_status & IWL_MVM_SCAN_SCHED) && in iwl_mvm_report_scan_aborted()
3430 !mvm->fw_restart) { in iwl_mvm_report_scan_aborted()
3431 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_report_scan_aborted()
3432 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_report_scan_aborted()
3441 if (!(mvm->scan_status & type)) in iwl_mvm_scan_stop()
3444 if (!test_bit(STATUS_DEVICE_ENABLED, &mvm->trans->status)) { in iwl_mvm_scan_stop()
3451 mvm->scan_status |= type << IWL_MVM_SCAN_STOPPING_SHIFT; in iwl_mvm_scan_stop()
3458 mvm->scan_status &= ~type; in iwl_mvm_scan_stop()
3461 cancel_delayed_work(&mvm->scan_timeout_dwork); in iwl_mvm_scan_stop()
3467 ieee80211_scan_completed(mvm->hw, &info); in iwl_mvm_scan_stop()
3470 ieee80211_sched_scan_stopped(mvm->hw); in iwl_mvm_scan_stop()
3471 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; in iwl_mvm_scan_stop()