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