xref: /wlan-dirver/qca-wifi-host-cmn/init_deinit/dispatcher/src/dispatcher_init_deinit.c (revision fa47688f04ef001a6dcafaebdcc3c031f15ee75e)
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 any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #include "cfg_dispatcher.h"
18 #include <qdf_types.h>
19 #include <qdf_trace.h>
20 #include <qdf_threads.h>
21 #include <qdf_module.h>
22 #include <dispatcher_init_deinit.h>
23 #include <scheduler_api.h>
24 #include <wlan_scan_ucfg_api.h>
25 #include <wlan_ftm_init_deinit_api.h>
26 #include <wlan_mgmt_txrx_utils_api.h>
27 #include <wlan_serialization_api.h>
28 #include <include/wlan_mlme_cmn.h>
29 #ifdef WLAN_ATF_ENABLE
30 #include <wlan_atf_utils_api.h>
31 #endif
32 #ifdef QCA_SUPPORT_SON
33 #include <wlan_son_pub.h>
34 #endif
35 #ifdef WLAN_SA_API_ENABLE
36 #include <wlan_sa_api_utils_api.h>
37 #endif
38 #ifdef WIFI_POS_CONVERGED
39 #include "wifi_pos_api.h"
40 #endif /* WIFI_POS_CONVERGED */
41 #include <wlan_reg_services_api.h>
42 #ifdef WLAN_CONV_CRYPTO_SUPPORTED
43 #include "wlan_crypto_main.h"
44 #endif
45 #ifdef DFS_COMPONENT_ENABLE
46 #include <wlan_dfs_init_deinit_api.h>
47 #endif
48 
49 #ifdef WLAN_OFFCHAN_TXRX_ENABLE
50 #include <wlan_offchan_txrx_api.h>
51 #endif
52 
53 #ifdef WLAN_SUPPORT_SPLITMAC
54 #include <wlan_splitmac.h>
55 #endif
56 #ifdef WLAN_CONV_SPECTRAL_ENABLE
57 #include <wlan_spectral_utils_api.h>
58 #endif
59 #ifdef WLAN_SUPPORT_FILS
60 #include <wlan_fd_utils_api.h>
61 #endif
62 
63 #ifdef WLAN_SUPPORT_GREEN_AP
64 #include <wlan_green_ap_api.h>
65 #endif
66 
67 #ifdef QCA_SUPPORT_CP_STATS
68 #include <wlan_cp_stats_utils_api.h>
69 #endif
70 
71 /**
72  * DOC: This file provides various init/deinit trigger point for new
73  * components.
74  */
75 
76 /* All new components needs to replace their dummy init/deinit
77  * psoc_open, psco_close, psoc_enable and psoc_disable APIs once
78  * their actual handlers are ready
79  */
80 
81 spectral_pdev_open_handler dispatcher_spectral_pdev_open_handler_cb;
82 
83 #ifdef QCA_SUPPORT_CP_STATS
84 static QDF_STATUS dispatcher_init_cp_stats(void)
85 {
86 	return wlan_cp_stats_init();
87 }
88 
89 static QDF_STATUS dispatcher_deinit_cp_stats(void)
90 {
91 	return wlan_cp_stats_deinit();
92 }
93 
94 static QDF_STATUS cp_stats_psoc_open(struct wlan_objmgr_psoc *psoc)
95 {
96 	return wlan_cp_stats_open(psoc);
97 }
98 
99 static QDF_STATUS cp_stats_psoc_close(struct wlan_objmgr_psoc *psoc)
100 {
101 	return wlan_cp_stats_close(psoc);
102 }
103 
104 static QDF_STATUS cp_stats_psoc_enable(struct wlan_objmgr_psoc *psoc)
105 {
106 	return wlan_cp_stats_enable(psoc);
107 }
108 
109 static QDF_STATUS cp_stats_psoc_disable(struct wlan_objmgr_psoc *psoc)
110 {
111 	return wlan_cp_stats_disable(psoc);
112 }
113 #else
114 static QDF_STATUS dispatcher_init_cp_stats(void)
115 {
116 	return QDF_STATUS_SUCCESS;
117 }
118 
119 static QDF_STATUS dispatcher_deinit_cp_stats(void)
120 {
121 	return QDF_STATUS_SUCCESS;
122 }
123 
124 static QDF_STATUS cp_stats_psoc_open(struct wlan_objmgr_psoc *psoc)
125 {
126 	return QDF_STATUS_SUCCESS;
127 }
128 
129 static QDF_STATUS cp_stats_psoc_close(struct wlan_objmgr_psoc *psoc)
130 {
131 	return QDF_STATUS_SUCCESS;
132 }
133 
134 static QDF_STATUS cp_stats_psoc_enable(struct wlan_objmgr_psoc *psoc)
135 {
136 	return QDF_STATUS_SUCCESS;
137 }
138 
139 static QDF_STATUS cp_stats_psoc_disable(struct wlan_objmgr_psoc *psoc)
140 {
141 	return QDF_STATUS_SUCCESS;
142 }
143 #endif
144 
145 #if defined QCA_SUPPORT_SON && QCA_SUPPORT_SON >= 1
146 static QDF_STATUS dispatcher_init_son(void)
147 {
148 	return wlan_son_init();
149 }
150 static QDF_STATUS son_psoc_open(struct wlan_objmgr_psoc *psoc)
151 {
152 	return wlan_son_psoc_open(psoc);
153 }
154 static QDF_STATUS dispatcher_deinit_son(void)
155 {
156 	return wlan_son_deinit();
157 }
158 
159 static QDF_STATUS son_psoc_close(struct wlan_objmgr_psoc *psoc)
160 {
161 	return wlan_son_psoc_close(psoc);
162 }
163 #else
164 static QDF_STATUS dispatcher_init_son(void)
165 {
166 	return QDF_STATUS_SUCCESS;
167 }
168 
169 static QDF_STATUS dispatcher_deinit_son(void)
170 {
171 	return QDF_STATUS_SUCCESS;
172 }
173 
174 static QDF_STATUS son_psoc_open(struct wlan_objmgr_psoc *psoc)
175 {
176 	return QDF_STATUS_SUCCESS;
177 }
178 
179 static QDF_STATUS son_psoc_close(struct wlan_objmgr_psoc *psoc)
180 {
181 	return QDF_STATUS_SUCCESS;
182 }
183 
184 #endif /* END of QCA_SUPPORT_SON */
185 
186 static QDF_STATUS dispatcher_regulatory_init(void)
187 {
188 	return wlan_regulatory_init();
189 }
190 
191 static QDF_STATUS dispatcher_regulatory_deinit(void)
192 {
193 	return wlan_regulatory_deinit();
194 }
195 
196 static QDF_STATUS dispatcher_regulatory_psoc_open(struct wlan_objmgr_psoc
197 						  *psoc)
198 {
199 	return regulatory_psoc_open(psoc);
200 }
201 
202 static QDF_STATUS dispatcher_regulatory_psoc_close(struct wlan_objmgr_psoc
203 						   *psoc)
204 {
205 	return regulatory_psoc_close(psoc);
206 }
207 
208 static QDF_STATUS dispatcher_regulatory_pdev_open(struct wlan_objmgr_pdev
209 						  *pdev)
210 {
211 	return regulatory_pdev_open(pdev);
212 }
213 
214 #ifdef WLAN_CONV_SPECTRAL_ENABLE
215 #ifdef CONFIG_WIN
216 QDF_STATUS dispatcher_register_spectral_pdev_open_handler(
217 			spectral_pdev_open_handler handler)
218 {
219 	dispatcher_spectral_pdev_open_handler_cb = handler;
220 
221 	return QDF_STATUS_SUCCESS;
222 }
223 qdf_export_symbol(dispatcher_register_spectral_pdev_open_handler);
224 
225 static QDF_STATUS dispatcher_spectral_pdev_open(struct wlan_objmgr_pdev
226 						  *pdev)
227 {
228 	return dispatcher_spectral_pdev_open_handler_cb(pdev);
229 }
230 
231 static QDF_STATUS dispatcher_spectral_pdev_close(struct wlan_objmgr_pdev *pdev)
232 {
233 	return QDF_STATUS_SUCCESS;
234 }
235 #else
236 static QDF_STATUS dispatcher_spectral_pdev_open(struct wlan_objmgr_pdev
237 						  *pdev)
238 {
239 	return spectral_pdev_open(pdev);
240 }
241 
242 static QDF_STATUS dispatcher_spectral_pdev_close(struct wlan_objmgr_pdev *pdev)
243 {
244 	return QDF_STATUS_SUCCESS;
245 }
246 #endif
247 #else
248 static QDF_STATUS dispatcher_spectral_pdev_open(struct wlan_objmgr_pdev
249 						  *pdev)
250 {
251 	return QDF_STATUS_SUCCESS;
252 }
253 
254 static QDF_STATUS dispatcher_spectral_pdev_close(struct wlan_objmgr_pdev *pdev)
255 {
256 	return QDF_STATUS_SUCCESS;
257 }
258 #endif
259 
260 static QDF_STATUS dispatcher_regulatory_pdev_close(struct wlan_objmgr_pdev
261 						  *pdev)
262 {
263 	return regulatory_pdev_close(pdev);
264 }
265 
266 #ifdef WLAN_SA_API_ENABLE
267 static QDF_STATUS dispatcher_init_sa_api(void)
268 {
269 	return wlan_sa_api_init();
270 }
271 
272 static QDF_STATUS dispatcher_deinit_sa_api(void)
273 {
274 	return wlan_sa_api_deinit();
275 }
276 
277 static QDF_STATUS sa_api_psoc_enable(struct wlan_objmgr_psoc *psoc)
278 {
279 	return wlan_sa_api_enable(psoc);
280 }
281 
282 static QDF_STATUS sa_api_psoc_disable(struct wlan_objmgr_psoc *psoc)
283 {
284 	return wlan_sa_api_disable(psoc);
285 }
286 #else
287 static QDF_STATUS dispatcher_init_sa_api(void)
288 {
289 	return QDF_STATUS_SUCCESS;
290 }
291 
292 static QDF_STATUS dispatcher_deinit_sa_api(void)
293 {
294 	return QDF_STATUS_SUCCESS;
295 }
296 
297 static QDF_STATUS sa_api_psoc_enable(struct wlan_objmgr_psoc *psoc)
298 {
299 	return QDF_STATUS_SUCCESS;
300 }
301 
302 static QDF_STATUS sa_api_psoc_disable(struct wlan_objmgr_psoc *psoc)
303 {
304 	return QDF_STATUS_SUCCESS;
305 }
306 #endif /* END of WLAN_SA_API_ENABLE */
307 
308 
309 #ifdef WLAN_ATF_ENABLE
310 static QDF_STATUS dispatcher_init_atf(void)
311 {
312 	return wlan_atf_init();
313 }
314 
315 static QDF_STATUS dispatcher_deinit_atf(void)
316 {
317 	return wlan_atf_deinit();
318 }
319 
320 static QDF_STATUS atf_psoc_open(struct wlan_objmgr_psoc *psoc)
321 {
322 	return wlan_atf_open(psoc);
323 }
324 
325 static QDF_STATUS atf_psoc_close(struct wlan_objmgr_psoc *psoc)
326 {
327 	return wlan_atf_close(psoc);
328 }
329 
330 static QDF_STATUS atf_psoc_enable(struct wlan_objmgr_psoc *psoc)
331 {
332 	return wlan_atf_enable(psoc);
333 }
334 
335 static QDF_STATUS atf_psoc_disable(struct wlan_objmgr_psoc *psoc)
336 {
337 	return wlan_atf_disable(psoc);
338 }
339 #else
340 static QDF_STATUS dispatcher_init_atf(void)
341 {
342 	return QDF_STATUS_SUCCESS;
343 }
344 
345 static QDF_STATUS dispatcher_deinit_atf(void)
346 {
347 	return QDF_STATUS_SUCCESS;
348 }
349 
350 static QDF_STATUS atf_psoc_open(struct wlan_objmgr_psoc *psoc)
351 {
352 	return QDF_STATUS_SUCCESS;
353 }
354 
355 static QDF_STATUS atf_psoc_close(struct wlan_objmgr_psoc *psoc)
356 {
357 	return QDF_STATUS_SUCCESS;
358 }
359 
360 static QDF_STATUS atf_psoc_enable(struct wlan_objmgr_psoc *psoc)
361 {
362 	return QDF_STATUS_SUCCESS;
363 }
364 
365 static QDF_STATUS atf_psoc_disable(struct wlan_objmgr_psoc *psoc)
366 {
367 	return QDF_STATUS_SUCCESS;
368 }
369 #endif /* END of WLAN_ATF_ENABLE */
370 
371 #ifdef WLAN_CONV_CRYPTO_SUPPORTED
372 static QDF_STATUS dispatcher_init_crypto(void)
373 {
374 	return wlan_crypto_init();
375 }
376 
377 static QDF_STATUS dispatcher_deinit_crypto(void)
378 {
379 	return wlan_crypto_deinit();
380 }
381 #else
382 static QDF_STATUS dispatcher_init_crypto(void)
383 {
384 	return QDF_STATUS_SUCCESS;
385 }
386 
387 static QDF_STATUS dispatcher_deinit_crypto(void)
388 {
389 	return QDF_STATUS_SUCCESS;
390 }
391 #endif /* END of WLAN_CONV_CRYPTO_SUPPORTED */
392 
393 #ifdef WIFI_POS_CONVERGED
394 static QDF_STATUS dispatcher_init_wifi_pos(void)
395 {
396 	return wifi_pos_init();
397 }
398 
399 static QDF_STATUS dispatcher_deinit_wifi_pos(void)
400 {
401 	return wifi_pos_deinit();
402 }
403 
404 static QDF_STATUS dispatcher_wifi_pos_enable(struct wlan_objmgr_psoc *psoc)
405 {
406 	return wifi_pos_psoc_enable(psoc);
407 }
408 
409 static QDF_STATUS dispatcher_wifi_pos_disable(struct wlan_objmgr_psoc *psoc)
410 {
411 	return wifi_pos_psoc_disable(psoc);
412 }
413 #else
414 static QDF_STATUS dispatcher_init_wifi_pos(void)
415 {
416 	return QDF_STATUS_SUCCESS;
417 }
418 
419 static QDF_STATUS dispatcher_deinit_wifi_pos(void)
420 {
421 	return QDF_STATUS_SUCCESS;
422 }
423 
424 static QDF_STATUS dispatcher_wifi_pos_enable(struct wlan_objmgr_psoc *psoc)
425 {
426 	return QDF_STATUS_SUCCESS;
427 }
428 
429 static QDF_STATUS dispatcher_wifi_pos_disable(struct wlan_objmgr_psoc *psoc)
430 {
431 	return QDF_STATUS_SUCCESS;
432 }
433 #endif
434 
435 #ifdef DFS_COMPONENT_ENABLE
436 static QDF_STATUS dispatcher_init_dfs(void)
437 {
438 	return dfs_init();
439 }
440 
441 static QDF_STATUS dispatcher_deinit_dfs(void)
442 {
443 	return dfs_deinit();
444 }
445 
446 static QDF_STATUS dispatcher_dfs_psoc_enable(struct wlan_objmgr_psoc *psoc)
447 {
448 	return wifi_dfs_psoc_enable(psoc);
449 }
450 
451 static QDF_STATUS dispatcher_dfs_psoc_disable(struct wlan_objmgr_psoc *psoc)
452 {
453 	return wifi_dfs_psoc_disable(psoc);
454 }
455 #else
456 static QDF_STATUS dispatcher_init_dfs(void)
457 {
458 	return QDF_STATUS_SUCCESS;
459 }
460 
461 static QDF_STATUS dispatcher_deinit_dfs(void)
462 {
463 	return QDF_STATUS_SUCCESS;
464 }
465 
466 static QDF_STATUS dispatcher_dfs_psoc_enable(struct wlan_objmgr_psoc *psoc)
467 {
468 	return QDF_STATUS_SUCCESS;
469 }
470 
471 static QDF_STATUS dispatcher_dfs_psoc_disable(struct wlan_objmgr_psoc *psoc)
472 {
473 	return QDF_STATUS_SUCCESS;
474 }
475 #endif
476 
477 #ifdef WLAN_OFFCHAN_TXRX_ENABLE
478 static QDF_STATUS dispatcher_offchan_txrx_init(void)
479 {
480 	return wlan_offchan_txrx_init();
481 }
482 
483 static QDF_STATUS dispatcher_offchan_txrx_deinit(void)
484 {
485 	return wlan_offchan_txrx_deinit();
486 }
487 #else
488 static QDF_STATUS dispatcher_offchan_txrx_init(void)
489 {
490 	return QDF_STATUS_SUCCESS;
491 }
492 
493 static QDF_STATUS dispatcher_offchan_txrx_deinit(void)
494 {
495 	return QDF_STATUS_SUCCESS;
496 }
497 #endif /*WLAN_OFFCHAN_TXRX_ENABLE*/
498 
499 #ifdef WLAN_SUPPORT_SPLITMAC
500 static QDF_STATUS dispatcher_splitmac_init(void)
501 {
502 	return wlan_splitmac_init();
503 }
504 
505 static QDF_STATUS dispatcher_splitmac_deinit(void)
506 {
507 	return wlan_splitmac_deinit();
508 }
509 #else
510 static QDF_STATUS dispatcher_splitmac_init(void)
511 {
512 	return QDF_STATUS_SUCCESS;
513 }
514 
515 static QDF_STATUS dispatcher_splitmac_deinit(void)
516 {
517 	return QDF_STATUS_SUCCESS;
518 }
519 #endif  /* WLAN_SUPPORT_SPLITMAC */
520 
521 #ifdef WLAN_CONV_SPECTRAL_ENABLE
522 #ifdef CONFIG_MCL
523 static QDF_STATUS dispatcher_spectral_init(void)
524 {
525 	return wlan_spectral_init();
526 }
527 
528 static QDF_STATUS dispatcher_spectral_deinit(void)
529 {
530 	return wlan_spectral_deinit();
531 }
532 #else
533 static QDF_STATUS dispatcher_spectral_init(void)
534 {
535 	return QDF_STATUS_SUCCESS;
536 }
537 
538 static QDF_STATUS dispatcher_spectral_deinit(void)
539 {
540 	return QDF_STATUS_SUCCESS;
541 }
542 #endif
543 #else
544 static QDF_STATUS dispatcher_spectral_init(void)
545 {
546 	return QDF_STATUS_SUCCESS;
547 }
548 
549 static QDF_STATUS dispatcher_spectral_deinit(void)
550 {
551 	return QDF_STATUS_SUCCESS;
552 }
553 #endif
554 
555 #ifdef DIRECT_BUF_RX_ENABLE
556 static QDF_STATUS dispatcher_dbr_psoc_enable(struct wlan_objmgr_psoc *psoc)
557 {
558 	struct wlan_lmac_if_tx_ops *tx_ops;
559 
560 	tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
561 	if (tx_ops->dbr_tx_ops.direct_buf_rx_register_events)
562 		return tx_ops->dbr_tx_ops.direct_buf_rx_register_events(psoc);
563 
564 	return QDF_STATUS_SUCCESS;
565 }
566 
567 static QDF_STATUS dispatcher_dbr_psoc_disable(struct wlan_objmgr_psoc *psoc)
568 {
569 	struct wlan_lmac_if_tx_ops *tx_ops;
570 
571 	tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
572 	if (tx_ops->dbr_tx_ops.direct_buf_rx_unregister_events)
573 		return tx_ops->dbr_tx_ops.direct_buf_rx_unregister_events(psoc);
574 
575 	return QDF_STATUS_SUCCESS;
576 }
577 #else
578 static QDF_STATUS dispatcher_dbr_psoc_enable(struct wlan_objmgr_psoc *psoc)
579 {
580 	return QDF_STATUS_SUCCESS;
581 }
582 
583 static QDF_STATUS dispatcher_dbr_psoc_disable(struct wlan_objmgr_psoc *psoc)
584 {
585 	return QDF_STATUS_SUCCESS;
586 }
587 #endif /* DIRECT_BUF_RX_ENABLE */
588 
589 #ifdef WLAN_SUPPORT_GREEN_AP
590 static QDF_STATUS dispatcher_green_ap_init(void)
591 {
592 	return wlan_green_ap_init();
593 }
594 
595 static QDF_STATUS dispatcher_green_ap_pdev_open(
596 				struct wlan_objmgr_pdev *pdev)
597 {
598 	return wlan_green_ap_pdev_open(pdev);
599 }
600 static QDF_STATUS dispatcher_green_ap_deinit(void)
601 {
602 	return wlan_green_ap_deinit();
603 }
604 #else
605 static QDF_STATUS dispatcher_green_ap_init(void)
606 {
607 	return QDF_STATUS_SUCCESS;
608 }
609 static QDF_STATUS dispatcher_green_ap_pdev_open(
610 				struct wlan_objmgr_pdev *pdev)
611 {
612 	return QDF_STATUS_SUCCESS;
613 }
614 
615 static QDF_STATUS dispatcher_green_ap_deinit(void)
616 {
617 	return QDF_STATUS_SUCCESS;
618 }
619 #endif
620 
621 #ifdef WLAN_SUPPORT_FILS
622 static QDF_STATUS dispatcher_fd_init(void)
623 {
624 	return wlan_fd_init();
625 }
626 
627 static QDF_STATUS dispatcher_fd_deinit(void)
628 {
629 	return wlan_fd_deinit();
630 }
631 
632 static QDF_STATUS fd_psoc_enable(struct wlan_objmgr_psoc *psoc)
633 {
634 	return wlan_fd_enable(psoc);
635 }
636 
637 static QDF_STATUS fd_psoc_disable(struct wlan_objmgr_psoc *psoc)
638 {
639 	return wlan_fd_disable(psoc);
640 }
641 #else
642 static QDF_STATUS dispatcher_fd_init(void)
643 {
644 	return QDF_STATUS_SUCCESS;
645 }
646 
647 static QDF_STATUS dispatcher_fd_deinit(void)
648 {
649 	return QDF_STATUS_SUCCESS;
650 }
651 
652 static QDF_STATUS fd_psoc_enable(struct wlan_objmgr_psoc *psoc)
653 {
654 	return QDF_STATUS_SUCCESS;
655 }
656 
657 static QDF_STATUS fd_psoc_disable(struct wlan_objmgr_psoc *psoc)
658 {
659 	return QDF_STATUS_SUCCESS;
660 }
661 #endif /* WLAN_SUPPORT_FILS */
662 
663 QDF_STATUS dispatcher_init(void)
664 {
665 	if (QDF_STATUS_SUCCESS != wlan_objmgr_global_obj_init())
666 		goto out;
667 
668 	if (QDF_STATUS_SUCCESS != wlan_mgmt_txrx_init())
669 		goto mgmt_txrx_init_fail;
670 
671 	if (QDF_STATUS_SUCCESS != ucfg_scan_init())
672 		goto ucfg_scan_init_fail;
673 
674 	if (QDF_STATUS_SUCCESS != wlan_serialization_init())
675 		goto serialization_init_fail;
676 
677 	if (QDF_STATUS_SUCCESS != dispatcher_init_crypto())
678 		goto crypto_init_fail;
679 
680 	if (QDF_STATUS_SUCCESS != dispatcher_init_cp_stats())
681 		goto cp_stats_init_fail;
682 
683 	if (QDF_STATUS_SUCCESS != dispatcher_init_atf())
684 		goto atf_init_fail;
685 
686 	if (QDF_STATUS_SUCCESS != dispatcher_init_sa_api())
687 		goto sa_api_init_fail;
688 
689 	if (QDF_STATUS_SUCCESS != dispatcher_init_wifi_pos())
690 		goto wifi_pos_init_fail;
691 
692 	if (QDF_STATUS_SUCCESS != dispatcher_init_dfs())
693 		goto dfs_init_fail;
694 
695 	if (QDF_STATUS_SUCCESS != dispatcher_regulatory_init())
696 		goto regulatory_init_fail;
697 
698 	if (QDF_STATUS_SUCCESS != dispatcher_offchan_txrx_init())
699 		goto offchan_init_fail;
700 
701 	if (QDF_STATUS_SUCCESS != dispatcher_init_son())
702 		goto son_init_fail;
703 
704 	if (QDF_STATUS_SUCCESS != dispatcher_splitmac_init())
705 		goto splitmac_init_fail;
706 
707 	if (QDF_STATUS_SUCCESS != dispatcher_fd_init())
708 		goto fd_init_fail;
709 
710 	if (QDF_STATUS_SUCCESS != dispatcher_green_ap_init())
711 		goto green_ap_init_fail;
712 
713 	if (QDF_STATUS_SUCCESS != dispatcher_ftm_init())
714 		goto ftm_init_fail;
715 
716 	if (QDF_IS_STATUS_ERROR(cfg_dispatcher_init()))
717 		goto cfg_init_fail;
718 
719 	if (QDF_STATUS_SUCCESS != dispatcher_spectral_init())
720 		goto spectral_init_fail;
721 
722 	if (QDF_STATUS_SUCCESS != wlan_cmn_mlme_init())
723 		goto cmn_mlme_init_fail;
724 
725 	/*
726 	 * scheduler INIT has to be the last as each component's
727 	 * initialization has to happen first and then at the end
728 	 * scheduler needs to start accepting the service.
729 	 */
730 	if (QDF_STATUS_SUCCESS != scheduler_init())
731 		goto scheduler_init_fail;
732 
733 	return QDF_STATUS_SUCCESS;
734 
735 scheduler_init_fail:
736 	wlan_cmn_mlme_deinit();
737 cmn_mlme_init_fail:
738 	dispatcher_spectral_deinit();
739 spectral_init_fail:
740 	cfg_dispatcher_deinit();
741 cfg_init_fail:
742 	dispatcher_ftm_deinit();
743 ftm_init_fail:
744 	dispatcher_green_ap_deinit();
745 green_ap_init_fail:
746 	dispatcher_fd_deinit();
747 fd_init_fail:
748 	dispatcher_splitmac_deinit();
749 splitmac_init_fail:
750 	dispatcher_deinit_son();
751 son_init_fail:
752 	dispatcher_offchan_txrx_deinit();
753 offchan_init_fail:
754 	dispatcher_regulatory_deinit();
755 regulatory_init_fail:
756 	dispatcher_deinit_dfs();
757 dfs_init_fail:
758 	dispatcher_deinit_wifi_pos();
759 wifi_pos_init_fail:
760 	dispatcher_deinit_sa_api();
761 sa_api_init_fail:
762 	dispatcher_deinit_atf();
763 atf_init_fail:
764 	dispatcher_deinit_cp_stats();
765 cp_stats_init_fail:
766 	dispatcher_deinit_crypto();
767 crypto_init_fail:
768 	wlan_serialization_deinit();
769 serialization_init_fail:
770 	ucfg_scan_deinit();
771 ucfg_scan_init_fail:
772 	wlan_mgmt_txrx_deinit();
773 mgmt_txrx_init_fail:
774 	wlan_objmgr_global_obj_deinit();
775 
776 out:
777 	return QDF_STATUS_E_FAILURE;
778 }
779 qdf_export_symbol(dispatcher_init);
780 
781 QDF_STATUS dispatcher_deinit(void)
782 {
783 	QDF_STATUS status;
784 
785 	QDF_BUG(QDF_STATUS_SUCCESS == scheduler_deinit());
786 
787 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_cmn_mlme_deinit());
788 
789 	status = cfg_dispatcher_deinit();
790 	QDF_BUG(QDF_IS_STATUS_SUCCESS(status));
791 
792 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_ftm_deinit());
793 
794 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_green_ap_deinit());
795 
796 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_fd_deinit());
797 
798 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_spectral_deinit());
799 
800 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_splitmac_deinit());
801 
802 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_son());
803 
804 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_offchan_txrx_deinit());
805 
806 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_regulatory_deinit());
807 
808 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_dfs());
809 
810 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_wifi_pos());
811 
812 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_sa_api());
813 
814 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_atf());
815 
816 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_cp_stats());
817 
818 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_crypto());
819 
820 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_serialization_deinit());
821 
822 	QDF_BUG(QDF_STATUS_SUCCESS == ucfg_scan_deinit());
823 
824 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_mgmt_txrx_deinit());
825 
826 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_objmgr_global_obj_deinit());
827 
828 	return QDF_STATUS_SUCCESS;
829 }
830 qdf_export_symbol(dispatcher_deinit);
831 
832 QDF_STATUS dispatcher_enable(void)
833 {
834 	QDF_STATUS status;
835 
836 	status = scheduler_enable();
837 
838 	return status;
839 }
840 qdf_export_symbol(dispatcher_enable);
841 
842 QDF_STATUS dispatcher_disable(void)
843 {
844 	QDF_BUG(QDF_IS_STATUS_SUCCESS(scheduler_disable()));
845 
846 	return QDF_STATUS_SUCCESS;
847 }
848 qdf_export_symbol(dispatcher_disable);
849 
850 QDF_STATUS dispatcher_psoc_open(struct wlan_objmgr_psoc *psoc)
851 {
852 	if (QDF_STATUS_SUCCESS != wlan_mgmt_txrx_psoc_open(psoc))
853 		goto out;
854 
855 	if (QDF_STATUS_SUCCESS != ucfg_scan_psoc_open(psoc))
856 		goto scan_psoc_open_fail;
857 
858 	if (QDF_STATUS_SUCCESS != cp_stats_psoc_open(psoc))
859 		goto cp_stats_psoc_open_fail;
860 
861 	if (QDF_STATUS_SUCCESS != atf_psoc_open(psoc))
862 		goto atf_psoc_open_fail;
863 
864 	if (QDF_STATUS_SUCCESS != dispatcher_regulatory_psoc_open(psoc))
865 		goto regulatory_psoc_open_fail;
866 
867 	if (QDF_STATUS_SUCCESS != son_psoc_open(psoc))
868 		goto psoc_son_fail;
869 
870 	if (QDF_STATUS_SUCCESS != dispatcher_ftm_psoc_open(psoc))
871 		goto ftm_psoc_open_fail;
872 
873 	return QDF_STATUS_SUCCESS;
874 
875 ftm_psoc_open_fail:
876 	son_psoc_close(psoc);
877 psoc_son_fail:
878 	regulatory_psoc_close(psoc);
879 regulatory_psoc_open_fail:
880 	atf_psoc_close(psoc);
881 atf_psoc_open_fail:
882 	cp_stats_psoc_close(psoc);
883 cp_stats_psoc_open_fail:
884 	ucfg_scan_psoc_close(psoc);
885 scan_psoc_open_fail:
886 	wlan_mgmt_txrx_psoc_close(psoc);
887 
888 out:
889 	return QDF_STATUS_E_FAILURE;
890 }
891 qdf_export_symbol(dispatcher_psoc_open);
892 
893 QDF_STATUS dispatcher_psoc_close(struct wlan_objmgr_psoc *psoc)
894 {
895 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_ftm_psoc_close(psoc));
896 
897 	QDF_BUG(QDF_STATUS_SUCCESS == son_psoc_close(psoc));
898 
899 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_regulatory_psoc_close(psoc));
900 
901 	QDF_BUG(QDF_STATUS_SUCCESS == atf_psoc_close(psoc));
902 
903 	QDF_BUG(QDF_STATUS_SUCCESS == cp_stats_psoc_close(psoc));
904 
905 	QDF_BUG(QDF_STATUS_SUCCESS == ucfg_scan_psoc_close(psoc));
906 
907 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_mgmt_txrx_psoc_close(psoc));
908 
909 	return QDF_STATUS_SUCCESS;
910 }
911 qdf_export_symbol(dispatcher_psoc_close);
912 
913 QDF_STATUS dispatcher_psoc_enable(struct wlan_objmgr_psoc *psoc)
914 {
915 	if (QDF_STATUS_SUCCESS != wlan_serialization_psoc_enable(psoc))
916 		goto out;
917 
918 	if (QDF_STATUS_SUCCESS != ucfg_scan_psoc_enable(psoc))
919 		goto serialization_psoc_enable_fail;
920 
921 	if (QDF_STATUS_SUCCESS != sa_api_psoc_enable(psoc))
922 		goto sa_api_psoc_enable_fail;
923 
924 	if (QDF_STATUS_SUCCESS != cp_stats_psoc_enable(psoc))
925 		goto cp_stats_psoc_enable_fail;
926 
927 	if (QDF_STATUS_SUCCESS != atf_psoc_enable(psoc))
928 		goto atf_psoc_enable_fail;
929 
930 	if (QDF_STATUS_SUCCESS != dispatcher_wifi_pos_enable(psoc))
931 		goto wifi_pos_psoc_enable_fail;
932 
933 	if (QDF_STATUS_SUCCESS != dispatcher_dfs_psoc_enable(psoc))
934 		goto wifi_dfs_psoc_enable_fail;
935 
936 	if (QDF_STATUS_SUCCESS != fd_psoc_enable(psoc))
937 		goto fd_psoc_enable_fail;
938 
939 	if (QDF_STATUS_SUCCESS != dispatcher_dbr_psoc_enable(psoc))
940 		goto dbr_psoc_enable_fail;
941 
942 	if (QDF_STATUS_SUCCESS != wlan_mlme_psoc_enable(psoc))
943 		goto mlme_psoc_enable_fail;
944 
945 	return QDF_STATUS_SUCCESS;
946 
947 mlme_psoc_enable_fail:
948 	dispatcher_dbr_psoc_disable(psoc);
949 dbr_psoc_enable_fail:
950 	fd_psoc_disable(psoc);
951 fd_psoc_enable_fail:
952 	dispatcher_dfs_psoc_disable(psoc);
953 wifi_dfs_psoc_enable_fail:
954 	dispatcher_wifi_pos_disable(psoc);
955 wifi_pos_psoc_enable_fail:
956 	atf_psoc_disable(psoc);
957 atf_psoc_enable_fail:
958 	cp_stats_psoc_disable(psoc);
959 cp_stats_psoc_enable_fail:
960 	sa_api_psoc_disable(psoc);
961 sa_api_psoc_enable_fail:
962 	ucfg_scan_psoc_disable(psoc);
963 serialization_psoc_enable_fail:
964 	wlan_serialization_psoc_disable(psoc);
965 out:
966 	return QDF_STATUS_E_FAILURE;
967 }
968 qdf_export_symbol(dispatcher_psoc_enable);
969 
970 QDF_STATUS dispatcher_psoc_disable(struct wlan_objmgr_psoc *psoc)
971 {
972 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_mlme_psoc_disable(psoc));
973 
974 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_dbr_psoc_disable(psoc));
975 
976 	QDF_BUG(QDF_STATUS_SUCCESS == fd_psoc_disable(psoc));
977 
978 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_dfs_psoc_disable(psoc));
979 
980 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_wifi_pos_disable(psoc));
981 
982 	QDF_BUG(QDF_STATUS_SUCCESS == atf_psoc_disable(psoc));
983 
984 	QDF_BUG(QDF_STATUS_SUCCESS == cp_stats_psoc_disable(psoc));
985 
986 	QDF_BUG(QDF_STATUS_SUCCESS == sa_api_psoc_disable(psoc));
987 
988 	QDF_BUG(QDF_STATUS_SUCCESS == ucfg_scan_psoc_disable(psoc));
989 
990 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_serialization_psoc_disable(psoc));
991 
992 	return QDF_STATUS_SUCCESS;
993 }
994 qdf_export_symbol(dispatcher_psoc_disable);
995 
996 QDF_STATUS dispatcher_pdev_open(struct wlan_objmgr_pdev *pdev)
997 {
998 	QDF_STATUS status;
999 
1000 	if (QDF_STATUS_SUCCESS != dispatcher_regulatory_pdev_open(pdev))
1001 		goto out;
1002 
1003 	status = dispatcher_spectral_pdev_open(pdev);
1004 	if (status != QDF_STATUS_SUCCESS && status != QDF_STATUS_COMP_DISABLED)
1005 		goto spectral_pdev_open_fail;
1006 
1007 	if (QDF_STATUS_SUCCESS != wlan_mgmt_txrx_pdev_open(pdev))
1008 		goto out;
1009 	if (QDF_IS_STATUS_ERROR(dispatcher_green_ap_pdev_open(pdev)))
1010 		goto out;
1011 
1012 	return QDF_STATUS_SUCCESS;
1013 
1014 spectral_pdev_open_fail:
1015 	dispatcher_regulatory_pdev_close(pdev);
1016 
1017 out:
1018 	return QDF_STATUS_E_FAILURE;
1019 }
1020 qdf_export_symbol(dispatcher_pdev_open);
1021 
1022 QDF_STATUS dispatcher_pdev_close(struct wlan_objmgr_pdev *pdev)
1023 {
1024 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_regulatory_pdev_close(pdev));
1025 
1026 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_spectral_pdev_close(pdev));
1027 
1028 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_mgmt_txrx_pdev_close(pdev));
1029 
1030 	return QDF_STATUS_SUCCESS;
1031 }
1032 qdf_export_symbol(dispatcher_pdev_close);
1033