linux/drivers/net/wireless/intel/iwlwifi/mvm/scan.c

// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
 * Copyright (C) 2012-2014, 2018-2024 Intel Corporation
 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
 * Copyright (C) 2016-2017 Intel Deutschland GmbH
 */
#include <linux/etherdevice.h>
#include <net/mac80211.h>
#include <linux/crc32.h>

#include "mvm.h"
#include "fw/api/scan.h"
#include "iwl-io.h"

#define IWL_DENSE_EBS_SCAN_RATIO
#define IWL_SPARSE_EBS_SCAN_RATIO

#define IWL_SCAN_DWELL_ACTIVE
#define IWL_SCAN_DWELL_PASSIVE
#define IWL_SCAN_DWELL_FRAGMENTED
#define IWL_SCAN_DWELL_EXTENDED
#define IWL_SCAN_NUM_OF_FRAGS

/* adaptive dwell max budget time [TU] for full scan */
#define IWL_SCAN_ADWELL_MAX_BUDGET_FULL_SCAN
/* adaptive dwell max budget time [TU] for directed scan */
#define IWL_SCAN_ADWELL_MAX_BUDGET_DIRECTED_SCAN
/* adaptive dwell default high band APs number */
#define IWL_SCAN_ADWELL_DEFAULT_HB_N_APS
/* adaptive dwell default low band APs number */
#define IWL_SCAN_ADWELL_DEFAULT_LB_N_APS
/* adaptive dwell default APs number in social channels (1, 6, 11) */
#define IWL_SCAN_ADWELL_DEFAULT_N_APS_SOCIAL
/* number of scan channels */
#define IWL_SCAN_NUM_CHANNELS
/* adaptive dwell number of APs override mask for p2p friendly GO */
#define IWL_SCAN_ADWELL_N_APS_GO_FRIENDLY_BIT
/* adaptive dwell number of APs override mask for social channels */
#define IWL_SCAN_ADWELL_N_APS_SOCIAL_CHS_BIT
/* adaptive dwell number of APs override for p2p friendly GO channels */
#define IWL_SCAN_ADWELL_N_APS_GO_FRIENDLY
/* adaptive dwell number of APs override for social channels */
#define IWL_SCAN_ADWELL_N_APS_SOCIAL_CHS

/* minimal number of 2GHz and 5GHz channels in the regular scan request */
#define IWL_MVM_6GHZ_PASSIVE_SCAN_MIN_CHANS

/* Number of iterations on the channel for mei filtered scan */
#define IWL_MEI_SCAN_NUM_ITER

struct iwl_mvm_scan_timing_params {};

static struct iwl_mvm_scan_timing_params scan_timing[] =;

struct iwl_mvm_scan_params {};

static inline void *iwl_mvm_get_scan_req_umac_data(struct iwl_mvm *mvm)
{}

static inline struct iwl_scan_umac_chan_param *
iwl_mvm_get_scan_req_umac_channel(struct iwl_mvm *mvm)
{}

static u8 iwl_mvm_scan_rx_ant(struct iwl_mvm *mvm)
{}

static inline __le16 iwl_mvm_scan_rx_chain(struct iwl_mvm *mvm)
{}

static inline __le32
iwl_mvm_scan_rate_n_flags(struct iwl_mvm *mvm, enum nl80211_band band,
			  bool no_cck)
{}

static enum iwl_mvm_traffic_load iwl_mvm_get_traffic_load(struct iwl_mvm *mvm)
{}

static enum iwl_mvm_traffic_load
iwl_mvm_get_traffic_load_band(struct iwl_mvm *mvm, enum nl80211_band band)
{}

struct iwl_mvm_scan_iter_data {};

static void iwl_mvm_scan_iterator(void *_data, u8 *mac,
				  struct ieee80211_vif *vif)
{}

static enum
iwl_mvm_scan_type _iwl_mvm_get_scan_type(struct iwl_mvm *mvm,
					 struct ieee80211_vif *vif,
					 enum iwl_mvm_traffic_load load,
					 bool low_latency)
{}

