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  *
8  * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
9  * Copyright (C) 2018 - 2020 Intel Corporation
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  * The full GNU General Public License is included in this distribution
21  * in the file called COPYING.
22  *
23  * Contact Information:
24  * Intel Linux Wireless <linuxwifi@intel.com>
25  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26  *
27  * BSD LICENSE
28  *
29  * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
30  * Copyright (C) 2018 - 2020 Intel Corporation
31  * All rights reserved.
32  *
33  * Redistribution and use in source and binary forms, with or without
34  * modification, are permitted provided that the following conditions
35  * are met:
36  *
37  *  * Redistributions of source code must retain the above copyright
38  *    notice, this list of conditions and the following disclaimer.
39  *  * Redistributions in binary form must reproduce the above copyright
40  *    notice, this list of conditions and the following disclaimer in
41  *    the documentation and/or other materials provided with the
42  *    distribution.
43  *  * Neither the name Intel Corporation nor the names of its
44  *    contributors may be used to endorse or promote products derived
45  *    from this software without specific prior written permission.
46  *
47  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
48  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
49  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
50  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
51  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
52  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
53  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
54  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
55  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
56  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
57  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58  *
59  *****************************************************************************/
60 #ifndef __iwl_fw_api_location_h__
61 #define __iwl_fw_api_location_h__
62 
63 /**
64  * enum iwl_location_subcmd_ids - location group command IDs
65  */
66 enum iwl_location_subcmd_ids {
67 	/**
68 	 * @TOF_RANGE_REQ_CMD: TOF ranging request,
69 	 *	uses &struct iwl_tof_range_req_cmd
70 	 */
71 	TOF_RANGE_REQ_CMD = 0x0,
72 	/**
73 	 * @TOF_CONFIG_CMD: TOF configuration, uses &struct iwl_tof_config_cmd
74 	 */
75 	TOF_CONFIG_CMD = 0x1,
76 	/**
77 	 * @TOF_RANGE_ABORT_CMD: abort ongoing ranging, uses
78 	 *	&struct iwl_tof_range_abort_cmd
79 	 */
80 	TOF_RANGE_ABORT_CMD = 0x2,
81 	/**
82 	 * @TOF_RANGE_REQ_EXT_CMD: TOF extended ranging config,
83 	 *	uses &struct iwl_tof_range_req_ext_cmd
84 	 */
85 	TOF_RANGE_REQ_EXT_CMD = 0x3,
86 	/**
87 	 * @TOF_RESPONDER_CONFIG_CMD: FTM responder configuration,
88 	 *	uses &struct iwl_tof_responder_config_cmd
89 	 */
90 	TOF_RESPONDER_CONFIG_CMD = 0x4,
91 	/**
92 	 * @TOF_RESPONDER_DYN_CONFIG_CMD: FTM dynamic configuration,
93 	 *	uses &struct iwl_tof_responder_dyn_config_cmd
94 	 */
95 	TOF_RESPONDER_DYN_CONFIG_CMD = 0x5,
96 	/**
97 	 * @CSI_HEADER_NOTIFICATION: CSI header
98 	 */
99 	CSI_HEADER_NOTIFICATION = 0xFA,
100 	/**
101 	 * @CSI_CHUNKS_NOTIFICATION: CSI chunk,
102 	 *	uses &struct iwl_csi_chunk_notification
103 	 */
104 	CSI_CHUNKS_NOTIFICATION = 0xFB,
105 	/**
106 	 * @TOF_LC_NOTIF: used for LCI/civic location, contains just
107 	 *	the action frame
108 	 */
109 	TOF_LC_NOTIF = 0xFC,
110 	/**
111 	 * @TOF_RESPONDER_STATS: FTM responder statistics notification,
112 	 *	uses &struct iwl_ftm_responder_stats
113 	 */
114 	TOF_RESPONDER_STATS = 0xFD,
115 	/**
116 	 * @TOF_MCSI_DEBUG_NOTIF: MCSI debug notification, uses
117 	 *	&struct iwl_tof_mcsi_notif
118 	 */
119 	TOF_MCSI_DEBUG_NOTIF = 0xFE,
120 	/**
121 	 * @TOF_RANGE_RESPONSE_NOTIF: ranging response, using
122 	 *	&struct iwl_tof_range_rsp_ntfy
123 	 */
124 	TOF_RANGE_RESPONSE_NOTIF = 0xFF,
125 };
126 
127 /**
128  * struct iwl_tof_config_cmd - ToF configuration
129  * @tof_disabled: indicates if ToF is disabled (or not)
130  * @one_sided_disabled: indicates if one-sided is disabled (or not)
131  * @is_debug_mode: indiciates if debug mode is active
132  * @is_buf_required: indicates if channel estimation buffer is required
133  */
134 struct iwl_tof_config_cmd {
135 	u8 tof_disabled;
136 	u8 one_sided_disabled;
137 	u8 is_debug_mode;
138 	u8 is_buf_required;
139 } __packed;
140 
141 /**
142  * enum iwl_tof_bandwidth - values for iwl_tof_range_req_ap_entry.bandwidth
143  * @IWL_TOF_BW_20_LEGACY: 20 MHz non-HT
144  * @IWL_TOF_BW_20_HT: 20 MHz HT
145  * @IWL_TOF_BW_40: 40 MHz
146  * @IWL_TOF_BW_80: 80 MHz
147  * @IWL_TOF_BW_160: 160 MHz
148  * @IWL_TOF_BW_NUM: number of tof bandwidths
149  */
150 enum iwl_tof_bandwidth {
151 	IWL_TOF_BW_20_LEGACY,
152 	IWL_TOF_BW_20_HT,
153 	IWL_TOF_BW_40,
154 	IWL_TOF_BW_80,
155 	IWL_TOF_BW_160,
156 	IWL_TOF_BW_NUM,
157 }; /* LOCAT_BW_TYPE_E */
158 
159 /*
160  * enum iwl_tof_algo_type - Algorithym type for range measurement request
161  */
162 enum iwl_tof_algo_type {
163 	IWL_TOF_ALGO_TYPE_MAX_LIKE	= 0,
164 	IWL_TOF_ALGO_TYPE_LINEAR_REG	= 1,
165 	IWL_TOF_ALGO_TYPE_FFT		= 2,
166 
167 	/* Keep last */
168 	IWL_TOF_ALGO_TYPE_INVALID,
169 }; /* ALGO_TYPE_E */
170 
171 /*
172  * enum iwl_tof_mcsi_ntfy - Enable/Disable MCSI notifications
173  */
174 enum iwl_tof_mcsi_enable {
175 	IWL_TOF_MCSI_DISABLED = 0,
176 	IWL_TOF_MCSI_ENABLED = 1,
177 }; /* MCSI_ENABLE_E */
178 
179 /**
180  * enum iwl_tof_responder_cmd_valid_field - valid fields in the responder cfg
181  * @IWL_TOF_RESPONDER_CMD_VALID_CHAN_INFO: channel info is valid
182  * @IWL_TOF_RESPONDER_CMD_VALID_TOA_OFFSET: ToA offset is valid
183  * @IWL_TOF_RESPONDER_CMD_VALID_COMMON_CALIB: common calibration mode is valid
184  * @IWL_TOF_RESPONDER_CMD_VALID_SPECIFIC_CALIB: spefici calibration mode is
185  *	valid
186  * @IWL_TOF_RESPONDER_CMD_VALID_BSSID: BSSID is valid
187  * @IWL_TOF_RESPONDER_CMD_VALID_TX_ANT: TX antenna is valid
188  * @IWL_TOF_RESPONDER_CMD_VALID_ALGO_TYPE: algorithm type is valid
189  * @IWL_TOF_RESPONDER_CMD_VALID_NON_ASAP_SUPPORT: non-ASAP support is valid
190  * @IWL_TOF_RESPONDER_CMD_VALID_STATISTICS_REPORT_SUPPORT: statistics report
191  *	support is valid
192  * @IWL_TOF_RESPONDER_CMD_VALID_MCSI_NOTIF_SUPPORT: MCSI notification support
193  *	is valid
194  * @IWL_TOF_RESPONDER_CMD_VALID_FAST_ALGO_SUPPORT: fast algorithm support
195  *	is valid
196  * @IWL_TOF_RESPONDER_CMD_VALID_RETRY_ON_ALGO_FAIL: retry on algorithm failure
197  *	is valid
198  * @IWL_TOF_RESPONDER_CMD_VALID_STA_ID: station ID is valid
199  */
200 enum iwl_tof_responder_cmd_valid_field {
201 	IWL_TOF_RESPONDER_CMD_VALID_CHAN_INFO = BIT(0),
202 	IWL_TOF_RESPONDER_CMD_VALID_TOA_OFFSET = BIT(1),
203 	IWL_TOF_RESPONDER_CMD_VALID_COMMON_CALIB = BIT(2),
204 	IWL_TOF_RESPONDER_CMD_VALID_SPECIFIC_CALIB = BIT(3),
205 	IWL_TOF_RESPONDER_CMD_VALID_BSSID = BIT(4),
206 	IWL_TOF_RESPONDER_CMD_VALID_TX_ANT = BIT(5),
207 	IWL_TOF_RESPONDER_CMD_VALID_ALGO_TYPE = BIT(6),
208 	IWL_TOF_RESPONDER_CMD_VALID_NON_ASAP_SUPPORT = BIT(7),
209 	IWL_TOF_RESPONDER_CMD_VALID_STATISTICS_REPORT_SUPPORT = BIT(8),
210 	IWL_TOF_RESPONDER_CMD_VALID_MCSI_NOTIF_SUPPORT = BIT(9),
211 	IWL_TOF_RESPONDER_CMD_VALID_FAST_ALGO_SUPPORT = BIT(10),
212 	IWL_TOF_RESPONDER_CMD_VALID_RETRY_ON_ALGO_FAIL = BIT(11),
213 	IWL_TOF_RESPONDER_CMD_VALID_STA_ID = BIT(12),
214 };
215 
216 /**
217  * enum iwl_tof_responder_cfg_flags - responder configuration flags
218  * @IWL_TOF_RESPONDER_FLAGS_NON_ASAP_SUPPORT: non-ASAP support
219  * @IWL_TOF_RESPONDER_FLAGS_REPORT_STATISTICS: report statistics
220  * @IWL_TOF_RESPONDER_FLAGS_REPORT_MCSI: report MCSI
221  * @IWL_TOF_RESPONDER_FLAGS_ALGO_TYPE: algorithm type
222  * @IWL_TOF_RESPONDER_FLAGS_TOA_OFFSET_MODE: ToA offset mode
223  * @IWL_TOF_RESPONDER_FLAGS_COMMON_CALIB_MODE: common calibration mode
224  * @IWL_TOF_RESPONDER_FLAGS_SPECIFIC_CALIB_MODE: specific calibration mode
225  * @IWL_TOF_RESPONDER_FLAGS_FAST_ALGO_SUPPORT: fast algorithm support
226  * @IWL_TOF_RESPONDER_FLAGS_RETRY_ON_ALGO_FAIL: retry on algorithm fail
227  * @IWL_TOF_RESPONDER_FLAGS_FTM_TX_ANT: TX antenna mask
228  */
229 enum iwl_tof_responder_cfg_flags {
230 	IWL_TOF_RESPONDER_FLAGS_NON_ASAP_SUPPORT = BIT(0),
231 	IWL_TOF_RESPONDER_FLAGS_REPORT_STATISTICS = BIT(1),
232 	IWL_TOF_RESPONDER_FLAGS_REPORT_MCSI = BIT(2),
233 	IWL_TOF_RESPONDER_FLAGS_ALGO_TYPE = BIT(3) | BIT(4) | BIT(5),
234 	IWL_TOF_RESPONDER_FLAGS_TOA_OFFSET_MODE = BIT(6),
235 	IWL_TOF_RESPONDER_FLAGS_COMMON_CALIB_MODE = BIT(7),
236 	IWL_TOF_RESPONDER_FLAGS_SPECIFIC_CALIB_MODE = BIT(8),
237 	IWL_TOF_RESPONDER_FLAGS_FAST_ALGO_SUPPORT = BIT(9),
238 	IWL_TOF_RESPONDER_FLAGS_RETRY_ON_ALGO_FAIL = BIT(10),
239 	IWL_TOF_RESPONDER_FLAGS_FTM_TX_ANT = RATE_MCS_ANT_ABC_MSK,
240 };
241 
242 /**
243  * struct iwl_tof_responder_config_cmd_v6 - ToF AP mode (for debug)
244  * @cmd_valid_fields: &iwl_tof_responder_cmd_valid_field
245  * @responder_cfg_flags: &iwl_tof_responder_cfg_flags
246  * @bandwidth: current AP Bandwidth: &enum iwl_tof_bandwidth
247  * @rate: current AP rate
248  * @channel_num: current AP Channel
249  * @ctrl_ch_position: coding of the control channel position relative to
250  *	the center frequency, see iwl_mvm_get_ctrl_pos()
251  * @sta_id: index of the AP STA when in AP mode
252  * @reserved1: reserved
253  * @toa_offset: Artificial addition [pSec] for the ToA - to be used for debug
254  *	purposes, simulating station movement by adding various values
255  *	to this field
256  * @common_calib: XVT: common calibration value
257  * @specific_calib: XVT: specific calibration value
258  * @bssid: Current AP BSSID
259  * @reserved2: reserved
260  */
261 struct iwl_tof_responder_config_cmd_v6 {
262 	__le32 cmd_valid_fields;
263 	__le32 responder_cfg_flags;
264 	u8 bandwidth;
265 	u8 rate;
266 	u8 channel_num;
267 	u8 ctrl_ch_position;
268 	u8 sta_id;
269 	u8 reserved1;
270 	__le16 toa_offset;
271 	__le16 common_calib;
272 	__le16 specific_calib;
273 	u8 bssid[ETH_ALEN];
274 	__le16 reserved2;
275 } __packed; /* TOF_RESPONDER_CONFIG_CMD_API_S_VER_6 */
276 
277 /**
278  * struct iwl_tof_responder_config_cmd - ToF AP mode (for debug)
279  * @cmd_valid_fields: &iwl_tof_responder_cmd_valid_field
280  * @responder_cfg_flags: &iwl_tof_responder_cfg_flags
281  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
282  *             bits 4 - 7: &enum iwl_location_bw.
283  * @rate: current AP rate
284  * @channel_num: current AP Channel
285  * @ctrl_ch_position: coding of the control channel position relative to
286  *	the center frequency, see iwl_mvm_get_ctrl_pos()
287  * @sta_id: index of the AP STA when in AP mode
288  * @reserved1: reserved
289  * @toa_offset: Artificial addition [pSec] for the ToA - to be used for debug
290  *	purposes, simulating station movement by adding various values
291  *	to this field
292  * @common_calib: XVT: common calibration value
293  * @specific_calib: XVT: specific calibration value
294  * @bssid: Current AP BSSID
295  * @reserved2: reserved
296  */
297 struct iwl_tof_responder_config_cmd {
298 	__le32 cmd_valid_fields;
299 	__le32 responder_cfg_flags;
300 	u8 format_bw;
301 	u8 rate;
302 	u8 channel_num;
303 	u8 ctrl_ch_position;
304 	u8 sta_id;
305 	u8 reserved1;
306 	__le16 toa_offset;
307 	__le16 common_calib;
308 	__le16 specific_calib;
309 	u8 bssid[ETH_ALEN];
310 	__le16 reserved2;
311 } __packed; /* TOF_RESPONDER_CONFIG_CMD_API_S_VER_6 */
312 
313 #define IWL_LCI_CIVIC_IE_MAX_SIZE	400
314 
315 /**
316  * struct iwl_tof_responder_dyn_config_cmd - Dynamic responder settings
317  * @lci_len: The length of the 1st (LCI) part in the @lci_civic buffer
318  * @civic_len: The length of the 2nd (CIVIC) part in the @lci_civic buffer
319  * @lci_civic: The LCI/CIVIC buffer. LCI data (if exists) comes first, then, if
320  *	needed, 0-padding such that the next part is dword-aligned, then CIVIC
321  *	data (if exists) follows, and then 0-padding again to complete a
322  *	4-multiple long buffer.
323  */
324 struct iwl_tof_responder_dyn_config_cmd_v2 {
325 	__le32 lci_len;
326 	__le32 civic_len;
327 	u8 lci_civic[];
328 } __packed; /* TOF_RESPONDER_DYN_CONFIG_CMD_API_S_VER_2 */
329 
330 #define IWL_LCI_MAX_SIZE	160
331 #define IWL_CIVIC_MAX_SIZE	160
332 #define HLTK_11AZ_LEN	32
333 
334 /**
335  * enum iwl_responder_dyn_cfg_valid_flags - valid flags for dyn_config_cmd
336  * @IWL_RESPONDER_DYN_CFG_VALID_LCI: LCI data is valid
337  * @IWL_RESPONDER_DYN_CFG_VALID_CIVIC: Civic data is valid
338  * @IWL_RESPONDER_DYN_CFG_VALID_PASN_STA: the pasn_addr, HLTK and cipher fields
339  *	are valid.
340  */
341 enum iwl_responder_dyn_cfg_valid_flags {
342 	IWL_RESPONDER_DYN_CFG_VALID_LCI = BIT(0),
343 	IWL_RESPONDER_DYN_CFG_VALID_CIVIC = BIT(1),
344 	IWL_RESPONDER_DYN_CFG_VALID_PASN_STA = BIT(2),
345 };
346 
347 /**
348  * struct iwl_tof_responder_dyn_config_cmd - Dynamic responder settings
349  * @cipher: The negotiated cipher. see &enum iwl_location_cipher.
350  * @valid_flags: flags indicating which fields in the command are valid. see
351  *	&enum iwl_responder_dyn_cfg_valid_flags.
352  * @lci_len: length of the LCI data in bytes
353  * @civic_len: length of the Civic data in bytes
354  * @lci_buf: the LCI buffer
355  * @civic_buf: the Civic buffer
356  * @hltk_buf: HLTK for secure LTF bits generation for the specified station
357  * @addr: mac address of the station for which to use the HLTK
358  * @reserved: for alignment
359  */
360 struct iwl_tof_responder_dyn_config_cmd {
361 	u8 cipher;
362 	u8 valid_flags;
363 	u8 lci_len;
364 	u8 civic_len;
365 	u8 lci_buf[IWL_LCI_MAX_SIZE];
366 	u8 civic_buf[IWL_LCI_MAX_SIZE];
367 	u8 hltk_buf[HLTK_11AZ_LEN];
368 	u8 addr[ETH_ALEN];
369 	u8 reserved[2];
370 } __packed; /* TOF_RESPONDER_DYN_CONFIG_CMD_API_S_VER_3 */
371 
372 /**
373  * struct iwl_tof_range_req_ext_cmd - extended range req for WLS
374  * @tsf_timer_offset_msec: the recommended time offset (mSec) from the AP's TSF
375  * @reserved: reserved
376  * @min_delta_ftm: Minimal time between two consecutive measurements,
377  *		   in units of 100us. 0 means no preference by station
378  * @ftm_format_and_bw20M: FTM Channel Spacing/Format for 20MHz: recommended
379  *			value be sent to the AP
380  * @ftm_format_and_bw40M: FTM Channel Spacing/Format for 40MHz: recommended
381  *			value to be sent to the AP
382  * @ftm_format_and_bw80M: FTM Channel Spacing/Format for 80MHz: recommended
383  *			value to be sent to the AP
384  */
385 struct iwl_tof_range_req_ext_cmd {
386 	__le16 tsf_timer_offset_msec;
387 	__le16 reserved;
388 	u8 min_delta_ftm;
389 	u8 ftm_format_and_bw20M;
390 	u8 ftm_format_and_bw40M;
391 	u8 ftm_format_and_bw80M;
392 } __packed;
393 
394 /**
395  * enum iwl_tof_location_query - values for query bitmap
396  * @IWL_TOF_LOC_LCI: query LCI
397  * @IWL_TOF_LOC_CIVIC: query civic
398  */
399 enum iwl_tof_location_query {
400 	IWL_TOF_LOC_LCI = 0x01,
401 	IWL_TOF_LOC_CIVIC = 0x02,
402 };
403 
404  /**
405  * struct iwl_tof_range_req_ap_entry_v2 - AP configuration parameters
406  * @channel_num: Current AP Channel
407  * @bandwidth: Current AP Bandwidth. One of iwl_tof_bandwidth.
408  * @tsf_delta_direction: TSF relatively to the subject AP
409  * @ctrl_ch_position: Coding of the control channel position relative to the
410  *	center frequency, see iwl_mvm_get_ctrl_pos().
411  * @bssid: AP's BSSID
412  * @measure_type: Measurement type: 0 - two sided, 1 - One sided
413  * @num_of_bursts: Recommended value to be sent to the AP.  2s Exponent of the
414  *	number of measurement iterations (min 2^0 = 1, max 2^14)
415  * @burst_period: Recommended value to be sent to the AP. Measurement
416  *	periodicity In units of 100ms. ignored if num_of_bursts = 0
417  * @samples_per_burst: 2-sided: the number of FTMs pairs in single Burst (1-31);
418  *	1-sided: how many rts/cts pairs should be used per burst.
419  * @retries_per_sample: Max number of retries that the LMAC should send
420  *	in case of no replies by the AP.
421  * @tsf_delta: TSF Delta in units of microseconds.
422  *	The difference between the AP TSF and the device local clock.
423  * @location_req: Location Request Bit[0] LCI should be sent in the FTMR;
424  *	Bit[1] Civic should be sent in the FTMR
425  * @asap_mode: 0 - non asap mode, 1 - asap mode (not relevant for one sided)
426  * @enable_dyn_ack: Enable Dynamic ACK BW.
427  *	0: Initiator interact with regular AP;
428  *	1: Initiator interact with Responder machine: need to send the
429  *	Initiator Acks with HT 40MHz / 80MHz, since the Responder should
430  *	use it for its ch est measurement (this flag will be set when we
431  *	configure the opposite machine to be Responder).
432  * @rssi: Last received value
433  *	legal values: -128-0 (0x7f). above 0x0 indicating an invalid value.
434  * @algo_type: &enum iwl_tof_algo_type
435  * @notify_mcsi: &enum iwl_tof_mcsi_ntfy.
436  * @reserved: For alignment and future use
437  */
438 struct iwl_tof_range_req_ap_entry_v2 {
439 	u8 channel_num;
440 	u8 bandwidth;
441 	u8 tsf_delta_direction;
442 	u8 ctrl_ch_position;
443 	u8 bssid[ETH_ALEN];
444 	u8 measure_type;
445 	u8 num_of_bursts;
446 	__le16 burst_period;
447 	u8 samples_per_burst;
448 	u8 retries_per_sample;
449 	__le32 tsf_delta;
450 	u8 location_req;
451 	u8 asap_mode;
452 	u8 enable_dyn_ack;
453 	s8 rssi;
454 	u8 algo_type;
455 	u8 notify_mcsi;
456 	__le16 reserved;
457 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_2 */
458 
459 /**
460  * enum iwl_initiator_ap_flags - per responder FTM configuration flags
461  * @IWL_INITIATOR_AP_FLAGS_ASAP: Request for ASAP measurement.
462  * @IWL_INITIATOR_AP_FLAGS_LCI_REQUEST: Request for LCI information
463  * @IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST: Request for CIVIC information
464  * @IWL_INITIATOR_AP_FLAGS_DYN_ACK: Send HT/VHT ack for FTM frames. If not set,
465  *	20Mhz dup acks will be sent.
466  * @IWL_INITIATOR_AP_FLAGS_ALGO_LR: Use LR algo type for rtt calculation.
467  *	Default algo type is ML.
468  * @IWL_INITIATOR_AP_FLAGS_ALGO_FFT: Use FFT algo type for rtt calculation.
469  *	Default algo type is ML.
470  * @IWL_INITIATOR_AP_FLAGS_MCSI_REPORT: Send the MCSI for each FTM frame to the
471  *	driver.
472  * @IWL_INITIATOR_AP_FLAGS_NON_TB: Use non trigger based flow
473  * @IWL_INITIATOR_AP_FLAGS_TB: Use trigger based flow
474  * @IWL_INITIATOR_AP_FLAGS_SECURED: request secured measurement
475  * @IWL_INITIATOR_AP_FLAGS_LMR_FEEDBACK: Send LMR feedback
476  * @IWL_INITIATOR_AP_FLAGS_USE_CALIB: Use calibration values from the request
477  *      instead of fw internal values.
478  */
479 enum iwl_initiator_ap_flags {
480 	IWL_INITIATOR_AP_FLAGS_ASAP = BIT(1),
481 	IWL_INITIATOR_AP_FLAGS_LCI_REQUEST = BIT(2),
482 	IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST = BIT(3),
483 	IWL_INITIATOR_AP_FLAGS_DYN_ACK = BIT(4),
484 	IWL_INITIATOR_AP_FLAGS_ALGO_LR = BIT(5),
485 	IWL_INITIATOR_AP_FLAGS_ALGO_FFT = BIT(6),
486 	IWL_INITIATOR_AP_FLAGS_MCSI_REPORT = BIT(8),
487 	IWL_INITIATOR_AP_FLAGS_NON_TB = BIT(9),
488 	IWL_INITIATOR_AP_FLAGS_TB = BIT(10),
489 	IWL_INITIATOR_AP_FLAGS_SECURED = BIT(11),
490 	IWL_INITIATOR_AP_FLAGS_LMR_FEEDBACK = BIT(12),
491 	IWL_INITIATOR_AP_FLAGS_USE_CALIB = BIT(13),
492 };
493 
494 /**
495  * struct iwl_tof_range_req_ap_entry_v3 - AP configuration parameters
496  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
497  * @channel_num: AP Channel number
498  * @bandwidth: AP bandwidth. One of iwl_tof_bandwidth.
499  * @ctrl_ch_position: Coding of the control channel position relative to the
500  *	center frequency, see iwl_mvm_get_ctrl_pos().
501  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
502  *	reply from the AP.
503  * @bssid: AP's BSSID
504  * @burst_period: Recommended value to be sent to the AP. Measurement
505  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
506  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
507  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
508  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
509  * @reserved: For alignment and future use
510  * @tsf_delta: not in use
511  */
512 struct iwl_tof_range_req_ap_entry_v3 {
513 	__le32 initiator_ap_flags;
514 	u8 channel_num;
515 	u8 bandwidth;
516 	u8 ctrl_ch_position;
517 	u8 ftmr_max_retries;
518 	u8 bssid[ETH_ALEN];
519 	__le16 burst_period;
520 	u8 samples_per_burst;
521 	u8 num_of_bursts;
522 	__le16 reserved;
523 	__le32 tsf_delta;
524 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_3 */
525 
526 /**
527  * enum iwl_location_frame_format - location frame formats
528  * @IWL_LOCATION_FRAME_FORMAT_LEGACY: legacy
529  * @IWL_LOCATION_FRAME_FORMAT_HT: HT
530  * @IWL_LOCATION_FRAME_FORMAT_VHT: VHT
531  * @IWL_LOCATION_FRAME_FORMAT_HE: HE
532  */
533 enum iwl_location_frame_format {
534 	IWL_LOCATION_FRAME_FORMAT_LEGACY,
535 	IWL_LOCATION_FRAME_FORMAT_HT,
536 	IWL_LOCATION_FRAME_FORMAT_VHT,
537 	IWL_LOCATION_FRAME_FORMAT_HE,
538 };
539 
540 /**
541  * enum iwl_location_bw - location bandwidth selection
542  * @IWL_LOCATION_BW_20MHZ: 20MHz
543  * @IWL_LOCATION_BW_40MHZ: 40MHz
544  * @IWL_LOCATION_BW_80MHZ: 80MHz
545  */
546 enum iwl_location_bw {
547 	IWL_LOCATION_BW_20MHZ,
548 	IWL_LOCATION_BW_40MHZ,
549 	IWL_LOCATION_BW_80MHZ,
550 };
551 
552 #define TK_11AZ_LEN	32
553 
554 #define LOCATION_BW_POS	4
555 
556 /**
557  * struct iwl_tof_range_req_ap_entry_v4 - AP configuration parameters
558  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
559  * @channel_num: AP Channel number
560  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
561  *             bits 4 - 7: &enum iwl_location_bw.
562  * @ctrl_ch_position: Coding of the control channel position relative to the
563  *	center frequency, see iwl_mvm_get_ctrl_pos().
564  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
565  *	reply from the AP.
566  * @bssid: AP's BSSID
567  * @burst_period: Recommended value to be sent to the AP. Measurement
568  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
569  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
570  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
571  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
572  * @reserved: For alignment and future use
573  * @hltk: HLTK to be used for secured 11az measurement
574  * @tk: TK to be used for secured 11az measurement
575  */
576 struct iwl_tof_range_req_ap_entry_v4 {
577 	__le32 initiator_ap_flags;
578 	u8 channel_num;
579 	u8 format_bw;
580 	u8 ctrl_ch_position;
581 	u8 ftmr_max_retries;
582 	u8 bssid[ETH_ALEN];
583 	__le16 burst_period;
584 	u8 samples_per_burst;
585 	u8 num_of_bursts;
586 	__le16 reserved;
587 	u8 hltk[HLTK_11AZ_LEN];
588 	u8 tk[TK_11AZ_LEN];
589 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_4 */
590 
591 /**
592  * enum iwl_location_cipher - location cipher selection
593  * @IWL_LOCATION_CIPHER_CCMP_128: CCMP 128
594  * @IWL_LOCATION_CIPHER_GCMP_128: GCMP 128
595  * @IWL_LOCATION_CIPHER_GCMP_256: GCMP 256
596  * @IWL_LOCATION_CIPHER_INVALID: security is not used.
597  * @IWL_LOCATION_CIPHER_MAX: maximum value for this enum.
598  */
599 enum iwl_location_cipher {
600 	IWL_LOCATION_CIPHER_CCMP_128,
601 	IWL_LOCATION_CIPHER_GCMP_128,
602 	IWL_LOCATION_CIPHER_GCMP_256,
603 	IWL_LOCATION_CIPHER_INVALID,
604 	IWL_LOCATION_CIPHER_MAX,
605 };
606 
607 /**
608  * struct iwl_tof_range_req_ap_entry_v6 - AP configuration parameters
609  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
610  * @channel_num: AP Channel number
611  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
612  *             bits 4 - 7: &enum iwl_location_bw.
613  * @ctrl_ch_position: Coding of the control channel position relative to the
614  *	center frequency, see iwl_mvm_get_ctrl_pos().
615  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
616  *	reply from the AP.
617  * @bssid: AP's BSSID
618  * @burst_period: Recommended value to be sent to the AP. Measurement
619  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
620  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
621  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
622  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
623  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
624  *	otherwise should be set to &IWL_MVM_INVALID_STA.
625  * @cipher: pairwise cipher suite for secured measurement.
626  *          &enum iwl_location_cipher.
627  * @hltk: HLTK to be used for secured 11az measurement
628  * @tk: TK to be used for secured 11az measurement
629  * @calib: An array of calibration values per FTM rx bandwidth.
630  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
631  *         calibration value that corresponds to the rx bandwidth of the FTM
632  *         frame.
633  * @beacon_interval: beacon interval of the AP in TUs. Only required if
634  *	&IWL_INITIATOR_AP_FLAGS_TB is set.
635  */
636 struct iwl_tof_range_req_ap_entry_v6 {
637 	__le32 initiator_ap_flags;
638 	u8 channel_num;
639 	u8 format_bw;
640 	u8 ctrl_ch_position;
641 	u8 ftmr_max_retries;
642 	u8 bssid[ETH_ALEN];
643 	__le16 burst_period;
644 	u8 samples_per_burst;
645 	u8 num_of_bursts;
646 	u8 sta_id;
647 	u8 cipher;
648 	u8 hltk[HLTK_11AZ_LEN];
649 	u8 tk[TK_11AZ_LEN];
650 	__le16 calib[IWL_TOF_BW_NUM];
651 	__le16 beacon_interval;
652 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_6 */
653 
654 /**
655  * struct iwl_tof_range_req_ap_entry_v7 - AP configuration parameters
656  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
657  * @channel_num: AP Channel number
658  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
659  *             bits 4 - 7: &enum iwl_location_bw.
660  * @ctrl_ch_position: Coding of the control channel position relative to the
661  *	center frequency, see iwl_mvm_get_ctrl_pos().
662  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
663  *	reply from the AP.
664  * @bssid: AP's BSSID
665  * @burst_period: Recommended value to be sent to the AP. Measurement
666  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
667  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
668  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
669  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
670  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
671  *	otherwise should be set to &IWL_MVM_INVALID_STA.
672  * @cipher: pairwise cipher suite for secured measurement.
673  *          &enum iwl_location_cipher.
674  * @hltk: HLTK to be used for secured 11az measurement
675  * @tk: TK to be used for secured 11az measurement
676  * @calib: An array of calibration values per FTM rx bandwidth.
677  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
678  *         calibration value that corresponds to the rx bandwidth of the FTM
679  *         frame.
680  * @beacon_interval: beacon interval of the AP in TUs. Only required if
681  *	&IWL_INITIATOR_AP_FLAGS_TB is set.
682  * @rx_pn: the next expected PN for protected management frames Rx. LE byte
683  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
684  *	is set to &IWL_MVM_INVALID_STA.
685  * @tx_pn: the next PN to use for protected management frames Tx. LE byte
686  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
687  *	is set to &IWL_MVM_INVALID_STA.
688  */
689 struct iwl_tof_range_req_ap_entry_v7 {
690 	__le32 initiator_ap_flags;
691 	u8 channel_num;
692 	u8 format_bw;
693 	u8 ctrl_ch_position;
694 	u8 ftmr_max_retries;
695 	u8 bssid[ETH_ALEN];
696 	__le16 burst_period;
697 	u8 samples_per_burst;
698 	u8 num_of_bursts;
699 	u8 sta_id;
700 	u8 cipher;
701 	u8 hltk[HLTK_11AZ_LEN];
702 	u8 tk[TK_11AZ_LEN];
703 	__le16 calib[IWL_TOF_BW_NUM];
704 	__le16 beacon_interval;
705 	u8 rx_pn[IEEE80211_CCMP_PN_LEN];
706 	u8 tx_pn[IEEE80211_CCMP_PN_LEN];
707 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_7 */
708 
709 /**
710  * enum iwl_tof_response_mode
711  * @IWL_MVM_TOF_RESPONSE_ASAP: report each AP measurement separately as soon as
712  *			       possible (not supported for this release)
713  * @IWL_MVM_TOF_RESPONSE_TIMEOUT: report all AP measurements as a batch upon
714  *				  timeout expiration
715  * @IWL_MVM_TOF_RESPONSE_COMPLETE: report all AP measurements as a batch at the
716  *				   earlier of: measurements completion / timeout
717  *				   expiration.
718  */
719 enum iwl_tof_response_mode {
720 	IWL_MVM_TOF_RESPONSE_ASAP,
721 	IWL_MVM_TOF_RESPONSE_TIMEOUT,
722 	IWL_MVM_TOF_RESPONSE_COMPLETE,
723 };
724 
725 /**
726  * enum iwl_tof_initiator_flags
727  *
728  * @IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED: disable fast algo, meaning run
729  *	the algo on ant A+B, instead of only one of them.
730  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A: open RX antenna A for FTMs RX
731  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B: open RX antenna B for FTMs RX
732  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C: open RX antenna C for FTMs RX
733  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A: use antenna A fo TX ACKs during FTM
734  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B: use antenna B fo TX ACKs during FTM
735  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C: use antenna C fo TX ACKs during FTM
736  * @IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM: use random mac address for FTM
737  * @IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB: use the specific calib value from
738  *	the range request command
739  * @IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB: use the common calib value from the
740  *	ragne request command
741  * @IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT: support non-asap measurements
742  */
743 enum iwl_tof_initiator_flags {
744 	IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED = BIT(0),
745 	IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A = BIT(1),
746 	IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B = BIT(2),
747 	IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C = BIT(3),
748 	IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A = BIT(4),
749 	IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B = BIT(5),
750 	IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C = BIT(6),
751 	IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM = BIT(7),
752 	IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB = BIT(15),
753 	IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB   = BIT(16),
754 	IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT = BIT(20),
755 }; /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */
756 
757 #define IWL_MVM_TOF_MAX_APS 5
758 #define IWL_MVM_TOF_MAX_TWO_SIDED_APS 5
759 
760 /**
761  * struct iwl_tof_range_req_cmd_v5 - start measurement cmd
762  * @initiator_flags: see flags @ iwl_tof_initiator_flags
763  * @request_id: A Token incremented per request. The same Token will be
764  *		sent back in the range response
765  * @initiator: 0- NW initiated,  1 - Client Initiated
766  * @one_sided_los_disable: '0'- run ML-Algo for both ToF/OneSided,
767  *			   '1' - run ML-Algo for ToF only
768  * @req_timeout: Requested timeout of the response in units of 100ms.
769  *	     This is equivalent to the session time configured to the
770  *	     LMAC in Initiator Request
771  * @report_policy: Supported partially for this release: For current release -
772  *		   the range report will be uploaded as a batch when ready or
773  *		   when the session is done (successfully / partially).
774  *		   one of iwl_tof_response_mode.
775  * @reserved0: reserved
776  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
777  * @macaddr_random: '0' Use default source MAC address (i.e. p2_p),
778  *	            '1' Use MAC Address randomization according to the below
779  * @range_req_bssid: ranging request BSSID
780  * @macaddr_template: MAC address template to use for non-randomized bits
781  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
782  *		  Bits set to 1 shall be randomized by the UMAC
783  * @ftm_rx_chains: Rx chain to open to receive Responder's FTMs (XVT)
784  * @ftm_tx_chains: Tx chain to send the ack to the Responder FTM (XVT)
785  * @common_calib: The common calib value to inject to this measurement calc
786  * @specific_calib: The specific calib value to inject to this measurement calc
787  * @ap: per-AP request data
788  */
789 struct iwl_tof_range_req_cmd_v5 {
790 	__le32 initiator_flags;
791 	u8 request_id;
792 	u8 initiator;
793 	u8 one_sided_los_disable;
794 	u8 req_timeout;
795 	u8 report_policy;
796 	u8 reserved0;
797 	u8 num_of_ap;
798 	u8 macaddr_random;
799 	u8 range_req_bssid[ETH_ALEN];
800 	u8 macaddr_template[ETH_ALEN];
801 	u8 macaddr_mask[ETH_ALEN];
802 	u8 ftm_rx_chains;
803 	u8 ftm_tx_chains;
804 	__le16 common_calib;
805 	__le16 specific_calib;
806 	struct iwl_tof_range_req_ap_entry_v2 ap[IWL_MVM_TOF_MAX_APS];
807 } __packed;
808 /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */
809 
810 /**
811  * struct iwl_tof_range_req_cmd_v7 - start measurement cmd
812  * @initiator_flags: see flags @ iwl_tof_initiator_flags
813  * @request_id: A Token incremented per request. The same Token will be
814  *		sent back in the range response
815  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
816  * @range_req_bssid: ranging request BSSID
817  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
818  *		  Bits set to 1 shall be randomized by the UMAC
819  * @macaddr_template: MAC address template to use for non-randomized bits
820  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
821  *	This is the session time for completing the measurement.
822  * @tsf_mac_id: report the measurement start time for each ap in terms of the
823  *	TSF of this mac id. 0xff to disable TSF reporting.
824  * @common_calib: The common calib value to inject to this measurement calc
825  * @specific_calib: The specific calib value to inject to this measurement calc
826  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
827  */
828 struct iwl_tof_range_req_cmd_v7 {
829 	__le32 initiator_flags;
830 	u8 request_id;
831 	u8 num_of_ap;
832 	u8 range_req_bssid[ETH_ALEN];
833 	u8 macaddr_mask[ETH_ALEN];
834 	u8 macaddr_template[ETH_ALEN];
835 	__le32 req_timeout_ms;
836 	__le32 tsf_mac_id;
837 	__le16 common_calib;
838 	__le16 specific_calib;
839 	struct iwl_tof_range_req_ap_entry_v3 ap[IWL_MVM_TOF_MAX_APS];
840 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_7 */
841 
842 /**
843  * struct iwl_tof_range_req_cmd_v8 - start measurement cmd
844  * @initiator_flags: see flags @ iwl_tof_initiator_flags
845  * @request_id: A Token incremented per request. The same Token will be
846  *		sent back in the range response
847  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
848  * @range_req_bssid: ranging request BSSID
849  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
850  *		  Bits set to 1 shall be randomized by the UMAC
851  * @macaddr_template: MAC address template to use for non-randomized bits
852  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
853  *	This is the session time for completing the measurement.
854  * @tsf_mac_id: report the measurement start time for each ap in terms of the
855  *	TSF of this mac id. 0xff to disable TSF reporting.
856  * @common_calib: The common calib value to inject to this measurement calc
857  * @specific_calib: The specific calib value to inject to this measurement calc
858  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
859  */
860 struct iwl_tof_range_req_cmd_v8 {
861 	__le32 initiator_flags;
862 	u8 request_id;
863 	u8 num_of_ap;
864 	u8 range_req_bssid[ETH_ALEN];
865 	u8 macaddr_mask[ETH_ALEN];
866 	u8 macaddr_template[ETH_ALEN];
867 	__le32 req_timeout_ms;
868 	__le32 tsf_mac_id;
869 	__le16 common_calib;
870 	__le16 specific_calib;
871 	struct iwl_tof_range_req_ap_entry_v4 ap[IWL_MVM_TOF_MAX_APS];
872 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_8 */
873 
874 /**
875  * struct iwl_tof_range_req_cmd_v9 - start measurement cmd
876  * @initiator_flags: see flags @ iwl_tof_initiator_flags
877  * @request_id: A Token incremented per request. The same Token will be
878  *		sent back in the range response
879  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
880  * @range_req_bssid: ranging request BSSID
881  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
882  *		  Bits set to 1 shall be randomized by the UMAC
883  * @macaddr_template: MAC address template to use for non-randomized bits
884  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
885  *	This is the session time for completing the measurement.
886  * @tsf_mac_id: report the measurement start time for each ap in terms of the
887  *	TSF of this mac id. 0xff to disable TSF reporting.
888  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
889  */
890 struct iwl_tof_range_req_cmd_v9 {
891 	__le32 initiator_flags;
892 	u8 request_id;
893 	u8 num_of_ap;
894 	u8 range_req_bssid[ETH_ALEN];
895 	u8 macaddr_mask[ETH_ALEN];
896 	u8 macaddr_template[ETH_ALEN];
897 	__le32 req_timeout_ms;
898 	__le32 tsf_mac_id;
899 	struct iwl_tof_range_req_ap_entry_v6 ap[IWL_MVM_TOF_MAX_APS];
900 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_9 */
901 
902 /**
903  * struct iwl_tof_range_req_cmd_v11 - start measurement cmd
904  * @initiator_flags: see flags @ iwl_tof_initiator_flags
905  * @request_id: A Token incremented per request. The same Token will be
906  *		sent back in the range response
907  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
908  * @range_req_bssid: ranging request BSSID
909  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
910  *		  Bits set to 1 shall be randomized by the UMAC
911  * @macaddr_template: MAC address template to use for non-randomized bits
912  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
913  *	This is the session time for completing the measurement.
914  * @tsf_mac_id: report the measurement start time for each ap in terms of the
915  *	TSF of this mac id. 0xff to disable TSF reporting.
916  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
917  */
918 struct iwl_tof_range_req_cmd_v11 {
919 	__le32 initiator_flags;
920 	u8 request_id;
921 	u8 num_of_ap;
922 	u8 range_req_bssid[ETH_ALEN];
923 	u8 macaddr_mask[ETH_ALEN];
924 	u8 macaddr_template[ETH_ALEN];
925 	__le32 req_timeout_ms;
926 	__le32 tsf_mac_id;
927 	struct iwl_tof_range_req_ap_entry_v7 ap[IWL_MVM_TOF_MAX_APS];
928 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_11 */
929 
930 /*
931  * enum iwl_tof_range_request_status - status of the sent request
932  * @IWL_TOF_RANGE_REQUEST_STATUS_SUCCESSFUL - FW successfully received the
933  *	request
934  * @IWL_TOF_RANGE_REQUEST_STATUS_BUSY - FW is busy with a previous request, the
935  *	sent request will not be handled
936  */
937 enum iwl_tof_range_request_status {
938 	IWL_TOF_RANGE_REQUEST_STATUS_SUCCESS,
939 	IWL_TOF_RANGE_REQUEST_STATUS_BUSY,
940 };
941 
942 /**
943  * enum iwl_tof_entry_status
944  *
945  * @IWL_TOF_ENTRY_SUCCESS: successful measurement.
946  * @IWL_TOF_ENTRY_GENERAL_FAILURE: General failure.
947  * @IWL_TOF_ENTRY_NO_RESPONSE: Responder didn't reply to the request.
948  * @IWL_TOF_ENTRY_REQUEST_REJECTED: Responder rejected the request.
949  * @IWL_TOF_ENTRY_NOT_SCHEDULED: Time event was scheduled but not called yet.
950  * @IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT: Time event triggered but no
951  *	measurement was completed.
952  * @IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE: No range due inability to switch
953  *	from the primary channel.
954  * @IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED: Device doesn't support FTM.
955  * @IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON: Request aborted due to unknown
956  *	reason.
957  * @IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP: Failure due to invalid
958  *	T1/T4.
959  * @IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE: Failure due to invalid FTM frame
960  *	structure.
961  * @IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED: Request cannot be scheduled.
962  * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE: Responder cannot serve the
963  *	initiator for some period, period supplied in @refusal_period.
964  * @IWL_TOF_ENTRY_BAD_REQUEST_ARGS: Bad request arguments.
965  * @IWL_TOF_ENTRY_WIFI_NOT_ENABLED: Wifi not enabled.
966  * @IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS: Responder override the original
967  *	parameters within the current session.
968  */
969 enum iwl_tof_entry_status {
970 	IWL_TOF_ENTRY_SUCCESS = 0,
971 	IWL_TOF_ENTRY_GENERAL_FAILURE = 1,
972 	IWL_TOF_ENTRY_NO_RESPONSE = 2,
973 	IWL_TOF_ENTRY_REQUEST_REJECTED = 3,
974 	IWL_TOF_ENTRY_NOT_SCHEDULED = 4,
975 	IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT = 5,
976 	IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE = 6,
977 	IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED = 7,
978 	IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON = 8,
979 	IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP = 9,
980 	IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE = 10,
981 	IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED = 11,
982 	IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE = 12,
983 	IWL_TOF_ENTRY_BAD_REQUEST_ARGS = 13,
984 	IWL_TOF_ENTRY_WIFI_NOT_ENABLED = 14,
985 	IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS = 15,
986 }; /* LOCATION_RANGE_RSP_AP_ENTRY_NTFY_API_S_VER_2 */
987 
988 /**
989  * struct iwl_tof_range_rsp_ap_entry_ntfy_v3 - AP parameters (response)
990  * @bssid: BSSID of the AP
991  * @measure_status: current APs measurement status, one of
992  *	&enum iwl_tof_entry_status.
993  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
994  * @rtt: The Round Trip Time that took for the last measurement for
995  *	current AP [pSec]
996  * @rtt_variance: The Variance of the RTT values measured for current AP
997  * @rtt_spread: The Difference between the maximum and the minimum RTT
998  *	values measured for current AP in the current session [pSec]
999  * @rssi: RSSI as uploaded in the Channel Estimation notification
1000  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
1001  *	measured for current AP in the current session
1002  * @reserved: reserved
1003  * @refusal_period: refusal period in case of
1004  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
1005  * @range: Measured range [cm]
1006  * @range_variance: Measured range variance [cm]
1007  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
1008  *	uploaded by the LMAC
1009  * @t2t3_initiator: as calculated from the algo in the initiator
1010  * @t1t4_responder: as calculated from the algo in the responder
1011  * @common_calib: Calib val that was used in for this AP measurement
1012  * @specific_calib: val that was used in for this AP measurement
1013  * @papd_calib_output: The result of the tof papd calibration that was injected
1014  *	into the algorithm.
1015  */
1016 struct iwl_tof_range_rsp_ap_entry_ntfy_v3 {
1017 	u8 bssid[ETH_ALEN];
1018 	u8 measure_status;
1019 	u8 measure_bw;
1020 	__le32 rtt;
1021 	__le32 rtt_variance;
1022 	__le32 rtt_spread;
1023 	s8 rssi;
1024 	u8 rssi_spread;
1025 	u8 reserved;
1026 	u8 refusal_period;
1027 	__le32 range;
1028 	__le32 range_variance;
1029 	__le32 timestamp;
1030 	__le32 t2t3_initiator;
1031 	__le32 t1t4_responder;
1032 	__le16 common_calib;
1033 	__le16 specific_calib;
1034 	__le32 papd_calib_output;
1035 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_3 */
1036 
1037 /**
1038  * struct iwl_tof_range_rsp_ap_entry_ntfy_v4 - AP parameters (response)
1039  * @bssid: BSSID of the AP
1040  * @measure_status: current APs measurement status, one of
1041  *	&enum iwl_tof_entry_status.
1042  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
1043  * @rtt: The Round Trip Time that took for the last measurement for
1044  *	current AP [pSec]
1045  * @rtt_variance: The Variance of the RTT values measured for current AP
1046  * @rtt_spread: The Difference between the maximum and the minimum RTT
1047  *	values measured for current AP in the current session [pSec]
1048  * @rssi: RSSI as uploaded in the Channel Estimation notification
1049  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
1050  *	measured for current AP in the current session
1051  * @last_burst: 1 if no more FTM sessions are scheduled for this responder
1052  * @refusal_period: refusal period in case of
1053  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
1054  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
1055  *	uploaded by the LMAC
1056  * @start_tsf: measurement start time in TSF of the mac specified in the range
1057  *	request
1058  * @rx_rate_n_flags: rate and flags of the last FTM frame received from this
1059  *	responder
1060  * @tx_rate_n_flags: rate and flags of the last ack sent to this responder
1061  * @t2t3_initiator: as calculated from the algo in the initiator
1062  * @t1t4_responder: as calculated from the algo in the responder
1063  * @common_calib: Calib val that was used in for this AP measurement
1064  * @specific_calib: val that was used in for this AP measurement
1065  * @papd_calib_output: The result of the tof papd calibration that was injected
1066  *	into the algorithm.
1067  */
1068 struct iwl_tof_range_rsp_ap_entry_ntfy_v4 {
1069 	u8 bssid[ETH_ALEN];
1070 	u8 measure_status;
1071 	u8 measure_bw;
1072 	__le32 rtt;
1073 	__le32 rtt_variance;
1074 	__le32 rtt_spread;
1075 	s8 rssi;
1076 	u8 rssi_spread;
1077 	u8 last_burst;
1078 	u8 refusal_period;
1079 	__le32 timestamp;
1080 	__le32 start_tsf;
1081 	__le32 rx_rate_n_flags;
1082 	__le32 tx_rate_n_flags;
1083 	__le32 t2t3_initiator;
1084 	__le32 t1t4_responder;
1085 	__le16 common_calib;
1086 	__le16 specific_calib;
1087 	__le32 papd_calib_output;
1088 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_4 */
1089 
1090 /**
1091  * struct iwl_tof_range_rsp_ap_entry_ntfy_v5 - AP parameters (response)
1092  * @bssid: BSSID of the AP
1093  * @measure_status: current APs measurement status, one of
1094  *	&enum iwl_tof_entry_status.
1095  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
1096  * @rtt: The Round Trip Time that took for the last measurement for
1097  *	current AP [pSec]
1098  * @rtt_variance: The Variance of the RTT values measured for current AP
1099  * @rtt_spread: The Difference between the maximum and the minimum RTT
1100  *	values measured for current AP in the current session [pSec]
1101  * @rssi: RSSI as uploaded in the Channel Estimation notification
1102  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
1103  *	measured for current AP in the current session
1104  * @last_burst: 1 if no more FTM sessions are scheduled for this responder
1105  * @refusal_period: refusal period in case of
1106  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
1107  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
1108  *	uploaded by the LMAC
1109  * @start_tsf: measurement start time in TSF of the mac specified in the range
1110  *	request
1111  * @rx_rate_n_flags: rate and flags of the last FTM frame received from this
1112  *	responder
1113  * @tx_rate_n_flags: rate and flags of the last ack sent to this responder
1114  * @t2t3_initiator: as calculated from the algo in the initiator
1115  * @t1t4_responder: as calculated from the algo in the responder
1116  * @common_calib: Calib val that was used in for this AP measurement
1117  * @specific_calib: val that was used in for this AP measurement
1118  * @papd_calib_output: The result of the tof papd calibration that was injected
1119  *	into the algorithm.
1120  * @rttConfidence: a value between 0 - 31 that represents the rtt accuracy.
1121  * @reserved: for alignment
1122  */
1123 struct iwl_tof_range_rsp_ap_entry_ntfy_v5 {
1124 	u8 bssid[ETH_ALEN];
1125 	u8 measure_status;
1126 	u8 measure_bw;
1127 	__le32 rtt;
1128 	__le32 rtt_variance;
1129 	__le32 rtt_spread;
1130 	s8 rssi;
1131 	u8 rssi_spread;
1132 	u8 last_burst;
1133 	u8 refusal_period;
1134 	__le32 timestamp;
1135 	__le32 start_tsf;
1136 	__le32 rx_rate_n_flags;
1137 	__le32 tx_rate_n_flags;
1138 	__le32 t2t3_initiator;
1139 	__le32 t1t4_responder;
1140 	__le16 common_calib;
1141 	__le16 specific_calib;
1142 	__le32 papd_calib_output;
1143 	u8 rttConfidence;
1144 	u8 reserved[3];
1145 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_5 */
1146 
1147 /**
1148  * struct iwl_tof_range_rsp_ap_entry_ntfy_v6 - AP parameters (response)
1149  * @bssid: BSSID of the AP
1150  * @measure_status: current APs measurement status, one of
1151  *	&enum iwl_tof_entry_status.
1152  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
1153  * @rtt: The Round Trip Time that took for the last measurement for
1154  *	current AP [pSec]
1155  * @rtt_variance: The Variance of the RTT values measured for current AP
1156  * @rtt_spread: The Difference between the maximum and the minimum RTT
1157  *	values measured for current AP in the current session [pSec]
1158  * @rssi: RSSI as uploaded in the Channel Estimation notification
1159  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
1160  *	measured for current AP in the current session
1161  * @last_burst: 1 if no more FTM sessions are scheduled for this responder
1162  * @refusal_period: refusal period in case of
1163  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
1164  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
1165  *	uploaded by the LMAC
1166  * @start_tsf: measurement start time in TSF of the mac specified in the range
1167  *	request
1168  * @rx_rate_n_flags: rate and flags of the last FTM frame received from this
1169  *	responder
1170  * @tx_rate_n_flags: rate and flags of the last ack sent to this responder
1171  * @t2t3_initiator: as calculated from the algo in the initiator
1172  * @t1t4_responder: as calculated from the algo in the responder
1173  * @common_calib: Calib val that was used in for this AP measurement
1174  * @specific_calib: val that was used in for this AP measurement
1175  * @papd_calib_output: The result of the tof papd calibration that was injected
1176  *	into the algorithm.
1177  * @rttConfidence: a value between 0 - 31 that represents the rtt accuracy.
1178  * @reserved: for alignment
1179  * @rx_pn: the last PN used for this responder Rx in case PMF is configured in
1180  *	LE byte order.
1181  * @tx_pn: the last PN used for this responder Tx in case PMF is configured in
1182  *	LE byte order.
1183  */
1184 struct iwl_tof_range_rsp_ap_entry_ntfy_v6 {
1185 	u8 bssid[ETH_ALEN];
1186 	u8 measure_status;
1187 	u8 measure_bw;
1188 	__le32 rtt;
1189 	__le32 rtt_variance;
1190 	__le32 rtt_spread;
1191 	s8 rssi;
1192 	u8 rssi_spread;
1193 	u8 last_burst;
1194 	u8 refusal_period;
1195 	__le32 timestamp;
1196 	__le32 start_tsf;
1197 	__le32 rx_rate_n_flags;
1198 	__le32 tx_rate_n_flags;
1199 	__le32 t2t3_initiator;
1200 	__le32 t1t4_responder;
1201 	__le16 common_calib;
1202 	__le16 specific_calib;
1203 	__le32 papd_calib_output;
1204 	u8 rttConfidence;
1205 	u8 reserved[3];
1206 	u8 rx_pn[IEEE80211_CCMP_PN_LEN];
1207 	u8 tx_pn[IEEE80211_CCMP_PN_LEN];
1208 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_6 */
1209 
1210 /**
1211  * enum iwl_tof_response_status - tof response status
1212  *
1213  * @IWL_TOF_RESPONSE_SUCCESS: successful range.
1214  * @IWL_TOF_RESPONSE_TIMEOUT: request aborted due to timeout expiration.
1215  *	partial result of ranges done so far is included in the response.
1216  * @IWL_TOF_RESPONSE_ABORTED: Measurement aborted by command.
1217  * @IWL_TOF_RESPONSE_FAILED: Measurement request command failed.
1218  */
1219 enum iwl_tof_response_status {
1220 	IWL_TOF_RESPONSE_SUCCESS = 0,
1221 	IWL_TOF_RESPONSE_TIMEOUT = 1,
1222 	IWL_TOF_RESPONSE_ABORTED = 4,
1223 	IWL_TOF_RESPONSE_FAILED  = 5,
1224 }; /* LOCATION_RNG_RSP_STATUS */
1225 
1226 /**
1227  * struct iwl_tof_range_rsp_ntfy_v5 - ranging response notification
1228  * @request_id: A Token ID of the corresponding Range request
1229  * @request_status: status of current measurement session, one of
1230  *	&enum iwl_tof_response_status.
1231  * @last_in_batch: reprot policy (when not all responses are uploaded at once)
1232  * @num_of_aps: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1233  * @ap: per-AP data
1234  */
1235 struct iwl_tof_range_rsp_ntfy_v5 {
1236 	u8 request_id;
1237 	u8 request_status;
1238 	u8 last_in_batch;
1239 	u8 num_of_aps;
1240 	struct iwl_tof_range_rsp_ap_entry_ntfy_v3 ap[IWL_MVM_TOF_MAX_APS];
1241 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_5 */
1242 
1243 /**
1244  * struct iwl_tof_range_rsp_ntfy_v6 - ranging response notification
1245  * @request_id: A Token ID of the corresponding Range request
1246  * @num_of_aps: Number of APs results
1247  * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
1248  * @reserved: reserved
1249  * @ap: per-AP data
1250  */
1251 struct iwl_tof_range_rsp_ntfy_v6 {
1252 	u8 request_id;
1253 	u8 num_of_aps;
1254 	u8 last_report;
1255 	u8 reserved;
1256 	struct iwl_tof_range_rsp_ap_entry_ntfy_v4 ap[IWL_MVM_TOF_MAX_APS];
1257 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_6 */
1258 
1259 /**
1260  * struct iwl_tof_range_rsp_ntfy_v7 - ranging response notification
1261  * @request_id: A Token ID of the corresponding Range request
1262  * @num_of_aps: Number of APs results
1263  * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
1264  * @reserved: reserved
1265  * @ap: per-AP data
1266  */
1267 struct iwl_tof_range_rsp_ntfy_v7 {
1268 	u8 request_id;
1269 	u8 num_of_aps;
1270 	u8 last_report;
1271 	u8 reserved;
1272 	struct iwl_tof_range_rsp_ap_entry_ntfy_v5 ap[IWL_MVM_TOF_MAX_APS];
1273 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_7 */
1274 
1275 /**
1276  * struct iwl_tof_range_rsp_ntfy_v8 - ranging response notification
1277  * @request_id: A Token ID of the corresponding Range request
1278  * @num_of_aps: Number of APs results
1279  * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
1280  * @reserved: reserved
1281  * @ap: per-AP data
1282  */
1283 struct iwl_tof_range_rsp_ntfy_v8 {
1284 	u8 request_id;
1285 	u8 num_of_aps;
1286 	u8 last_report;
1287 	u8 reserved;
1288 	struct iwl_tof_range_rsp_ap_entry_ntfy_v6 ap[IWL_MVM_TOF_MAX_APS];
1289 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_8 */
1290 
1291 #define IWL_MVM_TOF_MCSI_BUF_SIZE  (245)
1292 /**
1293  * struct iwl_tof_mcsi_notif - used for debug
1294  * @token: token ID for the current session
1295  * @role: '0' - initiator, '1' - responder
1296  * @reserved: reserved
1297  * @initiator_bssid: initiator machine
1298  * @responder_bssid: responder machine
1299  * @mcsi_buffer: debug data
1300  */
1301 struct iwl_tof_mcsi_notif {
1302 	u8 token;
1303 	u8 role;
1304 	__le16 reserved;
1305 	u8 initiator_bssid[ETH_ALEN];
1306 	u8 responder_bssid[ETH_ALEN];
1307 	u8 mcsi_buffer[IWL_MVM_TOF_MCSI_BUF_SIZE * 4];
1308 } __packed;
1309 
1310 /**
1311  * struct iwl_tof_range_abort_cmd
1312  * @request_id: corresponds to a range request
1313  * @reserved: reserved
1314  */
1315 struct iwl_tof_range_abort_cmd {
1316 	u8 request_id;
1317 	u8 reserved[3];
1318 } __packed;
1319 
1320 enum ftm_responder_stats_flags {
1321 	FTM_RESP_STAT_NON_ASAP_STARTED = BIT(0),
1322 	FTM_RESP_STAT_NON_ASAP_IN_WIN = BIT(1),
1323 	FTM_RESP_STAT_NON_ASAP_OUT_WIN = BIT(2),
1324 	FTM_RESP_STAT_TRIGGER_DUP = BIT(3),
1325 	FTM_RESP_STAT_DUP = BIT(4),
1326 	FTM_RESP_STAT_DUP_IN_WIN = BIT(5),
1327 	FTM_RESP_STAT_DUP_OUT_WIN = BIT(6),
1328 	FTM_RESP_STAT_SCHED_SUCCESS = BIT(7),
1329 	FTM_RESP_STAT_ASAP_REQ = BIT(8),
1330 	FTM_RESP_STAT_NON_ASAP_REQ = BIT(9),
1331 	FTM_RESP_STAT_ASAP_RESP = BIT(10),
1332 	FTM_RESP_STAT_NON_ASAP_RESP = BIT(11),
1333 	FTM_RESP_STAT_FAIL_INITIATOR_INACTIVE = BIT(12),
1334 	FTM_RESP_STAT_FAIL_INITIATOR_OUT_WIN = BIT(13),
1335 	FTM_RESP_STAT_FAIL_INITIATOR_RETRY_LIM = BIT(14),
1336 	FTM_RESP_STAT_FAIL_NEXT_SERVED = BIT(15),
1337 	FTM_RESP_STAT_FAIL_TRIGGER_ERR = BIT(16),
1338 	FTM_RESP_STAT_FAIL_GC = BIT(17),
1339 	FTM_RESP_STAT_SUCCESS = BIT(18),
1340 	FTM_RESP_STAT_INTEL_IE = BIT(19),
1341 	FTM_RESP_STAT_INITIATOR_ACTIVE = BIT(20),
1342 	FTM_RESP_STAT_MEASUREMENTS_AVAILABLE = BIT(21),
1343 	FTM_RESP_STAT_TRIGGER_UNKNOWN = BIT(22),
1344 	FTM_RESP_STAT_PROCESS_FAIL = BIT(23),
1345 	FTM_RESP_STAT_ACK = BIT(24),
1346 	FTM_RESP_STAT_NACK = BIT(25),
1347 	FTM_RESP_STAT_INVALID_INITIATOR_ID = BIT(26),
1348 	FTM_RESP_STAT_TIMER_MIN_DELTA = BIT(27),
1349 	FTM_RESP_STAT_INITIATOR_REMOVED = BIT(28),
1350 	FTM_RESP_STAT_INITIATOR_ADDED = BIT(29),
1351 	FTM_RESP_STAT_ERR_LIST_FULL = BIT(30),
1352 	FTM_RESP_STAT_INITIATOR_SCHED_NOW = BIT(31),
1353 }; /* RESP_IND_E */
1354 
1355 /**
1356  * struct iwl_ftm_responder_stats - FTM responder statistics
1357  * @addr: initiator address
1358  * @success_ftm: number of successful ftm frames
1359  * @ftm_per_burst: num of FTM frames that were received
1360  * @flags: &enum ftm_responder_stats_flags
1361  * @duration: actual duration of FTM
1362  * @allocated_duration: time that was allocated for this FTM session
1363  * @bw: FTM request bandwidth
1364  * @rate: FTM request rate
1365  * @reserved: for alingment and future use
1366  */
1367 struct iwl_ftm_responder_stats {
1368 	u8 addr[ETH_ALEN];
1369 	u8 success_ftm;
1370 	u8 ftm_per_burst;
1371 	__le32 flags;
1372 	__le32 duration;
1373 	__le32 allocated_duration;
1374 	u8 bw;
1375 	u8 rate;
1376 	__le16 reserved;
1377 } __packed; /* TOF_RESPONDER_STATISTICS_NTFY_S_VER_2 */
1378 
1379 #define IWL_CSI_MAX_EXPECTED_CHUNKS		16
1380 
1381 #define IWL_CSI_CHUNK_CTL_NUM_MASK_VER_1	0x0003
1382 #define IWL_CSI_CHUNK_CTL_IDX_MASK_VER_1	0x000c
1383 
1384 #define IWL_CSI_CHUNK_CTL_NUM_MASK_VER_2	0x00ff
1385 #define IWL_CSI_CHUNK_CTL_IDX_MASK_VER_2	0xff00
1386 
1387 struct iwl_csi_chunk_notification {
1388 	__le32 token;
1389 	__le16 seq;
1390 	__le16 ctl;
1391 	__le32 size;
1392 	u8 data[];
1393 } __packed; /* CSI_CHUNKS_HDR_NTFY_API_S_VER_1/VER_2 */
1394 
1395 #endif /* __iwl_fw_api_location_h__ */
1396