xref: /linux/drivers/net/wireless/intel/iwlwifi/fw/api/location.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
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  * @IWL_INITIATOR_AP_FLAGS_TEST_BAD_SLTF: use incorrect secure LTF tx key. This
620  *	is used for testing. Only supported from version 15 of the range request
621  *	command.
622  */
623 enum iwl_initiator_ap_flags {
624 	IWL_INITIATOR_AP_FLAGS_ASAP = BIT(1),
625 	IWL_INITIATOR_AP_FLAGS_LCI_REQUEST = BIT(2),
626 	IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST = BIT(3),
627 	IWL_INITIATOR_AP_FLAGS_DYN_ACK = BIT(4),
628 	IWL_INITIATOR_AP_FLAGS_ALGO_LR = BIT(5),
629 	IWL_INITIATOR_AP_FLAGS_ALGO_FFT = BIT(6),
630 	IWL_INITIATOR_AP_FLAGS_MCSI_REPORT = BIT(8),
631 	IWL_INITIATOR_AP_FLAGS_NON_TB = BIT(9),
632 	IWL_INITIATOR_AP_FLAGS_TB = BIT(10),
633 	IWL_INITIATOR_AP_FLAGS_SECURED = BIT(11),
634 	IWL_INITIATOR_AP_FLAGS_LMR_FEEDBACK = BIT(12),
635 	IWL_INITIATOR_AP_FLAGS_USE_CALIB = BIT(13),
636 	IWL_INITIATOR_AP_FLAGS_PMF = BIT(14),
637 	IWL_INITIATOR_AP_FLAGS_TERMINATE_ON_LMR_FEEDBACK = BIT(15),
638 	IWL_INITIATOR_AP_FLAGS_TEST_INCORRECT_SAC = BIT(16),
639 	IWL_INITIATOR_AP_FLAGS_TEST_BAD_SLTF = BIT(17),
640 };
641 
642 /**
643  * struct iwl_tof_range_req_ap_entry_v3 - AP configuration parameters
644  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
645  * @channel_num: AP Channel number
646  * @bandwidth: AP bandwidth. One of iwl_tof_bandwidth.
647  * @ctrl_ch_position: Coding of the control channel position relative to the
648  *	center frequency, see iwl_mvm_get_ctrl_pos().
649  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
650  *	reply from the AP.
651  * @bssid: AP's BSSID
652  * @burst_period: Recommended value to be sent to the AP. Measurement
653  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
654  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
655  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
656  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
657  * @reserved: For alignment and future use
658  * @tsf_delta: not in use
659  */
660 struct iwl_tof_range_req_ap_entry_v3 {
661 	__le32 initiator_ap_flags;
662 	u8 channel_num;
663 	u8 bandwidth;
664 	u8 ctrl_ch_position;
665 	u8 ftmr_max_retries;
666 	u8 bssid[ETH_ALEN];
667 	__le16 burst_period;
668 	u8 samples_per_burst;
669 	u8 num_of_bursts;
670 	__le16 reserved;
671 	__le32 tsf_delta;
672 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_3 */
673 
674 /**
675  * enum iwl_location_frame_format - location frame formats
676  * @IWL_LOCATION_FRAME_FORMAT_LEGACY: legacy
677  * @IWL_LOCATION_FRAME_FORMAT_HT: HT
678  * @IWL_LOCATION_FRAME_FORMAT_VHT: VHT
679  * @IWL_LOCATION_FRAME_FORMAT_HE: HE
680  */
681 enum iwl_location_frame_format {
682 	IWL_LOCATION_FRAME_FORMAT_LEGACY,
683 	IWL_LOCATION_FRAME_FORMAT_HT,
684 	IWL_LOCATION_FRAME_FORMAT_VHT,
685 	IWL_LOCATION_FRAME_FORMAT_HE,
686 };
687 
688 /**
689  * enum iwl_location_bw - location bandwidth selection
690  * @IWL_LOCATION_BW_20MHZ: 20MHz
691  * @IWL_LOCATION_BW_40MHZ: 40MHz
692  * @IWL_LOCATION_BW_80MHZ: 80MHz
693  * @IWL_LOCATION_BW_160MHZ: 160MHz
694  */
695 enum iwl_location_bw {
696 	IWL_LOCATION_BW_20MHZ,
697 	IWL_LOCATION_BW_40MHZ,
698 	IWL_LOCATION_BW_80MHZ,
699 	IWL_LOCATION_BW_160MHZ,
700 };
701 
702 #define TK_11AZ_LEN	32
703 
704 #define LOCATION_BW_POS	4
705 
706 /**
707  * struct iwl_tof_range_req_ap_entry_v4 - AP configuration parameters
708  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
709  * @channel_num: AP Channel number
710  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
711  *             bits 4 - 7: &enum iwl_location_bw.
712  * @ctrl_ch_position: Coding of the control channel position relative to the
713  *	center frequency, see iwl_mvm_get_ctrl_pos().
714  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
715  *	reply from the AP.
716  * @bssid: AP's BSSID
717  * @burst_period: Recommended value to be sent to the AP. Measurement
718  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
719  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
720  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
721  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
722  * @reserved: For alignment and future use
723  * @hltk: HLTK to be used for secured 11az measurement
724  * @tk: TK to be used for secured 11az measurement
725  */
726 struct iwl_tof_range_req_ap_entry_v4 {
727 	__le32 initiator_ap_flags;
728 	u8 channel_num;
729 	u8 format_bw;
730 	u8 ctrl_ch_position;
731 	u8 ftmr_max_retries;
732 	u8 bssid[ETH_ALEN];
733 	__le16 burst_period;
734 	u8 samples_per_burst;
735 	u8 num_of_bursts;
736 	__le16 reserved;
737 	u8 hltk[HLTK_11AZ_LEN];
738 	u8 tk[TK_11AZ_LEN];
739 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_4 */
740 
741 /**
742  * enum iwl_location_cipher - location cipher selection
743  * @IWL_LOCATION_CIPHER_CCMP_128: CCMP 128
744  * @IWL_LOCATION_CIPHER_GCMP_128: GCMP 128
745  * @IWL_LOCATION_CIPHER_GCMP_256: GCMP 256
746  * @IWL_LOCATION_CIPHER_INVALID: security is not used.
747  * @IWL_LOCATION_CIPHER_MAX: maximum value for this enum.
748  */
749 enum iwl_location_cipher {
750 	IWL_LOCATION_CIPHER_CCMP_128,
751 	IWL_LOCATION_CIPHER_GCMP_128,
752 	IWL_LOCATION_CIPHER_GCMP_256,
753 	IWL_LOCATION_CIPHER_INVALID,
754 	IWL_LOCATION_CIPHER_MAX,
755 };
756 
757 /**
758  * struct iwl_tof_range_req_ap_entry_v6 - AP configuration parameters
759  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
760  * @channel_num: AP Channel number
761  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
762  *             bits 4 - 7: &enum iwl_location_bw.
763  * @ctrl_ch_position: Coding of the control channel position relative to the
764  *	center frequency, see iwl_mvm_get_ctrl_pos().
765  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
766  *	reply from the AP.
767  * @bssid: AP's BSSID
768  * @burst_period: Recommended value to be sent to the AP. Measurement
769  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
770  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
771  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
772  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
773  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
774  *	otherwise should be set to &IWL_INVALID_STA.
775  * @cipher: pairwise cipher suite for secured measurement.
776  *          &enum iwl_location_cipher.
777  * @hltk: HLTK to be used for secured 11az measurement
778  * @tk: TK to be used for secured 11az measurement
779  * @calib: An array of calibration values per FTM rx bandwidth.
780  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
781  *         calibration value that corresponds to the rx bandwidth of the FTM
782  *         frame.
783  * @beacon_interval: beacon interval of the AP in TUs. Only required if
784  *	&IWL_INITIATOR_AP_FLAGS_TB is set.
785  */
786 struct iwl_tof_range_req_ap_entry_v6 {
787 	__le32 initiator_ap_flags;
788 	u8 channel_num;
789 	u8 format_bw;
790 	u8 ctrl_ch_position;
791 	u8 ftmr_max_retries;
792 	u8 bssid[ETH_ALEN];
793 	__le16 burst_period;
794 	u8 samples_per_burst;
795 	u8 num_of_bursts;
796 	u8 sta_id;
797 	u8 cipher;
798 	u8 hltk[HLTK_11AZ_LEN];
799 	u8 tk[TK_11AZ_LEN];
800 	__le16 calib[IWL_TOF_BW_NUM];
801 	__le16 beacon_interval;
802 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_6 */
803 
804 /**
805  * struct iwl_tof_range_req_ap_entry_v7 - AP configuration parameters
806  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
807  * @channel_num: AP Channel number
808  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
809  *             bits 4 - 7: &enum iwl_location_bw.
810  * @ctrl_ch_position: Coding of the control channel position relative to the
811  *	center frequency, see iwl_mvm_get_ctrl_pos().
812  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
813  *	reply from the AP.
814  * @bssid: AP's BSSID
815  * @burst_period: Recommended value to be sent to the AP. Measurement
816  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
817  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
818  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
819  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
820  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
821  *	otherwise should be set to &IWL_INVALID_STA.
822  * @cipher: pairwise cipher suite for secured measurement.
823  *          &enum iwl_location_cipher.
824  * @hltk: HLTK to be used for secured 11az measurement
825  * @tk: TK to be used for secured 11az measurement
826  * @calib: An array of calibration values per FTM rx bandwidth.
827  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
828  *         calibration value that corresponds to the rx bandwidth of the FTM
829  *         frame.
830  * @beacon_interval: beacon interval of the AP in TUs. Only required if
831  *	&IWL_INITIATOR_AP_FLAGS_TB is set.
832  * @rx_pn: the next expected PN for protected management frames Rx. LE byte
833  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
834  *	is set to &IWL_INVALID_STA.
835  * @tx_pn: the next PN to use for protected management frames Tx. LE byte
836  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
837  *	is set to &IWL_INVALID_STA.
838  */
839 struct iwl_tof_range_req_ap_entry_v7 {
840 	__le32 initiator_ap_flags;
841 	u8 channel_num;
842 	u8 format_bw;
843 	u8 ctrl_ch_position;
844 	u8 ftmr_max_retries;
845 	u8 bssid[ETH_ALEN];
846 	__le16 burst_period;
847 	u8 samples_per_burst;
848 	u8 num_of_bursts;
849 	u8 sta_id;
850 	u8 cipher;
851 	u8 hltk[HLTK_11AZ_LEN];
852 	u8 tk[TK_11AZ_LEN];
853 	__le16 calib[IWL_TOF_BW_NUM];
854 	__le16 beacon_interval;
855 	u8 rx_pn[IEEE80211_CCMP_PN_LEN];
856 	u8 tx_pn[IEEE80211_CCMP_PN_LEN];
857 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_7 */
858 
859 #define IWL_LOCATION_MAX_STS_POS	3
860 #define IWL_LOCATION_TOTAL_LTF_POS	6
861 
862 /**
863  * struct iwl_tof_range_req_ap_entry_v8 - AP configuration parameters
864  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
865  * @channel_num: AP Channel number
866  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
867  *             bits 4 - 7: &enum iwl_location_bw.
868  * @ctrl_ch_position: Coding of the control channel position relative to the
869  *	center frequency, see iwl_mvm_get_ctrl_pos().
870  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
871  *	reply from the AP.
872  * @bssid: AP's BSSID
873  * @burst_period: Recommended value to be sent to the AP. Measurement
874  *	periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
875  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
876  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
877  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
878  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
879  *	otherwise should be set to &IWL_INVALID_STA.
880  * @cipher: pairwise cipher suite for secured measurement.
881  *          &enum iwl_location_cipher.
882  * @hltk: HLTK to be used for secured 11az measurement
883  * @tk: TK to be used for secured 11az measurement
884  * @calib: An array of calibration values per FTM rx bandwidth.
885  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
886  *         calibration value that corresponds to the rx bandwidth of the FTM
887  *         frame.
888  * @beacon_interval: beacon interval of the AP in TUs. Only required if
889  *	&IWL_INITIATOR_AP_FLAGS_TB is set.
890  * @rx_pn: the next expected PN for protected management frames Rx. LE byte
891  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
892  *	is set to &IWL_INVALID_STA.
893  * @tx_pn: the next PN to use for protected management frames Tx. LE byte
894  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
895  *	is set to &IWL_INVALID_STA.
896  * @r2i_ndp_params: parameters for R2I NDP ranging negotiation.
897  *      bits 0 - 2: max LTF repetitions
898  *      bits 3 - 5: max number of spatial streams
899  *      bits 6 - 7: reserved
900  * @i2r_ndp_params: parameters for I2R NDP ranging negotiation.
901  *      bits 0 - 2: max LTF repetitions
902  *      bits 3 - 5: max number of spatial streams (supported values are < 2)
903  *      bits 6 - 7: reserved
904  * @r2i_max_total_ltf: R2I Max Total LTFs for NDP ranging negotiation.
905  *      One of &enum ieee80211_range_params_max_total_ltf.
906  * @i2r_max_total_ltf: I2R Max Total LTFs for NDP ranging negotiation.
907  *      One of &enum ieee80211_range_params_max_total_ltf.
908  */
909 struct iwl_tof_range_req_ap_entry_v8 {
910 	__le32 initiator_ap_flags;
911 	u8 channel_num;
912 	u8 format_bw;
913 	u8 ctrl_ch_position;
914 	u8 ftmr_max_retries;
915 	u8 bssid[ETH_ALEN];
916 	__le16 burst_period;
917 	u8 samples_per_burst;
918 	u8 num_of_bursts;
919 	u8 sta_id;
920 	u8 cipher;
921 	u8 hltk[HLTK_11AZ_LEN];
922 	u8 tk[TK_11AZ_LEN];
923 	__le16 calib[IWL_TOF_BW_NUM];
924 	__le16 beacon_interval;
925 	u8 rx_pn[IEEE80211_CCMP_PN_LEN];
926 	u8 tx_pn[IEEE80211_CCMP_PN_LEN];
927 	u8 r2i_ndp_params;
928 	u8 i2r_ndp_params;
929 	u8 r2i_max_total_ltf;
930 	u8 i2r_max_total_ltf;
931 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_8 */
932 
933 /**
934  * struct iwl_tof_range_req_ap_entry_v9 - AP configuration parameters
935  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
936  * @channel_num: AP Channel number
937  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
938  *             bits 4 - 7: &enum iwl_location_bw.
939  * @ctrl_ch_position: Coding of the control channel position relative to the
940  *	center frequency, see iwl_mvm_get_ctrl_pos().
941  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
942  *	reply from the AP.
943  * @bssid: AP's BSSID
944  * @burst_period: For EDCA based ranging: Recommended value to be sent to the
945  *	AP. Measurement periodicity In units of 100ms. ignored if
946  *	num_of_bursts_exp = 0.
947  *	For non trigger based NDP ranging, the maximum time between
948  *	measurements in units of milliseconds.
949  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
950  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
951  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
952  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
953  *	otherwise should be set to &IWL_INVALID_STA.
954  * @cipher: pairwise cipher suite for secured measurement.
955  *          &enum iwl_location_cipher.
956  * @hltk: HLTK to be used for secured 11az measurement
957  * @tk: TK to be used for secured 11az measurement
958  * @calib: An array of calibration values per FTM rx bandwidth.
959  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
960  *         calibration value that corresponds to the rx bandwidth of the FTM
961  *         frame.
962  * @beacon_interval: beacon interval of the AP in TUs. Only required if
963  *	&IWL_INITIATOR_AP_FLAGS_TB is set.
964  * @bss_color: the BSS color of the responder. Only valid if
965  *	&IWL_INITIATOR_AP_FLAGS_TB or &IWL_INITIATOR_AP_FLAGS_NON_TB is set.
966  * @rx_pn: the next expected PN for protected management frames Rx. LE byte
967  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
968  *	is set to &IWL_INVALID_STA.
969  * @tx_pn: the next PN to use for protected management frames Tx. LE byte
970  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
971  *	is set to &IWL_INVALID_STA.
972  * @r2i_ndp_params: parameters for R2I NDP ranging negotiation.
973  *      bits 0 - 2: max LTF repetitions
974  *      bits 3 - 5: max number of spatial streams
975  *      bits 6 - 7: reserved
976  * @i2r_ndp_params: parameters for I2R NDP ranging negotiation.
977  *      bits 0 - 2: max LTF repetitions
978  *      bits 3 - 5: max number of spatial streams (supported values are < 2)
979  *      bits 6 - 7: reserved
980  * @r2i_max_total_ltf: R2I Max Total LTFs for NDP ranging negotiation.
981  *      One of &enum ieee80211_range_params_max_total_ltf.
982  * @i2r_max_total_ltf: I2R Max Total LTFs for NDP ranging negotiation.
983  *      One of &enum ieee80211_range_params_max_total_ltf.
984  * @bss_color: the BSS color of the responder. Only valid if
985  *	&IWL_INITIATOR_AP_FLAGS_NON_TB or &IWL_INITIATOR_AP_FLAGS_TB is set.
986  * @band: 0 for 5.2 GHz, 1 for 2.4 GHz, 2 for 6GHz
987  * @min_time_between_msr: For non trigger based NDP ranging, the minimum time
988  *	between measurements in units of milliseconds
989  */
990 struct iwl_tof_range_req_ap_entry_v9 {
991 	__le32 initiator_ap_flags;
992 	u8 channel_num;
993 	u8 format_bw;
994 	u8 ctrl_ch_position;
995 	u8 ftmr_max_retries;
996 	u8 bssid[ETH_ALEN];
997 	__le16 burst_period;
998 	u8 samples_per_burst;
999 	u8 num_of_bursts;
1000 	u8 sta_id;
1001 	u8 cipher;
1002 	u8 hltk[HLTK_11AZ_LEN];
1003 	u8 tk[TK_11AZ_LEN];
1004 	__le16 calib[IWL_TOF_BW_NUM];
1005 	u16 beacon_interval;
1006 	u8 rx_pn[IEEE80211_CCMP_PN_LEN];
1007 	u8 tx_pn[IEEE80211_CCMP_PN_LEN];
1008 	u8 r2i_ndp_params;
1009 	u8 i2r_ndp_params;
1010 	u8 r2i_max_total_ltf;
1011 	u8 i2r_max_total_ltf;
1012 	u8 bss_color;
1013 	u8 band;
1014 	__le16 min_time_between_msr;
1015 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_9 */
1016 
1017 /**
1018  * struct iwl_tof_range_req_ap_entry_v10 - AP configuration parameters
1019  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
1020  * @band: 0 for 5.2 GHz, 1 for 2.4 GHz, 2 for 6GHz
1021  * @channel_num: AP Channel number
1022  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
1023  *             bits 4 - 7: &enum iwl_location_bw.
1024  * @ctrl_ch_position: Coding of the control channel position relative to the
1025  *	center frequency, see iwl_mvm_get_ctrl_pos().
1026  * @bssid: AP's BSSID
1027  * @burst_period: For EDCA based ranging: Recommended value to be sent to the
1028  *	AP. Measurement periodicity In units of 100ms. ignored if
1029  *	num_of_bursts_exp = 0.
1030  *	For non trigger based NDP ranging, the maximum time between
1031  *	measurements in units of milliseconds.
1032  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
1033  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
1034  *	the number of measurement iterations (min 2^0 = 1, max 2^14)
1035  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
1036  *	otherwise should be set to &IWL_INVALID_STA.
1037  * @cipher: pairwise cipher suite for secured measurement.
1038  *          &enum iwl_location_cipher.
1039  * @hltk: HLTK to be used for secured 11az measurement
1040  * @tk: TK to be used for secured 11az measurement
1041  * @calib: An array of calibration values per FTM rx bandwidth.
1042  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
1043  *         calibration value that corresponds to the rx bandwidth of the FTM
1044  *         frame.
1045  * @beacon_interval: beacon interval of the AP in TUs. Only required if
1046  *	&IWL_INITIATOR_AP_FLAGS_TB is set.
1047  * @rx_pn: the next expected PN for protected management frames Rx. LE byte
1048  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
1049  *	is set to &IWL_INVALID_STA.
1050  * @tx_pn: the next PN to use for protected management frames Tx. LE byte
1051  *	order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
1052  *	is set to &IWL_INVALID_STA.
1053  * @r2i_ndp_params: parameters for R2I NDP ranging negotiation.
1054  *      bits 0 - 2: max LTF repetitions
1055  *      bits 3 - 5: max number of spatial streams
1056  *      bits 6 - 7: max total LTFs. One of
1057  *		&enum ieee80211_range_params_max_total_ltf.
1058  * @i2r_ndp_params: parameters for I2R NDP ranging negotiation.
1059  *      bits 0 - 2: max LTF repetitions
1060  *      bits 3 - 5: max number of spatial streams (supported values are < 2)
1061  *      bits 6 - 7: max total LTFs. One of
1062  *		&enum ieee80211_range_params_max_total_ltf.
1063  * @min_time_between_msr: For non trigger based NDP ranging, the minimum time
1064  *	between measurements in units of milliseconds
1065  */
1066 struct iwl_tof_range_req_ap_entry_v10 {
1067 	__le32 initiator_ap_flags;
1068 	u8 band;
1069 	u8 channel_num;
1070 	u8 format_bw;
1071 	u8 ctrl_ch_position;
1072 	u8 bssid[ETH_ALEN];
1073 	__le16 burst_period;
1074 	u8 samples_per_burst;
1075 	u8 num_of_bursts;
1076 	u8 sta_id;
1077 	u8 cipher;
1078 	u8 hltk[HLTK_11AZ_LEN];
1079 	u8 tk[TK_11AZ_LEN];
1080 	__le16 calib[IWL_TOF_BW_NUM];
1081 	__le16 beacon_interval;
1082 	u8 rx_pn[IEEE80211_CCMP_PN_LEN];
1083 	u8 tx_pn[IEEE80211_CCMP_PN_LEN];
1084 	u8 r2i_ndp_params;
1085 	u8 i2r_ndp_params;
1086 	__le16 min_time_between_msr;
1087 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_9 */
1088 
1089 /**
1090  * enum iwl_tof_response_mode
1091  * @IWL_MVM_TOF_RESPONSE_ASAP: report each AP measurement separately as soon as
1092  *			       possible (not supported for this release)
1093  * @IWL_MVM_TOF_RESPONSE_TIMEOUT: report all AP measurements as a batch upon
1094  *				  timeout expiration
1095  * @IWL_MVM_TOF_RESPONSE_COMPLETE: report all AP measurements as a batch at the
1096  *				   earlier of: measurements completion / timeout
1097  *				   expiration.
1098  */
1099 enum iwl_tof_response_mode {
1100 	IWL_MVM_TOF_RESPONSE_ASAP,
1101 	IWL_MVM_TOF_RESPONSE_TIMEOUT,
1102 	IWL_MVM_TOF_RESPONSE_COMPLETE,
1103 };
1104 
1105 /**
1106  * enum iwl_tof_initiator_flags
1107  *
1108  * @IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED: disable fast algo, meaning run
1109  *	the algo on ant A+B, instead of only one of them.
1110  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A: open RX antenna A for FTMs RX
1111  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B: open RX antenna B for FTMs RX
1112  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C: open RX antenna C for FTMs RX
1113  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A: use antenna A fo TX ACKs during FTM
1114  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B: use antenna B fo TX ACKs during FTM
1115  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C: use antenna C fo TX ACKs during FTM
1116  * @IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM: use random mac address for FTM
1117  * @IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB: use the specific calib value from
1118  *	the range request command
1119  * @IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB: use the common calib value from the
1120  *	ragne request command
1121  * @IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT: support non-asap measurements
1122  */
1123 enum iwl_tof_initiator_flags {
1124 	IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED = BIT(0),
1125 	IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A = BIT(1),
1126 	IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B = BIT(2),
1127 	IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C = BIT(3),
1128 	IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A = BIT(4),
1129 	IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B = BIT(5),
1130 	IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C = BIT(6),
1131 	IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM = BIT(7),
1132 	IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB = BIT(15),
1133 	IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB   = BIT(16),
1134 	IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT = BIT(20),
1135 }; /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */
1136 
1137 #define IWL_MVM_TOF_MAX_APS 5
1138 #define IWL_MVM_TOF_MAX_TWO_SIDED_APS 5
1139 
1140 /**
1141  * struct iwl_tof_range_req_cmd_v5 - start measurement cmd
1142  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1143  * @request_id: A Token incremented per request. The same Token will be
1144  *		sent back in the range response
1145  * @initiator: 0- NW initiated,  1 - Client Initiated
1146  * @one_sided_los_disable: '0'- run ML-Algo for both ToF/OneSided,
1147  *			   '1' - run ML-Algo for ToF only
1148  * @req_timeout: Requested timeout of the response in units of 100ms.
1149  *	     This is equivalent to the session time configured to the
1150  *	     LMAC in Initiator Request
1151  * @report_policy: Supported partially for this release: For current release -
1152  *		   the range report will be uploaded as a batch when ready or
1153  *		   when the session is done (successfully / partially).
1154  *		   one of iwl_tof_response_mode.
1155  * @reserved0: reserved
1156  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1157  * @macaddr_random: '0' Use default source MAC address (i.e. p2_p),
1158  *	            '1' Use MAC Address randomization according to the below
1159  * @range_req_bssid: ranging request BSSID
1160  * @macaddr_template: MAC address template to use for non-randomized bits
1161  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1162  *		  Bits set to 1 shall be randomized by the UMAC
1163  * @ftm_rx_chains: Rx chain to open to receive Responder's FTMs (XVT)
1164  * @ftm_tx_chains: Tx chain to send the ack to the Responder FTM (XVT)
1165  * @common_calib: The common calib value to inject to this measurement calc
1166  * @specific_calib: The specific calib value to inject to this measurement calc
1167  * @ap: per-AP request data
1168  */
1169 struct iwl_tof_range_req_cmd_v5 {
1170 	__le32 initiator_flags;
1171 	u8 request_id;
1172 	u8 initiator;
1173 	u8 one_sided_los_disable;
1174 	u8 req_timeout;
1175 	u8 report_policy;
1176 	u8 reserved0;
1177 	u8 num_of_ap;
1178 	u8 macaddr_random;
1179 	u8 range_req_bssid[ETH_ALEN];
1180 	u8 macaddr_template[ETH_ALEN];
1181 	u8 macaddr_mask[ETH_ALEN];
1182 	u8 ftm_rx_chains;
1183 	u8 ftm_tx_chains;
1184 	__le16 common_calib;
1185 	__le16 specific_calib;
1186 	struct iwl_tof_range_req_ap_entry_v2 ap[IWL_MVM_TOF_MAX_APS];
1187 } __packed;
1188 /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */
1189 
1190 /**
1191  * struct iwl_tof_range_req_cmd_v7 - start measurement cmd
1192  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1193  * @request_id: A Token incremented per request. The same Token will be
1194  *		sent back in the range response
1195  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1196  * @range_req_bssid: ranging request BSSID
1197  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1198  *		  Bits set to 1 shall be randomized by the UMAC
1199  * @macaddr_template: MAC address template to use for non-randomized bits
1200  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
1201  *	This is the session time for completing the measurement.
1202  * @tsf_mac_id: report the measurement start time for each ap in terms of the
1203  *	TSF of this mac id. 0xff to disable TSF reporting.
1204  * @common_calib: The common calib value to inject to this measurement calc
1205  * @specific_calib: The specific calib value to inject to this measurement calc
1206  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
1207  */
1208 struct iwl_tof_range_req_cmd_v7 {
1209 	__le32 initiator_flags;
1210 	u8 request_id;
1211 	u8 num_of_ap;
1212 	u8 range_req_bssid[ETH_ALEN];
1213 	u8 macaddr_mask[ETH_ALEN];
1214 	u8 macaddr_template[ETH_ALEN];
1215 	__le32 req_timeout_ms;
1216 	__le32 tsf_mac_id;
1217 	__le16 common_calib;
1218 	__le16 specific_calib;
1219 	struct iwl_tof_range_req_ap_entry_v3 ap[IWL_MVM_TOF_MAX_APS];
1220 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_7 */
1221 
1222 /**
1223  * struct iwl_tof_range_req_cmd_v8 - start measurement cmd
1224  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1225  * @request_id: A Token incremented per request. The same Token will be
1226  *		sent back in the range response
1227  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1228  * @range_req_bssid: ranging request BSSID
1229  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1230  *		  Bits set to 1 shall be randomized by the UMAC
1231  * @macaddr_template: MAC address template to use for non-randomized bits
1232  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
1233  *	This is the session time for completing the measurement.
1234  * @tsf_mac_id: report the measurement start time for each ap in terms of the
1235  *	TSF of this mac id. 0xff to disable TSF reporting.
1236  * @common_calib: The common calib value to inject to this measurement calc
1237  * @specific_calib: The specific calib value to inject to this measurement calc
1238  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
1239  */
1240 struct iwl_tof_range_req_cmd_v8 {
1241 	__le32 initiator_flags;
1242 	u8 request_id;
1243 	u8 num_of_ap;
1244 	u8 range_req_bssid[ETH_ALEN];
1245 	u8 macaddr_mask[ETH_ALEN];
1246 	u8 macaddr_template[ETH_ALEN];
1247 	__le32 req_timeout_ms;
1248 	__le32 tsf_mac_id;
1249 	__le16 common_calib;
1250 	__le16 specific_calib;
1251 	struct iwl_tof_range_req_ap_entry_v4 ap[IWL_MVM_TOF_MAX_APS];
1252 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_8 */
1253 
1254 /**
1255  * struct iwl_tof_range_req_cmd_v9 - start measurement cmd
1256  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1257  * @request_id: A Token incremented per request. The same Token will be
1258  *		sent back in the range response
1259  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1260  * @range_req_bssid: ranging request BSSID
1261  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1262  *		  Bits set to 1 shall be randomized by the UMAC
1263  * @macaddr_template: MAC address template to use for non-randomized bits
1264  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
1265  *	This is the session time for completing the measurement.
1266  * @tsf_mac_id: report the measurement start time for each ap in terms of the
1267  *	TSF of this mac id. 0xff to disable TSF reporting.
1268  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
1269  */
1270 struct iwl_tof_range_req_cmd_v9 {
1271 	__le32 initiator_flags;
1272 	u8 request_id;
1273 	u8 num_of_ap;
1274 	u8 range_req_bssid[ETH_ALEN];
1275 	u8 macaddr_mask[ETH_ALEN];
1276 	u8 macaddr_template[ETH_ALEN];
1277 	__le32 req_timeout_ms;
1278 	__le32 tsf_mac_id;
1279 	struct iwl_tof_range_req_ap_entry_v6 ap[IWL_MVM_TOF_MAX_APS];
1280 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_9 */
1281 
1282 /**
1283  * struct iwl_tof_range_req_cmd_v11 - start measurement cmd
1284  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1285  * @request_id: A Token incremented per request. The same Token will be
1286  *		sent back in the range response
1287  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1288  * @range_req_bssid: ranging request BSSID
1289  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1290  *		  Bits set to 1 shall be randomized by the UMAC
1291  * @macaddr_template: MAC address template to use for non-randomized bits
1292  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
1293  *	This is the session time for completing the measurement.
1294  * @tsf_mac_id: report the measurement start time for each ap in terms of the
1295  *	TSF of this mac id. 0xff to disable TSF reporting.
1296  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
1297  */
1298 struct iwl_tof_range_req_cmd_v11 {
1299 	__le32 initiator_flags;
1300 	u8 request_id;
1301 	u8 num_of_ap;
1302 	u8 range_req_bssid[ETH_ALEN];
1303 	u8 macaddr_mask[ETH_ALEN];
1304 	u8 macaddr_template[ETH_ALEN];
1305 	__le32 req_timeout_ms;
1306 	__le32 tsf_mac_id;
1307 	struct iwl_tof_range_req_ap_entry_v7 ap[IWL_MVM_TOF_MAX_APS];
1308 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_11 */
1309 
1310 /**
1311  * struct iwl_tof_range_req_cmd_v12 - start measurement cmd
1312  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1313  * @request_id: A Token incremented per request. The same Token will be
1314  *		sent back in the range response
1315  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1316  * @range_req_bssid: ranging request BSSID
1317  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1318  *		  Bits set to 1 shall be randomized by the UMAC
1319  * @macaddr_template: MAC address template to use for non-randomized bits
1320  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
1321  *	This is the session time for completing the measurement.
1322  * @tsf_mac_id: report the measurement start time for each ap in terms of the
1323  *	TSF of this mac id. 0xff to disable TSF reporting.
1324  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
1325  */
1326 struct iwl_tof_range_req_cmd_v12 {
1327 	__le32 initiator_flags;
1328 	u8 request_id;
1329 	u8 num_of_ap;
1330 	u8 range_req_bssid[ETH_ALEN];
1331 	u8 macaddr_mask[ETH_ALEN];
1332 	u8 macaddr_template[ETH_ALEN];
1333 	__le32 req_timeout_ms;
1334 	__le32 tsf_mac_id;
1335 	struct iwl_tof_range_req_ap_entry_v8 ap[IWL_MVM_TOF_MAX_APS];
1336 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_12 */
1337 
1338 /**
1339  * struct iwl_tof_range_req_cmd_v13 - start measurement cmd
1340  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1341  * @request_id: A Token incremented per request. The same Token will be
1342  *		sent back in the range response
1343  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1344  * @range_req_bssid: ranging request BSSID
1345  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1346  *		  Bits set to 1 shall be randomized by the UMAC
1347  * @macaddr_template: MAC address template to use for non-randomized bits
1348  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
1349  *	This is the session time for completing the measurement.
1350  * @tsf_mac_id: report the measurement start time for each ap in terms of the
1351  *	TSF of this mac id. 0xff to disable TSF reporting.
1352  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v9.
1353  */
1354 struct iwl_tof_range_req_cmd_v13 {
1355 	__le32 initiator_flags;
1356 	u8 request_id;
1357 	u8 num_of_ap;
1358 	u8 range_req_bssid[ETH_ALEN];
1359 	u8 macaddr_mask[ETH_ALEN];
1360 	u8 macaddr_template[ETH_ALEN];
1361 	__le32 req_timeout_ms;
1362 	__le32 tsf_mac_id;
1363 	struct iwl_tof_range_req_ap_entry_v9 ap[IWL_MVM_TOF_MAX_APS];
1364 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_13 */
1365 
1366 /**
1367  * struct iwl_tof_range_req_cmd_v14 - start measurement cmd
1368  * @initiator_flags: see flags @ iwl_tof_initiator_flags
1369  * @request_id: A Token incremented per request. The same Token will be
1370  *		sent back in the range response
1371  * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1372  * @range_req_bssid: ranging request BSSID
1373  * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
1374  *		  Bits set to 1 shall be randomized by the UMAC
1375  * @macaddr_template: MAC address template to use for non-randomized bits
1376  * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
1377  *	This is the session time for completing the measurement.
1378  * @tsf_mac_id: report the measurement start time for each ap in terms of the
1379  *	TSF of this mac id. 0xff to disable TSF reporting.
1380  * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v10.
1381  */
1382 struct iwl_tof_range_req_cmd_v14 {
1383 	__le32 initiator_flags;
1384 	u8 request_id;
1385 	u8 num_of_ap;
1386 	u8 range_req_bssid[ETH_ALEN];
1387 	u8 macaddr_mask[ETH_ALEN];
1388 	u8 macaddr_template[ETH_ALEN];
1389 	__le32 req_timeout_ms;
1390 	__le32 tsf_mac_id;
1391 	struct iwl_tof_range_req_ap_entry_v10 ap[IWL_MVM_TOF_MAX_APS];
1392 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_13 */
1393 
1394 /*
1395  * enum iwl_tof_range_request_status - status of the sent request
1396  * @IWL_TOF_RANGE_REQUEST_STATUS_SUCCESSFUL - FW successfully received the
1397  *	request
1398  * @IWL_TOF_RANGE_REQUEST_STATUS_BUSY - FW is busy with a previous request, the
1399  *	sent request will not be handled
1400  */
1401 enum iwl_tof_range_request_status {
1402 	IWL_TOF_RANGE_REQUEST_STATUS_SUCCESS,
1403 	IWL_TOF_RANGE_REQUEST_STATUS_BUSY,
1404 };
1405 
1406 /**
1407  * enum iwl_tof_entry_status
1408  *
1409  * @IWL_TOF_ENTRY_SUCCESS: successful measurement.
1410  * @IWL_TOF_ENTRY_GENERAL_FAILURE: General failure.
1411  * @IWL_TOF_ENTRY_NO_RESPONSE: Responder didn't reply to the request.
1412  * @IWL_TOF_ENTRY_REQUEST_REJECTED: Responder rejected the request.
1413  * @IWL_TOF_ENTRY_NOT_SCHEDULED: Time event was scheduled but not called yet.
1414  * @IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT: Time event triggered but no
1415  *	measurement was completed.
1416  * @IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE: No range due inability to switch
1417  *	from the primary channel.
1418  * @IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED: Device doesn't support FTM.
1419  * @IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON: Request aborted due to unknown
1420  *	reason.
1421  * @IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP: Failure due to invalid
1422  *	T1/T4.
1423  * @IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE: Failure due to invalid FTM frame
1424  *	structure.
1425  * @IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED: Request cannot be scheduled.
1426  * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE: Responder cannot serve the
1427  *	initiator for some period, period supplied in @refusal_period.
1428  * @IWL_TOF_ENTRY_BAD_REQUEST_ARGS: Bad request arguments.
1429  * @IWL_TOF_ENTRY_WIFI_NOT_ENABLED: Wifi not enabled.
1430  * @IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS: Responder override the original
1431  *	parameters within the current session.
1432  */
1433 enum iwl_tof_entry_status {
1434 	IWL_TOF_ENTRY_SUCCESS = 0,
1435 	IWL_TOF_ENTRY_GENERAL_FAILURE = 1,
1436 	IWL_TOF_ENTRY_NO_RESPONSE = 2,
1437 	IWL_TOF_ENTRY_REQUEST_REJECTED = 3,
1438 	IWL_TOF_ENTRY_NOT_SCHEDULED = 4,
1439 	IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT = 5,
1440 	IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE = 6,
1441 	IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED = 7,
1442 	IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON = 8,
1443 	IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP = 9,
1444 	IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE = 10,
1445 	IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED = 11,
1446 	IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE = 12,
1447 	IWL_TOF_ENTRY_BAD_REQUEST_ARGS = 13,
1448 	IWL_TOF_ENTRY_WIFI_NOT_ENABLED = 14,
1449 	IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS = 15,
1450 }; /* LOCATION_RANGE_RSP_AP_ENTRY_NTFY_API_S_VER_2 */
1451 
1452 /**
1453  * struct iwl_tof_range_rsp_ap_entry_ntfy_v3 - AP parameters (response)
1454  * @bssid: BSSID of the AP
1455  * @measure_status: current APs measurement status, one of
1456  *	&enum iwl_tof_entry_status.
1457  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
1458  * @rtt: The Round Trip Time that took for the last measurement for
1459  *	current AP [pSec]
1460  * @rtt_variance: The Variance of the RTT values measured for current AP
1461  * @rtt_spread: The Difference between the maximum and the minimum RTT
1462  *	values measured for current AP in the current session [pSec]
1463  * @rssi: RSSI as uploaded in the Channel Estimation notification
1464  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
1465  *	measured for current AP in the current session
1466  * @reserved: reserved
1467  * @refusal_period: refusal period in case of
1468  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
1469  * @range: Measured range [cm]
1470  * @range_variance: Measured range variance [cm]
1471  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
1472  *	uploaded by the LMAC
1473  * @t2t3_initiator: as calculated from the algo in the initiator
1474  * @t1t4_responder: as calculated from the algo in the responder
1475  * @common_calib: Calib val that was used in for this AP measurement
1476  * @specific_calib: val that was used in for this AP measurement
1477  * @papd_calib_output: The result of the tof papd calibration that was injected
1478  *	into the algorithm.
1479  */
1480 struct iwl_tof_range_rsp_ap_entry_ntfy_v3 {
1481 	u8 bssid[ETH_ALEN];
1482 	u8 measure_status;
1483 	u8 measure_bw;
1484 	__le32 rtt;
1485 	__le32 rtt_variance;
1486 	__le32 rtt_spread;
1487 	s8 rssi;
1488 	u8 rssi_spread;
1489 	u8 reserved;
1490 	u8 refusal_period;
1491 	__le32 range;
1492 	__le32 range_variance;
1493 	__le32 timestamp;
1494 	__le32 t2t3_initiator;
1495 	__le32 t1t4_responder;
1496 	__le16 common_calib;
1497 	__le16 specific_calib;
1498 	__le32 papd_calib_output;
1499 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_3 */
1500 
1501 /**
1502  * struct iwl_tof_range_rsp_ap_entry_ntfy_v4 - AP parameters (response)
1503  * @bssid: BSSID of the AP
1504  * @measure_status: current APs measurement status, one of
1505  *	&enum iwl_tof_entry_status.
1506  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
1507  * @rtt: The Round Trip Time that took for the last measurement for
1508  *	current AP [pSec]
1509  * @rtt_variance: The Variance of the RTT values measured for current AP
1510  * @rtt_spread: The Difference between the maximum and the minimum RTT
1511  *	values measured for current AP in the current session [pSec]
1512  * @rssi: RSSI as uploaded in the Channel Estimation notification
1513  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
1514  *	measured for current AP in the current session
1515  * @last_burst: 1 if no more FTM sessions are scheduled for this responder
1516  * @refusal_period: refusal period in case of
1517  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
1518  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
1519  *	uploaded by the LMAC
1520  * @start_tsf: measurement start time in TSF of the mac specified in the range
1521  *	request
1522  * @rx_rate_n_flags: rate and flags of the last FTM frame received from this
1523  *	responder
1524  * @tx_rate_n_flags: rate and flags of the last ack sent to this responder
1525  * @t2t3_initiator: as calculated from the algo in the initiator
1526  * @t1t4_responder: as calculated from the algo in the responder
1527  * @common_calib: Calib val that was used in for this AP measurement
1528  * @specific_calib: val that was used in for this AP measurement
1529  * @papd_calib_output: The result of the tof papd calibration that was injected
1530  *	into the algorithm.
1531  */
1532 struct iwl_tof_range_rsp_ap_entry_ntfy_v4 {
1533 	u8 bssid[ETH_ALEN];
1534 	u8 measure_status;
1535 	u8 measure_bw;
1536 	__le32 rtt;
1537 	__le32 rtt_variance;
1538 	__le32 rtt_spread;
1539 	s8 rssi;
1540 	u8 rssi_spread;
1541 	u8 last_burst;
1542 	u8 refusal_period;
1543 	__le32 timestamp;
1544 	__le32 start_tsf;
1545 	__le32 rx_rate_n_flags;
1546 	__le32 tx_rate_n_flags;
1547 	__le32 t2t3_initiator;
1548 	__le32 t1t4_responder;
1549 	__le16 common_calib;
1550 	__le16 specific_calib;
1551 	__le32 papd_calib_output;
1552 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_4 */
1553 
1554 /**
1555  * struct iwl_tof_range_rsp_ap_entry_ntfy_v5 - AP parameters (response)
1556  * @bssid: BSSID of the AP
1557  * @measure_status: current APs measurement status, one of
1558  *	&enum iwl_tof_entry_status.
1559  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
1560  * @rtt: The Round Trip Time that took for the last measurement for
1561  *	current AP [pSec]
1562  * @rtt_variance: The Variance of the RTT values measured for current AP
1563  * @rtt_spread: The Difference between the maximum and the minimum RTT
1564  *	values measured for current AP in the current session [pSec]
1565  * @rssi: RSSI as uploaded in the Channel Estimation notification
1566  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
1567  *	measured for current AP in the current session
1568  * @last_burst: 1 if no more FTM sessions are scheduled for this responder
1569  * @refusal_period: refusal period in case of
1570  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
1571  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
1572  *	uploaded by the LMAC
1573  * @start_tsf: measurement start time in TSF of the mac specified in the range
1574  *	request
1575  * @rx_rate_n_flags: rate and flags of the last FTM frame received from this
1576  *	responder
1577  * @tx_rate_n_flags: rate and flags of the last ack sent to this responder
1578  * @t2t3_initiator: as calculated from the algo in the initiator
1579  * @t1t4_responder: as calculated from the algo in the responder
1580  * @common_calib: Calib val that was used in for this AP measurement
1581  * @specific_calib: val that was used in for this AP measurement
1582  * @papd_calib_output: The result of the tof papd calibration that was injected
1583  *	into the algorithm.
1584  * @rttConfidence: a value between 0 - 31 that represents the rtt accuracy.
1585  * @reserved: for alignment
1586  */
1587 struct iwl_tof_range_rsp_ap_entry_ntfy_v5 {
1588 	u8 bssid[ETH_ALEN];
1589 	u8 measure_status;
1590 	u8 measure_bw;
1591 	__le32 rtt;
1592 	__le32 rtt_variance;
1593 	__le32 rtt_spread;
1594 	s8 rssi;
1595 	u8 rssi_spread;
1596 	u8 last_burst;
1597 	u8 refusal_period;
1598 	__le32 timestamp;
1599 	__le32 start_tsf;
1600 	__le32 rx_rate_n_flags;
1601 	__le32 tx_rate_n_flags;
1602 	__le32 t2t3_initiator;
1603 	__le32 t1t4_responder;
1604 	__le16 common_calib;
1605 	__le16 specific_calib;
1606 	__le32 papd_calib_output;
1607 	u8 rttConfidence;
1608 	u8 reserved[3];
1609 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_5 */
1610 
1611 /**
1612  * struct iwl_tof_range_rsp_ap_entry_ntfy_v6 - AP parameters (response)
1613  * @bssid: BSSID of the AP
1614  * @measure_status: current APs measurement status, one of
1615  *	&enum iwl_tof_entry_status.
1616  * @measure_bw: Current AP Bandwidth: 0  20MHz, 1  40MHz, 2  80MHz
1617  * @rtt: The Round Trip Time that took for the last measurement for
1618  *	current AP [pSec]
1619  * @rtt_variance: The Variance of the RTT values measured for current AP
1620  * @rtt_spread: The Difference between the maximum and the minimum RTT
1621  *	values measured for current AP in the current session [pSec]
1622  * @rssi: RSSI as uploaded in the Channel Estimation notification
1623  * @rssi_spread: The Difference between the maximum and the minimum RSSI values
1624  *	measured for current AP in the current session
1625  * @last_burst: 1 if no more FTM sessions are scheduled for this responder
1626  * @refusal_period: refusal period in case of
1627  *	@IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
1628  * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
1629  *	uploaded by the LMAC
1630  * @start_tsf: measurement start time in TSF of the mac specified in the range
1631  *	request
1632  * @rx_rate_n_flags: rate and flags of the last FTM frame received from this
1633  *	responder
1634  * @tx_rate_n_flags: rate and flags of the last ack sent to this responder
1635  * @t2t3_initiator: as calculated from the algo in the initiator
1636  * @t1t4_responder: as calculated from the algo in the responder
1637  * @common_calib: Calib val that was used in for this AP measurement
1638  * @specific_calib: val that was used in for this AP measurement
1639  * @papd_calib_output: The result of the tof papd calibration that was injected
1640  *	into the algorithm.
1641  * @rttConfidence: a value between 0 - 31 that represents the rtt accuracy.
1642  * @reserved: for alignment
1643  * @rx_pn: the last PN used for this responder Rx in case PMF is configured in
1644  *	LE byte order.
1645  * @tx_pn: the last PN used for this responder Tx in case PMF is configured in
1646  *	LE byte order.
1647  */
1648 struct iwl_tof_range_rsp_ap_entry_ntfy_v6 {
1649 	u8 bssid[ETH_ALEN];
1650 	u8 measure_status;
1651 	u8 measure_bw;
1652 	__le32 rtt;
1653 	__le32 rtt_variance;
1654 	__le32 rtt_spread;
1655 	s8 rssi;
1656 	u8 rssi_spread;
1657 	u8 last_burst;
1658 	u8 refusal_period;
1659 	__le32 timestamp;
1660 	__le32 start_tsf;
1661 	__le32 rx_rate_n_flags;
1662 	__le32 tx_rate_n_flags;
1663 	__le32 t2t3_initiator;
1664 	__le32 t1t4_responder;
1665 	__le16 common_calib;
1666 	__le16 specific_calib;
1667 	__le32 papd_calib_output;
1668 	u8 rttConfidence;
1669 	u8 reserved[3];
1670 	u8 rx_pn[IEEE80211_CCMP_PN_LEN];
1671 	u8 tx_pn[IEEE80211_CCMP_PN_LEN];
1672 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_6,
1673 	       LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_7 */
1674 
1675 
1676 /**
1677  * enum iwl_tof_response_status - tof response status
1678  *
1679  * @IWL_TOF_RESPONSE_SUCCESS: successful range.
1680  * @IWL_TOF_RESPONSE_TIMEOUT: request aborted due to timeout expiration.
1681  *	partial result of ranges done so far is included in the response.
1682  * @IWL_TOF_RESPONSE_ABORTED: Measurement aborted by command.
1683  * @IWL_TOF_RESPONSE_FAILED: Measurement request command failed.
1684  */
1685 enum iwl_tof_response_status {
1686 	IWL_TOF_RESPONSE_SUCCESS = 0,
1687 	IWL_TOF_RESPONSE_TIMEOUT = 1,
1688 	IWL_TOF_RESPONSE_ABORTED = 4,
1689 	IWL_TOF_RESPONSE_FAILED  = 5,
1690 }; /* LOCATION_RNG_RSP_STATUS */
1691 
1692 /**
1693  * struct iwl_tof_range_rsp_ntfy_v5 - ranging response notification
1694  * @request_id: A Token ID of the corresponding Range request
1695  * @request_status: status of current measurement session, one of
1696  *	&enum iwl_tof_response_status.
1697  * @last_in_batch: reprot policy (when not all responses are uploaded at once)
1698  * @num_of_aps: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
1699  * @ap: per-AP data
1700  */
1701 struct iwl_tof_range_rsp_ntfy_v5 {
1702 	u8 request_id;
1703 	u8 request_status;
1704 	u8 last_in_batch;
1705 	u8 num_of_aps;
1706 	struct iwl_tof_range_rsp_ap_entry_ntfy_v3 ap[IWL_MVM_TOF_MAX_APS];
1707 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_5 */
1708 
1709 /**
1710  * struct iwl_tof_range_rsp_ntfy_v6 - ranging response notification
1711  * @request_id: A Token ID of the corresponding Range request
1712  * @num_of_aps: Number of APs results
1713  * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
1714  * @reserved: reserved
1715  * @ap: per-AP data
1716  */
1717 struct iwl_tof_range_rsp_ntfy_v6 {
1718 	u8 request_id;
1719 	u8 num_of_aps;
1720 	u8 last_report;
1721 	u8 reserved;
1722 	struct iwl_tof_range_rsp_ap_entry_ntfy_v4 ap[IWL_MVM_TOF_MAX_APS];
1723 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_6 */
1724 
1725 /**
1726  * struct iwl_tof_range_rsp_ntfy_v7 - ranging response notification
1727  * @request_id: A Token ID of the corresponding Range request
1728  * @num_of_aps: Number of APs results
1729  * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
1730  * @reserved: reserved
1731  * @ap: per-AP data
1732  */
1733 struct iwl_tof_range_rsp_ntfy_v7 {
1734 	u8 request_id;
1735 	u8 num_of_aps;
1736 	u8 last_report;
1737 	u8 reserved;
1738 	struct iwl_tof_range_rsp_ap_entry_ntfy_v5 ap[IWL_MVM_TOF_MAX_APS];
1739 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_7 */
1740 
1741 /**
1742  * struct iwl_tof_range_rsp_ntfy_v8 - ranging response notification
1743  * @request_id: A Token ID of the corresponding Range request
1744  * @num_of_aps: Number of APs results
1745  * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
1746  * @reserved: reserved
1747  * @ap: per-AP data
1748  */
1749 struct iwl_tof_range_rsp_ntfy_v8 {
1750 	u8 request_id;
1751 	u8 num_of_aps;
1752 	u8 last_report;
1753 	u8 reserved;
1754 	struct iwl_tof_range_rsp_ap_entry_ntfy_v6 ap[IWL_MVM_TOF_MAX_APS];
1755 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_8,
1756 	       LOCATION_RANGE_RSP_NTFY_API_S_VER_9 */
1757 
1758 #define IWL_MVM_TOF_MCSI_BUF_SIZE  (245)
1759 /**
1760  * struct iwl_tof_mcsi_notif - used for debug
1761  * @token: token ID for the current session
1762  * @role: '0' - initiator, '1' - responder
1763  * @reserved: reserved
1764  * @initiator_bssid: initiator machine
1765  * @responder_bssid: responder machine
1766  * @mcsi_buffer: debug data
1767  */
1768 struct iwl_tof_mcsi_notif {
1769 	u8 token;
1770 	u8 role;
1771 	__le16 reserved;
1772 	u8 initiator_bssid[ETH_ALEN];
1773 	u8 responder_bssid[ETH_ALEN];
1774 	u8 mcsi_buffer[IWL_MVM_TOF_MCSI_BUF_SIZE * 4];
1775 } __packed;
1776 
1777 /**
1778  * struct iwl_tof_range_abort_cmd
1779  * @request_id: corresponds to a range request
1780  * @reserved: reserved
1781  */
1782 struct iwl_tof_range_abort_cmd {
1783 	u8 request_id;
1784 	u8 reserved[3];
1785 } __packed;
1786 
1787 enum ftm_responder_stats_flags {
1788 	FTM_RESP_STAT_NON_ASAP_STARTED = BIT(0),
1789 	FTM_RESP_STAT_NON_ASAP_IN_WIN = BIT(1),
1790 	FTM_RESP_STAT_NON_ASAP_OUT_WIN = BIT(2),
1791 	FTM_RESP_STAT_TRIGGER_DUP = BIT(3),
1792 	FTM_RESP_STAT_DUP = BIT(4),
1793 	FTM_RESP_STAT_DUP_IN_WIN = BIT(5),
1794 	FTM_RESP_STAT_DUP_OUT_WIN = BIT(6),
1795 	FTM_RESP_STAT_SCHED_SUCCESS = BIT(7),
1796 	FTM_RESP_STAT_ASAP_REQ = BIT(8),
1797 	FTM_RESP_STAT_NON_ASAP_REQ = BIT(9),
1798 	FTM_RESP_STAT_ASAP_RESP = BIT(10),
1799 	FTM_RESP_STAT_NON_ASAP_RESP = BIT(11),
1800 	FTM_RESP_STAT_FAIL_INITIATOR_INACTIVE = BIT(12),
1801 	FTM_RESP_STAT_FAIL_INITIATOR_OUT_WIN = BIT(13),
1802 	FTM_RESP_STAT_FAIL_INITIATOR_RETRY_LIM = BIT(14),
1803 	FTM_RESP_STAT_FAIL_NEXT_SERVED = BIT(15),
1804 	FTM_RESP_STAT_FAIL_TRIGGER_ERR = BIT(16),
1805 	FTM_RESP_STAT_FAIL_GC = BIT(17),
1806 	FTM_RESP_STAT_SUCCESS = BIT(18),
1807 	FTM_RESP_STAT_INTEL_IE = BIT(19),
1808 	FTM_RESP_STAT_INITIATOR_ACTIVE = BIT(20),
1809 	FTM_RESP_STAT_MEASUREMENTS_AVAILABLE = BIT(21),
1810 	FTM_RESP_STAT_TRIGGER_UNKNOWN = BIT(22),
1811 	FTM_RESP_STAT_PROCESS_FAIL = BIT(23),
1812 	FTM_RESP_STAT_ACK = BIT(24),
1813 	FTM_RESP_STAT_NACK = BIT(25),
1814 	FTM_RESP_STAT_INVALID_INITIATOR_ID = BIT(26),
1815 	FTM_RESP_STAT_TIMER_MIN_DELTA = BIT(27),
1816 	FTM_RESP_STAT_INITIATOR_REMOVED = BIT(28),
1817 	FTM_RESP_STAT_INITIATOR_ADDED = BIT(29),
1818 	FTM_RESP_STAT_ERR_LIST_FULL = BIT(30),
1819 	FTM_RESP_STAT_INITIATOR_SCHED_NOW = BIT(31),
1820 }; /* RESP_IND_E */
1821 
1822 /**
1823  * struct iwl_ftm_responder_stats - FTM responder statistics
1824  * @addr: initiator address
1825  * @success_ftm: number of successful ftm frames
1826  * @ftm_per_burst: num of FTM frames that were received
1827  * @flags: &enum ftm_responder_stats_flags
1828  * @duration: actual duration of FTM
1829  * @allocated_duration: time that was allocated for this FTM session
1830  * @bw: FTM request bandwidth
1831  * @rate: FTM request rate
1832  * @reserved: for alingment and future use
1833  */
1834 struct iwl_ftm_responder_stats {
1835 	u8 addr[ETH_ALEN];
1836 	u8 success_ftm;
1837 	u8 ftm_per_burst;
1838 	__le32 flags;
1839 	__le32 duration;
1840 	__le32 allocated_duration;
1841 	u8 bw;
1842 	u8 rate;
1843 	__le16 reserved;
1844 } __packed; /* TOF_RESPONDER_STATISTICS_NTFY_S_VER_2 */
1845 
1846 #define IWL_CSI_MAX_EXPECTED_CHUNKS		16
1847 
1848 #define IWL_CSI_CHUNK_CTL_NUM_MASK_VER_1	0x0003
1849 #define IWL_CSI_CHUNK_CTL_IDX_MASK_VER_1	0x000c
1850 
1851 #define IWL_CSI_CHUNK_CTL_NUM_MASK_VER_2	0x00ff
1852 #define IWL_CSI_CHUNK_CTL_IDX_MASK_VER_2	0xff00
1853 
1854 struct iwl_csi_chunk_notification {
1855 	__le32 token;
1856 	__le16 seq;
1857 	__le16 ctl;
1858 	__le32 size;
1859 	u8 data[];
1860 } __packed; /* CSI_CHUNKS_HDR_NTFY_API_S_VER_1/VER_2 */
1861 
1862 #endif /* __iwl_fw_api_location_h__ */
1863