static enum
iwl_mvm_scan_type iwl_mvm_get_scan_type(struct iwl_mvm *mvm,
					struct ieee80211_vif *vif)
{}

static enum
iwl_mvm_scan_type iwl_mvm_get_scan_type_band(struct iwl_mvm *mvm,
					     struct ieee80211_vif *vif,
					     enum nl80211_band band)
{}

static inline bool iwl_mvm_rrm_scan_needed(struct iwl_mvm *mvm)
{}

static int iwl_mvm_max_scan_ie_fw_cmd_room(struct iwl_mvm *mvm)
{}

int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm)
{}

void iwl_mvm_rx_lmac_scan_iter_complete_notif(struct iwl_mvm *mvm,
					      struct iwl_rx_cmd_buffer *rxb)
{}

void iwl_mvm_rx_scan_match_found(struct iwl_mvm *mvm,
				 struct iwl_rx_cmd_buffer *rxb)
{}

static const char *iwl_mvm_ebs_status_str(enum iwl_scan_ebs_status status)
{}

void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm,
					 struct iwl_rx_cmd_buffer *rxb)
{}

static int iwl_ssid_exist(u8 *ssid, u8 ssid_len, struct iwl_ssid_ie *ssid_list)
{}

/* We insert the SSIDs in an inverted order, because the FW will
 * invert it back.
 */
static void iwl_scan_build_ssids(struct iwl_mvm_scan_params *params,
				 struct iwl_ssid_ie *ssids,
				 u32 *ssid_bitmap)
{}

static int
iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
				   struct cfg80211_sched_scan_request *req)
{}

static bool iwl_mvm_scan_pass_all(struct iwl_mvm *mvm,
				  struct cfg80211_sched_scan_request *req)
{}

static int iwl_mvm_lmac_scan_abort(struct iwl_mvm *mvm)
{}

static void iwl_mvm_scan_fill_tx_cmd(struct iwl_mvm *mvm,
				     struct iwl_scan_req_tx_cmd *tx_cmd,
				     bool no_cck)
{}

static void
iwl_mvm_lmac_scan_cfg_channels(struct iwl_mvm *mvm,
			       struct ieee80211_channel **channels,
			       int n_channels, u32 ssid_bitmap,
			       struct iwl_scan_req_lmac *cmd)
{}

static u8 *iwl_mvm_copy_and_insert_ds_elem(struct iwl_mvm *mvm, const u8 *ies,
					   size_t len, u8 *const pos)
{}

#define WFA_TPC_IE_LEN

static void iwl_mvm_add_tpc_report_ie(u8 *pos)
{}

static void
iwl_mvm_build_scan_probe(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
			 struct ieee80211_scan_ies *ies,
			 struct iwl_mvm_scan_params *params)
{}

static void iwl_mvm_scan_lmac_dwell(struct iwl_mvm *mvm,
				    struct iwl_scan_req_lmac *cmd,
				    struct iwl_mvm_scan_params *params)
{}

static inline bool iwl_mvm_scan_fits(struct iwl_mvm *mvm, int n_ssids,
				     struct ieee80211_scan_ies *ies,
				     int n_channels)
{}

static inline bool iwl_mvm_scan_use_ebs(struct iwl_mvm *mvm,
					struct ieee80211_vif *vif)
{}

static inline bool iwl_mvm_is_regular_scan(struct iwl_mvm_scan_params *params)
{}

static bool iwl_mvm_is_scan_fragmented(enum iwl_mvm_scan_type type)
{}

static int iwl_mvm_scan_lmac_flags(struct iwl_mvm *mvm,
				   struct iwl_mvm_scan_params *params,
				   struct ieee80211_vif *vif)
{}

static void
iwl_mvm_scan_set_legacy_probe_req(struct iwl_scan_probe_req_v1 *p_req,
				  struct iwl_scan_probe_req *src_p_req)
{}

static int iwl_mvm_scan_lmac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
			     struct iwl_mvm_scan_params *params)
{}

