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