xref: /linux/drivers/net/wireless/intel/iwlwifi/fw/api/location.h (revision 4b132aacb0768ac1e652cf517097ea6f237214b9)
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3  * Copyright (C) 2015-2017 Intel Deutschland GmbH
4  * Copyright (C) 2018-2022 Intel Corporation
5  * Copyright (C) 2024 Intel Corporation
6  */
7 #ifndef __iwl_fw_api_location_h__
8 #define __iwl_fw_api_location_h__
9 
10 /**
11  * enum iwl_location_subcmd_ids - location group command IDs
12  */
13 enum iwl_location_subcmd_ids {
14 	/**
15 	 * @TOF_RANGE_REQ_CMD: TOF ranging request,
16 	 *	uses one of &struct iwl_tof_range_req_cmd_v5,
17 	 *	&struct iwl_tof_range_req_cmd_v7,
18 	 *	&struct iwl_tof_range_req_cmd_v8,
19 	 *	&struct iwl_tof_range_req_cmd_v9,
20 	 *	&struct iwl_tof_range_req_cmd_v11,
21 	 *	&struct iwl_tof_range_req_cmd_v7
22 	 */
23 	TOF_RANGE_REQ_CMD = 0x0,
24 	/**
25 	 * @TOF_CONFIG_CMD: TOF configuration, uses &struct iwl_tof_config_cmd
26 	 */
27 	TOF_CONFIG_CMD = 0x1,
28 	/**
29 	 * @TOF_RANGE_ABORT_CMD: abort ongoing ranging, uses
30 	 *	&struct iwl_tof_range_abort_cmd
31 	 */
32 	TOF_RANGE_ABORT_CMD = 0x2,
33 	/**
34 	 * @TOF_RANGE_REQ_EXT_CMD: TOF extended ranging config,
35 	 *	uses &struct iwl_tof_range_req_ext_cmd
36 	 */
37 	TOF_RANGE_REQ_EXT_CMD = 0x3,
38 	/**
39 	 * @TOF_RESPONDER_CONFIG_CMD: FTM responder configuration, one of
40 	 *	&struct iwl_tof_responder_config_cmd_v6,
41 	 *	&struct iwl_tof_responder_config_cmd_v7,
42 	 *	&struct iwl_tof_responder_config_cmd_v8 or
43 	 *	&struct iwl_tof_responder_config_cmd_v9
44 	 */
45 	TOF_RESPONDER_CONFIG_CMD = 0x4,
46 	/**
47 	 * @TOF_RESPONDER_DYN_CONFIG_CMD: FTM dynamic configuration,
48 	 *	uses &struct iwl_tof_responder_dyn_config_cmd
49 	 */
50 	TOF_RESPONDER_DYN_CONFIG_CMD = 0x5,
51 	/**
52 	 * @CSI_HEADER_NOTIFICATION: CSI header
53 	 */
54 	CSI_HEADER_NOTIFICATION = 0xFA,
55 	/**
56 	 * @CSI_CHUNKS_NOTIFICATION: CSI chunk,
57 	 *	uses &struct iwl_csi_chunk_notification
58 	 */
59 	CSI_CHUNKS_NOTIFICATION = 0xFB,
60 	/**
61 	 * @TOF_LC_NOTIF: used for LCI/civic location, contains just
62 	 *	the action frame
63 	 */
64 	TOF_LC_NOTIF = 0xFC,
65 	/**
66 	 * @TOF_RESPONDER_STATS: FTM responder statistics notification,
67 	 *	uses &struct iwl_ftm_responder_stats
68 	 */
69 	TOF_RESPONDER_STATS = 0xFD,
70 	/**
71 	 * @TOF_MCSI_DEBUG_NOTIF: MCSI debug notification, uses
72 	 *	&struct iwl_tof_mcsi_notif
73 	 */
74 	TOF_MCSI_DEBUG_NOTIF = 0xFE,
75 	/**
76 	 * @TOF_RANGE_RESPONSE_NOTIF: ranging response, using one of
77 	 *	&struct iwl_tof_range_rsp_ntfy_v5,
78 	 *	&struct iwl_tof_range_rsp_ntfy_v6,
79 	 *	&struct iwl_tof_range_rsp_ntfy_v7 or
80 	 *	&struct iwl_tof_range_rsp_ntfy_v8
81 	 */
82 	TOF_RANGE_RESPONSE_NOTIF = 0xFF,
83 };
84 
85 /**
86  * struct iwl_tof_config_cmd - ToF configuration
87  * @tof_disabled: indicates if ToF is disabled (or not)
88  * @one_sided_disabled: indicates if one-sided is disabled (or not)
89  * @is_debug_mode: indiciates if debug mode is active
90  * @is_buf_required: indicates if channel estimation buffer is required
91  */
92 struct iwl_tof_config_cmd {
93 	u8 tof_disabled;
94 	u8 one_sided_disabled;
95 	u8 is_debug_mode;
96 	u8 is_buf_required;
97 } __packed;
98 
99 /**
100  * enum iwl_tof_bandwidth - values for iwl_tof_range_req_ap_entry.bandwidth
101  * @IWL_TOF_BW_20_LEGACY: 20 MHz non-HT
102  * @IWL_TOF_BW_20_HT: 20 MHz HT
103  * @IWL_TOF_BW_40: 40 MHz
104  * @IWL_TOF_BW_80: 80 MHz
105  * @IWL_TOF_BW_160: 160 MHz
106  * @IWL_TOF_BW_NUM: number of tof bandwidths
107  */
108 enum iwl_tof_bandwidth {
109 	IWL_TOF_BW_20_LEGACY,
110 	IWL_TOF_BW_20_HT,
111 	IWL_TOF_BW_40,
112 	IWL_TOF_BW_80,
113 	IWL_TOF_BW_160,
114 	IWL_TOF_BW_NUM,
115 }; /* LOCAT_BW_TYPE_E */
116 
117 /*
118  * enum iwl_tof_algo_type - Algorithym type for range measurement request
119  */
120 enum iwl_tof_algo_type {
121 	IWL_TOF_ALGO_TYPE_MAX_LIKE	= 0,
122 	IWL_TOF_ALGO_TYPE_LINEAR_REG	= 1,
123 	IWL_TOF_ALGO_TYPE_FFT		= 2,
124 
125 	/* Keep last */
126 	IWL_TOF_ALGO_TYPE_INVALID,
127 }; /* ALGO_TYPE_E */
128 
129 /*
130  * enum iwl_tof_mcsi_ntfy - Enable/Disable MCSI notifications
131  */
132 enum iwl_tof_mcsi_enable {
133 	IWL_TOF_MCSI_DISABLED = 0,
134 	IWL_TOF_MCSI_ENABLED = 1,
135 }; /* MCSI_ENABLE_E */
136 
137 /**
138  * enum iwl_tof_responder_cmd_valid_field - valid fields in the responder cfg
139  * @IWL_TOF_RESPONDER_CMD_VALID_CHAN_INFO: channel info is valid
140  * @IWL_TOF_RESPONDER_CMD_VALID_TOA_OFFSET: ToA offset is valid
141  * @IWL_TOF_RESPONDER_CMD_VALID_COMMON_CALIB: common calibration mode is valid
142  * @IWL_TOF_RESPONDER_CMD_VALID_SPECIFIC_CALIB: spefici calibration mode is
143  *	valid
144  * @IWL_TOF_RESPONDER_CMD_VALID_BSSID: BSSID is valid
145  * @IWL_TOF_RESPONDER_CMD_VALID_TX_ANT: TX antenna is valid
146  * @IWL_TOF_RESPONDER_CMD_VALID_ALGO_TYPE: algorithm type is valid
147  * @IWL_TOF_RESPONDER_CMD_VALID_NON_ASAP_SUPPORT: non-ASAP support is valid
148  * @IWL_TOF_RESPONDER_CMD_VALID_STATISTICS_REPORT_SUPPORT: statistics report
149  *	support is valid
150  * @IWL_TOF_RESPONDER_CMD_VALID_MCSI_NOTIF_SUPPORT: MCSI notification support
151  *	is valid
152  * @IWL_TOF_RESPONDER_CMD_VALID_FAST_ALGO_SUPPORT: fast algorithm support
153  *	is valid
154  * @IWL_TOF_RESPONDER_CMD_VALID_RETRY_ON_ALGO_FAIL: retry on algorithm failure
155  *	is valid
156  * @IWL_TOF_RESPONDER_CMD_VALID_STA_ID: station ID is valid
157  * @IWL_TOF_RESPONDER_CMD_VALID_NDP_SUPPORT: enable/disable NDP ranging support
158  *	is valid
159  * @IWL_TOF_RESPONDER_CMD_VALID_NDP_PARAMS: NDP parameters are valid
160  * @IWL_TOF_RESPONDER_CMD_VALID_LMR_FEEDBACK: LMR feedback support is valid
161  * @IWL_TOF_RESPONDER_CMD_VALID_SESSION_ID: session id flag is valid
162  * @IWL_TOF_RESPONDER_CMD_VALID_BSS_COLOR: the bss_color field is valid
163  * @IWL_TOF_RESPONDER_CMD_VALID_MIN_MAX_TIME_BETWEEN_MSR: the
164  *	min_time_between_msr and max_time_between_msr fields are valid
165  */
166 enum iwl_tof_responder_cmd_valid_field {
167 	IWL_TOF_RESPONDER_CMD_VALID_CHAN_INFO = BIT(0),
168 	IWL_TOF_RESPONDER_CMD_VALID_TOA_OFFSET = BIT(1),
169 	IWL_TOF_RESPONDER_CMD_VALID_COMMON_CALIB = BIT(2),
170 	IWL_TOF_RESPONDER_CMD_VALID_SPECIFIC_CALIB = BIT(3),
171 	IWL_TOF_RESPONDER_CMD_VALID_BSSID = BIT(4),
172 	IWL_TOF_RESPONDER_CMD_VALID_TX_ANT = BIT(5),
173 	IWL_TOF_RESPONDER_CMD_VALID_ALGO_TYPE = BIT(6),
174 	IWL_TOF_RESPONDER_CMD_VALID_NON_ASAP_SUPPORT = BIT(7),
175 	IWL_TOF_RESPONDER_CMD_VALID_STATISTICS_REPORT_SUPPORT = BIT(8),
176 	IWL_TOF_RESPONDER_CMD_VALID_MCSI_NOTIF_SUPPORT = BIT(9),
177 	IWL_TOF_RESPONDER_CMD_VALID_FAST_ALGO_SUPPORT = BIT(10),
178 	IWL_TOF_RESPONDER_CMD_VALID_RETRY_ON_ALGO_FAIL = BIT(11),
179 	IWL_TOF_RESPONDER_CMD_VALID_STA_ID = BIT(12),
180 	IWL_TOF_RESPONDER_CMD_VALID_NDP_SUPPORT = BIT(22),
181 	IWL_TOF_RESPONDER_CMD_VALID_NDP_PARAMS = BIT(23),
182 	IWL_TOF_RESPONDER_CMD_VALID_LMR_FEEDBACK = BIT(24),
183 	IWL_TOF_RESPONDER_CMD_VALID_SESSION_ID = BIT(25),
184 	IWL_TOF_RESPONDER_CMD_VALID_BSS_COLOR = BIT(26),
185 	IWL_TOF_RESPONDER_CMD_VALID_MIN_MAX_TIME_BETWEEN_MSR = BIT(27),
186 };
187 
188 /**
189  * enum iwl_tof_responder_cfg_flags - responder configuration flags
190  * @IWL_TOF_RESPONDER_FLAGS_NON_ASAP_SUPPORT: non-ASAP support
191  * @IWL_TOF_RESPONDER_FLAGS_REPORT_STATISTICS: report statistics
192  * @IWL_TOF_RESPONDER_FLAGS_REPORT_MCSI: report MCSI
193  * @IWL_TOF_RESPONDER_FLAGS_ALGO_TYPE: algorithm type
194  * @IWL_TOF_RESPONDER_FLAGS_TOA_OFFSET_MODE: ToA offset mode
195  * @IWL_TOF_RESPONDER_FLAGS_COMMON_CALIB_MODE: common calibration mode
196  * @IWL_TOF_RESPONDER_FLAGS_SPECIFIC_CALIB_MODE: specific calibration mode
197  * @IWL_TOF_RESPONDER_FLAGS_FAST_ALGO_SUPPORT: fast algorithm support
198  * @IWL_TOF_RESPONDER_FLAGS_RETRY_ON_ALGO_FAIL: retry on algorithm fail
199  * @IWL_TOF_RESPONDER_FLAGS_FTM_TX_ANT: TX antenna mask
200  * @IWL_TOF_RESPONDER_FLAGS_NDP_SUPPORT: support NDP ranging
201  * @IWL_TOF_RESPONDER_FLAGS_LMR_FEEDBACK: request for LMR feedback if the
202  *	initiator supports it
203  * @IWL_TOF_RESPONDER_FLAGS_SESSION_ID: send the session id in the initial FTM
204  *	frame.
205  */
206 enum iwl_tof_responder_cfg_flags {
207 	IWL_TOF_RESPONDER_FLAGS_NON_ASAP_SUPPORT = BIT(0),
208 	IWL_TOF_RESPONDER_FLAGS_REPORT_STATISTICS = BIT(1),
209 	IWL_TOF_RESPONDER_FLAGS_REPORT_MCSI = BIT(2),
210 	IWL_TOF_RESPONDER_FLAGS_ALGO_TYPE = BIT(3) | BIT(4) | BIT(5),
211 	IWL_TOF_RESPONDER_FLAGS_TOA_OFFSET_MODE = BIT(6),
212 	IWL_TOF_RESPONDER_FLAGS_COMMON_CALIB_MODE = BIT(7),
213 	IWL_TOF_RESPONDER_FLAGS_SPECIFIC_CALIB_MODE = BIT(8),
214 	IWL_TOF_RESPONDER_FLAGS_FAST_ALGO_SUPPORT = BIT(9),
215 	IWL_TOF_RESPONDER_FLAGS_RETRY_ON_ALGO_FAIL = BIT(10),
216 	IWL_TOF_RESPONDER_FLAGS_FTM_TX_ANT = RATE_MCS_ANT_AB_MSK,
217 	IWL_TOF_RESPONDER_FLAGS_NDP_SUPPORT = BIT(24),
218 	IWL_TOF_RESPONDER_FLAGS_LMR_FEEDBACK = BIT(25),
219 	IWL_TOF_RESPONDER_FLAGS_SESSION_ID = BIT(27),
220 };
221 
222 /**
223  * struct iwl_tof_responder_config_cmd_v6 - ToF AP mode (for debug)
224  * @cmd_valid_fields: &iwl_tof_responder_cmd_valid_field
225  * @responder_cfg_flags: &iwl_tof_responder_cfg_flags
226  * @bandwidth: current AP Bandwidth: &enum iwl_tof_bandwidth
227  * @rate: current AP rate
228  * @channel_num: current AP Channel
229  * @ctrl_ch_position: coding of the control channel position relative to
230  *	the center frequency, see iwl_mvm_get_ctrl_pos()
231  * @sta_id: index of the AP STA when in AP mode
232  * @reserved1: reserved
233  * @toa_offset: Artificial addition [pSec] for the ToA - to be used for debug
234  *	purposes, simulating station movement by adding various values
235  *	to this field
236  * @common_calib: XVT: common calibration value
237  * @specific_calib: XVT: specific calibration value
238  * @bssid: Current AP BSSID
239  * @reserved2: reserved
240  */
241 struct iwl_tof_responder_config_cmd_v6 {
242 	__le32 cmd_valid_fields;
243 	__le32 responder_cfg_flags;
244 	u8 bandwidth;
245 	u8 rate;
246 	u8 channel_num;
247 	u8 ctrl_ch_position;
248 	u8 sta_id;
249 	u8 reserved1;
250 	__le16 toa_offset;
251 	__le16 common_calib;
252 	__le16 specific_calib;
253 	u8 bssid[ETH_ALEN];
254 	__le16 reserved2;
255 } __packed; /* TOF_RESPONDER_CONFIG_CMD_API_S_VER_6 */
256 
257 /**
258  * struct iwl_tof_responder_config_cmd_v7 - ToF AP mode (for debug)
259  * @cmd_valid_fields: &iwl_tof_responder_cmd_valid_field
260  * @responder_cfg_flags: &iwl_tof_responder_cfg_flags
261  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
262  *             bits 4 - 7: &enum iwl_location_bw.
263  * @rate: current AP rate
264  * @channel_num: current AP Channel
265  * @ctrl_ch_position: coding of the control channel position relative to
266  *	the center frequency, see iwl_mvm_get_ctrl_pos()
267  * @sta_id: index of the AP STA when in AP mode
268  * @reserved1: reserved
269  * @toa_offset: Artificial addition [pSec] for the ToA - to be used for debug
270  *	purposes, simulating station movement by adding various values
271  *	to this field
272  * @common_calib: XVT: common calibration value
273  * @specific_calib: XVT: specific calibration value
274  * @bssid: Current AP BSSID
275  * @reserved2: reserved
276  */
277 struct iwl_tof_responder_config_cmd_v7 {
278 	__le32 cmd_valid_fields;
279 	__le32 responder_cfg_flags;
280 	u8 format_bw;
281 	u8 rate;
282 	u8 channel_num;
283 	u8 ctrl_ch_position;
284 	u8 sta_id;
285 	u8 reserved1;
286 	__le16 toa_offset;
287 	__le16 common_calib;
288 	__le16 specific_calib;
289 	u8 bssid[ETH_ALEN];
290 	__le16 reserved2;
291 } __packed; /* TOF_RESPONDER_CONFIG_CMD_API_S_VER_7 */
292 
293 #define IWL_RESPONDER_STS_POS	3
294 #define IWL_RESPONDER_TOTAL_LTF_POS	6
295 
296 /**
297  * struct iwl_tof_responder_config_cmd_v8 - ToF AP mode (for debug)
298  * @cmd_valid_fields: &iwl_tof_responder_cmd_valid_field
299  * @responder_cfg_flags: &iwl_tof_responder_cfg_flags
300  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
301  *             bits 4 - 7: &enum iwl_location_bw.
302  * @rate: current AP rate
303  * @channel_num: current AP Channel
304  * @ctrl_ch_position: coding of the control channel position relative to
305  *	the center frequency, see iwl_mvm_get_ctrl_pos()
306  * @sta_id: index of the AP STA when in AP mode
307  * @reserved1: reserved
308  * @toa_offset: Artificial addition [pSec] for the ToA - to be used for debug
309  *	purposes, simulating station movement by adding various values
310  *	to this field
311  * @common_calib: XVT: common calibration value
312  * @specific_calib: XVT: specific calibration value
313  * @bssid: Current AP BSSID
314  * @r2i_ndp_params: parameters for R2I NDP.
315  *	bits 0 - 2: max number of LTF repetitions
316  *	bits 3 - 5: max number of spatial streams (supported values are < 2)
317  *	bits 6 - 7: max number of total LTFs see
318  *	&enum ieee80211_range_params_max_total_ltf
319  * @i2r_ndp_params: parameters for I2R NDP.
320  *	bits 0 - 2: max number of LTF repetitions
321  *	bits 3 - 5: max number of spatial streams
322  *	bits 6 - 7: max number of total LTFs see
323  *	&enum ieee80211_range_params_max_total_ltf
324  */
325 struct iwl_tof_responder_config_cmd_v8 {
326 	__le32 cmd_valid_fields;
327 	__le32 responder_cfg_flags;
328 	u8 format_bw;
329 	u8 rate;
330 	u8 channel_num;
331 	u8 ctrl_ch_position;
332 	u8 sta_id;
333 	u8 reserved1;
334 	__le16 toa_offset;
335 	__le16 common_calib;
336 	__le16 specific_calib;
337 	u8 bssid[ETH_ALEN];
338 	u8 r2i_ndp_params;
339 	u8 i2r_ndp_params;
340 } __packed; /* TOF_RESPONDER_CONFIG_CMD_API_S_VER_8 */
341 
342 /**
343  * struct iwl_tof_responder_config_cmd_v9 - ToF AP mode (for debug)
344  * @cmd_valid_fields: &iwl_tof_responder_cmd_valid_field
345  * @responder_cfg_flags: &iwl_tof_responder_cfg_flags
346  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
347  *             bits 4 - 7: &enum iwl_location_bw.
348  * @bss_color: current AP bss_color
349  * @channel_num: current AP Channel
350  * @ctrl_ch_position: coding of the control channel position relative to
351  *	the center frequency, see iwl_mvm_get_ctrl_pos()
352  * @sta_id: index of the AP STA when in AP mode
353  * @reserved1: reserved
354  * @toa_offset: Artificial addition [pSec] for the ToA - to be used for debug
355  *	purposes, simulating station movement by adding various values
356  *	to this field
357  * @common_calib: XVT: common calibration value
358  * @specific_calib: XVT: specific calibration value
359  * @bssid: Current AP BSSID
360  * @r2i_ndp_params: parameters for R2I NDP.
361  *	bits 0 - 2: max number of LTF repetitions
362  *	bits 3 - 5: max number of spatial streams (supported values are < 2)
363  *	bits 6 - 7: max number of total LTFs see
364  *	&enum ieee80211_range_params_max_total_ltf
365  * @i2r_ndp_params: parameters for I2R NDP.
366  *	bits 0 - 2: max number of LTF repetitions
367  *	bits 3 - 5: max number of spatial streams
368  *	bits 6 - 7: max number of total LTFs see
369  *	&enum ieee80211_range_params_max_total_ltf
370  * @min_time_between_msr: for non trigger based NDP ranging, minimum time
371  *	between measurements in milliseconds.
372  * @max_time_between_msr: for non trigger based NDP ranging, maximum time
373  *	between measurements in milliseconds.
374  */
375 struct iwl_tof_responder_config_cmd_v9 {
376 	__le32 cmd_valid_fields;
377 	__le32 responder_cfg_flags;
378 	u8 format_bw;
379 	u8 bss_color;
380 	u8 channel_num;
381 	u8 ctrl_ch_position;
382 	u8 sta_id;
383 	u8 reserved1;
384 	__le16 toa_offset;
385 	__le16 common_calib;
386 	__le16 specific_calib;
387 	u8 bssid[ETH_ALEN];
388 	u8 r2i_ndp_params;
389 	u8 i2r_ndp_params;
390 	__le16 min_time_between_msr;
391 	__le16 max_time_between_msr;
392 } __packed; /* TOF_RESPONDER_CONFIG_CMD_API_S_VER_8 */
393 
394 /**
395  * struct iwl_tof_responder_config_cmd - ToF AP mode
396  * @cmd_valid_fields: &iwl_tof_responder_cmd_valid_field
397  * @responder_cfg_flags: &iwl_tof_responder_cfg_flags
398  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
399  *             bits 4 - 7: &enum iwl_location_bw.
400  * @bss_color: current AP bss_color
401  * @channel_num: current AP Channel
402  * @ctrl_ch_position: coding of the control channel position relative to
403  *	the center frequency, see iwl_mvm_get_ctrl_pos()
404  * @sta_id: index of the AP STA when in AP mode
405  * @band: current AP band
406  * @toa_offset: Artificial addition [pSec] for the ToA - to be used for debug
407  *	purposes, simulating station movement by adding various values
408  *	to this field
409  * @common_calib: XVT: common calibration value
410  * @specific_calib: XVT: specific calibration value
411  * @bssid: Current AP BSSID
412  * @r2i_ndp_params: parameters for R2I NDP.
413  *	bits 0 - 2: max number of LTF repetitions
414  *	bits 3 - 5: max number of spatial streams (supported values are < 2)
415  *	bits 6 - 7: max number of total LTFs see
416  *	&enum ieee80211_range_params_max_total_ltf
417  * @i2r_ndp_params: parameters for I2R NDP.
418  *	bits 0 - 2: max number of LTF repetitions
419  *	bits 3 - 5: max number of spatial streams
420  *	bits 6 - 7: max number of total LTFs see
421  *	&enum ieee80211_range_params_max_total_ltf
422  * @min_time_between_msr: for non trigger based NDP ranging, minimum time
423  *	between measurements in milliseconds.
424  * @max_time_between_msr: for non trigger based NDP ranging, maximum time
425  *	between measurements in milliseconds.
426  */
427 struct iwl_tof_responder_config_cmd {
428 	__le32 cmd_valid_fields;
429 	__le32 responder_cfg_flags;
430 	u8 format_bw;
431 	u8 bss_color;
432 	u8 channel_num;
433 	u8 ctrl_ch_position;
434 	u8 sta_id;
435 	u8 band;
436 	__le16 toa_offset;
437 	__le16 common_calib;
438 	__le16 specific_calib;
439 	u8 bssid[ETH_ALEN];
440 	u8 r2i_ndp_params;
441 	u8 i2r_ndp_params;
442 	__le16 min_time_between_msr;
443 	__le16 max_time_between_msr;
444 } __packed; /* TOF_RESPONDER_CONFIG_CMD_API_S_VER_10 */
445 
446 #define IWL_LCI_CIVIC_IE_MAX_SIZE	400
447 
448 /**
449  * struct iwl_tof_responder_dyn_config_cmd_v2 - Dynamic responder settings
450  * @lci_len: The length of the 1st (LCI) part in the @lci_civic buffer
451  * @civic_len: The length of the 2nd (CIVIC) part in the @lci_civic buffer
452  * @lci_civic: The LCI/CIVIC buffer. LCI data (if exists) comes first, then, if
453  *	needed, 0-padding such that the next part is dword-aligned, then CIVIC
454  *	data (if exists) follows, and then 0-padding again to complete a
455  *	4-multiple long buffer.
456  */
457 struct iwl_tof_responder_dyn_config_cmd_v2 {
458 	__le32 lci_len;
459 	__le32 civic_len;
460 	u8 lci_civic[];
461 } __packed; /* TOF_RESPONDER_DYN_CONFIG_CMD_API_S_VER_2 */
462 
463 #define IWL_LCI_MAX_SIZE	160
464 #define IWL_CIVIC_MAX_SIZE	160
465 #define HLTK_11AZ_LEN	32
466 
467 /**
468  * enum iwl_responder_dyn_cfg_valid_flags - valid flags for dyn_config_cmd
469  * @IWL_RESPONDER_DYN_CFG_VALID_LCI: LCI data is valid
470  * @IWL_RESPONDER_DYN_CFG_VALID_CIVIC: Civic data is valid
471  * @IWL_RESPONDER_DYN_CFG_VALID_PASN_STA: the pasn_addr, HLTK and cipher fields
472  *	are valid.
473  */
474 enum iwl_responder_dyn_cfg_valid_flags {
475 	IWL_RESPONDER_DYN_CFG_VALID_LCI = BIT(0),
476 	IWL_RESPONDER_DYN_CFG_VALID_CIVIC = BIT(1),
477 	IWL_RESPONDER_DYN_CFG_VALID_PASN_STA = BIT(2),
478 };
479 
480 /**
481  * struct iwl_tof_responder_dyn_config_cmd - Dynamic responder settings
482  * @cipher: The negotiated cipher. see &enum iwl_location_cipher.
483  * @valid_flags: flags indicating which fields in the command are valid. see
484  *	&enum iwl_responder_dyn_cfg_valid_flags.
485  * @lci_len: length of the LCI data in bytes
486  * @civic_len: length of the Civic data in bytes
487  * @lci_buf: the LCI buffer
488  * @civic_buf: the Civic buffer
489  * @hltk_buf: HLTK for secure LTF bits generation for the specified station
490  * @addr: mac address of the station for which to use the HLTK
491  * @reserved: for alignment
492  */
493 struct iwl_tof_responder_dyn_config_cmd {
494 	u8 cipher;
495 	u8 valid_flags;
496 	u8 lci_len;
497 	u8 civic_len;
498 	u8 lci_buf[IWL_LCI_MAX_SIZE];
499 	u8 civic_buf[IWL_LCI_MAX_SIZE];
500 	u8 hltk_buf[HLTK_11AZ_LEN];
501 	u8 addr[ETH_ALEN];
502 	u8 reserved[2];
503 } __packed; /* TOF_RESPONDER_DYN_CONFIG_CMD_API_S_VER_3 */
504 
505 /**
506  * struct iwl_tof_range_req_ext_cmd - extended range req for WLS
507  * @tsf_timer_offset_msec: the recommended time offset (mSec) from the AP's TSF
508  * @reserved: reserved
509  * @min_delta_ftm: Minimal time between two consecutive measurements,
510  *		   in units of 100us. 0 means no preference by station
511  * @ftm_format_and_bw20M: FTM Channel Spacing/Format for 20MHz: recommended
512  *			value be sent to the AP
513  * @ftm_format_and_bw40M: FTM Channel Spacing/Format for 40MHz: recommended
514  *			value to be sent to the AP
515  * @ftm_format_and_bw80M: FTM Channel Spacing/Format for 80MHz: recommended
516  *			value to be sent to the AP
517  */
518 struct iwl_tof_range_req_ext_cmd {
519 	__le16 tsf_timer_offset_msec;
520 	__le16 reserved;
521 	u8 min_delta_ftm;
522 	u8 ftm_format_and_bw20M;
523 	u8 ftm_format_and_bw40M;
524 	u8 ftm_format_and_bw80M;
525 } __packed;
526 
527 /**
528  * enum iwl_tof_location_query - values for query bitmap
529  * @IWL_TOF_LOC_LCI: query LCI
530  * @IWL_TOF_LOC_CIVIC: query civic
531  */
532 enum iwl_tof_location_query {
533 	IWL_TOF_LOC_LCI = 0x01,
534 	IWL_TOF_LOC_CIVIC = 0x02,
535 };
536 
537  /**
538  * struct iwl_tof_range_req_ap_entry_v2 - AP configuration parameters
539  * @channel_num: Current AP Channel
540  * @bandwidth: Current AP Bandwidth. One of iwl_tof_bandwidth.
541  * @tsf_delta_direction: TSF relatively to the subject AP
542  * @ctrl_ch_position: Coding of the control channel position relative to the
543  *	center frequency, see iwl_mvm_get_ctrl_pos().
544  * @bssid: AP's BSSID
545  * @measure_type: Measurement type: 0 - two sided, 1 - One sided
546  * @num_of_bursts: Recommended value to be sent to the AP.  2s Exponent of the
547  *	number of measurement iterations (min 2^0 = 1, max 2^14)
548  * @burst_period: Recommended value to be sent to the AP. Measurement
549  *	periodicity In units of 100ms. ignored if num_of_bursts = 0
550  * @samples_per_burst: 2-sided: the number of FTMs pairs in single Burst (1-31);
551  *	1-sided: how many rts/cts pairs should be used per burst.
552  * @retries_per_sample: Max number of retries that the LMAC should send
553  *	in case of no replies by the AP.
554  * @tsf_delta: TSF Delta in units of microseconds.
555  *	The difference between the AP TSF and the device local clock.
556  * @location_req: Location Request Bit[0] LCI should be sent in the FTMR;
557  *	Bit[1] Civic should be sent in the FTMR
558  * @asap_mode: 0 - non asap mode, 1 - asap mode (not relevant for one sided)
559  * @enable_dyn_ack: Enable Dynamic ACK BW.
560  *	0: Initiator interact with regular AP;
561  *	1: Initiator interact with Responder machine: need to send the
562  *	Initiator Acks with HT 40MHz / 80MHz, since the Responder should
563  *	use it for its ch est measurement (this flag will be set when we
564  *	configure the opposite machine to be Responder).
565  * @rssi: Last received value
566  *	legal values: -128-0 (0x7f). above 0x0 indicating an invalid value.
567  * @algo_type: &enum iwl_tof_algo_type
568  * @notify_mcsi: &enum iwl_tof_mcsi_ntfy.
569  * @reserved: For alignment and future use
570  */
571 struct iwl_tof_range_req_ap_entry_v2 {
572 	u8 channel_num;
573 	u8 bandwidth;
574 	u8 tsf_delta_direction;
575 	u8 ctrl_ch_position;
576 	u8 bssid[ETH_ALEN];
577 	u8 measure_type;
578 	u8 num_of_bursts;
579 	__le16 burst_period;
580 	u8 samples_per_burst;
581 	u8 retries_per_sample;
582 	__le32 tsf_delta;
583 	u8 location_req;
584 	u8 asap_mode;
585 	u8 enable_dyn_ack;
586 	s8 rssi;
587 	u8 algo_type;
588 	u8 notify_mcsi;
589 	__le16 reserved;
590 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_2 */
591 
592 /**
593  * enum iwl_initiator_ap_flags - per responder FTM configuration flags
594  * @IWL_INITIATOR_AP_FLAGS_ASAP: Request for ASAP measurement.
595  * @IWL_INITIATOR_AP_FLAGS_LCI_REQUEST: Request for LCI information
596  * @IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST: Request for CIVIC information
597  * @IWL_INITIATOR_AP_FLAGS_DYN_ACK: Send HT/VHT ack for FTM frames. If not set,
598  *	20Mhz dup acks will be sent.
599  * @IWL_INITIATOR_AP_FLAGS_ALGO_LR: Use LR algo type for rtt calculation.
600  *	Default algo type is ML.
601  * @IWL_INITIATOR_AP_FLAGS_ALGO_FFT: Use FFT algo type for rtt calculation.
602  *	Default algo type is ML.
603  * @IWL_INITIATOR_AP_FLAGS_MCSI_REPORT: Send the MCSI for each FTM frame to the
604  *	driver.
605  * @IWL_INITIATOR_AP_FLAGS_NON_TB: Use non trigger based flow
606  * @IWL_INITIATOR_AP_FLAGS_TB: Use trigger based flow
607  * @IWL_INITIATOR_AP_FLAGS_SECURED: request secure LTF measurement
608  * @IWL_INITIATOR_AP_FLAGS_LMR_FEEDBACK: Send LMR feedback
609  * @IWL_INITIATOR_AP_FLAGS_USE_CALIB: Use calibration values from the request
610  *      instead of fw internal values.
611  * @IWL_INITIATOR_AP_FLAGS_PMF: request to protect the negotiation and LMR
612  *      frames with protected management frames.
613  * @IWL_INITIATOR_AP_FLAGS_TERMINATE_ON_LMR_FEEDBACK: terminate the session if
614  *	the responder asked for LMR feedback although the initiator did not set
615  *	the LMR feedback bit in the FTM request. If not set, the initiator will
616  *	continue with the session and will provide the LMR feedback.
617  * @IWL_INITIATOR_AP_FLAGS_TEST_INCORRECT_SAC: send an incorrect SAC in the
618  *	first NDP exchange. This is used for testing.
619  */
620 enum iwl_initiator_ap_flags {
621 	IWL_INITIATOR_AP_FLAGS_ASAP = BIT(1),
622 	IWL_INITIATOR_AP_FLAGS_LCI_REQUEST = BIT(2),
623 	IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST = BIT(3),
624 	IWL_INITIATOR_AP_FLAGS_DYN_ACK = BIT(4),
625 	IWL_INITIATOR_AP_FLAGS_ALGO_LR = BIT(5),
626 	IWL_INITIATOR_AP_FLAGS_ALGO_FFT = BIT(6),
627 	IWL_INITIATOR_AP_FLAGS_MCSI_REPORT = BIT(8),
628 	IWL_INITIATOR_AP_FLAGS_NON_TB = BIT(9),
629 	IWL_INITIATOR_AP_FLAGS_TB = BIT(10),
630 	IWL_INITIATOR_AP_FLAGS_SECURED = BIT(11),
631 	IWL_INITIATOR_AP_FLAGS_LMR_FEEDBACK = BIT(12),
632 	IWL_INITIATOR_AP_FLAGS_USE_CALIB = BIT(13),
633 	IWL_INITIATOR_AP_FLAGS_PMF = BIT(14),
634 	IWL_INITIATOR_AP_FLAGS_TERMINATE_ON_LMR_FEEDBACK = BIT(15),
635 	IWL_INITIATOR_AP_FLAGS_TEST_INCORRECT_SAC = BIT(16),
636 };
637 
638 /**
639  * struct iwl_tof_range_req_ap_entry_v3 - AP configuration parameters
640  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
641  * @channel_num: AP Channel number
642  * @bandwidth: AP bandwidth. One of iwl_tof_bandwidth.
643  * @ctrl_ch_position: Coding of the control channel position relative to the
644  *	center frequency, see iwl_mvm_get_ctrl_pos().
645  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
646  *	reply from the AP.
647  * @bssid: AP's BSSID
648  * @burst_period: Recommended value to be sent to the AP. Measurement
649  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
650  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
651  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
652  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
653  * @reserved: For alignment and future use
654  * @tsf_delta: not in use
655  */
656 struct iwl_tof_range_req_ap_entry_v3 {
657 	__le32 initiator_ap_flags;
658 	u8 channel_num;
659 	u8 bandwidth;
660 	u8 ctrl_ch_position;
661 	u8 ftmr_max_retries;
662 	u8 bssid[ETH_ALEN];
663 	__le16 burst_period;
664 	u8 samples_per_burst;
665 	u8 num_of_bursts;
666 	__le16 reserved;
667 	__le32 tsf_delta;
668 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_3 */
669 
670 /**
671  * enum iwl_location_frame_format - location frame formats
672  * @IWL_LOCATION_FRAME_FORMAT_LEGACY: legacy
673  * @IWL_LOCATION_FRAME_FORMAT_HT: HT
674  * @IWL_LOCATION_FRAME_FORMAT_VHT: VHT
675  * @IWL_LOCATION_FRAME_FORMAT_HE: HE
676  */
677 enum iwl_location_frame_format {
678 	IWL_LOCATION_FRAME_FORMAT_LEGACY,
679 	IWL_LOCATION_FRAME_FORMAT_HT,
680 	IWL_LOCATION_FRAME_FORMAT_VHT,
681 	IWL_LOCATION_FRAME_FORMAT_HE,
682 };
683 
684 /**
685  * enum iwl_location_bw - location bandwidth selection
686  * @IWL_LOCATION_BW_20MHZ: 20MHz
687  * @IWL_LOCATION_BW_40MHZ: 40MHz
688  * @IWL_LOCATION_BW_80MHZ: 80MHz
689  * @IWL_LOCATION_BW_160MHZ: 160MHz
690  */
691 enum iwl_location_bw {
692 	IWL_LOCATION_BW_20MHZ,
693 	IWL_LOCATION_BW_40MHZ,
694 	IWL_LOCATION_BW_80MHZ,
695 	IWL_LOCATION_BW_160MHZ,
696 };
697 
698 #define TK_11AZ_LEN	32
699 
700 #define LOCATION_BW_POS	4
701 
702 /**
703  * struct iwl_tof_range_req_ap_entry_v4 - AP configuration parameters
704  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
705  * @channel_num: AP Channel number
706  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
707  *             bits 4 - 7: &enum iwl_location_bw.
708  * @ctrl_ch_position: Coding of the control channel position relative to the
709  *	center frequency, see iwl_mvm_get_ctrl_pos().
710  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
711  *	reply from the AP.
712  * @bssid: AP's BSSID
713  * @burst_period: Recommended value to be sent to the AP. Measurement
714  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
715  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
716  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
717  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
718  * @reserved: For alignment and future use
719  * @hltk: HLTK to be used for secured 11az measurement
720  * @tk: TK to be used for secured 11az measurement
721  */
722 struct iwl_tof_range_req_ap_entry_v4 {
723 	__le32 initiator_ap_flags;
724 	u8 channel_num;
725 	u8 format_bw;
726 	u8 ctrl_ch_position;
727 	u8 ftmr_max_retries;
728 	u8 bssid[ETH_ALEN];
729 	__le16 burst_period;
730 	u8 samples_per_burst;
731 	u8 num_of_bursts;
732 	__le16 reserved;
733 	u8 hltk[HLTK_11AZ_LEN];
734 	u8 tk[TK_11AZ_LEN];
735 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_4 */
736 
737 /**
738  * enum iwl_location_cipher - location cipher selection
739  * @IWL_LOCATION_CIPHER_CCMP_128: CCMP 128
740  * @IWL_LOCATION_CIPHER_GCMP_128: GCMP 128
741  * @IWL_LOCATION_CIPHER_GCMP_256: GCMP 256
742  * @IWL_LOCATION_CIPHER_INVALID: security is not used.
743  * @IWL_LOCATION_CIPHER_MAX: maximum value for this enum.
744  */
745 enum iwl_location_cipher {
746 	IWL_LOCATION_CIPHER_CCMP_128,
747 	IWL_LOCATION_CIPHER_GCMP_128,
748 	IWL_LOCATION_CIPHER_GCMP_256,
749 	IWL_LOCATION_CIPHER_INVALID,
750 	IWL_LOCATION_CIPHER_MAX,
751 };
752 
753 /**
754  * struct iwl_tof_range_req_ap_entry_v6 - AP configuration parameters
755  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
756  * @channel_num: AP Channel number
757  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
758  *             bits 4 - 7: &enum iwl_location_bw.
759  * @ctrl_ch_position: Coding of the control channel position relative to the
760  *	center frequency, see iwl_mvm_get_ctrl_pos().
761  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
762  *	reply from the AP.
763  * @bssid: AP's BSSID
764  * @burst_period: Recommended value to be sent to the AP. Measurement
765  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
766  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
767  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
768  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
769  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
770  *	otherwise should be set to &IWL_MVM_INVALID_STA.
771  * @cipher: pairwise cipher suite for secured measurement.
772  *          &enum iwl_location_cipher.
773  * @hltk: HLTK to be used for secured 11az measurement
774  * @tk: TK to be used for secured 11az measurement
775  * @calib: An array of calibration values per FTM rx bandwidth.
776  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
777  *         calibration value that corresponds to the rx bandwidth of the FTM
778  *         frame.
779  * @beacon_interval: beacon interval of the AP in TUs. Only required if
780  *	&IWL_INITIATOR_AP_FLAGS_TB is set.
781  */
782 struct iwl_tof_range_req_ap_entry_v6 {
783 	__le32 initiator_ap_flags;
784 	u8 channel_num;
785 	u8 format_bw;
786 	u8 ctrl_ch_position;
787 	u8 ftmr_max_retries;
788 	u8 bssid[ETH_ALEN];
789 	__le16 burst_period;
790 	u8 samples_per_burst;
791 	u8 num_of_bursts;
792 	u8 sta_id;
793 	u8 cipher;
794 	u8 hltk[HLTK_11AZ_LEN];
795 	u8 tk[TK_11AZ_LEN];
796 	__le16 calib[IWL_TOF_BW_NUM];
797 	__le16 beacon_interval;
798 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_6 */
799 
800 /**
801  * struct iwl_tof_range_req_ap_entry_v7 - AP configuration parameters
802  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
803  * @channel_num: AP Channel number
804  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
805  *             bits 4 - 7: &enum iwl_location_bw.
806  * @ctrl_ch_position: Coding of the control channel position relative to the
807  *	center frequency, see iwl_mvm_get_ctrl_pos().
808  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
809  *	reply from the AP.
810  * @bssid: AP's BSSID
811  * @burst_period: Recommended value to be sent to the AP. Measurement
812  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
813  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
814  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
815  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
816  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
817  *	otherwise should be set to &IWL_MVM_INVALID_STA.
818  * @cipher: pairwise cipher suite for secured measurement.
819  *          &enum iwl_location_cipher.
820  * @hltk: HLTK to be used for secured 11az measurement
821  * @tk: TK to be used for secured 11az measurement
822  * @calib: An array of calibration values per FTM rx bandwidth.
823  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
824  *         calibration value that corresponds to the rx bandwidth of the FTM
825  *         frame.
826  * @beacon_interval: beacon interval of the AP in TUs. Only required if
827  *	&IWL_INITIATOR_AP_FLAGS_TB is set.
828  * @rx_pn: the next expected PN for protected management frames Rx. LE byte
829  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
830  *	is set to &IWL_MVM_INVALID_STA.
831  * @tx_pn: the next PN to use for protected management frames Tx. LE byte
832  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
833  *	is set to &IWL_MVM_INVALID_STA.
834  */
835 struct iwl_tof_range_req_ap_entry_v7 {
836 	__le32 initiator_ap_flags;
837 	u8 channel_num;
838 	u8 format_bw;
839 	u8 ctrl_ch_position;
840 	u8 ftmr_max_retries;
841 	u8 bssid[ETH_ALEN];
842 	__le16 burst_period;
843 	u8 samples_per_burst;
844 	u8 num_of_bursts;
845 	u8 sta_id;
846 	u8 cipher;
847 	u8 hltk[HLTK_11AZ_LEN];
848 	u8 tk[TK_11AZ_LEN];
849 	__le16 calib[IWL_TOF_BW_NUM];
850 	__le16 beacon_interval;
851 	u8 rx_pn[IEEE80211_CCMP_PN_LEN];
852 	u8 tx_pn[IEEE80211_CCMP_PN_LEN];
853 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_7 */
854 
855 #define IWL_LOCATION_MAX_STS_POS	3
856 #define IWL_LOCATION_TOTAL_LTF_POS	6
857 
858 /**
859  * struct iwl_tof_range_req_ap_entry_v8 - AP configuration parameters
860  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
861  * @channel_num: AP Channel number
862  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
863  *             bits 4 - 7: &enum iwl_location_bw.
864  * @ctrl_ch_position: Coding of the control channel position relative to the
865  *	center frequency, see iwl_mvm_get_ctrl_pos().
866  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
867  *	reply from the AP.
868  * @bssid: AP's BSSID
869  * @burst_period: Recommended value to be sent to the AP. Measurement
870  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
871  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
872  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
873  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
874  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
875  *	otherwise should be set to &IWL_MVM_INVALID_STA.
876  * @cipher: pairwise cipher suite for secured measurement.
877  *          &enum iwl_location_cipher.
878  * @hltk: HLTK to be used for secured 11az measurement
879  * @tk: TK to be used for secured 11az measurement
880  * @calib: An array of calibration values per FTM rx bandwidth.
881  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
882  *         calibration value that corresponds to the rx bandwidth of the FTM
883  *         frame.
884  * @beacon_interval: beacon interval of the AP in TUs. Only required if
885  *	&IWL_INITIATOR_AP_FLAGS_TB is set.
886  * @rx_pn: the next expected PN for protected management frames Rx. LE byte
887  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
888  *	is set to &IWL_MVM_INVALID_STA.
889  * @tx_pn: the next PN to use for protected management frames Tx. LE byte
890  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
891  *	is set to &IWL_MVM_INVALID_STA.
892  * @r2i_ndp_params: parameters for R2I NDP ranging negotiation.
893  *      bits 0 - 2: max LTF repetitions
894  *      bits 3 - 5: max number of spatial streams
895  *      bits 6 - 7: reserved
896  * @i2r_ndp_params: parameters for I2R NDP ranging negotiation.
897  *      bits 0 - 2: max LTF repetitions
898  *      bits 3 - 5: max number of spatial streams (supported values are < 2)
899  *      bits 6 - 7: reserved
900  * @r2i_max_total_ltf: R2I Max Total LTFs for NDP ranging negotiation.
901  *      One of &enum ieee80211_range_params_max_total_ltf.
902  * @i2r_max_total_ltf: I2R Max Total LTFs for NDP ranging negotiation.
903  *      One of &enum ieee80211_range_params_max_total_ltf.
904  */
905 struct iwl_tof_range_req_ap_entry_v8 {
906 	__le32 initiator_ap_flags;
907 	u8 channel_num;
908 	u8 format_bw;
909 	u8 ctrl_ch_position;
910 	u8 ftmr_max_retries;
911 	u8 bssid[ETH_ALEN];
912 	__le16 burst_period;
913 	u8 samples_per_burst;
914 	u8 num_of_bursts;
915 	u8 sta_id;
916 	u8 cipher;
917 	u8 hltk[HLTK_11AZ_LEN];
918 	u8 tk[TK_11AZ_LEN];
919 	__le16 calib[IWL_TOF_BW_NUM];
920 	__le16 beacon_interval;
921 	u8 rx_pn[IEEE80211_CCMP_PN_LEN];
922 	u8 tx_pn[IEEE80211_CCMP_PN_LEN];
923 	u8 r2i_ndp_params;
924 	u8 i2r_ndp_params;
925 	u8 r2i_max_total_ltf;
926 	u8 i2r_max_total_ltf;
927 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_8 */
928 
929 /**
930  * struct iwl_tof_range_req_ap_entry_v9 - AP configuration parameters
931  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
932  * @channel_num: AP Channel number
933  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
934  *             bits 4 - 7: &enum iwl_location_bw.
935  * @ctrl_ch_position: Coding of the control channel position relative to the
936  *	center frequency, see iwl_mvm_get_ctrl_pos().
937  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
938  *	reply from the AP.
939  * @bssid: AP's BSSID
940  * @burst_period: For EDCA based ranging: Recommended value to be sent to the
941  *	AP. Measurement periodicity In units of 100ms. ignored if
942  *	num_of_bursts_exp = 0.
943  *	For non trigger based NDP ranging, the maximum time between
944  *	measurements in units of milliseconds.
945  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
946  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
947  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
948  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
949  *	otherwise should be set to &IWL_MVM_INVALID_STA.
950  * @cipher: pairwise cipher suite for secured measurement.
951  *          &enum iwl_location_cipher.
952  * @hltk: HLTK to be used for secured 11az measurement
953  * @tk: TK to be used for secured 11az measurement
954  * @calib: An array of calibration values per FTM rx bandwidth.
955  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
956  *         calibration value that corresponds to the rx bandwidth of the FTM
957  *         frame.
958  * @beacon_interval: beacon interval of the AP in TUs. Only required if
959  *	&IWL_INITIATOR_AP_FLAGS_TB is set.
960  * @bss_color: the BSS color of the responder. Only valid if
961  *	&IWL_INITIATOR_AP_FLAGS_TB or &IWL_INITIATOR_AP_FLAGS_NON_TB is set.
962  * @rx_pn: the next expected PN for protected management frames Rx. LE byte
963  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
964  *	is set to &IWL_MVM_INVALID_STA.
965  * @tx_pn: the next PN to use for protected management frames Tx. LE byte
966  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
967  *	is set to &IWL_MVM_INVALID_STA.
968  * @r2i_ndp_params: parameters for R2I NDP ranging negotiation.
969  *      bits 0 - 2: max LTF repetitions
970  *      bits 3 - 5: max number of spatial streams
971  *      bits 6 - 7: reserved
972  * @i2r_ndp_params: parameters for I2R NDP ranging negotiation.
973  *      bits 0 - 2: max LTF repetitions
974  *      bits 3 - 5: max number of spatial streams (supported values are < 2)
975  *      bits 6 - 7: reserved
976  * @r2i_max_total_ltf: R2I Max Total LTFs for NDP ranging negotiation.
977  *      One of &enum ieee80211_range_params_max_total_ltf.
978  * @i2r_max_total_ltf: I2R Max Total LTFs for NDP ranging negotiation.
979  *      One of &enum ieee80211_range_params_max_total_ltf.
980  * @bss_color: the BSS color of the responder. Only valid if
981  *	&IWL_INITIATOR_AP_FLAGS_NON_TB or &IWL_INITIATOR_AP_FLAGS_TB is set.
982  * @band: 0 for 5.2 GHz, 1 for 2.4 GHz, 2 for 6GHz
983  * @min_time_between_msr: For non trigger based NDP ranging, the minimum time
984  *	between measurements in units of milliseconds
985  */
986 struct iwl_tof_range_req_ap_entry_v9 {
987 	__le32 initiator_ap_flags;
988 	u8 channel_num;
989 	u8 format_bw;
990 	u8 ctrl_ch_position;
991 	u8 ftmr_max_retries;
992 	u8 bssid[ETH_ALEN];
993 	__le16 burst_period;
994 	u8 samples_per_burst;
995 	u8 num_of_bursts;
996 	u8 sta_id;
997 	u8 cipher;
998 	u8 hltk[HLTK_11AZ_LEN];
999 	u8 tk[TK_11AZ_LEN];
1000 	__le16 calib[IWL_TOF_BW_NUM];
1001 	u16 beacon_interval;
1002 	u8 rx_pn[IEEE80211_CCMP_PN_LEN];
1003 	u8 tx_pn[IEEE80211_CCMP_PN_LEN];
1004 	u8 r2i_ndp_params;
1005 	u8 i2r_ndp_params;
1006 	u8 r2i_max_total_ltf;
1007 	u8 i2r_max_total_ltf;
1008 	u8 bss_color;
1009 	u8 band;
1010 	__le16 min_time_between_msr;
1011 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_9 */
1012 
1013 /**
1014  * struct iwl_tof_range_req_ap_entry_v10 - AP configuration parameters
1015  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
1016  * @band: 0 for 5.2 GHz, 1 for 2.4 GHz, 2 for 6GHz
1017  * @channel_num: AP Channel number
1018  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
1019  *             bits 4 - 7: &enum iwl_location_bw.
1020  * @ctrl_ch_position: Coding of the control channel position relative to the
1021  *	center frequency, see iwl_mvm_get_ctrl_pos().
1022  * @bssid: AP's BSSID
1023  * @burst_period: For EDCA based ranging: Recommended value to be sent to the
1024  *	AP. Measurement periodicity In units of 100ms. ignored if
1025  *	num_of_bursts_exp = 0.
1026  *	For non trigger based NDP ranging, the maximum time between
1027  *	measurements in units of milliseconds.
1028  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
1029  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
1030  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
1031  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
1032  *	otherwise should be set to &IWL_MVM_INVALID_STA.
1033  * @cipher: pairwise cipher suite for secured measurement.
1034  *          &enum iwl_location_cipher.
1035  * @hltk: HLTK to be used for secured 11az measurement
1036  * @tk: TK to be used for secured 11az measurement
1037  * @calib: An array of calibration values per FTM rx bandwidth.
1038  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
1039  *         calibration value that corresponds to the rx bandwidth of the FTM
1040  *         frame.
1041  * @beacon_interval: beacon interval of the AP in TUs. Only required if
1042  *	&IWL_INITIATOR_AP_FLAGS_TB is set.
1043  * @rx_pn: the next expected PN for protected management frames Rx. LE byte
1044  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
1045  *	is set to &IWL_MVM_INVALID_STA.
1046  * @tx_pn: the next PN to use for protected management frames Tx. LE byte
1047  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
1048  *	is set to &IWL_MVM_INVALID_STA.
1049  * @r2i_ndp_params: parameters for R2I NDP ranging negotiation.
1050  *      bits 0 - 2: max LTF repetitions
1051  *      bits 3 - 5: max number of spatial streams
1052  *      bits 6 - 7: max total LTFs. One of
1053  *		&enum ieee80211_range_params_max_total_ltf.
1054  * @i2r_ndp_params: parameters for I2R NDP ranging negotiation.
1055  *      bits 0 - 2: max LTF repetitions
1056  *      bits 3 - 5: max number of spatial streams (supported values are < 2)
1057  *      bits 6 - 7: max total LTFs. One of
1058  *		&enum ieee80211_range_params_max_total_ltf.
1059  * @min_time_between_msr: For non trigger based NDP ranging, the minimum time
1060  *	between measurements in units of milliseconds
1061  */
1062 struct iwl_tof_range_req_ap_entry_v10 {
1063 	__le32 initiator_ap_flags;
1064 	u8 band;
1065 	u8 channel_num;
1066 	u8 format_bw;
1067 	u8 ctrl_ch_position;
1068 	u8 bssid[ETH_ALEN];
1069 	__le16 burst_period;
1070 	u8 samples_per_burst;
1071 	u8 num_of_bursts;
1072 	u8 sta_id;
1073 	u8 cipher;
1074 	u8 hltk[HLTK_11AZ_LEN];
1075 	u8 tk[TK_11AZ_LEN];
1076 	__le16 calib[IWL_TOF_BW_NUM];
1077 	__le16 beacon_interval;
1078 	u8 rx_pn[IEEE80211_CCMP_PN_LEN];
1079 	u8 tx_pn[IEEE80211_CCMP_PN_LEN];
1080 	u8 r2i_ndp_params;
1081 	u8 i2r_ndp_params;
1082 	__le16 min_time_between_msr;
1083 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_9 */
1084 
1085 /**
1086  * enum iwl_tof_response_mode
1087  * @IWL_MVM_TOF_RESPONSE_ASAP: report each AP measurement separately as soon as
1088  *			       possible (not supported for this release)
1089  * @IWL_MVM_TOF_RESPONSE_TIMEOUT: report all AP measurements as a batch upon
1090  *				  timeout expiration
1091  * @IWL_MVM_TOF_RESPONSE_COMPLETE: report all AP measurements as a batch at the
1092  *				   earlier of: measurements completion / timeout
1093  *				   expiration.
1094  */
1095 enum iwl_tof_response_mode {
1096 	IWL_MVM_TOF_RESPONSE_ASAP,
1097 	IWL_MVM_TOF_RESPONSE_TIMEOUT,
1098 	IWL_MVM_TOF_RESPONSE_COMPLETE,
1099 };
1100 
1101 /**
1102  * enum iwl_tof_initiator_flags
1103  *
1104  * @IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED: disable fast algo, meaning run
1105  *	the algo on ant A+B, instead of only one of them.
1106  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A: open RX antenna A for FTMs RX
1107  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B: open RX antenna B for FTMs RX
1108  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C: open RX antenna C for FTMs RX
1109  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A: use antenna A fo TX ACKs during FTM
1110  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B: use antenna B fo TX ACKs during FTM
1111  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C: use antenna C fo TX ACKs during FTM
1112  * @IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM: use random mac address for FTM
1113  * @IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB: use the specific calib value from
1114  *	the range request command
1115  * @IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB: use the common calib value from the
1116  *	ragne request command
1117  * @IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT: support non-asap measurements
1118  */
1119 enum iwl_tof_initiator_flags {
1120 	IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED = BIT(0),
1121 	IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A = BIT(1),
1122 	IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B = BIT(2),
1123 	IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C = BIT(3),
1124 	IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A = BIT(4),
1125 	IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B = BIT(5),
1126 	IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C = BIT(6),
1127 	IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM = BIT(7),
1128 	IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB = BIT(15),
1129 	IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB   = BIT(16),
1130 	IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT = BIT(20),
1131 }; /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */
1132 
1133 #define IWL_MVM_TOF_MAX_APS 5
1134 #define IWL_MVM_TOF_MAX_TWO_SIDED_APS 5
1135 
1136 /**
1137  * struct iwl_tof_range_req_cmd_v5 - start measurement cmd
1138  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1139  * @request_id: A Token incremented per request. The same Token will be
1140  *		sent back in the range response
1141  * @initiator: 0- NW initiated,  1 - Client Initiated
1142  * @one_sided_los_disable: '0'- run ML-Algo for both ToF/OneSided,
1143  *			   '1' - run ML-Algo for ToF only
1144  * @req_timeout: Requested timeout of the response in units of 100ms.
1145  *	     This is equivalent to the session time configured to the
1146  *	     LMAC in Initiator Request
1147  * @report_policy: Supported partially for this release: For current release -
1148  *		   the range report will be uploaded as a batch when ready or
1149  *		   when the session is done (successfully / partially).
1150  *		   one of iwl_tof_response_mode.
1151  * @reserved0: reserved
1152  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1153  * @macaddr_random: '0' Use default source MAC address (i.e. p2_p),
1154  *	            '1' Use MAC Address randomization according to the below
1155  * @range_req_bssid: ranging request BSSID
1156  * @macaddr_template: MAC address template to use for non-randomized bits
1157  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1158  *		  Bits set to 1 shall be randomized by the UMAC
1159  * @ftm_rx_chains: Rx chain to open to receive Responder's FTMs (XVT)
1160  * @ftm_tx_chains: Tx chain to send the ack to the Responder FTM (XVT)
1161  * @common_calib: The common calib value to inject to this measurement calc
1162  * @specific_calib: The specific calib value to inject to this measurement calc
1163  * @ap: per-AP request data
1164  */
1165 struct iwl_tof_range_req_cmd_v5 {
1166 	__le32 initiator_flags;
1167 	u8 request_id;
1168 	u8 initiator;
1169 	u8 one_sided_los_disable;
1170 	u8 req_timeout;
1171 	u8 report_policy;
1172 	u8 reserved0;
1173 	u8 num_of_ap;
1174 	u8 macaddr_random;
1175 	u8 range_req_bssid[ETH_ALEN];
1176 	u8 macaddr_template[ETH_ALEN];
1177 	u8 macaddr_mask[ETH_ALEN];
1178 	u8 ftm_rx_chains;
1179 	u8 ftm_tx_chains;
1180 	__le16 common_calib;
1181 	__le16 specific_calib;
1182 	struct iwl_tof_range_req_ap_entry_v2 ap[IWL_MVM_TOF_MAX_APS];
1183 } __packed;
1184 /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */
1185 
1186 /**
1187  * struct iwl_tof_range_req_cmd_v7 - start measurement cmd
1188  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1189  * @request_id: A Token incremented per request. The same Token will be
1190  *		sent back in the range response
1191  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1192  * @range_req_bssid: ranging request BSSID
1193  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1194  *		  Bits set to 1 shall be randomized by the UMAC
1195  * @macaddr_template: MAC address template to use for non-randomized bits
1196  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
1197  *	This is the session time for completing the measurement.
1198  * @tsf_mac_id: report the measurement start time for each ap in terms of the
1199  *	TSF of this mac id. 0xff to disable TSF reporting.
1200  * @common_calib: The common calib value to inject to this measurement calc
1201  * @specific_calib: The specific calib value to inject to this measurement calc
1202  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
1203  */
1204 struct iwl_tof_range_req_cmd_v7 {
1205 	__le32 initiator_flags;
1206 	u8 request_id;
1207 	u8 num_of_ap;
1208 	u8 range_req_bssid[ETH_ALEN];
1209 	u8 macaddr_mask[ETH_ALEN];
1210 	u8 macaddr_template[ETH_ALEN];
1211 	__le32 req_timeout_ms;
1212 	__le32 tsf_mac_id;
1213 	__le16 common_calib;
1214 	__le16 specific_calib;
1215 	struct iwl_tof_range_req_ap_entry_v3 ap[IWL_MVM_TOF_MAX_APS];
1216 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_7 */
1217 
1218 /**
1219  * struct iwl_tof_range_req_cmd_v8 - start measurement cmd
1220  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1221  * @request_id: A Token incremented per request. The same Token will be
1222  *		sent back in the range response
1223  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1224  * @range_req_bssid: ranging request BSSID
1225  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1226  *		  Bits set to 1 shall be randomized by the UMAC
1227  * @macaddr_template: MAC address template to use for non-randomized bits
1228  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
1229  *	This is the session time for completing the measurement.
1230  * @tsf_mac_id: report the measurement start time for each ap in terms of the
1231  *	TSF of this mac id. 0xff to disable TSF reporting.
1232  * @common_calib: The common calib value to inject to this measurement calc
1233  * @specific_calib: The specific calib value to inject to this measurement calc
1234  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
1235  */
1236 struct iwl_tof_range_req_cmd_v8 {
1237 	__le32 initiator_flags;
1238 	u8 request_id;
1239 	u8 num_of_ap;
1240 	u8 range_req_bssid[ETH_ALEN];
1241 	u8 macaddr_mask[ETH_ALEN];
1242 	u8 macaddr_template[ETH_ALEN];
1243 	__le32 req_timeout_ms;
1244 	__le32 tsf_mac_id;
1245 	__le16 common_calib;
1246 	__le16 specific_calib;
1247 	struct iwl_tof_range_req_ap_entry_v4 ap[IWL_MVM_TOF_MAX_APS];
1248 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_8 */
1249 
1250 /**
1251  * struct iwl_tof_range_req_cmd_v9 - start measurement cmd
1252  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1253  * @request_id: A Token incremented per request. The same Token will be
1254  *		sent back in the range response
1255  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1256  * @range_req_bssid: ranging request BSSID
1257  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1258  *		  Bits set to 1 shall be randomized by the UMAC
1259  * @macaddr_template: MAC address template to use for non-randomized bits
1260  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
1261  *	This is the session time for completing the measurement.
1262  * @tsf_mac_id: report the measurement start time for each ap in terms of the
1263  *	TSF of this mac id. 0xff to disable TSF reporting.
1264  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
1265  */
1266 struct iwl_tof_range_req_cmd_v9 {
1267 	__le32 initiator_flags;
1268 	u8 request_id;
1269 	u8 num_of_ap;
1270 	u8 range_req_bssid[ETH_ALEN];
1271 	u8 macaddr_mask[ETH_ALEN];
1272 	u8 macaddr_template[ETH_ALEN];
1273 	__le32 req_timeout_ms;
1274 	__le32 tsf_mac_id;
1275 	struct iwl_tof_range_req_ap_entry_v6 ap[IWL_MVM_TOF_MAX_APS];
1276 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_9 */
1277 
1278 /**
1279  * struct iwl_tof_range_req_cmd_v11 - start measurement cmd
1280  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1281  * @request_id: A Token incremented per request. The same Token will be
1282  *		sent back in the range response
1283  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1284  * @range_req_bssid: ranging request BSSID
1285  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1286  *		  Bits set to 1 shall be randomized by the UMAC
1287  * @macaddr_template: MAC address template to use for non-randomized bits
1288  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
1289  *	This is the session time for completing the measurement.
1290  * @tsf_mac_id: report the measurement start time for each ap in terms of the
1291  *	TSF of this mac id. 0xff to disable TSF reporting.
1292  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
1293  */
1294 struct iwl_tof_range_req_cmd_v11 {
1295 	__le32 initiator_flags;
1296 	u8 request_id;
1297 	u8 num_of_ap;
1298 	u8 range_req_bssid[ETH_ALEN];
1299 	u8 macaddr_mask[ETH_ALEN];
1300 	u8 macaddr_template[ETH_ALEN];
1301 	__le32 req_timeout_ms;
1302 	__le32 tsf_mac_id;
1303 	struct iwl_tof_range_req_ap_entry_v7 ap[IWL_MVM_TOF_MAX_APS];
1304 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_11 */
1305 
1306 /**
1307  * struct iwl_tof_range_req_cmd_v12 - start measurement cmd
1308  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1309  * @request_id: A Token incremented per request. The same Token will be
1310  *		sent back in the range response
1311  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1312  * @range_req_bssid: ranging request BSSID
1313  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1314  *		  Bits set to 1 shall be randomized by the UMAC
1315  * @macaddr_template: MAC address template to use for non-randomized bits
1316  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
1317  *	This is the session time for completing the measurement.
1318  * @tsf_mac_id: report the measurement start time for each ap in terms of the
1319  *	TSF of this mac id. 0xff to disable TSF reporting.
1320  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
1321  */
1322 struct iwl_tof_range_req_cmd_v12 {
1323 	__le32 initiator_flags;
1324 	u8 request_id;
1325 	u8 num_of_ap;
1326 	u8 range_req_bssid[ETH_ALEN];
1327 	u8 macaddr_mask[ETH_ALEN];
1328 	u8 macaddr_template[ETH_ALEN];
1329 	__le32 req_timeout_ms;
1330 	__le32 tsf_mac_id;
1331 	struct iwl_tof_range_req_ap_entry_v8 ap[IWL_MVM_TOF_MAX_APS];
1332 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_12 */
1333 
1334 /**
1335  * struct iwl_tof_range_req_cmd_v13 - start measurement cmd
1336  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1337  * @request_id: A Token incremented per request. The same Token will be
1338  *		sent back in the range response
1339  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1340  * @range_req_bssid: ranging request BSSID
1341  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1342  *		  Bits set to 1 shall be randomized by the UMAC
1343  * @macaddr_template: MAC address template to use for non-randomized bits
1344  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
1345  *	This is the session time for completing the measurement.
1346  * @tsf_mac_id: report the measurement start time for each ap in terms of the
1347  *	TSF of this mac id. 0xff to disable TSF reporting.
1348  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v9.
1349  */
1350 struct iwl_tof_range_req_cmd_v13 {
1351 	__le32 initiator_flags;
1352 	u8 request_id;
1353 	u8 num_of_ap;
1354 	u8 range_req_bssid[ETH_ALEN];
1355 	u8 macaddr_mask[ETH_ALEN];
1356 	u8 macaddr_template[ETH_ALEN];
1357 	__le32 req_timeout_ms;
1358 	__le32 tsf_mac_id;
1359 	struct iwl_tof_range_req_ap_entry_v9 ap[IWL_MVM_TOF_MAX_APS];
1360 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_13 */
1361 
1362 /**
1363  * struct iwl_tof_range_req_cmd_v14 - start measurement cmd
1364  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1365  * @request_id: A Token incremented per request. The same Token will be
1366  *		sent back in the range response
1367  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1368  * @range_req_bssid: ranging request BSSID
1369  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1370  *		  Bits set to 1 shall be randomized by the UMAC
1371  * @macaddr_template: MAC address template to use for non-randomized bits
1372  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
1373  *	This is the session time for completing the measurement.
1374  * @tsf_mac_id: report the measurement start time for each ap in terms of the
1375  *	TSF of this mac id. 0xff to disable TSF reporting.
1376  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v10.
1377  */
1378 struct iwl_tof_range_req_cmd_v14 {
1379 	__le32 initiator_flags;
1380 	u8 request_id;
1381 	u8 num_of_ap;
1382 	u8 range_req_bssid[ETH_ALEN];
1383 	u8 macaddr_mask[ETH_ALEN];
1384 	u8 macaddr_template[ETH_ALEN];
1385 	__le32 req_timeout_ms;
1386 	__le32 tsf_mac_id;
1387 	struct iwl_tof_range_req_ap_entry_v10 ap[IWL_MVM_TOF_MAX_APS];
1388 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_13 */
1389 
1390 /*
1391  * enum iwl_tof_range_request_status - status of the sent request
1392  * @IWL_TOF_RANGE_REQUEST_STATUS_SUCCESSFUL - FW successfully received the
1393  *	request
1394  * @IWL_TOF_RANGE_REQUEST_STATUS_BUSY - FW is busy with a previous request, the
1395  *	sent request will not be handled
1396  */
1397 enum iwl_tof_range_request_status {
1398 	IWL_TOF_RANGE_REQUEST_STATUS_SUCCESS,
1399 	IWL_TOF_RANGE_REQUEST_STATUS_BUSY,
1400 };
1401 
1402 /**
1403  * enum iwl_tof_entry_status
1404  *
1405  * @IWL_TOF_ENTRY_SUCCESS: successful measurement.
1406  * @IWL_TOF_ENTRY_GENERAL_FAILURE: General failure.
1407  * @IWL_TOF_ENTRY_NO_RESPONSE: Responder didn't reply to the request.
1408  * @IWL_TOF_ENTRY_REQUEST_REJECTED: Responder rejected the request.
1409  * @IWL_TOF_ENTRY_NOT_SCHEDULED: Time event was scheduled but not called yet.
1410  * @IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT: Time event triggered but no
1411  *	measurement was completed.
1412  * @IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE: No range due inability to switch
1413  *	from the primary channel.
1414  * @IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED: Device doesn't support FTM.
1415  * @IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON: Request aborted due to unknown
1416  *	reason.
1417  * @IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP: Failure due to invalid
1418  *	T1/T4.
1419  * @IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE: Failure due to invalid FTM frame
1420  *	structure.
1421  * @IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED: Request cannot be scheduled.
1422  * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE: Responder cannot serve the
1423  *	initiator for some period, period supplied in @refusal_period.
1424  * @IWL_TOF_ENTRY_BAD_REQUEST_ARGS: Bad request arguments.
1425  * @IWL_TOF_ENTRY_WIFI_NOT_ENABLED: Wifi not enabled.
1426  * @IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS: Responder override the original
1427  *	parameters within the current session.
1428  */
1429 enum iwl_tof_entry_status {
1430 	IWL_TOF_ENTRY_SUCCESS = 0,
1431 	IWL_TOF_ENTRY_GENERAL_FAILURE = 1,
1432 	IWL_TOF_ENTRY_NO_RESPONSE = 2,
1433 	IWL_TOF_ENTRY_REQUEST_REJECTED = 3,
1434 	IWL_TOF_ENTRY_NOT_SCHEDULED = 4,
1435 	IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT = 5,
1436 	IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE = 6,
1437 	IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED = 7,
1438 	IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON = 8,
1439 	IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP = 9,
1440 	IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE = 10,
1441 	IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED = 11,
1442 	IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE = 12,
1443 	IWL_TOF_ENTRY_BAD_REQUEST_ARGS = 13,
1444 	IWL_TOF_ENTRY_WIFI_NOT_ENABLED = 14,
1445 	IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS = 15,
1446 }; /* LOCATION_RANGE_RSP_AP_ENTRY_NTFY_API_S_VER_2 */
1447 
1448 /**
1449  * struct iwl_tof_range_rsp_ap_entry_ntfy_v3 - AP parameters (response)
1450  * @bssid: BSSID of the AP
1451  * @measure_status: current APs measurement status, one of
1452  *	&enum iwl_tof_entry_status.
1453  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
1454  * @rtt: The Round Trip Time that took for the last measurement for
1455  *	current AP [pSec]
1456  * @rtt_variance: The Variance of the RTT values measured for current AP
1457  * @rtt_spread: The Difference between the maximum and the minimum RTT
1458  *	values measured for current AP in the current session [pSec]
1459  * @rssi: RSSI as uploaded in the Channel Estimation notification
1460  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
1461  *	measured for current AP in the current session
1462  * @reserved: reserved
1463  * @refusal_period: refusal period in case of
1464  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
1465  * @range: Measured range [cm]
1466  * @range_variance: Measured range variance [cm]
1467  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
1468  *	uploaded by the LMAC
1469  * @t2t3_initiator: as calculated from the algo in the initiator
1470  * @t1t4_responder: as calculated from the algo in the responder
1471  * @common_calib: Calib val that was used in for this AP measurement
1472  * @specific_calib: val that was used in for this AP measurement
1473  * @papd_calib_output: The result of the tof papd calibration that was injected
1474  *	into the algorithm.
1475  */
1476 struct iwl_tof_range_rsp_ap_entry_ntfy_v3 {
1477 	u8 bssid[ETH_ALEN];
1478 	u8 measure_status;
1479 	u8 measure_bw;
1480 	__le32 rtt;
1481 	__le32 rtt_variance;
1482 	__le32 rtt_spread;
1483 	s8 rssi;
1484 	u8 rssi_spread;
1485 	u8 reserved;
1486 	u8 refusal_period;
1487 	__le32 range;
1488 	__le32 range_variance;
1489 	__le32 timestamp;
1490 	__le32 t2t3_initiator;
1491 	__le32 t1t4_responder;
1492 	__le16 common_calib;
1493 	__le16 specific_calib;
1494 	__le32 papd_calib_output;
1495 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_3 */
1496 
1497 /**
1498  * struct iwl_tof_range_rsp_ap_entry_ntfy_v4 - AP parameters (response)
1499  * @bssid: BSSID of the AP
1500  * @measure_status: current APs measurement status, one of
1501  *	&enum iwl_tof_entry_status.
1502  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
1503  * @rtt: The Round Trip Time that took for the last measurement for
1504  *	current AP [pSec]
1505  * @rtt_variance: The Variance of the RTT values measured for current AP
1506  * @rtt_spread: The Difference between the maximum and the minimum RTT
1507  *	values measured for current AP in the current session [pSec]
1508  * @rssi: RSSI as uploaded in the Channel Estimation notification
1509  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
1510  *	measured for current AP in the current session
1511  * @last_burst: 1 if no more FTM sessions are scheduled for this responder
1512  * @refusal_period: refusal period in case of
1513  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
1514  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
1515  *	uploaded by the LMAC
1516  * @start_tsf: measurement start time in TSF of the mac specified in the range
1517  *	request
1518  * @rx_rate_n_flags: rate and flags of the last FTM frame received from this
1519  *	responder
1520  * @tx_rate_n_flags: rate and flags of the last ack sent to this responder
1521  * @t2t3_initiator: as calculated from the algo in the initiator
1522  * @t1t4_responder: as calculated from the algo in the responder
1523  * @common_calib: Calib val that was used in for this AP measurement
1524  * @specific_calib: val that was used in for this AP measurement
1525  * @papd_calib_output: The result of the tof papd calibration that was injected
1526  *	into the algorithm.
1527  */
1528 struct iwl_tof_range_rsp_ap_entry_ntfy_v4 {
1529 	u8 bssid[ETH_ALEN];
1530 	u8 measure_status;
1531 	u8 measure_bw;
1532 	__le32 rtt;
1533 	__le32 rtt_variance;
1534 	__le32 rtt_spread;
1535 	s8 rssi;
1536 	u8 rssi_spread;
1537 	u8 last_burst;
1538 	u8 refusal_period;
1539 	__le32 timestamp;
1540 	__le32 start_tsf;
1541 	__le32 rx_rate_n_flags;
1542 	__le32 tx_rate_n_flags;
1543 	__le32 t2t3_initiator;
1544 	__le32 t1t4_responder;
1545 	__le16 common_calib;
1546 	__le16 specific_calib;
1547 	__le32 papd_calib_output;
1548 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_4 */
1549 
1550 /**
1551  * struct iwl_tof_range_rsp_ap_entry_ntfy_v5 - AP parameters (response)
1552  * @bssid: BSSID of the AP
1553  * @measure_status: current APs measurement status, one of
1554  *	&enum iwl_tof_entry_status.
1555  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
1556  * @rtt: The Round Trip Time that took for the last measurement for
1557  *	current AP [pSec]
1558  * @rtt_variance: The Variance of the RTT values measured for current AP
1559  * @rtt_spread: The Difference between the maximum and the minimum RTT
1560  *	values measured for current AP in the current session [pSec]
1561  * @rssi: RSSI as uploaded in the Channel Estimation notification
1562  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
1563  *	measured for current AP in the current session
1564  * @last_burst: 1 if no more FTM sessions are scheduled for this responder
1565  * @refusal_period: refusal period in case of
1566  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
1567  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
1568  *	uploaded by the LMAC
1569  * @start_tsf: measurement start time in TSF of the mac specified in the range
1570  *	request
1571  * @rx_rate_n_flags: rate and flags of the last FTM frame received from this
1572  *	responder
1573  * @tx_rate_n_flags: rate and flags of the last ack sent to this responder
1574  * @t2t3_initiator: as calculated from the algo in the initiator
1575  * @t1t4_responder: as calculated from the algo in the responder
1576  * @common_calib: Calib val that was used in for this AP measurement
1577  * @specific_calib: val that was used in for this AP measurement
1578  * @papd_calib_output: The result of the tof papd calibration that was injected
1579  *	into the algorithm.
1580  * @rttConfidence: a value between 0 - 31 that represents the rtt accuracy.
1581  * @reserved: for alignment
1582  */
1583 struct iwl_tof_range_rsp_ap_entry_ntfy_v5 {
1584 	u8 bssid[ETH_ALEN];
1585 	u8 measure_status;
1586 	u8 measure_bw;
1587 	__le32 rtt;
1588 	__le32 rtt_variance;
1589 	__le32 rtt_spread;
1590 	s8 rssi;
1591 	u8 rssi_spread;
1592 	u8 last_burst;
1593 	u8 refusal_period;
1594 	__le32 timestamp;
1595 	__le32 start_tsf;
1596 	__le32 rx_rate_n_flags;
1597 	__le32 tx_rate_n_flags;
1598 	__le32 t2t3_initiator;
1599 	__le32 t1t4_responder;
1600 	__le16 common_calib;
1601 	__le16 specific_calib;
1602 	__le32 papd_calib_output;
1603 	u8 rttConfidence;
1604 	u8 reserved[3];
1605 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_5 */
1606 
1607 /**
1608  * struct iwl_tof_range_rsp_ap_entry_ntfy_v6 - AP parameters (response)
1609  * @bssid: BSSID of the AP
1610  * @measure_status: current APs measurement status, one of
1611  *	&enum iwl_tof_entry_status.
1612  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
1613  * @rtt: The Round Trip Time that took for the last measurement for
1614  *	current AP [pSec]
1615  * @rtt_variance: The Variance of the RTT values measured for current AP
1616  * @rtt_spread: The Difference between the maximum and the minimum RTT
1617  *	values measured for current AP in the current session [pSec]
1618  * @rssi: RSSI as uploaded in the Channel Estimation notification
1619  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
1620  *	measured for current AP in the current session
1621  * @last_burst: 1 if no more FTM sessions are scheduled for this responder
1622  * @refusal_period: refusal period in case of
1623  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
1624  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
1625  *	uploaded by the LMAC
1626  * @start_tsf: measurement start time in TSF of the mac specified in the range
1627  *	request
1628  * @rx_rate_n_flags: rate and flags of the last FTM frame received from this
1629  *	responder
1630  * @tx_rate_n_flags: rate and flags of the last ack sent to this responder
1631  * @t2t3_initiator: as calculated from the algo in the initiator
1632  * @t1t4_responder: as calculated from the algo in the responder
1633  * @common_calib: Calib val that was used in for this AP measurement
1634  * @specific_calib: val that was used in for this AP measurement
1635  * @papd_calib_output: The result of the tof papd calibration that was injected
1636  *	into the algorithm.
1637  * @rttConfidence: a value between 0 - 31 that represents the rtt accuracy.
1638  * @reserved: for alignment
1639  * @rx_pn: the last PN used for this responder Rx in case PMF is configured in
1640  *	LE byte order.
1641  * @tx_pn: the last PN used for this responder Tx in case PMF is configured in
1642  *	LE byte order.
1643  */
1644 struct iwl_tof_range_rsp_ap_entry_ntfy_v6 {
1645 	u8 bssid[ETH_ALEN];
1646 	u8 measure_status;
1647 	u8 measure_bw;
1648 	__le32 rtt;
1649 	__le32 rtt_variance;
1650 	__le32 rtt_spread;
1651 	s8 rssi;
1652 	u8 rssi_spread;
1653 	u8 last_burst;
1654 	u8 refusal_period;
1655 	__le32 timestamp;
1656 	__le32 start_tsf;
1657 	__le32 rx_rate_n_flags;
1658 	__le32 tx_rate_n_flags;
1659 	__le32 t2t3_initiator;
1660 	__le32 t1t4_responder;
1661 	__le16 common_calib;
1662 	__le16 specific_calib;
1663 	__le32 papd_calib_output;
1664 	u8 rttConfidence;
1665 	u8 reserved[3];
1666 	u8 rx_pn[IEEE80211_CCMP_PN_LEN];
1667 	u8 tx_pn[IEEE80211_CCMP_PN_LEN];
1668 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_6,
1669 	       LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_7 */
1670 
1671 
1672 /**
1673  * enum iwl_tof_response_status - tof response status
1674  *
1675  * @IWL_TOF_RESPONSE_SUCCESS: successful range.
1676  * @IWL_TOF_RESPONSE_TIMEOUT: request aborted due to timeout expiration.
1677  *	partial result of ranges done so far is included in the response.
1678  * @IWL_TOF_RESPONSE_ABORTED: Measurement aborted by command.
1679  * @IWL_TOF_RESPONSE_FAILED: Measurement request command failed.
1680  */
1681 enum iwl_tof_response_status {
1682 	IWL_TOF_RESPONSE_SUCCESS = 0,
1683 	IWL_TOF_RESPONSE_TIMEOUT = 1,
1684 	IWL_TOF_RESPONSE_ABORTED = 4,
1685 	IWL_TOF_RESPONSE_FAILED  = 5,
1686 }; /* LOCATION_RNG_RSP_STATUS */
1687 
1688 /**
1689  * struct iwl_tof_range_rsp_ntfy_v5 - ranging response notification
1690  * @request_id: A Token ID of the corresponding Range request
1691  * @request_status: status of current measurement session, one of
1692  *	&enum iwl_tof_response_status.
1693  * @last_in_batch: reprot policy (when not all responses are uploaded at once)
1694  * @num_of_aps: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1695  * @ap: per-AP data
1696  */
1697 struct iwl_tof_range_rsp_ntfy_v5 {
1698 	u8 request_id;
1699 	u8 request_status;
1700 	u8 last_in_batch;
1701 	u8 num_of_aps;
1702 	struct iwl_tof_range_rsp_ap_entry_ntfy_v3 ap[IWL_MVM_TOF_MAX_APS];
1703 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_5 */
1704 
1705 /**
1706  * struct iwl_tof_range_rsp_ntfy_v6 - ranging response notification
1707  * @request_id: A Token ID of the corresponding Range request
1708  * @num_of_aps: Number of APs results
1709  * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
1710  * @reserved: reserved
1711  * @ap: per-AP data
1712  */
1713 struct iwl_tof_range_rsp_ntfy_v6 {
1714 	u8 request_id;
1715 	u8 num_of_aps;
1716 	u8 last_report;
1717 	u8 reserved;
1718 	struct iwl_tof_range_rsp_ap_entry_ntfy_v4 ap[IWL_MVM_TOF_MAX_APS];
1719 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_6 */
1720 
1721 /**
1722  * struct iwl_tof_range_rsp_ntfy_v7 - ranging response notification
1723  * @request_id: A Token ID of the corresponding Range request
1724  * @num_of_aps: Number of APs results
1725  * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
1726  * @reserved: reserved
1727  * @ap: per-AP data
1728  */
1729 struct iwl_tof_range_rsp_ntfy_v7 {
1730 	u8 request_id;
1731 	u8 num_of_aps;
1732 	u8 last_report;
1733 	u8 reserved;
1734 	struct iwl_tof_range_rsp_ap_entry_ntfy_v5 ap[IWL_MVM_TOF_MAX_APS];
1735 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_7 */
1736 
1737 /**
1738  * struct iwl_tof_range_rsp_ntfy_v8 - ranging response notification
1739  * @request_id: A Token ID of the corresponding Range request
1740  * @num_of_aps: Number of APs results
1741  * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
1742  * @reserved: reserved
1743  * @ap: per-AP data
1744  */
1745 struct iwl_tof_range_rsp_ntfy_v8 {
1746 	u8 request_id;
1747 	u8 num_of_aps;
1748 	u8 last_report;
1749 	u8 reserved;
1750 	struct iwl_tof_range_rsp_ap_entry_ntfy_v6 ap[IWL_MVM_TOF_MAX_APS];
1751 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_8,
1752 	       LOCATION_RANGE_RSP_NTFY_API_S_VER_9 */
1753 
1754 #define IWL_MVM_TOF_MCSI_BUF_SIZE  (245)
1755 /**
1756  * struct iwl_tof_mcsi_notif - used for debug
1757  * @token: token ID for the current session
1758  * @role: '0' - initiator, '1' - responder
1759  * @reserved: reserved
1760  * @initiator_bssid: initiator machine
1761  * @responder_bssid: responder machine
1762  * @mcsi_buffer: debug data
1763  */
1764 struct iwl_tof_mcsi_notif {
1765 	u8 token;
1766 	u8 role;
1767 	__le16 reserved;
1768 	u8 initiator_bssid[ETH_ALEN];
1769 	u8 responder_bssid[ETH_ALEN];
1770 	u8 mcsi_buffer[IWL_MVM_TOF_MCSI_BUF_SIZE * 4];
1771 } __packed;
1772 
1773 /**
1774  * struct iwl_tof_range_abort_cmd
1775  * @request_id: corresponds to a range request
1776  * @reserved: reserved
1777  */
1778 struct iwl_tof_range_abort_cmd {
1779 	u8 request_id;
1780 	u8 reserved[3];
1781 } __packed;
1782 
1783 enum ftm_responder_stats_flags {
1784 	FTM_RESP_STAT_NON_ASAP_STARTED = BIT(0),
1785 	FTM_RESP_STAT_NON_ASAP_IN_WIN = BIT(1),
1786 	FTM_RESP_STAT_NON_ASAP_OUT_WIN = BIT(2),
1787 	FTM_RESP_STAT_TRIGGER_DUP = BIT(3),
1788 	FTM_RESP_STAT_DUP = BIT(4),
1789 	FTM_RESP_STAT_DUP_IN_WIN = BIT(5),
1790 	FTM_RESP_STAT_DUP_OUT_WIN = BIT(6),
1791 	FTM_RESP_STAT_SCHED_SUCCESS = BIT(7),
1792 	FTM_RESP_STAT_ASAP_REQ = BIT(8),
1793 	FTM_RESP_STAT_NON_ASAP_REQ = BIT(9),
1794 	FTM_RESP_STAT_ASAP_RESP = BIT(10),
1795 	FTM_RESP_STAT_NON_ASAP_RESP = BIT(11),
1796 	FTM_RESP_STAT_FAIL_INITIATOR_INACTIVE = BIT(12),
1797 	FTM_RESP_STAT_FAIL_INITIATOR_OUT_WIN = BIT(13),
1798 	FTM_RESP_STAT_FAIL_INITIATOR_RETRY_LIM = BIT(14),
1799 	FTM_RESP_STAT_FAIL_NEXT_SERVED = BIT(15),
1800 	FTM_RESP_STAT_FAIL_TRIGGER_ERR = BIT(16),
1801 	FTM_RESP_STAT_FAIL_GC = BIT(17),
1802 	FTM_RESP_STAT_SUCCESS = BIT(18),
1803 	FTM_RESP_STAT_INTEL_IE = BIT(19),
1804 	FTM_RESP_STAT_INITIATOR_ACTIVE = BIT(20),
1805 	FTM_RESP_STAT_MEASUREMENTS_AVAILABLE = BIT(21),
1806 	FTM_RESP_STAT_TRIGGER_UNKNOWN = BIT(22),
1807 	FTM_RESP_STAT_PROCESS_FAIL = BIT(23),
1808 	FTM_RESP_STAT_ACK = BIT(24),
1809 	FTM_RESP_STAT_NACK = BIT(25),
1810 	FTM_RESP_STAT_INVALID_INITIATOR_ID = BIT(26),
1811 	FTM_RESP_STAT_TIMER_MIN_DELTA = BIT(27),
1812 	FTM_RESP_STAT_INITIATOR_REMOVED = BIT(28),
1813 	FTM_RESP_STAT_INITIATOR_ADDED = BIT(29),
1814 	FTM_RESP_STAT_ERR_LIST_FULL = BIT(30),
1815 	FTM_RESP_STAT_INITIATOR_SCHED_NOW = BIT(31),
1816 }; /* RESP_IND_E */
1817 
1818 /**
1819  * struct iwl_ftm_responder_stats - FTM responder statistics
1820  * @addr: initiator address
1821  * @success_ftm: number of successful ftm frames
1822  * @ftm_per_burst: num of FTM frames that were received
1823  * @flags: &enum ftm_responder_stats_flags
1824  * @duration: actual duration of FTM
1825  * @allocated_duration: time that was allocated for this FTM session
1826  * @bw: FTM request bandwidth
1827  * @rate: FTM request rate
1828  * @reserved: for alingment and future use
1829  */
1830 struct iwl_ftm_responder_stats {
1831 	u8 addr[ETH_ALEN];
1832 	u8 success_ftm;
1833 	u8 ftm_per_burst;
1834 	__le32 flags;
1835 	__le32 duration;
1836 	__le32 allocated_duration;
1837 	u8 bw;
1838 	u8 rate;
1839 	__le16 reserved;
1840 } __packed; /* TOF_RESPONDER_STATISTICS_NTFY_S_VER_2 */
1841 
1842 #define IWL_CSI_MAX_EXPECTED_CHUNKS		16
1843 
1844 #define IWL_CSI_CHUNK_CTL_NUM_MASK_VER_1	0x0003
1845 #define IWL_CSI_CHUNK_CTL_IDX_MASK_VER_1	0x000c
1846 
1847 #define IWL_CSI_CHUNK_CTL_NUM_MASK_VER_2	0x00ff
1848 #define IWL_CSI_CHUNK_CTL_IDX_MASK_VER_2	0xff00
1849 
1850 struct iwl_csi_chunk_notification {
1851 	__le32 token;
1852 	__le16 seq;
1853 	__le16 ctl;
1854 	__le32 size;
1855 	u8 data[];
1856 } __packed; /* CSI_CHUNKS_HDR_NTFY_API_S_VER_1/VER_2 */
1857 
1858 #endif /* __iwl_fw_api_location_h__ */
1859