1 /*
2  * Copyright (c) 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 any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /*
19  * DOC: contains MLO manager public file containing common functionality
20  */
21 #ifndef _WLAN_MLO_MGR_CMN_H_
22 #define _WLAN_MLO_MGR_CMN_H_
23 
24 #include <qdf_types.h>
25 #include <qdf_trace.h>
26 #include "wlan_mlo_mgr_public_structs.h"
27 #include <wlan_mlo_mgr_main.h>
28 
29 #define mlo_alert(format, args...) \
30 		QDF_TRACE_FATAL(QDF_MODULE_ID_MLO, format, ## args)
31 
32 #define mlo_err(format, args...) \
33 		QDF_TRACE_ERROR(QDF_MODULE_ID_MLO, format, ## args)
34 
35 #define mlo_warn(format, args...) \
36 		QDF_TRACE_WARN(QDF_MODULE_ID_MLO, format, ## args)
37 
38 #define mlo_info(format, args...) \
39 		QDF_TRACE_INFO(QDF_MODULE_ID_MLO, format, ## args)
40 
41 #define mlo_debug(format, args...) \
42 		QDF_TRACE_DEBUG(QDF_MODULE_ID_MLO, format, ## args)
43 
44 #define mlo_nofl_alert(format, args...) \
45 		QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_MLO, format, ## args)
46 
47 #define mlo_nofl_err(format, args...) \
48 		QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_MLO, format, ## args)
49 
50 #define mlo_nofl_warn(format, args...) \
51 		QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_MLO, format, ## args)
52 
53 #define mlo_nofl_info(format, args...) \
54 		QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_MLO, format, ## args)
55 
56 #define mlo_nofl_debug(format, args...) \
57 		QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_MLO, format, ## args)
58 
59 #define mlo_alert_rl(format, args...) \
60 		QDF_TRACE_FATAL_RL(QDF_MODULE_ID_MLO, format, ## args)
61 
62 #define mlo_err_rl(format, args...) \
63 		QDF_TRACE_ERROR_RL(QDF_MODULE_ID_MLO, format, ## args)
64 
65 #define mlo_warn_rl(format, args...) \
66 		QDF_TRACE_WARN_RL(QDF_MODULE_ID_MLO, format, ## args)
67 
68 #define mlo_info_rl(format, args...) \
69 		QDF_TRACE_INFO_RL(QDF_MODULE_ID_MLO, format, ## args)
70 
71 #define mlo_debug_rl(format, args...) \
72 		QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_MLO, format, ## args)
73 
74 #define mlo_nofl_alert_rl(format, args...) \
75 		QDF_TRACE_FATAL_RL_NO_FL(QDF_MODULE_ID_MLO, format, ## args)
76 
77 #define mlo_nofl_err_rl(format, args...) \
78 		QDF_TRACE_ERROR_RL_NO_FL(QDF_MODULE_ID_MLO, format, ## args)
79 
80 #define mlo_nofl_warn_rl(format, args...) \
81 		QDF_TRACE_WARN_RL_NO_FL(QDF_MODULE_ID_MLO, format, ## args)
82 
83 #define mlo_nofl_info_rl(format, args...) \
84 		QDF_TRACE_INFO_RL_NO_FL(QDF_MODULE_ID_MLO, format, ## args)
85 
86 #define mlo_nofl_debug_rl(format, args...) \
87 		QDF_TRACE_DEBUG_RL_NO_FL(QDF_MODULE_ID_MLO, format, ## args)
88 
89 #if defined(WLAN_FEATURE_11BE_MLO_ENABLE_ENHANCED_TRACE)
90 #define mlo_etrace_debug(format, args...) \
91 		QDF_TRACE_DEBUG(QDF_MODULE_ID_MLO, format, ## args)
92 #define mlo_etrace_err_rl(format, args...) \
93 		QDF_TRACE_ERROR_RL(QDF_MODULE_ID_MLO, format, ## args)
94 #else
95 #define mlo_etrace_debug(format, args...)
96 #define mlo_etrace_err_rl(format, args...)
97 #endif
98 
99 #define MLO_INVALID_LINK_IDX 0xFF
100 /**
101  * mlo_get_link_information() - get partner link information
102  * @mld_addr : MLD address
103  * @info: partner link information
104  *
105  * Return: QDF_STATUS
106  */
107 void mlo_get_link_information(struct qdf_mac_addr *mld_addr,
108 			      struct mlo_link_info *info);
109 /**
110  * is_mlo_all_links_up() - check all the link status in a MLO device
111  * @ml_dev: ML device context
112  *
113  * Return: QDF_STATUS
114  */
115 void is_mlo_all_links_up(struct wlan_mlo_dev_context *ml_dev);
116 
117 /**
118  * mlo_get_vdev_by_link_id() - get vdev by link id
119  * @vdev: vdev pointer
120  * @link_id: link id
121  * @id: debug id
122  *
123  * Return: vdev object pointer to link id
124  */
125 struct wlan_objmgr_vdev *mlo_get_vdev_by_link_id(
126 			struct wlan_objmgr_vdev *vdev,
127 			uint8_t link_id, wlan_objmgr_ref_dbgid id);
128 
129 /**
130  * mlo_release_vdev_ref() - release vdev reference
131  * @vdev: vdev pointer
132  *
133  * Return: void
134  */
135 void mlo_release_vdev_ref(struct wlan_objmgr_vdev *vdev);
136 
137 /**
138  * mlo_reg_mlme_ext_cb() - Function to register mlme extended callbacks
139  * @ctx: Pointer to mlo manager global context
140  * @ops: Pointer to the struct containing the callbacks
141  *
142  * Return: QDF_STATUS_SUCCESS on successful registration else failure
143  */
144 QDF_STATUS mlo_reg_mlme_ext_cb(struct mlo_mgr_context *ctx,
145 			       struct mlo_mlme_ext_ops *ops);
146 
147 /**
148  * mlo_unreg_mlme_ext_cb() - Function to unregister mlme extended callbacks
149  * @ctx: Pointer to mlo manager global context
150  *
151  * Return: QDF_STATUS_SUCCESS on success else failure
152  */
153 QDF_STATUS mlo_unreg_mlme_ext_cb(struct mlo_mgr_context *ctx);
154 
155 #ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
156 /**
157  * wlan_mlo_mgr_register_osif_ext_ops() - Function to register OSIF callbacks
158  * @mlo_ctx: Global MLO manager pointer
159  * @ops: Pointer to the struct containing OSIF callbacks.
160  *
161  * Return: QDF_STATUS
162  */
163 QDF_STATUS wlan_mlo_mgr_register_osif_ext_ops(struct mlo_mgr_context *mlo_ctx,
164 					      struct mlo_osif_ext_ops *ops);
165 
166 /**
167  * wlan_mlo_mgr_unregister_osif_ext_ops() - Function to unregister OSIF
168  * callbacks
169  * @mlo_ctx: Global MLO manager pointer
170  *
171  * Return: QDF_STATUS
172  */
173 QDF_STATUS
174 wlan_mlo_mgr_unregister_osif_ext_ops(struct mlo_mgr_context *mlo_ctx);
175 #else
176 static inline QDF_STATUS
wlan_mlo_mgr_register_osif_ext_ops(struct mlo_mgr_context * mlo_ctx,struct mlo_osif_ext_ops * ops)177 wlan_mlo_mgr_register_osif_ext_ops(struct mlo_mgr_context *mlo_ctx,
178 				   struct mlo_osif_ext_ops *ops)
179 {
180 	return QDF_STATUS_SUCCESS;
181 }
182 
183 static inline QDF_STATUS
wlan_mlo_mgr_unregister_osif_ext_ops(struct mlo_mgr_context * mlo_ctx)184 wlan_mlo_mgr_unregister_osif_ext_ops(struct mlo_mgr_context *mlo_ctx)
185 {
186 	return QDF_STATUS_SUCCESS;
187 }
188 #endif
189 
190 /**
191  * mlo_mlme_clone_sta_security() - Clone Security params in partner vdevs
192  * @vdev: Object manager vdev
193  * @req: wlan_cm_connect_req data object to be passed to callback
194  *
195  * Return: QDF_STATUS
196  */
197 QDF_STATUS mlo_mlme_clone_sta_security(struct wlan_objmgr_vdev *vdev,
198 				       struct wlan_cm_connect_req *req);
199 
200 /**
201  * mlo_mlme_sta_op_class() - Update partner link op-class from ML-IE
202  * @vdev: Object manager vdev
203  * @ml_ie: buffer having the ML-IE from supplicant
204  *
205  * Return: QDF_STATUS
206  */
207 QDF_STATUS mlo_mlme_sta_op_class(struct wlan_objmgr_vdev *vdev,
208 				 uint8_t *ml_ie);
209 
210 /**
211  * mlo_mlme_validate_conn_req() - Validate connect request
212  * @vdev: Object manager vdev
213  * @ext_data: Data object to be passed to callback
214  *
215  * Return: QDF_STATUS
216  */
217 QDF_STATUS mlo_mlme_validate_conn_req(struct wlan_objmgr_vdev *vdev,
218 				      void *ext_data);
219 
220 /**
221  * mlo_mlme_create_link_vdev() - Create link vdev for ML STA
222  * @vdev: Object manager vdev
223  * @ext_data: Data object to be passed to callback
224  *
225  * Return: QDF_STATUS
226  */
227 QDF_STATUS mlo_mlme_create_link_vdev(struct wlan_objmgr_vdev *vdev,
228 				     void *ext_data);
229 
230 /**
231  * mlo_mlme_peer_create() - Create mlo peer
232  * @vdev: Object manager vdev
233  * @ml_peer: MLO peer context
234  * @addr: Peer addr
235  * @frm_buf: Frame buffer for IE processing
236  *
237  * Return: void
238  */
239 void mlo_mlme_peer_create(struct wlan_objmgr_vdev *vdev,
240 			  struct wlan_mlo_peer_context *ml_peer,
241 			  struct qdf_mac_addr *addr,
242 			  qdf_nbuf_t frm_buf);
243 
244 /**
245  * mlo_mlme_bridge_peer_create() - Create mlo bridge peer
246  * @vdev: Object manager vdev
247  * @ml_peer: MLO peer context
248  * @addr: Peer addr
249  * @frm_buf: Frame buffer for IE processing
250  *
251  * Return: void
252  */
253 void mlo_mlme_bridge_peer_create(struct wlan_objmgr_vdev *vdev,
254 				 struct wlan_mlo_peer_context *ml_peer,
255 				 struct qdf_mac_addr *addr,
256 				 qdf_nbuf_t frm_buf);
257 
258 /**
259  * mlo_mlme_peer_assoc() - Send ML Peer assoc
260  * @peer: Object manager peer
261  *
262  * Return: void
263  */
264 void mlo_mlme_peer_assoc(struct wlan_objmgr_peer *peer);
265 
266 /**
267  * mlo_mlme_peer_assoc_fail() - Send ML Peer assoc fail
268  * @peer: Object manager peer
269  *
270  * Return: void
271  */
272 void mlo_mlme_peer_assoc_fail(struct wlan_objmgr_peer *peer);
273 
274 /**
275  * mlo_mlme_peer_delete() - Send ML Peer delete
276  * @peer: Object manager peer
277  *
278  * Return: void
279  */
280 void mlo_mlme_peer_delete(struct wlan_objmgr_peer *peer);
281 
282 /**
283  * mlo_mlme_peer_assoc_resp() - Initiate sending of Assoc response
284  * @peer: Object manager peer
285  *
286  * Return: void
287  */
288 void mlo_mlme_peer_assoc_resp(struct wlan_objmgr_peer *peer);
289 
290 /**
291  * mlo_mlme_get_link_assoc_req() - API to get link assoc req buffer
292  * @peer: Object manager peer
293  * @link_ix: link id of vdev
294  *
295  * Return: assoc req buffer
296  */
297 qdf_nbuf_t mlo_mlme_get_link_assoc_req(struct wlan_objmgr_peer *peer,
298 				       uint8_t link_ix);
299 
300 /**
301  * mlo_mlme_peer_deauth() - Initiate deauth on link peer
302  * @peer: Object manager peer
303  * @is_disassoc: disassoc frame needs to be sent
304  *
305  * Return: void
306  */
307 void mlo_mlme_peer_deauth(struct wlan_objmgr_peer *peer, uint8_t is_disassoc);
308 
309 #ifdef UMAC_MLO_AUTH_DEFER
310 /**
311  * mlo_mlme_peer_process_auth() - Process deferred auth request
312  * @auth_param: deferred auth params
313  *
314  * Return: void
315  */
316 void mlo_mlme_peer_process_auth(struct mlpeer_auth_params *auth_param);
317 #else
318 static inline void
mlo_mlme_peer_process_auth(struct mlpeer_auth_params * auth_param)319 mlo_mlme_peer_process_auth(struct mlpeer_auth_params *auth_param)
320 {
321 }
322 #endif
323 
324 /**
325  * mlo_mlme_peer_reassoc() - Reassoc mlo peer
326  * @vdev: Object manager vdev
327  * @ml_peer: MLO peer context
328  * @addr: Peer addr
329  * @frm_buf: Frame buffer for IE processing
330  *
331  * Return: void
332  */
333 void mlo_mlme_peer_reassoc(struct wlan_objmgr_vdev *vdev,
334 			   struct wlan_mlo_peer_context *ml_peer,
335 			   struct qdf_mac_addr *addr,
336 			   qdf_nbuf_t frm_buf);
337 
338 /**
339  * mlo_get_link_vdev_ix() - Get index of link VDEV in MLD
340  * @mldev: ML device context
341  * @vdev: VDEV object
342  *
343  * Return: link index
344  */
345 
346 uint8_t mlo_get_link_vdev_ix(struct wlan_mlo_dev_context *mldev,
347 			     struct wlan_objmgr_vdev *vdev);
348 
349 /**
350  * mlo_get_ml_vdev_list() - get mlo vdev list
351  * @vdev: vdev pointer
352  * @vdev_count: vdev count
353  * @wlan_vdev_list: vdev list
354  *
355  * Caller should release ref of the vdevs in wlan_vdev_list
356  * Return: None
357  */
358 void mlo_get_ml_vdev_list(struct wlan_objmgr_vdev *vdev,
359 			  uint16_t *vdev_count,
360 			  struct wlan_objmgr_vdev **wlan_vdev_list);
361 
362 /**
363  * mlo_mlme_handle_sta_csa_param() - process saved mlo sta csa param
364  * @vdev: vdev pointer
365  * @csa_param: saved csa_param
366  *
367  * Return: None
368  */
369 void mlo_mlme_handle_sta_csa_param(struct wlan_objmgr_vdev *vdev,
370 				   struct csa_offload_params *csa_param);
371 
372 #define INVALID_HW_LINK_ID 0xFFFF
373 #define WLAN_MLO_INVALID_NUM_LINKS             (-1)
374 #ifdef WLAN_MLO_MULTI_CHIP
375 #define WLAN_MLO_GROUP_INVALID                 0xFF
376 #define WLAN_MLO_CHIP_ID_INVALID               0xFF
377 /**
378  * wlan_mlo_get_max_num_links() - Get the maximum number of MLO links
379  * possible in the system
380  * @grp_id: Id of the required MLO Group
381  *
382  * Return: Maximum number of MLO links in the system
383  */
384 int8_t wlan_mlo_get_max_num_links(uint8_t grp_id);
385 
386 /**
387  * wlan_mlo_get_num_active_links() - Get the number of active MLO links
388  * in the system
389  * @grp_id: Id of the required MLO Group
390  *
391  * Return: Number of active MLO links in the system
392  */
393 int8_t wlan_mlo_get_num_active_links(uint8_t grp_id);
394 
395 /**
396  * wlan_mlo_get_valid_link_bitmap() - Get the bitmap indicating the valid
397  * MLO links in the system. If bit position i is set, link with id i is
398  * valid.
399  * @grp_id: Id of the required MLO Group
400  *
401  * Return: Valid link bitmap
402  */
403 uint16_t wlan_mlo_get_valid_link_bitmap(uint8_t grp_id);
404 
405 /**
406  * wlan_mlo_get_pdev_hw_link_id() - Get hw_link_id of pdev
407  * @pdev: pdev object
408  *
409  * Return: hw_link_id of the pdev.
410  */
411 uint16_t wlan_mlo_get_pdev_hw_link_id(struct wlan_objmgr_pdev *pdev);
412 
413 /**
414  * wlan_mlo_get_psoc_group_id() - Get MLO group id of psoc
415  * @psoc: psoc object
416  *
417  * Return: MLO group id of the psoc
418  */
419 uint8_t wlan_mlo_get_psoc_group_id(struct wlan_objmgr_psoc *psoc);
420 
421 /**
422  * wlan_mlo_get_psoc_mlo_chip_id() - Get MLO chip id of psoc
423  * @psoc: psoc object
424  *
425  * Return: MLO group id of the psoc
426  */
427 uint8_t wlan_mlo_get_psoc_mlo_chip_id(struct wlan_objmgr_psoc *psoc);
428 
429 /**
430  * wlan_mlo_get_psoc_capable() - Get if MLO capable psoc
431  * @psoc: Pointer to psoc object
432  *
433  * Return: True if MLO capable else false
434  */
435 bool wlan_mlo_get_psoc_capable(struct wlan_objmgr_psoc *psoc);
436 
437 /**
438  * struct hw_link_id_iterator: Argument passed in psoc/pdev iterator to
439  *                             find pdev from hw_link_id
440  * @hw_link_id: HW link id of pdev to find
441  * @mlo_grp_id: MLO Group id which it belongs to
442  * @dbgid: Module ref id used in iterator
443  * @pdev: Pointer to pdev. This will be set inside itertor callback
444  *        if hw_link_id match is found.
445  */
446 struct hw_link_id_iterator {
447 	uint16_t hw_link_id;
448 	uint8_t mlo_grp_id;
449 	wlan_objmgr_ref_dbgid dbgid;
450 	struct wlan_objmgr_pdev *pdev;
451 };
452 
453 /**
454  * wlan_mlo_get_pdev_by_hw_link_id() - Get pdev object from hw_link_id
455  * @hw_link_id: HW link id of the pdev
456  * @ml_grp_id: MLO Group id which it belongs to
457  * @refdbgid: dbgid of module used for taking reference to pdev object
458  *
459  * Return: Pointer to pdev object if hw_link_id is valid. Else, NULL
460  *         Reference will be held with refdgid if return is non-NULL.
461  *         Caller should free this reference.
462  */
463 struct wlan_objmgr_pdev *
464 wlan_mlo_get_pdev_by_hw_link_id(uint16_t hw_link_id, uint8_t ml_grp_id,
465 				wlan_objmgr_ref_dbgid refdbgid);
466 
467 #else
468 static inline int8_t
wlan_mlo_get_max_num_links(uint8_t grp_id)469 wlan_mlo_get_max_num_links(uint8_t grp_id)
470 {
471 	return WLAN_MLO_INVALID_NUM_LINKS;
472 }
473 
474 static inline int8_t
wlan_mlo_get_num_active_links(uint8_t grp_id)475 wlan_mlo_get_num_active_links(uint8_t grp_id)
476 {
477 	return WLAN_MLO_INVALID_NUM_LINKS;
478 }
479 
480 static inline uint16_t
wlan_mlo_get_valid_link_bitmap(uint8_t grp_id)481 wlan_mlo_get_valid_link_bitmap(uint8_t grp_id)
482 {
483 	return 0;
484 }
485 
486 static inline struct wlan_objmgr_pdev *
wlan_mlo_get_pdev_by_hw_link_id(uint16_t hw_link_id,uint8_t ml_grp_id,wlan_objmgr_ref_dbgid refdbgid)487 wlan_mlo_get_pdev_by_hw_link_id(uint16_t hw_link_id, uint8_t ml_grp_id,
488 				wlan_objmgr_ref_dbgid refdbgid)
489 {
490 	return NULL;
491 }
492 
493 static inline
wlan_mlo_get_pdev_hw_link_id(struct wlan_objmgr_pdev * pdev)494 uint16_t wlan_mlo_get_pdev_hw_link_id(struct wlan_objmgr_pdev *pdev)
495 {
496 	return INVALID_HW_LINK_ID;
497 }
498 
499 static inline
wlan_mlo_get_psoc_group_id(struct wlan_objmgr_psoc * psoc)500 uint8_t wlan_mlo_get_psoc_group_id(struct wlan_objmgr_psoc *psoc)
501 {
502 	return -EINVAL;
503 }
504 
505 static inline
wlan_mlo_get_psoc_capable(struct wlan_objmgr_psoc * psoc)506 bool wlan_mlo_get_psoc_capable(struct wlan_objmgr_psoc *psoc)
507 {
508 	return false;
509 }
510 #endif/*WLAN_MLO_MULTI_CHIP*/
511 
512 #ifdef WLAN_FEATURE_11BE_MLO
513 /**
514  * mlo_process_link_set_active_resp() - handler for mlo link set active response
515  * @psoc: psoc pointer
516  * @event: pointer to mlo link set active response
517  *
518  * Return: QDF_STATUS
519  */
520 QDF_STATUS
521 mlo_process_link_set_active_resp(struct wlan_objmgr_psoc *psoc,
522 				 struct mlo_link_set_active_resp *event);
523 
524 /**
525  * mlo_ser_set_link_req() - add mlo link set active cmd to serialization
526  * @req: mlo link set active request
527  *
528  * Return: QDF_STATUS
529  */
530 QDF_STATUS mlo_ser_set_link_req(struct mlo_link_set_active_req *req);
531 
532 /**
533  * typedef mlo_vdev_ops_handler() - API to have operation on ml vdevs
534  * @vdev: vdev object
535  * @arg: operation-specific argument
536  */
537 typedef void (*mlo_vdev_ops_handler)(struct wlan_objmgr_vdev *vdev,
538 				     void *arg);
539 
540 /**
541  * mlo_iterate_ml_vdev_list() - Iterate on ML vdevs of MLD
542  * @vdev: vdev object
543  * @handler: the handler will be called for each object in ML list
544  * @arg: argument to be passed to handler
545  * @lock: Need to acquire lock or not
546  *
547  * Return: none
548  */
549 static inline
mlo_iterate_ml_vdev_list(struct wlan_objmgr_vdev * vdev,mlo_vdev_ops_handler handler,void * arg,bool lock)550 void mlo_iterate_ml_vdev_list(struct wlan_objmgr_vdev *vdev,
551 			      mlo_vdev_ops_handler handler,
552 			      void *arg, bool lock)
553 {
554 	struct wlan_mlo_dev_context *mlo_dev_ctx = NULL;
555 	uint8_t i = 0;
556 	QDF_STATUS status;
557 
558 	if (!vdev)
559 		return;
560 
561 	mlo_dev_ctx = vdev->mlo_dev_ctx;
562 	if (!mlo_dev_ctx || !(wlan_vdev_mlme_is_mlo_vdev(vdev)))
563 		return;
564 
565 	if (lock)
566 		mlo_dev_lock_acquire(mlo_dev_ctx);
567 
568 	for (i =  0; i < WLAN_UMAC_MLO_MAX_VDEVS; i++) {
569 		if (!mlo_dev_ctx->wlan_vdev_list[i])
570 			continue;
571 
572 		status = wlan_objmgr_vdev_try_get_ref(
573 					mlo_dev_ctx->wlan_vdev_list[i],
574 					WLAN_MLO_MGR_ID);
575 		if (QDF_IS_STATUS_ERROR(status))
576 			continue;
577 
578 		if (handler)
579 			handler(mlo_dev_ctx->wlan_vdev_list[i], arg);
580 
581 		mlo_release_vdev_ref(mlo_dev_ctx->wlan_vdev_list[i]);
582 	}
583 
584 	if (lock)
585 		mlo_dev_lock_release(mlo_dev_ctx);
586 }
587 
588 /**
589  * struct mlo_stats_vdev_params - vdev params for MLO stats request
590  * @ml_vdev_count: Num of connected mlo vdevs
591  * @ml_vdev_id: vdev_ids of ml vdevs
592  */
593 struct mlo_stats_vdev_params {
594 	uint8_t ml_vdev_count;
595 	uint8_t ml_vdev_id[WLAN_UMAC_MLO_MAX_VDEVS];
596 };
597 
598 /**
599  * mlo_get_mlstats_vdev_params() - Get vdev params for MLO stats
600  * @psoc: psoc object
601  * @vdev_id: vdev id
602  * @ml_vdev_info: pointer to mlo_stats_vdev_params
603  *
604  * Return: QDF_STATUS
605  */
606 QDF_STATUS
607 mlo_get_mlstats_vdev_params(struct wlan_objmgr_psoc *psoc,
608 			    struct mlo_stats_vdev_params *ml_vdev_info,
609 			    uint8_t vdev_id);
610 
611 /**
612  * typedef get_ml_link_state_cb() - api to handle link state callback
613  * @ev: pointer to event parameter of structure
614  * @cookie: a cookie for request context
615  */
616 typedef void (*get_ml_link_state_cb)(struct ml_link_state_info_event *ev,
617 				     void *cookie);
618 /**
619  * wlan_handle_ml_link_state_info_event() - Event handler for ml link state
620  * @psoc: psoc handler
621  * @event: pointer to event parameter of structure
622  */
623 QDF_STATUS
624 wlan_handle_ml_link_state_info_event(struct wlan_objmgr_psoc *psoc,
625 				     struct ml_link_state_info_event *event);
626 /**
627  * mlo_get_link_state_register_resp_cb() - Register link state callback
628  * @vdev: vdev handler
629  * @req: pointer to request parameter of structure
630  */
631 QDF_STATUS
632 mlo_get_link_state_register_resp_cb(struct wlan_objmgr_vdev *vdev,
633 				    struct ml_link_state_cmd_info *req);
634 /**
635  * ml_post_get_link_state_msg() - Post get link state msg
636  * @vdev: vdev handler
637  */
638 QDF_STATUS ml_post_get_link_state_msg(struct wlan_objmgr_vdev *vdev);
639 
640 #endif
641 #ifdef WLAN_FEATURE_11BE
642 /**
643  * util_add_bw_ind() - Adding bandwidth indiacation element
644  * @bw_ind: pointer to bandwidth indication element
645  * @ccfs0: EHT Channel Centre Frequency Segment0 information
646  * @ccfs1: EHT Channel Centre Frequency Segment1 information
647  * @ch_width: channel width
648  * @puncture_bitmap: puncturing information
649  * @bw_ind_len: pointer to length of bandwidth indication element
650  */
651 QDF_STATUS
652 util_add_bw_ind(struct wlan_ie_bw_ind *bw_ind, uint8_t ccfs0,
653 		uint8_t ccfs1, enum phy_ch_width ch_width,
654 		uint16_t puncture_bitmap, int *bw_ind_len);
655 
656 /**
657  * util_parse_bw_ind() - Parsing of bandwidth indiacation element
658  * @bw_ind: pointer to bandwidth indication element
659  * @ccfs0: EHT Channel Centre Frequency Segment0 information
660  * @ccfs1: EHT Channel Centre Frequency Segment1 information
661  * @ch_width: channel width
662  * @puncture_bitmap: puncturing information
663  */
664 
665 QDF_STATUS
666 util_parse_bw_ind(struct wlan_ie_bw_ind *bw_ind, uint8_t *ccfs0,
667 		  uint8_t *ccfs1, enum phy_ch_width *ch_width,
668 		  uint16_t *puncture_bitmap);
669 #endif
670 
671 #ifdef QCA_SUPPORT_PRIMARY_LINK_MIGRATE
672 /**
673  * mlo_mlme_ptqm_migrate_timer_cb() - Timer callback for ptqm migration
674  * @arg: timer function argument
675  *
676  * Return: None
677  */
678 void mlo_mlme_ptqm_migrate_timer_cb(void *arg);
679 
680 /*
681  * wlan_mlo_set_ptqm_migration() - API to trigger ptqm migration.
682  * @vdev: vdev object
683  * @ml_peer: ml peer object
684  * @link_migration: flag to indicate if all peers of vdev need migration
685  * or individual peer migration
686  * @link_id: link id for new ptqm
687  * @force_mig: allow migration to vdevs which are disabled to be pumac
688  * using primary_umac_skip ini
689  *
690  * Return: Success if migration is triggered, else failure
691  */
692 QDF_STATUS wlan_mlo_set_ptqm_migration(struct wlan_objmgr_vdev *vdev,
693 				       struct wlan_mlo_peer_context *ml_peer,
694 				       bool link_migration,
695 				       uint32_t link_id,
696 				       bool force_mig);
697 #endif
698 
699 /*
700  * wlan_mlo_is_csa_allow() - API to check if CSA allowed for MLO vdev
701  * @vdev: vdev object
702  * @csa_freq: CSA target freq
703  *
704  * Return: true if CSA allowed
705  */
706 bool
707 wlan_mlo_is_csa_allow(struct wlan_objmgr_vdev *vdev, uint16_t csa_freq);
708 #endif
709