Commit 018971b1 authored by Avraham Stern's avatar Avraham Stern Committed by Luca Coelho

iwlwifi: mvm: add support for range request version 10

Range request version 10 keeps the same command size as version 9
but uses 2 reserved fields for the responder beacon interval and
station id (if exists).
For now, since the beacon interval of unassoc APs is unknown, use
a value of 100 TUs which is a common value for many APs.

While at it, remove the definition for CCMP_256 cipher, since this
is not supported.
Signed-off-by: default avatarAvraham Stern <avraham.stern@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200529092401.b7ccdad0805f.I59ea7f773caed85a66c61401066ae169008442e6@changeid
parent f327236d
...@@ -550,13 +550,11 @@ struct iwl_tof_range_req_ap_entry_v4 { ...@@ -550,13 +550,11 @@ struct iwl_tof_range_req_ap_entry_v4 {
/** /**
* enum iwl_location_cipher - location cipher selection * enum iwl_location_cipher - location cipher selection
* @IWL_LOCATION_CIPHER_CCMP_128: CCMP 128 * @IWL_LOCATION_CIPHER_CCMP_128: CCMP 128
* @IWL_LOCATION_CIPHER_CCMP_256: CCMP 256
* @IWL_LOCATION_CIPHER_GCMP_128: GCMP 128 * @IWL_LOCATION_CIPHER_GCMP_128: GCMP 128
* @IWL_LOCATION_CIPHER_GCMP_256: GCMP 256 * @IWL_LOCATION_CIPHER_GCMP_256: GCMP 256
*/ */
enum iwl_location_cipher { enum iwl_location_cipher {
IWL_LOCATION_CIPHER_CCMP_128, IWL_LOCATION_CIPHER_CCMP_128,
IWL_LOCATION_CIPHER_CCMP_256,
IWL_LOCATION_CIPHER_GCMP_128, IWL_LOCATION_CIPHER_GCMP_128,
IWL_LOCATION_CIPHER_GCMP_256, IWL_LOCATION_CIPHER_GCMP_256,
}; };
...@@ -577,7 +575,8 @@ enum iwl_location_cipher { ...@@ -577,7 +575,8 @@ enum iwl_location_cipher {
* @samples_per_burst: the number of FTMs pairs in single Burst (1-31); * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
* @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
* the number of measurement iterations (min 2^0 = 1, max 2^14) * the number of measurement iterations (min 2^0 = 1, max 2^14)
* @reserved: For alignment and future use * @sta_id: the station id of the AP. Only relevant when associated to the AP,
* otherwise should be set to &IWL_MVM_INVALID_STA.
* @cipher: pairwise cipher suite for secured measurement. * @cipher: pairwise cipher suite for secured measurement.
* &enum iwl_location_cipher. * &enum iwl_location_cipher.
* @hltk: HLTK to be used for secured 11az measurement * @hltk: HLTK to be used for secured 11az measurement
...@@ -586,7 +585,8 @@ enum iwl_location_cipher { ...@@ -586,7 +585,8 @@ enum iwl_location_cipher {
* If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the * If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
* calibration value that corresponds to the rx bandwidth of the FTM * calibration value that corresponds to the rx bandwidth of the FTM
* frame. * frame.
* @reserved2: For alignment and future use. * @beacon_interval: beacon interval of the AP in TUs. Only required if
* &IWL_INITIATOR_AP_FLAGS_TB is set.
*/ */
struct iwl_tof_range_req_ap_entry { struct iwl_tof_range_req_ap_entry {
__le32 initiator_ap_flags; __le32 initiator_ap_flags;
...@@ -598,13 +598,13 @@ struct iwl_tof_range_req_ap_entry { ...@@ -598,13 +598,13 @@ struct iwl_tof_range_req_ap_entry {
__le16 burst_period; __le16 burst_period;
u8 samples_per_burst; u8 samples_per_burst;
u8 num_of_bursts; u8 num_of_bursts;
u8 reserved; u8 sta_id;
u8 cipher; u8 cipher;
u8 hltk[HLTK_11AZ_LEN]; u8 hltk[HLTK_11AZ_LEN];
u8 tk[TK_11AZ_LEN]; u8 tk[TK_11AZ_LEN];
__le16 calib[IWL_TOF_BW_NUM]; __le16 calib[IWL_TOF_BW_NUM];
__le16 reserved2; __le16 beacon_interval;
} __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_5 */ } __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_6 */
/** /**
* enum iwl_tof_response_mode * enum iwl_tof_response_mode
......
...@@ -391,9 +391,27 @@ iwl_mvm_ftm_put_target_v3(struct iwl_mvm *mvm, ...@@ -391,9 +391,27 @@ iwl_mvm_ftm_put_target_v3(struct iwl_mvm *mvm,
} }
static int static int
iwl_mvm_ftm_put_target(struct iwl_mvm *mvm, iwl_mvm_ftm_put_target_v4(struct iwl_mvm *mvm,
struct cfg80211_pmsr_request_peer *peer,
struct iwl_tof_range_req_ap_entry_v4 *target)
{
int ret;
ret = iwl_mvm_ftm_target_chandef_v2(mvm, peer, &target->channel_num,
&target->format_bw,
&target->ctrl_ch_position);
if (ret)
return ret;
iwl_mvm_ftm_put_target_common(mvm, peer, (void *)target);
return 0;
}
static int
iwl_mvm_ftm_put_target(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct cfg80211_pmsr_request_peer *peer, struct cfg80211_pmsr_request_peer *peer,
struct iwl_tof_range_req_ap_entry_v4 *target) struct iwl_tof_range_req_ap_entry *target)
{ {
int ret; int ret;
...@@ -405,6 +423,20 @@ iwl_mvm_ftm_put_target(struct iwl_mvm *mvm, ...@@ -405,6 +423,20 @@ iwl_mvm_ftm_put_target(struct iwl_mvm *mvm,
iwl_mvm_ftm_put_target_common(mvm, peer, (void *)target); iwl_mvm_ftm_put_target_common(mvm, peer, (void *)target);
if (vif->bss_conf.assoc &&
!memcmp(peer->addr, vif->bss_conf.bssid, ETH_ALEN)) {
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
target->sta_id = mvmvif->ap_sta_id;
} else {
target->sta_id = IWL_MVM_INVALID_STA;
}
/*
* TODO: Beacon interval is currently unknown, so use the common value
* of 100 TUs.
*/
target->beacon_interval = cpu_to_le16(100);
return 0; return 0;
} }
...@@ -496,7 +528,7 @@ static int iwl_mvm_ftm_start_v8(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -496,7 +528,7 @@ static int iwl_mvm_ftm_start_v8(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
for (i = 0; i < cmd.num_of_ap; i++) { for (i = 0; i < cmd.num_of_ap; i++) {
struct cfg80211_pmsr_request_peer *peer = &req->peers[i]; struct cfg80211_pmsr_request_peer *peer = &req->peers[i];
err = iwl_mvm_ftm_put_target(mvm, peer, &cmd.ap[i]); err = iwl_mvm_ftm_put_target_v4(mvm, peer, &cmd.ap[i]);
if (err) if (err)
return err; return err;
} }
...@@ -521,8 +553,9 @@ static int iwl_mvm_ftm_start_v9(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -521,8 +553,9 @@ static int iwl_mvm_ftm_start_v9(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
for (i = 0; i < cmd.num_of_ap; i++) { for (i = 0; i < cmd.num_of_ap; i++) {
struct cfg80211_pmsr_request_peer *peer = &req->peers[i]; struct cfg80211_pmsr_request_peer *peer = &req->peers[i];
struct iwl_tof_range_req_ap_entry *target = &cmd.ap[i];
err = iwl_mvm_ftm_put_target(mvm, peer, (void *)&cmd.ap[i]); err = iwl_mvm_ftm_put_target(mvm, vif, peer, target);
if (err) if (err)
return err; return err;
} }
...@@ -548,6 +581,7 @@ int iwl_mvm_ftm_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -548,6 +581,7 @@ int iwl_mvm_ftm_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
switch (cmd_ver) { switch (cmd_ver) {
case 9: case 9:
case 10:
err = iwl_mvm_ftm_start_v9(mvm, vif, req); err = iwl_mvm_ftm_start_v9(mvm, vif, req);
break; break;
case 8: case 8:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment