qcacld-3.0: Add pre cac component

Add support for pre cac component.

Change-Id: I883febac103fc462fcd09f1534fda78c23b96466
CRs-Fixed: 3174505
This commit is contained in:
Dundi Raviteja
2022-04-08 12:48:50 +05:30
committed by Madan Koyyalamudi
parent 341153308e
commit e63bf7f295
8 changed files with 570 additions and 1 deletions

View File

@@ -0,0 +1,243 @@
/*
* Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. 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: Implement various notification handlers which are accessed
* internally in pre_cac component only.
*/
#include "wlan_pre_cac_main.h"
#include "wlan_objmgr_global_obj.h"
struct pre_cac_vdev_priv *
pre_cac_vdev_get_priv_fl(struct wlan_objmgr_vdev *vdev,
const char *func, uint32_t line)
{
struct pre_cac_vdev_priv *vdev_priv;
vdev_priv = wlan_objmgr_vdev_get_comp_private_obj(vdev,
WLAN_UMAC_COMP_PRE_CAC);
if (!vdev_priv) {
pre_cac_nofl_err("%s:%u: vdev id: %d, vdev_priv is NULL",
func, line, wlan_vdev_get_id(vdev));
}
return vdev_priv;
}
struct pre_cac_psoc_priv *
pre_cac_psoc_get_priv_fl(struct wlan_objmgr_psoc *psoc,
const char *func, uint32_t line)
{
struct pre_cac_psoc_priv *psoc_priv;
psoc_priv = wlan_objmgr_psoc_get_comp_private_obj(psoc,
WLAN_UMAC_COMP_PRE_CAC);
if (!psoc_priv)
pre_cac_nofl_err("%s:%u: psoc_priv is NULL", func, line);
return psoc_priv;
}
QDF_STATUS
pre_cac_vdev_create_notification(struct wlan_objmgr_vdev *vdev, void *arg)
{
struct pre_cac_vdev_priv *vdev_priv;
QDF_STATUS status;
vdev_priv = qdf_mem_malloc(sizeof(*vdev_priv));
if (!vdev_priv) {
status = QDF_STATUS_E_NOMEM;
goto exit;
}
status = wlan_objmgr_vdev_component_obj_attach(
vdev, WLAN_UMAC_COMP_PRE_CAC,
(void *)vdev_priv, QDF_STATUS_SUCCESS);
if (QDF_IS_STATUS_ERROR(status)) {
pre_cac_err("Failed to attach priv with vdev");
goto free_vdev_priv;
}
goto exit;
free_vdev_priv:
qdf_mem_free(vdev_priv);
status = QDF_STATUS_E_INVAL;
exit:
return status;
}
QDF_STATUS
pre_cac_vdev_destroy_notification(struct wlan_objmgr_vdev *vdev, void *arg)
{
struct pre_cac_vdev_priv *vdev_priv = NULL;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
vdev_priv = pre_cac_vdev_get_priv(vdev);
if (!vdev_priv) {
pre_cac_err("vdev priv is NULL");
goto exit;
}
status = wlan_objmgr_vdev_component_obj_detach(
vdev, WLAN_UMAC_COMP_PRE_CAC,
(void *)vdev_priv);
if (QDF_IS_STATUS_ERROR(status))
pre_cac_err("Failed to detach priv with vdev");
qdf_mem_free(vdev_priv);
vdev_priv = NULL;
exit:
return status;
}
QDF_STATUS
pre_cac_psoc_create_notification(struct wlan_objmgr_psoc *psoc, void *arg)
{
struct pre_cac_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_PRE_CAC,
psoc_priv, QDF_STATUS_SUCCESS);
if (QDF_IS_STATUS_ERROR(status)) {
pre_cac_err("Failed to attach psoc component obj");
goto free_psoc_priv;
}
return status;
free_psoc_priv:
qdf_mem_free(psoc_priv);
return status;
}
QDF_STATUS
pre_cac_psoc_destroy_notification(struct wlan_objmgr_psoc *psoc, void *arg)
{
struct pre_cac_psoc_priv *psoc_priv;
QDF_STATUS status;
psoc_priv = pre_cac_psoc_get_priv(psoc);
if (!psoc_priv) {
pre_cac_err("psoc priv is NULL");
return QDF_STATUS_E_FAILURE;
}
status = wlan_objmgr_psoc_component_obj_detach(psoc,
WLAN_UMAC_COMP_PRE_CAC,
psoc_priv);
if (QDF_IS_STATUS_ERROR(status)) {
pre_cac_err("Failed to detach psoc component obj");
return status;
}
qdf_mem_free(psoc_priv);
return status;
}
QDF_STATUS pre_cac_init(void)
{
QDF_STATUS status;
status = wlan_objmgr_register_psoc_create_handler(
WLAN_UMAC_COMP_PRE_CAC,
pre_cac_psoc_create_notification,
NULL);
if (QDF_IS_STATUS_ERROR(status)) {
pre_cac_err("Failed to register psoc create handler");
return status;
}
status = wlan_objmgr_register_psoc_destroy_handler(
WLAN_UMAC_COMP_PRE_CAC,
pre_cac_psoc_destroy_notification,
NULL);
if (QDF_IS_STATUS_ERROR(status)) {
pre_cac_err("Failed to register psoc delete handler");
goto fail_destroy_psoc;
}
status = wlan_objmgr_register_vdev_create_handler(
WLAN_UMAC_COMP_PRE_CAC,
pre_cac_vdev_create_notification, NULL);
if (QDF_IS_STATUS_ERROR(status)) {
pre_cac_err("Failed to register vdev create handler");
goto fail_create_vdev;
}
status = wlan_objmgr_register_vdev_destroy_handler(
WLAN_UMAC_COMP_PRE_CAC,
pre_cac_vdev_destroy_notification, NULL);
if (QDF_IS_STATUS_ERROR(status)) {
pre_cac_err("Failed to register vdev destroy handler");
goto fail_destroy_vdev;
}
return status;
fail_destroy_vdev:
wlan_objmgr_unregister_vdev_create_handler(WLAN_UMAC_COMP_PRE_CAC,
pre_cac_vdev_create_notification, NULL);
fail_create_vdev:
wlan_objmgr_unregister_psoc_destroy_handler(WLAN_UMAC_COMP_PRE_CAC,
pre_cac_psoc_destroy_notification, NULL);
fail_destroy_psoc:
wlan_objmgr_unregister_psoc_create_handler(WLAN_UMAC_COMP_PRE_CAC,
pre_cac_psoc_create_notification, NULL);
return status;
}
void pre_cac_deinit(void)
{
QDF_STATUS status;
status = wlan_objmgr_unregister_vdev_destroy_handler(
WLAN_UMAC_COMP_PRE_CAC,
pre_cac_vdev_destroy_notification,
NULL);
if (QDF_IS_STATUS_ERROR(status))
pre_cac_err("Failed to unregister vdev destroy handler");
status = wlan_objmgr_unregister_vdev_create_handler(
WLAN_UMAC_COMP_PRE_CAC,
pre_cac_vdev_create_notification, NULL);
if (QDF_IS_STATUS_ERROR(status))
pre_cac_err("Failed to unregister vdev create handler");
status = wlan_objmgr_unregister_psoc_destroy_handler(
WLAN_UMAC_COMP_PRE_CAC,
pre_cac_psoc_destroy_notification,
NULL);
if (QDF_IS_STATUS_ERROR(status))
pre_cac_err("Failed to unregister psoc destroy handler");
status = wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_PRE_CAC,
pre_cac_psoc_create_notification,
NULL);
if (QDF_IS_STATUS_ERROR(status))
pre_cac_err("Failed to unregister psoc create handler");
}

