Linux Audio

Check our new training course

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