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_ABC_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 }; 633 634 #define TK_11AZ_LEN 32 635 636 #define LOCATION_BW_POS 4 637 638 /** 639 * struct iwl_tof_range_req_ap_entry_v4 - AP configuration parameters 640 * @initiator_ap_flags: see &enum iwl_initiator_ap_flags. 641 * @channel_num: AP Channel number 642 * @format_bw: bits 0 - 3: &enum iwl_location_frame_format. 643 * bits 4 - 7: &enum iwl_location_bw. 644 * @ctrl_ch_position: Coding of the control channel position relative to the 645 * center frequency, see iwl_mvm_get_ctrl_pos(). 646 * @ftmr_max_retries: Max number of retries to send the FTMR in case of no 647 * reply from the AP. 648 * @bssid: AP's BSSID 649 * @burst_period: Recommended value to be sent to the AP. Measurement 650 * periodicity In units of 100ms. ignored if num_of_bursts_exp = 0 651 * @samples_per_burst: the number of FTMs pairs in single Burst (1-31); 652 * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of 653 * the number of measurement iterations (min 2^0 = 1, max 2^14) 654 * @reserved: For alignment and future use 655 * @hltk: HLTK to be used for secured 11az measurement 656 * @tk: TK to be used for secured 11az measurement 657 */ 658 struct iwl_tof_range_req_ap_entry_v4 { 659 __le32 initiator_ap_flags; 660 u8 channel_num; 661 u8 format_bw; 662 u8 ctrl_ch_position; 663 u8 ftmr_max_retries; 664 u8 bssid[ETH_ALEN]; 665 __le16 burst_period; 666 u8 samples_per_burst; 667 u8 num_of_bursts; 668 __le16 reserved; 669 u8 hltk[HLTK_11AZ_LEN]; 670 u8 tk[TK_11AZ_LEN]; 671 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_4 */ 672 673 /** 674 * enum iwl_location_cipher - location cipher selection 675 * @IWL_LOCATION_CIPHER_CCMP_128: CCMP 128 676 * @IWL_LOCATION_CIPHER_GCMP_128: GCMP 128 677 * @IWL_LOCATION_CIPHER_GCMP_256: GCMP 256 678 * @IWL_LOCATION_CIPHER_INVALID: security is not used. 679 * @IWL_LOCATION_CIPHER_MAX: maximum value for this enum. 680 */ 681 enum iwl_location_cipher { 682 IWL_LOCATION_CIPHER_CCMP_128, 683 IWL_LOCATION_CIPHER_GCMP_128, 684 IWL_LOCATION_CIPHER_GCMP_256, 685 IWL_LOCATION_CIPHER_INVALID, 686 IWL_LOCATION_CIPHER_MAX, 687 }; 688 689 /** 690 * struct iwl_tof_range_req_ap_entry_v6 - AP configuration parameters 691 * @initiator_ap_flags: see &enum iwl_initiator_ap_flags. 692 * @channel_num: AP Channel number 693 * @format_bw: bits 0 - 3: &enum iwl_location_frame_format. 694 * bits 4 - 7: &enum iwl_location_bw. 695 * @ctrl_ch_position: Coding of the control channel position relative to the 696 * center frequency, see iwl_mvm_get_ctrl_pos(). 697 * @ftmr_max_retries: Max number of retries to send the FTMR in case of no 698 * reply from the AP. 699 * @bssid: AP's BSSID 700 * @burst_period: Recommended value to be sent to the AP. Measurement 701 * periodicity In units of 100ms. ignored if num_of_bursts_exp = 0 702 * @samples_per_burst: the number of FTMs pairs in single Burst (1-31); 703 * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of 704 * the number of measurement iterations (min 2^0 = 1, max 2^14) 705 * @sta_id: the station id of the AP. Only relevant when associated to the AP, 706 * otherwise should be set to &IWL_MVM_INVALID_STA. 707 * @cipher: pairwise cipher suite for secured measurement. 708 * &enum iwl_location_cipher. 709 * @hltk: HLTK to be used for secured 11az measurement 710 * @tk: TK to be used for secured 11az measurement 711 * @calib: An array of calibration values per FTM rx bandwidth. 712 * If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the 713 * calibration value that corresponds to the rx bandwidth of the FTM 714 * frame. 715 * @beacon_interval: beacon interval of the AP in TUs. Only required if 716 * &IWL_INITIATOR_AP_FLAGS_TB is set. 717 */ 718 struct iwl_tof_range_req_ap_entry_v6 { 719 __le32 initiator_ap_flags; 720 u8 channel_num; 721 u8 format_bw; 722 u8 ctrl_ch_position; 723 u8 ftmr_max_retries; 724 u8 bssid[ETH_ALEN]; 725 __le16 burst_period; 726 u8 samples_per_burst; 727 u8 num_of_bursts; 728 u8 sta_id; 729 u8 cipher; 730 u8 hltk[HLTK_11AZ_LEN]; 731 u8 tk[TK_11AZ_LEN]; 732 __le16 calib[IWL_TOF_BW_NUM]; 733 __le16 beacon_interval; 734 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_6 */ 735 736 /** 737 * struct iwl_tof_range_req_ap_entry_v7 - AP configuration parameters 738 * @initiator_ap_flags: see &enum iwl_initiator_ap_flags. 739 * @channel_num: AP Channel number 740 * @format_bw: bits 0 - 3: &enum iwl_location_frame_format. 741 * bits 4 - 7: &enum iwl_location_bw. 742 * @ctrl_ch_position: Coding of the control channel position relative to the 743 * center frequency, see iwl_mvm_get_ctrl_pos(). 744 * @ftmr_max_retries: Max number of retries to send the FTMR in case of no 745 * reply from the AP. 746 * @bssid: AP's BSSID 747 * @burst_period: Recommended value to be sent to the AP. Measurement 748 * periodicity In units of 100ms. ignored if num_of_bursts_exp = 0 749 * @samples_per_burst: the number of FTMs pairs in single Burst (1-31); 750 * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of 751 * the number of measurement iterations (min 2^0 = 1, max 2^14) 752 * @sta_id: the station id of the AP. Only relevant when associated to the AP, 753 * otherwise should be set to &IWL_MVM_INVALID_STA. 754 * @cipher: pairwise cipher suite for secured measurement. 755 * &enum iwl_location_cipher. 756 * @hltk: HLTK to be used for secured 11az measurement 757 * @tk: TK to be used for secured 11az measurement 758 * @calib: An array of calibration values per FTM rx bandwidth. 759 * If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the 760 * calibration value that corresponds to the rx bandwidth of the FTM 761 * frame. 762 * @beacon_interval: beacon interval of the AP in TUs. Only required if 763 * &IWL_INITIATOR_AP_FLAGS_TB is set. 764 * @rx_pn: the next expected PN for protected management frames Rx. LE byte 765 * order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id 766 * is set to &IWL_MVM_INVALID_STA. 767 * @tx_pn: the next PN to use for protected management frames Tx. LE byte 768 * order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id 769 * is set to &IWL_MVM_INVALID_STA. 770 */ 771 struct iwl_tof_range_req_ap_entry_v7 { 772 __le32 initiator_ap_flags; 773 u8 channel_num; 774 u8 format_bw; 775 u8 ctrl_ch_position; 776 u8 ftmr_max_retries; 777 u8 bssid[ETH_ALEN]; 778 __le16 burst_period; 779 u8 samples_per_burst; 780 u8 num_of_bursts; 781 u8 sta_id; 782 u8 cipher; 783 u8 hltk[HLTK_11AZ_LEN]; 784 u8 tk[TK_11AZ_LEN]; 785 __le16 calib[IWL_TOF_BW_NUM]; 786 __le16 beacon_interval; 787 u8 rx_pn[IEEE80211_CCMP_PN_LEN]; 788 u8 tx_pn[IEEE80211_CCMP_PN_LEN]; 789 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_7 */ 790 791 #define IWL_LOCATION_MAX_STS_POS 3 792 793 /** 794 * struct iwl_tof_range_req_ap_entry_v8 - AP configuration parameters 795 * @initiator_ap_flags: see &enum iwl_initiator_ap_flags. 796 * @channel_num: AP Channel number 797 * @format_bw: bits 0 - 3: &enum iwl_location_frame_format. 798 * bits 4 - 7: &enum iwl_location_bw. 799 * @ctrl_ch_position: Coding of the control channel position relative to the 800 * center frequency, see iwl_mvm_get_ctrl_pos(). 801 * @ftmr_max_retries: Max number of retries to send the FTMR in case of no 802 * reply from the AP. 803 * @bssid: AP's BSSID 804 * @burst_period: Recommended value to be sent to the AP. Measurement 805 * periodicity In units of 100ms. ignored if num_of_bursts_exp = 0 806 * @samples_per_burst: the number of FTMs pairs in single Burst (1-31); 807 * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of 808 * the number of measurement iterations (min 2^0 = 1, max 2^14) 809 * @sta_id: the station id of the AP. Only relevant when associated to the AP, 810 * otherwise should be set to &IWL_MVM_INVALID_STA. 811 * @cipher: pairwise cipher suite for secured measurement. 812 * &enum iwl_location_cipher. 813 * @hltk: HLTK to be used for secured 11az measurement 814 * @tk: TK to be used for secured 11az measurement 815 * @calib: An array of calibration values per FTM rx bandwidth. 816 * If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the 817 * calibration value that corresponds to the rx bandwidth of the FTM 818 * frame. 819 * @beacon_interval: beacon interval of the AP in TUs. Only required if 820 * &IWL_INITIATOR_AP_FLAGS_TB is set. 821 * @rx_pn: the next expected PN for protected management frames Rx. LE byte 822 * order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id 823 * is set to &IWL_MVM_INVALID_STA. 824 * @tx_pn: the next PN to use for protected management frames Tx. LE byte 825 * order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id 826 * is set to &IWL_MVM_INVALID_STA. 827 * @r2i_ndp_params: parameters for R2I NDP ranging negotiation. 828 * bits 0 - 2: max LTF repetitions 829 * bits 3 - 5: max number of spatial streams 830 * bits 6 - 7: reserved 831 * @i2r_ndp_params: parameters for I2R NDP ranging negotiation. 832 * bits 0 - 2: max LTF repetitions 833 * bits 3 - 5: max number of spatial streams (supported values are < 2) 834 * bits 6 - 7: reserved 835 * @r2i_max_total_ltf: R2I Max Total LTFs for NDP ranging negotiation. 836 * One of &enum ieee80211_range_params_max_total_ltf. 837 * @i2r_max_total_ltf: I2R Max Total LTFs for NDP ranging negotiation. 838 * One of &enum ieee80211_range_params_max_total_ltf. 839 */ 840 struct iwl_tof_range_req_ap_entry_v8 { 841 __le32 initiator_ap_flags; 842 u8 channel_num; 843 u8 format_bw; 844 u8 ctrl_ch_position; 845 u8 ftmr_max_retries; 846 u8 bssid[ETH_ALEN]; 847 __le16 burst_period; 848 u8 samples_per_burst; 849 u8 num_of_bursts; 850 u8 sta_id; 851 u8 cipher; 852 u8 hltk[HLTK_11AZ_LEN]; 853 u8 tk[TK_11AZ_LEN]; 854 __le16 calib[IWL_TOF_BW_NUM]; 855 __le16 beacon_interval; 856 u8 rx_pn[IEEE80211_CCMP_PN_LEN]; 857 u8 tx_pn[IEEE80211_CCMP_PN_LEN]; 858 u8 r2i_ndp_params; 859 u8 i2r_ndp_params; 860 u8 r2i_max_total_ltf; 861 u8 i2r_max_total_ltf; 862 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_8 */ 863 864 /** 865 * struct iwl_tof_range_req_ap_entry_v9 - AP configuration parameters 866 * @initiator_ap_flags: see &enum iwl_initiator_ap_flags. 867 * @channel_num: AP Channel number 868 * @format_bw: bits 0 - 3: &enum iwl_location_frame_format. 869 * bits 4 - 7: &enum iwl_location_bw. 870 * @ctrl_ch_position: Coding of the control channel position relative to the 871 * center frequency, see iwl_mvm_get_ctrl_pos(). 872 * @ftmr_max_retries: Max number of retries to send the FTMR in case of no 873 * reply from the AP. 874 * @bssid: AP's BSSID 875 * @burst_period: For EDCA based ranging: Recommended value to be sent to the 876 * AP. Measurement periodicity In units of 100ms. ignored if 877 * num_of_bursts_exp = 0. 878 * For non trigger based NDP ranging, the maximum time between 879 * measurements in units of milliseconds. 880 * @samples_per_burst: the number of FTMs pairs in single Burst (1-31); 881 * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of 882 * the number of measurement iterations (min 2^0 = 1, max 2^14) 883 * @sta_id: the station id of the AP. Only relevant when associated to the AP, 884 * otherwise should be set to &IWL_MVM_INVALID_STA. 885 * @cipher: pairwise cipher suite for secured measurement. 886 * &enum iwl_location_cipher. 887 * @hltk: HLTK to be used for secured 11az measurement 888 * @tk: TK to be used for secured 11az measurement 889 * @calib: An array of calibration values per FTM rx bandwidth. 890 * If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the 891 * calibration value that corresponds to the rx bandwidth of the FTM 892 * frame. 893 * @beacon_interval: beacon interval of the AP in TUs. Only required if 894 * &IWL_INITIATOR_AP_FLAGS_TB is set. 895 * @bss_color: the BSS color of the responder. Only valid if 896 * &IWL_INITIATOR_AP_FLAGS_TB or &IWL_INITIATOR_AP_FLAGS_NON_TB is set. 897 * @rx_pn: the next expected PN for protected management frames Rx. LE byte 898 * order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id 899 * is set to &IWL_MVM_INVALID_STA. 900 * @tx_pn: the next PN to use for protected management frames Tx. LE byte 901 * order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id 902 * is set to &IWL_MVM_INVALID_STA. 903 * @r2i_ndp_params: parameters for R2I NDP ranging negotiation. 904 * bits 0 - 2: max LTF repetitions 905 * bits 3 - 5: max number of spatial streams 906 * bits 6 - 7: reserved 907 * @i2r_ndp_params: parameters for I2R NDP ranging negotiation. 908 * bits 0 - 2: max LTF repetitions 909 * bits 3 - 5: max number of spatial streams (supported values are < 2) 910 * bits 6 - 7: reserved 911 * @r2i_max_total_ltf: R2I Max Total LTFs for NDP ranging negotiation. 912 * One of &enum ieee80211_range_params_max_total_ltf. 913 * @i2r_max_total_ltf: I2R Max Total LTFs for NDP ranging negotiation. 914 * One of &enum ieee80211_range_params_max_total_ltf. 915 * @bss_color: the BSS color of the responder. Only valid if 916 * &IWL_INITIATOR_AP_FLAGS_NON_TB or &IWL_INITIATOR_AP_FLAGS_TB is set. 917 * @band: 0 for 5.2 GHz, 1 for 2.4 GHz, 2 for 6GHz 918 * @min_time_between_msr: For non trigger based NDP ranging, the minimum time 919 * between measurements in units of milliseconds 920 */ 921 struct iwl_tof_range_req_ap_entry_v9 { 922 __le32 initiator_ap_flags; 923 u8 channel_num; 924 u8 format_bw; 925 u8 ctrl_ch_position; 926 u8 ftmr_max_retries; 927 u8 bssid[ETH_ALEN]; 928 __le16 burst_period; 929 u8 samples_per_burst; 930 u8 num_of_bursts; 931 u8 sta_id; 932 u8 cipher; 933 u8 hltk[HLTK_11AZ_LEN]; 934 u8 tk[TK_11AZ_LEN]; 935 __le16 calib[IWL_TOF_BW_NUM]; 936 u16 beacon_interval; 937 u8 rx_pn[IEEE80211_CCMP_PN_LEN]; 938 u8 tx_pn[IEEE80211_CCMP_PN_LEN]; 939 u8 r2i_ndp_params; 940 u8 i2r_ndp_params; 941 u8 r2i_max_total_ltf; 942 u8 i2r_max_total_ltf; 943 u8 bss_color; 944 u8 band; 945 __le16 min_time_between_msr; 946 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_9 */ 947 948 /** 949 * enum iwl_tof_response_mode 950 * @IWL_MVM_TOF_RESPONSE_ASAP: report each AP measurement separately as soon as 951 * possible (not supported for this release) 952 * @IWL_MVM_TOF_RESPONSE_TIMEOUT: report all AP measurements as a batch upon 953 * timeout expiration 954 * @IWL_MVM_TOF_RESPONSE_COMPLETE: report all AP measurements as a batch at the 955 * earlier of: measurements completion / timeout 956 * expiration. 957 */ 958 enum iwl_tof_response_mode { 959 IWL_MVM_TOF_RESPONSE_ASAP, 960 IWL_MVM_TOF_RESPONSE_TIMEOUT, 961 IWL_MVM_TOF_RESPONSE_COMPLETE, 962 }; 963 964 /** 965 * enum iwl_tof_initiator_flags 966 * 967 * @IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED: disable fast algo, meaning run 968 * the algo on ant A+B, instead of only one of them. 969 * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A: open RX antenna A for FTMs RX 970 * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B: open RX antenna B for FTMs RX 971 * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C: open RX antenna C for FTMs RX 972 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A: use antenna A fo TX ACKs during FTM 973 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B: use antenna B fo TX ACKs during FTM 974 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C: use antenna C fo TX ACKs during FTM 975 * @IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM: use random mac address for FTM 976 * @IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB: use the specific calib value from 977 * the range request command 978 * @IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB: use the common calib value from the 979 * ragne request command 980 * @IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT: support non-asap measurements 981 */ 982 enum iwl_tof_initiator_flags { 983 IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED = BIT(0), 984 IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A = BIT(1), 985 IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B = BIT(2), 986 IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C = BIT(3), 987 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A = BIT(4), 988 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B = BIT(5), 989 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C = BIT(6), 990 IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM = BIT(7), 991 IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB = BIT(15), 992 IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB = BIT(16), 993 IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT = BIT(20), 994 }; /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */ 995 996 #define IWL_MVM_TOF_MAX_APS 5 997 #define IWL_MVM_TOF_MAX_TWO_SIDED_APS 5 998 999 /** 1000 * struct iwl_tof_range_req_cmd_v5 - start measurement cmd 1001 * @initiator_flags: see flags @ iwl_tof_initiator_flags 1002 * @request_id: A Token incremented per request. The same Token will be 1003 * sent back in the range response 1004 * @initiator: 0- NW initiated, 1 - Client Initiated 1005 * @one_sided_los_disable: '0'- run ML-Algo for both ToF/OneSided, 1006 * '1' - run ML-Algo for ToF only 1007 * @req_timeout: Requested timeout of the response in units of 100ms. 1008 * This is equivalent to the session time configured to the 1009 * LMAC in Initiator Request 1010 * @report_policy: Supported partially for this release: For current release - 1011 * the range report will be uploaded as a batch when ready or 1012 * when the session is done (successfully / partially). 1013 * one of iwl_tof_response_mode. 1014 * @reserved0: reserved 1015 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 1016 * @macaddr_random: '0' Use default source MAC address (i.e. p2_p), 1017 * '1' Use MAC Address randomization according to the below 1018 * @range_req_bssid: ranging request BSSID 1019 * @macaddr_template: MAC address template to use for non-randomized bits 1020 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template. 1021 * Bits set to 1 shall be randomized by the UMAC 1022 * @ftm_rx_chains: Rx chain to open to receive Responder's FTMs (XVT) 1023 * @ftm_tx_chains: Tx chain to send the ack to the Responder FTM (XVT) 1024 * @common_calib: The common calib value to inject to this measurement calc 1025 * @specific_calib: The specific calib value to inject to this measurement calc 1026 * @ap: per-AP request data 1027 */ 1028 struct iwl_tof_range_req_cmd_v5 { 1029 __le32 initiator_flags; 1030 u8 request_id; 1031 u8 initiator; 1032 u8 one_sided_los_disable; 1033 u8 req_timeout; 1034 u8 report_policy; 1035 u8 reserved0; 1036 u8 num_of_ap; 1037 u8 macaddr_random; 1038 u8 range_req_bssid[ETH_ALEN]; 1039 u8 macaddr_template[ETH_ALEN]; 1040 u8 macaddr_mask[ETH_ALEN]; 1041 u8 ftm_rx_chains; 1042 u8 ftm_tx_chains; 1043 __le16 common_calib; 1044 __le16 specific_calib; 1045 struct iwl_tof_range_req_ap_entry_v2 ap[IWL_MVM_TOF_MAX_APS]; 1046 } __packed; 1047 /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */ 1048 1049 /** 1050 * struct iwl_tof_range_req_cmd_v7 - start measurement cmd 1051 * @initiator_flags: see flags @ iwl_tof_initiator_flags 1052 * @request_id: A Token incremented per request. The same Token will be 1053 * sent back in the range response 1054 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 1055 * @range_req_bssid: ranging request BSSID 1056 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template. 1057 * Bits set to 1 shall be randomized by the UMAC 1058 * @macaddr_template: MAC address template to use for non-randomized bits 1059 * @req_timeout_ms: Requested timeout of the response in units of milliseconds. 1060 * This is the session time for completing the measurement. 1061 * @tsf_mac_id: report the measurement start time for each ap in terms of the 1062 * TSF of this mac id. 0xff to disable TSF reporting. 1063 * @common_calib: The common calib value to inject to this measurement calc 1064 * @specific_calib: The specific calib value to inject to this measurement calc 1065 * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2. 1066 */ 1067 struct iwl_tof_range_req_cmd_v7 { 1068 __le32 initiator_flags; 1069 u8 request_id; 1070 u8 num_of_ap; 1071 u8 range_req_bssid[ETH_ALEN]; 1072 u8 macaddr_mask[ETH_ALEN]; 1073 u8 macaddr_template[ETH_ALEN]; 1074 __le32 req_timeout_ms; 1075 __le32 tsf_mac_id; 1076 __le16 common_calib; 1077 __le16 specific_calib; 1078 struct iwl_tof_range_req_ap_entry_v3 ap[IWL_MVM_TOF_MAX_APS]; 1079 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_7 */ 1080 1081 /** 1082 * struct iwl_tof_range_req_cmd_v8 - start measurement cmd 1083 * @initiator_flags: see flags @ iwl_tof_initiator_flags 1084 * @request_id: A Token incremented per request. The same Token will be 1085 * sent back in the range response 1086 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 1087 * @range_req_bssid: ranging request BSSID 1088 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template. 1089 * Bits set to 1 shall be randomized by the UMAC 1090 * @macaddr_template: MAC address template to use for non-randomized bits 1091 * @req_timeout_ms: Requested timeout of the response in units of milliseconds. 1092 * This is the session time for completing the measurement. 1093 * @tsf_mac_id: report the measurement start time for each ap in terms of the 1094 * TSF of this mac id. 0xff to disable TSF reporting. 1095 * @common_calib: The common calib value to inject to this measurement calc 1096 * @specific_calib: The specific calib value to inject to this measurement calc 1097 * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2. 1098 */ 1099 struct iwl_tof_range_req_cmd_v8 { 1100 __le32 initiator_flags; 1101 u8 request_id; 1102 u8 num_of_ap; 1103 u8 range_req_bssid[ETH_ALEN]; 1104 u8 macaddr_mask[ETH_ALEN]; 1105 u8 macaddr_template[ETH_ALEN]; 1106 __le32 req_timeout_ms; 1107 __le32 tsf_mac_id; 1108 __le16 common_calib; 1109 __le16 specific_calib; 1110 struct iwl_tof_range_req_ap_entry_v4 ap[IWL_MVM_TOF_MAX_APS]; 1111 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_8 */ 1112 1113 /** 1114 * struct iwl_tof_range_req_cmd_v9 - start measurement cmd 1115 * @initiator_flags: see flags @ iwl_tof_initiator_flags 1116 * @request_id: A Token incremented per request. The same Token will be 1117 * sent back in the range response 1118 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 1119 * @range_req_bssid: ranging request BSSID 1120 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template. 1121 * Bits set to 1 shall be randomized by the UMAC 1122 * @macaddr_template: MAC address template to use for non-randomized bits 1123 * @req_timeout_ms: Requested timeout of the response in units of milliseconds. 1124 * This is the session time for completing the measurement. 1125 * @tsf_mac_id: report the measurement start time for each ap in terms of the 1126 * TSF of this mac id. 0xff to disable TSF reporting. 1127 * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2. 1128 */ 1129 struct iwl_tof_range_req_cmd_v9 { 1130 __le32 initiator_flags; 1131 u8 request_id; 1132 u8 num_of_ap; 1133 u8 range_req_bssid[ETH_ALEN]; 1134 u8 macaddr_mask[ETH_ALEN]; 1135 u8 macaddr_template[ETH_ALEN]; 1136 __le32 req_timeout_ms; 1137 __le32 tsf_mac_id; 1138 struct iwl_tof_range_req_ap_entry_v6 ap[IWL_MVM_TOF_MAX_APS]; 1139 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_9 */ 1140 1141 /** 1142 * struct iwl_tof_range_req_cmd_v11 - start measurement cmd 1143 * @initiator_flags: see flags @ iwl_tof_initiator_flags 1144 * @request_id: A Token incremented per request. The same Token will be 1145 * sent back in the range response 1146 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 1147 * @range_req_bssid: ranging request BSSID 1148 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template. 1149 * Bits set to 1 shall be randomized by the UMAC 1150 * @macaddr_template: MAC address template to use for non-randomized bits 1151 * @req_timeout_ms: Requested timeout of the response in units of milliseconds. 1152 * This is the session time for completing the measurement. 1153 * @tsf_mac_id: report the measurement start time for each ap in terms of the 1154 * TSF of this mac id. 0xff to disable TSF reporting. 1155 * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2. 1156 */ 1157 struct iwl_tof_range_req_cmd_v11 { 1158 __le32 initiator_flags; 1159 u8 request_id; 1160 u8 num_of_ap; 1161 u8 range_req_bssid[ETH_ALEN]; 1162 u8 macaddr_mask[ETH_ALEN]; 1163 u8 macaddr_template[ETH_ALEN]; 1164 __le32 req_timeout_ms; 1165 __le32 tsf_mac_id; 1166 struct iwl_tof_range_req_ap_entry_v7 ap[IWL_MVM_TOF_MAX_APS]; 1167 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_11 */ 1168 1169 /** 1170 * struct iwl_tof_range_req_cmd_v12 - start measurement cmd 1171 * @initiator_flags: see flags @ iwl_tof_initiator_flags 1172 * @request_id: A Token incremented per request. The same Token will be 1173 * sent back in the range response 1174 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 1175 * @range_req_bssid: ranging request BSSID 1176 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template. 1177 * Bits set to 1 shall be randomized by the UMAC 1178 * @macaddr_template: MAC address template to use for non-randomized bits 1179 * @req_timeout_ms: Requested timeout of the response in units of milliseconds. 1180 * This is the session time for completing the measurement. 1181 * @tsf_mac_id: report the measurement start time for each ap in terms of the 1182 * TSF of this mac id. 0xff to disable TSF reporting. 1183 * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2. 1184 */ 1185 struct iwl_tof_range_req_cmd_v12 { 1186 __le32 initiator_flags; 1187 u8 request_id; 1188 u8 num_of_ap; 1189 u8 range_req_bssid[ETH_ALEN]; 1190 u8 macaddr_mask[ETH_ALEN]; 1191 u8 macaddr_template[ETH_ALEN]; 1192 __le32 req_timeout_ms; 1193 __le32 tsf_mac_id; 1194 struct iwl_tof_range_req_ap_entry_v8 ap[IWL_MVM_TOF_MAX_APS]; 1195 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_12 */ 1196 1197 /** 1198 * struct iwl_tof_range_req_cmd_v13 - start measurement cmd 1199 * @initiator_flags: see flags @ iwl_tof_initiator_flags 1200 * @request_id: A Token incremented per request. The same Token will be 1201 * sent back in the range response 1202 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 1203 * @range_req_bssid: ranging request BSSID 1204 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template. 1205 * Bits set to 1 shall be randomized by the UMAC 1206 * @macaddr_template: MAC address template to use for non-randomized bits 1207 * @req_timeout_ms: Requested timeout of the response in units of milliseconds. 1208 * This is the session time for completing the measurement. 1209 * @tsf_mac_id: report the measurement start time for each ap in terms of the 1210 * TSF of this mac id. 0xff to disable TSF reporting. 1211 * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v9. 1212 */ 1213 struct iwl_tof_range_req_cmd_v13 { 1214 __le32 initiator_flags; 1215 u8 request_id; 1216 u8 num_of_ap; 1217 u8 range_req_bssid[ETH_ALEN]; 1218 u8 macaddr_mask[ETH_ALEN]; 1219 u8 macaddr_template[ETH_ALEN]; 1220 __le32 req_timeout_ms; 1221 __le32 tsf_mac_id; 1222 struct iwl_tof_range_req_ap_entry_v9 ap[IWL_MVM_TOF_MAX_APS]; 1223 } __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_13 */ 1224 1225 /* 1226 * enum iwl_tof_range_request_status - status of the sent request 1227 * @IWL_TOF_RANGE_REQUEST_STATUS_SUCCESSFUL - FW successfully received the 1228 * request 1229 * @IWL_TOF_RANGE_REQUEST_STATUS_BUSY - FW is busy with a previous request, the 1230 * sent request will not be handled 1231 */ 1232 enum iwl_tof_range_request_status { 1233 IWL_TOF_RANGE_REQUEST_STATUS_SUCCESS, 1234 IWL_TOF_RANGE_REQUEST_STATUS_BUSY, 1235 }; 1236 1237 /** 1238 * enum iwl_tof_entry_status 1239 * 1240 * @IWL_TOF_ENTRY_SUCCESS: successful measurement. 1241 * @IWL_TOF_ENTRY_GENERAL_FAILURE: General failure. 1242 * @IWL_TOF_ENTRY_NO_RESPONSE: Responder didn't reply to the request. 1243 * @IWL_TOF_ENTRY_REQUEST_REJECTED: Responder rejected the request. 1244 * @IWL_TOF_ENTRY_NOT_SCHEDULED: Time event was scheduled but not called yet. 1245 * @IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT: Time event triggered but no 1246 * measurement was completed. 1247 * @IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE: No range due inability to switch 1248 * from the primary channel. 1249 * @IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED: Device doesn't support FTM. 1250 * @IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON: Request aborted due to unknown 1251 * reason. 1252 * @IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP: Failure due to invalid 1253 * T1/T4. 1254 * @IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE: Failure due to invalid FTM frame 1255 * structure. 1256 * @IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED: Request cannot be scheduled. 1257 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE: Responder cannot serve the 1258 * initiator for some period, period supplied in @refusal_period. 1259 * @IWL_TOF_ENTRY_BAD_REQUEST_ARGS: Bad request arguments. 1260 * @IWL_TOF_ENTRY_WIFI_NOT_ENABLED: Wifi not enabled. 1261 * @IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS: Responder override the original 1262 * parameters within the current session. 1263 */ 1264 enum iwl_tof_entry_status { 1265 IWL_TOF_ENTRY_SUCCESS = 0, 1266 IWL_TOF_ENTRY_GENERAL_FAILURE = 1, 1267 IWL_TOF_ENTRY_NO_RESPONSE = 2, 1268 IWL_TOF_ENTRY_REQUEST_REJECTED = 3, 1269 IWL_TOF_ENTRY_NOT_SCHEDULED = 4, 1270 IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT = 5, 1271 IWL_TOF_ENTRY_TARGET_DIFF_CH_CANNOT_CHANGE = 6, 1272 IWL_TOF_ENTRY_RANGE_NOT_SUPPORTED = 7, 1273 IWL_TOF_ENTRY_REQUEST_ABORT_UNKNOWN_REASON = 8, 1274 IWL_TOF_ENTRY_LOCATION_INVALID_T1_T4_TIME_STAMP = 9, 1275 IWL_TOF_ENTRY_11MC_PROTOCOL_FAILURE = 10, 1276 IWL_TOF_ENTRY_REQUEST_CANNOT_SCHED = 11, 1277 IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE = 12, 1278 IWL_TOF_ENTRY_BAD_REQUEST_ARGS = 13, 1279 IWL_TOF_ENTRY_WIFI_NOT_ENABLED = 14, 1280 IWL_TOF_ENTRY_RESPONDER_OVERRIDE_PARAMS = 15, 1281 }; /* LOCATION_RANGE_RSP_AP_ENTRY_NTFY_API_S_VER_2 */ 1282 1283 /** 1284 * struct iwl_tof_range_rsp_ap_entry_ntfy_v3 - AP parameters (response) 1285 * @bssid: BSSID of the AP 1286 * @measure_status: current APs measurement status, one of 1287 * &enum iwl_tof_entry_status. 1288 * @measure_bw: Current AP Bandwidth: 0 20MHz, 1 40MHz, 2 80MHz 1289 * @rtt: The Round Trip Time that took for the last measurement for 1290 * current AP [pSec] 1291 * @rtt_variance: The Variance of the RTT values measured for current AP 1292 * @rtt_spread: The Difference between the maximum and the minimum RTT 1293 * values measured for current AP in the current session [pSec] 1294 * @rssi: RSSI as uploaded in the Channel Estimation notification 1295 * @rssi_spread: The Difference between the maximum and the minimum RSSI values 1296 * measured for current AP in the current session 1297 * @reserved: reserved 1298 * @refusal_period: refusal period in case of 1299 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec] 1300 * @range: Measured range [cm] 1301 * @range_variance: Measured range variance [cm] 1302 * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was 1303 * uploaded by the LMAC 1304 * @t2t3_initiator: as calculated from the algo in the initiator 1305 * @t1t4_responder: as calculated from the algo in the responder 1306 * @common_calib: Calib val that was used in for this AP measurement 1307 * @specific_calib: val that was used in for this AP measurement 1308 * @papd_calib_output: The result of the tof papd calibration that was injected 1309 * into the algorithm. 1310 */ 1311 struct iwl_tof_range_rsp_ap_entry_ntfy_v3 { 1312 u8 bssid[ETH_ALEN]; 1313 u8 measure_status; 1314 u8 measure_bw; 1315 __le32 rtt; 1316 __le32 rtt_variance; 1317 __le32 rtt_spread; 1318 s8 rssi; 1319 u8 rssi_spread; 1320 u8 reserved; 1321 u8 refusal_period; 1322 __le32 range; 1323 __le32 range_variance; 1324 __le32 timestamp; 1325 __le32 t2t3_initiator; 1326 __le32 t1t4_responder; 1327 __le16 common_calib; 1328 __le16 specific_calib; 1329 __le32 papd_calib_output; 1330 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_3 */ 1331 1332 /** 1333 * struct iwl_tof_range_rsp_ap_entry_ntfy_v4 - AP parameters (response) 1334 * @bssid: BSSID of the AP 1335 * @measure_status: current APs measurement status, one of 1336 * &enum iwl_tof_entry_status. 1337 * @measure_bw: Current AP Bandwidth: 0 20MHz, 1 40MHz, 2 80MHz 1338 * @rtt: The Round Trip Time that took for the last measurement for 1339 * current AP [pSec] 1340 * @rtt_variance: The Variance of the RTT values measured for current AP 1341 * @rtt_spread: The Difference between the maximum and the minimum RTT 1342 * values measured for current AP in the current session [pSec] 1343 * @rssi: RSSI as uploaded in the Channel Estimation notification 1344 * @rssi_spread: The Difference between the maximum and the minimum RSSI values 1345 * measured for current AP in the current session 1346 * @last_burst: 1 if no more FTM sessions are scheduled for this responder 1347 * @refusal_period: refusal period in case of 1348 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec] 1349 * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was 1350 * uploaded by the LMAC 1351 * @start_tsf: measurement start time in TSF of the mac specified in the range 1352 * request 1353 * @rx_rate_n_flags: rate and flags of the last FTM frame received from this 1354 * responder 1355 * @tx_rate_n_flags: rate and flags of the last ack sent to this responder 1356 * @t2t3_initiator: as calculated from the algo in the initiator 1357 * @t1t4_responder: as calculated from the algo in the responder 1358 * @common_calib: Calib val that was used in for this AP measurement 1359 * @specific_calib: val that was used in for this AP measurement 1360 * @papd_calib_output: The result of the tof papd calibration that was injected 1361 * into the algorithm. 1362 */ 1363 struct iwl_tof_range_rsp_ap_entry_ntfy_v4 { 1364 u8 bssid[ETH_ALEN]; 1365 u8 measure_status; 1366 u8 measure_bw; 1367 __le32 rtt; 1368 __le32 rtt_variance; 1369 __le32 rtt_spread; 1370 s8 rssi; 1371 u8 rssi_spread; 1372 u8 last_burst; 1373 u8 refusal_period; 1374 __le32 timestamp; 1375 __le32 start_tsf; 1376 __le32 rx_rate_n_flags; 1377 __le32 tx_rate_n_flags; 1378 __le32 t2t3_initiator; 1379 __le32 t1t4_responder; 1380 __le16 common_calib; 1381 __le16 specific_calib; 1382 __le32 papd_calib_output; 1383 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_4 */ 1384 1385 /** 1386 * struct iwl_tof_range_rsp_ap_entry_ntfy_v5 - AP parameters (response) 1387 * @bssid: BSSID of the AP 1388 * @measure_status: current APs measurement status, one of 1389 * &enum iwl_tof_entry_status. 1390 * @measure_bw: Current AP Bandwidth: 0 20MHz, 1 40MHz, 2 80MHz 1391 * @rtt: The Round Trip Time that took for the last measurement for 1392 * current AP [pSec] 1393 * @rtt_variance: The Variance of the RTT values measured for current AP 1394 * @rtt_spread: The Difference between the maximum and the minimum RTT 1395 * values measured for current AP in the current session [pSec] 1396 * @rssi: RSSI as uploaded in the Channel Estimation notification 1397 * @rssi_spread: The Difference between the maximum and the minimum RSSI values 1398 * measured for current AP in the current session 1399 * @last_burst: 1 if no more FTM sessions are scheduled for this responder 1400 * @refusal_period: refusal period in case of 1401 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec] 1402 * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was 1403 * uploaded by the LMAC 1404 * @start_tsf: measurement start time in TSF of the mac specified in the range 1405 * request 1406 * @rx_rate_n_flags: rate and flags of the last FTM frame received from this 1407 * responder 1408 * @tx_rate_n_flags: rate and flags of the last ack sent to this responder 1409 * @t2t3_initiator: as calculated from the algo in the initiator 1410 * @t1t4_responder: as calculated from the algo in the responder 1411 * @common_calib: Calib val that was used in for this AP measurement 1412 * @specific_calib: val that was used in for this AP measurement 1413 * @papd_calib_output: The result of the tof papd calibration that was injected 1414 * into the algorithm. 1415 * @rttConfidence: a value between 0 - 31 that represents the rtt accuracy. 1416 * @reserved: for alignment 1417 */ 1418 struct iwl_tof_range_rsp_ap_entry_ntfy_v5 { 1419 u8 bssid[ETH_ALEN]; 1420 u8 measure_status; 1421 u8 measure_bw; 1422 __le32 rtt; 1423 __le32 rtt_variance; 1424 __le32 rtt_spread; 1425 s8 rssi; 1426 u8 rssi_spread; 1427 u8 last_burst; 1428 u8 refusal_period; 1429 __le32 timestamp; 1430 __le32 start_tsf; 1431 __le32 rx_rate_n_flags; 1432 __le32 tx_rate_n_flags; 1433 __le32 t2t3_initiator; 1434 __le32 t1t4_responder; 1435 __le16 common_calib; 1436 __le16 specific_calib; 1437 __le32 papd_calib_output; 1438 u8 rttConfidence; 1439 u8 reserved[3]; 1440 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_5 */ 1441 1442 /** 1443 * struct iwl_tof_range_rsp_ap_entry_ntfy_v6 - AP parameters (response) 1444 * @bssid: BSSID of the AP 1445 * @measure_status: current APs measurement status, one of 1446 * &enum iwl_tof_entry_status. 1447 * @measure_bw: Current AP Bandwidth: 0 20MHz, 1 40MHz, 2 80MHz 1448 * @rtt: The Round Trip Time that took for the last measurement for 1449 * current AP [pSec] 1450 * @rtt_variance: The Variance of the RTT values measured for current AP 1451 * @rtt_spread: The Difference between the maximum and the minimum RTT 1452 * values measured for current AP in the current session [pSec] 1453 * @rssi: RSSI as uploaded in the Channel Estimation notification 1454 * @rssi_spread: The Difference between the maximum and the minimum RSSI values 1455 * measured for current AP in the current session 1456 * @last_burst: 1 if no more FTM sessions are scheduled for this responder 1457 * @refusal_period: refusal period in case of 1458 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec] 1459 * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was 1460 * uploaded by the LMAC 1461 * @start_tsf: measurement start time in TSF of the mac specified in the range 1462 * request 1463 * @rx_rate_n_flags: rate and flags of the last FTM frame received from this 1464 * responder 1465 * @tx_rate_n_flags: rate and flags of the last ack sent to this responder 1466 * @t2t3_initiator: as calculated from the algo in the initiator 1467 * @t1t4_responder: as calculated from the algo in the responder 1468 * @common_calib: Calib val that was used in for this AP measurement 1469 * @specific_calib: val that was used in for this AP measurement 1470 * @papd_calib_output: The result of the tof papd calibration that was injected 1471 * into the algorithm. 1472 * @rttConfidence: a value between 0 - 31 that represents the rtt accuracy. 1473 * @reserved: for alignment 1474 * @rx_pn: the last PN used for this responder Rx in case PMF is configured in 1475 * LE byte order. 1476 * @tx_pn: the last PN used for this responder Tx in case PMF is configured in 1477 * LE byte order. 1478 */ 1479 struct iwl_tof_range_rsp_ap_entry_ntfy_v6 { 1480 u8 bssid[ETH_ALEN]; 1481 u8 measure_status; 1482 u8 measure_bw; 1483 __le32 rtt; 1484 __le32 rtt_variance; 1485 __le32 rtt_spread; 1486 s8 rssi; 1487 u8 rssi_spread; 1488 u8 last_burst; 1489 u8 refusal_period; 1490 __le32 timestamp; 1491 __le32 start_tsf; 1492 __le32 rx_rate_n_flags; 1493 __le32 tx_rate_n_flags; 1494 __le32 t2t3_initiator; 1495 __le32 t1t4_responder; 1496 __le16 common_calib; 1497 __le16 specific_calib; 1498 __le32 papd_calib_output; 1499 u8 rttConfidence; 1500 u8 reserved[3]; 1501 u8 rx_pn[IEEE80211_CCMP_PN_LEN]; 1502 u8 tx_pn[IEEE80211_CCMP_PN_LEN]; 1503 } __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_6 */ 1504 1505 /** 1506 * enum iwl_tof_response_status - tof response status 1507 * 1508 * @IWL_TOF_RESPONSE_SUCCESS: successful range. 1509 * @IWL_TOF_RESPONSE_TIMEOUT: request aborted due to timeout expiration. 1510 * partial result of ranges done so far is included in the response. 1511 * @IWL_TOF_RESPONSE_ABORTED: Measurement aborted by command. 1512 * @IWL_TOF_RESPONSE_FAILED: Measurement request command failed. 1513 */ 1514 enum iwl_tof_response_status { 1515 IWL_TOF_RESPONSE_SUCCESS = 0, 1516 IWL_TOF_RESPONSE_TIMEOUT = 1, 1517 IWL_TOF_RESPONSE_ABORTED = 4, 1518 IWL_TOF_RESPONSE_FAILED = 5, 1519 }; /* LOCATION_RNG_RSP_STATUS */ 1520 1521 /** 1522 * struct iwl_tof_range_rsp_ntfy_v5 - ranging response notification 1523 * @request_id: A Token ID of the corresponding Range request 1524 * @request_status: status of current measurement session, one of 1525 * &enum iwl_tof_response_status. 1526 * @last_in_batch: reprot policy (when not all responses are uploaded at once) 1527 * @num_of_aps: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 1528 * @ap: per-AP data 1529 */ 1530 struct iwl_tof_range_rsp_ntfy_v5 { 1531 u8 request_id; 1532 u8 request_status; 1533 u8 last_in_batch; 1534 u8 num_of_aps; 1535 struct iwl_tof_range_rsp_ap_entry_ntfy_v3 ap[IWL_MVM_TOF_MAX_APS]; 1536 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_5 */ 1537 1538 /** 1539 * struct iwl_tof_range_rsp_ntfy_v6 - ranging response notification 1540 * @request_id: A Token ID of the corresponding Range request 1541 * @num_of_aps: Number of APs results 1542 * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise. 1543 * @reserved: reserved 1544 * @ap: per-AP data 1545 */ 1546 struct iwl_tof_range_rsp_ntfy_v6 { 1547 u8 request_id; 1548 u8 num_of_aps; 1549 u8 last_report; 1550 u8 reserved; 1551 struct iwl_tof_range_rsp_ap_entry_ntfy_v4 ap[IWL_MVM_TOF_MAX_APS]; 1552 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_6 */ 1553 1554 /** 1555 * struct iwl_tof_range_rsp_ntfy_v7 - ranging response notification 1556 * @request_id: A Token ID of the corresponding Range request 1557 * @num_of_aps: Number of APs results 1558 * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise. 1559 * @reserved: reserved 1560 * @ap: per-AP data 1561 */ 1562 struct iwl_tof_range_rsp_ntfy_v7 { 1563 u8 request_id; 1564 u8 num_of_aps; 1565 u8 last_report; 1566 u8 reserved; 1567 struct iwl_tof_range_rsp_ap_entry_ntfy_v5 ap[IWL_MVM_TOF_MAX_APS]; 1568 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_7 */ 1569 1570 /** 1571 * struct iwl_tof_range_rsp_ntfy_v8 - ranging response notification 1572 * @request_id: A Token ID of the corresponding Range request 1573 * @num_of_aps: Number of APs results 1574 * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise. 1575 * @reserved: reserved 1576 * @ap: per-AP data 1577 */ 1578 struct iwl_tof_range_rsp_ntfy_v8 { 1579 u8 request_id; 1580 u8 num_of_aps; 1581 u8 last_report; 1582 u8 reserved; 1583 struct iwl_tof_range_rsp_ap_entry_ntfy_v6 ap[IWL_MVM_TOF_MAX_APS]; 1584 } __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_8 */ 1585 1586 #define IWL_MVM_TOF_MCSI_BUF_SIZE (245) 1587 /** 1588 * struct iwl_tof_mcsi_notif - used for debug 1589 * @token: token ID for the current session 1590 * @role: '0' - initiator, '1' - responder 1591 * @reserved: reserved 1592 * @initiator_bssid: initiator machine 1593 * @responder_bssid: responder machine 1594 * @mcsi_buffer: debug data 1595 */ 1596 struct iwl_tof_mcsi_notif { 1597 u8 token; 1598 u8 role; 1599 __le16 reserved; 1600 u8 initiator_bssid[ETH_ALEN]; 1601 u8 responder_bssid[ETH_ALEN]; 1602 u8 mcsi_buffer[IWL_MVM_TOF_MCSI_BUF_SIZE * 4]; 1603 } __packed; 1604 1605 /** 1606 * struct iwl_tof_range_abort_cmd 1607 * @request_id: corresponds to a range request 1608 * @reserved: reserved 1609 */ 1610 struct iwl_tof_range_abort_cmd { 1611 u8 request_id; 1612 u8 reserved[3]; 1613 } __packed; 1614 1615 enum ftm_responder_stats_flags { 1616 FTM_RESP_STAT_NON_ASAP_STARTED = BIT(0), 1617 FTM_RESP_STAT_NON_ASAP_IN_WIN = BIT(1), 1618 FTM_RESP_STAT_NON_ASAP_OUT_WIN = BIT(2), 1619 FTM_RESP_STAT_TRIGGER_DUP = BIT(3), 1620 FTM_RESP_STAT_DUP = BIT(4), 1621 FTM_RESP_STAT_DUP_IN_WIN = BIT(5), 1622 FTM_RESP_STAT_DUP_OUT_WIN = BIT(6), 1623 FTM_RESP_STAT_SCHED_SUCCESS = BIT(7), 1624 FTM_RESP_STAT_ASAP_REQ = BIT(8), 1625 FTM_RESP_STAT_NON_ASAP_REQ = BIT(9), 1626 FTM_RESP_STAT_ASAP_RESP = BIT(10), 1627 FTM_RESP_STAT_NON_ASAP_RESP = BIT(11), 1628 FTM_RESP_STAT_FAIL_INITIATOR_INACTIVE = BIT(12), 1629 FTM_RESP_STAT_FAIL_INITIATOR_OUT_WIN = BIT(13), 1630 FTM_RESP_STAT_FAIL_INITIATOR_RETRY_LIM = BIT(14), 1631 FTM_RESP_STAT_FAIL_NEXT_SERVED = BIT(15), 1632 FTM_RESP_STAT_FAIL_TRIGGER_ERR = BIT(16), 1633 FTM_RESP_STAT_FAIL_GC = BIT(17), 1634 FTM_RESP_STAT_SUCCESS = BIT(18), 1635 FTM_RESP_STAT_INTEL_IE = BIT(19), 1636 FTM_RESP_STAT_INITIATOR_ACTIVE = BIT(20), 1637 FTM_RESP_STAT_MEASUREMENTS_AVAILABLE = BIT(21), 1638 FTM_RESP_STAT_TRIGGER_UNKNOWN = BIT(22), 1639 FTM_RESP_STAT_PROCESS_FAIL = BIT(23), 1640 FTM_RESP_STAT_ACK = BIT(24), 1641 FTM_RESP_STAT_NACK = BIT(25), 1642 FTM_RESP_STAT_INVALID_INITIATOR_ID = BIT(26), 1643 FTM_RESP_STAT_TIMER_MIN_DELTA = BIT(27), 1644 FTM_RESP_STAT_INITIATOR_REMOVED = BIT(28), 1645 FTM_RESP_STAT_INITIATOR_ADDED = BIT(29), 1646 FTM_RESP_STAT_ERR_LIST_FULL = BIT(30), 1647 FTM_RESP_STAT_INITIATOR_SCHED_NOW = BIT(31), 1648 }; /* RESP_IND_E */ 1649 1650 /** 1651 * struct iwl_ftm_responder_stats - FTM responder statistics 1652 * @addr: initiator address 1653 * @success_ftm: number of successful ftm frames 1654 * @ftm_per_burst: num of FTM frames that were received 1655 * @flags: &enum ftm_responder_stats_flags 1656 * @duration: actual duration of FTM 1657 * @allocated_duration: time that was allocated for this FTM session 1658 * @bw: FTM request bandwidth 1659 * @rate: FTM request rate 1660 * @reserved: for alingment and future use 1661 */ 1662 struct iwl_ftm_responder_stats { 1663 u8 addr[ETH_ALEN]; 1664 u8 success_ftm; 1665 u8 ftm_per_burst; 1666 __le32 flags; 1667 __le32 duration; 1668 __le32 allocated_duration; 1669 u8 bw; 1670 u8 rate; 1671 __le16 reserved; 1672 } __packed; /* TOF_RESPONDER_STATISTICS_NTFY_S_VER_2 */ 1673 1674 #define IWL_CSI_MAX_EXPECTED_CHUNKS 16 1675 1676 #define IWL_CSI_CHUNK_CTL_NUM_MASK_VER_1 0x0003 1677 #define IWL_CSI_CHUNK_CTL_IDX_MASK_VER_1 0x000c 1678 1679 #define IWL_CSI_CHUNK_CTL_NUM_MASK_VER_2 0x00ff 1680 #define IWL_CSI_CHUNK_CTL_IDX_MASK_VER_2 0xff00 1681 1682 struct iwl_csi_chunk_notification { 1683 __le32 token; 1684 __le16 seq; 1685 __le16 ctl; 1686 __le32 size; 1687 u8 data[]; 1688 } __packed; /* CSI_CHUNKS_HDR_NTFY_API_S_VER_1/VER_2 */ 1689 1690 #endif /* __iwl_fw_api_location_h__ */ 1691