1 /*
2 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2021-2024 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 * DOC: define internal APIs related to the mlme component, legacy APIs are
21 * called for the time being, but will be cleaned up after convergence
22 */
23 #include "wlan_mlme_main.h"
24 #include "wlan_mlme_vdev_mgr_interface.h"
25 #include "lim_utils.h"
26 #include "wma_api.h"
27 #include "wma.h"
28 #include "lim_types.h"
29 #include <include/wlan_mlme_cmn.h>
30 #include <../../core/src/vdev_mgr_ops.h>
31 #include "wlan_psoc_mlme_api.h"
32 #include "target_if_cm_roam_offload.h"
33 #include "wlan_crypto_global_api.h"
34 #include "target_if_wfa_testcmd.h"
35 #include <../../core/src/wlan_cm_vdev_api.h>
36 #include "csr_api.h"
37 #include <cm_utf.h>
38 #include "target_if_cm_roam_event.h"
39 #include "wlan_cm_roam_api.h"
40 #include "wifi_pos_api.h"
41 #ifdef WLAN_FEATURE_11BE_MLO
42 #include <wlan_mlo_mgr_public_structs.h>
43 #include <wlan_mlo_mgr_cmn.h>
44 #include <lim_mlo.h>
45 #include "wlan_mlo_mgr_sta.h"
46 #endif
47 #include <wlan_lmac_if_def.h>
48 #include "target_if_mlme.h"
49 #include "wlan_mlo_mgr_sta.h"
50 #include "wlan_cp_stats_mc_tgt_api.h"
51 #include "wlan_objmgr_pdev_obj.h"
52
53 static struct vdev_mlme_ops sta_mlme_ops;
54 static struct vdev_mlme_ops ap_mlme_ops;
55 static struct vdev_mlme_ops mon_mlme_ops;
56 static struct mlme_ext_ops ext_ops;
57 #ifdef WLAN_FEATURE_11BE_MLO
58 static struct mlo_mlme_ext_ops mlo_ext_ops;
59 #endif
60
mlme_is_vdev_in_beaconning_mode(enum QDF_OPMODE vdev_opmode)61 bool mlme_is_vdev_in_beaconning_mode(enum QDF_OPMODE vdev_opmode)
62 {
63 switch (vdev_opmode) {
64 case QDF_SAP_MODE:
65 case QDF_P2P_GO_MODE:
66 case QDF_IBSS_MODE:
67 case QDF_NDI_MODE:
68 return true;
69 default:
70 return false;
71 }
72 }
73
74 /**
75 * mlme_get_global_ops() - Register ext global ops
76 *
77 * Return: ext_ops global ops
78 */
mlme_get_global_ops(void)79 static struct mlme_ext_ops *mlme_get_global_ops(void)
80 {
81 return &ext_ops;
82 }
83
mlme_register_mlme_ext_ops(void)84 QDF_STATUS mlme_register_mlme_ext_ops(void)
85 {
86 mlme_set_ops_register_cb(mlme_get_global_ops);
87
88 /* Overwrite with UTF cb if UTF enabled */
89 cm_utf_set_mlme_ops(mlme_get_global_ops());
90 return QDF_STATUS_SUCCESS;
91 }
92
93 #ifdef WLAN_FEATURE_11BE_MLO
mlme_register_mlo_ext_ops(void)94 QDF_STATUS mlme_register_mlo_ext_ops(void)
95 {
96 QDF_STATUS status;
97 struct mlo_mgr_context *mlo_ctx = wlan_objmgr_get_mlo_ctx();
98
99 if (!mlo_ctx)
100 return QDF_STATUS_E_FAILURE;
101
102 mlo_reg_mlme_ext_cb(mlo_ctx, &mlo_ext_ops);
103
104 status = mlo_mgr_register_link_switch_notifier(WLAN_UMAC_COMP_MLME,
105 wlan_cm_link_switch_notif_cb);
106 if (status == QDF_STATUS_E_NOSUPPORT) {
107 status = QDF_STATUS_SUCCESS;
108 mlme_debug("Link switch not supported");
109 } else if (QDF_IS_STATUS_ERROR(status)) {
110 mlme_err("Failed to register link switch notifier for mlme!");
111 }
112
113 return status;
114 }
115
mlme_unregister_mlo_ext_ops(void)116 QDF_STATUS mlme_unregister_mlo_ext_ops(void)
117 {
118 struct mlo_mgr_context *mlo_ctx = wlan_objmgr_get_mlo_ctx();
119
120 if (mlo_ctx)
121 mlo_unreg_mlme_ext_cb(mlo_ctx);
122
123 return QDF_STATUS_SUCCESS;
124 }
125 #else
mlme_register_mlo_ext_ops(void)126 QDF_STATUS mlme_register_mlo_ext_ops(void)
127 {
128 return QDF_STATUS_SUCCESS;
129 }
130
mlme_unregister_mlo_ext_ops(void)131 QDF_STATUS mlme_unregister_mlo_ext_ops(void)
132 {
133 return QDF_STATUS_SUCCESS;
134 }
135 #endif
136 /**
137 * mlme_register_vdev_mgr_ops() - Register vdev mgr ops
138 * @vdev_mlme: vdev mlme object
139 *
140 * This function is called to register vdev manager operations
141 *
142 * Return: QDF_STATUS
143 */
mlme_register_vdev_mgr_ops(struct vdev_mlme_obj * vdev_mlme)144 QDF_STATUS mlme_register_vdev_mgr_ops(struct vdev_mlme_obj *vdev_mlme)
145 {
146 struct wlan_objmgr_vdev *vdev;
147
148 vdev = vdev_mlme->vdev;
149
150 if (mlme_is_vdev_in_beaconning_mode(vdev->vdev_mlme.vdev_opmode))
151 vdev_mlme->ops = &ap_mlme_ops;
152 else if (vdev->vdev_mlme.vdev_opmode == QDF_MONITOR_MODE)
153 vdev_mlme->ops = &mon_mlme_ops;
154 else
155 vdev_mlme->ops = &sta_mlme_ops;
156
157 return QDF_STATUS_SUCCESS;
158 }
159
160 /**
161 * mlme_unregister_vdev_mgr_ops() - Unregister vdev mgr ops
162 * @vdev_mlme: vdev mlme object
163 *
164 * This function is called to unregister vdev manager operations
165 *
166 * Return: QDF_STATUS
167 */
mlme_unregister_vdev_mgr_ops(struct vdev_mlme_obj * vdev_mlme)168 QDF_STATUS mlme_unregister_vdev_mgr_ops(struct vdev_mlme_obj *vdev_mlme)
169 {
170 return QDF_STATUS_SUCCESS;
171 }
172
173 /**
174 * sta_mlme_vdev_start_send() - MLME vdev start callback
175 * @vdev_mlme: vdev mlme object
176 * @event_data_len: event data length
177 * @event_data: event data
178 *
179 * This function is called to initiate actions of VDEV.start
180 *
181 * Return: QDF_STATUS
182 */
sta_mlme_vdev_start_send(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)183 static QDF_STATUS sta_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme,
184 uint16_t event_data_len,
185 void *event_data)
186 {
187 mlme_legacy_debug("vdev id = %d ",
188 vdev_mlme->vdev->vdev_objmgr.vdev_id);
189 return lim_sta_mlme_vdev_start_send(vdev_mlme, event_data_len,
190 event_data);
191 }
192
193 /**
194 * sta_mlme_start_continue() - vdev start rsp callback
195 * @vdev_mlme: vdev mlme object
196 * @data_len: event data length
197 * @data: event data
198 *
199 * This function is called to handle the VDEV START/RESTART callback
200 *
201 * Return: QDF_STATUS
202 */
sta_mlme_start_continue(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)203 static QDF_STATUS sta_mlme_start_continue(struct vdev_mlme_obj *vdev_mlme,
204 uint16_t data_len, void *data)
205 {
206 mlme_legacy_debug("vdev id = %d ",
207 vdev_mlme->vdev->vdev_objmgr.vdev_id);
208 return wma_sta_mlme_vdev_start_continue(vdev_mlme, data_len, data);
209 }
210
211 /**
212 * sta_mlme_vdev_restart_send() - MLME vdev restart send
213 * @vdev_mlme: vdev mlme object
214 * @event_data_len: event data length
215 * @event_data: event data
216 *
217 * This function is called to initiate actions of VDEV.start
218 *
219 * Return: QDF_STATUS
220 */
sta_mlme_vdev_restart_send(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)221 static QDF_STATUS sta_mlme_vdev_restart_send(struct vdev_mlme_obj *vdev_mlme,
222 uint16_t event_data_len,
223 void *event_data)
224 {
225 mlme_legacy_debug("vdev id = %d ",
226 vdev_mlme->vdev->vdev_objmgr.vdev_id);
227 return lim_sta_mlme_vdev_restart_send(vdev_mlme, event_data_len,
228 event_data);
229 }
230
231 /**
232 * sta_mlme_vdev_start_req_failed() - MLME start fail callback
233 * @vdev_mlme: vdev mlme object
234 * @data_len: event data length
235 * @data: event data
236 *
237 * This function is called to send the vdev stop to firmware
238 *
239 * Return: QDF_STATUS
240 */
sta_mlme_vdev_start_req_failed(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)241 static QDF_STATUS sta_mlme_vdev_start_req_failed(struct vdev_mlme_obj *vdev_mlme,
242 uint16_t data_len,
243 void *data)
244 {
245 mlme_legacy_debug("vdev id = %d ",
246 vdev_mlme->vdev->vdev_objmgr.vdev_id);
247 return lim_sta_mlme_vdev_req_fail(vdev_mlme, data_len, data);
248 }
249
250 /**
251 * sta_mlme_vdev_start_connection() - MLME vdev start callback
252 * @vdev_mlme: vdev mlme object
253 * @event_data_len: event data length
254 * @event_data: event data
255 *
256 * This function is called to initiate actions of STA connection
257 *
258 * Return: QDF_STATUS
259 */
sta_mlme_vdev_start_connection(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)260 static QDF_STATUS sta_mlme_vdev_start_connection(struct vdev_mlme_obj *vdev_mlme,
261 uint16_t event_data_len,
262 void *event_data)
263 {
264 mlme_legacy_debug("vdev id = %d ",
265 vdev_mlme->vdev->vdev_objmgr.vdev_id);
266 return QDF_STATUS_SUCCESS;
267 }
268
269 #if defined WLAN_FEATURE_SR
mlme_sr_is_enable(struct wlan_objmgr_vdev * vdev)270 int mlme_sr_is_enable(struct wlan_objmgr_vdev *vdev)
271 {
272 uint8_t sr_ctrl;
273
274 sr_ctrl = wlan_vdev_mlme_get_sr_ctrl(vdev);
275 return (!sr_ctrl || !(sr_ctrl & NON_SRG_PD_SR_DISALLOWED) ||
276 (sr_ctrl & SRG_INFO_PRESENT));
277 }
278
279 /**
280 * mlme_sr_handle_conc(): Handle concurrency scenario i.e Single MAC
281 * concurrency is not supoprted for SR, Disable SR if it is enable on other
282 * VDEV and enable it back once the once the concurrent vdev is down.
283 *
284 * @vdev: object manager vdev
285 * @conc_vdev: cuncurrent vdev object
286 * @en_sr_curr_vdev: indicates spatial reuse enable/disable
287 *
288 */
289 static void
mlme_sr_handle_conc(struct wlan_objmgr_vdev * vdev,struct wlan_objmgr_vdev * conc_vdev,bool en_sr_curr_vdev)290 mlme_sr_handle_conc(struct wlan_objmgr_vdev *vdev,
291 struct wlan_objmgr_vdev *conc_vdev, bool en_sr_curr_vdev)
292 {
293 uint32_t val = 0;
294 struct wlan_objmgr_pdev *pdev;
295 struct wlan_objmgr_psoc *psoc;
296 struct wlan_lmac_if_tx_ops *tx_ops;
297 struct wlan_lmac_if_spatial_reuse_tx_ops *sr_tx_ops;
298 uint8_t conc_vdev_id = wlan_vdev_get_id(conc_vdev);
299
300 pdev = wlan_vdev_get_pdev(vdev);
301 if (!pdev) {
302 mlme_err("pdev is NULL");
303 return;
304 }
305
306 psoc = wlan_vdev_get_psoc(vdev);
307 tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
308 if (!tx_ops) {
309 mlme_err("tx_ops is NULL");
310 return;
311 }
312
313 sr_tx_ops = &tx_ops->spatial_reuse_tx_ops;
314 if (en_sr_curr_vdev) {
315 wlan_vdev_mlme_set_sr_disable_due_conc(vdev, true);
316 wlan_vdev_mlme_set_sr_disable_due_conc(conc_vdev, true);
317
318 if (!wlan_vdev_mlme_get_he_spr_enabled(conc_vdev))
319 return;
320
321 if (mlme_sr_is_enable(conc_vdev)) {
322 if (sr_tx_ops->target_if_sr_update)
323 sr_tx_ops->target_if_sr_update
324 (pdev, conc_vdev_id, val);
325
326 wlan_spatial_reuse_osif_event(conc_vdev,
327 SR_OPERATION_SUSPEND,
328 SR_REASON_CODE_CONCURRENCY);
329 }
330 } else if (wlan_vdev_mlme_is_sr_disable_due_conc(conc_vdev)) {
331 wlan_vdev_mlme_set_sr_disable_due_conc(conc_vdev, false);
332
333 if (!wlan_vdev_mlme_get_he_spr_enabled(conc_vdev))
334 return;
335
336 if (mlme_sr_is_enable(conc_vdev)) {
337 wlan_mlme_update_sr_data(conc_vdev, &val, 0, 0, true);
338
339 if (sr_tx_ops->target_if_sr_update)
340 sr_tx_ops->target_if_sr_update
341 (pdev, conc_vdev_id, val);
342
343 wlan_spatial_reuse_osif_event(conc_vdev,
344 SR_OPERATION_RESUME,
345 SR_REASON_CODE_CONCURRENCY);
346 } else {
347 mlme_debug("SR Disabled in SR Control");
348 }
349 }
350 }
351
mlme_sr_update(struct wlan_objmgr_vdev * vdev,bool enable)352 void mlme_sr_update(struct wlan_objmgr_vdev *vdev, bool enable)
353 {
354 struct wlan_objmgr_vdev *conc_vdev;
355 struct wlan_objmgr_psoc *psoc;
356 struct wlan_objmgr_pdev *pdev;
357 struct wlan_lmac_if_tx_ops *tx_ops;
358 uint32_t conc_vdev_id;
359 uint32_t val = 0;
360 uint8_t vdev_id;
361 uint8_t mac_id;
362
363 if (!vdev) {
364 mlme_err("vdev is NULL");
365 return;
366 }
367 vdev_id = wlan_vdev_get_id(vdev);
368
369 pdev = wlan_vdev_get_pdev(vdev);
370 if (!pdev) {
371 mlme_err("pdev is NULL");
372 return;
373 }
374
375 psoc = wlan_vdev_get_psoc(vdev);
376 if (!psoc) {
377 mlme_err("psoc is NULL");
378 return;
379 }
380
381 policy_mgr_get_mac_id_by_session_id(psoc, vdev_id, &mac_id);
382 conc_vdev_id = policy_mgr_get_conc_vdev_on_same_mac(psoc, vdev_id,
383 mac_id);
384 if (conc_vdev_id != WLAN_INVALID_VDEV_ID &&
385 !policy_mgr_sr_same_mac_conc_enabled(psoc)) {
386 /*
387 * Single MAC concurrency is not supoprted for SR,
388 * Disable SR if it is enable on other VDEV and enable
389 * it back once the once the concurrent vdev is down.
390 */
391 mlme_debug("SR with concurrency is not allowed");
392 conc_vdev =
393 wlan_objmgr_get_vdev_by_id_from_psoc(psoc, conc_vdev_id,
394 WLAN_MLME_SB_ID);
395 if (!conc_vdev) {
396 mlme_err("Can't get vdev by vdev_id:%d", conc_vdev_id);
397 } else {
398 mlme_sr_handle_conc(vdev, conc_vdev, enable);
399 wlan_objmgr_vdev_release_ref(conc_vdev,
400 WLAN_MLME_SB_ID);
401 goto err;
402 }
403 }
404
405 if (!wlan_vdev_mlme_get_he_spr_enabled(vdev)) {
406 mlme_err("Spatial Reuse disabled for vdev_id: %d", vdev_id);
407 goto err;
408 }
409
410 if (mlme_sr_is_enable(vdev)) {
411 if (enable) {
412 wlan_mlme_update_sr_data(vdev, &val, 0, 0, true);
413 } else {
414 /* VDEV down, disable SR */
415 wlan_vdev_mlme_set_he_spr_enabled(vdev, false);
416 wlan_vdev_mlme_set_sr_ctrl(vdev, 0);
417 wlan_vdev_mlme_set_non_srg_pd_offset(vdev, 0);
418 }
419
420 mlme_debug("SR param val: %x, Enable: %x", val, enable);
421
422 tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
423 if (tx_ops && tx_ops->spatial_reuse_tx_ops.target_if_sr_update)
424 tx_ops->spatial_reuse_tx_ops.target_if_sr_update
425 (pdev, vdev_id, val);
426 } else {
427 mlme_debug("Spatial reuse is disabled in SR control");
428 }
429 err:
430 return;
431 }
432 #endif
433
434 /**
435 * sta_mlme_vdev_up_send() - MLME vdev UP callback
436 * @vdev_mlme: vdev mlme object
437 * @event_data_len: event data length
438 * @event_data: event data
439 *
440 * This function is called to send the vdev up command
441 *
442 * Return: QDF_STATUS
443 */
sta_mlme_vdev_up_send(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)444 static QDF_STATUS sta_mlme_vdev_up_send(struct vdev_mlme_obj *vdev_mlme,
445 uint16_t event_data_len,
446 void *event_data)
447 {
448 QDF_STATUS status;
449
450 mlme_legacy_debug("vdev id = %d ",
451 vdev_mlme->vdev->vdev_objmgr.vdev_id);
452 status = wma_sta_vdev_up_send(vdev_mlme, event_data_len, event_data);
453
454 if (QDF_IS_STATUS_SUCCESS(status))
455 mlme_sr_update(vdev_mlme->vdev, true);
456
457 return status;
458 }
459
460 /**
461 * sta_mlme_vdev_notify_up_complete() - MLME vdev UP complete callback
462 * @vdev_mlme: vdev mlme object
463 * @event_data_len: event data length
464 * @event_data: event data
465 *
466 * This function is called to VDEV MLME on moving
467 * to UP state
468 *
469 * Return: QDF_STATUS
470 */
sta_mlme_vdev_notify_up_complete(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)471 static QDF_STATUS sta_mlme_vdev_notify_up_complete(struct vdev_mlme_obj *vdev_mlme,
472 uint16_t event_data_len,
473 void *event_data)
474 {
475 mlme_legacy_debug("vdev id = %d ",
476 vdev_mlme->vdev->vdev_objmgr.vdev_id);
477 return QDF_STATUS_SUCCESS;
478 }
479
480 /**
481 * sta_mlme_vdev_notify_roam_start() - MLME vdev Roam start callback
482 * @vdev_mlme: vdev mlme object
483 * @event_data_len: event data length
484 * @event_data: event data
485 *
486 * This function is called to VDEV MLME on roaming
487 * to UP state
488 *
489 * Return: QDF_STATUS
490 */
491 static
sta_mlme_vdev_notify_roam_start(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)492 QDF_STATUS sta_mlme_vdev_notify_roam_start(struct vdev_mlme_obj *vdev_mlme,
493 uint16_t event_data_len,
494 void *event_data)
495 {
496 mlme_legacy_debug("vdev id = %d ",
497 vdev_mlme->vdev->vdev_objmgr.vdev_id);
498 return wlan_cm_sta_mlme_vdev_roam_notify(vdev_mlme, event_data_len,
499 event_data);
500 }
501
502 /**
503 * sta_mlme_vdev_disconnect_bss() - MLME vdev disconnect bss callback
504 * @vdev_mlme: vdev mlme object
505 * @event_data_len: event data length
506 * @event_data: event data
507 * @is_disconnect_legacy_only: flag to indicate legacy disconnect
508 *
509 * This function is called to disconnect BSS/send deauth to AP
510 *
511 * Return: QDF_STATUS
512 */
sta_mlme_vdev_disconnect_bss(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data,bool is_disconnect_legacy_only)513 static QDF_STATUS sta_mlme_vdev_disconnect_bss(struct vdev_mlme_obj *vdev_mlme,
514 uint16_t event_data_len,
515 void *event_data,
516 bool is_disconnect_legacy_only)
517 {
518 mlme_legacy_debug("vdev id = %d ",
519 vdev_mlme->vdev->vdev_objmgr.vdev_id);
520 return lim_sta_mlme_vdev_disconnect_bss(vdev_mlme, event_data_len,
521 event_data);
522 }
523
524 /**
525 * sta_mlme_vdev_stop_send() - MLME vdev stop send callback
526 * @vdev_mlme: vdev mlme object
527 * @data_len: event data length
528 * @data: event data
529 *
530 * This function is called to send the vdev stop to firmware
531 *
532 * Return: QDF_STATUS
533 */
sta_mlme_vdev_stop_send(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)534 static QDF_STATUS sta_mlme_vdev_stop_send(struct vdev_mlme_obj *vdev_mlme,
535 uint16_t data_len,
536 void *data)
537 {
538 mlme_legacy_debug("vdev id = %d ",
539 vdev_mlme->vdev->vdev_objmgr.vdev_id);
540 return lim_sta_mlme_vdev_stop_send(vdev_mlme, data_len, data);
541 }
542
543 /**
544 * sta_mlme_vdev_sta_disconnect_start() - MLME vdev disconnect send callback
545 * @vdev_mlme: vdev mlme object
546 * @data_len: event data length
547 * @data: event data
548 *
549 * This function is called to trigger the vdev stop to firmware when
550 * reassoc failure
551 *
552 * Return: QDF_STATUS
553 */
554 static QDF_STATUS
sta_mlme_vdev_sta_disconnect_start(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)555 sta_mlme_vdev_sta_disconnect_start(struct vdev_mlme_obj *vdev_mlme,
556 uint16_t data_len, void *data)
557 {
558 mlme_legacy_debug("vdev id = %d ",
559 vdev_mlme->vdev->vdev_objmgr.vdev_id);
560 return lim_sta_mlme_vdev_sta_disconnect_start(vdev_mlme, data_len,
561 data);
562 }
563
564 /**
565 * vdevmgr_mlme_stop_continue() - MLME vdev stop send callback
566 * @vdev_mlme: vdev mlme object
567 * @data_len: event data length
568 * @data: event data
569 *
570 * This function is called to initiate operations on
571 * LMAC/FW stop response such as remove peer.
572 *
573 * Return: QDF_STATUS
574 */
vdevmgr_mlme_stop_continue(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)575 static QDF_STATUS vdevmgr_mlme_stop_continue(struct vdev_mlme_obj *vdev_mlme,
576 uint16_t data_len,
577 void *data)
578 {
579 mlme_legacy_debug("vdev id = %d ",
580 vdev_mlme->vdev->vdev_objmgr.vdev_id);
581 return wma_mlme_vdev_stop_continue(vdev_mlme, data_len, data);
582 }
583
584 /**
585 * ap_mlme_vdev_start_send () - send vdev start req
586 * @vdev_mlme: vdev mlme object
587 * @data_len: event data length
588 * @data: event data
589 *
590 * This function is called to initiate actions of VDEV start ie start bss
591 *
592 * Return: QDF_STATUS
593 */
ap_mlme_vdev_start_send(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)594 static QDF_STATUS ap_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme,
595 uint16_t data_len, void *data)
596 {
597 mlme_legacy_debug("vdev id = %d ",
598 vdev_mlme->vdev->vdev_objmgr.vdev_id);
599 return lim_ap_mlme_vdev_start_send(vdev_mlme, data_len, data);
600 }
601
602 /**
603 * ap_mlme_start_continue () - vdev start rsp callback
604 * @vdev_mlme: vdev mlme object
605 * @data_len: event data length
606 * @data: event data
607 *
608 * This function is called to handle the VDEV START/RESTART callback
609 *
610 * Return: QDF_STATUS
611 */
ap_mlme_start_continue(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)612 static QDF_STATUS ap_mlme_start_continue(struct vdev_mlme_obj *vdev_mlme,
613 uint16_t data_len, void *data)
614 {
615 mlme_legacy_debug("vdev id = %d ",
616 vdev_mlme->vdev->vdev_objmgr.vdev_id);
617 mlme_set_notify_co_located_ap_update_rnr(vdev_mlme->vdev, true);
618
619 return wma_ap_mlme_vdev_start_continue(vdev_mlme, data_len, data);
620 }
621
622 /**
623 * ap_mlme_vdev_update_beacon() - callback to initiate beacon update
624 * @vdev_mlme: vdev mlme object
625 * @op: beacon operation
626 * @data_len: event data length
627 * @data: event data
628 *
629 * This function is called to update beacon
630 *
631 * Return: QDF_STATUS
632 */
ap_mlme_vdev_update_beacon(struct vdev_mlme_obj * vdev_mlme,enum beacon_update_op op,uint16_t data_len,void * data)633 static QDF_STATUS ap_mlme_vdev_update_beacon(struct vdev_mlme_obj *vdev_mlme,
634 enum beacon_update_op op,
635 uint16_t data_len, void *data)
636 {
637 mlme_legacy_debug("vdev id = %d ",
638 vdev_mlme->vdev->vdev_objmgr.vdev_id);
639 return lim_ap_mlme_vdev_update_beacon(vdev_mlme, op, data_len, data);
640 }
641
642 /**
643 * ap_mlme_vdev_up_send() - callback to send vdev up
644 * @vdev_mlme: vdev mlme object
645 * @data_len: event data length
646 * @data: event data
647 *
648 * This function is called to send vdev up req
649 *
650 * Return: QDF_STATUS
651 */
ap_mlme_vdev_up_send(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)652 static QDF_STATUS ap_mlme_vdev_up_send(struct vdev_mlme_obj *vdev_mlme,
653 uint16_t data_len, void *data)
654 {
655 mlme_legacy_debug("vdev id = %d ",
656 vdev_mlme->vdev->vdev_objmgr.vdev_id);
657 return lim_ap_mlme_vdev_up_send(vdev_mlme, data_len, data);
658 }
659
660 #ifdef WLAN_FEATURE_11BE_MLO
wlan_handle_emlsr_sta_concurrency(struct wlan_objmgr_psoc * psoc,bool conc_con_coming_up,bool emlsr_sta_coming_up)661 void wlan_handle_emlsr_sta_concurrency(struct wlan_objmgr_psoc *psoc,
662 bool conc_con_coming_up,
663 bool emlsr_sta_coming_up)
664 {
665 policy_mgr_handle_emlsr_sta_concurrency(psoc, conc_con_coming_up,
666 emlsr_sta_coming_up);
667 }
668 #endif
669
670 /**
671 * ap_mlme_vdev_notify_up_complete() - callback to notify up completion
672 * @vdev_mlme: vdev mlme object
673 * @data_len: event data length
674 * @data: event data
675 *
676 * This function is called to indicate up is completed
677 *
678 * Return: QDF_STATUS
679 */
680 static QDF_STATUS
ap_mlme_vdev_notify_up_complete(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)681 ap_mlme_vdev_notify_up_complete(struct vdev_mlme_obj *vdev_mlme,
682 uint16_t data_len, void *data)
683 {
684 if (!vdev_mlme) {
685 mlme_legacy_err("data is NULL");
686 return QDF_STATUS_E_INVAL;
687 }
688
689 pe_debug("Vdev %d is up", wlan_vdev_get_id(vdev_mlme->vdev));
690
691 return QDF_STATUS_SUCCESS;
692 }
693
694 /**
695 * ap_mlme_vdev_disconnect_peers() - callback to disconnect all connected peers
696 * @vdev_mlme: vdev mlme object
697 * @data_len: event data length
698 * @data: event data
699 * @is_disconnect_legacy_only: flag to indicate is disconnect legacy
700 *
701 * This function is called to disconnect all connected peers
702 *
703 * Return: QDF_STATUS
704 */
ap_mlme_vdev_disconnect_peers(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data,bool is_disconnect_legacy_only)705 static QDF_STATUS ap_mlme_vdev_disconnect_peers(struct vdev_mlme_obj *vdev_mlme,
706 uint16_t data_len, void *data,
707 bool is_disconnect_legacy_only)
708 {
709 mlme_legacy_debug("vdev id = %d ",
710 vdev_mlme->vdev->vdev_objmgr.vdev_id);
711 return lim_ap_mlme_vdev_disconnect_peers(vdev_mlme, data_len, data);
712 }
713
714 /**
715 * ap_mlme_vdev_stop_send() - callback to send stop vdev request
716 * @vdev_mlme: vdev mlme object
717 * @data_len: event data length
718 * @data: event data
719 *
720 * This function is called to send stop vdev request
721 *
722 * Return: QDF_STATUS
723 */
ap_mlme_vdev_stop_send(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)724 static QDF_STATUS ap_mlme_vdev_stop_send(struct vdev_mlme_obj *vdev_mlme,
725 uint16_t data_len, void *data)
726 {
727 mlme_legacy_debug("vdev id = %d ",
728 vdev_mlme->vdev->vdev_objmgr.vdev_id);
729 return lim_ap_mlme_vdev_stop_send(vdev_mlme, data_len, data);
730 }
731
732 /**
733 * ap_mlme_vdev_is_newchan_no_cac - VDEV SM CSA complete notification
734 * @vdev_mlme: VDEV MLME comp object
735 *
736 * On CSA complete, checks whether Channel does not needs CAC period, if
737 * it doesn't need cac return SUCCESS else FAILURE
738 *
739 * Return: SUCCESS if new channel doesn't need cac
740 * else FAILURE
741 */
742 static QDF_STATUS
ap_mlme_vdev_is_newchan_no_cac(struct vdev_mlme_obj * vdev_mlme)743 ap_mlme_vdev_is_newchan_no_cac(struct vdev_mlme_obj *vdev_mlme)
744 {
745 bool cac_required;
746
747 cac_required = mlme_get_cac_required(vdev_mlme->vdev);
748 mlme_legacy_debug("vdev id = %d cac_required %d",
749 vdev_mlme->vdev->vdev_objmgr.vdev_id, cac_required);
750
751 if (!cac_required)
752 return QDF_STATUS_SUCCESS;
753
754 mlme_set_cac_required(vdev_mlme->vdev, false);
755
756 return QDF_STATUS_E_FAILURE;
757 }
758
759 /**
760 * vdevmgr_mlme_vdev_down_send() - callback to send vdev down req
761 * @vdev_mlme: vdev mlme object
762 * @data_len: event data length
763 * @data: event data
764 *
765 * This function is called to send vdev down req
766 *
767 * Return: QDF_STATUS
768 */
vdevmgr_mlme_vdev_down_send(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)769 static QDF_STATUS vdevmgr_mlme_vdev_down_send(struct vdev_mlme_obj *vdev_mlme,
770 uint16_t data_len, void *data)
771 {
772 QDF_STATUS status;
773 uint8_t vdev_id;
774
775 vdev_id = wlan_vdev_get_id(vdev_mlme->vdev);
776
777 mlme_legacy_debug("vdev id = %d ", vdev_id);
778 status = wma_ap_mlme_vdev_down_send(vdev_mlme, data_len, data);
779 if (QDF_IS_STATUS_SUCCESS(status))
780 mlme_sr_update(vdev_mlme->vdev, false);
781
782 return status;
783 }
784
785 /**
786 * vdevmgr_notify_down_complete() - callback to indicate vdev down is completed
787 * @vdev_mlme: vdev mlme object
788 * @data_len: event data length
789 * @data: event data
790 *
791 * This function is called to indicate vdev down is completed
792 *
793 * Return: QDF_STATUS
794 */
vdevmgr_notify_down_complete(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)795 static QDF_STATUS vdevmgr_notify_down_complete(struct vdev_mlme_obj *vdev_mlme,
796 uint16_t data_len, void *data)
797 {
798 mlme_legacy_debug("vdev id = %d ",
799 vdev_mlme->vdev->vdev_objmgr.vdev_id);
800
801 return wma_mlme_vdev_notify_down_complete(vdev_mlme, data_len, data);
802 }
803
804 /**
805 * ap_mlme_vdev_start_req_failed () - vdev start req fail callback
806 * @vdev_mlme: vdev mlme object
807 * @data_len: event data length
808 * @data: event data
809 *
810 * This function is called to handle vdev start req/rsp failure
811 *
812 * Return: QDF_STATUS
813 */
ap_mlme_vdev_start_req_failed(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)814 static QDF_STATUS ap_mlme_vdev_start_req_failed(struct vdev_mlme_obj *vdev_mlme,
815 uint16_t data_len, void *data)
816 {
817 mlme_legacy_debug("vdev id = %d ",
818 vdev_mlme->vdev->vdev_objmgr.vdev_id);
819 return lim_ap_mlme_vdev_start_req_failed(vdev_mlme, data_len, data);
820 }
821
822 /**
823 * ap_mlme_vdev_restart_send() - a callback to send vdev restart
824 * @vdev_mlme: vdev mlme object
825 * @data_len: event data length
826 * @data: event data
827 *
828 * This function is called to initiate and send vdev restart req
829 *
830 * Return: QDF_STATUS
831 */
ap_mlme_vdev_restart_send(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)832 static QDF_STATUS ap_mlme_vdev_restart_send(struct vdev_mlme_obj *vdev_mlme,
833 uint16_t data_len, void *data)
834 {
835 mlme_legacy_debug("vdev id = %d ",
836 vdev_mlme->vdev->vdev_objmgr.vdev_id);
837 return lim_ap_mlme_vdev_restart_send(vdev_mlme, data_len, data);
838 }
839
840 /**
841 * ap_mlme_vdev_stop_start_send() - handle vdev stop during start req
842 * @vdev_mlme: vdev mlme object
843 * @type: restart req or start req
844 * @data_len: event data length
845 * @data: event data
846 *
847 * This function is called to handle vdev stop during start req
848 *
849 * Return: QDF_STATUS
850 */
ap_mlme_vdev_stop_start_send(struct vdev_mlme_obj * vdev_mlme,enum vdev_cmd_type type,uint16_t data_len,void * data)851 static QDF_STATUS ap_mlme_vdev_stop_start_send(struct vdev_mlme_obj *vdev_mlme,
852 enum vdev_cmd_type type,
853 uint16_t data_len, void *data)
854 {
855 mlme_legacy_debug("vdev id = %d ",
856 vdev_mlme->vdev->vdev_objmgr.vdev_id);
857 return wma_ap_mlme_vdev_stop_start_send(vdev_mlme, type,
858 data_len, data);
859 }
860
mlme_set_chan_switch_in_progress(struct wlan_objmgr_vdev * vdev,bool val)861 QDF_STATUS mlme_set_chan_switch_in_progress(struct wlan_objmgr_vdev *vdev,
862 bool val)
863 {
864 struct mlme_legacy_priv *mlme_priv;
865
866 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
867 if (!mlme_priv) {
868 mlme_legacy_err("vdev legacy private object is NULL");
869 return QDF_STATUS_E_FAILURE;
870 }
871
872 mlme_priv->chan_switch_in_progress = val;
873 mlo_set_chan_switch_in_progress(vdev, val);
874
875 mlme_legacy_info("Set chan_switch_in_progress: %d vdev %d",
876 val, wlan_vdev_get_id(vdev));
877
878 return QDF_STATUS_SUCCESS;
879 }
880
881 #ifdef WLAN_FEATURE_MSCS
mlme_set_is_mscs_req_sent(struct wlan_objmgr_vdev * vdev,bool val)882 QDF_STATUS mlme_set_is_mscs_req_sent(struct wlan_objmgr_vdev *vdev, bool val)
883 {
884 struct mlme_legacy_priv *mlme_priv;
885
886 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
887 if (!mlme_priv) {
888 mlme_legacy_err("vdev legacy private object is NULL");
889 return QDF_STATUS_E_FAILURE;
890 }
891
892 mlme_priv->mscs_req_info.is_mscs_req_sent = val;
893
894 return QDF_STATUS_SUCCESS;
895 }
896
mlme_get_is_mscs_req_sent(struct wlan_objmgr_vdev * vdev)897 bool mlme_get_is_mscs_req_sent(struct wlan_objmgr_vdev *vdev)
898 {
899 struct mlme_legacy_priv *mlme_priv;
900
901 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
902 if (!mlme_priv) {
903 mlme_legacy_err("vdev legacy private object is NULL");
904 return false;
905 }
906
907 return mlme_priv->mscs_req_info.is_mscs_req_sent;
908 }
909 #endif
910
mlme_is_chan_switch_in_progress(struct wlan_objmgr_vdev * vdev)911 bool mlme_is_chan_switch_in_progress(struct wlan_objmgr_vdev *vdev)
912 {
913 struct mlme_legacy_priv *mlme_priv;
914
915 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
916 if (!mlme_priv) {
917 mlme_legacy_err("vdev legacy private object is NULL");
918 return false;
919 }
920
921 return mlme_priv->chan_switch_in_progress;
922 }
923
924 QDF_STATUS
ap_mlme_set_hidden_ssid_restart_in_progress(struct wlan_objmgr_vdev * vdev,bool val)925 ap_mlme_set_hidden_ssid_restart_in_progress(struct wlan_objmgr_vdev *vdev,
926 bool val)
927 {
928 struct mlme_legacy_priv *mlme_priv;
929
930 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
931 if (!mlme_priv) {
932 mlme_legacy_err("vdev legacy private object is NULL");
933 return QDF_STATUS_E_FAILURE;
934 }
935
936 mlme_priv->hidden_ssid_restart_in_progress = val;
937
938 return QDF_STATUS_SUCCESS;
939 }
940
ap_mlme_is_hidden_ssid_restart_in_progress(struct wlan_objmgr_vdev * vdev)941 bool ap_mlme_is_hidden_ssid_restart_in_progress(struct wlan_objmgr_vdev *vdev)
942 {
943 struct mlme_legacy_priv *mlme_priv;
944
945 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
946 if (!mlme_priv) {
947 mlme_legacy_err("vdev legacy private object is NULL");
948 return false;
949 }
950
951 return mlme_priv->hidden_ssid_restart_in_progress;
952 }
953
mlme_set_bigtk_support(struct wlan_objmgr_vdev * vdev,bool val)954 QDF_STATUS mlme_set_bigtk_support(struct wlan_objmgr_vdev *vdev, bool val)
955 {
956 struct mlme_legacy_priv *mlme_priv;
957
958 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
959 if (!mlme_priv) {
960 mlme_legacy_err("vdev legacy private object is NULL");
961 return QDF_STATUS_E_FAILURE;
962 }
963
964 mlme_priv->bigtk_vdev_support = val;
965
966 return QDF_STATUS_SUCCESS;
967 }
968
mlme_get_bigtk_support(struct wlan_objmgr_vdev * vdev)969 bool mlme_get_bigtk_support(struct wlan_objmgr_vdev *vdev)
970 {
971 struct mlme_legacy_priv *mlme_priv;
972
973 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
974 if (!mlme_priv) {
975 mlme_legacy_err("vdev legacy private object is NULL");
976 return false;
977 }
978
979 return mlme_priv->bigtk_vdev_support;
980 }
981
982 #ifdef FEATURE_WLAN_TDLS
983 QDF_STATUS
mlme_set_tdls_chan_switch_prohibited(struct wlan_objmgr_vdev * vdev,bool val)984 mlme_set_tdls_chan_switch_prohibited(struct wlan_objmgr_vdev *vdev, bool val)
985 {
986 struct mlme_legacy_priv *mlme_priv;
987
988 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
989 if (!mlme_priv) {
990 mlme_legacy_err("vdev legacy private object is NULL");
991 return QDF_STATUS_E_FAILURE;
992 }
993
994 mlme_priv->connect_info.tdls_chan_swit_prohibited = val;
995
996 return QDF_STATUS_SUCCESS;
997 }
998
mlme_get_tdls_chan_switch_prohibited(struct wlan_objmgr_vdev * vdev)999 bool mlme_get_tdls_chan_switch_prohibited(struct wlan_objmgr_vdev *vdev)
1000 {
1001 struct mlme_legacy_priv *mlme_priv;
1002
1003 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1004 if (!mlme_priv) {
1005 mlme_legacy_err("vdev legacy private object is NULL");
1006 return false;
1007 }
1008
1009 return mlme_priv->connect_info.tdls_chan_swit_prohibited;
1010 }
1011
1012 QDF_STATUS
mlme_set_tdls_prohibited(struct wlan_objmgr_vdev * vdev,bool val)1013 mlme_set_tdls_prohibited(struct wlan_objmgr_vdev *vdev, bool val)
1014 {
1015 struct mlme_legacy_priv *mlme_priv;
1016
1017 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1018 if (!mlme_priv) {
1019 mlme_legacy_err("vdev legacy private object is NULL");
1020 return QDF_STATUS_E_FAILURE;
1021 }
1022
1023 mlme_priv->connect_info.tdls_prohibited = val;
1024
1025 return QDF_STATUS_SUCCESS;
1026 }
1027
mlme_get_tdls_prohibited(struct wlan_objmgr_vdev * vdev)1028 bool mlme_get_tdls_prohibited(struct wlan_objmgr_vdev *vdev)
1029 {
1030 struct mlme_legacy_priv *mlme_priv;
1031
1032 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1033 if (!mlme_priv) {
1034 mlme_legacy_err("vdev legacy private object is NULL");
1035 return false;
1036 }
1037
1038 return mlme_priv->connect_info.tdls_prohibited;
1039 }
1040 #endif
1041
1042 QDF_STATUS
mlme_set_roam_reason_better_ap(struct wlan_objmgr_vdev * vdev,bool val)1043 mlme_set_roam_reason_better_ap(struct wlan_objmgr_vdev *vdev, bool val)
1044 {
1045 struct mlme_legacy_priv *mlme_priv;
1046
1047 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1048 if (!mlme_priv) {
1049 mlme_legacy_err("vdev legacy private object is NULL");
1050 return QDF_STATUS_E_FAILURE;
1051 }
1052
1053 mlme_priv->roam_reason_better_ap = val;
1054
1055 return QDF_STATUS_SUCCESS;
1056 }
1057
mlme_get_roam_reason_better_ap(struct wlan_objmgr_vdev * vdev)1058 bool mlme_get_roam_reason_better_ap(struct wlan_objmgr_vdev *vdev)
1059 {
1060 struct mlme_legacy_priv *mlme_priv;
1061
1062 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1063 if (!mlme_priv) {
1064 mlme_legacy_err("vdev legacy private object is NULL");
1065 return false;
1066 }
1067
1068 return mlme_priv->roam_reason_better_ap;
1069 }
1070
1071 QDF_STATUS
mlme_set_hb_ap_rssi(struct wlan_objmgr_vdev * vdev,uint32_t val)1072 mlme_set_hb_ap_rssi(struct wlan_objmgr_vdev *vdev, uint32_t val)
1073 {
1074 struct mlme_legacy_priv *mlme_priv;
1075
1076 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1077 if (!mlme_priv) {
1078 mlme_legacy_err("vdev legacy private object is NULL");
1079 return QDF_STATUS_E_FAILURE;
1080 }
1081
1082 mlme_priv->hb_failure_rssi = val;
1083
1084 return QDF_STATUS_SUCCESS;
1085 }
1086
mlme_get_hb_ap_rssi(struct wlan_objmgr_vdev * vdev)1087 uint32_t mlme_get_hb_ap_rssi(struct wlan_objmgr_vdev *vdev)
1088 {
1089 struct mlme_legacy_priv *mlme_priv;
1090
1091 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1092 if (!mlme_priv) {
1093 mlme_legacy_err("vdev legacy private object is NULL");
1094 return 0;
1095 }
1096
1097 return mlme_priv->hb_failure_rssi;
1098 }
1099
1100
mlme_set_connection_fail(struct wlan_objmgr_vdev * vdev,bool val)1101 QDF_STATUS mlme_set_connection_fail(struct wlan_objmgr_vdev *vdev, bool val)
1102 {
1103 struct mlme_legacy_priv *mlme_priv;
1104
1105 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1106 if (!mlme_priv) {
1107 mlme_legacy_err("vdev legacy private object is NULL");
1108 return QDF_STATUS_E_FAILURE;
1109 }
1110
1111 mlme_priv->connection_fail = val;
1112
1113 return QDF_STATUS_SUCCESS;
1114 }
1115
mlme_is_connection_fail(struct wlan_objmgr_vdev * vdev)1116 bool mlme_is_connection_fail(struct wlan_objmgr_vdev *vdev)
1117 {
1118 struct mlme_legacy_priv *mlme_priv;
1119
1120 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1121 if (!mlme_priv) {
1122 mlme_legacy_err("vdev legacy private object is NULL");
1123 return false;
1124 }
1125
1126 return mlme_priv->connection_fail;
1127 }
1128
1129 #ifdef FEATURE_WLAN_WAPI
mlme_is_sta_vdev_wapi(struct wlan_objmgr_pdev * pdev,void * object,void * arg)1130 static void mlme_is_sta_vdev_wapi(struct wlan_objmgr_pdev *pdev,
1131 void *object, void *arg)
1132 {
1133 struct wlan_objmgr_vdev *vdev = (struct wlan_objmgr_vdev *)object;
1134 int32_t keymgmt;
1135 bool *is_wapi_sta_exist = (bool *)arg;
1136 QDF_STATUS status;
1137
1138 if (*is_wapi_sta_exist)
1139 return;
1140 if (wlan_vdev_mlme_get_opmode(vdev) != QDF_STA_MODE)
1141 return;
1142
1143 status = wlan_vdev_is_up(vdev);
1144 if (QDF_IS_STATUS_ERROR(status))
1145 return;
1146
1147 keymgmt = wlan_crypto_get_param(vdev, WLAN_CRYPTO_PARAM_KEY_MGMT);
1148 if (keymgmt < 0)
1149 return;
1150
1151 if (keymgmt & ((1 << WLAN_CRYPTO_KEY_MGMT_WAPI_PSK) |
1152 (1 << WLAN_CRYPTO_KEY_MGMT_WAPI_CERT))) {
1153 *is_wapi_sta_exist = true;
1154 mlme_debug("wapi exist for Vdev: %d",
1155 wlan_vdev_get_id(vdev));
1156 }
1157 }
1158
mlme_is_wapi_sta_active(struct wlan_objmgr_pdev * pdev)1159 bool mlme_is_wapi_sta_active(struct wlan_objmgr_pdev *pdev)
1160 {
1161 bool is_wapi_sta_exist = false;
1162
1163 wlan_objmgr_pdev_iterate_obj_list(pdev,
1164 WLAN_VDEV_OP,
1165 mlme_is_sta_vdev_wapi,
1166 &is_wapi_sta_exist, 0,
1167 WLAN_MLME_OBJMGR_ID);
1168
1169 return is_wapi_sta_exist;
1170 }
1171 #endif
1172
mlme_set_assoc_type(struct wlan_objmgr_vdev * vdev,enum vdev_assoc_type assoc_type)1173 QDF_STATUS mlme_set_assoc_type(struct wlan_objmgr_vdev *vdev,
1174 enum vdev_assoc_type assoc_type)
1175 {
1176 struct mlme_legacy_priv *mlme_priv;
1177
1178 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1179 if (!mlme_priv) {
1180 mlme_legacy_err("vdev legacy private object is NULL");
1181 return QDF_STATUS_E_FAILURE;
1182 }
1183
1184 mlme_priv->assoc_type = assoc_type;
1185
1186 return QDF_STATUS_SUCCESS;
1187 }
1188
mlme_get_vdev_stop_type(struct wlan_objmgr_vdev * vdev,uint32_t * vdev_stop_type)1189 QDF_STATUS mlme_get_vdev_stop_type(struct wlan_objmgr_vdev *vdev,
1190 uint32_t *vdev_stop_type)
1191 {
1192 struct mlme_legacy_priv *mlme_priv;
1193
1194 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1195 if (!mlme_priv) {
1196 mlme_legacy_err("vdev legacy private object is NULL");
1197 return QDF_STATUS_E_FAILURE;
1198 }
1199
1200 *vdev_stop_type = mlme_priv->vdev_stop_type;
1201
1202 return QDF_STATUS_SUCCESS;
1203 }
1204
mlme_set_vdev_stop_type(struct wlan_objmgr_vdev * vdev,uint32_t vdev_stop_type)1205 QDF_STATUS mlme_set_vdev_stop_type(struct wlan_objmgr_vdev *vdev,
1206 uint32_t vdev_stop_type)
1207 {
1208 struct mlme_legacy_priv *mlme_priv;
1209
1210 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1211 if (!mlme_priv) {
1212 mlme_legacy_err("vdev legacy private object is NULL");
1213 return QDF_STATUS_E_FAILURE;
1214 }
1215
1216 mlme_priv->vdev_stop_type = vdev_stop_type;
1217
1218 return QDF_STATUS_SUCCESS;
1219 }
1220
mlme_set_notify_co_located_ap_update_rnr(struct wlan_objmgr_vdev * vdev,bool upt_rnr)1221 void mlme_set_notify_co_located_ap_update_rnr(struct wlan_objmgr_vdev *vdev,
1222 bool upt_rnr)
1223 {
1224 struct mlme_legacy_priv *mlme_priv;
1225
1226 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1227 if (!mlme_priv) {
1228 mlme_legacy_err("vdev legacy private object is NULL");
1229 return;
1230 }
1231
1232 mlme_priv->notify_co_located_ap_upt_rnr = upt_rnr;
1233 }
1234
mlme_is_notify_co_located_ap_update_rnr(struct wlan_objmgr_vdev * vdev)1235 bool mlme_is_notify_co_located_ap_update_rnr(struct wlan_objmgr_vdev *vdev)
1236 {
1237 struct mlme_legacy_priv *mlme_priv;
1238
1239 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1240 if (!mlme_priv) {
1241 mlme_legacy_err("vdev legacy private object is NULL");
1242 return false;
1243 }
1244
1245 return mlme_priv->notify_co_located_ap_upt_rnr;
1246 }
1247
wlan_is_vdev_traffic_ll_ht(struct wlan_objmgr_vdev * vdev)1248 bool wlan_is_vdev_traffic_ll_ht(struct wlan_objmgr_vdev *vdev)
1249 {
1250 struct mlme_legacy_priv *mlme_priv;
1251
1252 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1253 if (!mlme_priv) {
1254 mlme_legacy_err("vdev legacy private object is NULL");
1255 return false;
1256 }
1257
1258 if (mlme_priv->vdev_traffic_type & PM_VDEV_TRAFFIC_LOW_LATENCY ||
1259 mlme_priv->vdev_traffic_type & PM_VDEV_TRAFFIC_HIGH_TPUT)
1260 return true;
1261
1262 return false;
1263 }
1264
mlme_get_vdev_wifi_std(struct wlan_objmgr_vdev * vdev)1265 WMI_HOST_WIFI_STANDARD mlme_get_vdev_wifi_std(struct wlan_objmgr_vdev *vdev)
1266 {
1267 struct mlme_legacy_priv *mlme_priv;
1268
1269 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1270 if (!mlme_priv) {
1271 mlme_legacy_err("vdev legacy private object is NULL");
1272 return WMI_HOST_WIFI_STANDARD_7;
1273 }
1274
1275 if (!mlme_priv->is_user_std_set)
1276 return WMI_HOST_WIFI_STANDARD_7;
1277
1278 return mlme_priv->wifi_std;
1279 }
1280
mlme_get_assoc_type(struct wlan_objmgr_vdev * vdev)1281 enum vdev_assoc_type mlme_get_assoc_type(struct wlan_objmgr_vdev *vdev)
1282 {
1283 struct mlme_legacy_priv *mlme_priv;
1284
1285 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1286 if (!mlme_priv) {
1287 mlme_legacy_err("vdev legacy private object is NULL");
1288 return false;
1289 }
1290
1291 return mlme_priv->assoc_type;
1292 }
1293
1294 QDF_STATUS
mlme_set_vdev_start_failed(struct wlan_objmgr_vdev * vdev,bool val)1295 mlme_set_vdev_start_failed(struct wlan_objmgr_vdev *vdev, bool val)
1296 {
1297 struct mlme_legacy_priv *mlme_priv;
1298
1299 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1300 if (!mlme_priv) {
1301 mlme_legacy_err("vdev legacy private object is NULL");
1302 return QDF_STATUS_E_FAILURE;
1303 }
1304
1305 mlme_priv->vdev_start_failed = val;
1306
1307 return QDF_STATUS_SUCCESS;
1308 }
1309
mlme_get_vdev_start_failed(struct wlan_objmgr_vdev * vdev)1310 bool mlme_get_vdev_start_failed(struct wlan_objmgr_vdev *vdev)
1311 {
1312 struct mlme_legacy_priv *mlme_priv;
1313
1314 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1315 if (!mlme_priv) {
1316 mlme_legacy_err("vdev legacy private object is NULL");
1317 return false;
1318 }
1319
1320 return mlme_priv->vdev_start_failed;
1321 }
1322
mlme_set_cac_required(struct wlan_objmgr_vdev * vdev,bool val)1323 QDF_STATUS mlme_set_cac_required(struct wlan_objmgr_vdev *vdev, bool val)
1324 {
1325 struct mlme_legacy_priv *mlme_priv;
1326
1327 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1328 if (!mlme_priv) {
1329 mlme_legacy_err("vdev legacy private object is NULL");
1330 return QDF_STATUS_E_FAILURE;
1331 }
1332
1333 mlme_priv->cac_required_for_new_channel = val;
1334
1335 return QDF_STATUS_SUCCESS;
1336 }
1337
mlme_get_cac_required(struct wlan_objmgr_vdev * vdev)1338 bool mlme_get_cac_required(struct wlan_objmgr_vdev *vdev)
1339 {
1340 struct mlme_legacy_priv *mlme_priv;
1341
1342 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1343 if (!mlme_priv) {
1344 mlme_legacy_err("vdev legacy private object is NULL");
1345 return false;
1346 }
1347
1348 return mlme_priv->cac_required_for_new_channel;
1349 }
1350
mlme_set_mbssid_info(struct wlan_objmgr_vdev * vdev,struct scan_mbssid_info * mbssid_info,qdf_freq_t freq)1351 QDF_STATUS mlme_set_mbssid_info(struct wlan_objmgr_vdev *vdev,
1352 struct scan_mbssid_info *mbssid_info,
1353 qdf_freq_t freq)
1354 {
1355 struct vdev_mlme_obj *vdev_mlme;
1356 struct vdev_mlme_mbss_11ax *mbss_11ax;
1357 struct qdf_mac_addr bssid;
1358 struct qdf_mac_addr bcast_addr = QDF_MAC_ADDR_BCAST_INIT;
1359
1360 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1361 if (!vdev_mlme) {
1362 mlme_legacy_err("vdev component object is NULL");
1363 return QDF_STATUS_E_FAILURE;
1364 }
1365
1366 mbss_11ax = &vdev_mlme->mgmt.mbss_11ax;
1367 mbss_11ax->profile_idx = mbssid_info->profile_num;
1368 mbss_11ax->profile_num = mbssid_info->profile_count;
1369 qdf_mem_copy(mbss_11ax->trans_bssid,
1370 mbssid_info->trans_bssid, QDF_MAC_ADDR_SIZE);
1371 qdf_mem_copy(mbss_11ax->non_trans_bssid,
1372 mbssid_info->non_trans_bssid, QDF_MAC_ADDR_SIZE);
1373
1374 qdf_mem_copy(&bssid.bytes, vdev_mlme->mgmt.generic.bssid,
1375 QDF_MAC_ADDR_SIZE);
1376
1377 /*
1378 * Consider the case of 5 GHz + non-tx 6 GHz MLO candidate.
1379 * The scan entry might be generated from a ML-probe, which doesn't have
1380 * the MBSSID info for the non-tx partner link. In this case, host has
1381 * to identify if this link is MBSS or not. This is essential to receive
1382 * traffic over this link.
1383 *
1384 * The below logic looks into the rnr db for the 6 GHz bssid and
1385 * determines if the bssid is non-tx profile from the bss parameter
1386 * saved by its neighbor. If this is a non-tx bssid, but trans_bssid
1387 * info is not available from the scan entry, then set transmitted bssid
1388 * to bcast address. Upon sending this bcast tx bssid to firmware, the
1389 * firmware would auto-detect the tx bssid from the upcoming beacons
1390 * and tunes the interface to proper bssid.
1391 *
1392 * Note: Always send bcast mac in trans_bssid if the host is unable
1393 * to determine if a given BSS is part of an MBSS.
1394 */
1395 if (freq != INVALID_CHANNEL_NUM && !mbss_11ax->profile_idx &&
1396 qdf_is_macaddr_zero((struct qdf_mac_addr *)&mbss_11ax->trans_bssid) &&
1397 util_is_bssid_non_tx(wlan_vdev_get_psoc(vdev), &bssid, freq))
1398 qdf_mem_copy(mbss_11ax->trans_bssid,
1399 bcast_addr.bytes, QDF_MAC_ADDR_SIZE);
1400
1401 return QDF_STATUS_SUCCESS;
1402 }
1403
mlme_get_mbssid_info(struct wlan_objmgr_vdev * vdev,struct vdev_mlme_mbss_11ax * mbss_11ax)1404 void mlme_get_mbssid_info(struct wlan_objmgr_vdev *vdev,
1405 struct vdev_mlme_mbss_11ax *mbss_11ax)
1406 {
1407 struct vdev_mlme_obj *vdev_mlme;
1408
1409 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1410 if (!vdev_mlme) {
1411 mlme_legacy_err("vdev component object is NULL");
1412 return;
1413 }
1414
1415 mbss_11ax = &vdev_mlme->mgmt.mbss_11ax;
1416 }
1417
mlme_set_tx_power(struct wlan_objmgr_vdev * vdev,int8_t tx_power)1418 QDF_STATUS mlme_set_tx_power(struct wlan_objmgr_vdev *vdev,
1419 int8_t tx_power)
1420 {
1421 struct vdev_mlme_obj *vdev_mlme;
1422
1423 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1424
1425 if (!vdev_mlme) {
1426 mlme_legacy_err("vdev component object is NULL");
1427 return QDF_STATUS_E_FAILURE;
1428 }
1429
1430 vdev_mlme->mgmt.generic.tx_power = tx_power;
1431
1432 return QDF_STATUS_SUCCESS;
1433 }
1434
mlme_get_tx_power(struct wlan_objmgr_vdev * vdev)1435 int8_t mlme_get_tx_power(struct wlan_objmgr_vdev *vdev)
1436 {
1437 struct vdev_mlme_obj *vdev_mlme;
1438
1439 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1440 if (!vdev_mlme) {
1441 mlme_legacy_err("vdev component object is NULL");
1442 return QDF_STATUS_E_INVAL;
1443 }
1444
1445 return vdev_mlme->mgmt.generic.tx_power;
1446 }
1447
mlme_set_max_reg_power(struct wlan_objmgr_vdev * vdev,int8_t max_reg_power)1448 QDF_STATUS mlme_set_max_reg_power(struct wlan_objmgr_vdev *vdev,
1449 int8_t max_reg_power)
1450 {
1451 struct vdev_mlme_obj *vdev_mlme;
1452
1453 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1454
1455 if (!vdev_mlme) {
1456 mlme_legacy_err("vdev component object is NULL");
1457 return QDF_STATUS_E_FAILURE;
1458 }
1459
1460 vdev_mlme->mgmt.generic.maxregpower = max_reg_power;
1461
1462 return QDF_STATUS_SUCCESS;
1463 }
1464
mlme_get_max_reg_power(struct wlan_objmgr_vdev * vdev)1465 int8_t mlme_get_max_reg_power(struct wlan_objmgr_vdev *vdev)
1466 {
1467 struct vdev_mlme_obj *vdev_mlme;
1468
1469 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1470 if (!vdev_mlme) {
1471 mlme_legacy_err("vdev component object is NULL");
1472 return QDF_STATUS_E_INVAL;
1473 }
1474
1475 return vdev_mlme->mgmt.generic.maxregpower;
1476 }
1477
1478 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_FEATURE_ROAM_OFFLOAD)
1479 QDF_STATUS
mlme_set_single_link_mlo_roaming(struct wlan_objmgr_vdev * vdev,bool val)1480 mlme_set_single_link_mlo_roaming(struct wlan_objmgr_vdev *vdev, bool val)
1481 {
1482 struct mlme_legacy_priv *mlme_priv;
1483
1484 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1485 if (!mlme_priv) {
1486 mlme_legacy_err("vdev legacy private object is NULL");
1487 return QDF_STATUS_E_FAILURE;
1488 }
1489
1490 mlme_priv->is_single_link_mlo_roam = val;
1491
1492 return QDF_STATUS_SUCCESS;
1493 }
1494
mlme_get_single_link_mlo_roaming(struct wlan_objmgr_vdev * vdev)1495 bool mlme_get_single_link_mlo_roaming(struct wlan_objmgr_vdev *vdev)
1496 {
1497 struct mlme_legacy_priv *mlme_priv;
1498
1499 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
1500 if (!mlme_priv) {
1501 mlme_legacy_err("vdev legacy private object is NULL");
1502 return false;
1503 }
1504
1505 return mlme_priv->is_single_link_mlo_roam;
1506 }
1507 #endif
1508
1509 /**
1510 * mlme_get_vdev_types() - get vdev type and subtype from its operation mode
1511 * @mode: operation mode of vdev
1512 * @type: type of vdev
1513 * @sub_type: sub_type of vdev
1514 *
1515 * This API is called to get vdev type and subtype from its operation mode.
1516 * Vdev operation modes are defined in enum QDF_OPMODE.
1517 *
1518 * Type of vdev are WLAN_VDEV_MLME_TYPE_AP, WLAN_VDEV_MLME_TYPE_STA,
1519 * WLAN_VDEV_MLME_TYPE_IBSS, ,WLAN_VDEV_MLME_TYPE_MONITOR,
1520 * WLAN_VDEV_MLME_TYPE_NAN, WLAN_VDEV_MLME_TYPE_OCB, WLAN_VDEV_MLME_TYPE_NDI
1521 *
1522 * Sub_types of vdev are WLAN_VDEV_MLME_SUBTYPE_P2P_DEVICE,
1523 * WLAN_VDEV_MLME_SUBTYPE_P2P_CLIENT, WLAN_VDEV_MLME_SUBTYPE_P2P_GO,
1524 * WLAN_VDEV_MLME_SUBTYPE_PROXY_STA, WLAN_VDEV_MLME_SUBTYPE_MESH
1525 * Return: QDF_STATUS
1526 */
1527
mlme_get_vdev_types(enum QDF_OPMODE mode,uint8_t * type,uint8_t * sub_type)1528 static QDF_STATUS mlme_get_vdev_types(enum QDF_OPMODE mode, uint8_t *type,
1529 uint8_t *sub_type)
1530 {
1531 QDF_STATUS status = QDF_STATUS_SUCCESS;
1532 *type = 0;
1533 *sub_type = 0;
1534
1535 switch (mode) {
1536 case QDF_STA_MODE:
1537 *type = WLAN_VDEV_MLME_TYPE_STA;
1538 break;
1539 case QDF_SAP_MODE:
1540 *type = WLAN_VDEV_MLME_TYPE_AP;
1541 break;
1542 case QDF_P2P_DEVICE_MODE:
1543 *type = WLAN_VDEV_MLME_TYPE_AP;
1544 *sub_type = WLAN_VDEV_MLME_SUBTYPE_P2P_DEVICE;
1545 break;
1546 case QDF_P2P_CLIENT_MODE:
1547 *type = WLAN_VDEV_MLME_TYPE_STA;
1548 *sub_type = WLAN_VDEV_MLME_SUBTYPE_P2P_CLIENT;
1549 break;
1550 case QDF_P2P_GO_MODE:
1551 *type = WLAN_VDEV_MLME_TYPE_AP;
1552 *sub_type = WLAN_VDEV_MLME_SUBTYPE_P2P_GO;
1553 break;
1554 case QDF_OCB_MODE:
1555 *type = WLAN_VDEV_MLME_TYPE_OCB;
1556 break;
1557 case QDF_IBSS_MODE:
1558 *type = WLAN_VDEV_MLME_TYPE_IBSS;
1559 break;
1560 case QDF_MONITOR_MODE:
1561 *type = WMI_HOST_VDEV_TYPE_MONITOR;
1562 break;
1563 case QDF_NDI_MODE:
1564 *type = WLAN_VDEV_MLME_TYPE_NDI;
1565 break;
1566 case QDF_NAN_DISC_MODE:
1567 *type = WLAN_VDEV_MLME_TYPE_NAN;
1568 break;
1569 default:
1570 mlme_err("Invalid device mode %d", mode);
1571 status = QDF_STATUS_E_INVAL;
1572 break;
1573 }
1574 return status;
1575 }
1576
1577 #ifdef WLAN_FEATURE_FILS_SK
mlme_free_fils_info(struct mlme_connect_info * connect_info)1578 static inline void mlme_free_fils_info(struct mlme_connect_info *connect_info)
1579 {
1580 qdf_mem_free(connect_info->fils_con_info);
1581 qdf_mem_free(connect_info->hlp_ie);
1582 connect_info->hlp_ie = NULL;
1583 connect_info->hlp_ie_len = 0;
1584 connect_info->fils_con_info = NULL;
1585 }
1586 #else
mlme_free_fils_info(struct mlme_connect_info * connect_info)1587 static inline void mlme_free_fils_info(struct mlme_connect_info *connect_info)
1588 {}
1589 #endif
1590
1591 static
mlme_init_wait_for_key_timer(struct wlan_objmgr_vdev * vdev,struct wait_for_key_timer * wait_key_timer)1592 void mlme_init_wait_for_key_timer(struct wlan_objmgr_vdev *vdev,
1593 struct wait_for_key_timer *wait_key_timer)
1594 {
1595 QDF_STATUS status;
1596
1597 if (!vdev || !wait_key_timer) {
1598 mlme_err("vdev or wait for key is NULL");
1599 return;
1600 }
1601
1602 wait_key_timer->vdev = vdev;
1603 status = qdf_mc_timer_init(&wait_key_timer->timer, QDF_TIMER_TYPE_SW,
1604 cm_wait_for_key_time_out_handler,
1605 wait_key_timer);
1606 if (QDF_IS_STATUS_ERROR(status))
1607 mlme_err("cannot allocate memory for WaitForKey time out timer");
1608 }
1609
1610 static
mlme_deinit_wait_for_key_timer(struct wait_for_key_timer * wait_key_timer)1611 void mlme_deinit_wait_for_key_timer(struct wait_for_key_timer *wait_key_timer)
1612 {
1613 qdf_mc_timer_stop(&wait_key_timer->timer);
1614 qdf_mc_timer_destroy(&wait_key_timer->timer);
1615 }
1616
mlme_ext_handler_destroy(struct vdev_mlme_obj * vdev_mlme)1617 static void mlme_ext_handler_destroy(struct vdev_mlme_obj *vdev_mlme)
1618 {
1619 if (!vdev_mlme || !vdev_mlme->ext_vdev_ptr)
1620 return;
1621 qdf_runtime_lock_deinit(
1622 &vdev_mlme->ext_vdev_ptr->bss_color_change_runtime_lock);
1623 qdf_wake_lock_destroy(
1624 &vdev_mlme->ext_vdev_ptr->bss_color_change_wakelock);
1625 qdf_runtime_lock_deinit(
1626 &vdev_mlme->ext_vdev_ptr->disconnect_runtime_lock);
1627 mlme_free_self_disconnect_ies(vdev_mlme->vdev);
1628 mlme_free_peer_disconnect_ies(vdev_mlme->vdev);
1629 mlme_free_sae_auth_retry(vdev_mlme->vdev);
1630 mlme_deinit_wait_for_key_timer(&vdev_mlme->ext_vdev_ptr->wait_key_timer);
1631 mlme_free_fils_info(&vdev_mlme->ext_vdev_ptr->connect_info);
1632 mlme_cm_free_roam_stats_info(vdev_mlme->ext_vdev_ptr);
1633 qdf_mem_free(vdev_mlme->ext_vdev_ptr);
1634 vdev_mlme->ext_vdev_ptr = NULL;
1635 }
1636
1637 static QDF_STATUS
mlme_wma_vdev_detach_post_cb(struct scheduler_msg * msg)1638 mlme_wma_vdev_detach_post_cb(struct scheduler_msg *msg)
1639 {
1640 struct vdev_delete_response rsp = {0};
1641
1642 if (!msg) {
1643 mlme_err("Msg is NULL");
1644 return QDF_STATUS_E_INVAL;
1645 }
1646
1647 rsp.vdev_id = msg->bodyval;
1648 wma_vdev_detach_callback(&rsp);
1649
1650 return QDF_STATUS_SUCCESS;
1651 }
1652
mlme_wma_vdev_detach_handler(uint8_t vdev_id)1653 static void mlme_wma_vdev_detach_handler(uint8_t vdev_id)
1654 {
1655 struct scheduler_msg msg = {0};
1656
1657 msg.bodyptr = NULL;
1658 msg.bodyval = vdev_id;
1659 msg.callback = mlme_wma_vdev_detach_post_cb;
1660
1661 if (scheduler_post_message(QDF_MODULE_ID_MLME,
1662 QDF_MODULE_ID_TARGET_IF,
1663 QDF_MODULE_ID_TARGET_IF, &msg) ==
1664 QDF_STATUS_SUCCESS)
1665 return;
1666
1667 mlme_err("Failed to post wma vdev detach");
1668 }
1669
1670 /**
1671 * vdevmgr_mlme_ext_hdl_destroy () - Destroy mlme legacy priv object
1672 * @vdev_mlme: vdev mlme object
1673 *
1674 * Return: QDF_STATUS
1675 */
1676 static
vdevmgr_mlme_ext_hdl_destroy(struct vdev_mlme_obj * vdev_mlme)1677 QDF_STATUS vdevmgr_mlme_ext_hdl_destroy(struct vdev_mlme_obj *vdev_mlme)
1678 {
1679 QDF_STATUS status = QDF_STATUS_E_FAILURE;
1680 uint8_t vdev_id;
1681
1682 vdev_id = vdev_mlme->vdev->vdev_objmgr.vdev_id;
1683 mlme_legacy_debug("Sending vdev delete to firmware for vdev id = %d ",
1684 vdev_id);
1685
1686 if (!vdev_mlme->ext_vdev_ptr)
1687 return status;
1688
1689 status = vdev_mgr_delete_send(vdev_mlme);
1690 if (QDF_IS_STATUS_ERROR(status)) {
1691 mlme_err("Failed to send vdev delete to firmware");
1692 mlme_wma_vdev_detach_handler(vdev_id);
1693 }
1694
1695 mlme_ext_handler_destroy(vdev_mlme);
1696
1697 return QDF_STATUS_SUCCESS;
1698 }
1699
1700 /**
1701 * vdevmgr_mlme_ext_hdl_create () - Create mlme legacy priv object
1702 * @vdev_mlme: vdev mlme object
1703 *
1704 * Return: QDF_STATUS
1705 */
1706 static
vdevmgr_mlme_ext_hdl_create(struct vdev_mlme_obj * vdev_mlme)1707 QDF_STATUS vdevmgr_mlme_ext_hdl_create(struct vdev_mlme_obj *vdev_mlme)
1708 {
1709 QDF_STATUS status;
1710
1711 mlme_legacy_debug("vdev id = %d ",
1712 vdev_mlme->vdev->vdev_objmgr.vdev_id);
1713 vdev_mlme->ext_vdev_ptr =
1714 qdf_mem_malloc(sizeof(struct mlme_legacy_priv));
1715 if (!vdev_mlme->ext_vdev_ptr)
1716 return QDF_STATUS_E_NOMEM;
1717
1718 mlme_init_rate_config(vdev_mlme);
1719 mlme_init_connect_chan_info_config(vdev_mlme);
1720 mlme_cm_alloc_roam_stats_info(vdev_mlme);
1721 vdev_mlme->ext_vdev_ptr->connect_info.fils_con_info = NULL;
1722 mlme_init_wait_for_key_timer(vdev_mlme->vdev,
1723 &vdev_mlme->ext_vdev_ptr->wait_key_timer);
1724
1725 qdf_wake_lock_create(
1726 &vdev_mlme->ext_vdev_ptr->bss_color_change_wakelock,
1727 "bss_color_change_wakelock");
1728 qdf_runtime_lock_init(
1729 &vdev_mlme->ext_vdev_ptr->bss_color_change_runtime_lock);
1730 qdf_runtime_lock_init(
1731 &vdev_mlme->ext_vdev_ptr->disconnect_runtime_lock);
1732
1733 sme_get_vdev_type_nss(wlan_vdev_mlme_get_opmode(vdev_mlme->vdev),
1734 &vdev_mlme->proto.generic.nss_2g,
1735 &vdev_mlme->proto.generic.nss_5g);
1736
1737 status = mlme_get_vdev_types(wlan_vdev_mlme_get_opmode(vdev_mlme->vdev),
1738 &vdev_mlme->mgmt.generic.type,
1739 &vdev_mlme->mgmt.generic.subtype);
1740 if (QDF_IS_STATUS_ERROR(status)) {
1741 mlme_err("Get vdev type failed; status:%d", status);
1742 mlme_ext_handler_destroy(vdev_mlme);
1743 return status;
1744 }
1745
1746 status = vdev_mgr_create_send(vdev_mlme);
1747 if (QDF_IS_STATUS_ERROR(status)) {
1748 mlme_err("Failed to create vdev for vdev id %d",
1749 wlan_vdev_get_id(vdev_mlme->vdev));
1750 vdevmgr_mlme_ext_hdl_destroy(vdev_mlme);
1751 return status;
1752 }
1753
1754 return status;
1755 }
1756
1757 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
1758 static
vdevmgr_mlme_vdev_send_set_mac_addr(struct qdf_mac_addr mac_addr,struct qdf_mac_addr mld_addr,struct wlan_objmgr_vdev * vdev)1759 QDF_STATUS vdevmgr_mlme_vdev_send_set_mac_addr(struct qdf_mac_addr mac_addr,
1760 struct qdf_mac_addr mld_addr,
1761 struct wlan_objmgr_vdev *vdev)
1762 {
1763 return vdev_mgr_send_set_mac_addr(mac_addr, mld_addr, vdev);
1764 }
1765 #endif
1766
1767 /**
1768 * ap_vdev_dfs_cac_timer_stop() - callback to stop cac timer
1769 * @vdev_mlme: vdev mlme object
1770 * @event_data_len: event data length
1771 * @event_data: event data
1772 *
1773 * This function is called to stop cac timer
1774 *
1775 * Return: QDF_STATUS
1776 */
ap_vdev_dfs_cac_timer_stop(struct vdev_mlme_obj * vdev_mlme,uint16_t event_data_len,void * event_data)1777 static QDF_STATUS ap_vdev_dfs_cac_timer_stop(struct vdev_mlme_obj *vdev_mlme,
1778 uint16_t event_data_len,
1779 void *event_data)
1780 {
1781 mlme_legacy_debug("vdev id = %d ",
1782 vdev_mlme->vdev->vdev_objmgr.vdev_id);
1783 return QDF_STATUS_SUCCESS;
1784 }
1785
1786 /**
1787 * mon_mlme_vdev_start_restart_send () - send vdev start/restart req
1788 * @vdev_mlme: vdev mlme object
1789 * @data_len: event data length
1790 * @data: event data
1791 *
1792 * This function is called to initiate actions of VDEV start/restart
1793 *
1794 * Return: QDF_STATUS
1795 */
mon_mlme_vdev_start_restart_send(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)1796 static QDF_STATUS mon_mlme_vdev_start_restart_send(
1797 struct vdev_mlme_obj *vdev_mlme,
1798 uint16_t data_len, void *data)
1799 {
1800 mlme_legacy_debug("vdev id = %d",
1801 vdev_mlme->vdev->vdev_objmgr.vdev_id);
1802 return lim_mon_mlme_vdev_start_send(vdev_mlme, data_len, data);
1803 }
1804
1805 /**
1806 * mon_mlme_start_continue () - vdev start rsp callback
1807 * @vdev_mlme: vdev mlme object
1808 * @data_len: event data length
1809 * @data: event data
1810 *
1811 * This function is called to handle the VDEV START/RESTART callback
1812 *
1813 * Return: QDF_STATUS
1814 */
mon_mlme_start_continue(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)1815 static QDF_STATUS mon_mlme_start_continue(struct vdev_mlme_obj *vdev_mlme,
1816 uint16_t data_len, void *data)
1817 {
1818 mlme_legacy_debug("vdev id = %d",
1819 vdev_mlme->vdev->vdev_objmgr.vdev_id);
1820 return wma_mon_mlme_vdev_start_continue(vdev_mlme, data_len, data);
1821 }
1822
1823 /**
1824 * mon_mlme_vdev_up_send() - callback to send vdev up
1825 * @vdev_mlme: vdev mlme object
1826 * @data_len: event data length
1827 * @data: event data
1828 *
1829 * This function is called to send vdev up req
1830 *
1831 * Return: QDF_STATUS
1832 */
mon_mlme_vdev_up_send(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)1833 static QDF_STATUS mon_mlme_vdev_up_send(struct vdev_mlme_obj *vdev_mlme,
1834 uint16_t data_len, void *data)
1835 {
1836 mlme_legacy_debug("vdev id = %d",
1837 vdev_mlme->vdev->vdev_objmgr.vdev_id);
1838 return wma_mon_mlme_vdev_up_send(vdev_mlme, data_len, data);
1839 }
1840
1841 /**
1842 * mon_mlme_vdev_disconnect_peers() - callback to disconnect all connected peers
1843 * @vdev_mlme: vdev mlme object
1844 * @data_len: event data length
1845 * @data: event data
1846 * @is_disconnect_legacy_only: flag to indicate legacy disconnect
1847 *
1848 * montior mode no connected peers, only do VDEV state transition.
1849 *
1850 * Return: QDF_STATUS
1851 */
mon_mlme_vdev_disconnect_peers(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data,bool is_disconnect_legacy_only)1852 static QDF_STATUS mon_mlme_vdev_disconnect_peers(
1853 struct vdev_mlme_obj *vdev_mlme,
1854 uint16_t data_len, void *data,
1855 bool is_disconnect_legacy_only)
1856 {
1857 struct wlan_objmgr_psoc *psoc = NULL;
1858 struct wlan_objmgr_pdev *pdev = NULL;
1859 uint32_t pdev_id;
1860
1861 psoc = wlan_vdev_get_psoc(vdev_mlme->vdev);
1862 if (!psoc) {
1863 mlme_legacy_debug("Invalid psoc");
1864 return QDF_STATUS_E_INVAL;
1865 }
1866
1867 pdev = wlan_vdev_get_pdev(vdev_mlme->vdev);
1868 if (!pdev) {
1869 mlme_legacy_debug("Invalid pdev");
1870 return QDF_STATUS_E_INVAL;
1871 }
1872
1873 pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
1874 if (pdev_id == WLAN_INVALID_PDEV_ID) {
1875 mlme_legacy_debug("Invalid pdev id");
1876 return QDF_STATUS_E_INVAL;
1877 }
1878
1879 /* Cancel periodic pdev stats update */
1880 tgt_set_pdev_stats_update_period(psoc, pdev_id, 0);
1881
1882 mlme_legacy_debug("vdev id = %d",
1883 vdev_mlme->vdev->vdev_objmgr.vdev_id);
1884 return wlan_vdev_mlme_sm_deliver_evt(
1885 vdev_mlme->vdev,
1886 WLAN_VDEV_SM_EV_DISCONNECT_COMPLETE,
1887 0, NULL);
1888 }
1889
1890 /**
1891 * mon_mlme_vdev_stop_send() - callback to send stop vdev request
1892 * @vdev_mlme: vdev mlme object
1893 * @data_len: event data length
1894 * @data: event data
1895 *
1896 * This function is called to send stop vdev request
1897 *
1898 * Return: QDF_STATUS
1899 */
mon_mlme_vdev_stop_send(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)1900 static QDF_STATUS mon_mlme_vdev_stop_send(struct vdev_mlme_obj *vdev_mlme,
1901 uint16_t data_len, void *data)
1902 {
1903 mlme_legacy_debug("vdev id = %d",
1904 vdev_mlme->vdev->vdev_objmgr.vdev_id);
1905 return wma_mon_mlme_vdev_stop_send(vdev_mlme, data_len, data);
1906 }
1907
1908 /**
1909 * mon_mlme_vdev_down_send() - callback to send vdev down req
1910 * @vdev_mlme: vdev mlme object
1911 * @data_len: event data length
1912 * @data: event data
1913 *
1914 * This function is called to send vdev down req
1915 *
1916 * Return: QDF_STATUS
1917 */
mon_mlme_vdev_down_send(struct vdev_mlme_obj * vdev_mlme,uint16_t data_len,void * data)1918 static QDF_STATUS mon_mlme_vdev_down_send(struct vdev_mlme_obj *vdev_mlme,
1919 uint16_t data_len, void *data)
1920 {
1921 mlme_legacy_debug("vdev id = %d",
1922 vdev_mlme->vdev->vdev_objmgr.vdev_id);
1923 return wma_mon_mlme_vdev_down_send(vdev_mlme, data_len, data);
1924 }
1925
1926 /**
1927 * vdevmgr_vdev_delete_rsp_handle() - callback to handle vdev delete response
1928 * @psoc: psoc object
1929 * @rsp: pointer to vdev delete response
1930 *
1931 * This function is called to handle vdev delete response and send result to
1932 * upper layer
1933 *
1934 * Return: QDF_STATUS
1935 */
1936 static QDF_STATUS
vdevmgr_vdev_delete_rsp_handle(struct wlan_objmgr_psoc * psoc,struct vdev_delete_response * rsp)1937 vdevmgr_vdev_delete_rsp_handle(struct wlan_objmgr_psoc *psoc,
1938 struct vdev_delete_response *rsp)
1939 {
1940 mlme_legacy_debug("vdev id = %d ", rsp->vdev_id);
1941 return wma_vdev_detach_callback(rsp);
1942 }
1943
1944 /**
1945 * vdevmgr_vdev_stop_rsp_handle() - callback to handle vdev stop response
1946 * @vdev_mlme: vdev mlme object
1947 * @rsp: pointer to vdev stop response
1948 *
1949 * This function is called to handle vdev stop response and send result to
1950 * upper layer
1951 *
1952 * Return: QDF_STATUS
1953 */
1954 static QDF_STATUS
vdevmgr_vdev_stop_rsp_handle(struct vdev_mlme_obj * vdev_mlme,struct vdev_stop_response * rsp)1955 vdevmgr_vdev_stop_rsp_handle(struct vdev_mlme_obj *vdev_mlme,
1956 struct vdev_stop_response *rsp)
1957 {
1958 mlme_legacy_debug("vdev id = %d ",
1959 vdev_mlme->vdev->vdev_objmgr.vdev_id);
1960 return wma_vdev_stop_resp_handler(vdev_mlme, rsp);
1961 }
1962
1963 /**
1964 * psoc_mlme_ext_hdl_enable() - to enable mlme ext param handler
1965 * @psoc: psoc object
1966 *
1967 * Return: QDF_STATUS
1968 */
psoc_mlme_ext_hdl_enable(struct wlan_objmgr_psoc * psoc)1969 static QDF_STATUS psoc_mlme_ext_hdl_enable(struct wlan_objmgr_psoc *psoc)
1970 {
1971 struct wlan_mlme_psoc_ext_obj *mlme_obj;
1972
1973 mlme_obj = mlme_get_psoc_ext_obj(psoc);
1974 if (!mlme_obj)
1975 return QDF_STATUS_E_FAILURE;
1976
1977 mlme_obj->scan_requester_id =
1978 wlan_scan_register_requester(psoc, "MLME_EXT",
1979 wlan_mlme_chan_stats_scan_event_cb,
1980 NULL);
1981
1982 return QDF_STATUS_SUCCESS;
1983 }
1984
1985 /**
1986 * psoc_mlme_ext_hdl_disable() - to disable mlme ext param handler
1987 * @psoc: psoc object
1988 *
1989 * Return: QDF_STATUS
1990 */
psoc_mlme_ext_hdl_disable(struct wlan_objmgr_psoc * psoc)1991 static QDF_STATUS psoc_mlme_ext_hdl_disable(struct wlan_objmgr_psoc *psoc)
1992 {
1993 struct wlan_mlme_psoc_ext_obj *mlme_obj;
1994
1995 mlme_obj = mlme_get_psoc_ext_obj(psoc);
1996 if (!mlme_obj)
1997 return QDF_STATUS_E_FAILURE;
1998
1999 wlan_scan_unregister_requester(psoc, mlme_obj->scan_requester_id);
2000
2001 return QDF_STATUS_SUCCESS;
2002 }
2003
2004 /**
2005 * psoc_mlme_ext_hdl_create() - Create mlme legacy priv object
2006 * @psoc_mlme: psoc mlme object
2007 *
2008 * Return: QDF_STATUS
2009 */
2010 static
psoc_mlme_ext_hdl_create(struct psoc_mlme_obj * psoc_mlme)2011 QDF_STATUS psoc_mlme_ext_hdl_create(struct psoc_mlme_obj *psoc_mlme)
2012 {
2013 psoc_mlme->ext_psoc_ptr =
2014 qdf_mem_malloc(sizeof(struct wlan_mlme_psoc_ext_obj));
2015 if (!psoc_mlme->ext_psoc_ptr)
2016 return QDF_STATUS_E_NOMEM;
2017
2018 target_if_cm_roam_register_tx_ops(
2019 &psoc_mlme->ext_psoc_ptr->rso_tx_ops);
2020
2021 target_if_wfatestcmd_register_tx_ops(
2022 &psoc_mlme->ext_psoc_ptr->wfa_testcmd.tx_ops);
2023 target_if_cm_roam_register_rx_ops(
2024 &psoc_mlme->ext_psoc_ptr->rso_rx_ops);
2025 wlan_mlme_register_rx_ops(&psoc_mlme->ext_psoc_ptr->mlme_rx_ops);
2026
2027 target_if_mlme_register_tx_ops(
2028 &psoc_mlme->ext_psoc_ptr->mlme_tx_ops);
2029
2030 return QDF_STATUS_SUCCESS;
2031 }
2032
2033 /**
2034 * psoc_mlme_ext_hdl_destroy() - Destroy mlme legacy priv object
2035 * @psoc_mlme: psoc mlme object
2036 *
2037 * Return: QDF_STATUS
2038 */
2039 static
psoc_mlme_ext_hdl_destroy(struct psoc_mlme_obj * psoc_mlme)2040 QDF_STATUS psoc_mlme_ext_hdl_destroy(struct psoc_mlme_obj *psoc_mlme)
2041 {
2042 if (!psoc_mlme) {
2043 mlme_err("PSOC MLME is NULL");
2044 return QDF_STATUS_E_FAILURE;
2045 }
2046
2047 if (psoc_mlme->ext_psoc_ptr) {
2048 qdf_mem_free(psoc_mlme->ext_psoc_ptr);
2049 psoc_mlme->ext_psoc_ptr = NULL;
2050 }
2051
2052 return QDF_STATUS_SUCCESS;
2053 }
2054
2055 /**
2056 * vdevmgr_vdev_start_rsp_handle() - callback to handle vdev start response
2057 * @vdev_mlme: vdev mlme object
2058 * @rsp: pointer to vdev start response
2059 *
2060 * This function is called to handle vdev start response
2061 *
2062 * Return: QDF_STATUS
2063 */
2064 static QDF_STATUS
vdevmgr_vdev_start_rsp_handle(struct vdev_mlme_obj * vdev_mlme,struct vdev_start_response * rsp)2065 vdevmgr_vdev_start_rsp_handle(struct vdev_mlme_obj *vdev_mlme,
2066 struct vdev_start_response *rsp)
2067 {
2068 QDF_STATUS status;
2069
2070 mlme_legacy_debug("vdev id = %d ",
2071 vdev_mlme->vdev->vdev_objmgr.vdev_id);
2072 status = wma_vdev_start_resp_handler(vdev_mlme, rsp);
2073
2074 return status;
2075 }
2076
2077 /**
2078 * vdevmgr_vdev_peer_delete_all_rsp_handle() - callback to handle vdev delete
2079 * all response
2080 * @vdev_mlme: vdev mlme object
2081 * @rsp: pointer to vdev delete response
2082 *
2083 * This function is called to handle vdev delete response and send result to
2084 * upper layer
2085 *
2086 * Return: QDF_STATUS
2087 */
2088 static QDF_STATUS
vdevmgr_vdev_peer_delete_all_rsp_handle(struct vdev_mlme_obj * vdev_mlme,struct peer_delete_all_response * rsp)2089 vdevmgr_vdev_peer_delete_all_rsp_handle(struct vdev_mlme_obj *vdev_mlme,
2090 struct peer_delete_all_response *rsp)
2091 {
2092 struct wlan_objmgr_psoc *psoc;
2093 struct wlan_lmac_if_wifi_pos_rx_ops *rx_ops;
2094 QDF_STATUS status;
2095
2096 psoc = wlan_vdev_get_psoc(vdev_mlme->vdev);
2097 if (!psoc)
2098 return -QDF_STATUS_E_INVAL;
2099
2100 if (QDF_HAS_PARAM(rsp->peer_type_bitmap, WLAN_PEER_RTT_PASN)) {
2101 rx_ops = wifi_pos_get_rx_ops(psoc);
2102 if (!rx_ops ||
2103 !rx_ops->wifi_pos_vdev_delete_all_ranging_peers_rsp_cb) {
2104 mlme_err("rx_ops is NULL");
2105 return QDF_STATUS_E_FAILURE;
2106 }
2107
2108 status = rx_ops->wifi_pos_vdev_delete_all_ranging_peers_rsp_cb(
2109 psoc, rsp->vdev_id);
2110 return status;
2111 }
2112
2113 status = lim_process_mlm_del_all_sta_rsp(vdev_mlme, rsp);
2114 if (QDF_IS_STATUS_ERROR(status))
2115 mlme_err("Failed to call lim_process_mlm_del_all_sta_rsp");
2116
2117 return status;
2118 }
2119
2120 #ifdef WLAN_FEATURE_11BE_MLO
vdevmgr_reconfig_req_cb(struct scheduler_msg * msg)2121 static QDF_STATUS vdevmgr_reconfig_req_cb(struct scheduler_msg *msg)
2122 {
2123 struct wlan_objmgr_vdev *vdev = msg->bodyptr;
2124 struct wlan_objmgr_psoc *psoc;
2125 uint8_t vdev_id;
2126
2127 if (!vdev) {
2128 mlme_err("vdev null");
2129 return QDF_STATUS_E_INVAL;
2130 }
2131
2132 psoc = wlan_vdev_get_psoc(vdev);
2133 if (!psoc) {
2134 mlme_err("Failed to get psoc");
2135 return QDF_STATUS_E_INVAL;
2136 }
2137
2138 vdev_id = wlan_vdev_get_id(vdev);
2139 if (!wlan_get_vdev_link_removed_flag_by_vdev_id(psoc, vdev_id))
2140 mlme_cm_osif_link_reconfig_notify(vdev);
2141
2142 policy_mgr_handle_link_removal_on_vdev(vdev);
2143 mlo_sta_stop_reconfig_timer_by_vdev(vdev);
2144
2145 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID);
2146
2147 return QDF_STATUS_SUCCESS;
2148 }
2149
vdevmgr_reconfig_req_flush_cb(struct scheduler_msg * msg)2150 static QDF_STATUS vdevmgr_reconfig_req_flush_cb(struct scheduler_msg *msg)
2151 {
2152 struct wlan_objmgr_vdev *vdev = msg->bodyptr;
2153
2154 if (!vdev) {
2155 mlme_err("vdev null");
2156 return QDF_STATUS_E_INVAL;
2157 }
2158 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID);
2159
2160 return QDF_STATUS_SUCCESS;
2161 }
2162
2163 static QDF_STATUS
vdevmgr_vdev_reconfig_notify(struct vdev_mlme_obj * vdev_mlme,uint16_t * tbtt_count,uint16_t bcn_int)2164 vdevmgr_vdev_reconfig_notify(struct vdev_mlme_obj *vdev_mlme,
2165 uint16_t *tbtt_count, uint16_t bcn_int)
2166 {
2167 struct wlan_objmgr_vdev *vdev = vdev_mlme->vdev;
2168
2169 if (!vdev) {
2170 mlme_err("invalid vdev");
2171 return QDF_STATUS_E_INVAL;
2172 }
2173 mlme_debug("vdev %d link removal notify tbtt %d bcn_int %d",
2174 wlan_vdev_get_id(vdev), *tbtt_count, bcn_int);
2175 if (*tbtt_count * bcn_int <= LINK_REMOVAL_MIN_TIMEOUT_MS)
2176 *tbtt_count = 0;
2177 else if (bcn_int)
2178 *tbtt_count -= LINK_REMOVAL_MIN_TIMEOUT_MS / bcn_int;
2179
2180 return QDF_STATUS_SUCCESS;
2181 }
2182
2183 static QDF_STATUS
vdevmgr_vdev_reconfig_notify_standby(struct vdev_mlme_obj * vdev_mlme,struct ml_rv_info * reconfig_info)2184 vdevmgr_vdev_reconfig_notify_standby(struct vdev_mlme_obj *vdev_mlme,
2185 struct ml_rv_info *reconfig_info)
2186 {
2187 struct wlan_objmgr_vdev *vdev = vdev_mlme->vdev;
2188
2189 if (!vdev) {
2190 mlme_err("invalid vdev");
2191 return QDF_STATUS_E_INVAL;
2192 }
2193
2194 return policy_mgr_handle_link_removal_on_standby(vdev, reconfig_info);
2195 }
2196
2197 static void
vdevmgr_vdev_reconfig_timer_complete(struct vdev_mlme_obj * vdev_mlme)2198 vdevmgr_vdev_reconfig_timer_complete(struct vdev_mlme_obj *vdev_mlme)
2199 {
2200 struct wlan_objmgr_vdev *vdev = vdev_mlme->vdev;
2201 struct scheduler_msg msg = {0};
2202 QDF_STATUS ret;
2203
2204 if (!vdev) {
2205 mlme_err("invalid vdev");
2206 return;
2207 }
2208 mlme_debug("vdev %d link removal timed out", wlan_vdev_get_id(vdev));
2209
2210 msg.bodyptr = vdev;
2211 msg.callback = vdevmgr_reconfig_req_cb;
2212 msg.flush_callback = vdevmgr_reconfig_req_flush_cb;
2213
2214 ret = wlan_objmgr_vdev_try_get_ref(vdev, WLAN_MLME_CM_ID);
2215 if (QDF_IS_STATUS_ERROR(ret))
2216 return;
2217
2218 ret = scheduler_post_message(QDF_MODULE_ID_MLME,
2219 QDF_MODULE_ID_TARGET_IF,
2220 QDF_MODULE_ID_TARGET_IF, &msg);
2221
2222 if (QDF_IS_STATUS_ERROR(ret)) {
2223 mlme_err("vdev %d failed to post scheduler_msg",
2224 wlan_vdev_get_id(vdev));
2225 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID);
2226 return;
2227 }
2228 }
2229 #endif
2230
mlme_vdev_self_peer_create(struct wlan_objmgr_vdev * vdev)2231 QDF_STATUS mlme_vdev_self_peer_create(struct wlan_objmgr_vdev *vdev)
2232 {
2233 struct vdev_mlme_obj *vdev_mlme;
2234
2235 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
2236 if (!vdev_mlme) {
2237 mlme_err("Failed to get vdev mlme obj for vdev id %d",
2238 wlan_vdev_get_id(vdev));
2239 return QDF_STATUS_E_INVAL;
2240 }
2241
2242 return wma_vdev_self_peer_create(vdev_mlme);
2243 }
2244
2245 static
vdevmgr_mlme_ext_post_hdl_create(struct vdev_mlme_obj * vdev_mlme)2246 QDF_STATUS vdevmgr_mlme_ext_post_hdl_create(struct vdev_mlme_obj *vdev_mlme)
2247 {
2248 return QDF_STATUS_SUCCESS;
2249 }
2250
mlme_vdev_uses_self_peer(uint32_t vdev_type,uint32_t vdev_subtype)2251 bool mlme_vdev_uses_self_peer(uint32_t vdev_type, uint32_t vdev_subtype)
2252 {
2253 switch (vdev_type) {
2254 case WMI_VDEV_TYPE_AP:
2255 return vdev_subtype == WMI_UNIFIED_VDEV_SUBTYPE_P2P_DEVICE;
2256
2257 case WMI_VDEV_TYPE_MONITOR:
2258 case WMI_VDEV_TYPE_OCB:
2259 return true;
2260
2261 default:
2262 return false;
2263 }
2264 }
2265
mlme_vdev_del_resp(uint8_t vdev_id)2266 void mlme_vdev_del_resp(uint8_t vdev_id)
2267 {
2268 sme_vdev_del_resp(vdev_id);
2269 }
2270
2271 static
mlme_vdev_self_peer_delete_resp_flush_cb(struct scheduler_msg * msg)2272 QDF_STATUS mlme_vdev_self_peer_delete_resp_flush_cb(struct scheduler_msg *msg)
2273 {
2274 /*
2275 * sme should be the last component to hold the reference invoke the
2276 * same to release the reference gracefully
2277 */
2278 sme_vdev_self_peer_delete_resp(msg->bodyptr);
2279 return QDF_STATUS_SUCCESS;
2280 }
2281
mlme_vdev_self_peer_delete_resp(struct del_vdev_params * param)2282 void mlme_vdev_self_peer_delete_resp(struct del_vdev_params *param)
2283 {
2284 struct scheduler_msg peer_del_rsp = {0};
2285 QDF_STATUS status;
2286
2287 peer_del_rsp.type = eWNI_SME_VDEV_DELETE_RSP;
2288 peer_del_rsp.bodyptr = param;
2289 peer_del_rsp.flush_callback = mlme_vdev_self_peer_delete_resp_flush_cb;
2290
2291 status = scheduler_post_message(QDF_MODULE_ID_MLME,
2292 QDF_MODULE_ID_SME,
2293 QDF_MODULE_ID_SME, &peer_del_rsp);
2294 if (!QDF_IS_STATUS_SUCCESS(status)) {
2295 /* In the error cases release the final sme reference */
2296 wlan_objmgr_vdev_release_ref(param->vdev, WLAN_LEGACY_SME_ID);
2297 qdf_mem_free(param);
2298 }
2299 }
2300
mlme_vdev_self_peer_delete(struct scheduler_msg * self_peer_del_msg)2301 QDF_STATUS mlme_vdev_self_peer_delete(struct scheduler_msg *self_peer_del_msg)
2302 {
2303 QDF_STATUS status;
2304 struct del_vdev_params *del_vdev = self_peer_del_msg->bodyptr;
2305
2306 if (!del_vdev) {
2307 mlme_err("Invalid del self peer params");
2308 return QDF_STATUS_E_INVAL;
2309 }
2310
2311 status = wma_vdev_detach(del_vdev);
2312 if (QDF_IS_STATUS_ERROR(status))
2313 mlme_err("Failed to detach vdev");
2314
2315 return status;
2316 }
2317
wlan_sap_disconnect_all_p2p_client(uint8_t vdev_id)2318 QDF_STATUS wlan_sap_disconnect_all_p2p_client(uint8_t vdev_id)
2319 {
2320 return csr_mlme_vdev_disconnect_all_p2p_client_event(vdev_id);
2321 }
2322
wlan_sap_stop_bss(uint8_t vdev_id)2323 QDF_STATUS wlan_sap_stop_bss(uint8_t vdev_id)
2324 {
2325 return csr_mlme_vdev_stop_bss(vdev_id);
2326 }
2327
wlan_get_conc_freq(void)2328 qdf_freq_t wlan_get_conc_freq(void)
2329 {
2330 return csr_mlme_get_concurrent_operation_freq();
2331 }
2332
2333 /**
2334 * ap_mlme_vdev_csa_complete() - callback to initiate csa complete
2335 *
2336 * @vdev_mlme: vdev mlme object
2337 *
2338 * This function is called for csa complete indication
2339 *
2340 * Return: QDF_STATUS
2341 */
ap_mlme_vdev_csa_complete(struct vdev_mlme_obj * vdev_mlme)2342 static QDF_STATUS ap_mlme_vdev_csa_complete(struct vdev_mlme_obj *vdev_mlme)
2343
2344 {
2345 uint8_t vdev_id;
2346
2347 vdev_id = wlan_vdev_get_id(vdev_mlme->vdev);
2348 mlme_legacy_debug("vdev id = %d ", vdev_id);
2349
2350 if (lim_is_csa_tx_pending(vdev_id))
2351 lim_send_csa_tx_complete(vdev_id);
2352 else
2353 mlme_legacy_debug("CSAIE_TX_COMPLETE_IND already sent");
2354
2355 return QDF_STATUS_SUCCESS;
2356 }
2357
2358 #ifdef WLAN_FEATURE_LL_LT_SAP
2359 QDF_STATUS
wlan_ll_sap_sort_channel_list(uint8_t vdev_id,qdf_list_t * list,struct sap_sel_ch_info * ch_info)2360 wlan_ll_sap_sort_channel_list(uint8_t vdev_id, qdf_list_t *list,
2361 struct sap_sel_ch_info *ch_info)
2362 {
2363 return wlansap_sort_channel_list(vdev_id, list, ch_info);
2364 }
2365
wlan_ll_sap_free_chan_info(struct sap_sel_ch_info * ch_param)2366 void wlan_ll_sap_free_chan_info(struct sap_sel_ch_info *ch_param)
2367 {
2368 return wlansap_free_chan_info(ch_param);
2369 }
2370
wlan_ll_sap_freq_present_in_pcl(struct policy_mgr_pcl_list * pcl,qdf_freq_t freq)2371 bool wlan_ll_sap_freq_present_in_pcl(struct policy_mgr_pcl_list *pcl,
2372 qdf_freq_t freq)
2373 {
2374 uint8_t i;
2375
2376 for (i = 0; i < pcl->pcl_len; i++) {
2377 if (pcl->pcl_list[i] == freq)
2378 return true;
2379 }
2380
2381 return false;
2382 }
2383 #endif
2384
2385 void
wlan_sap_get_user_config_acs_ch_list(uint8_t vdev_id,struct scan_filter * filter)2386 wlan_sap_get_user_config_acs_ch_list(uint8_t vdev_id,
2387 struct scan_filter *filter)
2388 {
2389 wlansap_get_user_config_acs_ch_list(vdev_id, filter);
2390 }
2391
2392 static struct vdev_mlme_ops sta_mlme_ops = {
2393 .mlme_vdev_start_send = sta_mlme_vdev_start_send,
2394 .mlme_vdev_restart_send = sta_mlme_vdev_restart_send,
2395 .mlme_vdev_start_continue = sta_mlme_start_continue,
2396 .mlme_vdev_start_req_failed = sta_mlme_vdev_start_req_failed,
2397 .mlme_vdev_sta_conn_start = sta_mlme_vdev_start_connection,
2398 .mlme_vdev_up_send = sta_mlme_vdev_up_send,
2399 .mlme_vdev_notify_up_complete = sta_mlme_vdev_notify_up_complete,
2400 .mlme_vdev_notify_roam_start = sta_mlme_vdev_notify_roam_start,
2401 .mlme_vdev_disconnect_peers = sta_mlme_vdev_disconnect_bss,
2402 .mlme_vdev_stop_send = sta_mlme_vdev_stop_send,
2403 .mlme_vdev_stop_continue = vdevmgr_mlme_stop_continue,
2404 .mlme_vdev_down_send = vdevmgr_mlme_vdev_down_send,
2405 .mlme_vdev_notify_down_complete = vdevmgr_notify_down_complete,
2406 .mlme_vdev_ext_stop_rsp = vdevmgr_vdev_stop_rsp_handle,
2407 .mlme_vdev_ext_start_rsp = vdevmgr_vdev_start_rsp_handle,
2408 .mlme_vdev_sta_disconn_start = sta_mlme_vdev_sta_disconnect_start,
2409 .mlme_vdev_ext_peer_delete_all_rsp =
2410 vdevmgr_vdev_peer_delete_all_rsp_handle,
2411 #ifdef WLAN_FEATURE_11BE_MLO
2412 .mlme_vdev_reconfig_notify =
2413 vdevmgr_vdev_reconfig_notify,
2414 .mlme_vdev_reconfig_timer_complete =
2415 vdevmgr_vdev_reconfig_timer_complete,
2416 .mlme_vdev_reconfig_notify_standby =
2417 vdevmgr_vdev_reconfig_notify_standby,
2418
2419 #endif
2420 };
2421
2422 static struct vdev_mlme_ops ap_mlme_ops = {
2423 .mlme_vdev_start_send = ap_mlme_vdev_start_send,
2424 .mlme_vdev_restart_send = ap_mlme_vdev_restart_send,
2425 .mlme_vdev_stop_start_send = ap_mlme_vdev_stop_start_send,
2426 .mlme_vdev_start_continue = ap_mlme_start_continue,
2427 .mlme_vdev_start_req_failed = ap_mlme_vdev_start_req_failed,
2428 .mlme_vdev_up_send = ap_mlme_vdev_up_send,
2429 .mlme_vdev_notify_up_complete = ap_mlme_vdev_notify_up_complete,
2430 .mlme_vdev_update_beacon = ap_mlme_vdev_update_beacon,
2431 .mlme_vdev_disconnect_peers = ap_mlme_vdev_disconnect_peers,
2432 .mlme_vdev_dfs_cac_timer_stop = ap_vdev_dfs_cac_timer_stop,
2433 .mlme_vdev_stop_send = ap_mlme_vdev_stop_send,
2434 .mlme_vdev_stop_continue = vdevmgr_mlme_stop_continue,
2435 .mlme_vdev_down_send = vdevmgr_mlme_vdev_down_send,
2436 .mlme_vdev_notify_down_complete = vdevmgr_notify_down_complete,
2437 .mlme_vdev_is_newchan_no_cac = ap_mlme_vdev_is_newchan_no_cac,
2438 .mlme_vdev_ext_stop_rsp = vdevmgr_vdev_stop_rsp_handle,
2439 .mlme_vdev_ext_start_rsp = vdevmgr_vdev_start_rsp_handle,
2440 .mlme_vdev_ext_peer_delete_all_rsp =
2441 vdevmgr_vdev_peer_delete_all_rsp_handle,
2442 .mlme_vdev_csa_complete = ap_mlme_vdev_csa_complete,
2443 };
2444
2445 static struct vdev_mlme_ops mon_mlme_ops = {
2446 .mlme_vdev_start_send = mon_mlme_vdev_start_restart_send,
2447 .mlme_vdev_restart_send = mon_mlme_vdev_start_restart_send,
2448 .mlme_vdev_start_continue = mon_mlme_start_continue,
2449 .mlme_vdev_up_send = mon_mlme_vdev_up_send,
2450 .mlme_vdev_disconnect_peers = mon_mlme_vdev_disconnect_peers,
2451 .mlme_vdev_stop_send = mon_mlme_vdev_stop_send,
2452 .mlme_vdev_down_send = mon_mlme_vdev_down_send,
2453 .mlme_vdev_ext_start_rsp = vdevmgr_vdev_start_rsp_handle,
2454 };
2455
2456 static struct mlme_ext_ops ext_ops = {
2457 .mlme_psoc_ext_hdl_create = psoc_mlme_ext_hdl_create,
2458 .mlme_psoc_ext_hdl_destroy = psoc_mlme_ext_hdl_destroy,
2459 .mlme_vdev_ext_hdl_create = vdevmgr_mlme_ext_hdl_create,
2460 .mlme_vdev_ext_hdl_destroy = vdevmgr_mlme_ext_hdl_destroy,
2461 .mlme_vdev_ext_hdl_post_create = vdevmgr_mlme_ext_post_hdl_create,
2462 .mlme_vdev_ext_delete_rsp = vdevmgr_vdev_delete_rsp_handle,
2463 .mlme_cm_ext_hdl_create_cb = cm_ext_hdl_create,
2464 .mlme_cm_ext_hdl_destroy_cb = cm_ext_hdl_destroy,
2465 .mlme_cm_ext_connect_start_ind_cb = cm_connect_start_ind,
2466 .mlme_cm_ext_connect_req_cb = cm_handle_connect_req,
2467 .mlme_cm_ext_bss_peer_create_req_cb = cm_send_bss_peer_create_req,
2468 .mlme_cm_ext_connect_complete_ind_cb = cm_connect_complete_ind,
2469 .mlme_cm_ext_disconnect_start_ind_cb = cm_disconnect_start_ind,
2470 .mlme_cm_ext_disconnect_req_cb = cm_handle_disconnect_req,
2471 .mlme_cm_ext_bss_peer_delete_req_cb = cm_send_bss_peer_delete_req,
2472 .mlme_cm_ext_disconnect_complete_ind_cb = cm_disconnect_complete_ind,
2473 .mlme_cm_ext_vdev_down_req_cb = cm_send_vdev_down_req,
2474 .mlme_cm_ext_reassoc_req_cb = cm_handle_reassoc_req,
2475 .mlme_cm_ext_roam_start_ind_cb = cm_handle_roam_start,
2476 .mlme_psoc_ext_hdl_enable = psoc_mlme_ext_hdl_enable,
2477 .mlme_psoc_ext_hdl_disable = psoc_mlme_ext_hdl_disable,
2478 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
2479 .mlme_vdev_send_set_mac_addr = vdevmgr_mlme_vdev_send_set_mac_addr,
2480 #endif
2481 .mlme_cm_ext_rso_stop_cb = cm_send_rso_stop,
2482 };
2483
2484 #ifdef WLAN_FEATURE_11BE_MLO
2485 static struct mlo_mlme_ext_ops mlo_ext_ops = {
2486 .mlo_mlme_ext_peer_create = lim_mlo_proc_assoc_req_frm,
2487 .mlo_mlme_ext_peer_delete = lim_mlo_cleanup_partner_peer,
2488 .mlo_mlme_ext_peer_assoc_fail = lim_mlo_ap_sta_assoc_fail,
2489 .mlo_mlme_ext_assoc_resp = lim_mlo_ap_sta_assoc_suc,
2490 .mlo_mlme_ext_handle_sta_csa_param = lim_handle_mlo_sta_csa_param,
2491 };
2492 #endif
2493