Browse Source

qcacmn: Add INI config for CP Stats component

Add new CFG file for CP stats where we can define INIs for component
CP Stats.
Add INI to enable / disable chipset stats logging feature in CP
Stats config file.

Change-Id: I56154127d2f74ec423891653419d93c3ee0c3c5c
CRs-Fixed: 3785789
Rachit Kankane 1 năm trước cách đây
mục cha
commit
168a9c55df

+ 4 - 2
cfg/inc/cfg_converged.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021,2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -51,6 +51,7 @@
 #else
 #define CFG_WLAN_CM_UTF_PARAM
 #endif
+#include <cfg_cp_stats.h>
 #include <cfg_mgmt_txrx.h>
 #include <cfg_ipa.h>
 
@@ -67,7 +68,8 @@
 		CFG_WLAN_CM_UTF_PARAM \
 		CFG_CMN_MLME_ALL \
 		CFG_MGMT_TXRX_ALL \
-		CFG_IPA
+		CFG_IPA \
+		CFG_CP_STATS_ALL
 
 #endif /* __CFG_CONVERGED_H */
 

+ 11 - 1
umac/cp_stats/core/src/wlan_cp_stats_defs.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2018-2019, 2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -126,11 +126,20 @@ struct peer_cp_stats {
 #endif
 };
 
+/**
+ * struct cp_stats_cfg_params - define CP stats INI configuration parameters
+ * @chipset_stats_enable: CP stats enable chipset stats logging from ini config
+ */
+struct cp_stats_cfg_params {
+	bool chipset_stats_enable;
+};
+
 /**
  * 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
+ * @host_params: Structure for INI variables
  * @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
@@ -155,6 +164,7 @@ struct cp_stats_context {
 	qdf_spinlock_t csc_lock;
 	struct wlan_objmgr_psoc *psoc_obj;
 	struct psoc_cp_stats    *psoc_cs;
+	struct cp_stats_cfg_params host_params;
 	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);

+ 16 - 1
umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -778,3 +778,18 @@ wlan_cp_stats_twt_get_peer_session_params(struct wlan_objmgr_psoc *psoc,
 }
 #endif /* WLAN_SUPPORT_TWT */
 
+#ifdef WLAN_CHIPSET_STATS
+bool wlan_cp_stats_get_chipset_stats_enable(struct wlan_objmgr_psoc *psoc)
+{
+	struct cp_stats_context *csc;
+
+	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 false;
+	}
+
+	return csc->host_params.chipset_stats_enable;
+}
+#endif

+ 13 - 1
umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2018, 2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -206,6 +206,18 @@ int wlan_cp_stats_twt_get_peer_session_params(
 					struct wlan_objmgr_psoc *psoc,
 					struct twt_session_stats_info *params);
 #endif
+#ifdef WLAN_CHIPSET_STATS
+/**
+ * wlan_cp_stats_get_chipset_stats_enable() - Returns INI
+ * CHIPSET_STATS_ENABLE
+ *
+ * @psoc: psoc object
+ *
+ * Return: True if Chipset Stats is enabled
+ *	   False if Chipset Stats is not supported or disabled
+ */
+bool wlan_cp_stats_get_chipset_stats_enable(struct wlan_objmgr_psoc *psoc);
+#endif
 
 #endif /* QCA_SUPPORT_CP_STATS */
 #endif /* __WLAN_CP_STATS_OBJ_MGR_HANDLER_H__ */

+ 45 - 0
umac/cp_stats/dispatcher/inc/cfg_cp_stats.h

@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: ISC
+ */
+
+/**
+ * DOC: This file contains centralized definitions of CP Stats component
+ */
+#ifndef __CONFIG_CP_STATS_H
+#define __CONFIG_CP_STATS_H
+
+#include "cfg_define.h"
+
+#ifdef WLAN_CHIPSET_STATS
+/*
+ * <ini>
+ * chipset_stats_enable - Enable/Disable chipset stats logging feature
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * This ini is used to enable/disable Chipset Stats Logging. Configurations
+ * are as follows:
+ * 0 - Disable Chipset Stats logging
+ * 1 - Enable Chipset Stats logging
+ *
+ * Related: None
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CHIPSET_STATS_ENABLE CFG_INI_BOOL(\
+		"chipset_stats_enable", false,\
+		"Enable Chipset stats logging feature")
+
+#define CFG_CP_STATS_CSTATS CFG(CHIPSET_STATS_ENABLE)
+#else
+#define CFG_CP_STATS_CSTATS
+#endif /* WLAN_CHIPSET_STATS */
+
+#define CFG_CP_STATS_ALL \
+	CFG_CP_STATS_CSTATS
+
+#endif /* __CONFIG_CP_STATS_H */

