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