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_obj_mgr_handler.h 22 * 23 * This header file provide declarations for APIs to handle events from object 24 * manager for registered events from wlan_cp_stats_init() 25 */ 26 27 #ifndef __WLAN_CP_STATS_OBJ_MGR_HANDLER_H__ 28 #define __WLAN_CP_STATS_OBJ_MGR_HANDLER_H__ 29 30 #ifdef QCA_SUPPORT_CP_STATS 31 #include <wlan_objmgr_cmn.h> 32 #include <wlan_objmgr_global_obj.h> 33 #include <wlan_objmgr_psoc_obj.h> 34 #include <wlan_objmgr_pdev_obj.h> 35 #include <wlan_objmgr_vdev_obj.h> 36 #include <wlan_objmgr_peer_obj.h> 37 38 #include "wlan_cp_stats_defs.h" 39 40 /** 41 * wlan_cp_stats_psoc_obj_create_handler() - psoc create notification handler 42 * callback function 43 * @psoc: pointer to psoc object 44 * @data: pointer to arg data 45 * 46 * Return: QDF_STATUS - Success or Failure 47 */ 48 QDF_STATUS wlan_cp_stats_psoc_obj_create_handler( 49 struct wlan_objmgr_psoc *psoc, void *data); 50 51 /** 52 * wlan_cp_stats_psoc_obj_destroy_handler() - psoc destroy notification handler 53 * callback function 54 * @psoc: pointer to psoc object 55 * @data: pointer to arg data 56 * 57 * Return: QDF_STATUS - Success or Failure 58 */ 59 QDF_STATUS wlan_cp_stats_psoc_obj_destroy_handler( 60 struct wlan_objmgr_psoc *psoc, void *data); 61 62 /** 63 * wlan_cp_stats_pdev_obj_create_handler() - Pdev create notification handler 64 * callback function 65 * @pdev: pointer to pdev object 66 * @data: pointer to arg data 67 * 68 * Return: QDF_STATUS - Success or Failure 69 */ 70 QDF_STATUS wlan_cp_stats_pdev_obj_create_handler( 71 struct wlan_objmgr_pdev *pdev, void *data); 72 73 /** 74 * wlan_cp_stats_pdev_obj_destroy_handler() - Pdev destroy notification handler 75 * callback function 76 * @pdev: pointer to pdev object 77 * @data: pointer to arg data 78 * 79 * Return: QDF_STATUS - Success or Failure 80 */ 81 QDF_STATUS wlan_cp_stats_pdev_obj_destroy_handler( 82 struct wlan_objmgr_pdev *pdev, void *data); 83 84 /** 85 * wlan_cp_stats_vdev_obj_create_handler() - vdev create notification handler 86 * callback function 87 * @vdev: pointer to vdev object 88 * @data: pointer to arg data 89 * 90 * Return: QDF_STATUS - Success or Failure 91 */ 92 QDF_STATUS wlan_cp_stats_vdev_obj_create_handler( 93 struct wlan_objmgr_vdev *vdev, void *data); 94 95 /** 96 * wlan_cp_stats_vdev_obj_destroy_handler() - vdev destroy notification handler 97 * callback function 98 * @vdev: pointer to vdev object 99 * @data: pointer to arg data 100 * 101 * Return: QDF_STATUS - Success or Failure 102 */ 103 QDF_STATUS wlan_cp_stats_vdev_obj_destroy_handler( 104 struct wlan_objmgr_vdev *vdev, void *data); 105 106 /** 107 * wlan_cp_stats_peer_obj_create_handler() - peer create notification handler 108 * callback function 109 * @peer: pointer to peer object 110 * @data: pointer to arg data 111 * 112 * Return: QDF_STATUS - Success or Failure 113 */ 114 QDF_STATUS wlan_cp_stats_peer_obj_create_handler( 115 struct wlan_objmgr_peer *peer, void *data); 116 117 /** 118 * wlan_cp_stats_peer_obj_destroy_handler() - peer destroy notification handler 119 * callback function 120 * @peer: pointer to peer object 121 * @data: pointer to arg data 122 * 123 * Return: QDF_STATUS - Success or Failure 124 */ 125 QDF_STATUS wlan_cp_stats_peer_obj_destroy_handler( 126 struct wlan_objmgr_peer *peer, void *data); 127 128 #ifdef WLAN_SUPPORT_INFRA_CTRL_PATH_STATS 129 /** 130 * wlan_cp_stats_infra_cp_register_resp_cb() - Register the response callback 131 * and cookie in the psoc mc_stats object 132 * @psoc: pointer to psoc object 133 * @req: pointer to request parameter structure 134 * 135 * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on 136 * failure 137 */ 138 QDF_STATUS 139 wlan_cp_stats_infra_cp_register_resp_cb(struct wlan_objmgr_psoc *psoc, 140 struct infra_cp_stats_cmd_info *req); 141 142 /** 143 * wlan_cp_stats_infra_cp_deregister_resp_cb() - Deregister the response callback 144 * and cookie in the psoc mc_stats object 145 * @psoc: pointer to psoc object 146 * 147 * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on 148 * failure 149 */ 150 QDF_STATUS 151 wlan_cp_stats_infra_cp_deregister_resp_cb(struct wlan_objmgr_psoc *psoc); 152 153 /** 154 * wlan_cp_stats_infra_cp_get_context() - get the context and callback 155 * for sending response 156 * @psoc: pointer to psoc object 157 * @resp_cb: pointer to store the response callback 158 * @context: pointer to store context 159 * 160 * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on 161 * failure 162 */ 163 QDF_STATUS 164 wlan_cp_stats_infra_cp_get_context(struct wlan_objmgr_psoc *psoc, 165 get_infra_cp_stats_cb *resp_cb, 166 void **context); 167 /** 168 * wlan_cp_stats_send_infra_cp_req() - API to send infra cp stats request to 169 * lmac 170 * @psoc: pointer to psoc object 171 * @req: pointer to infra cp stats request 172 * 173 * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on 174 * failure 175 */ 176 QDF_STATUS 177 wlan_cp_stats_send_infra_cp_req(struct wlan_objmgr_psoc *psoc, 178 struct infra_cp_stats_cmd_info *req); 179 #endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */ 180 181 #ifdef WLAN_CONFIG_TELEMETRY_AGENT 182 /** 183 * wlan_cp_stats_send_telemetry_cp_req() - API to send telemetry cp stats 184 * request to lmac 185 * @pdev: pointer to pdev object 186 * @req: pointer to telemetry cp stats request 187 * 188 * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on 189 * failure 190 */ 191 QDF_STATUS 192 wlan_cp_stats_send_telemetry_cp_req(struct wlan_objmgr_pdev *pdev, 193 struct infra_cp_stats_cmd_info *req); 194 #endif 195 196 #if defined(WLAN_SUPPORT_TWT) && defined (WLAN_TWT_CONV_SUPPORTED) 197 /** 198 * wlan_cp_stats_twt_get_peer_session_params() - Retrieve peer twt session 199 * parameters 200 * @psoc: psoc object 201 * @params: array of pointer to store peer twt session parameters 202 * 203 * Return: total number of valid TWT sessions 204 */ 205 int wlan_cp_stats_twt_get_peer_session_params( 206 struct wlan_objmgr_psoc *psoc, 207 struct twt_session_stats_info *params); 208 #endif 209 #ifdef WLAN_CHIPSET_STATS 210 /** 211 * wlan_cp_stats_get_chipset_stats_enable() - Returns INI 212 * CHIPSET_STATS_ENABLE 213 * 214 * @psoc: psoc object 215 * 216 * Return: True if Chipset Stats is enabled 217 * False if Chipset Stats is not supported or disabled 218 */ 219 bool wlan_cp_stats_get_chipset_stats_enable(struct wlan_objmgr_psoc *psoc); 220 221 /** 222 * wlan_cp_stats_cstats_qmi_event_handler() - chipset stats QMI event handler 223 * 224 * @cb_ctx: callback context 225 * @type : Type of stats 226 * @event: event data 227 * @event_len: event data length 228 * 229 * Return : 0 on success and -ve value on error 230 */ 231 int wlan_cp_stats_cstats_qmi_event_handler(void *cb_ctx, uint16_t type, 232 void *event, int event_len); 233 234 /** 235 * wlan_cp_stats_init_cfg() - update cp_stats_context with ini value 236 * 237 * @psoc: pointer to psoc 238 * @csc: pointer to cp_stats_context 239 * 240 * Return : void 241 */ 242 void wlan_cp_stats_init_cfg(struct wlan_objmgr_psoc *psoc, 243 struct cp_stats_context *csc); 244 #else 245 static inline void wlan_cp_stats_init_cfg(struct wlan_objmgr_psoc *psoc, 246 struct cp_stats_context *csc) 247 { 248 } 249 #endif /* WLAN_CHIPSET_STATS */ 250 251 #endif /* QCA_SUPPORT_CP_STATS */ 252 #endif /* __WLAN_CP_STATS_OBJ_MGR_HANDLER_H__ */ 253