فهرست منبع

qcacmn: Add wmi support to get telemetry stats from FW

Add wmi support to get telemetry stats from FW.

Change-Id: I7aec4ff19dc0a23755f572d3bca32f8491c60a5b
CRs-Fixed: 3376707
Mukul Dhiman 2 سال پیش
والد
کامیت
b590809644

+ 1 - 21
target_if/cp_stats/inc/target_if_cp_stats.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018, 2020-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 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
@@ -120,27 +121,6 @@ target_if_cp_stats_unregister_legacy_event_handler(
 }
 #endif  /* WLAN_SUPPORT_LEGACY_CP_STATS_HANDLERS */
 
-#ifdef WLAN_SUPPORT_INFRA_CTRL_PATH_STATS
-/**
- * get_infra_cp_stats_id() - convert from to wmi_ctrl_path_stats_id
- * @type: type from enum infra_cp_stats_id
- *
- * Return: wmi_ctrl_path_stats_id code for success or -EINVAL
- * for failure
- */
-uint32_t get_infra_cp_stats_id(enum infra_cp_stats_id type);
-
-/**
- * get_infra_cp_stats_action() - convert action codes from
- * enum infra_cp_stats_action to wmi_ctrl_path_stats_action
- * @action: action code from enum infra_cp_stats_action
- *
- * Return: wmi_ctrl_path_stats_action code for success or -EINVAL
- * for failure
- */
-uint32_t get_infra_cp_stats_action(enum infra_cp_stats_action action);
-#endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */
-
 #else
 static inline QDF_STATUS
 target_if_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)

+ 35 - 36
target_if/cp_stats/src/target_if_cp_stats.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2018, 2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -43,41 +43,6 @@
 #include "cp_stats/core/src/wlan_cp_stats_comp_handler.h"
 
 #ifdef WLAN_SUPPORT_INFRA_CTRL_PATH_STATS
-
-uint32_t get_infra_cp_stats_id(enum infra_cp_stats_id type)
-{
-	switch (type) {
-	case TYPE_REQ_CTRL_PATH_PDEV_TX_STAT:
-		return WMI_REQUEST_CTRL_PATH_PDEV_TX_STAT;
-	case TYPE_REQ_CTRL_PATH_VDEV_EXTD_STAT:
-		return WMI_REQUEST_CTRL_PATH_VDEV_EXTD_STAT;
-	case TYPE_REQ_CTRL_PATH_MEM_STAT:
-		return WMI_REQUEST_CTRL_PATH_MEM_STAT;
-	case TYPE_REQ_CTRL_PATH_TWT_STAT:
-		return WMI_REQUEST_CTRL_PATH_TWT_STAT;
-	case TYPE_REQ_CTRL_PATH_BMISS_STAT:
-		return WMI_REQUEST_CTRL_PATH_BMISS_STAT;
-	default:
-		return -EINVAL;
-	}
-}
-
-uint32_t get_infra_cp_stats_action(enum infra_cp_stats_action action)
-{
-	switch (action) {
-	case ACTION_REQ_CTRL_PATH_STAT_GET:
-		return WMI_REQUEST_CTRL_PATH_STAT_GET;
-	case ACTION_REQ_CTRL_PATH_STAT_RESET:
-		return WMI_REQUEST_CTRL_PATH_STAT_RESET;
-	case ACTION_REQ_CTRL_PATH_STAT_START:
-		return WMI_REQUEST_CTRL_PATH_STAT_START;
-	case ACTION_REQ_CTRL_PATH_STAT_STOP:
-		return WMI_REQUEST_CTRL_PATH_STAT_STOP;
-	default:
-		return -EINVAL;
-	}
-}
-
 #ifdef WLAN_SUPPORT_TWT
 /**
  * target_if_infra_cp_stats_twt_event_free() - Free event buffer
@@ -584,6 +549,39 @@ static void target_if_register_infra_cp_stats_txops(
 }
 #endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */
 
