1 /*
2 * Copyright (c) 2018, 2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for
6 * any purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
8 * copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 /**
21 * DOC: wlan_cp_stats_ucfg_api.h
22 *
23 * This header file maintain API declaration required for northbound interaction
24 */
25
26 #ifndef __WLAN_CP_STATS_UCFG_API_H__
27 #define __WLAN_CP_STATS_UCFG_API_H__
28
29 #ifdef QCA_SUPPORT_CP_STATS
30 #include <wlan_cp_stats_utils_api.h>
31 #include <wlan_cp_stats_chipset_stats.h>
32 #include "../../core/src/wlan_cp_stats_defs.h"
33 #include "../../core/src/wlan_cp_stats_cmn_api_i.h"
34 #include <wlan_cp_stats_chipset_stats.h>
35
36 /**
37 * ucfg_infra_cp_stats_register_resp_cb() - Register the response callback
38 * and cookie in the psoc mc_stats object
39 * @psoc: pointer to psoc object
40 * @req: pointer to request parameter structure
41 *
42 * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on
43 * failure
44 */
45 QDF_STATUS
46 ucfg_infra_cp_stats_register_resp_cb(struct wlan_objmgr_psoc *psoc,
47 struct infra_cp_stats_cmd_info *req);
48
49 /**
50 * ucfg_infra_cp_stats_deregister_resp_cb() - Deregister the response callback
51 * and cookie in the psoc mc_stats object
52 * @psoc: pointer to psoc object
53 *
54 * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on
55 * failure
56 */
57 QDF_STATUS
58 ucfg_infra_cp_stats_deregister_resp_cb(struct wlan_objmgr_psoc *psoc);
59
60 /**
61 * ucfg_send_infra_cp_stats_request() - send a infra cp stats command
62 * @vdev: pointer to vdev object
63 * @req: pointer to request parameter structure
64 *
65 * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes
66 * on failure
67 */
68 QDF_STATUS
69 ucfg_send_infra_cp_stats_request(struct wlan_objmgr_vdev *vdev,
70 struct infra_cp_stats_cmd_info *req);
71
72 #ifdef WLAN_CONFIG_TELEMETRY_AGENT
73 /**
74 * ucfg_send_telemetry_cp_stats_request() - send a telemetry cp stats command
75 * @pdev: pointer to pdev object
76 * @req: pointer to request parameter structure
77 *
78 * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes
79 * on failure
80 */
81 QDF_STATUS
82 ucfg_send_telemetry_cp_stats_request(struct wlan_objmgr_pdev *pdev,
83 struct infra_cp_stats_cmd_info *req);
84 #endif
85
86 #if defined(WLAN_SUPPORT_TWT) && defined (WLAN_TWT_CONV_SUPPORTED)
87 int ucfg_cp_stats_twt_get_peer_session_params(
88 struct wlan_objmgr_psoc *psoc_obj,
89 struct twt_session_stats_info *params);
90 #endif
91
92 #ifdef WLAN_CHIPSET_STATS
93 /**
94 * ucfg_cp_stats_get_chipset_stats_enable() - Returns INI CHIPSET_STATS_ENABLE
95 *
96 * @psoc: psoc object
97 *
98 * Return: True if Chipset Stats is enabled
99 * False if Chipset Stats is not supported or disabled
100 */
101 bool ucfg_cp_stats_get_chipset_stats_enable(struct wlan_objmgr_psoc *psoc);
102 #else
103 static inline
ucfg_cp_stats_get_chipset_stats_enable(struct wlan_objmgr_psoc * psoc)104 bool ucfg_cp_stats_get_chipset_stats_enable(struct wlan_objmgr_psoc *psoc)
105 {
106 return false;
107 }
108 #endif
109 #endif /* QCA_SUPPORT_CP_STATS */
110
111 /**
112 * ucfg_cp_stats_cstats_register_tx_rx_ops() - Register chipset stats ops
113 *
114 * @ops : pointer to tx/rx ops structure
115 *
116 * Return: void
117 */
118 void ucfg_cp_stats_cstats_register_tx_rx_ops(struct cstats_tx_rx_ops *ops);
119
120 /*
121 * ucfg_cp_stats_cstats_send_buffer_to_user() - ucfg api to Flush chipset stats
122 * to the middleware
123 * @type - Type of chipset stats to be sent
124 *
125 * Return : 0 on success and errno on failure
126 */
127 int ucfg_cp_stats_cstats_send_buffer_to_user(enum cstats_types type);
128 #endif /* __WLAN_CP_STATS_UCFG_API_H__ */
129