xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mlme_api.h (revision 8b3dca18206e1a0461492f082fa6e270b092c035)
1 /*
2  * Copyright (c) 2018-2019, 2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /**
19  * DOC: Define VDEV MLME public APIs
20  */
21 
22 #ifndef _WLAN_VDEV_MLME_API_H_
23 #define _WLAN_VDEV_MLME_API_H_
24 
25 #include <wlan_ext_mlme_obj_types.h>
26 
27 /**
28  * wlan_mlme_peer_param_id - peer param id in mlme layer
29  * @WLAN_MLME_PEER_BW_PUNCTURE: update puncture 20 MHz bitmap
30  */
31 enum wlan_mlme_peer_param_id {
32 	WLAN_MLME_PEER_BW_PUNCTURE,
33 	WLAN_MLME_PEER_MAX
34 };
35 
36 /**
37  * wlan_vdev_mlme_get_cmpt_obj - Retrieves MLME component object
38  * from VDEV object
39  * @vdev: pointer to vdev object
40  *
41  * Retrieves MLME component object from VDEV object
42  *
43  * Return: comp handle on SUCCESS
44  *         NULL, if it fails to retrieve
45  */
46 struct vdev_mlme_obj *wlan_vdev_mlme_get_cmpt_obj(
47 						struct wlan_objmgr_vdev *vdev);
48 /**
49  * wlan_vdev_mlme_set_ext_hdl - Sets legacy handle
50  * @vdev: pointer to vdev object
51  * @ext_hdl: pointer to legacy handle
52  *
53  * Sets Legacy handle to MLME component object
54  *
55  * Return:
56  */
57 void wlan_vdev_mlme_set_ext_hdl(struct wlan_objmgr_vdev *vdev,
58 				mlme_vdev_ext_t *ext_hdl);
59 
60 /**
61  * wlan_vdev_mlme_get_ext_hdl - Returns legacy handle
62  * @vdev: pointer to vdev object
63  *
64  * Retrieves legacy handle from vdev mlme component object
65  *
66  * Return: legacy handle on SUCCESS
67  *         NULL, if it fails to retrieve
68  */
69 mlme_vdev_ext_t *wlan_vdev_mlme_get_ext_hdl(struct wlan_objmgr_vdev *vdev);
70 
71 /**
72  * wlan_vdev_mlme_sm_deliver_evt() - Delivers event to VDEV MLME SM
73  * @vdev: Object manager VDEV object
74  * @event: MLME event
75  * @event_data_len: data size
76  * @event_data: event data
77  *
78  * API to dispatch event to VDEV MLME SM with lock acquired
79  *
80  * Return: SUCCESS: on handling event
81  *         FAILURE: on ignoring the event
82  */
83 QDF_STATUS wlan_vdev_mlme_sm_deliver_evt(struct wlan_objmgr_vdev *vdev,
84 					 enum wlan_vdev_sm_evt event,
85 					 uint16_t event_data_len,
86 					 void *event_data);
87 
88 /**
89  * wlan_vdev_mlme_sm_deliver_evt_sync() - Delivers event to VDEV MLME SM sync
90  * @vdev: Object manager VDEV object
91  * @event: MLME event
92  * @event_data_len: data size
93  * @event_data: event data
94  *
95  * API to dispatch event to VDEV MLME SM with lock acquired
96  *
97  * Return: SUCCESS: on handling event
98  *         FAILURE: on ignoring the event
99  */
100 QDF_STATUS wlan_vdev_mlme_sm_deliver_evt_sync(struct wlan_objmgr_vdev *vdev,
101 					      enum wlan_vdev_sm_evt event,
102 					      uint16_t event_data_len,
103 					      void *event_data);
104 
105 #ifdef SM_ENG_HIST_ENABLE
106 /**
107  * wlan_vdev_mlme_sm_history_print() - Prints SM history
108  * @vdev: Object manager VDEV object
109  *
110  * API to print SM history
111  *
112  * Return: void
113  */
114 void wlan_vdev_mlme_sm_history_print(struct wlan_objmgr_vdev *vdev);
115 
116 #endif
117 
118 /**
119  * wlan_vdev_allow_connect_n_tx() - Checks whether VDEV is in operational state
120  * @vdev: Object manager VDEV object
121  *
122  * API to checks the VDEV MLME SM state to allow tx or connections
123  *
124  * Return: SUCCESS: to allow tx or connection
125  *         FAILURE: otherwise failure
126  */
127 QDF_STATUS wlan_vdev_allow_connect_n_tx(struct wlan_objmgr_vdev *vdev);
128 
129 /**
130  * wlan_vdev_mlme_is_active() - Checks whether VDEV is in active state
131  * @vdev: Object manager VDEV object
132  *
133  * API to checks the VDEV MLME SM state to check channel is configured in FW
134  *
135  * Return: SUCCESS: valid channel is configured
136  *         FAILURE: otherwise failure
137  */
138 QDF_STATUS wlan_vdev_mlme_is_active(struct wlan_objmgr_vdev *vdev);
139 
140 /**
141  * wlan_vdev_chan_config_valid() - Checks whether VDEV chan config valid
142  * @vdev: Object manager VDEV object
143  *
144  * API to checks the VDEV MLME SM state to check channel is configured in Host
145  *
146  * Return: SUCCESS: valid channel is configured
147  *         FAILURE: otherwise failure
148  */
149 QDF_STATUS wlan_vdev_chan_config_valid(struct wlan_objmgr_vdev *vdev);
150 
151 /**
152  * wlan_vdev_mlme_is_csa_restart() - Checks whether VDEV MLME SM is in CSA
153  * @vdev: Object manager VDEV object
154  *
155  * API to checks the VDEV MLME SM state for CSA_RESTART substate
156  *
157  * Return: SUCCESS: if it is in CSA_RESTART sub state
158  *         FAILURE: otherwise failure
159  */
160 QDF_STATUS wlan_vdev_mlme_is_csa_restart(struct wlan_objmgr_vdev *vdev);
161 
162 /**
163  * wlan_vdev_is_going_down() - Checks whether VDEV is being brought down
164  * @vdev: Object manager VDEV object
165  *
166  * API to checks the VDEV MLME SM state to check VDEV is being brought down
167  *
168  * Return: SUCCESS: valid channel is configured
169  *         FAILURE: otherwise failure
170  */
171 QDF_STATUS wlan_vdev_is_going_down(struct wlan_objmgr_vdev *vdev);
172 
173 /**
174  * wlan_vdev_is_mlo_peer_create_allowed() - Checks whether PEER can be created
175  * @vdev: Object manager VDEV object
176  *
177  * API to check the VDEV MLME SM state to allow PEER association in MLD
178  *
179  * Return: SUCCESS: if peer create can be allowed
180  *         FAILURE: otherwise failure
181  */
182 QDF_STATUS wlan_vdev_is_mlo_peer_create_allowed(struct wlan_objmgr_vdev *vdev);
183 
184 /**
185  * wlan_vdev_is_restart_progress() - Checks VDEV restart is in progress
186  * @vdev: Object manager VDEV object
187  *
188  * API to check whether restarts is in progress
189  *
190  * Return: SUCCESS: if restart is in progress
191  *         FAILURE: otherwise failure
192  */
193 QDF_STATUS wlan_vdev_is_restart_progress(struct wlan_objmgr_vdev *vdev);
194 
195 /**
196  * wlan_vdev_is_dfs_cac_wait() - Checks VDEV is in cac wait state
197  * @vdev: Object manager VDEV object
198  *
199  * API to check whether state is cac wait state
200  *
201  * Return: SUCCESS: if state is cac wait state
202  *         FAILURE: otherwise failure
203  */
204 QDF_STATUS wlan_vdev_is_dfs_cac_wait(struct wlan_objmgr_vdev *vdev);
205 
206 /**
207  * wlan_vdev_mlme_cmd_lock - Acquire lock for command queuing atomicity
208  *
209  * API to take VDEV MLME command lock
210  *
211  * Return: void
212  */
213 void wlan_vdev_mlme_cmd_lock(struct wlan_objmgr_vdev *vdev);
214 
215 /**
216  * wlan_vdev_mlme_cmd_unlock - Release lock for command queuing atomicity
217  *
218  * API to release VDEV MLME command lock
219  *
220  * Return: void
221  */
222 void wlan_vdev_mlme_cmd_unlock(struct wlan_objmgr_vdev *vdev);
223 
224 /**
225  * wlan_vdev_mlme_is_scan_allowed() - Checks whether scan is allowed
226  * @vdev: Object manager VDEV object
227  *
228  * API to checks the VDEV MLME SM state to check scan is allowed
229  *
230  * Return: SUCCESS: if scan is allowed
231  *         FAILURE: otherwise failure
232  */
233 QDF_STATUS wlan_vdev_mlme_is_scan_allowed(struct wlan_objmgr_vdev *vdev);
234 
235 /**
236  * wlan_vdev_mlme_is_init_state() - Checks whether vdev is in init state
237  * @vdev: Object manager VDEV object
238  *
239  * API to checks the VDEV MLME SM state is in init state or not
240  *
241  * Return: SUCCESS: if vdev is in init state
242  *         FAILURE: otherwise failure
243  */
244 QDF_STATUS wlan_vdev_mlme_is_init_state(struct wlan_objmgr_vdev *vdev);
245 
246 /**
247  * wlan_vdev_is_up_active_state() - Checks whether vdev is in up active state
248  * @vdev: Object manager VDEV object
249  *
250  * API to checks the VDEV MLME SM state is in UP ACTIVE state
251  *
252  * Return: SUCCESS: if vdev is in UP ACTIVE state
253  *         FAILURE: otherwise failure
254  */
255 QDF_STATUS wlan_vdev_is_up_active_state(struct wlan_objmgr_vdev *vdev);
256 
257 #ifdef WLAN_FEATURE_11BE_MLO
258 /**
259  * wlan_vdev_mlme_get_is_mlo_link() - check if its mlo link vdev
260  * @psoc: PSOC object
261  * @vdev_id: VDEV Id
262  *
263  * Return: True if it is mlo link, otherwise false.
264  */
265 bool
266 wlan_vdev_mlme_get_is_mlo_link(struct wlan_objmgr_psoc *psoc,
267 			       uint8_t vdev_id);
268 
269 /**
270  * wlan_vdev_mlme_get_is_mlo_vdev() - check if its mlo assoc vdev
271  * @psoc: PSOC object
272  * @vdev_id: VDEV Id
273  *
274  * Return: True if it is mlo link, otherwise false.
275  */
276 bool
277 wlan_vdev_mlme_get_is_mlo_vdev(struct wlan_objmgr_psoc *psoc,
278 			       uint8_t vdev_id);
279 #else
280 static inline bool
281 wlan_vdev_mlme_get_is_mlo_link(struct wlan_objmgr_psoc *psoc,
282 			       uint8_t vdev_id)
283 {
284 	return false;
285 }
286 
287 static inline bool
288 wlan_vdev_mlme_get_is_mlo_vdev(struct wlan_objmgr_psoc *psoc,
289 			       uint8_t vdev_id)
290 {
291 	return false;
292 }
293 #endif
294 #endif
295