qcacld-3.0: Add ini for FTM time sync component

Add ini config required for FTM time sync feature.

"enable_time_sync_ftm"- ini to enable/disable the feature.

"time_sync_ftm_mode" - ini to configure the burst/aggregated mode.
In burst mode the offset derived for each RTT frame is sent by
firmware, in aggregated mode only one offset is sent by firmware.

"time_sync_ftm_role" - ini to configure slave(STA)/master(SAP) role.

Change-Id: I6a06d6fdc4c7556c32ab2d28f1cbaa936b98a85b
CRs-Fixed: 2618654
This commit is contained in:
Surabhi Vishnoi
2020-01-30 20:11:06 +05:30
committed by nshrivas
parent 639c7cc44a
commit 492308b08f
14 changed files with 610 additions and 107 deletions

View File

@@ -41,6 +41,8 @@
#define CFG_NAN_ALL
#endif
#include "cfg_ftm_time_sync.h"
#include "wlan_pmo_cfg.h"
#include "hdd_config.h"
#include "hdd_dp_cfg.h"
@@ -63,4 +65,5 @@
CFG_P2P_ALL \
CFG_PMO_ALL \
CFG_TDLS_ALL \
CFG_PKT_CAPTURE_MODE_ALL
CFG_PKT_CAPTURE_MODE_ALL \
CFG_TIME_SYNC_FTM_ALL

View File

