Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
0002 /*
0003  * Copyright (C) 2012-2014, 2018-2021 Intel Corporation
0004  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
0005  * Copyright (C) 2016-2017 Intel Deutschland GmbH
0006  */
0007 #ifndef __iwl_fw_api_scan_h__
0008 #define __iwl_fw_api_scan_h__
0009 
0010 /* Scan Commands, Responses, Notifications */
0011 
0012 /* Max number of IEs for direct SSID scans in a command */
0013 #define PROBE_OPTION_MAX        20
0014 
0015 #define SCAN_SHORT_SSID_MAX_SIZE        8
0016 #define SCAN_BSSID_MAX_SIZE             16
0017 
0018 /**
0019  * struct iwl_ssid_ie - directed scan network information element
0020  *
0021  * Up to 20 of these may appear in REPLY_SCAN_CMD,
0022  * selected by "type" bit field in struct iwl_scan_channel;
0023  * each channel may select different ssids from among the 20 entries.
0024  * SSID IEs get transmitted in reverse order of entry.
0025  *
0026  * @id: element ID
0027  * @len: element length
0028  * @ssid: element (SSID) data
0029  */
0030 struct iwl_ssid_ie {
0031     u8 id;
0032     u8 len;
0033     u8 ssid[IEEE80211_MAX_SSID_LEN];
0034 } __packed; /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
0035 
0036 /* scan offload */
0037 #define IWL_SCAN_MAX_BLACKLIST_LEN  64
0038 #define IWL_SCAN_SHORT_BLACKLIST_LEN    16
0039 #define IWL_SCAN_MAX_PROFILES       11
0040 #define IWL_SCAN_MAX_PROFILES_V2    8
0041 #define SCAN_OFFLOAD_PROBE_REQ_SIZE 512
0042 #define SCAN_NUM_BAND_PROBE_DATA_V_1    2
0043 #define SCAN_NUM_BAND_PROBE_DATA_V_2    3
0044 
0045 /* Default watchdog (in MS) for scheduled scan iteration */
0046 #define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
0047 
0048 #define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
0049 #define CAN_ABORT_STATUS 1
0050 
0051 #define IWL_FULL_SCAN_MULTIPLIER 5
0052 #define IWL_FAST_SCHED_SCAN_ITERATIONS 3
0053 #define IWL_MAX_SCHED_SCAN_PLANS 2
0054 
0055 enum scan_framework_client {
0056     SCAN_CLIENT_SCHED_SCAN      = BIT(0),
0057     SCAN_CLIENT_NETDETECT       = BIT(1),
0058     SCAN_CLIENT_ASSET_TRACKING  = BIT(2),
0059 };
0060 
0061 /**
0062  * struct iwl_scan_offload_blocklist - SCAN_OFFLOAD_BLACKLIST_S
0063  * @ssid:       MAC address to filter out
0064  * @reported_rssi:  AP rssi reported to the host
0065  * @client_bitmap: clients ignore this entry  - enum scan_framework_client
0066  */
0067 struct iwl_scan_offload_blocklist {
0068     u8 ssid[ETH_ALEN];
0069     u8 reported_rssi;
0070     u8 client_bitmap;
0071 } __packed;
0072 
0073 enum iwl_scan_offload_network_type {
0074     IWL_NETWORK_TYPE_BSS    = 1,
0075     IWL_NETWORK_TYPE_IBSS   = 2,
0076     IWL_NETWORK_TYPE_ANY    = 3,
0077 };
0078 
0079 enum iwl_scan_offload_band_selection {
0080     IWL_SCAN_OFFLOAD_SELECT_2_4 = 0x4,
0081     IWL_SCAN_OFFLOAD_SELECT_5_2 = 0x8,
0082     IWL_SCAN_OFFLOAD_SELECT_ANY = 0xc,
0083 };
0084 
0085 enum iwl_scan_offload_auth_alg {
0086     IWL_AUTH_ALGO_UNSUPPORTED  = 0x00,
0087     IWL_AUTH_ALGO_NONE         = 0x01,
0088     IWL_AUTH_ALGO_PSK          = 0x02,
0089     IWL_AUTH_ALGO_8021X        = 0x04,
0090     IWL_AUTH_ALGO_SAE          = 0x08,
0091     IWL_AUTH_ALGO_8021X_SHA384 = 0x10,
0092     IWL_AUTH_ALGO_OWE          = 0x20,
0093 };
0094 
0095 /**
0096  * struct iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S
0097  * @ssid_index:     index to ssid list in fixed part
0098  * @unicast_cipher: encryption algorithm to match - bitmap
0099  * @auth_alg:       authentication algorithm to match - bitmap
0100  * @network_type:   enum iwl_scan_offload_network_type
0101  * @band_selection: enum iwl_scan_offload_band_selection
0102  * @client_bitmap:  clients waiting for match - enum scan_framework_client
0103  * @reserved:       reserved
0104  */
0105 struct iwl_scan_offload_profile {
0106     u8 ssid_index;
0107     u8 unicast_cipher;
0108     u8 auth_alg;
0109     u8 network_type;
0110     u8 band_selection;
0111     u8 client_bitmap;
0112     u8 reserved[2];
0113 } __packed;
0114 
0115 /**
0116  * struct iwl_scan_offload_profile_cfg_data
0117  * @blocklist_len:  length of blocklist
0118  * @num_profiles:   num of profiles in the list
0119  * @match_notify:   clients waiting for match found notification
0120  * @pass_match:     clients waiting for the results
0121  * @active_clients: active clients bitmap - enum scan_framework_client
0122  * @any_beacon_notify:  clients waiting for match notification without match
0123  * @reserved:       reserved
0124  */
0125 struct iwl_scan_offload_profile_cfg_data {
0126     u8 blocklist_len;
0127     u8 num_profiles;
0128     u8 match_notify;
0129     u8 pass_match;
0130     u8 active_clients;
0131     u8 any_beacon_notify;
0132     u8 reserved[2];
0133 } __packed;
0134 
0135 /**
0136  * struct iwl_scan_offload_profile_cfg
0137  * @profiles:   profiles to search for match
0138  * @data:   the rest of the data for profile_cfg
0139  */
0140 struct iwl_scan_offload_profile_cfg_v1 {
0141     struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
0142     struct iwl_scan_offload_profile_cfg_data data;
0143 } __packed; /* SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1-2*/
0144 
0145 /**
0146  * struct iwl_scan_offload_profile_cfg
0147  * @profiles:   profiles to search for match
0148  * @data:   the rest of the data for profile_cfg
0149  */
0150 struct iwl_scan_offload_profile_cfg {
0151     struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES_V2];
0152     struct iwl_scan_offload_profile_cfg_data data;
0153 } __packed; /* SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_3*/
0154 
0155 /**
0156  * struct iwl_scan_schedule_lmac - schedule of scan offload
0157  * @delay:      delay between iterations, in seconds.
0158  * @iterations:     num of scan iterations
0159  * @full_scan_mul:  number of partial scans before each full scan
0160  */
0161 struct iwl_scan_schedule_lmac {
0162     __le16 delay;
0163     u8 iterations;
0164     u8 full_scan_mul;
0165 } __packed; /* SCAN_SCHEDULE_API_S */
0166 
0167 enum iwl_scan_offload_complete_status {
0168     IWL_SCAN_OFFLOAD_COMPLETED  = 1,
0169     IWL_SCAN_OFFLOAD_ABORTED    = 2,
0170 };
0171 
0172 enum iwl_scan_ebs_status {
0173     IWL_SCAN_EBS_SUCCESS,
0174     IWL_SCAN_EBS_FAILED,
0175     IWL_SCAN_EBS_CHAN_NOT_FOUND,
0176     IWL_SCAN_EBS_INACTIVE,
0177 };
0178 
0179 /**
0180  * struct iwl_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S
0181  * @tx_flags: combination of TX_CMD_FLG_*
0182  * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
0183  *  cleared. Combination of RATE_MCS_*
0184  * @sta_id: index of destination station in FW station table
0185  * @reserved: for alignment and future use
0186  */
0187 struct iwl_scan_req_tx_cmd {
0188     __le32 tx_flags;
0189     __le32 rate_n_flags;
0190     u8 sta_id;
0191     u8 reserved[3];
0192 } __packed;
0193 
0194 enum iwl_scan_channel_flags_lmac {
0195     IWL_UNIFIED_SCAN_CHANNEL_FULL       = BIT(27),
0196     IWL_UNIFIED_SCAN_CHANNEL_PARTIAL    = BIT(28),
0197 };
0198 
0199 /**
0200  * struct iwl_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2
0201  * @flags:      bits 1-20: directed scan to i'th ssid
0202  *          other bits &enum iwl_scan_channel_flags_lmac
0203  * @channel_num:    channel number 1-13 etc
0204  * @iter_count:     scan iteration on this channel
0205  * @iter_interval:  interval in seconds between iterations on one channel
0206  */
0207 struct iwl_scan_channel_cfg_lmac {
0208     __le32 flags;
0209     __le16 channel_num;
0210     __le16 iter_count;
0211     __le32 iter_interval;
0212 } __packed;
0213 
0214 /**
0215  * struct iwl_scan_probe_segment - PROBE_SEGMENT_API_S_VER_1
0216  * @offset: offset in the data block
0217  * @len: length of the segment
0218  */
0219 struct iwl_scan_probe_segment {
0220     __le16 offset;
0221     __le16 len;
0222 } __packed;
0223 
0224 /**
0225  * struct iwl_scan_probe_req_v1 - PROBE_REQUEST_FRAME_API_S_VER_2
0226  * @mac_header: first (and common) part of the probe
0227  * @band_data: band specific data
0228  * @common_data: last (and common) part of the probe
0229  * @buf: raw data block
0230  */
0231 struct iwl_scan_probe_req_v1 {
0232     struct iwl_scan_probe_segment mac_header;
0233     struct iwl_scan_probe_segment band_data[SCAN_NUM_BAND_PROBE_DATA_V_1];
0234     struct iwl_scan_probe_segment common_data;
0235     u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
0236 } __packed;
0237 
0238 /**
0239  * struct iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_v2
0240  * @mac_header: first (and common) part of the probe
0241  * @band_data: band specific data
0242  * @common_data: last (and common) part of the probe
0243  * @buf: raw data block
0244  */
0245 struct iwl_scan_probe_req {
0246     struct iwl_scan_probe_segment mac_header;
0247     struct iwl_scan_probe_segment band_data[SCAN_NUM_BAND_PROBE_DATA_V_2];
0248     struct iwl_scan_probe_segment common_data;
0249     u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
0250 } __packed;
0251 
0252 enum iwl_scan_channel_flags {
0253     IWL_SCAN_CHANNEL_FLAG_EBS       = BIT(0),
0254     IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE  = BIT(1),
0255     IWL_SCAN_CHANNEL_FLAG_CACHE_ADD     = BIT(2),
0256     IWL_SCAN_CHANNEL_FLAG_EBS_FRAG      = BIT(3),
0257     IWL_SCAN_CHANNEL_FLAG_FORCE_EBS         = BIT(4),
0258     IWL_SCAN_CHANNEL_FLAG_ENABLE_CHAN_ORDER = BIT(5),
0259     IWL_SCAN_CHANNEL_FLAG_6G_PSC_NO_FILTER  = BIT(6),
0260 };
0261 
0262 /**
0263  * struct iwl_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S
0264  * @flags: enum iwl_scan_channel_flags
0265  * @non_ebs_ratio: defines the ratio of number of scan iterations where EBS is
0266  *  involved.
0267  *  1 - EBS is disabled.
0268  *  2 - every second scan will be full scan(and so on).
0269  */
0270 struct iwl_scan_channel_opt {
0271     __le16 flags;
0272     __le16 non_ebs_ratio;
0273 } __packed;
0274 
0275 /**
0276  * enum iwl_mvm_lmac_scan_flags - LMAC scan flags
0277  * @IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses
0278  *  without filtering.
0279  * @IWL_MVM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels
0280  * @IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan
0281  * @IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification
0282  * @IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS: multiple SSID matching
0283  * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented
0284  * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report
0285  *  and DS parameter set IEs into probe requests.
0286  * @IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL: use extended dwell time on channels
0287  *  1, 6 and 11.
0288  * @IWL_MVM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches
0289  */
0290 enum iwl_mvm_lmac_scan_flags {
0291     IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL     = BIT(0),
0292     IWL_MVM_LMAC_SCAN_FLAG_PASSIVE      = BIT(1),
0293     IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION   = BIT(2),
0294     IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE    = BIT(3),
0295     IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS   = BIT(4),
0296     IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED   = BIT(5),
0297     IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6),
0298     IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL   = BIT(7),
0299     IWL_MVM_LMAC_SCAN_FLAG_MATCH        = BIT(9),
0300 };
0301 
0302 enum iwl_scan_priority {
0303     IWL_SCAN_PRIORITY_LOW,
0304     IWL_SCAN_PRIORITY_MEDIUM,
0305     IWL_SCAN_PRIORITY_HIGH,
0306 };
0307 
0308 enum iwl_scan_priority_ext {
0309     IWL_SCAN_PRIORITY_EXT_0_LOWEST,
0310     IWL_SCAN_PRIORITY_EXT_1,
0311     IWL_SCAN_PRIORITY_EXT_2,
0312     IWL_SCAN_PRIORITY_EXT_3,
0313     IWL_SCAN_PRIORITY_EXT_4,
0314     IWL_SCAN_PRIORITY_EXT_5,
0315     IWL_SCAN_PRIORITY_EXT_6,
0316     IWL_SCAN_PRIORITY_EXT_7_HIGHEST,
0317 };
0318 
0319 /**
0320  * struct iwl_scan_req_lmac - SCAN_REQUEST_CMD_API_S_VER_1
0321  * @reserved1: for alignment and future use
0322  * @n_channels: num of channels to scan
0323  * @active_dwell: dwell time for active channels
0324  * @passive_dwell: dwell time for passive channels
0325  * @fragmented_dwell: dwell time for fragmented passive scan
0326  * @extended_dwell: dwell time for channels 1, 6 and 11 (in certain cases)
0327  * @reserved2: for alignment and future use
0328  * @rx_chain_select: PHY_RX_CHAIN_* flags
0329  * @scan_flags: &enum iwl_mvm_lmac_scan_flags
0330  * @max_out_time: max time (in TU) to be out of associated channel
0331  * @suspend_time: pause scan this long (TUs) when returning to service channel
0332  * @flags: RXON flags
0333  * @filter_flags: RXON filter
0334  * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz
0335  * @direct_scan: list of SSIDs for directed active scan
0336  * @scan_prio: enum iwl_scan_priority
0337  * @iter_num: number of scan iterations
0338  * @delay: delay in seconds before first iteration
0339  * @schedule: two scheduling plans. The first one is finite, the second one can
0340  *  be infinite.
0341  * @channel_opt: channel optimization options, for full and partial scan
0342  * @data: channel configuration and probe request packet.
0343  */
0344 struct iwl_scan_req_lmac {
0345     /* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */
0346     __le32 reserved1;
0347     u8 n_channels;
0348     u8 active_dwell;
0349     u8 passive_dwell;
0350     u8 fragmented_dwell;
0351     u8 extended_dwell;
0352     u8 reserved2;
0353     __le16 rx_chain_select;
0354     __le32 scan_flags;
0355     __le32 max_out_time;
0356     __le32 suspend_time;
0357     /* RX_ON_FLAGS_API_S_VER_1 */
0358     __le32 flags;
0359     __le32 filter_flags;
0360     struct iwl_scan_req_tx_cmd tx_cmd[2];
0361     struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
0362     __le32 scan_prio;
0363     /* SCAN_REQ_PERIODIC_PARAMS_API_S */
0364     __le32 iter_num;
0365     __le32 delay;
0366     struct iwl_scan_schedule_lmac schedule[IWL_MAX_SCHED_SCAN_PLANS];
0367     struct iwl_scan_channel_opt channel_opt[2];
0368     u8 data[];
0369 } __packed;
0370 
0371 /**
0372  * struct iwl_scan_results_notif - scan results for one channel -
0373  *  SCAN_RESULT_NTF_API_S_VER_3
0374  * @channel: which channel the results are from
0375  * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
0376  * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
0377  * @num_probe_not_sent: # of request that weren't sent due to not enough time
0378  * @duration: duration spent in channel, in usecs
0379  */
0380 struct iwl_scan_results_notif {
0381     u8 channel;
0382     u8 band;
0383     u8 probe_status;
0384     u8 num_probe_not_sent;
0385     __le32 duration;
0386 } __packed;
0387 
0388 /**
0389  * struct iwl_lmac_scan_complete_notif - notifies end of scanning (all channels)
0390  *  SCAN_COMPLETE_NTF_API_S_VER_3
0391  * @scanned_channels: number of channels scanned (and number of valid results)
0392  * @status: one of SCAN_COMP_STATUS_*
0393  * @bt_status: BT on/off status
0394  * @last_channel: last channel that was scanned
0395  * @tsf_low: TSF timer (lower half) in usecs
0396  * @tsf_high: TSF timer (higher half) in usecs
0397  * @results: an array of scan results, only "scanned_channels" of them are valid
0398  */
0399 struct iwl_lmac_scan_complete_notif {
0400     u8 scanned_channels;
0401     u8 status;
0402     u8 bt_status;
0403     u8 last_channel;
0404     __le32 tsf_low;
0405     __le32 tsf_high;
0406     struct iwl_scan_results_notif results[];
0407 } __packed;
0408 
0409 /**
0410  * struct iwl_scan_offload_complete - PERIODIC_SCAN_COMPLETE_NTF_API_S_VER_2
0411  * @last_schedule_line: last schedule line executed (fast or regular)
0412  * @last_schedule_iteration: last scan iteration executed before scan abort
0413  * @status: &enum iwl_scan_offload_complete_status
0414  * @ebs_status: EBS success status &enum iwl_scan_ebs_status
0415  * @time_after_last_iter: time in seconds elapsed after last iteration
0416  * @reserved: reserved
0417  */
0418 struct iwl_periodic_scan_complete {
0419     u8 last_schedule_line;
0420     u8 last_schedule_iteration;
0421     u8 status;
0422     u8 ebs_status;
0423     __le32 time_after_last_iter;
0424     __le32 reserved;
0425 } __packed;
0426 
0427 /* UMAC Scan API */
0428 
0429 /* The maximum of either of these cannot exceed 8, because we use an
0430  * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h).
0431  */
0432 #define IWL_MVM_MAX_UMAC_SCANS 4
0433 #define IWL_MVM_MAX_LMAC_SCANS 1
0434 
0435 enum scan_config_flags {
0436     SCAN_CONFIG_FLAG_ACTIVATE           = BIT(0),
0437     SCAN_CONFIG_FLAG_DEACTIVATE         = BIT(1),
0438     SCAN_CONFIG_FLAG_FORBID_CHUB_REQS       = BIT(2),
0439     SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS        = BIT(3),
0440     SCAN_CONFIG_FLAG_SET_TX_CHAINS          = BIT(8),
0441     SCAN_CONFIG_FLAG_SET_RX_CHAINS          = BIT(9),
0442     SCAN_CONFIG_FLAG_SET_AUX_STA_ID         = BIT(10),
0443     SCAN_CONFIG_FLAG_SET_ALL_TIMES          = BIT(11),
0444     SCAN_CONFIG_FLAG_SET_EFFECTIVE_TIMES        = BIT(12),
0445     SCAN_CONFIG_FLAG_SET_CHANNEL_FLAGS      = BIT(13),
0446     SCAN_CONFIG_FLAG_SET_LEGACY_RATES       = BIT(14),
0447     SCAN_CONFIG_FLAG_SET_MAC_ADDR           = BIT(15),
0448     SCAN_CONFIG_FLAG_SET_FRAGMENTED         = BIT(16),
0449     SCAN_CONFIG_FLAG_CLEAR_FRAGMENTED       = BIT(17),
0450     SCAN_CONFIG_FLAG_SET_CAM_MODE           = BIT(18),
0451     SCAN_CONFIG_FLAG_CLEAR_CAM_MODE         = BIT(19),
0452     SCAN_CONFIG_FLAG_SET_PROMISC_MODE       = BIT(20),
0453     SCAN_CONFIG_FLAG_CLEAR_PROMISC_MODE     = BIT(21),
0454     SCAN_CONFIG_FLAG_SET_LMAC2_FRAGMENTED       = BIT(22),
0455     SCAN_CONFIG_FLAG_CLEAR_LMAC2_FRAGMENTED     = BIT(23),
0456 
0457     /* Bits 26-31 are for num of channels in channel_array */
0458 #define SCAN_CONFIG_N_CHANNELS(n) ((n) << 26)
0459 };
0460 
0461 enum scan_config_rates {
0462     /* OFDM basic rates */
0463     SCAN_CONFIG_RATE_6M = BIT(0),
0464     SCAN_CONFIG_RATE_9M = BIT(1),
0465     SCAN_CONFIG_RATE_12M    = BIT(2),
0466     SCAN_CONFIG_RATE_18M    = BIT(3),
0467     SCAN_CONFIG_RATE_24M    = BIT(4),
0468     SCAN_CONFIG_RATE_36M    = BIT(5),
0469     SCAN_CONFIG_RATE_48M    = BIT(6),
0470     SCAN_CONFIG_RATE_54M    = BIT(7),
0471     /* CCK basic rates */
0472     SCAN_CONFIG_RATE_1M = BIT(8),
0473     SCAN_CONFIG_RATE_2M = BIT(9),
0474     SCAN_CONFIG_RATE_5M = BIT(10),
0475     SCAN_CONFIG_RATE_11M    = BIT(11),
0476 
0477     /* Bits 16-27 are for supported rates */
0478 #define SCAN_CONFIG_SUPPORTED_RATE(rate)    ((rate) << 16)
0479 };
0480 
0481 enum iwl_channel_flags {
0482     IWL_CHANNEL_FLAG_EBS                = BIT(0),
0483     IWL_CHANNEL_FLAG_ACCURATE_EBS           = BIT(1),
0484     IWL_CHANNEL_FLAG_EBS_ADD            = BIT(2),
0485     IWL_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE    = BIT(3),
0486 };
0487 
0488 enum iwl_uhb_chan_cfg_flags {
0489     IWL_UHB_CHAN_CFG_FLAG_UNSOLICITED_PROBE_RES = BIT(24),
0490     IWL_UHB_CHAN_CFG_FLAG_PSC_CHAN_NO_LISTEN    = BIT(25),
0491     IWL_UHB_CHAN_CFG_FLAG_FORCE_PASSIVE         = BIT(26),
0492 };
0493 /**
0494  * struct iwl_scan_dwell
0495  * @active:     default dwell time for active scan
0496  * @passive:        default dwell time for passive scan
0497  * @fragmented:     default dwell time for fragmented scan
0498  * @extended:       default dwell time for channels 1, 6 and 11
0499  */
0500 struct iwl_scan_dwell {
0501     u8 active;
0502     u8 passive;
0503     u8 fragmented;
0504     u8 extended;
0505 } __packed;
0506 
0507 /**
0508  * struct iwl_scan_config_v1 - scan configuration command
0509  * @flags:          enum scan_config_flags
0510  * @tx_chains:          valid_tx antenna - ANT_* definitions
0511  * @rx_chains:          valid_rx antenna - ANT_* definitions
0512  * @legacy_rates:       default legacy rates - enum scan_config_rates
0513  * @out_of_channel_time:    default max out of serving channel time
0514  * @suspend_time:       default max suspend time
0515  * @dwell:          dwells for the scan
0516  * @mac_addr:           default mac address to be used in probes
0517  * @bcast_sta_id:       the index of the station in the fw
0518  * @channel_flags:      default channel flags - enum iwl_channel_flags
0519  *              scan_config_channel_flag
0520  * @channel_array:      default supported channels
0521  */
0522 struct iwl_scan_config_v1 {
0523     __le32 flags;
0524     __le32 tx_chains;
0525     __le32 rx_chains;
0526     __le32 legacy_rates;
0527     __le32 out_of_channel_time;
0528     __le32 suspend_time;
0529     struct iwl_scan_dwell dwell;
0530     u8 mac_addr[ETH_ALEN];
0531     u8 bcast_sta_id;
0532     u8 channel_flags;
0533     u8 channel_array[];
0534 } __packed; /* SCAN_CONFIG_DB_CMD_API_S */
0535 
0536 #define SCAN_TWO_LMACS 2
0537 #define SCAN_LB_LMAC_IDX 0
0538 #define SCAN_HB_LMAC_IDX 1
0539 
0540 /**
0541  * struct iwl_scan_config_v2 - scan configuration command
0542  * @flags:          enum scan_config_flags
0543  * @tx_chains:          valid_tx antenna - ANT_* definitions
0544  * @rx_chains:          valid_rx antenna - ANT_* definitions
0545  * @legacy_rates:       default legacy rates - enum scan_config_rates
0546  * @out_of_channel_time:    default max out of serving channel time
0547  * @suspend_time:       default max suspend time
0548  * @dwell:          dwells for the scan
0549  * @mac_addr:           default mac address to be used in probes
0550  * @bcast_sta_id:       the index of the station in the fw
0551  * @channel_flags:      default channel flags - enum iwl_channel_flags
0552  *              scan_config_channel_flag
0553  * @channel_array:      default supported channels
0554  */
0555 struct iwl_scan_config_v2 {
0556     __le32 flags;
0557     __le32 tx_chains;
0558     __le32 rx_chains;
0559     __le32 legacy_rates;
0560     __le32 out_of_channel_time[SCAN_TWO_LMACS];
0561     __le32 suspend_time[SCAN_TWO_LMACS];
0562     struct iwl_scan_dwell dwell;
0563     u8 mac_addr[ETH_ALEN];
0564     u8 bcast_sta_id;
0565     u8 channel_flags;
0566     u8 channel_array[];
0567 } __packed; /* SCAN_CONFIG_DB_CMD_API_S_2 */
0568 
0569 /**
0570  * struct iwl_scan_config - scan configuration command
0571  * @enable_cam_mode: whether to enable CAM mode.
0572  * @enable_promiscouos_mode: whether to enable promiscouos mode
0573  * @bcast_sta_id: the index of the station in the fw. Deprecated starting with
0574  *     API version 5.
0575  * @reserved: reserved
0576  * @tx_chains: valid_tx antenna - ANT_* definitions
0577  * @rx_chains: valid_rx antenna - ANT_* definitions
0578  */
0579 struct iwl_scan_config {
0580     u8 enable_cam_mode;
0581     u8 enable_promiscouos_mode;
0582     u8 bcast_sta_id;
0583     u8 reserved;
0584     __le32 tx_chains;
0585     __le32 rx_chains;
0586 } __packed; /* SCAN_CONFIG_DB_CMD_API_S_5 */
0587 
0588 /**
0589  * enum iwl_umac_scan_flags - UMAC scan flags
0590  * @IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request
0591  *  can be preempted by other scan requests with higher priority.
0592  *  The low priority scan will be resumed when the higher proirity scan is
0593  *  completed.
0594  * @IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver
0595  *  when scan starts.
0596  */
0597 enum iwl_umac_scan_flags {
0598     IWL_UMAC_SCAN_FLAG_PREEMPTIVE       = BIT(0),
0599     IWL_UMAC_SCAN_FLAG_START_NOTIF      = BIT(1),
0600 };
0601 
0602 enum iwl_umac_scan_uid_offsets {
0603     IWL_UMAC_SCAN_UID_TYPE_OFFSET       = 0,
0604     IWL_UMAC_SCAN_UID_SEQ_OFFSET        = 8,
0605 };
0606 
0607 enum iwl_umac_scan_general_flags {
0608     IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC        = BIT(0),
0609     IWL_UMAC_SCAN_GEN_FLAGS_OVER_BT         = BIT(1),
0610     IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL        = BIT(2),
0611     IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE         = BIT(3),
0612     IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT     = BIT(4),
0613     IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE       = BIT(5),
0614     IWL_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID       = BIT(6),
0615     IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED      = BIT(7),
0616     IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED     = BIT(8),
0617     IWL_UMAC_SCAN_GEN_FLAGS_MATCH           = BIT(9),
0618     IWL_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL      = BIT(10),
0619     /* Extended dwell is obselete when adaptive dwell is used, making this
0620      * bit reusable. Hence, probe request defer is used only when adaptive
0621      * dwell is supported. */
0622     IWL_UMAC_SCAN_GEN_FLAGS_PROB_REQ_DEFER_SUPP = BIT(10),
0623     IWL_UMAC_SCAN_GEN_FLAGS_LMAC2_FRAGMENTED    = BIT(11),
0624     IWL_UMAC_SCAN_GEN_FLAGS_ADAPTIVE_DWELL      = BIT(13),
0625     IWL_UMAC_SCAN_GEN_FLAGS_MAX_CHNL_TIME       = BIT(14),
0626     IWL_UMAC_SCAN_GEN_FLAGS_PROB_REQ_HIGH_TX_RATE   = BIT(15),
0627 };
0628 
0629 /**
0630  * enum iwl_umac_scan_general_flags2 - UMAC scan general flags #2
0631  * @IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL: Whether to send a complete
0632  *  notification per channel or not.
0633  * @IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER: Whether to allow channel
0634  *  reorder optimization or not.
0635  */
0636 enum iwl_umac_scan_general_flags2 {
0637     IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL     = BIT(0),
0638     IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER = BIT(1),
0639 };
0640 
0641 /**
0642  * enum iwl_umac_scan_general_flags_v2 - UMAC scan general flags version 2
0643  *
0644  * The FW flags were reordered and hence the driver introduce version 2
0645  *
0646  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_PERIODIC: periodic or scheduled
0647  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_PASS_ALL: pass all probe responses and beacons
0648  *                                       during scan iterations
0649  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_NTFY_ITER_COMPLETE: send complete notification
0650  *      on every iteration instead of only once after the last iteration
0651  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC1: fragmented scan LMAC1
0652  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC2: fragmented scan LMAC2
0653  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_MATCH: does this scan check for profile matching
0654  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_USE_ALL_RX_CHAINS: use all valid chains for RX
0655  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_ADAPTIVE_DWELL: works with adaptive dwell
0656  *                                             for active channel
0657  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_PREEMPTIVE: can be preempted by other requests
0658  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_NTF_START: send notification of scan start
0659  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_MULTI_SSID: matching on multiple SSIDs
0660  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE: all the channels scanned
0661  *                                           as passive
0662  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_TRIGGER_UHB_SCAN: at the end of 2.4GHz and
0663  *      5.2Ghz bands scan, trigger scan on 6GHz band to discover
0664  *      the reported collocated APs
0665  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN: at the end of 2.4GHz and 5GHz
0666  *      bands scan, if not APs were discovered, allow scan to conitnue and scan
0667  *      6GHz PSC channels in order to discover country information.
0668  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN_FILTER_IN: in case
0669  *      &IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN is enabled and scan is
0670  *      activated over 6GHz PSC channels, filter in beacons and probe responses.
0671  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_OCE: if set, send probe requests in a minimum
0672  *      rate of 5.5Mpbs, filter in broadcast probe responses and set the max
0673  *      channel time indication field in the FILS request parameters element
0674  *      (if included by the driver in the probe request IEs).
0675  */
0676 enum iwl_umac_scan_general_flags_v2 {
0677     IWL_UMAC_SCAN_GEN_FLAGS_V2_PERIODIC             = BIT(0),
0678     IWL_UMAC_SCAN_GEN_FLAGS_V2_PASS_ALL             = BIT(1),
0679     IWL_UMAC_SCAN_GEN_FLAGS_V2_NTFY_ITER_COMPLETE   = BIT(2),
0680     IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC1     = BIT(3),
0681     IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC2     = BIT(4),
0682     IWL_UMAC_SCAN_GEN_FLAGS_V2_MATCH                = BIT(5),
0683     IWL_UMAC_SCAN_GEN_FLAGS_V2_USE_ALL_RX_CHAINS    = BIT(6),
0684     IWL_UMAC_SCAN_GEN_FLAGS_V2_ADAPTIVE_DWELL       = BIT(7),
0685     IWL_UMAC_SCAN_GEN_FLAGS_V2_PREEMPTIVE           = BIT(8),
0686     IWL_UMAC_SCAN_GEN_FLAGS_V2_NTF_START            = BIT(9),
0687     IWL_UMAC_SCAN_GEN_FLAGS_V2_MULTI_SSID           = BIT(10),
0688     IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE        = BIT(11),
0689     IWL_UMAC_SCAN_GEN_FLAGS_V2_TRIGGER_UHB_SCAN     = BIT(12),
0690     IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN    = BIT(13),
0691     IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN_FILTER_IN = BIT(14),
0692     IWL_UMAC_SCAN_GEN_FLAGS_V2_OCE                  = BIT(15),
0693 };
0694 
0695 /**
0696  * enum iwl_umac_scan_general_params_flags2 - UMAC scan general flags2
0697  *
0698  * @IWL_UMAC_SCAN_GEN_PARAMS_FLAGS2_RESPECT_P2P_GO_LB: scan event scheduling
0699  *     should be aware of a P2P GO operation on the 2GHz band.
0700  * @IWL_UMAC_SCAN_GEN_PARAMS_FLAGS2_RESPECT_P2P_GO_HB: scan event scheduling
0701  *     should be aware of a P2P GO operation on the 5GHz or 6GHz band.
0702  */
0703 enum iwl_umac_scan_general_params_flags2 {
0704     IWL_UMAC_SCAN_GEN_PARAMS_FLAGS2_RESPECT_P2P_GO_LB = BIT(0),
0705     IWL_UMAC_SCAN_GEN_PARAMS_FLAGS2_RESPECT_P2P_GO_HB = BIT(1),
0706 };
0707 
0708 /**
0709  * struct iwl_scan_channel_cfg_umac
0710  * @flags:      bitmap - 0-19:  directed scan to i'th ssid.
0711  * @channel_num:    channel number 1-13 etc.
0712  * @band:       band of channel: 0 for 2GHz, 1 for 5GHz
0713  * @iter_count:     repetition count for the channel.
0714  * @iter_interval:  interval between two scan iterations on one channel.
0715  */
0716 struct  iwl_scan_channel_cfg_umac {
0717     __le32 flags;
0718     /* Both versions are of the same size, so use a union without adjusting
0719      * the command size later
0720      */
0721     union {
0722         struct {
0723             u8 channel_num;
0724             u8 iter_count;
0725             __le16 iter_interval;
0726         } v1;  /* SCAN_CHANNEL_CONFIG_API_S_VER_1 */
0727         struct {
0728             u8 channel_num;
0729             u8 band;
0730             u8 iter_count;
0731             u8 iter_interval;
0732          } v2; /* SCAN_CHANNEL_CONFIG_API_S_VER_2
0733             * SCAN_CHANNEL_CONFIG_API_S_VER_3
0734             * SCAN_CHANNEL_CONFIG_API_S_VER_4
0735             */
0736     };
0737 } __packed;
0738 
0739 /**
0740  * struct iwl_scan_umac_schedule
0741  * @interval: interval in seconds between scan iterations
0742  * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop
0743  * @reserved: for alignment and future use
0744  */
0745 struct iwl_scan_umac_schedule {
0746     __le16 interval;
0747     u8 iter_count;
0748     u8 reserved;
0749 } __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */
0750 
0751 struct iwl_scan_req_umac_tail_v1 {
0752     /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
0753     struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
0754     __le16 delay;
0755     __le16 reserved;
0756     /* SCAN_PROBE_PARAMS_API_S_VER_1 */
0757     struct iwl_scan_probe_req_v1 preq;
0758     struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
0759 } __packed;
0760 
0761 /**
0762  * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command
0763  *      parameters following channels configuration array.
0764  * @schedule: two scheduling plans.
0765  * @delay: delay in TUs before starting the first scan iteration
0766  * @reserved: for future use and alignment
0767  * @preq: probe request with IEs blocks
0768  * @direct_scan: list of SSIDs for directed active scan
0769  */
0770 struct iwl_scan_req_umac_tail_v2 {
0771     /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
0772     struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
0773     __le16 delay;
0774     __le16 reserved;
0775     /* SCAN_PROBE_PARAMS_API_S_VER_2 */
0776     struct iwl_scan_probe_req preq;
0777     struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
0778 } __packed;
0779 
0780 /**
0781  * struct iwl_scan_umac_chan_param
0782  * @flags: channel flags &enum iwl_scan_channel_flags
0783  * @count: num of channels in scan request
0784  * @reserved: for future use and alignment
0785  */
0786 struct iwl_scan_umac_chan_param {
0787     u8 flags;
0788     u8 count;
0789     __le16 reserved;
0790 } __packed; /*SCAN_CHANNEL_PARAMS_API_S_VER_1 */
0791 
0792 /**
0793  * struct iwl_scan_req_umac
0794  * @flags: &enum iwl_umac_scan_flags
0795  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
0796  * @ooc_priority: out of channel priority - &enum iwl_scan_priority
0797  * @general_flags: &enum iwl_umac_scan_general_flags
0798  * @scan_start_mac_id: report the scan start TSF time according to this mac TSF
0799  * @extended_dwell: dwell time for channels 1, 6 and 11
0800  * @active_dwell: dwell time for active scan per LMAC
0801  * @passive_dwell: dwell time for passive scan per LMAC
0802  * @fragmented_dwell: dwell time for fragmented passive scan
0803  * @adwell_default_n_aps: for adaptive dwell the default number of APs
0804  *  per channel
0805  * @adwell_default_n_aps_social: for adaptive dwell the default
0806  *  number of APs per social (1,6,11) channel
0807  * @general_flags2: &enum iwl_umac_scan_general_flags2
0808  * @adwell_max_budget: for adaptive dwell the maximal budget of TU to be added
0809  *  to total scan time
0810  * @max_out_time: max out of serving channel time, per LMAC - for CDB there
0811  *  are 2 LMACs
0812  * @suspend_time: max suspend time, per LMAC - for CDB there are 2 LMACs
0813  * @scan_priority: scan internal prioritization &enum iwl_scan_priority
0814  * @num_of_fragments: Number of fragments needed for full coverage per band.
0815  *  Relevant only for fragmented scan.
0816  * @channel: &struct iwl_scan_umac_chan_param
0817  * @reserved: for future use and alignment
0818  * @reserved3: for future use and alignment
0819  * @data: &struct iwl_scan_channel_cfg_umac and
0820  *  &struct iwl_scan_req_umac_tail
0821  */
0822 struct iwl_scan_req_umac {
0823     __le32 flags;
0824     __le32 uid;
0825     __le32 ooc_priority;
0826     __le16 general_flags;
0827     u8 reserved;
0828     u8 scan_start_mac_id;
0829     union {
0830         struct {
0831             u8 extended_dwell;
0832             u8 active_dwell;
0833             u8 passive_dwell;
0834             u8 fragmented_dwell;
0835             __le32 max_out_time;
0836             __le32 suspend_time;
0837             __le32 scan_priority;
0838             struct iwl_scan_umac_chan_param channel;
0839             u8 data[];
0840         } v1; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */
0841         struct {
0842             u8 extended_dwell;
0843             u8 active_dwell;
0844             u8 passive_dwell;
0845             u8 fragmented_dwell;
0846             __le32 max_out_time[SCAN_TWO_LMACS];
0847             __le32 suspend_time[SCAN_TWO_LMACS];
0848             __le32 scan_priority;
0849             struct iwl_scan_umac_chan_param channel;
0850             u8 data[];
0851         } v6; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_6 */
0852         struct {
0853             u8 active_dwell;
0854             u8 passive_dwell;
0855             u8 fragmented_dwell;
0856             u8 adwell_default_n_aps;
0857             u8 adwell_default_n_aps_social;
0858             u8 reserved3;
0859             __le16 adwell_max_budget;
0860             __le32 max_out_time[SCAN_TWO_LMACS];
0861             __le32 suspend_time[SCAN_TWO_LMACS];
0862             __le32 scan_priority;
0863             struct iwl_scan_umac_chan_param channel;
0864             u8 data[];
0865         } v7; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_7 */
0866         struct {
0867             u8 active_dwell[SCAN_TWO_LMACS];
0868             u8 reserved2;
0869             u8 adwell_default_n_aps;
0870             u8 adwell_default_n_aps_social;
0871             u8 general_flags2;
0872             __le16 adwell_max_budget;
0873             __le32 max_out_time[SCAN_TWO_LMACS];
0874             __le32 suspend_time[SCAN_TWO_LMACS];
0875             __le32 scan_priority;
0876             u8 passive_dwell[SCAN_TWO_LMACS];
0877             u8 num_of_fragments[SCAN_TWO_LMACS];
0878             struct iwl_scan_umac_chan_param channel;
0879             u8 data[];
0880         } v8; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_8 */
0881         struct {
0882             u8 active_dwell[SCAN_TWO_LMACS];
0883             u8 adwell_default_hb_n_aps;
0884             u8 adwell_default_lb_n_aps;
0885             u8 adwell_default_n_aps_social;
0886             u8 general_flags2;
0887             __le16 adwell_max_budget;
0888             __le32 max_out_time[SCAN_TWO_LMACS];
0889             __le32 suspend_time[SCAN_TWO_LMACS];
0890             __le32 scan_priority;
0891             u8 passive_dwell[SCAN_TWO_LMACS];
0892             u8 num_of_fragments[SCAN_TWO_LMACS];
0893             struct iwl_scan_umac_chan_param channel;
0894             u8 data[];
0895         } v9; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_9 */
0896     };
0897 } __packed;
0898 
0899 #define IWL_SCAN_REQ_UMAC_SIZE_V8 sizeof(struct iwl_scan_req_umac)
0900 #define IWL_SCAN_REQ_UMAC_SIZE_V7 48
0901 #define IWL_SCAN_REQ_UMAC_SIZE_V6 44
0902 #define IWL_SCAN_REQ_UMAC_SIZE_V1 36
0903 
0904 /**
0905  * struct iwl_scan_probe_params_v3
0906  * @preq: scan probe request params
0907  * @ssid_num: number of valid SSIDs in direct scan array
0908  * @short_ssid_num: number of valid short SSIDs in short ssid array
0909  * @bssid_num: number of valid bssid in bssids array
0910  * @reserved: reserved
0911  * @direct_scan: list of ssids
0912  * @short_ssid: array of short ssids
0913  * @bssid_array: array of bssids
0914  */
0915 struct iwl_scan_probe_params_v3 {
0916     struct iwl_scan_probe_req preq;
0917     u8 ssid_num;
0918     u8 short_ssid_num;
0919     u8 bssid_num;
0920     u8 reserved;
0921     struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
0922     __le32 short_ssid[SCAN_SHORT_SSID_MAX_SIZE];
0923     u8 bssid_array[SCAN_BSSID_MAX_SIZE][ETH_ALEN];
0924 } __packed; /* SCAN_PROBE_PARAMS_API_S_VER_3 */
0925 
0926 /**
0927  * struct iwl_scan_probe_params_v4
0928  * @preq: scan probe request params
0929  * @short_ssid_num: number of valid short SSIDs in short ssid array
0930  * @bssid_num: number of valid bssid in bssids array
0931  * @reserved: reserved
0932  * @direct_scan: list of ssids
0933  * @short_ssid: array of short ssids
0934  * @bssid_array: array of bssids
0935  */
0936 struct iwl_scan_probe_params_v4 {
0937     struct iwl_scan_probe_req preq;
0938     u8 short_ssid_num;
0939     u8 bssid_num;
0940     __le16 reserved;
0941     struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
0942     __le32 short_ssid[SCAN_SHORT_SSID_MAX_SIZE];
0943     u8 bssid_array[SCAN_BSSID_MAX_SIZE][ETH_ALEN];
0944 } __packed; /* SCAN_PROBE_PARAMS_API_S_VER_4 */
0945 
0946 #define SCAN_MAX_NUM_CHANS_V3 67
0947 
0948 /**
0949  * struct iwl_scan_channel_params_v4
0950  * @flags: channel flags &enum iwl_scan_channel_flags
0951  * @count: num of channels in scan request
0952  * @num_of_aps_override: override the number of APs the FW uses to calculate
0953  *  dwell time when adaptive dwell is used
0954  * @reserved: for future use and alignment
0955  * @channel_config: array of explicit channel configurations
0956  *                  for 2.4Ghz and 5.2Ghz bands
0957  * @adwell_ch_override_bitmap: when using adaptive dwell, override the number
0958  *  of APs value with &num_of_aps_override for the channel.
0959  *  To cast channel to index, use &iwl_mvm_scan_ch_and_band_to_idx
0960  */
0961 struct iwl_scan_channel_params_v4 {
0962     u8 flags;
0963     u8 count;
0964     u8 num_of_aps_override;
0965     u8 reserved;
0966     struct iwl_scan_channel_cfg_umac channel_config[SCAN_MAX_NUM_CHANS_V3];
0967     u8 adwell_ch_override_bitmap[16];
0968 } __packed; /* SCAN_CHANNEL_PARAMS_API_S_VER_4 also
0969            SCAN_CHANNEL_PARAMS_API_S_VER_5 */
0970 
0971 /**
0972  * struct iwl_scan_channel_params_v6
0973  * @flags: channel flags &enum iwl_scan_channel_flags
0974  * @count: num of channels in scan request
0975  * @n_aps_override: override the number of APs the FW uses to calculate dwell
0976  *  time when adaptive dwell is used.
0977  *  Channel k will use n_aps_override[i] when BIT(20 + i) is set in
0978  *  channel_config[k].flags
0979  * @channel_config: array of explicit channel configurations
0980  *                  for 2.4Ghz and 5.2Ghz bands
0981  */
0982 struct iwl_scan_channel_params_v6 {
0983     u8 flags;
0984     u8 count;
0985     u8 n_aps_override[2];
0986     struct iwl_scan_channel_cfg_umac channel_config[SCAN_MAX_NUM_CHANS_V3];
0987 } __packed; /* SCAN_CHANNEL_PARAMS_API_S_VER_6 */
0988 
0989 /**
0990  * struct iwl_scan_general_params_v11
0991  * @flags: &enum iwl_umac_scan_general_flags_v2
0992  * @reserved: reserved for future
0993  * @scan_start_mac_id: report the scan start TSF time according to this mac TSF
0994  * @active_dwell: dwell time for active scan per LMAC
0995  * @adwell_default_2g: adaptive dwell default number of APs
0996  *                        for 2.4GHz channel
0997  * @adwell_default_5g: adaptive dwell default number of APs
0998  *                        for 5GHz channels
0999  * @adwell_default_social_chn: adaptive dwell default number of
1000  *                             APs per social channel
1001  * @flags2: for version 11 see &enum iwl_umac_scan_general_params_flags2.
1002  *     Otherwise reserved.
1003  * @adwell_max_budget: the maximal number of TUs that adaptive dwell
1004  *                     can add to the total scan time
1005  * @max_out_of_time: max out of serving channel time, per LMAC
1006  * @suspend_time: max suspend time, per LMAC
1007  * @scan_priority: priority of the request
1008  * @passive_dwell: continues dwell time for passive channel
1009  *                 (without adaptive dwell)
1010  * @num_of_fragments: number of fragments needed for full fragmented
1011  *                    scan coverage.
1012  */
1013 struct iwl_scan_general_params_v11 {
1014     __le16 flags;
1015     u8 reserved;
1016     u8 scan_start_mac_id;
1017     u8 active_dwell[SCAN_TWO_LMACS];
1018     u8 adwell_default_2g;
1019     u8 adwell_default_5g;
1020     u8 adwell_default_social_chn;
1021     u8 flags2;
1022     __le16 adwell_max_budget;
1023     __le32 max_out_of_time[SCAN_TWO_LMACS];
1024     __le32 suspend_time[SCAN_TWO_LMACS];
1025     __le32 scan_priority;
1026     u8 passive_dwell[SCAN_TWO_LMACS];
1027     u8 num_of_fragments[SCAN_TWO_LMACS];
1028 } __packed; /* SCAN_GENERAL_PARAMS_API_S_VER_11 and *_VER_10 */
1029 
1030 /**
1031  * struct iwl_scan_periodic_parms_v1
1032  * @schedule: can scheduling parameter
1033  * @delay: initial delay of the periodic scan in seconds
1034  * @reserved: reserved for future
1035  */
1036 struct iwl_scan_periodic_parms_v1 {
1037     struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
1038     __le16 delay;
1039     __le16 reserved;
1040 } __packed; /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
1041 
1042 /**
1043  * struct iwl_scan_req_params_v12
1044  * @general_params: &struct iwl_scan_general_params_v11
1045  * @channel_params: &struct iwl_scan_channel_params_v4
1046  * @periodic_params: &struct iwl_scan_periodic_parms_v1
1047  * @probe_params: &struct iwl_scan_probe_params_v3
1048  */
1049 struct iwl_scan_req_params_v12 {
1050     struct iwl_scan_general_params_v11 general_params;
1051     struct iwl_scan_channel_params_v4 channel_params;
1052     struct iwl_scan_periodic_parms_v1 periodic_params;
1053     struct iwl_scan_probe_params_v3 probe_params;
1054 } __packed; /* SCAN_REQUEST_PARAMS_API_S_VER_12 */
1055 
1056 /**
1057  * struct iwl_scan_req_params_v15
1058  * @general_params: &struct iwl_scan_general_params_v11
1059  * @channel_params: &struct iwl_scan_channel_params_v6
1060  * @periodic_params: &struct iwl_scan_periodic_parms_v1
1061  * @probe_params: &struct iwl_scan_probe_params_v4
1062  */
1063 struct iwl_scan_req_params_v15 {
1064     struct iwl_scan_general_params_v11 general_params;
1065     struct iwl_scan_channel_params_v6 channel_params;
1066     struct iwl_scan_periodic_parms_v1 periodic_params;
1067     struct iwl_scan_probe_params_v4 probe_params;
1068 } __packed; /* SCAN_REQUEST_PARAMS_API_S_VER_15 and *_VER_14 */
1069 
1070 /**
1071  * struct iwl_scan_req_umac_v12
1072  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1073  * @ooc_priority: out of channel priority - &enum iwl_scan_priority
1074  * @scan_params: scan parameters
1075  */
1076 struct iwl_scan_req_umac_v12 {
1077     __le32 uid;
1078     __le32 ooc_priority;
1079     struct iwl_scan_req_params_v12 scan_params;
1080 } __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_12 */
1081 
1082 /**
1083  * struct iwl_scan_req_umac_v15
1084  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1085  * @ooc_priority: out of channel priority - &enum iwl_scan_priority
1086  * @scan_params: scan parameters
1087  */
1088 struct iwl_scan_req_umac_v15 {
1089     __le32 uid;
1090     __le32 ooc_priority;
1091     struct iwl_scan_req_params_v15 scan_params;
1092 } __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_15 and *_VER_14 */
1093 
1094 /**
1095  * struct iwl_umac_scan_abort
1096  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1097  * @flags: reserved
1098  */
1099 struct iwl_umac_scan_abort {
1100     __le32 uid;
1101     __le32 flags;
1102 } __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */
1103 
1104 /**
1105  * struct iwl_umac_scan_complete
1106  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1107  * @last_schedule: last scheduling line
1108  * @last_iter: last scan iteration number
1109  * @status: &enum iwl_scan_offload_complete_status
1110  * @ebs_status: &enum iwl_scan_ebs_status
1111  * @time_from_last_iter: time elapsed from last iteration
1112  * @reserved: for future use
1113  */
1114 struct iwl_umac_scan_complete {
1115     __le32 uid;
1116     u8 last_schedule;
1117     u8 last_iter;
1118     u8 status;
1119     u8 ebs_status;
1120     __le32 time_from_last_iter;
1121     __le32 reserved;
1122 } __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */
1123 
1124 #define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1 5
1125 #define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN    7
1126 
1127 /**
1128  * struct iwl_scan_offload_profile_match_v1 - match information
1129  * @bssid: matched bssid
1130  * @reserved: reserved
1131  * @channel: channel where the match occurred
1132  * @energy: energy
1133  * @matching_feature: feature matches
1134  * @matching_channels: bitmap of channels that matched, referencing
1135  *  the channels passed in the scan offload request.
1136  */
1137 struct iwl_scan_offload_profile_match_v1 {
1138     u8 bssid[ETH_ALEN];
1139     __le16 reserved;
1140     u8 channel;
1141     u8 energy;
1142     u8 matching_feature;
1143     u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1];
1144 } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_1 */
1145 
1146 /**
1147  * struct iwl_scan_offload_profiles_query_v1 - match results query response
1148  * @matched_profiles: bitmap of matched profiles, referencing the
1149  *  matches passed in the scan offload request
1150  * @last_scan_age: age of the last offloaded scan
1151  * @n_scans_done: number of offloaded scans done
1152  * @gp2_d0u: GP2 when D0U occurred
1153  * @gp2_invoked: GP2 when scan offload was invoked
1154  * @resume_while_scanning: not used
1155  * @self_recovery: obsolete
1156  * @reserved: reserved
1157  * @matches: array of match information, one for each match
1158  */
1159 struct iwl_scan_offload_profiles_query_v1 {
1160     __le32 matched_profiles;
1161     __le32 last_scan_age;
1162     __le32 n_scans_done;
1163     __le32 gp2_d0u;
1164     __le32 gp2_invoked;
1165     u8 resume_while_scanning;
1166     u8 self_recovery;
1167     __le16 reserved;
1168     struct iwl_scan_offload_profile_match_v1 matches[];
1169 } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */
1170 
1171 /**
1172  * struct iwl_scan_offload_profile_match - match information
1173  * @bssid: matched bssid
1174  * @reserved: reserved
1175  * @channel: channel where the match occurred
1176  * @energy: energy
1177  * @matching_feature: feature matches
1178  * @matching_channels: bitmap of channels that matched, referencing
1179  *  the channels passed in the scan offload request.
1180  */
1181 struct iwl_scan_offload_profile_match {
1182     u8 bssid[ETH_ALEN];
1183     __le16 reserved;
1184     u8 channel;
1185     u8 energy;
1186     u8 matching_feature;
1187     u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN];
1188 } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_2 */
1189 
1190 /**
1191  * struct iwl_scan_offload_profiles_query - match results query response
1192  * @matched_profiles: bitmap of matched profiles, referencing the
1193  *  matches passed in the scan offload request
1194  * @last_scan_age: age of the last offloaded scan
1195  * @n_scans_done: number of offloaded scans done
1196  * @gp2_d0u: GP2 when D0U occurred
1197  * @gp2_invoked: GP2 when scan offload was invoked
1198  * @resume_while_scanning: not used
1199  * @self_recovery: obsolete
1200  * @reserved: reserved
1201  * @matches: array of match information, one for each match
1202  */
1203 struct iwl_scan_offload_profiles_query {
1204     __le32 matched_profiles;
1205     __le32 last_scan_age;
1206     __le32 n_scans_done;
1207     __le32 gp2_d0u;
1208     __le32 gp2_invoked;
1209     u8 resume_while_scanning;
1210     u8 self_recovery;
1211     __le16 reserved;
1212     struct iwl_scan_offload_profile_match matches[];
1213 } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_3 */
1214 
1215 /**
1216  * struct iwl_umac_scan_iter_complete_notif - notifies end of scanning iteration
1217  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1218  * @scanned_channels: number of channels scanned and number of valid elements in
1219  *  results array
1220  * @status: one of SCAN_COMP_STATUS_*
1221  * @bt_status: BT on/off status
1222  * @last_channel: last channel that was scanned
1223  * @start_tsf: TSF timer in usecs of the scan start time for the mac specified
1224  *  in &struct iwl_scan_req_umac.
1225  * @results: array of scan results, length in @scanned_channels
1226  */
1227 struct iwl_umac_scan_iter_complete_notif {
1228     __le32 uid;
1229     u8 scanned_channels;
1230     u8 status;
1231     u8 bt_status;
1232     u8 last_channel;
1233     __le64 start_tsf;
1234     struct iwl_scan_results_notif results[];
1235 } __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_2 */
1236 
1237 #endif /* __iwl_fw_api_scan_h__ */