1 /* 2 * Copyright (c) 2018,2020 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 #define cp_stats_nofl_debug(args ...) \ 38 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_CP_STATS, ## args) 39 /** 40 * enum wlan_cp_stats_cfg_state - State of Object configuration to 41 * indicate whether object has to be attached/detached in cp stats 42 * @WLAN_CP_STATS_OBJ_DETACH: Object has to be detached 43 * @WLAN_CP_STATS_OBJ_ATTACH: Object has to be attached 44 * @WLAN_CP_STATS_OBJ_INVALID: Object is invalid 45 */ 46 enum wlan_cp_stats_cfg_state { 47 WLAN_CP_STATS_OBJ_DETACH = 0, 48 WLAN_CP_STATS_OBJ_ATTACH = 1, 49 WLAN_CP_STATS_OBJ_INVALID 50 }; 51 52 /** 53 * enum wlan_cp_stats_comp_id - component id for other umac components 54 * @WLAN_CP_STATS_ATF: ATF component specific id 55 * @WLAN_CP_STATS_MAX_COMPONENTS : Max id of cp stats components 56 */ 57 enum wlan_cp_stats_comp_id { 58 WLAN_CP_STATS_ATF = 0, 59 WLAN_CP_STATS_MAX_COMPONENTS, 60 }; 61 62 /** 63 * wlan_cp_stats_init(): API to init stats component 64 * 65 * This API is invoked from dispatcher init during all component init. 66 * This API will register all required handlers for psoc, pdev,vdev 67 * and peer object create/delete notification. 68 * 69 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error 70 */ 71 QDF_STATUS wlan_cp_stats_init(void); 72 73 /** 74 * wlan_cp_stats_init(): API to deinit stats component 75 * 76 * This API is invoked from dispatcher deinit during all component deinit. 77 * This API will unregister all required handlers for psoc, pdev,vdev 78 * and peer object create/delete notification. 79 * 80 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error 81 */ 82 QDF_STATUS wlan_cp_stats_deinit(void); 83 84 /** 85 * wlan_cp_stats_open(): API to open cp stats component 86 * @psoc: pointer to psoc 87 * 88 * This API is invoked from dispatcher psoc open. 89 * This API will initialize psoc level cp stats object. 90 * 91 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error 92 */ 93 QDF_STATUS wlan_cp_stats_open(struct wlan_objmgr_psoc *psoc); 94 95 /** 96 * wlan_cp_stats_close(): API to close cp stats component 97 * @psoc: pointer to psoc 98 * 99 * This API is invoked from dispatcher psoc close. 100 * This API will de-initialize psoc level cp stats object. 101 * 102 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error 103 */ 104 QDF_STATUS wlan_cp_stats_close(struct wlan_objmgr_psoc *psoc); 105 106 /** 107 * wlan_cp_stats_enable(): API to enable cp stats component 108 * @psoc: pointer to psoc 109 * 110 * This API is invoked from dispatcher psoc enable. 111 * This API will register cp_stats WMI event handlers. 112 * 113 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error 114 */ 115 QDF_STATUS wlan_cp_stats_enable(struct wlan_objmgr_psoc *psoc); 116 117 /** 118 * wlan_cp_stats_disable(): API to disable cp stats component 119 * @psoc: pointer to psoc 120 * 121 * This API is invoked from dispatcher psoc disable. 122 * This API will unregister cp_stats WMI event handlers. 123 * 124 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error 125 */ 126 QDF_STATUS wlan_cp_stats_disable(struct wlan_objmgr_psoc *psoc); 127 128 /** 129 * wlan_cp_stats_comp_obj_cfg() - public API to umac for 130 * attach/detach 131 * component specific stat obj to cp stats obj 132 * @obj_type: common object type 133 * @cfg_state: config state either to attach of detach 134 * @comp_id: umac component id 135 * @cmn_obj: pointer to common object 136 * @comp_priv_obj: pointer to component specific cp stats object 137 * 138 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error 139 */ 140 QDF_STATUS wlan_cp_stats_comp_obj_cfg( 141 enum wlan_objmgr_obj_type obj_type, 142 enum wlan_cp_stats_cfg_state cfg_state, 143 enum wlan_umac_comp_id comp_id, 144 void *cmn_obj, 145 void *data); 146 147 #endif /* QCA_SUPPORT_CP_STATS */ 148 #endif /* __WLAN_CP_STATS_UTILS_API_H__ */ 149