blob: 1cd7cc087936091303892942c5ee1eec50cc8754 [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 Berg31a658b2017-03-09 15:56:57 +010010 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
Johannes Berg8ca151b2013-01-24 14:25:36 +010011 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * USA
25 *
26 * The full GNU General Public License is included in this distribution
Emmanuel Grumbach410dc5a2013-02-18 09:22:28 +020027 * in the file called COPYING.
Johannes Berg8ca151b2013-01-24 14:25:36 +010028 *
29 * Contact Information:
Emmanuel Grumbachcb2f8272015-11-17 15:39:56 +020030 * Intel Linux Wireless <linuxwifi@intel.com>
Johannes Berg8ca151b2013-01-24 14:25:36 +010031 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
32 *
33 * BSD LICENSE
34 *
Emmanuel Grumbach51368bf2013-12-30 13:15:54 +020035 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
Luciano Coelho507e4cd2015-03-19 22:58:33 +020036 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
Johannes Berg31a658b2017-03-09 15:56:57 +010037 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
Johannes Berg8ca151b2013-01-24 14:25:36 +010038 * All rights reserved.
39 *
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
42 * are met:
43 *
44 * * Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 * * Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in
48 * the documentation and/or other materials provided with the
49 * distribution.
50 * * Neither the name Intel Corporation nor the names of its
51 * contributors may be used to endorse or promote products derived
52 * from this software without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
55 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
56 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
57 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
58 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
59 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
60 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
61 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
62 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
63 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
64 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65 *
66 *****************************************************************************/
67
68#ifndef __fw_api_scan_h__
69#define __fw_api_scan_h__
70
Johannes Berg8ca151b2013-01-24 14:25:36 +010071/* 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.
Johannes Bergacf91dd2017-05-16 16:15:42 +020083 *
84 * @id: element ID
85 * @len: element length
86 * @ssid: element (SSID) data
Johannes Berg8ca151b2013-01-24 14:25:36 +010087 */
88struct iwl_ssid_ie {
89 u8 id;
90 u8 len;
91 u8 ssid[IEEE80211_MAX_SSID_LEN];
92} __packed; /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
93
Johannes Berg8ca151b2013-01-24 14:25:36 +010094/* scan offload */
Johannes Berg8ca151b2013-01-24 14:25:36 +010095#define IWL_SCAN_MAX_BLACKLIST_LEN 64
David Spinadel35a000b2013-08-28 09:29:43 +030096#define IWL_SCAN_SHORT_BLACKLIST_LEN 16
Johannes Berg8ca151b2013-01-24 14:25:36 +010097#define IWL_SCAN_MAX_PROFILES 11
98#define SCAN_OFFLOAD_PROBE_REQ_SIZE 512
99
100/* Default watchdog (in MS) for scheduled scan iteration */
101#define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
102
103#define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
104#define CAN_ABORT_STATUS 1
105
106#define IWL_FULL_SCAN_MULTIPLIER 5
107#define IWL_FAST_SCHED_SCAN_ITERATIONS 3
Avraham Sterncd55cce2015-08-19 12:46:12 +0300108#define IWL_MAX_SCHED_SCAN_PLANS 2
Johannes Berg8ca151b2013-01-24 14:25:36 +0100109
David Spinadel35a000b2013-08-28 09:29:43 +0300110enum scan_framework_client {
111 SCAN_CLIENT_SCHED_SCAN = BIT(0),
112 SCAN_CLIENT_NETDETECT = BIT(1),
113 SCAN_CLIENT_ASSET_TRACKING = BIT(2),
114};
115
Johannes Berg8ca151b2013-01-24 14:25:36 +0100116/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100117 * struct iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S
Johannes Berg8ca151b2013-01-24 14:25:36 +0100118 * @ssid: MAC address to filter out
119 * @reported_rssi: AP rssi reported to the host
David Spinadel35a000b2013-08-28 09:29:43 +0300120 * @client_bitmap: clients ignore this entry - enum scan_framework_client
Johannes Berg8ca151b2013-01-24 14:25:36 +0100121 */
122struct iwl_scan_offload_blacklist {
123 u8 ssid[ETH_ALEN];
124 u8 reported_rssi;
David Spinadel35a000b2013-08-28 09:29:43 +0300125 u8 client_bitmap;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100126} __packed;
127
128enum iwl_scan_offload_network_type {
129 IWL_NETWORK_TYPE_BSS = 1,
130 IWL_NETWORK_TYPE_IBSS = 2,
131 IWL_NETWORK_TYPE_ANY = 3,
132};
133
134enum iwl_scan_offload_band_selection {
135 IWL_SCAN_OFFLOAD_SELECT_2_4 = 0x4,
136 IWL_SCAN_OFFLOAD_SELECT_5_2 = 0x8,
137 IWL_SCAN_OFFLOAD_SELECT_ANY = 0xc,
138};
139
140/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100141 * struct iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S
Johannes Berg8ca151b2013-01-24 14:25:36 +0100142 * @ssid_index: index to ssid list in fixed part
Sara Sharon0d365ae2015-03-31 12:24:05 +0300143 * @unicast_cipher: encryption algorithm to match - bitmap
Johannes Berg83b03192017-05-16 13:28:53 +0200144 * @auth_alg: authentication algorithm to match - bitmap
Johannes Berg8ca151b2013-01-24 14:25:36 +0100145 * @network_type: enum iwl_scan_offload_network_type
146 * @band_selection: enum iwl_scan_offload_band_selection
David Spinadel35a000b2013-08-28 09:29:43 +0300147 * @client_bitmap: clients waiting for match - enum scan_framework_client
Johannes Bergacf91dd2017-05-16 16:15:42 +0200148 * @reserved: reserved
Johannes Berg8ca151b2013-01-24 14:25:36 +0100149 */
150struct iwl_scan_offload_profile {
151 u8 ssid_index;
152 u8 unicast_cipher;
153 u8 auth_alg;
154 u8 network_type;
155 u8 band_selection;
David Spinadel35a000b2013-08-28 09:29:43 +0300156 u8 client_bitmap;
157 u8 reserved[2];
Johannes Berg8ca151b2013-01-24 14:25:36 +0100158} __packed;
159
160/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100161 * struct iwl_scan_offload_profile_cfg - SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1
Johannes Berg8ca151b2013-01-24 14:25:36 +0100162 * @profiles: profiles to search for match
163 * @blacklist_len: length of blacklist
164 * @num_profiles: num of profiles in the list
David Spinadel35a000b2013-08-28 09:29:43 +0300165 * @match_notify: clients waiting for match found notification
166 * @pass_match: clients waiting for the results
167 * @active_clients: active clients bitmap - enum scan_framework_client
David Spinadel6e0bbe52013-12-30 09:59:45 +0200168 * @any_beacon_notify: clients waiting for match notification without match
Johannes Bergacf91dd2017-05-16 16:15:42 +0200169 * @reserved: reserved
Johannes Berg8ca151b2013-01-24 14:25:36 +0100170 */
171struct iwl_scan_offload_profile_cfg {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100172 struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
173 u8 blacklist_len;
174 u8 num_profiles;
David Spinadel35a000b2013-08-28 09:29:43 +0300175 u8 match_notify;
176 u8 pass_match;
177 u8 active_clients;
David Spinadel6e0bbe52013-12-30 09:59:45 +0200178 u8 any_beacon_notify;
179 u8 reserved[2];
Johannes Berg8ca151b2013-01-24 14:25:36 +0100180} __packed;
181
182/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100183 * struct iwl_scan_schedule_lmac - schedule of scan offload
Johannes Berg8ca151b2013-01-24 14:25:36 +0100184 * @delay: delay between iterations, in seconds.
185 * @iterations: num of scan iterations
186 * @full_scan_mul: number of partial scans before each full scan
187 */
Luciano Coelho0bef0382015-04-02 00:25:44 +0300188struct iwl_scan_schedule_lmac {
David Spinadelb14fc2b2014-06-25 13:17:53 +0300189 __le16 delay;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100190 u8 iterations;
191 u8 full_scan_mul;
Luciano Coelho0bef0382015-04-02 00:25:44 +0300192} __packed; /* SCAN_SCHEDULE_API_S */
Johannes Berg8ca151b2013-01-24 14:25:36 +0100193
Luciano Coelho0bef0382015-04-02 00:25:44 +0300194enum iwl_scan_offload_complete_status {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100195 IWL_SCAN_OFFLOAD_COMPLETED = 1,
196 IWL_SCAN_OFFLOAD_ABORTED = 2,
197};
198
Haim Dreyfusse820c2d2014-04-06 11:19:09 +0300199enum iwl_scan_ebs_status {
200 IWL_SCAN_EBS_SUCCESS,
201 IWL_SCAN_EBS_FAILED,
202 IWL_SCAN_EBS_CHAN_NOT_FOUND,
David Spinadelf0bf8592015-05-20 11:56:59 +0300203 IWL_SCAN_EBS_INACTIVE,
Haim Dreyfusse820c2d2014-04-06 11:19:09 +0300204};
205
Johannes Berg8ca151b2013-01-24 14:25:36 +0100206/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100207 * struct iwl_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S
David Spinadelfb98be52014-05-04 12:51:10 +0300208 * @tx_flags: combination of TX_CMD_FLG_*
209 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
210 * cleared. Combination of RATE_MCS_*
211 * @sta_id: index of destination station in FW station table
212 * @reserved: for alignment and future use
213 */
214struct iwl_scan_req_tx_cmd {
215 __le32 tx_flags;
216 __le32 rate_n_flags;
217 u8 sta_id;
218 u8 reserved[3];
219} __packed;
220
221enum iwl_scan_channel_flags_lmac {
222 IWL_UNIFIED_SCAN_CHANNEL_FULL = BIT(27),
223 IWL_UNIFIED_SCAN_CHANNEL_PARTIAL = BIT(28),
224};
225
226/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100227 * struct iwl_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2
David Spinadelfb98be52014-05-04 12:51:10 +0300228 * @flags: bits 1-20: directed scan to i'th ssid
229 * other bits &enum iwl_scan_channel_flags_lmac
Johannes Berg83b03192017-05-16 13:28:53 +0200230 * @channel_num: channel number 1-13 etc
David Spinadelfb98be52014-05-04 12:51:10 +0300231 * @iter_count: scan iteration on this channel
232 * @iter_interval: interval in seconds between iterations on one channel
233 */
234struct iwl_scan_channel_cfg_lmac {
235 __le32 flags;
236 __le16 channel_num;
237 __le16 iter_count;
238 __le32 iter_interval;
239} __packed;
240
241/*
Johannes Berg31a658b2017-03-09 15:56:57 +0100242 * struct iwl_scan_probe_segment - PROBE_SEGMENT_API_S_VER_1
David Spinadelfb98be52014-05-04 12:51:10 +0300243 * @offset: offset in the data block
244 * @len: length of the segment
245 */
246struct iwl_scan_probe_segment {
247 __le16 offset;
248 __le16 len;
249} __packed;
250
251/* iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_2
252 * @mac_header: first (and common) part of the probe
253 * @band_data: band specific data
254 * @common_data: last (and common) part of the probe
255 * @buf: raw data block
256 */
257struct iwl_scan_probe_req {
258 struct iwl_scan_probe_segment mac_header;
259 struct iwl_scan_probe_segment band_data[2];
260 struct iwl_scan_probe_segment common_data;
261 u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
262} __packed;
263
264enum iwl_scan_channel_flags {
265 IWL_SCAN_CHANNEL_FLAG_EBS = BIT(0),
266 IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE = BIT(1),
267 IWL_SCAN_CHANNEL_FLAG_CACHE_ADD = BIT(2),
268};
269
Johannes Berg31a658b2017-03-09 15:56:57 +0100270/* struct iwl_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S
David Spinadel1f9c4182014-12-01 23:30:07 +0200271 * @flags: enum iwl_scan_channel_flags
272 * @non_ebs_ratio: defines the ratio of number of scan iterations where EBS is
273 * involved.
274 * 1 - EBS is disabled.
275 * 2 - every second scan will be full scan(and so on).
David Spinadelfb98be52014-05-04 12:51:10 +0300276 */
277struct iwl_scan_channel_opt {
278 __le16 flags;
279 __le16 non_ebs_ratio;
280} __packed;
281
282/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100283 * enum iwl_mvm_lmac_scan_flags - LMAC scan flags
David Spinadelfb98be52014-05-04 12:51:10 +0300284 * @IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses
285 * without filtering.
286 * @IWL_MVM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels
287 * @IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan
288 * @IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification
Johannes Bergacf91dd2017-05-16 16:15:42 +0200289 * @IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS: multiple SSID matching
David Spinadelfb98be52014-05-04 12:51:10 +0300290 * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented
Andrei Otcheretianski73897bd2014-07-09 18:59:14 +0300291 * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report
292 * and DS parameter set IEs into probe requests.
David Spinadelc3e230b2015-11-22 16:37:36 +0200293 * @IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL: use extended dwell time on channels
294 * 1, 6 and 11.
David Spinadel7e2a3882014-12-23 14:38:09 +0200295 * @IWL_MVM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches
David Spinadelfb98be52014-05-04 12:51:10 +0300296 */
297enum iwl_mvm_lmac_scan_flags {
298 IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL = BIT(0),
299 IWL_MVM_LMAC_SCAN_FLAG_PASSIVE = BIT(1),
300 IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION = BIT(2),
301 IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE = BIT(3),
302 IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = BIT(4),
303 IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED = BIT(5),
Andrei Otcheretianski73897bd2014-07-09 18:59:14 +0300304 IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6),
David Spinadelc3e230b2015-11-22 16:37:36 +0200305 IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL = BIT(7),
David Spinadel7e2a3882014-12-23 14:38:09 +0200306 IWL_MVM_LMAC_SCAN_FLAG_MATCH = BIT(9),
David Spinadelfb98be52014-05-04 12:51:10 +0300307};
308
309enum iwl_scan_priority {
310 IWL_SCAN_PRIORITY_LOW,
311 IWL_SCAN_PRIORITY_MEDIUM,
312 IWL_SCAN_PRIORITY_HIGH,
313};
314
Avraham Sternd7afbfc2015-05-12 12:19:48 +0300315enum iwl_scan_priority_ext {
316 IWL_SCAN_PRIORITY_EXT_0_LOWEST,
317 IWL_SCAN_PRIORITY_EXT_1,
318 IWL_SCAN_PRIORITY_EXT_2,
319 IWL_SCAN_PRIORITY_EXT_3,
320 IWL_SCAN_PRIORITY_EXT_4,
321 IWL_SCAN_PRIORITY_EXT_5,
322 IWL_SCAN_PRIORITY_EXT_6,
323 IWL_SCAN_PRIORITY_EXT_7_HIGHEST,
324};
325
David Spinadelfb98be52014-05-04 12:51:10 +0300326/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100327 * struct iwl_scan_req_lmac - SCAN_REQUEST_CMD_API_S_VER_1
David Spinadelfb98be52014-05-04 12:51:10 +0300328 * @reserved1: for alignment and future use
Johannes Berg83b03192017-05-16 13:28:53 +0200329 * @n_channels: num of channels to scan
Johannes Bergacf91dd2017-05-16 16:15:42 +0200330 * @active_dwell: dwell time for active channels
331 * @passive_dwell: dwell time for passive channels
332 * @fragmented_dwell: dwell time for fragmented passive scan
David Spinadelc3e230b2015-11-22 16:37:36 +0200333 * @extended_dwell: dwell time for channels 1, 6 and 11 (in certain cases)
David Spinadelfb98be52014-05-04 12:51:10 +0300334 * @reserved2: for alignment and future use
Johannes Berg83b03192017-05-16 13:28:53 +0200335 * @rx_chain_select: PHY_RX_CHAIN_* flags
David Spinadelfb98be52014-05-04 12:51:10 +0300336 * @scan_flags: &enum iwl_mvm_lmac_scan_flags
337 * @max_out_time: max time (in TU) to be out of associated channel
338 * @suspend_time: pause scan this long (TUs) when returning to service channel
339 * @flags: RXON flags
340 * @filter_flags: RXON filter
341 * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz
342 * @direct_scan: list of SSIDs for directed active scan
343 * @scan_prio: enum iwl_scan_priority
344 * @iter_num: number of scan iterations
345 * @delay: delay in seconds before first iteration
346 * @schedule: two scheduling plans. The first one is finite, the second one can
347 * be infinite.
348 * @channel_opt: channel optimization options, for full and partial scan
349 * @data: channel configuration and probe request packet.
350 */
Luciano Coelho65ff5562015-03-20 13:35:47 +0200351struct iwl_scan_req_lmac {
David Spinadelfb98be52014-05-04 12:51:10 +0300352 /* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */
353 __le32 reserved1;
354 u8 n_channels;
355 u8 active_dwell;
356 u8 passive_dwell;
357 u8 fragmented_dwell;
David Spinadelc3e230b2015-11-22 16:37:36 +0200358 u8 extended_dwell;
359 u8 reserved2;
David Spinadelfb98be52014-05-04 12:51:10 +0300360 __le16 rx_chain_select;
361 __le32 scan_flags;
362 __le32 max_out_time;
363 __le32 suspend_time;
364 /* RX_ON_FLAGS_API_S_VER_1 */
365 __le32 flags;
366 __le32 filter_flags;
367 struct iwl_scan_req_tx_cmd tx_cmd[2];
368 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
369 __le32 scan_prio;
370 /* SCAN_REQ_PERIODIC_PARAMS_API_S */
371 __le32 iter_num;
372 __le32 delay;
Avraham Sterncd55cce2015-08-19 12:46:12 +0300373 struct iwl_scan_schedule_lmac schedule[IWL_MAX_SCHED_SCAN_PLANS];
David Spinadelfb98be52014-05-04 12:51:10 +0300374 struct iwl_scan_channel_opt channel_opt[2];
375 u8 data[];
376} __packed;
377
378/**
Avraham Stern1083fd72015-03-31 16:14:41 +0300379 * struct iwl_scan_results_notif - scan results for one channel -
David Spinadelfb98be52014-05-04 12:51:10 +0300380 * SCAN_RESULT_NTF_API_S_VER_3
381 * @channel: which channel the results are from
382 * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
383 * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
384 * @num_probe_not_sent: # of request that weren't sent due to not enough time
385 * @duration: duration spent in channel, in usecs
386 */
Avraham Stern1083fd72015-03-31 16:14:41 +0300387struct iwl_scan_results_notif {
David Spinadelfb98be52014-05-04 12:51:10 +0300388 u8 channel;
389 u8 band;
390 u8 probe_status;
391 u8 num_probe_not_sent;
392 __le32 duration;
393} __packed;
394
395/**
396 * struct iwl_lmac_scan_complete_notif - notifies end of scanning (all channels)
397 * SCAN_COMPLETE_NTF_API_S_VER_3
398 * @scanned_channels: number of channels scanned (and number of valid results)
399 * @status: one of SCAN_COMP_STATUS_*
400 * @bt_status: BT on/off status
401 * @last_channel: last channel that was scanned
402 * @tsf_low: TSF timer (lower half) in usecs
403 * @tsf_high: TSF timer (higher half) in usecs
404 * @results: an array of scan results, only "scanned_channels" of them are valid
405 */
406struct iwl_lmac_scan_complete_notif {
407 u8 scanned_channels;
408 u8 status;
409 u8 bt_status;
410 u8 last_channel;
411 __le32 tsf_low;
412 __le32 tsf_high;
413 struct iwl_scan_results_notif results[];
414} __packed;
415
416/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100417 * struct iwl_scan_offload_complete - PERIODIC_SCAN_COMPLETE_NTF_API_S_VER_2
David Spinadelfb98be52014-05-04 12:51:10 +0300418 * @last_schedule_line: last schedule line executed (fast or regular)
419 * @last_schedule_iteration: last scan iteration executed before scan abort
Johannes Bergacf91dd2017-05-16 16:15:42 +0200420 * @status: &enum iwl_scan_offload_complete_status
David Spinadelfb98be52014-05-04 12:51:10 +0300421 * @ebs_status: EBS success status &enum iwl_scan_ebs_status
Johannes Bergacf91dd2017-05-16 16:15:42 +0200422 * @time_after_last_iter: time in seconds elapsed after last iteration
423 * @reserved: reserved
David Spinadelfb98be52014-05-04 12:51:10 +0300424 */
425struct iwl_periodic_scan_complete {
426 u8 last_schedule_line;
427 u8 last_schedule_iteration;
428 u8 status;
429 u8 ebs_status;
430 __le32 time_after_last_iter;
431 __le32 reserved;
432} __packed;
433
David Spinadeld2496222014-05-20 12:46:37 +0300434/* UMAC Scan API */
435
Luciano Coelho507e4cd2015-03-19 22:58:33 +0200436/* The maximum of either of these cannot exceed 8, because we use an
437 * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h).
438 */
439#define IWL_MVM_MAX_UMAC_SCANS 8
440#define IWL_MVM_MAX_LMAC_SCANS 1
David Spinadeld2496222014-05-20 12:46:37 +0300441
442enum scan_config_flags {
443 SCAN_CONFIG_FLAG_ACTIVATE = BIT(0),
444 SCAN_CONFIG_FLAG_DEACTIVATE = BIT(1),
445 SCAN_CONFIG_FLAG_FORBID_CHUB_REQS = BIT(2),
446 SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS = BIT(3),
447 SCAN_CONFIG_FLAG_SET_TX_CHAINS = BIT(8),
448 SCAN_CONFIG_FLAG_SET_RX_CHAINS = BIT(9),
449 SCAN_CONFIG_FLAG_SET_AUX_STA_ID = BIT(10),
450 SCAN_CONFIG_FLAG_SET_ALL_TIMES = BIT(11),
451 SCAN_CONFIG_FLAG_SET_EFFECTIVE_TIMES = BIT(12),
452 SCAN_CONFIG_FLAG_SET_CHANNEL_FLAGS = BIT(13),
453 SCAN_CONFIG_FLAG_SET_LEGACY_RATES = BIT(14),
454 SCAN_CONFIG_FLAG_SET_MAC_ADDR = BIT(15),
455 SCAN_CONFIG_FLAG_SET_FRAGMENTED = BIT(16),
456 SCAN_CONFIG_FLAG_CLEAR_FRAGMENTED = BIT(17),
457 SCAN_CONFIG_FLAG_SET_CAM_MODE = BIT(18),
458 SCAN_CONFIG_FLAG_CLEAR_CAM_MODE = BIT(19),
459 SCAN_CONFIG_FLAG_SET_PROMISC_MODE = BIT(20),
460 SCAN_CONFIG_FLAG_CLEAR_PROMISC_MODE = BIT(21),
Sara Sharon9ba221b2016-11-17 11:35:05 +0200461 SCAN_CONFIG_FLAG_SET_LMAC2_FRAGMENTED = BIT(22),
462 SCAN_CONFIG_FLAG_CLEAR_LMAC2_FRAGMENTED = BIT(23),
David Spinadeld2496222014-05-20 12:46:37 +0300463
464 /* Bits 26-31 are for num of channels in channel_array */
465#define SCAN_CONFIG_N_CHANNELS(n) ((n) << 26)
466};
467
468enum scan_config_rates {
469 /* OFDM basic rates */
470 SCAN_CONFIG_RATE_6M = BIT(0),
471 SCAN_CONFIG_RATE_9M = BIT(1),
472 SCAN_CONFIG_RATE_12M = BIT(2),
473 SCAN_CONFIG_RATE_18M = BIT(3),
474 SCAN_CONFIG_RATE_24M = BIT(4),
475 SCAN_CONFIG_RATE_36M = BIT(5),
476 SCAN_CONFIG_RATE_48M = BIT(6),
477 SCAN_CONFIG_RATE_54M = BIT(7),
478 /* CCK basic rates */
479 SCAN_CONFIG_RATE_1M = BIT(8),
480 SCAN_CONFIG_RATE_2M = BIT(9),
481 SCAN_CONFIG_RATE_5M = BIT(10),
482 SCAN_CONFIG_RATE_11M = BIT(11),
483
484 /* Bits 16-27 are for supported rates */
485#define SCAN_CONFIG_SUPPORTED_RATE(rate) ((rate) << 16)
486};
487
488enum iwl_channel_flags {
489 IWL_CHANNEL_FLAG_EBS = BIT(0),
490 IWL_CHANNEL_FLAG_ACCURATE_EBS = BIT(1),
491 IWL_CHANNEL_FLAG_EBS_ADD = BIT(2),
492 IWL_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE = BIT(3),
493};
494
495/**
Sara Sharon9ba221b2016-11-17 11:35:05 +0200496 * struct iwl_scan_dwell
497 * @active: default dwell time for active scan
498 * @passive: default dwell time for passive scan
499 * @fragmented: default dwell time for fragmented scan
500 * @extended: default dwell time for channels 1, 6 and 11
501 */
502struct iwl_scan_dwell {
503 u8 active;
504 u8 passive;
505 u8 fragmented;
506 u8 extended;
507} __packed;
508
509/**
David Spinadeld2496222014-05-20 12:46:37 +0300510 * struct iwl_scan_config
David Spinadeld2496222014-05-20 12:46:37 +0300511 * @flags: enum scan_config_flags
512 * @tx_chains: valid_tx antenna - ANT_* definitions
513 * @rx_chains: valid_rx antenna - ANT_* definitions
514 * @legacy_rates: default legacy rates - enum scan_config_rates
515 * @out_of_channel_time: default max out of serving channel time
516 * @suspend_time: default max suspend time
Sara Sharon9ba221b2016-11-17 11:35:05 +0200517 * @dwell: dwells for the scan
David Spinadeld2496222014-05-20 12:46:37 +0300518 * @mac_addr: default mac address to be used in probes
519 * @bcast_sta_id: the index of the station in the fw
520 * @channel_flags: default channel flags - enum iwl_channel_flags
521 * scan_config_channel_flag
522 * @channel_array: default supported channels
523 */
Sara Sharona0b48282017-01-12 16:01:11 +0200524struct iwl_scan_config_v1 {
David Spinadeld2496222014-05-20 12:46:37 +0300525 __le32 flags;
526 __le32 tx_chains;
527 __le32 rx_chains;
528 __le32 legacy_rates;
529 __le32 out_of_channel_time;
530 __le32 suspend_time;
Sara Sharon9ba221b2016-11-17 11:35:05 +0200531 struct iwl_scan_dwell dwell;
David Spinadeld2496222014-05-20 12:46:37 +0300532 u8 mac_addr[ETH_ALEN];
533 u8 bcast_sta_id;
534 u8 channel_flags;
535 u8 channel_array[];
536} __packed; /* SCAN_CONFIG_DB_CMD_API_S */
537
Sara Sharon9ba221b2016-11-17 11:35:05 +0200538#define SCAN_TWO_LMACS 2
539
Sara Sharona0b48282017-01-12 16:01:11 +0200540struct iwl_scan_config {
Sara Sharon9ba221b2016-11-17 11:35:05 +0200541 __le32 flags;
542 __le32 tx_chains;
543 __le32 rx_chains;
544 __le32 legacy_rates;
545 __le32 out_of_channel_time[SCAN_TWO_LMACS];
546 __le32 suspend_time[SCAN_TWO_LMACS];
547 struct iwl_scan_dwell dwell;
548 u8 mac_addr[ETH_ALEN];
549 u8 bcast_sta_id;
550 u8 channel_flags;
551 u8 channel_array[];
552} __packed; /* SCAN_CONFIG_DB_CMD_API_S_3 */
553
David Spinadeld2496222014-05-20 12:46:37 +0300554/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100555 * enum iwl_umac_scan_flags - UMAC scan flags
556 * @IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request
David Spinadeld2496222014-05-20 12:46:37 +0300557 * can be preempted by other scan requests with higher priority.
Avraham Stern8465fe62015-06-21 12:06:13 +0300558 * The low priority scan will be resumed when the higher proirity scan is
559 * completed.
Johannes Berg31a658b2017-03-09 15:56:57 +0100560 * @IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver
David Spinadeld2496222014-05-20 12:46:37 +0300561 * when scan starts.
562 */
563enum iwl_umac_scan_flags {
564 IWL_UMAC_SCAN_FLAG_PREEMPTIVE = BIT(0),
565 IWL_UMAC_SCAN_FLAG_START_NOTIF = BIT(1),
566};
567
568enum iwl_umac_scan_uid_offsets {
569 IWL_UMAC_SCAN_UID_TYPE_OFFSET = 0,
570 IWL_UMAC_SCAN_UID_SEQ_OFFSET = 8,
571};
572
573enum iwl_umac_scan_general_flags {
Sara Sharon9ba221b2016-11-17 11:35:05 +0200574 IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC = BIT(0),
575 IWL_UMAC_SCAN_GEN_FLAGS_OVER_BT = BIT(1),
576 IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL = BIT(2),
577 IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE = BIT(3),
578 IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT = BIT(4),
579 IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE = BIT(5),
580 IWL_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID = BIT(6),
581 IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED = BIT(7),
582 IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED = BIT(8),
583 IWL_UMAC_SCAN_GEN_FLAGS_MATCH = BIT(9),
584 IWL_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL = BIT(10),
585 IWL_UMAC_SCAN_GEN_FLAGS_LMAC2_FRAGMENTED = BIT(11),
David Spinadeld2496222014-05-20 12:46:37 +0300586};
587
588/**
589 * struct iwl_scan_channel_cfg_umac
590 * @flags: bitmap - 0-19: directed scan to i'th ssid.
591 * @channel_num: channel number 1-13 etc.
592 * @iter_count: repetition count for the channel.
Sara Sharon0d365ae2015-03-31 12:24:05 +0300593 * @iter_interval: interval between two scan iterations on one channel.
David Spinadeld2496222014-05-20 12:46:37 +0300594 */
595struct iwl_scan_channel_cfg_umac {
596 __le32 flags;
597 u8 channel_num;
598 u8 iter_count;
599 __le16 iter_interval;
600} __packed; /* SCAN_CHANNEL_CFG_S_VER2 */
601
602/**
603 * struct iwl_scan_umac_schedule
604 * @interval: interval in seconds between scan iterations
605 * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop
606 * @reserved: for alignment and future use
607 */
608struct iwl_scan_umac_schedule {
609 __le16 interval;
610 u8 iter_count;
611 u8 reserved;
612} __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */
613
614/**
615 * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command
616 * parameters following channels configuration array.
617 * @schedule: two scheduling plans.
618 * @delay: delay in TUs before starting the first scan iteration
619 * @reserved: for future use and alignment
620 * @preq: probe request with IEs blocks
621 * @direct_scan: list of SSIDs for directed active scan
622 */
623struct iwl_scan_req_umac_tail {
624 /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
Avraham Sterncd55cce2015-08-19 12:46:12 +0300625 struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
David Spinadeld2496222014-05-20 12:46:37 +0300626 __le16 delay;
627 __le16 reserved;
628 /* SCAN_PROBE_PARAMS_API_S_VER_1 */
629 struct iwl_scan_probe_req preq;
630 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
631} __packed;
632
633/**
634 * struct iwl_scan_req_umac
David Spinadeld2496222014-05-20 12:46:37 +0300635 * @flags: &enum iwl_umac_scan_flags
636 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
637 * @ooc_priority: out of channel priority - &enum iwl_scan_priority
638 * @general_flags: &enum iwl_umac_scan_general_flags
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300639 * @reserved2: for future use and alignment
640 * @scan_start_mac_id: report the scan start TSF time according to this mac TSF
David Spinadelc3e230b2015-11-22 16:37:36 +0200641 * @extended_dwell: dwell time for channels 1, 6 and 11
David Spinadeld2496222014-05-20 12:46:37 +0300642 * @active_dwell: dwell time for active scan
643 * @passive_dwell: dwell time for passive scan
644 * @fragmented_dwell: dwell time for fragmented passive scan
Sara Sharon9ba221b2016-11-17 11:35:05 +0200645 * @max_out_time: max out of serving channel time, per LMAC - for CDB there
646 * are 2 LMACs
647 * @suspend_time: max suspend time, per LMAC - for CDB there are 2 LMACs
David Spinadeld2496222014-05-20 12:46:37 +0300648 * @scan_priority: scan internal prioritization &enum iwl_scan_priority
649 * @channel_flags: &enum iwl_scan_channel_flags
650 * @n_channels: num of channels in scan request
David Spinadelc3e230b2015-11-22 16:37:36 +0200651 * @reserved: for future use and alignment
David Spinadeld2496222014-05-20 12:46:37 +0300652 * @data: &struct iwl_scan_channel_cfg_umac and
653 * &struct iwl_scan_req_umac_tail
654 */
655struct iwl_scan_req_umac {
David Spinadeld2496222014-05-20 12:46:37 +0300656 __le32 flags;
657 __le32 uid;
658 __le32 ooc_priority;
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300659 /* SCAN_GENERAL_PARAMS_API_S_VER_4 */
660 __le16 general_flags;
661 u8 reserved2;
662 u8 scan_start_mac_id;
David Spinadelc3e230b2015-11-22 16:37:36 +0200663 u8 extended_dwell;
David Spinadeld2496222014-05-20 12:46:37 +0300664 u8 active_dwell;
665 u8 passive_dwell;
666 u8 fragmented_dwell;
Sara Sharon9ba221b2016-11-17 11:35:05 +0200667 union {
668 struct {
669 __le32 max_out_time;
670 __le32 suspend_time;
671 __le32 scan_priority;
672 /* SCAN_CHANNEL_PARAMS_API_S_VER_4 */
673 u8 channel_flags;
674 u8 n_channels;
675 __le16 reserved;
676 u8 data[];
Sara Sharona0b48282017-01-12 16:01:11 +0200677 } v1; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */
Sara Sharon9ba221b2016-11-17 11:35:05 +0200678 struct {
679 __le32 max_out_time[SCAN_TWO_LMACS];
680 __le32 suspend_time[SCAN_TWO_LMACS];
681 __le32 scan_priority;
682 /* SCAN_CHANNEL_PARAMS_API_S_VER_4 */
683 u8 channel_flags;
684 u8 n_channels;
685 __le16 reserved;
686 u8 data[];
Sara Sharona0b48282017-01-12 16:01:11 +0200687 } v6; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_6 */
Sara Sharon9ba221b2016-11-17 11:35:05 +0200688 };
689} __packed;
690
Sara Sharona0b48282017-01-12 16:01:11 +0200691#define IWL_SCAN_REQ_UMAC_SIZE sizeof(struct iwl_scan_req_umac)
692#define IWL_SCAN_REQ_UMAC_SIZE_V1 (sizeof(struct iwl_scan_req_umac) - \
693 2 * sizeof(__le32))
David Spinadeld2496222014-05-20 12:46:37 +0300694
695/**
696 * struct iwl_umac_scan_abort
David Spinadeld2496222014-05-20 12:46:37 +0300697 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
698 * @flags: reserved
699 */
700struct iwl_umac_scan_abort {
David Spinadeld2496222014-05-20 12:46:37 +0300701 __le32 uid;
702 __le32 flags;
703} __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */
704
705/**
706 * struct iwl_umac_scan_complete
707 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
708 * @last_schedule: last scheduling line
Johannes Bergacf91dd2017-05-16 16:15:42 +0200709 * @last_iter: last scan iteration number
710 * @status: &enum iwl_scan_offload_complete_status
David Spinadeld2496222014-05-20 12:46:37 +0300711 * @ebs_status: &enum iwl_scan_ebs_status
712 * @time_from_last_iter: time elapsed from last iteration
713 * @reserved: for future use
714 */
715struct iwl_umac_scan_complete {
716 __le32 uid;
717 u8 last_schedule;
718 u8 last_iter;
719 u8 status;
720 u8 ebs_status;
721 __le32 time_from_last_iter;
722 __le32 reserved;
723} __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */
724
Luciano Coelhob04998f2014-11-20 15:58:34 +0200725#define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN 5
726/**
727 * struct iwl_scan_offload_profile_match - match information
728 * @bssid: matched bssid
Johannes Bergacf91dd2017-05-16 16:15:42 +0200729 * @reserved: reserved
Luciano Coelhob04998f2014-11-20 15:58:34 +0200730 * @channel: channel where the match occurred
Johannes Bergacf91dd2017-05-16 16:15:42 +0200731 * @energy: energy
732 * @matching_feature: feature matches
Luciano Coelhob04998f2014-11-20 15:58:34 +0200733 * @matching_channels: bitmap of channels that matched, referencing
734 * the channels passed in tue scan offload request
735 */
736struct iwl_scan_offload_profile_match {
737 u8 bssid[ETH_ALEN];
738 __le16 reserved;
739 u8 channel;
740 u8 energy;
741 u8 matching_feature;
742 u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN];
743} __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_1 */
744
745/**
746 * struct iwl_scan_offload_profiles_query - match results query response
747 * @matched_profiles: bitmap of matched profiles, referencing the
748 * matches passed in the scan offload request
749 * @last_scan_age: age of the last offloaded scan
750 * @n_scans_done: number of offloaded scans done
751 * @gp2_d0u: GP2 when D0U occurred
752 * @gp2_invoked: GP2 when scan offload was invoked
753 * @resume_while_scanning: not used
754 * @self_recovery: obsolete
755 * @reserved: reserved
756 * @matches: array of match information, one for each match
757 */
758struct iwl_scan_offload_profiles_query {
759 __le32 matched_profiles;
760 __le32 last_scan_age;
761 __le32 n_scans_done;
762 __le32 gp2_d0u;
763 __le32 gp2_invoked;
764 u8 resume_while_scanning;
765 u8 self_recovery;
766 __le16 reserved;
767 struct iwl_scan_offload_profile_match matches[IWL_SCAN_MAX_PROFILES];
768} __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */
769
Avraham Sternee9219b2015-03-23 15:09:27 +0200770/**
771 * struct iwl_umac_scan_iter_complete_notif - notifies end of scanning iteration
772 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
773 * @scanned_channels: number of channels scanned and number of valid elements in
774 * results array
775 * @status: one of SCAN_COMP_STATUS_*
776 * @bt_status: BT on/off status
777 * @last_channel: last channel that was scanned
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300778 * @start_tsf: TSF timer in usecs of the scan start time for the mac specified
779 * in &struct iwl_scan_req_umac.
Johannes Berg550aba92017-04-26 13:34:29 +0200780 * @results: array of scan results, length in @scanned_channels
Avraham Sternee9219b2015-03-23 15:09:27 +0200781 */
782struct iwl_umac_scan_iter_complete_notif {
783 __le32 uid;
784 u8 scanned_channels;
785 u8 status;
786 u8 bt_status;
787 u8 last_channel;
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300788 __le64 start_tsf;
Avraham Sternee9219b2015-03-23 15:09:27 +0200789 struct iwl_scan_results_notif results[];
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300790} __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_2 */
Avraham Sternee9219b2015-03-23 15:09:27 +0200791
Johannes Berg8ca151b2013-01-24 14:25:36 +0100792#endif