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