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