static int rate_to_scan_rate_flag(unsigned int rate)
{}

static __le32 iwl_mvm_scan_config_rates(struct iwl_mvm *mvm)
{}

static void iwl_mvm_fill_scan_dwell(struct iwl_mvm *mvm,
				    struct iwl_scan_dwell *dwell)
{}

static void iwl_mvm_fill_channels(struct iwl_mvm *mvm, u8 *channels,
				  u32 max_channels)
{}

static void iwl_mvm_fill_scan_config_v1(struct iwl_mvm *mvm, void *config,
					u32 flags, u8 channel_flags,
					u32 max_channels)
{}

static void iwl_mvm_fill_scan_config_v2(struct iwl_mvm *mvm, void *config,
					u32 flags, u8 channel_flags,
					u32 max_channels)
{}

static int iwl_mvm_legacy_config_scan(struct iwl_mvm *mvm)
{}

int iwl_mvm_config_scan(struct iwl_mvm *mvm)
{}

static int iwl_mvm_scan_uid_by_status(struct iwl_mvm *mvm, int status)
{}

static void iwl_mvm_scan_umac_dwell(struct iwl_mvm *mvm,
				    struct iwl_scan_req_umac *cmd,
				    struct iwl_mvm_scan_params *params)
{}

static u32 iwl_mvm_scan_umac_ooc_priority(int type)
{}

static void
iwl_mvm_scan_umac_dwell_v11(struct iwl_mvm *mvm,
			    struct iwl_scan_general_params_v11 *general_params,
			    struct iwl_mvm_scan_params *params)
{}

struct iwl_mvm_scan_channel_segment {};

static const struct iwl_mvm_scan_channel_segment scan_channel_segments[] =;

static int iwl_mvm_scan_ch_and_band_to_idx(u8 channel_id, u8 band)
{}

static const u8 p2p_go_friendly_chs[] =;

static const u8 social_chs[] =;

static void iwl_mvm_scan_ch_add_n_aps_override(enum nl80211_iftype vif_type,
					       u8 ch_id, u8 band, u8 *ch_bitmap,
					       size_t bitmap_n_entries)
{}

static u32 iwl_mvm_scan_ch_n_aps_flag(enum nl80211_iftype vif_type, u8 ch_id)
{}

static void
iwl_mvm_umac_scan_cfg_channels(struct iwl_mvm *mvm,
			       struct ieee80211_channel **channels,
			       int n_channels, u32 flags,
			       struct iwl_scan_channel_cfg_umac *channel_cfg)
{}

static void
iwl_mvm_umac_scan_cfg_channels_v4(struct iwl_mvm *mvm,
				  struct ieee80211_channel **channels,
				  struct iwl_scan_channel_params_v4 *cp,
				  int n_channels, u32 flags,
				  enum nl80211_iftype vif_type)
{}

static void
iwl_mvm_umac_scan_cfg_channels_v7(struct iwl_mvm *mvm,
				  struct ieee80211_channel **channels,
				  struct iwl_scan_channel_params_v7 *cp,
				  int n_channels, u32 flags,
				  enum nl80211_iftype vif_type, u32 version)
{}

static void
iwl_mvm_umac_scan_fill_6g_chan_list(struct iwl_mvm *mvm,
				    struct iwl_mvm_scan_params *params,
				     struct iwl_scan_probe_params_v4 *pp)
{}

/* TODO: this function can be merged with iwl_mvm_scan_umac_fill_ch_p_v7 */
static u32
iwl_mvm_umac_scan_cfg_channels_v7_6g(struct iwl_mvm *mvm,
				     struct iwl_mvm_scan_params *params,
				     u32 n_channels,
				     struct iwl_scan_probe_params_v4 *pp,
				     struct iwl_scan_channel_params_v7 *cp,
				     enum nl80211_iftype vif_type,
				     u32 version)
{}

