Skip to content

Commit cec2d4f

Browse files
AviSternlucacoelho
authored andcommitted
iwlwifi: mvm: report FTM start time TSF when applicable
When the interface that is requesting an FTM measurement is connected to a BSS, it is possible that the FTM request was originated by an RRM request from the AP. In this case the station needs to report the measurement start time in terms of the TSF of the AP. Since there is no indication in the FTM request itself if the TSF is needed, always report the TSF if the station is associated. Signed-off-by: Avraham Stern <[email protected]> Signed-off-by: Luca Coelho <[email protected]>
1 parent 0c546fb commit cec2d4f

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,24 @@ static void iwl_mvm_ftm_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
187187
for (i = 0; i < ETH_ALEN; i++)
188188
cmd->macaddr_mask[i] = ~req->mac_addr_mask[i];
189189

190-
if (vif->bss_conf.assoc)
190+
if (vif->bss_conf.assoc) {
191191
memcpy(cmd->range_req_bssid, vif->bss_conf.bssid, ETH_ALEN);
192-
else
192+
193+
/* AP's TSF is only relevant if associated */
194+
for (i = 0; i < req->n_peers; i++) {
195+
if (req->peers[i].report_ap_tsf) {
196+
struct iwl_mvm_vif *mvmvif =
197+
iwl_mvm_vif_from_mac80211(vif);
198+
199+
cmd->tsf_mac_id = cpu_to_le32(mvmvif->id);
200+
return;
201+
}
202+
}
203+
} else {
193204
eth_broadcast_addr(cmd->range_req_bssid);
205+
}
194206

195-
/* TODO: fill in tsf_mac_id if needed */
207+
/* Don't report AP's TSF */
196208
cmd->tsf_mac_id = cpu_to_le32(0xff);
197209
}
198210

@@ -527,6 +539,8 @@ void iwl_mvm_ftm_range_resp(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
527539
fw_ap = (void *)&fw_resp_v6->ap[i];
528540

529541
result.final = fw_resp->ap[i].last_burst;
542+
result.ap_tsf = le32_to_cpu(fw_ap->start_tsf);
543+
result.ap_tsf_valid = 1;
530544
} else {
531545
/* the first part is the same for old and new APIs */
532546
fw_ap = (void *)&fw_resp_v5->ap[i];

0 commit comments

Comments
 (0)