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