Skip to content

Commit 018971b

Browse files
AviSternlucacoelho
authored andcommitted
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: Avraham Stern <[email protected]> Signed-off-by: Luca Coelho <[email protected]> Link: https://lore.kernel.org/r/iwlwifi.20200529092401.b7ccdad0805f.I59ea7f773caed85a66c61401066ae169008442e6@changeid
1 parent f327236 commit 018971b

File tree

2 files changed

+45
-11
lines changed

2 files changed

+45
-11
lines changed

drivers/net/wireless/intel/iwlwifi/fw/api/location.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,13 +550,11 @@ struct iwl_tof_range_req_ap_entry_v4 {
550550
/**
551551
* enum iwl_location_cipher - location cipher selection
552552
* @IWL_LOCATION_CIPHER_CCMP_128: CCMP 128
553-
* @IWL_LOCATION_CIPHER_CCMP_256: CCMP 256
554553
* @IWL_LOCATION_CIPHER_GCMP_128: GCMP 128
555554
* @IWL_LOCATION_CIPHER_GCMP_256: GCMP 256
556555
*/
557556
enum iwl_location_cipher {
558557
IWL_LOCATION_CIPHER_CCMP_128,
559-
IWL_LOCATION_CIPHER_CCMP_256,
560558
IWL_LOCATION_CIPHER_GCMP_128,
561559
IWL_LOCATION_CIPHER_GCMP_256,
562560
};
@@ -577,7 +575,8 @@ enum iwl_location_cipher {
577575
* @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
578576
* @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
579577
* the number of measurement iterations (min 2^0 = 1, max 2^14)
580-
* @reserved: For alignment and future use
578+
* @sta_id: the station id of the AP. Only relevant when associated to the AP,
579+
* otherwise should be set to &IWL_MVM_INVALID_STA.
581580
* @cipher: pairwise cipher suite for secured measurement.
582581
* &enum iwl_location_cipher.
583582
* @hltk: HLTK to be used for secured 11az measurement
@@ -586,7 +585,8 @@ enum iwl_location_cipher {
586585
* If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
587586
* calibration value that corresponds to the rx bandwidth of the FTM
588587
* frame.
589-
* @reserved2: For alignment and future use.
588+
* @beacon_interval: beacon interval of the AP in TUs. Only required if
589+
* &IWL_INITIATOR_AP_FLAGS_TB is set.
590590
*/
591591
struct iwl_tof_range_req_ap_entry {
592592
__le32 initiator_ap_flags;
@@ -598,13 +598,13 @@ struct iwl_tof_range_req_ap_entry {
598598
__le16 burst_period;
599599
u8 samples_per_burst;
600600
u8 num_of_bursts;
601-
u8 reserved;
601+
u8 sta_id;
602602
u8 cipher;
603603
u8 hltk[HLTK_11AZ_LEN];
604604
u8 tk[TK_11AZ_LEN];
605605
__le16 calib[IWL_TOF_BW_NUM];
606-
__le16 reserved2;
607-
} __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_5 */
606+
__le16 beacon_interval;
607+
} __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_6 */
608608

609609
/**
610610
* enum iwl_tof_response_mode

drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,27 @@ iwl_mvm_ftm_put_target_v3(struct iwl_mvm *mvm,
391391
}
392392

393393
static int
394-
iwl_mvm_ftm_put_target(struct iwl_mvm *mvm,
394+
iwl_mvm_ftm_put_target_v4(struct iwl_mvm *mvm,
395+
struct cfg80211_pmsr_request_peer *peer,
396+
struct iwl_tof_range_req_ap_entry_v4 *target)
397+
{
398+
int ret;
399+
400+
ret = iwl_mvm_ftm_target_chandef_v2(mvm, peer, &target->channel_num,
401+
&target->format_bw,
402+
&target->ctrl_ch_position);
403+
if (ret)
404+
return ret;
405+
406+
iwl_mvm_ftm_put_target_common(mvm, peer, (void *)target);
407+
408+
return 0;
409+
}
410+
411+
static int
412+
iwl_mvm_ftm_put_target(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
395413
struct cfg80211_pmsr_request_peer *peer,
396-
struct iwl_tof_range_req_ap_entry_v4 *target)
414+
struct iwl_tof_range_req_ap_entry *target)
397415
{
398416
int ret;
399417

@@ -405,6 +423,20 @@ iwl_mvm_ftm_put_target(struct iwl_mvm *mvm,
405423

406424
iwl_mvm_ftm_put_target_common(mvm, peer, (void *)target);
407425

426+
if (vif->bss_conf.assoc &&
427+
!memcmp(peer->addr, vif->bss_conf.bssid, ETH_ALEN)) {
428+
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
429+
430+
target->sta_id = mvmvif->ap_sta_id;
431+
} else {
432+
target->sta_id = IWL_MVM_INVALID_STA;
433+
}
434+
435+
/*
436+
* TODO: Beacon interval is currently unknown, so use the common value
437+
* of 100 TUs.
438+
*/
439+
target->beacon_interval = cpu_to_le16(100);
408440
return 0;
409441
}
410442

@@ -496,7 +528,7 @@ static int iwl_mvm_ftm_start_v8(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
496528
for (i = 0; i < cmd.num_of_ap; i++) {
497529
struct cfg80211_pmsr_request_peer *peer = &req->peers[i];
498530

499-
err = iwl_mvm_ftm_put_target(mvm, peer, &cmd.ap[i]);
531+
err = iwl_mvm_ftm_put_target_v4(mvm, peer, &cmd.ap[i]);
500532
if (err)
501533
return err;
502534
}
@@ -521,8 +553,9 @@ static int iwl_mvm_ftm_start_v9(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
521553

522554
for (i = 0; i < cmd.num_of_ap; i++) {
523555
struct cfg80211_pmsr_request_peer *peer = &req->peers[i];
556+
struct iwl_tof_range_req_ap_entry *target = &cmd.ap[i];
524557

525-
err = iwl_mvm_ftm_put_target(mvm, peer, (void *)&cmd.ap[i]);
558+
err = iwl_mvm_ftm_put_target(mvm, vif, peer, target);
526559
if (err)
527560
return err;
528561
}
@@ -548,6 +581,7 @@ int iwl_mvm_ftm_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
548581

549582
switch (cmd_ver) {
550583
case 9:
584+
case 10:
551585
err = iwl_mvm_ftm_start_v9(mvm, vif, req);
552586
break;
553587
case 8:

0 commit comments

Comments
 (0)