blob: d27c67b67015c62c0bd4f8553a9c1421e6c009d3 [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.
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/* scan offload */
Johannes Berg8ca151b2013-01-24 14:25:36 +010091#define IWL_SCAN_MAX_BLACKLIST_LEN 64
David Spinadel35a000b2013-08-28 09:29:43 +030092#define IWL_SCAN_SHORT_BLACKLIST_LEN 16
Johannes Berg8ca151b2013-01-24 14:25:36 +010093#define IWL_SCAN_MAX_PROFILES 11
94#define SCAN_OFFLOAD_PROBE_REQ_SIZE 512
95
96/* Default watchdog (in MS) for scheduled scan iteration */
97#define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
98
99#define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
100#define CAN_ABORT_STATUS 1
101
102#define IWL_FULL_SCAN_MULTIPLIER 5
103#define IWL_FAST_SCHED_SCAN_ITERATIONS 3
Avraham Sterncd55cce2015-08-19 12:46:12 +0300104#define IWL_MAX_SCHED_SCAN_PLANS 2
Johannes Berg8ca151b2013-01-24 14:25:36 +0100105
David Spinadel35a000b2013-08-28 09:29:43 +0300106enum scan_framework_client {
107 SCAN_CLIENT_SCHED_SCAN = BIT(0),
108 SCAN_CLIENT_NETDETECT = BIT(1),
109 SCAN_CLIENT_ASSET_TRACKING = BIT(2),
110};
111
Johannes Berg8ca151b2013-01-24 14:25:36 +0100112/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100113 * struct iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S
Johannes Berg8ca151b2013-01-24 14:25:36 +0100114 * @ssid: MAC address to filter out
115 * @reported_rssi: AP rssi reported to the host
David Spinadel35a000b2013-08-28 09:29:43 +0300116 * @client_bitmap: clients ignore this entry - enum scan_framework_client
Johannes Berg8ca151b2013-01-24 14:25:36 +0100117 */
118struct iwl_scan_offload_blacklist {
119 u8 ssid[ETH_ALEN];
120 u8 reported_rssi;
David Spinadel35a000b2013-08-28 09:29:43 +0300121 u8 client_bitmap;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100122} __packed;
123
124enum iwl_scan_offload_network_type {
125 IWL_NETWORK_TYPE_BSS = 1,
126 IWL_NETWORK_TYPE_IBSS = 2,
127 IWL_NETWORK_TYPE_ANY = 3,
128};
129
130enum iwl_scan_offload_band_selection {
131 IWL_SCAN_OFFLOAD_SELECT_2_4 = 0x4,
132 IWL_SCAN_OFFLOAD_SELECT_5_2 = 0x8,
133 IWL_SCAN_OFFLOAD_SELECT_ANY = 0xc,
134};
135
136/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100137 * struct iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S
Johannes Berg8ca151b2013-01-24 14:25:36 +0100138 * @ssid_index: index to ssid list in fixed part
Sara Sharon0d365ae2015-03-31 12:24:05 +0300139 * @unicast_cipher: encryption algorithm to match - bitmap
140 * @aut_alg: authentication algorithm to match - bitmap
Johannes Berg8ca151b2013-01-24 14:25:36 +0100141 * @network_type: enum iwl_scan_offload_network_type
142 * @band_selection: enum iwl_scan_offload_band_selection
David Spinadel35a000b2013-08-28 09:29:43 +0300143 * @client_bitmap: clients waiting for match - enum scan_framework_client
Johannes Berg8ca151b2013-01-24 14:25:36 +0100144 */
145struct iwl_scan_offload_profile {
146 u8 ssid_index;
147 u8 unicast_cipher;
148 u8 auth_alg;
149 u8 network_type;
150 u8 band_selection;
David Spinadel35a000b2013-08-28 09:29:43 +0300151 u8 client_bitmap;
152 u8 reserved[2];
Johannes Berg8ca151b2013-01-24 14:25:36 +0100153} __packed;
154
155/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100156 * struct iwl_scan_offload_profile_cfg - SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1
Johannes Berg8ca151b2013-01-24 14:25:36 +0100157 * @profiles: profiles to search for match
158 * @blacklist_len: length of blacklist
159 * @num_profiles: num of profiles in the list
David Spinadel35a000b2013-08-28 09:29:43 +0300160 * @match_notify: clients waiting for match found notification
161 * @pass_match: clients waiting for the results
162 * @active_clients: active clients bitmap - enum scan_framework_client
David Spinadel6e0bbe52013-12-30 09:59:45 +0200163 * @any_beacon_notify: clients waiting for match notification without match
Johannes Berg8ca151b2013-01-24 14:25:36 +0100164 */
165struct iwl_scan_offload_profile_cfg {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100166 struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
167 u8 blacklist_len;
168 u8 num_profiles;
David Spinadel35a000b2013-08-28 09:29:43 +0300169 u8 match_notify;
170 u8 pass_match;
171 u8 active_clients;
David Spinadel6e0bbe52013-12-30 09:59:45 +0200172 u8 any_beacon_notify;
173 u8 reserved[2];
Johannes Berg8ca151b2013-01-24 14:25:36 +0100174} __packed;
175
176/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100177 * struct iwl_scan_schedule_lmac - schedule of scan offload
Johannes Berg8ca151b2013-01-24 14:25:36 +0100178 * @delay: delay between iterations, in seconds.
179 * @iterations: num of scan iterations
180 * @full_scan_mul: number of partial scans before each full scan
181 */
Luciano Coelho0bef0382015-04-02 00:25:44 +0300182struct iwl_scan_schedule_lmac {
David Spinadelb14fc2b2014-06-25 13:17:53 +0300183 __le16 delay;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100184 u8 iterations;
185 u8 full_scan_mul;
Luciano Coelho0bef0382015-04-02 00:25:44 +0300186} __packed; /* SCAN_SCHEDULE_API_S */
Johannes Berg8ca151b2013-01-24 14:25:36 +0100187
Luciano Coelho0bef0382015-04-02 00:25:44 +0300188enum iwl_scan_offload_complete_status {
Johannes Berg8ca151b2013-01-24 14:25:36 +0100189 IWL_SCAN_OFFLOAD_COMPLETED = 1,
190 IWL_SCAN_OFFLOAD_ABORTED = 2,
191};
192
Haim Dreyfusse820c2d2014-04-06 11:19:09 +0300193enum iwl_scan_ebs_status {
194 IWL_SCAN_EBS_SUCCESS,
195 IWL_SCAN_EBS_FAILED,
196 IWL_SCAN_EBS_CHAN_NOT_FOUND,
David Spinadelf0bf8592015-05-20 11:56:59 +0300197 IWL_SCAN_EBS_INACTIVE,
Haim Dreyfusse820c2d2014-04-06 11:19:09 +0300198};
199
Johannes Berg8ca151b2013-01-24 14:25:36 +0100200/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100201 * struct iwl_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S
David Spinadelfb98be52014-05-04 12:51:10 +0300202 * @tx_flags: combination of TX_CMD_FLG_*
203 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
204 * cleared. Combination of RATE_MCS_*
205 * @sta_id: index of destination station in FW station table
206 * @reserved: for alignment and future use
207 */
208struct iwl_scan_req_tx_cmd {
209 __le32 tx_flags;
210 __le32 rate_n_flags;
211 u8 sta_id;
212 u8 reserved[3];
213} __packed;
214
215enum iwl_scan_channel_flags_lmac {
216 IWL_UNIFIED_SCAN_CHANNEL_FULL = BIT(27),
217 IWL_UNIFIED_SCAN_CHANNEL_PARTIAL = BIT(28),
218};
219
220/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100221 * struct iwl_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2
David Spinadelfb98be52014-05-04 12:51:10 +0300222 * @flags: bits 1-20: directed scan to i'th ssid
223 * other bits &enum iwl_scan_channel_flags_lmac
224 * @channel_number: channel number 1-13 etc
225 * @iter_count: scan iteration on this channel
226 * @iter_interval: interval in seconds between iterations on one channel
227 */
228struct iwl_scan_channel_cfg_lmac {
229 __le32 flags;
230 __le16 channel_num;
231 __le16 iter_count;
232 __le32 iter_interval;
233} __packed;
234
235/*
Johannes Berg31a658b2017-03-09 15:56:57 +0100236 * struct iwl_scan_probe_segment - PROBE_SEGMENT_API_S_VER_1
David Spinadelfb98be52014-05-04 12:51:10 +0300237 * @offset: offset in the data block
238 * @len: length of the segment
239 */
240struct iwl_scan_probe_segment {
241 __le16 offset;
242 __le16 len;
243} __packed;
244
245/* iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_2
246 * @mac_header: first (and common) part of the probe
247 * @band_data: band specific data
248 * @common_data: last (and common) part of the probe
249 * @buf: raw data block
250 */
251struct iwl_scan_probe_req {
252 struct iwl_scan_probe_segment mac_header;
253 struct iwl_scan_probe_segment band_data[2];
254 struct iwl_scan_probe_segment common_data;
255 u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
256} __packed;
257
258enum iwl_scan_channel_flags {
259 IWL_SCAN_CHANNEL_FLAG_EBS = BIT(0),
260 IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE = BIT(1),
261 IWL_SCAN_CHANNEL_FLAG_CACHE_ADD = BIT(2),
262};
263
Johannes Berg31a658b2017-03-09 15:56:57 +0100264/* struct iwl_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S
David Spinadel1f9c4182014-12-01 23:30:07 +0200265 * @flags: enum iwl_scan_channel_flags
266 * @non_ebs_ratio: defines the ratio of number of scan iterations where EBS is
267 * involved.
268 * 1 - EBS is disabled.
269 * 2 - every second scan will be full scan(and so on).
David Spinadelfb98be52014-05-04 12:51:10 +0300270 */
271struct iwl_scan_channel_opt {
272 __le16 flags;
273 __le16 non_ebs_ratio;
274} __packed;
275
276/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100277 * enum iwl_mvm_lmac_scan_flags - LMAC scan flags
David Spinadelfb98be52014-05-04 12:51:10 +0300278 * @IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses
279 * without filtering.
280 * @IWL_MVM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels
281 * @IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan
282 * @IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification
283 * @IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS multiple SSID matching
284 * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented
Andrei Otcheretianski73897bd2014-07-09 18:59:14 +0300285 * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report
286 * and DS parameter set IEs into probe requests.
David Spinadelc3e230b2015-11-22 16:37:36 +0200287 * @IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL: use extended dwell time on channels
288 * 1, 6 and 11.
David Spinadel7e2a3882014-12-23 14:38:09 +0200289 * @IWL_MVM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches
David Spinadelfb98be52014-05-04 12:51:10 +0300290 */
291enum iwl_mvm_lmac_scan_flags {
292 IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL = BIT(0),
293 IWL_MVM_LMAC_SCAN_FLAG_PASSIVE = BIT(1),
294 IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION = BIT(2),
295 IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE = BIT(3),
296 IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = BIT(4),
297 IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED = BIT(5),
Andrei Otcheretianski73897bd2014-07-09 18:59:14 +0300298 IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6),
David Spinadelc3e230b2015-11-22 16:37:36 +0200299 IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL = BIT(7),
David Spinadel7e2a3882014-12-23 14:38:09 +0200300 IWL_MVM_LMAC_SCAN_FLAG_MATCH = BIT(9),
David Spinadelfb98be52014-05-04 12:51:10 +0300301};
302
303enum iwl_scan_priority {
304 IWL_SCAN_PRIORITY_LOW,
305 IWL_SCAN_PRIORITY_MEDIUM,
306 IWL_SCAN_PRIORITY_HIGH,
307};
308
Avraham Sternd7afbfc2015-05-12 12:19:48 +0300309enum iwl_scan_priority_ext {
310 IWL_SCAN_PRIORITY_EXT_0_LOWEST,
311 IWL_SCAN_PRIORITY_EXT_1,
312 IWL_SCAN_PRIORITY_EXT_2,
313 IWL_SCAN_PRIORITY_EXT_3,
314 IWL_SCAN_PRIORITY_EXT_4,
315 IWL_SCAN_PRIORITY_EXT_5,
316 IWL_SCAN_PRIORITY_EXT_6,
317 IWL_SCAN_PRIORITY_EXT_7_HIGHEST,
318};
319
David Spinadelfb98be52014-05-04 12:51:10 +0300320/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100321 * struct iwl_scan_req_lmac - SCAN_REQUEST_CMD_API_S_VER_1
David Spinadelfb98be52014-05-04 12:51:10 +0300322 * @reserved1: for alignment and future use
323 * @channel_num: num of channels to scan
324 * @active-dwell: dwell time for active channels
325 * @passive-dwell: dwell time for passive channels
326 * @fragmented-dwell: dwell time for fragmented passive scan
David Spinadelc3e230b2015-11-22 16:37:36 +0200327 * @extended_dwell: dwell time for channels 1, 6 and 11 (in certain cases)
David Spinadelfb98be52014-05-04 12:51:10 +0300328 * @reserved2: for alignment and future use
329 * @rx_chain_selct: PHY_RX_CHAIN_* flags
330 * @scan_flags: &enum iwl_mvm_lmac_scan_flags
331 * @max_out_time: max time (in TU) to be out of associated channel
332 * @suspend_time: pause scan this long (TUs) when returning to service channel
333 * @flags: RXON flags
334 * @filter_flags: RXON filter
335 * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz
336 * @direct_scan: list of SSIDs for directed active scan
337 * @scan_prio: enum iwl_scan_priority
338 * @iter_num: number of scan iterations
339 * @delay: delay in seconds before first iteration
340 * @schedule: two scheduling plans. The first one is finite, the second one can
341 * be infinite.
342 * @channel_opt: channel optimization options, for full and partial scan
343 * @data: channel configuration and probe request packet.
344 */
Luciano Coelho65ff5562015-03-20 13:35:47 +0200345struct iwl_scan_req_lmac {
David Spinadelfb98be52014-05-04 12:51:10 +0300346 /* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */
347 __le32 reserved1;
348 u8 n_channels;
349 u8 active_dwell;
350 u8 passive_dwell;
351 u8 fragmented_dwell;
David Spinadelc3e230b2015-11-22 16:37:36 +0200352 u8 extended_dwell;
353 u8 reserved2;
David Spinadelfb98be52014-05-04 12:51:10 +0300354 __le16 rx_chain_select;
355 __le32 scan_flags;
356 __le32 max_out_time;
357 __le32 suspend_time;
358 /* RX_ON_FLAGS_API_S_VER_1 */
359 __le32 flags;
360 __le32 filter_flags;
361 struct iwl_scan_req_tx_cmd tx_cmd[2];
362 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
363 __le32 scan_prio;
364 /* SCAN_REQ_PERIODIC_PARAMS_API_S */
365 __le32 iter_num;
366 __le32 delay;
Avraham Sterncd55cce2015-08-19 12:46:12 +0300367 struct iwl_scan_schedule_lmac schedule[IWL_MAX_SCHED_SCAN_PLANS];
David Spinadelfb98be52014-05-04 12:51:10 +0300368 struct iwl_scan_channel_opt channel_opt[2];
369 u8 data[];
370} __packed;
371
372/**
Avraham Stern1083fd72015-03-31 16:14:41 +0300373 * struct iwl_scan_results_notif - scan results for one channel -
David Spinadelfb98be52014-05-04 12:51:10 +0300374 * SCAN_RESULT_NTF_API_S_VER_3
375 * @channel: which channel the results are from
376 * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
377 * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
378 * @num_probe_not_sent: # of request that weren't sent due to not enough time
379 * @duration: duration spent in channel, in usecs
380 */
Avraham Stern1083fd72015-03-31 16:14:41 +0300381struct iwl_scan_results_notif {
David Spinadelfb98be52014-05-04 12:51:10 +0300382 u8 channel;
383 u8 band;
384 u8 probe_status;
385 u8 num_probe_not_sent;
386 __le32 duration;
387} __packed;
388
389/**
390 * struct iwl_lmac_scan_complete_notif - notifies end of scanning (all channels)
391 * SCAN_COMPLETE_NTF_API_S_VER_3
392 * @scanned_channels: number of channels scanned (and number of valid results)
393 * @status: one of SCAN_COMP_STATUS_*
394 * @bt_status: BT on/off status
395 * @last_channel: last channel that was scanned
396 * @tsf_low: TSF timer (lower half) in usecs
397 * @tsf_high: TSF timer (higher half) in usecs
398 * @results: an array of scan results, only "scanned_channels" of them are valid
399 */
400struct iwl_lmac_scan_complete_notif {
401 u8 scanned_channels;
402 u8 status;
403 u8 bt_status;
404 u8 last_channel;
405 __le32 tsf_low;
406 __le32 tsf_high;
407 struct iwl_scan_results_notif results[];
408} __packed;
409
410/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100411 * struct iwl_scan_offload_complete - PERIODIC_SCAN_COMPLETE_NTF_API_S_VER_2
David Spinadelfb98be52014-05-04 12:51:10 +0300412 * @last_schedule_line: last schedule line executed (fast or regular)
413 * @last_schedule_iteration: last scan iteration executed before scan abort
414 * @status: enum iwl_scan_offload_complete_status
415 * @ebs_status: EBS success status &enum iwl_scan_ebs_status
416 * @time_after_last_iter; time in seconds elapsed after last iteration
417 */
418struct iwl_periodic_scan_complete {
419 u8 last_schedule_line;
420 u8 last_schedule_iteration;
421 u8 status;
422 u8 ebs_status;
423 __le32 time_after_last_iter;
424 __le32 reserved;
425} __packed;
426
David Spinadeld2496222014-05-20 12:46:37 +0300427/* UMAC Scan API */
428
Luciano Coelho507e4cd2015-03-19 22:58:33 +0200429/* The maximum of either of these cannot exceed 8, because we use an
430 * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h).
431 */
432#define IWL_MVM_MAX_UMAC_SCANS 8
433#define IWL_MVM_MAX_LMAC_SCANS 1
David Spinadeld2496222014-05-20 12:46:37 +0300434
435enum scan_config_flags {
436 SCAN_CONFIG_FLAG_ACTIVATE = BIT(0),
437 SCAN_CONFIG_FLAG_DEACTIVATE = BIT(1),
438 SCAN_CONFIG_FLAG_FORBID_CHUB_REQS = BIT(2),
439 SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS = BIT(3),
440 SCAN_CONFIG_FLAG_SET_TX_CHAINS = BIT(8),
441 SCAN_CONFIG_FLAG_SET_RX_CHAINS = BIT(9),
442 SCAN_CONFIG_FLAG_SET_AUX_STA_ID = BIT(10),
443 SCAN_CONFIG_FLAG_SET_ALL_TIMES = BIT(11),
444 SCAN_CONFIG_FLAG_SET_EFFECTIVE_TIMES = BIT(12),
445 SCAN_CONFIG_FLAG_SET_CHANNEL_FLAGS = BIT(13),
446 SCAN_CONFIG_FLAG_SET_LEGACY_RATES = BIT(14),
447 SCAN_CONFIG_FLAG_SET_MAC_ADDR = BIT(15),
448 SCAN_CONFIG_FLAG_SET_FRAGMENTED = BIT(16),
449 SCAN_CONFIG_FLAG_CLEAR_FRAGMENTED = BIT(17),
450 SCAN_CONFIG_FLAG_SET_CAM_MODE = BIT(18),
451 SCAN_CONFIG_FLAG_CLEAR_CAM_MODE = BIT(19),
452 SCAN_CONFIG_FLAG_SET_PROMISC_MODE = BIT(20),
453 SCAN_CONFIG_FLAG_CLEAR_PROMISC_MODE = BIT(21),
Sara Sharon9ba221b2016-11-17 11:35:05 +0200454 SCAN_CONFIG_FLAG_SET_LMAC2_FRAGMENTED = BIT(22),
455 SCAN_CONFIG_FLAG_CLEAR_LMAC2_FRAGMENTED = BIT(23),
David Spinadeld2496222014-05-20 12:46:37 +0300456
457 /* Bits 26-31 are for num of channels in channel_array */
458#define SCAN_CONFIG_N_CHANNELS(n) ((n) << 26)
459};
460
461enum scan_config_rates {
462 /* OFDM basic rates */
463 SCAN_CONFIG_RATE_6M = BIT(0),
464 SCAN_CONFIG_RATE_9M = BIT(1),
465 SCAN_CONFIG_RATE_12M = BIT(2),
466 SCAN_CONFIG_RATE_18M = BIT(3),
467 SCAN_CONFIG_RATE_24M = BIT(4),
468 SCAN_CONFIG_RATE_36M = BIT(5),
469 SCAN_CONFIG_RATE_48M = BIT(6),
470 SCAN_CONFIG_RATE_54M = BIT(7),
471 /* CCK basic rates */
472 SCAN_CONFIG_RATE_1M = BIT(8),
473 SCAN_CONFIG_RATE_2M = BIT(9),
474 SCAN_CONFIG_RATE_5M = BIT(10),
475 SCAN_CONFIG_RATE_11M = BIT(11),
476
477 /* Bits 16-27 are for supported rates */
478#define SCAN_CONFIG_SUPPORTED_RATE(rate) ((rate) << 16)
479};
480
481enum iwl_channel_flags {
482 IWL_CHANNEL_FLAG_EBS = BIT(0),
483 IWL_CHANNEL_FLAG_ACCURATE_EBS = BIT(1),
484 IWL_CHANNEL_FLAG_EBS_ADD = BIT(2),
485 IWL_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE = BIT(3),
486};
487
488/**
Sara Sharon9ba221b2016-11-17 11:35:05 +0200489 * struct iwl_scan_dwell
490 * @active: default dwell time for active scan
491 * @passive: default dwell time for passive scan
492 * @fragmented: default dwell time for fragmented scan
493 * @extended: default dwell time for channels 1, 6 and 11
494 */
495struct iwl_scan_dwell {
496 u8 active;
497 u8 passive;
498 u8 fragmented;
499 u8 extended;
500} __packed;
501
502/**
David Spinadeld2496222014-05-20 12:46:37 +0300503 * struct iwl_scan_config
David Spinadeld2496222014-05-20 12:46:37 +0300504 * @flags: enum scan_config_flags
505 * @tx_chains: valid_tx antenna - ANT_* definitions
506 * @rx_chains: valid_rx antenna - ANT_* definitions
507 * @legacy_rates: default legacy rates - enum scan_config_rates
508 * @out_of_channel_time: default max out of serving channel time
509 * @suspend_time: default max suspend time
Sara Sharon9ba221b2016-11-17 11:35:05 +0200510 * @dwell: dwells for the scan
David Spinadeld2496222014-05-20 12:46:37 +0300511 * @mac_addr: default mac address to be used in probes
512 * @bcast_sta_id: the index of the station in the fw
513 * @channel_flags: default channel flags - enum iwl_channel_flags
514 * scan_config_channel_flag
515 * @channel_array: default supported channels
516 */
Sara Sharona0b48282017-01-12 16:01:11 +0200517struct iwl_scan_config_v1 {
David Spinadeld2496222014-05-20 12:46:37 +0300518 __le32 flags;
519 __le32 tx_chains;
520 __le32 rx_chains;
521 __le32 legacy_rates;
522 __le32 out_of_channel_time;
523 __le32 suspend_time;
Sara Sharon9ba221b2016-11-17 11:35:05 +0200524 struct iwl_scan_dwell dwell;
David Spinadeld2496222014-05-20 12:46:37 +0300525 u8 mac_addr[ETH_ALEN];
526 u8 bcast_sta_id;
527 u8 channel_flags;
528 u8 channel_array[];
529} __packed; /* SCAN_CONFIG_DB_CMD_API_S */
530
Sara Sharon9ba221b2016-11-17 11:35:05 +0200531#define SCAN_TWO_LMACS 2
532
Sara Sharona0b48282017-01-12 16:01:11 +0200533struct iwl_scan_config {
Sara Sharon9ba221b2016-11-17 11:35:05 +0200534 __le32 flags;
535 __le32 tx_chains;
536 __le32 rx_chains;
537 __le32 legacy_rates;
538 __le32 out_of_channel_time[SCAN_TWO_LMACS];
539 __le32 suspend_time[SCAN_TWO_LMACS];
540 struct iwl_scan_dwell dwell;
541 u8 mac_addr[ETH_ALEN];
542 u8 bcast_sta_id;
543 u8 channel_flags;
544 u8 channel_array[];
545} __packed; /* SCAN_CONFIG_DB_CMD_API_S_3 */
546
David Spinadeld2496222014-05-20 12:46:37 +0300547/**
Johannes Berg31a658b2017-03-09 15:56:57 +0100548 * enum iwl_umac_scan_flags - UMAC scan flags
549 * @IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request
David Spinadeld2496222014-05-20 12:46:37 +0300550 * can be preempted by other scan requests with higher priority.
Avraham Stern8465fe62015-06-21 12:06:13 +0300551 * The low priority scan will be resumed when the higher proirity scan is
552 * completed.
Johannes Berg31a658b2017-03-09 15:56:57 +0100553 * @IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver
David Spinadeld2496222014-05-20 12:46:37 +0300554 * when scan starts.
555 */
556enum iwl_umac_scan_flags {
557 IWL_UMAC_SCAN_FLAG_PREEMPTIVE = BIT(0),
558 IWL_UMAC_SCAN_FLAG_START_NOTIF = BIT(1),
559};
560
561enum iwl_umac_scan_uid_offsets {
562 IWL_UMAC_SCAN_UID_TYPE_OFFSET = 0,
563 IWL_UMAC_SCAN_UID_SEQ_OFFSET = 8,
564};
565
566enum iwl_umac_scan_general_flags {
Sara Sharon9ba221b2016-11-17 11:35:05 +0200567 IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC = BIT(0),
568 IWL_UMAC_SCAN_GEN_FLAGS_OVER_BT = BIT(1),
569 IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL = BIT(2),
570 IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE = BIT(3),
571 IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT = BIT(4),
572 IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE = BIT(5),
573 IWL_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID = BIT(6),
574 IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED = BIT(7),
575 IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED = BIT(8),
576 IWL_UMAC_SCAN_GEN_FLAGS_MATCH = BIT(9),
577 IWL_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL = BIT(10),
578 IWL_UMAC_SCAN_GEN_FLAGS_LMAC2_FRAGMENTED = BIT(11),
David Spinadeld2496222014-05-20 12:46:37 +0300579};
580
581/**
582 * struct iwl_scan_channel_cfg_umac
583 * @flags: bitmap - 0-19: directed scan to i'th ssid.
584 * @channel_num: channel number 1-13 etc.
585 * @iter_count: repetition count for the channel.
Sara Sharon0d365ae2015-03-31 12:24:05 +0300586 * @iter_interval: interval between two scan iterations on one channel.
David Spinadeld2496222014-05-20 12:46:37 +0300587 */
588struct iwl_scan_channel_cfg_umac {
589 __le32 flags;
590 u8 channel_num;
591 u8 iter_count;
592 __le16 iter_interval;
593} __packed; /* SCAN_CHANNEL_CFG_S_VER2 */
594
595/**
596 * struct iwl_scan_umac_schedule
597 * @interval: interval in seconds between scan iterations
598 * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop
599 * @reserved: for alignment and future use
600 */
601struct iwl_scan_umac_schedule {
602 __le16 interval;
603 u8 iter_count;
604 u8 reserved;
605} __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */
606
607/**
608 * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command
609 * parameters following channels configuration array.
610 * @schedule: two scheduling plans.
611 * @delay: delay in TUs before starting the first scan iteration
612 * @reserved: for future use and alignment
613 * @preq: probe request with IEs blocks
614 * @direct_scan: list of SSIDs for directed active scan
615 */
616struct iwl_scan_req_umac_tail {
617 /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
Avraham Sterncd55cce2015-08-19 12:46:12 +0300618 struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
David Spinadeld2496222014-05-20 12:46:37 +0300619 __le16 delay;
620 __le16 reserved;
621 /* SCAN_PROBE_PARAMS_API_S_VER_1 */
622 struct iwl_scan_probe_req preq;
623 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
624} __packed;
625
626/**
627 * struct iwl_scan_req_umac
David Spinadeld2496222014-05-20 12:46:37 +0300628 * @flags: &enum iwl_umac_scan_flags
629 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
630 * @ooc_priority: out of channel priority - &enum iwl_scan_priority
631 * @general_flags: &enum iwl_umac_scan_general_flags
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300632 * @reserved2: for future use and alignment
633 * @scan_start_mac_id: report the scan start TSF time according to this mac TSF
David Spinadelc3e230b2015-11-22 16:37:36 +0200634 * @extended_dwell: dwell time for channels 1, 6 and 11
David Spinadeld2496222014-05-20 12:46:37 +0300635 * @active_dwell: dwell time for active scan
636 * @passive_dwell: dwell time for passive scan
637 * @fragmented_dwell: dwell time for fragmented passive scan
Sara Sharon9ba221b2016-11-17 11:35:05 +0200638 * @max_out_time: max out of serving channel time, per LMAC - for CDB there
639 * are 2 LMACs
640 * @suspend_time: max suspend time, per LMAC - for CDB there are 2 LMACs
David Spinadeld2496222014-05-20 12:46:37 +0300641 * @scan_priority: scan internal prioritization &enum iwl_scan_priority
642 * @channel_flags: &enum iwl_scan_channel_flags
643 * @n_channels: num of channels in scan request
David Spinadelc3e230b2015-11-22 16:37:36 +0200644 * @reserved: for future use and alignment
David Spinadeld2496222014-05-20 12:46:37 +0300645 * @data: &struct iwl_scan_channel_cfg_umac and
646 * &struct iwl_scan_req_umac_tail
647 */
648struct iwl_scan_req_umac {
David Spinadeld2496222014-05-20 12:46:37 +0300649 __le32 flags;
650 __le32 uid;
651 __le32 ooc_priority;
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300652 /* SCAN_GENERAL_PARAMS_API_S_VER_4 */
653 __le16 general_flags;
654 u8 reserved2;
655 u8 scan_start_mac_id;
David Spinadelc3e230b2015-11-22 16:37:36 +0200656 u8 extended_dwell;
David Spinadeld2496222014-05-20 12:46:37 +0300657 u8 active_dwell;
658 u8 passive_dwell;
659 u8 fragmented_dwell;
Sara Sharon9ba221b2016-11-17 11:35:05 +0200660 union {
661 struct {
662 __le32 max_out_time;
663 __le32 suspend_time;
664 __le32 scan_priority;
665 /* SCAN_CHANNEL_PARAMS_API_S_VER_4 */
666 u8 channel_flags;
667 u8 n_channels;
668 __le16 reserved;
669 u8 data[];
Sara Sharona0b48282017-01-12 16:01:11 +0200670 } v1; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */
Sara Sharon9ba221b2016-11-17 11:35:05 +0200671 struct {
672 __le32 max_out_time[SCAN_TWO_LMACS];
673 __le32 suspend_time[SCAN_TWO_LMACS];
674 __le32 scan_priority;
675 /* SCAN_CHANNEL_PARAMS_API_S_VER_4 */
676 u8 channel_flags;
677 u8 n_channels;
678 __le16 reserved;
679 u8 data[];
Sara Sharona0b48282017-01-12 16:01:11 +0200680 } v6; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_6 */
Sara Sharon9ba221b2016-11-17 11:35:05 +0200681 };
682} __packed;
683
Sara Sharona0b48282017-01-12 16:01:11 +0200684#define IWL_SCAN_REQ_UMAC_SIZE sizeof(struct iwl_scan_req_umac)
685#define IWL_SCAN_REQ_UMAC_SIZE_V1 (sizeof(struct iwl_scan_req_umac) - \
686 2 * sizeof(__le32))
David Spinadeld2496222014-05-20 12:46:37 +0300687
688/**
689 * struct iwl_umac_scan_abort
David Spinadeld2496222014-05-20 12:46:37 +0300690 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
691 * @flags: reserved
692 */
693struct iwl_umac_scan_abort {
David Spinadeld2496222014-05-20 12:46:37 +0300694 __le32 uid;
695 __le32 flags;
696} __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */
697
698/**
699 * struct iwl_umac_scan_complete
700 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
701 * @last_schedule: last scheduling line
702 * @last_iter: last scan iteration number
703 * @scan status: &enum iwl_scan_offload_complete_status
704 * @ebs_status: &enum iwl_scan_ebs_status
705 * @time_from_last_iter: time elapsed from last iteration
706 * @reserved: for future use
707 */
708struct iwl_umac_scan_complete {
709 __le32 uid;
710 u8 last_schedule;
711 u8 last_iter;
712 u8 status;
713 u8 ebs_status;
714 __le32 time_from_last_iter;
715 __le32 reserved;
716} __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */
717
Luciano Coelhob04998f2014-11-20 15:58:34 +0200718#define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN 5
719/**
720 * struct iwl_scan_offload_profile_match - match information
721 * @bssid: matched bssid
722 * @channel: channel where the match occurred
723 * @energy:
724 * @matching_feature:
725 * @matching_channels: bitmap of channels that matched, referencing
726 * the channels passed in tue scan offload request
727 */
728struct iwl_scan_offload_profile_match {
729 u8 bssid[ETH_ALEN];
730 __le16 reserved;
731 u8 channel;
732 u8 energy;
733 u8 matching_feature;
734 u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN];
735} __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_1 */
736
737/**
738 * struct iwl_scan_offload_profiles_query - match results query response
739 * @matched_profiles: bitmap of matched profiles, referencing the
740 * matches passed in the scan offload request
741 * @last_scan_age: age of the last offloaded scan
742 * @n_scans_done: number of offloaded scans done
743 * @gp2_d0u: GP2 when D0U occurred
744 * @gp2_invoked: GP2 when scan offload was invoked
745 * @resume_while_scanning: not used
746 * @self_recovery: obsolete
747 * @reserved: reserved
748 * @matches: array of match information, one for each match
749 */
750struct iwl_scan_offload_profiles_query {
751 __le32 matched_profiles;
752 __le32 last_scan_age;
753 __le32 n_scans_done;
754 __le32 gp2_d0u;
755 __le32 gp2_invoked;
756 u8 resume_while_scanning;
757 u8 self_recovery;
758 __le16 reserved;
759 struct iwl_scan_offload_profile_match matches[IWL_SCAN_MAX_PROFILES];
760} __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */
761
Avraham Sternee9219b2015-03-23 15:09:27 +0200762/**
763 * struct iwl_umac_scan_iter_complete_notif - notifies end of scanning iteration
764 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
765 * @scanned_channels: number of channels scanned and number of valid elements in
766 * results array
767 * @status: one of SCAN_COMP_STATUS_*
768 * @bt_status: BT on/off status
769 * @last_channel: last channel that was scanned
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300770 * @start_tsf: TSF timer in usecs of the scan start time for the mac specified
771 * in &struct iwl_scan_req_umac.
Avraham Sternee9219b2015-03-23 15:09:27 +0200772 * @results: array of scan results, only "scanned_channels" of them are valid
773 */
774struct iwl_umac_scan_iter_complete_notif {
775 __le32 uid;
776 u8 scanned_channels;
777 u8 status;
778 u8 bt_status;
779 u8 last_channel;
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300780 __le64 start_tsf;
Avraham Sternee9219b2015-03-23 15:09:27 +0200781 struct iwl_scan_results_notif results[];
Avrahams Sternaacf8f12016-07-19 11:15:09 +0300782} __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_2 */
Avraham Sternee9219b2015-03-23 15:09:27 +0200783
Johannes Berg8ca151b2013-01-24 14:25:36 +0100784#endif