Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
0002 /*
0003  * Copyright (C) 2015-2017 Intel Deutschland GmbH
0004  * Copyright (C) 2018-2021 Intel Corporation
0005  */
0006 #ifndef __iwl_fw_api_location_h__
0007 #define __iwl_fw_api_location_h__
0008 
0009 /**
0010  * enum iwl_location_subcmd_ids - location group command IDs
0011  */
0012 enum iwl_location_subcmd_ids {
0013     /**
0014      * @TOF_RANGE_REQ_CMD: TOF ranging request,
0015      *  uses one of &struct iwl_tof_range_req_cmd_v5,
0016      *  &struct iwl_tof_range_req_cmd_v7,
0017      *  &struct iwl_tof_range_req_cmd_v8,
0018      *  &struct iwl_tof_range_req_cmd_v9,
0019      *  &struct iwl_tof_range_req_cmd_v11,
0020      *  &struct iwl_tof_range_req_cmd_v7
0021      */
0022     TOF_RANGE_REQ_CMD = 0x0,
0023     /**
0024      * @TOF_CONFIG_CMD: TOF configuration, uses &struct iwl_tof_config_cmd
0025      */
0026     TOF_CONFIG_CMD = 0x1,
0027     /**
0028      * @TOF_RANGE_ABORT_CMD: abort ongoing ranging, uses
0029      *  &struct iwl_tof_range_abort_cmd
0030      */
0031     TOF_RANGE_ABORT_CMD = 0x2,
0032     /**
0033      * @TOF_RANGE_REQ_EXT_CMD: TOF extended ranging config,
0034      *  uses &struct iwl_tof_range_req_ext_cmd
0035      */
0036     TOF_RANGE_REQ_EXT_CMD = 0x3,
0037     /**
0038      * @TOF_RESPONDER_CONFIG_CMD: FTM responder configuration,
0039      *  uses &struct iwl_tof_responder_config_cmd
0040      */
0041     TOF_RESPONDER_CONFIG_CMD = 0x4,
0042     /**
0043      * @TOF_RESPONDER_DYN_CONFIG_CMD: FTM dynamic configuration,
0044      *  uses &struct iwl_tof_responder_dyn_config_cmd
0045      */
0046     TOF_RESPONDER_DYN_CONFIG_CMD = 0x5,
0047     /**
0048      * @CSI_HEADER_NOTIFICATION: CSI header
0049      */
0050     CSI_HEADER_NOTIFICATION = 0xFA,
0051     /**
0052      * @CSI_CHUNKS_NOTIFICATION: CSI chunk,
0053      *  uses &struct iwl_csi_chunk_notification
0054      */
0055     CSI_CHUNKS_NOTIFICATION = 0xFB,
0056     /**
0057      * @TOF_LC_NOTIF: used for LCI/civic location, contains just
0058      *  the action frame
0059      */
0060     TOF_LC_NOTIF = 0xFC,
0061     /**
0062      * @TOF_RESPONDER_STATS: FTM responder statistics notification,
0063      *  uses &struct iwl_ftm_responder_stats
0064      */
0065     TOF_RESPONDER_STATS = 0xFD,
0066     /**
0067      * @TOF_MCSI_DEBUG_NOTIF: MCSI debug notification, uses
0068      *  &struct iwl_tof_mcsi_notif
0069      */
0070     TOF_MCSI_DEBUG_NOTIF = 0xFE,
0071     /**
0072      * @TOF_RANGE_RESPONSE_NOTIF: ranging response, using
0073      *  &struct iwl_tof_range_rsp_ntfy
0074      */
0075     TOF_RANGE_RESPONSE_NOTIF = 0xFF,
0076 };
0077 
0078 /**
0079  * struct iwl_tof_config_cmd - ToF configuration
0080  * @tof_disabled: indicates if ToF is disabled (or not)
0081  * @one_sided_disabled: indicates if one-sided is disabled (or not)
0082  * @is_debug_mode: indiciates if debug mode is active
0083  * @is_buf_required: indicates if channel estimation buffer is required
0084  */
0085 struct iwl_tof_config_cmd {
0086     u8 tof_disabled;
0087     u8 one_sided_disabled;
0088     u8 is_debug_mode;
0089     u8 is_buf_required;
0090 } __packed;
0091 
0092 /**
0093  * enum iwl_tof_bandwidth - values for iwl_tof_range_req_ap_entry.bandwidth
0094  * @IWL_TOF_BW_20_LEGACY: 20 MHz non-HT
0095  * @IWL_TOF_BW_20_HT: 20 MHz HT
0096  * @IWL_TOF_BW_40: 40 MHz
0097  * @IWL_TOF_BW_80: 80 MHz
0098  * @IWL_TOF_BW_160: 160 MHz
0099  * @IWL_TOF_BW_NUM: number of tof bandwidths
0100  */
0101 enum iwl_tof_bandwidth {
0102     IWL_TOF_BW_20_LEGACY,
0103     IWL_TOF_BW_20_HT,
0104     IWL_TOF_BW_40,
0105     IWL_TOF_BW_80,
0106     IWL_TOF_BW_160,
0107     IWL_TOF_BW_NUM,
0108 }; /* LOCAT_BW_TYPE_E */
0109 
0110 /*
0111  * enum iwl_tof_algo_type - Algorithym type for range measurement request
0112  */
0113 enum iwl_tof_algo_type {
0114     IWL_TOF_ALGO_TYPE_MAX_LIKE  = 0,
0115     IWL_TOF_ALGO_TYPE_LINEAR_REG    = 1,
0116     IWL_TOF_ALGO_TYPE_FFT       = 2,
0117 
0118     /* Keep last */
0119     IWL_TOF_ALGO_TYPE_INVALID,
0120 }; /* ALGO_TYPE_E */
0121 
0122 /*
0123  * enum iwl_tof_mcsi_ntfy - Enable/Disable MCSI notifications
0124  */
0125 enum iwl_tof_mcsi_enable {
0126     IWL_TOF_MCSI_DISABLED = 0,
0127     IWL_TOF_MCSI_ENABLED = 1,
0128 }; /* MCSI_ENABLE_E */
0129 
0130 /**
0131  * enum iwl_tof_responder_cmd_valid_field - valid fields in the responder cfg
0132  * @IWL_TOF_RESPONDER_CMD_VALID_CHAN_INFO: channel info is valid
0133  * @IWL_TOF_RESPONDER_CMD_VALID_TOA_OFFSET: ToA offset is valid
0134  * @IWL_TOF_RESPONDER_CMD_VALID_COMMON_CALIB: common calibration mode is valid
0135  * @IWL_TOF_RESPONDER_CMD_VALID_SPECIFIC_CALIB: spefici calibration mode is
0136  *  valid
0137  * @IWL_TOF_RESPONDER_CMD_VALID_BSSID: BSSID is valid
0138  * @IWL_TOF_RESPONDER_CMD_VALID_TX_ANT: TX antenna is valid
0139  * @IWL_TOF_RESPONDER_CMD_VALID_ALGO_TYPE: algorithm type is valid
0140  * @IWL_TOF_RESPONDER_CMD_VALID_NON_ASAP_SUPPORT: non-ASAP support is valid
0141  * @IWL_TOF_RESPONDER_CMD_VALID_STATISTICS_REPORT_SUPPORT: statistics report
0142  *  support is valid
0143  * @IWL_TOF_RESPONDER_CMD_VALID_MCSI_NOTIF_SUPPORT: MCSI notification support
0144  *  is valid
0145  * @IWL_TOF_RESPONDER_CMD_VALID_FAST_ALGO_SUPPORT: fast algorithm support
0146  *  is valid
0147  * @IWL_TOF_RESPONDER_CMD_VALID_RETRY_ON_ALGO_FAIL: retry on algorithm failure
0148  *  is valid
0149  * @IWL_TOF_RESPONDER_CMD_VALID_STA_ID: station ID is valid
0150  * @IWL_TOF_RESPONDER_CMD_VALID_NDP_SUPPORT: enable/disable NDP ranging support
0151  *  is valid
0152  * @IWL_TOF_RESPONDER_CMD_VALID_NDP_PARAMS: NDP parameters are valid
0153  * @IWL_TOF_RESPONDER_CMD_VALID_LMR_FEEDBACK: LMR feedback support is valid
0154  * @IWL_TOF_RESPONDER_CMD_VALID_SESSION_ID: session id flag is valid
0155  * @IWL_TOF_RESPONDER_CMD_VALID_BSS_COLOR: the bss_color field is valid
0156  * @IWL_TOF_RESPONDER_CMD_VALID_MIN_MAX_TIME_BETWEEN_MSR: the
0157  *  min_time_between_msr and max_time_between_msr fields are valid
0158  */
0159 enum iwl_tof_responder_cmd_valid_field {
0160     IWL_TOF_RESPONDER_CMD_VALID_CHAN_INFO = BIT(0),
0161     IWL_TOF_RESPONDER_CMD_VALID_TOA_OFFSET = BIT(1),
0162     IWL_TOF_RESPONDER_CMD_VALID_COMMON_CALIB = BIT(2),
0163     IWL_TOF_RESPONDER_CMD_VALID_SPECIFIC_CALIB = BIT(3),
0164     IWL_TOF_RESPONDER_CMD_VALID_BSSID = BIT(4),
0165     IWL_TOF_RESPONDER_CMD_VALID_TX_ANT = BIT(5),
0166     IWL_TOF_RESPONDER_CMD_VALID_ALGO_TYPE = BIT(6),
0167     IWL_TOF_RESPONDER_CMD_VALID_NON_ASAP_SUPPORT = BIT(7),
0168     IWL_TOF_RESPONDER_CMD_VALID_STATISTICS_REPORT_SUPPORT = BIT(8),
0169     IWL_TOF_RESPONDER_CMD_VALID_MCSI_NOTIF_SUPPORT = BIT(9),
0170     IWL_TOF_RESPONDER_CMD_VALID_FAST_ALGO_SUPPORT = BIT(10),
0171     IWL_TOF_RESPONDER_CMD_VALID_RETRY_ON_ALGO_FAIL = BIT(11),
0172     IWL_TOF_RESPONDER_CMD_VALID_STA_ID = BIT(12),
0173     IWL_TOF_RESPONDER_CMD_VALID_NDP_SUPPORT = BIT(22),
0174     IWL_TOF_RESPONDER_CMD_VALID_NDP_PARAMS = BIT(23),
0175     IWL_TOF_RESPONDER_CMD_VALID_LMR_FEEDBACK = BIT(24),
0176     IWL_TOF_RESPONDER_CMD_VALID_SESSION_ID = BIT(25),
0177     IWL_TOF_RESPONDER_CMD_VALID_BSS_COLOR = BIT(26),
0178     IWL_TOF_RESPONDER_CMD_VALID_MIN_MAX_TIME_BETWEEN_MSR = BIT(27),
0179 };
0180 
0181 /**
0182  * enum iwl_tof_responder_cfg_flags - responder configuration flags
0183  * @IWL_TOF_RESPONDER_FLAGS_NON_ASAP_SUPPORT: non-ASAP support
0184  * @IWL_TOF_RESPONDER_FLAGS_REPORT_STATISTICS: report statistics
0185  * @IWL_TOF_RESPONDER_FLAGS_REPORT_MCSI: report MCSI
0186  * @IWL_TOF_RESPONDER_FLAGS_ALGO_TYPE: algorithm type
0187  * @IWL_TOF_RESPONDER_FLAGS_TOA_OFFSET_MODE: ToA offset mode
0188  * @IWL_TOF_RESPONDER_FLAGS_COMMON_CALIB_MODE: common calibration mode
0189  * @IWL_TOF_RESPONDER_FLAGS_SPECIFIC_CALIB_MODE: specific calibration mode
0190  * @IWL_TOF_RESPONDER_FLAGS_FAST_ALGO_SUPPORT: fast algorithm support
0191  * @IWL_TOF_RESPONDER_FLAGS_RETRY_ON_ALGO_FAIL: retry on algorithm fail
0192  * @IWL_TOF_RESPONDER_FLAGS_FTM_TX_ANT: TX antenna mask
0193  * @IWL_TOF_RESPONDER_FLAGS_NDP_SUPPORT: support NDP ranging
0194  * @IWL_TOF_RESPONDER_FLAGS_LMR_FEEDBACK: request for LMR feedback if the
0195  *  initiator supports it
0196  * @IWL_TOF_RESPONDER_FLAGS_SESSION_ID: send the session id in the initial FTM
0197  *  frame.
0198  */
0199 enum iwl_tof_responder_cfg_flags {
0200     IWL_TOF_RESPONDER_FLAGS_NON_ASAP_SUPPORT = BIT(0),
0201     IWL_TOF_RESPONDER_FLAGS_REPORT_STATISTICS = BIT(1),
0202     IWL_TOF_RESPONDER_FLAGS_REPORT_MCSI = BIT(2),
0203     IWL_TOF_RESPONDER_FLAGS_ALGO_TYPE = BIT(3) | BIT(4) | BIT(5),
0204     IWL_TOF_RESPONDER_FLAGS_TOA_OFFSET_MODE = BIT(6),
0205     IWL_TOF_RESPONDER_FLAGS_COMMON_CALIB_MODE = BIT(7),
0206     IWL_TOF_RESPONDER_FLAGS_SPECIFIC_CALIB_MODE = BIT(8),
0207     IWL_TOF_RESPONDER_FLAGS_FAST_ALGO_SUPPORT = BIT(9),
0208     IWL_TOF_RESPONDER_FLAGS_RETRY_ON_ALGO_FAIL = BIT(10),
0209     IWL_TOF_RESPONDER_FLAGS_FTM_TX_ANT = RATE_MCS_ANT_AB_MSK,
0210     IWL_TOF_RESPONDER_FLAGS_NDP_SUPPORT = BIT(24),
0211     IWL_TOF_RESPONDER_FLAGS_LMR_FEEDBACK = BIT(25),
0212     IWL_TOF_RESPONDER_FLAGS_SESSION_ID = BIT(27),
0213 };
0214 
0215 /**
0216  * struct iwl_tof_responder_config_cmd_v6 - ToF AP mode (for debug)
0217  * @cmd_valid_fields: &iwl_tof_responder_cmd_valid_field
0218  * @responder_cfg_flags: &iwl_tof_responder_cfg_flags
0219  * @bandwidth: current AP Bandwidth: &enum iwl_tof_bandwidth
0220  * @rate: current AP rate
0221  * @channel_num: current AP Channel
0222  * @ctrl_ch_position: coding of the control channel position relative to
0223  *  the center frequency, see iwl_mvm_get_ctrl_pos()
0224  * @sta_id: index of the AP STA when in AP mode
0225  * @reserved1: reserved
0226  * @toa_offset: Artificial addition [pSec] for the ToA - to be used for debug
0227  *  purposes, simulating station movement by adding various values
0228  *  to this field
0229  * @common_calib: XVT: common calibration value
0230  * @specific_calib: XVT: specific calibration value
0231  * @bssid: Current AP BSSID
0232  * @reserved2: reserved
0233  */
0234 struct iwl_tof_responder_config_cmd_v6 {
0235     __le32 cmd_valid_fields;
0236     __le32 responder_cfg_flags;
0237     u8 bandwidth;
0238     u8 rate;
0239     u8 channel_num;
0240     u8 ctrl_ch_position;
0241     u8 sta_id;
0242     u8 reserved1;
0243     __le16 toa_offset;
0244     __le16 common_calib;
0245     __le16 specific_calib;
0246     u8 bssid[ETH_ALEN];
0247     __le16 reserved2;
0248 } __packed; /* TOF_RESPONDER_CONFIG_CMD_API_S_VER_6 */
0249 
0250 /**
0251  * struct iwl_tof_responder_config_cmd_v7 - ToF AP mode (for debug)
0252  * @cmd_valid_fields: &iwl_tof_responder_cmd_valid_field
0253  * @responder_cfg_flags: &iwl_tof_responder_cfg_flags
0254  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
0255  *             bits 4 - 7: &enum iwl_location_bw.
0256  * @rate: current AP rate
0257  * @channel_num: current AP Channel
0258  * @ctrl_ch_position: coding of the control channel position relative to
0259  *  the center frequency, see iwl_mvm_get_ctrl_pos()
0260  * @sta_id: index of the AP STA when in AP mode
0261  * @reserved1: reserved
0262  * @toa_offset: Artificial addition [pSec] for the ToA - to be used for debug
0263  *  purposes, simulating station movement by adding various values
0264  *  to this field
0265  * @common_calib: XVT: common calibration value
0266  * @specific_calib: XVT: specific calibration value
0267  * @bssid: Current AP BSSID
0268  * @reserved2: reserved
0269  */
0270 struct iwl_tof_responder_config_cmd_v7 {
0271     __le32 cmd_valid_fields;
0272     __le32 responder_cfg_flags;
0273     u8 format_bw;
0274     u8 rate;
0275     u8 channel_num;
0276     u8 ctrl_ch_position;
0277     u8 sta_id;
0278     u8 reserved1;
0279     __le16 toa_offset;
0280     __le16 common_calib;
0281     __le16 specific_calib;
0282     u8 bssid[ETH_ALEN];
0283     __le16 reserved2;
0284 } __packed; /* TOF_RESPONDER_CONFIG_CMD_API_S_VER_7 */
0285 
0286 #define IWL_RESPONDER_STS_POS   3
0287 #define IWL_RESPONDER_TOTAL_LTF_POS 6
0288 
0289 /**
0290  * struct iwl_tof_responder_config_cmd_v8 - ToF AP mode (for debug)
0291  * @cmd_valid_fields: &iwl_tof_responder_cmd_valid_field
0292  * @responder_cfg_flags: &iwl_tof_responder_cfg_flags
0293  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
0294  *             bits 4 - 7: &enum iwl_location_bw.
0295  * @rate: current AP rate
0296  * @channel_num: current AP Channel
0297  * @ctrl_ch_position: coding of the control channel position relative to
0298  *  the center frequency, see iwl_mvm_get_ctrl_pos()
0299  * @sta_id: index of the AP STA when in AP mode
0300  * @reserved1: reserved
0301  * @toa_offset: Artificial addition [pSec] for the ToA - to be used for debug
0302  *  purposes, simulating station movement by adding various values
0303  *  to this field
0304  * @common_calib: XVT: common calibration value
0305  * @specific_calib: XVT: specific calibration value
0306  * @bssid: Current AP BSSID
0307  * @r2i_ndp_params: parameters for R2I NDP.
0308  *  bits 0 - 2: max number of LTF repetitions
0309  *  bits 3 - 5: max number of spatial streams (supported values are < 2)
0310  *  bits 6 - 7: max number of total LTFs see
0311  *  &enum ieee80211_range_params_max_total_ltf
0312  * @i2r_ndp_params: parameters for I2R NDP.
0313  *  bits 0 - 2: max number of LTF repetitions
0314  *  bits 3 - 5: max number of spatial streams
0315  *  bits 6 - 7: max number of total LTFs see
0316  *  &enum ieee80211_range_params_max_total_ltf
0317  */
0318 struct iwl_tof_responder_config_cmd_v8 {
0319     __le32 cmd_valid_fields;
0320     __le32 responder_cfg_flags;
0321     u8 format_bw;
0322     u8 rate;
0323     u8 channel_num;
0324     u8 ctrl_ch_position;
0325     u8 sta_id;
0326     u8 reserved1;
0327     __le16 toa_offset;
0328     __le16 common_calib;
0329     __le16 specific_calib;
0330     u8 bssid[ETH_ALEN];
0331     u8 r2i_ndp_params;
0332     u8 i2r_ndp_params;
0333 } __packed; /* TOF_RESPONDER_CONFIG_CMD_API_S_VER_8 */
0334 
0335 /**
0336  * struct iwl_tof_responder_config_cmd_v9 - ToF AP mode (for debug)
0337  * @cmd_valid_fields: &iwl_tof_responder_cmd_valid_field
0338  * @responder_cfg_flags: &iwl_tof_responder_cfg_flags
0339  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
0340  *             bits 4 - 7: &enum iwl_location_bw.
0341  * @bss_color: current AP bss_color
0342  * @channel_num: current AP Channel
0343  * @ctrl_ch_position: coding of the control channel position relative to
0344  *  the center frequency, see iwl_mvm_get_ctrl_pos()
0345  * @sta_id: index of the AP STA when in AP mode
0346  * @reserved1: reserved
0347  * @toa_offset: Artificial addition [pSec] for the ToA - to be used for debug
0348  *  purposes, simulating station movement by adding various values
0349  *  to this field
0350  * @common_calib: XVT: common calibration value
0351  * @specific_calib: XVT: specific calibration value
0352  * @bssid: Current AP BSSID
0353  * @r2i_ndp_params: parameters for R2I NDP.
0354  *  bits 0 - 2: max number of LTF repetitions
0355  *  bits 3 - 5: max number of spatial streams (supported values are < 2)
0356  *  bits 6 - 7: max number of total LTFs see
0357  *  &enum ieee80211_range_params_max_total_ltf
0358  * @i2r_ndp_params: parameters for I2R NDP.
0359  *  bits 0 - 2: max number of LTF repetitions
0360  *  bits 3 - 5: max number of spatial streams
0361  *  bits 6 - 7: max number of total LTFs see
0362  *  &enum ieee80211_range_params_max_total_ltf
0363  * @min_time_between_msr: for non trigger based NDP ranging, minimum time
0364  *  between measurements in milliseconds.
0365  * @max_time_between_msr: for non trigger based NDP ranging, maximum time
0366  *  between measurements in milliseconds.
0367  */
0368 struct iwl_tof_responder_config_cmd_v9 {
0369     __le32 cmd_valid_fields;
0370     __le32 responder_cfg_flags;
0371     u8 format_bw;
0372     u8 bss_color;
0373     u8 channel_num;
0374     u8 ctrl_ch_position;
0375     u8 sta_id;
0376     u8 reserved1;
0377     __le16 toa_offset;
0378     __le16 common_calib;
0379     __le16 specific_calib;
0380     u8 bssid[ETH_ALEN];
0381     u8 r2i_ndp_params;
0382     u8 i2r_ndp_params;
0383     __le16 min_time_between_msr;
0384     __le16 max_time_between_msr;
0385 } __packed; /* TOF_RESPONDER_CONFIG_CMD_API_S_VER_8 */
0386 
0387 #define IWL_LCI_CIVIC_IE_MAX_SIZE   400
0388 
0389 /**
0390  * struct iwl_tof_responder_dyn_config_cmd - Dynamic responder settings
0391  * @lci_len: The length of the 1st (LCI) part in the @lci_civic buffer
0392  * @civic_len: The length of the 2nd (CIVIC) part in the @lci_civic buffer
0393  * @lci_civic: The LCI/CIVIC buffer. LCI data (if exists) comes first, then, if
0394  *  needed, 0-padding such that the next part is dword-aligned, then CIVIC
0395  *  data (if exists) follows, and then 0-padding again to complete a
0396  *  4-multiple long buffer.
0397  */
0398 struct iwl_tof_responder_dyn_config_cmd_v2 {
0399     __le32 lci_len;
0400     __le32 civic_len;
0401     u8 lci_civic[];
0402 } __packed; /* TOF_RESPONDER_DYN_CONFIG_CMD_API_S_VER_2 */
0403 
0404 #define IWL_LCI_MAX_SIZE    160
0405 #define IWL_CIVIC_MAX_SIZE  160
0406 #define HLTK_11AZ_LEN   32
0407 
0408 /**
0409  * enum iwl_responder_dyn_cfg_valid_flags - valid flags for dyn_config_cmd
0410  * @IWL_RESPONDER_DYN_CFG_VALID_LCI: LCI data is valid
0411  * @IWL_RESPONDER_DYN_CFG_VALID_CIVIC: Civic data is valid
0412  * @IWL_RESPONDER_DYN_CFG_VALID_PASN_STA: the pasn_addr, HLTK and cipher fields
0413  *  are valid.
0414  */
0415 enum iwl_responder_dyn_cfg_valid_flags {
0416     IWL_RESPONDER_DYN_CFG_VALID_LCI = BIT(0),
0417     IWL_RESPONDER_DYN_CFG_VALID_CIVIC = BIT(1),
0418     IWL_RESPONDER_DYN_CFG_VALID_PASN_STA = BIT(2),
0419 };
0420 
0421 /**
0422  * struct iwl_tof_responder_dyn_config_cmd - Dynamic responder settings
0423  * @cipher: The negotiated cipher. see &enum iwl_location_cipher.
0424  * @valid_flags: flags indicating which fields in the command are valid. see
0425  *  &enum iwl_responder_dyn_cfg_valid_flags.
0426  * @lci_len: length of the LCI data in bytes
0427  * @civic_len: length of the Civic data in bytes
0428  * @lci_buf: the LCI buffer
0429  * @civic_buf: the Civic buffer
0430  * @hltk_buf: HLTK for secure LTF bits generation for the specified station
0431  * @addr: mac address of the station for which to use the HLTK
0432  * @reserved: for alignment
0433  */
0434 struct iwl_tof_responder_dyn_config_cmd {
0435     u8 cipher;
0436     u8 valid_flags;
0437     u8 lci_len;
0438     u8 civic_len;
0439     u8 lci_buf[IWL_LCI_MAX_SIZE];
0440     u8 civic_buf[IWL_LCI_MAX_SIZE];
0441     u8 hltk_buf[HLTK_11AZ_LEN];
0442     u8 addr[ETH_ALEN];
0443     u8 reserved[2];
0444 } __packed; /* TOF_RESPONDER_DYN_CONFIG_CMD_API_S_VER_3 */
0445 
0446 /**
0447  * struct iwl_tof_range_req_ext_cmd - extended range req for WLS
0448  * @tsf_timer_offset_msec: the recommended time offset (mSec) from the AP's TSF
0449  * @reserved: reserved
0450  * @min_delta_ftm: Minimal time between two consecutive measurements,
0451  *         in units of 100us. 0 means no preference by station
0452  * @ftm_format_and_bw20M: FTM Channel Spacing/Format for 20MHz: recommended
0453  *          value be sent to the AP
0454  * @ftm_format_and_bw40M: FTM Channel Spacing/Format for 40MHz: recommended
0455  *          value to be sent to the AP
0456  * @ftm_format_and_bw80M: FTM Channel Spacing/Format for 80MHz: recommended
0457  *          value to be sent to the AP
0458  */
0459 struct iwl_tof_range_req_ext_cmd {
0460     __le16 tsf_timer_offset_msec;
0461     __le16 reserved;
0462     u8 min_delta_ftm;
0463     u8 ftm_format_and_bw20M;
0464     u8 ftm_format_and_bw40M;
0465     u8 ftm_format_and_bw80M;
0466 } __packed;
0467 
0468 /**
0469  * enum iwl_tof_location_query - values for query bitmap
0470  * @IWL_TOF_LOC_LCI: query LCI
0471  * @IWL_TOF_LOC_CIVIC: query civic
0472  */
0473 enum iwl_tof_location_query {
0474     IWL_TOF_LOC_LCI = 0x01,
0475     IWL_TOF_LOC_CIVIC = 0x02,
0476 };
0477 
0478  /**
0479  * struct iwl_tof_range_req_ap_entry_v2 - AP configuration parameters
0480  * @channel_num: Current AP Channel
0481  * @bandwidth: Current AP Bandwidth. One of iwl_tof_bandwidth.
0482  * @tsf_delta_direction: TSF relatively to the subject AP
0483  * @ctrl_ch_position: Coding of the control channel position relative to the
0484  *  center frequency, see iwl_mvm_get_ctrl_pos().
0485  * @bssid: AP's BSSID
0486  * @measure_type: Measurement type: 0 - two sided, 1 - One sided
0487  * @num_of_bursts: Recommended value to be sent to the AP.  2s Exponent of the
0488  *  number of measurement iterations (min 2^0 = 1, max 2^14)
0489  * @burst_period: Recommended value to be sent to the AP. Measurement
0490  *  periodicity In units of 100ms. ignored if num_of_bursts = 0
0491  * @samples_per_burst: 2-sided: the number of FTMs pairs in single Burst (1-31);
0492  *  1-sided: how many rts/cts pairs should be used per burst.
0493  * @retries_per_sample: Max number of retries that the LMAC should send
0494  *  in case of no replies by the AP.
0495  * @tsf_delta: TSF Delta in units of microseconds.
0496  *  The difference between the AP TSF and the device local clock.
0497  * @location_req: Location Request Bit[0] LCI should be sent in the FTMR;
0498  *  Bit[1] Civic should be sent in the FTMR
0499  * @asap_mode: 0 - non asap mode, 1 - asap mode (not relevant for one sided)
0500  * @enable_dyn_ack: Enable Dynamic ACK BW.
0501  *  0: Initiator interact with regular AP;
0502  *  1: Initiator interact with Responder machine: need to send the
0503  *  Initiator Acks with HT 40MHz / 80MHz, since the Responder should
0504  *  use it for its ch est measurement (this flag will be set when we
0505  *  configure the opposite machine to be Responder).
0506  * @rssi: Last received value
0507  *  legal values: -128-0 (0x7f). above 0x0 indicating an invalid value.
0508  * @algo_type: &enum iwl_tof_algo_type
0509  * @notify_mcsi: &enum iwl_tof_mcsi_ntfy.
0510  * @reserved: For alignment and future use
0511  */
0512 struct iwl_tof_range_req_ap_entry_v2 {
0513     u8 channel_num;
0514     u8 bandwidth;
0515     u8 tsf_delta_direction;
0516     u8 ctrl_ch_position;
0517     u8 bssid[ETH_ALEN];
0518     u8 measure_type;
0519     u8 num_of_bursts;
0520     __le16 burst_period;
0521     u8 samples_per_burst;
0522     u8 retries_per_sample;
0523     __le32 tsf_delta;
0524     u8 location_req;
0525     u8 asap_mode;
0526     u8 enable_dyn_ack;
0527     s8 rssi;
0528     u8 algo_type;
0529     u8 notify_mcsi;
0530     __le16 reserved;
0531 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_2 */
0532 
0533 /**
0534  * enum iwl_initiator_ap_flags - per responder FTM configuration flags
0535  * @IWL_INITIATOR_AP_FLAGS_ASAP: Request for ASAP measurement.
0536  * @IWL_INITIATOR_AP_FLAGS_LCI_REQUEST: Request for LCI information
0537  * @IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST: Request for CIVIC information
0538  * @IWL_INITIATOR_AP_FLAGS_DYN_ACK: Send HT/VHT ack for FTM frames. If not set,
0539  *  20Mhz dup acks will be sent.
0540  * @IWL_INITIATOR_AP_FLAGS_ALGO_LR: Use LR algo type for rtt calculation.
0541  *  Default algo type is ML.
0542  * @IWL_INITIATOR_AP_FLAGS_ALGO_FFT: Use FFT algo type for rtt calculation.
0543  *  Default algo type is ML.
0544  * @IWL_INITIATOR_AP_FLAGS_MCSI_REPORT: Send the MCSI for each FTM frame to the
0545  *  driver.
0546  * @IWL_INITIATOR_AP_FLAGS_NON_TB: Use non trigger based flow
0547  * @IWL_INITIATOR_AP_FLAGS_TB: Use trigger based flow
0548  * @IWL_INITIATOR_AP_FLAGS_SECURED: request secure LTF measurement
0549  * @IWL_INITIATOR_AP_FLAGS_LMR_FEEDBACK: Send LMR feedback
0550  * @IWL_INITIATOR_AP_FLAGS_USE_CALIB: Use calibration values from the request
0551  *      instead of fw internal values.
0552  * @IWL_INITIATOR_AP_FLAGS_PMF: request to protect the negotiation and LMR
0553  *      frames with protected management frames.
0554  * @IWL_INITIATOR_AP_FLAGS_TERMINATE_ON_LMR_FEEDBACK: terminate the session if
0555  *  the responder asked for LMR feedback although the initiator did not set
0556  *  the LMR feedback bit in the FTM request. If not set, the initiator will
0557  *  continue with the session and will provide the LMR feedback.
0558  */
0559 enum iwl_initiator_ap_flags {
0560     IWL_INITIATOR_AP_FLAGS_ASAP = BIT(1),
0561     IWL_INITIATOR_AP_FLAGS_LCI_REQUEST = BIT(2),
0562     IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST = BIT(3),
0563     IWL_INITIATOR_AP_FLAGS_DYN_ACK = BIT(4),
0564     IWL_INITIATOR_AP_FLAGS_ALGO_LR = BIT(5),
0565     IWL_INITIATOR_AP_FLAGS_ALGO_FFT = BIT(6),
0566     IWL_INITIATOR_AP_FLAGS_MCSI_REPORT = BIT(8),
0567     IWL_INITIATOR_AP_FLAGS_NON_TB = BIT(9),
0568     IWL_INITIATOR_AP_FLAGS_TB = BIT(10),
0569     IWL_INITIATOR_AP_FLAGS_SECURED = BIT(11),
0570     IWL_INITIATOR_AP_FLAGS_LMR_FEEDBACK = BIT(12),
0571     IWL_INITIATOR_AP_FLAGS_USE_CALIB = BIT(13),
0572     IWL_INITIATOR_AP_FLAGS_PMF = BIT(14),
0573     IWL_INITIATOR_AP_FLAGS_TERMINATE_ON_LMR_FEEDBACK = BIT(15),
0574 };
0575 
0576 /**
0577  * struct iwl_tof_range_req_ap_entry_v3 - AP configuration parameters
0578  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
0579  * @channel_num: AP Channel number
0580  * @bandwidth: AP bandwidth. One of iwl_tof_bandwidth.
0581  * @ctrl_ch_position: Coding of the control channel position relative to the
0582  *  center frequency, see iwl_mvm_get_ctrl_pos().
0583  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
0584  *  reply from the AP.
0585  * @bssid: AP's BSSID
0586  * @burst_period: Recommended value to be sent to the AP. Measurement
0587  *  periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
0588  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
0589  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
0590  *  the number of measurement iterations (min 2^0 = 1, max 2^14)
0591  * @reserved: For alignment and future use
0592  * @tsf_delta: not in use
0593  */
0594 struct iwl_tof_range_req_ap_entry_v3 {
0595     __le32 initiator_ap_flags;
0596     u8 channel_num;
0597     u8 bandwidth;
0598     u8 ctrl_ch_position;
0599     u8 ftmr_max_retries;
0600     u8 bssid[ETH_ALEN];
0601     __le16 burst_period;
0602     u8 samples_per_burst;
0603     u8 num_of_bursts;
0604     __le16 reserved;
0605     __le32 tsf_delta;
0606 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_3 */
0607 
0608 /**
0609  * enum iwl_location_frame_format - location frame formats
0610  * @IWL_LOCATION_FRAME_FORMAT_LEGACY: legacy
0611  * @IWL_LOCATION_FRAME_FORMAT_HT: HT
0612  * @IWL_LOCATION_FRAME_FORMAT_VHT: VHT
0613  * @IWL_LOCATION_FRAME_FORMAT_HE: HE
0614  */
0615 enum iwl_location_frame_format {
0616     IWL_LOCATION_FRAME_FORMAT_LEGACY,
0617     IWL_LOCATION_FRAME_FORMAT_HT,
0618     IWL_LOCATION_FRAME_FORMAT_VHT,
0619     IWL_LOCATION_FRAME_FORMAT_HE,
0620 };
0621 
0622 /**
0623  * enum iwl_location_bw - location bandwidth selection
0624  * @IWL_LOCATION_BW_20MHZ: 20MHz
0625  * @IWL_LOCATION_BW_40MHZ: 40MHz
0626  * @IWL_LOCATION_BW_80MHZ: 80MHz
0627  */
0628 enum iwl_location_bw {
0629     IWL_LOCATION_BW_20MHZ,
0630     IWL_LOCATION_BW_40MHZ,
0631     IWL_LOCATION_BW_80MHZ,
0632     IWL_LOCATION_BW_160MHZ,
0633 };
0634 
0635 #define TK_11AZ_LEN 32
0636 
0637 #define LOCATION_BW_POS 4
0638 
0639 /**
0640  * struct iwl_tof_range_req_ap_entry_v4 - AP configuration parameters
0641  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
0642  * @channel_num: AP Channel number
0643  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
0644  *             bits 4 - 7: &enum iwl_location_bw.
0645  * @ctrl_ch_position: Coding of the control channel position relative to the
0646  *  center frequency, see iwl_mvm_get_ctrl_pos().
0647  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
0648  *  reply from the AP.
0649  * @bssid: AP's BSSID
0650  * @burst_period: Recommended value to be sent to the AP. Measurement
0651  *  periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
0652  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
0653  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
0654  *  the number of measurement iterations (min 2^0 = 1, max 2^14)
0655  * @reserved: For alignment and future use
0656  * @hltk: HLTK to be used for secured 11az measurement
0657  * @tk: TK to be used for secured 11az measurement
0658  */
0659 struct iwl_tof_range_req_ap_entry_v4 {
0660     __le32 initiator_ap_flags;
0661     u8 channel_num;
0662     u8 format_bw;
0663     u8 ctrl_ch_position;
0664     u8 ftmr_max_retries;
0665     u8 bssid[ETH_ALEN];
0666     __le16 burst_period;
0667     u8 samples_per_burst;
0668     u8 num_of_bursts;
0669     __le16 reserved;
0670     u8 hltk[HLTK_11AZ_LEN];
0671     u8 tk[TK_11AZ_LEN];
0672 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_4 */
0673 
0674 /**
0675  * enum iwl_location_cipher - location cipher selection
0676  * @IWL_LOCATION_CIPHER_CCMP_128: CCMP 128
0677  * @IWL_LOCATION_CIPHER_GCMP_128: GCMP 128
0678  * @IWL_LOCATION_CIPHER_GCMP_256: GCMP 256
0679  * @IWL_LOCATION_CIPHER_INVALID: security is not used.
0680  * @IWL_LOCATION_CIPHER_MAX: maximum value for this enum.
0681  */
0682 enum iwl_location_cipher {
0683     IWL_LOCATION_CIPHER_CCMP_128,
0684     IWL_LOCATION_CIPHER_GCMP_128,
0685     IWL_LOCATION_CIPHER_GCMP_256,
0686     IWL_LOCATION_CIPHER_INVALID,
0687     IWL_LOCATION_CIPHER_MAX,
0688 };
0689 
0690 /**
0691  * struct iwl_tof_range_req_ap_entry_v6 - AP configuration parameters
0692  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
0693  * @channel_num: AP Channel number
0694  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
0695  *             bits 4 - 7: &enum iwl_location_bw.
0696  * @ctrl_ch_position: Coding of the control channel position relative to the
0697  *  center frequency, see iwl_mvm_get_ctrl_pos().
0698  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
0699  *  reply from the AP.
0700  * @bssid: AP's BSSID
0701  * @burst_period: Recommended value to be sent to the AP. Measurement
0702  *  periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
0703  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
0704  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
0705  *  the number of measurement iterations (min 2^0 = 1, max 2^14)
0706  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
0707  *  otherwise should be set to &IWL_MVM_INVALID_STA.
0708  * @cipher: pairwise cipher suite for secured measurement.
0709  *          &enum iwl_location_cipher.
0710  * @hltk: HLTK to be used for secured 11az measurement
0711  * @tk: TK to be used for secured 11az measurement
0712  * @calib: An array of calibration values per FTM rx bandwidth.
0713  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
0714  *         calibration value that corresponds to the rx bandwidth of the FTM
0715  *         frame.
0716  * @beacon_interval: beacon interval of the AP in TUs. Only required if
0717  *  &IWL_INITIATOR_AP_FLAGS_TB is set.
0718  */
0719 struct iwl_tof_range_req_ap_entry_v6 {
0720     __le32 initiator_ap_flags;
0721     u8 channel_num;
0722     u8 format_bw;
0723     u8 ctrl_ch_position;
0724     u8 ftmr_max_retries;
0725     u8 bssid[ETH_ALEN];
0726     __le16 burst_period;
0727     u8 samples_per_burst;
0728     u8 num_of_bursts;
0729     u8 sta_id;
0730     u8 cipher;
0731     u8 hltk[HLTK_11AZ_LEN];
0732     u8 tk[TK_11AZ_LEN];
0733     __le16 calib[IWL_TOF_BW_NUM];
0734     __le16 beacon_interval;
0735 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_6 */
0736 
0737 /**
0738  * struct iwl_tof_range_req_ap_entry_v7 - AP configuration parameters
0739  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
0740  * @channel_num: AP Channel number
0741  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
0742  *             bits 4 - 7: &enum iwl_location_bw.
0743  * @ctrl_ch_position: Coding of the control channel position relative to the
0744  *  center frequency, see iwl_mvm_get_ctrl_pos().
0745  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
0746  *  reply from the AP.
0747  * @bssid: AP's BSSID
0748  * @burst_period: Recommended value to be sent to the AP. Measurement
0749  *  periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
0750  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
0751  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
0752  *  the number of measurement iterations (min 2^0 = 1, max 2^14)
0753  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
0754  *  otherwise should be set to &IWL_MVM_INVALID_STA.
0755  * @cipher: pairwise cipher suite for secured measurement.
0756  *          &enum iwl_location_cipher.
0757  * @hltk: HLTK to be used for secured 11az measurement
0758  * @tk: TK to be used for secured 11az measurement
0759  * @calib: An array of calibration values per FTM rx bandwidth.
0760  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
0761  *         calibration value that corresponds to the rx bandwidth of the FTM
0762  *         frame.
0763  * @beacon_interval: beacon interval of the AP in TUs. Only required if
0764  *  &IWL_INITIATOR_AP_FLAGS_TB is set.
0765  * @rx_pn: the next expected PN for protected management frames Rx. LE byte
0766  *  order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
0767  *  is set to &IWL_MVM_INVALID_STA.
0768  * @tx_pn: the next PN to use for protected management frames Tx. LE byte
0769  *  order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
0770  *  is set to &IWL_MVM_INVALID_STA.
0771  */
0772 struct iwl_tof_range_req_ap_entry_v7 {
0773     __le32 initiator_ap_flags;
0774     u8 channel_num;
0775     u8 format_bw;
0776     u8 ctrl_ch_position;
0777     u8 ftmr_max_retries;
0778     u8 bssid[ETH_ALEN];
0779     __le16 burst_period;
0780     u8 samples_per_burst;
0781     u8 num_of_bursts;
0782     u8 sta_id;
0783     u8 cipher;
0784     u8 hltk[HLTK_11AZ_LEN];
0785     u8 tk[TK_11AZ_LEN];
0786     __le16 calib[IWL_TOF_BW_NUM];
0787     __le16 beacon_interval;
0788     u8 rx_pn[IEEE80211_CCMP_PN_LEN];
0789     u8 tx_pn[IEEE80211_CCMP_PN_LEN];
0790 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_7 */
0791 
0792 #define IWL_LOCATION_MAX_STS_POS    3
0793 
0794 /**
0795  * struct iwl_tof_range_req_ap_entry_v8 - AP configuration parameters
0796  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
0797  * @channel_num: AP Channel number
0798  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
0799  *             bits 4 - 7: &enum iwl_location_bw.
0800  * @ctrl_ch_position: Coding of the control channel position relative to the
0801  *  center frequency, see iwl_mvm_get_ctrl_pos().
0802  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
0803  *  reply from the AP.
0804  * @bssid: AP's BSSID
0805  * @burst_period: Recommended value to be sent to the AP. Measurement
0806  *  periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
0807  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
0808  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
0809  *  the number of measurement iterations (min 2^0 = 1, max 2^14)
0810  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
0811  *  otherwise should be set to &IWL_MVM_INVALID_STA.
0812  * @cipher: pairwise cipher suite for secured measurement.
0813  *          &enum iwl_location_cipher.
0814  * @hltk: HLTK to be used for secured 11az measurement
0815  * @tk: TK to be used for secured 11az measurement
0816  * @calib: An array of calibration values per FTM rx bandwidth.
0817  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
0818  *         calibration value that corresponds to the rx bandwidth of the FTM
0819  *         frame.
0820  * @beacon_interval: beacon interval of the AP in TUs. Only required if
0821  *  &IWL_INITIATOR_AP_FLAGS_TB is set.
0822  * @rx_pn: the next expected PN for protected management frames Rx. LE byte
0823  *  order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
0824  *  is set to &IWL_MVM_INVALID_STA.
0825  * @tx_pn: the next PN to use for protected management frames Tx. LE byte
0826  *  order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
0827  *  is set to &IWL_MVM_INVALID_STA.
0828  * @r2i_ndp_params: parameters for R2I NDP ranging negotiation.
0829  *      bits 0 - 2: max LTF repetitions
0830  *      bits 3 - 5: max number of spatial streams
0831  *      bits 6 - 7: reserved
0832  * @i2r_ndp_params: parameters for I2R NDP ranging negotiation.
0833  *      bits 0 - 2: max LTF repetitions
0834  *      bits 3 - 5: max number of spatial streams (supported values are < 2)
0835  *      bits 6 - 7: reserved
0836  * @r2i_max_total_ltf: R2I Max Total LTFs for NDP ranging negotiation.
0837  *      One of &enum ieee80211_range_params_max_total_ltf.
0838  * @i2r_max_total_ltf: I2R Max Total LTFs for NDP ranging negotiation.
0839  *      One of &enum ieee80211_range_params_max_total_ltf.
0840  */
0841 struct iwl_tof_range_req_ap_entry_v8 {
0842     __le32 initiator_ap_flags;
0843     u8 channel_num;
0844     u8 format_bw;
0845     u8 ctrl_ch_position;
0846     u8 ftmr_max_retries;
0847     u8 bssid[ETH_ALEN];
0848     __le16 burst_period;
0849     u8 samples_per_burst;
0850     u8 num_of_bursts;
0851     u8 sta_id;
0852     u8 cipher;
0853     u8 hltk[HLTK_11AZ_LEN];
0854     u8 tk[TK_11AZ_LEN];
0855     __le16 calib[IWL_TOF_BW_NUM];
0856     __le16 beacon_interval;
0857     u8 rx_pn[IEEE80211_CCMP_PN_LEN];
0858     u8 tx_pn[IEEE80211_CCMP_PN_LEN];
0859     u8 r2i_ndp_params;
0860     u8 i2r_ndp_params;
0861     u8 r2i_max_total_ltf;
0862     u8 i2r_max_total_ltf;
0863 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_8 */
0864 
0865 /**
0866  * struct iwl_tof_range_req_ap_entry_v9 - AP configuration parameters
0867  * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
0868  * @channel_num: AP Channel number
0869  * @format_bw: bits 0 - 3: &enum iwl_location_frame_format.
0870  *             bits 4 - 7: &enum iwl_location_bw.
0871  * @ctrl_ch_position: Coding of the control channel position relative to the
0872  *  center frequency, see iwl_mvm_get_ctrl_pos().
0873  * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
0874  *  reply from the AP.
0875  * @bssid: AP's BSSID
0876  * @burst_period: For EDCA based ranging: Recommended value to be sent to the
0877  *  AP. Measurement periodicity In units of 100ms. ignored if
0878  *  num_of_bursts_exp = 0.
0879  *  For non trigger based NDP ranging, the maximum time between
0880  *  measurements in units of milliseconds.
0881  * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
0882  * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
0883  *  the number of measurement iterations (min 2^0 = 1, max 2^14)
0884  * @sta_id: the station id of the AP. Only relevant when associated to the AP,
0885  *  otherwise should be set to &IWL_MVM_INVALID_STA.
0886  * @cipher: pairwise cipher suite for secured measurement.
0887  *          &enum iwl_location_cipher.
0888  * @hltk: HLTK to be used for secured 11az measurement
0889  * @tk: TK to be used for secured 11az measurement
0890  * @calib: An array of calibration values per FTM rx bandwidth.
0891  *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
0892  *         calibration value that corresponds to the rx bandwidth of the FTM
0893  *         frame.
0894  * @beacon_interval: beacon interval of the AP in TUs. Only required if
0895  *  &IWL_INITIATOR_AP_FLAGS_TB is set.
0896  * @bss_color: the BSS color of the responder. Only valid if
0897  *  &IWL_INITIATOR_AP_FLAGS_TB or &IWL_INITIATOR_AP_FLAGS_NON_TB is set.
0898  * @rx_pn: the next expected PN for protected management frames Rx. LE byte
0899  *  order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
0900  *  is set to &IWL_MVM_INVALID_STA.
0901  * @tx_pn: the next PN to use for protected management frames Tx. LE byte
0902  *  order. Only valid if &IWL_INITIATOR_AP_FLAGS_SECURED is set and sta_id
0903  *  is set to &IWL_MVM_INVALID_STA.
0904  * @r2i_ndp_params: parameters for R2I NDP ranging negotiation.
0905  *      bits 0 - 2: max LTF repetitions
0906  *      bits 3 - 5: max number of spatial streams
0907  *      bits 6 - 7: reserved
0908  * @i2r_ndp_params: parameters for I2R NDP ranging negotiation.
0909  *      bits 0 - 2: max LTF repetitions
0910  *      bits 3 - 5: max number of spatial streams (supported values are < 2)
0911  *      bits 6 - 7: reserved
0912  * @r2i_max_total_ltf: R2I Max Total LTFs for NDP ranging negotiation.
0913  *      One of &enum ieee80211_range_params_max_total_ltf.
0914  * @i2r_max_total_ltf: I2R Max Total LTFs for NDP ranging negotiation.
0915  *      One of &enum ieee80211_range_params_max_total_ltf.
0916  * @bss_color: the BSS color of the responder. Only valid if
0917  *  &IWL_INITIATOR_AP_FLAGS_NON_TB or &IWL_INITIATOR_AP_FLAGS_TB is set.
0918  * @band: 0 for 5.2 GHz, 1 for 2.4 GHz, 2 for 6GHz
0919  * @min_time_between_msr: For non trigger based NDP ranging, the minimum time
0920  *  between measurements in units of milliseconds
0921  */
0922 struct iwl_tof_range_req_ap_entry_v9 {
0923     __le32 initiator_ap_flags;
0924     u8 channel_num;
0925     u8 format_bw;
0926     u8 ctrl_ch_position;
0927     u8 ftmr_max_retries;
0928     u8 bssid[ETH_ALEN];
0929     __le16 burst_period;
0930     u8 samples_per_burst;
0931     u8 num_of_bursts;
0932     u8 sta_id;
0933     u8 cipher;
0934     u8 hltk[HLTK_11AZ_LEN];
0935     u8 tk[TK_11AZ_LEN];
0936     __le16 calib[IWL_TOF_BW_NUM];
0937     u16 beacon_interval;
0938     u8 rx_pn[IEEE80211_CCMP_PN_LEN];
0939     u8 tx_pn[IEEE80211_CCMP_PN_LEN];
0940     u8 r2i_ndp_params;
0941     u8 i2r_ndp_params;
0942     u8 r2i_max_total_ltf;
0943     u8 i2r_max_total_ltf;
0944     u8 bss_color;
0945     u8 band;
0946     __le16 min_time_between_msr;
0947 } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_9 */
0948 
0949 /**
0950  * enum iwl_tof_response_mode
0951  * @IWL_MVM_TOF_RESPONSE_ASAP: report each AP measurement separately as soon as
0952  *                 possible (not supported for this release)
0953  * @IWL_MVM_TOF_RESPONSE_TIMEOUT: report all AP measurements as a batch upon
0954  *                timeout expiration
0955  * @IWL_MVM_TOF_RESPONSE_COMPLETE: report all AP measurements as a batch at the
0956  *                 earlier of: measurements completion / timeout
0957  *                 expiration.
0958  */
0959 enum iwl_tof_response_mode {
0960     IWL_MVM_TOF_RESPONSE_ASAP,
0961     IWL_MVM_TOF_RESPONSE_TIMEOUT,
0962     IWL_MVM_TOF_RESPONSE_COMPLETE,
0963 };
0964 
0965 /**
0966  * enum iwl_tof_initiator_flags
0967  *
0968  * @IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED: disable fast algo, meaning run
0969  *  the algo on ant A+B, instead of only one of them.
0970  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A: open RX antenna A for FTMs RX
0971  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B: open RX antenna B for FTMs RX
0972  * @IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C: open RX antenna C for FTMs RX
0973  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A: use antenna A fo TX ACKs during FTM
0974  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B: use antenna B fo TX ACKs during FTM
0975  * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C: use antenna C fo TX ACKs during FTM
0976  * @IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM: use random mac address for FTM
0977  * @IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB: use the specific calib value from
0978  *  the range request command
0979  * @IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB: use the common calib value from the
0980  *  ragne request command
0981  * @IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT: support non-asap measurements
0982  */
0983 enum iwl_tof_initiator_flags {
0984     IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED = BIT(0),
0985     IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_A = BIT(1),
0986     IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_B = BIT(2),
0987     IWL_TOF_INITIATOR_FLAGS_RX_CHAIN_SEL_C = BIT(3),
0988     IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A = BIT(4),
0989     IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B = BIT(5),
0990     IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C = BIT(6),
0991     IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM = BIT(7),
0992     IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB = BIT(15),
0993     IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB   = BIT(16),
0994     IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT = BIT(20),
0995 }; /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */
0996 
0997 #define IWL_MVM_TOF_MAX_APS 5
0998 #define IWL_MVM_TOF_MAX_TWO_SIDED_APS 5
0999 
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__ */