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 * @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 */ 434 enum iwl_initiator_ap_flags { 435 IWL_INITIATOR_AP_FLAGS_ASAP = BIT(1), 436 IWL_INITIATOR_AP_FLAGS_LCI_REQUEST = BIT(2), 437 IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST = BIT(3), 438 IWL_INITIATOR_AP_FLAGS_DYN_ACK = BIT(4), 439 IWL_INITIATOR_AP_FLAGS_ALGO_LR = BIT(5), 440 IWL_INITIATOR_AP_FLAGS_ALGO_FFT = BIT(6), 441 IWL_INITIATOR_AP_FLAGS_MCSI_REPORT = BIT(8), 442 IWL_INITIATOR_AP_FLAGS_NON_TB = BIT(9), 443 IWL_INITIATOR_AP_FLAGS_TB = BIT(10), 444 IWL_INITIATOR_AP_FLAGS_SECURED = BIT(11), 445 }; 446 447 /** 448 * struct iwl_tof_range_req_ap_entry_v3 - AP configuration parameters 449 * @initiator_ap_flags: see &enum iwl_initiator_ap_flags. 450 * @channel_num: AP Channel number 451 * @bandwidth: AP bandwidth. One of iwl_tof_bandwidth. 452 * @ctrl_ch_position: Coding of the control channel position relative to the 453 * center frequency, see iwl_mvm_get_ctrl_pos(). 454 * @ftmr_max_retries: Max number of retries to send the FTMR in case of no 455 * reply from the AP. 456 * @bssid: AP's BSSID 457 * @burst_period: Recommended value to be sent to the AP. Measurement 458 * periodicity In units of 100ms. ignored if num_of_bursts_exp = 0 459 * @samples_per_burst: the number of FTMs pairs in single Burst (1-31); 460 * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of 461 * the number of measurement iterations (min 2^0 = 1, max 2^14) 462 * @reserved: For alignment and future use 463 * @tsf_delta: not in use 464 */ 465 struct iwl_tof_range_req_ap_entry_v3 { 466 __le32 initiator_ap_flags; 467 u8 channel_num; 468 u8 bandwidth; 469 u8 ctrl_ch_position; 470 u8 ftmr_max_retries; 471 u8 bssid[ETH_ALEN]; 472 __le16 burst_period; 473 u8 samples_per_burst; 474 u8 num_of_bursts; 475 __le16 reserved; 476 __le32 tsf_delta; 477 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_3 */ 478 479 /** 480 * enum iwl_location_frame_format - location frame formats 481 * @IWL_LOCATION_FRAME_FORMAT_LEGACY: legacy 482 * @IWL_LOCATION_FRAME_FORMAT_HT: HT 483 * @IWL_LOCATION_FRAME_FORMAT_VHT: VHT 484 * @IWL_LOCATION_FRAME_FORMAT_HE: HE 485 */ 486 enum iwl_location_frame_format { 487 IWL_LOCATION_FRAME_FORMAT_LEGACY, 488 IWL_LOCATION_FRAME_FORMAT_HT, 489 IWL_LOCATION_FRAME_FORMAT_VHT, 490 IWL_LOCATION_FRAME_FORMAT_HE, 491 }; 492 493 /** 494 * enum iwl_location_bw - location bandwidth selection 495 * @IWL_LOCATION_BW_20MHZ: 20MHz 496 * @IWL_LOCATION_BW_40MHZ: 40MHz 497 * @IWL_LOCATION_BW_80MHZ: 80MHz 498 */ 499 enum iwl_location_bw { 500 IWL_LOCATION_BW_20MHZ, 501 IWL_LOCATION_BW_40MHZ, 502 IWL_LOCATION_BW_80MHZ, 503 }; 504 505 #define HLTK_11AZ_LEN 32 506 #define TK_11AZ_LEN 32 507 508 #define LOCATION_BW_POS 4 509 510 /** 511 * struct iwl_tof_range_req_ap_entry - AP configuration parameters 512 * @initiator_ap_flags: see &enum iwl_initiator_ap_flags. 513 * @channel_num: AP Channel number 514 * @format_bw: bits 0 - 3: &enum iwl_location_frame_format. 515 * bits 4 - 7: &enum iwl_location_bw. 516 * @ctrl_ch_position: Coding of the control channel position relative to the 517 * center frequency, see iwl_mvm_get_ctrl_pos(). 518 * @ftmr_max_retries: Max number of retries to send the FTMR in case of no 519 * reply from the AP. 520 * @bssid: AP's BSSID 521 * @burst_period: Recommended value to be sent to the AP. Measurement 522 * periodicity In units of 100ms. ignored if num_of_bursts_exp = 0 523 * @samples_per_burst: the number of FTMs pairs in single Burst (1-31); 524 * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of 525 * the number of measurement iterations (min 2^0 = 1, max 2^14) 526 * @reserved: For alignment and future use 527 * @hltk: HLTK to be used for secured 11az measurement 528 * @tk: TK to be used for secured 11az measurement 529 */ 530 struct iwl_tof_range_req_ap_entry { 531 __le32 initiator_ap_flags; 532 u8 channel_num; 533 u8 format_bw; 534 u8 ctrl_ch_position; 535 u8 ftmr_max_retries; 536 u8 bssid[ETH_ALEN]; 537 __le16 burst_period; 538 u8 samples_per_burst; 539 u8 num_of_bursts; 540 __le16 reserved; 541 u8 hltk[HLTK_11AZ_LEN]; 542 u8 tk[TK_11AZ_LEN]; 543 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_4 */ 544 545 /** 546 * enum iwl_tof_response_mode 547 * @IWL_MVM_TOF_RESPONSE_ASAP: report each AP measurement separately as soon as 548 * possible (not supported for this release) 549 * @IWL_MVM_TOF_RESPONSE_TIMEOUT: report all AP measurements as a batch upon 550 * timeout expiration 551 * @IWL_MVM_TOF_RESPONSE_COMPLETE: report all AP measurements as a batch at the 552 * earlier of: measurements completion / timeout 553 * expiration. 554 */ 555 enum iwl_tof_response_mode { 556 IWL_MVM_TOF_RESPONSE_ASAP, 557 IWL_MVM_TOF_RESPONSE_TIMEOUT, 558 IWL_MVM_TOF_RESPONSE_COMPLETE, 559 }; 560 561 /** 562 * enum iwl_tof_initiator_flags 563 * 564 * @IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED: disable fast algo, meaning run 565 * the algo on ant A+B, instead of only one of them. 566 * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A: open RX antenna A for FTMs RX 567 * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B: open RX antenna B for FTMs RX 568 * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C: open RX antenna C for FTMs RX 569 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A: use antenna A fo TX ACKs during FTM 570 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B: use antenna B fo TX ACKs during FTM 571 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C: use antenna C fo TX ACKs during FTM 572 * @IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM: use random mac address for FTM 573 * @IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB: use the specific calib value from 574 * the range request command 575 * @IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB: use the common calib value from the 576 * ragne request command 577 * @IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT: support non-asap measurements 578 */ 579 enum iwl_tof_initiator_flags { 580 IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED = BIT(0), 581 IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A = BIT(1), 582 IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B = BIT(2), 583 IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C = BIT(3), 584 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A = BIT(4), 585 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B = BIT(5), 586 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C = BIT(6), 587 IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM = BIT(7), 588 IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB = BIT(15), 589 IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB = BIT(16), 590 IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT = BIT(20), 591 }; /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */ 592 593 #define IWL_MVM_TOF_MAX_APS 5 594 #define IWL_MVM_TOF_MAX_TWO_SIDED_APS 5 595 596 /** 597 * struct iwl_tof_range_req_cmd_v5 - start measurement cmd 598 * @initiator_flags: see flags @ iwl_tof_initiator_flags 599 * @request_id: A Token incremented per request. The same Token will be 600 * sent back in the range response 601 * @initiator: 0- NW initiated, 1 - Client Initiated 602 * @one_sided_los_disable: '0'- run ML-Algo for both ToF/OneSided, 603 * '1' - run ML-Algo for ToF only 604 * @req_timeout: Requested timeout of the response in units of 100ms. 605 * This is equivalent to the session time configured to the 606 * LMAC in Initiator Request 607 * @report_policy: Supported partially for this release: For current release - 608 * the range report will be uploaded as a batch when ready or 609 * when the session is done (successfully / partially). 610 * one of iwl_tof_response_mode. 611 * @reserved0: reserved 612 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 613 * @macaddr_random: '0' Use default source MAC address (i.e. p2_p), 614 * '1' Use MAC Address randomization according to the below 615 * @range_req_bssid: ranging request BSSID 616 * @macaddr_template: MAC address template to use for non-randomized bits 617 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template. 618 * Bits set to 1 shall be randomized by the UMAC 619 * @ftm_rx_chains: Rx chain to open to receive Responder's FTMs (XVT) 620 * @ftm_tx_chains: Tx chain to send the ack to the Responder FTM (XVT) 621 * @common_calib: The common calib value to inject to this measurement calc 622 * @specific_calib: The specific calib value to inject to this measurement calc 623 * @ap: per-AP request data 624 */ 625 struct iwl_tof_range_req_cmd_v5 { 626 __le32 initiator_flags; 627 u8 request_id; 628 u8 initiator; 629 u8 one_sided_los_disable; 630 u8 req_timeout; 631 u8 report_policy; 632 u8 reserved0; 633 u8 num_of_ap; 634 u8 macaddr_random; 635 u8 range_req_bssid[ETH_ALEN]; 636 u8 macaddr_template[ETH_ALEN]; 637 u8 macaddr_mask[ETH_ALEN]; 638 u8 ftm_rx_chains; 639 u8 ftm_tx_chains; 640 __le16 common_calib; 641 __le16 specific_calib; 642 struct iwl_tof_range_req_ap_entry_v2 ap[IWL_MVM_TOF_MAX_APS]; 643 } __packed; 644 /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */ 645 646 /** 647 * struct iwl_tof_range_req_cmd_v7 - start measurement cmd 648 * @initiator_flags: see flags @ iwl_tof_initiator_flags 649 * @request_id: A Token incremented per request. The same Token will be 650 * sent back in the range response 651 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 652 * @range_req_bssid: ranging request BSSID 653 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template. 654 * Bits set to 1 shall be randomized by the UMAC 655 * @macaddr_template: MAC address template to use for non-randomized bits 656 * @req_timeout_ms: Requested timeout of the response in units of milliseconds. 657 * This is the session time for completing the measurement. 658 * @tsf_mac_id: report the measurement start time for each ap in terms of the 659 * TSF of this mac id. 0xff to disable TSF reporting. 660 * @common_calib: The common calib value to inject to this measurement calc 661 * @specific_calib: The specific calib value to inject to this measurement calc 662 * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2. 663 */ 664 struct iwl_tof_range_req_cmd_v7 { 665 __le32 initiator_flags; 666 u8 request_id; 667 u8 num_of_ap; 668 u8 range_req_bssid[ETH_ALEN]; 669 u8 macaddr_mask[ETH_ALEN]; 670 u8 macaddr_template[ETH_ALEN]; 671 __le32 req_timeout_ms; 672 __le32 tsf_mac_id; 673 __le16 common_calib; 674 __le16 specific_calib; 675 struct iwl_tof_range_req_ap_entry_v3 ap[IWL_MVM_TOF_MAX_APS]; 676 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_7 */ 677 678 /** 679 * struct iwl_tof_range_req_cmd - start measurement cmd 680 * @initiator_flags: see flags @ iwl_tof_initiator_flags 681 * @request_id: A Token incremented per request. The same Token will be 682 * sent back in the range response 683 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 684 * @range_req_bssid: ranging request BSSID 685 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template. 686 * Bits set to 1 shall be randomized by the UMAC 687 * @macaddr_template: MAC address template to use for non-randomized bits 688 * @req_timeout_ms: Requested timeout of the response in units of milliseconds. 689 * This is the session time for completing the measurement. 690 * @tsf_mac_id: report the measurement start time for each ap in terms of the 691 * TSF of this mac id. 0xff to disable TSF reporting. 692 * @common_calib: The common calib value to inject to this measurement calc 693 * @specific_calib: The specific calib value to inject to this measurement calc 694 * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2. 695 */ 696 struct iwl_tof_range_req_cmd { 697 __le32 initiator_flags; 698 u8 request_id; 699 u8 num_of_ap; 700 u8 range_req_bssid[ETH_ALEN]; 701 u8 macaddr_mask[ETH_ALEN]; 702 u8 macaddr_template[ETH_ALEN]; 703 __le32 req_timeout_ms; 704 __le32 tsf_mac_id; 705 __le16 common_calib; 706 __le16 specific_calib; 707 struct iwl_tof_range_req_ap_entry ap[IWL_MVM_TOF_MAX_APS]; 708 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_8 */ 709 710 /* 711 * enum iwl_tof_range_request_status - status of the sent request 712 * @IWL_TOF_RANGE_REQUEST_STATUS_SUCCESSFUL - FW successfully received the 713 * request 714 * @IWL_TOF_RANGE_REQUEST_STATUS_BUSY - FW is busy with a previous request, the 715 * sent request will not be handled 716 */ 717 enum iwl_tof_range_request_status { 718 IWL_TOF_RANGE_REQUEST_STATUS_SUCCESS, 719 IWL_TOF_RANGE_REQUEST_STATUS_BUSY, 720 }; 721 722 /** 723 * enum iwl_tof_entry_status 724 * 725 * @IWL_TOF_ENTRY_SUCCESS: successful measurement. 726 * @IWL_TOF_ENTRY_GENERAL_FAILURE: General failure. 727 * @IWL_TOF_ENTRY_NO_RESPONSE: Responder didn't reply to the request. 728 * @IWL_TOF_ENTRY_REQUEST_REJECTED: Responder rejected the request. 729 * @IWL_TOF_ENTRY_NOT_SCHEDULED: Time event was scheduled but not called yet. 730 * @IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT: Time event triggered but no 731 * measurement was completed. 732 * @IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE: No range due inability to switch 733 * from the primary channel. 734 * @IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED: Device doesn't support FTM. 735 * @IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON: Request aborted due to unknown 736 * reason. 737 * @IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP: Failure due to invalid 738 * T1/T4. 739 * @IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE: Failure due to invalid FTM frame 740 * structure. 741 * @IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED: Request cannot be scheduled. 742 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE: Responder cannot serve the 743 * initiator for some period, period supplied in @refusal_period. 744 * @IWL_TOF_ENTRY_BAD_REQUEST_ARGS: Bad request arguments. 745 * @IWL_TOF_ENTRY_WIFI_NOT_ENABLED: Wifi not enabled. 746 * @IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS: Responder override the original 747 * parameters within the current session. 748 */ 749 enum iwl_tof_entry_status { 750 IWL_TOF_ENTRY_SUCCESS = 0, 751 IWL_TOF_ENTRY_GENERAL_FAILURE = 1, 752 IWL_TOF_ENTRY_NO_RESPONSE = 2, 753 IWL_TOF_ENTRY_REQUEST_REJECTED = 3, 754 IWL_TOF_ENTRY_NOT_SCHEDULED = 4, 755 IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT = 5, 756 IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE = 6, 757 IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED = 7, 758 IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON = 8, 759 IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP = 9, 760 IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE = 10, 761 IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED = 11, 762 IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE = 12, 763 IWL_TOF_ENTRY_BAD_REQUEST_ARGS = 13, 764 IWL_TOF_ENTRY_WIFI_NOT_ENABLED = 14, 765 IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS = 15, 766 }; /* LOCATION_RANGE_RSP_AP_ENTRY_NTFY_API_S_VER_2 */ 767 768 /** 769 * struct iwl_tof_range_rsp_ap_entry_ntfy_v3 - AP parameters (response) 770 * @bssid: BSSID of the AP 771 * @measure_status: current APs measurement status, one of 772 * &enum iwl_tof_entry_status. 773 * @measure_bw: Current AP Bandwidth: 0 20MHz, 1 40MHz, 2 80MHz 774 * @rtt: The Round Trip Time that took for the last measurement for 775 * current AP [pSec] 776 * @rtt_variance: The Variance of the RTT values measured for current AP 777 * @rtt_spread: The Difference between the maximum and the minimum RTT 778 * values measured for current AP in the current session [pSec] 779 * @rssi: RSSI as uploaded in the Channel Estimation notification 780 * @rssi_spread: The Difference between the maximum and the minimum RSSI values 781 * measured for current AP in the current session 782 * @reserved: reserved 783 * @refusal_period: refusal period in case of 784 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec] 785 * @range: Measured range [cm] 786 * @range_variance: Measured range variance [cm] 787 * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was 788 * uploaded by the LMAC 789 * @t2t3_initiator: as calculated from the algo in the initiator 790 * @t1t4_responder: as calculated from the algo in the responder 791 * @common_calib: Calib val that was used in for this AP measurement 792 * @specific_calib: val that was used in for this AP measurement 793 * @papd_calib_output: The result of the tof papd calibration that was injected 794 * into the algorithm. 795 */ 796 struct iwl_tof_range_rsp_ap_entry_ntfy_v3 { 797 u8 bssid[ETH_ALEN]; 798 u8 measure_status; 799 u8 measure_bw; 800 __le32 rtt; 801 __le32 rtt_variance; 802 __le32 rtt_spread; 803 s8 rssi; 804 u8 rssi_spread; 805 u8 reserved; 806 u8 refusal_period; 807 __le32 range; 808 __le32 range_variance; 809 __le32 timestamp; 810 __le32 t2t3_initiator; 811 __le32 t1t4_responder; 812 __le16 common_calib; 813 __le16 specific_calib; 814 __le32 papd_calib_output; 815 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_3 */ 816 817 /** 818 * struct iwl_tof_range_rsp_ap_entry_ntfy_v4 - AP parameters (response) 819 * @bssid: BSSID of the AP 820 * @measure_status: current APs measurement status, one of 821 * &enum iwl_tof_entry_status. 822 * @measure_bw: Current AP Bandwidth: 0 20MHz, 1 40MHz, 2 80MHz 823 * @rtt: The Round Trip Time that took for the last measurement for 824 * current AP [pSec] 825 * @rtt_variance: The Variance of the RTT values measured for current AP 826 * @rtt_spread: The Difference between the maximum and the minimum RTT 827 * values measured for current AP in the current session [pSec] 828 * @rssi: RSSI as uploaded in the Channel Estimation notification 829 * @rssi_spread: The Difference between the maximum and the minimum RSSI values 830 * measured for current AP in the current session 831 * @last_burst: 1 if no more FTM sessions are scheduled for this responder 832 * @refusal_period: refusal period in case of 833 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec] 834 * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was 835 * uploaded by the LMAC 836 * @start_tsf: measurement start time in TSF of the mac specified in the range 837 * request 838 * @rx_rate_n_flags: rate and flags of the last FTM frame received from this 839 * responder 840 * @tx_rate_n_flags: rate and flags of the last ack sent to this responder 841 * @t2t3_initiator: as calculated from the algo in the initiator 842 * @t1t4_responder: as calculated from the algo in the responder 843 * @common_calib: Calib val that was used in for this AP measurement 844 * @specific_calib: val that was used in for this AP measurement 845 * @papd_calib_output: The result of the tof papd calibration that was injected 846 * into the algorithm. 847 */ 848 struct iwl_tof_range_rsp_ap_entry_ntfy_v4 { 849 u8 bssid[ETH_ALEN]; 850 u8 measure_status; 851 u8 measure_bw; 852 __le32 rtt; 853 __le32 rtt_variance; 854 __le32 rtt_spread; 855 s8 rssi; 856 u8 rssi_spread; 857 u8 last_burst; 858 u8 refusal_period; 859 __le32 timestamp; 860 __le32 start_tsf; 861 __le32 rx_rate_n_flags; 862 __le32 tx_rate_n_flags; 863 __le32 t2t3_initiator; 864 __le32 t1t4_responder; 865 __le16 common_calib; 866 __le16 specific_calib; 867 __le32 papd_calib_output; 868 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_4 */ 869 870 /** 871 * struct iwl_tof_range_rsp_ap_entry_ntfy - AP parameters (response) 872 * @bssid: BSSID of the AP 873 * @measure_status: current APs measurement status, one of 874 * &enum iwl_tof_entry_status. 875 * @measure_bw: Current AP Bandwidth: 0 20MHz, 1 40MHz, 2 80MHz 876 * @rtt: The Round Trip Time that took for the last measurement for 877 * current AP [pSec] 878 * @rtt_variance: The Variance of the RTT values measured for current AP 879 * @rtt_spread: The Difference between the maximum and the minimum RTT 880 * values measured for current AP in the current session [pSec] 881 * @rssi: RSSI as uploaded in the Channel Estimation notification 882 * @rssi_spread: The Difference between the maximum and the minimum RSSI values 883 * measured for current AP in the current session 884 * @last_burst: 1 if no more FTM sessions are scheduled for this responder 885 * @refusal_period: refusal period in case of 886 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec] 887 * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was 888 * uploaded by the LMAC 889 * @start_tsf: measurement start time in TSF of the mac specified in the range 890 * request 891 * @rx_rate_n_flags: rate and flags of the last FTM frame received from this 892 * responder 893 * @tx_rate_n_flags: rate and flags of the last ack sent to this responder 894 * @t2t3_initiator: as calculated from the algo in the initiator 895 * @t1t4_responder: as calculated from the algo in the responder 896 * @common_calib: Calib val that was used in for this AP measurement 897 * @specific_calib: val that was used in for this AP measurement 898 * @papd_calib_output: The result of the tof papd calibration that was injected 899 * into the algorithm. 900 * @rttConfidence: a value between 0 - 31 that represents the rtt accuracy. 901 * @reserved: for alignment 902 */ 903 struct iwl_tof_range_rsp_ap_entry_ntfy { 904 u8 bssid[ETH_ALEN]; 905 u8 measure_status; 906 u8 measure_bw; 907 __le32 rtt; 908 __le32 rtt_variance; 909 __le32 rtt_spread; 910 s8 rssi; 911 u8 rssi_spread; 912 u8 last_burst; 913 u8 refusal_period; 914 __le32 timestamp; 915 __le32 start_tsf; 916 __le32 rx_rate_n_flags; 917 __le32 tx_rate_n_flags; 918 __le32 t2t3_initiator; 919 __le32 t1t4_responder; 920 __le16 common_calib; 921 __le16 specific_calib; 922 __le32 papd_calib_output; 923 u8 rttConfidence; 924 u8 reserved[3]; 925 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_5 */ 926 927 /** 928 * enum iwl_tof_response_status - tof response status 929 * 930 * @IWL_TOF_RESPONSE_SUCCESS: successful range. 931 * @IWL_TOF_RESPONSE_TIMEOUT: request aborted due to timeout expiration. 932 * partial result of ranges done so far is included in the response. 933 * @IWL_TOF_RESPONSE_ABORTED: Measurement aborted by command. 934 * @IWL_TOF_RESPONSE_FAILED: Measurement request command failed. 935 */ 936 enum iwl_tof_response_status { 937 IWL_TOF_RESPONSE_SUCCESS = 0, 938 IWL_TOF_RESPONSE_TIMEOUT = 1, 939 IWL_TOF_RESPONSE_ABORTED = 4, 940 IWL_TOF_RESPONSE_FAILED = 5, 941 }; /* LOCATION_RNG_RSP_STATUS */ 942 943 /** 944 * struct iwl_tof_range_rsp_ntfy_v5 - ranging response notification 945 * @request_id: A Token ID of the corresponding Range request 946 * @request_status: status of current measurement session, one of 947 * &enum iwl_tof_response_status. 948 * @last_in_batch: reprot policy (when not all responses are uploaded at once) 949 * @num_of_aps: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 950 * @ap: per-AP data 951 */ 952 struct iwl_tof_range_rsp_ntfy_v5 { 953 u8 request_id; 954 u8 request_status; 955 u8 last_in_batch; 956 u8 num_of_aps; 957 struct iwl_tof_range_rsp_ap_entry_ntfy_v3 ap[IWL_MVM_TOF_MAX_APS]; 958 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_5 */ 959 960 /** 961 * struct iwl_tof_range_rsp_ntfy_v6 - ranging response notification 962 * @request_id: A Token ID of the corresponding Range request 963 * @num_of_aps: Number of APs results 964 * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise. 965 * @reserved: reserved 966 * @ap: per-AP data 967 */ 968 struct iwl_tof_range_rsp_ntfy_v6 { 969 u8 request_id; 970 u8 num_of_aps; 971 u8 last_report; 972 u8 reserved; 973 struct iwl_tof_range_rsp_ap_entry_ntfy_v4 ap[IWL_MVM_TOF_MAX_APS]; 974 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_6 */ 975 976 /** 977 * struct iwl_tof_range_rsp_ntfy - ranging response notification 978 * @request_id: A Token ID of the corresponding Range request 979 * @num_of_aps: Number of APs results 980 * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise. 981 * @reserved: reserved 982 * @ap: per-AP data 983 */ 984 struct iwl_tof_range_rsp_ntfy { 985 u8 request_id; 986 u8 num_of_aps; 987 u8 last_report; 988 u8 reserved; 989 struct iwl_tof_range_rsp_ap_entry_ntfy ap[IWL_MVM_TOF_MAX_APS]; 990 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_7 */ 991 992 #define IWL_MVM_TOF_MCSI_BUF_SIZE (245) 993 /** 994 * struct iwl_tof_mcsi_notif - used for debug 995 * @token: token ID for the current session 996 * @role: '0' - initiator, '1' - responder 997 * @reserved: reserved 998 * @initiator_bssid: initiator machine 999 * @responder_bssid: responder machine 1000 * @mcsi_buffer: debug data 1001 */ 1002 struct iwl_tof_mcsi_notif { 1003 u8 token; 1004 u8 role; 1005 __le16 reserved; 1006 u8 initiator_bssid[ETH_ALEN]; 1007 u8 responder_bssid[ETH_ALEN]; 1008 u8 mcsi_buffer[IWL_MVM_TOF_MCSI_BUF_SIZE * 4]; 1009 } __packed; 1010 1011 /** 1012 * struct iwl_tof_range_abort_cmd 1013 * @request_id: corresponds to a range request 1014 * @reserved: reserved 1015 */ 1016 struct iwl_tof_range_abort_cmd { 1017 u8 request_id; 1018 u8 reserved[3]; 1019 } __packed; 1020 1021 enum ftm_responder_stats_flags { 1022 FTM_RESP_STAT_NON_ASAP_STARTED = BIT(0), 1023 FTM_RESP_STAT_NON_ASAP_IN_WIN = BIT(1), 1024 FTM_RESP_STAT_NON_ASAP_OUT_WIN = BIT(2), 1025 FTM_RESP_STAT_TRIGGER_DUP = BIT(3), 1026 FTM_RESP_STAT_DUP = BIT(4), 1027 FTM_RESP_STAT_DUP_IN_WIN = BIT(5), 1028 FTM_RESP_STAT_DUP_OUT_WIN = BIT(6), 1029 FTM_RESP_STAT_SCHED_SUCCESS = BIT(7), 1030 FTM_RESP_STAT_ASAP_REQ = BIT(8), 1031 FTM_RESP_STAT_NON_ASAP_REQ = BIT(9), 1032 FTM_RESP_STAT_ASAP_RESP = BIT(10), 1033 FTM_RESP_STAT_NON_ASAP_RESP = BIT(11), 1034 FTM_RESP_STAT_FAIL_INITIATOR_INACTIVE = BIT(12), 1035 FTM_RESP_STAT_FAIL_INITIATOR_OUT_WIN = BIT(13), 1036 FTM_RESP_STAT_FAIL_INITIATOR_RETRY_LIM = BIT(14), 1037 FTM_RESP_STAT_FAIL_NEXT_SERVED = BIT(15), 1038 FTM_RESP_STAT_FAIL_TRIGGER_ERR = BIT(16), 1039 FTM_RESP_STAT_FAIL_GC = BIT(17), 1040 FTM_RESP_STAT_SUCCESS = BIT(18), 1041 FTM_RESP_STAT_INTEL_IE = BIT(19), 1042 FTM_RESP_STAT_INITIATOR_ACTIVE = BIT(20), 1043 FTM_RESP_STAT_MEASUREMENTS_AVAILABLE = BIT(21), 1044 FTM_RESP_STAT_TRIGGER_UNKNOWN = BIT(22), 1045 FTM_RESP_STAT_PROCESS_FAIL = BIT(23), 1046 FTM_RESP_STAT_ACK = BIT(24), 1047 FTM_RESP_STAT_NACK = BIT(25), 1048 FTM_RESP_STAT_INVALID_INITIATOR_ID = BIT(26), 1049 FTM_RESP_STAT_TIMER_MIN_DELTA = BIT(27), 1050 FTM_RESP_STAT_INITIATOR_REMOVED = BIT(28), 1051 FTM_RESP_STAT_INITIATOR_ADDED = BIT(29), 1052 FTM_RESP_STAT_ERR_LIST_FULL = BIT(30), 1053 FTM_RESP_STAT_INITIATOR_SCHED_NOW = BIT(31), 1054 }; /* RESP_IND_E */ 1055 1056 /** 1057 * struct iwl_ftm_responder_stats - FTM responder statistics 1058 * @addr: initiator address 1059 * @success_ftm: number of successful ftm frames 1060 * @ftm_per_burst: num of FTM frames that were received 1061 * @flags: &enum ftm_responder_stats_flags 1062 * @duration: actual duration of FTM 1063 * @allocated_duration: time that was allocated for this FTM session 1064 * @bw: FTM request bandwidth 1065 * @rate: FTM request rate 1066 * @reserved: for alingment and future use 1067 */ 1068 struct iwl_ftm_responder_stats { 1069 u8 addr[ETH_ALEN]; 1070 u8 success_ftm; 1071 u8 ftm_per_burst; 1072 __le32 flags; 1073 __le32 duration; 1074 __le32 allocated_duration; 1075 u8 bw; 1076 u8 rate; 1077 __le16 reserved; 1078 } __packed; /* TOF_RESPONDER_STATISTICS_NTFY_S_VER_2 */ 1079 1080 #define IWL_CSI_MAX_EXPECTED_CHUNKS 16 1081 1082 #define IWL_CSI_CHUNK_CTL_NUM_MASK_VER_1 0x0003 1083 #define IWL_CSI_CHUNK_CTL_IDX_MASK_VER_1 0x000c 1084 1085 #define IWL_CSI_CHUNK_CTL_NUM_MASK_VER_2 0x00ff 1086 #define IWL_CSI_CHUNK_CTL_IDX_MASK_VER_2 0xff00 1087 1088 struct iwl_csi_chunk_notification { 1089 __le32 token; 1090 __le16 seq; 1091 __le16 ctl; 1092 __le32 size; 1093 u8 data[]; 1094 } __packed; /* CSI_CHUNKS_HDR_NTFY_API_S_VER_1/VER_2 */ 1095 1096 #endif /* __iwl_fw_api_location_h__ */ 1097