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