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