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 Intel Corporation 10 * Copyright (C) 2019 Intel Corporation 11 * 12 * This program is free software; you can redistribute it and/or modify 13 * it under the terms of version 2 of the GNU General Public License as 14 * published by the Free Software Foundation. 15 * 16 * This program is distributed in the hope that it will be useful, but 17 * WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * General Public License for more details. 20 * 21 * The full GNU General Public License is included in this distribution 22 * in the file called COPYING. 23 * 24 * Contact Information: 25 * Intel Linux Wireless <linuxwifi@intel.com> 26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 27 * 28 * BSD LICENSE 29 * 30 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH 31 * Copyright (C) 2018 Intel Corporation 32 * Copyright (C) 2019 Intel Corporation 33 * All rights reserved. 34 * 35 * Redistribution and use in source and binary forms, with or without 36 * modification, are permitted provided that the following conditions 37 * are met: 38 * 39 * * Redistributions of source code must retain the above copyright 40 * notice, this list of conditions and the following disclaimer. 41 * * Redistributions in binary form must reproduce the above copyright 42 * notice, this list of conditions and the following disclaimer in 43 * the documentation and/or other materials provided with the 44 * distribution. 45 * * Neither the name Intel Corporation nor the names of its 46 * contributors may be used to endorse or promote products derived 47 * from this software without specific prior written permission. 48 * 49 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 50 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 51 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 52 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 53 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 54 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 55 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 56 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 57 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 58 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 59 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 * 61 *****************************************************************************/ 62 #ifndef __iwl_fw_api_location_h__ 63 #define __iwl_fw_api_location_h__ 64 65 /** 66 * enum iwl_location_subcmd_ids - location group command IDs 67 */ 68 enum iwl_location_subcmd_ids { 69 /** 70 * @TOF_RANGE_REQ_CMD: TOF ranging request, 71 * uses &struct iwl_tof_range_req_cmd 72 */ 73 TOF_RANGE_REQ_CMD = 0x0, 74 /** 75 * @TOF_CONFIG_CMD: TOF configuration, uses &struct iwl_tof_config_cmd 76 */ 77 TOF_CONFIG_CMD = 0x1, 78 /** 79 * @TOF_RANGE_ABORT_CMD: abort ongoing ranging, uses 80 * &struct iwl_tof_range_abort_cmd 81 */ 82 TOF_RANGE_ABORT_CMD = 0x2, 83 /** 84 * @TOF_RANGE_REQ_EXT_CMD: TOF extended ranging config, 85 * uses &struct iwl_tof_range_req_ext_cmd 86 */ 87 TOF_RANGE_REQ_EXT_CMD = 0x3, 88 /** 89 * @TOF_RESPONDER_CONFIG_CMD: FTM responder configuration, 90 * uses &struct iwl_tof_responder_config_cmd 91 */ 92 TOF_RESPONDER_CONFIG_CMD = 0x4, 93 /** 94 * @TOF_RESPONDER_DYN_CONFIG_CMD: FTM dynamic configuration, 95 * uses &struct iwl_tof_responder_dyn_config_cmd 96 */ 97 TOF_RESPONDER_DYN_CONFIG_CMD = 0x5, 98 /** 99 * @CSI_HEADER_NOTIFICATION: CSI header 100 */ 101 CSI_HEADER_NOTIFICATION = 0xFA, 102 /** 103 * @CSI_CHUNKS_NOTIFICATION: CSI chunk, 104 * uses &struct iwl_csi_chunk_notification 105 */ 106 CSI_CHUNKS_NOTIFICATION = 0xFB, 107 /** 108 * @TOF_LC_NOTIF: used for LCI/civic location, contains just 109 * the action frame 110 */ 111 TOF_LC_NOTIF = 0xFC, 112 /** 113 * @TOF_RESPONDER_STATS: FTM responder statistics notification, 114 * uses &struct iwl_ftm_responder_stats 115 */ 116 TOF_RESPONDER_STATS = 0xFD, 117 /** 118 * @TOF_MCSI_DEBUG_NOTIF: MCSI debug notification, uses 119 * &struct iwl_tof_mcsi_notif 120 */ 121 TOF_MCSI_DEBUG_NOTIF = 0xFE, 122 /** 123 * @TOF_RANGE_RESPONSE_NOTIF: ranging response, using 124 * &struct iwl_tof_range_rsp_ntfy 125 */ 126 TOF_RANGE_RESPONSE_NOTIF = 0xFF, 127 }; 128 129 /** 130 * struct iwl_tof_config_cmd - ToF configuration 131 * @tof_disabled: indicates if ToF is disabled (or not) 132 * @one_sided_disabled: indicates if one-sided is disabled (or not) 133 * @is_debug_mode: indiciates if debug mode is active 134 * @is_buf_required: indicates if channel estimation buffer is required 135 */ 136 struct iwl_tof_config_cmd { 137 u8 tof_disabled; 138 u8 one_sided_disabled; 139 u8 is_debug_mode; 140 u8 is_buf_required; 141 } __packed; 142 143 /** 144 * enum iwl_tof_bandwidth - values for iwl_tof_range_req_ap_entry.bandwidth 145 * @IWL_TOF_BW_20_LEGACY: 20 MHz non-HT 146 * @IWL_TOF_BW_20_HT: 20 MHz HT 147 * @IWL_TOF_BW_40: 40 MHz 148 * @IWL_TOF_BW_80: 80 MHz 149 * @IWL_TOF_BW_160: 160 MHz 150 */ 151 enum iwl_tof_bandwidth { 152 IWL_TOF_BW_20_LEGACY, 153 IWL_TOF_BW_20_HT, 154 IWL_TOF_BW_40, 155 IWL_TOF_BW_80, 156 IWL_TOF_BW_160, 157 }; /* LOCAT_BW_TYPE_E */ 158 159 /* 160 * enum iwl_tof_algo_type - Algorithym type for range measurement request 161 */ 162 enum 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 */ 174 enum 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 */ 200 enum 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 */ 229 enum 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 */ 261 struct 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 */ 297 struct 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 */ 324 struct 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 */ 343 struct 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 */ 357 enum 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 */ 396 struct 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 */ 431 enum iwl_initiator_ap_flags { 432 IWL_INITIATOR_AP_FLAGS_ASAP = BIT(1), 433 IWL_INITIATOR_AP_FLAGS_LCI_REQUEST = BIT(2), 434 IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST = BIT(3), 435 IWL_INITIATOR_AP_FLAGS_DYN_ACK = BIT(4), 436 IWL_INITIATOR_AP_FLAGS_ALGO_LR = BIT(5), 437 IWL_INITIATOR_AP_FLAGS_ALGO_FFT = BIT(6), 438 IWL_INITIATOR_AP_FLAGS_MCSI_REPORT = BIT(8), 439 }; 440 441 /** 442 * struct iwl_tof_range_req_ap_entry_v3 - AP configuration parameters 443 * @initiator_ap_flags: see &enum iwl_initiator_ap_flags. 444 * @channel_num: AP Channel number 445 * @bandwidth: AP bandwidth. One of iwl_tof_bandwidth. 446 * @ctrl_ch_position: Coding of the control channel position relative to the 447 * center frequency, see iwl_mvm_get_ctrl_pos(). 448 * @ftmr_max_retries: Max number of retries to send the FTMR in case of no 449 * reply from the AP. 450 * @bssid: AP's BSSID 451 * @burst_period: Recommended value to be sent to the AP. Measurement 452 * periodicity In units of 100ms. ignored if num_of_bursts_exp = 0 453 * @samples_per_burst: the number of FTMs pairs in single Burst (1-31); 454 * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of 455 * the number of measurement iterations (min 2^0 = 1, max 2^14) 456 * @reserved: For alignment and future use 457 * @tsf_delta: not in use 458 */ 459 struct iwl_tof_range_req_ap_entry_v3 { 460 __le32 initiator_ap_flags; 461 u8 channel_num; 462 u8 bandwidth; 463 u8 ctrl_ch_position; 464 u8 ftmr_max_retries; 465 u8 bssid[ETH_ALEN]; 466 __le16 burst_period; 467 u8 samples_per_burst; 468 u8 num_of_bursts; 469 __le16 reserved; 470 __le32 tsf_delta; 471 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_3 */ 472 473 /** 474 * enum iwl_location_frame_format - location frame formats 475 * @IWL_LOCATION_FRAME_FORMAT_LEGACY: legacy 476 * @IWL_LOCATION_FRAME_FORMAT_HT: HT 477 * @IWL_LOCATION_FRAME_FORMAT_VHT: VHT 478 * @IWL_LOCATION_FRAME_FORMAT_HE: HE 479 */ 480 enum iwl_location_frame_format { 481 IWL_LOCATION_FRAME_FORMAT_LEGACY, 482 IWL_LOCATION_FRAME_FORMAT_HT, 483 IWL_LOCATION_FRAME_FORMAT_VHT, 484 IWL_LOCATION_FRAME_FORMAT_HE, 485 }; 486 487 /** 488 * enum iwl_location_bw - location bandwidth selection 489 * @IWL_LOCATION_BW_20MHZ: 20MHz 490 * @IWL_LOCATION_BW_40MHZ: 40MHz 491 * @IWL_LOCATION_BW_80MHZ: 80MHz 492 */ 493 enum iwl_location_bw { 494 IWL_LOCATION_BW_20MHZ, 495 IWL_LOCATION_BW_40MHZ, 496 IWL_LOCATION_BW_80MHZ, 497 }; 498 499 #define HLTK_11AZ_LEN 32 500 #define TK_11AZ_LEN 32 501 502 #define LOCATION_BW_POS 4 503 504 /** 505 * struct iwl_tof_range_req_ap_entry - AP configuration parameters 506 * @initiator_ap_flags: see &enum iwl_initiator_ap_flags. 507 * @channel_num: AP Channel number 508 * @format_bw: bits 0 - 3: &enum iwl_location_frame_format. 509 * bits 4 - 7: &enum iwl_location_bw. 510 * @ctrl_ch_position: Coding of the control channel position relative to the 511 * center frequency, see iwl_mvm_get_ctrl_pos(). 512 * @ftmr_max_retries: Max number of retries to send the FTMR in case of no 513 * reply from the AP. 514 * @bssid: AP's BSSID 515 * @burst_period: Recommended value to be sent to the AP. Measurement 516 * periodicity In units of 100ms. ignored if num_of_bursts_exp = 0 517 * @samples_per_burst: the number of FTMs pairs in single Burst (1-31); 518 * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of 519 * the number of measurement iterations (min 2^0 = 1, max 2^14) 520 * @reserved: For alignment and future use 521 * @hltk: HLTK to be used for secured 11az measurement 522 * @tk: TK to be used for secured 11az measurement 523 */ 524 struct iwl_tof_range_req_ap_entry { 525 __le32 initiator_ap_flags; 526 u8 channel_num; 527 u8 format_bw; 528 u8 ctrl_ch_position; 529 u8 ftmr_max_retries; 530 u8 bssid[ETH_ALEN]; 531 __le16 burst_period; 532 u8 samples_per_burst; 533 u8 num_of_bursts; 534 __le16 reserved; 535 u8 hltk[HLTK_11AZ_LEN]; 536 u8 tk[TK_11AZ_LEN]; 537 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_4 */ 538 539 /** 540 * enum iwl_tof_response_mode 541 * @IWL_MVM_TOF_RESPONSE_ASAP: report each AP measurement separately as soon as 542 * possible (not supported for this release) 543 * @IWL_MVM_TOF_RESPONSE_TIMEOUT: report all AP measurements as a batch upon 544 * timeout expiration 545 * @IWL_MVM_TOF_RESPONSE_COMPLETE: report all AP measurements as a batch at the 546 * earlier of: measurements completion / timeout 547 * expiration. 548 */ 549 enum iwl_tof_response_mode { 550 IWL_MVM_TOF_RESPONSE_ASAP, 551 IWL_MVM_TOF_RESPONSE_TIMEOUT, 552 IWL_MVM_TOF_RESPONSE_COMPLETE, 553 }; 554 555 /** 556 * enum iwl_tof_initiator_flags 557 * 558 * @IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED: disable fast algo, meaning run 559 * the algo on ant A+B, instead of only one of them. 560 * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A: open RX antenna A for FTMs RX 561 * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B: open RX antenna B for FTMs RX 562 * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C: open RX antenna C for FTMs RX 563 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A: use antenna A fo TX ACKs during FTM 564 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B: use antenna B fo TX ACKs during FTM 565 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C: use antenna C fo TX ACKs during FTM 566 * @IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM: use random mac address for FTM 567 * @IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB: use the specific calib value from 568 * the range request command 569 * @IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB: use the common calib value from the 570 * ragne request command 571 * @IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT: support non-asap measurements 572 */ 573 enum iwl_tof_initiator_flags { 574 IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED = BIT(0), 575 IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A = BIT(1), 576 IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B = BIT(2), 577 IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C = BIT(3), 578 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A = BIT(4), 579 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B = BIT(5), 580 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C = BIT(6), 581 IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM = BIT(7), 582 IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB = BIT(15), 583 IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB = BIT(16), 584 IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT = BIT(20), 585 }; /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */ 586 587 #define IWL_MVM_TOF_MAX_APS 5 588 #define IWL_MVM_TOF_MAX_TWO_SIDED_APS 5 589 590 /** 591 * struct iwl_tof_range_req_cmd_v5 - start measurement cmd 592 * @initiator_flags: see flags @ iwl_tof_initiator_flags 593 * @request_id: A Token incremented per request. The same Token will be 594 * sent back in the range response 595 * @initiator: 0- NW initiated, 1 - Client Initiated 596 * @one_sided_los_disable: '0'- run ML-Algo for both ToF/OneSided, 597 * '1' - run ML-Algo for ToF only 598 * @req_timeout: Requested timeout of the response in units of 100ms. 599 * This is equivalent to the session time configured to the 600 * LMAC in Initiator Request 601 * @report_policy: Supported partially for this release: For current release - 602 * the range report will be uploaded as a batch when ready or 603 * when the session is done (successfully / partially). 604 * one of iwl_tof_response_mode. 605 * @reserved0: reserved 606 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 607 * @macaddr_random: '0' Use default source MAC address (i.e. p2_p), 608 * '1' Use MAC Address randomization according to the below 609 * @range_req_bssid: ranging request BSSID 610 * @macaddr_template: MAC address template to use for non-randomized bits 611 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template. 612 * Bits set to 1 shall be randomized by the UMAC 613 * @ftm_rx_chains: Rx chain to open to receive Responder's FTMs (XVT) 614 * @ftm_tx_chains: Tx chain to send the ack to the Responder FTM (XVT) 615 * @common_calib: The common calib value to inject to this measurement calc 616 * @specific_calib: The specific calib value to inject to this measurement calc 617 * @ap: per-AP request data 618 */ 619 struct iwl_tof_range_req_cmd_v5 { 620 __le32 initiator_flags; 621 u8 request_id; 622 u8 initiator; 623 u8 one_sided_los_disable; 624 u8 req_timeout; 625 u8 report_policy; 626 u8 reserved0; 627 u8 num_of_ap; 628 u8 macaddr_random; 629 u8 range_req_bssid[ETH_ALEN]; 630 u8 macaddr_template[ETH_ALEN]; 631 u8 macaddr_mask[ETH_ALEN]; 632 u8 ftm_rx_chains; 633 u8 ftm_tx_chains; 634 __le16 common_calib; 635 __le16 specific_calib; 636 struct iwl_tof_range_req_ap_entry_v2 ap[IWL_MVM_TOF_MAX_APS]; 637 } __packed; 638 /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */ 639 640 /** 641 * struct iwl_tof_range_req_cmd_v7 - start measurement cmd 642 * @initiator_flags: see flags @ iwl_tof_initiator_flags 643 * @request_id: A Token incremented per request. The same Token will be 644 * sent back in the range response 645 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 646 * @range_req_bssid: ranging request BSSID 647 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template. 648 * Bits set to 1 shall be randomized by the UMAC 649 * @macaddr_template: MAC address template to use for non-randomized bits 650 * @req_timeout_ms: Requested timeout of the response in units of milliseconds. 651 * This is the session time for completing the measurement. 652 * @tsf_mac_id: report the measurement start time for each ap in terms of the 653 * TSF of this mac id. 0xff to disable TSF reporting. 654 * @common_calib: The common calib value to inject to this measurement calc 655 * @specific_calib: The specific calib value to inject to this measurement calc 656 * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2. 657 */ 658 struct iwl_tof_range_req_cmd_v7 { 659 __le32 initiator_flags; 660 u8 request_id; 661 u8 num_of_ap; 662 u8 range_req_bssid[ETH_ALEN]; 663 u8 macaddr_mask[ETH_ALEN]; 664 u8 macaddr_template[ETH_ALEN]; 665 __le32 req_timeout_ms; 666 __le32 tsf_mac_id; 667 __le16 common_calib; 668 __le16 specific_calib; 669 struct iwl_tof_range_req_ap_entry_v3 ap[IWL_MVM_TOF_MAX_APS]; 670 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_7 */ 671 672 /** 673 * struct iwl_tof_range_req_cmd - start measurement cmd 674 * @initiator_flags: see flags @ iwl_tof_initiator_flags 675 * @request_id: A Token incremented per request. The same Token will be 676 * sent back in the range response 677 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 678 * @range_req_bssid: ranging request BSSID 679 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template. 680 * Bits set to 1 shall be randomized by the UMAC 681 * @macaddr_template: MAC address template to use for non-randomized bits 682 * @req_timeout_ms: Requested timeout of the response in units of milliseconds. 683 * This is the session time for completing the measurement. 684 * @tsf_mac_id: report the measurement start time for each ap in terms of the 685 * TSF of this mac id. 0xff to disable TSF reporting. 686 * @common_calib: The common calib value to inject to this measurement calc 687 * @specific_calib: The specific calib value to inject to this measurement calc 688 * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2. 689 */ 690 struct iwl_tof_range_req_cmd { 691 __le32 initiator_flags; 692 u8 request_id; 693 u8 num_of_ap; 694 u8 range_req_bssid[ETH_ALEN]; 695 u8 macaddr_mask[ETH_ALEN]; 696 u8 macaddr_template[ETH_ALEN]; 697 __le32 req_timeout_ms; 698 __le32 tsf_mac_id; 699 __le16 common_calib; 700 __le16 specific_calib; 701 struct iwl_tof_range_req_ap_entry ap[IWL_MVM_TOF_MAX_APS]; 702 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_8 */ 703 704 /* 705 * enum iwl_tof_range_request_status - status of the sent request 706 * @IWL_TOF_RANGE_REQUEST_STATUS_SUCCESSFUL - FW successfully received the 707 * request 708 * @IWL_TOF_RANGE_REQUEST_STATUS_BUSY - FW is busy with a previous request, the 709 * sent request will not be handled 710 */ 711 enum iwl_tof_range_request_status { 712 IWL_TOF_RANGE_REQUEST_STATUS_SUCCESS, 713 IWL_TOF_RANGE_REQUEST_STATUS_BUSY, 714 }; 715 716 /** 717 * enum iwl_tof_entry_status 718 * 719 * @IWL_TOF_ENTRY_SUCCESS: successful measurement. 720 * @IWL_TOF_ENTRY_GENERAL_FAILURE: General failure. 721 * @IWL_TOF_ENTRY_NO_RESPONSE: Responder didn't reply to the request. 722 * @IWL_TOF_ENTRY_REQUEST_REJECTED: Responder rejected the request. 723 * @IWL_TOF_ENTRY_NOT_SCHEDULED: Time event was scheduled but not called yet. 724 * @IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT: Time event triggered but no 725 * measurement was completed. 726 * @IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE: No range due inability to switch 727 * from the primary channel. 728 * @IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED: Device doesn't support FTM. 729 * @IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON: Request aborted due to unknown 730 * reason. 731 * @IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP: Failure due to invalid 732 * T1/T4. 733 * @IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE: Failure due to invalid FTM frame 734 * structure. 735 * @IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED: Request cannot be scheduled. 736 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE: Responder cannot serve the 737 * initiator for some period, period supplied in @refusal_period. 738 * @IWL_TOF_ENTRY_BAD_REQUEST_ARGS: Bad request arguments. 739 * @IWL_TOF_ENTRY_WIFI_NOT_ENABLED: Wifi not enabled. 740 * @IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS: Responder override the original 741 * parameters within the current session. 742 */ 743 enum iwl_tof_entry_status { 744 IWL_TOF_ENTRY_SUCCESS = 0, 745 IWL_TOF_ENTRY_GENERAL_FAILURE = 1, 746 IWL_TOF_ENTRY_NO_RESPONSE = 2, 747 IWL_TOF_ENTRY_REQUEST_REJECTED = 3, 748 IWL_TOF_ENTRY_NOT_SCHEDULED = 4, 749 IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT = 5, 750 IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE = 6, 751 IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED = 7, 752 IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON = 8, 753 IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP = 9, 754 IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE = 10, 755 IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED = 11, 756 IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE = 12, 757 IWL_TOF_ENTRY_BAD_REQUEST_ARGS = 13, 758 IWL_TOF_ENTRY_WIFI_NOT_ENABLED = 14, 759 IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS = 15, 760 }; /* LOCATION_RANGE_RSP_AP_ENTRY_NTFY_API_S_VER_2 */ 761 762 /** 763 * struct iwl_tof_range_rsp_ap_entry_ntfy_v3 - AP parameters (response) 764 * @bssid: BSSID of the AP 765 * @measure_status: current APs measurement status, one of 766 * &enum iwl_tof_entry_status. 767 * @measure_bw: Current AP Bandwidth: 0 20MHz, 1 40MHz, 2 80MHz 768 * @rtt: The Round Trip Time that took for the last measurement for 769 * current AP [pSec] 770 * @rtt_variance: The Variance of the RTT values measured for current AP 771 * @rtt_spread: The Difference between the maximum and the minimum RTT 772 * values measured for current AP in the current session [pSec] 773 * @rssi: RSSI as uploaded in the Channel Estimation notification 774 * @rssi_spread: The Difference between the maximum and the minimum RSSI values 775 * measured for current AP in the current session 776 * @reserved: reserved 777 * @refusal_period: refusal period in case of 778 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec] 779 * @range: Measured range [cm] 780 * @range_variance: Measured range variance [cm] 781 * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was 782 * uploaded by the LMAC 783 * @t2t3_initiator: as calculated from the algo in the initiator 784 * @t1t4_responder: as calculated from the algo in the responder 785 * @common_calib: Calib val that was used in for this AP measurement 786 * @specific_calib: val that was used in for this AP measurement 787 * @papd_calib_output: The result of the tof papd calibration that was injected 788 * into the algorithm. 789 */ 790 struct iwl_tof_range_rsp_ap_entry_ntfy_v3 { 791 u8 bssid[ETH_ALEN]; 792 u8 measure_status; 793 u8 measure_bw; 794 __le32 rtt; 795 __le32 rtt_variance; 796 __le32 rtt_spread; 797 s8 rssi; 798 u8 rssi_spread; 799 u8 reserved; 800 u8 refusal_period; 801 __le32 range; 802 __le32 range_variance; 803 __le32 timestamp; 804 __le32 t2t3_initiator; 805 __le32 t1t4_responder; 806 __le16 common_calib; 807 __le16 specific_calib; 808 __le32 papd_calib_output; 809 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_3 */ 810 811 /** 812 * struct iwl_tof_range_rsp_ap_entry_ntfy_v4 - AP parameters (response) 813 * @bssid: BSSID of the AP 814 * @measure_status: current APs measurement status, one of 815 * &enum iwl_tof_entry_status. 816 * @measure_bw: Current AP Bandwidth: 0 20MHz, 1 40MHz, 2 80MHz 817 * @rtt: The Round Trip Time that took for the last measurement for 818 * current AP [pSec] 819 * @rtt_variance: The Variance of the RTT values measured for current AP 820 * @rtt_spread: The Difference between the maximum and the minimum RTT 821 * values measured for current AP in the current session [pSec] 822 * @rssi: RSSI as uploaded in the Channel Estimation notification 823 * @rssi_spread: The Difference between the maximum and the minimum RSSI values 824 * measured for current AP in the current session 825 * @last_burst: 1 if no more FTM sessions are scheduled for this responder 826 * @refusal_period: refusal period in case of 827 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec] 828 * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was 829 * uploaded by the LMAC 830 * @start_tsf: measurement start time in TSF of the mac specified in the range 831 * request 832 * @rx_rate_n_flags: rate and flags of the last FTM frame received from this 833 * responder 834 * @tx_rate_n_flags: rate and flags of the last ack sent to this responder 835 * @t2t3_initiator: as calculated from the algo in the initiator 836 * @t1t4_responder: as calculated from the algo in the responder 837 * @common_calib: Calib val that was used in for this AP measurement 838 * @specific_calib: val that was used in for this AP measurement 839 * @papd_calib_output: The result of the tof papd calibration that was injected 840 * into the algorithm. 841 */ 842 struct iwl_tof_range_rsp_ap_entry_ntfy_v4 { 843 u8 bssid[ETH_ALEN]; 844 u8 measure_status; 845 u8 measure_bw; 846 __le32 rtt; 847 __le32 rtt_variance; 848 __le32 rtt_spread; 849 s8 rssi; 850 u8 rssi_spread; 851 u8 last_burst; 852 u8 refusal_period; 853 __le32 timestamp; 854 __le32 start_tsf; 855 __le32 rx_rate_n_flags; 856 __le32 tx_rate_n_flags; 857 __le32 t2t3_initiator; 858 __le32 t1t4_responder; 859 __le16 common_calib; 860 __le16 specific_calib; 861 __le32 papd_calib_output; 862 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_4 */ 863 864 /** 865 * struct iwl_tof_range_rsp_ap_entry_ntfy - AP parameters (response) 866 * @bssid: BSSID of the AP 867 * @measure_status: current APs measurement status, one of 868 * &enum iwl_tof_entry_status. 869 * @measure_bw: Current AP Bandwidth: 0 20MHz, 1 40MHz, 2 80MHz 870 * @rtt: The Round Trip Time that took for the last measurement for 871 * current AP [pSec] 872 * @rtt_variance: The Variance of the RTT values measured for current AP 873 * @rtt_spread: The Difference between the maximum and the minimum RTT 874 * values measured for current AP in the current session [pSec] 875 * @rssi: RSSI as uploaded in the Channel Estimation notification 876 * @rssi_spread: The Difference between the maximum and the minimum RSSI values 877 * measured for current AP in the current session 878 * @last_burst: 1 if no more FTM sessions are scheduled for this responder 879 * @refusal_period: refusal period in case of 880 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec] 881 * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was 882 * uploaded by the LMAC 883 * @start_tsf: measurement start time in TSF of the mac specified in the range 884 * request 885 * @rx_rate_n_flags: rate and flags of the last FTM frame received from this 886 * responder 887 * @tx_rate_n_flags: rate and flags of the last ack sent to this responder 888 * @t2t3_initiator: as calculated from the algo in the initiator 889 * @t1t4_responder: as calculated from the algo in the responder 890 * @common_calib: Calib val that was used in for this AP measurement 891 * @specific_calib: val that was used in for this AP measurement 892 * @papd_calib_output: The result of the tof papd calibration that was injected 893 * into the algorithm. 894 * @rttConfidence: a value between 0 - 31 that represents the rtt accuracy. 895 * @reserved: for alignment 896 */ 897 struct iwl_tof_range_rsp_ap_entry_ntfy { 898 u8 bssid[ETH_ALEN]; 899 u8 measure_status; 900 u8 measure_bw; 901 __le32 rtt; 902 __le32 rtt_variance; 903 __le32 rtt_spread; 904 s8 rssi; 905 u8 rssi_spread; 906 u8 last_burst; 907 u8 refusal_period; 908 __le32 timestamp; 909 __le32 start_tsf; 910 __le32 rx_rate_n_flags; 911 __le32 tx_rate_n_flags; 912 __le32 t2t3_initiator; 913 __le32 t1t4_responder; 914 __le16 common_calib; 915 __le16 specific_calib; 916 __le32 papd_calib_output; 917 u8 rttConfidence; 918 u8 reserved[3]; 919 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_5 */ 920 921 /** 922 * enum iwl_tof_response_status - tof response status 923 * 924 * @IWL_TOF_RESPONSE_SUCCESS: successful range. 925 * @IWL_TOF_RESPONSE_TIMEOUT: request aborted due to timeout expiration. 926 * partial result of ranges done so far is included in the response. 927 * @IWL_TOF_RESPONSE_ABORTED: Measurement aborted by command. 928 * @IWL_TOF_RESPONSE_FAILED: Measurement request command failed. 929 */ 930 enum iwl_tof_response_status { 931 IWL_TOF_RESPONSE_SUCCESS = 0, 932 IWL_TOF_RESPONSE_TIMEOUT = 1, 933 IWL_TOF_RESPONSE_ABORTED = 4, 934 IWL_TOF_RESPONSE_FAILED = 5, 935 }; /* LOCATION_RNG_RSP_STATUS */ 936 937 /** 938 * struct iwl_tof_range_rsp_ntfy_v5 - ranging response notification 939 * @request_id: A Token ID of the corresponding Range request 940 * @request_status: status of current measurement session, one of 941 * &enum iwl_tof_response_status. 942 * @last_in_batch: reprot policy (when not all responses are uploaded at once) 943 * @num_of_aps: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 944 * @ap: per-AP data 945 */ 946 struct iwl_tof_range_rsp_ntfy_v5 { 947 u8 request_id; 948 u8 request_status; 949 u8 last_in_batch; 950 u8 num_of_aps; 951 struct iwl_tof_range_rsp_ap_entry_ntfy_v3 ap[IWL_MVM_TOF_MAX_APS]; 952 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_5 */ 953 954 /** 955 * struct iwl_tof_range_rsp_ntfy_v6 - ranging response notification 956 * @request_id: A Token ID of the corresponding Range request 957 * @num_of_aps: Number of APs results 958 * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise. 959 * @reserved: reserved 960 * @ap: per-AP data 961 */ 962 struct iwl_tof_range_rsp_ntfy_v6 { 963 u8 request_id; 964 u8 num_of_aps; 965 u8 last_report; 966 u8 reserved; 967 struct iwl_tof_range_rsp_ap_entry_ntfy_v4 ap[IWL_MVM_TOF_MAX_APS]; 968 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_6 */ 969 970 /** 971 * struct iwl_tof_range_rsp_ntfy - ranging response notification 972 * @request_id: A Token ID of the corresponding Range request 973 * @num_of_aps: Number of APs results 974 * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise. 975 * @reserved: reserved 976 * @ap: per-AP data 977 */ 978 struct iwl_tof_range_rsp_ntfy { 979 u8 request_id; 980 u8 num_of_aps; 981 u8 last_report; 982 u8 reserved; 983 struct iwl_tof_range_rsp_ap_entry_ntfy ap[IWL_MVM_TOF_MAX_APS]; 984 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_7 */ 985 986 #define IWL_MVM_TOF_MCSI_BUF_SIZE (245) 987 /** 988 * struct iwl_tof_mcsi_notif - used for debug 989 * @token: token ID for the current session 990 * @role: '0' - initiator, '1' - responder 991 * @reserved: reserved 992 * @initiator_bssid: initiator machine 993 * @responder_bssid: responder machine 994 * @mcsi_buffer: debug data 995 */ 996 struct iwl_tof_mcsi_notif { 997 u8 token; 998 u8 role; 999 __le16 reserved; 1000 u8 initiator_bssid[ETH_ALEN]; 1001 u8 responder_bssid[ETH_ALEN]; 1002 u8 mcsi_buffer[IWL_MVM_TOF_MCSI_BUF_SIZE * 4]; 1003 } __packed; 1004 1005 /** 1006 * struct iwl_tof_range_abort_cmd 1007 * @request_id: corresponds to a range request 1008 * @reserved: reserved 1009 */ 1010 struct iwl_tof_range_abort_cmd { 1011 u8 request_id; 1012 u8 reserved[3]; 1013 } __packed; 1014 1015 enum ftm_responder_stats_flags { 1016 FTM_RESP_STAT_NON_ASAP_STARTED = BIT(0), 1017 FTM_RESP_STAT_NON_ASAP_IN_WIN = BIT(1), 1018 FTM_RESP_STAT_NON_ASAP_OUT_WIN = BIT(2), 1019 FTM_RESP_STAT_TRIGGER_DUP = BIT(3), 1020 FTM_RESP_STAT_DUP = BIT(4), 1021 FTM_RESP_STAT_DUP_IN_WIN = BIT(5), 1022 FTM_RESP_STAT_DUP_OUT_WIN = BIT(6), 1023 FTM_RESP_STAT_SCHED_SUCCESS = BIT(7), 1024 FTM_RESP_STAT_ASAP_REQ = BIT(8), 1025 FTM_RESP_STAT_NON_ASAP_REQ = BIT(9), 1026 FTM_RESP_STAT_ASAP_RESP = BIT(10), 1027 FTM_RESP_STAT_NON_ASAP_RESP = BIT(11), 1028 FTM_RESP_STAT_FAIL_INITIATOR_INACTIVE = BIT(12), 1029 FTM_RESP_STAT_FAIL_INITIATOR_OUT_WIN = BIT(13), 1030 FTM_RESP_STAT_FAIL_INITIATOR_RETRY_LIM = BIT(14), 1031 FTM_RESP_STAT_FAIL_NEXT_SERVED = BIT(15), 1032 FTM_RESP_STAT_FAIL_TRIGGER_ERR = BIT(16), 1033 FTM_RESP_STAT_FAIL_GC = BIT(17), 1034 FTM_RESP_STAT_SUCCESS = BIT(18), 1035 FTM_RESP_STAT_INTEL_IE = BIT(19), 1036 FTM_RESP_STAT_INITIATOR_ACTIVE = BIT(20), 1037 FTM_RESP_STAT_MEASUREMENTS_AVAILABLE = BIT(21), 1038 FTM_RESP_STAT_TRIGGER_UNKNOWN = BIT(22), 1039 FTM_RESP_STAT_PROCESS_FAIL = BIT(23), 1040 FTM_RESP_STAT_ACK = BIT(24), 1041 FTM_RESP_STAT_NACK = BIT(25), 1042 FTM_RESP_STAT_INVALID_INITIATOR_ID = BIT(26), 1043 FTM_RESP_STAT_TIMER_MIN_DELTA = BIT(27), 1044 FTM_RESP_STAT_INITIATOR_REMOVED = BIT(28), 1045 FTM_RESP_STAT_INITIATOR_ADDED = BIT(29), 1046 FTM_RESP_STAT_ERR_LIST_FULL = BIT(30), 1047 FTM_RESP_STAT_INITIATOR_SCHED_NOW = BIT(31), 1048 }; /* RESP_IND_E */ 1049 1050 /** 1051 * struct iwl_ftm_responder_stats - FTM responder statistics 1052 * @addr: initiator address 1053 * @success_ftm: number of successful ftm frames 1054 * @ftm_per_burst: num of FTM frames that were received 1055 * @flags: &enum ftm_responder_stats_flags 1056 * @duration: actual duration of FTM 1057 * @allocated_duration: time that was allocated for this FTM session 1058 * @bw: FTM request bandwidth 1059 * @rate: FTM request rate 1060 * @reserved: for alingment and future use 1061 */ 1062 struct iwl_ftm_responder_stats { 1063 u8 addr[ETH_ALEN]; 1064 u8 success_ftm; 1065 u8 ftm_per_burst; 1066 __le32 flags; 1067 __le32 duration; 1068 __le32 allocated_duration; 1069 u8 bw; 1070 u8 rate; 1071 __le16 reserved; 1072 } __packed; /* TOF_RESPONDER_STATISTICS_NTFY_S_VER_2 */ 1073 1074 #define IWL_CSI_MAX_EXPECTED_CHUNKS 16 1075 1076 #define IWL_CSI_CHUNK_CTL_NUM_MASK_VER_1 0x0003 1077 #define IWL_CSI_CHUNK_CTL_IDX_MASK_VER_1 0x000c 1078 1079 #define IWL_CSI_CHUNK_CTL_NUM_MASK_VER_2 0x00ff 1080 #define IWL_CSI_CHUNK_CTL_IDX_MASK_VER_2 0xff00 1081 1082 struct iwl_csi_chunk_notification { 1083 __le32 token; 1084 __le16 seq; 1085 __le16 ctl; 1086 __le32 size; 1087 u8 data[]; 1088 } __packed; /* CSI_CHUNKS_HDR_NTFY_API_S_VER_1/VER_2 */ 1089 1090 #endif /* __iwl_fw_api_location_h__ */ 1091