|
|
deb259 |
From 02a377d13809d6f5c67d03107a9e97b593ecb48d Mon Sep 17 00:00:00 2001
|
|
|
deb259 |
From: Eugene Syromiatnikov <esyr@redhat.com>
|
|
|
deb259 |
Date: Thu, 25 Jul 2019 13:53:09 +0200
|
|
|
deb259 |
Subject: [PATCH 5/7] Revert "iwlwifi: mvm: add support for new FTM fw API"
|
|
|
deb259 |
|
|
|
deb259 |
This reverts commit ff418feeec0fefb8373567c1e4e32b631587f454.
|
|
|
deb259 |
---
|
|
|
deb259 |
.../net/wireless/intel/iwlwifi/fw/api/location.h | 181 +----------
|
|
|
deb259 |
drivers/net/wireless/intel/iwlwifi/fw/file.h | 2 -
|
|
|
deb259 |
.../net/wireless/intel/iwlwifi/mvm/ftm-initiator.c | 338 ++++++---------------
|
|
|
deb259 |
3 files changed, 95 insertions(+), 426 deletions(-)
|
|
|
deb259 |
|
|
|
deb259 |
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/location.h b/drivers/net/wireless/intel/iwlwifi/fw/api/location.h
|
|
|
deb259 |
index 5dddb21c1c4d..10cac5f987e7 100644
|
|
|
deb259 |
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/location.h
|
|
|
deb259 |
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/location.h
|
|
|
deb259 |
@@ -324,7 +324,7 @@ enum iwl_tof_location_query {
|
|
|
deb259 |
};
|
|
|
deb259 |
|
|
|
deb259 |
/**
|
|
|
deb259 |
- * struct iwl_tof_range_req_ap_entry_v2 - AP configuration parameters
|
|
|
deb259 |
+ * struct iwl_tof_range_req_ap_entry - AP configuration parameters
|
|
|
deb259 |
* @channel_num: Current AP Channel
|
|
|
deb259 |
* @bandwidth: Current AP Bandwidth. One of iwl_tof_bandwidth.
|
|
|
deb259 |
* @tsf_delta_direction: TSF relatively to the subject AP
|
|
|
deb259 |
@@ -357,7 +357,7 @@ enum iwl_tof_location_query {
|
|
|
deb259 |
* @notify_mcsi: &enum iwl_tof_mcsi_ntfy.
|
|
|
deb259 |
* @reserved: For alignment and future use
|
|
|
deb259 |
*/
|
|
|
deb259 |
-struct iwl_tof_range_req_ap_entry_v2 {
|
|
|
deb259 |
+struct iwl_tof_range_req_ap_entry {
|
|
|
deb259 |
u8 channel_num;
|
|
|
deb259 |
u8 bandwidth;
|
|
|
deb259 |
u8 tsf_delta_direction;
|
|
|
deb259 |
@@ -376,62 +376,6 @@ struct iwl_tof_range_req_ap_entry_v2 {
|
|
|
deb259 |
u8 algo_type;
|
|
|
deb259 |
u8 notify_mcsi;
|
|
|
deb259 |
__le16 reserved;
|
|
|
deb259 |
-} __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_2 */
|
|
|
deb259 |
-
|
|
|
deb259 |
-/**
|
|
|
deb259 |
- * enum iwl_initiator_ap_flags - per responder FTM configuration flags
|
|
|
deb259 |
- * @IWL_INITIATOR_AP_FLAGS_ASAP: Request for ASAP measurement.
|
|
|
deb259 |
- * @IWL_INITIATOR_AP_FLAGS_LCI_REQUEST: Request for LCI information
|
|
|
deb259 |
- * @IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST: Request for CIVIC information
|
|
|
deb259 |
- * @IWL_INITIATOR_AP_FLAGS_DYN_ACK: Send HT/VHT ack for FTM frames. If not set,
|
|
|
deb259 |
- * 20Mhz dup acks will be sent.
|
|
|
deb259 |
- * @IWL_INITIATOR_AP_FLAGS_ALGO_LR: Use LR algo type for rtt calculation.
|
|
|
deb259 |
- * Default algo type is ML.
|
|
|
deb259 |
- * @IWL_INITIATOR_AP_FLAGS_ALGO_FFT: Use FFT algo type for rtt calculation.
|
|
|
deb259 |
- * Default algo type is ML.
|
|
|
deb259 |
- * @IWL_INITIATOR_AP_FLAGS_MCSI_REPORT: Send the MCSI for each FTM frame to the
|
|
|
deb259 |
- * driver.
|
|
|
deb259 |
- */
|
|
|
deb259 |
-enum iwl_initiator_ap_flags {
|
|
|
deb259 |
- IWL_INITIATOR_AP_FLAGS_ASAP = BIT(1),
|
|
|
deb259 |
- IWL_INITIATOR_AP_FLAGS_LCI_REQUEST = BIT(2),
|
|
|
deb259 |
- IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST = BIT(3),
|
|
|
deb259 |
- IWL_INITIATOR_AP_FLAGS_DYN_ACK = BIT(4),
|
|
|
deb259 |
- IWL_INITIATOR_AP_FLAGS_ALGO_LR = BIT(5),
|
|
|
deb259 |
- IWL_INITIATOR_AP_FLAGS_ALGO_FFT = BIT(6),
|
|
|
deb259 |
- IWL_INITIATOR_AP_FLAGS_MCSI_REPORT = BIT(8),
|
|
|
deb259 |
-};
|
|
|
deb259 |
-
|
|
|
deb259 |
-/**
|
|
|
deb259 |
- * struct iwl_tof_range_req_ap_entry - AP configuration parameters
|
|
|
deb259 |
- * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
|
|
|
deb259 |
- * @channel_num: AP Channel number
|
|
|
deb259 |
- * @bandwidth: AP bandwidth. One of iwl_tof_bandwidth.
|
|
|
deb259 |
- * @ctrl_ch_position: Coding of the control channel position relative to the
|
|
|
deb259 |
- * center frequency, see iwl_mvm_get_ctrl_pos().
|
|
|
deb259 |
- * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
|
|
|
deb259 |
- * reply from the AP.
|
|
|
deb259 |
- * @bssid: AP's BSSID
|
|
|
deb259 |
- * @burst_period: Recommended value to be sent to the AP. Measurement
|
|
|
deb259 |
- * periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
|
|
|
deb259 |
- * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
|
|
|
deb259 |
- * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
|
|
|
deb259 |
- * the number of measurement iterations (min 2^0 = 1, max 2^14)
|
|
|
deb259 |
- * @reserved: For alignment and future use
|
|
|
deb259 |
- * @tsf_delta: not in use
|
|
|
deb259 |
- */
|
|
|
deb259 |
-struct iwl_tof_range_req_ap_entry {
|
|
|
deb259 |
- __le32 initiator_ap_flags;
|
|
|
deb259 |
- u8 channel_num;
|
|
|
deb259 |
- u8 bandwidth;
|
|
|
deb259 |
- u8 ctrl_ch_position;
|
|
|
deb259 |
- u8 ftmr_max_retries;
|
|
|
deb259 |
- u8 bssid[ETH_ALEN];
|
|
|
deb259 |
- __le16 burst_period;
|
|
|
deb259 |
- u8 samples_per_burst;
|
|
|
deb259 |
- u8 num_of_bursts;
|
|
|
deb259 |
- __le16 reserved;
|
|
|
deb259 |
- __le32 tsf_delta;
|
|
|
deb259 |
} __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_3 */
|
|
|
deb259 |
|
|
|
deb259 |
/**
|
|
|
deb259 |
@@ -461,12 +405,10 @@ enum iwl_tof_response_mode {
|
|
|
deb259 |
* @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A: use antenna A fo TX ACKs during FTM
|
|
|
deb259 |
* @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B: use antenna B fo TX ACKs during FTM
|
|
|
deb259 |
* @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C: use antenna C fo TX ACKs during FTM
|
|
|
deb259 |
- * @IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM: use random mac address for FTM
|
|
|
deb259 |
* @IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB: use the specific calib value from
|
|
|
deb259 |
* the range request command
|
|
|
deb259 |
* @IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB: use the common calib value from the
|
|
|
deb259 |
* ragne request command
|
|
|
deb259 |
- * @IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT: support non-asap measurements
|
|
|
deb259 |
*/
|
|
|
deb259 |
enum iwl_tof_initiator_flags {
|
|
|
deb259 |
IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED = BIT(0),
|
|
|
deb259 |
@@ -476,17 +418,15 @@ enum iwl_tof_initiator_flags {
|
|
|
deb259 |
IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A = BIT(4),
|
|
|
deb259 |
IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B = BIT(5),
|
|
|
deb259 |
IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C = BIT(6),
|
|
|
deb259 |
- IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM = BIT(7),
|
|
|
deb259 |
IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB = BIT(15),
|
|
|
deb259 |
IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB = BIT(16),
|
|
|
deb259 |
- IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT = BIT(20),
|
|
|
deb259 |
}; /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */
|
|
|
deb259 |
|
|
|
deb259 |
#define IWL_MVM_TOF_MAX_APS 5
|
|
|
deb259 |
#define IWL_MVM_TOF_MAX_TWO_SIDED_APS 5
|
|
|
deb259 |
|
|
|
deb259 |
/**
|
|
|
deb259 |
- * struct iwl_tof_range_req_cmd_v5 - start measurement cmd
|
|
|
deb259 |
+ * struct iwl_tof_range_req_cmd - start measurement cmd
|
|
|
deb259 |
* @initiator_flags: see flags @ iwl_tof_initiator_flags
|
|
|
deb259 |
* @request_id: A Token incremented per request. The same Token will be
|
|
|
deb259 |
* sent back in the range response
|
|
|
deb259 |
@@ -514,7 +454,7 @@ enum iwl_tof_initiator_flags {
|
|
|
deb259 |
* @specific_calib: The specific calib value to inject to this measurement calc
|
|
|
deb259 |
* @ap: per-AP request data
|
|
|
deb259 |
*/
|
|
|
deb259 |
-struct iwl_tof_range_req_cmd_v5 {
|
|
|
deb259 |
+struct iwl_tof_range_req_cmd {
|
|
|
deb259 |
__le32 initiator_flags;
|
|
|
deb259 |
u8 request_id;
|
|
|
deb259 |
u8 initiator;
|
|
|
deb259 |
@@ -531,42 +471,10 @@ struct iwl_tof_range_req_cmd_v5 {
|
|
|
deb259 |
u8 ftm_tx_chains;
|
|
|
deb259 |
__le16 common_calib;
|
|
|
deb259 |
__le16 specific_calib;
|
|
|
deb259 |
- struct iwl_tof_range_req_ap_entry_v2 ap[IWL_MVM_TOF_MAX_APS];
|
|
|
deb259 |
+ struct iwl_tof_range_req_ap_entry ap[IWL_MVM_TOF_MAX_APS];
|
|
|
deb259 |
} __packed;
|
|
|
deb259 |
/* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */
|
|
|
deb259 |
|
|
|
deb259 |
-/**
|
|
|
deb259 |
- * struct iwl_tof_range_req_cmd - start measurement cmd
|
|
|
deb259 |
- * @initiator_flags: see flags @ iwl_tof_initiator_flags
|
|
|
deb259 |
- * @request_id: A Token incremented per request. The same Token will be
|
|
|
deb259 |
- * sent back in the range response
|
|
|
deb259 |
- * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
|
|
|
deb259 |
- * @range_req_bssid: ranging request BSSID
|
|
|
deb259 |
- * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
|
|
|
deb259 |
- * Bits set to 1 shall be randomized by the UMAC
|
|
|
deb259 |
- * @macaddr_template: MAC address template to use for non-randomized bits
|
|
|
deb259 |
- * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
|
|
|
deb259 |
- * This is the session time for completing the measurement.
|
|
|
deb259 |
- * @tsf_mac_id: report the measurement start time for each ap in terms of the
|
|
|
deb259 |
- * TSF of this mac id. 0xff to disable TSF reporting.
|
|
|
deb259 |
- * @common_calib: The common calib value to inject to this measurement calc
|
|
|
deb259 |
- * @specific_calib: The specific calib value to inject to this measurement calc
|
|
|
deb259 |
- * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
|
|
|
deb259 |
- */
|
|
|
deb259 |
-struct iwl_tof_range_req_cmd {
|
|
|
deb259 |
- __le32 initiator_flags;
|
|
|
deb259 |
- u8 request_id;
|
|
|
deb259 |
- u8 num_of_ap;
|
|
|
deb259 |
- u8 range_req_bssid[ETH_ALEN];
|
|
|
deb259 |
- u8 macaddr_mask[ETH_ALEN];
|
|
|
deb259 |
- u8 macaddr_template[ETH_ALEN];
|
|
|
deb259 |
- __le32 req_timeout_ms;
|
|
|
deb259 |
- __le32 tsf_mac_id;
|
|
|
deb259 |
- __le16 common_calib;
|
|
|
deb259 |
- __le16 specific_calib;
|
|
|
deb259 |
- struct iwl_tof_range_req_ap_entry ap[IWL_MVM_TOF_MAX_APS];
|
|
|
deb259 |
-} __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_7 */
|
|
|
deb259 |
-
|
|
|
deb259 |
/*
|
|
|
deb259 |
* enum iwl_tof_range_request_status - status of the sent request
|
|
|
deb259 |
* @IWL_TOF_RANGE_REQUEST_STATUS_SUCCESSFUL - FW successfully received the
|
|
|
deb259 |
@@ -626,7 +534,7 @@ enum iwl_tof_entry_status {
|
|
|
deb259 |
}; /* LOCATION_RANGE_RSP_AP_ENTRY_NTFY_API_S_VER_2 */
|
|
|
deb259 |
|
|
|
deb259 |
/**
|
|
|
deb259 |
- * struct iwl_tof_range_rsp_ap_entry_ntfy_v3 - AP parameters (response)
|
|
|
deb259 |
+ * struct iwl_tof_range_rsp_ap_entry_ntfy - AP parameters (response)
|
|
|
deb259 |
* @bssid: BSSID of the AP
|
|
|
deb259 |
* @measure_status: current APs measurement status, one of
|
|
|
deb259 |
* &enum iwl_tof_entry_status.
|
|
|
deb259 |
@@ -653,7 +561,7 @@ enum iwl_tof_entry_status {
|
|
|
deb259 |
* @papd_calib_output: The result of the tof papd calibration that was injected
|
|
|
deb259 |
* into the algorithm.
|
|
|
deb259 |
*/
|
|
|
deb259 |
-struct iwl_tof_range_rsp_ap_entry_ntfy_v3 {
|
|
|
deb259 |
+struct iwl_tof_range_rsp_ap_entry_ntfy {
|
|
|
deb259 |
u8 bssid[ETH_ALEN];
|
|
|
deb259 |
u8 measure_status;
|
|
|
deb259 |
u8 measure_bw;
|
|
|
deb259 |
@@ -675,59 +583,6 @@ struct iwl_tof_range_rsp_ap_entry_ntfy_v3 {
|
|
|
deb259 |
} __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_3 */
|
|
|
deb259 |
|
|
|
deb259 |
/**
|
|
|
deb259 |
- * struct iwl_tof_range_rsp_ap_entry_ntfy - AP parameters (response)
|
|
|
deb259 |
- * @bssid: BSSID of the AP
|
|
|
deb259 |
- * @measure_status: current APs measurement status, one of
|
|
|
deb259 |
- * &enum iwl_tof_entry_status.
|
|
|
deb259 |
- * @measure_bw: Current AP Bandwidth: 0 20MHz, 1 40MHz, 2 80MHz
|
|
|
deb259 |
- * @rtt: The Round Trip Time that took for the last measurement for
|
|
|
deb259 |
- * current AP [pSec]
|
|
|
deb259 |
- * @rtt_variance: The Variance of the RTT values measured for current AP
|
|
|
deb259 |
- * @rtt_spread: The Difference between the maximum and the minimum RTT
|
|
|
deb259 |
- * values measured for current AP in the current session [pSec]
|
|
|
deb259 |
- * @rssi: RSSI as uploaded in the Channel Estimation notification
|
|
|
deb259 |
- * @rssi_spread: The Difference between the maximum and the minimum RSSI values
|
|
|
deb259 |
- * measured for current AP in the current session
|
|
|
deb259 |
- * @last_burst: 1 if no more FTM sessions are scheduled for this responder
|
|
|
deb259 |
- * @refusal_period: refusal period in case of
|
|
|
deb259 |
- * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
|
|
|
deb259 |
- * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
|
|
|
deb259 |
- * uploaded by the LMAC
|
|
|
deb259 |
- * @start_tsf: measurement start time in TSF of the mac specified in the range
|
|
|
deb259 |
- * request
|
|
|
deb259 |
- * @rx_rate_n_flags: rate and flags of the last FTM frame received from this
|
|
|
deb259 |
- * responder
|
|
|
deb259 |
- * @tx_rate_n_flags: rate and flags of the last ack sent to this responder
|
|
|
deb259 |
- * @t2t3_initiator: as calculated from the algo in the initiator
|
|
|
deb259 |
- * @t1t4_responder: as calculated from the algo in the responder
|
|
|
deb259 |
- * @common_calib: Calib val that was used in for this AP measurement
|
|
|
deb259 |
- * @specific_calib: val that was used in for this AP measurement
|
|
|
deb259 |
- * @papd_calib_output: The result of the tof papd calibration that was injected
|
|
|
deb259 |
- * into the algorithm.
|
|
|
deb259 |
- */
|
|
|
deb259 |
-struct iwl_tof_range_rsp_ap_entry_ntfy {
|
|
|
deb259 |
- u8 bssid[ETH_ALEN];
|
|
|
deb259 |
- u8 measure_status;
|
|
|
deb259 |
- u8 measure_bw;
|
|
|
deb259 |
- __le32 rtt;
|
|
|
deb259 |
- __le32 rtt_variance;
|
|
|
deb259 |
- __le32 rtt_spread;
|
|
|
deb259 |
- s8 rssi;
|
|
|
deb259 |
- u8 rssi_spread;
|
|
|
deb259 |
- u8 last_burst;
|
|
|
deb259 |
- u8 refusal_period;
|
|
|
deb259 |
- __le32 timestamp;
|
|
|
deb259 |
- __le32 start_tsf;
|
|
|
deb259 |
- __le32 rx_rate_n_flags;
|
|
|
deb259 |
- __le32 tx_rate_n_flags;
|
|
|
deb259 |
- __le32 t2t3_initiator;
|
|
|
deb259 |
- __le32 t1t4_responder;
|
|
|
deb259 |
- __le16 common_calib;
|
|
|
deb259 |
- __le16 specific_calib;
|
|
|
deb259 |
- __le32 papd_calib_output;
|
|
|
deb259 |
-} __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_4 */
|
|
|
deb259 |
-
|
|
|
deb259 |
-/**
|
|
|
deb259 |
* enum iwl_tof_response_status - tof response status
|
|
|
deb259 |
*
|
|
|
deb259 |
* @IWL_TOF_RESPONSE_SUCCESS: successful range.
|
|
|
deb259 |
@@ -744,7 +599,7 @@ enum iwl_tof_response_status {
|
|
|
deb259 |
}; /* LOCATION_RNG_RSP_STATUS */
|
|
|
deb259 |
|
|
|
deb259 |
/**
|
|
|
deb259 |
- * struct iwl_tof_range_rsp_ntfy_v5 - ranging response notification
|
|
|
deb259 |
+ * struct iwl_tof_range_rsp_ntfy - ranging response notification
|
|
|
deb259 |
* @request_id: A Token ID of the corresponding Range request
|
|
|
deb259 |
* @request_status: status of current measurement session, one of
|
|
|
deb259 |
* &enum iwl_tof_response_status.
|
|
|
deb259 |
@@ -752,29 +607,13 @@ enum iwl_tof_response_status {
|
|
|
deb259 |
* @num_of_aps: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
|
|
|
deb259 |
* @ap: per-AP data
|
|
|
deb259 |
*/
|
|
|
deb259 |
-struct iwl_tof_range_rsp_ntfy_v5 {
|
|
|
deb259 |
+struct iwl_tof_range_rsp_ntfy {
|
|
|
deb259 |
u8 request_id;
|
|
|
deb259 |
u8 request_status;
|
|
|
deb259 |
u8 last_in_batch;
|
|
|
deb259 |
u8 num_of_aps;
|
|
|
deb259 |
- struct iwl_tof_range_rsp_ap_entry_ntfy_v3 ap[IWL_MVM_TOF_MAX_APS];
|
|
|
deb259 |
-} __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_5 */
|
|
|
deb259 |
-
|
|
|
deb259 |
-/**
|
|
|
deb259 |
- * struct iwl_tof_range_rsp_ntfy - ranging response notification
|
|
|
deb259 |
- * @request_id: A Token ID of the corresponding Range request
|
|
|
deb259 |
- * @num_of_aps: Number of APs results
|
|
|
deb259 |
- * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
|
|
|
deb259 |
- * @reserved: reserved
|
|
|
deb259 |
- * @ap: per-AP data
|
|
|
deb259 |
- */
|
|
|
deb259 |
-struct iwl_tof_range_rsp_ntfy {
|
|
|
deb259 |
- u8 request_id;
|
|
|
deb259 |
- u8 num_of_aps;
|
|
|
deb259 |
- u8 last_report;
|
|
|
deb259 |
- u8 reserved;
|
|
|
deb259 |
struct iwl_tof_range_rsp_ap_entry_ntfy ap[IWL_MVM_TOF_MAX_APS];
|
|
|
deb259 |
-} __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_6 */
|
|
|
deb259 |
+} __packed;
|
|
|
deb259 |
|
|
|
deb259 |
#define IWL_MVM_TOF_MCSI_BUF_SIZE (245)
|
|
|
deb259 |
/**
|
|
|
deb259 |
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/file.h b/drivers/net/wireless/intel/iwlwifi/fw/file.h
|
|
|
deb259 |
index de9243d30135..c26cf2a2ea02 100644
|
|
|
deb259 |
--- a/drivers/net/wireless/intel/iwlwifi/fw/file.h
|
|
|
deb259 |
+++ b/drivers/net/wireless/intel/iwlwifi/fw/file.h
|
|
|
deb259 |
@@ -9,7 +9,6 @@
|
|
|
deb259 |
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
|
|
|
deb259 |
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH
|
|
|
deb259 |
* Copyright(c) 2018 Intel Corporation
|
|
|
deb259 |
- * Copyright(c) 2019 Intel Corporation
|
|
|
deb259 |
*
|
|
|
deb259 |
* This program is free software; you can redistribute it and/or modify
|
|
|
deb259 |
* it under the terms of version 2 of the GNU General Public License as
|
|
|
deb259 |
@@ -33,7 +32,6 @@
|
|
|
deb259 |
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
|
|
|
deb259 |
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH
|
|
|
deb259 |
* Copyright(c) 2018 Intel Corporation
|
|
|
deb259 |
- * Copyright(c) 2019 Intel Corporation
|
|
|
deb259 |
* All rights reserved.
|
|
|
deb259 |
*
|
|
|
deb259 |
* Redistribution and use in source and binary forms, with or without
|
|
|
deb259 |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
|
|
|
deb259 |
index c1d9703ab40c..eb6f084a0f8a 100644
|
|
|
deb259 |
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
|
|
|
deb259 |
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
|
|
|
deb259 |
@@ -132,225 +132,92 @@ iwl_ftm_range_request_status_to_err(enum iwl_tof_range_request_status s)
|
|
|
deb259 |
}
|
|
|
deb259 |
}
|
|
|
deb259 |
|
|
|
deb259 |
-static void iwl_mvm_ftm_cmd_v5(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
|
|
|
deb259 |
- struct iwl_tof_range_req_cmd_v5 *cmd,
|
|
|
deb259 |
- struct cfg80211_pmsr_request *req)
|
|
|
deb259 |
-{
|
|
|
deb259 |
- int i;
|
|
|
deb259 |
-
|
|
|
deb259 |
- cmd->request_id = req->cookie;
|
|
|
deb259 |
- cmd->num_of_ap = req->n_peers;
|
|
|
deb259 |
-
|
|
|
deb259 |
- /* use maximum for "no timeout" or bigger than what we can do */
|
|
|
deb259 |
- if (!req->timeout || req->timeout > 255 * 100)
|
|
|
deb259 |
- cmd->req_timeout = 255;
|
|
|
deb259 |
- else
|
|
|
deb259 |
- cmd->req_timeout = DIV_ROUND_UP(req->timeout, 100);
|
|
|
deb259 |
-
|
|
|
deb259 |
- /*
|
|
|
deb259 |
- * We treat it always as random, since if not we'll
|
|
|
deb259 |
- * have filled our local address there instead.
|
|
|
deb259 |
- */
|
|
|
deb259 |
- cmd->macaddr_random = 1;
|
|
|
deb259 |
- memcpy(cmd->macaddr_template, req->mac_addr, ETH_ALEN);
|
|
|
deb259 |
- for (i = 0; i < ETH_ALEN; i++)
|
|
|
deb259 |
- cmd->macaddr_mask[i] = ~req->mac_addr_mask[i];
|
|
|
deb259 |
-
|
|
|
deb259 |
- if (vif->bss_conf.assoc)
|
|
|
deb259 |
- memcpy(cmd->range_req_bssid, vif->bss_conf.bssid, ETH_ALEN);
|
|
|
deb259 |
- else
|
|
|
deb259 |
- eth_broadcast_addr(cmd->range_req_bssid);
|
|
|
deb259 |
-}
|
|
|
deb259 |
-
|
|
|
deb259 |
-static void iwl_mvm_ftm_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
|
|
|
deb259 |
- struct iwl_tof_range_req_cmd *cmd,
|
|
|
deb259 |
- struct cfg80211_pmsr_request *req)
|
|
|
deb259 |
-{
|
|
|
deb259 |
- int i;
|
|
|
deb259 |
-
|
|
|
deb259 |
- cmd->initiator_flags =
|
|
|
deb259 |
- cpu_to_le32(IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM |
|
|
|
deb259 |
- IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT);
|
|
|
deb259 |
- cmd->request_id = req->cookie;
|
|
|
deb259 |
- cmd->num_of_ap = req->n_peers;
|
|
|
deb259 |
-
|
|
|
deb259 |
- /*
|
|
|
deb259 |
- * Use a large value for "no timeout". Don't use the maximum value
|
|
|
deb259 |
- * because of fw limitations.
|
|
|
deb259 |
- */
|
|
|
deb259 |
- if (req->timeout)
|
|
|
deb259 |
- cmd->req_timeout_ms = cpu_to_le32(req->timeout);
|
|
|
deb259 |
- else
|
|
|
deb259 |
- cmd->req_timeout_ms = cpu_to_le32(0xfffff);
|
|
|
deb259 |
-
|
|
|
deb259 |
- memcpy(cmd->macaddr_template, req->mac_addr, ETH_ALEN);
|
|
|
deb259 |
- for (i = 0; i < ETH_ALEN; i++)
|
|
|
deb259 |
- cmd->macaddr_mask[i] = ~req->mac_addr_mask[i];
|
|
|
deb259 |
-
|
|
|
deb259 |
- if (vif->bss_conf.assoc)
|
|
|
deb259 |
- memcpy(cmd->range_req_bssid, vif->bss_conf.bssid, ETH_ALEN);
|
|
|
deb259 |
- else
|
|
|
deb259 |
- eth_broadcast_addr(cmd->range_req_bssid);
|
|
|
deb259 |
-
|
|
|
deb259 |
- /* TODO: fill in tsf_mac_id if needed */
|
|
|
deb259 |
- cmd->tsf_mac_id = cpu_to_le32(0xff);
|
|
|
deb259 |
-}
|
|
|
deb259 |
-
|
|
|
deb259 |
-static int iwl_mvm_ftm_target_chandef(struct iwl_mvm *mvm,
|
|
|
deb259 |
- struct cfg80211_pmsr_request_peer *peer,
|
|
|
deb259 |
- u8 *channel, u8 *bandwidth,
|
|
|
deb259 |
- u8 *ctrl_ch_position)
|
|
|
deb259 |
-{
|
|
|
deb259 |
- u32 freq = peer->chandef.chan->center_freq;
|
|
|
deb259 |
-
|
|
|
deb259 |
- *channel = ieee80211_frequency_to_channel(freq);
|
|
|
deb259 |
-
|
|
|
deb259 |
- switch (peer->chandef.width) {
|
|
|
deb259 |
- case NL80211_CHAN_WIDTH_20_NOHT:
|
|
|
deb259 |
- *bandwidth = IWL_TOF_BW_20_LEGACY;
|
|
|
deb259 |
- break;
|
|
|
deb259 |
- case NL80211_CHAN_WIDTH_20:
|
|
|
deb259 |
- *bandwidth = IWL_TOF_BW_20_HT;
|
|
|
deb259 |
- break;
|
|
|
deb259 |
- case NL80211_CHAN_WIDTH_40:
|
|
|
deb259 |
- *bandwidth = IWL_TOF_BW_40;
|
|
|
deb259 |
- break;
|
|
|
deb259 |
- case NL80211_CHAN_WIDTH_80:
|
|
|
deb259 |
- *bandwidth = IWL_TOF_BW_80;
|
|
|
deb259 |
- break;
|
|
|
deb259 |
- default:
|
|
|
deb259 |
- IWL_ERR(mvm, "Unsupported BW in FTM request (%d)\n",
|
|
|
deb259 |
- peer->chandef.width);
|
|
|
deb259 |
- return -EINVAL;
|
|
|
deb259 |
- }
|
|
|
deb259 |
-
|
|
|
deb259 |
- *ctrl_ch_position = (peer->chandef.width > NL80211_CHAN_WIDTH_20) ?
|
|
|
deb259 |
- iwl_mvm_get_ctrl_pos(&peer->chandef) : 0;
|
|
|
deb259 |
-
|
|
|
deb259 |
- return 0;
|
|
|
deb259 |
-}
|
|
|
deb259 |
-
|
|
|
deb259 |
-static int
|
|
|
deb259 |
-iwl_mvm_ftm_put_target_v2(struct iwl_mvm *mvm,
|
|
|
deb259 |
- struct cfg80211_pmsr_request_peer *peer,
|
|
|
deb259 |
- struct iwl_tof_range_req_ap_entry_v2 *target)
|
|
|
deb259 |
-{
|
|
|
deb259 |
- int ret;
|
|
|
deb259 |
-
|
|
|
deb259 |
- ret = iwl_mvm_ftm_target_chandef(mvm, peer, &target->channel_num,
|
|
|
deb259 |
- &target->bandwidth,
|
|
|
deb259 |
- &target->ctrl_ch_position);
|
|
|
deb259 |
- if (ret)
|
|
|
deb259 |
- return ret;
|
|
|
deb259 |
-
|
|
|
deb259 |
- memcpy(target->bssid, peer->addr, ETH_ALEN);
|
|
|
deb259 |
- target->burst_period =
|
|
|
deb259 |
- cpu_to_le16(peer->ftm.burst_period);
|
|
|
deb259 |
- target->samples_per_burst = peer->ftm.ftms_per_burst;
|
|
|
deb259 |
- target->num_of_bursts = peer->ftm.num_bursts_exp;
|
|
|
deb259 |
- target->measure_type = 0; /* regular two-sided FTM */
|
|
|
deb259 |
- target->retries_per_sample = peer->ftm.ftmr_retries;
|
|
|
deb259 |
- target->asap_mode = peer->ftm.asap;
|
|
|
deb259 |
- target->enable_dyn_ack = IWL_MVM_FTM_INITIATOR_DYNACK;
|
|
|
deb259 |
-
|
|
|
deb259 |
- if (peer->ftm.request_lci)
|
|
|
deb259 |
- target->location_req |= IWL_TOF_LOC_LCI;
|
|
|
deb259 |
- if (peer->ftm.request_civicloc)
|
|
|
deb259 |
- target->location_req |= IWL_TOF_LOC_CIVIC;
|
|
|
deb259 |
-
|
|
|
deb259 |
- target->algo_type = IWL_MVM_FTM_INITIATOR_ALGO;
|
|
|
deb259 |
-
|
|
|
deb259 |
- return 0;
|
|
|
deb259 |
-}
|
|
|
deb259 |
-
|
|
|
deb259 |
-#define FTM_PUT_FLAG(flag) (target->initiator_ap_flags |= \
|
|
|
deb259 |
- cpu_to_le32(IWL_INITIATOR_AP_FLAGS_##flag))
|
|
|
deb259 |
-
|
|
|
deb259 |
-static int iwl_mvm_ftm_put_target(struct iwl_mvm *mvm,
|
|
|
deb259 |
- struct cfg80211_pmsr_request_peer *peer,
|
|
|
deb259 |
- struct iwl_tof_range_req_ap_entry *target)
|
|
|
deb259 |
-{
|
|
|
deb259 |
- int ret;
|
|
|
deb259 |
-
|
|
|
deb259 |
- ret = iwl_mvm_ftm_target_chandef(mvm, peer, &target->channel_num,
|
|
|
deb259 |
- &target->bandwidth,
|
|
|
deb259 |
- &target->ctrl_ch_position);
|
|
|
deb259 |
- if (ret)
|
|
|
deb259 |
- return ret;
|
|
|
deb259 |
-
|
|
|
deb259 |
- memcpy(target->bssid, peer->addr, ETH_ALEN);
|
|
|
deb259 |
- target->burst_period =
|
|
|
deb259 |
- cpu_to_le16(peer->ftm.burst_period);
|
|
|
deb259 |
- target->samples_per_burst = peer->ftm.ftms_per_burst;
|
|
|
deb259 |
- target->num_of_bursts = peer->ftm.num_bursts_exp;
|
|
|
deb259 |
- target->ftmr_max_retries = peer->ftm.ftmr_retries;
|
|
|
deb259 |
- target->initiator_ap_flags = cpu_to_le32(0);
|
|
|
deb259 |
-
|
|
|
deb259 |
- if (peer->ftm.asap)
|
|
|
deb259 |
- FTM_PUT_FLAG(ASAP);
|
|
|
deb259 |
-
|
|
|
deb259 |
- if (peer->ftm.request_lci)
|
|
|
deb259 |
- FTM_PUT_FLAG(LCI_REQUEST);
|
|
|
deb259 |
-
|
|
|
deb259 |
- if (peer->ftm.request_civicloc)
|
|
|
deb259 |
- FTM_PUT_FLAG(CIVIC_REQUEST);
|
|
|
deb259 |
-
|
|
|
deb259 |
- if (IWL_MVM_FTM_INITIATOR_DYNACK)
|
|
|
deb259 |
- FTM_PUT_FLAG(DYN_ACK);
|
|
|
deb259 |
-
|
|
|
deb259 |
- if (IWL_MVM_FTM_INITIATOR_ALGO == IWL_TOF_ALGO_TYPE_LINEAR_REG)
|
|
|
deb259 |
- FTM_PUT_FLAG(ALGO_LR);
|
|
|
deb259 |
- else if (IWL_MVM_FTM_INITIATOR_ALGO == IWL_TOF_ALGO_TYPE_FFT)
|
|
|
deb259 |
- FTM_PUT_FLAG(ALGO_FFT);
|
|
|
deb259 |
-
|
|
|
deb259 |
- return 0;
|
|
|
deb259 |
-}
|
|
|
deb259 |
-
|
|
|
deb259 |
int iwl_mvm_ftm_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
|
|
|
deb259 |
struct cfg80211_pmsr_request *req)
|
|
|
deb259 |
{
|
|
|
deb259 |
- struct iwl_tof_range_req_cmd_v5 cmd_v5;
|
|
|
deb259 |
- struct iwl_tof_range_req_cmd cmd;
|
|
|
deb259 |
- bool new_api = fw_has_api(&mvm->fw->ucode_capa,
|
|
|
deb259 |
- IWL_UCODE_TLV_API_FTM_NEW_RANGE_REQ);
|
|
|
deb259 |
- u8 num_of_ap;
|
|
|
deb259 |
+ struct iwl_tof_range_req_cmd cmd = {
|
|
|
deb259 |
+ .request_id = req->cookie,
|
|
|
deb259 |
+ .req_timeout = DIV_ROUND_UP(req->timeout, 100),
|
|
|
deb259 |
+ .num_of_ap = req->n_peers,
|
|
|
deb259 |
+ /*
|
|
|
deb259 |
+ * We treat it always as random, since if not we'll
|
|
|
deb259 |
+ * have filled our local address there instead.
|
|
|
deb259 |
+ */
|
|
|
deb259 |
+ .macaddr_random = 1,
|
|
|
deb259 |
+ };
|
|
|
deb259 |
struct iwl_host_cmd hcmd = {
|
|
|
deb259 |
.id = iwl_cmd_id(TOF_RANGE_REQ_CMD, LOCATION_GROUP, 0),
|
|
|
deb259 |
+ .data[0] = &cmd,
|
|
|
deb259 |
+ .len[0] = sizeof(cmd),
|
|
|
deb259 |
.dataflags[0] = IWL_HCMD_DFL_DUP,
|
|
|
deb259 |
};
|
|
|
deb259 |
u32 status = 0;
|
|
|
deb259 |
int err, i;
|
|
|
deb259 |
|
|
|
deb259 |
+ /* use maximum for "no timeout" or bigger than what we can do */
|
|
|
deb259 |
+ if (!req->timeout || req->timeout > 255 * 100)
|
|
|
deb259 |
+ cmd.req_timeout = 255;
|
|
|
deb259 |
+
|
|
|
deb259 |
lockdep_assert_held(&mvm->mutex);
|
|
|
deb259 |
|
|
|
deb259 |
if (mvm->ftm_initiator.req)
|
|
|
deb259 |
return -EBUSY;
|
|
|
deb259 |
|
|
|
deb259 |
- if (new_api) {
|
|
|
deb259 |
- iwl_mvm_ftm_cmd(mvm, vif, &cmd, req);
|
|
|
deb259 |
- hcmd.data[0] = &cm;;
|
|
|
deb259 |
- hcmd.len[0] = sizeof(cmd);
|
|
|
deb259 |
- num_of_ap = cmd.num_of_ap;
|
|
|
deb259 |
- } else {
|
|
|
deb259 |
- iwl_mvm_ftm_cmd_v5(mvm, vif, &cmd_v5, req);
|
|
|
deb259 |
- hcmd.data[0] = &cmd_v5;
|
|
|
deb259 |
- hcmd.len[0] = sizeof(cmd_v5);
|
|
|
deb259 |
- num_of_ap = cmd_v5.num_of_ap;
|
|
|
deb259 |
- }
|
|
|
deb259 |
+ memcpy(cmd.macaddr_template, req->mac_addr, ETH_ALEN);
|
|
|
deb259 |
+ for (i = 0; i < ETH_ALEN; i++)
|
|
|
deb259 |
+ cmd.macaddr_mask[i] = ~req->mac_addr_mask[i];
|
|
|
deb259 |
|
|
|
deb259 |
- for (i = 0; i < num_of_ap; i++) {
|
|
|
deb259 |
+ for (i = 0; i < cmd.num_of_ap; i++) {
|
|
|
deb259 |
struct cfg80211_pmsr_request_peer *peer = &req->peers[i];
|
|
|
deb259 |
+ struct iwl_tof_range_req_ap_entry *cmd_target = &cmd.ap[i];
|
|
|
deb259 |
+ u32 freq = peer->chandef.chan->center_freq;
|
|
|
deb259 |
|
|
|
deb259 |
- if (new_api)
|
|
|
deb259 |
- err = iwl_mvm_ftm_put_target(mvm, peer, &cmd.ap[i]);
|
|
|
deb259 |
- else
|
|
|
deb259 |
- err = iwl_mvm_ftm_put_target_v2(mvm, peer,
|
|
|
deb259 |
- &cmd_v5.ap[i]);
|
|
|
deb259 |
-
|
|
|
deb259 |
- if (err)
|
|
|
deb259 |
- return err;
|
|
|
deb259 |
+ cmd_target->channel_num = ieee80211_frequency_to_channel(freq);
|
|
|
deb259 |
+ switch (peer->chandef.width) {
|
|
|
deb259 |
+ case NL80211_CHAN_WIDTH_20_NOHT:
|
|
|
deb259 |
+ cmd_target->bandwidth = IWL_TOF_BW_20_LEGACY;
|
|
|
deb259 |
+ break;
|
|
|
deb259 |
+ case NL80211_CHAN_WIDTH_20:
|
|
|
deb259 |
+ cmd_target->bandwidth = IWL_TOF_BW_20_HT;
|
|
|
deb259 |
+ break;
|
|
|
deb259 |
+ case NL80211_CHAN_WIDTH_40:
|
|
|
deb259 |
+ cmd_target->bandwidth = IWL_TOF_BW_40;
|
|
|
deb259 |
+ break;
|
|
|
deb259 |
+ case NL80211_CHAN_WIDTH_80:
|
|
|
deb259 |
+ cmd_target->bandwidth = IWL_TOF_BW_80;
|
|
|
deb259 |
+ break;
|
|
|
deb259 |
+ default:
|
|
|
deb259 |
+ IWL_ERR(mvm, "Unsupported BW in FTM request (%d)\n",
|
|
|
deb259 |
+ peer->chandef.width);
|
|
|
deb259 |
+ return -EINVAL;
|
|
|
deb259 |
+ }
|
|
|
deb259 |
+ cmd_target->ctrl_ch_position =
|
|
|
deb259 |
+ (peer->chandef.width > NL80211_CHAN_WIDTH_20) ?
|
|
|
deb259 |
+ iwl_mvm_get_ctrl_pos(&peer->chandef) : 0;
|
|
|
deb259 |
+
|
|
|
deb259 |
+ memcpy(cmd_target->bssid, peer->addr, ETH_ALEN);
|
|
|
deb259 |
+ cmd_target->measure_type = 0; /* regular two-sided FTM */
|
|
|
deb259 |
+ cmd_target->num_of_bursts = peer->ftm.num_bursts_exp;
|
|
|
deb259 |
+ cmd_target->burst_period =
|
|
|
deb259 |
+ cpu_to_le16(peer->ftm.burst_period);
|
|
|
deb259 |
+ cmd_target->samples_per_burst = peer->ftm.ftms_per_burst;
|
|
|
deb259 |
+ cmd_target->retries_per_sample = peer->ftm.ftmr_retries;
|
|
|
deb259 |
+ cmd_target->asap_mode = peer->ftm.asap;
|
|
|
deb259 |
+ cmd_target->enable_dyn_ack = IWL_MVM_FTM_INITIATOR_DYNACK;
|
|
|
deb259 |
+
|
|
|
deb259 |
+ if (peer->ftm.request_lci)
|
|
|
deb259 |
+ cmd_target->location_req |= IWL_TOF_LOC_LCI;
|
|
|
deb259 |
+ if (peer->ftm.request_civicloc)
|
|
|
deb259 |
+ cmd_target->location_req |= IWL_TOF_LOC_CIVIC;
|
|
|
deb259 |
+
|
|
|
deb259 |
+ cmd_target->algo_type = IWL_MVM_FTM_INITIATOR_ALGO;
|
|
|
deb259 |
}
|
|
|
deb259 |
|
|
|
deb259 |
+ if (vif->bss_conf.assoc)
|
|
|
deb259 |
+ memcpy(cmd.range_req_bssid, vif->bss_conf.bssid, ETH_ALEN);
|
|
|
deb259 |
+ else
|
|
|
deb259 |
+ eth_broadcast_addr(cmd.range_req_bssid);
|
|
|
deb259 |
+
|
|
|
deb259 |
err = iwl_mvm_send_cmd_status(mvm, &hcmd, &status);
|
|
|
deb259 |
if (!err && status) {
|
|
|
deb259 |
IWL_ERR(mvm, "FTM range request command failure, status: %u\n",
|
|
|
deb259 |
@@ -438,34 +305,11 @@ static void iwl_mvm_ftm_get_lci_civic(struct iwl_mvm *mvm,
|
|
|
deb259 |
}
|
|
|
deb259 |
}
|
|
|
deb259 |
|
|
|
deb259 |
-static int iwl_mvm_ftm_range_resp_valid(struct iwl_mvm *mvm, u8 request_id,
|
|
|
deb259 |
- u8 num_of_aps)
|
|
|
deb259 |
-{
|
|
|
deb259 |
- lockdep_assert_held(&mvm->mutex);
|
|
|
deb259 |
-
|
|
|
deb259 |
- if (request_id != (u8)mvm->ftm_initiator.req->cookie) {
|
|
|
deb259 |
- IWL_ERR(mvm, "Request ID mismatch, got %u, active %u\n",
|
|
|
deb259 |
- request_id, (u8)mvm->ftm_initiator.req->cookie);
|
|
|
deb259 |
- return -EINVAL;
|
|
|
deb259 |
- }
|
|
|
deb259 |
-
|
|
|
deb259 |
- if (num_of_aps > mvm->ftm_initiator.req->n_peers) {
|
|
|
deb259 |
- IWL_ERR(mvm, "FTM range response invalid\n");
|
|
|
deb259 |
- return -EINVAL;
|
|
|
deb259 |
- }
|
|
|
deb259 |
-
|
|
|
deb259 |
- return 0;
|
|
|
deb259 |
-}
|
|
|
deb259 |
-
|
|
|
deb259 |
void iwl_mvm_ftm_range_resp(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
|
|
|
deb259 |
{
|
|
|
deb259 |
struct iwl_rx_packet *pkt = rxb_addr(rxb);
|
|
|
deb259 |
- struct iwl_tof_range_rsp_ntfy_v5 *fw_resp_v5 = (void *)pkt->data;
|
|
|
deb259 |
struct iwl_tof_range_rsp_ntfy *fw_resp = (void *)pkt->data;
|
|
|
deb259 |
int i;
|
|
|
deb259 |
- bool new_api = fw_has_api(&mvm->fw->ucode_capa,
|
|
|
deb259 |
- IWL_UCODE_TLV_API_FTM_NEW_RANGE_REQ);
|
|
|
deb259 |
- u8 num_of_aps, last_in_batch;
|
|
|
deb259 |
|
|
|
deb259 |
lockdep_assert_held(&mvm->mutex);
|
|
|
deb259 |
|
|
|
deb259 |
@@ -474,46 +318,28 @@ void iwl_mvm_ftm_range_resp(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
|
|
|
deb259 |
return;
|
|
|
deb259 |
}
|
|
|
deb259 |
|
|
|
deb259 |
- if (new_api) {
|
|
|
deb259 |
- if (iwl_mvm_ftm_range_resp_valid(mvm, fw_resp->request_id,
|
|
|
deb259 |
- fw_resp->num_of_aps))
|
|
|
deb259 |
- return;
|
|
|
deb259 |
-
|
|
|
deb259 |
- num_of_aps = fw_resp->num_of_aps;
|
|
|
deb259 |
- last_in_batch = fw_resp->last_report;
|
|
|
deb259 |
- } else {
|
|
|
deb259 |
- if (iwl_mvm_ftm_range_resp_valid(mvm, fw_resp_v5->request_id,
|
|
|
deb259 |
- fw_resp_v5->num_of_aps))
|
|
|
deb259 |
- return;
|
|
|
deb259 |
+ if (fw_resp->request_id != (u8)mvm->ftm_initiator.req->cookie) {
|
|
|
deb259 |
+ IWL_ERR(mvm, "Request ID mismatch, got %u, active %u\n",
|
|
|
deb259 |
+ fw_resp->request_id,
|
|
|
deb259 |
+ (u8)mvm->ftm_initiator.req->cookie);
|
|
|
deb259 |
+ return;
|
|
|
deb259 |
+ }
|
|
|
deb259 |
|
|
|
deb259 |
- num_of_aps = fw_resp_v5->num_of_aps;
|
|
|
deb259 |
- last_in_batch = fw_resp_v5->last_in_batch;
|
|
|
deb259 |
+ if (fw_resp->num_of_aps > mvm->ftm_initiator.req->n_peers) {
|
|
|
deb259 |
+ IWL_ERR(mvm, "FTM range response invalid\n");
|
|
|
deb259 |
+ return;
|
|
|
deb259 |
}
|
|
|
deb259 |
|
|
|
deb259 |
- for (i = 0; i < num_of_aps && i < IWL_MVM_TOF_MAX_APS; i++) {
|
|
|
deb259 |
+ for (i = 0; i < fw_resp->num_of_aps && i < IWL_MVM_TOF_MAX_APS; i++) {
|
|
|
deb259 |
+ struct iwl_tof_range_rsp_ap_entry_ntfy *fw_ap = &fw_resp->ap[i];
|
|
|
deb259 |
struct cfg80211_pmsr_result result = {};
|
|
|
deb259 |
- struct iwl_tof_range_rsp_ap_entry_ntfy *fw_ap;
|
|
|
deb259 |
int peer_idx;
|
|
|
deb259 |
|
|
|
deb259 |
- if (new_api) {
|
|
|
deb259 |
- fw_ap = &fw_resp->ap[i];
|
|
|
deb259 |
- result.final = fw_resp->ap[i].last_burst;
|
|
|
deb259 |
- } else {
|
|
|
deb259 |
- /* the first part is the same for old and new APIs */
|
|
|
deb259 |
- fw_ap = (void *)&fw_resp_v5->ap[i];
|
|
|
deb259 |
- /*
|
|
|
deb259 |
- * FIXME: the firmware needs to report this, we don't
|
|
|
deb259 |
- * even know the number of bursts the responder picked
|
|
|
deb259 |
- * (if we asked it to)
|
|
|
deb259 |
- */
|
|
|
deb259 |
- result.final = 0;
|
|
|
deb259 |
- }
|
|
|
deb259 |
-
|
|
|
deb259 |
peer_idx = iwl_mvm_ftm_find_peer(mvm->ftm_initiator.req,
|
|
|
deb259 |
fw_ap->bssid);
|
|
|
deb259 |
if (peer_idx < 0) {
|
|
|
deb259 |
IWL_WARN(mvm,
|
|
|
deb259 |
- "Unknown address (%pM, target #%d) in FTM response\n",
|
|
|
deb259 |
+ "Unknown address (%pM, target #%d) in FTM response.\n",
|
|
|
deb259 |
fw_ap->bssid, i);
|
|
|
deb259 |
continue;
|
|
|
deb259 |
}
|
|
|
deb259 |
@@ -548,6 +374,12 @@ void iwl_mvm_ftm_range_resp(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
|
|
|
deb259 |
result.type = NL80211_PMSR_TYPE_FTM;
|
|
|
deb259 |
result.ftm.burst_index = mvm->ftm_initiator.responses[peer_idx];
|
|
|
deb259 |
mvm->ftm_initiator.responses[peer_idx]++;
|
|
|
deb259 |
+ /*
|
|
|
deb259 |
+ * FIXME: the firmware needs to report this, we don't even know
|
|
|
deb259 |
+ * the number of bursts the responder picked (if we asked
|
|
|
deb259 |
+ * it to)
|
|
|
deb259 |
+ */
|
|
|
deb259 |
+ result.final = 0;
|
|
|
deb259 |
result.ftm.rssi_avg = fw_ap->rssi;
|
|
|
deb259 |
result.ftm.rssi_avg_valid = 1;
|
|
|
deb259 |
result.ftm.rssi_spread = fw_ap->rssi_spread;
|
|
|
deb259 |
@@ -566,7 +398,7 @@ void iwl_mvm_ftm_range_resp(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
|
|
|
deb259 |
&result, GFP_KERNEL);
|
|
|
deb259 |
}
|
|
|
deb259 |
|
|
|
deb259 |
- if (last_in_batch) {
|
|
|
deb259 |
+ if (fw_resp->last_in_batch) {
|
|
|
deb259 |
cfg80211_pmsr_complete(mvm->ftm_initiator.req_wdev,
|
|
|
deb259 |
mvm->ftm_initiator.req,
|
|
|
deb259 |
GFP_KERNEL);
|
|
|
deb259 |
--
|
|
|
deb259 |
2.13.6
|
|
|
deb259 |
|