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. Deprecated starting with
546  *     API version 5.
547  * @reserved: reserved
548  * @tx_chains: valid_tx antenna - ANT_* definitions
549  * @rx_chains: valid_rx antenna - ANT_* definitions
550  */
551 struct iwl_scan_config {
552 	u8 enable_cam_mode;
553 	u8 enable_promiscouos_mode;
554 	u8 bcast_sta_id;
555 	u8 reserved;
556 	__le32 tx_chains;
557 	__le32 rx_chains;
558 } __packed; /* SCAN_CONFIG_DB_CMD_API_S_5 */
559 
560 /**
561  * enum iwl_umac_scan_flags - UMAC scan flags
562  * @IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request
563  *	can be preempted by other scan requests with higher priority.
564  *	The low priority scan will be resumed when the higher proirity scan is
565  *	completed.
566  * @IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver
567  *	when scan starts.
568  */
569 enum iwl_umac_scan_flags {
570 	IWL_UMAC_SCAN_FLAG_PREEMPTIVE		= BIT(0),
571 	IWL_UMAC_SCAN_FLAG_START_NOTIF		= BIT(1),
572 };
573 
574 enum iwl_umac_scan_uid_offsets {
575 	IWL_UMAC_SCAN_UID_TYPE_OFFSET		= 0,
576 	IWL_UMAC_SCAN_UID_SEQ_OFFSET		= 8,
577 };
578 
579 enum iwl_umac_scan_general_flags {
580 	IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC		= BIT(0),
581 	IWL_UMAC_SCAN_GEN_FLAGS_OVER_BT			= BIT(1),
582 	IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL		= BIT(2),
583 	IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE			= BIT(3),
584 	IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT		= BIT(4),
585 	IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE		= BIT(5),
586 	IWL_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID		= BIT(6),
587 	IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED		= BIT(7),
588 	IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED		= BIT(8),
589 	IWL_UMAC_SCAN_GEN_FLAGS_MATCH			= BIT(9),
590 	IWL_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL		= BIT(10),
591 	/* Extended dwell is obselete when adaptive dwell is used, making this
592 	 * bit reusable. Hence, probe request defer is used only when adaptive
593 	 * dwell is supported. */
594 	IWL_UMAC_SCAN_GEN_FLAGS_PROB_REQ_DEFER_SUPP	= BIT(10),
595 	IWL_UMAC_SCAN_GEN_FLAGS_LMAC2_FRAGMENTED	= BIT(11),
596 	IWL_UMAC_SCAN_GEN_FLAGS_ADAPTIVE_DWELL		= BIT(13),
597 	IWL_UMAC_SCAN_GEN_FLAGS_MAX_CHNL_TIME		= BIT(14),
598 	IWL_UMAC_SCAN_GEN_FLAGS_PROB_REQ_HIGH_TX_RATE	= BIT(15),
599 };
600 
601 /**
602  * enum iwl_umac_scan_general_flags2 - UMAC scan general flags #2
603  * @IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL: Whether to send a complete
604  *	notification per channel or not.
605  * @IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER: Whether to allow channel
606  *	reorder optimization or not.
607  */
608 enum iwl_umac_scan_general_flags2 {
609 	IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL		= BIT(0),
610 	IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER	= BIT(1),
611 };
612 
613 /**
614  * enum iwl_umac_scan_general_flags_v2 - UMAC scan general flags version 2
615  *
616  * The FW flags were reordered and hence the driver introduce version 2
617  *
618  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_PERIODIC: periodic or scheduled
619  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_PASS_ALL: pass all probe responses and beacons
620  *                                       during scan iterations
621  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_NTFY_ITER_COMPLETE: send complete notification
622  *      on every iteration instead of only once after the last iteration
623  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC1: fragmented scan LMAC1
624  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC2: fragmented scan LMAC2
625  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_MATCH: does this scan check for profile matching
626  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_USE_ALL_RX_CHAINS: use all valid chains for RX
627  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_ADAPTIVE_DWELL: works with adaptive dwell
628  *                                             for active channel
629  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_PREEMPTIVE: can be preempted by other requests
630  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_NTF_START: send notification of scan start
631  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_MULTI_SSID: matching on multiple SSIDs
632  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE: all the channels scanned
633  *                                           as passive
634  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_TRIGGER_UHB_SCAN: at the end of 2.4GHz and
635  *		5.2Ghz bands scan, trigger scan on 6GHz band to discover
636  *		the reported collocated APs
637  */
638 enum iwl_umac_scan_general_flags_v2 {
639 	IWL_UMAC_SCAN_GEN_FLAGS_V2_PERIODIC             = BIT(0),
640 	IWL_UMAC_SCAN_GEN_FLAGS_V2_PASS_ALL             = BIT(1),
641 	IWL_UMAC_SCAN_GEN_FLAGS_V2_NTFY_ITER_COMPLETE   = BIT(2),
642 	IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC1     = BIT(3),
643 	IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC2     = BIT(4),
644 	IWL_UMAC_SCAN_GEN_FLAGS_V2_MATCH                = BIT(5),
645 	IWL_UMAC_SCAN_GEN_FLAGS_V2_USE_ALL_RX_CHAINS    = BIT(6),
646 	IWL_UMAC_SCAN_GEN_FLAGS_V2_ADAPTIVE_DWELL       = BIT(7),
647 	IWL_UMAC_SCAN_GEN_FLAGS_V2_PREEMPTIVE           = BIT(8),
648 	IWL_UMAC_SCAN_GEN_FLAGS_V2_NTF_START            = BIT(9),
649 	IWL_UMAC_SCAN_GEN_FLAGS_V2_MULTI_SSID           = BIT(10),
650 	IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE        = BIT(11),
651 	IWL_UMAC_SCAN_GEN_FLAGS_V2_TRIGGER_UHB_SCAN     = BIT(12),
652 };
653 
654 /**
655  * struct iwl_scan_channel_cfg_umac
656  * @flags:		bitmap - 0-19:	directed scan to i'th ssid.
657  * @channel_num:	channel number 1-13 etc.
658  * @band:		band of channel: 0 for 2GHz, 1 for 5GHz
659  * @iter_count:		repetition count for the channel.
660  * @iter_interval:	interval between two scan iterations on one channel.
661  */
662 struct  iwl_scan_channel_cfg_umac {
663 	__le32 flags;
664 	/* Both versions are of the same size, so use a union without adjusting
665 	 * the command size later
666 	 */
667 	union {
668 		struct {
669 			u8 channel_num;
670 			u8 iter_count;
671 			__le16 iter_interval;
672 		} v1;  /* SCAN_CHANNEL_CONFIG_API_S_VER_1 */
673 		struct {
674 			u8 channel_num;
675 			u8 band;
676 			u8 iter_count;
677 			u8 iter_interval;
678 		 } v2; /* SCAN_CHANNEL_CONFIG_API_S_VER_2
679 			* SCAN_CHANNEL_CONFIG_API_S_VER_3
680 			* SCAN_CHANNEL_CONFIG_API_S_VER_4
681 			*/
682 	};
683 } __packed;
684 
685 /**
686  * struct iwl_scan_umac_schedule
687  * @interval: interval in seconds between scan iterations
688  * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop
689  * @reserved: for alignment and future use
690  */
691 struct iwl_scan_umac_schedule {
692 	__le16 interval;
693 	u8 iter_count;
694 	u8 reserved;
695 } __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */
696 
697 struct iwl_scan_req_umac_tail_v1 {
698 	/* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
699 	struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
700 	__le16 delay;
701 	__le16 reserved;
702 	/* SCAN_PROBE_PARAMS_API_S_VER_1 */
703 	struct iwl_scan_probe_req_v1 preq;
704 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
705 } __packed;
706 
707 /**
708  * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command
709  *      parameters following channels configuration array.
710  * @schedule: two scheduling plans.
711  * @delay: delay in TUs before starting the first scan iteration
712  * @reserved: for future use and alignment
713  * @preq: probe request with IEs blocks
714  * @direct_scan: list of SSIDs for directed active scan
715  */
716 struct iwl_scan_req_umac_tail_v2 {
717 	/* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
718 	struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
719 	__le16 delay;
720 	__le16 reserved;
721 	/* SCAN_PROBE_PARAMS_API_S_VER_2 */
722 	struct iwl_scan_probe_req preq;
723 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
724 } __packed;
725 
726 /**
727  * struct iwl_scan_umac_chan_param
728  * @flags: channel flags &enum iwl_scan_channel_flags
729  * @count: num of channels in scan request
730  * @reserved: for future use and alignment
731  */
732 struct iwl_scan_umac_chan_param {
733 	u8 flags;
734 	u8 count;
735 	__le16 reserved;
736 } __packed; /*SCAN_CHANNEL_PARAMS_API_S_VER_1 */
737 
738 /**
739  * struct iwl_scan_req_umac
740  * @flags: &enum iwl_umac_scan_flags
741  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
742  * @ooc_priority: out of channel priority - &enum iwl_scan_priority
743  * @general_flags: &enum iwl_umac_scan_general_flags
744  * @scan_start_mac_id: report the scan start TSF time according to this mac TSF
745  * @extended_dwell: dwell time for channels 1, 6 and 11
746  * @active_dwell: dwell time for active scan per LMAC
747  * @passive_dwell: dwell time for passive scan per LMAC
748  * @fragmented_dwell: dwell time for fragmented passive scan
749  * @adwell_default_n_aps: for adaptive dwell the default number of APs
750  *	per channel
751  * @adwell_default_n_aps_social: for adaptive dwell the default
752  *	number of APs per social (1,6,11) channel
753  * @general_flags2: &enum iwl_umac_scan_general_flags2
754  * @adwell_max_budget: for adaptive dwell the maximal budget of TU to be added
755  *	to total scan time
756  * @max_out_time: max out of serving channel time, per LMAC - for CDB there
757  *	are 2 LMACs
758  * @suspend_time: max suspend time, per LMAC - for CDB there are 2 LMACs
759  * @scan_priority: scan internal prioritization &enum iwl_scan_priority
760  * @num_of_fragments: Number of fragments needed for full coverage per band.
761  *	Relevant only for fragmented scan.
762  * @channel: &struct iwl_scan_umac_chan_param
763  * @reserved: for future use and alignment
764  * @reserved3: for future use and alignment
765  * @data: &struct iwl_scan_channel_cfg_umac and
766  *	&struct iwl_scan_req_umac_tail
767  */
768 struct iwl_scan_req_umac {
769 	__le32 flags;
770 	__le32 uid;
771 	__le32 ooc_priority;
772 	__le16 general_flags;
773 	u8 reserved;
774 	u8 scan_start_mac_id;
775 	union {
776 		struct {
777 			u8 extended_dwell;
778 			u8 active_dwell;
779 			u8 passive_dwell;
780 			u8 fragmented_dwell;
781 			__le32 max_out_time;
782 			__le32 suspend_time;
783 			__le32 scan_priority;
784 			struct iwl_scan_umac_chan_param channel;
785 			u8 data[];
786 		} v1; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */
787 		struct {
788 			u8 extended_dwell;
789 			u8 active_dwell;
790 			u8 passive_dwell;
791 			u8 fragmented_dwell;
792 			__le32 max_out_time[SCAN_TWO_LMACS];
793 			__le32 suspend_time[SCAN_TWO_LMACS];
794 			__le32 scan_priority;
795 			struct iwl_scan_umac_chan_param channel;
796 			u8 data[];
797 		} v6; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_6 */
798 		struct {
799 			u8 active_dwell;
800 			u8 passive_dwell;
801 			u8 fragmented_dwell;
802 			u8 adwell_default_n_aps;
803 			u8 adwell_default_n_aps_social;
804 			u8 reserved3;
805 			__le16 adwell_max_budget;
806 			__le32 max_out_time[SCAN_TWO_LMACS];
807 			__le32 suspend_time[SCAN_TWO_LMACS];
808 			__le32 scan_priority;
809 			struct iwl_scan_umac_chan_param channel;
810 			u8 data[];
811 		} v7; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_7 */
812 		struct {
813 			u8 active_dwell[SCAN_TWO_LMACS];
814 			u8 reserved2;
815 			u8 adwell_default_n_aps;
816 			u8 adwell_default_n_aps_social;
817 			u8 general_flags2;
818 			__le16 adwell_max_budget;
819 			__le32 max_out_time[SCAN_TWO_LMACS];
820 			__le32 suspend_time[SCAN_TWO_LMACS];
821 			__le32 scan_priority;
822 			u8 passive_dwell[SCAN_TWO_LMACS];
823 			u8 num_of_fragments[SCAN_TWO_LMACS];
824 			struct iwl_scan_umac_chan_param channel;
825 			u8 data[];
826 		} v8; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_8 */
827 		struct {
828 			u8 active_dwell[SCAN_TWO_LMACS];
829 			u8 adwell_default_hb_n_aps;
830 			u8 adwell_default_lb_n_aps;
831 			u8 adwell_default_n_aps_social;
832 			u8 general_flags2;
833 			__le16 adwell_max_budget;
834 			__le32 max_out_time[SCAN_TWO_LMACS];
835 			__le32 suspend_time[SCAN_TWO_LMACS];
836 			__le32 scan_priority;
837 			u8 passive_dwell[SCAN_TWO_LMACS];
838 			u8 num_of_fragments[SCAN_TWO_LMACS];
839 			struct iwl_scan_umac_chan_param channel;
840 			u8 data[];
841 		} v9; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_9 */
842 	};
843 } __packed;
844 
845 #define IWL_SCAN_REQ_UMAC_SIZE_V8 sizeof(struct iwl_scan_req_umac)
846 #define IWL_SCAN_REQ_UMAC_SIZE_V7 48
847 #define IWL_SCAN_REQ_UMAC_SIZE_V6 44
848 #define IWL_SCAN_REQ_UMAC_SIZE_V1 36
849 
850 /**
851  * struct iwl_scan_probe_params_v3
852  * @preq: scan probe request params
853  * @ssid_num: number of valid SSIDs in direct scan array
854  * @short_ssid_num: number of valid short SSIDs in short ssid array
855  * @bssid_num: number of valid bssid in bssids array
856  * @reserved: reserved
857  * @direct_scan: list of ssids
858  * @short_ssid: array of short ssids
859  * @bssid_array: array of bssids
860  */
861 struct iwl_scan_probe_params_v3 {
862 	struct iwl_scan_probe_req preq;
863 	u8 ssid_num;
864 	u8 short_ssid_num;
865 	u8 bssid_num;
866 	u8 reserved;
867 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
868 	__le32 short_ssid[SCAN_SHORT_SSID_MAX_SIZE];
869 	u8 bssid_array[ETH_ALEN][SCAN_BSSID_MAX_SIZE];
870 } __packed; /* SCAN_PROBE_PARAMS_API_S_VER_3 */
871 
872 /**
873  * struct iwl_scan_probe_params_v4
874  * @preq: scan probe request params
875  * @short_ssid_num: number of valid short SSIDs in short ssid array
876  * @bssid_num: number of valid bssid in bssids array
877  * @reserved: reserved
878  * @direct_scan: list of ssids
879  * @short_ssid: array of short ssids
880  * @bssid_array: array of bssids
881  */
882 struct iwl_scan_probe_params_v4 {
883 	struct iwl_scan_probe_req preq;
884 	u8 short_ssid_num;
885 	u8 bssid_num;
886 	__le16 reserved;
887 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
888 	__le32 short_ssid[SCAN_SHORT_SSID_MAX_SIZE];
889 	u8 bssid_array[ETH_ALEN][SCAN_BSSID_MAX_SIZE];
890 } __packed; /* SCAN_PROBE_PARAMS_API_S_VER_4 */
891 
892 #define SCAN_MAX_NUM_CHANS_V3 67
893 
894 /**
895  * struct iwl_scan_channel_params_v4
896  * @flags: channel flags &enum iwl_scan_channel_flags
897  * @count: num of channels in scan request
898  * @num_of_aps_override: override the number of APs the FW uses to calculate
899  *	dwell time when adaptive dwell is used
900  * @reserved: for future use and alignment
901  * @channel_config: array of explicit channel configurations
902  *                  for 2.4Ghz and 5.2Ghz bands
903  * @adwell_ch_override_bitmap: when using adaptive dwell, override the number
904  *	of APs value with &num_of_aps_override for the channel.
905  *	To cast channel to index, use &iwl_mvm_scan_ch_and_band_to_idx
906  */
907 struct iwl_scan_channel_params_v4 {
908 	u8 flags;
909 	u8 count;
910 	u8 num_of_aps_override;
911 	u8 reserved;
912 	struct iwl_scan_channel_cfg_umac channel_config[SCAN_MAX_NUM_CHANS_V3];
913 	u8 adwell_ch_override_bitmap[16];
914 } __packed; /* SCAN_CHANNEL_PARAMS_API_S_VER_4 also
915 	       SCAN_CHANNEL_PARAMS_API_S_VER_5 */
916 
917 /**
918  * struct iwl_scan_channel_params_v6
919  * @flags: channel flags &enum iwl_scan_channel_flags
920  * @count: num of channels in scan request
921  * @n_aps_override: override the number of APs the FW uses to calculate dwell
922  *	time when adaptive dwell is used.
923  *	Channel k will use n_aps_override[i] when BIT(20 + i) is set in
924  *	channel_config[k].flags
925  * @channel_config: array of explicit channel configurations
926  *                  for 2.4Ghz and 5.2Ghz bands
927  */
928 struct iwl_scan_channel_params_v6 {
929 	u8 flags;
930 	u8 count;
931 	u8 n_aps_override[2];
932 	struct iwl_scan_channel_cfg_umac channel_config[SCAN_MAX_NUM_CHANS_V3];
933 } __packed; /* SCAN_CHANNEL_PARAMS_API_S_VER_6 */
934 
935 /**
936  * struct iwl_scan_general_params_v10
937  * @flags: &enum iwl_umac_scan_flags
938  * @reserved: reserved for future
939  * @scan_start_mac_id: report the scan start TSF time according to this mac TSF
940  * @active_dwell: dwell time for active scan per LMAC
941  * @adwell_default_2g: adaptive dwell default number of APs
942  *                        for 2.4GHz channel
943  * @adwell_default_5g: adaptive dwell default number of APs
944  *                        for 5GHz channels
945  * @adwell_default_social_chn: adaptive dwell default number of
946  *                             APs per social channel
947  * @reserved1: reserved for future
948  * @adwell_max_budget: the maximal number of TUs that adaptive dwell
949  *                     can add to the total scan time
950  * @max_out_of_time: max out of serving channel time, per LMAC
951  * @suspend_time: max suspend time, per LMAC
952  * @scan_priority: priority of the request
953  * @passive_dwell: continues dwell time for passive channel
954  *                 (without adaptive dwell)
955  * @num_of_fragments: number of fragments needed for full fragmented
956  *                    scan coverage.
957  */
958 struct iwl_scan_general_params_v10 {
959 	__le16 flags;
960 	u8 reserved;
961 	u8 scan_start_mac_id;
962 	u8 active_dwell[SCAN_TWO_LMACS];
963 	u8 adwell_default_2g;
964 	u8 adwell_default_5g;
965 	u8 adwell_default_social_chn;
966 	u8 reserved1;
967 	__le16 adwell_max_budget;
968 	__le32 max_out_of_time[SCAN_TWO_LMACS];
969 	__le32 suspend_time[SCAN_TWO_LMACS];
970 	__le32 scan_priority;
971 	u8 passive_dwell[SCAN_TWO_LMACS];
972 	u8 num_of_fragments[SCAN_TWO_LMACS];
973 } __packed; /* SCAN_GENERAL_PARAMS_API_S_VER_10 */
974 
975 /**
976  * struct iwl_scan_periodic_parms_v1
977  * @schedule: can scheduling parameter
978  * @delay: initial delay of the periodic scan in seconds
979  * @reserved: reserved for future
980  */
981 struct iwl_scan_periodic_parms_v1 {
982 	struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
983 	__le16 delay;
984 	__le16 reserved;
985 } __packed; /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
986 
987 /**
988  * struct iwl_scan_req_params_v12
989  * @general_params: &struct iwl_scan_general_params_v10
990  * @channel_params: &struct iwl_scan_channel_params_v4
991  * @periodic_params: &struct iwl_scan_periodic_parms_v1
992  * @probe_params: &struct iwl_scan_probe_params_v3
993  */
994 struct iwl_scan_req_params_v12 {
995 	struct iwl_scan_general_params_v10 general_params;
996 	struct iwl_scan_channel_params_v4 channel_params;
997 	struct iwl_scan_periodic_parms_v1 periodic_params;
998 	struct iwl_scan_probe_params_v3 probe_params;
999 } __packed; /* SCAN_REQUEST_PARAMS_API_S_VER_12 */
1000 
1001 /**
1002  * struct iwl_scan_req_params_v14
1003  * @general_params: &struct iwl_scan_general_params_v10
1004  * @channel_params: &struct iwl_scan_channel_params_v6
1005  * @periodic_params: &struct iwl_scan_periodic_parms_v1
1006  * @probe_params: &struct iwl_scan_probe_params_v4
1007  */
1008 struct iwl_scan_req_params_v14 {
1009 	struct iwl_scan_general_params_v10 general_params;
1010 	struct iwl_scan_channel_params_v6 channel_params;
1011 	struct iwl_scan_periodic_parms_v1 periodic_params;
1012 	struct iwl_scan_probe_params_v4 probe_params;
1013 } __packed; /* SCAN_REQUEST_PARAMS_API_S_VER_14 */
1014 
1015 /**
1016  * struct iwl_scan_req_umac_v12
1017  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1018  * @ooc_priority: out of channel priority - &enum iwl_scan_priority
1019  * @scan_params: scan parameters
1020  */
1021 struct iwl_scan_req_umac_v12 {
1022 	__le32 uid;
1023 	__le32 ooc_priority;
1024 	struct iwl_scan_req_params_v12 scan_params;
1025 } __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_12 */
1026 
1027 /**
1028  * struct iwl_scan_req_umac_v14
1029  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1030  * @ooc_priority: out of channel priority - &enum iwl_scan_priority
1031  * @scan_params: scan parameters
1032  */
1033 struct iwl_scan_req_umac_v14 {
1034 	__le32 uid;
1035 	__le32 ooc_priority;
1036 	struct iwl_scan_req_params_v14 scan_params;
1037 } __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_14 */
1038 
1039 /**
1040  * struct iwl_umac_scan_abort
1041  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1042  * @flags: reserved
1043  */
1044 struct iwl_umac_scan_abort {
1045 	__le32 uid;
1046 	__le32 flags;
1047 } __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */
1048 
1049 /**
1050  * struct iwl_umac_scan_complete
1051  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1052  * @last_schedule: last scheduling line
1053  * @last_iter: last scan iteration number
1054  * @status: &enum iwl_scan_offload_complete_status
1055  * @ebs_status: &enum iwl_scan_ebs_status
1056  * @time_from_last_iter: time elapsed from last iteration
1057  * @reserved: for future use
1058  */
1059 struct iwl_umac_scan_complete {
1060 	__le32 uid;
1061 	u8 last_schedule;
1062 	u8 last_iter;
1063 	u8 status;
1064 	u8 ebs_status;
1065 	__le32 time_from_last_iter;
1066 	__le32 reserved;
1067 } __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */
1068 
1069 #define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1 5
1070 #define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN    7
1071 
1072 /**
1073  * struct iwl_scan_offload_profile_match_v1 - match information
1074  * @bssid: matched bssid
1075  * @reserved: reserved
1076  * @channel: channel where the match occurred
1077  * @energy: energy
1078  * @matching_feature: feature matches
1079  * @matching_channels: bitmap of channels that matched, referencing
1080  *	the channels passed in the scan offload request.
1081  */
1082 struct iwl_scan_offload_profile_match_v1 {
1083 	u8 bssid[ETH_ALEN];
1084 	__le16 reserved;
1085 	u8 channel;
1086 	u8 energy;
1087 	u8 matching_feature;
1088 	u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1];
1089 } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_1 */
1090 
1091 /**
1092  * struct iwl_scan_offload_profiles_query_v1 - match results query response
1093  * @matched_profiles: bitmap of matched profiles, referencing the
1094  *	matches passed in the scan offload request
1095  * @last_scan_age: age of the last offloaded scan
1096  * @n_scans_done: number of offloaded scans done
1097  * @gp2_d0u: GP2 when D0U occurred
1098  * @gp2_invoked: GP2 when scan offload was invoked
1099  * @resume_while_scanning: not used
1100  * @self_recovery: obsolete
1101  * @reserved: reserved
1102  * @matches: array of match information, one for each match
1103  */
1104 struct iwl_scan_offload_profiles_query_v1 {
1105 	__le32 matched_profiles;
1106 	__le32 last_scan_age;
1107 	__le32 n_scans_done;
1108 	__le32 gp2_d0u;
1109 	__le32 gp2_invoked;
1110 	u8 resume_while_scanning;
1111 	u8 self_recovery;
1112 	__le16 reserved;
1113 	struct iwl_scan_offload_profile_match_v1 matches[0];
1114 } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */
1115 
1116 /**
1117  * struct iwl_scan_offload_profile_match - match information
1118  * @bssid: matched bssid
1119  * @reserved: reserved
1120  * @channel: channel where the match occurred
1121  * @energy: energy
1122  * @matching_feature: feature matches
1123  * @matching_channels: bitmap of channels that matched, referencing
1124  *	the channels passed in the scan offload request.
1125  */
1126 struct iwl_scan_offload_profile_match {
1127 	u8 bssid[ETH_ALEN];
1128 	__le16 reserved;
1129 	u8 channel;
1130 	u8 energy;
1131 	u8 matching_feature;
1132 	u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN];
1133 } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_2 */
1134 
1135 /**
1136  * struct iwl_scan_offload_profiles_query - match results query response
1137  * @matched_profiles: bitmap of matched profiles, referencing the
1138  *	matches passed in the scan offload request
1139  * @last_scan_age: age of the last offloaded scan
1140  * @n_scans_done: number of offloaded scans done
1141  * @gp2_d0u: GP2 when D0U occurred
1142  * @gp2_invoked: GP2 when scan offload was invoked
1143  * @resume_while_scanning: not used
1144  * @self_recovery: obsolete
1145  * @reserved: reserved
1146  * @matches: array of match information, one for each match
1147  */
1148 struct iwl_scan_offload_profiles_query {
1149 	__le32 matched_profiles;
1150 	__le32 last_scan_age;
1151 	__le32 n_scans_done;
1152 	__le32 gp2_d0u;
1153 	__le32 gp2_invoked;
1154 	u8 resume_while_scanning;
1155 	u8 self_recovery;
1156 	__le16 reserved;
1157 	struct iwl_scan_offload_profile_match matches[0];
1158 } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_3 */
1159 
1160 /**
1161  * struct iwl_umac_scan_iter_complete_notif - notifies end of scanning iteration
1162  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1163  * @scanned_channels: number of channels scanned and number of valid elements in
1164  *	results array
1165  * @status: one of SCAN_COMP_STATUS_*
1166  * @bt_status: BT on/off status
1167  * @last_channel: last channel that was scanned
1168  * @start_tsf: TSF timer in usecs of the scan start time for the mac specified
1169  *	in &struct iwl_scan_req_umac.
1170  * @results: array of scan results, length in @scanned_channels
1171  */
1172 struct iwl_umac_scan_iter_complete_notif {
1173 	__le32 uid;
1174 	u8 scanned_channels;
1175 	u8 status;
1176 	u8 bt_status;
1177 	u8 last_channel;
1178 	__le64 start_tsf;
1179 	struct iwl_scan_results_notif results[];
1180 } __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_2 */
1181 
1182 #endif /* __iwl_fw_api_scan_h__ */
1183