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