]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[karo-tx-linux.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  *
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 - 2014 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  *@SCAN_FLAGS_PASSIVE2ACTIVE: use active scan on channels that was active
141  *      in the past hour, even if they are marked as passive.
142  */
143 enum iwl_scan_flags {
144         SCAN_FLAGS_PERIODIC_SCAN                = BIT(0),
145         SCAN_FLAGS_P2P_PUBLIC_ACTION_FRAME_TX   = BIT(1),
146         SCAN_FLAGS_DELAYED_SCAN_LOWBAND         = BIT(2),
147         SCAN_FLAGS_DELAYED_SCAN_HIGHBAND        = BIT(3),
148         SCAN_FLAGS_FRAGMENTED_SCAN              = BIT(4),
149         SCAN_FLAGS_PASSIVE2ACTIVE               = BIT(5),
150 };
151
152 /**
153  * enum iwl_scan_type - Scan types for scan command
154  * @SCAN_TYPE_FORCED:
155  * @SCAN_TYPE_BACKGROUND:
156  * @SCAN_TYPE_OS:
157  * @SCAN_TYPE_ROAMING:
158  * @SCAN_TYPE_ACTION:
159  * @SCAN_TYPE_DISCOVERY:
160  * @SCAN_TYPE_DISCOVERY_FORCED:
161  */
162 enum iwl_scan_type {
163         SCAN_TYPE_FORCED                = 0,
164         SCAN_TYPE_BACKGROUND            = 1,
165         SCAN_TYPE_OS                    = 2,
166         SCAN_TYPE_ROAMING               = 3,
167         SCAN_TYPE_ACTION                = 4,
168         SCAN_TYPE_DISCOVERY             = 5,
169         SCAN_TYPE_DISCOVERY_FORCED      = 6,
170 }; /* SCAN_ACTIVITY_TYPE_E_VER_1 */
171
172 /**
173  * Maximal number of channels to scan
174  * it should be equal to:
175  * max(IWL_NUM_CHANNELS, IWL_NUM_CHANNELS_FAMILY_8000)
176  */
177 #define MAX_NUM_SCAN_CHANNELS 50
178
179 /**
180  * struct iwl_scan_cmd - scan request command
181  * ( SCAN_REQUEST_CMD = 0x80 )
182  * @len: command length in bytes
183  * @scan_flags: scan flags from SCAN_FLAGS_*
184  * @channel_count: num of channels in channel list (1 - MAX_NUM_SCAN_CHANNELS)
185  * @quiet_time: in msecs, dwell this time for active scan on quiet channels
186  * @quiet_plcp_th: quiet PLCP threshold (channel is quiet if less than
187  *      this number of packets were received (typically 1)
188  * @passive2active: is auto switching from passive to active during scan allowed
189  * @rxchain_sel_flags: RXON_RX_CHAIN_*
190  * @max_out_time: in TUs, max out of serving channel time
191  * @suspend_time: how long to pause scan when returning to service channel:
192  *      bits 0-19: beacon interal in TUs (suspend before executing)
193  *      bits 20-23: reserved
194  *      bits 24-31: number of beacons (suspend between channels)
195  * @rxon_flags: RXON_FLG_*
196  * @filter_flags: RXON_FILTER_*
197  * @tx_cmd: for active scans (zero for passive), w/o payload,
198  *      no RS so specify TX rate
199  * @direct_scan: direct scan SSIDs
200  * @type: one of SCAN_TYPE_*
201  * @repeats: how many time to repeat the scan
202  */
203 struct iwl_scan_cmd {
204         __le16 len;
205         u8 scan_flags;
206         u8 channel_count;
207         __le16 quiet_time;
208         __le16 quiet_plcp_th;
209         __le16 passive2active;
210         __le16 rxchain_sel_flags;
211         __le32 max_out_time;
212         __le32 suspend_time;
213         /* RX_ON_FLAGS_API_S_VER_1 */
214         __le32 rxon_flags;
215         __le32 filter_flags;
216         struct iwl_tx_cmd tx_cmd;
217         struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
218         __le32 type;
219         __le32 repeats;
220
221         /*
222          * Probe request frame, followed by channel list.
223          *
224          * Size of probe request frame is specified by byte count in tx_cmd.
225          * Channel list follows immediately after probe request frame.
226          * Number of channels in list is specified by channel_count.
227          * Each channel in list is of type:
228          *
229          * struct iwl_scan_channel channels[0];
230          *
231          * NOTE:  Only one band of channels can be scanned per pass.  You
232          * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
233          * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
234          * before requesting another scan.
235          */
236         u8 data[0];
237 } __packed; /* SCAN_REQUEST_FIXED_PART_API_S_VER_5 */
238
239 /* Response to scan request contains only status with one of these values */
240 #define SCAN_RESPONSE_OK        0x1
241 #define SCAN_RESPONSE_ERROR     0x2
242
243 /*
244  * SCAN_ABORT_CMD = 0x81
245  * When scan abort is requested, the command has no fields except the common
246  * header. The response contains only a status with one of these values.
247  */
248 #define SCAN_ABORT_POSSIBLE     0x1
249 #define SCAN_ABORT_IGNORED      0x2 /* no pending scans */
250
251 /* TODO: complete documentation */
252 #define  SCAN_OWNER_STATUS 0x1
253 #define  MEASURE_OWNER_STATUS 0x2
254
255 /**
256  * struct iwl_scan_start_notif - notifies start of scan in the device
257  * ( SCAN_START_NOTIFICATION = 0x82 )
258  * @tsf_low: TSF timer (lower half) in usecs
259  * @tsf_high: TSF timer (higher half) in usecs
260  * @beacon_timer: structured as follows:
261  *      bits 0:19 - beacon interval in usecs
262  *      bits 20:23 - reserved (0)
263  *      bits 24:31 - number of beacons
264  * @channel: which channel is scanned
265  * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
266  * @status: one of *_OWNER_STATUS
267  */
268 struct iwl_scan_start_notif {
269         __le32 tsf_low;
270         __le32 tsf_high;
271         __le32 beacon_timer;
272         u8 channel;
273         u8 band;
274         u8 reserved[2];
275         __le32 status;
276 } __packed; /* SCAN_START_NTF_API_S_VER_1 */
277
278 /* scan results probe_status first bit indicates success */
279 #define SCAN_PROBE_STATUS_OK            0
280 #define SCAN_PROBE_STATUS_TX_FAILED     BIT(0)
281 /* error statuses combined with TX_FAILED */
282 #define SCAN_PROBE_STATUS_FAIL_TTL      BIT(1)
283 #define SCAN_PROBE_STATUS_FAIL_BT       BIT(2)
284
285 /* How many statistics are gathered for each channel */
286 #define SCAN_RESULTS_STATISTICS 1
287
288 /**
289  * enum iwl_scan_complete_status - status codes for scan complete notifications
290  * @SCAN_COMP_STATUS_OK:  scan completed successfully
291  * @SCAN_COMP_STATUS_ABORT: scan was aborted by user
292  * @SCAN_COMP_STATUS_ERR_SLEEP: sending null sleep packet failed
293  * @SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT: timeout before channel is ready
294  * @SCAN_COMP_STATUS_ERR_PROBE: sending probe request failed
295  * @SCAN_COMP_STATUS_ERR_WAKEUP: sending null wakeup packet failed
296  * @SCAN_COMP_STATUS_ERR_ANTENNAS: invalid antennas chosen at scan command
297  * @SCAN_COMP_STATUS_ERR_INTERNAL: internal error caused scan abort
298  * @SCAN_COMP_STATUS_ERR_COEX: medium was lost ot WiMax
299  * @SCAN_COMP_STATUS_P2P_ACTION_OK: P2P public action frame TX was successful
300  *      (not an error!)
301  * @SCAN_COMP_STATUS_ITERATION_END: indicates end of one repeatition the driver
302  *      asked for
303  * @SCAN_COMP_STATUS_ERR_ALLOC_TE: scan could not allocate time events
304 */
305 enum iwl_scan_complete_status {
306         SCAN_COMP_STATUS_OK = 0x1,
307         SCAN_COMP_STATUS_ABORT = 0x2,
308         SCAN_COMP_STATUS_ERR_SLEEP = 0x3,
309         SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT = 0x4,
310         SCAN_COMP_STATUS_ERR_PROBE = 0x5,
311         SCAN_COMP_STATUS_ERR_WAKEUP = 0x6,
312         SCAN_COMP_STATUS_ERR_ANTENNAS = 0x7,
313         SCAN_COMP_STATUS_ERR_INTERNAL = 0x8,
314         SCAN_COMP_STATUS_ERR_COEX = 0x9,
315         SCAN_COMP_STATUS_P2P_ACTION_OK = 0xA,
316         SCAN_COMP_STATUS_ITERATION_END = 0x0B,
317         SCAN_COMP_STATUS_ERR_ALLOC_TE = 0x0C,
318 };
319
320 /**
321  * struct iwl_scan_results_notif - scan results for one channel
322  * ( SCAN_RESULTS_NOTIFICATION = 0x83 )
323  * @channel: which channel the results are from
324  * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
325  * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
326  * @num_probe_not_sent: # of request that weren't sent due to not enough time
327  * @duration: duration spent in channel, in usecs
328  * @statistics: statistics gathered for this channel
329  */
330 struct iwl_scan_results_notif {
331         u8 channel;
332         u8 band;
333         u8 probe_status;
334         u8 num_probe_not_sent;
335         __le32 duration;
336         __le32 statistics[SCAN_RESULTS_STATISTICS];
337 } __packed; /* SCAN_RESULT_NTF_API_S_VER_2 */
338
339 /**
340  * struct iwl_scan_complete_notif - notifies end of scanning (all channels)
341  * ( SCAN_COMPLETE_NOTIFICATION = 0x84 )
342  * @scanned_channels: number of channels scanned (and number of valid results)
343  * @status: one of SCAN_COMP_STATUS_*
344  * @bt_status: BT on/off status
345  * @last_channel: last channel that was scanned
346  * @tsf_low: TSF timer (lower half) in usecs
347  * @tsf_high: TSF timer (higher half) in usecs
348  * @results: all scan results, only "scanned_channels" of them are valid
349  */
350 struct iwl_scan_complete_notif {
351         u8 scanned_channels;
352         u8 status;
353         u8 bt_status;
354         u8 last_channel;
355         __le32 tsf_low;
356         __le32 tsf_high;
357         struct iwl_scan_results_notif results[MAX_NUM_SCAN_CHANNELS];
358 } __packed; /* SCAN_COMPLETE_NTF_API_S_VER_2 */
359
360 /* scan offload */
361 #define IWL_MAX_SCAN_CHANNELS           40
362 #define IWL_SCAN_MAX_BLACKLIST_LEN      64
363 #define IWL_SCAN_SHORT_BLACKLIST_LEN    16
364 #define IWL_SCAN_MAX_PROFILES           11
365 #define SCAN_OFFLOAD_PROBE_REQ_SIZE     512
366
367 /* Default watchdog (in MS) for scheduled scan iteration */
368 #define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
369
370 #define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
371 #define CAN_ABORT_STATUS 1
372
373 #define IWL_FULL_SCAN_MULTIPLIER 5
374 #define IWL_FAST_SCHED_SCAN_ITERATIONS 3
375
376 enum scan_framework_client {
377         SCAN_CLIENT_SCHED_SCAN          = BIT(0),
378         SCAN_CLIENT_NETDETECT           = BIT(1),
379         SCAN_CLIENT_ASSET_TRACKING      = BIT(2),
380 };
381
382 /**
383  * struct iwl_scan_offload_cmd - SCAN_REQUEST_FIXED_PART_API_S_VER_6
384  * @scan_flags:         see enum iwl_scan_flags
385  * @channel_count:      channels in channel list
386  * @quiet_time:         dwell time, in milisiconds, on quiet channel
387  * @quiet_plcp_th:      quiet channel num of packets threshold
388  * @good_CRC_th:        passive to active promotion threshold
389  * @rx_chain:           RXON rx chain.
390  * @max_out_time:       max TUs to be out of assoceated channel
391  * @suspend_time:       pause scan this TUs when returning to service channel
392  * @flags:              RXON flags
393  * @filter_flags:       RXONfilter
394  * @tx_cmd:             tx command for active scan; for 2GHz and for 5GHz.
395  * @direct_scan:        list of SSIDs for directed active scan
396  * @scan_type:          see enum iwl_scan_type.
397  * @rep_count:          repetition count for each scheduled scan iteration.
398  */
399 struct iwl_scan_offload_cmd {
400         __le16 len;
401         u8 scan_flags;
402         u8 channel_count;
403         __le16 quiet_time;
404         __le16 quiet_plcp_th;
405         __le16 good_CRC_th;
406         __le16 rx_chain;
407         __le32 max_out_time;
408         __le32 suspend_time;
409         /* RX_ON_FLAGS_API_S_VER_1 */
410         __le32 flags;
411         __le32 filter_flags;
412         struct iwl_tx_cmd tx_cmd[2];
413         /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
414         struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
415         __le32 scan_type;
416         __le32 rep_count;
417 } __packed;
418
419 enum iwl_scan_offload_channel_flags {
420         IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE         = BIT(0),
421         IWL_SCAN_OFFLOAD_CHANNEL_NARROW         = BIT(22),
422         IWL_SCAN_OFFLOAD_CHANNEL_FULL           = BIT(24),
423         IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL        = BIT(25),
424 };
425
426 /**
427  * iwl_scan_channel_cfg - SCAN_CHANNEL_CFG_S
428  * @type:               bitmap - see enum iwl_scan_offload_channel_flags.
429  *                      0:      passive (0) or active (1) scan.
430  *                      1-20:   directed scan to i'th ssid.
431  *                      22:     channel width configuation - 1 for narrow.
432  *                      24:     full scan.
433  *                      25:     partial scan.
434  * @channel_number:     channel number 1-13 etc.
435  * @iter_count:         repetition count for the channel.
436  * @iter_interval:      interval between two innteration on one channel.
437  * @dwell_time: entry 0 - active scan, entry 1 - passive scan.
438  */
439 struct iwl_scan_channel_cfg {
440         __le32 type[IWL_MAX_SCAN_CHANNELS];
441         __le16 channel_number[IWL_MAX_SCAN_CHANNELS];
442         __le16 iter_count[IWL_MAX_SCAN_CHANNELS];
443         __le32 iter_interval[IWL_MAX_SCAN_CHANNELS];
444         u8 dwell_time[IWL_MAX_SCAN_CHANNELS][2];
445 } __packed;
446
447 /**
448  * iwl_scan_offload_cfg - SCAN_OFFLOAD_CONFIG_API_S
449  * @scan_cmd:           scan command fixed part
450  * @channel_cfg:        scan channel configuration
451  * @data:               probe request frames (one per band)
452  */
453 struct iwl_scan_offload_cfg {
454         struct iwl_scan_offload_cmd scan_cmd;
455         struct iwl_scan_channel_cfg channel_cfg;
456         u8 data[0];
457 } __packed;
458
459 /**
460  * iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S
461  * @ssid:               MAC address to filter out
462  * @reported_rssi:      AP rssi reported to the host
463  * @client_bitmap: clients ignore this entry  - enum scan_framework_client
464  */
465 struct iwl_scan_offload_blacklist {
466         u8 ssid[ETH_ALEN];
467         u8 reported_rssi;
468         u8 client_bitmap;
469 } __packed;
470
471 enum iwl_scan_offload_network_type {
472         IWL_NETWORK_TYPE_BSS    = 1,
473         IWL_NETWORK_TYPE_IBSS   = 2,
474         IWL_NETWORK_TYPE_ANY    = 3,
475 };
476
477 enum iwl_scan_offload_band_selection {
478         IWL_SCAN_OFFLOAD_SELECT_2_4     = 0x4,
479         IWL_SCAN_OFFLOAD_SELECT_5_2     = 0x8,
480         IWL_SCAN_OFFLOAD_SELECT_ANY     = 0xc,
481 };
482
483 /**
484  * iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S
485  * @ssid_index:         index to ssid list in fixed part
486  * @unicast_cipher:     encryption olgorithm to match - bitmap
487  * @aut_alg:            authentication olgorithm to match - bitmap
488  * @network_type:       enum iwl_scan_offload_network_type
489  * @band_selection:     enum iwl_scan_offload_band_selection
490  * @client_bitmap:      clients waiting for match - enum scan_framework_client
491  */
492 struct iwl_scan_offload_profile {
493         u8 ssid_index;
494         u8 unicast_cipher;
495         u8 auth_alg;
496         u8 network_type;
497         u8 band_selection;
498         u8 client_bitmap;
499         u8 reserved[2];
500 } __packed;
501
502 /**
503  * iwl_scan_offload_profile_cfg - SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1
504  * @blaclist:           AP list to filter off from scan results
505  * @profiles:           profiles to search for match
506  * @blacklist_len:      length of blacklist
507  * @num_profiles:       num of profiles in the list
508  * @match_notify:       clients waiting for match found notification
509  * @pass_match:         clients waiting for the results
510  * @active_clients:     active clients bitmap - enum scan_framework_client
511  * @any_beacon_notify:  clients waiting for match notification without match
512  */
513 struct iwl_scan_offload_profile_cfg {
514         struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
515         u8 blacklist_len;
516         u8 num_profiles;
517         u8 match_notify;
518         u8 pass_match;
519         u8 active_clients;
520         u8 any_beacon_notify;
521         u8 reserved[2];
522 } __packed;
523
524 /**
525  * iwl_scan_offload_schedule - schedule of scan offload
526  * @delay:              delay between iterations, in seconds.
527  * @iterations:         num of scan iterations
528  * @full_scan_mul:      number of partial scans before each full scan
529  */
530 struct iwl_scan_offload_schedule {
531         u16 delay;
532         u8 iterations;
533         u8 full_scan_mul;
534 } __packed;
535
536 /*
537  * iwl_scan_offload_flags
538  *
539  * IWL_SCAN_OFFLOAD_FLAG_PASS_ALL: pass all results - no filtering.
540  * IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL: add cached channels to partial scan.
541  * IWL_SCAN_OFFLOAD_FLAG_EBS_QUICK_MODE: EBS duration is 100mSec - typical
542  *      beacon period. Finding channel activity in this mode is not guaranteed.
543  * IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE: EBS duration is 200mSec.
544  *      Assuming beacon period is 100ms finding channel activity is guaranteed.
545  */
546 enum iwl_scan_offload_flags {
547         IWL_SCAN_OFFLOAD_FLAG_PASS_ALL          = BIT(0),
548         IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL    = BIT(2),
549         IWL_SCAN_OFFLOAD_FLAG_EBS_QUICK_MODE    = BIT(5),
550         IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE = BIT(6),
551 };
552
553 /**
554  * iwl_scan_offload_req - scan offload request command
555  * @flags:              bitmap - enum iwl_scan_offload_flags.
556  * @watchdog:           maximum scan duration in TU.
557  * @delay:              delay in seconds before first iteration.
558  * @schedule_line:      scan offload schedule, for fast and regular scan.
559  */
560 struct iwl_scan_offload_req {
561         __le16 flags;
562         __le16 watchdog;
563         __le16 delay;
564         __le16 reserved;
565         struct iwl_scan_offload_schedule schedule_line[2];
566 } __packed;
567
568 enum iwl_scan_offload_compleate_status {
569         IWL_SCAN_OFFLOAD_COMPLETED      = 1,
570         IWL_SCAN_OFFLOAD_ABORTED        = 2,
571 };
572
573 enum iwl_scan_ebs_status {
574         IWL_SCAN_EBS_SUCCESS,
575         IWL_SCAN_EBS_FAILED,
576         IWL_SCAN_EBS_CHAN_NOT_FOUND,
577 };
578
579 /**
580  * iwl_scan_offload_complete - SCAN_OFFLOAD_COMPLETE_NTF_API_S_VER_1
581  * @last_schedule_line:         last schedule line executed (fast or regular)
582  * @last_schedule_iteration:    last scan iteration executed before scan abort
583  * @status:                     enum iwl_scan_offload_compleate_status
584  * @ebs_status: last EBS status, see IWL_SCAN_EBS_*
585  */
586 struct iwl_scan_offload_complete {
587         u8 last_schedule_line;
588         u8 last_schedule_iteration;
589         u8 status;
590         u8 ebs_status;
591 } __packed;
592
593 /**
594  * iwl_sched_scan_results - SCAN_OFFLOAD_MATCH_FOUND_NTF_API_S_VER_1
595  * @ssid_bitmap:        SSIDs indexes found in this iteration
596  * @client_bitmap:      clients that are active and wait for this notification
597  */
598 struct iwl_sched_scan_results {
599         __le16 ssid_bitmap;
600         u8 client_bitmap;
601         u8 reserved;
602 };
603
604 #endif