1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3  * Copyright (C) 2012-2014, 2018-2020 Intel Corporation
4  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5  * Copyright (C) 2016-2017 Intel Deutschland GmbH
6  */
7 #ifndef __iwl_fw_api_scan_h__
8 #define __iwl_fw_api_scan_h__
9 
10 /* Scan Commands, Responses, Notifications */
11 
12 /* Max number of IEs for direct SSID scans in a command */
13 #define PROBE_OPTION_MAX		20
14 
15 #define SCAN_SHORT_SSID_MAX_SIZE        8
16 #define SCAN_BSSID_MAX_SIZE             16
17 
18 /**
19  * struct iwl_ssid_ie - directed scan network information element
20  *
21  * Up to 20 of these may appear in REPLY_SCAN_CMD,
22  * selected by "type" bit field in struct iwl_scan_channel;
23  * each channel may select different ssids from among the 20 entries.
24  * SSID IEs get transmitted in reverse order of entry.
25  *
26  * @id: element ID
27  * @len: element length
28  * @ssid: element (SSID) data
29  */
30 struct iwl_ssid_ie {
31 	u8 id;
32 	u8 len;
33 	u8 ssid[IEEE80211_MAX_SSID_LEN];
34 } __packed; /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
35 
36 /* scan offload */
37 #define IWL_SCAN_MAX_BLACKLIST_LEN	64
38 #define IWL_SCAN_SHORT_BLACKLIST_LEN	16
39 #define IWL_SCAN_MAX_PROFILES		11
40 #define IWL_SCAN_MAX_PROFILES_V2	8
41 #define SCAN_OFFLOAD_PROBE_REQ_SIZE	512
42 #define SCAN_NUM_BAND_PROBE_DATA_V_1	2
43 #define SCAN_NUM_BAND_PROBE_DATA_V_2	3
44 
45 /* Default watchdog (in MS) for scheduled scan iteration */
46 #define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
47 
48 #define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
49 #define CAN_ABORT_STATUS 1
50 
51 #define IWL_FULL_SCAN_MULTIPLIER 5
52 #define IWL_FAST_SCHED_SCAN_ITERATIONS 3
53 #define IWL_MAX_SCHED_SCAN_PLANS 2
54 
55 enum scan_framework_client {
56 	SCAN_CLIENT_SCHED_SCAN		= BIT(0),
57 	SCAN_CLIENT_NETDETECT		= BIT(1),
58 	SCAN_CLIENT_ASSET_TRACKING	= BIT(2),
59 };
60 
61 /**
62  * struct iwl_scan_offload_blocklist - SCAN_OFFLOAD_BLACKLIST_S
63  * @ssid:		MAC address to filter out
64  * @reported_rssi:	AP rssi reported to the host
65  * @client_bitmap: clients ignore this entry  - enum scan_framework_client
66  */
67 struct iwl_scan_offload_blocklist {
68 	u8 ssid[ETH_ALEN];
69 	u8 reported_rssi;
70 	u8 client_bitmap;
71 } __packed;
72 
73 enum iwl_scan_offload_network_type {
74 	IWL_NETWORK_TYPE_BSS	= 1,
75 	IWL_NETWORK_TYPE_IBSS	= 2,
76 	IWL_NETWORK_TYPE_ANY	= 3,
77 };
78 
79 enum iwl_scan_offload_band_selection {
80 	IWL_SCAN_OFFLOAD_SELECT_2_4	= 0x4,
81 	IWL_SCAN_OFFLOAD_SELECT_5_2	= 0x8,
82 	IWL_SCAN_OFFLOAD_SELECT_ANY	= 0xc,
83 };
84 
85 /**
86  * struct iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S
87  * @ssid_index:		index to ssid list in fixed part
88  * @unicast_cipher:	encryption algorithm to match - bitmap
89  * @auth_alg:		authentication algorithm to match - bitmap
90  * @network_type:	enum iwl_scan_offload_network_type
91  * @band_selection:	enum iwl_scan_offload_band_selection
92  * @client_bitmap:	clients waiting for match - enum scan_framework_client
93  * @reserved:		reserved
94  */
95 struct iwl_scan_offload_profile {
96 	u8 ssid_index;
97 	u8 unicast_cipher;
98 	u8 auth_alg;
99 	u8 network_type;
100 	u8 band_selection;
101 	u8 client_bitmap;
102 	u8 reserved[2];
103 } __packed;
104 
105 /**
106  * struct iwl_scan_offload_profile_cfg_data
107  * @blocklist_len:	length of blocklist
108  * @num_profiles:	num of profiles in the list
109  * @match_notify:	clients waiting for match found notification
110  * @pass_match:		clients waiting for the results
111  * @active_clients:	active clients bitmap - enum scan_framework_client
112  * @any_beacon_notify:	clients waiting for match notification without match
113  * @reserved:		reserved
114  */
115 struct iwl_scan_offload_profile_cfg_data {
116 	u8 blocklist_len;
117 	u8 num_profiles;
118 	u8 match_notify;
119 	u8 pass_match;
120 	u8 active_clients;
121 	u8 any_beacon_notify;
122 	u8 reserved[2];
123 } __packed;
124 
125 /**
126  * struct iwl_scan_offload_profile_cfg
127  * @profiles:	profiles to search for match
128  * @data:	the rest of the data for profile_cfg
129  */
130 struct iwl_scan_offload_profile_cfg_v1 {
131 	struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
132 	struct iwl_scan_offload_profile_cfg_data data;
133 } __packed; /* SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1-2*/
134 
135 /**
136  * struct iwl_scan_offload_profile_cfg
137  * @profiles:	profiles to search for match
138  * @data:	the rest of the data for profile_cfg
139  */
140 struct iwl_scan_offload_profile_cfg {
141 	struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES_V2];
142 	struct iwl_scan_offload_profile_cfg_data data;
143 } __packed; /* SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_3*/
144 
145 /**
146  * struct iwl_scan_schedule_lmac - schedule of scan offload
147  * @delay:		delay between iterations, in seconds.
148  * @iterations:		num of scan iterations
149  * @full_scan_mul:	number of partial scans before each full scan
150  */
151 struct iwl_scan_schedule_lmac {
152 	__le16 delay;
153 	u8 iterations;
154 	u8 full_scan_mul;
155 } __packed; /* SCAN_SCHEDULE_API_S */
156 
157 enum iwl_scan_offload_complete_status {
158 	IWL_SCAN_OFFLOAD_COMPLETED	= 1,
159 	IWL_SCAN_OFFLOAD_ABORTED	= 2,
160 };
161 
162 enum iwl_scan_ebs_status {
163 	IWL_SCAN_EBS_SUCCESS,
164 	IWL_SCAN_EBS_FAILED,
165 	IWL_SCAN_EBS_CHAN_NOT_FOUND,
166 	IWL_SCAN_EBS_INACTIVE,
167 };
168 
169 /**
170  * struct iwl_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S
171  * @tx_flags: combination of TX_CMD_FLG_*
172  * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
173  *	cleared. Combination of RATE_MCS_*
174  * @sta_id: index of destination station in FW station table
175  * @reserved: for alignment and future use
176  */
177 struct iwl_scan_req_tx_cmd {
178 	__le32 tx_flags;
179 	__le32 rate_n_flags;
180 	u8 sta_id;
181 	u8 reserved[3];
182 } __packed;
183 
184 enum iwl_scan_channel_flags_lmac {
185 	IWL_UNIFIED_SCAN_CHANNEL_FULL		= BIT(27),
186 	IWL_UNIFIED_SCAN_CHANNEL_PARTIAL	= BIT(28),
187 };
188 
189 /**
190  * struct iwl_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2
191  * @flags:		bits 1-20: directed scan to i'th ssid
192  *			other bits &enum iwl_scan_channel_flags_lmac
193  * @channel_num:	channel number 1-13 etc
194  * @iter_count:		scan iteration on this channel
195  * @iter_interval:	interval in seconds between iterations on one channel
196  */
197 struct iwl_scan_channel_cfg_lmac {
198 	__le32 flags;
199 	__le16 channel_num;
200 	__le16 iter_count;
201 	__le32 iter_interval;
202 } __packed;
203 
204 /*
205  * struct iwl_scan_probe_segment - PROBE_SEGMENT_API_S_VER_1
206  * @offset: offset in the data block
207  * @len: length of the segment
208  */
209 struct iwl_scan_probe_segment {
210 	__le16 offset;
211 	__le16 len;
212 } __packed;
213 
214 /* iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_2
215  * @mac_header: first (and common) part of the probe
216  * @band_data: band specific data
217  * @common_data: last (and common) part of the probe
218  * @buf: raw data block
219  */
220 struct iwl_scan_probe_req_v1 {
221 	struct iwl_scan_probe_segment mac_header;
222 	struct iwl_scan_probe_segment band_data[SCAN_NUM_BAND_PROBE_DATA_V_1];
223 	struct iwl_scan_probe_segment common_data;
224 	u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
225 } __packed;
226 
227 /* iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_v2
228  * @mac_header: first (and common) part of the probe
229  * @band_data: band specific data
230  * @common_data: last (and common) part of the probe
231  * @buf: raw data block
232  */
233 struct iwl_scan_probe_req {
234 	struct iwl_scan_probe_segment mac_header;
235 	struct iwl_scan_probe_segment band_data[SCAN_NUM_BAND_PROBE_DATA_V_2];
236 	struct iwl_scan_probe_segment common_data;
237 	u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
238 } __packed;
239 
240 enum iwl_scan_channel_flags {
241 	IWL_SCAN_CHANNEL_FLAG_EBS		= BIT(0),
242 	IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE	= BIT(1),
243 	IWL_SCAN_CHANNEL_FLAG_CACHE_ADD		= BIT(2),
244 	IWL_SCAN_CHANNEL_FLAG_EBS_FRAG		= BIT(3),
245 	IWL_SCAN_CHANNEL_FLAG_FORCE_EBS         = BIT(4),
246 	IWL_SCAN_CHANNEL_FLAG_ENABLE_CHAN_ORDER = BIT(5),
247 	IWL_SCAN_CHANNEL_FLAG_6G_PSC_NO_FILTER  = BIT(6),
248 };
249 
250 /* struct iwl_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S
251  * @flags: enum iwl_scan_channel_flags
252  * @non_ebs_ratio: defines the ratio of number of scan iterations where EBS is
253  *	involved.
254  *	1 - EBS is disabled.
255  *	2 - every second scan will be full scan(and so on).
256  */
257 struct iwl_scan_channel_opt {
258 	__le16 flags;
259 	__le16 non_ebs_ratio;
260 } __packed;
261 
262 /**
263  * enum iwl_mvm_lmac_scan_flags - LMAC scan flags
264  * @IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses
265  *	without filtering.
266  * @IWL_MVM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels
267  * @IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan
268  * @IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification
269  * @IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS: multiple SSID matching
270  * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented
271  * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report
272  *	and DS parameter set IEs into probe requests.
273  * @IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL: use extended dwell time on channels
274  *	1, 6 and 11.
275  * @IWL_MVM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches
276  */
277 enum iwl_mvm_lmac_scan_flags {
278 	IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL		= BIT(0),
279 	IWL_MVM_LMAC_SCAN_FLAG_PASSIVE		= BIT(1),
280 	IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION	= BIT(2),
281 	IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE	= BIT(3),
282 	IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS	= BIT(4),
283 	IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED	= BIT(5),
284 	IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED	= BIT(6),
285 	IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL	= BIT(7),
286 	IWL_MVM_LMAC_SCAN_FLAG_MATCH		= BIT(9),
287 };
288 
289 enum iwl_scan_priority {
290 	IWL_SCAN_PRIORITY_LOW,
291 	IWL_SCAN_PRIORITY_MEDIUM,
292 	IWL_SCAN_PRIORITY_HIGH,
293 };
294 
295 enum iwl_scan_priority_ext {
296 	IWL_SCAN_PRIORITY_EXT_0_LOWEST,
297 	IWL_SCAN_PRIORITY_EXT_1,
298 	IWL_SCAN_PRIORITY_EXT_2,
299 	IWL_SCAN_PRIORITY_EXT_3,
300 	IWL_SCAN_PRIORITY_EXT_4,
301 	IWL_SCAN_PRIORITY_EXT_5,
302 	IWL_SCAN_PRIORITY_EXT_6,
303 	IWL_SCAN_PRIORITY_EXT_7_HIGHEST,
304 };
305 
306 /**
307  * struct iwl_scan_req_lmac - SCAN_REQUEST_CMD_API_S_VER_1
308  * @reserved1: for alignment and future use
309  * @n_channels: num of channels to scan
310  * @active_dwell: dwell time for active channels
311  * @passive_dwell: dwell time for passive channels
312  * @fragmented_dwell: dwell time for fragmented passive scan
313  * @extended_dwell: dwell time for channels 1, 6 and 11 (in certain cases)
314  * @reserved2: for alignment and future use
315  * @rx_chain_select: PHY_RX_CHAIN_* flags
316  * @scan_flags: &enum iwl_mvm_lmac_scan_flags
317  * @max_out_time: max time (in TU) to be out of associated channel
318  * @suspend_time: pause scan this long (TUs) when returning to service channel
319  * @flags: RXON flags
320  * @filter_flags: RXON filter
321  * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz
322  * @direct_scan: list of SSIDs for directed active scan
323  * @scan_prio: enum iwl_scan_priority
324  * @iter_num: number of scan iterations
325  * @delay: delay in seconds before first iteration
326  * @schedule: two scheduling plans. The first one is finite, the second one can
327  *	be infinite.
328  * @channel_opt: channel optimization options, for full and partial scan
329  * @data: channel configuration and probe request packet.
330  */
331 struct iwl_scan_req_lmac {
332 	/* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */
333 	__le32 reserved1;
334 	u8 n_channels;
335 	u8 active_dwell;
336 	u8 passive_dwell;
337 	u8 fragmented_dwell;
338 	u8 extended_dwell;
339 	u8 reserved2;
340 	__le16 rx_chain_select;
341 	__le32 scan_flags;
342 	__le32 max_out_time;
343 	__le32 suspend_time;
344 	/* RX_ON_FLAGS_API_S_VER_1 */
345 	__le32 flags;
346 	__le32 filter_flags;
347 	struct iwl_scan_req_tx_cmd tx_cmd[2];
348 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
349 	__le32 scan_prio;
350 	/* SCAN_REQ_PERIODIC_PARAMS_API_S */
351 	__le32 iter_num;
352 	__le32 delay;
353 	struct iwl_scan_schedule_lmac schedule[IWL_MAX_SCHED_SCAN_PLANS];
354 	struct iwl_scan_channel_opt channel_opt[2];
355 	u8 data[];
356 } __packed;
357 
358 /**
359  * struct iwl_scan_results_notif - scan results for one channel -
360  *	SCAN_RESULT_NTF_API_S_VER_3
361  * @channel: which channel the results are from
362  * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
363  * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
364  * @num_probe_not_sent: # of request that weren't sent due to not enough time
365  * @duration: duration spent in channel, in usecs
366  */
367 struct iwl_scan_results_notif {
368 	u8 channel;
369 	u8 band;
370 	u8 probe_status;
371 	u8 num_probe_not_sent;
372 	__le32 duration;
373 } __packed;
374 
375 /**
376  * struct iwl_lmac_scan_complete_notif - notifies end of scanning (all channels)
377  *	SCAN_COMPLETE_NTF_API_S_VER_3
378  * @scanned_channels: number of channels scanned (and number of valid results)
379  * @status: one of SCAN_COMP_STATUS_*
380  * @bt_status: BT on/off status
381  * @last_channel: last channel that was scanned
382  * @tsf_low: TSF timer (lower half) in usecs
383  * @tsf_high: TSF timer (higher half) in usecs
384  * @results: an array of scan results, only "scanned_channels" of them are valid
385  */
386 struct iwl_lmac_scan_complete_notif {
387 	u8 scanned_channels;
388 	u8 status;
389 	u8 bt_status;
390 	u8 last_channel;
391 	__le32 tsf_low;
392 	__le32 tsf_high;
393 	struct iwl_scan_results_notif results[];
394 } __packed;
395 
396 /**
397  * struct iwl_scan_offload_complete - PERIODIC_SCAN_COMPLETE_NTF_API_S_VER_2
398  * @last_schedule_line: last schedule line executed (fast or regular)
399  * @last_schedule_iteration: last scan iteration executed before scan abort
400  * @status: &enum iwl_scan_offload_complete_status
401  * @ebs_status: EBS success status &enum iwl_scan_ebs_status
402  * @time_after_last_iter: time in seconds elapsed after last iteration
403  * @reserved: reserved
404  */
405 struct iwl_periodic_scan_complete {
406 	u8 last_schedule_line;
407 	u8 last_schedule_iteration;
408 	u8 status;
409 	u8 ebs_status;
410 	__le32 time_after_last_iter;
411 	__le32 reserved;
412 } __packed;
413 
414 /* UMAC Scan API */
415 
416 /* The maximum of either of these cannot exceed 8, because we use an
417  * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h).
418  */
419 #define IWL_MVM_MAX_UMAC_SCANS 4
420 #define IWL_MVM_MAX_LMAC_SCANS 1
421 
422 enum scan_config_flags {
423 	SCAN_CONFIG_FLAG_ACTIVATE			= BIT(0),
424 	SCAN_CONFIG_FLAG_DEACTIVATE			= BIT(1),
425 	SCAN_CONFIG_FLAG_FORBID_CHUB_REQS		= BIT(2),
426 	SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS		= BIT(3),
427 	SCAN_CONFIG_FLAG_SET_TX_CHAINS			= BIT(8),
428 	SCAN_CONFIG_FLAG_SET_RX_CHAINS			= BIT(9),
429 	SCAN_CONFIG_FLAG_SET_AUX_STA_ID			= BIT(10),
430 	SCAN_CONFIG_FLAG_SET_ALL_TIMES			= BIT(11),
431 	SCAN_CONFIG_FLAG_SET_EFFECTIVE_TIMES		= BIT(12),
432 	SCAN_CONFIG_FLAG_SET_CHANNEL_FLAGS		= BIT(13),
433 	SCAN_CONFIG_FLAG_SET_LEGACY_RATES		= BIT(14),
434 	SCAN_CONFIG_FLAG_SET_MAC_ADDR			= BIT(15),
435 	SCAN_CONFIG_FLAG_SET_FRAGMENTED			= BIT(16),
436 	SCAN_CONFIG_FLAG_CLEAR_FRAGMENTED		= BIT(17),
437 	SCAN_CONFIG_FLAG_SET_CAM_MODE			= BIT(18),
438 	SCAN_CONFIG_FLAG_CLEAR_CAM_MODE			= BIT(19),
439 	SCAN_CONFIG_FLAG_SET_PROMISC_MODE		= BIT(20),
440 	SCAN_CONFIG_FLAG_CLEAR_PROMISC_MODE		= BIT(21),
441 	SCAN_CONFIG_FLAG_SET_LMAC2_FRAGMENTED		= BIT(22),
442 	SCAN_CONFIG_FLAG_CLEAR_LMAC2_FRAGMENTED		= BIT(23),
443 
444 	/* Bits 26-31 are for num of channels in channel_array */
445 #define SCAN_CONFIG_N_CHANNELS(n) ((n) << 26)
446 };
447 
448 enum scan_config_rates {
449 	/* OFDM basic rates */
450 	SCAN_CONFIG_RATE_6M	= BIT(0),
451 	SCAN_CONFIG_RATE_9M	= BIT(1),
452 	SCAN_CONFIG_RATE_12M	= BIT(2),
453 	SCAN_CONFIG_RATE_18M	= BIT(3),
454 	SCAN_CONFIG_RATE_24M	= BIT(4),
455 	SCAN_CONFIG_RATE_36M	= BIT(5),
456 	SCAN_CONFIG_RATE_48M	= BIT(6),
457 	SCAN_CONFIG_RATE_54M	= BIT(7),
458 	/* CCK basic rates */
459 	SCAN_CONFIG_RATE_1M	= BIT(8),
460 	SCAN_CONFIG_RATE_2M	= BIT(9),
461 	SCAN_CONFIG_RATE_5M	= BIT(10),
462 	SCAN_CONFIG_RATE_11M	= BIT(11),
463 
464 	/* Bits 16-27 are for supported rates */
465 #define SCAN_CONFIG_SUPPORTED_RATE(rate)	((rate) << 16)
466 };
467 
468 enum iwl_channel_flags {
469 	IWL_CHANNEL_FLAG_EBS				= BIT(0),
470 	IWL_CHANNEL_FLAG_ACCURATE_EBS			= BIT(1),
471 	IWL_CHANNEL_FLAG_EBS_ADD			= BIT(2),
472 	IWL_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE	= BIT(3),
473 };
474 
475 enum iwl_uhb_chan_cfg_flags {
476 	IWL_UHB_CHAN_CFG_FLAG_UNSOLICITED_PROBE_RES = BIT(24),
477 	IWL_UHB_CHAN_CFG_FLAG_PSC_CHAN_NO_LISTEN    = BIT(25),
478 	IWL_UHB_CHAN_CFG_FLAG_FORCE_PASSIVE         = BIT(26),
479 };
480 /**
481  * struct iwl_scan_dwell
482  * @active:		default dwell time for active scan
483  * @passive:		default dwell time for passive scan
484  * @fragmented:		default dwell time for fragmented scan
485  * @extended:		default dwell time for channels 1, 6 and 11
486  */
487 struct iwl_scan_dwell {
488 	u8 active;
489 	u8 passive;
490 	u8 fragmented;
491 	u8 extended;
492 } __packed;
493 
494 /**
495  * struct iwl_scan_config_v1
496  * @flags:			enum scan_config_flags
497  * @tx_chains:			valid_tx antenna - ANT_* definitions
498  * @rx_chains:			valid_rx antenna - ANT_* definitions
499  * @legacy_rates:		default legacy rates - enum scan_config_rates
500  * @out_of_channel_time:	default max out of serving channel time
501  * @suspend_time:		default max suspend time
502  * @dwell:			dwells for the scan
503  * @mac_addr:			default mac address to be used in probes
504  * @bcast_sta_id:		the index of the station in the fw
505  * @channel_flags:		default channel flags - enum iwl_channel_flags
506  *				scan_config_channel_flag
507  * @channel_array:		default supported channels
508  */
509 struct iwl_scan_config_v1 {
510 	__le32 flags;
511 	__le32 tx_chains;
512 	__le32 rx_chains;
513 	__le32 legacy_rates;
514 	__le32 out_of_channel_time;
515 	__le32 suspend_time;
516 	struct iwl_scan_dwell dwell;
517 	u8 mac_addr[ETH_ALEN];
518 	u8 bcast_sta_id;
519 	u8 channel_flags;
520 	u8 channel_array[];
521 } __packed; /* SCAN_CONFIG_DB_CMD_API_S */
522 
523 #define SCAN_TWO_LMACS 2
524 #define SCAN_LB_LMAC_IDX 0
525 #define SCAN_HB_LMAC_IDX 1
526 
527 struct iwl_scan_config_v2 {
528 	__le32 flags;
529 	__le32 tx_chains;
530 	__le32 rx_chains;
531 	__le32 legacy_rates;
532 	__le32 out_of_channel_time[SCAN_TWO_LMACS];
533 	__le32 suspend_time[SCAN_TWO_LMACS];
534 	struct iwl_scan_dwell dwell;
535 	u8 mac_addr[ETH_ALEN];
536 	u8 bcast_sta_id;
537 	u8 channel_flags;
538 	u8 channel_array[];
539 } __packed; /* SCAN_CONFIG_DB_CMD_API_S_2 */
540 
541 /**
542  * struct iwl_scan_config
543  * @enable_cam_mode: whether to enable CAM mode.
544  * @enable_promiscouos_mode: whether to enable promiscouos mode
545  * @bcast_sta_id: the index of the station in the fw
546  * @reserved: reserved
547  * @tx_chains: valid_tx antenna - ANT_* definitions
548  * @rx_chains: valid_rx antenna - ANT_* definitions
549  */
550 struct iwl_scan_config {
551 	u8 enable_cam_mode;
552 	u8 enable_promiscouos_mode;
553 	u8 bcast_sta_id;
554 	u8 reserved;
555 	__le32 tx_chains;
556 	__le32 rx_chains;
557 } __packed; /* SCAN_CONFIG_DB_CMD_API_S_3 */
558 
559 /**
560  * enum iwl_umac_scan_flags - UMAC scan flags
561  * @IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request
562  *	can be preempted by other scan requests with higher priority.
563  *	The low priority scan will be resumed when the higher proirity scan is
564  *	completed.
565  * @IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver
566  *	when scan starts.
567  */
568 enum iwl_umac_scan_flags {
569 	IWL_UMAC_SCAN_FLAG_PREEMPTIVE		= BIT(0),
570 	IWL_UMAC_SCAN_FLAG_START_NOTIF		= BIT(1),
571 };
572 
573 enum iwl_umac_scan_uid_offsets {
574 	IWL_UMAC_SCAN_UID_TYPE_OFFSET		= 0,
575 	IWL_UMAC_SCAN_UID_SEQ_OFFSET		= 8,
576 };
577 
578 enum iwl_umac_scan_general_flags {
579 	IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC		= BIT(0),
580 	IWL_UMAC_SCAN_GEN_FLAGS_OVER_BT			= BIT(1),
581 	IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL		= BIT(2),
582 	IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE			= BIT(3),
583 	IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT		= BIT(4),
584 	IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE		= BIT(5),
585 	IWL_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID		= BIT(6),
586 	IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED		= BIT(7),
587 	IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED		= BIT(8),
588 	IWL_UMAC_SCAN_GEN_FLAGS_MATCH			= BIT(9),
589 	IWL_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL		= BIT(10),
590 	/* Extended dwell is obselete when adaptive dwell is used, making this
591 	 * bit reusable. Hence, probe request defer is used only when adaptive
592 	 * dwell is supported. */
593 	IWL_UMAC_SCAN_GEN_FLAGS_PROB_REQ_DEFER_SUPP	= BIT(10),
594 	IWL_UMAC_SCAN_GEN_FLAGS_LMAC2_FRAGMENTED	= BIT(11),
595 	IWL_UMAC_SCAN_GEN_FLAGS_ADAPTIVE_DWELL		= BIT(13),
596 	IWL_UMAC_SCAN_GEN_FLAGS_MAX_CHNL_TIME		= BIT(14),
597 	IWL_UMAC_SCAN_GEN_FLAGS_PROB_REQ_HIGH_TX_RATE	= BIT(15),
598 };
599 
600 /**
601  * enum iwl_umac_scan_general_flags2 - UMAC scan general flags #2
602  * @IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL: Whether to send a complete
603  *	notification per channel or not.
604  * @IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER: Whether to allow channel
605  *	reorder optimization or not.
606  */
607 enum iwl_umac_scan_general_flags2 {
608 	IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL		= BIT(0),
609 	IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER	= BIT(1),
610 };
611 
612 /**
613  * enum iwl_umac_scan_general_flags_v2 - UMAC scan general flags version 2
614  *
615  * The FW flags were reordered and hence the driver introduce version 2
616  *
617  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_PERIODIC: periodic or scheduled
618  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_PASS_ALL: pass all probe responses and beacons
619  *                                       during scan iterations
620  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_NTFY_ITER_COMPLETE: send complete notification
621  *      on every iteration instead of only once after the last iteration
622  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC1: fragmented scan LMAC1
623  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC2: fragmented scan LMAC2
624  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_MATCH: does this scan check for profile matching
625  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_USE_ALL_RX_CHAINS: use all valid chains for RX
626  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_ADAPTIVE_DWELL: works with adaptive dwell
627  *                                             for active channel
628  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_PREEMPTIVE: can be preempted by other requests
629  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_NTF_START: send notification of scan start
630  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_MULTI_SSID: matching on multiple SSIDs
631  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE: all the channels scanned
632  *                                           as passive
633  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_TRIGGER_UHB_SCAN: at the end of 2.4GHz and
634  *		5.2Ghz bands scan, trigger scan on 6GHz band to discover
635  *		the reported collocated APs
636  */
637 enum iwl_umac_scan_general_flags_v2 {
638 	IWL_UMAC_SCAN_GEN_FLAGS_V2_PERIODIC             = BIT(0),
639 	IWL_UMAC_SCAN_GEN_FLAGS_V2_PASS_ALL             = BIT(1),
640 	IWL_UMAC_SCAN_GEN_FLAGS_V2_NTFY_ITER_COMPLETE   = BIT(2),
641 	IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC1     = BIT(3),
642 	IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC2     = BIT(4),
643 	IWL_UMAC_SCAN_GEN_FLAGS_V2_MATCH                = BIT(5),
644 	IWL_UMAC_SCAN_GEN_FLAGS_V2_USE_ALL_RX_CHAINS    = BIT(6),
645 	IWL_UMAC_SCAN_GEN_FLAGS_V2_ADAPTIVE_DWELL       = BIT(7),
646 	IWL_UMAC_SCAN_GEN_FLAGS_V2_PREEMPTIVE           = BIT(8),
647 	IWL_UMAC_SCAN_GEN_FLAGS_V2_NTF_START            = BIT(9),
648 	IWL_UMAC_SCAN_GEN_FLAGS_V2_MULTI_SSID           = BIT(10),
649 	IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE        = BIT(11),
650 	IWL_UMAC_SCAN_GEN_FLAGS_V2_TRIGGER_UHB_SCAN     = BIT(12),
651 };
652 
653 /**
654  * struct iwl_scan_channel_cfg_umac
655  * @flags:		bitmap - 0-19:	directed scan to i'th ssid.
656  * @channel_num:	channel number 1-13 etc.
657  * @band:		band of channel: 0 for 2GHz, 1 for 5GHz
658  * @iter_count:		repetition count for the channel.
659  * @iter_interval:	interval between two scan iterations on one channel.
660  */
661 struct  iwl_scan_channel_cfg_umac {
662 	__le32 flags;
663 	/* Both versions are of the same size, so use a union without adjusting
664 	 * the command size later
665 	 */
666 	union {
667 		struct {
668 			u8 channel_num;
669 			u8 iter_count;
670 			__le16 iter_interval;
671 		} v1;  /* SCAN_CHANNEL_CONFIG_API_S_VER_1 */
672 		struct {
673 			u8 channel_num;
674 			u8 band;
675 			u8 iter_count;
676 			u8 iter_interval;
677 		 } v2; /* SCAN_CHANNEL_CONFIG_API_S_VER_2
678 			* SCAN_CHANNEL_CONFIG_API_S_VER_3
679 			* SCAN_CHANNEL_CONFIG_API_S_VER_4
680 			*/
681 	};
682 } __packed;
683 
684 /**
685  * struct iwl_scan_umac_schedule
686  * @interval: interval in seconds between scan iterations
687  * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop
688  * @reserved: for alignment and future use
689  */
690 struct iwl_scan_umac_schedule {
691 	__le16 interval;
692 	u8 iter_count;
693 	u8 reserved;
694 } __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */
695 
696 struct iwl_scan_req_umac_tail_v1 {
697 	/* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
698 	struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
699 	__le16 delay;
700 	__le16 reserved;
701 	/* SCAN_PROBE_PARAMS_API_S_VER_1 */
702 	struct iwl_scan_probe_req_v1 preq;
703 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
704 } __packed;
705 
706 /**
707  * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command
708  *      parameters following channels configuration array.
709  * @schedule: two scheduling plans.
710  * @delay: delay in TUs before starting the first scan iteration
711  * @reserved: for future use and alignment
712  * @preq: probe request with IEs blocks
713  * @direct_scan: list of SSIDs for directed active scan
714  */
715 struct iwl_scan_req_umac_tail_v2 {
716 	/* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
717 	struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
718 	__le16 delay;
719 	__le16 reserved;
720 	/* SCAN_PROBE_PARAMS_API_S_VER_2 */
721 	struct iwl_scan_probe_req preq;
722 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
723 } __packed;
724 
725 /**
726  * struct iwl_scan_umac_chan_param
727  * @flags: channel flags &enum iwl_scan_channel_flags
728  * @count: num of channels in scan request
729  * @reserved: for future use and alignment
730  */
731 struct iwl_scan_umac_chan_param {
732 	u8 flags;
733 	u8 count;
734 	__le16 reserved;
735 } __packed; /*SCAN_CHANNEL_PARAMS_API_S_VER_1 */
736 
737 /**
738  * struct iwl_scan_req_umac
739  * @flags: &enum iwl_umac_scan_flags
740  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
741  * @ooc_priority: out of channel priority - &enum iwl_scan_priority
742  * @general_flags: &enum iwl_umac_scan_general_flags
743  * @scan_start_mac_id: report the scan start TSF time according to this mac TSF
744  * @extended_dwell: dwell time for channels 1, 6 and 11
745  * @active_dwell: dwell time for active scan per LMAC
746  * @passive_dwell: dwell time for passive scan per LMAC
747  * @fragmented_dwell: dwell time for fragmented passive scan
748  * @adwell_default_n_aps: for adaptive dwell the default number of APs
749  *	per channel
750  * @adwell_default_n_aps_social: for adaptive dwell the default
751  *	number of APs per social (1,6,11) channel
752  * @general_flags2: &enum iwl_umac_scan_general_flags2
753  * @adwell_max_budget: for adaptive dwell the maximal budget of TU to be added
754  *	to total scan time
755  * @max_out_time: max out of serving channel time, per LMAC - for CDB there
756  *	are 2 LMACs
757  * @suspend_time: max suspend time, per LMAC - for CDB there are 2 LMACs
758  * @scan_priority: scan internal prioritization &enum iwl_scan_priority
759  * @num_of_fragments: Number of fragments needed for full coverage per band.
760  *	Relevant only for fragmented scan.
761  * @channel: &struct iwl_scan_umac_chan_param
762  * @reserved: for future use and alignment
763  * @reserved3: for future use and alignment
764  * @data: &struct iwl_scan_channel_cfg_umac and
765  *	&struct iwl_scan_req_umac_tail
766  */
767 struct iwl_scan_req_umac {
768 	__le32 flags;
769 	__le32 uid;
770 	__le32 ooc_priority;
771 	__le16 general_flags;
772 	u8 reserved;
773 	u8 scan_start_mac_id;
774 	union {
775 		struct {
776 			u8 extended_dwell;
777 			u8 active_dwell;
778 			u8 passive_dwell;
779 			u8 fragmented_dwell;
780 			__le32 max_out_time;
781 			__le32 suspend_time;
782 			__le32 scan_priority;
783 			struct iwl_scan_umac_chan_param channel;
784 			u8 data[];
785 		} v1; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */
786 		struct {
787 			u8 extended_dwell;
788 			u8 active_dwell;
789 			u8 passive_dwell;
790 			u8 fragmented_dwell;
791 			__le32 max_out_time[SCAN_TWO_LMACS];
792 			__le32 suspend_time[SCAN_TWO_LMACS];
793 			__le32 scan_priority;
794 			struct iwl_scan_umac_chan_param channel;
795 			u8 data[];
796 		} v6; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_6 */
797 		struct {
798 			u8 active_dwell;
799 			u8 passive_dwell;
800 			u8 fragmented_dwell;
801 			u8 adwell_default_n_aps;
802 			u8 adwell_default_n_aps_social;
803 			u8 reserved3;
804 			__le16 adwell_max_budget;
805 			__le32 max_out_time[SCAN_TWO_LMACS];
806 			__le32 suspend_time[SCAN_TWO_LMACS];
807 			__le32 scan_priority;
808 			struct iwl_scan_umac_chan_param channel;
809 			u8 data[];
810 		} v7; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_7 */
811 		struct {
812 			u8 active_dwell[SCAN_TWO_LMACS];
813 			u8 reserved2;
814 			u8 adwell_default_n_aps;
815 			u8 adwell_default_n_aps_social;
816 			u8 general_flags2;
817 			__le16 adwell_max_budget;
818 			__le32 max_out_time[SCAN_TWO_LMACS];
819 			__le32 suspend_time[SCAN_TWO_LMACS];
820 			__le32 scan_priority;
821 			u8 passive_dwell[SCAN_TWO_LMACS];
822 			u8 num_of_fragments[SCAN_TWO_LMACS];
823 			struct iwl_scan_umac_chan_param channel;
824 			u8 data[];
825 		} v8; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_8 */
826 		struct {
827 			u8 active_dwell[SCAN_TWO_LMACS];
828 			u8 adwell_default_hb_n_aps;
829 			u8 adwell_default_lb_n_aps;
830 			u8 adwell_default_n_aps_social;
831 			u8 general_flags2;
832 			__le16 adwell_max_budget;
833 			__le32 max_out_time[SCAN_TWO_LMACS];
834 			__le32 suspend_time[SCAN_TWO_LMACS];
835 			__le32 scan_priority;
836 			u8 passive_dwell[SCAN_TWO_LMACS];
837 			u8 num_of_fragments[SCAN_TWO_LMACS];
838 			struct iwl_scan_umac_chan_param channel;
839 			u8 data[];
840 		} v9; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_9 */
841 	};
842 } __packed;
843 
844 #define IWL_SCAN_REQ_UMAC_SIZE_V8 sizeof(struct iwl_scan_req_umac)
845 #define IWL_SCAN_REQ_UMAC_SIZE_V7 48
846 #define IWL_SCAN_REQ_UMAC_SIZE_V6 44
847 #define IWL_SCAN_REQ_UMAC_SIZE_V1 36
848 
849 /**
850  * struct iwl_scan_probe_params_v3
851  * @preq: scan probe request params
852  * @ssid_num: number of valid SSIDs in direct scan array
853  * @short_ssid_num: number of valid short SSIDs in short ssid array
854  * @bssid_num: number of valid bssid in bssids array
855  * @reserved: reserved
856  * @direct_scan: list of ssids
857  * @short_ssid: array of short ssids
858  * @bssid_array: array of bssids
859  */
860 struct iwl_scan_probe_params_v3 {
861 	struct iwl_scan_probe_req preq;
862 	u8 ssid_num;
863 	u8 short_ssid_num;
864 	u8 bssid_num;
865 	u8 reserved;
866 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
867 	__le32 short_ssid[SCAN_SHORT_SSID_MAX_SIZE];
868 	u8 bssid_array[ETH_ALEN][SCAN_BSSID_MAX_SIZE];
869 } __packed; /* SCAN_PROBE_PARAMS_API_S_VER_3 */
870 
871 /**
872  * struct iwl_scan_probe_params_v4
873  * @preq: scan probe request params
874  * @short_ssid_num: number of valid short SSIDs in short ssid array
875  * @bssid_num: number of valid bssid in bssids array
876  * @reserved: reserved
877  * @direct_scan: list of ssids
878  * @short_ssid: array of short ssids
879  * @bssid_array: array of bssids
880  */
881 struct iwl_scan_probe_params_v4 {
882 	struct iwl_scan_probe_req preq;
883 	u8 short_ssid_num;
884 	u8 bssid_num;
885 	__le16 reserved;
886 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
887 	__le32 short_ssid[SCAN_SHORT_SSID_MAX_SIZE];
888 	u8 bssid_array[ETH_ALEN][SCAN_BSSID_MAX_SIZE];
889 } __packed; /* SCAN_PROBE_PARAMS_API_S_VER_4 */
890 
891 #define SCAN_MAX_NUM_CHANS_V3 67
892 
893 /**
894  * struct iwl_scan_channel_params_v4
895  * @flags: channel flags &enum iwl_scan_channel_flags
896  * @count: num of channels in scan request
897  * @num_of_aps_override: override the number of APs the FW uses to calculate
898  *	dwell time when adaptive dwell is used
899  * @reserved: for future use and alignment
900  * @channel_config: array of explicit channel configurations
901  *                  for 2.4Ghz and 5.2Ghz bands
902  * @adwell_ch_override_bitmap: when using adaptive dwell, override the number
903  *	of APs value with &num_of_aps_override for the channel.
904  *	To cast channel to index, use &iwl_mvm_scan_ch_and_band_to_idx
905  */
906 struct iwl_scan_channel_params_v4 {
907 	u8 flags;
908 	u8 count;
909 	u8 num_of_aps_override;
910 	u8 reserved;
911 	struct iwl_scan_channel_cfg_umac channel_config[SCAN_MAX_NUM_CHANS_V3];
912 	u8 adwell_ch_override_bitmap[16];
913 } __packed; /* SCAN_CHANNEL_PARAMS_API_S_VER_4 also
914 	       SCAN_CHANNEL_PARAMS_API_S_VER_5 */
915 
916 /**
917  * struct iwl_scan_channel_params_v6
918  * @flags: channel flags &enum iwl_scan_channel_flags
919  * @count: num of channels in scan request
920  * @n_aps_override: override the number of APs the FW uses to calculate dwell
921  *	time when adaptive dwell is used.
922  *	Channel k will use n_aps_override[i] when BIT(20 + i) is set in
923  *	channel_config[k].flags
924  * @channel_config: array of explicit channel configurations
925  *                  for 2.4Ghz and 5.2Ghz bands
926  */
927 struct iwl_scan_channel_params_v6 {
928 	u8 flags;
929 	u8 count;
930 	u8 n_aps_override[2];
931 	struct iwl_scan_channel_cfg_umac channel_config[SCAN_MAX_NUM_CHANS_V3];
932 } __packed; /* SCAN_CHANNEL_PARAMS_API_S_VER_6 */
933 
934 /**
935  * struct iwl_scan_general_params_v10
936  * @flags: &enum iwl_umac_scan_flags
937  * @reserved: reserved for future
938  * @scan_start_mac_id: report the scan start TSF time according to this mac TSF
939  * @active_dwell: dwell time for active scan per LMAC
940  * @adwell_default_2g: adaptive dwell default number of APs
941  *                        for 2.4GHz channel
942  * @adwell_default_5g: adaptive dwell default number of APs
943  *                        for 5GHz channels
944  * @adwell_default_social_chn: adaptive dwell default number of
945  *                             APs per social channel
946  * @reserved1: reserved for future
947  * @adwell_max_budget: the maximal number of TUs that adaptive dwell
948  *                     can add to the total scan time
949  * @max_out_of_time: max out of serving channel time, per LMAC
950  * @suspend_time: max suspend time, per LMAC
951  * @scan_priority: priority of the request
952  * @passive_dwell: continues dwell time for passive channel
953  *                 (without adaptive dwell)
954  * @num_of_fragments: number of fragments needed for full fragmented
955  *                    scan coverage.
956  */
957 struct iwl_scan_general_params_v10 {
958 	__le16 flags;
959 	u8 reserved;
960 	u8 scan_start_mac_id;
961 	u8 active_dwell[SCAN_TWO_LMACS];
962 	u8 adwell_default_2g;
963 	u8 adwell_default_5g;
964 	u8 adwell_default_social_chn;
965 	u8 reserved1;
966 	__le16 adwell_max_budget;
967 	__le32 max_out_of_time[SCAN_TWO_LMACS];
968 	__le32 suspend_time[SCAN_TWO_LMACS];
969 	__le32 scan_priority;
970 	u8 passive_dwell[SCAN_TWO_LMACS];
971 	u8 num_of_fragments[SCAN_TWO_LMACS];
972 } __packed; /* SCAN_GENERAL_PARAMS_API_S_VER_10 */
973 
974 /**
975  * struct iwl_scan_periodic_parms_v1
976  * @schedule: can scheduling parameter
977  * @delay: initial delay of the periodic scan in seconds
978  * @reserved: reserved for future
979  */
980 struct iwl_scan_periodic_parms_v1 {
981 	struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
982 	__le16 delay;
983 	__le16 reserved;
984 } __packed; /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
985 
986 /**
987  * struct iwl_scan_req_params_v12
988  * @general_params: &struct iwl_scan_general_params_v10
989  * @channel_params: &struct iwl_scan_channel_params_v4
990  * @periodic_params: &struct iwl_scan_periodic_parms_v1
991  * @probe_params: &struct iwl_scan_probe_params_v3
992  */
993 struct iwl_scan_req_params_v12 {
994 	struct iwl_scan_general_params_v10 general_params;
995 	struct iwl_scan_channel_params_v4 channel_params;
996 	struct iwl_scan_periodic_parms_v1 periodic_params;
997 	struct iwl_scan_probe_params_v3 probe_params;
998 } __packed; /* SCAN_REQUEST_PARAMS_API_S_VER_12 */
999 
1000 /**
1001  * struct iwl_scan_req_params_v14
1002  * @general_params: &struct iwl_scan_general_params_v10
1003  * @channel_params: &struct iwl_scan_channel_params_v6
1004  * @periodic_params: &struct iwl_scan_periodic_parms_v1
1005  * @probe_params: &struct iwl_scan_probe_params_v4
1006  */
1007 struct iwl_scan_req_params_v14 {
1008 	struct iwl_scan_general_params_v10 general_params;
1009 	struct iwl_scan_channel_params_v6 channel_params;
1010 	struct iwl_scan_periodic_parms_v1 periodic_params;
1011 	struct iwl_scan_probe_params_v4 probe_params;
1012 } __packed; /* SCAN_REQUEST_PARAMS_API_S_VER_14 */
1013 
1014 /**
1015  * struct iwl_scan_req_umac_v12
1016  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1017  * @ooc_priority: out of channel priority - &enum iwl_scan_priority
1018  * @scan_params: scan parameters
1019  */
1020 struct iwl_scan_req_umac_v12 {
1021 	__le32 uid;
1022 	__le32 ooc_priority;
1023 	struct iwl_scan_req_params_v12 scan_params;
1024 } __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_12 */
1025 
1026 /**
1027  * struct iwl_scan_req_umac_v14
1028  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1029  * @ooc_priority: out of channel priority - &enum iwl_scan_priority
1030  * @scan_params: scan parameters
1031  */
1032 struct iwl_scan_req_umac_v14 {
1033 	__le32 uid;
1034 	__le32 ooc_priority;
1035 	struct iwl_scan_req_params_v14 scan_params;
1036 } __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_14 */
1037 
1038 /**
1039  * struct iwl_umac_scan_abort
1040  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1041  * @flags: reserved
1042  */
1043 struct iwl_umac_scan_abort {
1044 	__le32 uid;
1045 	__le32 flags;
1046 } __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */
1047 
1048 /**
1049  * struct iwl_umac_scan_complete
1050  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1051  * @last_schedule: last scheduling line
1052  * @last_iter: last scan iteration number
1053  * @status: &enum iwl_scan_offload_complete_status
1054  * @ebs_status: &enum iwl_scan_ebs_status
1055  * @time_from_last_iter: time elapsed from last iteration
1056  * @reserved: for future use
1057  */
1058 struct iwl_umac_scan_complete {
1059 	__le32 uid;
1060 	u8 last_schedule;
1061 	u8 last_iter;
1062 	u8 status;
1063 	u8 ebs_status;
1064 	__le32 time_from_last_iter;
1065 	__le32 reserved;
1066 } __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */
1067 
1068 #define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1 5
1069 #define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN    7
1070 
1071 /**
1072  * struct iwl_scan_offload_profile_match_v1 - match information
1073  * @bssid: matched bssid
1074  * @reserved: reserved
1075  * @channel: channel where the match occurred
1076  * @energy: energy
1077  * @matching_feature: feature matches
1078  * @matching_channels: bitmap of channels that matched, referencing
1079  *	the channels passed in the scan offload request.
1080  */
1081 struct iwl_scan_offload_profile_match_v1 {
1082 	u8 bssid[ETH_ALEN];
1083 	__le16 reserved;
1084 	u8 channel;
1085 	u8 energy;
1086 	u8 matching_feature;
1087 	u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1];
1088 } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_1 */
1089 
1090 /**
1091  * struct iwl_scan_offload_profiles_query_v1 - match results query response
1092  * @matched_profiles: bitmap of matched profiles, referencing the
1093  *	matches passed in the scan offload request
1094  * @last_scan_age: age of the last offloaded scan
1095  * @n_scans_done: number of offloaded scans done
1096  * @gp2_d0u: GP2 when D0U occurred
1097  * @gp2_invoked: GP2 when scan offload was invoked
1098  * @resume_while_scanning: not used
1099  * @self_recovery: obsolete
1100  * @reserved: reserved
1101  * @matches: array of match information, one for each match
1102  */
1103 struct iwl_scan_offload_profiles_query_v1 {
1104 	__le32 matched_profiles;
1105 	__le32 last_scan_age;
1106 	__le32 n_scans_done;
1107 	__le32 gp2_d0u;
1108 	__le32 gp2_invoked;
1109 	u8 resume_while_scanning;
1110 	u8 self_recovery;
1111 	__le16 reserved;
1112 	struct iwl_scan_offload_profile_match_v1 matches[0];
1113 } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */
1114 
1115 /**
1116  * struct iwl_scan_offload_profile_match - match information
1117  * @bssid: matched bssid
1118  * @reserved: reserved
1119  * @channel: channel where the match occurred
1120  * @energy: energy
1121  * @matching_feature: feature matches
1122  * @matching_channels: bitmap of channels that matched, referencing
1123  *	the channels passed in the scan offload request.
1124  */
1125 struct iwl_scan_offload_profile_match {
1126 	u8 bssid[ETH_ALEN];
1127 	__le16 reserved;
1128 	u8 channel;
1129 	u8 energy;
1130 	u8 matching_feature;
1131 	u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN];
1132 } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_2 */
1133 
1134 /**
1135  * struct iwl_scan_offload_profiles_query - match results query response
1136  * @matched_profiles: bitmap of matched profiles, referencing the
1137  *	matches passed in the scan offload request
1138  * @last_scan_age: age of the last offloaded scan
1139  * @n_scans_done: number of offloaded scans done
1140  * @gp2_d0u: GP2 when D0U occurred
1141  * @gp2_invoked: GP2 when scan offload was invoked
1142  * @resume_while_scanning: not used
1143  * @self_recovery: obsolete
1144  * @reserved: reserved
1145  * @matches: array of match information, one for each match
1146  */
1147 struct iwl_scan_offload_profiles_query {
1148 	__le32 matched_profiles;
1149 	__le32 last_scan_age;
1150 	__le32 n_scans_done;
1151 	__le32 gp2_d0u;
1152 	__le32 gp2_invoked;
1153 	u8 resume_while_scanning;
1154 	u8 self_recovery;
1155 	__le16 reserved;
1156 	struct iwl_scan_offload_profile_match matches[0];
1157 } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_3 */
1158 
1159 /**
1160  * struct iwl_umac_scan_iter_complete_notif - notifies end of scanning iteration
1161  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1162  * @scanned_channels: number of channels scanned and number of valid elements in
1163  *	results array
1164  * @status: one of SCAN_COMP_STATUS_*
1165  * @bt_status: BT on/off status
1166  * @last_channel: last channel that was scanned
1167  * @start_tsf: TSF timer in usecs of the scan start time for the mac specified
1168  *	in &struct iwl_scan_req_umac.
1169  * @results: array of scan results, length in @scanned_channels
1170  */
1171 struct iwl_umac_scan_iter_complete_notif {
1172 	__le32 uid;
1173 	u8 scanned_channels;
1174 	u8 status;
1175 	u8 bt_status;
1176 	u8 last_channel;
1177 	__le64 start_tsf;
1178 	struct iwl_scan_results_notif results[];
1179 } __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_2 */
1180 
1181 #endif /* __iwl_fw_api_scan_h__ */
1182