View File

@@ -0,0 +1,174 @@
/*
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. 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 private API which shall be used internally only
* in pre_cac component. This file shall include prototypes of
* various notification handlers and logging functions.
*
* Note: This API should be never accessed out of pre_cac component.
*/
#ifndef _WLAN_PRE_CAC_MAIN_H_
#define _WLAN_PRE_CAC_MAIN_H_
#include <qdf_types.h>
#include "wlan_objmgr_vdev_obj.h"
#define pre_cac_log(level, args...) \
QDF_TRACE(QDF_MODULE_ID_WLAN_PRE_CAC, level, ## args)
#define pre_cac_logfl(level, format, args...) \
pre_cac_log(level, FL(format), ## args)
#define pre_cac_fatal(format, args...) \
pre_cac_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
#define pre_cac_err(format, args...) \
pre_cac_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
#define pre_cac_warn(format, args...) \
pre_cac_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
#define pre_cac_info(format, args...) \
pre_cac_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
#define pre_cac_debug(format, args...) \
pre_cac_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
#define pre_cac_nofl_err(format, args...) \
pre_cac_log(QDF_TRACE_LEVEL_ERROR, format, ## args)
#define pre_cac_nofl_warn(format, args...) \
pre_cac_log(QDF_TRACE_LEVEL_WARN, format, ## args)
#define pre_cac_nofl_info(format, args...) \
pre_cac_log(QDF_TRACE_LEVEL_INFO, format, ## args)
#define pre_cac_nofl_debug(format, args...) \
pre_cac_log(QDF_TRACE_LEVEL_DEBUG, format, ## args)
#define PRE_CAC_ENTER() pre_cac_debug("enter")
#define PRE_CAC_EXIT() pre_cac_debug("exit")
/**
* struct pre_cac_vdev_priv - Private object to be stored in vdev
* @is_pre_cac_on: status of pre_cac
*/
struct pre_cac_vdev_priv {
bool is_pre_cac_on;
};
/**
* struct pre_cac_psoc_priv - Private object to be stored in psoc
* @pre_cac_work: pre cac work handler
*/
struct pre_cac_psoc_priv {
qdf_work_t pre_cac_work;
};
/**
* pre_cac_vdev_create_notification(): Handler for vdev create notify.
* @vdev: vdev which is going to be created by objmgr
* @arg: argument for notification handler.
*
* Allocate and attach vdev private object.
*
* Return: QDF_STATUS status in case of success else return error.
*/
QDF_STATUS pre_cac_vdev_create_notification(struct wlan_objmgr_vdev *vdev,
void *arg);
/**
* pre_cac_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
*/
QDF_STATUS
pre_cac_vdev_destroy_notification(struct wlan_objmgr_vdev *vdev,
void *arg);
/**
* pre_cac_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
pre_cac_psoc_create_notification(struct wlan_objmgr_psoc *psoc, void *arg);
/**
* pre_cac_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
pre_cac_psoc_destroy_notification(struct wlan_objmgr_psoc *psoc, void *arg);
struct pre_cac_vdev_priv *
pre_cac_vdev_get_priv_fl(struct wlan_objmgr_vdev *vdev,
const char *func, uint32_t line);
/**
* pre_cac_vdev_get_priv_fl(): Wrapper to retrieve vdev priv obj
* @vdev: vdev pointer
*
* Wrapper for pre_cac to get vdev private object pointer.
*
* Return: Private object of vdev
*/
#define pre_cac_vdev_get_priv(vdev) \
pre_cac_vdev_get_priv_fl(vdev, __func__, __LINE__)
struct pre_cac_psoc_priv *
pre_cac_psoc_get_priv_fl(struct wlan_objmgr_psoc *psoc,
const char *func, uint32_t line);
/**
* pre_cac_psoc_get_priv_fl(): Wrapper to retrieve psoc priv obj
* @psoc: psoc pointer
*
* Wrapper for pre_cac to get psoc private object pointer.
*
* Return: pre_cac psoc private object
*/
#define pre_cac_psoc_get_priv(vdev) \
pre_cac_psoc_get_priv_fl(vdev, __func__, __LINE__)
/**
* pre_cac_init() - pre cac component initialization.
*
* This function initializes the pre cac component and registers
* the handlers which are invoked on vdev creation.
*
* Return: For successful registration - QDF_STATUS_SUCCESS,
* else QDF_STATUS error codes.
*/
QDF_STATUS pre_cac_init(void);
/**
* pre_cac_deinit() - pre cac component deinit.
*
* This function deinits pre cac component.
*
* Return: None
*/
void pre_cac_deinit(void);
#endif /* end of _WLAN_PRE_CAC_MAIN_H_ */

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. 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: Public API declarations of pre cac called from SAP module
*/
#ifndef _WLAN_PRE_CAC_API_H_
#define _WLAN_PRE_CAC_API_H_
#endif /* _WLAN_PRE_CAC_API_H_ */

View File

@@ -0,0 +1,61 @@
/*
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. 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 public API related to the pre_cac called by north bound
* HDD/OSIF/LIM
*/
#ifndef _WLAN_PRE_CAC_UCFG_API_H_
#define _WLAN_PRE_CAC_UCFG_API_H_
#include <qdf_status.h>
#include <qdf_types.h>
#ifdef PRE_CAC_SUPPORT
/**
* ucfg_pre_cac_init() - pre cac component initialization.
*
* This function initializes the pre cac component and registers
* the handlers which are invoked on vdev creation.
*
* Return: For successful registration - QDF_STATUS_SUCCESS,
* else QDF_STATUS error codes.
*/
QDF_STATUS ucfg_pre_cac_init(void);
/**
* ucfg_pre_cac_deinit() - pre cac component deinit.
*
* This function deinits pre cac component.
*
* Return: None
*/
void ucfg_pre_cac_deinit(void);
#else
static inline
QDF_STATUS ucfg_pre_cac_init(void)
{
return QDF_STATUS_SUCCESS;
}
static inline
void ucfg_pre_cac_deinit(void)
{
}
#endif /* PRE_CAC_SUPPORT */
#endif /* _WLAN_PRE_CAC_UCFG_API_H_ */

View File

@@ -0,0 +1,19 @@
/*
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. 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: Public API implementation of pre cac called from SAP module
*/

View File

@@ -0,0 +1,32 @@
/*
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. 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: Public API implementation of pre cac called by north bound iface.
*/
#include "../../core/src/wlan_pre_cac_main.h"
#include "wlan_pre_cac_ucfg_api.h"
QDF_STATUS ucfg_pre_cac_init(void)
{
return pre_cac_init();
}
void ucfg_pre_cac_deinit(void)
{
pre_cac_deinit();
}