blob: dded91d7eb96b229395605ba314f1dc7fe4ad14f [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
71#include "fw-api.h"
72
73/* Scan Commands, Responses, Notifications */
74
Johannes Berg8ca151b2013-01-24 14:25:36 +010075/* Max number of IEs for direct SSID scans in a command */
76#define PROBE_OPTION_MAX 20
77
78/**
Johannes Berg8ca151b2013-01-24 14:25:36 +010079 * struct iwl_ssid_ie - directed scan network information element
80 *
81 * Up to 20 of these may appear in REPLY_SCAN_CMD,
82 * selected by "type" bit field in struct iwl_scan_channel;
83 * each channel may select different ssids from among the 20 entries.
84 * SSID IEs get transmitted in reverse order of entry.
85 */
86struct iwl_ssid_ie {
87 u8 id;
88 u8 len;
89 u8 ssid[IEEE80211_MAX_SSID_LEN];
90} __packed; /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
91
Johannes Berg8ca151b2013-01-24 14:25:36 +010092/* scan offload */
Johannes Berg8ca151b2013-01-24 14:25:36 +010093#define IWL_SCAN_MAX_BLACKLIST_LEN 64
David Spinadel35a000b2013-08-28 09:29:43 +030094#define IWL_SCAN_SHORT_BLACKLIST_LEN 16
Johannes Berg8ca151b2013-01-24 14:25:36 +010095#define IWL_SCAN_MAX_PROFILES 11
96#define SCAN_OFFLOAD_PROBE_REQ_SIZE 512
97
98/* Default watchdog (in MS) for scheduled scan iteration */
99#define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
100
101#define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
102#define CAN_ABORT_STATUS 1
103
104#define IWL_FULL_SCAN_MULTIPLIER 5
105#define IWL_FAST_SCHED_SCAN_ITERATIONS 3
Avraham Sterncd55cce2015-08-19 12:46:12 +0300106#define IWL_MAX_SCHED_SCAN_PLANS 2
Johannes Berg8ca151b2013-01-24 14:25:36 +0100107
David Spinadel35a000b2013-08-28 09:29:43 +0300108enum scan_framework_client {
109 SCAN_CLIENT_SCHED_SCAN = BIT(0),
110 SCAN_CLIENT_NETDETECT = BIT(1),
111 SCAN_CLIENT_ASSET_TRACKING = BIT(2),
112};
113
Johannes Berg8ca151b2013-01-24 14:25:36 +0100114/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100115 * struct iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S
Johannes Berg8ca151b2013-01-24 14:25:36 +0100116 * @ssid: MAC address to filter out
117 * @reported_rssi: AP rssi reported to the host
David Spinadel35a000b2013-08-28 09:29:43 +0300118 * @client_bitmap: clients ignore this entry - enum scan_framework_client
Johannes Berg8ca151b2013-01-24 14:25:36 +0100119 */
120struct iwl_scan_offload_blacklist {
121 u8 ssid[ETH_ALEN];
122 u8 reported_rssi;
David Spinadel35a000b2013-08-28 09:29:43 +0300123 u8 client_bitmap;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100124} __packed;
125
126enum iwl_scan_offload_network_type {
127 IWL_NETWORK_TYPE_BSS = 1,
128 IWL_NETWORK_TYPE_IBSS = 2,
129 IWL_NETWORK_TYPE_ANY = 3,
130};
131
132enum iwl_scan_offload_band_selection {
133 IWL_SCAN_OFFLOAD_SELECT_2_4 = 0x4,
134 IWL_SCAN_OFFLOAD_SELECT_5_2 = 0x8,
135 IWL_SCAN_OFFLOAD_SELECT_ANY = 0xc,
136};
137
138/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100139 * struct iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S
Johannes Berg8ca151b2013-01-24 14:25:36 +0100140 * @ssid_index: index to ssid list in fixed part
Sara Sharon0d365ae2015-03-31 12:24:05 +0300141 * @unicast_cipher: encryption algorithm to match - bitmap
142 * @aut_alg: authentication algorithm to match - bitmap
Johannes Berg8ca151b2013-01-24 14:25:36 +0100143 * @network_type: enum iwl_scan_offload_network_type
144 * @band_selection: enum iwl_scan_offload_band_selection
David Spinadel35a000b2013-08-28 09:29:43 +0300145 * @client_bitmap: clients waiting for match - enum scan_framework_client
Johannes Berg8ca151b2013-01-24 14:25:36 +0100146 */
147struct iwl_scan_offload_profile {
148 u8 ssid_index;
149 u8 unicast_cipher;
150 u8 auth_alg;
151 u8 network_type;
152 u8 band_selection;
David Spinadel35a000b2013-08-28 09:29:43 +0300153 u8 client_bitmap;
154 u8 reserved[2];
Johannes Berg8ca151b2013-01-24 14:25:36 +0100155} __packed;
156
157/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100158 * struct iwl_scan_offload_profile_cfg - SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1
Johannes Berg8ca151b2013-01-24 14:25:36 +0100159 * @profiles: profiles to search for match
160 * @blacklist_len: length of blacklist
161 * @num_profiles: num of profiles in the list
David Spinadel35a000b2013-08-28 09:29:43 +0300162 * @match_notify: clients waiting for match found notification
163 * @pass_match: clients waiting for the results
164 * @active_clients: active clients bitmap - enum scan_framework_client
David Spinadel6e0bbe52013-12-30 09:59:45 +0200165 * @any_beacon_notify: clients waiting for match notification without match
Johannes Berg8ca151b2013-01-24 14:25:36 +0100166 */
167struct iwl_scan_offload_profile_cfg {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100168 struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
169 u8 blacklist_len;
170 u8 num_profiles;
David Spinadel35a000b2013-08-28 09:29:43 +0300171 u8 match_notify;
172 u8 pass_match;
173 u8 active_clients;
David Spinadel6e0bbe52013-12-30 09:59:45 +0200174 u8 any_beacon_notify;
175 u8 reserved[2];
Johannes Berg8ca151b2013-01-24 14:25:36 +0100176} __packed;
177
178/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100179 * struct iwl_scan_schedule_lmac - schedule of scan offload
Johannes Berg8ca151b2013-01-24 14:25:36 +0100180 * @delay: delay between iterations, in seconds.
181 * @iterations: num of scan iterations
182 * @full_scan_mul: number of partial scans before each full scan
183 */
Luciano Coelho0bef0382015-04-02 00:25:44 +0300184struct iwl_scan_schedule_lmac {
David Spinadelb14fc2b2014-06-25 13:17:53 +0300185 __le16 delay;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100186 u8 iterations;
187 u8 full_scan_mul;
Luciano Coelho0bef0382015-04-02 00:25:44 +0300188} __packed; /* SCAN_SCHEDULE_API_S */
Johannes Berg8ca151b2013-01-24 14:25:36 +0100189
Luciano Coelho0bef0382015-04-02 00:25:44 +0300190enum iwl_scan_offload_complete_status {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100191 IWL_SCAN_OFFLOAD_COMPLETED = 1,
192 IWL_SCAN_OFFLOAD_ABORTED = 2,
193};
194
Haim Dreyfusse820c2d2014-04-06 11:19:09 +0300195enum iwl_scan_ebs_status {
196 IWL_SCAN_EBS_SUCCESS,
197 IWL_SCAN_EBS_FAILED,
198 IWL_SCAN_EBS_CHAN_NOT_FOUND,
David Spinadelf0bf8592015-05-20 11:56:59 +0300199 IWL_SCAN_EBS_INACTIVE,
Haim Dreyfusse820c2d2014-04-06 11:19:09 +0300200};
201
Johannes Berg8ca151b2013-01-24 14:25:36 +0100202/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100203 * struct iwl_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S
David Spinadelfb98be52014-05-04 12:51:10 +0300204 * @tx_flags: combination of TX_CMD_FLG_*
205 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
206 * cleared. Combination of RATE_MCS_*
207 * @sta_id: index of destination station in FW station table
208 * @reserved: for alignment and future use
209 */
210struct iwl_scan_req_tx_cmd {
211 __le32 tx_flags;
212 __le32 rate_n_flags;
213 u8 sta_id;
214 u8 reserved[3];
215} __packed;
216
217enum iwl_scan_channel_flags_lmac {
218 IWL_UNIFIED_SCAN_CHANNEL_FULL = BIT(27),
219 IWL_UNIFIED_SCAN_CHANNEL_PARTIAL = BIT(28),
220};
221
222/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100223 * struct iwl_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2
David Spinadelfb98be52014-05-04 12:51:10 +0300224 * @flags: bits 1-20: directed scan to i'th ssid
225 * other bits &enum iwl_scan_channel_flags_lmac
226 * @channel_number: channel number 1-13 etc
227 * @iter_count: scan iteration on this channel
228 * @iter_interval: interval in seconds between iterations on one channel
229 */
230struct iwl_scan_channel_cfg_lmac {
231 __le32 flags;
232 __le16 channel_num;
233 __le16 iter_count;
234 __le32 iter_interval;
235} __packed;
236
237/*
Johannes Berg31a658b2017-03-09 15:56:57 +0100238 * struct iwl_scan_probe_segment - PROBE_SEGMENT_API_S_VER_1
David Spinadelfb98be52014-05-04 12:51:10 +0300239 * @offset: offset in the data block
240 * @len: length of the segment
241 */
242struct iwl_scan_probe_segment {
243 __le16 offset;
244 __le16 len;
245} __packed;
246
247/* iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_2
248 * @mac_header: first (and common) part of the probe
249 * @band_data: band specific data
250 * @common_data: last (and common) part of the probe
251 * @buf: raw data block
252 */
253struct iwl_scan_probe_req {
254 struct iwl_scan_probe_segment mac_header;
255 struct iwl_scan_probe_segment band_data[2];
256 struct iwl_scan_probe_segment common_data;
257 u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
258} __packed;
259
260enum iwl_scan_channel_flags {
261 IWL_SCAN_CHANNEL_FLAG_EBS = BIT(0),
262 IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE = BIT(1),
263 IWL_SCAN_CHANNEL_FLAG_CACHE_ADD = BIT(2),
264};
265
Johannes Berg31a658b2017-03-09 15:56:57 +0100266/* struct iwl_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S
David Spinadel1f9c4182014-12-01 23:30:07 +0200267 * @flags: enum iwl_scan_channel_flags
268 * @non_ebs_ratio: defines the ratio of number of scan iterations where EBS is
269 * involved.
270 * 1 - EBS is disabled.
271 * 2 - every second scan will be full scan(and so on).
David Spinadelfb98be52014-05-04 12:51:10 +0300272 */
273struct iwl_scan_channel_opt {
274 __le16 flags;
275 __le16 non_ebs_ratio;
276} __packed;
277
278/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100279 * enum iwl_mvm_lmac_scan_flags - LMAC scan flags
David Spinadelfb98be52014-05-04 12:51:10 +0300280 * @IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses
281 * without filtering.
282 * @IWL_MVM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels
283 * @IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan
284 * @IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification
285 * @IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS multiple SSID matching
286 * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented
Andrei Otcheretianski73897bd2014-07-09 18:59:14 +0300287 * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report
288 * and DS parameter set IEs into probe requests.
David Spinadelc3e230b2015-11-22 16:37:36 +0200289 * @IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL: use extended dwell time on channels
290 * 1, 6 and 11.
David Spinadel7e2a3882014-12-23 14:38:09 +0200291 * @IWL_MVM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches
David Spinadelfb98be52014-05-04 12:51:10 +0300292 */
293enum iwl_mvm_lmac_scan_flags {
294 IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL = BIT(0),
295 IWL_MVM_LMAC_SCAN_FLAG_PASSIVE = BIT(1),
296 IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION = BIT(2),
297 IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE = BIT(3),
298 IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = BIT(4),
299 IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED = BIT(5),
Andrei Otcheretianski73897bd2014-07-09 18:59:14 +0300300 IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6),
David Spinadelc3e230b2015-11-22 16:37:36 +0200301 IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL = BIT(7),
David Spinadel7e2a3882014-12-23 14:38:09 +0200302 IWL_MVM_LMAC_SCAN_FLAG_MATCH = BIT(9),
David Spinadelfb98be52014-05-04 12:51:10 +0300303};
304
305enum iwl_scan_priority {
306 IWL_SCAN_PRIORITY_LOW,
307 IWL_SCAN_PRIORITY_MEDIUM,
308 IWL_SCAN_PRIORITY_HIGH,
309};
310
Avraham Sternd7afbfc2015-05-12 12:19:48 +0300311enum iwl_scan_priority_ext {
312 IWL_SCAN_PRIORITY_EXT_0_LOWEST,
313 IWL_SCAN_PRIORITY_EXT_1,
314 IWL_SCAN_PRIORITY_EXT_2,
315 IWL_SCAN_PRIORITY_EXT_3,
316 IWL_SCAN_PRIORITY_EXT_4,
317 IWL_SCAN_PRIORITY_EXT_5,
318 IWL_SCAN_PRIORITY_EXT_6,
319 IWL_SCAN_PRIORITY_EXT_7_HIGHEST,
320};
321
David Spinadelfb98be52014-05-04 12:51:10 +0300322/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100323 * struct iwl_scan_req_lmac - SCAN_REQUEST_CMD_API_S_VER_1
David Spinadelfb98be52014-05-04 12:51:10 +0300324 * @reserved1: for alignment and future use
325 * @channel_num: num of channels to scan
326 * @active-dwell: dwell time for active channels
327 * @passive-dwell: dwell time for passive channels
328 * @fragmented-dwell: dwell time for fragmented passive scan
David Spinadelc3e230b2015-11-22 16:37:36 +0200329 * @extended_dwell: dwell time for channels 1, 6 and 11 (in certain cases)
David Spinadelfb98be52014-05-04 12:51:10 +0300330 * @reserved2: for alignment and future use
331 * @rx_chain_selct: PHY_RX_CHAIN_* flags
332 * @scan_flags: &enum iwl_mvm_lmac_scan_flags
333 * @max_out_time: max time (in TU) to be out of associated channel
334 * @suspend_time: pause scan this long (TUs) when returning to service channel
335 * @flags: RXON flags
336 * @filter_flags: RXON filter
337 * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz
338 * @direct_scan: list of SSIDs for directed active scan
339 * @scan_prio: enum iwl_scan_priority
340 * @iter_num: number of scan iterations
341 * @delay: delay in seconds before first iteration
342 * @schedule: two scheduling plans. The first one is finite, the second one can
343 * be infinite.
344 * @channel_opt: channel optimization options, for full and partial scan
345 * @data: channel configuration and probe request packet.
346 */
Luciano Coelho65ff5562015-03-20 13:35:47 +0200347struct iwl_scan_req_lmac {
David Spinadelfb98be52014-05-04 12:51:10 +0300348 /* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */
349 __le32 reserved1;
350 u8 n_channels;
351 u8 active_dwell;
352 u8 passive_dwell;
353 u8 fragmented_dwell;
David Spinadelc3e230b2015-11-22 16:37:36 +0200354 u8 extended_dwell;
355 u8 reserved2;
David Spinadelfb98be52014-05-04 12:51:10 +0300356 __le16 rx_chain_select;
357 __le32 scan_flags;
358 __le32 max_out_time;
359 __le32 suspend_time;
360 /* RX_ON_FLAGS_API_S_VER_1 */
361 __le32 flags;
362 __le32 filter_flags;
363 struct iwl_scan_req_tx_cmd tx_cmd[2];
364 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
365 __le32 scan_prio;
366 /* SCAN_REQ_PERIODIC_PARAMS_API_S */
367 __le32 iter_num;
368 __le32 delay;
Avraham Sterncd55cce2015-08-19 12:46:12 +0300369 struct iwl_scan_schedule_lmac schedule[IWL_MAX_SCHED_SCAN_PLANS];
David Spinadelfb98be52014-05-04 12:51:10 +0300370 struct iwl_scan_channel_opt channel_opt[2];
371 u8 data[];
372} __packed;
373
374/**
Avraham Stern1083fd72015-03-31 16:14:41 +0300375 * struct iwl_scan_results_notif - scan results for one channel -
David Spinadelfb98be52014-05-04 12:51:10 +0300376 * SCAN_RESULT_NTF_API_S_VER_3
377 * @channel: which channel the results are from
378 * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
379 * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
380 * @num_probe_not_sent: # of request that weren't sent due to not enough time
381 * @duration: duration spent in channel, in usecs
382 */
Avraham Stern1083fd72015-03-31 16:14:41 +0300383struct iwl_scan_results_notif {
David Spinadelfb98be52014-05-04 12:51:10 +0300384 u8 channel;
385 u8 band;
386 u8 probe_status;
387 u8 num_probe_not_sent;
388 __le32 duration;
389} __packed;
390
391/**
392 * struct iwl_lmac_scan_complete_notif - notifies end of scanning (all channels)
393 * SCAN_COMPLETE_NTF_API_S_VER_3
394 * @scanned_channels: number of channels scanned (and number of valid results)
395 * @status: one of SCAN_COMP_STATUS_*
396 * @bt_status: BT on/off status
397 * @last_channel: last channel that was scanned
398 * @tsf_low: TSF timer (lower half) in usecs
399 * @tsf_high: TSF timer (higher half) in usecs
400 * @results: an array of scan results, only "scanned_channels" of them are valid
401 */
402struct iwl_lmac_scan_complete_notif {
403 u8 scanned_channels;
404 u8 status;
405 u8 bt_status;
406 u8 last_channel;
407 __le32 tsf_low;
408 __le32 tsf_high;
409 struct iwl_scan_results_notif results[];
410} __packed;
411
412/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100413 * struct iwl_scan_offload_complete - PERIODIC_SCAN_COMPLETE_NTF_API_S_VER_2
David Spinadelfb98be52014-05-04 12:51:10 +0300414 * @last_schedule_line: last schedule line executed (fast or regular)
415 * @last_schedule_iteration: last scan iteration executed before scan abort
416 * @status: enum iwl_scan_offload_complete_status
417 * @ebs_status: EBS success status &enum iwl_scan_ebs_status
418 * @time_after_last_iter; time in seconds elapsed after last iteration
419 */
420struct iwl_periodic_scan_complete {
421 u8 last_schedule_line;
422 u8 last_schedule_iteration;
423 u8 status;
424 u8 ebs_status;
425 __le32 time_after_last_iter;
426 __le32 reserved;
427} __packed;
428
David Spinadeld2496222014-05-20 12:46:37 +0300429/* UMAC Scan API */
430
Luciano Coelho507e4cd2015-03-19 22:58:33 +0200431/* The maximum of either of these cannot exceed 8, because we use an
432 * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h).
433 */
434#define IWL_MVM_MAX_UMAC_SCANS 8
435#define IWL_MVM_MAX_LMAC_SCANS 1
David Spinadeld2496222014-05-20 12:46:37 +0300436
437enum scan_config_flags {
438 SCAN_CONFIG_FLAG_ACTIVATE = BIT(0),
439 SCAN_CONFIG_FLAG_DEACTIVATE = BIT(1),
440 SCAN_CONFIG_FLAG_FORBID_CHUB_REQS = BIT(2),
441 SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS = BIT(3),
442 SCAN_CONFIG_FLAG_SET_TX_CHAINS = BIT(8),
443 SCAN_CONFIG_FLAG_SET_RX_CHAINS = BIT(9),
444 SCAN_CONFIG_FLAG_SET_AUX_STA_ID = BIT(10),
445 SCAN_CONFIG_FLAG_SET_ALL_TIMES = BIT(11),
446 SCAN_CONFIG_FLAG_SET_EFFECTIVE_TIMES = BIT(12),
447 SCAN_CONFIG_FLAG_SET_CHANNEL_FLAGS = BIT(13),
448 SCAN_CONFIG_FLAG_SET_LEGACY_RATES = BIT(14),
449 SCAN_CONFIG_FLAG_SET_MAC_ADDR = BIT(15),
450 SCAN_CONFIG_FLAG_SET_FRAGMENTED = BIT(16),
451 SCAN_CONFIG_FLAG_CLEAR_FRAGMENTED = BIT(17),
452 SCAN_CONFIG_FLAG_SET_CAM_MODE = BIT(18),
453 SCAN_CONFIG_FLAG_CLEAR_CAM_MODE = BIT(19),
454 SCAN_CONFIG_FLAG_SET_PROMISC_MODE = BIT(20),
455 SCAN_CONFIG_FLAG_CLEAR_PROMISC_MODE = BIT(21),
Sara Sharon9ba221b2016-11-17 11:35:05 +0200456 SCAN_CONFIG_FLAG_SET_LMAC2_FRAGMENTED = BIT(22),
457 SCAN_CONFIG_FLAG_CLEAR_LMAC2_FRAGMENTED = BIT(23),
David Spinadeld2496222014-05-20 12:46:37 +0300458
459 /* Bits 26-31 are for num of channels in channel_array */
460#define SCAN_CONFIG_N_CHANNELS(n) ((n) << 26)
461};
462
463enum scan_config_rates {
464 /* OFDM basic rates */
465 SCAN_CONFIG_RATE_6M = BIT(0),
466 SCAN_CONFIG_RATE_9M = BIT(1),
467 SCAN_CONFIG_RATE_12M = BIT(2),
468 SCAN_CONFIG_RATE_18M = BIT(3),
469 SCAN_CONFIG_RATE_24M = BIT(4),
470 SCAN_CONFIG_RATE_36M = BIT(5),
471 SCAN_CONFIG_RATE_48M = BIT(6),
472 SCAN_CONFIG_RATE_54M = BIT(7),
473 /* CCK basic rates */
474 SCAN_CONFIG_RATE_1M = BIT(8),
475 SCAN_CONFIG_RATE_2M = BIT(9),
476 SCAN_CONFIG_RATE_5M = BIT(10),
477 SCAN_CONFIG_RATE_11M = BIT(11),
478
479 /* Bits 16-27 are for supported rates */
480#define SCAN_CONFIG_SUPPORTED_RATE(rate) ((rate) << 16)
481};
482
483enum iwl_channel_flags {
484 IWL_CHANNEL_FLAG_EBS = BIT(0),
485 IWL_CHANNEL_FLAG_ACCURATE_EBS = BIT(1),
486 IWL_CHANNEL_FLAG_EBS_ADD = BIT(2),
487 IWL_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE = BIT(3),
488};
489
490/**
Sara Sharon9ba221b2016-11-17 11:35:05 +0200491 * struct iwl_scan_dwell
492 * @active: default dwell time for active scan
493 * @passive: default dwell time for passive scan
494 * @fragmented: default dwell time for fragmented scan
495 * @extended: default dwell time for channels 1, 6 and 11
496 */
497struct iwl_scan_dwell {
498 u8 active;
499 u8 passive;
500 u8 fragmented;
501 u8 extended;
502} __packed;
503
504/**
David Spinadeld2496222014-05-20 12:46:37 +0300505 * struct iwl_scan_config
David Spinadeld2496222014-05-20 12:46:37 +0300506 * @flags: enum scan_config_flags
507 * @tx_chains: valid_tx antenna - ANT_* definitions
508 * @rx_chains: valid_rx antenna - ANT_* definitions
509 * @legacy_rates: default legacy rates - enum scan_config_rates
510 * @out_of_channel_time: default max out of serving channel time
511 * @suspend_time: default max suspend time
Sara Sharon9ba221b2016-11-17 11:35:05 +0200512 * @dwell: dwells for the scan
David Spinadeld2496222014-05-20 12:46:37 +0300513 * @mac_addr: default mac address to be used in probes
514 * @bcast_sta_id: the index of the station in the fw
515 * @channel_flags: default channel flags - enum iwl_channel_flags
516 * scan_config_channel_flag
517 * @channel_array: default supported channels
518 */
Sara Sharona0b48282017-01-12 16:01:11 +0200519struct iwl_scan_config_v1 {
David Spinadeld2496222014-05-20 12:46:37 +0300520 __le32 flags;
521 __le32 tx_chains;
522 __le32 rx_chains;
523 __le32 legacy_rates;
524 __le32 out_of_channel_time;
525 __le32 suspend_time;
Sara Sharon9ba221b2016-11-17 11:35:05 +0200526 struct iwl_scan_dwell dwell;
David Spinadeld2496222014-05-20 12:46:37 +0300527 u8 mac_addr[ETH_ALEN];
528 u8 bcast_sta_id;
529 u8 channel_flags;
530 u8 channel_array[];
531} __packed; /* SCAN_CONFIG_DB_CMD_API_S */
532
Sara Sharon9ba221b2016-11-17 11:35:05 +0200533#define SCAN_TWO_LMACS 2
534
Sara Sharona0b48282017-01-12 16:01:11 +0200535struct iwl_scan_config {
Sara Sharon9ba221b2016-11-17 11:35:05 +0200536 __le32 flags;
537 __le32 tx_chains;
538 __le32 rx_chains;
539 __le32 legacy_rates;
540 __le32 out_of_channel_time[SCAN_TWO_LMACS];
541 __le32 suspend_time[SCAN_TWO_LMACS];
542 struct iwl_scan_dwell dwell;
543 u8 mac_addr[ETH_ALEN];
544 u8 bcast_sta_id;
545 u8 channel_flags;
546 u8 channel_array[];
547} __packed; /* SCAN_CONFIG_DB_CMD_API_S_3 */
548
David Spinadeld2496222014-05-20 12:46:37 +0300549/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100550 * enum iwl_umac_scan_flags - UMAC scan flags
551 * @IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request
David Spinadeld2496222014-05-20 12:46:37 +0300552 * can be preempted by other scan requests with higher priority.
Avraham Stern8465fe62015-06-21 12:06:13 +0300553 * The low priority scan will be resumed when the higher proirity scan is
554 * completed.
Johannes Berg31a658b2017-03-09 15:56:57 +0100555 * @IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver
David Spinadeld2496222014-05-20 12:46:37 +0300556 * when scan starts.
557 */
558enum iwl_umac_scan_flags {
559 IWL_UMAC_SCAN_FLAG_PREEMPTIVE = BIT(0),
560 IWL_UMAC_SCAN_FLAG_START_NOTIF = BIT(1),
561};
562
563enum iwl_umac_scan_uid_offsets {
564 IWL_UMAC_SCAN_UID_TYPE_OFFSET = 0,
565 IWL_UMAC_SCAN_UID_SEQ_OFFSET = 8,
566};
567
568enum iwl_umac_scan_general_flags {
Sara Sharon9ba221b2016-11-17 11:35:05 +0200569 IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC = BIT(0),
570 IWL_UMAC_SCAN_GEN_FLAGS_OVER_BT = BIT(1),
571 IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL = BIT(2),
572 IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE = BIT(3),
573 IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT = BIT(4),
574 IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE = BIT(5),
575 IWL_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID = BIT(6),
576 IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED = BIT(7),
577 IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED = BIT(8),
578 IWL_UMAC_SCAN_GEN_FLAGS_MATCH = BIT(9),
579 IWL_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL = BIT(10),
580 IWL_UMAC_SCAN_GEN_FLAGS_LMAC2_FRAGMENTED = BIT(11),
David Spinadeld2496222014-05-20 12:46:37 +0300581};
582
583/**
584 * struct iwl_scan_channel_cfg_umac
585 * @flags: bitmap - 0-19: directed scan to i'th ssid.
586 * @channel_num: channel number 1-13 etc.
587 * @iter_count: repetition count for the channel.
Sara Sharon0d365ae2015-03-31 12:24:05 +0300588 * @iter_interval: interval between two scan iterations on one channel.
David Spinadeld2496222014-05-20 12:46:37 +0300589 */
590struct iwl_scan_channel_cfg_umac {
591 __le32 flags;
592 u8 channel_num;
593 u8 iter_count;
594 __le16 iter_interval;
595} __packed; /* SCAN_CHANNEL_CFG_S_VER2 */
596
597/**
598 * struct iwl_scan_umac_schedule
599 * @interval: interval in seconds between scan iterations
600 * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop
601 * @reserved: for alignment and future use
602 */
603struct iwl_scan_umac_schedule {
604 __le16 interval;
605 u8 iter_count;
606 u8 reserved;
607} __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */
608
609/**
610 * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command
611 * parameters following channels configuration array.
612 * @schedule: two scheduling plans.
613 * @delay: delay in TUs before starting the first scan iteration
614 * @reserved: for future use and alignment
615 * @preq: probe request with IEs blocks
616 * @direct_scan: list of SSIDs for directed active scan
617 */
618struct iwl_scan_req_umac_tail {
619 /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
Avraham Sterncd55cce2015-08-19 12:46:12 +0300620 struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
David Spinadeld2496222014-05-20 12:46:37 +0300621 __le16 delay;
622 __le16 reserved;
623 /* SCAN_PROBE_PARAMS_API_S_VER_1 */
624 struct iwl_scan_probe_req preq;
625 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
626} __packed;
627
628/**
629 * struct iwl_scan_req_umac
David Spinadeld2496222014-05-20 12:46:37 +0300630 * @flags: &enum iwl_umac_scan_flags
631 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
632 * @ooc_priority: out of channel priority - &enum iwl_scan_priority
633 * @general_flags: &enum iwl_umac_scan_general_flags
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300634 * @reserved2: for future use and alignment
635 * @scan_start_mac_id: report the scan start TSF time according to this mac TSF
David Spinadelc3e230b2015-11-22 16:37:36 +0200636 * @extended_dwell: dwell time for channels 1, 6 and 11
David Spinadeld2496222014-05-20 12:46:37 +0300637 * @active_dwell: dwell time for active scan
638 * @passive_dwell: dwell time for passive scan
639 * @fragmented_dwell: dwell time for fragmented passive scan
Sara Sharon9ba221b2016-11-17 11:35:05 +0200640 * @max_out_time: max out of serving channel time, per LMAC - for CDB there
641 * are 2 LMACs
642 * @suspend_time: max suspend time, per LMAC - for CDB there are 2 LMACs
David Spinadeld2496222014-05-20 12:46:37 +0300643 * @scan_priority: scan internal prioritization &enum iwl_scan_priority
644 * @channel_flags: &enum iwl_scan_channel_flags
645 * @n_channels: num of channels in scan request
David Spinadelc3e230b2015-11-22 16:37:36 +0200646 * @reserved: for future use and alignment
David Spinadeld2496222014-05-20 12:46:37 +0300647 * @data: &struct iwl_scan_channel_cfg_umac and
648 * &struct iwl_scan_req_umac_tail
649 */
650struct iwl_scan_req_umac {
David Spinadeld2496222014-05-20 12:46:37 +0300651 __le32 flags;
652 __le32 uid;
653 __le32 ooc_priority;
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300654 /* SCAN_GENERAL_PARAMS_API_S_VER_4 */
655 __le16 general_flags;
656 u8 reserved2;
657 u8 scan_start_mac_id;
David Spinadelc3e230b2015-11-22 16:37:36 +0200658 u8 extended_dwell;
David Spinadeld2496222014-05-20 12:46:37 +0300659 u8 active_dwell;
660 u8 passive_dwell;
661 u8 fragmented_dwell;
Sara Sharon9ba221b2016-11-17 11:35:05 +0200662 union {
663 struct {
664 __le32 max_out_time;
665 __le32 suspend_time;
666 __le32 scan_priority;
667 /* SCAN_CHANNEL_PARAMS_API_S_VER_4 */
668 u8 channel_flags;
669 u8 n_channels;
670 __le16 reserved;
671 u8 data[];
Sara Sharona0b48282017-01-12 16:01:11 +0200672 } v1; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */
Sara Sharon9ba221b2016-11-17 11:35:05 +0200673 struct {
674 __le32 max_out_time[SCAN_TWO_LMACS];
675 __le32 suspend_time[SCAN_TWO_LMACS];
676 __le32 scan_priority;
677 /* SCAN_CHANNEL_PARAMS_API_S_VER_4 */
678 u8 channel_flags;
679 u8 n_channels;
680 __le16 reserved;
681 u8 data[];
Sara Sharona0b48282017-01-12 16:01:11 +0200682 } v6; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_6 */
Sara Sharon9ba221b2016-11-17 11:35:05 +0200683 };
684} __packed;
685
Sara Sharona0b48282017-01-12 16:01:11 +0200686#define IWL_SCAN_REQ_UMAC_SIZE sizeof(struct iwl_scan_req_umac)
687#define IWL_SCAN_REQ_UMAC_SIZE_V1 (sizeof(struct iwl_scan_req_umac) - \
688 2 * sizeof(__le32))
David Spinadeld2496222014-05-20 12:46:37 +0300689
690/**
691 * struct iwl_umac_scan_abort
David Spinadeld2496222014-05-20 12:46:37 +0300692 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
693 * @flags: reserved
694 */
695struct iwl_umac_scan_abort {
David Spinadeld2496222014-05-20 12:46:37 +0300696 __le32 uid;
697 __le32 flags;
698} __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */
699
700/**
701 * struct iwl_umac_scan_complete
702 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
703 * @last_schedule: last scheduling line
704 * @last_iter: last scan iteration number
705 * @scan status: &enum iwl_scan_offload_complete_status
706 * @ebs_status: &enum iwl_scan_ebs_status
707 * @time_from_last_iter: time elapsed from last iteration
708 * @reserved: for future use
709 */
710struct iwl_umac_scan_complete {
711 __le32 uid;
712 u8 last_schedule;
713 u8 last_iter;
714 u8 status;
715 u8 ebs_status;
716 __le32 time_from_last_iter;
717 __le32 reserved;
718} __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */
719
Luciano Coelhob04998f2014-11-20 15:58:34 +0200720#define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN 5
721/**
722 * struct iwl_scan_offload_profile_match - match information
723 * @bssid: matched bssid
724 * @channel: channel where the match occurred
725 * @energy:
726 * @matching_feature:
727 * @matching_channels: bitmap of channels that matched, referencing
728 * the channels passed in tue scan offload request
729 */
730struct iwl_scan_offload_profile_match {
731 u8 bssid[ETH_ALEN];
732 __le16 reserved;
733 u8 channel;
734 u8 energy;
735 u8 matching_feature;
736 u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN];
737} __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_1 */
738
739/**
740 * struct iwl_scan_offload_profiles_query - match results query response
741 * @matched_profiles: bitmap of matched profiles, referencing the
742 * matches passed in the scan offload request
743 * @last_scan_age: age of the last offloaded scan
744 * @n_scans_done: number of offloaded scans done
745 * @gp2_d0u: GP2 when D0U occurred
746 * @gp2_invoked: GP2 when scan offload was invoked
747 * @resume_while_scanning: not used
748 * @self_recovery: obsolete
749 * @reserved: reserved
750 * @matches: array of match information, one for each match
751 */
752struct iwl_scan_offload_profiles_query {
753 __le32 matched_profiles;
754 __le32 last_scan_age;
755 __le32 n_scans_done;
756 __le32 gp2_d0u;
757 __le32 gp2_invoked;
758 u8 resume_while_scanning;
759 u8 self_recovery;
760 __le16 reserved;
761 struct iwl_scan_offload_profile_match matches[IWL_SCAN_MAX_PROFILES];
762} __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */
763
Avraham Sternee9219b2015-03-23 15:09:27 +0200764/**
765 * struct iwl_umac_scan_iter_complete_notif - notifies end of scanning iteration
766 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
767 * @scanned_channels: number of channels scanned and number of valid elements in
768 * results array
769 * @status: one of SCAN_COMP_STATUS_*
770 * @bt_status: BT on/off status
771 * @last_channel: last channel that was scanned
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300772 * @start_tsf: TSF timer in usecs of the scan start time for the mac specified
773 * in &struct iwl_scan_req_umac.
Avraham Sternee9219b2015-03-23 15:09:27 +0200774 * @results: array of scan results, only "scanned_channels" of them are valid
775 */
776struct iwl_umac_scan_iter_complete_notif {
777 __le32 uid;
778 u8 scanned_channels;
779 u8 status;
780 u8 bt_status;
781 u8 last_channel;
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300782 __le64 start_tsf;
Avraham Sternee9219b2015-03-23 15:09:27 +0200783 struct iwl_scan_results_notif results[];
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300784} __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_2 */
Avraham Sternee9219b2015-03-23 15:09:27 +0200785
Johannes Berg8ca151b2013-01-24 14:25:36 +0100786#endif