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 */ 66 enum 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 */ 134 struct 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 */ 150 enum 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 */ 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 * @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 */ 437 enum 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 */ 470 struct 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 */ 491 enum 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 */ 504 enum 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 */ 535 struct 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 */ 556 enum 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 */ 591 struct 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 */ 619 enum 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 */ 643 enum 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 */ 689 struct 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 */ 728 struct 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 */ 760 struct 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 */ 790 struct 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 */ 809 enum 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 */ 841 enum 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 */ 888 struct 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 */ 940 struct 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 */ 995 struct 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 */ 1028 enum 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 */ 1044 struct 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 */ 1060 struct 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 */ 1076 struct 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 */ 1094 struct 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 */ 1108 struct iwl_tof_range_abort_cmd { 1109 u8 request_id; 1110 u8 reserved[3]; 1111 } __packed; 1112 1113 enum 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 */ 1160 struct 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 1180 struct 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__ */ 1189