xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/obj_mgr/inc/wlan_objmgr_global_obj.h (revision dd4dc88b837a295134aa9869114a2efee0f4894b)
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: Public APIs to perform operations on Global objects
20   */
21 #ifndef _WLAN_OBJMGR_GLOBAL_OBJ_H_
22 #define _WLAN_OBJMGR_GLOBAL_OBJ_H_
23 
24 /**
25  * wlan_objmgr_global_obj_init() - global object initialization
26  *
27  * Creates global object, intializes with default values
28  *
29  * Return: SUCCESS  on successful creation,
30  *         FAILURE  on Mem alloc failure or allocated already
31  *
32  */
33 QDF_STATUS wlan_objmgr_global_obj_init(void);
34 
35 /**
36  * wlan_objmgr_global_obj_deinit() - global object deinitialization
37  *
38  * Deletes global object
39  *
40  * Return: SUCCESS  on successful deletion,
41  *         FAILURE  on object is not found
42  *
43  */
44 QDF_STATUS wlan_objmgr_global_obj_deinit(void);
45 
46 /**
47  * wlan_objmgr_global_obj_can_destroyed() - Checks whether global object
48  *					  can be destroyed
49  *
50  * Checks the psoc table of global object, if psoc table is empty
51  * returns the SUCCESS
52  *
53  * Return: SUCCESS  on can be destroyed,
54  *         FAILURE  on can't be destroyed
55  *
56  */
57 QDF_STATUS wlan_objmgr_global_obj_can_destroyed(void);
58 
59 /**
60  * wlan_objmgr_register_psoc_create_handler() - register psoc create handler
61  * @id: component id
62  * @handler: function pointer of the component
63  * @args: args, if component wants certain args to be passed on PSOC creation
64  *
65  * API, allows other UMAC components to register handler
66  * The registered handler would be invoked on PSOC creation
67  *
68  * Return: SUCCESS,
69  *         Failure (if registration fails, each failure has different error
70  *         code)
71  */
72 QDF_STATUS wlan_objmgr_register_psoc_create_handler(
73 		enum wlan_umac_comp_id id,
74 		wlan_objmgr_psoc_create_handler handler,
75 		void *args);
76 
77 /**
78  * wlan_objmgr_unregister_psoc_create_handler() - unregister psoc create handler
79  * @id: component id
80  * @handler: function pointer of the component
81  * @args: args, if component wants certain args to be passed on PSOC creation
82  *
83  * API, allows other UMAC components to unregister handler
84  *
85  * Return: SUCCESS,
86  *         Failure (if handler is not present, each failure has different error
87  *         code)
88  */
89 QDF_STATUS wlan_objmgr_unregister_psoc_create_handler(
90 		enum wlan_umac_comp_id id,
91 		wlan_objmgr_psoc_create_handler handler,
92 		void *args);
93 
94 /**
95  * wlan_objmgr_register_psoc_destroy_handler() - register destroy handler
96  * @id: component id
97  * @handler: function pointer of the component
98  * @args: args, if component wants certain args to be passed on PSOC deletion
99  *
100  * API, allows other UMAC components to register handler
101  * The registered handler would be invoked on PSOC deletion
102  *
103  * Return: SUCCESS,
104  *         Failure (if registration fails, each failure has different error
105  *         code)
106  */
107 QDF_STATUS wlan_objmgr_register_psoc_destroy_handler(
108 		enum wlan_umac_comp_id id,
109 		wlan_objmgr_psoc_destroy_handler handler,
110 		void *args);
111 
112 /**
113  * wlan_objmgr_unregister_psoc_destroy_handler() - unregister destroy handler
114  * @id: component id
115  * @handler: function pointer of the component
116  * @args: args, if component wants certain args to be passed on PSOC deletion
117  *
118  * API, allows other UMAC components to unregister handler
119  *
120  * Return: SUCCESS,
121  *         Failure (if handler is not present, each failure has different error
122  *         code)
123  */
124 QDF_STATUS wlan_objmgr_unregister_psoc_destroy_handler(
125 		enum wlan_umac_comp_id id,
126 		wlan_objmgr_psoc_destroy_handler handler,
127 		void *args);
128 
129 /**
130  * wlan_objmgr_register_psoc_status_handler() - register status handler
131  * @id: component id
132  * @handler: function pointer of the component
133  * @args: args, if component wants certain args to be passed on PSOC status
134  *         change
135  *
136  * API, allows other UMAC components to register handler
137  * The registered handler would be invoked on PSOC object status change
138  *
139  * Return: SUCCESS,
140  *         Failure (if registration fails, each failure has different error
141  *         code)
142  */
143 QDF_STATUS wlan_objmgr_register_psoc_status_handler(
144 		enum wlan_umac_comp_id id,
145 		wlan_objmgr_psoc_status_handler handler,
146 		void *args);
147 
148 /**
149  * wlan_objmgr_unregister_psoc_status_handler() - unregister status handler
150  * @id: component id
151  * @handler: function pointer of the component
152  * @args: args, if component wants certain args to be passed on PSOC status
153  *
154  * API, allows other UMAC components to unregister handler
155  *
156  * Return: SUCCESS,
157  *         Failure (if handler is not present, each failure has different error
158  *         code)
159  */
160 QDF_STATUS wlan_objmgr_unregister_psoc_status_handler(
161 		enum wlan_umac_comp_id id,
162 		wlan_objmgr_psoc_status_handler handler,
163 		void *args);
164 
165 /**
166  * wlan_objmgr_register_pdev_create_handler() - register pdev create handler
167  * @id: component id
168  * @handler: function pointer of the component
169  * @args: args, if component wants certain args to be passed on PDEV creation
170  *
171  * API, allows other UMAC components to register handler
172  * The registered handler would be invoked on PDEV creation
173  *
174  * Return: SUCCESS,
175  *         Failure (if registration fails, each failure has different error
176  *         code)
177  */
178 QDF_STATUS wlan_objmgr_register_pdev_create_handler(
179 		enum wlan_umac_comp_id id,
180 		wlan_objmgr_pdev_create_handler handler,
181 		void *args);
182 
183 /**
184  * wlan_objmgr_unregister_pdev_create_handler() - unregister pdev create handler
185  * @id: component id
186  * @handler: function pointer of the component
187  * @args: args, if component wants certain args to be passed on PDEV creation
188  *
189  * API, allows other UMAC components to unregister handler
190  *
191  * Return: SUCCESS,
192  *         Failure (if handler is not present, each failure has different error
193  *         code)
194  */
195 QDF_STATUS wlan_objmgr_unregister_pdev_create_handler(
196 		enum wlan_umac_comp_id id,
197 		wlan_objmgr_pdev_create_handler handler,
198 		void *args);
199 
200 /**
201  * wlan_objmgr_register_pdev_destroy_handler() - register pdev destroy handler
202  * @id: component id
203  * @handler: function pointer of the component
204  * @args: args, if component wants certain args to be passed on PDEV deletion
205  *
206  * API, allows other UMAC components to register handler
207  * The registered handler would be invoked on PDEV deletion
208  *
209  * Return: SUCCESS,
210  *         Failure (if registration fails, each failure has different error
211  *         code)
212  */
213 QDF_STATUS wlan_objmgr_register_pdev_destroy_handler(
214 		enum wlan_umac_comp_id id,
215 		wlan_objmgr_pdev_destroy_handler handler,
216 		void *args);
217 
218 /**
219  * wlan_objmgr_unregister_pdev_destroy_handler() - unregister pdev destroy handler
220  * @id: component id
221  * @handler: function pointer of the component
222  * @args: args, if component wants certain args to be passed on PDEV deletion
223  *
224  * API, allows other UMAC components to unregister handler
225  *
226  * Return: SUCCESS,
227  *         Failure (if handler is not present, each failure has different error
228  *         code)
229  */
230 QDF_STATUS wlan_objmgr_unregister_pdev_destroy_handler(
231 		enum wlan_umac_comp_id id,
232 		wlan_objmgr_pdev_destroy_handler handler,
233 		void *args);
234 
235 /**
236  * wlan_objmgr_register_pdev_status_handler() - register pdev status handler
237  * @id: component id
238  * @handler: function pointer of the component
239  * @args: args, if component wants certain args to be passed on PDEV status
240  *         change
241  *
242  * API, allows other UMAC components to register handler
243  * The registered handler would be invoked on PDEV object status change
244  *
245  * Return: SUCCESS,
246  *         Failure (if registration fails, each failure has different error
247  *         code)
248  */
249 QDF_STATUS wlan_objmgr_register_pdev_status_handler(
250 		enum wlan_umac_comp_id id,
251 		wlan_objmgr_pdev_status_handler handler,
252 		void *args);
253 
254 /**
255  * wlan_objmgr_unregister_pdev_status_handler() - unregister pdev status handler
256  * @id: component id
257  * @handler: function pointer of the component
258  * @args: args, if component wants certain args to be passed on PDEV status
259  *
260  * API, allows other UMAC components to unregister handler
261  *
262  * Return: SUCCESS,
263  *         Failure (if handler is not present, each failure has different error
264  *         code)
265  */
266 QDF_STATUS wlan_objmgr_unregister_pdev_status_handler(
267 		enum wlan_umac_comp_id id,
268 		wlan_objmgr_pdev_status_handler handler,
269 		void *args);
270 
271 /**
272  * wlan_objmgr_register_vdev_create_handler() - register vdev create handler
273  * @id: component id
274  * @handler: function pointer of the component
275  * @args: args, if component wants certain args to be passed on VDEV creation
276  *
277  * API, allows other UMAC components to register handler
278  * The registered handler would be invoked on VDEV creation
279  *
280  * Return: SUCCESS,
281  *         Failure (if registration fails, each failure has different error
282  *         code)
283  */
284 QDF_STATUS wlan_objmgr_register_vdev_create_handler(
285 		enum wlan_umac_comp_id id,
286 		wlan_objmgr_vdev_create_handler handler,
287 		void *args);
288 
289 /**
290  * wlan_objmgr_unregister_vdev_create_handler() - unregister vdev create handler
291  * @id: component id
292  * @handler: function pointer of the component
293  * @args: args, if component wants certain args to be passed on VDEV creation
294  *
295  * API, allows other UMAC components to unregister handler
296  *
297  * Return: SUCCESS,
298  *         Failure (if handler is not present, each failure has different error
299  *         code)
300  */
301 QDF_STATUS wlan_objmgr_unregister_vdev_create_handler(
302 		enum wlan_umac_comp_id id,
303 		wlan_objmgr_vdev_create_handler handler,
304 		void *args);
305 
306 /**
307  * wlan_objmgr_register_vdev_destroy_handler() - register vdev destroy handler
308  * @id: component id
309  * @handler: function pointer of the component
310  * @args: args, if component wants certain args to be passed on VDEV deletion
311  *
312  * API, allows other UMAC components to register handler
313  * The registered handler would be invoked on VDEV deletion
314  *
315  * Return: SUCCESS,
316  *         Failure (if registration fails, each failure has different error
317  *         code)
318  */
319 QDF_STATUS wlan_objmgr_register_vdev_destroy_handler(
320 		enum wlan_umac_comp_id id,
321 		wlan_objmgr_vdev_destroy_handler handler,
322 		void *args);
323 
324 /**
325  * wlan_objmgr_unregister_vdev_destroy_handler() - unregister vdev destroy handler
326  * @id: component id
327  * @handler: function pointer of the component
328  * @args: args, if component wants certain args to be passed on VDEV deletion
329  *
330  * API, allows other UMAC components to unregister handler
331  *
332  * Return: SUCCESS,
333  *         Failure (if handler is not present, each failure has different error
334  *         code)
335  */
336 QDF_STATUS wlan_objmgr_unregister_vdev_destroy_handler(
337 		enum wlan_umac_comp_id id,
338 		wlan_objmgr_vdev_destroy_handler handler,
339 		void *args);
340 
341 /**
342  * wlan_objmgr_register_vdev_status_handler() - register vdev status handler
343  * @id: component id
344  * @handler: function pointer of the component
345  * @args: args, if component wants certain args to be passed on VDEV status
346  *         change
347  *
348  * API, allows other UMAC components to register handler
349  * The registered handler would be invoked on VDEV object status change
350  *
351  * Return: SUCCESS,
352  *         Failure (if registration fails, each failure has different error
353  *         code)
354  */
355 QDF_STATUS wlan_objmgr_register_vdev_status_handler(
356 		enum wlan_umac_comp_id id,
357 		wlan_objmgr_vdev_status_handler handler,
358 		void *args);
359 
360 /**
361  * wlan_objmgr_unregister_vdev_status_handler() - unregister vdev status handler
362  * @id: component id
363  * @handler: function pointer of the component
364  * @args: args, if component wants certain args to be passed on VDEV status
365  *
366  * API, allows other UMAC components to unregister handler
367  *
368  * Return: SUCCESS,
369  *         Failure (if handler is not present, each failure has different error
370  *         code)
371  */
372 QDF_STATUS wlan_objmgr_unregister_vdev_status_handler(
373 		enum wlan_umac_comp_id id,
374 		wlan_objmgr_vdev_status_handler handler,
375 		void *args);
376 
377 /**
378  * wlan_objmgr_register_peer_create_handler() - register peer create handler
379  * @id: component id
380  * @handler: function pointer of the component
381  * @args: args, if component wants certain args to be passed on PEER creation
382  *
383  * API, allows other UMAC components to register handler
384  * The registered handler would be invoked on PEER creation
385  *
386  * Return: SUCCESS,
387  *         Failure (if registration fails, each failure has different error
388  *         code)
389  */
390 QDF_STATUS wlan_objmgr_register_peer_create_handler(
391 		enum wlan_umac_comp_id id,
392 		wlan_objmgr_peer_create_handler handler,
393 		void *args);
394 
395 /**
396  * wlan_objmgr_unregister_peer_create_handler() - unregister peer create handler
397  * @id: component id
398  * @handler: function pointer of the component
399  * @args: args, if component wants certain args to be passed on PEER creation
400  *
401  * API, allows other UMAC components to unregister handler
402  *
403  * Return: SUCCESS,
404  *         Failure (if handler is not present, each failure has different error
405  *         code)
406  */
407 QDF_STATUS wlan_objmgr_unregister_peer_create_handler(
408 		enum wlan_umac_comp_id id,
409 		wlan_objmgr_peer_create_handler handler,
410 		void *args);
411 
412 /**
413  * wlan_objmgr_register_peer_destroy_handler() - register peer destroy handler
414  * @id: component id
415  * @handler: function pointer of the component
416  * @args: args, if component wants certain args to be passed on PEER deletion
417  *
418  * API, allows other UMAC components to register handler
419  * The registered handler would be invoked on PEER deletion
420  *
421  * Return: SUCCESS,
422  *         Failure (if registration fails, each failure has different error
423  *         code)
424  */
425 QDF_STATUS wlan_objmgr_register_peer_destroy_handler(
426 		enum wlan_umac_comp_id id,
427 		wlan_objmgr_peer_destroy_handler handler,
428 		void *args);
429 
430 /**
431  * wlan_objmgr_unregister_peer_destroy_handler() - unregister peer destroy handler
432  * @id: component id
433  * @handler: function pointer of the component
434  * @args: args, if component wants certain args to be passed on PEER deletion
435  *
436  * API, allows other UMAC components to unregister handler
437  *
438  * Return: SUCCESS,
439  *         Failure (if handler is not present, each failure has different error
440  *         code)
441  */
442 QDF_STATUS wlan_objmgr_unregister_peer_destroy_handler(
443 		enum wlan_umac_comp_id id,
444 		wlan_objmgr_peer_destroy_handler handler,
445 		void *args);
446 
447 /**
448  * wlan_objmgr_register_peer_status_handler() - register peer status handler
449  * @id: component id
450  * @handler: function pointer of the component
451  * @args: args, if component wants certain args to be passed on PEER status
452  *         change
453  *
454  * API, allows other UMAC components to register handler
455  * The registered handler would be invoked on PEER object status change
456  *
457  * Return: SUCCESS,
458  *         Failure (if registration fails, each failure has different error
459  *         code)
460  */
461 QDF_STATUS wlan_objmgr_register_peer_status_handler(
462 		enum wlan_umac_comp_id id,
463 		wlan_objmgr_peer_status_handler handler,
464 		void *args);
465 
466 /**
467  * wlan_objmgr_unregister_peer_status_handler() - unregister peer status handler
468  * @id: component id
469  * @handler: function pointer of the component
470  * @args: args, if component wants certain args to be passed on PEER status
471  *
472  * API, allows other UMAC components to unregister handler
473  *
474  * Return: SUCCESS,
475  *         Failure (if handler is not present, each failure has different error
476  *         code)
477  */
478 QDF_STATUS wlan_objmgr_unregister_peer_status_handler(
479 		enum wlan_umac_comp_id id,
480 		wlan_objmgr_peer_status_handler handler,
481 		void *args);
482 
483 /**
484  * APIs to operations on psoc
485  */
486 typedef void (*wlan_objmgr_psoc_handler)(struct wlan_objmgr_psoc *psoc,
487 					void *arg,
488 					uint8_t index);
489 
490 /**
491  * wlan_objmgr_iterate_psoc_list() - iterate through all psocs
492  *
493  * @handler: the handler will be called for each psoc
494  *           the handler should be implemented to perform required operation
495  * @arg:     agruments passed by caller
496  * @dbg_id: id of the caller
497  *
498  * API to be used for performing the operations on all psoc
499  * The "handler" here shouldn't take g_umac_glb_obj->global_lock lock when
500  * processing
501  *
502  * Return: SUCCESS/FAILURE
503  */
504 QDF_STATUS wlan_objmgr_iterate_psoc_list(
505 		wlan_objmgr_psoc_handler handler,
506 		void *arg, wlan_objmgr_ref_dbgid dbg_id);
507 
508 #endif /* _WLAN_OBJMGR_GLOBAL_OBJ_H_*/
509