1 /* 2 * Copyright (c) 2016-2019, 2021 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 * DOC: Define the global data structure of UMAC 20 */ 21 #ifndef _WLAN_OBJMGR_GLOBAL_OBJ_I_H_ 22 #define _WLAN_OBJMGR_GLOBAL_OBJ_I_H_ 23 24 #include "wlan_objmgr_cmn.h" 25 #ifdef WLAN_FEATURE_11BE_MLO 26 #include "wlan_mlo_mgr_public_structs.h" 27 #endif 28 29 struct wlan_objmgr_debug_info; 30 /** 31 * struct wlan_objmgr_global - Global object definition 32 * @psoc[]: Array of PSOCs to maintain PSOC's list, 33 * its optional 34 * @psoc_create_handler[]: PSOC create handler array 35 * @psoc_create_handler_arg[]: PSOC create handler args array 36 * @psoc_destroy_handler[]: PSOC destroy handler array 37 * @psoc_destroy_handler_arg[]: PSOC destroy handler args array 38 * @psoc_status_handler[]: PSOC status handler array 39 * @psoc_status_handler_arg[]: PSOC status handler args array 40 * @pdev_create_handler[]: PDEV create handler array 41 * @pdev_create_handler_arg[]: PDEV create handler args array 42 * @pdev_destroy_handler[]: PDEV destroy handler array 43 * @pdev_destroy_handler_arg[]: PDEV destroy handler args array 44 * @pdev_status_handler[]: PDEV status handler array 45 * @pdev_status_handler_arg[]: PDEV status handler args array 46 * @vdev_create_handler[]: VDEV create handler array 47 * @vdev_create_handler_arg[]: VDEV create handler args array 48 * @vdev_destroy_handler[]: VDEV destroy handler array 49 * @vdev_destroy_handler_arg[]: VDEV destroy handler args array 50 * @vdev_peer_free_notify_handler[]: VDEV peer free notify handler array 51 * @vdev_status_handler[]: VDEV status handler array 52 * @vdev_status_handler_arg[]: VDEV status handler args array 53 * @peer_create_handler[]: PEER create handler array 54 * @peer_create_handler_arg[]: PEER create handler args array 55 * @peer_destroy_handler[]: PEER destroy handler array 56 * @peer_destroy_handler_arg[]: PEER destroy handler args array 57 * @peer_status_handler[]: PEER status handler array 58 * @peer_status_handler_arg[]: PEER status handler args array 59 * @debug_info: Objmgr debug information 60 * @global_lock: Global lock 61 */ 62 struct wlan_objmgr_global { 63 struct wlan_objmgr_psoc *psoc[WLAN_OBJMGR_MAX_DEVICES]; 64 #ifdef WLAN_FEATURE_11BE_MLO 65 struct mlo_mgr_context *mlo_ctx; 66 #endif 67 wlan_objmgr_psoc_create_handler 68 psoc_create_handler[WLAN_UMAC_MAX_COMPONENTS]; 69 void *psoc_create_handler_arg[WLAN_UMAC_MAX_COMPONENTS]; 70 wlan_objmgr_psoc_destroy_handler 71 psoc_destroy_handler[WLAN_UMAC_MAX_COMPONENTS]; 72 void *psoc_destroy_handler_arg[WLAN_UMAC_MAX_COMPONENTS]; 73 wlan_objmgr_psoc_status_handler 74 psoc_status_handler[WLAN_UMAC_MAX_COMPONENTS]; 75 void *psoc_status_handler_arg[WLAN_UMAC_MAX_COMPONENTS]; 76 wlan_objmgr_pdev_create_handler 77 pdev_create_handler[WLAN_UMAC_MAX_COMPONENTS]; 78 void *pdev_create_handler_arg[WLAN_UMAC_MAX_COMPONENTS]; 79 wlan_objmgr_pdev_destroy_handler 80 pdev_destroy_handler[WLAN_UMAC_MAX_COMPONENTS]; 81 void *pdev_destroy_handler_arg[WLAN_UMAC_MAX_COMPONENTS]; 82 wlan_objmgr_pdev_status_handler 83 pdev_status_handler[WLAN_UMAC_MAX_COMPONENTS]; 84 void *pdev_status_handler_arg[WLAN_UMAC_MAX_COMPONENTS]; 85 wlan_objmgr_vdev_create_handler 86 vdev_create_handler[WLAN_UMAC_MAX_COMPONENTS]; 87 void *vdev_create_handler_arg[WLAN_UMAC_MAX_COMPONENTS]; 88 wlan_objmgr_vdev_destroy_handler 89 vdev_destroy_handler[WLAN_UMAC_MAX_COMPONENTS]; 90 void *vdev_destroy_handler_arg[WLAN_UMAC_MAX_COMPONENTS]; 91 wlan_objmgr_vdev_peer_free_notify_handler 92 vdev_peer_free_notify_handler[WLAN_UMAC_MAX_COMPONENTS]; 93 wlan_objmgr_vdev_status_handler 94 vdev_status_handler[WLAN_UMAC_MAX_COMPONENTS]; 95 void *vdev_status_handler_arg[WLAN_UMAC_MAX_COMPONENTS]; 96 wlan_objmgr_peer_create_handler 97 peer_create_handler[WLAN_UMAC_MAX_COMPONENTS]; 98 void *peer_create_handler_arg[WLAN_UMAC_MAX_COMPONENTS]; 99 wlan_objmgr_peer_destroy_handler 100 peer_destroy_handler[WLAN_UMAC_MAX_COMPONENTS]; 101 void *peer_destroy_handler_arg[WLAN_UMAC_MAX_COMPONENTS]; 102 wlan_objmgr_peer_status_handler 103 peer_status_handler[WLAN_UMAC_MAX_COMPONENTS]; 104 void *peer_status_handler_arg[WLAN_UMAC_MAX_COMPONENTS]; 105 struct wlan_objmgr_debug_info *debug_info; 106 qdf_spinlock_t global_lock; 107 }; 108 109 #define MAX_SLEEP_ITERATION 5 110 111 extern struct wlan_objmgr_global *g_umac_glb_obj; 112 113 /** 114 * wlan_objmgr_psoc_object_attach() - attach psoc to global object 115 * @psoc - PSOC object 116 * 117 * attaches PSOC to global psoc list 118 * 119 * Return: SUCCESS 120 * Failure (Max supported PSOCs exceeded) 121 */ 122 QDF_STATUS wlan_objmgr_psoc_object_attach( 123 struct wlan_objmgr_psoc *psoc); 124 125 /** 126 * wlan_objmgr_psoc_object_detach() - detach psoc from global object 127 * @psoc - PSOC object 128 * 129 * detaches PSOC from global psoc list 130 * 131 * Return: SUCCESS 132 * Failure (if list is empty and PSOC is not present) 133 */ 134 QDF_STATUS wlan_objmgr_psoc_object_detach( 135 struct wlan_objmgr_psoc *psoc); 136 137 /** 138 * wlan_objmgr_print_ref_ids() - Print ref counts of modules 139 * @id - array of ref debug 140 * @log_level - log level 141 * 142 * Itertes through array, and prints the ref count debug 143 * 144 * Return: nothing 145 */ 146 void wlan_objmgr_print_ref_ids(qdf_atomic_t *id, 147 QDF_TRACE_LEVEL log_level); 148 #endif /* _WLAN_OBJMGR_GLOBAL_OBJ_I_H_ */ 149