+#ifdef WLAN_TELEMETRY_STATS_SUPPORT
+/**
+ * target_if_telemetry_cp_stats_req() - API to send stats request to wmi
+ * @pdev: pointer to pdev object
+ * @req: pointer to object containing stats request parameters
+ *
+ * Return: QDF_STATUS_SUCCESS on success, else other qdf error values
+ */
+static
+QDF_STATUS target_if_telemetry_cp_stats_req(struct wlan_objmgr_pdev *pdev,
+					    struct infra_cp_stats_cmd_info *req)
+{
+	struct wmi_unified *wmi_handle;
+
+	wmi_handle = get_wmi_unified_hdl_from_pdev(pdev);
+	if (!wmi_handle) {
+		cp_stats_err("wmi_handle is null.");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+	return wmi_unified_infra_cp_stats_request_send(wmi_handle, req);
+}
+
+static void target_if_register_telemetry_cp_stats_txops(
+				struct wlan_lmac_if_cp_stats_tx_ops *tx_ops)
+{
+	tx_ops->send_req_telemetry_cp_stats = target_if_telemetry_cp_stats_req;
+}
+#else
+static void target_if_register_telemetry_cp_stats_txops(
+				struct wlan_lmac_if_cp_stats_tx_ops *tx_ops)
+{ }
+#endif
+
 QDF_STATUS
 target_if_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 {
@@ -600,6 +598,7 @@ target_if_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 		return QDF_STATUS_E_FAILURE;
 	}
 	target_if_register_infra_cp_stats_txops(cp_stats_tx_ops);
+	target_if_register_telemetry_cp_stats_txops(cp_stats_tx_ops);
 
 	cp_stats_tx_ops->cp_stats_attach =
 		target_if_cp_stats_register_event_handler;

+ 22 - 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 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 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
@@ -466,6 +466,27 @@ wlan_cp_stats_send_infra_cp_req(struct wlan_objmgr_psoc *psoc,
 }
 #endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */
 
+#ifdef WLAN_TELEMETRY_STATS_SUPPORT
+QDF_STATUS
+wlan_cp_stats_send_telemetry_cp_req(struct wlan_objmgr_pdev *pdev,
+				    struct infra_cp_stats_cmd_info *req)
+{
+	struct wlan_lmac_if_cp_stats_tx_ops *tx_ops;
+
+	tx_ops = target_if_cp_stats_get_tx_ops(wlan_pdev_get_psoc(pdev));
+	if (!tx_ops) {
+		cp_stats_err("could not get tx_ops");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	if (!tx_ops->send_req_telemetry_cp_stats) {
+		cp_stats_err("could not get send_req_infra_twt_stats");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+	return tx_ops->send_req_telemetry_cp_stats(pdev, req);
+}
+#endif
+
 #if defined(WLAN_SUPPORT_TWT) && defined (WLAN_TWT_CONV_SUPPORTED)
 /**
  * wlan_cp_stats_twt_get_peer_session_param() - Obtains twt session parameters

+ 16 - 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 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 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
@@ -167,6 +167,21 @@ wlan_cp_stats_send_infra_cp_req(struct wlan_objmgr_psoc *psoc,
 				struct infra_cp_stats_cmd_info *req);
 #endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */
 
+#ifdef WLAN_TELEMETRY_STATS_SUPPORT
+/**
+ * wlan_cp_stats_send_telemetry_cp_req() - API to send telemetry cp stats
+ * request to lmac
+ * @pdev: pointer to pdev object
+ * @req: pointer to telemetry cp stats request
+ *
+ * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on
+ * failure
+ */
+QDF_STATUS
+wlan_cp_stats_send_telemetry_cp_req(struct wlan_objmgr_pdev *pdev,
+				    struct infra_cp_stats_cmd_info *req);
+#endif
+
 #if defined(WLAN_SUPPORT_TWT) && defined (WLAN_TWT_CONV_SUPPORTED)
 /**
  * wlan_cp_stats_twt_get_peer_session_params() - Retrieve peer twt session

+ 4 - 1
umac/cp_stats/dispatcher/inc/wlan_cp_stats_public_structs.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -155,6 +155,7 @@ enum infra_cp_stats_action {
 	ACTION_REQ_CTRL_PATH_STAT_RESET,
 	ACTION_REQ_CTRL_PATH_STAT_START,
 	ACTION_REQ_CTRL_PATH_STAT_STOP,
+	ACTION_REQ_CTRL_PATH_STAT_PERIODIC_PUBLISH,
 };
 
 enum infra_cp_stats_id {
@@ -163,6 +164,7 @@ enum infra_cp_stats_id {
 	TYPE_REQ_CTRL_PATH_MEM_STAT,
 	TYPE_REQ_CTRL_PATH_TWT_STAT,
 	TYPE_REQ_CTRL_PATH_BMISS_STAT,
+	TYPE_REQ_CTRL_PATH_PMLO_STAT,
 };
 
 /**
@@ -199,5 +201,6 @@ struct infra_cp_stats_cmd_info {
 #endif
 	void (*infra_cp_stats_resp_cb)(struct infra_cp_stats_event *ev,
 				       void *cookie);
+	uint32_t stat_periodicity;
 };
 #endif

+ 15 - 1
umac/cp_stats/dispatcher/inc/wlan_cp_stats_ucfg_api.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2018, 2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 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
@@ -56,6 +56,20 @@ QDF_STATUS
 ucfg_send_infra_cp_stats_request(struct wlan_objmgr_vdev *vdev,
 				 struct infra_cp_stats_cmd_info *req);
 
+#ifdef WLAN_TELEMETRY_STATS_SUPPORT
+/**
+ * @ucfg_send_telemetry_cp_stats_request() - send a telemetry cp stats command
+ * @pdev: pointer to pdev object
+ * @req: pointer to request parameter structure
+ *
+ * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes
+ * on failure
+ */
+QDF_STATUS
+ucfg_send_telemetry_cp_stats_request(struct wlan_objmgr_pdev *pdev,
+				     struct infra_cp_stats_cmd_info *req);
+#endif
+
 #if defined(WLAN_SUPPORT_TWT) && defined (WLAN_TWT_CONV_SUPPORTED)
 int ucfg_cp_stats_twt_get_peer_session_params(
 					struct wlan_objmgr_psoc *psoc_obj,

+ 12 - 1
umac/cp_stats/dispatcher/src/wlan_cp_stats_ucfg_api.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2018, 2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 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
@@ -43,6 +43,17 @@ ucfg_send_infra_cp_stats_request(struct wlan_objmgr_vdev *vdev,
 }
 #endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */
 
+#ifdef WLAN_TELEMETRY_STATS_SUPPORT
+QDF_STATUS
+ucfg_send_telemetry_cp_stats_request(struct wlan_objmgr_pdev *pdev,
+				     struct infra_cp_stats_cmd_info *req)
+{
+	return wlan_cp_stats_send_telemetry_cp_req(pdev, req);
+}
+
+qdf_export_symbol(ucfg_send_telemetry_cp_stats_request);
+#endif
+
 #if defined(WLAN_SUPPORT_TWT) && defined (WLAN_TWT_CONV_SUPPORTED)
 int ucfg_cp_stats_twt_get_peer_session_params(
 					struct wlan_objmgr_psoc *psoc_obj,

+ 5 - 0
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -179,6 +179,11 @@ struct wlan_lmac_if_cp_stats_tx_ops {
 					struct wlan_objmgr_psoc *psoc,
 					stats_req_info *req);
 #endif
+#ifdef WLAN_TELEMETRY_STATS_SUPPORT
+	QDF_STATUS (*send_req_telemetry_cp_stats)(
+					struct wlan_objmgr_pdev *pdev,
+					struct infra_cp_stats_cmd_info *req);
+#endif
 };
 
 /**

+ 4 - 2
wmi/inc/wmi_unified_cp_stats_api.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021,2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -24,8 +24,10 @@
 #ifdef QCA_SUPPORT_MC_CP_STATS
 #include <wmi_unified_mc_cp_stats_api.h>
 #endif
+#include <wlan_cp_stats_public_structs.h>
 
-#ifdef WLAN_SUPPORT_INFRA_CTRL_PATH_STATS
+#if defined(WLAN_SUPPORT_INFRA_CTRL_PATH_STATS) || \
+	defined(WLAN_TELEMETRY_STATS_SUPPORT)
 /**
  * wmi_unified_infra_cp_stats_request_send() - WMI request infra_cp_stats
  * function

+ 2 - 1
wmi/inc/wmi_unified_priv.h

@@ -2910,7 +2910,8 @@ QDF_STATUS (*extract_halphy_stats_end_of_event)(wmi_unified_t wmi_handle,
 QDF_STATUS (*extract_halphy_stats_event_count)(wmi_unified_t wmi_handle,
 					       void *evt_buf,
 					       uint32_t *event_count_flag);
-#ifdef WLAN_SUPPORT_INFRA_CTRL_PATH_STATS
+#if defined(WLAN_SUPPORT_INFRA_CTRL_PATH_STATS) || \
+	defined(WLAN_TELEMETRY_STATS_SUPPORT)
 QDF_STATUS
 (*extract_infra_cp_stats)(wmi_unified_t wmi_handle,
 			  void *evt_buf, uint32_t evt_buf_len,

+ 3 - 2
wmi/src/wmi_unified_cp_stats_api.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021,2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -22,7 +22,8 @@
 #include "wmi_unified_param.h"
 #include "wmi_unified_cp_stats_api.h"
 
-#ifdef WLAN_SUPPORT_INFRA_CTRL_PATH_STATS
+#if defined(WLAN_SUPPORT_INFRA_CTRL_PATH_STATS) || \
+	defined(WLAN_TELEMETRY_STATS_SUPPORT)
 QDF_STATUS
 wmi_unified_infra_cp_stats_request_send(wmi_unified_t wmi_handle,
 					struct infra_cp_stats_cmd_info *param)

+ 64 - 4
wmi/src/wmi_unified_cp_stats_tlv.c

@@ -22,7 +22,61 @@
 #include "target_if_cp_stats.h"
 #include <wlan_cp_stats_public_structs.h>
 
-#ifdef WLAN_SUPPORT_INFRA_CTRL_PATH_STATS
+#if defined(WLAN_SUPPORT_INFRA_CTRL_PATH_STATS) || \
+	defined(WLAN_TELEMETRY_STATS_SUPPORT)
+/**
+ * get_infra_cp_stats_id() - convert from to wmi_ctrl_path_stats_id
+ * @type: type from enum infra_cp_stats_id
+ *
+ * Return: wmi_ctrl_path_stats_id code for success or -EINVAL
+ * for failure
+ */
+static uint32_t get_infra_cp_stats_id(enum infra_cp_stats_id type)
+{
+	switch (type) {
+	case TYPE_REQ_CTRL_PATH_PDEV_TX_STAT:
+		return WMI_REQUEST_CTRL_PATH_PDEV_TX_STAT;
+	case TYPE_REQ_CTRL_PATH_VDEV_EXTD_STAT:
+		return WMI_REQUEST_CTRL_PATH_VDEV_EXTD_STAT;
+	case TYPE_REQ_CTRL_PATH_MEM_STAT:
+		return WMI_REQUEST_CTRL_PATH_MEM_STAT;
+	case TYPE_REQ_CTRL_PATH_TWT_STAT:
+		return WMI_REQUEST_CTRL_PATH_TWT_STAT;
+	case TYPE_REQ_CTRL_PATH_BMISS_STAT:
+		return WMI_REQUEST_CTRL_PATH_BMISS_STAT;
+	case TYPE_REQ_CTRL_PATH_PMLO_STAT:
+		return WMI_REQUEST_CTRL_PATH_PMLO_STAT;
+	default:
+		return -EINVAL;
+	}
+}
+
+/**
+ * get_infra_cp_stats_action() - convert action codes from
+ * enum infra_cp_stats_action to wmi_ctrl_path_stats_action
+ * @action: action code from enum infra_cp_stats_action
+ *
+ * Return: wmi_ctrl_path_stats_action code for success or -EINVAL
+ * for failure
+ */
+static uint32_t get_infra_cp_stats_action(enum infra_cp_stats_action action)
+{
+	switch (action) {
+	case ACTION_REQ_CTRL_PATH_STAT_GET:
+		return WMI_REQUEST_CTRL_PATH_STAT_GET;
+	case ACTION_REQ_CTRL_PATH_STAT_RESET:
+		return WMI_REQUEST_CTRL_PATH_STAT_RESET;
+	case ACTION_REQ_CTRL_PATH_STAT_START:
+		return WMI_REQUEST_CTRL_PATH_STAT_START;
+	case ACTION_REQ_CTRL_PATH_STAT_STOP:
+		return WMI_REQUEST_CTRL_PATH_STAT_STOP;
+	case ACTION_REQ_CTRL_PATH_STAT_PERIODIC_PUBLISH:
+		return WMI_REQUEST_CTRL_PATH_STAT_PERIODIC_PUBLISH;
+	default:
+		return -EINVAL;
+	}
+}
+
 #ifdef WLAN_SUPPORT_TWT
 static uint32_t
 get_stats_req_twt_dialog_id(struct infra_cp_stats_cmd_info *req)
@@ -356,6 +410,7 @@ prepare_infra_cp_stats_buf(wmi_unified_t wmi_handle,
 
 	cmd_fixed_param->request_id = stats_req->action;
 	cmd_fixed_param->action = get_infra_cp_stats_action(stats_req->action);
+	cmd_fixed_param->stat_periodicity = stats_req->stat_periodicity;
 
 	buf_ptr = (uint8_t *)cmd_fixed_param;
 	/* Setting tlv header for pdev id arrays*/
@@ -385,8 +440,12 @@ prepare_infra_cp_stats_buf(wmi_unified_t wmi_handle,
 	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32,
 		       sizeof(A_UINT32) * num_dialog_ids);
 
-	for (index = 0; index < num_pdev_ids; index++)
-		pdev_id_array[index] = stats_req->pdev_id[index];
+	for (index = 0; index < num_pdev_ids; index++) {
+		pdev_id_array[index] =
+			wmi_handle->ops->convert_pdev_id_host_to_target(
+					wmi_handle,
+					stats_req->pdev_id[index]);
+	}
 
 	for (index = 0; index < num_vdev_ids; index++)
 		vdev_id_array[index] = stats_req->vdev_id[index];
@@ -1010,7 +1069,8 @@ extract_pmf_bcn_protect_stats_tlv(wmi_unified_t wmi_handle, void *evt_buf,
 	return QDF_STATUS_SUCCESS;
 }
 
-#ifdef WLAN_SUPPORT_INFRA_CTRL_PATH_STATS
+#if defined(WLAN_SUPPORT_INFRA_CTRL_PATH_STATS) || \
+	defined(WLAN_TELEMETRY_STATS_SUPPORT)
 static void wmi_infra_cp_stats_ops_attach_tlv(struct wmi_ops *ops)
 {
 	ops->send_infra_cp_stats_request_cmd =