+ 18 - 0
umac/cp_stats/dispatcher/inc/wlan_cp_stats_ucfg_api.h

@@ -88,6 +88,24 @@ int ucfg_cp_stats_twt_get_peer_session_params(
 					struct wlan_objmgr_psoc *psoc_obj,
 					struct twt_session_stats_info *params);
 #endif
+
+#ifdef WLAN_CHIPSET_STATS
+/**
+ * ucfg_cp_stats_get_chipset_stats_enable() - Returns INI CHIPSET_STATS_ENABLE
+ *
+ * @psoc: psoc object
+ *
+ * Return: True if Chipset Stats is enabled
+ *        False if Chipset Stats is not supported or disabled
+ */
+bool ucfg_cp_stats_get_chipset_stats_enable(struct wlan_objmgr_psoc *psoc);
+#else
+static inline
+bool ucfg_cp_stats_get_chipset_stats_enable(struct wlan_objmgr_psoc *psoc)
+{
+	return false;
+}
+#endif
 #endif /* QCA_SUPPORT_CP_STATS */
 
 /**

+ 7 - 0
umac/cp_stats/dispatcher/src/wlan_cp_stats_ucfg_api.c

@@ -68,6 +68,13 @@ int ucfg_cp_stats_twt_get_peer_session_params(
 {
 	return wlan_cp_stats_twt_get_peer_session_params(psoc_obj, params);
 }
+
+#ifdef WLAN_CHIPSET_STATS
+bool ucfg_cp_stats_get_chipset_stats_enable(struct wlan_objmgr_psoc *psoc)
+{
+	return wlan_cp_stats_get_chipset_stats_enable(psoc);
+}
+#endif
 #endif
 
 void ucfg_cp_stats_cstats_register_tx_rx_ops(struct cstats_tx_rx_ops *ops)

+ 21 - 0
umac/cp_stats/dispatcher/src/wlan_cp_stats_utils_api.c

@@ -23,6 +23,7 @@
  * This file provide public API definitions for other accessing other UMAC
  * components
  */
+#include <cfg_ucfg_api.h>
 #include "../../core/src/wlan_cp_stats_defs.h"
 #include "../../core/src/wlan_cp_stats_obj_mgr_handler.h"
 #include "../../core/src/wlan_cp_stats_comp_handler.h"
@@ -218,6 +219,25 @@ QDF_STATUS wlan_cp_stats_deinit(void)
 	return status;
 }
 
+#ifdef WLAN_CHIPSET_STATS
+static void wlan_cp_stats_init_cfg(struct wlan_objmgr_psoc *psoc,
+				   struct cp_stats_context *csc)
+{
+	if (!psoc) {
+		cp_stats_err("psoc is NULL");
+		return;
+	}
+	csc->host_params.chipset_stats_enable =
+			cfg_get(psoc, CHIPSET_STATS_ENABLE);
+}
+#else
+static inline
+void wlan_cp_stats_init_cfg(struct wlan_objmgr_psoc *psoc,
+			    struct cp_stats_context *csc)
+{
+}
+#endif
+
 /* DA/OL specific call back initialization */
 QDF_STATUS wlan_cp_stats_open(struct wlan_objmgr_psoc *psoc)
 {
@@ -234,6 +254,7 @@ QDF_STATUS wlan_cp_stats_open(struct wlan_objmgr_psoc *psoc)
 		cp_stats_err("cp_stats_context is null!");
 		return QDF_STATUS_E_FAILURE;
 	}
+	wlan_cp_stats_init_cfg(psoc, csc);
 
 	if (csc->cp_stats_open)
 		status = csc->cp_stats_open(psoc);