xref: /wlan-dirver/qca-wifi-host-cmn/umac/cp_stats/dispatcher/inc/wlan_cp_stats_utils_api.h (revision 6ecd284e5a94a1c96e26d571dd47419ac305990d)
1 /*
2  * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: wlan_cp_stats_utils_api.h
21  *
22  * This header file provide declaration to public APIs exposed for other UMAC
23  * components to init/deinit, (de)register to required WMI events on
24  * soc enable/disable
25  */
26 
27 #ifndef __WLAN_CP_STATS_UTILS_API_H__
28 #define __WLAN_CP_STATS_UTILS_API_H__
29 
30 #ifdef QCA_SUPPORT_CP_STATS
31 #include <wlan_objmgr_cmn.h>
32 
33 #define cp_stats_debug(args ...) \
34 		QDF_TRACE_DEBUG(QDF_MODULE_ID_CP_STATS, ## args)
35 #define cp_stats_err(args ...) \
36 		QDF_TRACE_ERROR(QDF_MODULE_ID_CP_STATS, ## args)
37 
38 /**
39  * enum wlan_cp_stats_cfg_state - State of Object configuration to
40  * indicate whether object has to be attached/detached in cp stats
41  * @WLAN_OBJ_DETACH:	Object has to be detached
42  * @WLAN_OBJ_ATTACH:	Object has to be attached
43  */
44 enum wlan_cp_stats_cfg_state {
45 	WLAN_CP_STATS_OBJ_DETACH = 0,
46 	WLAN_CP_STATS_OBJ_ATTACH = 1,
47 };
48 
49 /**
50  * enum wlan_cp_stats_comp_id - component id for other umac components
51  * @WLAN_CP_STATS_ATF:	ATF component specific id
52  */
53 enum wlan_cp_stats_comp_id {
54 	WLAN_CP_STATS_ATF = 0,
55 	WLAN_CP_STATS_MAX_COMPONENTS,
56 };
57 
58 /**
59  * wlan_cp_stats_init(): API to init stats component
60  *
61  * This API is invoked from dispatcher init during all component init.
62  * This API will register all required handlers for psoc, pdev,vdev
63  * and peer object create/delete notification.
64  *
65  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
66  */
67 QDF_STATUS wlan_cp_stats_init(void);
68 
69 /**
70  * wlan_cp_stats_init(): API to deinit stats component
71  *
72  * This API is invoked from dispatcher deinit during all component deinit.
73  * This API will unregister all required handlers for psoc, pdev,vdev
74  * and peer object create/delete notification.
75  *
76  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
77  */
78 QDF_STATUS wlan_cp_stats_deinit(void);
79 
80 /**
81  * wlan_cp_stats_open(): API to open cp stats component
82  * @psoc: pointer to psoc
83  *
84  * This API is invoked from dispatcher psoc open.
85  * This API will initialize psoc level cp stats object.
86  *
87  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
88  */
89 QDF_STATUS wlan_cp_stats_open(struct wlan_objmgr_psoc *psoc);
90 
91 /**
92  * wlan_cp_stats_close(): API to close cp stats component
93  * @psoc: pointer to psoc
94  *
95  * This API is invoked from dispatcher psoc close.
96  * This API will de-initialize psoc level cp stats object.
97  *
98  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
99  */
100 QDF_STATUS wlan_cp_stats_close(struct wlan_objmgr_psoc *psoc);
101 
102 /**
103  * wlan_cp_stats_enable(): API to enable cp stats component
104  * @psoc: pointer to psoc
105  *
106  * This API is invoked from dispatcher psoc enable.
107  * This API will register cp_stats WMI event handlers.
108  *
109  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
110  */
111 QDF_STATUS wlan_cp_stats_enable(struct wlan_objmgr_psoc *psoc);
112 
113 /**
114  * wlan_cp_stats_disable(): API to disable cp stats component
115  * @psoc: pointer to psoc
116  *
117  * This API is invoked from dispatcher psoc disable.
118  * This API will unregister cp_stats WMI event handlers.
119  *
120  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
121  */
122 QDF_STATUS wlan_cp_stats_disable(struct wlan_objmgr_psoc *psoc);
123 
124 /**
125  * wlan_cp_stats_comp_obj_configure() - public API to attach/deattach umac
126  * component specific stat obj to cp stats obj
127  * @obj_type: common object type
128  * @cfg_state: config state either to attach of detach
129  * @comp_id: umac component id
130  * @cmn_obj: pointer to common object
131  * @comp_priv_obj: pointer to component specific cp stats object
132  *
133  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
134  */
135 QDF_STATUS wlan_cp_stats_comp_obj_configure(
136 		enum wlan_objmgr_obj_type obj_type,
137 		enum wlan_cp_stats_cfg_state cfg_state,
138 		enum wlan_umac_comp_id comp_id,
139 		void *cmn_obj,
140 		void *data);
141 
142 #endif /* QCA_SUPPORT_CP_STATS */
143 #endif /* __WLAN_CP_STATS_UTILS_API_H__ */
144