mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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:
parent
3550d5a7f6
commit
fffcebf2e9
19 changed files with 1360 additions and 1 deletions
166
ftm/core/src/wlan_ftm_svc.c
Normal file
166
ftm/core/src/wlan_ftm_svc.c
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
/*
|
||||
* 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_svc_i.h"
|
||||
#include <wlan_lmac_if_def.h>
|
||||
#include <wlan_ftm_ucfg_api.h>
|
||||
|
||||
static inline struct wlan_lmac_if_ftm_tx_ops *
|
||||
wlan_psoc_get_ftm_txops(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
return &((psoc->soc_cb.tx_ops.ftm_tx_ops));
|
||||
}
|
||||
|
||||
static QDF_STATUS
|
||||
ftm_pdev_obj_init(struct wifi_ftm_pdev_priv_obj *ftm_pdev_obj)
|
||||
{
|
||||
ftm_pdev_obj->data = qdf_mem_malloc(FTM_CMD_MAX_BUF_LENGTH);
|
||||
if (!ftm_pdev_obj->data) {
|
||||
ftm_err("Memory alloc failed for ftm pdev obj data");
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
}
|
||||
|
||||
ftm_pdev_obj->length = 0;
|
||||
|
||||
ftm_pdev_obj->cmd_type = WIFI_FTM_CMD_UNKNOWN;
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
wlan_ftm_pdev_obj_create_notification(struct wlan_objmgr_pdev *pdev,
|
||||
void *arg_list)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
struct wifi_ftm_pdev_priv_obj *ftm_pdev_obj;
|
||||
|
||||
ftm_pdev_obj = qdf_mem_malloc(sizeof(*ftm_pdev_obj));
|
||||
|
||||
if (!ftm_pdev_obj) {
|
||||
ftm_err("Memory alloc failed for ftm pdev obj");
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
}
|
||||
|
||||
ftm_pdev_obj->pdev = pdev;
|
||||
status = ftm_pdev_obj_init(ftm_pdev_obj);
|
||||
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
ftm_err("ftm pdev obj init failed");
|
||||
qdf_mem_free(ftm_pdev_obj);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = wlan_objmgr_pdev_component_obj_attach(pdev,
|
||||
WLAN_UMAC_COMP_FTM,
|
||||
ftm_pdev_obj,
|
||||
QDF_STATUS_SUCCESS);
|
||||
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
ftm_err("ftm pdev obj attach failed");
|
||||
qdf_mem_free(ftm_pdev_obj);
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static QDF_STATUS
|
||||
ftm_pdev_obj_deinit(struct wifi_ftm_pdev_priv_obj *ftm_pdev_obj)
|
||||
{
|
||||
if (ftm_pdev_obj->data) {
|
||||
qdf_mem_free(ftm_pdev_obj->data);
|
||||
|
||||
ftm_pdev_obj->data = NULL;
|
||||
ftm_pdev_obj->length = 0;
|
||||
}
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
wlan_ftm_pdev_obj_destroy_notification(struct wlan_objmgr_pdev *pdev,
|
||||
void *arg_list)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
struct wifi_ftm_pdev_priv_obj *ftm_pdev_obj =
|
||||
wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_UMAC_COMP_FTM);
|
||||
|
||||
if (NULL == ftm_pdev_obj) {
|
||||
ftm_err("invalid wifi ftm obj");
|
||||
return QDF_STATUS_E_FAULT;
|
||||
}
|
||||
|
||||
status = wlan_objmgr_pdev_component_obj_detach(pdev, WLAN_UMAC_COMP_FTM,
|
||||
ftm_pdev_obj);
|
||||
|
||||
status = ftm_pdev_obj_deinit(ftm_pdev_obj);
|
||||
ftm_pdev_obj->pdev = NULL;
|
||||
|
||||
qdf_mem_free(ftm_pdev_obj);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
wlan_ftm_testmode_attach(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
struct wlan_lmac_if_ftm_tx_ops *ftm_tx_ops;
|
||||
|
||||
ftm_tx_ops = wlan_psoc_get_ftm_txops(psoc);
|
||||
|
||||
if (ftm_tx_ops->ftm_attach)
|
||||
return ftm_tx_ops->ftm_attach(psoc);
|
||||
else
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
wlan_ftm_testmode_detach(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
struct wlan_lmac_if_ftm_tx_ops *ftm_tx_ops;
|
||||
|
||||
ftm_tx_ops = wlan_psoc_get_ftm_txops(psoc);
|
||||
|
||||
if (ftm_tx_ops->ftm_detach)
|
||||
return ftm_tx_ops->ftm_detach(psoc);
|
||||
else
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS
|
||||
wlan_ftm_cmd_send(struct wlan_objmgr_pdev *pdev, uint8_t *buf,
|
||||
uint32_t len, uint8_t pdev_id)
|
||||
{
|
||||
struct wlan_lmac_if_ftm_tx_ops *ftm_tx_ops;
|
||||
struct wlan_objmgr_psoc *psoc;
|
||||
|
||||
psoc = wlan_pdev_get_psoc(pdev);
|
||||
if (!psoc)
|
||||
return QDF_STATUS_E_NOENT;
|
||||
|
||||
ftm_tx_ops = wlan_psoc_get_ftm_txops(psoc);
|
||||
|
||||
if (ftm_tx_ops->ftm_cmd_send)
|
||||
return ftm_tx_ops->ftm_cmd_send(pdev, buf, len, pdev_id);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
91
ftm/core/src/wlan_ftm_svc_i.h
Normal file
91
ftm/core/src/wlan_ftm_svc_i.h
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* 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: declare the ftm service data structure and apis
|
||||
*/
|
||||
#ifndef _WLAN_FTM_SVC_H_
|
||||
#define _WLAN_FTM_SVC_H_
|
||||
|
||||
#include <qdf_types.h>
|
||||
#include <qdf_status.h>
|
||||
#include <wlan_objmgr_pdev_obj.h>
|
||||
|
||||
/**
|
||||
* struct ftm_seg_hdr_info - the segment header for the event from FW
|
||||
* @len: length of the segment header
|
||||
* @msgref: message reference
|
||||
* @segment_info: segment information
|
||||
* @pad: padding
|
||||
*
|
||||
*/
|
||||
struct ftm_seg_hdr_info {
|
||||
uint32_t len;
|
||||
uint32_t msgref;
|
||||
uint32_t segment_info;
|
||||
uint32_t pad;
|
||||
};
|
||||
|
||||
/**
|
||||
* wlan_ftm_pdev_obj_create_notification() - ftm pdev create handler
|
||||
* @pdev: pdev pointer
|
||||
* @arg_list: argument list
|
||||
*
|
||||
* return: QDF_STATUS_SUCCESS for success or error code
|
||||
*/
|
||||
QDF_STATUS wlan_ftm_pdev_obj_create_notification(struct wlan_objmgr_pdev *pdev,
|
||||
void *arg_list);
|
||||
|
||||
/**
|
||||
* wlan_ftm_pdev_obj_destroy_notification() - ftm pdev destroy handler
|
||||
* @pdev: pdev pointer
|
||||
* @arg_list: argument list
|
||||
*
|
||||
* return: QDF_STATUS_SUCCESS for success or error code
|
||||
*/
|
||||
QDF_STATUS wlan_ftm_pdev_obj_destroy_notification(struct wlan_objmgr_pdev *pdev,
|
||||
void *arg_list);
|
||||
|
||||
/**
|
||||
* wlan_ftm_cmd_send() - send ftm command to target_if layer
|
||||
* @pdev: pdev pointer
|
||||
* @buf: data buffer
|
||||
* @len: event length
|
||||
*
|
||||
* return: QDF_STATUS_SUCCESS for success or error code
|
||||
*/
|
||||
QDF_STATUS wlan_ftm_cmd_send(struct wlan_objmgr_pdev *pdev, uint8_t *buf,
|
||||
uint32_t len, uint8_t pdev_id);
|
||||
|
||||
/**
|
||||
* wlan_ftm_testmode_attach() - Attach FTM UTF handle
|
||||
* @psoc: psoc pointer
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
|
||||
*/
|
||||
QDF_STATUS wlan_ftm_testmode_attach(struct wlan_objmgr_psoc *psoc);
|
||||
|
||||
/**
|
||||
* wlan_ftm_testmode_detach() - Attach FTM UTF handle
|
||||
* @psoc: psoc pointer
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
|
||||
*/
|
||||
QDF_STATUS wlan_ftm_testmode_detach(struct wlan_objmgr_psoc *psoc);
|
||||
#endif /* _WLAN_FTM_SVC_H_ */
|
||||
59
ftm/dispatcher/inc/wlan_ftm_init_deinit_api.h
Normal file
59
ftm/dispatcher/inc/wlan_ftm_init_deinit_api.h
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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: declare the ftm service data structure and apis
|
||||
*/
|
||||
#ifndef _WLAN_FTM_UCFG_API_H_
|
||||
#define _WLAN_FTM_UCFG_API_H_
|
||||
|
||||
#include <qdf_types.h>
|
||||
#include <qdf_status.h>
|
||||
#include <wlan_objmgr_cmn.h>
|
||||
|
||||
/**
|
||||
* dispatcher_ftm_init() - FTM testmode initialization API
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
|
||||
*/
|
||||
QDF_STATUS dispatcher_ftm_init(void);
|
||||
|
||||
/**
|
||||
* dispatcher_ftm_deinit() - FTM testmode deinitialization API
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
|
||||
*/
|
||||
QDF_STATUS dispatcher_ftm_deinit(void);
|
||||
|
||||
/**
|
||||
* dispatcher_ftm_psoc_open() - FTM module open API
|
||||
* @psoc: psoc object
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
|
||||
*/
|
||||
QDF_STATUS dispatcher_ftm_psoc_open(struct wlan_objmgr_psoc *psoc);
|
||||
|
||||
/**
|
||||
* dispatcher_ftm_psoc_close() - FTM module close API
|
||||
* @psoc: psoc object
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
|
||||
*/
|
||||
QDF_STATUS dispatcher_ftm_psoc_close(struct wlan_objmgr_psoc *psoc);
|
||||
#endif /* _WLAN_FTM_UCFG_API_H_ */
|
||||
125
ftm/dispatcher/inc/wlan_ftm_ucfg_api.h
Normal file
125
ftm/dispatcher/inc/wlan_ftm_ucfg_api.h
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* 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: declare the ftm service data structure and apis
|
||||
*/
|
||||
#ifndef _WLAN_FTM_UCFG_API_H_
|
||||
#define _WLAN_FTM_UCFG_API_H_
|
||||
|
||||
#include <qdf_types.h>
|
||||
#include <qdf_status.h>
|
||||
#include <wlan_objmgr_cmn.h>
|
||||
|
||||
#define FTM_DEBUG 0
|
||||
|
||||
#if FTM_DEBUG
|
||||
#define ftm_log(level, args...) \
|
||||
QDF_TRACE(QDF_MODULE_ID_FTM, level, ## args)
|
||||
#define ftm_logfl(level, format, args...) \
|
||||
ftm_log(level, FL(format), ## args)
|
||||
|
||||
#define ftm_alert(format, args...) \
|
||||
ftm_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
|
||||
#define ftm_err(format, args...) \
|
||||
ftm_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
|
||||
#define ftm_warn(format, args...) \
|
||||
ftm_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
|
||||
#define ftm_notice(format, args...) \
|
||||
ftm_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
|
||||
#define ftm_debug(format, args...) \
|
||||
ftm_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
|
||||
#else
|
||||
#define ftm_alert(format, args...)
|
||||
#define ftm_err(format, args...)
|
||||
#define ftm_warn(format, args...)
|
||||
#define ftm_notice(format, args...)
|
||||
#define ftm_debug(format, args...)
|
||||
#endif
|
||||
|
||||
#define FTM_IOCTL_UNIFIED_UTF_CMD 0x1000
|
||||
#define FTM_IOCTL_UNIFIED_UTF_RSP 0x1001
|
||||
#define FTM_CMD_MAX_BUF_LENGTH 2048
|
||||
|
||||
/**
|
||||
* enum wifi_ftm_cmd_type - the enumeration of the command source per pdev
|
||||
* @WIFI_FTM_CMD_IOCTL: command from ioctl on the pdev
|
||||
* @WIFI_FTM_CMD_NL80211: command from nl80211 on the pdev
|
||||
*
|
||||
*/
|
||||
enum wifi_ftm_pdev_cmd_type {
|
||||
WIFI_FTM_CMD_IOCTL = 1,
|
||||
WIFI_FTM_CMD_NL80211,
|
||||
|
||||
/* command should be added above */
|
||||
WIFI_FTM_CMD_UNKNOWN,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct wifi_ftm_pdev_priv_obj - wifi ftm pdev utf event info
|
||||
* @pdev: pointer to pdev
|
||||
* @data: data ptr
|
||||
* @current_seq: curent squence
|
||||
* @expected_seq: expected sequence
|
||||
* @length: length
|
||||
* @offset: offset
|
||||
* @cmd_type: command type from either ioctl or nl80211
|
||||
*/
|
||||
struct wifi_ftm_pdev_priv_obj {
|
||||
struct wlan_objmgr_pdev *pdev;
|
||||
uint8_t *data;
|
||||
uint8_t current_seq;
|
||||
uint8_t expected_seq;
|
||||
qdf_size_t length;
|
||||
qdf_size_t offset;
|
||||
enum wifi_ftm_pdev_cmd_type cmd_type;
|
||||
};
|
||||
|
||||
/**
|
||||
* wlan_ftm_testmode_cmd() - handle FTM testmode command
|
||||
* @pdev: pdev pointer
|
||||
* @data: data
|
||||
* @len: data length
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
|
||||
*/
|
||||
QDF_STATUS ucfg_wlan_ftm_testmode_cmd(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t *data, uint32_t len);
|
||||
|
||||
/**
|
||||
* wlan_ftm_testmode_rsp() - handle FTM testmode command
|
||||
* @pdev: pdev pointer
|
||||
* @data: data
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
|
||||
*/
|
||||
QDF_STATUS ucfg_wlan_ftm_testmode_rsp(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t *data);
|
||||
|
||||
/**
|
||||
* wlan_ftm_process_utf_event() - process ftm UTF event
|
||||
* @scn_handle: scn handle
|
||||
* @event: event buffer
|
||||
* @len: event length
|
||||
*
|
||||
* return: QDF_STATUS_SUCCESS for success or error code
|
||||
*/
|
||||
QDF_STATUS wlan_ftm_process_utf_event(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t *event_buf, uint32_t len);
|
||||
#endif /* _WLAN_FTM_UCFG_API_H_ */
|
||||
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;
|
||||
}
|
||||
Loading…
Reference in a new issue