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 Intel Corporation
10  * Copyright (C) 2019 Intel Corporation
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of version 2 of the GNU General Public License as
14  * published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * General Public License for more details.
20  *
21  * The full GNU General Public License is included in this distribution
22  * in the file called COPYING.
23  *
24  * Contact Information:
25  * Intel Linux Wireless <linuxwifi@intel.com>
26  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27  *
28  * BSD LICENSE
29  *
30  * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
31  * Copyright (C) 2018 Intel Corporation
32  * Copyright (C) 2019 Intel Corporation
33  * All rights reserved.
34  *
35  * Redistribution and use in source and binary forms, with or without
36  * modification, are permitted provided that the following conditions
37  * are met:
38  *
39  *  * Redistributions of source code must retain the above copyright
40  *    notice, this list of conditions and the following disclaimer.
41  *  * Redistributions in binary form must reproduce the above copyright
42  *    notice, this list of conditions and the following disclaimer in
43  *    the documentation and/or other materials provided with the
44  *    distribution.
45  *  * Neither the name Intel Corporation nor the names of its
46  *    contributors may be used to endorse or promote products derived
47  *    from this software without specific prior written permission.
48  *
49  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
52  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
53  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
54  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
55  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
57  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
59  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60  *
61  *****************************************************************************/
62 #ifndef __iwl_fw_api_location_h__
63 #define __iwl_fw_api_location_h__
64 
65 /**
66  * enum iwl_location_subcmd_ids - location group command IDs
67  */
68 enum iwl_location_subcmd_ids {
69 	/**
70 	 * @TOF_RANGE_REQ_CMD: TOF ranging request,
71 	 *	uses &struct iwl_tof_range_req_cmd
72 	 */
73 	TOF_RANGE_REQ_CMD = 0x0,
74 	/**
75 	 * @TOF_CONFIG_CMD: TOF configuration, uses &struct iwl_tof_config_cmd
76 	 */
77 	TOF_CONFIG_CMD = 0x1,
78 	/**
79 	 * @TOF_RANGE_ABORT_CMD: abort ongoing ranging, uses
80 	 *	&struct iwl_tof_range_abort_cmd
81 	 */
82 	TOF_RANGE_ABORT_CMD = 0x2,
83 	/**
84 	 * @TOF_RANGE_REQ_EXT_CMD: TOF extended ranging config,
85 	 *	uses &struct iwl_tof_range_request_ext_cmd
86 	 */
87 	TOF_RANGE_REQ_EXT_CMD = 0x3,
88 	/**
89 	 * @TOF_RESPONDER_CONFIG_CMD: FTM responder configuration,
90 	 *	uses &struct iwl_tof_responder_config_cmd
91 	 */
92 	TOF_RESPONDER_CONFIG_CMD = 0x4,
93 	/**
94 	 * @TOF_RESPONDER_DYN_CONFIG_CMD: FTM dynamic configuration,
95 	 *	uses &struct iwl_tof_responder_dyn_config_cmd
96 	 */
97 	TOF_RESPONDER_DYN_CONFIG_CMD = 0x5,
98 	/**
99 	 * @CSI_HEADER_NOTIFICATION: CSI header
100 	 */
101 	CSI_HEADER_NOTIFICATION = 0xFA,
102 	/**
103 	 * @CSI_CHUNKS_NOTIFICATION: CSI chunk,
104 	 *	uses &struct iwl_csi_chunk_notification
105 	 */
106 	CSI_CHUNKS_NOTIFICATION = 0xFB,
107 	/**
108 	 * @TOF_LC_NOTIF: used for LCI/civic location, contains just
109 	 *	the action frame
110 	 */
111 	TOF_LC_NOTIF = 0xFC,
112 	/**
113 	 * @TOF_RESPONDER_STATS: FTM responder statistics notification,
114 	 *	uses &struct iwl_ftm_responder_stats
115 	 */
116 	TOF_RESPONDER_STATS = 0xFD,
117 	/**
118 	 * @TOF_MCSI_DEBUG_NOTIF: MCSI debug notification, uses
119 	 *	&struct iwl_tof_mcsi_notif
120 	 */
121 	TOF_MCSI_DEBUG_NOTIF = 0xFE,
122 	/**
123 	 * @TOF_RANGE_RESPONSE_NOTIF: ranging response, using
124 	 *	&struct iwl_tof_range_rsp_ntfy
125 	 */
126 	TOF_RANGE_RESPONSE_NOTIF = 0xFF,
127 };
128 
129 /**
130  * struct iwl_tof_config_cmd - ToF configuration
131  * @tof_disabled: indicates if ToF is disabled (or not)
132  * @one_sided_disabled: indicates if one-sided is disabled (or not)
133  * @is_debug_mode: indiciates if debug mode is active
134  * @is_buf_required: indicates if channel estimation buffer is required
135  */
136 struct iwl_tof_config_cmd {
137 	u8 tof_disabled;
138 	u8 one_sided_disabled;
139 	u8 is_debug_mode;
140 	u8 is_buf_required;
141 } __packed;
142 
143 /**
144  * enum iwl_tof_bandwidth - values for iwl_tof_range_req_ap_entry.bandwidth
145  * @IWL_TOF_BW_20_LEGACY: 20 MHz non-HT
146  * @IWL_TOF_BW_20_HT: 20 MHz HT
147  * @IWL_TOF_BW_40: 40 MHz
148  * @IWL_TOF_BW_80: 80 MHz
149  * @IWL_TOF_BW_160: 160 MHz
150  */
151 enum iwl_tof_bandwidth {
152 	IWL_TOF_BW_20_LEGACY,
153 	IWL_TOF_BW_20_HT,
154 	IWL_TOF_BW_40,
155 	IWL_TOF_BW_80,
156 	IWL_TOF_BW_160,
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 - 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 {
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 #define IWL_LCI_CIVIC_IE_MAX_SIZE	400
278 
279 /**
280  * struct iwl_tof_responder_dyn_config_cmd - Dynamic responder settings
281  * @lci_len: The length of the 1st (LCI) part in the @lci_civic buffer
282  * @civic_len: The length of the 2nd (CIVIC) part in the @lci_civic buffer
283  * @lci_civic: The LCI/CIVIC buffer. LCI data (if exists) comes first, then, if
284  *	needed, 0-padding such that the next part is dword-aligned, then CIVIC
285  *	data (if exists) follows, and then 0-padding again to complete a
286  *	4-multiple long buffer.
287  */
288 struct iwl_tof_responder_dyn_config_cmd {
289 	__le32 lci_len;
290 	__le32 civic_len;
291 	u8 lci_civic[];
292 } __packed; /* TOF_RESPONDER_DYN_CONFIG_CMD_API_S_VER_2 */
293 
294 /**
295  * struct iwl_tof_range_request_ext_cmd - extended range req for WLS
296  * @tsf_timer_offset_msec: the recommended time offset (mSec) from the AP's TSF
297  * @reserved: reserved
298  * @min_delta_ftm: Minimal time between two consecutive measurements,
299  *		   in units of 100us. 0 means no preference by station
300  * @ftm_format_and_bw20M: FTM Channel Spacing/Format for 20MHz: recommended
301  *			value be sent to the AP
302  * @ftm_format_and_bw40M: FTM Channel Spacing/Format for 40MHz: recommended
303  *			value to be sent to the AP
304  * @ftm_format_and_bw80M: FTM Channel Spacing/Format for 80MHz: recommended
305  *			value to be sent to the AP
306  */
307 struct iwl_tof_range_req_ext_cmd {
308 	__le16 tsf_timer_offset_msec;
309 	__le16 reserved;
310 	u8 min_delta_ftm;
311 	u8 ftm_format_and_bw20M;
312 	u8 ftm_format_and_bw40M;
313 	u8 ftm_format_and_bw80M;
314 } __packed;
315 
316 /**
317  * enum iwl_tof_location_query - values for query bitmap
318  * @IWL_TOF_LOC_LCI: query LCI
319  * @IWL_TOF_LOC_CIVIC: query civic
320  */
321 enum iwl_tof_location_query {
322 	IWL_TOF_LOC_LCI = 0x01,
323 	IWL_TOF_LOC_CIVIC = 0x02,
324 };
325 
326  /**
327  * struct iwl_tof_range_req_ap_entry_v2 - AP configuration parameters
328  * @channel_num: Current AP Channel
329  * @bandwidth: Current AP Bandwidth. One of iwl_tof_bandwidth.
330  * @tsf_delta_direction: TSF relatively to the subject AP
331  * @ctrl_ch_position: Coding of the control channel position relative to the
332  *	center frequency, see iwl_mvm_get_ctrl_pos().
333  * @bssid: AP's BSSID
334  * @measure_type: Measurement type: 0 - two sided, 1 - One sided
335  * @num_of_bursts: Recommended value to be sent to the AP.  2s Exponent of the
336  *	number of measurement iterations (min 2^0 = 1, max 2^14)
337  * @burst_period: Recommended value to be sent to the AP. Measurement
338  *	periodicity In units of 100ms. ignored if num_of_bursts = 0
339  * @samples_per_burst: 2-sided: the number of FTMs pairs in single Burst (1-31);
340  *	1-sided: how many rts/cts pairs should be used per burst.
341  * @retries_per_sample: Max number of retries that the LMAC should send
342  *	in case of no replies by the AP.
343  * @tsf_delta: TSF Delta in units of microseconds.
344  *	The difference between the AP TSF and the device local clock.
345  * @location_req: Location Request Bit[0] LCI should be sent in the FTMR;
346  *	Bit[1] Civic should be sent in the FTMR
347  * @asap_mode: 0 - non asap mode, 1 - asap mode (not relevant for one sided)
348  * @enable_dyn_ack: Enable Dynamic ACK BW.
349  *	0: Initiator interact with regular AP;
350  *	1: Initiator interact with Responder machine: need to send the
351  *	Initiator Acks with HT 40MHz / 80MHz, since the Responder should
352  *	use it for its ch est measurement (this flag will be set when we
353  *	configure the opposite machine to be Responder).
354  * @rssi: Last received value
355  *	legal values: -128-0 (0x7f). above 0x0 indicating an invalid value.
356  * @algo_type: &enum iwl_tof_algo_type
357  * @notify_mcsi: &enum iwl_tof_mcsi_ntfy.
358  * @reserved: For alignment and future use
359  */
360 struct iwl_tof_range_req_ap_entry_v2 {
361 	u8 channel_num;
362 	u8 bandwidth;
363 	u8 tsf_delta_direction;
364 	u8 ctrl_ch_position;
365 	u8 bssid[ETH_ALEN];
366 	u8 measure_type;
367 	u8 num_of_bursts;
368 	__le16 burst_period;
369 	u8 samples_per_burst;
370 	u8 retries_per_sample;
371 	__le32 tsf_delta;
372 	u8 location_req;
373 	u8 asap_mode;
374 	u8 enable_dyn_ack;
375 	s8 rssi;
376 	u8 algo_type;
377 	u8 notify_mcsi;
378 	__le16 reserved;
379 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_2 */
380 
381 /**
382  * enum iwl_initiator_ap_flags - per responder FTM configuration flags
383  * @IWL_INITIATOR_AP_FLAGS_ASAP: Request for ASAP measurement.
384  * @IWL_INITIATOR_AP_FLAGS_LCI_REQUEST: Request for LCI information
385  * @IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST: Request for CIVIC information
386  * @IWL_INITIATOR_AP_FLAGS_DYN_ACK: Send HT/VHT ack for FTM frames. If not set,
387  *	20Mhz dup acks will be sent.
388  * @IWL_INITIATOR_AP_FLAGS_ALGO_LR: Use LR algo type for rtt calculation.
389  *	Default algo type is ML.
390  * @IWL_INITIATOR_AP_FLAGS_ALGO_FFT: Use FFT algo type for rtt calculation.
391  *	Default algo type is ML.
392  * @IWL_INITIATOR_AP_FLAGS_MCSI_REPORT: Send the MCSI for each FTM frame to the
393  *	driver.
394  */
395 enum iwl_initiator_ap_flags {
396 	IWL_INITIATOR_AP_FLAGS_ASAP = BIT(1),
397 	IWL_INITIATOR_AP_FLAGS_LCI_REQUEST = BIT(2),
398 	IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST = BIT(3),
399 	IWL_INITIATOR_AP_FLAGS_DYN_ACK = BIT(4),
400 	IWL_INITIATOR_AP_FLAGS_ALGO_LR = BIT(5),
401 	IWL_INITIATOR_AP_FLAGS_ALGO_FFT = BIT(6),
402 	IWL_INITIATOR_AP_FLAGS_MCSI_REPORT = BIT(8),
403 };
404 
405 /**
406  * struct iwl_tof_range_req_ap_entry - AP configuration parameters
407  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
408  * @channel_num: AP Channel number
409  * @bandwidth: AP bandwidth. One of iwl_tof_bandwidth.
410  * @ctrl_ch_position: Coding of the control channel position relative to the
411  *	center frequency, see iwl_mvm_get_ctrl_pos().
412  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
413  *	reply from the AP.
414  * @bssid: AP's BSSID
415  * @burst_period: Recommended value to be sent to the AP. Measurement
416  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
417  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
418  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
419  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
420  * @reserved: For alignment and future use
421  * @tsf_delta: not in use
422  */
423 struct iwl_tof_range_req_ap_entry {
424 	__le32 initiator_ap_flags;
425 	u8 channel_num;
426 	u8 bandwidth;
427 	u8 ctrl_ch_position;
428 	u8 ftmr_max_retries;
429 	u8 bssid[ETH_ALEN];
430 	__le16 burst_period;
431 	u8 samples_per_burst;
432 	u8 num_of_bursts;
433 	__le16 reserved;
434 	__le32 tsf_delta;
435 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_3 */
436 
437 /**
438  * enum iwl_tof_response_mode
439  * @IWL_MVM_TOF_RESPONSE_ASAP: report each AP measurement separately as soon as
440  *			       possible (not supported for this release)
441  * @IWL_MVM_TOF_RESPONSE_TIMEOUT: report all AP measurements as a batch upon
442  *				  timeout expiration
443  * @IWL_MVM_TOF_RESPONSE_COMPLETE: report all AP measurements as a batch at the
444  *				   earlier of: measurements completion / timeout
445  *				   expiration.
446  */
447 enum iwl_tof_response_mode {
448 	IWL_MVM_TOF_RESPONSE_ASAP,
449 	IWL_MVM_TOF_RESPONSE_TIMEOUT,
450 	IWL_MVM_TOF_RESPONSE_COMPLETE,
451 };
452 
453 /**
454  * enum iwl_tof_initiator_flags
455  *
456  * @IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED: disable fast algo, meaning run
457  *	the algo on ant A+B, instead of only one of them.
458  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A: open RX antenna A for FTMs RX
459  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B: open RX antenna B for FTMs RX
460  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C: open RX antenna C for FTMs RX
461  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A: use antenna A fo TX ACKs during FTM
462  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B: use antenna B fo TX ACKs during FTM
463  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C: use antenna C fo TX ACKs during FTM
464  * @IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM: use random mac address for FTM
465  * @IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB: use the specific calib value from
466  *	the range request command
467  * @IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB: use the common calib value from the
468  *	ragne request command
469  * @IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT: support non-asap measurements
470  */
471 enum iwl_tof_initiator_flags {
472 	IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED = BIT(0),
473 	IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A = BIT(1),
474 	IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B = BIT(2),
475 	IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C = BIT(3),
476 	IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A = BIT(4),
477 	IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B = BIT(5),
478 	IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C = BIT(6),
479 	IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM = BIT(7),
480 	IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB = BIT(15),
481 	IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB   = BIT(16),
482 	IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT = BIT(20),
483 }; /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */
484 
485 #define IWL_MVM_TOF_MAX_APS 5
486 #define IWL_MVM_TOF_MAX_TWO_SIDED_APS 5
487 
488 /**
489  * struct iwl_tof_range_req_cmd_v5 - start measurement cmd
490  * @initiator_flags: see flags @ iwl_tof_initiator_flags
491  * @request_id: A Token incremented per request. The same Token will be
492  *		sent back in the range response
493  * @initiator: 0- NW initiated,  1 - Client Initiated
494  * @one_sided_los_disable: '0'- run ML-Algo for both ToF/OneSided,
495  *			   '1' - run ML-Algo for ToF only
496  * @req_timeout: Requested timeout of the response in units of 100ms.
497  *	     This is equivalent to the session time configured to the
498  *	     LMAC in Initiator Request
499  * @report_policy: Supported partially for this release: For current release -
500  *		   the range report will be uploaded as a batch when ready or
501  *		   when the session is done (successfully / partially).
502  *		   one of iwl_tof_response_mode.
503  * @reserved0: reserved
504  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
505  * @macaddr_random: '0' Use default source MAC address (i.e. p2_p),
506  *	            '1' Use MAC Address randomization according to the below
507  * @range_req_bssid: ranging request BSSID
508  * @macaddr_template: MAC address template to use for non-randomized bits
509  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
510  *		  Bits set to 1 shall be randomized by the UMAC
511  * @ftm_rx_chains: Rx chain to open to receive Responder's FTMs (XVT)
512  * @ftm_tx_chains: Tx chain to send the ack to the Responder FTM (XVT)
513  * @common_calib: The common calib value to inject to this measurement calc
514  * @specific_calib: The specific calib value to inject to this measurement calc
515  * @ap: per-AP request data
516  */
517 struct iwl_tof_range_req_cmd_v5 {
518 	__le32 initiator_flags;
519 	u8 request_id;
520 	u8 initiator;
521 	u8 one_sided_los_disable;
522 	u8 req_timeout;
523 	u8 report_policy;
524 	u8 reserved0;
525 	u8 num_of_ap;
526 	u8 macaddr_random;
527 	u8 range_req_bssid[ETH_ALEN];
528 	u8 macaddr_template[ETH_ALEN];
529 	u8 macaddr_mask[ETH_ALEN];
530 	u8 ftm_rx_chains;
531 	u8 ftm_tx_chains;
532 	__le16 common_calib;
533 	__le16 specific_calib;
534 	struct iwl_tof_range_req_ap_entry_v2 ap[IWL_MVM_TOF_MAX_APS];
535 } __packed;
536 /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */
537 
538 /**
539  * struct iwl_tof_range_req_cmd - start measurement cmd
540  * @initiator_flags: see flags @ iwl_tof_initiator_flags
541  * @request_id: A Token incremented per request. The same Token will be
542  *		sent back in the range response
543  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
544  * @range_req_bssid: ranging request BSSID
545  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
546  *		  Bits set to 1 shall be randomized by the UMAC
547  * @macaddr_template: MAC address template to use for non-randomized bits
548  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
549  *	This is the session time for completing the measurement.
550  * @tsf_mac_id: report the measurement start time for each ap in terms of the
551  *	TSF of this mac id. 0xff to disable TSF reporting.
552  * @common_calib: The common calib value to inject to this measurement calc
553  * @specific_calib: The specific calib value to inject to this measurement calc
554  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
555  */
556 struct iwl_tof_range_req_cmd {
557 	__le32 initiator_flags;
558 	u8 request_id;
559 	u8 num_of_ap;
560 	u8 range_req_bssid[ETH_ALEN];
561 	u8 macaddr_mask[ETH_ALEN];
562 	u8 macaddr_template[ETH_ALEN];
563 	__le32 req_timeout_ms;
564 	__le32 tsf_mac_id;
565 	__le16 common_calib;
566 	__le16 specific_calib;
567 	struct iwl_tof_range_req_ap_entry ap[IWL_MVM_TOF_MAX_APS];
568 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_7 */
569 
570 /*
571  * enum iwl_tof_range_request_status - status of the sent request
572  * @IWL_TOF_RANGE_REQUEST_STATUS_SUCCESSFUL - FW successfully received the
573  *	request
574  * @IWL_TOF_RANGE_REQUEST_STATUS_BUSY - FW is busy with a previous request, the
575  *	sent request will not be handled
576  */
577 enum iwl_tof_range_request_status {
578 	IWL_TOF_RANGE_REQUEST_STATUS_SUCCESS,
579 	IWL_TOF_RANGE_REQUEST_STATUS_BUSY,
580 };
581 
582 /**
583  * enum iwl_tof_entry_status
584  *
585  * @IWL_TOF_ENTRY_SUCCESS: successful measurement.
586  * @IWL_TOF_ENTRY_GENERAL_FAILURE: General failure.
587  * @IWL_TOF_ENTRY_NO_RESPONSE: Responder didn't reply to the request.
588  * @IWL_TOF_ENTRY_REQUEST_REJECTED: Responder rejected the request.
589  * @IWL_TOF_ENTRY_NOT_SCHEDULED: Time event was scheduled but not called yet.
590  * @IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT: Time event triggered but no
591  *	measurement was completed.
592  * @IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE: No range due inability to switch
593  *	from the primary channel.
594  * @IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED: Device doesn't support FTM.
595  * @IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON: Request aborted due to unknown
596  *	reason.
597  * @IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP: Failure due to invalid
598  *	T1/T4.
599  * @IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE: Failure due to invalid FTM frame
600  *	structure.
601  * @IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED: Request cannot be scheduled.
602  * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE: Responder cannot serve the
603  *	initiator for some period, period supplied in @refusal_period.
604  * @IWL_TOF_ENTRY_BAD_REQUEST_ARGS: Bad request arguments.
605  * @IWL_TOF_ENTRY_WIFI_NOT_ENABLED: Wifi not enabled.
606  * @IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS: Responder override the original
607  *	parameters within the current session.
608  */
609 enum iwl_tof_entry_status {
610 	IWL_TOF_ENTRY_SUCCESS = 0,
611 	IWL_TOF_ENTRY_GENERAL_FAILURE = 1,
612 	IWL_TOF_ENTRY_NO_RESPONSE = 2,
613 	IWL_TOF_ENTRY_REQUEST_REJECTED = 3,
614 	IWL_TOF_ENTRY_NOT_SCHEDULED = 4,
615 	IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT = 5,
616 	IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE = 6,
617 	IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED = 7,
618 	IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON = 8,
619 	IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP = 9,
620 	IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE = 10,
621 	IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED = 11,
622 	IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE = 12,
623 	IWL_TOF_ENTRY_BAD_REQUEST_ARGS = 13,
624 	IWL_TOF_ENTRY_WIFI_NOT_ENABLED = 14,
625 	IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS = 15,
626 }; /* LOCATION_RANGE_RSP_AP_ENTRY_NTFY_API_S_VER_2 */
627 
628 /**
629  * struct iwl_tof_range_rsp_ap_entry_ntfy_v3 - AP parameters (response)
630  * @bssid: BSSID of the AP
631  * @measure_status: current APs measurement status, one of
632  *	&enum iwl_tof_entry_status.
633  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
634  * @rtt: The Round Trip Time that took for the last measurement for
635  *	current AP [pSec]
636  * @rtt_variance: The Variance of the RTT values measured for current AP
637  * @rtt_spread: The Difference between the maximum and the minimum RTT
638  *	values measured for current AP in the current session [pSec]
639  * @rssi: RSSI as uploaded in the Channel Estimation notification
640  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
641  *	measured for current AP in the current session
642  * @reserved: reserved
643  * @refusal_period: refusal period in case of
644  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
645  * @range: Measured range [cm]
646  * @range_variance: Measured range variance [cm]
647  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
648  *	uploaded by the LMAC
649  * @t2t3_initiator: as calculated from the algo in the initiator
650  * @t1t4_responder: as calculated from the algo in the responder
651  * @common_calib: Calib val that was used in for this AP measurement
652  * @specific_calib: val that was used in for this AP measurement
653  * @papd_calib_output: The result of the tof papd calibration that was injected
654  *	into the algorithm.
655  */
656 struct iwl_tof_range_rsp_ap_entry_ntfy_v3 {
657 	u8 bssid[ETH_ALEN];
658 	u8 measure_status;
659 	u8 measure_bw;
660 	__le32 rtt;
661 	__le32 rtt_variance;
662 	__le32 rtt_spread;
663 	s8 rssi;
664 	u8 rssi_spread;
665 	u8 reserved;
666 	u8 refusal_period;
667 	__le32 range;
668 	__le32 range_variance;
669 	__le32 timestamp;
670 	__le32 t2t3_initiator;
671 	__le32 t1t4_responder;
672 	__le16 common_calib;
673 	__le16 specific_calib;
674 	__le32 papd_calib_output;
675 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_3 */
676 
677 /**
678  * struct iwl_tof_range_rsp_ap_entry_ntfy_v4 - AP parameters (response)
679  * @bssid: BSSID of the AP
680  * @measure_status: current APs measurement status, one of
681  *	&enum iwl_tof_entry_status.
682  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
683  * @rtt: The Round Trip Time that took for the last measurement for
684  *	current AP [pSec]
685  * @rtt_variance: The Variance of the RTT values measured for current AP
686  * @rtt_spread: The Difference between the maximum and the minimum RTT
687  *	values measured for current AP in the current session [pSec]
688  * @rssi: RSSI as uploaded in the Channel Estimation notification
689  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
690  *	measured for current AP in the current session
691  * @last_burst: 1 if no more FTM sessions are scheduled for this responder
692  * @refusal_period: refusal period in case of
693  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
694  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
695  *	uploaded by the LMAC
696  * @start_tsf: measurement start time in TSF of the mac specified in the range
697  *	request
698  * @rx_rate_n_flags: rate and flags of the last FTM frame received from this
699  *	responder
700  * @tx_rate_n_flags: rate and flags of the last ack sent to this responder
701  * @t2t3_initiator: as calculated from the algo in the initiator
702  * @t1t4_responder: as calculated from the algo in the responder
703  * @common_calib: Calib val that was used in for this AP measurement
704  * @specific_calib: val that was used in for this AP measurement
705  * @papd_calib_output: The result of the tof papd calibration that was injected
706  *	into the algorithm.
707  */
708 struct iwl_tof_range_rsp_ap_entry_ntfy_v4 {
709 	u8 bssid[ETH_ALEN];
710 	u8 measure_status;
711 	u8 measure_bw;
712 	__le32 rtt;
713 	__le32 rtt_variance;
714 	__le32 rtt_spread;
715 	s8 rssi;
716 	u8 rssi_spread;
717 	u8 last_burst;
718 	u8 refusal_period;
719 	__le32 timestamp;
720 	__le32 start_tsf;
721 	__le32 rx_rate_n_flags;
722 	__le32 tx_rate_n_flags;
723 	__le32 t2t3_initiator;
724 	__le32 t1t4_responder;
725 	__le16 common_calib;
726 	__le16 specific_calib;
727 	__le32 papd_calib_output;
728 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_4 */
729 
730 /**
731  * struct iwl_tof_range_rsp_ap_entry_ntfy - AP parameters (response)
732  * @bssid: BSSID of the AP
733  * @measure_status: current APs measurement status, one of
734  *	&enum iwl_tof_entry_status.
735  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
736  * @rtt: The Round Trip Time that took for the last measurement for
737  *	current AP [pSec]
738  * @rtt_variance: The Variance of the RTT values measured for current AP
739  * @rtt_spread: The Difference between the maximum and the minimum RTT
740  *	values measured for current AP in the current session [pSec]
741  * @rssi: RSSI as uploaded in the Channel Estimation notification
742  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
743  *	measured for current AP in the current session
744  * @last_burst: 1 if no more FTM sessions are scheduled for this responder
745  * @refusal_period: refusal period in case of
746  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
747  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
748  *	uploaded by the LMAC
749  * @start_tsf: measurement start time in TSF of the mac specified in the range
750  *	request
751  * @rx_rate_n_flags: rate and flags of the last FTM frame received from this
752  *	responder
753  * @tx_rate_n_flags: rate and flags of the last ack sent to this responder
754  * @t2t3_initiator: as calculated from the algo in the initiator
755  * @t1t4_responder: as calculated from the algo in the responder
756  * @common_calib: Calib val that was used in for this AP measurement
757  * @specific_calib: val that was used in for this AP measurement
758  * @papd_calib_output: The result of the tof papd calibration that was injected
759  *	into the algorithm.
760  * @rttConfidence: a value between 0 - 31 that represents the rtt accuracy.
761  * @reserved: for alignment
762  */
763 struct iwl_tof_range_rsp_ap_entry_ntfy {
764 	u8 bssid[ETH_ALEN];
765 	u8 measure_status;
766 	u8 measure_bw;
767 	__le32 rtt;
768 	__le32 rtt_variance;
769 	__le32 rtt_spread;
770 	s8 rssi;
771 	u8 rssi_spread;
772 	u8 last_burst;
773 	u8 refusal_period;
774 	__le32 timestamp;
775 	__le32 start_tsf;
776 	__le32 rx_rate_n_flags;
777 	__le32 tx_rate_n_flags;
778 	__le32 t2t3_initiator;
779 	__le32 t1t4_responder;
780 	__le16 common_calib;
781 	__le16 specific_calib;
782 	__le32 papd_calib_output;
783 	u8 rttConfidence;
784 	u8 reserved[3];
785 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_5 */
786 
787 /**
788  * enum iwl_tof_response_status - tof response status
789  *
790  * @IWL_TOF_RESPONSE_SUCCESS: successful range.
791  * @IWL_TOF_RESPONSE_TIMEOUT: request aborted due to timeout expiration.
792  *	partial result of ranges done so far is included in the response.
793  * @IWL_TOF_RESPONSE_ABORTED: Measurement aborted by command.
794  * @IWL_TOF_RESPONSE_FAILED: Measurement request command failed.
795  */
796 enum iwl_tof_response_status {
797 	IWL_TOF_RESPONSE_SUCCESS = 0,
798 	IWL_TOF_RESPONSE_TIMEOUT = 1,
799 	IWL_TOF_RESPONSE_ABORTED = 4,
800 	IWL_TOF_RESPONSE_FAILED  = 5,
801 }; /* LOCATION_RNG_RSP_STATUS */
802 
803 /**
804  * struct iwl_tof_range_rsp_ntfy_v5 - ranging response notification
805  * @request_id: A Token ID of the corresponding Range request
806  * @request_status: status of current measurement session, one of
807  *	&enum iwl_tof_response_status.
808  * @last_in_batch: reprot policy (when not all responses are uploaded at once)
809  * @num_of_aps: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
810  * @ap: per-AP data
811  */
812 struct iwl_tof_range_rsp_ntfy_v5 {
813 	u8 request_id;
814 	u8 request_status;
815 	u8 last_in_batch;
816 	u8 num_of_aps;
817 	struct iwl_tof_range_rsp_ap_entry_ntfy_v3 ap[IWL_MVM_TOF_MAX_APS];
818 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_5 */
819 
820 /**
821  * struct iwl_tof_range_rsp_ntfy_v6 - ranging response notification
822  * @request_id: A Token ID of the corresponding Range request
823  * @num_of_aps: Number of APs results
824  * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
825  * @reserved: reserved
826  * @ap: per-AP data
827  */
828 struct iwl_tof_range_rsp_ntfy_v6 {
829 	u8 request_id;
830 	u8 num_of_aps;
831 	u8 last_report;
832 	u8 reserved;
833 	struct iwl_tof_range_rsp_ap_entry_ntfy_v4 ap[IWL_MVM_TOF_MAX_APS];
834 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_6 */
835 
836 /**
837  * struct iwl_tof_range_rsp_ntfy - ranging response notification
838  * @request_id: A Token ID of the corresponding Range request
839  * @num_of_aps: Number of APs results
840  * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
841  * @reserved: reserved
842  * @ap: per-AP data
843  */
844 struct iwl_tof_range_rsp_ntfy {
845 	u8 request_id;
846 	u8 num_of_aps;
847 	u8 last_report;
848 	u8 reserved;
849 	struct iwl_tof_range_rsp_ap_entry_ntfy ap[IWL_MVM_TOF_MAX_APS];
850 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_7 */
851 
852 #define IWL_MVM_TOF_MCSI_BUF_SIZE  (245)
853 /**
854  * struct iwl_tof_mcsi_notif - used for debug
855  * @token: token ID for the current session
856  * @role: '0' - initiator, '1' - responder
857  * @reserved: reserved
858  * @initiator_bssid: initiator machine
859  * @responder_bssid: responder machine
860  * @mcsi_buffer: debug data
861  */
862 struct iwl_tof_mcsi_notif {
863 	u8 token;
864 	u8 role;
865 	__le16 reserved;
866 	u8 initiator_bssid[ETH_ALEN];
867 	u8 responder_bssid[ETH_ALEN];
868 	u8 mcsi_buffer[IWL_MVM_TOF_MCSI_BUF_SIZE * 4];
869 } __packed;
870 
871 /**
872  * struct iwl_tof_range_abort_cmd
873  * @request_id: corresponds to a range request
874  * @reserved: reserved
875  */
876 struct iwl_tof_range_abort_cmd {
877 	u8 request_id;
878 	u8 reserved[3];
879 } __packed;
880 
881 enum ftm_responder_stats_flags {
882 	FTM_RESP_STAT_NON_ASAP_STARTED = BIT(0),
883 	FTM_RESP_STAT_NON_ASAP_IN_WIN = BIT(1),
884 	FTM_RESP_STAT_NON_ASAP_OUT_WIN = BIT(2),
885 	FTM_RESP_STAT_TRIGGER_DUP = BIT(3),
886 	FTM_RESP_STAT_DUP = BIT(4),
887 	FTM_RESP_STAT_DUP_IN_WIN = BIT(5),
888 	FTM_RESP_STAT_DUP_OUT_WIN = BIT(6),
889 	FTM_RESP_STAT_SCHED_SUCCESS = BIT(7),
890 	FTM_RESP_STAT_ASAP_REQ = BIT(8),
891 	FTM_RESP_STAT_NON_ASAP_REQ = BIT(9),
892 	FTM_RESP_STAT_ASAP_RESP = BIT(10),
893 	FTM_RESP_STAT_NON_ASAP_RESP = BIT(11),
894 	FTM_RESP_STAT_FAIL_INITIATOR_INACTIVE = BIT(12),
895 	FTM_RESP_STAT_FAIL_INITIATOR_OUT_WIN = BIT(13),
896 	FTM_RESP_STAT_FAIL_INITIATOR_RETRY_LIM = BIT(14),
897 	FTM_RESP_STAT_FAIL_NEXT_SERVED = BIT(15),
898 	FTM_RESP_STAT_FAIL_TRIGGER_ERR = BIT(16),
899 	FTM_RESP_STAT_FAIL_GC = BIT(17),
900 	FTM_RESP_STAT_SUCCESS = BIT(18),
901 	FTM_RESP_STAT_INTEL_IE = BIT(19),
902 	FTM_RESP_STAT_INITIATOR_ACTIVE = BIT(20),
903 	FTM_RESP_STAT_MEASUREMENTS_AVAILABLE = BIT(21),
904 	FTM_RESP_STAT_TRIGGER_UNKNOWN = BIT(22),
905 	FTM_RESP_STAT_PROCESS_FAIL = BIT(23),
906 	FTM_RESP_STAT_ACK = BIT(24),
907 	FTM_RESP_STAT_NACK = BIT(25),
908 	FTM_RESP_STAT_INVALID_INITIATOR_ID = BIT(26),
909 	FTM_RESP_STAT_TIMER_MIN_DELTA = BIT(27),
910 	FTM_RESP_STAT_INITIATOR_REMOVED = BIT(28),
911 	FTM_RESP_STAT_INITIATOR_ADDED = BIT(29),
912 	FTM_RESP_STAT_ERR_LIST_FULL = BIT(30),
913 	FTM_RESP_STAT_INITIATOR_SCHED_NOW = BIT(31),
914 }; /* RESP_IND_E */
915 
916 /**
917  * struct iwl_ftm_responder_stats - FTM responder statistics
918  * @addr: initiator address
919  * @success_ftm: number of successful ftm frames
920  * @ftm_per_burst: num of FTM frames that were received
921  * @flags: &enum ftm_responder_stats_flags
922  * @duration: actual duration of FTM
923  * @allocated_duration: time that was allocated for this FTM session
924  * @bw: FTM request bandwidth
925  * @rate: FTM request rate
926  * @reserved: for alingment and future use
927  */
928 struct iwl_ftm_responder_stats {
929 	u8 addr[ETH_ALEN];
930 	u8 success_ftm;
931 	u8 ftm_per_burst;
932 	__le32 flags;
933 	__le32 duration;
934 	__le32 allocated_duration;
935 	u8 bw;
936 	u8 rate;
937 	__le16 reserved;
938 } __packed; /* TOF_RESPONDER_STATISTICS_NTFY_S_VER_2 */
939 
940 #define IWL_CSI_MAX_EXPECTED_CHUNKS		16
941 
942 #define IWL_CSI_CHUNK_CTL_NUM_MASK_VER_1	0x0003
943 #define IWL_CSI_CHUNK_CTL_IDX_MASK_VER_1	0x000c
944 
945 #define IWL_CSI_CHUNK_CTL_NUM_MASK_VER_2	0x00ff
946 #define IWL_CSI_CHUNK_CTL_IDX_MASK_VER_2	0xff00
947 
948 struct iwl_csi_chunk_notification {
949 	__le32 token;
950 	__le16 seq;
951 	__le16 ctl;
952 	__le32 size;
953 	u8 data[];
954 } __packed; /* CSI_CHUNKS_HDR_NTFY_API_S_VER_1/VER_2 */
955 
956 #endif /* __iwl_fw_api_location_h__ */
957