Parcourir la source

qcacmn: Add framework for cp stats component

Control plane statistics is converged central
component which maintains all control plane stats
and provides necessary support to access statistics
through public APIs

Add framework necessary to create,destroy cp stats
objects corresponding to common object on receiving
event notifications from obj mgr and provide framework
to interact with southbound and northbound

CRs-Fixed: 2192386
Change-Id: I76ec50c1203aa56c4aefc23cbfa03e828b0d7bfd
Naga il y a 7 ans
Parent
commit
f161d3eea6
33 fichiers modifiés avec 3257 ajouts et 0 suppressions
  1. 95 0
      umac/cp_stats/core/src/wlan_cp_stats_cmn_api_i.h
  2. 29 0
      umac/cp_stats/core/src/wlan_cp_stats_cmn_defs.h
  3. 207 0
      umac/cp_stats/core/src/wlan_cp_stats_comp_handler.c
  4. 52 0
      umac/cp_stats/core/src/wlan_cp_stats_comp_handler.h
  5. 36 0
      umac/cp_stats/core/src/wlan_cp_stats_da_api.c
  6. 50 0
      umac/cp_stats/core/src/wlan_cp_stats_da_api.h
  7. 434 0
      umac/cp_stats/core/src/wlan_cp_stats_defs.h
  8. 98 0
      umac/cp_stats/core/src/wlan_cp_stats_ic_defs.h
  9. 403 0
      umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c
  10. 126 0
      umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.h
  11. 163 0
      umac/cp_stats/core/src/wlan_cp_stats_ol_api.c
  12. 147 0
      umac/cp_stats/core/src/wlan_cp_stats_ol_api.h
  13. 31 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_chan_info_api.h
  14. 30 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_chan_info_defs.h
  15. 31 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_acs_api.h
  16. 29 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_acs_defs.h
  17. 44 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_arpdbg_defs.h
  18. 126 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_atf_defs.h
  19. 65 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_dcs_defs.h
  20. 33 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_tgt_api.h
  21. 44 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_defs.h
  22. 114 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_handler.h
  23. 69 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_vow_defs.h
  24. 31 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_tgt_api.h
  25. 31 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_ucfg_api.h
  26. 143 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_utils_api.h
  27. 23 0
      umac/cp_stats/dispatcher/src/wlan_cp_stats_chan_info_api.c
  28. 23 0
      umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_acs_api.c
  29. 24 0
      umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_dcs_api.c
  30. 26 0
      umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_tgt_api.c
  31. 110 0
      umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_ucfg_handler.c
  32. 28 0
      umac/cp_stats/dispatcher/src/wlan_cp_stats_ucfg_api.c
  33. 362 0
      umac/cp_stats/dispatcher/src/wlan_cp_stats_utils_api.c

+ 95 - 0
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__ */

+ 29 - 0
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__ */

+ 207 - 0
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 <wlan_cp_stats_ucfg_api.h>
+
+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;
+}

+ 52 - 0
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__ */

+ 36 - 0
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;
+}

+ 50 - 0
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 <wlan_objmgr_cmn.h>
+#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__ */

+ 434 - 0
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 <wlan_objmgr_cmn.h>
+#include <wlan_objmgr_global_obj.h>
+#include <wlan_objmgr_psoc_obj.h>
+#include <wlan_objmgr_pdev_obj.h>
+#include <wlan_objmgr_vdev_obj.h>
+#include <wlan_objmgr_peer_obj.h>
+#include "wlan_cp_stats_cmn_defs.h"
+#include <wlan_cp_stats_utils_api.h>
+
+/**
+ * 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__ */

+ 98 - 0
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 <wlan_cp_stats_ic_atf_defs.h>
+#include <wlan_cp_stats_ic_arpdbg_defs.h>
+#include <wlan_cp_stats_ic_vow_defs.h>
+#include <wlan_cp_stats_ic_rrm_bcn_defs.h>
+#include <ieee80211_rrm.h>
+
+/**
+ * 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__ */

+ 403 - 0
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 <wlan_cp_stats_ucfg_api.h>
+
+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;
+}

+ 126 - 0
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 <wlan_objmgr_cmn.h>
+#include <wlan_objmgr_global_obj.h>
+#include <wlan_objmgr_psoc_obj.h>
+#include <wlan_objmgr_pdev_obj.h>
+#include <wlan_objmgr_vdev_obj.h>
+#include <wlan_objmgr_peer_obj.h>
+
+/**
+ * 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__ */

+ 163 - 0
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 <wlan_objmgr_cmn.h>
+#include "wlan_cp_stats_defs.h"
+#include "wlan_cp_stats_ol_api.h"
+#include "wlan_cp_stats_cmn_api_i.h"
+#include <wlan_cp_stats_ucfg_api.h>
+
+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;
+}

+ 147 - 0
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 <wlan_objmgr_cmn.h>
+#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__ */

+ 31 - 0
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__ */

+ 30 - 0
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__ */

+ 31 - 0
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__ */

+ 29 - 0
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__ */

+ 44 - 0
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__ */

+ 126 - 0
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 <qdf_status.h>
+#include <wlan_objmgr_cmn.h>
+#include <wlan_atf_utils_defs.h>
+
+/**
+ * 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__ */

+ 65 - 0
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__ */

+ 33 - 0
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 <wlan_objmgr_cmn.h>
+
+#endif /* QCA_SUPPORT_CP_STATS */
+#endif /* __WLAN_CP_STATS_IC_TGT_API_H__ */

+ 44 - 0
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__ */

+ 114 - 0
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 <wlan_objmgr_cmn.h>
+#include <wlan_cp_stats_ucfg_api.h>
+
+/**
+ * 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__ */

+ 69 - 0
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__ */

+ 31 - 0
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 <wlan_objmgr_cmn.h>
+
+#endif /* QCA_SUPPORT_CP_STATS */
+#endif /* __WLAN_CP_STATS_TGT_API_H__ */

+ 31 - 0
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__ */

+ 143 - 0
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 <wlan_objmgr_cmn.h>
+
+#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__ */

+ 23 - 0
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
+ */

+ 23 - 0
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
+ */

+ 24 - 0
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
+ */

+ 26 - 0
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 <wlan_cp_stats_ic_atf_defs.h>
+

+ 110 - 0
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 <wlan_cfg80211_ic_cp_stats.h>
+#include <wlan_cp_stats_ic_ucfg_defs.h>
+#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;
+}

+ 28 - 0
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__ */

+ 362 - 0
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 <wlan_cp_stats_utils_api.h>
+#include <wlan_cp_stats_ucfg_api.h>
+
+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;
+}