static u8 iwl_mvm_scan_umac_chan_flags_v2(struct iwl_mvm *mvm,
					  struct iwl_mvm_scan_params *params,
					  struct ieee80211_vif *vif)
{}

static void iwl_mvm_scan_6ghz_passive_scan(struct iwl_mvm *mvm,
					   struct iwl_mvm_scan_params *params,
					   struct ieee80211_vif *vif)
{}

static u16 iwl_mvm_scan_umac_flags_v2(struct iwl_mvm *mvm,
				      struct iwl_mvm_scan_params *params,
				      struct ieee80211_vif *vif,
				      int type)
{}

static u8 iwl_mvm_scan_umac_flags2(struct iwl_mvm *mvm,
				   struct iwl_mvm_scan_params *params,
				   struct ieee80211_vif *vif, int type,
				   u16 gen_flags)
{}

static u16 iwl_mvm_scan_umac_flags(struct iwl_mvm *mvm,
				   struct iwl_mvm_scan_params *params,
				   struct ieee80211_vif *vif)
{}

static int
iwl_mvm_fill_scan_sched_params(struct iwl_mvm_scan_params *params,
			       struct iwl_scan_umac_schedule *schedule,
			       __le16 *delay)
{}

static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
			     struct iwl_mvm_scan_params *params,
			     int type, int uid)
{}

static void
iwl_mvm_scan_umac_fill_general_p_v12(struct iwl_mvm *mvm,
				     struct iwl_mvm_scan_params *params,
				     struct ieee80211_vif *vif,
				     struct iwl_scan_general_params_v11 *gp,
				     u16 gen_flags, u8 gen_flags2,
				     u32 version)
{}

static void
iwl_mvm_scan_umac_fill_probe_p_v3(struct iwl_mvm_scan_params *params,
				  struct iwl_scan_probe_params_v3 *pp)
{}

static void
iwl_mvm_scan_umac_fill_probe_p_v4(struct iwl_mvm_scan_params *params,
				  struct iwl_scan_probe_params_v4 *pp,
				  u32 *bitmap_ssid)
{}

static void
iwl_mvm_scan_umac_fill_ch_p_v4(struct iwl_mvm *mvm,
			       struct iwl_mvm_scan_params *params,
			       struct ieee80211_vif *vif,
			       struct iwl_scan_channel_params_v4 *cp,
			       u32 channel_cfg_flags)
{}

static void
iwl_mvm_scan_umac_fill_ch_p_v7(struct iwl_mvm *mvm,
			       struct iwl_mvm_scan_params *params,
			       struct ieee80211_vif *vif,
			       struct iwl_scan_channel_params_v7 *cp,
			       u32 channel_cfg_flags,
			       u32 version)
{}

static int iwl_mvm_scan_umac_v12(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
				 struct iwl_mvm_scan_params *params, int type,
				 int uid)
{}

static int iwl_mvm_scan_umac_v14_and_above(struct iwl_mvm *mvm,
					   struct ieee80211_vif *vif,
					   struct iwl_mvm_scan_params *params,
					   int type, int uid, u32 version)
{}

static int iwl_mvm_scan_umac_v14(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
				 struct iwl_mvm_scan_params *params, int type,
				 int uid)
{}

static int iwl_mvm_scan_umac_v15(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
				 struct iwl_mvm_scan_params *params, int type,
				 int uid)
{}

static int iwl_mvm_scan_umac_v16(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
				 struct iwl_mvm_scan_params *params, int type,
				 int uid)
{}

static int iwl_mvm_scan_umac_v17(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
				 struct iwl_mvm_scan_params *params, int type,
				 int uid)
{}

static int iwl_mvm_num_scans(struct iwl_mvm *mvm)
{}

static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type)
{}

#define SCAN_TIMEOUT

void iwl_mvm_scan_timeout_wk(struct work_struct *work)
{}

static void iwl_mvm_fill_scan_type(struct iwl_mvm *mvm,
				   struct iwl_mvm_scan_params *params,
				   struct ieee80211_vif *vif)
{}

struct iwl_scan_umac_handler {};

