blob: f34cf002e2438227c7354730cad66378c9b5cb94 [file] [log] [blame]
Johannes Berg8ca151b2013-01-24 14:25:36 +01001/******************************************************************************
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 *
Emmanuel Grumbach51368bf2013-12-30 13:15:54 +02008 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
Luciano Coelho507e4cd2015-03-19 22:58:33 +02009 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
Johannes Berg8ca151b2013-01-24 14:25:36 +010010 *
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
Emmanuel Grumbach410dc5a2013-02-18 09:22:28 +020026 * in the file called COPYING.
Johannes Berg8ca151b2013-01-24 14:25:36 +010027 *
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 *
Emmanuel Grumbach51368bf2013-12-30 13:15:54 +020034 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
Luciano Coelho507e4cd2015-03-19 22:58:33 +020035 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
Johannes Berg8ca151b2013-01-24 14:25:36 +010036 * 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
Johannes Berg8ca151b2013-01-24 14:25:36 +010073/* Max number of IEs for direct SSID scans in a command */
74#define PROBE_OPTION_MAX 20
75
76/**
Johannes Berg8ca151b2013-01-24 14:25:36 +010077 * 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 */
84struct 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
Johannes Berg8ca151b2013-01-24 14:25:36 +010090/* How many statistics are gathered for each channel */
91#define SCAN_RESULTS_STATISTICS 1
92
93/**
94 * enum iwl_scan_complete_status - status codes for scan complete notifications
95 * @SCAN_COMP_STATUS_OK: scan completed successfully
96 * @SCAN_COMP_STATUS_ABORT: scan was aborted by user
97 * @SCAN_COMP_STATUS_ERR_SLEEP: sending null sleep packet failed
98 * @SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT: timeout before channel is ready
99 * @SCAN_COMP_STATUS_ERR_PROBE: sending probe request failed
100 * @SCAN_COMP_STATUS_ERR_WAKEUP: sending null wakeup packet failed
101 * @SCAN_COMP_STATUS_ERR_ANTENNAS: invalid antennas chosen at scan command
102 * @SCAN_COMP_STATUS_ERR_INTERNAL: internal error caused scan abort
103 * @SCAN_COMP_STATUS_ERR_COEX: medium was lost ot WiMax
104 * @SCAN_COMP_STATUS_P2P_ACTION_OK: P2P public action frame TX was successful
105 * (not an error!)
Sara Sharon0d365ae2015-03-31 12:24:05 +0300106 * @SCAN_COMP_STATUS_ITERATION_END: indicates end of one repetition the driver
Johannes Berg8ca151b2013-01-24 14:25:36 +0100107 * asked for
108 * @SCAN_COMP_STATUS_ERR_ALLOC_TE: scan could not allocate time events
109*/
110enum iwl_scan_complete_status {
111 SCAN_COMP_STATUS_OK = 0x1,
112 SCAN_COMP_STATUS_ABORT = 0x2,
113 SCAN_COMP_STATUS_ERR_SLEEP = 0x3,
114 SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT = 0x4,
115 SCAN_COMP_STATUS_ERR_PROBE = 0x5,
116 SCAN_COMP_STATUS_ERR_WAKEUP = 0x6,
117 SCAN_COMP_STATUS_ERR_ANTENNAS = 0x7,
118 SCAN_COMP_STATUS_ERR_INTERNAL = 0x8,
119 SCAN_COMP_STATUS_ERR_COEX = 0x9,
120 SCAN_COMP_STATUS_P2P_ACTION_OK = 0xA,
121 SCAN_COMP_STATUS_ITERATION_END = 0x0B,
122 SCAN_COMP_STATUS_ERR_ALLOC_TE = 0x0C,
123};
124
Johannes Berg8ca151b2013-01-24 14:25:36 +0100125/* scan offload */
Johannes Berg8ca151b2013-01-24 14:25:36 +0100126#define IWL_SCAN_MAX_BLACKLIST_LEN 64
David Spinadel35a000b2013-08-28 09:29:43 +0300127#define IWL_SCAN_SHORT_BLACKLIST_LEN 16
Johannes Berg8ca151b2013-01-24 14:25:36 +0100128#define IWL_SCAN_MAX_PROFILES 11
129#define SCAN_OFFLOAD_PROBE_REQ_SIZE 512
130
131/* Default watchdog (in MS) for scheduled scan iteration */
132#define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
133
134#define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
135#define CAN_ABORT_STATUS 1
136
137#define IWL_FULL_SCAN_MULTIPLIER 5
138#define IWL_FAST_SCHED_SCAN_ITERATIONS 3
139
David Spinadel35a000b2013-08-28 09:29:43 +0300140enum scan_framework_client {
141 SCAN_CLIENT_SCHED_SCAN = BIT(0),
142 SCAN_CLIENT_NETDETECT = BIT(1),
143 SCAN_CLIENT_ASSET_TRACKING = BIT(2),
144};
145
Johannes Berg8ca151b2013-01-24 14:25:36 +0100146/**
147 * struct iwl_scan_offload_cmd - SCAN_REQUEST_FIXED_PART_API_S_VER_6
148 * @scan_flags: see enum iwl_scan_flags
149 * @channel_count: channels in channel list
Sara Sharon0d365ae2015-03-31 12:24:05 +0300150 * @quiet_time: dwell time, in milliseconds, on quiet channel
Johannes Berg8ca151b2013-01-24 14:25:36 +0100151 * @quiet_plcp_th: quiet channel num of packets threshold
152 * @good_CRC_th: passive to active promotion threshold
153 * @rx_chain: RXON rx chain.
Sara Sharon0d365ae2015-03-31 12:24:05 +0300154 * @max_out_time: max TUs to be out of associated channel
Alexander Bondaref67f18d2014-03-30 10:47:08 +0300155 * @suspend_time: pause scan this TUs when returning to service channel
Johannes Berg8ca151b2013-01-24 14:25:36 +0100156 * @flags: RXON flags
157 * @filter_flags: RXONfilter
158 * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz.
159 * @direct_scan: list of SSIDs for directed active scan
160 * @scan_type: see enum iwl_scan_type.
161 * @rep_count: repetition count for each scheduled scan iteration.
162 */
163struct iwl_scan_offload_cmd {
164 __le16 len;
165 u8 scan_flags;
166 u8 channel_count;
167 __le16 quiet_time;
168 __le16 quiet_plcp_th;
169 __le16 good_CRC_th;
170 __le16 rx_chain;
171 __le32 max_out_time;
172 __le32 suspend_time;
173 /* RX_ON_FLAGS_API_S_VER_1 */
174 __le32 flags;
175 __le32 filter_flags;
176 struct iwl_tx_cmd tx_cmd[2];
177 /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
178 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
179 __le32 scan_type;
180 __le32 rep_count;
181} __packed;
182
183enum iwl_scan_offload_channel_flags {
184 IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE = BIT(0),
185 IWL_SCAN_OFFLOAD_CHANNEL_NARROW = BIT(22),
186 IWL_SCAN_OFFLOAD_CHANNEL_FULL = BIT(24),
187 IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL = BIT(25),
188};
189
David Spinadel762533b2014-06-05 11:20:43 +0300190/* channel configuration for struct iwl_scan_offload_cfg. Each channels needs:
191 * __le32 type: bitmap; bits 1-20 are for directed scan to i'th ssid and
192 * see enum iwl_scan_offload_channel_flags.
193 * __le16 channel_number: channel number 1-13 etc.
194 * __le16 iter_count: repetition count for the channel.
Sara Sharon0d365ae2015-03-31 12:24:05 +0300195 * __le32 iter_interval: interval between two iterations on one channel.
David Spinadel762533b2014-06-05 11:20:43 +0300196 * u8 active_dwell.
197 * u8 passive_dwell.
Johannes Berg8ca151b2013-01-24 14:25:36 +0100198 */
David Spinadel762533b2014-06-05 11:20:43 +0300199#define IWL_SCAN_CHAN_SIZE 14
Johannes Berg8ca151b2013-01-24 14:25:36 +0100200
201/**
202 * iwl_scan_offload_cfg - SCAN_OFFLOAD_CONFIG_API_S
203 * @scan_cmd: scan command fixed part
David Spinadel762533b2014-06-05 11:20:43 +0300204 * @data: scan channel configuration and probe request frames
Johannes Berg8ca151b2013-01-24 14:25:36 +0100205 */
206struct iwl_scan_offload_cfg {
207 struct iwl_scan_offload_cmd scan_cmd;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100208 u8 data[0];
209} __packed;
210
211/**
212 * iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S
213 * @ssid: MAC address to filter out
214 * @reported_rssi: AP rssi reported to the host
David Spinadel35a000b2013-08-28 09:29:43 +0300215 * @client_bitmap: clients ignore this entry - enum scan_framework_client
Johannes Berg8ca151b2013-01-24 14:25:36 +0100216 */
217struct iwl_scan_offload_blacklist {
218 u8 ssid[ETH_ALEN];
219 u8 reported_rssi;
David Spinadel35a000b2013-08-28 09:29:43 +0300220 u8 client_bitmap;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100221} __packed;
222
223enum iwl_scan_offload_network_type {
224 IWL_NETWORK_TYPE_BSS = 1,
225 IWL_NETWORK_TYPE_IBSS = 2,
226 IWL_NETWORK_TYPE_ANY = 3,
227};
228
229enum iwl_scan_offload_band_selection {
230 IWL_SCAN_OFFLOAD_SELECT_2_4 = 0x4,
231 IWL_SCAN_OFFLOAD_SELECT_5_2 = 0x8,
232 IWL_SCAN_OFFLOAD_SELECT_ANY = 0xc,
233};
234
235/**
236 * iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S
237 * @ssid_index: index to ssid list in fixed part
Sara Sharon0d365ae2015-03-31 12:24:05 +0300238 * @unicast_cipher: encryption algorithm to match - bitmap
239 * @aut_alg: authentication algorithm to match - bitmap
Johannes Berg8ca151b2013-01-24 14:25:36 +0100240 * @network_type: enum iwl_scan_offload_network_type
241 * @band_selection: enum iwl_scan_offload_band_selection
David Spinadel35a000b2013-08-28 09:29:43 +0300242 * @client_bitmap: clients waiting for match - enum scan_framework_client
Johannes Berg8ca151b2013-01-24 14:25:36 +0100243 */
244struct iwl_scan_offload_profile {
245 u8 ssid_index;
246 u8 unicast_cipher;
247 u8 auth_alg;
248 u8 network_type;
249 u8 band_selection;
David Spinadel35a000b2013-08-28 09:29:43 +0300250 u8 client_bitmap;
251 u8 reserved[2];
Johannes Berg8ca151b2013-01-24 14:25:36 +0100252} __packed;
253
254/**
255 * iwl_scan_offload_profile_cfg - SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1
256 * @blaclist: AP list to filter off from scan results
257 * @profiles: profiles to search for match
258 * @blacklist_len: length of blacklist
259 * @num_profiles: num of profiles in the list
David Spinadel35a000b2013-08-28 09:29:43 +0300260 * @match_notify: clients waiting for match found notification
261 * @pass_match: clients waiting for the results
262 * @active_clients: active clients bitmap - enum scan_framework_client
David Spinadel6e0bbe52013-12-30 09:59:45 +0200263 * @any_beacon_notify: clients waiting for match notification without match
Johannes Berg8ca151b2013-01-24 14:25:36 +0100264 */
265struct iwl_scan_offload_profile_cfg {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100266 struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
267 u8 blacklist_len;
268 u8 num_profiles;
David Spinadel35a000b2013-08-28 09:29:43 +0300269 u8 match_notify;
270 u8 pass_match;
271 u8 active_clients;
David Spinadel6e0bbe52013-12-30 09:59:45 +0200272 u8 any_beacon_notify;
273 u8 reserved[2];
Johannes Berg8ca151b2013-01-24 14:25:36 +0100274} __packed;
275
276/**
Luciano Coelho0bef0382015-04-02 00:25:44 +0300277 * iwl_scan_schedule_lmac - schedule of scan offload
Johannes Berg8ca151b2013-01-24 14:25:36 +0100278 * @delay: delay between iterations, in seconds.
279 * @iterations: num of scan iterations
280 * @full_scan_mul: number of partial scans before each full scan
281 */
Luciano Coelho0bef0382015-04-02 00:25:44 +0300282struct iwl_scan_schedule_lmac {
David Spinadelb14fc2b2014-06-25 13:17:53 +0300283 __le16 delay;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100284 u8 iterations;
285 u8 full_scan_mul;
Luciano Coelho0bef0382015-04-02 00:25:44 +0300286} __packed; /* SCAN_SCHEDULE_API_S */
Johannes Berg8ca151b2013-01-24 14:25:36 +0100287
Luciano Coelho0bef0382015-04-02 00:25:44 +0300288enum iwl_scan_offload_complete_status {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100289 IWL_SCAN_OFFLOAD_COMPLETED = 1,
290 IWL_SCAN_OFFLOAD_ABORTED = 2,
291};
292
Haim Dreyfusse820c2d2014-04-06 11:19:09 +0300293enum iwl_scan_ebs_status {
294 IWL_SCAN_EBS_SUCCESS,
295 IWL_SCAN_EBS_FAILED,
296 IWL_SCAN_EBS_CHAN_NOT_FOUND,
297};
298
Johannes Berg8ca151b2013-01-24 14:25:36 +0100299/**
300 * iwl_scan_offload_complete - SCAN_OFFLOAD_COMPLETE_NTF_API_S_VER_1
301 * @last_schedule_line: last schedule line executed (fast or regular)
302 * @last_schedule_iteration: last scan iteration executed before scan abort
303 * @status: enum iwl_scan_offload_compleate_status
Haim Dreyfusse820c2d2014-04-06 11:19:09 +0300304 * @ebs_status: last EBS status, see IWL_SCAN_EBS_*
Johannes Berg8ca151b2013-01-24 14:25:36 +0100305 */
306struct iwl_scan_offload_complete {
307 u8 last_schedule_line;
308 u8 last_schedule_iteration;
309 u8 status;
Haim Dreyfusse820c2d2014-04-06 11:19:09 +0300310 u8 ebs_status;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100311} __packed;
312
David Spinadel35a000b2013-08-28 09:29:43 +0300313/**
314 * iwl_sched_scan_results - SCAN_OFFLOAD_MATCH_FOUND_NTF_API_S_VER_1
315 * @ssid_bitmap: SSIDs indexes found in this iteration
316 * @client_bitmap: clients that are active and wait for this notification
317 */
318struct iwl_sched_scan_results {
319 __le16 ssid_bitmap;
320 u8 client_bitmap;
321 u8 reserved;
322};
323
David Spinadelfb98be52014-05-04 12:51:10 +0300324/* Unified LMAC scan API */
325
326#define IWL_MVM_BASIC_PASSIVE_DWELL 110
327
328/**
329 * iwl_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S
330 * @tx_flags: combination of TX_CMD_FLG_*
331 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
332 * cleared. Combination of RATE_MCS_*
333 * @sta_id: index of destination station in FW station table
334 * @reserved: for alignment and future use
335 */
336struct iwl_scan_req_tx_cmd {
337 __le32 tx_flags;
338 __le32 rate_n_flags;
339 u8 sta_id;
340 u8 reserved[3];
341} __packed;
342
343enum iwl_scan_channel_flags_lmac {
344 IWL_UNIFIED_SCAN_CHANNEL_FULL = BIT(27),
345 IWL_UNIFIED_SCAN_CHANNEL_PARTIAL = BIT(28),
346};
347
348/**
349 * iwl_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2
350 * @flags: bits 1-20: directed scan to i'th ssid
351 * other bits &enum iwl_scan_channel_flags_lmac
352 * @channel_number: channel number 1-13 etc
353 * @iter_count: scan iteration on this channel
354 * @iter_interval: interval in seconds between iterations on one channel
355 */
356struct iwl_scan_channel_cfg_lmac {
357 __le32 flags;
358 __le16 channel_num;
359 __le16 iter_count;
360 __le32 iter_interval;
361} __packed;
362
363/*
364 * iwl_scan_probe_segment - PROBE_SEGMENT_API_S_VER_1
365 * @offset: offset in the data block
366 * @len: length of the segment
367 */
368struct iwl_scan_probe_segment {
369 __le16 offset;
370 __le16 len;
371} __packed;
372
373/* iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_2
374 * @mac_header: first (and common) part of the probe
375 * @band_data: band specific data
376 * @common_data: last (and common) part of the probe
377 * @buf: raw data block
378 */
379struct iwl_scan_probe_req {
380 struct iwl_scan_probe_segment mac_header;
381 struct iwl_scan_probe_segment band_data[2];
382 struct iwl_scan_probe_segment common_data;
383 u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
384} __packed;
385
386enum iwl_scan_channel_flags {
387 IWL_SCAN_CHANNEL_FLAG_EBS = BIT(0),
388 IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE = BIT(1),
389 IWL_SCAN_CHANNEL_FLAG_CACHE_ADD = BIT(2),
390};
391
392/* iwl_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S
David Spinadel1f9c4182014-12-01 23:30:07 +0200393 * @flags: enum iwl_scan_channel_flags
394 * @non_ebs_ratio: defines the ratio of number of scan iterations where EBS is
395 * involved.
396 * 1 - EBS is disabled.
397 * 2 - every second scan will be full scan(and so on).
David Spinadelfb98be52014-05-04 12:51:10 +0300398 */
399struct iwl_scan_channel_opt {
400 __le16 flags;
401 __le16 non_ebs_ratio;
402} __packed;
403
404/**
405 * iwl_mvm_lmac_scan_flags
406 * @IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses
407 * without filtering.
408 * @IWL_MVM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels
409 * @IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan
410 * @IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification
411 * @IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS multiple SSID matching
412 * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented
Andrei Otcheretianski73897bd2014-07-09 18:59:14 +0300413 * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report
414 * and DS parameter set IEs into probe requests.
David Spinadel7e2a3882014-12-23 14:38:09 +0200415 * @IWL_MVM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches
David Spinadelfb98be52014-05-04 12:51:10 +0300416 */
417enum iwl_mvm_lmac_scan_flags {
418 IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL = BIT(0),
419 IWL_MVM_LMAC_SCAN_FLAG_PASSIVE = BIT(1),
420 IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION = BIT(2),
421 IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE = BIT(3),
422 IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = BIT(4),
423 IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED = BIT(5),
Andrei Otcheretianski73897bd2014-07-09 18:59:14 +0300424 IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6),
David Spinadel7e2a3882014-12-23 14:38:09 +0200425 IWL_MVM_LMAC_SCAN_FLAG_MATCH = BIT(9),
David Spinadelfb98be52014-05-04 12:51:10 +0300426};
427
428enum iwl_scan_priority {
429 IWL_SCAN_PRIORITY_LOW,
430 IWL_SCAN_PRIORITY_MEDIUM,
431 IWL_SCAN_PRIORITY_HIGH,
432};
433
Avraham Sternd7afbfc2015-05-12 12:19:48 +0300434enum iwl_scan_priority_ext {
435 IWL_SCAN_PRIORITY_EXT_0_LOWEST,
436 IWL_SCAN_PRIORITY_EXT_1,
437 IWL_SCAN_PRIORITY_EXT_2,
438 IWL_SCAN_PRIORITY_EXT_3,
439 IWL_SCAN_PRIORITY_EXT_4,
440 IWL_SCAN_PRIORITY_EXT_5,
441 IWL_SCAN_PRIORITY_EXT_6,
442 IWL_SCAN_PRIORITY_EXT_7_HIGHEST,
443};
444
David Spinadelfb98be52014-05-04 12:51:10 +0300445/**
Luciano Coelho65ff5562015-03-20 13:35:47 +0200446 * iwl_scan_req_lmac - SCAN_REQUEST_CMD_API_S_VER_1
David Spinadelfb98be52014-05-04 12:51:10 +0300447 * @reserved1: for alignment and future use
448 * @channel_num: num of channels to scan
449 * @active-dwell: dwell time for active channels
450 * @passive-dwell: dwell time for passive channels
451 * @fragmented-dwell: dwell time for fragmented passive scan
452 * @reserved2: for alignment and future use
453 * @rx_chain_selct: PHY_RX_CHAIN_* flags
454 * @scan_flags: &enum iwl_mvm_lmac_scan_flags
455 * @max_out_time: max time (in TU) to be out of associated channel
456 * @suspend_time: pause scan this long (TUs) when returning to service channel
457 * @flags: RXON flags
458 * @filter_flags: RXON filter
459 * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz
460 * @direct_scan: list of SSIDs for directed active scan
461 * @scan_prio: enum iwl_scan_priority
462 * @iter_num: number of scan iterations
463 * @delay: delay in seconds before first iteration
464 * @schedule: two scheduling plans. The first one is finite, the second one can
465 * be infinite.
466 * @channel_opt: channel optimization options, for full and partial scan
467 * @data: channel configuration and probe request packet.
468 */
Luciano Coelho65ff5562015-03-20 13:35:47 +0200469struct iwl_scan_req_lmac {
David Spinadelfb98be52014-05-04 12:51:10 +0300470 /* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */
471 __le32 reserved1;
472 u8 n_channels;
473 u8 active_dwell;
474 u8 passive_dwell;
475 u8 fragmented_dwell;
476 __le16 reserved2;
477 __le16 rx_chain_select;
478 __le32 scan_flags;
479 __le32 max_out_time;
480 __le32 suspend_time;
481 /* RX_ON_FLAGS_API_S_VER_1 */
482 __le32 flags;
483 __le32 filter_flags;
484 struct iwl_scan_req_tx_cmd tx_cmd[2];
485 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
486 __le32 scan_prio;
487 /* SCAN_REQ_PERIODIC_PARAMS_API_S */
488 __le32 iter_num;
489 __le32 delay;
Luciano Coelho0bef0382015-04-02 00:25:44 +0300490 struct iwl_scan_schedule_lmac schedule[2];
David Spinadelfb98be52014-05-04 12:51:10 +0300491 struct iwl_scan_channel_opt channel_opt[2];
492 u8 data[];
493} __packed;
494
495/**
Avraham Stern1083fd72015-03-31 16:14:41 +0300496 * struct iwl_scan_results_notif - scan results for one channel -
David Spinadelfb98be52014-05-04 12:51:10 +0300497 * SCAN_RESULT_NTF_API_S_VER_3
498 * @channel: which channel the results are from
499 * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
500 * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
501 * @num_probe_not_sent: # of request that weren't sent due to not enough time
502 * @duration: duration spent in channel, in usecs
503 */
Avraham Stern1083fd72015-03-31 16:14:41 +0300504struct iwl_scan_results_notif {
David Spinadelfb98be52014-05-04 12:51:10 +0300505 u8 channel;
506 u8 band;
507 u8 probe_status;
508 u8 num_probe_not_sent;
509 __le32 duration;
510} __packed;
511
512/**
513 * struct iwl_lmac_scan_complete_notif - notifies end of scanning (all channels)
514 * SCAN_COMPLETE_NTF_API_S_VER_3
515 * @scanned_channels: number of channels scanned (and number of valid results)
516 * @status: one of SCAN_COMP_STATUS_*
517 * @bt_status: BT on/off status
518 * @last_channel: last channel that was scanned
519 * @tsf_low: TSF timer (lower half) in usecs
520 * @tsf_high: TSF timer (higher half) in usecs
521 * @results: an array of scan results, only "scanned_channels" of them are valid
522 */
523struct iwl_lmac_scan_complete_notif {
524 u8 scanned_channels;
525 u8 status;
526 u8 bt_status;
527 u8 last_channel;
528 __le32 tsf_low;
529 __le32 tsf_high;
530 struct iwl_scan_results_notif results[];
531} __packed;
532
533/**
534 * iwl_scan_offload_complete - PERIODIC_SCAN_COMPLETE_NTF_API_S_VER_2
535 * @last_schedule_line: last schedule line executed (fast or regular)
536 * @last_schedule_iteration: last scan iteration executed before scan abort
537 * @status: enum iwl_scan_offload_complete_status
538 * @ebs_status: EBS success status &enum iwl_scan_ebs_status
539 * @time_after_last_iter; time in seconds elapsed after last iteration
540 */
541struct iwl_periodic_scan_complete {
542 u8 last_schedule_line;
543 u8 last_schedule_iteration;
544 u8 status;
545 u8 ebs_status;
546 __le32 time_after_last_iter;
547 __le32 reserved;
548} __packed;
549
David Spinadeld2496222014-05-20 12:46:37 +0300550/* UMAC Scan API */
551
552/**
553 * struct iwl_mvm_umac_cmd_hdr - Command header for UMAC commands
554 * @size: size of the command (not including header)
555 * @reserved0: for future use and alignment
556 * @ver: API version number
557 */
558struct iwl_mvm_umac_cmd_hdr {
559 __le16 size;
560 u8 reserved0;
561 u8 ver;
562} __packed;
563
Luciano Coelho507e4cd2015-03-19 22:58:33 +0200564/* The maximum of either of these cannot exceed 8, because we use an
565 * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h).
566 */
567#define IWL_MVM_MAX_UMAC_SCANS 8
568#define IWL_MVM_MAX_LMAC_SCANS 1
David Spinadeld2496222014-05-20 12:46:37 +0300569
570enum scan_config_flags {
571 SCAN_CONFIG_FLAG_ACTIVATE = BIT(0),
572 SCAN_CONFIG_FLAG_DEACTIVATE = BIT(1),
573 SCAN_CONFIG_FLAG_FORBID_CHUB_REQS = BIT(2),
574 SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS = BIT(3),
575 SCAN_CONFIG_FLAG_SET_TX_CHAINS = BIT(8),
576 SCAN_CONFIG_FLAG_SET_RX_CHAINS = BIT(9),
577 SCAN_CONFIG_FLAG_SET_AUX_STA_ID = BIT(10),
578 SCAN_CONFIG_FLAG_SET_ALL_TIMES = BIT(11),
579 SCAN_CONFIG_FLAG_SET_EFFECTIVE_TIMES = BIT(12),
580 SCAN_CONFIG_FLAG_SET_CHANNEL_FLAGS = BIT(13),
581 SCAN_CONFIG_FLAG_SET_LEGACY_RATES = BIT(14),
582 SCAN_CONFIG_FLAG_SET_MAC_ADDR = BIT(15),
583 SCAN_CONFIG_FLAG_SET_FRAGMENTED = BIT(16),
584 SCAN_CONFIG_FLAG_CLEAR_FRAGMENTED = BIT(17),
585 SCAN_CONFIG_FLAG_SET_CAM_MODE = BIT(18),
586 SCAN_CONFIG_FLAG_CLEAR_CAM_MODE = BIT(19),
587 SCAN_CONFIG_FLAG_SET_PROMISC_MODE = BIT(20),
588 SCAN_CONFIG_FLAG_CLEAR_PROMISC_MODE = BIT(21),
589
590 /* Bits 26-31 are for num of channels in channel_array */
591#define SCAN_CONFIG_N_CHANNELS(n) ((n) << 26)
592};
593
594enum scan_config_rates {
595 /* OFDM basic rates */
596 SCAN_CONFIG_RATE_6M = BIT(0),
597 SCAN_CONFIG_RATE_9M = BIT(1),
598 SCAN_CONFIG_RATE_12M = BIT(2),
599 SCAN_CONFIG_RATE_18M = BIT(3),
600 SCAN_CONFIG_RATE_24M = BIT(4),
601 SCAN_CONFIG_RATE_36M = BIT(5),
602 SCAN_CONFIG_RATE_48M = BIT(6),
603 SCAN_CONFIG_RATE_54M = BIT(7),
604 /* CCK basic rates */
605 SCAN_CONFIG_RATE_1M = BIT(8),
606 SCAN_CONFIG_RATE_2M = BIT(9),
607 SCAN_CONFIG_RATE_5M = BIT(10),
608 SCAN_CONFIG_RATE_11M = BIT(11),
609
610 /* Bits 16-27 are for supported rates */
611#define SCAN_CONFIG_SUPPORTED_RATE(rate) ((rate) << 16)
612};
613
614enum iwl_channel_flags {
615 IWL_CHANNEL_FLAG_EBS = BIT(0),
616 IWL_CHANNEL_FLAG_ACCURATE_EBS = BIT(1),
617 IWL_CHANNEL_FLAG_EBS_ADD = BIT(2),
618 IWL_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE = BIT(3),
619};
620
621/**
622 * struct iwl_scan_config
623 * @hdr: umac command header
624 * @flags: enum scan_config_flags
625 * @tx_chains: valid_tx antenna - ANT_* definitions
626 * @rx_chains: valid_rx antenna - ANT_* definitions
627 * @legacy_rates: default legacy rates - enum scan_config_rates
628 * @out_of_channel_time: default max out of serving channel time
629 * @suspend_time: default max suspend time
630 * @dwell_active: default dwell time for active scan
631 * @dwell_passive: default dwell time for passive scan
632 * @dwell_fragmented: default dwell time for fragmented scan
633 * @reserved: for future use and alignment
634 * @mac_addr: default mac address to be used in probes
635 * @bcast_sta_id: the index of the station in the fw
636 * @channel_flags: default channel flags - enum iwl_channel_flags
637 * scan_config_channel_flag
638 * @channel_array: default supported channels
639 */
640struct iwl_scan_config {
641 struct iwl_mvm_umac_cmd_hdr hdr;
642 __le32 flags;
643 __le32 tx_chains;
644 __le32 rx_chains;
645 __le32 legacy_rates;
646 __le32 out_of_channel_time;
647 __le32 suspend_time;
648 u8 dwell_active;
649 u8 dwell_passive;
650 u8 dwell_fragmented;
651 u8 reserved;
652 u8 mac_addr[ETH_ALEN];
653 u8 bcast_sta_id;
654 u8 channel_flags;
655 u8 channel_array[];
656} __packed; /* SCAN_CONFIG_DB_CMD_API_S */
657
658/**
659 * iwl_umac_scan_flags
660 *@IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request
661 * can be preempted by other scan requests with higher priority.
662 * The low priority scan is aborted.
663 *@IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver
664 * when scan starts.
665 */
666enum iwl_umac_scan_flags {
667 IWL_UMAC_SCAN_FLAG_PREEMPTIVE = BIT(0),
668 IWL_UMAC_SCAN_FLAG_START_NOTIF = BIT(1),
669};
670
671enum iwl_umac_scan_uid_offsets {
672 IWL_UMAC_SCAN_UID_TYPE_OFFSET = 0,
673 IWL_UMAC_SCAN_UID_SEQ_OFFSET = 8,
674};
675
676enum iwl_umac_scan_general_flags {
677 IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC = BIT(0),
678 IWL_UMAC_SCAN_GEN_FLAGS_OVER_BT = BIT(1),
679 IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL = BIT(2),
680 IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE = BIT(3),
681 IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT = BIT(4),
682 IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE = BIT(5),
683 IWL_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID = BIT(6),
684 IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED = BIT(7),
685 IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED = BIT(8),
686 IWL_UMAC_SCAN_GEN_FLAGS_MATCH = BIT(9)
687};
688
689/**
690 * struct iwl_scan_channel_cfg_umac
691 * @flags: bitmap - 0-19: directed scan to i'th ssid.
692 * @channel_num: channel number 1-13 etc.
693 * @iter_count: repetition count for the channel.
Sara Sharon0d365ae2015-03-31 12:24:05 +0300694 * @iter_interval: interval between two scan iterations on one channel.
David Spinadeld2496222014-05-20 12:46:37 +0300695 */
696struct iwl_scan_channel_cfg_umac {
697 __le32 flags;
698 u8 channel_num;
699 u8 iter_count;
700 __le16 iter_interval;
701} __packed; /* SCAN_CHANNEL_CFG_S_VER2 */
702
703/**
704 * struct iwl_scan_umac_schedule
705 * @interval: interval in seconds between scan iterations
706 * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop
707 * @reserved: for alignment and future use
708 */
709struct iwl_scan_umac_schedule {
710 __le16 interval;
711 u8 iter_count;
712 u8 reserved;
713} __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */
714
715/**
716 * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command
717 * parameters following channels configuration array.
718 * @schedule: two scheduling plans.
719 * @delay: delay in TUs before starting the first scan iteration
720 * @reserved: for future use and alignment
721 * @preq: probe request with IEs blocks
722 * @direct_scan: list of SSIDs for directed active scan
723 */
724struct iwl_scan_req_umac_tail {
725 /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
726 struct iwl_scan_umac_schedule schedule[2];
727 __le16 delay;
728 __le16 reserved;
729 /* SCAN_PROBE_PARAMS_API_S_VER_1 */
730 struct iwl_scan_probe_req preq;
731 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
732} __packed;
733
734/**
735 * struct iwl_scan_req_umac
736 * @hdr: umac command header
737 * @flags: &enum iwl_umac_scan_flags
738 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
739 * @ooc_priority: out of channel priority - &enum iwl_scan_priority
740 * @general_flags: &enum iwl_umac_scan_general_flags
741 * @reserved1: for future use and alignment
742 * @active_dwell: dwell time for active scan
743 * @passive_dwell: dwell time for passive scan
744 * @fragmented_dwell: dwell time for fragmented passive scan
745 * @max_out_time: max out of serving channel time
746 * @suspend_time: max suspend time
747 * @scan_priority: scan internal prioritization &enum iwl_scan_priority
748 * @channel_flags: &enum iwl_scan_channel_flags
749 * @n_channels: num of channels in scan request
750 * @reserved2: for future use and alignment
751 * @data: &struct iwl_scan_channel_cfg_umac and
752 * &struct iwl_scan_req_umac_tail
753 */
754struct iwl_scan_req_umac {
755 struct iwl_mvm_umac_cmd_hdr hdr;
756 __le32 flags;
757 __le32 uid;
758 __le32 ooc_priority;
759 /* SCAN_GENERAL_PARAMS_API_S_VER_1 */
760 __le32 general_flags;
761 u8 reserved1;
762 u8 active_dwell;
763 u8 passive_dwell;
764 u8 fragmented_dwell;
765 __le32 max_out_time;
766 __le32 suspend_time;
767 __le32 scan_priority;
768 /* SCAN_CHANNEL_PARAMS_API_S_VER_1 */
769 u8 channel_flags;
770 u8 n_channels;
771 __le16 reserved2;
772 u8 data[];
773} __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */
774
775/**
776 * struct iwl_umac_scan_abort
777 * @hdr: umac command header
778 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
779 * @flags: reserved
780 */
781struct iwl_umac_scan_abort {
782 struct iwl_mvm_umac_cmd_hdr hdr;
783 __le32 uid;
784 __le32 flags;
785} __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */
786
787/**
788 * struct iwl_umac_scan_complete
789 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
790 * @last_schedule: last scheduling line
791 * @last_iter: last scan iteration number
792 * @scan status: &enum iwl_scan_offload_complete_status
793 * @ebs_status: &enum iwl_scan_ebs_status
794 * @time_from_last_iter: time elapsed from last iteration
795 * @reserved: for future use
796 */
797struct iwl_umac_scan_complete {
798 __le32 uid;
799 u8 last_schedule;
800 u8 last_iter;
801 u8 status;
802 u8 ebs_status;
803 __le32 time_from_last_iter;
804 __le32 reserved;
805} __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */
806
Luciano Coelhob04998f2014-11-20 15:58:34 +0200807#define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN 5
808/**
809 * struct iwl_scan_offload_profile_match - match information
810 * @bssid: matched bssid
811 * @channel: channel where the match occurred
812 * @energy:
813 * @matching_feature:
814 * @matching_channels: bitmap of channels that matched, referencing
815 * the channels passed in tue scan offload request
816 */
817struct iwl_scan_offload_profile_match {
818 u8 bssid[ETH_ALEN];
819 __le16 reserved;
820 u8 channel;
821 u8 energy;
822 u8 matching_feature;
823 u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN];
824} __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_1 */
825
826/**
827 * struct iwl_scan_offload_profiles_query - match results query response
828 * @matched_profiles: bitmap of matched profiles, referencing the
829 * matches passed in the scan offload request
830 * @last_scan_age: age of the last offloaded scan
831 * @n_scans_done: number of offloaded scans done
832 * @gp2_d0u: GP2 when D0U occurred
833 * @gp2_invoked: GP2 when scan offload was invoked
834 * @resume_while_scanning: not used
835 * @self_recovery: obsolete
836 * @reserved: reserved
837 * @matches: array of match information, one for each match
838 */
839struct iwl_scan_offload_profiles_query {
840 __le32 matched_profiles;
841 __le32 last_scan_age;
842 __le32 n_scans_done;
843 __le32 gp2_d0u;
844 __le32 gp2_invoked;
845 u8 resume_while_scanning;
846 u8 self_recovery;
847 __le16 reserved;
848 struct iwl_scan_offload_profile_match matches[IWL_SCAN_MAX_PROFILES];
849} __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */
850
Avraham Sternee9219b2015-03-23 15:09:27 +0200851/**
852 * struct iwl_umac_scan_iter_complete_notif - notifies end of scanning iteration
853 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
854 * @scanned_channels: number of channels scanned and number of valid elements in
855 * results array
856 * @status: one of SCAN_COMP_STATUS_*
857 * @bt_status: BT on/off status
858 * @last_channel: last channel that was scanned
859 * @tsf_low: TSF timer (lower half) in usecs
860 * @tsf_high: TSF timer (higher half) in usecs
861 * @results: array of scan results, only "scanned_channels" of them are valid
862 */
863struct iwl_umac_scan_iter_complete_notif {
864 __le32 uid;
865 u8 scanned_channels;
866 u8 status;
867 u8 bt_status;
868 u8 last_channel;
869 __le32 tsf_low;
870 __le32 tsf_high;
871 struct iwl_scan_results_notif results[];
872} __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_1 */
873
Johannes Berg8ca151b2013-01-24 14:25:36 +0100874#endif