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