xref: /freebsd/sys/contrib/dev/iwlwifi/fw/api/scan.h (revision 9af1bba44e1ce9b0296ae56760b564d67ab7a1cf)
1bfcc09ddSBjoern A. Zeeb /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2bfcc09ddSBjoern A. Zeeb /*
3*9af1bba4SBjoern A. Zeeb  * Copyright (C) 2012-2014, 2018-2023 Intel Corporation
4bfcc09ddSBjoern A. Zeeb  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5bfcc09ddSBjoern A. Zeeb  * Copyright (C) 2016-2017 Intel Deutschland GmbH
6bfcc09ddSBjoern A. Zeeb  */
7bfcc09ddSBjoern A. Zeeb #ifndef __iwl_fw_api_scan_h__
8bfcc09ddSBjoern A. Zeeb #define __iwl_fw_api_scan_h__
9bfcc09ddSBjoern A. Zeeb 
10bfcc09ddSBjoern A. Zeeb /* Scan Commands, Responses, Notifications */
11bfcc09ddSBjoern A. Zeeb 
12*9af1bba4SBjoern A. Zeeb /**
13*9af1bba4SBjoern A. Zeeb  * enum iwl_scan_subcmd_ids - scan commands
14*9af1bba4SBjoern A. Zeeb  */
15*9af1bba4SBjoern A. Zeeb enum iwl_scan_subcmd_ids {
16*9af1bba4SBjoern A. Zeeb 	/**
17*9af1bba4SBjoern A. Zeeb 	 * @OFFLOAD_MATCH_INFO_NOTIF: &struct iwl_scan_offload_match_info
18*9af1bba4SBjoern A. Zeeb 	 */
19*9af1bba4SBjoern A. Zeeb 	OFFLOAD_MATCH_INFO_NOTIF = 0xFC,
20*9af1bba4SBjoern A. Zeeb };
21*9af1bba4SBjoern A. Zeeb 
22bfcc09ddSBjoern A. Zeeb /* Max number of IEs for direct SSID scans in a command */
23bfcc09ddSBjoern A. Zeeb #define PROBE_OPTION_MAX		20
24bfcc09ddSBjoern A. Zeeb 
25bfcc09ddSBjoern A. Zeeb #define SCAN_SHORT_SSID_MAX_SIZE        8
26bfcc09ddSBjoern A. Zeeb #define SCAN_BSSID_MAX_SIZE             16
27bfcc09ddSBjoern A. Zeeb 
28bfcc09ddSBjoern A. Zeeb /**
29bfcc09ddSBjoern A. Zeeb  * struct iwl_ssid_ie - directed scan network information element
30bfcc09ddSBjoern A. Zeeb  *
31bfcc09ddSBjoern A. Zeeb  * Up to 20 of these may appear in REPLY_SCAN_CMD,
32bfcc09ddSBjoern A. Zeeb  * selected by "type" bit field in struct iwl_scan_channel;
33bfcc09ddSBjoern A. Zeeb  * each channel may select different ssids from among the 20 entries.
34bfcc09ddSBjoern A. Zeeb  * SSID IEs get transmitted in reverse order of entry.
35bfcc09ddSBjoern A. Zeeb  *
36bfcc09ddSBjoern A. Zeeb  * @id: element ID
37bfcc09ddSBjoern A. Zeeb  * @len: element length
38bfcc09ddSBjoern A. Zeeb  * @ssid: element (SSID) data
39bfcc09ddSBjoern A. Zeeb  */
40bfcc09ddSBjoern A. Zeeb struct iwl_ssid_ie {
41bfcc09ddSBjoern A. Zeeb 	u8 id;
42bfcc09ddSBjoern A. Zeeb 	u8 len;
43bfcc09ddSBjoern A. Zeeb 	u8 ssid[IEEE80211_MAX_SSID_LEN];
44bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
45bfcc09ddSBjoern A. Zeeb 
46bfcc09ddSBjoern A. Zeeb /* scan offload */
47bfcc09ddSBjoern A. Zeeb #define IWL_SCAN_MAX_BLACKLIST_LEN	64
48bfcc09ddSBjoern A. Zeeb #define IWL_SCAN_SHORT_BLACKLIST_LEN	16
49bfcc09ddSBjoern A. Zeeb #define IWL_SCAN_MAX_PROFILES		11
50bfcc09ddSBjoern A. Zeeb #define IWL_SCAN_MAX_PROFILES_V2	8
51bfcc09ddSBjoern A. Zeeb #define SCAN_OFFLOAD_PROBE_REQ_SIZE	512
52bfcc09ddSBjoern A. Zeeb #define SCAN_NUM_BAND_PROBE_DATA_V_1	2
53bfcc09ddSBjoern A. Zeeb #define SCAN_NUM_BAND_PROBE_DATA_V_2	3
54bfcc09ddSBjoern A. Zeeb 
55bfcc09ddSBjoern A. Zeeb /* Default watchdog (in MS) for scheduled scan iteration */
56bfcc09ddSBjoern A. Zeeb #define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
57bfcc09ddSBjoern A. Zeeb 
58bfcc09ddSBjoern A. Zeeb #define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
59bfcc09ddSBjoern A. Zeeb #define CAN_ABORT_STATUS 1
60bfcc09ddSBjoern A. Zeeb 
61bfcc09ddSBjoern A. Zeeb #define IWL_FULL_SCAN_MULTIPLIER 5
62bfcc09ddSBjoern A. Zeeb #define IWL_FAST_SCHED_SCAN_ITERATIONS 3
63bfcc09ddSBjoern A. Zeeb #define IWL_MAX_SCHED_SCAN_PLANS 2
64bfcc09ddSBjoern A. Zeeb 
65bfcc09ddSBjoern A. Zeeb enum scan_framework_client {
66bfcc09ddSBjoern A. Zeeb 	SCAN_CLIENT_SCHED_SCAN		= BIT(0),
67bfcc09ddSBjoern A. Zeeb 	SCAN_CLIENT_NETDETECT		= BIT(1),
68bfcc09ddSBjoern A. Zeeb 	SCAN_CLIENT_ASSET_TRACKING	= BIT(2),
69bfcc09ddSBjoern A. Zeeb };
70bfcc09ddSBjoern A. Zeeb 
71bfcc09ddSBjoern A. Zeeb /**
72bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_offload_blocklist - SCAN_OFFLOAD_BLACKLIST_S
73bfcc09ddSBjoern A. Zeeb  * @ssid:		MAC address to filter out
74bfcc09ddSBjoern A. Zeeb  * @reported_rssi:	AP rssi reported to the host
75bfcc09ddSBjoern A. Zeeb  * @client_bitmap: clients ignore this entry  - enum scan_framework_client
76bfcc09ddSBjoern A. Zeeb  */
77bfcc09ddSBjoern A. Zeeb struct iwl_scan_offload_blocklist {
78bfcc09ddSBjoern A. Zeeb 	u8 ssid[ETH_ALEN];
79bfcc09ddSBjoern A. Zeeb 	u8 reported_rssi;
80bfcc09ddSBjoern A. Zeeb 	u8 client_bitmap;
81bfcc09ddSBjoern A. Zeeb } __packed;
82bfcc09ddSBjoern A. Zeeb 
83bfcc09ddSBjoern A. Zeeb enum iwl_scan_offload_network_type {
84bfcc09ddSBjoern A. Zeeb 	IWL_NETWORK_TYPE_BSS	= 1,
85bfcc09ddSBjoern A. Zeeb 	IWL_NETWORK_TYPE_IBSS	= 2,
86bfcc09ddSBjoern A. Zeeb 	IWL_NETWORK_TYPE_ANY	= 3,
87bfcc09ddSBjoern A. Zeeb };
88bfcc09ddSBjoern A. Zeeb 
89bfcc09ddSBjoern A. Zeeb enum iwl_scan_offload_band_selection {
90bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_OFFLOAD_SELECT_2_4	= 0x4,
91bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_OFFLOAD_SELECT_5_2	= 0x8,
92bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_OFFLOAD_SELECT_ANY	= 0xc,
93bfcc09ddSBjoern A. Zeeb };
94bfcc09ddSBjoern A. Zeeb 
95d9836fb4SBjoern A. Zeeb enum iwl_scan_offload_auth_alg {
96d9836fb4SBjoern A. Zeeb 	IWL_AUTH_ALGO_UNSUPPORTED  = 0x00,
97d9836fb4SBjoern A. Zeeb 	IWL_AUTH_ALGO_NONE         = 0x01,
98d9836fb4SBjoern A. Zeeb 	IWL_AUTH_ALGO_PSK          = 0x02,
99d9836fb4SBjoern A. Zeeb 	IWL_AUTH_ALGO_8021X        = 0x04,
100d9836fb4SBjoern A. Zeeb 	IWL_AUTH_ALGO_SAE          = 0x08,
101d9836fb4SBjoern A. Zeeb 	IWL_AUTH_ALGO_8021X_SHA384 = 0x10,
102d9836fb4SBjoern A. Zeeb 	IWL_AUTH_ALGO_OWE          = 0x20,
103d9836fb4SBjoern A. Zeeb };
104d9836fb4SBjoern A. Zeeb 
105bfcc09ddSBjoern A. Zeeb /**
106bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S
107bfcc09ddSBjoern A. Zeeb  * @ssid_index:		index to ssid list in fixed part
108bfcc09ddSBjoern A. Zeeb  * @unicast_cipher:	encryption algorithm to match - bitmap
109bfcc09ddSBjoern A. Zeeb  * @auth_alg:		authentication algorithm to match - bitmap
110bfcc09ddSBjoern A. Zeeb  * @network_type:	enum iwl_scan_offload_network_type
111bfcc09ddSBjoern A. Zeeb  * @band_selection:	enum iwl_scan_offload_band_selection
112bfcc09ddSBjoern A. Zeeb  * @client_bitmap:	clients waiting for match - enum scan_framework_client
113bfcc09ddSBjoern A. Zeeb  * @reserved:		reserved
114bfcc09ddSBjoern A. Zeeb  */
115bfcc09ddSBjoern A. Zeeb struct iwl_scan_offload_profile {
116bfcc09ddSBjoern A. Zeeb 	u8 ssid_index;
117bfcc09ddSBjoern A. Zeeb 	u8 unicast_cipher;
118bfcc09ddSBjoern A. Zeeb 	u8 auth_alg;
119bfcc09ddSBjoern A. Zeeb 	u8 network_type;
120bfcc09ddSBjoern A. Zeeb 	u8 band_selection;
121bfcc09ddSBjoern A. Zeeb 	u8 client_bitmap;
122bfcc09ddSBjoern A. Zeeb 	u8 reserved[2];
123bfcc09ddSBjoern A. Zeeb } __packed;
124bfcc09ddSBjoern A. Zeeb 
125bfcc09ddSBjoern A. Zeeb /**
126bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_offload_profile_cfg_data
127bfcc09ddSBjoern A. Zeeb  * @blocklist_len:	length of blocklist
128bfcc09ddSBjoern A. Zeeb  * @num_profiles:	num of profiles in the list
129bfcc09ddSBjoern A. Zeeb  * @match_notify:	clients waiting for match found notification
130bfcc09ddSBjoern A. Zeeb  * @pass_match:		clients waiting for the results
131bfcc09ddSBjoern A. Zeeb  * @active_clients:	active clients bitmap - enum scan_framework_client
132bfcc09ddSBjoern A. Zeeb  * @any_beacon_notify:	clients waiting for match notification without match
133bfcc09ddSBjoern A. Zeeb  * @reserved:		reserved
134bfcc09ddSBjoern A. Zeeb  */
135bfcc09ddSBjoern A. Zeeb struct iwl_scan_offload_profile_cfg_data {
136bfcc09ddSBjoern A. Zeeb 	u8 blocklist_len;
137bfcc09ddSBjoern A. Zeeb 	u8 num_profiles;
138bfcc09ddSBjoern A. Zeeb 	u8 match_notify;
139bfcc09ddSBjoern A. Zeeb 	u8 pass_match;
140bfcc09ddSBjoern A. Zeeb 	u8 active_clients;
141bfcc09ddSBjoern A. Zeeb 	u8 any_beacon_notify;
142bfcc09ddSBjoern A. Zeeb 	u8 reserved[2];
143bfcc09ddSBjoern A. Zeeb } __packed;
144bfcc09ddSBjoern A. Zeeb 
145bfcc09ddSBjoern A. Zeeb /**
146bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_offload_profile_cfg
147bfcc09ddSBjoern A. Zeeb  * @profiles:	profiles to search for match
148bfcc09ddSBjoern A. Zeeb  * @data:	the rest of the data for profile_cfg
149bfcc09ddSBjoern A. Zeeb  */
150bfcc09ddSBjoern A. Zeeb struct iwl_scan_offload_profile_cfg_v1 {
151bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
152bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_offload_profile_cfg_data data;
153bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1-2*/
154bfcc09ddSBjoern A. Zeeb 
155bfcc09ddSBjoern A. Zeeb /**
156bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_offload_profile_cfg
157bfcc09ddSBjoern A. Zeeb  * @profiles:	profiles to search for match
158bfcc09ddSBjoern A. Zeeb  * @data:	the rest of the data for profile_cfg
159bfcc09ddSBjoern A. Zeeb  */
160bfcc09ddSBjoern A. Zeeb struct iwl_scan_offload_profile_cfg {
161bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES_V2];
162bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_offload_profile_cfg_data data;
163bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_3*/
164bfcc09ddSBjoern A. Zeeb 
165bfcc09ddSBjoern A. Zeeb /**
166bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_schedule_lmac - schedule of scan offload
167bfcc09ddSBjoern A. Zeeb  * @delay:		delay between iterations, in seconds.
168bfcc09ddSBjoern A. Zeeb  * @iterations:		num of scan iterations
169bfcc09ddSBjoern A. Zeeb  * @full_scan_mul:	number of partial scans before each full scan
170bfcc09ddSBjoern A. Zeeb  */
171bfcc09ddSBjoern A. Zeeb struct iwl_scan_schedule_lmac {
172bfcc09ddSBjoern A. Zeeb 	__le16 delay;
173bfcc09ddSBjoern A. Zeeb 	u8 iterations;
174bfcc09ddSBjoern A. Zeeb 	u8 full_scan_mul;
175bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_SCHEDULE_API_S */
176bfcc09ddSBjoern A. Zeeb 
177bfcc09ddSBjoern A. Zeeb enum iwl_scan_offload_complete_status {
178bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_OFFLOAD_COMPLETED	= 1,
179bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_OFFLOAD_ABORTED	= 2,
180bfcc09ddSBjoern A. Zeeb };
181bfcc09ddSBjoern A. Zeeb 
182bfcc09ddSBjoern A. Zeeb enum iwl_scan_ebs_status {
183bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_EBS_SUCCESS,
184bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_EBS_FAILED,
185bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_EBS_CHAN_NOT_FOUND,
186bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_EBS_INACTIVE,
187bfcc09ddSBjoern A. Zeeb };
188bfcc09ddSBjoern A. Zeeb 
189bfcc09ddSBjoern A. Zeeb /**
190bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S
191bfcc09ddSBjoern A. Zeeb  * @tx_flags: combination of TX_CMD_FLG_*
192bfcc09ddSBjoern A. Zeeb  * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
193bfcc09ddSBjoern A. Zeeb  *	cleared. Combination of RATE_MCS_*
194bfcc09ddSBjoern A. Zeeb  * @sta_id: index of destination station in FW station table
195bfcc09ddSBjoern A. Zeeb  * @reserved: for alignment and future use
196bfcc09ddSBjoern A. Zeeb  */
197bfcc09ddSBjoern A. Zeeb struct iwl_scan_req_tx_cmd {
198bfcc09ddSBjoern A. Zeeb 	__le32 tx_flags;
199bfcc09ddSBjoern A. Zeeb 	__le32 rate_n_flags;
200bfcc09ddSBjoern A. Zeeb 	u8 sta_id;
201bfcc09ddSBjoern A. Zeeb 	u8 reserved[3];
202bfcc09ddSBjoern A. Zeeb } __packed;
203bfcc09ddSBjoern A. Zeeb 
204bfcc09ddSBjoern A. Zeeb enum iwl_scan_channel_flags_lmac {
205bfcc09ddSBjoern A. Zeeb 	IWL_UNIFIED_SCAN_CHANNEL_FULL		= BIT(27),
206bfcc09ddSBjoern A. Zeeb 	IWL_UNIFIED_SCAN_CHANNEL_PARTIAL	= BIT(28),
207bfcc09ddSBjoern A. Zeeb };
208bfcc09ddSBjoern A. Zeeb 
209bfcc09ddSBjoern A. Zeeb /**
210bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2
211bfcc09ddSBjoern A. Zeeb  * @flags:		bits 1-20: directed scan to i'th ssid
212bfcc09ddSBjoern A. Zeeb  *			other bits &enum iwl_scan_channel_flags_lmac
213bfcc09ddSBjoern A. Zeeb  * @channel_num:	channel number 1-13 etc
214bfcc09ddSBjoern A. Zeeb  * @iter_count:		scan iteration on this channel
215bfcc09ddSBjoern A. Zeeb  * @iter_interval:	interval in seconds between iterations on one channel
216bfcc09ddSBjoern A. Zeeb  */
217bfcc09ddSBjoern A. Zeeb struct iwl_scan_channel_cfg_lmac {
218bfcc09ddSBjoern A. Zeeb 	__le32 flags;
219bfcc09ddSBjoern A. Zeeb 	__le16 channel_num;
220bfcc09ddSBjoern A. Zeeb 	__le16 iter_count;
221bfcc09ddSBjoern A. Zeeb 	__le32 iter_interval;
222bfcc09ddSBjoern A. Zeeb } __packed;
223bfcc09ddSBjoern A. Zeeb 
224d9836fb4SBjoern A. Zeeb /**
225bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_probe_segment - PROBE_SEGMENT_API_S_VER_1
226bfcc09ddSBjoern A. Zeeb  * @offset: offset in the data block
227bfcc09ddSBjoern A. Zeeb  * @len: length of the segment
228bfcc09ddSBjoern A. Zeeb  */
229bfcc09ddSBjoern A. Zeeb struct iwl_scan_probe_segment {
230bfcc09ddSBjoern A. Zeeb 	__le16 offset;
231bfcc09ddSBjoern A. Zeeb 	__le16 len;
232bfcc09ddSBjoern A. Zeeb } __packed;
233bfcc09ddSBjoern A. Zeeb 
234d9836fb4SBjoern A. Zeeb /**
235d9836fb4SBjoern A. Zeeb  * struct iwl_scan_probe_req_v1 - PROBE_REQUEST_FRAME_API_S_VER_2
236bfcc09ddSBjoern A. Zeeb  * @mac_header: first (and common) part of the probe
237bfcc09ddSBjoern A. Zeeb  * @band_data: band specific data
238bfcc09ddSBjoern A. Zeeb  * @common_data: last (and common) part of the probe
239bfcc09ddSBjoern A. Zeeb  * @buf: raw data block
240bfcc09ddSBjoern A. Zeeb  */
241bfcc09ddSBjoern A. Zeeb struct iwl_scan_probe_req_v1 {
242bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_probe_segment mac_header;
243bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_probe_segment band_data[SCAN_NUM_BAND_PROBE_DATA_V_1];
244bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_probe_segment common_data;
245bfcc09ddSBjoern A. Zeeb 	u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
246bfcc09ddSBjoern A. Zeeb } __packed;
247bfcc09ddSBjoern A. Zeeb 
248d9836fb4SBjoern A. Zeeb /**
249d9836fb4SBjoern A. Zeeb  * struct iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_v2
250bfcc09ddSBjoern A. Zeeb  * @mac_header: first (and common) part of the probe
251bfcc09ddSBjoern A. Zeeb  * @band_data: band specific data
252bfcc09ddSBjoern A. Zeeb  * @common_data: last (and common) part of the probe
253bfcc09ddSBjoern A. Zeeb  * @buf: raw data block
254bfcc09ddSBjoern A. Zeeb  */
255bfcc09ddSBjoern A. Zeeb struct iwl_scan_probe_req {
256bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_probe_segment mac_header;
257bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_probe_segment band_data[SCAN_NUM_BAND_PROBE_DATA_V_2];
258bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_probe_segment common_data;
259bfcc09ddSBjoern A. Zeeb 	u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
260bfcc09ddSBjoern A. Zeeb } __packed;
261bfcc09ddSBjoern A. Zeeb 
262bfcc09ddSBjoern A. Zeeb enum iwl_scan_channel_flags {
263bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_CHANNEL_FLAG_EBS		= BIT(0),
264bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE	= BIT(1),
265bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_CHANNEL_FLAG_CACHE_ADD		= BIT(2),
266bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_CHANNEL_FLAG_EBS_FRAG		= BIT(3),
267bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_CHANNEL_FLAG_FORCE_EBS         = BIT(4),
268bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_CHANNEL_FLAG_ENABLE_CHAN_ORDER = BIT(5),
269bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_CHANNEL_FLAG_6G_PSC_NO_FILTER  = BIT(6),
270bfcc09ddSBjoern A. Zeeb };
271bfcc09ddSBjoern A. Zeeb 
272d9836fb4SBjoern A. Zeeb /**
273d9836fb4SBjoern A. Zeeb  * struct iwl_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S
274bfcc09ddSBjoern A. Zeeb  * @flags: enum iwl_scan_channel_flags
275bfcc09ddSBjoern A. Zeeb  * @non_ebs_ratio: defines the ratio of number of scan iterations where EBS is
276bfcc09ddSBjoern A. Zeeb  *	involved.
277bfcc09ddSBjoern A. Zeeb  *	1 - EBS is disabled.
278bfcc09ddSBjoern A. Zeeb  *	2 - every second scan will be full scan(and so on).
279bfcc09ddSBjoern A. Zeeb  */
280bfcc09ddSBjoern A. Zeeb struct iwl_scan_channel_opt {
281bfcc09ddSBjoern A. Zeeb 	__le16 flags;
282bfcc09ddSBjoern A. Zeeb 	__le16 non_ebs_ratio;
283bfcc09ddSBjoern A. Zeeb } __packed;
284bfcc09ddSBjoern A. Zeeb 
285bfcc09ddSBjoern A. Zeeb /**
286bfcc09ddSBjoern A. Zeeb  * enum iwl_mvm_lmac_scan_flags - LMAC scan flags
287bfcc09ddSBjoern A. Zeeb  * @IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses
288bfcc09ddSBjoern A. Zeeb  *	without filtering.
289bfcc09ddSBjoern A. Zeeb  * @IWL_MVM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels
290bfcc09ddSBjoern A. Zeeb  * @IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan
291bfcc09ddSBjoern A. Zeeb  * @IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification
292bfcc09ddSBjoern A. Zeeb  * @IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS: multiple SSID matching
293bfcc09ddSBjoern A. Zeeb  * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented
294bfcc09ddSBjoern A. Zeeb  * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report
295bfcc09ddSBjoern A. Zeeb  *	and DS parameter set IEs into probe requests.
296bfcc09ddSBjoern A. Zeeb  * @IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL: use extended dwell time on channels
297bfcc09ddSBjoern A. Zeeb  *	1, 6 and 11.
298bfcc09ddSBjoern A. Zeeb  * @IWL_MVM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches
299bfcc09ddSBjoern A. Zeeb  */
300bfcc09ddSBjoern A. Zeeb enum iwl_mvm_lmac_scan_flags {
301bfcc09ddSBjoern A. Zeeb 	IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL		= BIT(0),
302bfcc09ddSBjoern A. Zeeb 	IWL_MVM_LMAC_SCAN_FLAG_PASSIVE		= BIT(1),
303bfcc09ddSBjoern A. Zeeb 	IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION	= BIT(2),
304bfcc09ddSBjoern A. Zeeb 	IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE	= BIT(3),
305bfcc09ddSBjoern A. Zeeb 	IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS	= BIT(4),
306bfcc09ddSBjoern A. Zeeb 	IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED	= BIT(5),
307bfcc09ddSBjoern A. Zeeb 	IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED	= BIT(6),
308bfcc09ddSBjoern A. Zeeb 	IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL	= BIT(7),
309bfcc09ddSBjoern A. Zeeb 	IWL_MVM_LMAC_SCAN_FLAG_MATCH		= BIT(9),
310bfcc09ddSBjoern A. Zeeb };
311bfcc09ddSBjoern A. Zeeb 
312bfcc09ddSBjoern A. Zeeb enum iwl_scan_priority {
313bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_PRIORITY_LOW,
314bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_PRIORITY_MEDIUM,
315bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_PRIORITY_HIGH,
316bfcc09ddSBjoern A. Zeeb };
317bfcc09ddSBjoern A. Zeeb 
318bfcc09ddSBjoern A. Zeeb enum iwl_scan_priority_ext {
319bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_PRIORITY_EXT_0_LOWEST,
320bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_PRIORITY_EXT_1,
321bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_PRIORITY_EXT_2,
322bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_PRIORITY_EXT_3,
323bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_PRIORITY_EXT_4,
324bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_PRIORITY_EXT_5,
325bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_PRIORITY_EXT_6,
326bfcc09ddSBjoern A. Zeeb 	IWL_SCAN_PRIORITY_EXT_7_HIGHEST,
327bfcc09ddSBjoern A. Zeeb };
328bfcc09ddSBjoern A. Zeeb 
329bfcc09ddSBjoern A. Zeeb /**
330bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_req_lmac - SCAN_REQUEST_CMD_API_S_VER_1
331bfcc09ddSBjoern A. Zeeb  * @reserved1: for alignment and future use
332bfcc09ddSBjoern A. Zeeb  * @n_channels: num of channels to scan
333bfcc09ddSBjoern A. Zeeb  * @active_dwell: dwell time for active channels
334bfcc09ddSBjoern A. Zeeb  * @passive_dwell: dwell time for passive channels
335bfcc09ddSBjoern A. Zeeb  * @fragmented_dwell: dwell time for fragmented passive scan
336bfcc09ddSBjoern A. Zeeb  * @extended_dwell: dwell time for channels 1, 6 and 11 (in certain cases)
337bfcc09ddSBjoern A. Zeeb  * @reserved2: for alignment and future use
338bfcc09ddSBjoern A. Zeeb  * @rx_chain_select: PHY_RX_CHAIN_* flags
339bfcc09ddSBjoern A. Zeeb  * @scan_flags: &enum iwl_mvm_lmac_scan_flags
340bfcc09ddSBjoern A. Zeeb  * @max_out_time: max time (in TU) to be out of associated channel
341bfcc09ddSBjoern A. Zeeb  * @suspend_time: pause scan this long (TUs) when returning to service channel
342bfcc09ddSBjoern A. Zeeb  * @flags: RXON flags
343bfcc09ddSBjoern A. Zeeb  * @filter_flags: RXON filter
344bfcc09ddSBjoern A. Zeeb  * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz
345bfcc09ddSBjoern A. Zeeb  * @direct_scan: list of SSIDs for directed active scan
346bfcc09ddSBjoern A. Zeeb  * @scan_prio: enum iwl_scan_priority
347bfcc09ddSBjoern A. Zeeb  * @iter_num: number of scan iterations
348bfcc09ddSBjoern A. Zeeb  * @delay: delay in seconds before first iteration
349bfcc09ddSBjoern A. Zeeb  * @schedule: two scheduling plans. The first one is finite, the second one can
350bfcc09ddSBjoern A. Zeeb  *	be infinite.
351bfcc09ddSBjoern A. Zeeb  * @channel_opt: channel optimization options, for full and partial scan
352bfcc09ddSBjoern A. Zeeb  * @data: channel configuration and probe request packet.
353bfcc09ddSBjoern A. Zeeb  */
354bfcc09ddSBjoern A. Zeeb struct iwl_scan_req_lmac {
355bfcc09ddSBjoern A. Zeeb 	/* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */
356bfcc09ddSBjoern A. Zeeb 	__le32 reserved1;
357bfcc09ddSBjoern A. Zeeb 	u8 n_channels;
358bfcc09ddSBjoern A. Zeeb 	u8 active_dwell;
359bfcc09ddSBjoern A. Zeeb 	u8 passive_dwell;
360bfcc09ddSBjoern A. Zeeb 	u8 fragmented_dwell;
361bfcc09ddSBjoern A. Zeeb 	u8 extended_dwell;
362bfcc09ddSBjoern A. Zeeb 	u8 reserved2;
363bfcc09ddSBjoern A. Zeeb 	__le16 rx_chain_select;
364bfcc09ddSBjoern A. Zeeb 	__le32 scan_flags;
365bfcc09ddSBjoern A. Zeeb 	__le32 max_out_time;
366bfcc09ddSBjoern A. Zeeb 	__le32 suspend_time;
367bfcc09ddSBjoern A. Zeeb 	/* RX_ON_FLAGS_API_S_VER_1 */
368bfcc09ddSBjoern A. Zeeb 	__le32 flags;
369bfcc09ddSBjoern A. Zeeb 	__le32 filter_flags;
370bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_req_tx_cmd tx_cmd[2];
371bfcc09ddSBjoern A. Zeeb 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
372bfcc09ddSBjoern A. Zeeb 	__le32 scan_prio;
373bfcc09ddSBjoern A. Zeeb 	/* SCAN_REQ_PERIODIC_PARAMS_API_S */
374bfcc09ddSBjoern A. Zeeb 	__le32 iter_num;
375bfcc09ddSBjoern A. Zeeb 	__le32 delay;
376bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_schedule_lmac schedule[IWL_MAX_SCHED_SCAN_PLANS];
377bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_channel_opt channel_opt[2];
378bfcc09ddSBjoern A. Zeeb 	u8 data[];
379bfcc09ddSBjoern A. Zeeb } __packed;
380bfcc09ddSBjoern A. Zeeb 
381bfcc09ddSBjoern A. Zeeb /**
382bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_results_notif - scan results for one channel -
383bfcc09ddSBjoern A. Zeeb  *	SCAN_RESULT_NTF_API_S_VER_3
384bfcc09ddSBjoern A. Zeeb  * @channel: which channel the results are from
385bfcc09ddSBjoern A. Zeeb  * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
386bfcc09ddSBjoern A. Zeeb  * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
387bfcc09ddSBjoern A. Zeeb  * @num_probe_not_sent: # of request that weren't sent due to not enough time
388bfcc09ddSBjoern A. Zeeb  * @duration: duration spent in channel, in usecs
389bfcc09ddSBjoern A. Zeeb  */
390bfcc09ddSBjoern A. Zeeb struct iwl_scan_results_notif {
391bfcc09ddSBjoern A. Zeeb 	u8 channel;
392bfcc09ddSBjoern A. Zeeb 	u8 band;
393bfcc09ddSBjoern A. Zeeb 	u8 probe_status;
394bfcc09ddSBjoern A. Zeeb 	u8 num_probe_not_sent;
395bfcc09ddSBjoern A. Zeeb 	__le32 duration;
396bfcc09ddSBjoern A. Zeeb } __packed;
397bfcc09ddSBjoern A. Zeeb 
398bfcc09ddSBjoern A. Zeeb /**
399bfcc09ddSBjoern A. Zeeb  * struct iwl_lmac_scan_complete_notif - notifies end of scanning (all channels)
400bfcc09ddSBjoern A. Zeeb  *	SCAN_COMPLETE_NTF_API_S_VER_3
401bfcc09ddSBjoern A. Zeeb  * @scanned_channels: number of channels scanned (and number of valid results)
402bfcc09ddSBjoern A. Zeeb  * @status: one of SCAN_COMP_STATUS_*
403bfcc09ddSBjoern A. Zeeb  * @bt_status: BT on/off status
404bfcc09ddSBjoern A. Zeeb  * @last_channel: last channel that was scanned
405bfcc09ddSBjoern A. Zeeb  * @tsf_low: TSF timer (lower half) in usecs
406bfcc09ddSBjoern A. Zeeb  * @tsf_high: TSF timer (higher half) in usecs
407bfcc09ddSBjoern A. Zeeb  * @results: an array of scan results, only "scanned_channels" of them are valid
408bfcc09ddSBjoern A. Zeeb  */
409bfcc09ddSBjoern A. Zeeb struct iwl_lmac_scan_complete_notif {
410bfcc09ddSBjoern A. Zeeb 	u8 scanned_channels;
411bfcc09ddSBjoern A. Zeeb 	u8 status;
412bfcc09ddSBjoern A. Zeeb 	u8 bt_status;
413bfcc09ddSBjoern A. Zeeb 	u8 last_channel;
414bfcc09ddSBjoern A. Zeeb 	__le32 tsf_low;
415bfcc09ddSBjoern A. Zeeb 	__le32 tsf_high;
416bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_results_notif results[];
417bfcc09ddSBjoern A. Zeeb } __packed;
418bfcc09ddSBjoern A. Zeeb 
419bfcc09ddSBjoern A. Zeeb /**
420bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_offload_complete - PERIODIC_SCAN_COMPLETE_NTF_API_S_VER_2
421bfcc09ddSBjoern A. Zeeb  * @last_schedule_line: last schedule line executed (fast or regular)
422bfcc09ddSBjoern A. Zeeb  * @last_schedule_iteration: last scan iteration executed before scan abort
423bfcc09ddSBjoern A. Zeeb  * @status: &enum iwl_scan_offload_complete_status
424bfcc09ddSBjoern A. Zeeb  * @ebs_status: EBS success status &enum iwl_scan_ebs_status
425bfcc09ddSBjoern A. Zeeb  * @time_after_last_iter: time in seconds elapsed after last iteration
426bfcc09ddSBjoern A. Zeeb  * @reserved: reserved
427bfcc09ddSBjoern A. Zeeb  */
428bfcc09ddSBjoern A. Zeeb struct iwl_periodic_scan_complete {
429bfcc09ddSBjoern A. Zeeb 	u8 last_schedule_line;
430bfcc09ddSBjoern A. Zeeb 	u8 last_schedule_iteration;
431bfcc09ddSBjoern A. Zeeb 	u8 status;
432bfcc09ddSBjoern A. Zeeb 	u8 ebs_status;
433bfcc09ddSBjoern A. Zeeb 	__le32 time_after_last_iter;
434bfcc09ddSBjoern A. Zeeb 	__le32 reserved;
435bfcc09ddSBjoern A. Zeeb } __packed;
436bfcc09ddSBjoern A. Zeeb 
437bfcc09ddSBjoern A. Zeeb /* UMAC Scan API */
438bfcc09ddSBjoern A. Zeeb 
439bfcc09ddSBjoern A. Zeeb /* The maximum of either of these cannot exceed 8, because we use an
440bfcc09ddSBjoern A. Zeeb  * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h).
441bfcc09ddSBjoern A. Zeeb  */
442bfcc09ddSBjoern A. Zeeb #define IWL_MVM_MAX_UMAC_SCANS 4
443bfcc09ddSBjoern A. Zeeb #define IWL_MVM_MAX_LMAC_SCANS 1
444bfcc09ddSBjoern A. Zeeb 
445bfcc09ddSBjoern A. Zeeb enum scan_config_flags {
446bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_ACTIVATE			= BIT(0),
447bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_DEACTIVATE			= BIT(1),
448bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_FORBID_CHUB_REQS		= BIT(2),
449bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS		= BIT(3),
450bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_SET_TX_CHAINS			= BIT(8),
451bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_SET_RX_CHAINS			= BIT(9),
452bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_SET_AUX_STA_ID			= BIT(10),
453bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_SET_ALL_TIMES			= BIT(11),
454bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_SET_EFFECTIVE_TIMES		= BIT(12),
455bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_SET_CHANNEL_FLAGS		= BIT(13),
456bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_SET_LEGACY_RATES		= BIT(14),
457bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_SET_MAC_ADDR			= BIT(15),
458bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_SET_FRAGMENTED			= BIT(16),
459bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_CLEAR_FRAGMENTED		= BIT(17),
460bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_SET_CAM_MODE			= BIT(18),
461bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_CLEAR_CAM_MODE			= BIT(19),
462bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_SET_PROMISC_MODE		= BIT(20),
463bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_CLEAR_PROMISC_MODE		= BIT(21),
464bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_SET_LMAC2_FRAGMENTED		= BIT(22),
465bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_FLAG_CLEAR_LMAC2_FRAGMENTED		= BIT(23),
466bfcc09ddSBjoern A. Zeeb 
467bfcc09ddSBjoern A. Zeeb 	/* Bits 26-31 are for num of channels in channel_array */
468bfcc09ddSBjoern A. Zeeb #define SCAN_CONFIG_N_CHANNELS(n) ((n) << 26)
469bfcc09ddSBjoern A. Zeeb };
470bfcc09ddSBjoern A. Zeeb 
471bfcc09ddSBjoern A. Zeeb enum scan_config_rates {
472bfcc09ddSBjoern A. Zeeb 	/* OFDM basic rates */
473bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_RATE_6M	= BIT(0),
474bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_RATE_9M	= BIT(1),
475bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_RATE_12M	= BIT(2),
476bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_RATE_18M	= BIT(3),
477bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_RATE_24M	= BIT(4),
478bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_RATE_36M	= BIT(5),
479bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_RATE_48M	= BIT(6),
480bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_RATE_54M	= BIT(7),
481bfcc09ddSBjoern A. Zeeb 	/* CCK basic rates */
482bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_RATE_1M	= BIT(8),
483bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_RATE_2M	= BIT(9),
484bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_RATE_5M	= BIT(10),
485bfcc09ddSBjoern A. Zeeb 	SCAN_CONFIG_RATE_11M	= BIT(11),
486bfcc09ddSBjoern A. Zeeb 
487bfcc09ddSBjoern A. Zeeb 	/* Bits 16-27 are for supported rates */
488bfcc09ddSBjoern A. Zeeb #define SCAN_CONFIG_SUPPORTED_RATE(rate)	((rate) << 16)
489bfcc09ddSBjoern A. Zeeb };
490bfcc09ddSBjoern A. Zeeb 
491bfcc09ddSBjoern A. Zeeb enum iwl_channel_flags {
492bfcc09ddSBjoern A. Zeeb 	IWL_CHANNEL_FLAG_EBS				= BIT(0),
493bfcc09ddSBjoern A. Zeeb 	IWL_CHANNEL_FLAG_ACCURATE_EBS			= BIT(1),
494bfcc09ddSBjoern A. Zeeb 	IWL_CHANNEL_FLAG_EBS_ADD			= BIT(2),
495bfcc09ddSBjoern A. Zeeb 	IWL_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE	= BIT(3),
496bfcc09ddSBjoern A. Zeeb };
497bfcc09ddSBjoern A. Zeeb 
498bfcc09ddSBjoern A. Zeeb enum iwl_uhb_chan_cfg_flags {
499bfcc09ddSBjoern A. Zeeb 	IWL_UHB_CHAN_CFG_FLAG_UNSOLICITED_PROBE_RES = BIT(24),
500bfcc09ddSBjoern A. Zeeb 	IWL_UHB_CHAN_CFG_FLAG_PSC_CHAN_NO_LISTEN    = BIT(25),
501bfcc09ddSBjoern A. Zeeb 	IWL_UHB_CHAN_CFG_FLAG_FORCE_PASSIVE         = BIT(26),
502bfcc09ddSBjoern A. Zeeb };
503bfcc09ddSBjoern A. Zeeb /**
504bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_dwell
505bfcc09ddSBjoern A. Zeeb  * @active:		default dwell time for active scan
506bfcc09ddSBjoern A. Zeeb  * @passive:		default dwell time for passive scan
507bfcc09ddSBjoern A. Zeeb  * @fragmented:		default dwell time for fragmented scan
508bfcc09ddSBjoern A. Zeeb  * @extended:		default dwell time for channels 1, 6 and 11
509bfcc09ddSBjoern A. Zeeb  */
510bfcc09ddSBjoern A. Zeeb struct iwl_scan_dwell {
511bfcc09ddSBjoern A. Zeeb 	u8 active;
512bfcc09ddSBjoern A. Zeeb 	u8 passive;
513bfcc09ddSBjoern A. Zeeb 	u8 fragmented;
514bfcc09ddSBjoern A. Zeeb 	u8 extended;
515bfcc09ddSBjoern A. Zeeb } __packed;
516bfcc09ddSBjoern A. Zeeb 
517bfcc09ddSBjoern A. Zeeb /**
518d9836fb4SBjoern A. Zeeb  * struct iwl_scan_config_v1 - scan configuration command
519bfcc09ddSBjoern A. Zeeb  * @flags:			enum scan_config_flags
520bfcc09ddSBjoern A. Zeeb  * @tx_chains:			valid_tx antenna - ANT_* definitions
521bfcc09ddSBjoern A. Zeeb  * @rx_chains:			valid_rx antenna - ANT_* definitions
522bfcc09ddSBjoern A. Zeeb  * @legacy_rates:		default legacy rates - enum scan_config_rates
523bfcc09ddSBjoern A. Zeeb  * @out_of_channel_time:	default max out of serving channel time
524bfcc09ddSBjoern A. Zeeb  * @suspend_time:		default max suspend time
525bfcc09ddSBjoern A. Zeeb  * @dwell:			dwells for the scan
526bfcc09ddSBjoern A. Zeeb  * @mac_addr:			default mac address to be used in probes
527bfcc09ddSBjoern A. Zeeb  * @bcast_sta_id:		the index of the station in the fw
528bfcc09ddSBjoern A. Zeeb  * @channel_flags:		default channel flags - enum iwl_channel_flags
529bfcc09ddSBjoern A. Zeeb  *				scan_config_channel_flag
530bfcc09ddSBjoern A. Zeeb  * @channel_array:		default supported channels
531bfcc09ddSBjoern A. Zeeb  */
532bfcc09ddSBjoern A. Zeeb struct iwl_scan_config_v1 {
533bfcc09ddSBjoern A. Zeeb 	__le32 flags;
534bfcc09ddSBjoern A. Zeeb 	__le32 tx_chains;
535bfcc09ddSBjoern A. Zeeb 	__le32 rx_chains;
536bfcc09ddSBjoern A. Zeeb 	__le32 legacy_rates;
537bfcc09ddSBjoern A. Zeeb 	__le32 out_of_channel_time;
538bfcc09ddSBjoern A. Zeeb 	__le32 suspend_time;
539bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_dwell dwell;
540bfcc09ddSBjoern A. Zeeb 	u8 mac_addr[ETH_ALEN];
541bfcc09ddSBjoern A. Zeeb 	u8 bcast_sta_id;
542bfcc09ddSBjoern A. Zeeb 	u8 channel_flags;
543bfcc09ddSBjoern A. Zeeb 	u8 channel_array[];
544bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_CONFIG_DB_CMD_API_S */
545bfcc09ddSBjoern A. Zeeb 
546bfcc09ddSBjoern A. Zeeb #define SCAN_TWO_LMACS 2
547bfcc09ddSBjoern A. Zeeb #define SCAN_LB_LMAC_IDX 0
548bfcc09ddSBjoern A. Zeeb #define SCAN_HB_LMAC_IDX 1
549bfcc09ddSBjoern A. Zeeb 
550d9836fb4SBjoern A. Zeeb /**
551d9836fb4SBjoern A. Zeeb  * struct iwl_scan_config_v2 - scan configuration command
552d9836fb4SBjoern A. Zeeb  * @flags:			enum scan_config_flags
553d9836fb4SBjoern A. Zeeb  * @tx_chains:			valid_tx antenna - ANT_* definitions
554d9836fb4SBjoern A. Zeeb  * @rx_chains:			valid_rx antenna - ANT_* definitions
555d9836fb4SBjoern A. Zeeb  * @legacy_rates:		default legacy rates - enum scan_config_rates
556d9836fb4SBjoern A. Zeeb  * @out_of_channel_time:	default max out of serving channel time
557d9836fb4SBjoern A. Zeeb  * @suspend_time:		default max suspend time
558d9836fb4SBjoern A. Zeeb  * @dwell:			dwells for the scan
559d9836fb4SBjoern A. Zeeb  * @mac_addr:			default mac address to be used in probes
560d9836fb4SBjoern A. Zeeb  * @bcast_sta_id:		the index of the station in the fw
561d9836fb4SBjoern A. Zeeb  * @channel_flags:		default channel flags - enum iwl_channel_flags
562d9836fb4SBjoern A. Zeeb  *				scan_config_channel_flag
563d9836fb4SBjoern A. Zeeb  * @channel_array:		default supported channels
564d9836fb4SBjoern A. Zeeb  */
565bfcc09ddSBjoern A. Zeeb struct iwl_scan_config_v2 {
566bfcc09ddSBjoern A. Zeeb 	__le32 flags;
567bfcc09ddSBjoern A. Zeeb 	__le32 tx_chains;
568bfcc09ddSBjoern A. Zeeb 	__le32 rx_chains;
569bfcc09ddSBjoern A. Zeeb 	__le32 legacy_rates;
570bfcc09ddSBjoern A. Zeeb 	__le32 out_of_channel_time[SCAN_TWO_LMACS];
571bfcc09ddSBjoern A. Zeeb 	__le32 suspend_time[SCAN_TWO_LMACS];
572bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_dwell dwell;
573bfcc09ddSBjoern A. Zeeb 	u8 mac_addr[ETH_ALEN];
574bfcc09ddSBjoern A. Zeeb 	u8 bcast_sta_id;
575bfcc09ddSBjoern A. Zeeb 	u8 channel_flags;
576bfcc09ddSBjoern A. Zeeb 	u8 channel_array[];
577bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_CONFIG_DB_CMD_API_S_2 */
578bfcc09ddSBjoern A. Zeeb 
579bfcc09ddSBjoern A. Zeeb /**
580d9836fb4SBjoern A. Zeeb  * struct iwl_scan_config - scan configuration command
581bfcc09ddSBjoern A. Zeeb  * @enable_cam_mode: whether to enable CAM mode.
582bfcc09ddSBjoern A. Zeeb  * @enable_promiscouos_mode: whether to enable promiscouos mode
583bfcc09ddSBjoern A. Zeeb  * @bcast_sta_id: the index of the station in the fw. Deprecated starting with
584bfcc09ddSBjoern A. Zeeb  *     API version 5.
585bfcc09ddSBjoern A. Zeeb  * @reserved: reserved
586bfcc09ddSBjoern A. Zeeb  * @tx_chains: valid_tx antenna - ANT_* definitions
587bfcc09ddSBjoern A. Zeeb  * @rx_chains: valid_rx antenna - ANT_* definitions
588bfcc09ddSBjoern A. Zeeb  */
589bfcc09ddSBjoern A. Zeeb struct iwl_scan_config {
590bfcc09ddSBjoern A. Zeeb 	u8 enable_cam_mode;
591bfcc09ddSBjoern A. Zeeb 	u8 enable_promiscouos_mode;
592bfcc09ddSBjoern A. Zeeb 	u8 bcast_sta_id;
593bfcc09ddSBjoern A. Zeeb 	u8 reserved;
594bfcc09ddSBjoern A. Zeeb 	__le32 tx_chains;
595bfcc09ddSBjoern A. Zeeb 	__le32 rx_chains;
596bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_CONFIG_DB_CMD_API_S_5 */
597bfcc09ddSBjoern A. Zeeb 
598bfcc09ddSBjoern A. Zeeb /**
599bfcc09ddSBjoern A. Zeeb  * enum iwl_umac_scan_flags - UMAC scan flags
600bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request
601bfcc09ddSBjoern A. Zeeb  *	can be preempted by other scan requests with higher priority.
602bfcc09ddSBjoern A. Zeeb  *	The low priority scan will be resumed when the higher proirity scan is
603bfcc09ddSBjoern A. Zeeb  *	completed.
604bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver
605bfcc09ddSBjoern A. Zeeb  *	when scan starts.
606bfcc09ddSBjoern A. Zeeb  */
607bfcc09ddSBjoern A. Zeeb enum iwl_umac_scan_flags {
608bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_FLAG_PREEMPTIVE		= BIT(0),
609bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_FLAG_START_NOTIF		= BIT(1),
610bfcc09ddSBjoern A. Zeeb };
611bfcc09ddSBjoern A. Zeeb 
612bfcc09ddSBjoern A. Zeeb enum iwl_umac_scan_uid_offsets {
613bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_UID_TYPE_OFFSET		= 0,
614bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_UID_SEQ_OFFSET		= 8,
615bfcc09ddSBjoern A. Zeeb };
616bfcc09ddSBjoern A. Zeeb 
617bfcc09ddSBjoern A. Zeeb enum iwl_umac_scan_general_flags {
618bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC		= BIT(0),
619bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_OVER_BT			= BIT(1),
620bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL		= BIT(2),
621bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE			= BIT(3),
622bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT		= BIT(4),
623bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE		= BIT(5),
624bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID		= BIT(6),
625bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED		= BIT(7),
626bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED		= BIT(8),
627bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_MATCH			= BIT(9),
628bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL		= BIT(10),
629bfcc09ddSBjoern A. Zeeb 	/* Extended dwell is obselete when adaptive dwell is used, making this
630bfcc09ddSBjoern A. Zeeb 	 * bit reusable. Hence, probe request defer is used only when adaptive
631bfcc09ddSBjoern A. Zeeb 	 * dwell is supported. */
632bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_PROB_REQ_DEFER_SUPP	= BIT(10),
633bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_LMAC2_FRAGMENTED	= BIT(11),
634bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_ADAPTIVE_DWELL		= BIT(13),
635bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_MAX_CHNL_TIME		= BIT(14),
636bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_PROB_REQ_HIGH_TX_RATE	= BIT(15),
637bfcc09ddSBjoern A. Zeeb };
638bfcc09ddSBjoern A. Zeeb 
639bfcc09ddSBjoern A. Zeeb /**
640bfcc09ddSBjoern A. Zeeb  * enum iwl_umac_scan_general_flags2 - UMAC scan general flags #2
641bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL: Whether to send a complete
642bfcc09ddSBjoern A. Zeeb  *	notification per channel or not.
643bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER: Whether to allow channel
644bfcc09ddSBjoern A. Zeeb  *	reorder optimization or not.
645bfcc09ddSBjoern A. Zeeb  */
646bfcc09ddSBjoern A. Zeeb enum iwl_umac_scan_general_flags2 {
647bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL		= BIT(0),
648bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER	= BIT(1),
649bfcc09ddSBjoern A. Zeeb };
650bfcc09ddSBjoern A. Zeeb 
651bfcc09ddSBjoern A. Zeeb /**
652bfcc09ddSBjoern A. Zeeb  * enum iwl_umac_scan_general_flags_v2 - UMAC scan general flags version 2
653bfcc09ddSBjoern A. Zeeb  *
654bfcc09ddSBjoern A. Zeeb  * The FW flags were reordered and hence the driver introduce version 2
655bfcc09ddSBjoern A. Zeeb  *
656bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_PERIODIC: periodic or scheduled
657bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_PASS_ALL: pass all probe responses and beacons
658bfcc09ddSBjoern A. Zeeb  *                                       during scan iterations
659bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_NTFY_ITER_COMPLETE: send complete notification
660bfcc09ddSBjoern A. Zeeb  *      on every iteration instead of only once after the last iteration
661bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC1: fragmented scan LMAC1
662bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC2: fragmented scan LMAC2
663bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_MATCH: does this scan check for profile matching
664bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_USE_ALL_RX_CHAINS: use all valid chains for RX
665bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_ADAPTIVE_DWELL: works with adaptive dwell
666bfcc09ddSBjoern A. Zeeb  *                                             for active channel
667bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_PREEMPTIVE: can be preempted by other requests
668bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_NTF_START: send notification of scan start
669bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_MULTI_SSID: matching on multiple SSIDs
670bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE: all the channels scanned
671bfcc09ddSBjoern A. Zeeb  *                                           as passive
672bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_TRIGGER_UHB_SCAN: at the end of 2.4GHz and
673bfcc09ddSBjoern A. Zeeb  *		5.2Ghz bands scan, trigger scan on 6GHz band to discover
674bfcc09ddSBjoern A. Zeeb  *		the reported collocated APs
675bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN: at the end of 2.4GHz and 5GHz
676bfcc09ddSBjoern A. Zeeb  *      bands scan, if not APs were discovered, allow scan to conitnue and scan
677bfcc09ddSBjoern A. Zeeb  *      6GHz PSC channels in order to discover country information.
678bfcc09ddSBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN_FILTER_IN: in case
679bfcc09ddSBjoern A. Zeeb  *      &IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN is enabled and scan is
680bfcc09ddSBjoern A. Zeeb  *      activated over 6GHz PSC channels, filter in beacons and probe responses.
681d9836fb4SBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_FLAGS_V2_OCE: if set, send probe requests in a minimum
682d9836fb4SBjoern A. Zeeb  *      rate of 5.5Mpbs, filter in broadcast probe responses and set the max
683d9836fb4SBjoern A. Zeeb  *      channel time indication field in the FILS request parameters element
684d9836fb4SBjoern A. Zeeb  *      (if included by the driver in the probe request IEs).
685bfcc09ddSBjoern A. Zeeb  */
686bfcc09ddSBjoern A. Zeeb enum iwl_umac_scan_general_flags_v2 {
687bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_PERIODIC             = BIT(0),
688bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_PASS_ALL             = BIT(1),
689bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_NTFY_ITER_COMPLETE   = BIT(2),
690bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC1     = BIT(3),
691bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC2     = BIT(4),
692bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_MATCH                = BIT(5),
693bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_USE_ALL_RX_CHAINS    = BIT(6),
694bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_ADAPTIVE_DWELL       = BIT(7),
695bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_PREEMPTIVE           = BIT(8),
696bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_NTF_START            = BIT(9),
697bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_MULTI_SSID           = BIT(10),
698bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE        = BIT(11),
699bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_TRIGGER_UHB_SCAN     = BIT(12),
700bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN    = BIT(13),
701bfcc09ddSBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN_FILTER_IN = BIT(14),
702d9836fb4SBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_FLAGS_V2_OCE                  = BIT(15),
703d9836fb4SBjoern A. Zeeb };
704d9836fb4SBjoern A. Zeeb 
705d9836fb4SBjoern A. Zeeb /**
706d9836fb4SBjoern A. Zeeb  * enum iwl_umac_scan_general_params_flags2 - UMAC scan general flags2
707d9836fb4SBjoern A. Zeeb  *
708d9836fb4SBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_PARAMS_FLAGS2_RESPECT_P2P_GO_LB: scan event scheduling
709d9836fb4SBjoern A. Zeeb  *     should be aware of a P2P GO operation on the 2GHz band.
710d9836fb4SBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_PARAMS_FLAGS2_RESPECT_P2P_GO_HB: scan event scheduling
711d9836fb4SBjoern A. Zeeb  *     should be aware of a P2P GO operation on the 5GHz or 6GHz band.
712*9af1bba4SBjoern A. Zeeb  * @IWL_UMAC_SCAN_GEN_PARAMS_FLAGS2_DONT_TOGGLE_ANT: don't toggle between
713*9af1bba4SBjoern A. Zeeb  *     valid antennas, and use the same antenna as in previous scan
714d9836fb4SBjoern A. Zeeb  */
715d9836fb4SBjoern A. Zeeb enum iwl_umac_scan_general_params_flags2 {
716d9836fb4SBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_PARAMS_FLAGS2_RESPECT_P2P_GO_LB = BIT(0),
717d9836fb4SBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_PARAMS_FLAGS2_RESPECT_P2P_GO_HB = BIT(1),
718*9af1bba4SBjoern A. Zeeb 	IWL_UMAC_SCAN_GEN_PARAMS_FLAGS2_DONT_TOGGLE_ANT   = BIT(2),
719bfcc09ddSBjoern A. Zeeb };
720bfcc09ddSBjoern A. Zeeb 
721bfcc09ddSBjoern A. Zeeb /**
722bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_channel_cfg_umac
723bfcc09ddSBjoern A. Zeeb  * @flags:		bitmap - 0-19:	directed scan to i'th ssid.
724bfcc09ddSBjoern A. Zeeb  * @channel_num:	channel number 1-13 etc.
725bfcc09ddSBjoern A. Zeeb  * @band:		band of channel: 0 for 2GHz, 1 for 5GHz
726bfcc09ddSBjoern A. Zeeb  * @iter_count:		repetition count for the channel.
727bfcc09ddSBjoern A. Zeeb  * @iter_interval:	interval between two scan iterations on one channel.
728bfcc09ddSBjoern A. Zeeb  */
729bfcc09ddSBjoern A. Zeeb struct  iwl_scan_channel_cfg_umac {
730*9af1bba4SBjoern A. Zeeb #define IWL_CHAN_CFG_FLAGS_BAND_POS 30
731bfcc09ddSBjoern A. Zeeb 	__le32 flags;
732*9af1bba4SBjoern A. Zeeb 
733*9af1bba4SBjoern A. Zeeb 	/* All versions are of the same size, so use a union without adjusting
734bfcc09ddSBjoern A. Zeeb 	 * the command size later
735bfcc09ddSBjoern A. Zeeb 	 */
736bfcc09ddSBjoern A. Zeeb 	union {
737bfcc09ddSBjoern A. Zeeb 		struct {
738bfcc09ddSBjoern A. Zeeb 			u8 channel_num;
739bfcc09ddSBjoern A. Zeeb 			u8 iter_count;
740bfcc09ddSBjoern A. Zeeb 			__le16 iter_interval;
741bfcc09ddSBjoern A. Zeeb 		} v1;  /* SCAN_CHANNEL_CONFIG_API_S_VER_1 */
742bfcc09ddSBjoern A. Zeeb 		struct {
743bfcc09ddSBjoern A. Zeeb 			u8 channel_num;
744bfcc09ddSBjoern A. Zeeb 			u8 band;
745bfcc09ddSBjoern A. Zeeb 			u8 iter_count;
746bfcc09ddSBjoern A. Zeeb 			u8 iter_interval;
747bfcc09ddSBjoern A. Zeeb 		 } v2; /* SCAN_CHANNEL_CONFIG_API_S_VER_2
748bfcc09ddSBjoern A. Zeeb 			* SCAN_CHANNEL_CONFIG_API_S_VER_3
749bfcc09ddSBjoern A. Zeeb 			* SCAN_CHANNEL_CONFIG_API_S_VER_4
750bfcc09ddSBjoern A. Zeeb 			*/
751*9af1bba4SBjoern A. Zeeb 		struct {
752*9af1bba4SBjoern A. Zeeb 			u8 channel_num;
753*9af1bba4SBjoern A. Zeeb 			u8 psd_20;
754*9af1bba4SBjoern A. Zeeb 			u8 iter_count;
755*9af1bba4SBjoern A. Zeeb 			u8 iter_interval;
756*9af1bba4SBjoern A. Zeeb 		} v5;  /* SCAN_CHANNEL_CONFIG_API_S_VER_5 */
757bfcc09ddSBjoern A. Zeeb 	};
758bfcc09ddSBjoern A. Zeeb } __packed;
759bfcc09ddSBjoern A. Zeeb 
760bfcc09ddSBjoern A. Zeeb /**
761bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_umac_schedule
762bfcc09ddSBjoern A. Zeeb  * @interval: interval in seconds between scan iterations
763bfcc09ddSBjoern A. Zeeb  * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop
764bfcc09ddSBjoern A. Zeeb  * @reserved: for alignment and future use
765bfcc09ddSBjoern A. Zeeb  */
766bfcc09ddSBjoern A. Zeeb struct iwl_scan_umac_schedule {
767bfcc09ddSBjoern A. Zeeb 	__le16 interval;
768bfcc09ddSBjoern A. Zeeb 	u8 iter_count;
769bfcc09ddSBjoern A. Zeeb 	u8 reserved;
770bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */
771bfcc09ddSBjoern A. Zeeb 
772bfcc09ddSBjoern A. Zeeb struct iwl_scan_req_umac_tail_v1 {
773bfcc09ddSBjoern A. Zeeb 	/* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
774bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
775bfcc09ddSBjoern A. Zeeb 	__le16 delay;
776bfcc09ddSBjoern A. Zeeb 	__le16 reserved;
777bfcc09ddSBjoern A. Zeeb 	/* SCAN_PROBE_PARAMS_API_S_VER_1 */
778bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_probe_req_v1 preq;
779bfcc09ddSBjoern A. Zeeb 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
780bfcc09ddSBjoern A. Zeeb } __packed;
781bfcc09ddSBjoern A. Zeeb 
782bfcc09ddSBjoern A. Zeeb /**
783bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command
784bfcc09ddSBjoern A. Zeeb  *      parameters following channels configuration array.
785bfcc09ddSBjoern A. Zeeb  * @schedule: two scheduling plans.
786bfcc09ddSBjoern A. Zeeb  * @delay: delay in TUs before starting the first scan iteration
787bfcc09ddSBjoern A. Zeeb  * @reserved: for future use and alignment
788bfcc09ddSBjoern A. Zeeb  * @preq: probe request with IEs blocks
789bfcc09ddSBjoern A. Zeeb  * @direct_scan: list of SSIDs for directed active scan
790bfcc09ddSBjoern A. Zeeb  */
791bfcc09ddSBjoern A. Zeeb struct iwl_scan_req_umac_tail_v2 {
792bfcc09ddSBjoern A. Zeeb 	/* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
793bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
794bfcc09ddSBjoern A. Zeeb 	__le16 delay;
795bfcc09ddSBjoern A. Zeeb 	__le16 reserved;
796bfcc09ddSBjoern A. Zeeb 	/* SCAN_PROBE_PARAMS_API_S_VER_2 */
797bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_probe_req preq;
798bfcc09ddSBjoern A. Zeeb 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
799bfcc09ddSBjoern A. Zeeb } __packed;
800bfcc09ddSBjoern A. Zeeb 
801bfcc09ddSBjoern A. Zeeb /**
802bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_umac_chan_param
803bfcc09ddSBjoern A. Zeeb  * @flags: channel flags &enum iwl_scan_channel_flags
804bfcc09ddSBjoern A. Zeeb  * @count: num of channels in scan request
805bfcc09ddSBjoern A. Zeeb  * @reserved: for future use and alignment
806bfcc09ddSBjoern A. Zeeb  */
807bfcc09ddSBjoern A. Zeeb struct iwl_scan_umac_chan_param {
808bfcc09ddSBjoern A. Zeeb 	u8 flags;
809bfcc09ddSBjoern A. Zeeb 	u8 count;
810bfcc09ddSBjoern A. Zeeb 	__le16 reserved;
811bfcc09ddSBjoern A. Zeeb } __packed; /*SCAN_CHANNEL_PARAMS_API_S_VER_1 */
812bfcc09ddSBjoern A. Zeeb 
813bfcc09ddSBjoern A. Zeeb /**
814bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_req_umac
815bfcc09ddSBjoern A. Zeeb  * @flags: &enum iwl_umac_scan_flags
816bfcc09ddSBjoern A. Zeeb  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
817bfcc09ddSBjoern A. Zeeb  * @ooc_priority: out of channel priority - &enum iwl_scan_priority
818bfcc09ddSBjoern A. Zeeb  * @general_flags: &enum iwl_umac_scan_general_flags
819bfcc09ddSBjoern A. Zeeb  * @scan_start_mac_id: report the scan start TSF time according to this mac TSF
820bfcc09ddSBjoern A. Zeeb  * @extended_dwell: dwell time for channels 1, 6 and 11
821bfcc09ddSBjoern A. Zeeb  * @active_dwell: dwell time for active scan per LMAC
822bfcc09ddSBjoern A. Zeeb  * @passive_dwell: dwell time for passive scan per LMAC
823bfcc09ddSBjoern A. Zeeb  * @fragmented_dwell: dwell time for fragmented passive scan
824bfcc09ddSBjoern A. Zeeb  * @adwell_default_n_aps: for adaptive dwell the default number of APs
825bfcc09ddSBjoern A. Zeeb  *	per channel
826bfcc09ddSBjoern A. Zeeb  * @adwell_default_n_aps_social: for adaptive dwell the default
827bfcc09ddSBjoern A. Zeeb  *	number of APs per social (1,6,11) channel
828bfcc09ddSBjoern A. Zeeb  * @general_flags2: &enum iwl_umac_scan_general_flags2
829bfcc09ddSBjoern A. Zeeb  * @adwell_max_budget: for adaptive dwell the maximal budget of TU to be added
830bfcc09ddSBjoern A. Zeeb  *	to total scan time
831bfcc09ddSBjoern A. Zeeb  * @max_out_time: max out of serving channel time, per LMAC - for CDB there
832bfcc09ddSBjoern A. Zeeb  *	are 2 LMACs
833bfcc09ddSBjoern A. Zeeb  * @suspend_time: max suspend time, per LMAC - for CDB there are 2 LMACs
834bfcc09ddSBjoern A. Zeeb  * @scan_priority: scan internal prioritization &enum iwl_scan_priority
835bfcc09ddSBjoern A. Zeeb  * @num_of_fragments: Number of fragments needed for full coverage per band.
836bfcc09ddSBjoern A. Zeeb  *	Relevant only for fragmented scan.
837bfcc09ddSBjoern A. Zeeb  * @channel: &struct iwl_scan_umac_chan_param
838bfcc09ddSBjoern A. Zeeb  * @reserved: for future use and alignment
839bfcc09ddSBjoern A. Zeeb  * @reserved3: for future use and alignment
840bfcc09ddSBjoern A. Zeeb  * @data: &struct iwl_scan_channel_cfg_umac and
841bfcc09ddSBjoern A. Zeeb  *	&struct iwl_scan_req_umac_tail
842bfcc09ddSBjoern A. Zeeb  */
843bfcc09ddSBjoern A. Zeeb struct iwl_scan_req_umac {
844bfcc09ddSBjoern A. Zeeb 	__le32 flags;
845bfcc09ddSBjoern A. Zeeb 	__le32 uid;
846bfcc09ddSBjoern A. Zeeb 	__le32 ooc_priority;
847bfcc09ddSBjoern A. Zeeb 	__le16 general_flags;
848bfcc09ddSBjoern A. Zeeb 	u8 reserved;
849bfcc09ddSBjoern A. Zeeb 	u8 scan_start_mac_id;
850bfcc09ddSBjoern A. Zeeb 	union {
851bfcc09ddSBjoern A. Zeeb 		struct {
852bfcc09ddSBjoern A. Zeeb 			u8 extended_dwell;
853bfcc09ddSBjoern A. Zeeb 			u8 active_dwell;
854bfcc09ddSBjoern A. Zeeb 			u8 passive_dwell;
855bfcc09ddSBjoern A. Zeeb 			u8 fragmented_dwell;
856bfcc09ddSBjoern A. Zeeb 			__le32 max_out_time;
857bfcc09ddSBjoern A. Zeeb 			__le32 suspend_time;
858bfcc09ddSBjoern A. Zeeb 			__le32 scan_priority;
859bfcc09ddSBjoern A. Zeeb 			struct iwl_scan_umac_chan_param channel;
860bfcc09ddSBjoern A. Zeeb 			u8 data[];
861bfcc09ddSBjoern A. Zeeb 		} v1; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */
862bfcc09ddSBjoern A. Zeeb 		struct {
863bfcc09ddSBjoern A. Zeeb 			u8 extended_dwell;
864bfcc09ddSBjoern A. Zeeb 			u8 active_dwell;
865bfcc09ddSBjoern A. Zeeb 			u8 passive_dwell;
866bfcc09ddSBjoern A. Zeeb 			u8 fragmented_dwell;
867bfcc09ddSBjoern A. Zeeb 			__le32 max_out_time[SCAN_TWO_LMACS];
868bfcc09ddSBjoern A. Zeeb 			__le32 suspend_time[SCAN_TWO_LMACS];
869bfcc09ddSBjoern A. Zeeb 			__le32 scan_priority;
870bfcc09ddSBjoern A. Zeeb 			struct iwl_scan_umac_chan_param channel;
871bfcc09ddSBjoern A. Zeeb 			u8 data[];
872bfcc09ddSBjoern A. Zeeb 		} v6; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_6 */
873bfcc09ddSBjoern A. Zeeb 		struct {
874bfcc09ddSBjoern A. Zeeb 			u8 active_dwell;
875bfcc09ddSBjoern A. Zeeb 			u8 passive_dwell;
876bfcc09ddSBjoern A. Zeeb 			u8 fragmented_dwell;
877bfcc09ddSBjoern A. Zeeb 			u8 adwell_default_n_aps;
878bfcc09ddSBjoern A. Zeeb 			u8 adwell_default_n_aps_social;
879bfcc09ddSBjoern A. Zeeb 			u8 reserved3;
880bfcc09ddSBjoern A. Zeeb 			__le16 adwell_max_budget;
881bfcc09ddSBjoern A. Zeeb 			__le32 max_out_time[SCAN_TWO_LMACS];
882bfcc09ddSBjoern A. Zeeb 			__le32 suspend_time[SCAN_TWO_LMACS];
883bfcc09ddSBjoern A. Zeeb 			__le32 scan_priority;
884bfcc09ddSBjoern A. Zeeb 			struct iwl_scan_umac_chan_param channel;
885bfcc09ddSBjoern A. Zeeb 			u8 data[];
886bfcc09ddSBjoern A. Zeeb 		} v7; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_7 */
887bfcc09ddSBjoern A. Zeeb 		struct {
888bfcc09ddSBjoern A. Zeeb 			u8 active_dwell[SCAN_TWO_LMACS];
889bfcc09ddSBjoern A. Zeeb 			u8 reserved2;
890bfcc09ddSBjoern A. Zeeb 			u8 adwell_default_n_aps;
891bfcc09ddSBjoern A. Zeeb 			u8 adwell_default_n_aps_social;
892bfcc09ddSBjoern A. Zeeb 			u8 general_flags2;
893bfcc09ddSBjoern A. Zeeb 			__le16 adwell_max_budget;
894bfcc09ddSBjoern A. Zeeb 			__le32 max_out_time[SCAN_TWO_LMACS];
895bfcc09ddSBjoern A. Zeeb 			__le32 suspend_time[SCAN_TWO_LMACS];
896bfcc09ddSBjoern A. Zeeb 			__le32 scan_priority;
897bfcc09ddSBjoern A. Zeeb 			u8 passive_dwell[SCAN_TWO_LMACS];
898bfcc09ddSBjoern A. Zeeb 			u8 num_of_fragments[SCAN_TWO_LMACS];
899bfcc09ddSBjoern A. Zeeb 			struct iwl_scan_umac_chan_param channel;
900bfcc09ddSBjoern A. Zeeb 			u8 data[];
901bfcc09ddSBjoern A. Zeeb 		} v8; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_8 */
902bfcc09ddSBjoern A. Zeeb 		struct {
903bfcc09ddSBjoern A. Zeeb 			u8 active_dwell[SCAN_TWO_LMACS];
904bfcc09ddSBjoern A. Zeeb 			u8 adwell_default_hb_n_aps;
905bfcc09ddSBjoern A. Zeeb 			u8 adwell_default_lb_n_aps;
906bfcc09ddSBjoern A. Zeeb 			u8 adwell_default_n_aps_social;
907bfcc09ddSBjoern A. Zeeb 			u8 general_flags2;
908bfcc09ddSBjoern A. Zeeb 			__le16 adwell_max_budget;
909bfcc09ddSBjoern A. Zeeb 			__le32 max_out_time[SCAN_TWO_LMACS];
910bfcc09ddSBjoern A. Zeeb 			__le32 suspend_time[SCAN_TWO_LMACS];
911bfcc09ddSBjoern A. Zeeb 			__le32 scan_priority;
912bfcc09ddSBjoern A. Zeeb 			u8 passive_dwell[SCAN_TWO_LMACS];
913bfcc09ddSBjoern A. Zeeb 			u8 num_of_fragments[SCAN_TWO_LMACS];
914bfcc09ddSBjoern A. Zeeb 			struct iwl_scan_umac_chan_param channel;
915bfcc09ddSBjoern A. Zeeb 			u8 data[];
916bfcc09ddSBjoern A. Zeeb 		} v9; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_9 */
917bfcc09ddSBjoern A. Zeeb 	};
918bfcc09ddSBjoern A. Zeeb } __packed;
919bfcc09ddSBjoern A. Zeeb 
920bfcc09ddSBjoern A. Zeeb #define IWL_SCAN_REQ_UMAC_SIZE_V8 sizeof(struct iwl_scan_req_umac)
921bfcc09ddSBjoern A. Zeeb #define IWL_SCAN_REQ_UMAC_SIZE_V7 48
922bfcc09ddSBjoern A. Zeeb #define IWL_SCAN_REQ_UMAC_SIZE_V6 44
923bfcc09ddSBjoern A. Zeeb #define IWL_SCAN_REQ_UMAC_SIZE_V1 36
924bfcc09ddSBjoern A. Zeeb 
925bfcc09ddSBjoern A. Zeeb /**
926bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_probe_params_v3
927bfcc09ddSBjoern A. Zeeb  * @preq: scan probe request params
928bfcc09ddSBjoern A. Zeeb  * @ssid_num: number of valid SSIDs in direct scan array
929bfcc09ddSBjoern A. Zeeb  * @short_ssid_num: number of valid short SSIDs in short ssid array
930bfcc09ddSBjoern A. Zeeb  * @bssid_num: number of valid bssid in bssids array
931bfcc09ddSBjoern A. Zeeb  * @reserved: reserved
932bfcc09ddSBjoern A. Zeeb  * @direct_scan: list of ssids
933bfcc09ddSBjoern A. Zeeb  * @short_ssid: array of short ssids
934bfcc09ddSBjoern A. Zeeb  * @bssid_array: array of bssids
935bfcc09ddSBjoern A. Zeeb  */
936bfcc09ddSBjoern A. Zeeb struct iwl_scan_probe_params_v3 {
937bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_probe_req preq;
938bfcc09ddSBjoern A. Zeeb 	u8 ssid_num;
939bfcc09ddSBjoern A. Zeeb 	u8 short_ssid_num;
940bfcc09ddSBjoern A. Zeeb 	u8 bssid_num;
941bfcc09ddSBjoern A. Zeeb 	u8 reserved;
942bfcc09ddSBjoern A. Zeeb 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
943bfcc09ddSBjoern A. Zeeb 	__le32 short_ssid[SCAN_SHORT_SSID_MAX_SIZE];
944bfcc09ddSBjoern A. Zeeb 	u8 bssid_array[SCAN_BSSID_MAX_SIZE][ETH_ALEN];
945bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_PROBE_PARAMS_API_S_VER_3 */
946bfcc09ddSBjoern A. Zeeb 
947bfcc09ddSBjoern A. Zeeb /**
948bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_probe_params_v4
949bfcc09ddSBjoern A. Zeeb  * @preq: scan probe request params
950bfcc09ddSBjoern A. Zeeb  * @short_ssid_num: number of valid short SSIDs in short ssid array
951bfcc09ddSBjoern A. Zeeb  * @bssid_num: number of valid bssid in bssids array
952bfcc09ddSBjoern A. Zeeb  * @reserved: reserved
953bfcc09ddSBjoern A. Zeeb  * @direct_scan: list of ssids
954bfcc09ddSBjoern A. Zeeb  * @short_ssid: array of short ssids
955bfcc09ddSBjoern A. Zeeb  * @bssid_array: array of bssids
956bfcc09ddSBjoern A. Zeeb  */
957bfcc09ddSBjoern A. Zeeb struct iwl_scan_probe_params_v4 {
958bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_probe_req preq;
959bfcc09ddSBjoern A. Zeeb 	u8 short_ssid_num;
960bfcc09ddSBjoern A. Zeeb 	u8 bssid_num;
961bfcc09ddSBjoern A. Zeeb 	__le16 reserved;
962bfcc09ddSBjoern A. Zeeb 	struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
963bfcc09ddSBjoern A. Zeeb 	__le32 short_ssid[SCAN_SHORT_SSID_MAX_SIZE];
964bfcc09ddSBjoern A. Zeeb 	u8 bssid_array[SCAN_BSSID_MAX_SIZE][ETH_ALEN];
965bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_PROBE_PARAMS_API_S_VER_4 */
966bfcc09ddSBjoern A. Zeeb 
967bfcc09ddSBjoern A. Zeeb #define SCAN_MAX_NUM_CHANS_V3 67
968bfcc09ddSBjoern A. Zeeb 
969bfcc09ddSBjoern A. Zeeb /**
970bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_channel_params_v4
971bfcc09ddSBjoern A. Zeeb  * @flags: channel flags &enum iwl_scan_channel_flags
972bfcc09ddSBjoern A. Zeeb  * @count: num of channels in scan request
973bfcc09ddSBjoern A. Zeeb  * @num_of_aps_override: override the number of APs the FW uses to calculate
974bfcc09ddSBjoern A. Zeeb  *	dwell time when adaptive dwell is used
975bfcc09ddSBjoern A. Zeeb  * @reserved: for future use and alignment
976bfcc09ddSBjoern A. Zeeb  * @channel_config: array of explicit channel configurations
977bfcc09ddSBjoern A. Zeeb  *                  for 2.4Ghz and 5.2Ghz bands
978bfcc09ddSBjoern A. Zeeb  * @adwell_ch_override_bitmap: when using adaptive dwell, override the number
979bfcc09ddSBjoern A. Zeeb  *	of APs value with &num_of_aps_override for the channel.
980bfcc09ddSBjoern A. Zeeb  *	To cast channel to index, use &iwl_mvm_scan_ch_and_band_to_idx
981bfcc09ddSBjoern A. Zeeb  */
982bfcc09ddSBjoern A. Zeeb struct iwl_scan_channel_params_v4 {
983bfcc09ddSBjoern A. Zeeb 	u8 flags;
984bfcc09ddSBjoern A. Zeeb 	u8 count;
985bfcc09ddSBjoern A. Zeeb 	u8 num_of_aps_override;
986bfcc09ddSBjoern A. Zeeb 	u8 reserved;
987bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_channel_cfg_umac channel_config[SCAN_MAX_NUM_CHANS_V3];
988bfcc09ddSBjoern A. Zeeb 	u8 adwell_ch_override_bitmap[16];
989bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_CHANNEL_PARAMS_API_S_VER_4 also
990bfcc09ddSBjoern A. Zeeb 	       SCAN_CHANNEL_PARAMS_API_S_VER_5 */
991bfcc09ddSBjoern A. Zeeb 
992bfcc09ddSBjoern A. Zeeb /**
993*9af1bba4SBjoern A. Zeeb  * struct iwl_scan_channel_params_v7
994bfcc09ddSBjoern A. Zeeb  * @flags: channel flags &enum iwl_scan_channel_flags
995bfcc09ddSBjoern A. Zeeb  * @count: num of channels in scan request
996bfcc09ddSBjoern A. Zeeb  * @n_aps_override: override the number of APs the FW uses to calculate dwell
997bfcc09ddSBjoern A. Zeeb  *	time when adaptive dwell is used.
998bfcc09ddSBjoern A. Zeeb  *	Channel k will use n_aps_override[i] when BIT(20 + i) is set in
999bfcc09ddSBjoern A. Zeeb  *	channel_config[k].flags
1000bfcc09ddSBjoern A. Zeeb  * @channel_config: array of explicit channel configurations
1001bfcc09ddSBjoern A. Zeeb  *                  for 2.4Ghz and 5.2Ghz bands
1002bfcc09ddSBjoern A. Zeeb  */
1003*9af1bba4SBjoern A. Zeeb struct iwl_scan_channel_params_v7 {
1004bfcc09ddSBjoern A. Zeeb 	u8 flags;
1005bfcc09ddSBjoern A. Zeeb 	u8 count;
1006bfcc09ddSBjoern A. Zeeb 	u8 n_aps_override[2];
1007bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_channel_cfg_umac channel_config[SCAN_MAX_NUM_CHANS_V3];
1008bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_CHANNEL_PARAMS_API_S_VER_6 */
1009bfcc09ddSBjoern A. Zeeb 
1010bfcc09ddSBjoern A. Zeeb /**
1011d9836fb4SBjoern A. Zeeb  * struct iwl_scan_general_params_v11
1012d9836fb4SBjoern A. Zeeb  * @flags: &enum iwl_umac_scan_general_flags_v2
1013bfcc09ddSBjoern A. Zeeb  * @reserved: reserved for future
1014*9af1bba4SBjoern A. Zeeb  * @scan_start_mac_or_link_id: report the scan start TSF time according to this
1015*9af1bba4SBjoern A. Zeeb  *     mac (up to verion 11) or link (starting with version 12) TSF
1016bfcc09ddSBjoern A. Zeeb  * @active_dwell: dwell time for active scan per LMAC
1017bfcc09ddSBjoern A. Zeeb  * @adwell_default_2g: adaptive dwell default number of APs
1018bfcc09ddSBjoern A. Zeeb  *                        for 2.4GHz channel
1019bfcc09ddSBjoern A. Zeeb  * @adwell_default_5g: adaptive dwell default number of APs
1020bfcc09ddSBjoern A. Zeeb  *                        for 5GHz channels
1021bfcc09ddSBjoern A. Zeeb  * @adwell_default_social_chn: adaptive dwell default number of
1022bfcc09ddSBjoern A. Zeeb  *                             APs per social channel
1023d9836fb4SBjoern A. Zeeb  * @flags2: for version 11 see &enum iwl_umac_scan_general_params_flags2.
1024d9836fb4SBjoern A. Zeeb  *     Otherwise reserved.
1025bfcc09ddSBjoern A. Zeeb  * @adwell_max_budget: the maximal number of TUs that adaptive dwell
1026bfcc09ddSBjoern A. Zeeb  *                     can add to the total scan time
1027bfcc09ddSBjoern A. Zeeb  * @max_out_of_time: max out of serving channel time, per LMAC
1028bfcc09ddSBjoern A. Zeeb  * @suspend_time: max suspend time, per LMAC
1029bfcc09ddSBjoern A. Zeeb  * @scan_priority: priority of the request
1030bfcc09ddSBjoern A. Zeeb  * @passive_dwell: continues dwell time for passive channel
1031bfcc09ddSBjoern A. Zeeb  *                 (without adaptive dwell)
1032bfcc09ddSBjoern A. Zeeb  * @num_of_fragments: number of fragments needed for full fragmented
1033bfcc09ddSBjoern A. Zeeb  *                    scan coverage.
1034bfcc09ddSBjoern A. Zeeb  */
1035d9836fb4SBjoern A. Zeeb struct iwl_scan_general_params_v11 {
1036bfcc09ddSBjoern A. Zeeb 	__le16 flags;
1037bfcc09ddSBjoern A. Zeeb 	u8 reserved;
1038*9af1bba4SBjoern A. Zeeb 	u8 scan_start_mac_or_link_id;
1039bfcc09ddSBjoern A. Zeeb 	u8 active_dwell[SCAN_TWO_LMACS];
1040bfcc09ddSBjoern A. Zeeb 	u8 adwell_default_2g;
1041bfcc09ddSBjoern A. Zeeb 	u8 adwell_default_5g;
1042bfcc09ddSBjoern A. Zeeb 	u8 adwell_default_social_chn;
1043d9836fb4SBjoern A. Zeeb 	u8 flags2;
1044bfcc09ddSBjoern A. Zeeb 	__le16 adwell_max_budget;
1045bfcc09ddSBjoern A. Zeeb 	__le32 max_out_of_time[SCAN_TWO_LMACS];
1046bfcc09ddSBjoern A. Zeeb 	__le32 suspend_time[SCAN_TWO_LMACS];
1047bfcc09ddSBjoern A. Zeeb 	__le32 scan_priority;
1048bfcc09ddSBjoern A. Zeeb 	u8 passive_dwell[SCAN_TWO_LMACS];
1049bfcc09ddSBjoern A. Zeeb 	u8 num_of_fragments[SCAN_TWO_LMACS];
1050*9af1bba4SBjoern A. Zeeb } __packed; /* SCAN_GENERAL_PARAMS_API_S_VER_12, *_VER_11  and *_VER_10 */
1051bfcc09ddSBjoern A. Zeeb 
1052bfcc09ddSBjoern A. Zeeb /**
1053bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_periodic_parms_v1
1054bfcc09ddSBjoern A. Zeeb  * @schedule: can scheduling parameter
1055bfcc09ddSBjoern A. Zeeb  * @delay: initial delay of the periodic scan in seconds
1056bfcc09ddSBjoern A. Zeeb  * @reserved: reserved for future
1057bfcc09ddSBjoern A. Zeeb  */
1058bfcc09ddSBjoern A. Zeeb struct iwl_scan_periodic_parms_v1 {
1059bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
1060bfcc09ddSBjoern A. Zeeb 	__le16 delay;
1061bfcc09ddSBjoern A. Zeeb 	__le16 reserved;
1062bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
1063bfcc09ddSBjoern A. Zeeb 
1064bfcc09ddSBjoern A. Zeeb /**
1065bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_req_params_v12
1066d9836fb4SBjoern A. Zeeb  * @general_params: &struct iwl_scan_general_params_v11
1067bfcc09ddSBjoern A. Zeeb  * @channel_params: &struct iwl_scan_channel_params_v4
1068bfcc09ddSBjoern A. Zeeb  * @periodic_params: &struct iwl_scan_periodic_parms_v1
1069bfcc09ddSBjoern A. Zeeb  * @probe_params: &struct iwl_scan_probe_params_v3
1070bfcc09ddSBjoern A. Zeeb  */
1071bfcc09ddSBjoern A. Zeeb struct iwl_scan_req_params_v12 {
1072d9836fb4SBjoern A. Zeeb 	struct iwl_scan_general_params_v11 general_params;
1073bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_channel_params_v4 channel_params;
1074bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_periodic_parms_v1 periodic_params;
1075bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_probe_params_v3 probe_params;
1076bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_REQUEST_PARAMS_API_S_VER_12 */
1077bfcc09ddSBjoern A. Zeeb 
1078bfcc09ddSBjoern A. Zeeb /**
1079*9af1bba4SBjoern A. Zeeb  * struct iwl_scan_req_params_v16
1080d9836fb4SBjoern A. Zeeb  * @general_params: &struct iwl_scan_general_params_v11
1081*9af1bba4SBjoern A. Zeeb  * @channel_params: &struct iwl_scan_channel_params_v7
1082bfcc09ddSBjoern A. Zeeb  * @periodic_params: &struct iwl_scan_periodic_parms_v1
1083bfcc09ddSBjoern A. Zeeb  * @probe_params: &struct iwl_scan_probe_params_v4
1084bfcc09ddSBjoern A. Zeeb  */
1085*9af1bba4SBjoern A. Zeeb struct iwl_scan_req_params_v17 {
1086d9836fb4SBjoern A. Zeeb 	struct iwl_scan_general_params_v11 general_params;
1087*9af1bba4SBjoern A. Zeeb 	struct iwl_scan_channel_params_v7 channel_params;
1088bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_periodic_parms_v1 periodic_params;
1089bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_probe_params_v4 probe_params;
1090*9af1bba4SBjoern A. Zeeb } __packed; /* SCAN_REQUEST_PARAMS_API_S_VER_17 - 14 */
1091bfcc09ddSBjoern A. Zeeb 
1092bfcc09ddSBjoern A. Zeeb /**
1093bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_req_umac_v12
1094bfcc09ddSBjoern A. Zeeb  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1095bfcc09ddSBjoern A. Zeeb  * @ooc_priority: out of channel priority - &enum iwl_scan_priority
1096bfcc09ddSBjoern A. Zeeb  * @scan_params: scan parameters
1097bfcc09ddSBjoern A. Zeeb  */
1098bfcc09ddSBjoern A. Zeeb struct iwl_scan_req_umac_v12 {
1099bfcc09ddSBjoern A. Zeeb 	__le32 uid;
1100bfcc09ddSBjoern A. Zeeb 	__le32 ooc_priority;
1101bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_req_params_v12 scan_params;
1102bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_12 */
1103bfcc09ddSBjoern A. Zeeb 
1104bfcc09ddSBjoern A. Zeeb /**
1105*9af1bba4SBjoern A. Zeeb  * struct iwl_scan_req_umac_v16
1106bfcc09ddSBjoern A. Zeeb  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1107bfcc09ddSBjoern A. Zeeb  * @ooc_priority: out of channel priority - &enum iwl_scan_priority
1108bfcc09ddSBjoern A. Zeeb  * @scan_params: scan parameters
1109bfcc09ddSBjoern A. Zeeb  */
1110*9af1bba4SBjoern A. Zeeb struct iwl_scan_req_umac_v17 {
1111bfcc09ddSBjoern A. Zeeb 	__le32 uid;
1112bfcc09ddSBjoern A. Zeeb 	__le32 ooc_priority;
1113*9af1bba4SBjoern A. Zeeb 	struct iwl_scan_req_params_v17 scan_params;
1114*9af1bba4SBjoern A. Zeeb } __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_17 - 14 */
1115bfcc09ddSBjoern A. Zeeb 
1116bfcc09ddSBjoern A. Zeeb /**
1117bfcc09ddSBjoern A. Zeeb  * struct iwl_umac_scan_abort
1118bfcc09ddSBjoern A. Zeeb  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1119bfcc09ddSBjoern A. Zeeb  * @flags: reserved
1120bfcc09ddSBjoern A. Zeeb  */
1121bfcc09ddSBjoern A. Zeeb struct iwl_umac_scan_abort {
1122bfcc09ddSBjoern A. Zeeb 	__le32 uid;
1123bfcc09ddSBjoern A. Zeeb 	__le32 flags;
1124bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */
1125bfcc09ddSBjoern A. Zeeb 
1126bfcc09ddSBjoern A. Zeeb /**
1127bfcc09ddSBjoern A. Zeeb  * struct iwl_umac_scan_complete
1128bfcc09ddSBjoern A. Zeeb  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1129bfcc09ddSBjoern A. Zeeb  * @last_schedule: last scheduling line
1130bfcc09ddSBjoern A. Zeeb  * @last_iter: last scan iteration number
1131bfcc09ddSBjoern A. Zeeb  * @status: &enum iwl_scan_offload_complete_status
1132bfcc09ddSBjoern A. Zeeb  * @ebs_status: &enum iwl_scan_ebs_status
1133bfcc09ddSBjoern A. Zeeb  * @time_from_last_iter: time elapsed from last iteration
1134bfcc09ddSBjoern A. Zeeb  * @reserved: for future use
1135bfcc09ddSBjoern A. Zeeb  */
1136bfcc09ddSBjoern A. Zeeb struct iwl_umac_scan_complete {
1137bfcc09ddSBjoern A. Zeeb 	__le32 uid;
1138bfcc09ddSBjoern A. Zeeb 	u8 last_schedule;
1139bfcc09ddSBjoern A. Zeeb 	u8 last_iter;
1140bfcc09ddSBjoern A. Zeeb 	u8 status;
1141bfcc09ddSBjoern A. Zeeb 	u8 ebs_status;
1142bfcc09ddSBjoern A. Zeeb 	__le32 time_from_last_iter;
1143bfcc09ddSBjoern A. Zeeb 	__le32 reserved;
1144bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */
1145bfcc09ddSBjoern A. Zeeb 
1146bfcc09ddSBjoern A. Zeeb #define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1 5
1147bfcc09ddSBjoern A. Zeeb #define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN    7
1148bfcc09ddSBjoern A. Zeeb 
1149bfcc09ddSBjoern A. Zeeb /**
1150bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_offload_profile_match_v1 - match information
1151bfcc09ddSBjoern A. Zeeb  * @bssid: matched bssid
1152bfcc09ddSBjoern A. Zeeb  * @reserved: reserved
1153bfcc09ddSBjoern A. Zeeb  * @channel: channel where the match occurred
1154bfcc09ddSBjoern A. Zeeb  * @energy: energy
1155bfcc09ddSBjoern A. Zeeb  * @matching_feature: feature matches
1156bfcc09ddSBjoern A. Zeeb  * @matching_channels: bitmap of channels that matched, referencing
1157bfcc09ddSBjoern A. Zeeb  *	the channels passed in the scan offload request.
1158bfcc09ddSBjoern A. Zeeb  */
1159bfcc09ddSBjoern A. Zeeb struct iwl_scan_offload_profile_match_v1 {
1160bfcc09ddSBjoern A. Zeeb 	u8 bssid[ETH_ALEN];
1161bfcc09ddSBjoern A. Zeeb 	__le16 reserved;
1162bfcc09ddSBjoern A. Zeeb 	u8 channel;
1163bfcc09ddSBjoern A. Zeeb 	u8 energy;
1164bfcc09ddSBjoern A. Zeeb 	u8 matching_feature;
1165bfcc09ddSBjoern A. Zeeb 	u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1];
1166bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_1 */
1167bfcc09ddSBjoern A. Zeeb 
1168bfcc09ddSBjoern A. Zeeb /**
1169bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_offload_profiles_query_v1 - match results query response
1170bfcc09ddSBjoern A. Zeeb  * @matched_profiles: bitmap of matched profiles, referencing the
1171bfcc09ddSBjoern A. Zeeb  *	matches passed in the scan offload request
1172bfcc09ddSBjoern A. Zeeb  * @last_scan_age: age of the last offloaded scan
1173bfcc09ddSBjoern A. Zeeb  * @n_scans_done: number of offloaded scans done
1174bfcc09ddSBjoern A. Zeeb  * @gp2_d0u: GP2 when D0U occurred
1175bfcc09ddSBjoern A. Zeeb  * @gp2_invoked: GP2 when scan offload was invoked
1176bfcc09ddSBjoern A. Zeeb  * @resume_while_scanning: not used
1177bfcc09ddSBjoern A. Zeeb  * @self_recovery: obsolete
1178bfcc09ddSBjoern A. Zeeb  * @reserved: reserved
1179bfcc09ddSBjoern A. Zeeb  * @matches: array of match information, one for each match
1180bfcc09ddSBjoern A. Zeeb  */
1181bfcc09ddSBjoern A. Zeeb struct iwl_scan_offload_profiles_query_v1 {
1182bfcc09ddSBjoern A. Zeeb 	__le32 matched_profiles;
1183bfcc09ddSBjoern A. Zeeb 	__le32 last_scan_age;
1184bfcc09ddSBjoern A. Zeeb 	__le32 n_scans_done;
1185bfcc09ddSBjoern A. Zeeb 	__le32 gp2_d0u;
1186bfcc09ddSBjoern A. Zeeb 	__le32 gp2_invoked;
1187bfcc09ddSBjoern A. Zeeb 	u8 resume_while_scanning;
1188bfcc09ddSBjoern A. Zeeb 	u8 self_recovery;
1189bfcc09ddSBjoern A. Zeeb 	__le16 reserved;
1190*9af1bba4SBjoern A. Zeeb 	struct iwl_scan_offload_profile_match_v1 matches[];
1191bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */
1192bfcc09ddSBjoern A. Zeeb 
1193bfcc09ddSBjoern A. Zeeb /**
1194bfcc09ddSBjoern A. Zeeb  * struct iwl_scan_offload_profile_match - match information
1195bfcc09ddSBjoern A. Zeeb  * @bssid: matched bssid
1196bfcc09ddSBjoern A. Zeeb  * @reserved: reserved
1197bfcc09ddSBjoern A. Zeeb  * @channel: channel where the match occurred
1198bfcc09ddSBjoern A. Zeeb  * @energy: energy
1199bfcc09ddSBjoern A. Zeeb  * @matching_feature: feature matches
1200bfcc09ddSBjoern A. Zeeb  * @matching_channels: bitmap of channels that matched, referencing
1201bfcc09ddSBjoern A. Zeeb  *	the channels passed in the scan offload request.
1202bfcc09ddSBjoern A. Zeeb  */
1203bfcc09ddSBjoern A. Zeeb struct iwl_scan_offload_profile_match {
1204bfcc09ddSBjoern A. Zeeb 	u8 bssid[ETH_ALEN];
1205bfcc09ddSBjoern A. Zeeb 	__le16 reserved;
1206bfcc09ddSBjoern A. Zeeb 	u8 channel;
1207bfcc09ddSBjoern A. Zeeb 	u8 energy;
1208bfcc09ddSBjoern A. Zeeb 	u8 matching_feature;
1209bfcc09ddSBjoern A. Zeeb 	u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN];
1210bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_2 */
1211bfcc09ddSBjoern A. Zeeb 
1212bfcc09ddSBjoern A. Zeeb /**
1213*9af1bba4SBjoern A. Zeeb  * struct iwl_scan_offload_match_info - match results information
1214bfcc09ddSBjoern A. Zeeb  * @matched_profiles: bitmap of matched profiles, referencing the
1215bfcc09ddSBjoern A. Zeeb  *	matches passed in the scan offload request
1216bfcc09ddSBjoern A. Zeeb  * @last_scan_age: age of the last offloaded scan
1217bfcc09ddSBjoern A. Zeeb  * @n_scans_done: number of offloaded scans done
1218bfcc09ddSBjoern A. Zeeb  * @gp2_d0u: GP2 when D0U occurred
1219bfcc09ddSBjoern A. Zeeb  * @gp2_invoked: GP2 when scan offload was invoked
1220bfcc09ddSBjoern A. Zeeb  * @resume_while_scanning: not used
1221bfcc09ddSBjoern A. Zeeb  * @self_recovery: obsolete
1222bfcc09ddSBjoern A. Zeeb  * @reserved: reserved
1223bfcc09ddSBjoern A. Zeeb  * @matches: array of match information, one for each match
1224bfcc09ddSBjoern A. Zeeb  */
1225*9af1bba4SBjoern A. Zeeb struct iwl_scan_offload_match_info {
1226bfcc09ddSBjoern A. Zeeb 	__le32 matched_profiles;
1227bfcc09ddSBjoern A. Zeeb 	__le32 last_scan_age;
1228bfcc09ddSBjoern A. Zeeb 	__le32 n_scans_done;
1229bfcc09ddSBjoern A. Zeeb 	__le32 gp2_d0u;
1230bfcc09ddSBjoern A. Zeeb 	__le32 gp2_invoked;
1231bfcc09ddSBjoern A. Zeeb 	u8 resume_while_scanning;
1232bfcc09ddSBjoern A. Zeeb 	u8 self_recovery;
1233bfcc09ddSBjoern A. Zeeb 	__le16 reserved;
1234*9af1bba4SBjoern A. Zeeb 	struct iwl_scan_offload_profile_match matches[];
1235*9af1bba4SBjoern A. Zeeb } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_3 and
1236*9af1bba4SBjoern A. Zeeb 	     * SCAN_OFFLOAD_MATCH_INFO_NOTIFICATION_S_VER_1
1237*9af1bba4SBjoern A. Zeeb 	     */
1238bfcc09ddSBjoern A. Zeeb 
1239bfcc09ddSBjoern A. Zeeb /**
1240bfcc09ddSBjoern A. Zeeb  * struct iwl_umac_scan_iter_complete_notif - notifies end of scanning iteration
1241bfcc09ddSBjoern A. Zeeb  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
1242bfcc09ddSBjoern A. Zeeb  * @scanned_channels: number of channels scanned and number of valid elements in
1243bfcc09ddSBjoern A. Zeeb  *	results array
1244bfcc09ddSBjoern A. Zeeb  * @status: one of SCAN_COMP_STATUS_*
1245bfcc09ddSBjoern A. Zeeb  * @bt_status: BT on/off status
1246bfcc09ddSBjoern A. Zeeb  * @last_channel: last channel that was scanned
1247bfcc09ddSBjoern A. Zeeb  * @start_tsf: TSF timer in usecs of the scan start time for the mac specified
1248bfcc09ddSBjoern A. Zeeb  *	in &struct iwl_scan_req_umac.
1249bfcc09ddSBjoern A. Zeeb  * @results: array of scan results, length in @scanned_channels
1250bfcc09ddSBjoern A. Zeeb  */
1251bfcc09ddSBjoern A. Zeeb struct iwl_umac_scan_iter_complete_notif {
1252bfcc09ddSBjoern A. Zeeb 	__le32 uid;
1253bfcc09ddSBjoern A. Zeeb 	u8 scanned_channels;
1254bfcc09ddSBjoern A. Zeeb 	u8 status;
1255bfcc09ddSBjoern A. Zeeb 	u8 bt_status;
1256bfcc09ddSBjoern A. Zeeb 	u8 last_channel;
1257bfcc09ddSBjoern A. Zeeb 	__le64 start_tsf;
1258bfcc09ddSBjoern A. Zeeb 	struct iwl_scan_results_notif results[];
1259bfcc09ddSBjoern A. Zeeb } __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_2 */
1260bfcc09ddSBjoern A. Zeeb 
1261bfcc09ddSBjoern A. Zeeb #endif /* __iwl_fw_api_scan_h__ */
1262