Merge remote-tracking branch 'lsk/v3.10/topic/configs' into linux-linaro-lsk
[firefly-linux-kernel-4.4.55.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 - 2013 Intel Corporation. All rights reserved.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of version 2 of the GNU General Public License as
12  * published by the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
22  * USA
23  *
24  * The full GNU General Public License is included in this distribution
25  * in the file called COPYING.
26  *
27  * Contact Information:
28  *  Intel Linux Wireless <ilw@linux.intel.com>
29  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30  *
31  * BSD LICENSE
32  *
33  * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
34  * All rights reserved.
35  *
36  * Redistribution and use in source and binary forms, with or without
37  * modification, are permitted provided that the following conditions
38  * are met:
39  *
40  *  * Redistributions of source code must retain the above copyright
41  *    notice, this list of conditions and the following disclaimer.
42  *  * Redistributions in binary form must reproduce the above copyright
43  *    notice, this list of conditions and the following disclaimer in
44  *    the documentation and/or other materials provided with the
45  *    distribution.
46  *  * Neither the name Intel Corporation nor the names of its
47  *    contributors may be used to endorse or promote products derived
48  *    from this software without specific prior written permission.
49  *
50  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61  *
62  *****************************************************************************/
63
64 #ifndef __fw_api_scan_h__
65 #define __fw_api_scan_h__
66
67 #include "fw-api.h"
68
69 /* Scan Commands, Responses, Notifications */
70
71 /* Masks for iwl_scan_channel.type flags */
72 #define SCAN_CHANNEL_TYPE_ACTIVE        BIT(0)
73 #define SCAN_CHANNEL_NARROW_BAND        BIT(22)
74
75 /* Max number of IEs for direct SSID scans in a command */
76 #define PROBE_OPTION_MAX                20
77
78 /**
79  * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table
80  * @channel: band is selected by iwl_scan_cmd "flags" field
81  * @tx_gain: gain for analog radio
82  * @dsp_atten: gain for DSP
83  * @active_dwell: dwell time for active scan in TU, typically 5-50
84  * @passive_dwell: dwell time for passive scan in TU, typically 20-500
85  * @type: type is broken down to these bits:
86  *      bit 0: 0 = passive, 1 = active
87  *      bits 1-20: SSID direct bit map. If any of these bits is set then
88  *              the corresponding SSID IE is transmitted in probe request
89  *              (bit i adds IE in position i to the probe request)
90  *      bit 22: channel width, 0 = regular, 1 = TGj narrow channel
91  *
92  * @iteration_count:
93  * @iteration_interval:
94  * This struct is used once for each channel in the scan list.
95  * Each channel can independently select:
96  * 1)  SSID for directed active scans
97  * 2)  Txpower setting (for rate specified within Tx command)
98  * 3)  How long to stay on-channel (behavior may be modified by quiet_time,
99  *     quiet_plcp_th, good_CRC_th)
100  *
101  * To avoid uCode errors, make sure the following are true (see comments
102  * under struct iwl_scan_cmd about max_out_time and quiet_time):
103  * 1)  If using passive_dwell (i.e. passive_dwell != 0):
104  *     active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
105  * 2)  quiet_time <= active_dwell
106  * 3)  If restricting off-channel time (i.e. max_out_time !=0):
107  *     passive_dwell < max_out_time
108  *     active_dwell < max_out_time
109  */
110 struct iwl_scan_channel {
111         __le32 type;
112         __le16 channel;
113         __le16 iteration_count;
114         __le32 iteration_interval;
115         __le16 active_dwell;
116         __le16 passive_dwell;
117 } __packed; /* SCAN_CHANNEL_CONTROL_API_S_VER_1 */
118
119 /**
120  * struct iwl_ssid_ie - directed scan network information element
121  *
122  * Up to 20 of these may appear in REPLY_SCAN_CMD,
123  * selected by "type" bit field in struct iwl_scan_channel;
124  * each channel may select different ssids from among the 20 entries.
125  * SSID IEs get transmitted in reverse order of entry.
126  */
127 struct iwl_ssid_ie {
128         u8 id;
129         u8 len;
130         u8 ssid[IEEE80211_MAX_SSID_LEN];
131 } __packed; /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
132
133 /**
134  * iwl_scan_flags - masks for scan command flags
135  *@SCAN_FLAGS_PERIODIC_SCAN:
136  *@SCAN_FLAGS_P2P_PUBLIC_ACTION_FRAME_TX:
137  *@SCAN_FLAGS_DELAYED_SCAN_LOWBAND:
138  *@SCAN_FLAGS_DELAYED_SCAN_HIGHBAND:
139  *@SCAN_FLAGS_FRAGMENTED_SCAN:
140  */
141 enum iwl_scan_flags {
142         SCAN_FLAGS_PERIODIC_SCAN                = BIT(0),
143         SCAN_FLAGS_P2P_PUBLIC_ACTION_FRAME_TX   = BIT(1),
144         SCAN_FLAGS_DELAYED_SCAN_LOWBAND         = BIT(2),
145         SCAN_FLAGS_DELAYED_SCAN_HIGHBAND        = BIT(3),
146         SCAN_FLAGS_FRAGMENTED_SCAN              = BIT(4),
147 };
148
149 /**
150  * enum iwl_scan_type - Scan types for scan command
151  * @SCAN_TYPE_FORCED:
152  * @SCAN_TYPE_BACKGROUND:
153  * @SCAN_TYPE_OS:
154  * @SCAN_TYPE_ROAMING:
155  * @SCAN_TYPE_ACTION:
156  * @SCAN_TYPE_DISCOVERY:
157  * @SCAN_TYPE_DISCOVERY_FORCED:
158  */
159 enum iwl_scan_type {
160         SCAN_TYPE_FORCED                = 0,
161         SCAN_TYPE_BACKGROUND            = 1,
162         SCAN_TYPE_OS                    = 2,
163         SCAN_TYPE_ROAMING               = 3,
164         SCAN_TYPE_ACTION                = 4,
165         SCAN_TYPE_DISCOVERY             = 5,
166         SCAN_TYPE_DISCOVERY_FORCED      = 6,
167 }; /* SCAN_ACTIVITY_TYPE_E_VER_1 */
168
169 /* Maximal number of channels to scan */
170 #define MAX_NUM_SCAN_CHANNELS 0x24
171
172 /**
173  * struct iwl_scan_cmd - scan request command
174  * ( SCAN_REQUEST_CMD = 0x80 )
175  * @len: command length in bytes
176  * @scan_flags: scan flags from SCAN_FLAGS_*
177  * @channel_count: num of channels in channel list (1 - MAX_NUM_SCAN_CHANNELS)
178  * @quiet_time: in msecs, dwell this time for active scan on quiet channels
179  * @quiet_plcp_th: quiet PLCP threshold (channel is quiet if less than
180  *      this number of packets were received (typically 1)
181  * @passive2active: is auto switching from passive to active allowed (0 or 1)
182  * @rxchain_sel_flags: RXON_RX_CHAIN_*
183  * @max_out_time: in usecs, max out of serving channel time
184  * @suspend_time: how long to pause scan when returning to service channel:
185  *      bits 0-19: beacon interal in usecs (suspend before executing)
186  *      bits 20-23: reserved
187  *      bits 24-31: number of beacons (suspend between channels)
188  * @rxon_flags: RXON_FLG_*
189  * @filter_flags: RXON_FILTER_*
190  * @tx_cmd: for active scans (zero for passive), w/o payload,
191  *      no RS so specify TX rate
192  * @direct_scan: direct scan SSIDs
193  * @type: one of SCAN_TYPE_*
194  * @repeats: how many time to repeat the scan
195  */
196 struct iwl_scan_cmd {
197         __le16 len;
198         u8 scan_flags;
199         u8 channel_count;
200         __le16 quiet_time;
201         __le16 quiet_plcp_th;
202         __le16 passive2active;
203         __le16 rxchain_sel_flags;
204         __le32 max_out_time;
205         __le32 suspend_time;
206         /* RX_ON_FLAGS_API_S_VER_1 */
207         __le32 rxon_flags;
208         __le32 filter_flags;
209         struct iwl_tx_cmd tx_cmd;
210         struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
211         __le32 type;
212         __le32 repeats;
213
214         /*
215          * Probe request frame, followed by channel list.
216          *
217          * Size of probe request frame is specified by byte count in tx_cmd.
218          * Channel list follows immediately after probe request frame.
219          * Number of channels in list is specified by channel_count.
220          * Each channel in list is of type:
221          *
222          * struct iwl_scan_channel channels[0];
223          *
224          * NOTE:  Only one band of channels can be scanned per pass.  You
225          * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
226          * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
227          * before requesting another scan.
228          */
229         u8 data[0];
230 } __packed; /* SCAN_REQUEST_FIXED_PART_API_S_VER_5 */
231
232 /* Response to scan request contains only status with one of these values */
233 #define SCAN_RESPONSE_OK        0x1
234 #define SCAN_RESPONSE_ERROR     0x2
235
236 /*
237  * SCAN_ABORT_CMD = 0x81
238  * When scan abort is requested, the command has no fields except the common
239  * header. The response contains only a status with one of these values.
240  */
241 #define SCAN_ABORT_POSSIBLE     0x1
242 #define SCAN_ABORT_IGNORED      0x2 /* no pending scans */
243
244 /* TODO: complete documentation */
245 #define  SCAN_OWNER_STATUS 0x1
246 #define  MEASURE_OWNER_STATUS 0x2
247
248 /**
249  * struct iwl_scan_start_notif - notifies start of scan in the device
250  * ( SCAN_START_NOTIFICATION = 0x82 )
251  * @tsf_low: TSF timer (lower half) in usecs
252  * @tsf_high: TSF timer (higher half) in usecs
253  * @beacon_timer: structured as follows:
254  *      bits 0:19 - beacon interval in usecs
255  *      bits 20:23 - reserved (0)
256  *      bits 24:31 - number of beacons
257  * @channel: which channel is scanned
258  * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
259  * @status: one of *_OWNER_STATUS
260  */
261 struct iwl_scan_start_notif {
262         __le32 tsf_low;
263         __le32 tsf_high;
264         __le32 beacon_timer;
265         u8 channel;
266         u8 band;
267         u8 reserved[2];
268         __le32 status;
269 } __packed; /* SCAN_START_NTF_API_S_VER_1 */
270
271 /* scan results probe_status first bit indicates success */
272 #define SCAN_PROBE_STATUS_OK            0
273 #define SCAN_PROBE_STATUS_TX_FAILED     BIT(0)
274 /* error statuses combined with TX_FAILED */
275 #define SCAN_PROBE_STATUS_FAIL_TTL      BIT(1)
276 #define SCAN_PROBE_STATUS_FAIL_BT       BIT(2)
277
278 /* How many statistics are gathered for each channel */
279 #define SCAN_RESULTS_STATISTICS 1
280
281 /**
282  * enum iwl_scan_complete_status - status codes for scan complete notifications
283  * @SCAN_COMP_STATUS_OK:  scan completed successfully
284  * @SCAN_COMP_STATUS_ABORT: scan was aborted by user
285  * @SCAN_COMP_STATUS_ERR_SLEEP: sending null sleep packet failed
286  * @SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT: timeout before channel is ready
287  * @SCAN_COMP_STATUS_ERR_PROBE: sending probe request failed
288  * @SCAN_COMP_STATUS_ERR_WAKEUP: sending null wakeup packet failed
289  * @SCAN_COMP_STATUS_ERR_ANTENNAS: invalid antennas chosen at scan command
290  * @SCAN_COMP_STATUS_ERR_INTERNAL: internal error caused scan abort
291  * @SCAN_COMP_STATUS_ERR_COEX: medium was lost ot WiMax
292  * @SCAN_COMP_STATUS_P2P_ACTION_OK: P2P public action frame TX was successful
293  *      (not an error!)
294  * @SCAN_COMP_STATUS_ITERATION_END: indicates end of one repeatition the driver
295  *      asked for
296  * @SCAN_COMP_STATUS_ERR_ALLOC_TE: scan could not allocate time events
297 */
298 enum iwl_scan_complete_status {
299         SCAN_COMP_STATUS_OK = 0x1,
300         SCAN_COMP_STATUS_ABORT = 0x2,
301         SCAN_COMP_STATUS_ERR_SLEEP = 0x3,
302         SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT = 0x4,
303         SCAN_COMP_STATUS_ERR_PROBE = 0x5,
304         SCAN_COMP_STATUS_ERR_WAKEUP = 0x6,
305         SCAN_COMP_STATUS_ERR_ANTENNAS = 0x7,
306         SCAN_COMP_STATUS_ERR_INTERNAL = 0x8,
307         SCAN_COMP_STATUS_ERR_COEX = 0x9,
308         SCAN_COMP_STATUS_P2P_ACTION_OK = 0xA,
309         SCAN_COMP_STATUS_ITERATION_END = 0x0B,
310         SCAN_COMP_STATUS_ERR_ALLOC_TE = 0x0C,
311 };
312
313 /**
314  * struct iwl_scan_results_notif - scan results for one channel
315  * ( SCAN_RESULTS_NOTIFICATION = 0x83 )
316  * @channel: which channel the results are from
317  * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
318  * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
319  * @num_probe_not_sent: # of request that weren't sent due to not enough time
320  * @duration: duration spent in channel, in usecs
321  * @statistics: statistics gathered for this channel
322  */
323 struct iwl_scan_results_notif {
324         u8 channel;
325         u8 band;
326         u8 probe_status;
327         u8 num_probe_not_sent;
328         __le32 duration;
329         __le32 statistics[SCAN_RESULTS_STATISTICS];
330 } __packed; /* SCAN_RESULT_NTF_API_S_VER_2 */
331
332 /**
333  * struct iwl_scan_complete_notif - notifies end of scanning (all channels)
334  * ( SCAN_COMPLETE_NOTIFICATION = 0x84 )
335  * @scanned_channels: number of channels scanned (and number of valid results)
336  * @status: one of SCAN_COMP_STATUS_*
337  * @bt_status: BT on/off status
338  * @last_channel: last channel that was scanned
339  * @tsf_low: TSF timer (lower half) in usecs
340  * @tsf_high: TSF timer (higher half) in usecs
341  * @results: all scan results, only "scanned_channels" of them are valid
342  */
343 struct iwl_scan_complete_notif {
344         u8 scanned_channels;
345         u8 status;
346         u8 bt_status;
347         u8 last_channel;
348         __le32 tsf_low;
349         __le32 tsf_high;
350         struct iwl_scan_results_notif results[MAX_NUM_SCAN_CHANNELS];
351 } __packed; /* SCAN_COMPLETE_NTF_API_S_VER_2 */
352
353 /* scan offload */
354 #define IWL_MAX_SCAN_CHANNELS           40
355 #define IWL_SCAN_MAX_BLACKLIST_LEN      64
356 #define IWL_SCAN_MAX_PROFILES           11
357 #define SCAN_OFFLOAD_PROBE_REQ_SIZE     512
358
359 /* Default watchdog (in MS) for scheduled scan iteration */
360 #define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
361
362 #define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
363 #define CAN_ABORT_STATUS 1
364
365 #define IWL_FULL_SCAN_MULTIPLIER 5
366 #define IWL_FAST_SCHED_SCAN_ITERATIONS 3
367
368 /**
369  * struct iwl_scan_offload_cmd - SCAN_REQUEST_FIXED_PART_API_S_VER_6
370  * @scan_flags:         see enum iwl_scan_flags
371  * @channel_count:      channels in channel list
372  * @quiet_time:         dwell time, in milisiconds, on quiet channel
373  * @quiet_plcp_th:      quiet channel num of packets threshold
374  * @good_CRC_th:        passive to active promotion threshold
375  * @rx_chain:           RXON rx chain.
376  * @max_out_time:       max uSec to be out of assoceated channel
377  * @suspend_time:       pause scan this long when returning to service channel
378  * @flags:              RXON flags
379  * @filter_flags:       RXONfilter
380  * @tx_cmd:             tx command for active scan; for 2GHz and for 5GHz.
381  * @direct_scan:        list of SSIDs for directed active scan
382  * @scan_type:          see enum iwl_scan_type.
383  * @rep_count:          repetition count for each scheduled scan iteration.
384  */
385 struct iwl_scan_offload_cmd {
386         __le16 len;
387         u8 scan_flags;
388         u8 channel_count;
389         __le16 quiet_time;
390         __le16 quiet_plcp_th;
391         __le16 good_CRC_th;
392         __le16 rx_chain;
393         __le32 max_out_time;
394         __le32 suspend_time;
395         /* RX_ON_FLAGS_API_S_VER_1 */
396         __le32 flags;
397         __le32 filter_flags;
398         struct iwl_tx_cmd tx_cmd[2];
399         /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
400         struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
401         __le32 scan_type;
402         __le32 rep_count;
403 } __packed;
404
405 enum iwl_scan_offload_channel_flags {
406         IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE         = BIT(0),
407         IWL_SCAN_OFFLOAD_CHANNEL_NARROW         = BIT(22),
408         IWL_SCAN_OFFLOAD_CHANNEL_FULL           = BIT(24),
409         IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL        = BIT(25),
410 };
411
412 /**
413  * iwl_scan_channel_cfg - SCAN_CHANNEL_CFG_S
414  * @type:               bitmap - see enum iwl_scan_offload_channel_flags.
415  *                      0:      passive (0) or active (1) scan.
416  *                      1-20:   directed scan to i'th ssid.
417  *                      22:     channel width configuation - 1 for narrow.
418  *                      24:     full scan.
419  *                      25:     partial scan.
420  * @channel_number:     channel number 1-13 etc.
421  * @iter_count:         repetition count for the channel.
422  * @iter_interval:      interval between two innteration on one channel.
423  * @dwell_time: entry 0 - active scan, entry 1 - passive scan.
424  */
425 struct iwl_scan_channel_cfg {
426         __le32 type[IWL_MAX_SCAN_CHANNELS];
427         __le16 channel_number[IWL_MAX_SCAN_CHANNELS];
428         __le16 iter_count[IWL_MAX_SCAN_CHANNELS];
429         __le32 iter_interval[IWL_MAX_SCAN_CHANNELS];
430         u8 dwell_time[IWL_MAX_SCAN_CHANNELS][2];
431 } __packed;
432
433 /**
434  * iwl_scan_offload_cfg - SCAN_OFFLOAD_CONFIG_API_S
435  * @scan_cmd:           scan command fixed part
436  * @channel_cfg:        scan channel configuration
437  * @data:               probe request frames (one per band)
438  */
439 struct iwl_scan_offload_cfg {
440         struct iwl_scan_offload_cmd scan_cmd;
441         struct iwl_scan_channel_cfg channel_cfg;
442         u8 data[0];
443 } __packed;
444
445 /**
446  * iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S
447  * @ssid:               MAC address to filter out
448  * @reported_rssi:      AP rssi reported to the host
449  */
450 struct iwl_scan_offload_blacklist {
451         u8 ssid[ETH_ALEN];
452         u8 reported_rssi;
453         u8 reserved;
454 } __packed;
455
456 enum iwl_scan_offload_network_type {
457         IWL_NETWORK_TYPE_BSS    = 1,
458         IWL_NETWORK_TYPE_IBSS   = 2,
459         IWL_NETWORK_TYPE_ANY    = 3,
460 };
461
462 enum iwl_scan_offload_band_selection {
463         IWL_SCAN_OFFLOAD_SELECT_2_4     = 0x4,
464         IWL_SCAN_OFFLOAD_SELECT_5_2     = 0x8,
465         IWL_SCAN_OFFLOAD_SELECT_ANY     = 0xc,
466 };
467
468 /**
469  * iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S
470  * @ssid_index:         index to ssid list in fixed part
471  * @unicast_cipher:     encryption olgorithm to match - bitmap
472  * @aut_alg:            authentication olgorithm to match - bitmap
473  * @network_type:       enum iwl_scan_offload_network_type
474  * @band_selection:     enum iwl_scan_offload_band_selection
475  */
476 struct iwl_scan_offload_profile {
477         u8 ssid_index;
478         u8 unicast_cipher;
479         u8 auth_alg;
480         u8 network_type;
481         u8 band_selection;
482         u8 reserved[3];
483 } __packed;
484
485 /**
486  * iwl_scan_offload_profile_cfg - SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1
487  * @blaclist:           AP list to filter off from scan results
488  * @profiles:           profiles to search for match
489  * @blacklist_len:      length of blacklist
490  * @num_profiles:       num of profiles in the list
491  */
492 struct iwl_scan_offload_profile_cfg {
493         struct iwl_scan_offload_blacklist blacklist[IWL_SCAN_MAX_BLACKLIST_LEN];
494         struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
495         u8 blacklist_len;
496         u8 num_profiles;
497         u8 reserved[2];
498 } __packed;
499
500 /**
501  * iwl_scan_offload_schedule - schedule of scan offload
502  * @delay:              delay between iterations, in seconds.
503  * @iterations:         num of scan iterations
504  * @full_scan_mul:      number of partial scans before each full scan
505  */
506 struct iwl_scan_offload_schedule {
507         u16 delay;
508         u8 iterations;
509         u8 full_scan_mul;
510 } __packed;
511
512 /*
513  * iwl_scan_offload_flags
514  *
515  * IWL_SCAN_OFFLOAD_FLAG_FILTER_SSID: filter mode - upload every beacon or match
516  *      ssid list.
517  * IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL: add cached channels to partial scan.
518  * IWL_SCAN_OFFLOAD_FLAG_ENERGY_SCAN: use energy based scan before partial scan
519  *      on A band.
520  */
521 enum iwl_scan_offload_flags {
522         IWL_SCAN_OFFLOAD_FLAG_FILTER_SSID       = BIT(0),
523         IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL    = BIT(2),
524         IWL_SCAN_OFFLOAD_FLAG_ENERGY_SCAN       = BIT(3),
525 };
526
527 /**
528  * iwl_scan_offload_req - scan offload request command
529  * @flags:              bitmap - enum iwl_scan_offload_flags.
530  * @watchdog:           maximum scan duration in TU.
531  * @delay:              delay in seconds before first iteration.
532  * @schedule_line:      scan offload schedule, for fast and regular scan.
533  */
534 struct iwl_scan_offload_req {
535         __le16 flags;
536         __le16 watchdog;
537         __le16 delay;
538         __le16 reserved;
539         struct iwl_scan_offload_schedule schedule_line[2];
540 } __packed;
541
542 enum iwl_scan_offload_compleate_status {
543         IWL_SCAN_OFFLOAD_COMPLETED      = 1,
544         IWL_SCAN_OFFLOAD_ABORTED        = 2,
545 };
546
547 /**
548  * iwl_scan_offload_complete - SCAN_OFFLOAD_COMPLETE_NTF_API_S_VER_1
549  * @last_schedule_line:         last schedule line executed (fast or regular)
550  * @last_schedule_iteration:    last scan iteration executed before scan abort
551  * @status:                     enum iwl_scan_offload_compleate_status
552  */
553 struct iwl_scan_offload_complete {
554         u8 last_schedule_line;
555         u8 last_schedule_iteration;
556         u8 status;
557         u8 reserved;
558 } __packed;
559
560 #endif