@@ -51,28 +51,92 @@
#define FTM_TIME_SYNC_EXIT() ftm_time_sync_debug("exit")
/**
* ftm_time_sync_vdev_create_notification(): Handler for vdev create notify.
* ftm_time_sync_vdev_create_notification() - Handler for vdev create notify.
* @vdev: vdev which is going to be created by objmgr
* @arg: argument for notification handler.
* @arg: argument for notification handler
*
* Allocate and attach vdev private object.
*
* Return: QDF_STATUS status in case of success else return error.
* Return: QDF_STATUS
*/
QDF_STATUS ftm_timesync_vdev_create_notification(struct wlan_objmgr_vdev *vdev,
void *arg);
QDF_STATUS ftm_time_sync_vdev_create_notification(struct wlan_objmgr_vdev *vdev,
void *arg);
/**
* ftm_time_sync_vdev_destroy_notification(): Handler for vdev destroy notify.
* ftm_time_sync_vdev_destroy_notification() - Handler for vdev destroy notify.
* @vdev: vdev which is going to be destroyed by objmgr
* @arg: argument for notification handler.
*
* Deallocate and detach vdev private object.
*
* Return QDF_STATUS status in case of success else return error
* Return: QDF_STATUS
*/
QDF_STATUS
ftm_timesync_vdev_destroy_notification(struct wlan_objmgr_vdev *vdev,
ftm_time_sync_vdev_destroy_notification(struct wlan_objmgr_vdev *vdev,
void *arg);
/**
* ftm_time_sync_psoc_create_notification() - Handler for psoc create notify.
* @psoc: psoc which is going to be created by objmgr
* @arg: argument for notification handler.
*
* Allocate and attach psoc private object.
*
* Return: QDF_STATUS
*/
QDF_STATUS
ftm_time_sync_psoc_create_notification(struct wlan_objmgr_psoc *psoc,
void *arg);
/**
* ftm_time_sync_psoc_destroy_notification() - Handler for psoc destroy notify.
* @psoc: psoc which is going to be destroyed by objmgr
* @arg: argument for notification handler.
*
* Deallocate and detach psoc private object.
*
* Return: QDF_STATUS
*/
QDF_STATUS
ftm_time_sync_psoc_destroy_notification(struct wlan_objmgr_psoc *psoc,
void *arg);
/**
* ftm_time_sync_is_enable() - Function to advertise feature is enabled or not
* @psoc: psoc context
*
* This function advertises whether the feature is enabled or not.
*
* Return: true if enable, false if disable
*/
bool ftm_time_sync_is_enable(struct wlan_objmgr_psoc *psoc);
/**
* ftm_time_sync_set_enable() - Handler to enable the feature
* @psoc: psoc context
* @value: value to be set
*
* This function is used to enable the ftm time sync feature.
* The feature is enabled iff both ini and wmi service is advertised by
* firmware.
*
* Return: None
*/
void ftm_time_sync_set_enable(struct wlan_objmgr_psoc *psoc, bool value);
/**
* ftm_time_sync_get_mode() - API to get the ftm time sync mode
* @psoc: psoc context
*
* Return: enum ftm_time_sync_mode
*/
enum ftm_time_sync_mode ftm_time_sync_get_mode(struct wlan_objmgr_psoc *psoc);
/**
* ftm_time_sync_get_role() - API to get the ftm time sync role
* @psoc: psoc context
*
* Return: enum ftm_time_sync_role
*/
enum ftm_time_sync_role ftm_time_sync_get_role(struct wlan_objmgr_psoc *psoc);
#endif /* end of _FTM_TIME_SYNC_MAIN_H_ */

View File

@@ -27,46 +27,46 @@
#include "wlan_objmgr_global_obj.h"
/**
* ftm_timesync_vdev_get_ref() - Wrapper to increment ftm_timesync ref count
* ftm_time_sync_vdev_get_ref() - Wrapper to increment ftm_time_sync ref count
* @vdev: vdev object
*
* Wrapper for ftm_timesync to increment ref count after checking valid
* Wrapper for ftm_time_sync to increment ref count after checking valid
* object state.
*
* Return: SUCCESS/FAILURE
*/
static inline
QDF_STATUS ftm_timesync_vdev_get_ref(struct wlan_objmgr_vdev *vdev)
QDF_STATUS ftm_time_sync_vdev_get_ref(struct wlan_objmgr_vdev *vdev)
{
return wlan_objmgr_vdev_try_get_ref(vdev, FTM_TIME_SYNC_ID);
}
/**
* ftm_timesync_vdev_put_ref() - Wrapper to decrement ftm_timesync ref count
* ftm_time_sync_vdev_put_ref() - Wrapper to decrement ftm_time_sync ref count
* @vdev: vdev object
*
* Wrapper for ftm_timesync to decrement ref count of vdev.
* Wrapper for ftm_time_sync to decrement ref count of vdev.
*
* Return: SUCCESS/FAILURE
*/
static inline
void ftm_timesync_vdev_put_ref(struct wlan_objmgr_vdev *vdev)
void ftm_time_sync_vdev_put_ref(struct wlan_objmgr_vdev *vdev)
{
return wlan_objmgr_vdev_release_ref(vdev, FTM_TIME_SYNC_ID);
}
/**
* ftm_timesync_vdev_get_priv(): Wrapper to retrieve vdev priv obj
* ftm_time_sync_vdev_get_priv() - Wrapper to retrieve vdev priv obj
* @vdev: vdev pointer
*
* Wrapper for ftm_timesync to get vdev private object pointer.
* Wrapper for ftm_time_sync to get vdev private object pointer.
*
* Return: Private object of vdev
*/
static inline struct ftm_timesync_vdev_priv *
ftm_timesync_vdev_get_priv(struct wlan_objmgr_vdev *vdev)
static inline struct ftm_time_sync_vdev_priv *
ftm_time_sync_vdev_get_priv(struct wlan_objmgr_vdev *vdev)
{
struct ftm_timesync_vdev_priv *vdev_priv;
struct ftm_time_sync_vdev_priv *vdev_priv;
vdev_priv = wlan_objmgr_vdev_get_comp_private_obj(
vdev, WLAN_UMAC_COMP_FTM_TIME_SYNC);
@@ -75,4 +75,52 @@ ftm_timesync_vdev_get_priv(struct wlan_objmgr_vdev *vdev)
return vdev_priv;
}
/**
* ftm_time_sync_psoc_get_ref() - Wrapper to increment ftm_time sync ref count
* @psoc: psoc object
*
* Wrapper for ftm time sync to increment ref count after checking valid
* object state.
*
* Return: QDF_STATUS
*/
static inline
QDF_STATUS ftm_time_sync_psoc_get_ref(struct wlan_objmgr_psoc *psoc)
{
return wlan_objmgr_psoc_try_get_ref(psoc, FTM_TIME_SYNC_ID);
}
/**
* ftm_time_sync_psoc_put_ref() - Wrapper to decrement ftm time sync ref count
* @psoc: psoc object
*
* Wrapper for ftm time sync to decrement ref count of psoc.
*
* Return: None
*/
static inline
void ftm_time_sync_psoc_put_ref(struct wlan_objmgr_psoc *psoc)
{
wlan_objmgr_psoc_release_ref(psoc, FTM_TIME_SYNC_ID);
}
/**
* ftm_time_sync_psoc_get_priv() - Wrapper to retrieve psoc priv obj
* @psoc: psoc pointer
*
* Wrapper for ftm time sync to get psoc private object pointer.
*
* Return: ftm time sync psoc private object
*/
static inline struct ftm_time_sync_psoc_priv *
ftm_time_sync_psoc_get_priv(struct wlan_objmgr_psoc *psoc)
{
struct ftm_time_sync_psoc_priv *psoc_priv;
psoc_priv = wlan_objmgr_psoc_get_comp_private_obj(
psoc, WLAN_UMAC_COMP_FTM_TIME_SYNC);
QDF_BUG(psoc_priv);
return psoc_priv;
}
#endif /* _FTM_TIME_SYNC_OBJMGR_H */

View File

@@ -16,10 +16,10 @@
/**
* DOC: Declare private API which shall be used internally only
* in ftm_timesync component. This file shall include prototypes of
* ftm_timesync parsing and send logic.
* in ftm_time_sync component. This file shall include prototypes of
* ftm_time_sync parsing and send logic.
*
* Note: This API should be never accessed out of ftm_timesync component.
* Note: This API should be never accessed out of ftm_time_sync component.
*/
#ifndef _FTM_TIME_SYNC_PRIV_STRUCT_H_
@@ -43,20 +43,42 @@ struct wlan_time_sync_pair {
};
/**
* struct ftm_timesync_vdev_priv - Private object to be stored in vdev
* struct ftm_time_sync_vdev_priv - Private object to be stored in vdev
* @qtime_ref: qtime ref
* @mac_ref: mac time ref
* @time_pair: array of master/slave qtime pair
*/
struct ftm_timesync_priv {
struct ftm_time_sync_priv {
uint64_t qtime_ref;
uint64_t mac_ref;
struct wlan_time_sync_pair time_pair[WLAN_FTM_TIME_SYNC_PAIR_MAX];
};
/**
* struct ftm_timesync_vdev_priv - Private object to be stored in vdev
* struct ftm_time_sync_cfg - Cfg ini param for FTM time sync
* @enable: FTM time_sync feature enable/disable
* @mode: Aggregated/burst mode applicable iff enable = 1
* @role: Slave/Master Role applicable iff enable = 1
*/
struct ftm_time_sync_cfg {
bool enable;
enum ftm_time_sync_mode mode;
enum ftm_time_sync_role role;
};
/**
* struct ftm_time_sync_psoc_priv - Private object to be stored in psoc
* @psoc: pointer to psoc object
* @cfg_param: INI config param for ftm time sync
*/
struct ftm_time_sync_psoc_priv {
struct wlan_objmgr_psoc *psoc;
struct ftm_time_sync_cfg cfg_param;
};
/**
* struct ftm_time_sync_vdev_priv - Private object to be stored in vdev
* @vdev: pointer to vdev object
* @ftm_ts_priv: time sync private struct
* @rx_ops: rx operations for ftm time sync
@@ -68,11 +90,11 @@ struct ftm_timesync_priv {
* @num_reads: number of times the qtime to be captured
* @valid: send qtime to FW only if this is true
*/
struct ftm_timesync_vdev_priv {
struct ftm_time_sync_vdev_priv {
struct wlan_objmgr_vdev *vdev;
struct ftm_timesync_priv ftm_ts_priv;
struct wlan_ftm_timesync_rx_ops rx_ops;
struct wlan_ftm_timesync_tx_ops tx_ops;
struct ftm_time_sync_priv ftm_ts_priv;
struct wlan_ftm_time_sync_rx_ops rx_ops;
struct wlan_ftm_time_sync_tx_ops tx_ops;
qdf_mutex_t ftm_time_sync_mutex;
struct qdf_delayed_work ftm_time_sync_work;
uint32_t time_sync_interval;

View File

@@ -16,16 +16,91 @@
/**
* DOC: Implement various notification handlers which are accessed
* internally in ftm_timesync component only.
* internally in ftm_time_sync component only.
*/
#include "ftm_time_sync_main.h"
#include "target_if_ftm_time_sync.h"
#include "wlan_objmgr_vdev_obj.h"
#include "cfg_ftm_time_sync.h"
#include "cfg_ucfg_api.h"
#include <pld_common.h>
void ftm_time_sync_set_enable(struct wlan_objmgr_psoc *psoc, bool value)
{
struct ftm_time_sync_psoc_priv *psoc_priv;
if (!psoc) {
ftm_time_sync_err("psoc is NULL");
return;
}
psoc_priv = ftm_time_sync_psoc_get_priv(psoc);
if (!psoc_priv) {
ftm_time_sync_err("psoc priv is NULL");
return;
}
psoc_priv->cfg_param.enable &= value;
}
bool ftm_time_sync_is_enable(struct wlan_objmgr_psoc *psoc)
{
struct ftm_time_sync_psoc_priv *psoc_priv;
if (!psoc) {
ftm_time_sync_err("psoc is NULL");
return false;
}
psoc_priv = ftm_time_sync_psoc_get_priv(psoc);
if (!psoc_priv) {
ftm_time_sync_err("psoc priv is NULL");
return false;
}
return psoc_priv->cfg_param.enable;
}
enum ftm_time_sync_mode ftm_time_sync_get_mode(struct wlan_objmgr_psoc *psoc)
{
struct ftm_time_sync_psoc_priv *psoc_priv;
if (!psoc) {
ftm_time_sync_err("psoc is NULL");
return FTM_TIMESYNC_AGGREGATED_MODE;
}
psoc_priv = ftm_time_sync_psoc_get_priv(psoc);
if (!psoc_priv) {
ftm_time_sync_err("psoc priv is NULL");
return FTM_TIMESYNC_AGGREGATED_MODE;
}
return psoc_priv->cfg_param.mode;
}
enum ftm_time_sync_role ftm_time_sync_get_role(struct wlan_objmgr_psoc *psoc)
{
struct ftm_time_sync_psoc_priv *psoc_priv;
if (!psoc) {
ftm_time_sync_err("psoc is NULL");
return FTM_TIMESYNC_SLAVE_ROLE;
}
psoc_priv = ftm_time_sync_psoc_get_priv(psoc);
if (!psoc_priv) {
ftm_time_sync_err("psoc priv is NULL");
return FTM_TIMESYNC_SLAVE_ROLE;
}
return psoc_priv->cfg_param.role;
}
static void ftm_time_sync_work_handler(void *arg)
{
struct ftm_timesync_vdev_priv *vdev_priv = arg;
struct ftm_time_sync_vdev_priv *vdev_priv = arg;
struct wlan_objmgr_psoc *psoc;
qdf_device_t qdf_dev;
QDF_STATUS status;
@@ -73,12 +148,21 @@ static void ftm_time_sync_work_handler(void *arg)
}
QDF_STATUS
ftm_timesync_vdev_create_notification(struct wlan_objmgr_vdev *vdev, void *arg)
ftm_time_sync_vdev_create_notification(struct wlan_objmgr_vdev *vdev, void *arg)
{
struct ftm_timesync_vdev_priv *vdev_priv;
struct ftm_time_sync_vdev_priv *vdev_priv;
struct wlan_objmgr_psoc *psoc;
QDF_STATUS status;
psoc = wlan_vdev_get_psoc(vdev);
if (!psoc) {
ftm_time_sync_err("Failed to get psoc");
return QDF_STATUS_E_INVAL;
}
if (!ftm_time_sync_is_enable(psoc))
return QDF_STATUS_SUCCESS;
vdev_priv = qdf_mem_malloc(sizeof(*vdev_priv));
if (!vdev_priv) {
status = QDF_STATUS_E_NOMEM;
@@ -93,12 +177,6 @@ ftm_timesync_vdev_create_notification(struct wlan_objmgr_vdev *vdev, void *arg)
goto free_vdev_priv;
}
psoc = wlan_vdev_get_psoc(vdev);
if (!psoc) {
ftm_time_sync_err("Failed to get psoc");
return QDF_STATUS_E_INVAL;
}
vdev_priv->vdev = vdev;
status = qdf_delayed_work_create(&vdev_priv->ftm_time_sync_work,
ftm_time_sync_work_handler, vdev_priv);
@@ -108,11 +186,12 @@ ftm_timesync_vdev_create_notification(struct wlan_objmgr_vdev *vdev, void *arg)
}
qdf_mutex_create(&vdev_priv->ftm_time_sync_mutex);
target_if_ftm_time_sync_register_tx_ops(&vdev_priv->tx_ops);
target_if_ftm_time_sync_register_rx_ops(&vdev_priv->rx_ops);
vdev_priv->rx_ops.ftm_timesync_register_start_stop(psoc);
vdev_priv->rx_ops.ftm_timesync_regiser_master_slave_offset(psoc);
vdev_priv->rx_ops.ftm_time_sync_register_start_stop(psoc);
vdev_priv->rx_ops.ftm_time_sync_regiser_master_slave_offset(psoc);
vdev_priv->valid = true;
@@ -142,12 +221,24 @@ ftm_time_sync_deregister_wmi_events(struct wlan_objmgr_vdev *vdev)
}
QDF_STATUS
ftm_timesync_vdev_destroy_notification(struct wlan_objmgr_vdev *vdev, void *arg)
ftm_time_sync_vdev_destroy_notification(struct wlan_objmgr_vdev *vdev,
void *arg)
{
struct ftm_timesync_vdev_priv *vdev_priv = NULL;
struct ftm_time_sync_vdev_priv *vdev_priv = NULL;
struct wlan_objmgr_psoc *psoc;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
vdev_priv = ftm_timesync_vdev_get_priv(vdev);
psoc = wlan_vdev_get_psoc(vdev);
if (!psoc) {
ftm_time_sync_err("Failed to get psoc");
return QDF_STATUS_E_INVAL;
}
if (!ftm_time_sync_is_enable(psoc))
return QDF_STATUS_SUCCESS;
vdev_priv = ftm_time_sync_vdev_get_priv(vdev);
if (!vdev_priv) {
ftm_time_sync_err("vdev priv is NULL");
goto exit;
@@ -170,3 +261,67 @@ ftm_timesync_vdev_destroy_notification(struct wlan_objmgr_vdev *vdev, void *arg)
exit:
return status;
}
static void
ftm_time_sync_cfg_init(struct ftm_time_sync_psoc_priv *psoc_priv)
{
psoc_priv->cfg_param.enable = cfg_get(psoc_priv->psoc,
CFG_ENABLE_TIME_SYNC_FTM);
psoc_priv->cfg_param.role = cfg_get(psoc_priv->psoc,
CFG_TIME_SYNC_FTM_ROLE);
psoc_priv->cfg_param.mode = cfg_get(psoc_priv->psoc,
CFG_TIME_SYNC_FTM_MODE);
}
QDF_STATUS
ftm_time_sync_psoc_create_notification(struct wlan_objmgr_psoc *psoc, void *arg)
{
struct ftm_time_sync_psoc_priv *psoc_priv;
QDF_STATUS status;
psoc_priv = qdf_mem_malloc(sizeof(*psoc_priv));
if (!psoc_priv)
return QDF_STATUS_E_NOMEM;
status = wlan_objmgr_psoc_component_obj_attach(
psoc, WLAN_UMAC_COMP_FTM_TIME_SYNC,
psoc_priv, QDF_STATUS_SUCCESS);
if (QDF_IS_STATUS_ERROR(status)) {
ftm_time_sync_err("Failed to attach psoc component obj");
goto free_psoc_priv;
}
psoc_priv->psoc = psoc;
ftm_time_sync_cfg_init(psoc_priv);
return status;
free_psoc_priv:
qdf_mem_free(psoc_priv);
return status;
}
QDF_STATUS
ftm_time_sync_psoc_destroy_notification(struct wlan_objmgr_psoc *psoc,
void *arg)
{
struct ftm_time_sync_psoc_priv *psoc_priv;
QDF_STATUS status;
psoc_priv = ftm_time_sync_psoc_get_priv(psoc);
if (!psoc_priv) {
ftm_time_sync_err("psoc priv is NULL");
return QDF_STATUS_E_FAILURE;
}
status = wlan_objmgr_psoc_component_obj_detach(
psoc, WLAN_UMAC_COMP_FTM_TIME_SYNC,
psoc_priv);
if (QDF_IS_STATUS_ERROR(status)) {
ftm_time_sync_err("Failed to detach psoc component obj");
return status;
}
qdf_mem_free(psoc_priv);
return status;
}

View File

@@ -0,0 +1,96 @@
/*
* Copyright (c) 2020, 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.
*/
#if !defined(__FTM_TIME_SYNC_CFG_H__)
#define __FTM_TIME_SYNC_CFG_H__
/**
*
* DOC: ftm_time_sync_cfg.h
*
* FTM TIME SYNC feature INI configuration parameter definitions
*/
#ifdef FEATURE_WLAN_TIME_SYNC_FTM
#include "cfg_define.h"
#include "cfg_converged.h"
#include "qdf_types.h"
/*
* <ini>
* enable_time_sync_ftm - Time Sync FTM feature support
* @Min: 0
* @Max: 1
* @Default: 0
*
* When set to 1 Time Sync FTM feature will be enabled.
*
* Supported Feature: Time Sync FTM
*
* Usage: External
*
* </ini>
*/
#define CFG_ENABLE_TIME_SYNC_FTM CFG_INI_BOOL("enable_time_sync_ftm", \
0, \
"Enable Time Sync FTM Support")
/*
* <ini>
* time_sync_ftm_mode- Time Sync FTM feature Mode configuration
* @Min: 0 - Aggregated Mode
* @Max: 1 - Burst Mode
* @Default: 0
*
* This ini is applicable only if enable_time_sync_ftm is set to 1.
*
* Supported Feature: Time Sync FTM
*
* Usage: External
*
* </ini>
*/
#define CFG_TIME_SYNC_FTM_MODE CFG_INI_BOOL("time_sync_ftm_mode", \
0, \
"Configure Time Sync FTM Mode")
/*
* <ini>
* time_sync_ftm_role- Time Sync FTM feature Role configuration
* @Min: 0 - Slave Role
* @Max: 1 - Master Role
* @Default: 0
*
* This ini is applicable only if enable_time_sync_ftm is set to 1.
*
* Supported Feature: Time Sync FTM
*
* Usage: External
*
* </ini>
*/
#define CFG_TIME_SYNC_FTM_ROLE CFG_INI_BOOL("time_sync_ftm_role", \
0, \
"Configure Time Sync FTM Role")
#define CFG_TIME_SYNC_FTM_ALL \
CFG(CFG_ENABLE_TIME_SYNC_FTM) \
CFG(CFG_TIME_SYNC_FTM_MODE) \
CFG(CFG_TIME_SYNC_FTM_ROLE)
#else
#define CFG_TIME_SYNC_FTM_ALL
#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
#endif /* __FTM_TIME_SYNC_CFG_H__ */

View File

@@ -15,7 +15,7 @@
*/
/**
* DOC: Declare public API related to the ftm timesync called by north bound
* DOC: Declare public API related to the ftm time_sync called by north bound
* HDD/OSIF/LIM
*/
@@ -24,13 +24,12 @@
#include <qdf_status.h>
#include <qdf_types.h>
//#include "ftm_time_sync_public_struct.h"
#include "ftm_time_sync_objmgr.h"
#ifdef FEATURE_WLAN_TIME_SYNC_FTM
/**
* ucfg_ftm_timesync_init() - FTM time sync component initialization.
* ucfg_ftm_time_sync_init() - FTM time sync component initialization.
*
* This function initializes the ftm time sync component and registers
* the handlers which are invoked on vdev creation.
@@ -38,29 +37,59 @@
* Return: For successful registration - QDF_STATUS_SUCCESS,
* else QDF_STATUS error codes.
*/
QDF_STATUS ucfg_ftm_timesync_init(void);
QDF_STATUS ucfg_ftm_time_sync_init(void);
/**
* ucfg_ftm_timesync_deinit() - FTM time sync component deinit.
* ucfg_ftm_time_sync_deinit() - FTM time sync component deinit.
*
* This function deinits ftm time sync component.
*
* Return: None
*/
void ucfg_ftm_timesync_deinit(void);
void ucfg_ftm_time_sync_deinit(void);
/**
* ucfg_is_ftm_time_sync_enable() - FTM time sync feature enable/disable
* @psoc: psoc context
*
* This function advertises whether the ftm time sync feature is enabled or not
*
* Return: true if enable else false
*/
bool ucfg_is_ftm_time_sync_enable(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_ftm_time_sync_set_enable() - FTM time sync feature set enable/disable
* @psoc: psoc context
* @value: value to be set
*
* This function enables/disables the feature.
*
* Return: None
*/
void ucfg_ftm_time_sync_set_enable(struct wlan_objmgr_psoc *psoc, bool value);
#else
static inline
QDF_STATUS ucfg_ftm_timesync_init(void)
QDF_STATUS ucfg_ftm_time_sync_init(void)
{
return QDF_STATUS_SUCCESS;
}
static inline
void ucfg_ftm_timesync_deinit(void)
void ucfg_ftm_time_sync_deinit(void)
{
}
static inline
bool ucfg_is_ftm_time_sync_enable(struct wlan_objmgr_psoc *psoc)
{
return false;
}
static inline
void ucfg_ftm_time_sync_set_enable(struct wlan_objmgr_psoc *psoc, bool value)
{
}
#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
#endif /* _FTM_TIME_SYNC_UCFG_API_H_ */

View File

@@ -25,14 +25,38 @@
#ifndef _WLAN_TIME_SYNC_FTM_PUBLIC_STRUCT_H_
#define _WLAN_TIME_SYNC_FTM_PUBLIC_STRUCT_H_
struct wlan_objmgr_psoc;
/**
* struct wlan_ftm_timesync_tx_ops - structure of tx operation function
* pointers for ftm timesync component
* enum ftm_time_sync_mode - ftm time sync modes
* @FTM_TIMESYNC_AGGREGATED_MODE: Ftm time sync aggregated mode
* Only one aggregated offset is provided
* @FTM_TIMESYNC_BURST_MODE: Ftm time sync burst mode, offset for each FTM
* frame is provided
*/
enum ftm_time_sync_mode {
FTM_TIMESYNC_AGGREGATED_MODE,
FTM_TIMESYNC_BURST_MODE,
};
/**
* enum ftm_time_sync_role - ftm time sync role
* @FTM_TIMESYNC_SLAVE_ROLE: Slave/STA role
* @FTM_TIMESYNC_MASTER_ROLE: Master/SAP role
*/
enum ftm_time_sync_role {
FTM_TIMESYNC_SLAVE_ROLE,
FTM_TIMESYNC_MASTER_ROLE,
};
/**
* struct wlan_ftm_time_sync_tx_ops - structure of tx operation function
* pointers for ftm time_sync component
* @ftm_time_sync_send_qtime: send qtime wmi cmd to FW
* @ftm_time_sync_send_trigger: send ftm time sync trigger cmd
*
*/
struct wlan_ftm_timesync_tx_ops {
struct wlan_ftm_time_sync_tx_ops {
QDF_STATUS (*ftm_time_sync_send_qtime)(struct wlan_objmgr_psoc *psoc,
uint32_t vdev_id,
uint64_t lpass_ts);
@@ -41,16 +65,16 @@ struct wlan_ftm_timesync_tx_ops {
};
/**
* struct wlan_ftm_timesync_rx_ops - structure of rx operation function
* pointers for ftm timesync component
* @ftm_timesync_register_start_stop: register ftm timesync start stop event
* @ftm_timesync_regiser_master_slave_offset: register master slave qtime
* offset event
* struct wlan_ftm_time_sync_rx_ops - structure of rx operation function
* pointers for ftm time_sync component
* @ftm_time_sync_register_start_stop: register ftm time_sync start stop event
* @ftm_time_sync_regiser_master_slave_offset: register master slave qtime
* offset event
*/
struct wlan_ftm_timesync_rx_ops {
QDF_STATUS (*ftm_timesync_register_start_stop)
struct wlan_ftm_time_sync_rx_ops {
QDF_STATUS (*ftm_time_sync_register_start_stop)
(struct wlan_objmgr_psoc *psoc);
QDF_STATUS (*ftm_timesync_regiser_master_slave_offset)
QDF_STATUS (*ftm_time_sync_regiser_master_slave_offset)
(struct wlan_objmgr_psoc *psoc);
};
#endif /*_WLAN_TIME_SYNC_FTM_PUBLIC_STRUCT_H_ */

View File

@@ -15,56 +15,108 @@
*/
/**
* DOC: Public API implementation of ftm timesync called by north bound iface.
* DOC: Public API implementation of ftm time_sync called by north bound iface.
*/
#include "ftm_time_sync_ucfg_api.h"
#include "ftm_time_sync_main.h"
#include <qdf_str.h>
QDF_STATUS ucfg_ftm_timesync_init(void)
QDF_STATUS ucfg_ftm_time_sync_init(void)
{
QDF_STATUS status;
status = wlan_objmgr_register_psoc_create_handler(
WLAN_UMAC_COMP_FTM_TIME_SYNC,
ftm_time_sync_psoc_create_notification,
NULL);
if (QDF_IS_STATUS_ERROR(status)) {
ftm_time_sync_err("Failed to register psoc create handler");
return status;
}
status = wlan_objmgr_register_psoc_destroy_handler(
WLAN_UMAC_COMP_FTM_TIME_SYNC,
ftm_time_sync_psoc_destroy_notification,
NULL);
if (QDF_IS_STATUS_ERROR(status)) {
ftm_time_sync_err("Failed to register psoc delete handler");
goto fail_destroy_psoc;
}
status = wlan_objmgr_register_vdev_create_handler(
WLAN_UMAC_COMP_FTM_TIME_SYNC,
ftm_timesync_vdev_create_notification, NULL);
if (!QDF_IS_STATUS_SUCCESS(status)) {
ftm_time_sync_vdev_create_notification, NULL);
if (QDF_IS_STATUS_ERROR(status)) {
ftm_time_sync_err("Failed to register vdev create handler");
goto exit;
goto fail_create_vdev;
}
status = wlan_objmgr_register_vdev_destroy_handler(
WLAN_UMAC_COMP_FTM_TIME_SYNC,
ftm_timesync_vdev_destroy_notification, NULL);
if (QDF_IS_STATUS_SUCCESS(status)) {
ftm_time_sync_debug("vdev create/delete notif registered");
goto exit;
ftm_time_sync_vdev_destroy_notification, NULL);
if (QDF_IS_STATUS_ERROR(status)) {
ftm_time_sync_err("Failed to register vdev destroy handler");
goto fail_destroy_vdev;
}
return status;
ftm_time_sync_err("Failed to register vdev delete handler");
fail_destroy_vdev:
wlan_objmgr_unregister_vdev_create_handler(
WLAN_UMAC_COMP_FTM_TIME_SYNC,
ftm_timesync_vdev_create_notification, NULL);
WLAN_UMAC_COMP_FTM_TIME_SYNC,
ftm_time_sync_vdev_create_notification, NULL);
fail_create_vdev:
wlan_objmgr_unregister_psoc_destroy_handler(
WLAN_UMAC_COMP_FTM_TIME_SYNC,
ftm_time_sync_psoc_destroy_notification, NULL);
fail_destroy_psoc:
wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_FTM_TIME_SYNC,
ftm_time_sync_psoc_create_notification, NULL);
exit:
return status;
}
void ucfg_ftm_timesync_deinit(void)
void ucfg_ftm_time_sync_deinit(void)
{
QDF_STATUS status;
status = wlan_objmgr_unregister_vdev_create_handler(
WLAN_UMAC_COMP_FTM_TIME_SYNC,
ftm_timesync_vdev_create_notification, NULL);
if (!QDF_IS_STATUS_SUCCESS(status))
ftm_time_sync_err("Failed to unregister vdev create handler");
status = wlan_objmgr_unregister_vdev_destroy_handler(
WLAN_UMAC_COMP_FTM_TIME_SYNC,
ftm_timesync_vdev_destroy_notification,
ftm_time_sync_vdev_destroy_notification,
NULL);
if (!QDF_IS_STATUS_SUCCESS(status))
if (QDF_IS_STATUS_ERROR(status))
ftm_time_sync_err("Failed to unregister vdev delete handler");
status = wlan_objmgr_unregister_vdev_create_handler(
WLAN_UMAC_COMP_FTM_TIME_SYNC,
ftm_time_sync_vdev_create_notification, NULL);
if (!QDF_IS_STATUS_ERROR(status))
ftm_time_sync_err("Failed to unregister vdev create handler");
status = wlan_objmgr_unregister_psoc_destroy_handler(
WLAN_UMAC_COMP_FTM_TIME_SYNC,
ftm_time_sync_psoc_destroy_notification,
NULL);
if (QDF_IS_STATUS_ERROR(status))
ftm_time_sync_err("Failed to unregister psoc destroy handler");
status = wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_FTM_TIME_SYNC,
ftm_time_sync_psoc_create_notification,
NULL);
if (QDF_IS_STATUS_ERROR(status))
ftm_time_sync_err("Failed to unregister psoc create handler");
}
bool ucfg_is_ftm_time_sync_enable(struct wlan_objmgr_psoc *psoc)
{
return ftm_time_sync_is_enable(psoc);
}
void ucfg_ftm_time_sync_set_enable(struct wlan_objmgr_psoc *psoc, bool enable)
{
return ftm_time_sync_set_enable(psoc, enable);
}

View File

@@ -28,7 +28,7 @@ tgt_ftm_ts_start_stop_evt(struct wlan_objmgr_psoc *psoc,
struct ftm_time_sync_start_stop_params *param)
{
struct wlan_objmgr_vdev *vdev;
struct ftm_timesync_vdev_priv *vdev_priv;
struct ftm_time_sync_vdev_priv *vdev_priv;
uint8_t vdev_id;
vdev_id = param->vdev_id;
@@ -40,7 +40,7 @@ tgt_ftm_ts_start_stop_evt(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_FAILURE;
}
vdev_priv = ftm_timesync_vdev_get_priv(vdev);
vdev_priv = ftm_time_sync_vdev_get_priv(vdev);
qdf_mutex_acquire(&vdev_priv->ftm_time_sync_mutex);
@@ -61,7 +61,7 @@ tgt_ftm_ts_start_stop_evt(struct wlan_objmgr_psoc *psoc,
qdf_mutex_release(&vdev_priv->ftm_time_sync_mutex);
}
ftm_timesync_vdev_put_ref(vdev);
ftm_time_sync_vdev_put_ref(vdev);
return QDF_STATUS_SUCCESS;
}
@@ -69,7 +69,7 @@ tgt_ftm_ts_start_stop_evt(struct wlan_objmgr_psoc *psoc,
QDF_STATUS tgt_ftm_ts_offset_evt(struct wlan_objmgr_psoc *psoc,
struct ftm_time_sync_offset *param)
{
struct ftm_timesync_vdev_priv *vdev_priv;
struct ftm_time_sync_vdev_priv *vdev_priv;
struct wlan_objmgr_vdev *vdev;
uint8_t vdev_id;
int iter;
@@ -83,7 +83,7 @@ QDF_STATUS tgt_ftm_ts_offset_evt(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_FAILURE;
}
vdev_priv = ftm_timesync_vdev_get_priv(vdev);
vdev_priv = ftm_time_sync_vdev_get_priv(vdev);
vdev_priv->num_qtime_pair = param->num_qtime <
FTM_TIME_SYNC_QTIME_PAIR_MAX ? param->num_qtime :
@@ -96,7 +96,7 @@ QDF_STATUS tgt_ftm_ts_offset_evt(struct wlan_objmgr_psoc *psoc,
param->pairs[iter].qtime_slave;
}
ftm_timesync_vdev_put_ref(vdev);
ftm_time_sync_vdev_put_ref(vdev);
return QDF_STATUS_SUCCESS;
}

View File

@@ -34,7 +34,7 @@
*
* Return: None
*/
void target_if_ftm_time_sync_register_rx_ops(struct wlan_ftm_timesync_rx_ops
void target_if_ftm_time_sync_register_rx_ops(struct wlan_ftm_time_sync_rx_ops
*rx_ops);
/**
@@ -44,7 +44,7 @@ void target_if_ftm_time_sync_register_rx_ops(struct wlan_ftm_timesync_rx_ops
*
* Return: None
*/
void target_if_ftm_time_sync_register_tx_ops(struct wlan_ftm_timesync_tx_ops
void target_if_ftm_time_sync_register_tx_ops(struct wlan_ftm_time_sync_tx_ops
*tx_ops);
/**

View File

@@ -107,7 +107,7 @@ target_if_ftm_time_sync_start_stop_event(struct wlan_objmgr_psoc *psoc)
target_if_time_sync_ftm_start_stop_event_handler,
WMI_RX_SERIALIZER_CTX);
if (status) {
target_if_err("Ftm timesync start stop event register failed");
target_if_err("Ftm time_sync start stop event register failed");
return QDF_STATUS_E_FAILURE;
}
@@ -142,7 +142,7 @@ target_if_time_sync_master_slave_offset_event_handler(ol_scn_t scn_handle,
if (wmi_unified_extract_time_sync_ftm_offset(
wmi_handle, data, &param) != QDF_STATUS_SUCCESS) {
target_if_err("Extraction of timesync ftm offset param failed");
target_if_err("Extraction of time_sync ftm offset param failed");
return -EINVAL;
}
@@ -169,7 +169,7 @@ target_if_ftm_time_sync_master_slave_offset(struct wlan_objmgr_psoc *psoc)
target_if_time_sync_master_slave_offset_event_handler,
WMI_RX_SERIALIZER_CTX);
if (status) {
target_if_err("Ftm timesync offset event register failed");
target_if_err("Ftm time_sync offset event register failed");
return QDF_STATUS_E_FAILURE;
}
@@ -210,25 +210,25 @@ target_if_ftm_time_sync_unregister_ev_handlers(struct wlan_objmgr_psoc *psoc)
return QDF_STATUS_SUCCESS;
}
void
target_if_ftm_time_sync_register_rx_ops(struct wlan_ftm_timesync_rx_ops *rx_ops)
void target_if_ftm_time_sync_register_rx_ops(
struct wlan_ftm_time_sync_rx_ops *rx_ops)
{
if (!rx_ops) {
target_if_err("FTM timesync rx_ops is null");
target_if_err("FTM time_sync rx_ops is null");
return;
}
rx_ops->ftm_timesync_register_start_stop =
rx_ops->ftm_time_sync_register_start_stop =
target_if_ftm_time_sync_start_stop_event;
rx_ops->ftm_timesync_regiser_master_slave_offset =
rx_ops->ftm_time_sync_regiser_master_slave_offset =
target_if_ftm_time_sync_master_slave_offset;
}
void
target_if_ftm_time_sync_register_tx_ops(struct wlan_ftm_timesync_tx_ops *tx_ops)
void target_if_ftm_time_sync_register_tx_ops(
struct wlan_ftm_time_sync_tx_ops *tx_ops)
{
if (!tx_ops) {
target_if_err("FTM timesync tx_ops is null");
target_if_err("FTM time_sync tx_ops is null");
return;
}

View File

@@ -14361,7 +14361,7 @@ static QDF_STATUS hdd_component_init(void)
if (QDF_IS_STATUS_ERROR(status))
goto blm_deinit;
status = ucfg_ftm_timesync_init();
status = ucfg_ftm_time_sync_init();
if (QDF_IS_STATUS_ERROR(status))
goto pkt_capture_deinit;
@@ -14413,7 +14413,7 @@ mlme_global_deinit:
static void hdd_component_deinit(void)
{
/* deinitialize non-converged components */
ucfg_ftm_timesync_deinit();
ucfg_ftm_time_sync_deinit();
ucfg_pkt_capture_deinit();
ucfg_blm_deinit();
ucfg_tdls_deinit();

View File

@@ -100,6 +100,7 @@
#include "target_if_vdev_mgr_rx_ops.h"
#include "wlan_policy_mgr_i.h"
#include "target_if_psoc_timer_tx_ops.h"
#include <ftm_time_sync_ucfg_api.h>
#ifdef DIRECT_BUF_RX_ENABLE
#include <target_if_direct_buf_rx_api.h>
@@ -6714,6 +6715,15 @@ int wma_rx_service_ready_ext_event(void *handle, uint8_t *event,
cdp_cfg_set_tx_compl_tsf64(soc, false);
}
if (ucfg_is_ftm_time_sync_enable(wma_handle->psoc) &&
wmi_service_enabled(wmi_handle, wmi_service_time_sync_ftm)) {
wlan_res_cfg->time_sync_ftm = true;
ucfg_ftm_time_sync_set_enable(wma_handle->psoc, true);
} else {
wlan_res_cfg->time_sync_ftm = false;
ucfg_ftm_time_sync_set_enable(wma_handle->psoc, false);
}
wma_init_dbr_params(wma_handle);
wma_set_coex_res_cfg(wma_handle, wmi_handle, wlan_res_cfg);