diff --git a/umac/cp_stats/core/src/wlan_cp_stats_cmn_api_i.h b/umac/cp_stats/core/src/wlan_cp_stats_cmn_api_i.h new file mode 100644 index 000000000000..207704ee4e44 --- /dev/null +++ b/umac/cp_stats/core/src/wlan_cp_stats_cmn_api_i.h @@ -0,0 +1,95 @@ +/* + * 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: wlan_cp_stats_cmn_api_i.h + * + * This header filed declare APIs which have separate definition for both mc + * and ic + */ +#ifndef __WLAN_CP_STATS_CMN_API_I_H__ +#define __WLAN_CP_STATS_CMN_API_I_H__ +#ifdef QCA_SUPPORT_CP_STATS +#include "wlan_cp_stats_defs.h" + +/** + * wlan_cp_stats_psoc_cs_init() - common psoc obj initialization + * @psoc: pointer to psoc object + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_psoc_cs_init(struct psoc_cp_stats *psoc_cs); + +/** + * wlan_cp_stats_psoc_cs_deinit() - common psoc obj deinitialization + * @psoc: pointer to psoc object + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_psoc_cs_deinit(struct psoc_cp_stats *psoc_cs); + +/** + * wlan_cp_stats_pdev_cs_init() - common pdev obj initialization + * @pdev: pointer to pdev object + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_pdev_cs_init(struct pdev_cp_stats *pdev_cs); + +/** + * wlan_cp_stats_pdev_cs_deinit() - common pdev obj deinitialization + * @pdev: pointer to pdev object + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_pdev_cs_deinit(struct pdev_cp_stats *pdev_cs); + +/** + * wlan_cp_stats_vdev_cs_init() - common vdev obj initialization + * @vdev: pointer to vdev object + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_vdev_cs_init(struct vdev_cp_stats *vdev_cs); + +/** + * wlan_cp_stats_vdev_cs_deinit() - common vdev obj deinitialization + * @vdev: pointer to vdev object + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_vdev_cs_deinit(struct vdev_cp_stats *vdev_cs); + +/** + * wlan_cp_stats_peer_cs_init() - common peer obj initialization + * @peer: pointer to peer object + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_peer_cs_init(struct peer_cp_stats *peer_cs); + +/** + * wlan_cp_stats_peer_cs_deinit() - common peer obj deinitialization + * @peer: pointer to peer object + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_peer_cs_deinit(struct peer_cp_stats *peer_cs); + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_CMN_API_I_H__ */ diff --git a/umac/cp_stats/core/src/wlan_cp_stats_cmn_defs.h b/umac/cp_stats/core/src/wlan_cp_stats_cmn_defs.h new file mode 100644 index 000000000000..0e9d2afee409 --- /dev/null +++ b/umac/cp_stats/core/src/wlan_cp_stats_cmn_defs.h @@ -0,0 +1,29 @@ +/* + * 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: wlan_cp_stats_cmn_defs.h + * + * This header file maintain definitions for cp stats structures which are + * common between win and mcl + */ + +#ifndef __WLAN_CP_STATS_CMN_DEFS_H__ +#define __WLAN_CP_STATS_CMN_DEFS_H__ + +#endif /* __WLAN_CP_STATS_CMN_DEFS_H__ */ diff --git a/umac/cp_stats/core/src/wlan_cp_stats_comp_handler.c b/umac/cp_stats/core/src/wlan_cp_stats_comp_handler.c new file mode 100644 index 000000000000..33f26b814b13 --- /dev/null +++ b/umac/cp_stats/core/src/wlan_cp_stats_comp_handler.c @@ -0,0 +1,207 @@ +/* + * 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: wlan_cp_stats_comp_handler.c + * + * This file maintain definitions to APIs which handle attach/detach of other + * UMAC component specific cp stat object to cp stats + */ +#include "wlan_cp_stats_comp_handler.h" +#include "wlan_cp_stats_defs.h" +#include + +static QDF_STATUS +wlan_cp_stats_psoc_comp_obj_config +(struct wlan_objmgr_psoc *psoc, enum wlan_cp_stats_comp_id comp_id, + enum wlan_cp_stats_cfg_state cfg_state, void *comp_priv_obj) +{ + struct psoc_cp_stats *psoc_cs; + + psoc_cs = wlan_cp_stats_get_psoc_stats_obj(psoc); + if (!psoc_cs) { + cp_stats_err("psoc cp stats object is null"); + return QDF_STATUS_E_INVAL; + } + + wlan_cp_stats_psoc_obj_lock(psoc_cs); + if (cfg_state == WLAN_CP_STATS_OBJ_ATTACH) { + if (psoc_cs->psoc_comp_priv_obj[comp_id]) { + wlan_cp_stats_psoc_obj_unlock(psoc_cs); + return QDF_STATUS_E_EXISTS; + } + psoc_cs->psoc_comp_priv_obj[comp_id] = comp_priv_obj; + } else if (cfg_state == WLAN_CP_STATS_OBJ_DETACH) { + if (psoc_cs->psoc_comp_priv_obj[comp_id] != comp_priv_obj) { + wlan_cp_stats_psoc_obj_unlock(psoc_cs); + return QDF_STATUS_E_INVAL; + } + psoc_cs->psoc_comp_priv_obj[comp_id] = NULL; + } + + wlan_cp_stats_psoc_obj_unlock(psoc_cs); + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS +wlan_cp_stats_pdev_comp_obj_config +(struct wlan_objmgr_pdev *pdev, enum wlan_cp_stats_comp_id comp_id, + enum wlan_cp_stats_cfg_state cfg_state, void *comp_priv_obj) +{ + struct pdev_cp_stats *pdev_cs; + + pdev_cs = wlan_cp_stats_get_pdev_stats_obj(pdev); + if (!pdev_cs) { + cp_stats_err("pdev cp stats object is null"); + return QDF_STATUS_E_INVAL; + } + + wlan_cp_stats_pdev_obj_lock(pdev_cs); + if (cfg_state == WLAN_CP_STATS_OBJ_ATTACH) { + if (pdev_cs->pdev_comp_priv_obj[comp_id]) { + wlan_cp_stats_pdev_obj_unlock(pdev_cs); + return QDF_STATUS_E_EXISTS; + } + pdev_cs->pdev_comp_priv_obj[comp_id] = comp_priv_obj; + } else if (cfg_state == WLAN_CP_STATS_OBJ_DETACH) { + if (pdev_cs->pdev_comp_priv_obj[comp_id] != comp_priv_obj) { + wlan_cp_stats_pdev_obj_unlock(pdev_cs); + return QDF_STATUS_E_INVAL; + } + pdev_cs->pdev_comp_priv_obj[comp_id] = NULL; + } + + wlan_cp_stats_pdev_obj_unlock(pdev_cs); + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS +wlan_cp_stats_vdev_comp_obj_config +(struct wlan_objmgr_vdev *vdev, enum wlan_cp_stats_comp_id comp_id, + enum wlan_cp_stats_cfg_state cfg_state, void *comp_priv_obj) +{ + struct vdev_cp_stats *vdev_cs; + + vdev_cs = wlan_cp_stats_get_vdev_stats_obj(vdev); + if (!vdev_cs) { + cp_stats_err("vdev cp stats object is null"); + return QDF_STATUS_E_INVAL; + } + + wlan_cp_stats_vdev_obj_lock(vdev_cs); + if (cfg_state == WLAN_CP_STATS_OBJ_ATTACH) { + if (vdev_cs->vdev_comp_priv_obj[comp_id]) { + wlan_cp_stats_vdev_obj_unlock(vdev_cs); + return QDF_STATUS_E_EXISTS; + } + vdev_cs->vdev_comp_priv_obj[comp_id] = comp_priv_obj; + } else if (cfg_state == WLAN_CP_STATS_OBJ_DETACH) { + if (vdev_cs->vdev_comp_priv_obj[comp_id] != comp_priv_obj) { + wlan_cp_stats_vdev_obj_unlock(vdev_cs); + return QDF_STATUS_E_INVAL; + } + vdev_cs->vdev_comp_priv_obj[comp_id] = NULL; + } + + wlan_cp_stats_vdev_obj_unlock(vdev_cs); + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS +wlan_cp_stats_peer_comp_obj_config +(struct wlan_objmgr_peer *peer, enum wlan_cp_stats_comp_id comp_id, + enum wlan_cp_stats_cfg_state cfg_state, void *comp_priv_obj) +{ + struct peer_cp_stats *peer_cs; + + peer_cs = wlan_cp_stats_get_peer_stats_obj(peer); + if (!peer_cs) { + cp_stats_err("peer cp stats object is null"); + return QDF_STATUS_E_INVAL; + } + + wlan_cp_stats_peer_obj_lock(peer_cs); + if (cfg_state == WLAN_CP_STATS_OBJ_ATTACH) { + if (peer_cs->peer_comp_priv_obj[comp_id]) { + wlan_cp_stats_peer_obj_unlock(peer_cs); + return QDF_STATUS_E_EXISTS; + } + peer_cs->peer_comp_priv_obj[comp_id] = comp_priv_obj; + } else if (cfg_state == WLAN_CP_STATS_OBJ_DETACH) { + if (peer_cs->peer_comp_priv_obj[comp_id] != comp_priv_obj) { + wlan_cp_stats_peer_obj_unlock(peer_cs); + return QDF_STATUS_E_INVAL; + } + peer_cs->peer_comp_priv_obj[comp_id] = NULL; + } + + wlan_cp_stats_peer_obj_unlock(peer_cs); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +wlan_cp_stats_comp_obj_config(enum wlan_objmgr_obj_type obj_type, + enum wlan_cp_stats_cfg_state cfg_state, + enum wlan_cp_stats_comp_id comp_id, + void *cmn_obj, void *comp_priv_obj) +{ + QDF_STATUS status; + + if (!cmn_obj) { + cp_stats_err("Common object is NULL"); + return QDF_STATUS_E_INVAL; + } + + /* component id is invalid */ + if (comp_id >= WLAN_CP_STATS_MAX_COMPONENTS) { + cp_stats_err("Invalid component Id"); + return QDF_STATUS_MAXCOMP_FAIL; + } + + switch (obj_type) { + case WLAN_PSOC_OP: + status = + wlan_cp_stats_psoc_comp_obj_config( + (struct wlan_objmgr_psoc *)cmn_obj, + comp_id, cfg_state, comp_priv_obj); + break; + case WLAN_PDEV_OP: + status = + wlan_cp_stats_pdev_comp_obj_config( + (struct wlan_objmgr_pdev *)cmn_obj, + comp_id, cfg_state, comp_priv_obj); + break; + case WLAN_VDEV_OP: + status = + wlan_cp_stats_vdev_comp_obj_config( + (struct wlan_objmgr_vdev *)cmn_obj, + comp_id, cfg_state, comp_priv_obj); + break; + case WLAN_PEER_OP: + status = + wlan_cp_stats_peer_comp_obj_config( + (struct wlan_objmgr_peer *)cmn_obj, + comp_id, cfg_state, comp_priv_obj); + break; + default: + cp_stats_err("Invalid common object"); + return QDF_STATUS_E_INVAL; + } + + return status; +} diff --git a/umac/cp_stats/core/src/wlan_cp_stats_comp_handler.h b/umac/cp_stats/core/src/wlan_cp_stats_comp_handler.h new file mode 100644 index 000000000000..02a63f539924 --- /dev/null +++ b/umac/cp_stats/core/src/wlan_cp_stats_comp_handler.h @@ -0,0 +1,52 @@ +/* + * 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: wlan_cp_stats_comp_handler.h + * + * This header file API declarations required to attach/detach and + * enable/disable other UMAC component specific control plane statitics + * to cp stats component object + */ + +#ifndef __WLAN_CP_STATS_COMP_HANDLER_H__ +#define __WLAN_CP_STATS_COMP_HANDLER_H__ + +#ifdef QCA_SUPPORT_CP_STATS +#include "wlan_cp_stats_defs.h" + +/** + * wlan_cp_stats_comp_obj_config() - attach/detach component specific stats + * callback function + * @obj_type: common object type + * @cfg_state: config state either to attach of detach + * @comp_id: cpstats component id + * @cmn_obj: pointer to common object + * @comp_priv_obj: pointer to component specific cp stats object + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_comp_obj_config( + enum wlan_objmgr_obj_type obj_type, + enum wlan_cp_stats_cfg_state cfg_state, + enum wlan_cp_stats_comp_id comp_id, + void *cmn_obj, + void *comp_priv_obj); + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_COMP_HANDLER_H__ */ diff --git a/umac/cp_stats/core/src/wlan_cp_stats_da_api.c b/umac/cp_stats/core/src/wlan_cp_stats_da_api.c new file mode 100644 index 000000000000..71fcbe23e779 --- /dev/null +++ b/umac/cp_stats/core/src/wlan_cp_stats_da_api.c @@ -0,0 +1,36 @@ +/* + * 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: wlan_cp_stats_da_api.c + * + * This file provide definitions for cp stats global context initialization + * specific to DA + */ +#include "wlan_cp_stats_defs.h" +#include "wlan_cp_stats_da_api.h" + +QDF_STATUS wlan_cp_stats_ctx_init_da(struct cp_stats_context *csc) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_ctx_deinit_da(struct cp_stats_context *ac) +{ + return QDF_STATUS_SUCCESS; +} diff --git a/umac/cp_stats/core/src/wlan_cp_stats_da_api.h b/umac/cp_stats/core/src/wlan_cp_stats_da_api.h new file mode 100644 index 000000000000..67a181466d89 --- /dev/null +++ b/umac/cp_stats/core/src/wlan_cp_stats_da_api.h @@ -0,0 +1,50 @@ +/* + * 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: wlan_cp_stats_da_api.h + * + * This header file provide declarations for cp stats global context object + * initialization specific to DA + */ +#ifndef __WLAN_CP_STATS_DA_API_H__ +#define __WLAN_CP_STATS_DA_API_H__ + +#ifdef QCA_SUPPORT_CP_STATS +#include +#include "wlan_cp_stats_defs.h" +#include "wlan_cp_stats_da_api.h" + +/** + * wlan_cp_stats_ctx_init_da() - initialize cp stats global context + * @pdev: Pointer to cp stats global context object + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_ctx_init_da(struct cp_stats_context *csc); + +/** + * wlan_cp_stats_ctx_deinit_da() - deinitialize cp stats global context + * @pdev: Pointer to cp stats global context object + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_ctx_deinit_da(struct cp_stats_context *csc); + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_DA_API_H__ */ diff --git a/umac/cp_stats/core/src/wlan_cp_stats_defs.h b/umac/cp_stats/core/src/wlan_cp_stats_defs.h new file mode 100644 index 000000000000..a64193a7b8c6 --- /dev/null +++ b/umac/cp_stats/core/src/wlan_cp_stats_defs.h @@ -0,0 +1,434 @@ +/* + * 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: wlan_cp_stats_defs.h + * + * This header file maintains core definitions of control plane statistics + * component + */ + +#ifndef __WLAN_CP_STATS_DEFS_H__ +#define __WLAN_CP_STATS_DEFS_H__ + +#ifdef QCA_SUPPORT_CP_STATS +#include +#include +#include +#include +#include +#include +#include "wlan_cp_stats_cmn_defs.h" +#include + +/** + * struct psoc_cp_stats - defines cp stats at psoc object + * @psoc_obj: pointer to psoc + * @psoc_comp_priv_obj[]: component's private object pointers + * @psoc_cp_stats_lock: lock to protect object + */ +struct psoc_cp_stats { + struct wlan_objmgr_psoc *psoc_obj; + void *psoc_comp_priv_obj[WLAN_CP_STATS_MAX_COMPONENTS]; + qdf_spinlock_t psoc_cp_stats_lock; +}; + +/** + * struct pdev_cp_stats - defines cp stats at pdev object + * @pdev_obj: pointer to pdev + * @pdev_stats: pointer to ic/mc specific stats + * @pdev_comp_priv_obj[]: component's private object pointers + * @pdev_cp_stats_lock: lock to protect object + */ +struct pdev_cp_stats { + struct wlan_objmgr_pdev *pdev_obj; + void *pdev_stats; + void *pdev_comp_priv_obj[WLAN_CP_STATS_MAX_COMPONENTS]; + qdf_spinlock_t pdev_cp_stats_lock; +}; + +/** + * struct vdev_cp_stats - defines cp stats at vdev object + * @vdev_obj: pointer to vdev + * @vdev_stats: pointer to ic/mc specific stats + * @vdev_comp_priv_obj[]: component's private object pointers + * @vdev_cp_stats_lock: lock to protect object + */ +struct vdev_cp_stats { + struct wlan_objmgr_vdev *vdev_obj; + void *vdev_stats; + void *vdev_comp_priv_obj[WLAN_CP_STATS_MAX_COMPONENTS]; + qdf_spinlock_t vdev_cp_stats_lock; +}; + +/** + * struct peer_cp_stats - defines cp stats at peer object + * @peer_obj: pointer to peer + * @peer_stats: pointer to ic/mc specific stats + * @peer_comp_priv_obj[]: component's private object pointers + * @peer_cp_stats_lock: lock to protect object + */ +struct peer_cp_stats { + struct wlan_objmgr_peer *peer_obj; + void *peer_stats; + void *peer_comp_priv_obj[WLAN_CP_STATS_MAX_COMPONENTS]; + qdf_spinlock_t peer_cp_stats_lock; +}; + +/** + * struct cp_stats_context - defines cp stats global context object + * @csc_lock: lock to protect object + * @psoc_obj: pointer to psoc + * @psoc_cs: pointer to cp stats at psoc + * @cp_stats_ctx_init: callback pointer to init cp stats global ctx + * @cp_stats_ctx_deinit: callback pointer to deinit cp stats global ctx + * @cp_stats_psoc_obj_init:callback pointer to init cp stats obj on psoc create + * @cp_stats_psoc_obj_deinit:callback pointer to deinit cp stats obj on psoc + * destroy + * @cp_stats_pdev_obj_init:callback pointer to init cp stats obj on pdev create + * @cp_stats_pdev_obj_deinit:callback pointer to deinit cp stats obj on pdev + * destroy + * @cp_stats_vdev_obj_init:callback pointer to init cp stats obj on vdev create + * @cp_stats_vdev_obj_deinit:callback pointer to deinit cp stats obj on vdev + * destroy + * @cp_stats_peer_obj_init:callback pointer to init cp stats obj on peer create + * @cp_stats_peer_obj_deinit:callback pointer to deinit cp stats obj on peer + * destroy + * @cp_stats_comp_obj_config:callback pointer to attach/detach other umac comp + * @cp_stats_open: callback pointer for cp stats on psoc open + * @cp_stats_close: callback pointer for cp stats on psoc close + * @cp_stats_enable: callback pointer for cp stats on psoc enable + * @cp_stats_disable: callback pointer for cp stats on psoc disable + */ +struct cp_stats_context { + qdf_spinlock_t csc_lock; + struct wlan_objmgr_psoc *psoc_obj; + struct psoc_cp_stats *psoc_cs; + QDF_STATUS (*cp_stats_ctx_init)(struct cp_stats_context *ctx); + QDF_STATUS (*cp_stats_ctx_deinit)(struct cp_stats_context *ctx); + QDF_STATUS (*cp_stats_psoc_obj_init)(struct psoc_cp_stats *psoc_cs); + QDF_STATUS (*cp_stats_psoc_obj_deinit)(struct psoc_cp_stats *psoc_cs); + QDF_STATUS (*cp_stats_pdev_obj_init)(struct pdev_cp_stats *pdev_cs); + QDF_STATUS (*cp_stats_pdev_obj_deinit)(struct pdev_cp_stats *pdev_cs); + QDF_STATUS (*cp_stats_vdev_obj_init)(struct vdev_cp_stats *vdev_cs); + QDF_STATUS (*cp_stats_vdev_obj_deinit)(struct vdev_cp_stats *vdev_cs); + QDF_STATUS (*cp_stats_peer_obj_init)(struct peer_cp_stats *peer_cs); + QDF_STATUS (*cp_stats_peer_obj_deinit)(struct peer_cp_stats *peer_cs); + QDF_STATUS (*cp_stats_comp_obj_config)( + enum wlan_objmgr_obj_type obj_type, + enum wlan_cp_stats_cfg_state cfg_state, + enum wlan_cp_stats_comp_id comp_id, + void *cmn_obj, + void *data); + QDF_STATUS (*cp_stats_open)(struct wlan_objmgr_psoc *psoc); + QDF_STATUS (*cp_stats_close)(struct wlan_objmgr_psoc *psoc); + QDF_STATUS (*cp_stats_enable)(struct wlan_objmgr_psoc *psoc); + QDF_STATUS (*cp_stats_disable)(struct wlan_objmgr_psoc *psoc); +}; + +/** + * wlan_cp_stats_psoc_obj_lock() - private API to acquire spinlock at psoc + * @psoc: pointer to psoc cp stats object + * + * Return: void + */ +static inline void wlan_cp_stats_psoc_obj_lock(struct psoc_cp_stats *psoc) +{ + qdf_spin_lock_bh(&psoc->psoc_cp_stats_lock); +} + +/** + * wlan_cp_stats_psoc_obj_unlock() - private API to release spinlock at psoc + * @psoc: pointer to psoc cp stats object + * + * Return: void + */ +static inline void wlan_cp_stats_psoc_obj_unlock(struct psoc_cp_stats *psoc) +{ + qdf_spin_unlock_bh(&psoc->psoc_cp_stats_lock); +} + +/** + * wlan_cp_stats_pdev_obj_lock() - private API to acquire spinlock at pdev + * @pdev: pointer to pdev cp stats object + * + * Return: void + */ +static inline void wlan_cp_stats_pdev_obj_lock(struct pdev_cp_stats *pdev) +{ + qdf_spin_lock_bh(&pdev->pdev_cp_stats_lock); +} + +/** + * wlan_cp_stats_pdev_obj_unlock() - private api to release spinlock at pdev + * @pdev: pointer to pdev cp stats object + * + * Return: void + */ +static inline void wlan_cp_stats_pdev_obj_unlock(struct pdev_cp_stats *pdev) +{ + qdf_spin_unlock_bh(&pdev->pdev_cp_stats_lock); +} + +/** + * wlan_cp_stats_vdev_obj_lock() - private api to acquire spinlock at vdev + * @vdev: pointer to vdev cp stats object + * + * Return: void + */ +static inline void wlan_cp_stats_vdev_obj_lock(struct vdev_cp_stats *vdev) +{ + qdf_spin_lock_bh(&vdev->vdev_cp_stats_lock); +} + +/** + * wlan_cp_stats_vdev_obj_unlock() - private api to release spinlock at vdev + * @vdev: pointer to vdev cp stats object + * + * Return: void + */ +static inline void wlan_cp_stats_vdev_obj_unlock(struct vdev_cp_stats *vdev) +{ + qdf_spin_unlock_bh(&vdev->vdev_cp_stats_lock); +} + +/** + * wlan_cp_stats_peer_obj_lock() - private api to acquire spinlock at peer + * @peer: pointer to peer cp stats object + * + * Return: void + */ +static inline void wlan_cp_stats_peer_obj_lock(struct peer_cp_stats *peer) +{ + qdf_spin_lock_bh(&peer->peer_cp_stats_lock); +} + +/** + * wlan_cp_stats_peer_obj_unlock() - private api to release spinlock at peer + * @peer: pointer to peer cp stats object + * + * Return: void + */ +static inline void wlan_cp_stats_peer_obj_unlock(struct peer_cp_stats *peer) +{ + qdf_spin_unlock_bh(&peer->peer_cp_stats_lock); +} + +/** + * wlan_cp_stats_get_psoc_stats_obj() - API to get psoc_cp_stats from psoc + * @psoc: Reference to psoc global object + * + * This API used to get psoc specific cp_stats object from global psoc + * reference. + * + * Return : Reference to psoc_cp_stats object on success or NULL on failure + */ +static inline +struct psoc_cp_stats *wlan_cp_stats_get_psoc_stats_obj(struct wlan_objmgr_psoc + *psoc) +{ + struct psoc_cp_stats *psoc_cs = NULL; + + if (psoc) { + psoc_cs = wlan_objmgr_psoc_get_comp_private_obj + (psoc, WLAN_UMAC_COMP_CP_STATS); + } + + return psoc_cs; +} + +/** + * wlan_cp_stats_get_pdev_stats_obj() - API to get pdev_cp_stats from pdev + * @pdev: Reference to pdev global object + * + * This API used to get pdev specific cp_stats object from global pdev + * reference. + * + * Return : Reference to pdev_cp_stats object on success or NULL on failure + */ +static inline +struct pdev_cp_stats *wlan_cp_stats_get_pdev_stats_obj(struct wlan_objmgr_pdev + *pdev) +{ + struct pdev_cp_stats *pdev_cs = NULL; + + if (pdev) { + pdev_cs = wlan_objmgr_pdev_get_comp_private_obj + (pdev, WLAN_UMAC_COMP_CP_STATS); + } + + return pdev_cs; +} + +/** + * wlan_cp_stats_get_vdev_stats_obj() - API to get vdev_cp_stats from vdev + * @vdev : Reference to vdev global object + * + * This API used to get vdev specific cp_stats object from global vdev + * reference. + * + * Return : Reference to vdev_cp_stats object on success or NULL on failure + */ +static inline +struct vdev_cp_stats *wlan_cp_stats_get_vdev_stats_obj(struct wlan_objmgr_vdev + *vdev) +{ + struct vdev_cp_stats *vdev_cs = NULL; + + if (vdev) { + vdev_cs = wlan_objmgr_vdev_get_comp_private_obj + (vdev, WLAN_UMAC_COMP_CP_STATS); + } + + return vdev_cs; +} + +/** + * wlan_cp_stats_get_peer_stats_obj() - API to get peer_cp_stats from peer + * @peer: Reference to peer global object + * + * This API used to get peer specific cp_stats object from global peer + * reference. + * + * Return : Reference to peer_cp_stats object on success or NULL on failure + */ +static inline +struct peer_cp_stats *wlan_cp_stats_get_peer_stats_obj(struct wlan_objmgr_peer + *peer) +{ + struct peer_cp_stats *peer_cs = NULL; + + if (peer) { + peer_cs = wlan_objmgr_peer_get_comp_private_obj + (peer, WLAN_UMAC_COMP_CP_STATS); + } + + return peer_cs; +} + +/** + * wlan_cp_stats_get_pdev_from_vdev() - API to get pdev_cp_stats obj from vdev + * @vdev: Reference to vdev global object + * + * This API used to get pdev specific cp_stats object from global vdev + * reference. + * + * Return: Reference to pdev_cp_stats object on success or NULL on failure + */ +static inline +struct pdev_cp_stats *wlan_cp_stats_get_pdev_from_vdev(struct wlan_objmgr_vdev + *vdev) +{ + struct wlan_objmgr_pdev *pdev; + struct pdev_cp_stats *pdev_cs = NULL; + + pdev = wlan_vdev_get_pdev(vdev); + if (pdev) { + pdev_cs = wlan_objmgr_pdev_get_comp_private_obj + (pdev, WLAN_UMAC_COMP_CP_STATS); + } + + return pdev_cs; +} + +/** + * wlan_cp_stats_ctx_get_from_pdev() - API to get cp_stats ctx obj from pdev + * @pdev: Reference to pdev global object + * + * This API used to get cp_stats context object from global pdev reference. + * + * Return: Reference to cp_stats_context object on success or NULL on failure + */ +static inline +struct cp_stats_context *wlan_cp_stats_ctx_get_from_pdev(struct wlan_objmgr_pdev + *pdev) +{ + struct wlan_objmgr_psoc *psoc; + struct cp_stats_context *csc = NULL; + + if (!pdev) + return NULL; + + psoc = wlan_pdev_get_psoc(pdev); + if (psoc) { + csc = wlan_objmgr_psoc_get_comp_private_obj + (psoc, WLAN_UMAC_COMP_CP_STATS); + } + return csc; +} + +/** + * wlan_cp_stats_ctx_get_from_vdev() - API to get cp_stats ctx obj from vdev + * @vdev: Reference to vdev global object + * + * This API used to get cp_stats context object from global vdev reference. + * + * Return: Reference to cp_stats_context object on success or NULL on failure + */ +static inline +struct cp_stats_context *wlan_cp_stats_ctx_get_from_vdev(struct wlan_objmgr_vdev + *vdev) +{ + struct wlan_objmgr_pdev *pdev; + + if (!vdev) + return NULL; + + pdev = wlan_vdev_get_pdev(vdev); + return wlan_cp_stats_ctx_get_from_pdev(pdev); +} + +/** + * wlan_cp_stats_ctx_get_from_peer() - API to get cp_stats ctx object from peer + * @peer: Reference to peer object + * + * This API used to get cp_stats context object from global peer reference. + * + * Return: Reference to cp_stats_context object on success or NULL on failure + */ +static inline +struct cp_stats_context *wlan_cp_stats_ctx_get_from_peer(struct wlan_objmgr_peer + *peer) +{ + struct wlan_objmgr_vdev *vdev; + + vdev = wlan_peer_get_vdev(peer); + return wlan_cp_stats_ctx_get_from_vdev(vdev); +} + +/** + * wlan_cp_stats_get_comp_id() - API to get cp_stats component id from umac + * component id + * @comp_id: umac comp id + * + * Return: wlan_cp_stats_comp_id + */ +static inline enum wlan_cp_stats_comp_id +wlan_cp_stats_get_comp_id(enum wlan_umac_comp_id comp_id) +{ + enum wlan_cp_stats_comp_id cp_stats_comp_id = + WLAN_CP_STATS_MAX_COMPONENTS; + + if (comp_id == WLAN_UMAC_COMP_ATF) + cp_stats_comp_id = WLAN_CP_STATS_ATF; + + return cp_stats_comp_id; +} + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_DEFS_H__ */ diff --git a/umac/cp_stats/core/src/wlan_cp_stats_ic_defs.h b/umac/cp_stats/core/src/wlan_cp_stats_ic_defs.h new file mode 100644 index 000000000000..96a243cb0e88 --- /dev/null +++ b/umac/cp_stats/core/src/wlan_cp_stats_ic_defs.h @@ -0,0 +1,98 @@ +/* + * 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: wlan_cp_stats_ic_defs.h + * + * This header file maintain structure definitions for cp stats specific to ic + */ + +#ifndef __WLAN_CP_STATS_IC_DEFS_H__ +#define __WLAN_CP_STATS_IC_DEFS_H__ + +#ifdef QCA_SUPPORT_CP_STATS +#include +#include +#include +#include +#include + +/** + * struct pdev_ic_cp_stats - control plane stats specific to WIN at pdev + * @rx_mgmt: rx management frames + * @tx_mgmt: tx management frames + * @tx_bcn: tx beacon frames + * @rx_phyofdmerr: rx PHY error + * @rx_phycckerr: rx PHY error + * @tx_fcs_err: tx fcs error + * @vow_stats: vow ext stats + * @arp_dbg_cs: arp dbg stats + */ +struct pdev_ic_cp_stats { + uint64_t rx_mgmt; + uint64_t tx_mgmt; + uint64_t tx_bcn; + uint64_t rx_phyofdmerr; + uint64_t rx_phycckerr; + uint64_t tx_fcs_err; + struct vow_extstats vow_stats; + struct arp_dbg_stats arp_dbg_cs; +}; + +/** + * struct vdev_ic_cp_stats - control plane stats specific to WIN at vdev + * @tx_success: total tx success + * @tx_failure: total tx failures + * @rx_mgmt: rx mgmt frames + * @tx_mgmt: tx mgmt frames + * @rx_ctrl: rx control frames + * @tx_ctrl: tx control frames + * @tx_bcn_swba: beacon intr SWBA counter + * @tx_offchan_mgmt: tx offchan mgmt success + * @tx_offchan_date: tx offchan data success + * @tx_offchan_fail: tx offchan total failures + * @atf_cs: atf stats + * @rrm_bcnreq_info: beacon report + */ +struct vdev_ic_cp_stats { + uint64_t tx_success; + uint64_t tx_failure; + uint64_t rx_mgmt; + uint64_t tx_mgmt; + uint64_t rx_ctrl; + uint64_t tx_ctrl; + uint64_t tx_bcn_swba; + uint64_t tx_offchan_mgmt; + uint64_t tx_offchan_data; + uint64_t tx_offchan_fail; + struct atf_cp_stats atf_cs; + ieee80211_rrm_beaconreq_info_t rrm_bcnreq_info; +}; + +/** + * struct peer_ic_cp_stats - control plane stats specific to WIN at peer + * @rx_mgmt_rate: rx mgmt rate + * @rx_mgmt_rssi: rx mgmt rssi + */ +struct peer_ic_cp_stats { + uint32_t rx_mgmt_rate; + int8_t rx_mgmt_rssi; +}; + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_IC_DEFS_H__ */ diff --git a/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c b/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c new file mode 100644 index 000000000000..4dd0d7a291a0 --- /dev/null +++ b/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c @@ -0,0 +1,403 @@ +/* + * 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: wlan_cp_stats_om_handler.c + * + * This file provide definitions to APIs invoked on receiving common object + * repective create/destroy event notifications, which further + * (de)allocate cp specific objects and (de)attach to specific + * common object + */ +#include "wlan_cp_stats_obj_mgr_handler.h" +#include "wlan_cp_stats_defs.h" +#include "wlan_cp_stats_da_api.h" +#include "wlan_cp_stats_ol_api.h" +#include + +QDF_STATUS +wlan_cp_stats_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg) +{ + QDF_STATUS status = QDF_STATUS_E_FAILURE; + WLAN_DEV_TYPE dev_type; + struct psoc_cp_stats *psoc_cs; + struct cp_stats_context *csc; + + if (!psoc) { + cp_stats_err("PSOC is NULL"); + status = QDF_STATUS_E_INVAL; + goto wlan_cp_stats_psoc_obj_create_handler_return; + } + + csc = qdf_mem_malloc(sizeof(*csc)); + if (!csc) { + cp_stats_err("Failed to allocate cp_stats_context object"); + status = QDF_STATUS_E_NOMEM; + goto wlan_cp_stats_psoc_obj_create_handler_return; + } + + csc->psoc_obj = psoc; + dev_type = wlan_objmgr_psoc_get_dev_type(csc->psoc_obj); + if (dev_type == WLAN_DEV_INVALID) { + cp_stats_err("Failed to init cp stats ctx, bad device type"); + status = QDF_STATUS_E_INVAL; + goto wlan_cp_stats_psoc_obj_create_handler_return; + } else if (WLAN_DEV_DA == dev_type) { + csc->cp_stats_ctx_init = wlan_cp_stats_ctx_init_da; + csc->cp_stats_ctx_deinit = wlan_cp_stats_ctx_deinit_da; + } else if (WLAN_DEV_OL == dev_type) { + csc->cp_stats_ctx_init = wlan_cp_stats_ctx_init_ol; + csc->cp_stats_ctx_deinit = wlan_cp_stats_ctx_deinit_ol; + } + + if (QDF_STATUS_SUCCESS != csc->cp_stats_ctx_init(csc)) { + cp_stats_err("Failed to init global ctx call back handlers"); + goto wlan_cp_stats_psoc_obj_create_handler_return; + } + + psoc_cs = qdf_mem_malloc(sizeof(*psoc_cs)); + if (!psoc_cs) { + cp_stats_err("Failed to allocate psoc_cp_stats object"); + status = QDF_STATUS_E_NOMEM; + goto wlan_cp_stats_psoc_obj_create_handler_return; + } + + psoc_cs->psoc_obj = psoc; + csc->psoc_cs = psoc_cs; + if (csc->cp_stats_psoc_obj_init) { + if (QDF_STATUS_SUCCESS != + csc->cp_stats_psoc_obj_init(psoc_cs)) { + cp_stats_err("Failed to initialize psoc handlers"); + goto wlan_cp_stats_psoc_obj_create_handler_return; + } + } + + status = wlan_objmgr_psoc_component_obj_attach(psoc, + WLAN_UMAC_COMP_CP_STATS, csc, + QDF_STATUS_SUCCESS); + +wlan_cp_stats_psoc_obj_create_handler_return: + if (QDF_IS_STATUS_ERROR(status)) { + if (csc) { + if (csc->cp_stats_psoc_obj_deinit) + csc->cp_stats_psoc_obj_deinit(psoc_cs); + + if (csc->psoc_cs) { + qdf_mem_free(csc->psoc_cs); + csc->psoc_cs = NULL; + } + + if (csc->cp_stats_ctx_deinit) + csc->cp_stats_ctx_deinit(csc); + + qdf_mem_free(csc); + csc = NULL; + } + } + + cp_stats_debug("cp stats context attach at psoc"); + return status; +} + +QDF_STATUS +wlan_cp_stats_psoc_obj_destroy_handler(struct wlan_objmgr_psoc *psoc, void *arg) +{ + struct cp_stats_context *csc; + + if (!psoc) { + cp_stats_err("PSOC is NULL"); + return QDF_STATUS_E_NOMEM; + } + csc = wlan_objmgr_psoc_get_comp_private_obj(psoc, + WLAN_UMAC_COMP_CP_STATS); + if (!csc) { + cp_stats_err("cp_stats context is NULL!"); + return QDF_STATUS_E_INVAL; + } + + wlan_objmgr_psoc_component_obj_detach(psoc, + WLAN_UMAC_COMP_CP_STATS, csc); + qdf_mem_free(csc->psoc_cs); + if (csc->cp_stats_ctx_deinit) + csc->cp_stats_ctx_deinit(csc); + qdf_mem_free(csc); + + cp_stats_debug("cp stats context dettached at psoc"); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +wlan_cp_stats_pdev_obj_create_handler(struct wlan_objmgr_pdev *pdev, void *arg) +{ + QDF_STATUS status = QDF_STATUS_E_FAILURE; + struct pdev_cp_stats *pdev_cs; + struct cp_stats_context *csc; + + if (!pdev) { + cp_stats_err("PDEV is NULL"); + status = QDF_STATUS_E_INVAL; + goto wlan_cp_stats_pdev_obj_create_handler_return; + } + + pdev_cs = qdf_mem_malloc(sizeof(*pdev_cs)); + if (!pdev_cs) { + cp_stats_err("Failed to allocate pdev_cp_stats object"); + status = QDF_STATUS_E_NOMEM; + goto wlan_cp_stats_pdev_obj_create_handler_return; + } + csc = wlan_cp_stats_ctx_get_from_pdev(pdev); + if (!csc) { + cp_stats_err("cp_stats context is NULL!"); + status = QDF_STATUS_E_INVAL; + goto wlan_cp_stats_pdev_obj_create_handler_return; + } + pdev_cs->pdev_obj = pdev; + if (csc->cp_stats_pdev_obj_init) { + if (QDF_STATUS_SUCCESS != + csc->cp_stats_pdev_obj_init(pdev_cs)) { + cp_stats_err("Failed to initialize pdev handlers"); + goto wlan_cp_stats_pdev_obj_create_handler_return; + } + } + + status = wlan_objmgr_pdev_component_obj_attach(pdev, + WLAN_UMAC_COMP_CP_STATS, pdev_cs, + QDF_STATUS_SUCCESS); + + cp_stats_debug("pdev cp stats object attached"); +wlan_cp_stats_pdev_obj_create_handler_return: + if (QDF_IS_STATUS_ERROR(status)) { + if (csc) { + if (csc->cp_stats_pdev_obj_deinit) + csc->cp_stats_pdev_obj_deinit(pdev_cs); + } + + if (pdev_cs) + qdf_mem_free(pdev_cs); + } + + return status; +} + +QDF_STATUS +wlan_cp_stats_pdev_obj_destroy_handler(struct wlan_objmgr_pdev *pdev, void *arg) +{ + struct pdev_cp_stats *pdev_cs; + struct cp_stats_context *csc; + + if (!pdev) { + cp_stats_err("pdev is NULL"); + return QDF_STATUS_E_INVAL; + } + + pdev_cs = wlan_objmgr_pdev_get_comp_private_obj(pdev, + WLAN_UMAC_COMP_CP_STATS); + if (!pdev_cs) { + cp_stats_err("pdev is NULL"); + return QDF_STATUS_E_INVAL; + } + csc = wlan_cp_stats_ctx_get_from_pdev(pdev); + if (!csc) { + cp_stats_err("cp_stats context is NULL!"); + return QDF_STATUS_E_INVAL; + } + + if (csc->cp_stats_pdev_obj_deinit) + csc->cp_stats_pdev_obj_deinit(pdev_cs); + + wlan_objmgr_pdev_component_obj_detach(pdev, WLAN_UMAC_COMP_CP_STATS, + pdev_cs); + + qdf_mem_free(pdev_cs); + cp_stats_debug("pdev cp stats object dettached"); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +wlan_cp_stats_vdev_obj_create_handler(struct wlan_objmgr_vdev *vdev, void *arg) +{ + QDF_STATUS status = QDF_STATUS_E_FAILURE; + struct vdev_cp_stats *vdev_cs; + struct cp_stats_context *csc; + + if (!vdev) { + cp_stats_err("vdev is NULL"); + status = QDF_STATUS_E_INVAL; + goto wlan_cp_stats_vdev_obj_create_handler_return; + } + + vdev_cs = qdf_mem_malloc(sizeof(*vdev_cs)); + if (!vdev_cs) { + cp_stats_err("Failed to allocate vdev_cp_stats object"); + status = QDF_STATUS_E_NOMEM; + goto wlan_cp_stats_vdev_obj_create_handler_return; + } + csc = wlan_cp_stats_ctx_get_from_vdev(vdev); + if (!csc) { + cp_stats_err("cp_stats context is NULL!"); + status = QDF_STATUS_E_INVAL; + goto wlan_cp_stats_vdev_obj_create_handler_return; + } + vdev_cs->vdev_obj = vdev; + if (csc->cp_stats_vdev_obj_init) { + if (QDF_STATUS_SUCCESS != + csc->cp_stats_vdev_obj_init(vdev_cs)) { + cp_stats_err("Failed to initialize vdev handlers"); + goto wlan_cp_stats_vdev_obj_create_handler_return; + } + } + + status = wlan_objmgr_vdev_component_obj_attach(vdev, + WLAN_UMAC_COMP_CP_STATS, vdev_cs, + QDF_STATUS_SUCCESS); + +wlan_cp_stats_vdev_obj_create_handler_return: + if (QDF_IS_STATUS_ERROR(status)) { + if (csc) { + if (csc->cp_stats_vdev_obj_deinit) + csc->cp_stats_vdev_obj_deinit(vdev_cs); + } + + if (vdev_cs) + qdf_mem_free(vdev_cs); + } + + cp_stats_debug("vdev cp stats object attach"); + return status; +} + +QDF_STATUS +wlan_cp_stats_vdev_obj_destroy_handler(struct wlan_objmgr_vdev *vdev, void *arg) +{ + struct vdev_cp_stats *vdev_cs; + struct cp_stats_context *csc; + + if (!vdev) { + cp_stats_err("vdev is NULL"); + return QDF_STATUS_E_INVAL; + } + + vdev_cs = wlan_objmgr_vdev_get_comp_private_obj(vdev, + WLAN_UMAC_COMP_CP_STATS); + if (!vdev_cs) { + cp_stats_err("vdev is NULL"); + return QDF_STATUS_E_INVAL; + } + csc = wlan_cp_stats_ctx_get_from_vdev(vdev); + if (!csc) { + cp_stats_err("cp_stats context is NULL!"); + return QDF_STATUS_E_INVAL; + } + + if (csc->cp_stats_vdev_obj_deinit) + csc->cp_stats_vdev_obj_deinit(vdev_cs); + + wlan_objmgr_vdev_component_obj_detach(vdev, WLAN_UMAC_COMP_CP_STATS, + vdev_cs); + + qdf_mem_free(vdev_cs); + cp_stats_debug("vdev cp stats object dettach"); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +wlan_cp_stats_peer_obj_create_handler(struct wlan_objmgr_peer *peer, void *arg) +{ + QDF_STATUS status = QDF_STATUS_E_FAILURE; + struct peer_cp_stats *peer_cs; + struct cp_stats_context *csc; + + if (!peer) { + cp_stats_err("peer is NULL"); + status = QDF_STATUS_E_INVAL; + goto wlan_cp_stats_peer_obj_create_handler_return; + } + + peer_cs = qdf_mem_malloc(sizeof(*peer_cs)); + if (!peer_cs) { + cp_stats_err("Failed to allocate peer_cp_stats object"); + status = QDF_STATUS_E_NOMEM; + goto wlan_cp_stats_peer_obj_create_handler_return; + } + csc = wlan_cp_stats_ctx_get_from_peer(peer); + if (!csc) { + cp_stats_err("cp_stats context is NULL!"); + status = QDF_STATUS_E_INVAL; + goto wlan_cp_stats_peer_obj_create_handler_return; + } + peer_cs->peer_obj = peer; + if (csc->cp_stats_peer_obj_init) { + if (QDF_STATUS_SUCCESS != + csc->cp_stats_peer_obj_init(peer_cs)) { + cp_stats_err("Failed to initialize peer handlers"); + goto wlan_cp_stats_peer_obj_create_handler_return; + } + } + + status = wlan_objmgr_peer_component_obj_attach(peer, + WLAN_UMAC_COMP_CP_STATS, peer_cs, + QDF_STATUS_SUCCESS); + +wlan_cp_stats_peer_obj_create_handler_return: + if (QDF_IS_STATUS_ERROR(status)) { + if (csc) { + if (csc->cp_stats_peer_obj_deinit) + csc->cp_stats_peer_obj_deinit(peer_cs); + } + + if (peer_cs) + qdf_mem_free(peer_cs); + } + + cp_stats_debug("peer cp stats object attach"); + return status; +} + +QDF_STATUS +wlan_cp_stats_peer_obj_destroy_handler(struct wlan_objmgr_peer *peer, void *arg) +{ + struct peer_cp_stats *peer_cs; + struct cp_stats_context *csc; + + if (!peer) { + cp_stats_err("peer is NULL"); + return QDF_STATUS_E_INVAL; + } + + peer_cs = wlan_objmgr_peer_get_comp_private_obj(peer, + WLAN_UMAC_COMP_CP_STATS); + if (!peer_cs) { + cp_stats_err("peer is NULL"); + return QDF_STATUS_E_INVAL; + } + csc = wlan_cp_stats_ctx_get_from_peer(peer); + if (!csc) { + cp_stats_err("cp_stats context is NULL!"); + return QDF_STATUS_E_INVAL; + } + + if (csc->cp_stats_peer_obj_deinit) + csc->cp_stats_peer_obj_deinit(peer_cs); + + wlan_objmgr_peer_component_obj_detach(peer, WLAN_UMAC_COMP_CP_STATS, + peer_cs); + + qdf_mem_free(peer_cs); + cp_stats_debug("peer cp stats object dettached"); + return QDF_STATUS_SUCCESS; +} diff --git a/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.h b/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.h new file mode 100644 index 000000000000..ad050db4f84e --- /dev/null +++ b/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.h @@ -0,0 +1,126 @@ +/* + * 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: wlan_cp_stats_obj_mgr_handler.h + * + * This header file provide declarations for APIs to handle events from object + * manager for registered events from wlan_cp_stats_init() + */ + +#ifndef __WLAN_CP_STATS_OBJ_MGR_HANDLER_H__ +#define __WLAN_CP_STATS_OBJ_MGR_HANDLER_H__ + +#ifdef QCA_SUPPORT_CP_STATS +#include +#include +#include +#include +#include +#include + +/** + * wlan_cp_stats_psoc_obj_create_handler() - psoc create notification handler + * callback function + * @psoc: pointer to psoc object + * @data: pointer to arg data + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_psoc_obj_create_handler( + struct wlan_objmgr_psoc *psoc, void *data); + +/** + * wlan_cp_stats_psoc_obj_destroy_handler() - psoc destroy notification handler + * callback function + * @psoc: pointer to psoc object + * @data: pointer to arg data + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_psoc_obj_destroy_handler( + struct wlan_objmgr_psoc *psoc, void *data); + +/** + * wlan_cp_stats_pdev_obj_create_handler() - Pdev create notification handler + * callback function + * @pdev: pointer to pdev object + * @data: pointer to arg data + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_pdev_obj_create_handler( + struct wlan_objmgr_pdev *pdev, void *data); + +/** + * wlan_cp_stats_pdev_obj_destroy_handler() - Pdev destroy notification handler + * callback function + * @pdev: pointer to pdev object + * @data: pointer to arg data + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_pdev_obj_destroy_handler( + struct wlan_objmgr_pdev *pdev, void *data); + +/** + * wlan_cp_stats_vdev_obj_create_handler() - vdev create notification handler + * callback function + * @vdev: pointer to vdev object + * @data: pointer to arg data + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_vdev_obj_create_handler( + struct wlan_objmgr_vdev *vdev, void *data); + +/** + * wlan_cp_stats_vdev_obj_destroy_handler() - vdev destroy notification handler + * callback function + * @vdev: pointer to vdev object + * @data: pointer to arg data + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_vdev_obj_destroy_handler( + struct wlan_objmgr_vdev *vdev, void *data); + +/** + * wlan_cp_stats_peer_obj_create_handler() - peer create notification handler + * callback function + * @peer: pointer to peer object + * @data: pointer to arg data + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_peer_obj_create_handler( + struct wlan_objmgr_peer *peer, void *data); + +/** + * wlan_cp_stats_peer_obj_destroy_handler() - peer destroy notification handler + * callback function + * @peer: pointer to peer object + * @data: pointer to arg data + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_cp_stats_peer_obj_destroy_handler( + struct wlan_objmgr_peer *peer, void *data); + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_OBJ_MGR_HANDLER_H__ */ diff --git a/umac/cp_stats/core/src/wlan_cp_stats_ol_api.c b/umac/cp_stats/core/src/wlan_cp_stats_ol_api.c new file mode 100644 index 000000000000..22205710ee97 --- /dev/null +++ b/umac/cp_stats/core/src/wlan_cp_stats_ol_api.c @@ -0,0 +1,163 @@ +/* + * 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: wlan_cp_stats_ol_api.c + * + * This file provide definitions for following + * - (de)init cp stat global ctx obj + * - (de)init common specific ucfg handler + * - (de)register to WMI events for psoc open + */ +#include +#include "wlan_cp_stats_defs.h" +#include "wlan_cp_stats_ol_api.h" +#include "wlan_cp_stats_cmn_api_i.h" +#include + +QDF_STATUS wlan_cp_stats_psoc_obj_init_ol(struct psoc_cp_stats *psoc_cs) +{ + qdf_spinlock_create(&psoc_cs->psoc_cp_stats_lock); + wlan_cp_stats_psoc_cs_init(psoc_cs); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_psoc_obj_deinit_ol(struct psoc_cp_stats *psoc_cs) +{ + wlan_cp_stats_psoc_cs_deinit(psoc_cs); + qdf_spinlock_destroy(&psoc_cs->psoc_cp_stats_lock); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_pdev_obj_init_ol(struct pdev_cp_stats *pdev_cs) +{ + qdf_spinlock_create(&pdev_cs->pdev_cp_stats_lock); + wlan_cp_stats_pdev_cs_init(pdev_cs); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_pdev_obj_deinit_ol(struct pdev_cp_stats *pdev_cs) +{ + wlan_cp_stats_pdev_cs_deinit(pdev_cs); + qdf_spinlock_destroy(&pdev_cs->pdev_cp_stats_lock); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_vdev_obj_init_ol(struct vdev_cp_stats *vdev_cs) +{ + qdf_spinlock_create(&vdev_cs->vdev_cp_stats_lock); + wlan_cp_stats_vdev_cs_init(vdev_cs); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_vdev_obj_deinit_ol(struct vdev_cp_stats *vdev_cs) +{ + wlan_cp_stats_vdev_cs_deinit(vdev_cs); + qdf_spinlock_destroy(&vdev_cs->vdev_cp_stats_lock); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_peer_obj_init_ol(struct peer_cp_stats *peer_cs) +{ + qdf_spinlock_create(&peer_cs->peer_cp_stats_lock); + wlan_cp_stats_peer_cs_init(peer_cs); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_peer_obj_deinit_ol(struct peer_cp_stats *peer_cs) +{ + wlan_cp_stats_peer_cs_deinit(peer_cs); + qdf_spinlock_destroy(&peer_cs->peer_cp_stats_lock); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_open_ol(struct wlan_objmgr_psoc *psoc) +{ + if (!psoc) { + cp_stats_err("PSOC is null!"); + return QDF_STATUS_E_INVAL; + } + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_close_ol(struct wlan_objmgr_psoc *psoc) +{ + if (!psoc) { + cp_stats_err("PSOC is null!"); + return QDF_STATUS_E_INVAL; + } + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_enable_ol(struct wlan_objmgr_psoc *psoc) +{ + if (!psoc) { + cp_stats_err("PSOC is null!\n"); + return QDF_STATUS_E_INVAL; + } + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_disable_ol(struct wlan_objmgr_psoc *psoc) +{ + if (!psoc) { + cp_stats_err("PSOC is null!\n"); + return QDF_STATUS_E_INVAL; + } + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_ctx_init_ol(struct cp_stats_context *csc) +{ + csc->cp_stats_open = wlan_cp_stats_open_ol; + csc->cp_stats_close = wlan_cp_stats_close_ol; + csc->cp_stats_enable = wlan_cp_stats_enable_ol; + csc->cp_stats_disable = wlan_cp_stats_disable_ol; + csc->cp_stats_psoc_obj_init = wlan_cp_stats_psoc_obj_init_ol; + csc->cp_stats_psoc_obj_deinit = wlan_cp_stats_psoc_obj_deinit_ol; + csc->cp_stats_pdev_obj_init = wlan_cp_stats_pdev_obj_init_ol; + csc->cp_stats_pdev_obj_deinit = wlan_cp_stats_pdev_obj_deinit_ol; + csc->cp_stats_vdev_obj_init = wlan_cp_stats_vdev_obj_init_ol; + csc->cp_stats_vdev_obj_deinit = wlan_cp_stats_vdev_obj_deinit_ol; + csc->cp_stats_peer_obj_init = wlan_cp_stats_peer_obj_init_ol; + csc->cp_stats_peer_obj_deinit = wlan_cp_stats_peer_obj_deinit_ol; + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_ctx_deinit_ol(struct cp_stats_context *csc) +{ + csc->cp_stats_open = NULL; + csc->cp_stats_close = NULL; + csc->cp_stats_enable = NULL; + csc->cp_stats_disable = NULL; + csc->cp_stats_psoc_obj_init = NULL; + csc->cp_stats_psoc_obj_deinit = NULL; + csc->cp_stats_pdev_obj_init = NULL; + csc->cp_stats_pdev_obj_deinit = NULL; + csc->cp_stats_vdev_obj_init = NULL; + csc->cp_stats_vdev_obj_deinit = NULL; + csc->cp_stats_peer_obj_init = NULL; + csc->cp_stats_peer_obj_deinit = NULL; + + return QDF_STATUS_SUCCESS; +} diff --git a/umac/cp_stats/core/src/wlan_cp_stats_ol_api.h b/umac/cp_stats/core/src/wlan_cp_stats_ol_api.h new file mode 100644 index 000000000000..1b97c956a017 --- /dev/null +++ b/umac/cp_stats/core/src/wlan_cp_stats_ol_api.h @@ -0,0 +1,147 @@ +/* + * 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: wlan_cp_stats_ol_api.h + * + * This header file provide API declarations required for cp stats global + * context specific to offload + */ + +#ifndef __WLAN_CP_STATS_OL_API_H__ +#define __WLAN_CP_STATS_OL_API_H__ + +#ifdef QCA_SUPPORT_CP_STATS +#include +#include "wlan_cp_stats_defs.h" +#include "wlan_cp_stats_ol_api.h" + +/** + * wlan_cp_stats_psoc_obj_init_ol() - private API to init psoc cp stats obj + * @psoc_cs: pointer to psoc cp stat object + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_psoc_obj_init_ol(struct psoc_cp_stats *psoc_cs); + +/** + * wlan_cp_stats_psoc_obj_deinit_ol() - private API to deinit psoc cp stats obj + * @psoc_cs: pointer to psoc cp stat object + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_psoc_obj_deinit_ol(struct psoc_cp_stats *psoc_cs); + +/** + * wlan_cp_stats_pdev_obj_init_ol() - private API to init pdev cp stats obj + * @pdev_cs: pointer to pdev cp stat object + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_pdev_obj_init_ol(struct pdev_cp_stats *pdev_cs); + +/** + * wlan_cp_stats_pdev_obj_deinit_ol() - private API to deinit pdev cp stats obj + * @pdev_cs: pointer to pdev cp stat object + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_pdev_obj_deinit_ol(struct pdev_cp_stats *pdev_cs); + +/** + * wlan_cp_stats_vdev_obj_init_ol() - private API to init vdev cp stats obj + * @vdev_cs: pointer to vdev cp stat object + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_vdev_obj_init_ol(struct vdev_cp_stats *vdev_cs); + +/** + * wlan_cp_stats_vdev_obj_deinit_ol() - private API to deinit vdev cp stats obj + * @vdev_cs: pointer to vdev cp stat object + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_vdev_obj_deinit_ol(struct vdev_cp_stats *vdev_cs); + +/** + * wlan_cp_stats_peer_obj_init_ol() - private API to init peer cp stats obj + * @peer_cs: pointer to peer cp stat object + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_peer_obj_init_ol(struct peer_cp_stats *peer_cs); + +/** + * wlan_cp_stats_peer_obj_deinit_ol() - private API to deinit peer cp stats obj + * @peer_cs: pointer to peer cp stat object + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_peer_obj_deinit_ol(struct peer_cp_stats *peer_cs); + +/** + * wlan_cp_stats_open_ol() - private API for psoc open + * @psoc: pointer to psoc object + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_open_ol(struct wlan_objmgr_psoc *psoc); + +/** + * wlan_cp_stats_close_ol() - private API for psoc close + * @psoc: pointer to psoc object + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_close_ol(struct wlan_objmgr_psoc *psoc); + +/** + * wlan_cp_stats_enable_ol() - private API for psoc enable + * @psoc: pointer to psoc enable + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_enable_ol(struct wlan_objmgr_psoc *psoc); + +/** + * wlan_cp_stats_disable_ol() - private API for psoc disable + * @psoc: pointer to psoc enable + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_disable_ol(struct wlan_objmgr_psoc *psoc); + +/** + * wlan_cp_stats_ctx_init_ol() - private API to initialize cp stat global ctx + * @csc: pointer to cp stats global context object + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_ctx_init_ol(struct cp_stats_context *csc); + +/** + * wlan_cp_stats_ctx_deinit_ol() - private API to deinit cp stat global ctx + * @csc: pointer to cp stats global context object + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_ctx_deinit_ol(struct cp_stats_context *csc); + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_OL_API_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_chan_info_api.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_chan_info_api.h new file mode 100644 index 000000000000..734e89803607 --- /dev/null +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_chan_info_api.h @@ -0,0 +1,31 @@ +/* + * 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: wlan_cp_stats_chan_info_api.h + * + * This file provide structure definitions for ACS related control plane stats + */ + +#ifndef __WLAN_CP_STATS_CHAN_INFO_API_H__ +#define __WLAN_CP_STATS_CHAN_INFO_API_H__ + +#ifdef QCA_SUPPORT_CP_STATS + +#endif /* QCA_SUPPORT_CP_STATS*/ +#endif /* __WLAN_CP_STATS_CHAN_INFO_API_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_chan_info_defs.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_chan_info_defs.h new file mode 100644 index 000000000000..48ac52ceb852 --- /dev/null +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_chan_info_defs.h @@ -0,0 +1,30 @@ +/* + * 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: wlan_cp_stats_chan_info_defs.h + * + * This file provide structure definitions for ACS related control plane stats + */ +#ifndef __WLAN_CP_STATS_CHAN_INFO_DEFS_H__ +#define __WLAN_CP_STATS_CHAN_INFO_DEFS_H__ + +#ifdef QCA_SUPPORT_CP_STATS + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_CHAN_INFO_DEFS_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_acs_api.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_acs_api.h new file mode 100644 index 000000000000..e0b999d774d2 --- /dev/null +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_acs_api.h @@ -0,0 +1,31 @@ +/* + * 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: wlan_cp_stats_ic_acs_api.h + * + * This file provide declarations for APIs exposed for accessing ACS related + * control plane stats + */ + +#ifndef __WLAN_CP_STATS_IC_ACS_API_H__ +#define __WLAN_CP_STATS_IC_ACS_API_H__ +#ifdef QCA_SUPPORT_CP_STATS + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_IC_ACS_API_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_acs_defs.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_acs_defs.h new file mode 100644 index 000000000000..f4dc9f411ad2 --- /dev/null +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_acs_defs.h @@ -0,0 +1,29 @@ +/* + * 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: wlan_cp_stats_acs_defs.h + * + * This header file declare APIs defines structure for + * common ACS functionality + */ + +#ifndef __WLAN_CP_STATS_ACS_DEFS_H__ +#define __WLAN_CP_STATS_ACS_DEFS_H__ + +#endif /* __WLAN_CP_STATS_ACS_DEFS_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_arpdbg_defs.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_arpdbg_defs.h new file mode 100644 index 000000000000..f1c2c2df9f11 --- /dev/null +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_arpdbg_defs.h @@ -0,0 +1,44 @@ +/* + * 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: wlan_cp_stats_ic_arpdbg_defs.h + * + * This header file provide structure definitions for arp dbg stats + */ + +#ifndef __WLAN_CP_STATS_IC_ARPDBG_DEFS_H__ +#define __WLAN_CP_STATS_IC_ARPDBG_DEFS_H__ +#ifdef QCA_SUPPORT_CP_STATS + +/** + * struct arp_dbg_stats - defines arp debug stats + * @tx_arp_req_count: tx arp req count + * @tx_arp_resp_count: tx arp response count + * @rx_arp_req_count: rx arp req count + * @rx_arp_resp_count: rx arp response count + */ +struct arp_dbg_stats { + uint32_t tx_arp_req_count; /* tx arp request counters */ + uint32_t rx_arp_req_count; /* rx arp request counters */ + uint32_t tx_arp_resp_count; /* tx arp response counters */ + uint32_t rx_arp_resp_count; /* rx arp response counters */ +}; + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_IC_ARPDBG_DEFS_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_atf_defs.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_atf_defs.h new file mode 100644 index 000000000000..0059f032508c --- /dev/null +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_atf_defs.h @@ -0,0 +1,126 @@ +/* + * 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: wlan_cp_stats_atf_defs.h + * + * This header file provides structure definitions to ATF control plane stats + */ + +#ifndef __WLAN_CP_STATS_ATF_DEFS_H__ +#define __WLAN_CP_STATS_ATF_DEFS_H__ + +#ifdef QCA_SUPPORT_CP_STATS +#include +#include +#include + +/** + * struct atf_cp_stats - ATF statistics + * @tokens: tokens distributed by strictq/fairq + * @act_tokens: tokens available, after adjustemnt of + * excess consumed in prev cycle + * @total: total tokens distributed by strictq/fairq + * @contribution: tokens contributed by this node + * @tot_contribution: tokens contributed by all nodes + * @borrow: tokens borrowed by this node + * @unused: tokens not used + * @pkt_drop_nobuf: packets dropped as node is already holding + * it's share of tx buffers + * @allowed_bufs: max tx buffers that this node can hold + * @max_num_buf_held: max tx buffers held by this node + * @min_num_buf_held: min tx buffers held by this node + * @num_tx_bufs: packets sent for this node + * @num_tx_bytes: bytes sent for this node + * @tokens_common: tokens distributed by strictq/fairq + * (for non-atf nodes) + * @act_tokens_common: tokens available, after adjustemnt of + * excess consumed in prev cycle + * (for non-atf nodes) + * @timestamp: time when stats are updated + * @weighted_unusedtokens_percent: weighted unused tokens percent + * @raw_tx_tokens: raw tokens + * @throughput: attainable throughput assuming 100% airtime + * @total_used_tokens: total of used tokens + */ +struct atf_cp_stats { + uint8_t vdev_id; + uint32_t tokens; + uint32_t act_tokens; + uint32_t total; + uint32_t contribution; + uint32_t tot_contribution; + uint32_t borrow; + uint32_t unused; + uint32_t pkt_drop_nobuf; + uint16_t allowed_bufs; + uint16_t max_num_buf_held; + uint16_t min_num_buf_held; + uint16_t num_tx_bufs; + uint32_t num_tx_bytes; + uint32_t tokens_common; + uint32_t act_tokens_common; + uint32_t timestamp; + uint32_t weighted_unusedtokens_percent; + uint32_t raw_tx_tokens; + uint32_t throughput; + uint64_t total_used_tokens; +}; + +/** + * struct atfcntbl - Structure for ATF config table element + * @ssid: SSID + * @sta_mac: STA MAC address + * @value: value to configure + * @info_mark: 1 -- STA, 0 -- VDEV + * @assoc_status: 1 -- Yes, 0 -- No + * @all_tokens_used: 1 -- Yes, 0 -- No + * @cfg_value: Config value + * @grpname: Group name + */ +struct atfcntbl_cs { + uint8_t ssid[SSID_MAX_LEN + 1]; + uint8_t sta_mac[MAC_ADDR_SIZE]; + uint32_t value; + uint8_t info_mark; + uint8_t assoc_status; + uint8_t all_tokens_used; + uint32_t cfg_value; + uint8_t grpname[SSID_MAX_LEN + 1]; +}; + +/** + * struct atftable - ATF table + * @id_type: Sub command + * @atf_info: Array of atfcntbl + * @info_cnt: Count of info entry + * @busy: Busy state flag + * @atf_group: Group ID + * @show_per_peer_table: Flag to show per peer table + */ +struct atftable_cs { + uint16_t id_type; + struct atfcntbl atf_info[ATF_ACTIVED_MAX_CLIENTS + ATF_CFG_NUM_VDEV]; + uint16_t info_cnt; + uint8_t atf_status; + uint32_t busy; + uint32_t atf_group; +}; + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_ATF_DEFS_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_dcs_defs.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_dcs_defs.h new file mode 100644 index 000000000000..405ed9bfb775 --- /dev/null +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_dcs_defs.h @@ -0,0 +1,65 @@ +/* + * 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: wlan_cp_stats_ic_dcs_defs.h + * + * This header file provide structure definitions for DCS control plane stats + */ + +#ifndef __WLAN_CP_STATS_IC_DCS_CHAN_STATS_H__ +#define __WLAN_CP_STATS_IC_DCS_CHAN_STATS_H__ + +#ifdef QCA_SUPPORT_CP_STATS + +/** + * struct pdev_dcs_chan_stats - DCS statistics + * @dcs_cck_phyerr: channel noise floor + * @dcs_total_chan_util: total channel utilization + * @dcs_tx_chan_util: tx channel utilization + * @dcs_rx_chan_util: rx channel utilization + * @dcs_self_bss_util: self BSS util + * @dcs_other_bss_util: other BSS util + * @dcs_wasted_chan_util: wasted chan util + * @dcs_unused_chan_util: unused chan util + * @dcs_ss_under_util: spatial stream under util + * @dcs_sec_20_util: secondary 20MHz util + * @dcs_sec_40_util: secondary 40Mhz util + * @dcs_sec_80_util: secondary 80MHz util + * @dcs_ofdm_phyerr: tx ofdm errors + * @dcs_cck_phyerr: tx cck errors + */ +struct pdev_dcs_chan_stats { + uint32_t dcs_chan_nf; + uint32_t dcs_total_chan_util; + uint32_t dcs_tx_chan_util; + uint32_t dcs_rx_chan_util; + uint32_t dcs_self_bss_util; + uint32_t dcs_other_bss_util; + uint32_t dcs_wasted_chan_util; + uint32_t dcs_unused_chan_util; + uint32_t dcs_ss_under_util; + uint32_t dcs_sec_20_util; + uint32_t dcs_sec_40_util; + uint32_t dcs_sec_80_util; + uint32_t dcs_ofdm_phyerr; + uint32_t dcs_cck_phyerr; +}; + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_IC_DCS_CHAN_STATS_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_tgt_api.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_tgt_api.h new file mode 100644 index 000000000000..8a5ab6609d52 --- /dev/null +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_tgt_api.h @@ -0,0 +1,33 @@ +/* + * 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: wlan_cp_stats_ic_tgt_api.h + * + * This header file provides API declarations required for southbound + * interaction specific to ic + */ +#ifndef __WLAN_CP_STATS_IC_TGT_API_H__ +#define __WLAN_CP_STATS_IC_TGT_API_H__ + +#ifdef QCA_SUPPORT_CP_STATS + +#include + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_IC_TGT_API_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_defs.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_defs.h new file mode 100644 index 000000000000..9a35a291334c --- /dev/null +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_defs.h @@ -0,0 +1,44 @@ +/* + * 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: wlan_cp_stats_ic_ucfg_defs.h + * + * This header file provide definitions and declarations required for northbound + * specific to WIN + */ + +#ifndef __WLAN_CP_STATS_IC_UCFG_DEFS_H__ +#define __WLAN_CP_STATS_IC_UCFG_DEFS_H__ + +#ifdef QCA_SUPPORT_CP_STATS + +/** + * enum wlan_ucfg_cp_stats_vendorcmd_handler_idx - cp stats commands + * @CP_STATS_GET_ATF_HANDLER_IDX: get ATF stats id + * @CP_STATS_GET_VOW_STATS_HANDLER_IDX: get vow ext stats id + * @CP_STATS_VENDOR_CMD_HANDLER_MAX: max command id + */ +enum wlan_ucfg_cp_stats_vendorcmd_handler_idx { + CP_STATS_GET_ATF_HANDLER_IDX, + CP_STATS_GET_VOW_STATS_HANDLER_IDX, + CP_STATS_VENDOR_CMD_HANDLER_MAX, +}; + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_IC_UCFG_DEFS_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_handler.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_handler.h new file mode 100644 index 000000000000..da749235e8e3 --- /dev/null +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_handler.h @@ -0,0 +1,114 @@ +/* + * 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: wlan_cp_stats_ic_ucfg_handler.h + * + * This header file provide APIs declaration required for (de)register ucfg + * handlers, these APIs are invoked from architecture specific (de)init + * APIs when corresponding common object specific obj mgt event notification is + * triggered + */ + +#ifndef __WLAN_CP_STATS_IC_UCFG_HANDLER_H__ +#define __WLAN_CP_STATS_IC_UCFG_HANDLER_H__ + +#ifdef QCA_SUPPORT_CP_STATS +#include +#include + +/** + * wlan_cp_stats_register_pdev_ucfg_handlers() : API to register callbacks + * for commands at pdev object + * @pdev: reference to pdev global object + * + * This API is invoked from pdev create handler and used to register callbacks + * required by ucfg layer + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS +wlan_cp_stats_register_pdev_ucfg_handlers(struct wlan_objmgr_pdev *pdev); + +/** + * wlan_cp_stats_register_vdev_ucfg_handlers() : API to register callbacks + * for commands at vdev object + * @vdev: reference to vdev global object + * + * This API is invoked from vdev create handler and used to register callbacks + * required by ucfg layer + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS +wlan_cp_stats_register_vdev_ucfg_handlers(struct wlan_objmgr_vdev *vdev); + +/** + * wlan_cp_stats_register_peer_ucfg_handlers() : API to register callbacks + * for commands at peer object + * @peer: reference to peer global object + * + * This API is invoked from peer create handler and used to register callbacks + * required by ucfg layer + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS +wlan_cp_stats_register_peer_ucfg_handlers(struct wlan_objmgr_peer *peer); + +/** + * wlan_cp_stats_unregister_pdev_ucfg_handlers() : API to unregister callbacks + * for commands at pdev object + * @pdev: reference to pdev global object + * + * This API is invoked from pdev create handler and used to unregister callbacks + * required by ucfg layer + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS +wlan_cp_stats_unregister_pdev_ucfg_handlers(struct wlan_objmgr_pdev *pdev); + +/** + * wlan_cp_stats_unregister_vdev_ucfg_handlers() : API to unregister callbacks + * for commands at vdev object + * @vdev: reference to vdev global object + * + * This API is invoked from vdev create handler and used to unregister callbacks + * required by ucfg layer + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS +wlan_cp_stats_unregister_vdev_ucfg_handlers(struct wlan_objmgr_vdev *vdev); + +/** + * wlan_cp_stats_unregister_peer_ucfg_handlers() : API to unregister callbacks + * for commands at peer object + * @peer: reference to peer global object + * + * This API is invoked from peer create handler and used to unregister callbacks + * required by ucfg layer + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS +wlan_cp_stats_unregister_peer_ucfg_handlers(struct wlan_objmgr_peer *peer); + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_IC_UCFG_HANDLER_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_vow_defs.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_vow_defs.h new file mode 100644 index 000000000000..7e48f3055fab --- /dev/null +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_vow_defs.h @@ -0,0 +1,69 @@ +/* + * 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: wlan_cp_stats_ic_vow_defs.h + * + * This header file provide structure definitions vow ext stats + */ + +#ifndef __WLAN_CP_STATS_IC_VOW_DEFS_H__ +#define __WLAN_CP_STATS_IC_VOW_DEFS_H__ + +#ifdef QCA_SUPPORT_CP_STATS + +/** + * struct vow_extstats - vow extension structure + * @rx_rssi_ctl0: control channel chain0 rssi + * @rx_rssi_ctl1: control channel chain1 rssi + * @rx_rssi_ctl2: control channel chain2 rssi + * @rx_rssi_ext0: extension channel chain0 rssi + * @rx_rssi_ext1: extension channel chain1 rssi + * @rx_rssi_ext2: extension channel chain2 rssi + * @rx_rssi_comb: combined RSSI value + * @rx_bw: Band width 0-20, 1-40, 2-80 + * @rx_sgi: Guard interval, 0-Long GI, 1-Short GI + * @rx_nss: Number of spatial streams + * @rx_mcs: Rate MCS value + * @rx_ratecode: Hardware rate code + * @rx_rs_flags: Receive misc flags + * @rx_moreaggr: 0 - non aggr frame + * @rx_mac_ts: Time stamp + * @rx_seqno: rx sequence number + */ +struct vow_extstats { + uint8_t rx_rssi_ctl0; + uint8_t rx_rssi_ctl1; + uint8_t rx_rssi_ctl2; + uint8_t rx_rssi_ext0; + uint8_t rx_rssi_ext1; + uint8_t rx_rssi_ext2; + uint8_t rx_rssi_comb; + uint8_t rx_bw; + uint8_t rx_sgi; + uint8_t rx_nss; + uint8_t rx_mcs; + uint8_t rx_ratecode; + uint8_t rx_rs_flags; + uint8_t rx_moreaggr; + uint32_t rx_mac_ts; + uint16_t rx_seqno; +}; + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_IC_VOW_DEFS_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_tgt_api.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_tgt_api.h new file mode 100644 index 000000000000..e13fc0fa3d92 --- /dev/null +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_tgt_api.h @@ -0,0 +1,31 @@ +/* + * 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: wlan_cp_stats_tgt_api.h + * + * This header file provide with API declarations to interface with Southbound + */ +#ifndef __WLAN_CP_STATS_TGT_API_H__ +#define __WLAN_CP_STATS_TGT_API_H__ + +#ifdef QCA_SUPPORT_CP_STATS +#include + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_TGT_API_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ucfg_api.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ucfg_api.h new file mode 100644 index 000000000000..ea69d7e31e20 --- /dev/null +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ucfg_api.h @@ -0,0 +1,31 @@ +/* + * 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: wlan_cp_stats_ucfg_api.h + * + * This header file maintain API declaration required for northbound interaction + */ + +#ifndef __WLAN_CP_STATS_UCFG_API_H__ +#define __WLAN_CP_STATS_UCFG_API_H__ + +#ifdef QCA_SUPPORT_CP_STATS + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_UCFG_API_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_utils_api.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_utils_api.h new file mode 100644 index 000000000000..d3f6cf338f9b --- /dev/null +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_utils_api.h @@ -0,0 +1,143 @@ +/* + * 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: wlan_cp_stats_utils_api.h + * + * This header file provide declaration to public APIs exposed for other UMAC + * components to init/deinit, (de)register to required WMI events on + * soc enable/disable + */ + +#ifndef __WLAN_CP_STATS_UTILS_API_H__ +#define __WLAN_CP_STATS_UTILS_API_H__ + +#ifdef QCA_SUPPORT_CP_STATS +#include + +#define cp_stats_debug(args ...) \ + QDF_TRACE_DEBUG(QDF_MODULE_ID_CP_STATS, ## args) +#define cp_stats_err(args ...) \ + QDF_TRACE_ERROR(QDF_MODULE_ID_CP_STATS, ## args) + +/** + * enum wlan_cp_stats_cfg_state - State of Object configuration to + * indicate whether object has to be attached/detached in cp stats + * @WLAN_OBJ_DETACH: Object has to be detached + * @WLAN_OBJ_ATTACH: Object has to be attached + */ +enum wlan_cp_stats_cfg_state { + WLAN_CP_STATS_OBJ_DETACH = 0, + WLAN_CP_STATS_OBJ_ATTACH = 1, +}; + +/** + * enum wlan_cp_stats_comp_id - component id for other umac components + * @WLAN_CP_STATS_ATF: ATF component specific id + */ +enum wlan_cp_stats_comp_id { + WLAN_CP_STATS_ATF = 0, + WLAN_CP_STATS_MAX_COMPONENTS, +}; + +/** + * wlan_cp_stats_init(): API to init stats component + * + * This API is invoked from dispatcher init during all component init. + * This API will register all required handlers for psoc, pdev,vdev + * and peer object create/delete notification. + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_init(void); + +/** + * wlan_cp_stats_init(): API to deinit stats component + * + * This API is invoked from dispatcher deinit during all component deinit. + * This API will unregister all required handlers for psoc, pdev,vdev + * and peer object create/delete notification. + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_deinit(void); + +/** + * wlan_cp_stats_open(): API to open cp stats component + * @psoc: pointer to psoc + * + * This API is invoked from dispatcher psoc open. + * This API will initialize psoc level cp stats object. + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_open(struct wlan_objmgr_psoc *psoc); + +/** + * wlan_cp_stats_close(): API to close cp stats component + * @psoc: pointer to psoc + * + * This API is invoked from dispatcher psoc close. + * This API will de-initialize psoc level cp stats object. + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_close(struct wlan_objmgr_psoc *psoc); + +/** + * wlan_cp_stats_enable(): API to enable cp stats component + * @psoc: pointer to psoc + * + * This API is invoked from dispatcher psoc enable. + * This API will register cp_stats WMI event handlers. + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_enable(struct wlan_objmgr_psoc *psoc); + +/** + * wlan_cp_stats_disable(): API to disable cp stats component + * @psoc: pointer to psoc + * + * This API is invoked from dispatcher psoc disable. + * This API will unregister cp_stats WMI event handlers. + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_disable(struct wlan_objmgr_psoc *psoc); + +/** + * wlan_cp_stats_comp_obj_configure() - public API to attach/deattach umac + * component specific stat obj to cp stats obj + * @obj_type: common object type + * @cfg_state: config state either to attach of detach + * @comp_id: umac component id + * @cmn_obj: pointer to common object + * @comp_priv_obj: pointer to component specific cp stats object + * + * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error + */ +QDF_STATUS wlan_cp_stats_comp_obj_configure( + enum wlan_objmgr_obj_type obj_type, + enum wlan_cp_stats_cfg_state cfg_state, + enum wlan_umac_comp_id comp_id, + void *cmn_obj, + void *data); + +#endif /* QCA_SUPPORT_CP_STATS */ +#endif /* __WLAN_CP_STATS_UTILS_API_H__ */ diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_chan_info_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_chan_info_api.c new file mode 100644 index 000000000000..dc6a1909ebd3 --- /dev/null +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_chan_info_api.c @@ -0,0 +1,23 @@ +/* + * 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: wlan_cp_stats_chan_info_api.c + * + * This header file declare APIs and defines structure for channel information + */ diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_acs_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_acs_api.c new file mode 100644 index 000000000000..7e93ba929a26 --- /dev/null +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_acs_api.c @@ -0,0 +1,23 @@ +/* + * 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: wlan_cp_stats_ic_acs_api.c + * + * This file holds definition for APIs of ACS specific to ic + */ diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_dcs_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_dcs_api.c new file mode 100644 index 000000000000..2abd73386457 --- /dev/null +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_dcs_api.c @@ -0,0 +1,24 @@ +/* + * 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: wlan_cp_stats_ic_dcs_api.c + * + * This file provides definitions for APIs exposed to get and set DCS related + * control plane statistics + */ diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_tgt_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_tgt_api.c new file mode 100644 index 000000000000..5a7c1b1c6e86 --- /dev/null +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_tgt_api.c @@ -0,0 +1,26 @@ +/* + * 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:wlan_cp_stats_ic_tgt_api.c + * + * This file provide API definitions to update control plane statistics received + * from southbound interface + */ +#include + diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_ucfg_handler.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_ucfg_handler.c new file mode 100644 index 000000000000..40178551dfd5 --- /dev/null +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_ucfg_handler.c @@ -0,0 +1,110 @@ +/* + * 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:wlan_cp_stats_ic_ucfg_handler.c + * + * This file provide APIs definition for registering cp stats cfg80211 command + * handlers + */ +#include "wlan_cp_stats_ic_ucfg_handler.h" +#include +#include +#include "../../core/src/wlan_cp_stats_cmn_api_i.h" + +QDF_STATUS wlan_cp_stats_psoc_cs_init(struct psoc_cp_stats *psoc_cs) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_psoc_cs_deinit(struct psoc_cp_stats *psoc_cs) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_pdev_cs_init(struct pdev_cp_stats *pdev_cs) +{ + wlan_cp_stats_register_pdev_ucfg_handlers(pdev_cs->pdev_obj); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_pdev_cs_deinit(struct pdev_cp_stats *pdev_cs) +{ + wlan_cp_stats_unregister_pdev_ucfg_handlers(pdev_cs->pdev_obj); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_vdev_cs_init(struct vdev_cp_stats *vdev_cs) +{ + wlan_cp_stats_register_vdev_ucfg_handlers(vdev_cs->vdev_obj); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_vdev_cs_deinit(struct vdev_cp_stats *vdev_cs) +{ + wlan_cp_stats_unregister_vdev_ucfg_handlers(vdev_cs->vdev_obj); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_peer_cs_init(struct peer_cp_stats *peer_cs) +{ + wlan_cp_stats_register_peer_ucfg_handlers(peer_cs->peer_obj); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cp_stats_peer_cs_deinit(struct peer_cp_stats *peer_cs) +{ + wlan_cp_stats_unregister_peer_ucfg_handlers(peer_cs->peer_obj); + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +wlan_cp_stats_register_pdev_ucfg_handlers(struct wlan_objmgr_pdev *pdev) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +wlan_cp_stats_unregister_pdev_ucfg_handlers(struct wlan_objmgr_pdev *pdev) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +wlan_cp_stats_register_vdev_ucfg_handlers(struct wlan_objmgr_vdev *vdev) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +wlan_cp_stats_unregister_vdev_ucfg_handlers(struct wlan_objmgr_vdev *vdev) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +wlan_cp_stats_register_peer_ucfg_handlers(struct wlan_objmgr_peer *peer) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +wlan_cp_stats_unregister_peer_ucfg_handlers(struct wlan_objmgr_peer *peer) +{ + return QDF_STATUS_SUCCESS; +} diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_ucfg_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ucfg_api.c new file mode 100644 index 000000000000..6fa1675024ac --- /dev/null +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ucfg_api.c @@ -0,0 +1,28 @@ +/* + * 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: wlan_cp_stats_ucfg_api.h + * + * This file provide API definitions required for northbound interaction + */ + +#ifndef __WLAN_CP_STATS_UCFG_API_H__ +#define __WLAN_CP_STATS_UCFG_API_H__ + +#endif /* __WLAN_CP_STATS_UCFG_API_H__ */ diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_utils_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_utils_api.c new file mode 100644 index 000000000000..a21ec8038fa4 --- /dev/null +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_utils_api.c @@ -0,0 +1,362 @@ +/* + * 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: wlan_cp_stats_utils_api.c + * + * This file provide public API definitions for other accessing other UMAC + * components + */ +#include "../../core/src/wlan_cp_stats_defs.h" +#include "../../core/src/wlan_cp_stats_obj_mgr_handler.h" +#include +#include + +QDF_STATUS wlan_cp_stats_init(void) +{ + QDF_STATUS status = QDF_STATUS_E_FAILURE; + + status = wlan_objmgr_register_psoc_create_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_psoc_obj_create_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) { + cp_stats_err("Failed to register psoc create handler"); + goto wlan_cp_stats_psoc_init_fail1; + } + + status = wlan_objmgr_register_psoc_destroy_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_psoc_obj_destroy_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) { + cp_stats_err("Failed to register psoc destroy handler"); + goto wlan_cp_stats_psoc_init_fail2; + } + + status = wlan_objmgr_register_pdev_create_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_pdev_obj_create_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) { + cp_stats_err("Failed to register pdev create handler"); + goto wlan_cp_stats_pdev_init_fail1; + } + + status = wlan_objmgr_register_pdev_destroy_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_pdev_obj_destroy_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) { + cp_stats_err("Failed to register pdev destroy handler"); + goto wlan_cp_stats_pdev_init_fail2; + } + + status = wlan_objmgr_register_vdev_create_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_vdev_obj_create_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) { + cp_stats_err("Failed to register vdev create handler"); + goto wlan_cp_stats_vdev_init_fail1; + } + + status = wlan_objmgr_register_vdev_destroy_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_vdev_obj_destroy_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) { + cp_stats_err("Failed to register vdev destroy handler"); + goto wlan_cp_stats_vdev_init_fail2; + } + + status = wlan_objmgr_register_peer_create_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_peer_obj_create_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) { + cp_stats_err("Failed to register peer create handler"); + goto wlan_cp_stats_peer_init_fail1; + } + + status = wlan_objmgr_register_peer_destroy_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_peer_obj_destroy_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) { + cp_stats_err("Failed to register peer destroy handler"); + goto wlan_cp_stats_peer_init_fail2; + } + + return QDF_STATUS_SUCCESS; + +wlan_cp_stats_peer_init_fail2: + wlan_objmgr_unregister_peer_create_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_peer_obj_create_handler, + NULL); +wlan_cp_stats_peer_init_fail1: + wlan_objmgr_unregister_vdev_destroy_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_vdev_obj_destroy_handler, + NULL); +wlan_cp_stats_vdev_init_fail2: + wlan_objmgr_unregister_vdev_create_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_vdev_obj_create_handler, + NULL); +wlan_cp_stats_vdev_init_fail1: + wlan_objmgr_unregister_pdev_destroy_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_pdev_obj_destroy_handler, + NULL); +wlan_cp_stats_pdev_init_fail2: + wlan_objmgr_unregister_pdev_create_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_pdev_obj_create_handler, + NULL); +wlan_cp_stats_pdev_init_fail1: + wlan_objmgr_unregister_psoc_destroy_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_psoc_obj_destroy_handler, + NULL); +wlan_cp_stats_psoc_init_fail2: + wlan_objmgr_unregister_psoc_create_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_psoc_obj_create_handler, + NULL); +wlan_cp_stats_psoc_init_fail1: + return status; +} + +QDF_STATUS wlan_cp_stats_deinit(void) +{ + QDF_STATUS status = QDF_STATUS_E_FAILURE; + + status = wlan_objmgr_unregister_psoc_create_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_psoc_obj_create_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) + cp_stats_err("Failed to unregister psoc create handler"); + + status = wlan_objmgr_unregister_psoc_destroy_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_psoc_obj_destroy_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) + cp_stats_err("Failed to unregister psoc destroy handler"); + + status = wlan_objmgr_unregister_pdev_create_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_pdev_obj_create_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) + cp_stats_err("Failed to unregister pdev create handler"); + + status = wlan_objmgr_unregister_pdev_destroy_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_pdev_obj_destroy_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) + cp_stats_err("Failed to unregister pdev destroy handler"); + + status = wlan_objmgr_unregister_vdev_create_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_vdev_obj_create_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) + cp_stats_err("Failed to unregister vdev create handler"); + + status = wlan_objmgr_unregister_vdev_destroy_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_vdev_obj_destroy_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) + cp_stats_err("Failed to unregister vdev destroy handler"); + + status = wlan_objmgr_unregister_peer_create_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_peer_obj_create_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) + cp_stats_err("Failed to unregister peer create handler"); + + status = wlan_objmgr_unregister_peer_destroy_handler + (WLAN_UMAC_COMP_CP_STATS, + wlan_cp_stats_peer_obj_destroy_handler, + NULL); + if (QDF_IS_STATUS_ERROR(status)) + cp_stats_err("Failed to unregister peer destroy handler"); + + return status; +} + +/* DA/OL specific call back initialization */ +QDF_STATUS wlan_cp_stats_open(struct wlan_objmgr_psoc *psoc) +{ + QDF_STATUS status = QDF_STATUS_E_FAILURE; + struct cp_stats_context *csc; + + if (!psoc) { + cp_stats_err("PSOC is null!"); + return QDF_STATUS_E_INVAL; + } + csc = + wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_CP_STATS); + if (!csc) { + cp_stats_err("cp_stats_context is null!"); + return QDF_STATUS_E_FAILURE; + } + + if (csc->cp_stats_open) + status = csc->cp_stats_open(psoc); + + qdf_spinlock_create(&csc->csc_lock); + return status; +} + +QDF_STATUS wlan_cp_stats_close(struct wlan_objmgr_psoc *psoc) +{ + QDF_STATUS status = QDF_STATUS_E_FAILURE; + struct cp_stats_context *csc; + + if (!psoc) { + cp_stats_err("PSOC is null!"); + return QDF_STATUS_E_INVAL; + } + csc = + wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_CP_STATS); + if (!csc) { + cp_stats_err("cp_stats_context is null!"); + return QDF_STATUS_E_FAILURE; + } + + if (csc->cp_stats_close) + status = csc->cp_stats_close(psoc); + + qdf_spinlock_destroy(&csc->csc_lock); + return status; +} + +/* WMI registrations stage */ +QDF_STATUS wlan_cp_stats_enable(struct wlan_objmgr_psoc *psoc) +{ + QDF_STATUS status = QDF_STATUS_E_FAILURE; + struct cp_stats_context *csc; + + if (!psoc) { + cp_stats_err("PSOC is null!\n"); + return QDF_STATUS_E_INVAL; + } + csc = + wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_CP_STATS); + if (!csc) { + cp_stats_err("cp_stats_context is null!\n"); + return QDF_STATUS_E_FAILURE; + } + + if (csc->cp_stats_enable) + status = csc->cp_stats_enable(psoc); + + return status; +} + +QDF_STATUS wlan_cp_stats_disable(struct wlan_objmgr_psoc *psoc) +{ + QDF_STATUS status = QDF_STATUS_E_FAILURE; + struct cp_stats_context *csc; + + if (!psoc) { + cp_stats_err("PSOC is null!\n"); + return QDF_STATUS_E_INVAL; + } + csc = + wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_CP_STATS); + if (!csc) { + cp_stats_err("cp_stats_context is null!\n"); + return QDF_STATUS_E_FAILURE; + } + + if (csc->cp_stats_disable) + status = csc->cp_stats_disable(psoc); + + return status; +} + +QDF_STATUS +wlan_cp_stats_comp_obj_configure(enum wlan_objmgr_obj_type obj_type, + enum wlan_cp_stats_cfg_state cfg_state, + enum wlan_umac_comp_id comp_id, + void *cmn_obj, void *data) +{ + QDF_STATUS status = QDF_STATUS_E_FAILURE; + struct cp_stats_context *csc; + struct wlan_objmgr_psoc *psoc; + struct wlan_objmgr_pdev *pdev; + struct wlan_objmgr_vdev *vdev; + struct wlan_objmgr_peer *peer; + enum wlan_cp_stats_comp_id cp_stats_comp_id; + + if (!cmn_obj) { + cp_stats_err("common object is null!"); + return QDF_STATUS_E_INVAL; + } + + cp_stats_comp_id = wlan_cp_stats_get_comp_id(comp_id); + if (cp_stats_comp_id >= WLAN_CP_STATS_MAX_COMPONENTS) { + cp_stats_err("Invalid UMAC id provided to cp_stats"); + return QDF_STATUS_E_INVAL; + } + + switch (obj_type) { + case WLAN_PSOC_OP: + psoc = (struct wlan_objmgr_psoc *)cmn_obj; + csc = + wlan_objmgr_psoc_get_comp_private_obj + (psoc, WLAN_UMAC_COMP_CP_STATS); + break; + case WLAN_PDEV_OP: + pdev = (struct wlan_objmgr_pdev *)cmn_obj; + csc = wlan_cp_stats_ctx_get_from_pdev(pdev); + break; + case WLAN_VDEV_OP: + vdev = (struct wlan_objmgr_vdev *)cmn_obj; + csc = wlan_cp_stats_ctx_get_from_vdev(vdev); + break; + case WLAN_PEER_OP: + peer = (struct wlan_objmgr_peer *)cmn_obj; + csc = wlan_cp_stats_ctx_get_from_peer(peer); + break; + default: + cp_stats_err("Invalid common object type"); + return QDF_STATUS_E_INVAL; + } + + if (!csc) { + cp_stats_err("cp_stats_context is null!"); + return QDF_STATUS_E_FAILURE; + } + + if (csc->cp_stats_comp_obj_config) + status = csc->cp_stats_comp_obj_config(obj_type, cfg_state, + cp_stats_comp_id, + cmn_obj, data); + + return status; +}