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