1 /*
2  * Copyright (c) 2021, 2023 Qualcomm Innovation Center, Inc. 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 /**
18  * DOC: osif_vdev_mgr_util.c
19  *
20  * This header file maintains definitaions of osif APIs corresponding to vdev
21  * manager.
22  */
23 
24 #include <include/wlan_mlme_cmn.h>
25 #include "osif_vdev_mgr_util.h"
26 
27 static struct osif_vdev_mgr_ops *osif_vdev_mgr_legacy_ops;
28 
29 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
osif_vdev_mgr_set_mac_addr_response(uint8_t vdev_id,uint8_t resp_status)30 static QDF_STATUS osif_vdev_mgr_set_mac_addr_response(uint8_t vdev_id,
31 						      uint8_t resp_status)
32 {
33 	if (osif_vdev_mgr_legacy_ops &&
34 	    osif_vdev_mgr_legacy_ops->osif_vdev_mgr_set_mac_addr_response)
35 		osif_vdev_mgr_legacy_ops->osif_vdev_mgr_set_mac_addr_response(
36 						vdev_id, resp_status);
37 
38 	return QDF_STATUS_SUCCESS;
39 }
40 #endif
osif_vdev_mgr_send_scan_done_complete_cb(uint8_t vdev_id)41 static void osif_vdev_mgr_send_scan_done_complete_cb(uint8_t vdev_id)
42 {
43 	if (osif_vdev_mgr_legacy_ops &&
44 	    osif_vdev_mgr_legacy_ops->osif_vdev_mgr_send_scan_done_complete_cb)
45 	     osif_vdev_mgr_legacy_ops->osif_vdev_mgr_send_scan_done_complete_cb(
46 								vdev_id);
47 }
48 
49 static struct mlme_vdev_mgr_ops vdev_mgr_ops = {
50 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
51 	.mlme_vdev_mgr_set_mac_addr_response =
52 					osif_vdev_mgr_set_mac_addr_response,
53 #endif
54 	.mlme_vdev_mgr_send_scan_done_complete_cb =
55 				osif_vdev_mgr_send_scan_done_complete_cb,
56 };
57 
58 /**
59  * osif_vdev_mgr_get_global_ops() - Get vdev manager global ops
60  *
61  * Return: Connection manager global ops
62  */
osif_vdev_mgr_get_global_ops(void)63 static struct mlme_vdev_mgr_ops *osif_vdev_mgr_get_global_ops(void)
64 {
65 	return &vdev_mgr_ops;
66 }
67 
osif_vdev_mgr_register_cb(void)68 QDF_STATUS osif_vdev_mgr_register_cb(void)
69 {
70 	mlme_set_osif_vdev_mgr_cb(osif_vdev_mgr_get_global_ops);
71 
72 	return QDF_STATUS_SUCCESS;
73 }
74 
osif_vdev_mgr_set_legacy_cb(struct osif_vdev_mgr_ops * osif_legacy_ops)75 void osif_vdev_mgr_set_legacy_cb(struct osif_vdev_mgr_ops *osif_legacy_ops)
76 {
77 	osif_vdev_mgr_legacy_ops = osif_legacy_ops;
78 }
79 
osif_vdev_mgr_reset_legacy_cb(void)80 void osif_vdev_mgr_reset_legacy_cb(void)
81 {
82 	osif_vdev_mgr_legacy_ops = NULL;
83 }
84