1 /******************************************************************************
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
8 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
9 * Copyright (C) 2018 Intel Corporation
10 * Copyright (C) 2019 Intel Corporation
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * The full GNU General Public License is included in this distribution
22 * in the file called COPYING.
24 * Contact Information:
25 * Intel Linux Wireless <linuxwifi@intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
31 * Copyright (C) 2018 Intel Corporation
32 * Copyright (C) 2019 Intel Corporation
33 * All rights reserved.
35 * Redistribution and use in source and binary forms, with or without
36 * modification, are permitted provided that the following conditions
39 * * Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * * Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in
43 * the documentation and/or other materials provided with the
45 * * Neither the name Intel Corporation nor the names of its
46 * contributors may be used to endorse or promote products derived
47 * from this software without specific prior written permission.
49 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
52 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
53 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
54 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
55 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
57 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
59 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *****************************************************************************/
62 #include <linux/etherdevice.h>
63 #include <linux/math64.h>
64 #include <net/cfg80211.h>
68 #include "constants.h"
70 struct iwl_mvm_loc_entry {
71 struct list_head list;
73 u8 lci_len, civic_len;
77 static void iwl_mvm_ftm_reset(struct iwl_mvm *mvm)
79 struct iwl_mvm_loc_entry *e, *t;
81 mvm->ftm_initiator.req = NULL;
82 mvm->ftm_initiator.req_wdev = NULL;
83 memset(mvm->ftm_initiator.responses, 0,
84 sizeof(mvm->ftm_initiator.responses));
85 list_for_each_entry_safe(e, t, &mvm->ftm_initiator.loc_list, list) {
91 void iwl_mvm_ftm_restart(struct iwl_mvm *mvm)
93 struct cfg80211_pmsr_result result = {
94 .status = NL80211_PMSR_STATUS_FAILURE,
96 .host_time = ktime_get_boottime_ns(),
97 .type = NL80211_PMSR_TYPE_FTM,
101 lockdep_assert_held(&mvm->mutex);
103 if (!mvm->ftm_initiator.req)
106 for (i = 0; i < mvm->ftm_initiator.req->n_peers; i++) {
107 memcpy(result.addr, mvm->ftm_initiator.req->peers[i].addr,
109 result.ftm.burst_index = mvm->ftm_initiator.responses[i];
111 cfg80211_pmsr_report(mvm->ftm_initiator.req_wdev,
112 mvm->ftm_initiator.req,
113 &result, GFP_KERNEL);
116 cfg80211_pmsr_complete(mvm->ftm_initiator.req_wdev,
117 mvm->ftm_initiator.req, GFP_KERNEL);
118 iwl_mvm_ftm_reset(mvm);
122 iwl_ftm_range_request_status_to_err(enum iwl_tof_range_request_status s)
125 case IWL_TOF_RANGE_REQUEST_STATUS_SUCCESS:
127 case IWL_TOF_RANGE_REQUEST_STATUS_BUSY:
135 static void iwl_mvm_ftm_cmd_v5(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
136 struct iwl_tof_range_req_cmd_v5 *cmd,
137 struct cfg80211_pmsr_request *req)
141 cmd->request_id = req->cookie;
142 cmd->num_of_ap = req->n_peers;
144 /* use maximum for "no timeout" or bigger than what we can do */
145 if (!req->timeout || req->timeout > 255 * 100)
146 cmd->req_timeout = 255;
148 cmd->req_timeout = DIV_ROUND_UP(req->timeout, 100);
151 * We treat it always as random, since if not we'll
152 * have filled our local address there instead.
154 cmd->macaddr_random = 1;
155 memcpy(cmd->macaddr_template, req->mac_addr, ETH_ALEN);
156 for (i = 0; i < ETH_ALEN; i++)
157 cmd->macaddr_mask[i] = ~req->mac_addr_mask[i];
159 if (vif->bss_conf.assoc)
160 memcpy(cmd->range_req_bssid, vif->bss_conf.bssid, ETH_ALEN);
162 eth_broadcast_addr(cmd->range_req_bssid);
165 static void iwl_mvm_ftm_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
166 struct iwl_tof_range_req_cmd *cmd,
167 struct cfg80211_pmsr_request *req)
171 cmd->initiator_flags =
172 cpu_to_le32(IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM |
173 IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT);
174 cmd->request_id = req->cookie;
175 cmd->num_of_ap = req->n_peers;
178 * Use a large value for "no timeout". Don't use the maximum value
179 * because of fw limitations.
182 cmd->req_timeout_ms = cpu_to_le32(req->timeout);
184 cmd->req_timeout_ms = cpu_to_le32(0xfffff);
186 memcpy(cmd->macaddr_template, req->mac_addr, ETH_ALEN);
187 for (i = 0; i < ETH_ALEN; i++)
188 cmd->macaddr_mask[i] = ~req->mac_addr_mask[i];
190 if (vif->bss_conf.assoc) {
191 memcpy(cmd->range_req_bssid, vif->bss_conf.bssid, ETH_ALEN);
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);
199 cmd->tsf_mac_id = cpu_to_le32(mvmvif->id);
204 eth_broadcast_addr(cmd->range_req_bssid);
207 /* Don't report AP's TSF */
208 cmd->tsf_mac_id = cpu_to_le32(0xff);
211 static int iwl_mvm_ftm_target_chandef(struct iwl_mvm *mvm,
212 struct cfg80211_pmsr_request_peer *peer,
213 u8 *channel, u8 *bandwidth,
214 u8 *ctrl_ch_position)
216 u32 freq = peer->chandef.chan->center_freq;
218 *channel = ieee80211_frequency_to_channel(freq);
220 switch (peer->chandef.width) {
221 case NL80211_CHAN_WIDTH_20_NOHT:
222 *bandwidth = IWL_TOF_BW_20_LEGACY;
224 case NL80211_CHAN_WIDTH_20:
225 *bandwidth = IWL_TOF_BW_20_HT;
227 case NL80211_CHAN_WIDTH_40:
228 *bandwidth = IWL_TOF_BW_40;
230 case NL80211_CHAN_WIDTH_80:
231 *bandwidth = IWL_TOF_BW_80;
234 IWL_ERR(mvm, "Unsupported BW in FTM request (%d)\n",
235 peer->chandef.width);
239 *ctrl_ch_position = (peer->chandef.width > NL80211_CHAN_WIDTH_20) ?
240 iwl_mvm_get_ctrl_pos(&peer->chandef) : 0;
246 iwl_mvm_ftm_put_target_v2(struct iwl_mvm *mvm,
247 struct cfg80211_pmsr_request_peer *peer,
248 struct iwl_tof_range_req_ap_entry_v2 *target)
252 ret = iwl_mvm_ftm_target_chandef(mvm, peer, &target->channel_num,
254 &target->ctrl_ch_position);
258 memcpy(target->bssid, peer->addr, ETH_ALEN);
259 target->burst_period =
260 cpu_to_le16(peer->ftm.burst_period);
261 target->samples_per_burst = peer->ftm.ftms_per_burst;
262 target->num_of_bursts = peer->ftm.num_bursts_exp;
263 target->measure_type = 0; /* regular two-sided FTM */
264 target->retries_per_sample = peer->ftm.ftmr_retries;
265 target->asap_mode = peer->ftm.asap;
266 target->enable_dyn_ack = IWL_MVM_FTM_INITIATOR_DYNACK;
268 if (peer->ftm.request_lci)
269 target->location_req |= IWL_TOF_LOC_LCI;
270 if (peer->ftm.request_civicloc)
271 target->location_req |= IWL_TOF_LOC_CIVIC;
273 target->algo_type = IWL_MVM_FTM_INITIATOR_ALGO;
278 #define FTM_PUT_FLAG(flag) (target->initiator_ap_flags |= \
279 cpu_to_le32(IWL_INITIATOR_AP_FLAGS_##flag))
281 static int iwl_mvm_ftm_put_target(struct iwl_mvm *mvm,
282 struct cfg80211_pmsr_request_peer *peer,
283 struct iwl_tof_range_req_ap_entry *target)
287 ret = iwl_mvm_ftm_target_chandef(mvm, peer, &target->channel_num,
289 &target->ctrl_ch_position);
293 memcpy(target->bssid, peer->addr, ETH_ALEN);
294 target->burst_period =
295 cpu_to_le16(peer->ftm.burst_period);
296 target->samples_per_burst = peer->ftm.ftms_per_burst;
297 target->num_of_bursts = peer->ftm.num_bursts_exp;
298 target->ftmr_max_retries = peer->ftm.ftmr_retries;
299 target->initiator_ap_flags = cpu_to_le32(0);
304 if (peer->ftm.request_lci)
305 FTM_PUT_FLAG(LCI_REQUEST);
307 if (peer->ftm.request_civicloc)
308 FTM_PUT_FLAG(CIVIC_REQUEST);
310 if (IWL_MVM_FTM_INITIATOR_DYNACK)
311 FTM_PUT_FLAG(DYN_ACK);
313 if (IWL_MVM_FTM_INITIATOR_ALGO == IWL_TOF_ALGO_TYPE_LINEAR_REG)
314 FTM_PUT_FLAG(ALGO_LR);
315 else if (IWL_MVM_FTM_INITIATOR_ALGO == IWL_TOF_ALGO_TYPE_FFT)
316 FTM_PUT_FLAG(ALGO_FFT);
321 int iwl_mvm_ftm_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
322 struct cfg80211_pmsr_request *req)
324 struct iwl_tof_range_req_cmd_v5 cmd_v5;
325 struct iwl_tof_range_req_cmd cmd;
326 bool new_api = fw_has_api(&mvm->fw->ucode_capa,
327 IWL_UCODE_TLV_API_FTM_NEW_RANGE_REQ);
329 struct iwl_host_cmd hcmd = {
330 .id = iwl_cmd_id(TOF_RANGE_REQ_CMD, LOCATION_GROUP, 0),
331 .dataflags[0] = IWL_HCMD_DFL_DUP,
336 lockdep_assert_held(&mvm->mutex);
338 if (mvm->ftm_initiator.req)
342 iwl_mvm_ftm_cmd(mvm, vif, &cmd, req);
344 hcmd.len[0] = sizeof(cmd);
345 num_of_ap = cmd.num_of_ap;
347 iwl_mvm_ftm_cmd_v5(mvm, vif, &cmd_v5, req);
348 hcmd.data[0] = &cmd_v5;
349 hcmd.len[0] = sizeof(cmd_v5);
350 num_of_ap = cmd_v5.num_of_ap;
353 for (i = 0; i < num_of_ap; i++) {
354 struct cfg80211_pmsr_request_peer *peer = &req->peers[i];
357 err = iwl_mvm_ftm_put_target(mvm, peer, &cmd.ap[i]);
359 err = iwl_mvm_ftm_put_target_v2(mvm, peer,
366 err = iwl_mvm_send_cmd_status(mvm, &hcmd, &status);
367 if (!err && status) {
368 IWL_ERR(mvm, "FTM range request command failure, status: %u\n",
370 err = iwl_ftm_range_request_status_to_err(status);
374 mvm->ftm_initiator.req = req;
375 mvm->ftm_initiator.req_wdev = ieee80211_vif_to_wdev(vif);
381 void iwl_mvm_ftm_abort(struct iwl_mvm *mvm, struct cfg80211_pmsr_request *req)
383 struct iwl_tof_range_abort_cmd cmd = {
384 .request_id = req->cookie,
387 lockdep_assert_held(&mvm->mutex);
389 if (req != mvm->ftm_initiator.req)
392 if (iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(TOF_RANGE_ABORT_CMD,
394 0, sizeof(cmd), &cmd))
395 IWL_ERR(mvm, "failed to abort FTM process\n");
398 static int iwl_mvm_ftm_find_peer(struct cfg80211_pmsr_request *req,
403 for (i = 0; i < req->n_peers; i++) {
404 struct cfg80211_pmsr_request_peer *peer = &req->peers[i];
406 if (ether_addr_equal_unaligned(peer->addr, addr))
413 static u64 iwl_mvm_ftm_get_host_time(struct iwl_mvm *mvm, __le32 fw_gp2_ts)
415 u32 gp2_ts = le32_to_cpu(fw_gp2_ts);
417 u64 now_from_boot_ns;
419 iwl_mvm_get_sync_time(mvm, &curr_gp2, &now_from_boot_ns);
421 if (curr_gp2 >= gp2_ts)
422 diff = curr_gp2 - gp2_ts;
424 diff = curr_gp2 + (U32_MAX - gp2_ts + 1);
426 return now_from_boot_ns - (u64)diff * 1000;
429 static void iwl_mvm_ftm_get_lci_civic(struct iwl_mvm *mvm,
430 struct cfg80211_pmsr_result *res)
432 struct iwl_mvm_loc_entry *entry;
434 list_for_each_entry(entry, &mvm->ftm_initiator.loc_list, list) {
435 if (!ether_addr_equal_unaligned(res->addr, entry->addr))
438 if (entry->lci_len) {
439 res->ftm.lci_len = entry->lci_len;
440 res->ftm.lci = entry->buf;
443 if (entry->civic_len) {
444 res->ftm.civicloc_len = entry->civic_len;
445 res->ftm.civicloc = entry->buf + entry->lci_len;
448 /* we found the entry we needed */
453 static int iwl_mvm_ftm_range_resp_valid(struct iwl_mvm *mvm, u8 request_id,
456 lockdep_assert_held(&mvm->mutex);
458 if (request_id != (u8)mvm->ftm_initiator.req->cookie) {
459 IWL_ERR(mvm, "Request ID mismatch, got %u, active %u\n",
460 request_id, (u8)mvm->ftm_initiator.req->cookie);
464 if (num_of_aps > mvm->ftm_initiator.req->n_peers) {
465 IWL_ERR(mvm, "FTM range response invalid\n");
472 static void iwl_mvm_debug_range_resp(struct iwl_mvm *mvm, u8 index,
473 struct cfg80211_pmsr_result *res)
475 s64 rtt_avg = div_s64(res->ftm.rtt_avg * 100, 6666);
477 IWL_DEBUG_INFO(mvm, "entry %d\n", index);
478 IWL_DEBUG_INFO(mvm, "\tstatus: %d\n", res->status);
479 IWL_DEBUG_INFO(mvm, "\tBSSID: %pM\n", res->addr);
480 IWL_DEBUG_INFO(mvm, "\thost time: %llu\n", res->host_time);
481 IWL_DEBUG_INFO(mvm, "\tburst index: %hhu\n", res->ftm.burst_index);
482 IWL_DEBUG_INFO(mvm, "\tsuccess num: %u\n", res->ftm.num_ftmr_successes);
483 IWL_DEBUG_INFO(mvm, "\trssi: %d\n", res->ftm.rssi_avg);
484 IWL_DEBUG_INFO(mvm, "\trssi spread: %hhu\n", res->ftm.rssi_spread);
485 IWL_DEBUG_INFO(mvm, "\trtt: %lld\n", res->ftm.rtt_avg);
486 IWL_DEBUG_INFO(mvm, "\trtt var: %llu\n", res->ftm.rtt_variance);
487 IWL_DEBUG_INFO(mvm, "\trtt spread: %llu\n", res->ftm.rtt_spread);
488 IWL_DEBUG_INFO(mvm, "\tdistance: %lld\n", rtt_avg);
491 void iwl_mvm_ftm_range_resp(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
493 struct iwl_rx_packet *pkt = rxb_addr(rxb);
494 struct iwl_tof_range_rsp_ntfy_v5 *fw_resp_v5 = (void *)pkt->data;
495 struct iwl_tof_range_rsp_ntfy_v6 *fw_resp_v6 = (void *)pkt->data;
496 struct iwl_tof_range_rsp_ntfy *fw_resp = (void *)pkt->data;
498 bool new_api = fw_has_api(&mvm->fw->ucode_capa,
499 IWL_UCODE_TLV_API_FTM_NEW_RANGE_REQ);
500 u8 num_of_aps, last_in_batch;
502 lockdep_assert_held(&mvm->mutex);
504 if (!mvm->ftm_initiator.req) {
505 IWL_ERR(mvm, "Got FTM response but have no request?\n");
510 if (iwl_mvm_ftm_range_resp_valid(mvm, fw_resp->request_id,
511 fw_resp->num_of_aps))
514 num_of_aps = fw_resp->num_of_aps;
515 last_in_batch = fw_resp->last_report;
517 if (iwl_mvm_ftm_range_resp_valid(mvm, fw_resp_v5->request_id,
518 fw_resp_v5->num_of_aps))
521 num_of_aps = fw_resp_v5->num_of_aps;
522 last_in_batch = fw_resp_v5->last_in_batch;
525 IWL_DEBUG_INFO(mvm, "Range response received\n");
526 IWL_DEBUG_INFO(mvm, "request id: %lld, num of entries: %hhu\n",
527 mvm->ftm_initiator.req->cookie, num_of_aps);
529 for (i = 0; i < num_of_aps && i < IWL_MVM_TOF_MAX_APS; i++) {
530 struct cfg80211_pmsr_result result = {};
531 struct iwl_tof_range_rsp_ap_entry_ntfy *fw_ap;
535 if (fw_has_api(&mvm->fw->ucode_capa,
536 IWL_UCODE_TLV_API_FTM_RTT_ACCURACY))
537 fw_ap = &fw_resp->ap[i];
539 fw_ap = (void *)&fw_resp_v6->ap[i];
541 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;
545 /* the first part is the same for old and new APIs */
546 fw_ap = (void *)&fw_resp_v5->ap[i];
548 * FIXME: the firmware needs to report this, we don't
549 * even know the number of bursts the responder picked
550 * (if we asked it to)
555 peer_idx = iwl_mvm_ftm_find_peer(mvm->ftm_initiator.req,
559 "Unknown address (%pM, target #%d) in FTM response\n",
564 switch (fw_ap->measure_status) {
565 case IWL_TOF_ENTRY_SUCCESS:
566 result.status = NL80211_PMSR_STATUS_SUCCESS;
568 case IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT:
569 result.status = NL80211_PMSR_STATUS_TIMEOUT;
571 case IWL_TOF_ENTRY_NO_RESPONSE:
572 result.status = NL80211_PMSR_STATUS_FAILURE;
573 result.ftm.failure_reason =
574 NL80211_PMSR_FTM_FAILURE_NO_RESPONSE;
576 case IWL_TOF_ENTRY_REQUEST_REJECTED:
577 result.status = NL80211_PMSR_STATUS_FAILURE;
578 result.ftm.failure_reason =
579 NL80211_PMSR_FTM_FAILURE_PEER_BUSY;
580 result.ftm.busy_retry_time = fw_ap->refusal_period;
583 result.status = NL80211_PMSR_STATUS_FAILURE;
584 result.ftm.failure_reason =
585 NL80211_PMSR_FTM_FAILURE_UNSPECIFIED;
588 memcpy(result.addr, fw_ap->bssid, ETH_ALEN);
589 result.host_time = iwl_mvm_ftm_get_host_time(mvm,
591 result.type = NL80211_PMSR_TYPE_FTM;
592 result.ftm.burst_index = mvm->ftm_initiator.responses[peer_idx];
593 mvm->ftm_initiator.responses[peer_idx]++;
594 result.ftm.rssi_avg = fw_ap->rssi;
595 result.ftm.rssi_avg_valid = 1;
596 result.ftm.rssi_spread = fw_ap->rssi_spread;
597 result.ftm.rssi_spread_valid = 1;
598 result.ftm.rtt_avg = (s32)le32_to_cpu(fw_ap->rtt);
599 result.ftm.rtt_avg_valid = 1;
600 result.ftm.rtt_variance = le32_to_cpu(fw_ap->rtt_variance);
601 result.ftm.rtt_variance_valid = 1;
602 result.ftm.rtt_spread = le32_to_cpu(fw_ap->rtt_spread);
603 result.ftm.rtt_spread_valid = 1;
605 iwl_mvm_ftm_get_lci_civic(mvm, &result);
607 cfg80211_pmsr_report(mvm->ftm_initiator.req_wdev,
608 mvm->ftm_initiator.req,
609 &result, GFP_KERNEL);
611 if (fw_has_api(&mvm->fw->ucode_capa,
612 IWL_UCODE_TLV_API_FTM_RTT_ACCURACY))
613 IWL_DEBUG_INFO(mvm, "RTT confidence: %hhu\n",
614 fw_ap->rttConfidence);
616 iwl_mvm_debug_range_resp(mvm, i, &result);
620 cfg80211_pmsr_complete(mvm->ftm_initiator.req_wdev,
621 mvm->ftm_initiator.req,
623 iwl_mvm_ftm_reset(mvm);
627 void iwl_mvm_ftm_lc_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
629 struct iwl_rx_packet *pkt = rxb_addr(rxb);
630 const struct ieee80211_mgmt *mgmt = (void *)pkt->data;
631 size_t len = iwl_rx_packet_payload_len(pkt);
632 struct iwl_mvm_loc_entry *entry;
633 const u8 *ies, *lci, *civic, *msr_ie;
634 size_t ies_len, lci_len = 0, civic_len = 0;
635 size_t baselen = IEEE80211_MIN_ACTION_SIZE +
636 sizeof(mgmt->u.action.u.ftm);
637 static const u8 rprt_type_lci = IEEE80211_SPCT_MSR_RPRT_TYPE_LCI;
638 static const u8 rprt_type_civic = IEEE80211_SPCT_MSR_RPRT_TYPE_CIVIC;
643 lockdep_assert_held(&mvm->mutex);
645 ies = mgmt->u.action.u.ftm.variable;
646 ies_len = len - baselen;
648 msr_ie = cfg80211_find_ie_match(WLAN_EID_MEASURE_REPORT, ies, ies_len,
649 &rprt_type_lci, 1, 4);
655 msr_ie = cfg80211_find_ie_match(WLAN_EID_MEASURE_REPORT, ies, ies_len,
656 &rprt_type_civic, 1, 4);
659 civic_len = msr_ie[1];
662 entry = kmalloc(sizeof(*entry) + lci_len + civic_len, GFP_KERNEL);
666 memcpy(entry->addr, mgmt->bssid, ETH_ALEN);
668 entry->lci_len = lci_len;
670 memcpy(entry->buf, lci, lci_len);
672 entry->civic_len = civic_len;
674 memcpy(entry->buf + lci_len, civic, civic_len);
676 list_add_tail(&entry->list, &mvm->ftm_initiator.loc_list);