qcacmn: Converge FTM feature
Support for FTM to make it common between WIN and MCL. Change-Id: I4a65ca6d73d83e71f6a04405b5c41cdddb0a3c71 CRs-fixed: 2148283
This commit is contained in:
85
ftm/dispatcher/src/wlan_ftm_init_deinit.c
Normal file
85
ftm/dispatcher/src/wlan_ftm_init_deinit.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: This implementation of init/deint functions for FTM services.
|
||||
*/
|
||||
|
||||
#include <wlan_ftm_init_deinit_api.h>
|
||||
#include <wlan_ftm_ucfg_api.h>
|
||||
#include <wlan_objmgr_global_obj.h>
|
||||
#include "../../core/src/wlan_ftm_svc_i.h"
|
||||
#include <wlan_cmn.h>
|
||||
#include <qdf_module.h>
|
||||
|
||||
QDF_STATUS dispatcher_ftm_init(void)
|
||||
{
|
||||
QDF_STATUS status = QDF_STATUS_SUCCESS;
|
||||
|
||||
status = wlan_objmgr_register_pdev_create_handler(WLAN_UMAC_COMP_FTM,
|
||||
wlan_ftm_pdev_obj_create_notification, NULL);
|
||||
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
goto err_pdev_create;
|
||||
|
||||
status = wlan_objmgr_register_pdev_destroy_handler(WLAN_UMAC_COMP_FTM,
|
||||
wlan_ftm_pdev_obj_destroy_notification, NULL);
|
||||
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
goto err_pdev_delete;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
|
||||
err_pdev_delete:
|
||||
wlan_objmgr_unregister_pdev_create_handler(WLAN_UMAC_COMP_FTM,
|
||||
wlan_ftm_pdev_obj_create_notification, NULL);
|
||||
err_pdev_create:
|
||||
return status;
|
||||
}
|
||||
|
||||
QDF_STATUS dispatcher_ftm_deinit(void)
|
||||
{
|
||||
QDF_STATUS status = QDF_STATUS_SUCCESS;
|
||||
|
||||
status = wlan_objmgr_unregister_pdev_create_handler(WLAN_UMAC_COMP_FTM,
|
||||
wlan_ftm_pdev_obj_create_notification, NULL);
|
||||
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
|
||||
status = wlan_objmgr_unregister_pdev_destroy_handler(WLAN_UMAC_COMP_FTM,
|
||||
wlan_ftm_pdev_obj_destroy_notification, NULL);
|
||||
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS dispatcher_ftm_psoc_open(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
/* calling the wmi event handler registration */
|
||||
return wlan_ftm_testmode_attach(psoc);
|
||||
}
|
||||
|
||||
QDF_STATUS dispatcher_ftm_psoc_close(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
/* calling the wmi event handler de-registration */
|
||||
return wlan_ftm_testmode_detach(psoc);
|
||||
}
|
139
ftm/dispatcher/src/wlan_ftm_ucfg_api.c
Normal file
139
ftm/dispatcher/src/wlan_ftm_ucfg_api.c
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: This implementation of init/deint functions for FTM services.
|
||||
*/
|
||||
|
||||
#include <wlan_ftm_ucfg_api.h>
|
||||
#include <wlan_cfg80211_ftm.h>
|
||||
#include "../../core/src/wlan_ftm_svc_i.h"
|
||||
#include <wlan_cmn.h>
|
||||
#include <qdf_module.h>
|
||||
|
||||
QDF_STATUS ucfg_wlan_ftm_testmode_cmd(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t *data, uint32_t len)
|
||||
{
|
||||
struct wifi_ftm_pdev_priv_obj *ftm_pdev_obj;
|
||||
uint8_t pdev_id;
|
||||
|
||||
ftm_pdev_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
|
||||
WLAN_UMAC_COMP_FTM);
|
||||
if (!ftm_pdev_obj) {
|
||||
ftm_err("Failed to get ftm pdev component");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
ftm_pdev_obj->length = 0;
|
||||
pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
|
||||
|
||||
return wlan_ftm_cmd_send(pdev, data, len, pdev_id);
|
||||
}
|
||||
|
||||
QDF_STATUS ucfg_wlan_ftm_testmode_rsp(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t *data)
|
||||
{
|
||||
struct wifi_ftm_pdev_priv_obj *ftm_pdev_obj;
|
||||
uint32_t *len;
|
||||
|
||||
ftm_pdev_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
|
||||
WLAN_UMAC_COMP_FTM);
|
||||
if (!ftm_pdev_obj) {
|
||||
ftm_err("Failed to get ftm pdev component");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
if (ftm_pdev_obj->length) {
|
||||
len = (uint32_t *)data;
|
||||
*len = ftm_pdev_obj->length;
|
||||
qdf_mem_copy((data + 4), ftm_pdev_obj->data,
|
||||
ftm_pdev_obj->length);
|
||||
|
||||
ftm_pdev_obj->length = 0;
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
wlan_ftm_process_utf_event(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t *event_buf, uint32_t len)
|
||||
{
|
||||
struct wifi_ftm_pdev_priv_obj *ftm_pdev_obj;
|
||||
u_int16_t utf_datalen;
|
||||
uint8_t *utf_data;
|
||||
struct ftm_seg_hdr_info seghdr_info;
|
||||
u_int8_t total_segments, current_seq;
|
||||
|
||||
ftm_pdev_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
|
||||
WLAN_UMAC_COMP_FTM);
|
||||
if (!ftm_pdev_obj) {
|
||||
ftm_err("Failed to get ftm pdev component");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
utf_data = event_buf;
|
||||
seghdr_info = *(struct ftm_seg_hdr_info *)(event_buf);
|
||||
ftm_pdev_obj->current_seq = (seghdr_info.segment_info & 0xF);
|
||||
|
||||
current_seq = (seghdr_info.segment_info & 0xF);
|
||||
total_segments = (seghdr_info.segment_info >> 4) & 0xF;
|
||||
|
||||
utf_datalen = len - sizeof(seghdr_info);
|
||||
|
||||
if (current_seq == 0) {
|
||||
ftm_pdev_obj->expected_seq = 0;
|
||||
ftm_pdev_obj->offset = 0;
|
||||
} else {
|
||||
if (ftm_pdev_obj->expected_seq != current_seq) {
|
||||
ftm_debug("seq mismatch exp Seq %d got seq %d\n",
|
||||
ftm_pdev_obj->expected_seq, current_seq);
|
||||
}
|
||||
}
|
||||
|
||||
qdf_mem_copy(&ftm_pdev_obj->data[ftm_pdev_obj->offset],
|
||||
&utf_data[sizeof(seghdr_info)], utf_datalen);
|
||||
|
||||
ftm_pdev_obj->offset = ftm_pdev_obj->offset + utf_datalen;
|
||||
ftm_pdev_obj->expected_seq++;
|
||||
|
||||
if (ftm_pdev_obj->expected_seq == total_segments) {
|
||||
if (ftm_pdev_obj->offset != seghdr_info.len) {
|
||||
ftm_debug("len mismatch len %zu total len %d\n",
|
||||
ftm_pdev_obj->offset, seghdr_info.len);
|
||||
}
|
||||
|
||||
ftm_pdev_obj->length = ftm_pdev_obj->offset;
|
||||
|
||||
/**
|
||||
* If the repsonse is for a command from FTM daemon,
|
||||
* send this repsonse data to cfg80211
|
||||
*/
|
||||
if (ftm_pdev_obj->cmd_type == WIFI_FTM_CMD_NL80211) {
|
||||
if (wlan_cfg80211_ftm_rx_event(pdev, ftm_pdev_obj->data,
|
||||
ftm_pdev_obj->length) != QDF_STATUS_SUCCESS) {
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
ftm_pdev_obj->cmd_type = WIFI_FTM_CMD_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
Reference in New Issue
Block a user