1 /*
2 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for
6 * any purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
8 * copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 /**
21 * DOC: Declares VDEV MLME SM APIs and structures
22 */
23
24 #ifndef _VDEV_MLME_SM_H_
25 #define _VDEV_MLME_SM_H_
26
27 #ifdef WLAN_FEATURE_11BE_MLO
28 #include <wlan_mlo_mgr_ap.h>
29 #include <wlan_mlo_mgr_sta.h>
30 #endif
31 #include <wlan_dfs_utils_api.h>
32
33 /**
34 * mlme_vdev_sm_deliver_event() - Delivers event to VDEV MLME SM
35 * @vdev_mlme: MLME VDEV comp object
36 * @event: MLME event
37 * @event_data_len: data size
38 * @event_data: event data
39 *
40 * API to dispatch event to VDEV MLME SM
41 *
42 * Return: SUCCESS: on handling event
43 * FAILURE: on ignoring the event
44 */
45 QDF_STATUS mlme_vdev_sm_deliver_event(struct vdev_mlme_obj *vdev_mlme,
46 enum wlan_vdev_sm_evt event,
47 uint16_t event_data_len,
48 void *event_data);
49
50 /**
51 * mlme_vdev_sm_print_state_event() - Prints the state/substate, event
52 * @vdev_mlme: MLME VDEV comp object
53 * @event: MLME event
54 *
55 * API to print current state/substate, events in readable format
56 *
57 * Return: void
58 */
59 void mlme_vdev_sm_print_state_event(struct vdev_mlme_obj *vdev_mlme,
60 enum wlan_vdev_sm_evt event);
61
62 /**
63 * mlme_vdev_sm_print_state() - Prints the state/substate
64 * @vdev_mlme: MLME VDEV comp object
65 *
66 * API to print current state/substate
67 *
68 * Return: void
69 */
70 void mlme_vdev_sm_print_state(struct vdev_mlme_obj *vdev_mlme);
71 #ifdef SM_ENG_HIST_ENABLE
72 /**
73 * mlme_vdev_sm_history_print() - Prints SM history
74 * @vdev_mlme: MLME VDEV comp object
75 *
76 * API to print SM history
77 *
78 * Return: void
79 */
80 void mlme_vdev_sm_history_print(struct vdev_mlme_obj *vdev_mlme);
81 #endif
82
83 #endif
84
85 /**
86 * mlme_vdev_sm_create() - Invoke SME creation for VDEV
87 * @vdev_mlme: VDEV MLME comp object
88 *
89 * API allocates VDEV MLME SM and initializes SM lock
90 *
91 * Return: SUCCESS on successful allocation
92 * FAILURE, if registration fails
93 */
94 QDF_STATUS mlme_vdev_sm_create(struct vdev_mlme_obj *vdev_mlme);
95
96 /**
97 * mlme_vdev_sm_destroy() - Invoke SME destroy for VDEV
98 * @vdev_mlme: VDEV MLME comp object
99 *
100 * API frees VDEV MLME SM and destroys the SM lock
101 *
102 * Return: SUCCESS on successful destroy
103 * FAILURE, if registration fails
104 */
105 QDF_STATUS mlme_vdev_sm_destroy(struct vdev_mlme_obj *vdev_mlme);
106
107 /**
108 * mlme_vdev_validate_basic_params() - Validate basic params
109 * @vdev_mlme: VDEV MLME comp object
110 * @event_data_len: data size
111 * @event_data: event data
112 *
113 * API validate MLME VDEV basic parameters
114 *
115 * Return: SUCCESS on successful validation
116 * FAILURE, if any parameter is not initialized
117 */
mlme_vdev_validate_basic_params(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)118 static inline QDF_STATUS mlme_vdev_validate_basic_params(
119 struct vdev_mlme_obj *vdev_mlme,
120 uint16_t event_data_len, void *event_data)
121 {
122 QDF_STATUS ret = QDF_STATUS_SUCCESS;
123
124 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_validate_basic_params)
125 ret = vdev_mlme->ops->mlme_vdev_validate_basic_params(
126 vdev_mlme, event_data_len, event_data);
127
128 return ret;
129 }
130
131 /**
132 * mlme_vdev_reset_proto_params() - Reset VDEV protocol params
133 * @vdev_mlme: VDEV MLME comp object
134 * @event_data_len: data size
135 * @event_data: event data
136 *
137 * API resets the protocol params of vdev
138 *
139 * Return: SUCCESS on successful reset
140 * FAILURE, if it fails due to any
141 */
mlme_vdev_reset_proto_params(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)142 static inline QDF_STATUS mlme_vdev_reset_proto_params(
143 struct vdev_mlme_obj *vdev_mlme,
144 uint16_t event_data_len, void *event_data)
145 {
146 QDF_STATUS ret = QDF_STATUS_SUCCESS;
147
148 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_reset_proto_params)
149 ret = vdev_mlme->ops->mlme_vdev_reset_proto_params(
150 vdev_mlme, event_data_len, event_data);
151
152 return ret;
153 }
154
155 /**
156 * mlme_vdev_start_send() - Invokes VDEV start operation
157 * @vdev_mlme: VDEV MLME comp object
158 * @event_data_len: data size
159 * @event_data: event data
160 *
161 * API invokes VDEV start operation
162 *
163 * Return: SUCCESS on successful completion of start operation
164 * FAILURE, if it fails due to any
165 */
mlme_vdev_start_send(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)166 static inline QDF_STATUS mlme_vdev_start_send(
167 struct vdev_mlme_obj *vdev_mlme,
168 uint16_t event_data_len, void *event_data)
169 {
170 QDF_STATUS ret = QDF_STATUS_SUCCESS;
171
172 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_start_send)
173 ret = vdev_mlme->ops->mlme_vdev_start_send(
174 vdev_mlme, event_data_len, event_data);
175
176 return ret;
177 }
178
179 /**
180 * mlme_vdev_restart_send() - Invokes VDEV restart operation
181 * @vdev_mlme: VDEV MLME comp object
182 * @event_data_len: data size
183 * @event_data: event data
184 *
185 * API invokes VDEV restart operation
186 *
187 * Return: SUCCESS on successful completion of restart operation
188 * FAILURE, if it fails due to any
189 */
mlme_vdev_restart_send(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)190 static inline QDF_STATUS mlme_vdev_restart_send(
191 struct vdev_mlme_obj *vdev_mlme,
192 uint16_t event_data_len, void *event_data)
193 {
194 QDF_STATUS ret = QDF_STATUS_SUCCESS;
195
196 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_restart_send)
197 ret = vdev_mlme->ops->mlme_vdev_restart_send(
198 vdev_mlme, event_data_len, event_data);
199
200 return ret;
201 }
202
203 /**
204 * mlme_vdev_stop_start_send() - Invoke block VDEV restart operation
205 * @vdev_mlme: VDEV MLME comp object
206 * @restart: restart req/start req
207 * @event_data_len: data size
208 * @event_data: event data
209 *
210 * API invokes stops pending VDEV restart operation
211 *
212 * Return: SUCCESS alsways
213 */
mlme_vdev_stop_start_send(struct vdev_mlme_obj * vdev_mlme,uint8_t restart,uint16_t event_data_len,void * event_data)214 static inline QDF_STATUS mlme_vdev_stop_start_send(
215 struct vdev_mlme_obj *vdev_mlme,
216 uint8_t restart,
217 uint16_t event_data_len, void *event_data)
218 {
219 QDF_STATUS ret = QDF_STATUS_SUCCESS;
220
221 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_stop_start_send)
222 ret = vdev_mlme->ops->mlme_vdev_stop_start_send(
223 vdev_mlme, restart, event_data_len, event_data);
224
225 return ret;
226 }
227
228 /**
229 * mlme_vdev_start_continue() - VDEV start response handling
230 * @vdev_mlme: VDEV MLME comp object
231 * @event_data_len: data size
232 * @event_data: event data
233 *
234 * API invokes VDEV start response actions
235 *
236 * Return: SUCCESS on successful completion of start response operation
237 * FAILURE, if it fails due to any
238 */
mlme_vdev_start_continue(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)239 static inline QDF_STATUS mlme_vdev_start_continue(
240 struct vdev_mlme_obj *vdev_mlme,
241 uint16_t event_data_len, void *event_data)
242 {
243 QDF_STATUS ret = QDF_STATUS_SUCCESS;
244
245 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_start_continue)
246 ret = vdev_mlme->ops->mlme_vdev_start_continue(
247 vdev_mlme, event_data_len, event_data);
248
249 return ret;
250 }
251
252 /**
253 * mlme_vdev_start_req_failed() - Invoke Station VDEV connection, if it pause
254 * @vdev_mlme: VDEV MLME comp object
255 * @event_data_len: data size
256 * @event_data: event data
257 *
258 * API invokes on START fail response
259 *
260 * Return: SUCCESS on successful invocation of callback
261 * FAILURE, if it fails due to any
262 */
mlme_vdev_start_req_failed(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)263 static inline QDF_STATUS mlme_vdev_start_req_failed(
264 struct vdev_mlme_obj *vdev_mlme,
265 uint16_t event_data_len, void *event_data)
266 {
267 QDF_STATUS ret = QDF_STATUS_SUCCESS;
268
269 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_start_req_failed)
270 ret = vdev_mlme->ops->mlme_vdev_start_req_failed(
271 vdev_mlme, event_data_len, event_data);
272
273 return ret;
274 }
275
276 /**
277 * mlme_vdev_sta_conn_start() - Invoke Station VDEV connection, if it pause
278 * @vdev_mlme: VDEV MLME comp object
279 * @event_data_len: data size
280 * @event_data: event data
281 *
282 * API invokes connection SM to start station connection
283 *
284 * Return: SUCCESS on successful invocation of connection sm
285 * FAILURE, if it fails due to any
286 */
mlme_vdev_sta_conn_start(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)287 static inline QDF_STATUS mlme_vdev_sta_conn_start(
288 struct vdev_mlme_obj *vdev_mlme,
289 uint16_t event_data_len, void *event_data)
290 {
291 QDF_STATUS ret = QDF_STATUS_SUCCESS;
292
293 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_sta_conn_start)
294 ret = vdev_mlme->ops->mlme_vdev_sta_conn_start(
295 vdev_mlme, event_data_len, event_data);
296
297 return ret;
298 }
299
300 /**
301 * mlme_vdev_sta_disconn_start() - Invoke Station VDEV disconnection
302 * @vdev_mlme: VDEV MLME comp object
303 * @event_data_len: data size
304 * @event_data: event data
305 *
306 * API invokes connection SM to start station disconnection
307 *
308 * Return: SUCCESS on successful invocation of disconnection sm
309 * FAILURE, if it fails due to any
310 */
mlme_vdev_sta_disconn_start(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)311 static inline QDF_STATUS mlme_vdev_sta_disconn_start(
312 struct vdev_mlme_obj *vdev_mlme,
313 uint16_t event_data_len, void *event_data)
314 {
315 QDF_STATUS ret = QDF_STATUS_SUCCESS;
316
317 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_sta_disconn_start)
318 ret = vdev_mlme->ops->mlme_vdev_sta_disconn_start(
319 vdev_mlme, event_data_len, event_data);
320
321 return ret;
322 }
323
324 /**
325 * mlme_vdev_up_send() - VDEV up operation
326 * @vdev_mlme: VDEV MLME comp object
327 * @event_data_len: data size
328 * @event_data: event data
329 *
330 * API invokes VDEV up operations
331 *
332 * Return: SUCCESS on successful completion of up operation
333 * FAILURE, if it fails due to any
334 */
mlme_vdev_up_send(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)335 static inline QDF_STATUS mlme_vdev_up_send(
336 struct vdev_mlme_obj *vdev_mlme,
337 uint16_t event_data_len, void *event_data)
338 {
339 QDF_STATUS ret = QDF_STATUS_SUCCESS;
340
341 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_up_send)
342 ret = vdev_mlme->ops->mlme_vdev_up_send(
343 vdev_mlme, event_data_len, event_data);
344
345 return ret;
346 }
347
348 /**
349 * mlme_vdev_notify_up_complete() - VDEV up state transition notification
350 * @vdev_mlme: VDEV MLME comp object
351 * @event_data_len: data size
352 * @event_data: event data
353 *
354 * API notifies MLME on moving to UP state
355 *
356 * Return: SUCCESS on successful completion of up notification
357 * FAILURE, if it fails due to any
358 */
359 static inline
mlme_vdev_notify_up_complete(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)360 QDF_STATUS mlme_vdev_notify_up_complete(struct vdev_mlme_obj *vdev_mlme,
361 uint16_t event_data_len,
362 void *event_data)
363 {
364 QDF_STATUS ret = QDF_STATUS_SUCCESS;
365
366 if (vdev_mlme->ops && vdev_mlme->ops->mlme_vdev_notify_up_complete)
367 ret = vdev_mlme->ops->mlme_vdev_notify_up_complete(
368 vdev_mlme, event_data_len, event_data);
369
370 return ret;
371 }
372
373 /**
374 * mlme_vdev_notify_roam_start() - VDEV Roaming notification
375 * @vdev_mlme: VDEV MLME comp object
376 * @event_len: data size
377 * @event_data: event data
378 *
379 * API notifies MLME on roaming
380 *
381 * Return: SUCCESS on successful completion of up notification
382 * FAILURE, if it fails due to any
383 */
384 static inline
mlme_vdev_notify_roam_start(struct vdev_mlme_obj * vdev_mlme,uint16_t event_len,void * event_data)385 QDF_STATUS mlme_vdev_notify_roam_start(struct vdev_mlme_obj *vdev_mlme,
386 uint16_t event_len, void *event_data)
387 {
388 QDF_STATUS ret = QDF_STATUS_SUCCESS;
389
390 if (vdev_mlme->ops && vdev_mlme->ops->mlme_vdev_notify_roam_start)
391 ret = vdev_mlme->ops->mlme_vdev_notify_roam_start(vdev_mlme,
392 event_len,
393 event_data);
394
395 return ret;
396 }
397
398 /**
399 * mlme_vdev_update_beacon() - Updates beacon
400 * @vdev_mlme: VDEV MLME comp object
401 * @op: beacon update type
402 * @event_data_len: data size
403 * @event_data: event data
404 *
405 * API updates/allocates/frees the beacon
406 *
407 * Return: SUCCESS on successful update of beacon
408 * FAILURE, if it fails due to any
409 */
410 static inline
mlme_vdev_update_beacon(struct vdev_mlme_obj * vdev_mlme,enum beacon_update_op op,uint16_t event_data_len,void * event_data)411 QDF_STATUS mlme_vdev_update_beacon(struct vdev_mlme_obj *vdev_mlme,
412 enum beacon_update_op op,
413 uint16_t event_data_len, void *event_data)
414 {
415 QDF_STATUS ret = QDF_STATUS_SUCCESS;
416
417 if (vdev_mlme->ops && vdev_mlme->ops->mlme_vdev_update_beacon)
418 ret = vdev_mlme->ops->mlme_vdev_update_beacon(vdev_mlme, op,
419 event_data_len, event_data);
420
421 return ret;
422 }
423
424 /**
425 * mlme_vdev_disconnect_peers() - Disconnect peers
426 * @vdev_mlme: VDEV MLME comp object
427 * @event_data_len: data size
428 * @event_data: event data
429 * @discon_legacy_only: flag indicating that only legacy peer to be
430 * disconnected
431 *
432 * API trigger stations disconnection with AP VDEV or AP disconnection with STA
433 * VDEV
434 *
435 * Return: SUCCESS on successful invocation of station disconnection
436 * FAILURE, if it fails due to any
437 */
mlme_vdev_disconnect_peers(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data,bool discon_legacy_only)438 static inline QDF_STATUS mlme_vdev_disconnect_peers(
439 struct vdev_mlme_obj *vdev_mlme,
440 uint16_t event_data_len, void *event_data,
441 bool discon_legacy_only)
442 {
443 QDF_STATUS ret = QDF_STATUS_SUCCESS;
444
445 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_disconnect_peers)
446 ret = vdev_mlme->ops->mlme_vdev_disconnect_peers(
447 vdev_mlme, event_data_len, event_data,
448 discon_legacy_only);
449
450 return ret;
451 }
452
453 /**
454 * mlme_vdev_dfs_cac_timer_stop() - Stop CAC timer
455 * @vdev_mlme: VDEV MLME comp object
456 * @event_data_len: data size
457 * @event_data: event data
458 *
459 * API stops the CAC timer through DFS API
460 *
461 * Return: SUCCESS on successful CAC timer stop
462 * FAILURE, if it fails due to any
463 */
mlme_vdev_dfs_cac_timer_stop(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)464 static inline QDF_STATUS mlme_vdev_dfs_cac_timer_stop(
465 struct vdev_mlme_obj *vdev_mlme,
466 uint16_t event_data_len, void *event_data)
467 {
468 QDF_STATUS ret = QDF_STATUS_SUCCESS;
469
470 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_dfs_cac_timer_stop)
471 ret = vdev_mlme->ops->mlme_vdev_dfs_cac_timer_stop(
472 vdev_mlme, event_data_len, event_data);
473
474 return ret;
475 }
476
477 /**
478 * mlme_vdev_stop_send() - Invokes VDEV stop operation
479 * @vdev_mlme: VDEV MLME comp object
480 * @event_data_len: data size
481 * @event_data: event data
482 *
483 * API invokes VDEV stop operation
484 *
485 * Return: SUCCESS on successful completion of stop operation
486 * FAILURE, if it fails due to any
487 */
mlme_vdev_stop_send(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)488 static inline QDF_STATUS mlme_vdev_stop_send(
489 struct vdev_mlme_obj *vdev_mlme,
490 uint16_t event_data_len, void *event_data)
491 {
492 QDF_STATUS ret = QDF_STATUS_SUCCESS;
493
494 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_stop_send)
495 ret = vdev_mlme->ops->mlme_vdev_stop_send(
496 vdev_mlme, event_data_len, event_data);
497
498 return ret;
499 }
500
501 /**
502 * mlme_vdev_stop_continue() - VDEV stop response handling
503 * @vdev_mlme: VDEV MLME comp object
504 * @event_data_len: data size
505 * @event_data: event data
506 *
507 * API invokes VDEV stop response actions
508 *
509 * Return: SUCCESS on successful completion of stop response operation
510 * FAILURE, if it fails due to any
511 */
mlme_vdev_stop_continue(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)512 static inline QDF_STATUS mlme_vdev_stop_continue(
513 struct vdev_mlme_obj *vdev_mlme,
514 uint16_t event_data_len, void *event_data)
515 {
516 QDF_STATUS ret = QDF_STATUS_SUCCESS;
517
518 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_stop_continue)
519 ret = vdev_mlme->ops->mlme_vdev_stop_continue(vdev_mlme,
520 event_data_len,
521 event_data);
522
523 return ret;
524 }
525
526 /**
527 * mlme_vdev_down_send() - VDEV down operation
528 * @vdev_mlme: VDEV MLME comp object
529 * @event_data_len: data size
530 * @event_data: event data
531 *
532 * API invokes VDEV down operation
533 *
534 * Return: SUCCESS on successful completion of VDEV down operation
535 * FAILURE, if it fails due to any
536 */
mlme_vdev_down_send(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)537 static inline QDF_STATUS mlme_vdev_down_send(
538 struct vdev_mlme_obj *vdev_mlme,
539 uint16_t event_data_len, void *event_data)
540 {
541 QDF_STATUS ret = QDF_STATUS_SUCCESS;
542
543 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_down_send)
544 ret = vdev_mlme->ops->mlme_vdev_down_send(
545 vdev_mlme, event_data_len, event_data);
546
547 return ret;
548 }
549
550 /**
551 * mlme_vdev_notify_down_complete() - VDEV init state transition notification
552 * @vdev_mlme: VDEV MLME comp object
553 * @event_data_len: data size
554 * @event_data: event data
555 *
556 * API notifies MLME on moving to INIT state
557 *
558 * Return: SUCCESS on successful completion of down notification
559 * FAILURE, if it fails due to any
560 */
mlme_vdev_notify_down_complete(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)561 static inline QDF_STATUS mlme_vdev_notify_down_complete(
562 struct vdev_mlme_obj *vdev_mlme,
563 uint16_t event_data_len, void *event_data)
564 {
565 QDF_STATUS ret = QDF_STATUS_SUCCESS;
566
567 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_notify_down_complete)
568 ret = vdev_mlme->ops->mlme_vdev_notify_down_complete(
569 vdev_mlme, event_data_len, event_data);
570
571 return ret;
572 }
573
574 /**
575 * mlme_vdev_notify_start_state_exit() - VDEV SM start state exit notification
576 * @vdev_mlme: VDEV MLME comp object
577 *
578 * API notifies on start state exit
579 *
580 * Return: SUCCESS on successful completion of notification
581 * FAILURE, if it fails due to any
582 */
mlme_vdev_notify_start_state_exit(struct vdev_mlme_obj * vdev_mlme)583 static inline QDF_STATUS mlme_vdev_notify_start_state_exit(
584 struct vdev_mlme_obj *vdev_mlme)
585 {
586 QDF_STATUS ret = QDF_STATUS_SUCCESS;
587
588 if ((vdev_mlme->ops) &&
589 vdev_mlme->ops->mlme_vdev_notify_start_state_exit)
590 ret = vdev_mlme->ops->mlme_vdev_notify_start_state_exit(
591 vdev_mlme);
592
593 return ret;
594 }
595
596 /**
597 * mlme_vdev_is_newchan_no_cac() - Checks new channel requires CAC
598 * @vdev_mlme: VDEV MLME comp object
599 *
600 * API checks whether Channel needs CAC period,
601 * if yes, it moves to SUSPEND_RESTART to disconnect stations before
602 * sending RESTART to FW, otherwise, it moves to RESTART_PROGRESS substate
603 *
604 * Return: SUCCESS to move to RESTART_PROGRESS substate
605 * FAILURE, move to SUSPEND_RESTART state
606 */
mlme_vdev_is_newchan_no_cac(struct vdev_mlme_obj * vdev_mlme)607 static inline QDF_STATUS mlme_vdev_is_newchan_no_cac(
608 struct vdev_mlme_obj *vdev_mlme)
609 {
610 QDF_STATUS ret = QDF_STATUS_SUCCESS;
611
612 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_is_newchan_no_cac)
613 ret = vdev_mlme->ops->mlme_vdev_is_newchan_no_cac(vdev_mlme);
614
615 return ret;
616 }
617
618 /**
619 * mlme_vdev_dfs_cac_wait_notify() - Notifies DFS CAC wait state
620 * @vdev_mlme: VDEV MLME comp object
621 *
622 * Return: NO_SUPPORT if the callback is not supported.
623 * SUCCESS if DFS CAC Wait notification handled by caller
624 */
mlme_vdev_dfs_cac_wait_notify(struct vdev_mlme_obj * vdev_mlme)625 static inline QDF_STATUS mlme_vdev_dfs_cac_wait_notify(
626 struct vdev_mlme_obj *vdev_mlme)
627 {
628 QDF_STATUS ret = QDF_STATUS_E_NOSUPPORT;
629
630 if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_dfs_cac_wait_notify)
631 ret = vdev_mlme->ops->mlme_vdev_dfs_cac_wait_notify(vdev_mlme);
632
633 return ret;
634 }
635
636 /**
637 * mlme_vdev_chan_switch_disable_notify_dfs() - Notifies DFS when channel
638 * switch is disabled
639 * @vdev_mlme: VDEV MLME comp object
640 *
641 * Return: QDF_STATUS.
642 */
mlme_vdev_chan_switch_disable_notify_dfs(struct vdev_mlme_obj * vdev_mlme)643 static inline QDF_STATUS mlme_vdev_chan_switch_disable_notify_dfs(
644 struct vdev_mlme_obj *vdev_mlme)
645 {
646 return utils_dfs_radar_enable(wlan_vdev_get_pdev(vdev_mlme->vdev));
647 }
648 #ifdef WLAN_FEATURE_11BE_MLO
649 /**
650 * mlme_vdev_up_notify_mlo_mgr() - notify mlo link is ready to up
651 * @vdev_mlme: VDEV MLME comp object
652 *
653 * Return: true if MLO_SYNC_COMPLETE is posted, else false
654 */
mlme_vdev_up_notify_mlo_mgr(struct vdev_mlme_obj * vdev_mlme)655 static inline bool mlme_vdev_up_notify_mlo_mgr(struct vdev_mlme_obj *vdev_mlme)
656 {
657 if (wlan_vdev_mlme_is_mlo_ap(vdev_mlme->vdev))
658 return mlo_ap_link_sync_wait_notify(vdev_mlme->vdev);
659
660 return true;
661 }
662
663 /**
664 * mlme_vdev_start_rsp_notify_mlo_mgr() - notify mlo link is started
665 * @vdev_mlme: VDEV MLME comp object
666 *
667 * Return: VOID.
668 */
mlme_vdev_start_rsp_notify_mlo_mgr(struct vdev_mlme_obj * vdev_mlme)669 static inline void mlme_vdev_start_rsp_notify_mlo_mgr(
670 struct vdev_mlme_obj *vdev_mlme)
671 {
672 if (wlan_vdev_mlme_is_mlo_ap(vdev_mlme->vdev))
673 mlo_ap_link_start_rsp_notify(vdev_mlme->vdev);
674 }
675
676 /**
677 * mlme_vdev_down_cmpl_notify_mlo_mgr() - notify mlo link is down complete
678 * @vdev_mlme: VDEV MLME comp object
679 *
680 * Return: VOID.
681 */
mlme_vdev_down_cmpl_notify_mlo_mgr(struct vdev_mlme_obj * vdev_mlme)682 static inline void mlme_vdev_down_cmpl_notify_mlo_mgr(
683 struct vdev_mlme_obj *vdev_mlme)
684 {
685 if (wlan_vdev_mlme_is_mlo_ap(vdev_mlme->vdev))
686 mlo_ap_link_down_cmpl_notify(vdev_mlme->vdev);
687 }
688
689 /**
690 * mlme_vdev_up_active_notify_mlo_mgr() - notify mlo link is up active
691 * @vdev_mlme: VDEV MLME comp object
692 *
693 * Return: VOID.
694 */
mlme_vdev_up_active_notify_mlo_mgr(struct vdev_mlme_obj * vdev_mlme)695 static inline void mlme_vdev_up_active_notify_mlo_mgr(
696 struct vdev_mlme_obj *vdev_mlme)
697 {
698 if ((wlan_vdev_mlme_get_opmode(vdev_mlme->vdev) == QDF_STA_MODE) &&
699 wlan_vdev_mlme_is_mlo_vdev(vdev_mlme->vdev))
700 mlo_sta_up_active_notify(vdev_mlme->vdev);
701 }
702
703 /**
704 * mlme_vdev_notify_mlo_sync_wait_entry() - Notifies mlo sync wait state
705 * @vdev_mlme: VDEV MLME comp object
706 *
707 * Return: NO_SUPPORT if the callback is not supported.
708 * SUCCESS if notification is handled by caller
709 */
mlme_vdev_notify_mlo_sync_wait_entry(struct vdev_mlme_obj * vdev_mlme)710 static inline QDF_STATUS mlme_vdev_notify_mlo_sync_wait_entry(
711 struct vdev_mlme_obj *vdev_mlme)
712 {
713 QDF_STATUS ret = QDF_STATUS_E_NOSUPPORT;
714
715 if (vdev_mlme->ops &&
716 vdev_mlme->ops->mlme_vdev_notify_mlo_sync_wait_entry)
717 ret = vdev_mlme->ops->mlme_vdev_notify_mlo_sync_wait_entry(
718 vdev_mlme);
719 return ret;
720 }
721 #else
mlme_vdev_up_notify_mlo_mgr(struct vdev_mlme_obj * vdev_mlme)722 static inline bool mlme_vdev_up_notify_mlo_mgr(struct vdev_mlme_obj *vdev_mlme)
723 {
724 return true;
725 }
726
mlme_vdev_start_rsp_notify_mlo_mgr(struct vdev_mlme_obj * vdev_mlme)727 static inline void mlme_vdev_start_rsp_notify_mlo_mgr(
728 struct vdev_mlme_obj *vdev_mlme)
729 {
730 }
731
mlme_vdev_down_cmpl_notify_mlo_mgr(struct vdev_mlme_obj * vdev_mlme)732 static inline void mlme_vdev_down_cmpl_notify_mlo_mgr(
733 struct vdev_mlme_obj *vdev_mlme)
734 {
735 }
736
mlme_vdev_up_active_notify_mlo_mgr(struct vdev_mlme_obj * vdev_mlme)737 static inline void mlme_vdev_up_active_notify_mlo_mgr(
738 struct vdev_mlme_obj *vdev_mlme)
739 {
740 }
741
mlme_vdev_notify_mlo_sync_wait_entry(struct vdev_mlme_obj * vdev_mlme)742 static inline QDF_STATUS mlme_vdev_notify_mlo_sync_wait_entry(
743 struct vdev_mlme_obj *vdev_mlme)
744 {
745 return QDF_STATUS_SUCCESS;
746 }
747 #endif
748
749 #ifdef VDEV_SM_LOCK_SUPPORT
750 /**
751 * mlme_vdev_sm_spinlock_create() - Create VDEV MLME spinlock
752 * @vdev_mlme: VDEV MLME comp object
753 *
754 * Creates VDEV MLME spinlock
755 *
756 * Return: void
757 */
mlme_vdev_sm_spinlock_create(struct vdev_mlme_obj * vdev_mlme)758 static inline void mlme_vdev_sm_spinlock_create(struct vdev_mlme_obj *vdev_mlme)
759 {
760 qdf_spinlock_create(&vdev_mlme->sm_lock);
761 }
762
763 /**
764 * mlme_vdev_sm_spinlock_destroy() - Destroy VDEV MLME spinlock
765 * @vdev_mlme: VDEV MLME comp object
766 *
767 * Destroy VDEV MLME spinlock
768 *
769 * Return: void
770 */
mlme_vdev_sm_spinlock_destroy(struct vdev_mlme_obj * vdev_mlme)771 static inline void mlme_vdev_sm_spinlock_destroy(
772 struct vdev_mlme_obj *vdev_mlme)
773 {
774 qdf_spinlock_destroy(&vdev_mlme->sm_lock);
775 }
776
777 /**
778 * mlme_vdev_sm_spin_lock() - acquire spinlock
779 * @vdev_mlme: vdev mlme comp object
780 *
781 * acquire vdev mlme spinlock
782 *
783 * return: void
784 */
mlme_vdev_sm_spin_lock(struct vdev_mlme_obj * vdev_mlme)785 static inline void mlme_vdev_sm_spin_lock(struct vdev_mlme_obj *vdev_mlme)
786 {
787 qdf_spin_lock_bh(&vdev_mlme->sm_lock);
788 }
789
790 /**
791 * mlme_vdev_sm_spin_unlock() - release spinlock
792 * @vdev_mlme: vdev mlme comp object
793 *
794 * release vdev mlme spinlock
795 *
796 * return: void
797 */
mlme_vdev_sm_spin_unlock(struct vdev_mlme_obj * vdev_mlme)798 static inline void mlme_vdev_sm_spin_unlock(struct vdev_mlme_obj *vdev_mlme)
799 {
800 qdf_spin_unlock_bh(&vdev_mlme->sm_lock);
801 }
802
803 /**
804 * mlme_vdev_cmd_mutex_create() - Create VDEV MLME cmd mutex
805 * @vdev_mlme: VDEV MLME comp object
806 *
807 * Creates VDEV MLME cmd mutex
808 *
809 * Return: void
810 */
811 static inline void
mlme_vdev_cmd_mutex_create(struct vdev_mlme_obj * vdev_mlme)812 mlme_vdev_cmd_mutex_create(struct vdev_mlme_obj *vdev_mlme)
813 {
814 qdf_mutex_create(&vdev_mlme->vdev_cmd_lock);
815 }
816
817 /**
818 * mlme_vdev_cmd_mutex_destroy() - Destroy VDEV MLME cmd mutex
819 * @vdev_mlme: VDEV MLME comp object
820 *
821 * Destroy VDEV MLME cmd mutex
822 *
823 * Return: void
824 */
825 static inline void
mlme_vdev_cmd_mutex_destroy(struct vdev_mlme_obj * vdev_mlme)826 mlme_vdev_cmd_mutex_destroy(struct vdev_mlme_obj *vdev_mlme)
827 {
828 qdf_mutex_destroy(&vdev_mlme->vdev_cmd_lock);
829 }
830
831 /**
832 * mlme_vdev_cmd_mutex_acquire() - acquire mutex
833 * @vdev_mlme: vdev mlme comp object
834 *
835 * acquire vdev mlme cmd mutex
836 *
837 * return: void
838 */
mlme_vdev_cmd_mutex_acquire(struct vdev_mlme_obj * vdev_mlme)839 static inline void mlme_vdev_cmd_mutex_acquire(struct vdev_mlme_obj *vdev_mlme)
840 {
841 qdf_mutex_acquire(&vdev_mlme->vdev_cmd_lock);
842 }
843
844 /**
845 * mlme_vdev_cmd_mutex_release() - release mutex
846 * @vdev_mlme: vdev mlme comp object
847 *
848 * release vdev mlme cmd mutex
849 *
850 * return: void
851 */
mlme_vdev_cmd_mutex_release(struct vdev_mlme_obj * vdev_mlme)852 static inline void mlme_vdev_cmd_mutex_release(struct vdev_mlme_obj *vdev_mlme)
853 {
854 qdf_mutex_release(&vdev_mlme->vdev_cmd_lock);
855 }
856
857 #else
mlme_vdev_sm_spinlock_create(struct vdev_mlme_obj * vdev_mlme)858 static inline void mlme_vdev_sm_spinlock_create(struct vdev_mlme_obj *vdev_mlme)
859 {
860 mlme_debug("VDEV SM lock is disabled!!!");
861 }
862
mlme_vdev_sm_spinlock_destroy(struct vdev_mlme_obj * vdev_mlme)863 static inline void mlme_vdev_sm_spinlock_destroy(
864 struct vdev_mlme_obj *vdev_mlme)
865 {
866 mlme_debug("VDEV SM lock is disabled!!!");
867 }
868
mlme_vdev_sm_spin_lock(struct vdev_mlme_obj * vdev_mlme)869 static inline void mlme_vdev_sm_spin_lock(struct vdev_mlme_obj *vdev_mlme)
870 {
871 }
872
mlme_vdev_sm_spin_unlock(struct vdev_mlme_obj * vdev_mlme)873 static inline void mlme_vdev_sm_spin_unlock(struct vdev_mlme_obj *vdev_mlme)
874 {
875 }
876
877 static inline void
mlme_vdev_cmd_mutex_create(struct vdev_mlme_obj * vdev_mlme)878 mlme_vdev_cmd_mutex_create(struct vdev_mlme_obj *vdev_mlme)
879 {
880 mlme_debug("VDEV CMD lock is disabled!!!");
881 }
882
883 static inline void
mlme_vdev_cmd_mutex_destroy(struct vdev_mlme_obj * vdev_mlme)884 mlme_vdev_cmd_mutex_destroy(struct vdev_mlme_obj *vdev_mlme)
885 {
886 mlme_debug("VDEV CMD lock is disabled!!!");
887 }
888
mlme_vdev_cmd_mutex_acquire(struct vdev_mlme_obj * vdev_mlme)889 static inline void mlme_vdev_cmd_mutex_acquire(struct vdev_mlme_obj *vdev_mlme)
890 {
891 }
892
mlme_vdev_cmd_mutex_release(struct vdev_mlme_obj * vdev_mlme)893 static inline void mlme_vdev_cmd_mutex_release(struct vdev_mlme_obj *vdev_mlme)
894 {
895 }
896 #endif
897