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