#define IWL_SCAN_UMAC_HANDLER(_ver)

static const struct iwl_scan_umac_handler iwl_scan_umac_handlers[] =;

static void iwl_mvm_mei_scan_work(struct work_struct *wk)
{}

void iwl_mvm_mei_scan_filter_init(struct iwl_mei_scan_filter *mei_scan_filter)
{}

/* In case CSME is connected and has link protection set, this function will
 * override the scan request to scan only the associated channel and only for
 * the associated SSID.
 */
static void iwl_mvm_mei_limited_scan(struct iwl_mvm *mvm,
				     struct iwl_mvm_scan_params *params)
{}

static int iwl_mvm_build_scan_cmd(struct iwl_mvm *mvm,
				  struct ieee80211_vif *vif,
				  struct iwl_host_cmd *hcmd,
				  struct iwl_mvm_scan_params *params,
				  int type)
{}

struct iwl_mvm_scan_respect_p2p_go_iter_data {};

static void iwl_mvm_scan_respect_p2p_go_iter(void *_data, u8 *mac,
					     struct ieee80211_vif *vif)
{}

static bool _iwl_mvm_get_respect_p2p_go(struct iwl_mvm *mvm,
					struct ieee80211_vif *vif,
					bool low_latency,
					enum nl80211_band band)
{}

static bool iwl_mvm_get_respect_p2p_go_band(struct iwl_mvm *mvm,
					    struct ieee80211_vif *vif,
					    enum nl80211_band band)
{}

static bool iwl_mvm_get_respect_p2p_go(struct iwl_mvm *mvm,
				       struct ieee80211_vif *vif)
{}

static void iwl_mvm_fill_respect_p2p_go(struct iwl_mvm *mvm,
					struct iwl_mvm_scan_params *params,
					struct ieee80211_vif *vif)
{}

static int _iwl_mvm_single_scan_start(struct iwl_mvm *mvm,
				      struct ieee80211_vif *vif,
				      struct cfg80211_scan_request *req,
				      struct ieee80211_scan_ies *ies,
				      int type)
{}

int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
			   struct cfg80211_scan_request *req,
			   struct ieee80211_scan_ies *ies)
{}

int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
			     struct ieee80211_vif *vif,
			     struct cfg80211_sched_scan_request *req,
			     struct ieee80211_scan_ies *ies,
			     int type)
{}

void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm,
					 struct iwl_rx_cmd_buffer *rxb)
{}

void iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm,
					      struct iwl_rx_cmd_buffer *rxb)
{}

static int iwl_mvm_umac_scan_abort(struct iwl_mvm *mvm, int type)
{}

static int iwl_mvm_scan_stop_wait(struct iwl_mvm *mvm, int type)
{}

static size_t iwl_scan_req_umac_get_size(u8 scan_ver)
{}

size_t iwl_mvm_scan_size(struct iwl_mvm *mvm)
{}

/*
 * This function is used in nic restart flow, to inform mac80211 about scans
 * that was aborted by restart flow or by an assert.
 */
void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm)
{}

int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify)
{}

static int iwl_mvm_int_mlo_scan_start(struct iwl_mvm *mvm,
				      struct ieee80211_vif *vif,
				      struct ieee80211_channel **channels,
				      size_t n_channels)
{}

int iwl_mvm_int_mlo_scan(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
{}

static int iwl_mvm_chanidx_from_phy(struct iwl_mvm *mvm,
				    enum nl80211_band band,
				    u16 phy_chan_num)
{}

static u32 iwl_mvm_div_by_db(u32 value, u8 db)
{}

VISIBLE_IF_IWLWIFI_KUNIT s8
iwl_mvm_average_dbm_values(const struct iwl_umac_scan_channel_survey_notif *notif)
{}
EXPORT_SYMBOL_IF_IWLWIFI_KUNIT();

void iwl_mvm_rx_channel_survey_notif(struct iwl_mvm *mvm,
				     struct iwl_rx_cmd_buffer *rxb)
{}