xref: /wlan-driver/qca-wifi-host-cmn/wmi/src/wmi_unified_cp_stats_api.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021,2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 /**
18  * DOC: Implement API's specific to cp stats component.
19  */
20 
21 #include "wmi_unified_priv.h"
22 #include "wmi_unified_param.h"
23 #include "wmi_unified_cp_stats_api.h"
24 
25 #if defined(WLAN_SUPPORT_INFRA_CTRL_PATH_STATS) || \
26 	defined(WLAN_CONFIG_TELEMETRY_AGENT)
27 QDF_STATUS
wmi_unified_infra_cp_stats_request_send(wmi_unified_t wmi_handle,struct infra_cp_stats_cmd_info * param)28 wmi_unified_infra_cp_stats_request_send(wmi_unified_t wmi_handle,
29 					struct infra_cp_stats_cmd_info *param)
30 {
31 	if (wmi_handle->ops->send_infra_cp_stats_request_cmd)
32 		return wmi_handle->ops->send_infra_cp_stats_request_cmd(
33 								wmi_handle,
34 								param);
35 
36 	return QDF_STATUS_E_FAILURE;
37 }
38 
39 QDF_STATUS
wmi_unified_extract_infra_cp_stats(wmi_unified_t wmi_handle,void * evt_buf,uint32_t evt_buf_len,struct infra_cp_stats_event * params)40 wmi_unified_extract_infra_cp_stats(wmi_unified_t wmi_handle,
41 				   void *evt_buf, uint32_t evt_buf_len,
42 				   struct infra_cp_stats_event *params)
43 {
44 	if (wmi_handle->ops->extract_infra_cp_stats)
45 		return wmi_handle->ops->extract_infra_cp_stats(wmi_handle,
46 								   evt_buf,
47 								   evt_buf_len,
48 								   params);
49 
50 	return QDF_STATUS_E_FAILURE;
51 }
52 
53 #endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */
54 
wmi_unified_stats_request_send(wmi_unified_t wmi_handle,uint8_t macaddr[QDF_MAC_ADDR_SIZE],struct stats_request_params * param)55 QDF_STATUS wmi_unified_stats_request_send(wmi_unified_t wmi_handle,
56 					  uint8_t macaddr[QDF_MAC_ADDR_SIZE],
57 					  struct stats_request_params *param)
58 {
59 	if (wmi_handle->ops->send_stats_request_cmd)
60 		return wmi_handle->ops->send_stats_request_cmd(wmi_handle,
61 				   macaddr, param);
62 
63 	return QDF_STATUS_E_FAILURE;
64 }
65 
66 #ifdef WLAN_FEATURE_BIG_DATA_STATS
67 QDF_STATUS
wmi_unified_big_data_stats_request_send(wmi_unified_t wmi_handle,struct stats_request_params * param)68 wmi_unified_big_data_stats_request_send(wmi_unified_t wmi_handle,
69 					struct stats_request_params *param)
70 {
71 	if (wmi_handle->ops->send_big_data_stats_request_cmd)
72 		return wmi_handle->ops->send_big_data_stats_request_cmd(
73 								wmi_handle,
74 								param);
75 
76 	return QDF_STATUS_E_FAILURE;
77 }
78 #endif
79 
80 QDF_STATUS
wmi_extract_stats_param(wmi_unified_t wmi_handle,void * evt_buf,wmi_host_stats_event * stats_param)81 wmi_extract_stats_param(wmi_unified_t wmi_handle, void *evt_buf,
82 			wmi_host_stats_event *stats_param)
83 {
84 	if (wmi_handle->ops->extract_all_stats_count)
85 		return wmi_handle->ops->extract_all_stats_count(wmi_handle,
86 			evt_buf, stats_param);
87 
88 	return QDF_STATUS_E_FAILURE;
89 }
90 
91 QDF_STATUS
wmi_extract_pdev_stats(wmi_unified_t wmi_handle,void * evt_buf,uint32_t index,wmi_host_pdev_stats * pdev_stats)92 wmi_extract_pdev_stats(wmi_unified_t wmi_handle, void *evt_buf,
93 		       uint32_t index, wmi_host_pdev_stats *pdev_stats)
94 {
95 	if (wmi_handle->ops->extract_pdev_stats)
96 		return wmi_handle->ops->extract_pdev_stats(wmi_handle,
97 			evt_buf, index, pdev_stats);
98 
99 	return QDF_STATUS_E_FAILURE;
100 }
101 
102 QDF_STATUS
wmi_extract_vdev_stats(wmi_unified_t wmi_handle,void * evt_buf,uint32_t index,wmi_host_vdev_stats * vdev_stats)103 wmi_extract_vdev_stats(wmi_unified_t wmi_handle, void *evt_buf,
104 		       uint32_t index, wmi_host_vdev_stats *vdev_stats)
105 {
106 	if (wmi_handle->ops->extract_vdev_stats)
107 		return wmi_handle->ops->extract_vdev_stats(wmi_handle,
108 			evt_buf, index, vdev_stats);
109 
110 	return QDF_STATUS_E_FAILURE;
111 }
112 
113 QDF_STATUS
wmi_extract_peer_stats(wmi_unified_t wmi_handle,void * evt_buf,uint32_t index,wmi_host_peer_stats * peer_stats)114 wmi_extract_peer_stats(wmi_unified_t wmi_handle, void *evt_buf,
115 		       uint32_t index, wmi_host_peer_stats *peer_stats)
116 {
117 	if (wmi_handle->ops->extract_peer_stats)
118 		return wmi_handle->ops->extract_peer_stats(wmi_handle,
119 			evt_buf, index, peer_stats);
120 
121 	return QDF_STATUS_E_FAILURE;
122 }
123 
124 QDF_STATUS
wmi_extract_peer_extd_stats(wmi_unified_t wmi_handle,void * evt_buf,uint32_t index,wmi_host_peer_extd_stats * peer_extd_stats)125 wmi_extract_peer_extd_stats(wmi_unified_t wmi_handle, void *evt_buf,
126 			    uint32_t index,
127 			    wmi_host_peer_extd_stats *peer_extd_stats)
128 {
129 	if (wmi_handle->ops->extract_peer_extd_stats)
130 		return wmi_handle->ops->extract_peer_extd_stats(wmi_handle,
131 			evt_buf, index, peer_extd_stats);
132 
133 	return QDF_STATUS_E_FAILURE;
134 }
135 
136 #ifdef WLAN_FEATURE_SON
137 QDF_STATUS
wmi_extract_inst_rssi_stats_resp(wmi_unified_t wmi_handle,void * evt_buf,struct wmi_host_inst_rssi_stats_resp * inst_rssi_resp)138 wmi_extract_inst_rssi_stats_resp(wmi_unified_t wmi_handle, void *evt_buf,
139 			struct wmi_host_inst_rssi_stats_resp *inst_rssi_resp)
140 {
141 	if (wmi_handle->ops->extract_inst_rssi_stats_resp)
142 		return wmi_handle->ops->extract_inst_rssi_stats_resp(
143 				wmi_handle, evt_buf, inst_rssi_resp);
144 
145 	return QDF_STATUS_E_FAILURE;
146 }
147 #endif
148