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 * 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 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_request_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 */ 149 enum iwl_tof_bandwidth { 150 IWL_TOF_BW_20_LEGACY, 151 IWL_TOF_BW_20_HT, 152 IWL_TOF_BW_40, 153 IWL_TOF_BW_80, 154 IWL_TOF_BW_160, 155 }; /* LOCAT_BW_TYPE_E */ 156 157 /* 158 * enum iwl_tof_algo_type - Algorithym type for range measurement request 159 */ 160 enum iwl_tof_algo_type { 161 IWL_TOF_ALGO_TYPE_MAX_LIKE = 0, 162 IWL_TOF_ALGO_TYPE_LINEAR_REG = 1, 163 IWL_TOF_ALGO_TYPE_FFT = 2, 164 165 /* Keep last */ 166 IWL_TOF_ALGO_TYPE_INVALID, 167 }; /* ALGO_TYPE_E */ 168 169 /* 170 * enum iwl_tof_mcsi_ntfy - Enable/Disable MCSI notifications 171 */ 172 enum iwl_tof_mcsi_enable { 173 IWL_TOF_MCSI_DISABLED = 0, 174 IWL_TOF_MCSI_ENABLED = 1, 175 }; /* MCSI_ENABLE_E */ 176 177 /** 178 * enum iwl_tof_responder_cmd_valid_field - valid fields in the responder cfg 179 * @IWL_TOF_RESPONDER_CMD_VALID_CHAN_INFO: channel info is valid 180 * @IWL_TOF_RESPONDER_CMD_VALID_TOA_OFFSET: ToA offset is valid 181 * @IWL_TOF_RESPONDER_CMD_VALID_COMMON_CALIB: common calibration mode is valid 182 * @IWL_TOF_RESPONDER_CMD_VALID_SPECIFIC_CALIB: spefici calibration mode is 183 * valid 184 * @IWL_TOF_RESPONDER_CMD_VALID_BSSID: BSSID is valid 185 * @IWL_TOF_RESPONDER_CMD_VALID_TX_ANT: TX antenna is valid 186 * @IWL_TOF_RESPONDER_CMD_VALID_ALGO_TYPE: algorithm type is valid 187 * @IWL_TOF_RESPONDER_CMD_VALID_NON_ASAP_SUPPORT: non-ASAP support is valid 188 * @IWL_TOF_RESPONDER_CMD_VALID_STATISTICS_REPORT_SUPPORT: statistics report 189 * support is valid 190 * @IWL_TOF_RESPONDER_CMD_VALID_MCSI_NOTIF_SUPPORT: MCSI notification support 191 * is valid 192 * @IWL_TOF_RESPONDER_CMD_VALID_FAST_ALGO_SUPPORT: fast algorithm support 193 * is valid 194 * @IWL_TOF_RESPONDER_CMD_VALID_RETRY_ON_ALGO_FAIL: retry on algorithm failure 195 * is valid 196 * @IWL_TOF_RESPONDER_CMD_VALID_STA_ID: station ID is valid 197 */ 198 enum iwl_tof_responder_cmd_valid_field { 199 IWL_TOF_RESPONDER_CMD_VALID_CHAN_INFO = BIT(0), 200 IWL_TOF_RESPONDER_CMD_VALID_TOA_OFFSET = BIT(1), 201 IWL_TOF_RESPONDER_CMD_VALID_COMMON_CALIB = BIT(2), 202 IWL_TOF_RESPONDER_CMD_VALID_SPECIFIC_CALIB = BIT(3), 203 IWL_TOF_RESPONDER_CMD_VALID_BSSID = BIT(4), 204 IWL_TOF_RESPONDER_CMD_VALID_TX_ANT = BIT(5), 205 IWL_TOF_RESPONDER_CMD_VALID_ALGO_TYPE = BIT(6), 206 IWL_TOF_RESPONDER_CMD_VALID_NON_ASAP_SUPPORT = BIT(7), 207 IWL_TOF_RESPONDER_CMD_VALID_STATISTICS_REPORT_SUPPORT = BIT(8), 208 IWL_TOF_RESPONDER_CMD_VALID_MCSI_NOTIF_SUPPORT = BIT(9), 209 IWL_TOF_RESPONDER_CMD_VALID_FAST_ALGO_SUPPORT = BIT(10), 210 IWL_TOF_RESPONDER_CMD_VALID_RETRY_ON_ALGO_FAIL = BIT(11), 211 IWL_TOF_RESPONDER_CMD_VALID_STA_ID = BIT(12), 212 }; 213 214 /** 215 * enum iwl_tof_responder_cfg_flags - responder configuration flags 216 * @IWL_TOF_RESPONDER_FLAGS_NON_ASAP_SUPPORT: non-ASAP support 217 * @IWL_TOF_RESPONDER_FLAGS_REPORT_STATISTICS: report statistics 218 * @IWL_TOF_RESPONDER_FLAGS_REPORT_MCSI: report MCSI 219 * @IWL_TOF_RESPONDER_FLAGS_ALGO_TYPE: algorithm type 220 * @IWL_TOF_RESPONDER_FLAGS_TOA_OFFSET_MODE: ToA offset mode 221 * @IWL_TOF_RESPONDER_FLAGS_COMMON_CALIB_MODE: common calibration mode 222 * @IWL_TOF_RESPONDER_FLAGS_SPECIFIC_CALIB_MODE: specific calibration mode 223 * @IWL_TOF_RESPONDER_FLAGS_FAST_ALGO_SUPPORT: fast algorithm support 224 * @IWL_TOF_RESPONDER_FLAGS_RETRY_ON_ALGO_FAIL: retry on algorithm fail 225 * @IWL_TOF_RESPONDER_FLAGS_FTM_TX_ANT: TX antenna mask 226 */ 227 enum iwl_tof_responder_cfg_flags { 228 IWL_TOF_RESPONDER_FLAGS_NON_ASAP_SUPPORT = BIT(0), 229 IWL_TOF_RESPONDER_FLAGS_REPORT_STATISTICS = BIT(1), 230 IWL_TOF_RESPONDER_FLAGS_REPORT_MCSI = BIT(2), 231 IWL_TOF_RESPONDER_FLAGS_ALGO_TYPE = BIT(3) | BIT(4) | BIT(5), 232 IWL_TOF_RESPONDER_FLAGS_TOA_OFFSET_MODE = BIT(6), 233 IWL_TOF_RESPONDER_FLAGS_COMMON_CALIB_MODE = BIT(7), 234 IWL_TOF_RESPONDER_FLAGS_SPECIFIC_CALIB_MODE = BIT(8), 235 IWL_TOF_RESPONDER_FLAGS_FAST_ALGO_SUPPORT = BIT(9), 236 IWL_TOF_RESPONDER_FLAGS_RETRY_ON_ALGO_FAIL = BIT(10), 237 IWL_TOF_RESPONDER_FLAGS_FTM_TX_ANT = RATE_MCS_ANT_ABC_MSK, 238 }; 239 240 /** 241 * struct iwl_tof_responder_config_cmd - ToF AP mode (for debug) 242 * @cmd_valid_fields: &iwl_tof_responder_cmd_valid_field 243 * @responder_cfg_flags: &iwl_tof_responder_cfg_flags 244 * @bandwidth: current AP Bandwidth: &enum iwl_tof_bandwidth 245 * @rate: current AP rate 246 * @channel_num: current AP Channel 247 * @ctrl_ch_position: coding of the control channel position relative to 248 * the center frequency, see iwl_mvm_get_ctrl_pos() 249 * @sta_id: index of the AP STA when in AP mode 250 * @reserved1: reserved 251 * @toa_offset: Artificial addition [pSec] for the ToA - to be used for debug 252 * purposes, simulating station movement by adding various values 253 * to this field 254 * @common_calib: XVT: common calibration value 255 * @specific_calib: XVT: specific calibration value 256 * @bssid: Current AP BSSID 257 * @reserved2: reserved 258 */ 259 struct iwl_tof_responder_config_cmd { 260 __le32 cmd_valid_fields; 261 __le32 responder_cfg_flags; 262 u8 bandwidth; 263 u8 rate; 264 u8 channel_num; 265 u8 ctrl_ch_position; 266 u8 sta_id; 267 u8 reserved1; 268 __le16 toa_offset; 269 __le16 common_calib; 270 __le16 specific_calib; 271 u8 bssid[ETH_ALEN]; 272 __le16 reserved2; 273 } __packed; /* TOF_RESPONDER_CONFIG_CMD_API_S_VER_6 */ 274 275 #define IWL_LCI_CIVIC_IE_MAX_SIZE 400 276 277 /** 278 * struct iwl_tof_responder_dyn_config_cmd - Dynamic responder settings 279 * @lci_len: The length of the 1st (LCI) part in the @lci_civic buffer 280 * @civic_len: The length of the 2nd (CIVIC) part in the @lci_civic buffer 281 * @lci_civic: The LCI/CIVIC buffer. LCI data (if exists) comes first, then, if 282 * needed, 0-padding such that the next part is dword-aligned, then CIVIC 283 * data (if exists) follows, and then 0-padding again to complete a 284 * 4-multiple long buffer. 285 */ 286 struct iwl_tof_responder_dyn_config_cmd { 287 __le32 lci_len; 288 __le32 civic_len; 289 u8 lci_civic[]; 290 } __packed; /* TOF_RESPONDER_DYN_CONFIG_CMD_API_S_VER_2 */ 291 292 /** 293 * struct iwl_tof_range_request_ext_cmd - extended range req for WLS 294 * @tsf_timer_offset_msec: the recommended time offset (mSec) from the AP's TSF 295 * @reserved: reserved 296 * @min_delta_ftm: Minimal time between two consecutive measurements, 297 * in units of 100us. 0 means no preference by station 298 * @ftm_format_and_bw20M: FTM Channel Spacing/Format for 20MHz: recommended 299 * value be sent to the AP 300 * @ftm_format_and_bw40M: FTM Channel Spacing/Format for 40MHz: recommended 301 * value to be sent to the AP 302 * @ftm_format_and_bw80M: FTM Channel Spacing/Format for 80MHz: recommended 303 * value to be sent to the AP 304 */ 305 struct iwl_tof_range_req_ext_cmd { 306 __le16 tsf_timer_offset_msec; 307 __le16 reserved; 308 u8 min_delta_ftm; 309 u8 ftm_format_and_bw20M; 310 u8 ftm_format_and_bw40M; 311 u8 ftm_format_and_bw80M; 312 } __packed; 313 314 /** 315 * enum iwl_tof_location_query - values for query bitmap 316 * @IWL_TOF_LOC_LCI: query LCI 317 * @IWL_TOF_LOC_CIVIC: query civic 318 */ 319 enum iwl_tof_location_query { 320 IWL_TOF_LOC_LCI = 0x01, 321 IWL_TOF_LOC_CIVIC = 0x02, 322 }; 323 324 /** 325 * struct iwl_tof_range_req_ap_entry - AP configuration parameters 326 * @channel_num: Current AP Channel 327 * @bandwidth: Current AP Bandwidth. One of iwl_tof_bandwidth. 328 * @tsf_delta_direction: TSF relatively to the subject AP 329 * @ctrl_ch_position: Coding of the control channel position relative to the 330 * center frequency, see iwl_mvm_get_ctrl_pos(). 331 * @bssid: AP's BSSID 332 * @measure_type: Measurement type: 0 - two sided, 1 - One sided 333 * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of the 334 * number of measurement iterations (min 2^0 = 1, max 2^14) 335 * @burst_period: Recommended value to be sent to the AP. Measurement 336 * periodicity In units of 100ms. ignored if num_of_bursts = 0 337 * @samples_per_burst: 2-sided: the number of FTMs pairs in single Burst (1-31); 338 * 1-sided: how many rts/cts pairs should be used per burst. 339 * @retries_per_sample: Max number of retries that the LMAC should send 340 * in case of no replies by the AP. 341 * @tsf_delta: TSF Delta in units of microseconds. 342 * The difference between the AP TSF and the device local clock. 343 * @location_req: Location Request Bit[0] LCI should be sent in the FTMR; 344 * Bit[1] Civic should be sent in the FTMR 345 * @asap_mode: 0 - non asap mode, 1 - asap mode (not relevant for one sided) 346 * @enable_dyn_ack: Enable Dynamic ACK BW. 347 * 0: Initiator interact with regular AP; 348 * 1: Initiator interact with Responder machine: need to send the 349 * Initiator Acks with HT 40MHz / 80MHz, since the Responder should 350 * use it for its ch est measurement (this flag will be set when we 351 * configure the opposite machine to be Responder). 352 * @rssi: Last received value 353 * legal values: -128-0 (0x7f). above 0x0 indicating an invalid value. 354 * @algo_type: &enum iwl_tof_algo_type 355 * @notify_mcsi: &enum iwl_tof_mcsi_ntfy. 356 * @reserved: For alignment and future use 357 */ 358 struct iwl_tof_range_req_ap_entry { 359 u8 channel_num; 360 u8 bandwidth; 361 u8 tsf_delta_direction; 362 u8 ctrl_ch_position; 363 u8 bssid[ETH_ALEN]; 364 u8 measure_type; 365 u8 num_of_bursts; 366 __le16 burst_period; 367 u8 samples_per_burst; 368 u8 retries_per_sample; 369 __le32 tsf_delta; 370 u8 location_req; 371 u8 asap_mode; 372 u8 enable_dyn_ack; 373 s8 rssi; 374 u8 algo_type; 375 u8 notify_mcsi; 376 __le16 reserved; 377 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_3 */ 378 379 /** 380 * enum iwl_tof_response_mode 381 * @IWL_MVM_TOF_RESPONSE_ASAP: report each AP measurement separately as soon as 382 * possible (not supported for this release) 383 * @IWL_MVM_TOF_RESPONSE_TIMEOUT: report all AP measurements as a batch upon 384 * timeout expiration 385 * @IWL_MVM_TOF_RESPONSE_COMPLETE: report all AP measurements as a batch at the 386 * earlier of: measurements completion / timeout 387 * expiration. 388 */ 389 enum iwl_tof_response_mode { 390 IWL_MVM_TOF_RESPONSE_ASAP, 391 IWL_MVM_TOF_RESPONSE_TIMEOUT, 392 IWL_MVM_TOF_RESPONSE_COMPLETE, 393 }; 394 395 /** 396 * enum iwl_tof_initiator_flags 397 * 398 * @IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED: disable fast algo, meaning run 399 * the algo on ant A+B, instead of only one of them. 400 * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A: open RX antenna A for FTMs RX 401 * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B: open RX antenna B for FTMs RX 402 * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C: open RX antenna C for FTMs RX 403 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A: use antenna A fo TX ACKs during FTM 404 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B: use antenna B fo TX ACKs during FTM 405 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C: use antenna C fo TX ACKs during FTM 406 * @IWL_TOF_INITIATOR_FLAGS_MINDELTA_NO_PREF: no preference for minDeltaFTM 407 */ 408 enum iwl_tof_initiator_flags { 409 IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED = BIT(0), 410 IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A = BIT(1), 411 IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B = BIT(2), 412 IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C = BIT(3), 413 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A = BIT(4), 414 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B = BIT(5), 415 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C = BIT(6), 416 IWL_TOF_INITIATOR_FLAGS_MINDELTA_NO_PREF = BIT(7), 417 }; /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */ 418 419 #define IWL_MVM_TOF_MAX_APS 5 420 #define IWL_MVM_TOF_MAX_TWO_SIDED_APS 5 421 422 /** 423 * struct iwl_tof_range_req_cmd - start measurement cmd 424 * @initiator_flags: see flags @ iwl_tof_initiator_flags 425 * @request_id: A Token incremented per request. The same Token will be 426 * sent back in the range response 427 * @initiator: 0- NW initiated, 1 - Client Initiated 428 * @one_sided_los_disable: '0'- run ML-Algo for both ToF/OneSided, 429 * '1' - run ML-Algo for ToF only 430 * @req_timeout: Requested timeout of the response in units of 100ms. 431 * This is equivalent to the session time configured to the 432 * LMAC in Initiator Request 433 * @report_policy: Supported partially for this release: For current release - 434 * the range report will be uploaded as a batch when ready or 435 * when the session is done (successfully / partially). 436 * one of iwl_tof_response_mode. 437 * @reserved0: reserved 438 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 439 * @macaddr_random: '0' Use default source MAC address (i.e. p2_p), 440 * '1' Use MAC Address randomization according to the below 441 * @range_req_bssid: ranging request BSSID 442 * @macaddr_template: MAC address template to use for non-randomized bits 443 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template. 444 * Bits set to 1 shall be randomized by the UMAC 445 * @ftm_rx_chains: Rx chain to open to receive Responder's FTMs (XVT) 446 * @ftm_tx_chains: Tx chain to send the ack to the Responder FTM (XVT) 447 * @common_calib: The common calib value to inject to this measurement calc 448 * @specific_calib: The specific calib value to inject to this measurement calc 449 * @ap: per-AP request data 450 */ 451 struct iwl_tof_range_req_cmd { 452 __le32 initiator_flags; 453 u8 request_id; 454 u8 initiator; 455 u8 one_sided_los_disable; 456 u8 req_timeout; 457 u8 report_policy; 458 u8 reserved0; 459 u8 num_of_ap; 460 u8 macaddr_random; 461 u8 range_req_bssid[ETH_ALEN]; 462 u8 macaddr_template[ETH_ALEN]; 463 u8 macaddr_mask[ETH_ALEN]; 464 u8 ftm_rx_chains; 465 u8 ftm_tx_chains; 466 __le16 common_calib; 467 __le16 specific_calib; 468 struct iwl_tof_range_req_ap_entry ap[IWL_MVM_TOF_MAX_APS]; 469 } __packed; 470 /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */ 471 472 /* 473 * enum iwl_tof_range_request_status - status of the sent request 474 * @IWL_TOF_RANGE_REQUEST_STATUS_SUCCESSFUL - FW successfully received the 475 * request 476 * @IWL_TOF_RANGE_REQUEST_STATUS_BUSY - FW is busy with a previous request, the 477 * sent request will not be handled 478 */ 479 enum iwl_tof_range_request_status { 480 IWL_TOF_RANGE_REQUEST_STATUS_SUCCESS, 481 IWL_TOF_RANGE_REQUEST_STATUS_BUSY, 482 }; 483 484 /** 485 * enum iwl_tof_entry_status 486 * 487 * @IWL_TOF_ENTRY_SUCCESS: successful measurement. 488 * @IWL_TOF_ENTRY_GENERAL_FAILURE: General failure. 489 * @IWL_TOF_ENTRY_NO_RESPONSE: Responder didn't reply to the request. 490 * @IWL_TOF_ENTRY_REQUEST_REJECTED: Responder rejected the request. 491 * @IWL_TOF_ENTRY_NOT_SCHEDULED: Time event was scheduled but not called yet. 492 * @IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT: Time event triggered but no 493 * measurement was completed. 494 * @IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE: No range due inability to switch 495 * from the primary channel. 496 * @IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED: Device doesn't support FTM. 497 * @IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON: Request aborted due to unknown 498 * reason. 499 * @IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP: Failure due to invalid 500 * T1/T4. 501 * @IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE: Failure due to invalid FTM frame 502 * structure. 503 * @IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED: Request cannot be scheduled. 504 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE: Responder cannot serve the 505 * initiator for some period, period supplied in @refusal_period. 506 * @IWL_TOF_ENTRY_BAD_REQUEST_ARGS: Bad request arguments. 507 * @IWL_TOF_ENTRY_WIFI_NOT_ENABLED: Wifi not enabled. 508 * @IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS: Responder override the original 509 * parameters within the current session. 510 */ 511 enum iwl_tof_entry_status { 512 IWL_TOF_ENTRY_SUCCESS = 0, 513 IWL_TOF_ENTRY_GENERAL_FAILURE = 1, 514 IWL_TOF_ENTRY_NO_RESPONSE = 2, 515 IWL_TOF_ENTRY_REQUEST_REJECTED = 3, 516 IWL_TOF_ENTRY_NOT_SCHEDULED = 4, 517 IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT = 5, 518 IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE = 6, 519 IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED = 7, 520 IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON = 8, 521 IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP = 9, 522 IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE = 10, 523 IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED = 11, 524 IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE = 12, 525 IWL_TOF_ENTRY_BAD_REQUEST_ARGS = 13, 526 IWL_TOF_ENTRY_WIFI_NOT_ENABLED = 14, 527 IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS = 15, 528 }; /* LOCATION_RANGE_RSP_AP_ENTRY_NTFY_API_S_VER_2 */ 529 530 /** 531 * struct iwl_tof_range_rsp_ap_entry_ntfy - AP parameters (response) 532 * @bssid: BSSID of the AP 533 * @measure_status: current APs measurement status, one of 534 * &enum iwl_tof_entry_status. 535 * @measure_bw: Current AP Bandwidth: 0 20MHz, 1 40MHz, 2 80MHz 536 * @rtt: The Round Trip Time that took for the last measurement for 537 * current AP [pSec] 538 * @rtt_variance: The Variance of the RTT values measured for current AP 539 * @rtt_spread: The Difference between the maximum and the minimum RTT 540 * values measured for current AP in the current session [pSec] 541 * @rssi: RSSI as uploaded in the Channel Estimation notification 542 * @rssi_spread: The Difference between the maximum and the minimum RSSI values 543 * measured for current AP in the current session 544 * @reserved: reserved 545 * @refusal_period: refusal period in case of 546 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec] 547 * @range: Measured range [cm] 548 * @range_variance: Measured range variance [cm] 549 * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was 550 * uploaded by the LMAC 551 * @t2t3_initiator: as calculated from the algo in the initiator 552 * @t1t4_responder: as calculated from the algo in the responder 553 * @common_calib: Calib val that was used in for this AP measurement 554 * @specific_calib: val that was used in for this AP measurement 555 * @papd_calib_output: The result of the tof papd calibration that was injected 556 * into the algorithm. 557 */ 558 struct iwl_tof_range_rsp_ap_entry_ntfy { 559 u8 bssid[ETH_ALEN]; 560 u8 measure_status; 561 u8 measure_bw; 562 __le32 rtt; 563 __le32 rtt_variance; 564 __le32 rtt_spread; 565 s8 rssi; 566 u8 rssi_spread; 567 u8 reserved; 568 u8 refusal_period; 569 __le32 range; 570 __le32 range_variance; 571 __le32 timestamp; 572 __le32 t2t3_initiator; 573 __le32 t1t4_responder; 574 __le16 common_calib; 575 __le16 specific_calib; 576 __le32 papd_calib_output; 577 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_3 */ 578 579 /** 580 * enum iwl_tof_response_status - tof response status 581 * 582 * @IWL_TOF_RESPONSE_SUCCESS: successful range. 583 * @IWL_TOF_RESPONSE_TIMEOUT: request aborted due to timeout expiration. 584 * partial result of ranges done so far is included in the response. 585 * @IWL_TOF_RESPONSE_ABORTED: Measurement aborted by command. 586 * @IWL_TOF_RESPONSE_FAILED: Measurement request command failed. 587 */ 588 enum iwl_tof_response_status { 589 IWL_TOF_RESPONSE_SUCCESS = 0, 590 IWL_TOF_RESPONSE_TIMEOUT = 1, 591 IWL_TOF_RESPONSE_ABORTED = 4, 592 IWL_TOF_RESPONSE_FAILED = 5, 593 }; /* LOCATION_RNG_RSP_STATUS */ 594 595 /** 596 * struct iwl_tof_range_rsp_ntfy - ranging response notification 597 * @request_id: A Token ID of the corresponding Range request 598 * @request_status: status of current measurement session, one of 599 * &enum iwl_tof_response_status. 600 * @last_in_batch: reprot policy (when not all responses are uploaded at once) 601 * @num_of_aps: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 602 * @ap: per-AP data 603 */ 604 struct iwl_tof_range_rsp_ntfy { 605 u8 request_id; 606 u8 request_status; 607 u8 last_in_batch; 608 u8 num_of_aps; 609 struct iwl_tof_range_rsp_ap_entry_ntfy ap[IWL_MVM_TOF_MAX_APS]; 610 } __packed; 611 612 #define IWL_MVM_TOF_MCSI_BUF_SIZE (245) 613 /** 614 * struct iwl_tof_mcsi_notif - used for debug 615 * @token: token ID for the current session 616 * @role: '0' - initiator, '1' - responder 617 * @reserved: reserved 618 * @initiator_bssid: initiator machine 619 * @responder_bssid: responder machine 620 * @mcsi_buffer: debug data 621 */ 622 struct iwl_tof_mcsi_notif { 623 u8 token; 624 u8 role; 625 __le16 reserved; 626 u8 initiator_bssid[ETH_ALEN]; 627 u8 responder_bssid[ETH_ALEN]; 628 u8 mcsi_buffer[IWL_MVM_TOF_MCSI_BUF_SIZE * 4]; 629 } __packed; 630 631 /** 632 * struct iwl_tof_range_abort_cmd 633 * @request_id: corresponds to a range request 634 * @reserved: reserved 635 */ 636 struct iwl_tof_range_abort_cmd { 637 u8 request_id; 638 u8 reserved[3]; 639 } __packed; 640 641 enum ftm_responder_stats_flags { 642 FTM_RESP_STAT_NON_ASAP_STARTED = BIT(0), 643 FTM_RESP_STAT_NON_ASAP_IN_WIN = BIT(1), 644 FTM_RESP_STAT_NON_ASAP_OUT_WIN = BIT(2), 645 FTM_RESP_STAT_TRIGGER_DUP = BIT(3), 646 FTM_RESP_STAT_DUP = BIT(4), 647 FTM_RESP_STAT_DUP_IN_WIN = BIT(5), 648 FTM_RESP_STAT_DUP_OUT_WIN = BIT(6), 649 FTM_RESP_STAT_SCHED_SUCCESS = BIT(7), 650 FTM_RESP_STAT_ASAP_REQ = BIT(8), 651 FTM_RESP_STAT_NON_ASAP_REQ = BIT(9), 652 FTM_RESP_STAT_ASAP_RESP = BIT(10), 653 FTM_RESP_STAT_NON_ASAP_RESP = BIT(11), 654 FTM_RESP_STAT_FAIL_INITIATOR_INACTIVE = BIT(12), 655 FTM_RESP_STAT_FAIL_INITIATOR_OUT_WIN = BIT(13), 656 FTM_RESP_STAT_FAIL_INITIATOR_RETRY_LIM = BIT(14), 657 FTM_RESP_STAT_FAIL_NEXT_SERVED = BIT(15), 658 FTM_RESP_STAT_FAIL_TRIGGER_ERR = BIT(16), 659 FTM_RESP_STAT_FAIL_GC = BIT(17), 660 FTM_RESP_STAT_SUCCESS = BIT(18), 661 FTM_RESP_STAT_INTEL_IE = BIT(19), 662 FTM_RESP_STAT_INITIATOR_ACTIVE = BIT(20), 663 FTM_RESP_STAT_MEASUREMENTS_AVAILABLE = BIT(21), 664 FTM_RESP_STAT_TRIGGER_UNKNOWN = BIT(22), 665 FTM_RESP_STAT_PROCESS_FAIL = BIT(23), 666 FTM_RESP_STAT_ACK = BIT(24), 667 FTM_RESP_STAT_NACK = BIT(25), 668 FTM_RESP_STAT_INVALID_INITIATOR_ID = BIT(26), 669 FTM_RESP_STAT_TIMER_MIN_DELTA = BIT(27), 670 FTM_RESP_STAT_INITIATOR_REMOVED = BIT(28), 671 FTM_RESP_STAT_INITIATOR_ADDED = BIT(29), 672 FTM_RESP_STAT_ERR_LIST_FULL = BIT(30), 673 FTM_RESP_STAT_INITIATOR_SCHED_NOW = BIT(31), 674 }; /* RESP_IND_E */ 675 676 /** 677 * struct iwl_ftm_responder_stats - FTM responder statistics 678 * @addr: initiator address 679 * @success_ftm: number of successful ftm frames 680 * @ftm_per_burst: num of FTM frames that were received 681 * @flags: &enum ftm_responder_stats_flags 682 * @duration: actual duration of FTM 683 * @allocated_duration: time that was allocated for this FTM session 684 * @bw: FTM request bandwidth 685 * @rate: FTM request rate 686 * @reserved: for alingment and future use 687 */ 688 struct iwl_ftm_responder_stats { 689 u8 addr[ETH_ALEN]; 690 u8 success_ftm; 691 u8 ftm_per_burst; 692 __le32 flags; 693 __le32 duration; 694 __le32 allocated_duration; 695 u8 bw; 696 u8 rate; 697 __le16 reserved; 698 } __packed; /* TOF_RESPONDER_STATISTICS_NTFY_S_VER_2 */ 699 700 #define IWL_CSI_CHUNK_CTL_NUM_MASK 0x3 701 #define IWL_CSI_CHUNK_CTL_IDX_MASK 0xc 702 703 struct iwl_csi_chunk_notification { 704 __le32 token; 705 __le16 seq; 706 __le16 ctl; 707 __le32 size; 708 u8 data[]; 709 } __packed; /* CSI_CHUNKS_HDR_NTFY_API_S_VER_1 */ 710 711 #endif /* __iwl_fw_api_location_h__ */ 712