1 /*
2  * Copyright (c) 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: contains mlo mgr north bound interface api
19  */
20 
21 #ifndef _WLAN_MLO_MGR_PUBLIC_API_H_
22 #define _WLAN_MLO_MGR_PUBLIC_API_H_
23 
24 #include <wlan_mlo_mgr_link_switch.h>
25 
26 /**
27  * wlan_mlo_mgr_register_link_switch_notifier() - Components to register
28  * notifier callback on start of link switch.
29  * @comp_id: Component ID to register callback.
30  * @cb: Callback to register.
31  *
32  * The global MLO MGR will store the list of callbacks registered via this
33  * API and call each callback on start of link switch.
34  *
35  * Return: QDF_STATUS
36  */
37 static inline QDF_STATUS
wlan_mlo_mgr_register_link_switch_notifier(enum wlan_umac_comp_id comp_id,mlo_mgr_link_switch_notifier_cb cb)38 wlan_mlo_mgr_register_link_switch_notifier(enum wlan_umac_comp_id comp_id,
39 					   mlo_mgr_link_switch_notifier_cb cb)
40 {
41 	return mlo_mgr_register_link_switch_notifier(comp_id, cb);
42 }
43 
44 /**
45  * wlan_mlo_mgr_unregister_link_switch_notifier() - Components to unregister
46  * notifier callback on start of link switch.
47  * @comp_id: Component ID to unregister the callback.
48  *
49  * The global MLO MGR will remove the registered callback for @comp_id for
50  * notifying start of link switch.
51  *
52  * Return: QDF_STATUS
53  */
54 static inline QDF_STATUS
wlan_mlo_mgr_unregister_link_switch_notifier(enum wlan_umac_comp_id comp_id)55 wlan_mlo_mgr_unregister_link_switch_notifier(enum wlan_umac_comp_id comp_id)
56 {
57 	return mlo_mgr_unregister_link_switch_notifier(comp_id);
58 }
59 
60 /**
61  * wlan_mlo_mgr_is_link_switch_in_progress() - Check link switch in progress
62  * on MLO dev context level.
63  * @vdev: VDEV object manager
64  *
65  * This API will check if current state of MLO manager link switch state is
66  * in progress or not. The return value of true shall not be treated as @vdev
67  * is in link switch in progress. To know the status of VDEV in link switch or
68  * not need to use wlan_vdev_mlme_is_mlo_link_switch_in_progress() API
69  *
70  * Return: bool
71  */
72 static inline bool
wlan_mlo_mgr_is_link_switch_in_progress(struct wlan_objmgr_vdev * vdev)73 wlan_mlo_mgr_is_link_switch_in_progress(struct wlan_objmgr_vdev *vdev)
74 {
75 	return mlo_mgr_is_link_switch_in_progress(vdev);
76 }
77 
78 /**
79  * wlan_mlo_mgr_is_link_switch_on_assoc_vdev() - Is link switch in progress is
80  * on assoc VDEV.
81  * @vdev: VDEV object manager.
82  *
83  * Return true if current link switch in progress is on assoc VDEV or not.
84  *
85  * Return: void
86  */
87 static inline bool
wlan_mlo_mgr_is_link_switch_on_assoc_vdev(struct wlan_objmgr_vdev * vdev)88 wlan_mlo_mgr_is_link_switch_on_assoc_vdev(struct wlan_objmgr_vdev *vdev)
89 {
90 	return mlo_mgr_is_link_switch_on_assoc_vdev(vdev);
91 }
92 
93 /**
94  * wlan_mlo_mgr_link_switch_get_assoc_vdev() - Return assco VDEV pointer
95  * if it is in link switch.
96  * @vdev: VDEV object manager
97  *
98  * Return: VDEV object manager pointer
99  */
100 static inline struct wlan_objmgr_vdev *
wlan_mlo_mgr_link_switch_get_assoc_vdev(struct wlan_objmgr_vdev * vdev)101 wlan_mlo_mgr_link_switch_get_assoc_vdev(struct wlan_objmgr_vdev *vdev)
102 {
103 	return mlo_mgr_link_switch_get_assoc_vdev(vdev);
104 }
105 
106 /**
107  * wlan_mlo_mgr_link_switch_set_mac_addr_resp() - Dispatcher API to call to
108  * notify about status of set mac addr request.
109  * @vdev: VDEV object manager
110  * @resp_status: Status of request
111  *
112  * Return: QDF_STATUS
113  */
114 static inline QDF_STATUS
wlan_mlo_mgr_link_switch_set_mac_addr_resp(struct wlan_objmgr_vdev * vdev,uint8_t resp_status)115 wlan_mlo_mgr_link_switch_set_mac_addr_resp(struct wlan_objmgr_vdev *vdev,
116 					   uint8_t resp_status)
117 {
118 	return mlo_mgr_link_switch_set_mac_addr_resp(vdev, resp_status);
119 }
120 
121 /**
122  * wlan_mlo_mgr_link_switch_defer_disconnect_req() - Defer disconnect requests
123  * from source other than link switch.
124  * @vdev: VDEV object manager
125  * @source: Disconnect requestor
126  * @reason: Reason for disconnect
127  *
128  * Return: QDF_STATUS.
129  */
130 static inline QDF_STATUS
wlan_mlo_mgr_link_switch_defer_disconnect_req(struct wlan_objmgr_vdev * vdev,enum wlan_cm_source source,enum wlan_reason_code reason)131 wlan_mlo_mgr_link_switch_defer_disconnect_req(struct wlan_objmgr_vdev *vdev,
132 					      enum wlan_cm_source source,
133 					      enum wlan_reason_code reason)
134 {
135 	return mlo_mgr_link_switch_defer_disconnect_req(vdev, source, reason);
136 }
137 #endif /* _WLAN_MLO_MGR_PUBLIC_API_H_ */
138