1 /*
2  * Copyright (c) 2013-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 #ifndef _WMI_UNIFIED_CP_STATS_API_H_
22 #define _WMI_UNIFIED_CP_STATS_API_H_
23 
24 #ifdef QCA_SUPPORT_MC_CP_STATS
25 #include <wmi_unified_mc_cp_stats_api.h>
26 #endif
27 #include <wlan_cp_stats_public_structs.h>
28 
29 #if defined(WLAN_SUPPORT_INFRA_CTRL_PATH_STATS) || \
30 	defined(WLAN_CONFIG_TELEMETRY_AGENT)
31 /**
32  * wmi_unified_infra_cp_stats_request_send() - WMI request infra_cp_stats
33  * function
34  * @wmi_handle: wmi handle
35  * @param: pointer to hold infra_cp_stats request parameters
36  *
37  * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error
38  *         codes on failure
39  */
40 QDF_STATUS
41 wmi_unified_infra_cp_stats_request_send(
42 				wmi_unified_t wmi_handle,
43 				struct infra_cp_stats_cmd_info *param);
44 
45 /**
46  * wmi_unified_extract_infra_cp_stats() - extract various infra cp statistics
47  * @wmi_handle: wmi handle
48  * @evt_buf: event buffer
49  * @evt_buf_len: length of event buffer
50  * @params: pointer to store the extracted event info
51  *
52  * This function extracts the infra cp statistics from the event
53  *
54  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
55  */
56 QDF_STATUS
57 wmi_unified_extract_infra_cp_stats(wmi_unified_t wmi_handle,
58 				   void *evt_buf, uint32_t evt_buf_len,
59 				   struct infra_cp_stats_event *params);
60 
61 /**
62  * wmi_stats_handler() - parse the wmi event and fill the stats values
63  * @wmi_handle: wmi handle
64  * @buff: Buffer containing wmi event
65  * @len: length of event buffer
66  * @params: buffer to hold parameters extracted from response event
67  *
68  * Return: QDF_STATUS_SUCCESS on success, else other qdf error values
69  */
70 QDF_STATUS wmi_stats_handler(wmi_unified_t wmi_handle, void *buff, int32_t len,
71 			     struct infra_cp_stats_event *params);
72 
73 QDF_STATUS
74 extract_infra_cp_stats_tlv(wmi_unified_t wmi_handle, void *evt_buf,
75 			   uint32_t evt_buf_len,
76 			   struct infra_cp_stats_event *params);
77 #endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */
78 
79 /**
80  * wmi_unified_stats_request_send() - WMI request stats function
81  * @wmi_handle: handle to WMI
82  * @macaddr: MAC address
83  * @param: pointer to hold stats request parameter
84  *
85  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
86  */
87 QDF_STATUS wmi_unified_stats_request_send(wmi_unified_t wmi_handle,
88 					  uint8_t macaddr[QDF_MAC_ADDR_SIZE],
89 					  struct stats_request_params *param);
90 
91 #ifdef WLAN_FEATURE_BIG_DATA_STATS
92 /**
93  * wmi_unified_big_data_stats_request_send() - WMI request big data stats
94  * function
95  * @wmi_handle: handle to WMI
96  * @param: pointer to hold stats request parameter
97  *
98  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
99  */
100 QDF_STATUS
101 wmi_unified_big_data_stats_request_send(wmi_unified_t wmi_handle,
102 					struct stats_request_params *param);
103 #endif
104 
105 /**
106  * wmi_extract_stats_param() - extract all stats count from event
107  * @wmi_handle: wmi handle
108  * @evt_buf: pointer to event buffer
109  * @stats_param: Pointer to hold stats count
110  *
111  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
112  */
113 QDF_STATUS
114 wmi_extract_stats_param(wmi_unified_t wmi_handle, void *evt_buf,
115 			wmi_host_stats_event *stats_param);
116 
117 /**
118  * wmi_extract_pdev_stats() - extract pdev stats from event
119  * @wmi_handle: wmi handle
120  * @evt_buf: pointer to event buffer
121  * @index: Index into pdev stats
122  * @pdev_stats: Pointer to hold pdev stats
123  *
124  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
125  */
126 QDF_STATUS
127 wmi_extract_pdev_stats(wmi_unified_t wmi_handle, void *evt_buf,
128 		       uint32_t index, wmi_host_pdev_stats *pdev_stats);
129 
130 /**
131  * wmi_extract_vdev_stats() - extract vdev stats from event
132  * @wmi_handle: wmi handle
133  * @evt_buf: pointer to event buffer
134  * @index: Index into vdev stats
135  * @vdev_stats: Pointer to hold vdev stats
136  *
137  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
138  */
139 QDF_STATUS
140 wmi_extract_vdev_stats(wmi_unified_t wmi_handle, void *evt_buf,
141 		       uint32_t index, wmi_host_vdev_stats *vdev_stats);
142 
143 /**
144  * wmi_extract_peer_stats() - extract peer stats from event
145  * @wmi_handle: wmi handle
146  * @evt_buf: pointer to event buffer
147  * @index: Index into peer stats
148  * @peer_stats: Pointer to hold peer stats
149  *
150  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
151  */
152 QDF_STATUS
153 wmi_extract_peer_stats(wmi_unified_t wmi_handle, void *evt_buf,
154 		       uint32_t index, wmi_host_peer_stats *peer_stats);
155 
156 /**
157  * wmi_extract_peer_extd_stats() - extract extended peer stats from event
158  * @wmi_handle: wmi handle
159  * @evt_buf: pointer to event buffer
160  * @index: Index into extended peer stats
161  * @peer_extd_stats: Pointer to hold extended peer stats
162  *
163  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
164  */
165 QDF_STATUS
166 wmi_extract_peer_extd_stats(wmi_unified_t wmi_handle, void *evt_buf,
167 			    uint32_t index,
168 			    wmi_host_peer_extd_stats *peer_extd_stats);
169 
170 #ifdef WLAN_FEATURE_SON
171 /**
172  * wmi_extract_inst_rssi_stats_resp() - extract inst rssi stats from event
173  * @wmi_handle: wmi handle
174  * @evt_buf: pointer to event buffer
175  * @inst_rssi_resp: pointer to hold inst rssi stats
176  *
177  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
178  */
179 QDF_STATUS
180 wmi_extract_inst_rssi_stats_resp(wmi_unified_t wmi_handle, void *evt_buf,
181 			struct wmi_host_inst_rssi_stats_resp *inst_rssi_resp);
182 #endif
183 #endif /* _WMI_UNIFIED_CP_STATS_API_H_ */
184