xref: /wlan-dirver/qca-wifi-host-cmn/os_if/linux/mlme/src/osif_vdev_mgr_util.c (revision d0c05845839e5f2ba5a8dcebe0cd3e4cd4e8dfcf)
1 /*
2  * Copyright (c) 2021 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
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
41 
42 static struct mlme_vdev_mgr_ops vdev_mgr_ops = {
43 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
44 	.mlme_vdev_mgr_set_mac_addr_response =
45 					osif_vdev_mgr_set_mac_addr_response
46 #endif
47 };
48 
49 /**
50  * osif_vdev_mgr_get_global_ops() - Get vdev manager global ops
51  *
52  * Return: Connection manager global ops
53  */
54 static struct mlme_vdev_mgr_ops *osif_vdev_mgr_get_global_ops(void)
55 {
56 	return &vdev_mgr_ops;
57 }
58 
59 QDF_STATUS osif_vdev_mgr_register_cb(void)
60 {
61 	mlme_set_osif_vdev_mgr_cb(osif_vdev_mgr_get_global_ops);
62 
63 	return QDF_STATUS_SUCCESS;
64 }
65 
66 void osif_vdev_mgr_set_legacy_cb(struct osif_vdev_mgr_ops *osif_legacy_ops)
67 {
68 	osif_vdev_mgr_legacy_ops = osif_legacy_ops;
69 }
70 
71 void osif_vdev_mgr_reset_legacy_cb(void)
72 {
73 	osif_vdev_mgr_legacy_ops = NULL;
74 }
75