iwlwifi: mvm: generalize the other-scan stopping code
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / mvm / fw-api-scan.h
CommitLineData
8ca151b5
JB
1/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
51368bf7 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
507e4cda 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
8ca151b5
JB
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
23 * USA
24 *
25 * The full GNU General Public License is included in this distribution
410dc5aa 26 * in the file called COPYING.
8ca151b5
JB
27 *
28 * Contact Information:
29 * Intel Linux Wireless <ilw@linux.intel.com>
30 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
31 *
32 * BSD LICENSE
33 *
51368bf7 34 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
507e4cda 35 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
8ca151b5
JB
36 * All rights reserved.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 *
42 * * Redistributions of source code must retain the above copyright
43 * notice, this list of conditions and the following disclaimer.
44 * * Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in
46 * the documentation and/or other materials provided with the
47 * distribution.
48 * * Neither the name Intel Corporation nor the names of its
49 * contributors may be used to endorse or promote products derived
50 * from this software without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
53 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
54 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
55 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
56 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
57 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
58 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
59 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
60 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
62 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 *
64 *****************************************************************************/
65
66#ifndef __fw_api_scan_h__
67#define __fw_api_scan_h__
68
69#include "fw-api.h"
70
71/* Scan Commands, Responses, Notifications */
72
8ca151b5
JB
73/* Max number of IEs for direct SSID scans in a command */
74#define PROBE_OPTION_MAX 20
75
8ca151b5
JB
76/**
77 * 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
8ca151b5
JB
90/* How many statistics are gathered for each channel */
91#define SCAN_RESULTS_STATISTICS 1
92
93/**
94 * enum iwl_scan_complete_status - status codes for scan complete notifications
95 * @SCAN_COMP_STATUS_OK: scan completed successfully
96 * @SCAN_COMP_STATUS_ABORT: scan was aborted by user
97 * @SCAN_COMP_STATUS_ERR_SLEEP: sending null sleep packet failed
98 * @SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT: timeout before channel is ready
99 * @SCAN_COMP_STATUS_ERR_PROBE: sending probe request failed
100 * @SCAN_COMP_STATUS_ERR_WAKEUP: sending null wakeup packet failed
101 * @SCAN_COMP_STATUS_ERR_ANTENNAS: invalid antennas chosen at scan command
102 * @SCAN_COMP_STATUS_ERR_INTERNAL: internal error caused scan abort
103 * @SCAN_COMP_STATUS_ERR_COEX: medium was lost ot WiMax
104 * @SCAN_COMP_STATUS_P2P_ACTION_OK: P2P public action frame TX was successful
105 * (not an error!)
0d365ae5 106 * @SCAN_COMP_STATUS_ITERATION_END: indicates end of one repetition the driver
8ca151b5
JB
107 * asked for
108 * @SCAN_COMP_STATUS_ERR_ALLOC_TE: scan could not allocate time events
109*/
110enum iwl_scan_complete_status {
111 SCAN_COMP_STATUS_OK = 0x1,
112 SCAN_COMP_STATUS_ABORT = 0x2,
113 SCAN_COMP_STATUS_ERR_SLEEP = 0x3,
114 SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT = 0x4,
115 SCAN_COMP_STATUS_ERR_PROBE = 0x5,
116 SCAN_COMP_STATUS_ERR_WAKEUP = 0x6,
117 SCAN_COMP_STATUS_ERR_ANTENNAS = 0x7,
118 SCAN_COMP_STATUS_ERR_INTERNAL = 0x8,
119 SCAN_COMP_STATUS_ERR_COEX = 0x9,
120 SCAN_COMP_STATUS_P2P_ACTION_OK = 0xA,
121 SCAN_COMP_STATUS_ITERATION_END = 0x0B,
122 SCAN_COMP_STATUS_ERR_ALLOC_TE = 0x0C,
123};
124
8ca151b5 125/* scan offload */
8ca151b5 126#define IWL_SCAN_MAX_BLACKLIST_LEN 64
35a000b7 127#define IWL_SCAN_SHORT_BLACKLIST_LEN 16
8ca151b5
JB
128#define IWL_SCAN_MAX_PROFILES 11
129#define SCAN_OFFLOAD_PROBE_REQ_SIZE 512
130
131/* Default watchdog (in MS) for scheduled scan iteration */
132#define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
133
134#define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
135#define CAN_ABORT_STATUS 1
136
137#define IWL_FULL_SCAN_MULTIPLIER 5
138#define IWL_FAST_SCHED_SCAN_ITERATIONS 3
139
35a000b7
DS
140enum scan_framework_client {
141 SCAN_CLIENT_SCHED_SCAN = BIT(0),
142 SCAN_CLIENT_NETDETECT = BIT(1),
143 SCAN_CLIENT_ASSET_TRACKING = BIT(2),
144};
145
8ca151b5
JB
146/**
147 * struct iwl_scan_offload_cmd - SCAN_REQUEST_FIXED_PART_API_S_VER_6
148 * @scan_flags: see enum iwl_scan_flags
149 * @channel_count: channels in channel list
0d365ae5 150 * @quiet_time: dwell time, in milliseconds, on quiet channel
8ca151b5
JB
151 * @quiet_plcp_th: quiet channel num of packets threshold
152 * @good_CRC_th: passive to active promotion threshold
153 * @rx_chain: RXON rx chain.
0d365ae5 154 * @max_out_time: max TUs to be out of associated channel
ef67f18d 155 * @suspend_time: pause scan this TUs when returning to service channel
8ca151b5
JB
156 * @flags: RXON flags
157 * @filter_flags: RXONfilter
158 * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz.
159 * @direct_scan: list of SSIDs for directed active scan
160 * @scan_type: see enum iwl_scan_type.
161 * @rep_count: repetition count for each scheduled scan iteration.
162 */
163struct iwl_scan_offload_cmd {
164 __le16 len;
165 u8 scan_flags;
166 u8 channel_count;
167 __le16 quiet_time;
168 __le16 quiet_plcp_th;
169 __le16 good_CRC_th;
170 __le16 rx_chain;
171 __le32 max_out_time;
172 __le32 suspend_time;
173 /* RX_ON_FLAGS_API_S_VER_1 */
174 __le32 flags;
175 __le32 filter_flags;
176 struct iwl_tx_cmd tx_cmd[2];
177 /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
178 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
179 __le32 scan_type;
180 __le32 rep_count;
181} __packed;
182
183enum iwl_scan_offload_channel_flags {
184 IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE = BIT(0),
185 IWL_SCAN_OFFLOAD_CHANNEL_NARROW = BIT(22),
186 IWL_SCAN_OFFLOAD_CHANNEL_FULL = BIT(24),
187 IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL = BIT(25),
188};
189
762533ba
DS
190/* channel configuration for struct iwl_scan_offload_cfg. Each channels needs:
191 * __le32 type: bitmap; bits 1-20 are for directed scan to i'th ssid and
192 * see enum iwl_scan_offload_channel_flags.
193 * __le16 channel_number: channel number 1-13 etc.
194 * __le16 iter_count: repetition count for the channel.
0d365ae5 195 * __le32 iter_interval: interval between two iterations on one channel.
762533ba
DS
196 * u8 active_dwell.
197 * u8 passive_dwell.
8ca151b5 198 */
762533ba 199#define IWL_SCAN_CHAN_SIZE 14
8ca151b5
JB
200
201/**
202 * iwl_scan_offload_cfg - SCAN_OFFLOAD_CONFIG_API_S
203 * @scan_cmd: scan command fixed part
762533ba 204 * @data: scan channel configuration and probe request frames
8ca151b5
JB
205 */
206struct iwl_scan_offload_cfg {
207 struct iwl_scan_offload_cmd scan_cmd;
8ca151b5
JB
208 u8 data[0];
209} __packed;
210
211/**
212 * iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S
213 * @ssid: MAC address to filter out
214 * @reported_rssi: AP rssi reported to the host
35a000b7 215 * @client_bitmap: clients ignore this entry - enum scan_framework_client
8ca151b5
JB
216 */
217struct iwl_scan_offload_blacklist {
218 u8 ssid[ETH_ALEN];
219 u8 reported_rssi;
35a000b7 220 u8 client_bitmap;
8ca151b5
JB
221} __packed;
222
223enum iwl_scan_offload_network_type {
224 IWL_NETWORK_TYPE_BSS = 1,
225 IWL_NETWORK_TYPE_IBSS = 2,
226 IWL_NETWORK_TYPE_ANY = 3,
227};
228
229enum iwl_scan_offload_band_selection {
230 IWL_SCAN_OFFLOAD_SELECT_2_4 = 0x4,
231 IWL_SCAN_OFFLOAD_SELECT_5_2 = 0x8,
232 IWL_SCAN_OFFLOAD_SELECT_ANY = 0xc,
233};
234
235/**
236 * iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S
237 * @ssid_index: index to ssid list in fixed part
0d365ae5
SS
238 * @unicast_cipher: encryption algorithm to match - bitmap
239 * @aut_alg: authentication algorithm to match - bitmap
8ca151b5
JB
240 * @network_type: enum iwl_scan_offload_network_type
241 * @band_selection: enum iwl_scan_offload_band_selection
35a000b7 242 * @client_bitmap: clients waiting for match - enum scan_framework_client
8ca151b5
JB
243 */
244struct iwl_scan_offload_profile {
245 u8 ssid_index;
246 u8 unicast_cipher;
247 u8 auth_alg;
248 u8 network_type;
249 u8 band_selection;
35a000b7
DS
250 u8 client_bitmap;
251 u8 reserved[2];
8ca151b5
JB
252} __packed;
253
254/**
255 * iwl_scan_offload_profile_cfg - SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1
256 * @blaclist: AP list to filter off from scan results
257 * @profiles: profiles to search for match
258 * @blacklist_len: length of blacklist
259 * @num_profiles: num of profiles in the list
35a000b7
DS
260 * @match_notify: clients waiting for match found notification
261 * @pass_match: clients waiting for the results
262 * @active_clients: active clients bitmap - enum scan_framework_client
6e0bbe5e 263 * @any_beacon_notify: clients waiting for match notification without match
8ca151b5
JB
264 */
265struct iwl_scan_offload_profile_cfg {
8ca151b5
JB
266 struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
267 u8 blacklist_len;
268 u8 num_profiles;
35a000b7
DS
269 u8 match_notify;
270 u8 pass_match;
271 u8 active_clients;
6e0bbe5e
DS
272 u8 any_beacon_notify;
273 u8 reserved[2];
8ca151b5
JB
274} __packed;
275
276/**
277 * iwl_scan_offload_schedule - schedule of scan offload
278 * @delay: delay between iterations, in seconds.
279 * @iterations: num of scan iterations
280 * @full_scan_mul: number of partial scans before each full scan
281 */
282struct iwl_scan_offload_schedule {
b14fc2be 283 __le16 delay;
8ca151b5
JB
284 u8 iterations;
285 u8 full_scan_mul;
286} __packed;
287
288/*
289 * iwl_scan_offload_flags
290 *
de33fb5e 291 * IWL_SCAN_OFFLOAD_FLAG_PASS_ALL: pass all results - no filtering.
8ca151b5 292 * IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL: add cached channels to partial scan.
e820c2da
HD
293 * IWL_SCAN_OFFLOAD_FLAG_EBS_QUICK_MODE: EBS duration is 100mSec - typical
294 * beacon period. Finding channel activity in this mode is not guaranteed.
295 * IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE: EBS duration is 200mSec.
296 * Assuming beacon period is 100ms finding channel activity is guaranteed.
8ca151b5
JB
297 */
298enum iwl_scan_offload_flags {
de33fb5e 299 IWL_SCAN_OFFLOAD_FLAG_PASS_ALL = BIT(0),
8ca151b5 300 IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL = BIT(2),
e820c2da
HD
301 IWL_SCAN_OFFLOAD_FLAG_EBS_QUICK_MODE = BIT(5),
302 IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE = BIT(6),
8ca151b5
JB
303};
304
305/**
306 * iwl_scan_offload_req - scan offload request command
307 * @flags: bitmap - enum iwl_scan_offload_flags.
308 * @watchdog: maximum scan duration in TU.
309 * @delay: delay in seconds before first iteration.
310 * @schedule_line: scan offload schedule, for fast and regular scan.
311 */
312struct iwl_scan_offload_req {
313 __le16 flags;
314 __le16 watchdog;
315 __le16 delay;
316 __le16 reserved;
317 struct iwl_scan_offload_schedule schedule_line[2];
318} __packed;
319
320enum iwl_scan_offload_compleate_status {
321 IWL_SCAN_OFFLOAD_COMPLETED = 1,
322 IWL_SCAN_OFFLOAD_ABORTED = 2,
323};
324
e820c2da
HD
325enum iwl_scan_ebs_status {
326 IWL_SCAN_EBS_SUCCESS,
327 IWL_SCAN_EBS_FAILED,
328 IWL_SCAN_EBS_CHAN_NOT_FOUND,
329};
330
8ca151b5
JB
331/**
332 * iwl_scan_offload_complete - SCAN_OFFLOAD_COMPLETE_NTF_API_S_VER_1
333 * @last_schedule_line: last schedule line executed (fast or regular)
334 * @last_schedule_iteration: last scan iteration executed before scan abort
335 * @status: enum iwl_scan_offload_compleate_status
e820c2da 336 * @ebs_status: last EBS status, see IWL_SCAN_EBS_*
8ca151b5
JB
337 */
338struct iwl_scan_offload_complete {
339 u8 last_schedule_line;
340 u8 last_schedule_iteration;
341 u8 status;
e820c2da 342 u8 ebs_status;
8ca151b5
JB
343} __packed;
344
35a000b7
DS
345/**
346 * iwl_sched_scan_results - SCAN_OFFLOAD_MATCH_FOUND_NTF_API_S_VER_1
347 * @ssid_bitmap: SSIDs indexes found in this iteration
348 * @client_bitmap: clients that are active and wait for this notification
349 */
350struct iwl_sched_scan_results {
351 __le16 ssid_bitmap;
352 u8 client_bitmap;
353 u8 reserved;
354};
355
fb98be5e
DS
356/* Unified LMAC scan API */
357
358#define IWL_MVM_BASIC_PASSIVE_DWELL 110
359
360/**
361 * iwl_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S
362 * @tx_flags: combination of TX_CMD_FLG_*
363 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
364 * cleared. Combination of RATE_MCS_*
365 * @sta_id: index of destination station in FW station table
366 * @reserved: for alignment and future use
367 */
368struct iwl_scan_req_tx_cmd {
369 __le32 tx_flags;
370 __le32 rate_n_flags;
371 u8 sta_id;
372 u8 reserved[3];
373} __packed;
374
375enum iwl_scan_channel_flags_lmac {
376 IWL_UNIFIED_SCAN_CHANNEL_FULL = BIT(27),
377 IWL_UNIFIED_SCAN_CHANNEL_PARTIAL = BIT(28),
378};
379
380/**
381 * iwl_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2
382 * @flags: bits 1-20: directed scan to i'th ssid
383 * other bits &enum iwl_scan_channel_flags_lmac
384 * @channel_number: channel number 1-13 etc
385 * @iter_count: scan iteration on this channel
386 * @iter_interval: interval in seconds between iterations on one channel
387 */
388struct iwl_scan_channel_cfg_lmac {
389 __le32 flags;
390 __le16 channel_num;
391 __le16 iter_count;
392 __le32 iter_interval;
393} __packed;
394
395/*
396 * iwl_scan_probe_segment - PROBE_SEGMENT_API_S_VER_1
397 * @offset: offset in the data block
398 * @len: length of the segment
399 */
400struct iwl_scan_probe_segment {
401 __le16 offset;
402 __le16 len;
403} __packed;
404
405/* iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_2
406 * @mac_header: first (and common) part of the probe
407 * @band_data: band specific data
408 * @common_data: last (and common) part of the probe
409 * @buf: raw data block
410 */
411struct iwl_scan_probe_req {
412 struct iwl_scan_probe_segment mac_header;
413 struct iwl_scan_probe_segment band_data[2];
414 struct iwl_scan_probe_segment common_data;
415 u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
416} __packed;
417
418enum iwl_scan_channel_flags {
419 IWL_SCAN_CHANNEL_FLAG_EBS = BIT(0),
420 IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE = BIT(1),
421 IWL_SCAN_CHANNEL_FLAG_CACHE_ADD = BIT(2),
422};
423
424/* iwl_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S
1f9c418f
DS
425 * @flags: enum iwl_scan_channel_flags
426 * @non_ebs_ratio: defines the ratio of number of scan iterations where EBS is
427 * involved.
428 * 1 - EBS is disabled.
429 * 2 - every second scan will be full scan(and so on).
fb98be5e
DS
430 */
431struct iwl_scan_channel_opt {
432 __le16 flags;
433 __le16 non_ebs_ratio;
434} __packed;
435
436/**
437 * iwl_mvm_lmac_scan_flags
438 * @IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses
439 * without filtering.
440 * @IWL_MVM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels
441 * @IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan
442 * @IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification
443 * @IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS multiple SSID matching
444 * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented
73897bd1
AO
445 * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report
446 * and DS parameter set IEs into probe requests.
7e2a3883 447 * @IWL_MVM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches
fb98be5e
DS
448 */
449enum iwl_mvm_lmac_scan_flags {
450 IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL = BIT(0),
451 IWL_MVM_LMAC_SCAN_FLAG_PASSIVE = BIT(1),
452 IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION = BIT(2),
453 IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE = BIT(3),
454 IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = BIT(4),
455 IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED = BIT(5),
73897bd1 456 IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6),
7e2a3883 457 IWL_MVM_LMAC_SCAN_FLAG_MATCH = BIT(9),
fb98be5e
DS
458};
459
460enum iwl_scan_priority {
461 IWL_SCAN_PRIORITY_LOW,
462 IWL_SCAN_PRIORITY_MEDIUM,
463 IWL_SCAN_PRIORITY_HIGH,
464};
465
466/**
467 * iwl_scan_req_unified_lmac - SCAN_REQUEST_CMD_API_S_VER_1
468 * @reserved1: for alignment and future use
469 * @channel_num: num of channels to scan
470 * @active-dwell: dwell time for active channels
471 * @passive-dwell: dwell time for passive channels
472 * @fragmented-dwell: dwell time for fragmented passive scan
473 * @reserved2: for alignment and future use
474 * @rx_chain_selct: PHY_RX_CHAIN_* flags
475 * @scan_flags: &enum iwl_mvm_lmac_scan_flags
476 * @max_out_time: max time (in TU) to be out of associated channel
477 * @suspend_time: pause scan this long (TUs) when returning to service channel
478 * @flags: RXON flags
479 * @filter_flags: RXON filter
480 * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz
481 * @direct_scan: list of SSIDs for directed active scan
482 * @scan_prio: enum iwl_scan_priority
483 * @iter_num: number of scan iterations
484 * @delay: delay in seconds before first iteration
485 * @schedule: two scheduling plans. The first one is finite, the second one can
486 * be infinite.
487 * @channel_opt: channel optimization options, for full and partial scan
488 * @data: channel configuration and probe request packet.
489 */
490struct iwl_scan_req_unified_lmac {
491 /* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */
492 __le32 reserved1;
493 u8 n_channels;
494 u8 active_dwell;
495 u8 passive_dwell;
496 u8 fragmented_dwell;
497 __le16 reserved2;
498 __le16 rx_chain_select;
499 __le32 scan_flags;
500 __le32 max_out_time;
501 __le32 suspend_time;
502 /* RX_ON_FLAGS_API_S_VER_1 */
503 __le32 flags;
504 __le32 filter_flags;
505 struct iwl_scan_req_tx_cmd tx_cmd[2];
506 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
507 __le32 scan_prio;
508 /* SCAN_REQ_PERIODIC_PARAMS_API_S */
509 __le32 iter_num;
510 __le32 delay;
511 struct iwl_scan_offload_schedule schedule[2];
512 struct iwl_scan_channel_opt channel_opt[2];
513 u8 data[];
514} __packed;
515
516/**
1083fd73 517 * struct iwl_scan_results_notif - scan results for one channel -
fb98be5e
DS
518 * SCAN_RESULT_NTF_API_S_VER_3
519 * @channel: which channel the results are from
520 * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
521 * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
522 * @num_probe_not_sent: # of request that weren't sent due to not enough time
523 * @duration: duration spent in channel, in usecs
524 */
1083fd73 525struct iwl_scan_results_notif {
fb98be5e
DS
526 u8 channel;
527 u8 band;
528 u8 probe_status;
529 u8 num_probe_not_sent;
530 __le32 duration;
531} __packed;
532
533/**
534 * struct iwl_lmac_scan_complete_notif - notifies end of scanning (all channels)
535 * SCAN_COMPLETE_NTF_API_S_VER_3
536 * @scanned_channels: number of channels scanned (and number of valid results)
537 * @status: one of SCAN_COMP_STATUS_*
538 * @bt_status: BT on/off status
539 * @last_channel: last channel that was scanned
540 * @tsf_low: TSF timer (lower half) in usecs
541 * @tsf_high: TSF timer (higher half) in usecs
542 * @results: an array of scan results, only "scanned_channels" of them are valid
543 */
544struct iwl_lmac_scan_complete_notif {
545 u8 scanned_channels;
546 u8 status;
547 u8 bt_status;
548 u8 last_channel;
549 __le32 tsf_low;
550 __le32 tsf_high;
551 struct iwl_scan_results_notif results[];
552} __packed;
553
554/**
555 * iwl_scan_offload_complete - PERIODIC_SCAN_COMPLETE_NTF_API_S_VER_2
556 * @last_schedule_line: last schedule line executed (fast or regular)
557 * @last_schedule_iteration: last scan iteration executed before scan abort
558 * @status: enum iwl_scan_offload_complete_status
559 * @ebs_status: EBS success status &enum iwl_scan_ebs_status
560 * @time_after_last_iter; time in seconds elapsed after last iteration
561 */
562struct iwl_periodic_scan_complete {
563 u8 last_schedule_line;
564 u8 last_schedule_iteration;
565 u8 status;
566 u8 ebs_status;
567 __le32 time_after_last_iter;
568 __le32 reserved;
569} __packed;
570
d2496221
DS
571/* UMAC Scan API */
572
573/**
574 * struct iwl_mvm_umac_cmd_hdr - Command header for UMAC commands
575 * @size: size of the command (not including header)
576 * @reserved0: for future use and alignment
577 * @ver: API version number
578 */
579struct iwl_mvm_umac_cmd_hdr {
580 __le16 size;
581 u8 reserved0;
582 u8 ver;
583} __packed;
584
507e4cda
LC
585/* The maximum of either of these cannot exceed 8, because we use an
586 * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h).
587 */
588#define IWL_MVM_MAX_UMAC_SCANS 8
589#define IWL_MVM_MAX_LMAC_SCANS 1
d2496221
DS
590
591enum scan_config_flags {
592 SCAN_CONFIG_FLAG_ACTIVATE = BIT(0),
593 SCAN_CONFIG_FLAG_DEACTIVATE = BIT(1),
594 SCAN_CONFIG_FLAG_FORBID_CHUB_REQS = BIT(2),
595 SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS = BIT(3),
596 SCAN_CONFIG_FLAG_SET_TX_CHAINS = BIT(8),
597 SCAN_CONFIG_FLAG_SET_RX_CHAINS = BIT(9),
598 SCAN_CONFIG_FLAG_SET_AUX_STA_ID = BIT(10),
599 SCAN_CONFIG_FLAG_SET_ALL_TIMES = BIT(11),
600 SCAN_CONFIG_FLAG_SET_EFFECTIVE_TIMES = BIT(12),
601 SCAN_CONFIG_FLAG_SET_CHANNEL_FLAGS = BIT(13),
602 SCAN_CONFIG_FLAG_SET_LEGACY_RATES = BIT(14),
603 SCAN_CONFIG_FLAG_SET_MAC_ADDR = BIT(15),
604 SCAN_CONFIG_FLAG_SET_FRAGMENTED = BIT(16),
605 SCAN_CONFIG_FLAG_CLEAR_FRAGMENTED = BIT(17),
606 SCAN_CONFIG_FLAG_SET_CAM_MODE = BIT(18),
607 SCAN_CONFIG_FLAG_CLEAR_CAM_MODE = BIT(19),
608 SCAN_CONFIG_FLAG_SET_PROMISC_MODE = BIT(20),
609 SCAN_CONFIG_FLAG_CLEAR_PROMISC_MODE = BIT(21),
610
611 /* Bits 26-31 are for num of channels in channel_array */
612#define SCAN_CONFIG_N_CHANNELS(n) ((n) << 26)
613};
614
615enum scan_config_rates {
616 /* OFDM basic rates */
617 SCAN_CONFIG_RATE_6M = BIT(0),
618 SCAN_CONFIG_RATE_9M = BIT(1),
619 SCAN_CONFIG_RATE_12M = BIT(2),
620 SCAN_CONFIG_RATE_18M = BIT(3),
621 SCAN_CONFIG_RATE_24M = BIT(4),
622 SCAN_CONFIG_RATE_36M = BIT(5),
623 SCAN_CONFIG_RATE_48M = BIT(6),
624 SCAN_CONFIG_RATE_54M = BIT(7),
625 /* CCK basic rates */
626 SCAN_CONFIG_RATE_1M = BIT(8),
627 SCAN_CONFIG_RATE_2M = BIT(9),
628 SCAN_CONFIG_RATE_5M = BIT(10),
629 SCAN_CONFIG_RATE_11M = BIT(11),
630
631 /* Bits 16-27 are for supported rates */
632#define SCAN_CONFIG_SUPPORTED_RATE(rate) ((rate) << 16)
633};
634
635enum iwl_channel_flags {
636 IWL_CHANNEL_FLAG_EBS = BIT(0),
637 IWL_CHANNEL_FLAG_ACCURATE_EBS = BIT(1),
638 IWL_CHANNEL_FLAG_EBS_ADD = BIT(2),
639 IWL_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE = BIT(3),
640};
641
642/**
643 * struct iwl_scan_config
644 * @hdr: umac command header
645 * @flags: enum scan_config_flags
646 * @tx_chains: valid_tx antenna - ANT_* definitions
647 * @rx_chains: valid_rx antenna - ANT_* definitions
648 * @legacy_rates: default legacy rates - enum scan_config_rates
649 * @out_of_channel_time: default max out of serving channel time
650 * @suspend_time: default max suspend time
651 * @dwell_active: default dwell time for active scan
652 * @dwell_passive: default dwell time for passive scan
653 * @dwell_fragmented: default dwell time for fragmented scan
654 * @reserved: for future use and alignment
655 * @mac_addr: default mac address to be used in probes
656 * @bcast_sta_id: the index of the station in the fw
657 * @channel_flags: default channel flags - enum iwl_channel_flags
658 * scan_config_channel_flag
659 * @channel_array: default supported channels
660 */
661struct iwl_scan_config {
662 struct iwl_mvm_umac_cmd_hdr hdr;
663 __le32 flags;
664 __le32 tx_chains;
665 __le32 rx_chains;
666 __le32 legacy_rates;
667 __le32 out_of_channel_time;
668 __le32 suspend_time;
669 u8 dwell_active;
670 u8 dwell_passive;
671 u8 dwell_fragmented;
672 u8 reserved;
673 u8 mac_addr[ETH_ALEN];
674 u8 bcast_sta_id;
675 u8 channel_flags;
676 u8 channel_array[];
677} __packed; /* SCAN_CONFIG_DB_CMD_API_S */
678
679/**
680 * iwl_umac_scan_flags
681 *@IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request
682 * can be preempted by other scan requests with higher priority.
683 * The low priority scan is aborted.
684 *@IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver
685 * when scan starts.
686 */
687enum iwl_umac_scan_flags {
688 IWL_UMAC_SCAN_FLAG_PREEMPTIVE = BIT(0),
689 IWL_UMAC_SCAN_FLAG_START_NOTIF = BIT(1),
690};
691
692enum iwl_umac_scan_uid_offsets {
693 IWL_UMAC_SCAN_UID_TYPE_OFFSET = 0,
694 IWL_UMAC_SCAN_UID_SEQ_OFFSET = 8,
695};
696
697enum iwl_umac_scan_general_flags {
698 IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC = BIT(0),
699 IWL_UMAC_SCAN_GEN_FLAGS_OVER_BT = BIT(1),
700 IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL = BIT(2),
701 IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE = BIT(3),
702 IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT = BIT(4),
703 IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE = BIT(5),
704 IWL_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID = BIT(6),
705 IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED = BIT(7),
706 IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED = BIT(8),
707 IWL_UMAC_SCAN_GEN_FLAGS_MATCH = BIT(9)
708};
709
710/**
711 * struct iwl_scan_channel_cfg_umac
712 * @flags: bitmap - 0-19: directed scan to i'th ssid.
713 * @channel_num: channel number 1-13 etc.
714 * @iter_count: repetition count for the channel.
0d365ae5 715 * @iter_interval: interval between two scan iterations on one channel.
d2496221
DS
716 */
717struct iwl_scan_channel_cfg_umac {
718 __le32 flags;
719 u8 channel_num;
720 u8 iter_count;
721 __le16 iter_interval;
722} __packed; /* SCAN_CHANNEL_CFG_S_VER2 */
723
724/**
725 * struct iwl_scan_umac_schedule
726 * @interval: interval in seconds between scan iterations
727 * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop
728 * @reserved: for alignment and future use
729 */
730struct iwl_scan_umac_schedule {
731 __le16 interval;
732 u8 iter_count;
733 u8 reserved;
734} __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */
735
736/**
737 * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command
738 * parameters following channels configuration array.
739 * @schedule: two scheduling plans.
740 * @delay: delay in TUs before starting the first scan iteration
741 * @reserved: for future use and alignment
742 * @preq: probe request with IEs blocks
743 * @direct_scan: list of SSIDs for directed active scan
744 */
745struct iwl_scan_req_umac_tail {
746 /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
747 struct iwl_scan_umac_schedule schedule[2];
748 __le16 delay;
749 __le16 reserved;
750 /* SCAN_PROBE_PARAMS_API_S_VER_1 */
751 struct iwl_scan_probe_req preq;
752 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
753} __packed;
754
755/**
756 * struct iwl_scan_req_umac
757 * @hdr: umac command header
758 * @flags: &enum iwl_umac_scan_flags
759 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
760 * @ooc_priority: out of channel priority - &enum iwl_scan_priority
761 * @general_flags: &enum iwl_umac_scan_general_flags
762 * @reserved1: for future use and alignment
763 * @active_dwell: dwell time for active scan
764 * @passive_dwell: dwell time for passive scan
765 * @fragmented_dwell: dwell time for fragmented passive scan
766 * @max_out_time: max out of serving channel time
767 * @suspend_time: max suspend time
768 * @scan_priority: scan internal prioritization &enum iwl_scan_priority
769 * @channel_flags: &enum iwl_scan_channel_flags
770 * @n_channels: num of channels in scan request
771 * @reserved2: for future use and alignment
772 * @data: &struct iwl_scan_channel_cfg_umac and
773 * &struct iwl_scan_req_umac_tail
774 */
775struct iwl_scan_req_umac {
776 struct iwl_mvm_umac_cmd_hdr hdr;
777 __le32 flags;
778 __le32 uid;
779 __le32 ooc_priority;
780 /* SCAN_GENERAL_PARAMS_API_S_VER_1 */
781 __le32 general_flags;
782 u8 reserved1;
783 u8 active_dwell;
784 u8 passive_dwell;
785 u8 fragmented_dwell;
786 __le32 max_out_time;
787 __le32 suspend_time;
788 __le32 scan_priority;
789 /* SCAN_CHANNEL_PARAMS_API_S_VER_1 */
790 u8 channel_flags;
791 u8 n_channels;
792 __le16 reserved2;
793 u8 data[];
794} __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */
795
796/**
797 * struct iwl_umac_scan_abort
798 * @hdr: umac command header
799 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
800 * @flags: reserved
801 */
802struct iwl_umac_scan_abort {
803 struct iwl_mvm_umac_cmd_hdr hdr;
804 __le32 uid;
805 __le32 flags;
806} __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */
807
808/**
809 * struct iwl_umac_scan_complete
810 * @uid: scan id, &enum iwl_umac_scan_uid_offsets
811 * @last_schedule: last scheduling line
812 * @last_iter: last scan iteration number
813 * @scan status: &enum iwl_scan_offload_complete_status
814 * @ebs_status: &enum iwl_scan_ebs_status
815 * @time_from_last_iter: time elapsed from last iteration
816 * @reserved: for future use
817 */
818struct iwl_umac_scan_complete {
819 __le32 uid;
820 u8 last_schedule;
821 u8 last_iter;
822 u8 status;
823 u8 ebs_status;
824 __le32 time_from_last_iter;
825 __le32 reserved;
826} __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */
827
b04998f3
LC
828#define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN 5
829/**
830 * struct iwl_scan_offload_profile_match - match information
831 * @bssid: matched bssid
832 * @channel: channel where the match occurred
833 * @energy:
834 * @matching_feature:
835 * @matching_channels: bitmap of channels that matched, referencing
836 * the channels passed in tue scan offload request
837 */
838struct iwl_scan_offload_profile_match {
839 u8 bssid[ETH_ALEN];
840 __le16 reserved;
841 u8 channel;
842 u8 energy;
843 u8 matching_feature;
844 u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN];
845} __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_1 */
846
847/**
848 * struct iwl_scan_offload_profiles_query - match results query response
849 * @matched_profiles: bitmap of matched profiles, referencing the
850 * matches passed in the scan offload request
851 * @last_scan_age: age of the last offloaded scan
852 * @n_scans_done: number of offloaded scans done
853 * @gp2_d0u: GP2 when D0U occurred
854 * @gp2_invoked: GP2 when scan offload was invoked
855 * @resume_while_scanning: not used
856 * @self_recovery: obsolete
857 * @reserved: reserved
858 * @matches: array of match information, one for each match
859 */
860struct iwl_scan_offload_profiles_query {
861 __le32 matched_profiles;
862 __le32 last_scan_age;
863 __le32 n_scans_done;
864 __le32 gp2_d0u;
865 __le32 gp2_invoked;
866 u8 resume_while_scanning;
867 u8 self_recovery;
868 __le16 reserved;
869 struct iwl_scan_offload_profile_match matches[IWL_SCAN_MAX_PROFILES];
870} __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */
871
8ca151b5 872#endif
This page took 0.187142 seconds and 5 git commands to generate.