]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h
Merge tag 'iwlwifi-next-for-kalle-2015-08-04' of https://git.kernel.org/pub/scm/linux...
[mirror_ubuntu-zesty-kernel.git] / drivers / net / wireless / iwlwifi / mvm / 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 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
23 * USA
24 *
25 * The full GNU General Public License is included in this distribution
26 * in the file called COPYING.
27 *
28 * Contact Information:
29 * Intel Linux Wireless <ilw@linux.intel.com>
30 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
31 *
32 * BSD LICENSE
33 *
34 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
35 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
36 * All rights reserved.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 *
42 * * Redistributions of source code must retain the above copyright
43 * notice, this list of conditions and the following disclaimer.
44 * * Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in
46 * the documentation and/or other materials provided with the
47 * distribution.
48 * * Neither the name Intel Corporation nor the names of its
49 * contributors may be used to endorse or promote products derived
50 * from this software without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
53 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
54 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
55 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
56 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
57 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
58 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
59 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
60 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
62 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 *
64 *****************************************************************************/
65
66 #ifndef __fw_api_scan_h__
67 #define __fw_api_scan_h__
68
69 #include "fw-api.h"
70
71 /* Scan Commands, Responses, Notifications */
72
73 /* Max number of IEs for direct SSID scans in a command */
74 #define PROBE_OPTION_MAX 20
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 struct iwl_ssid_ie {
85 u8 id;
86 u8 len;
87 u8 ssid[IEEE80211_MAX_SSID_LEN];
88 } __packed; /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
89
90 /* scan offload */
91 #define IWL_SCAN_MAX_BLACKLIST_LEN 64
92 #define IWL_SCAN_SHORT_BLACKLIST_LEN 16
93 #define IWL_SCAN_MAX_PROFILES 11
94 #define SCAN_OFFLOAD_PROBE_REQ_SIZE 512
95
96 /* Default watchdog (in MS) for scheduled scan iteration */
97 #define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
98
99 #define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
100 #define CAN_ABORT_STATUS 1
101
102 #define IWL_FULL_SCAN_MULTIPLIER 5
103 #define IWL_FAST_SCHED_SCAN_ITERATIONS 3
104
105 enum scan_framework_client {
106 SCAN_CLIENT_SCHED_SCAN = BIT(0),
107 SCAN_CLIENT_NETDETECT = BIT(1),
108 SCAN_CLIENT_ASSET_TRACKING = BIT(2),
109 };
110
111 /**
112 * iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S
113 * @ssid: MAC address to filter out
114 * @reported_rssi: AP rssi reported to the host
115 * @client_bitmap: clients ignore this entry - enum scan_framework_client
116 */
117 struct iwl_scan_offload_blacklist {
118 u8 ssid[ETH_ALEN];
119 u8 reported_rssi;
120 u8 client_bitmap;
121 } __packed;
122
123 enum iwl_scan_offload_network_type {
124 IWL_NETWORK_TYPE_BSS = 1,
125 IWL_NETWORK_TYPE_IBSS = 2,
126 IWL_NETWORK_TYPE_ANY = 3,
127 };
128
129 enum iwl_scan_offload_band_selection {
130 IWL_SCAN_OFFLOAD_SELECT_2_4 = 0x4,
131 IWL_SCAN_OFFLOAD_SELECT_5_2 = 0x8,
132 IWL_SCAN_OFFLOAD_SELECT_ANY = 0xc,
133 };
134
135 /**
136 * iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S
137 * @ssid_index: index to ssid list in fixed part
138 * @unicast_cipher: encryption algorithm to match - bitmap
139 * @aut_alg: authentication algorithm to match - bitmap
140 * @network_type: enum iwl_scan_offload_network_type
141 * @band_selection: enum iwl_scan_offload_band_selection
142 * @client_bitmap: clients waiting for match - enum scan_framework_client
143 */
144 struct iwl_scan_offload_profile {
145 u8 ssid_index;
146 u8 unicast_cipher;
147 u8 auth_alg;
148 u8 network_type;
149 u8 band_selection;
150 u8 client_bitmap;
151 u8 reserved[2];
152 } __packed;
153
154 /**
155 * iwl_scan_offload_profile_cfg - SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1
156 * @blaclist: AP list to filter off from scan results
157 * @profiles: profiles to search for match
158 * @blacklist_len: length of blacklist
159 * @num_profiles: num of profiles in the list
160 * @match_notify: clients waiting for match found notification
161 * @pass_match: clients waiting for the results
162 * @active_clients: active clients bitmap - enum scan_framework_client
163 * @any_beacon_notify: clients waiting for match notification without match
164 */
165 struct iwl_scan_offload_profile_cfg {
166 struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
167 u8 blacklist_len;
168 u8 num_profiles;
169 u8 match_notify;
170 u8 pass_match;
171 u8 active_clients;
172 u8 any_beacon_notify;
173 u8 reserved[2];
174 } __packed;
175
176 /**
177 * iwl_scan_schedule_lmac - schedule of scan offload
178 * @delay: delay between iterations, in seconds.
179 * @iterations: num of scan iterations
180 * @full_scan_mul: number of partial scans before each full scan
181 */
182 struct iwl_scan_schedule_lmac {
183 __le16 delay;
184 u8 iterations;
185 u8 full_scan_mul;
186 } __packed; /* SCAN_SCHEDULE_API_S */
187
188 enum iwl_scan_offload_complete_status {
189 IWL_SCAN_OFFLOAD_COMPLETED = 1,
190 IWL_SCAN_OFFLOAD_ABORTED = 2,
191 };
192
193 enum iwl_scan_ebs_status {
194 IWL_SCAN_EBS_SUCCESS,
195 IWL_SCAN_EBS_FAILED,
196 IWL_SCAN_EBS_CHAN_NOT_FOUND,
197 IWL_SCAN_EBS_INACTIVE,
198 };
199
200 /**
201 * iwl_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S
202 * @tx_flags: combination of TX_CMD_FLG_*
203 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
204 * cleared. Combination of RATE_MCS_*
205 * @sta_id: index of destination station in FW station table
206 * @reserved: for alignment and future use
207 */
208 struct iwl_scan_req_tx_cmd {
209 __le32 tx_flags;
210 __le32 rate_n_flags;
211 u8 sta_id;
212 u8 reserved[3];
213 } __packed;
214
215 enum iwl_scan_channel_flags_lmac {
216 IWL_UNIFIED_SCAN_CHANNEL_FULL = BIT(27),
217 IWL_UNIFIED_SCAN_CHANNEL_PARTIAL = BIT(28),
218 };
219
220 /**
221 * iwl_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2
222 * @flags: bits 1-20: directed scan to i'th ssid
223 * other bits &enum iwl_scan_channel_flags_lmac
224 * @channel_number: channel number 1-13 etc
225 * @iter_count: scan iteration on this channel
226 * @iter_interval: interval in seconds between iterations on one channel
227 */
228 struct iwl_scan_channel_cfg_lmac {
229 __le32 flags;
230 __le16 channel_num;
231 __le16 iter_count;
232 __le32 iter_interval;
233 } __packed;
234
235 /*
236 * iwl_scan_probe_segment - PROBE_SEGMENT_API_S_VER_1
237 * @offset: offset in the data block
238 * @len: length of the segment
239 */
240 struct iwl_scan_probe_segment {
241 __le16 offset;
242 __le16 len;
243 } __packed;
244
245 /* iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_2
246 * @mac_header: first (and common) part of the probe
247 * @band_data: band specific data
248 * @common_data: last (and common) part of the probe
249 * @buf: raw data block
250 */
251 struct iwl_scan_probe_req {
252 struct iwl_scan_probe_segment mac_header;
253 struct iwl_scan_probe_segment band_data[2];
254 struct iwl_scan_probe_segment common_data;
255 u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
256 } __packed;
257
258 enum iwl_scan_channel_flags {
259 IWL_SCAN_CHANNEL_FLAG_EBS = BIT(0),
260 IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE = BIT(1),
261 IWL_SCAN_CHANNEL_FLAG_CACHE_ADD = BIT(2),
262 };
263
264 /* iwl_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S
265 * @flags: enum iwl_scan_channel_flags
266 * @non_ebs_ratio: defines the ratio of number of scan iterations where EBS is
267 * involved.
268 * 1 - EBS is disabled.
269 * 2 - every second scan will be full scan(and so on).
270 */
271 struct iwl_scan_channel_opt {
272 __le16 flags;
273 __le16 non_ebs_ratio;
274 } __packed;
275
276 /**
277 * iwl_mvm_lmac_scan_flags
278 * @IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses
279 * without filtering.
280 * @IWL_MVM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels
281 * @IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan
282 * @IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification
283 * @IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS multiple SSID matching
284 * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented
285 * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report
286 * and DS parameter set IEs into probe requests.
287 * @IWL_MVM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches
288 */
289 enum iwl_mvm_lmac_scan_flags {
290 IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL = BIT(0),
291 IWL_MVM_LMAC_SCAN_FLAG_PASSIVE = BIT(1),
292 IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION = BIT(2),
293 IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE = BIT(3),
294 IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = BIT(4),
295 IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED = BIT(5),
296 IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6),
297 IWL_MVM_LMAC_SCAN_FLAG_MATCH = BIT(9),
298 };
299
300 enum iwl_scan_priority {
301 IWL_SCAN_PRIORITY_LOW,
302 IWL_SCAN_PRIORITY_MEDIUM,
303 IWL_SCAN_PRIORITY_HIGH,
304 };
305
306 enum iwl_scan_priority_ext {
307 IWL_SCAN_PRIORITY_EXT_0_LOWEST,
308 IWL_SCAN_PRIORITY_EXT_1,
309 IWL_SCAN_PRIORITY_EXT_2,
310 IWL_SCAN_PRIORITY_EXT_3,
311 IWL_SCAN_PRIORITY_EXT_4,
312 IWL_SCAN_PRIORITY_EXT_5,
313 IWL_SCAN_PRIORITY_EXT_6,
314 IWL_SCAN_PRIORITY_EXT_7_HIGHEST,
315 };
316
317 /**
318 * iwl_scan_req_lmac - SCAN_REQUEST_CMD_API_S_VER_1
319 * @reserved1: for alignment and future use
320 * @channel_num: num of channels to scan
321 * @active-dwell: dwell time for active channels
322 * @passive-dwell: dwell time for passive channels
323 * @fragmented-dwell: dwell time for fragmented passive scan
324 * @reserved2: for alignment and future use
325 * @rx_chain_selct: PHY_RX_CHAIN_* flags
326 * @scan_flags: &enum iwl_mvm_lmac_scan_flags
327 * @max_out_time: max time (in TU) to be out of associated channel
328 * @suspend_time: pause scan this long (TUs) when returning to service channel
329 * @flags: RXON flags
330 * @filter_flags: RXON filter
331 * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz
332 * @direct_scan: list of SSIDs for directed active scan
333 * @scan_prio: enum iwl_scan_priority
334 * @iter_num: number of scan iterations
335 * @delay: delay in seconds before first iteration
336 * @schedule: two scheduling plans. The first one is finite, the second one can
337 * be infinite.
338 * @channel_opt: channel optimization options, for full and partial scan
339 * @data: channel configuration and probe request packet.
340 */
341 struct iwl_scan_req_lmac {
342 /* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */
343 __le32 reserved1;
344 u8 n_channels;
345 u8 active_dwell;
346 u8 passive_dwell;
347 u8 fragmented_dwell;
348 __le16 reserved2;
349 __le16 rx_chain_select;
350 __le32 scan_flags;
351 __le32 max_out_time;
352 __le32 suspend_time;
353 /* RX_ON_FLAGS_API_S_VER_1 */
354 __le32 flags;
355 __le32 filter_flags;
356 struct iwl_scan_req_tx_cmd tx_cmd[2];
357 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
358 __le32 scan_prio;
359 /* SCAN_REQ_PERIODIC_PARAMS_API_S */
360 __le32 iter_num;
361 __le32 delay;
362 struct iwl_scan_schedule_lmac schedule[2];
363 struct iwl_scan_channel_opt channel_opt[2];
364 u8 data[];
365 } __packed;
366
367 /**
368 * struct iwl_scan_results_notif - scan results for one channel -
369 * SCAN_RESULT_NTF_API_S_VER_3
370 * @channel: which channel the results are from
371 * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
372 * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
373 * @num_probe_not_sent: # of request that weren't sent due to not enough time
374 * @duration: duration spent in channel, in usecs
375 */
376 struct iwl_scan_results_notif {
377 u8 channel;
378 u8 band;
379 u8 probe_status;
380 u8 num_probe_not_sent;
381 __le32 duration;
382 } __packed;
383
384 /**
385 * struct iwl_lmac_scan_complete_notif - notifies end of scanning (all channels)
386 * SCAN_COMPLETE_NTF_API_S_VER_3
387 * @scanned_channels: number of channels scanned (and number of valid results)
388 * @status: one of SCAN_COMP_STATUS_*
389 * @bt_status: BT on/off status
390 * @last_channel: last channel that was scanned
391 * @tsf_low: TSF timer (lower half) in usecs
392 * @tsf_high: TSF timer (higher half) in usecs
393 * @results: an array of scan results, only "scanned_channels" of them are valid
394 */
395 struct iwl_lmac_scan_complete_notif {
396 u8 scanned_channels;
397 u8 status;
398 u8 bt_status;
399 u8 last_channel;
400 __le32 tsf_low;
401 __le32 tsf_high;
402 struct iwl_scan_results_notif results[];
403 } __packed;
404
405 /**
406 * iwl_scan_offload_complete - PERIODIC_SCAN_COMPLETE_NTF_API_S_VER_2
407 * @last_schedule_line: last schedule line executed (fast or regular)
408 * @last_schedule_iteration: last scan iteration executed before scan abort
409 * @status: enum iwl_scan_offload_complete_status
410 * @ebs_status: EBS success status &enum iwl_scan_ebs_status
411 * @time_after_last_iter; time in seconds elapsed after last iteration
412 */
413 struct iwl_periodic_scan_complete {
414 u8 last_schedule_line;
415 u8 last_schedule_iteration;
416 u8 status;
417 u8 ebs_status;
418 __le32 time_after_last_iter;
419 __le32 reserved;
420 } __packed;
421
422 /* UMAC Scan API */
423
424 /* The maximum of either of these cannot exceed 8, because we use an
425 * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h).
426 */
427 #define IWL_MVM_MAX_UMAC_SCANS 8
428 #define IWL_MVM_MAX_LMAC_SCANS 1
429
430 enum scan_config_flags {
431 SCAN_CONFIG_FLAG_ACTIVATE = BIT(0),
432 SCAN_CONFIG_FLAG_DEACTIVATE = BIT(1),
433 SCAN_CONFIG_FLAG_FORBID_CHUB_REQS = BIT(2),
434 SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS = BIT(3),
435 SCAN_CONFIG_FLAG_SET_TX_CHAINS = BIT(8),
436 SCAN_CONFIG_FLAG_SET_RX_CHAINS = BIT(9),
437 SCAN_CONFIG_FLAG_SET_AUX_STA_ID = BIT(10),
438 SCAN_CONFIG_FLAG_SET_ALL_TIMES = BIT(11),
439 SCAN_CONFIG_FLAG_SET_EFFECTIVE_TIMES = BIT(12),
440 SCAN_CONFIG_FLAG_SET_CHANNEL_FLAGS = BIT(13),
441 SCAN_CONFIG_FLAG_SET_LEGACY_RATES = BIT(14),
442 SCAN_CONFIG_FLAG_SET_MAC_ADDR = BIT(15),
443 SCAN_CONFIG_FLAG_SET_FRAGMENTED = BIT(16),
444 SCAN_CONFIG_FLAG_CLEAR_FRAGMENTED = BIT(17),
445 SCAN_CONFIG_FLAG_SET_CAM_MODE = BIT(18),
446 SCAN_CONFIG_FLAG_CLEAR_CAM_MODE = BIT(19),
447 SCAN_CONFIG_FLAG_SET_PROMISC_MODE = BIT(20),
448 SCAN_CONFIG_FLAG_CLEAR_PROMISC_MODE = BIT(21),
449
450 /* Bits 26-31 are for num of channels in channel_array */
451 #define SCAN_CONFIG_N_CHANNELS(n) ((n) << 26)
452 };
453
454 enum scan_config_rates {
455 /* OFDM basic rates */
456 SCAN_CONFIG_RATE_6M = BIT(0),
457 SCAN_CONFIG_RATE_9M = BIT(1),
458 SCAN_CONFIG_RATE_12M = BIT(2),
459 SCAN_CONFIG_RATE_18M = BIT(3),
460 SCAN_CONFIG_RATE_24M = BIT(4),
461 SCAN_CONFIG_RATE_36M = BIT(5),
462 SCAN_CONFIG_RATE_48M = BIT(6),
463 SCAN_CONFIG_RATE_54M = BIT(7),
464 /* CCK basic rates */
465 SCAN_CONFIG_RATE_1M = BIT(8),
466 SCAN_CONFIG_RATE_2M = BIT(9),
467 SCAN_CONFIG_RATE_5M = BIT(10),
468 SCAN_CONFIG_RATE_11M = BIT(11),
469
470 /* Bits 16-27 are for supported rates */
471 #define SCAN_CONFIG_SUPPORTED_RATE(rate) ((rate) << 16)
472 };
473
474 enum iwl_channel_flags {
475 IWL_CHANNEL_FLAG_EBS = BIT(0),
476 IWL_CHANNEL_FLAG_ACCURATE_EBS = BIT(1),
477 IWL_CHANNEL_FLAG_EBS_ADD = BIT(2),
478 IWL_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE = BIT(3),
479 };
480
481 /**
482 * struct iwl_scan_config
483 * @flags: enum scan_config_flags
484 * @tx_chains: valid_tx antenna - ANT_* definitions
485 * @rx_chains: valid_rx antenna - ANT_* definitions
486 * @legacy_rates: default legacy rates - enum scan_config_rates
487 * @out_of_channel_time: default max out of serving channel time
488 * @suspend_time: default max suspend time
489 * @dwell_active: default dwell time for active scan
490 * @dwell_passive: default dwell time for passive scan
491 * @dwell_fragmented: default dwell time for fragmented scan
492 * @reserved: for future use and alignment
493 * @mac_addr: default mac address to be used in probes
494 * @bcast_sta_id: the index of the station in the fw
495 * @channel_flags: default channel flags - enum iwl_channel_flags
496 * scan_config_channel_flag
497 * @channel_array: default supported channels
498 */
499 struct iwl_scan_config {
500 __le32 flags;
501 __le32 tx_chains;
502 __le32 rx_chains;
503 __le32 legacy_rates;
504 __le32 out_of_channel_time;
505 __le32 suspend_time;
506 u8 dwell_active;
507 u8 dwell_passive;
508 u8 dwell_fragmented;
509 u8 reserved;
510 u8 mac_addr[ETH_ALEN];
511 u8 bcast_sta_id;
512 u8 channel_flags;
513 u8 channel_array[];
514 } __packed; /* SCAN_CONFIG_DB_CMD_API_S */
515
516 /**
517 * iwl_umac_scan_flags
518 *@IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request
519 * can be preempted by other scan requests with higher priority.
520 * The low priority scan will be resumed when the higher proirity scan is
521 * completed.
522 *@IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver
523 * when scan starts.
524 */
525 enum iwl_umac_scan_flags {
526 IWL_UMAC_SCAN_FLAG_PREEMPTIVE = BIT(0),
527 IWL_UMAC_SCAN_FLAG_START_NOTIF = BIT(1),
528 };
529
530 enum iwl_umac_scan_uid_offsets {
531 IWL_UMAC_SCAN_UID_TYPE_OFFSET = 0,
532 IWL_UMAC_SCAN_UID_SEQ_OFFSET = 8,
533 };
534
535 enum iwl_umac_scan_general_flags {
536 IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC = BIT(0),
537 IWL_UMAC_SCAN_GEN_FLAGS_OVER_BT = BIT(1),
538 IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL = BIT(2),
539 IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE = BIT(3),
540 IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT = BIT(4),
541 IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE = BIT(5),
542 IWL_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID = BIT(6),
543 IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED = BIT(7),
544 IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED = BIT(8),
545 IWL_UMAC_SCAN_GEN_FLAGS_MATCH = BIT(9)
546 };
547
548 /**
549 * struct iwl_scan_channel_cfg_umac
550 * @flags: bitmap - 0-19: directed scan to i'th ssid.
551 * @channel_num: channel number 1-13 etc.
552 * @iter_count: repetition count for the channel.
553 * @iter_interval: interval between two scan iterations on one channel.
554 */
555 struct iwl_scan_channel_cfg_umac {
556 __le32 flags;
557 u8 channel_num;
558 u8 iter_count;
559 __le16 iter_interval;
560 } __packed; /* SCAN_CHANNEL_CFG_S_VER2 */
561
562 /**
563 * struct iwl_scan_umac_schedule
564 * @interval: interval in seconds between scan iterations
565 * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop
566 * @reserved: for alignment and future use
567 */
568 struct iwl_scan_umac_schedule {
569 __le16 interval;
570 u8 iter_count;
571 u8 reserved;
572 } __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */
573
574 /**
575 * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command
576 * parameters following channels configuration array.
577 * @schedule: two scheduling plans.
578 * @delay: delay in TUs before starting the first scan iteration
579 * @reserved: for future use and alignment
580 * @preq: probe request with IEs blocks
581 * @direct_scan: list of SSIDs for directed active scan
582 */
583 struct iwl_scan_req_umac_tail {
584 /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
585 struct iwl_scan_umac_schedule schedule[2];
586 __le16 delay;
587 __le16 reserved;
588 /* SCAN_PROBE_PARAMS_API_S_VER_1 */
589 struct iwl_scan_probe_req preq;
590 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
591 } __packed;
592
593 /**
594 * struct iwl_scan_req_umac
595 * @flags: &enum iwl_umac_scan_flags
596 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
597 * @ooc_priority: out of channel priority - &enum iwl_scan_priority
598 * @general_flags: &enum iwl_umac_scan_general_flags
599 * @reserved1: for future use and alignment
600 * @active_dwell: dwell time for active scan
601 * @passive_dwell: dwell time for passive scan
602 * @fragmented_dwell: dwell time for fragmented passive scan
603 * @max_out_time: max out of serving channel time
604 * @suspend_time: max suspend time
605 * @scan_priority: scan internal prioritization &enum iwl_scan_priority
606 * @channel_flags: &enum iwl_scan_channel_flags
607 * @n_channels: num of channels in scan request
608 * @reserved2: for future use and alignment
609 * @data: &struct iwl_scan_channel_cfg_umac and
610 * &struct iwl_scan_req_umac_tail
611 */
612 struct iwl_scan_req_umac {
613 __le32 flags;
614 __le32 uid;
615 __le32 ooc_priority;
616 /* SCAN_GENERAL_PARAMS_API_S_VER_1 */
617 __le32 general_flags;
618 u8 reserved1;
619 u8 active_dwell;
620 u8 passive_dwell;
621 u8 fragmented_dwell;
622 __le32 max_out_time;
623 __le32 suspend_time;
624 __le32 scan_priority;
625 /* SCAN_CHANNEL_PARAMS_API_S_VER_1 */
626 u8 channel_flags;
627 u8 n_channels;
628 __le16 reserved2;
629 u8 data[];
630 } __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */
631
632 /**
633 * struct iwl_umac_scan_abort
634 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
635 * @flags: reserved
636 */
637 struct iwl_umac_scan_abort {
638 __le32 uid;
639 __le32 flags;
640 } __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */
641
642 /**
643 * struct iwl_umac_scan_complete
644 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
645 * @last_schedule: last scheduling line
646 * @last_iter: last scan iteration number
647 * @scan status: &enum iwl_scan_offload_complete_status
648 * @ebs_status: &enum iwl_scan_ebs_status
649 * @time_from_last_iter: time elapsed from last iteration
650 * @reserved: for future use
651 */
652 struct iwl_umac_scan_complete {
653 __le32 uid;
654 u8 last_schedule;
655 u8 last_iter;
656 u8 status;
657 u8 ebs_status;
658 __le32 time_from_last_iter;
659 __le32 reserved;
660 } __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */
661
662 #define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN 5
663 /**
664 * struct iwl_scan_offload_profile_match - match information
665 * @bssid: matched bssid
666 * @channel: channel where the match occurred
667 * @energy:
668 * @matching_feature:
669 * @matching_channels: bitmap of channels that matched, referencing
670 * the channels passed in tue scan offload request
671 */
672 struct iwl_scan_offload_profile_match {
673 u8 bssid[ETH_ALEN];
674 __le16 reserved;
675 u8 channel;
676 u8 energy;
677 u8 matching_feature;
678 u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN];
679 } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_1 */
680
681 /**
682 * struct iwl_scan_offload_profiles_query - match results query response
683 * @matched_profiles: bitmap of matched profiles, referencing the
684 * matches passed in the scan offload request
685 * @last_scan_age: age of the last offloaded scan
686 * @n_scans_done: number of offloaded scans done
687 * @gp2_d0u: GP2 when D0U occurred
688 * @gp2_invoked: GP2 when scan offload was invoked
689 * @resume_while_scanning: not used
690 * @self_recovery: obsolete
691 * @reserved: reserved
692 * @matches: array of match information, one for each match
693 */
694 struct iwl_scan_offload_profiles_query {
695 __le32 matched_profiles;
696 __le32 last_scan_age;
697 __le32 n_scans_done;
698 __le32 gp2_d0u;
699 __le32 gp2_invoked;
700 u8 resume_while_scanning;
701 u8 self_recovery;
702 __le16 reserved;
703 struct iwl_scan_offload_profile_match matches[IWL_SCAN_MAX_PROFILES];
704 } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */
705
706 /**
707 * struct iwl_umac_scan_iter_complete_notif - notifies end of scanning iteration
708 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
709 * @scanned_channels: number of channels scanned and number of valid elements in
710 * results array
711 * @status: one of SCAN_COMP_STATUS_*
712 * @bt_status: BT on/off status
713 * @last_channel: last channel that was scanned
714 * @tsf_low: TSF timer (lower half) in usecs
715 * @tsf_high: TSF timer (higher half) in usecs
716 * @results: array of scan results, only "scanned_channels" of them are valid
717 */
718 struct iwl_umac_scan_iter_complete_notif {
719 __le32 uid;
720 u8 scanned_channels;
721 u8 status;
722 u8 bt_status;
723 u8 last_channel;
724 __le32 tsf_low;
725 __le32 tsf_high;
726 struct iwl_scan_results_notif results[];
727 } __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_1 */
728
729 #endif