xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h (revision 8cfe6b10058a04cafb17eed051f2ddf11bee8931)
1 /*
2  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 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 structure definitions
20  */
21 #ifndef __MLO_MGR_PUBLIC_STRUCTS_H
22 #define __MLO_MGR_PUBLIC_STRUCTS_H
23 
24 #include <wlan_objmgr_cmn.h>
25 #include <qdf_list.h>
26 #include <qdf_atomic.h>
27 #include <qdf_nbuf.h>
28 #include <wlan_cmn_ieee80211.h>
29 #include <wlan_cmn.h>
30 #include <wlan_objmgr_global_obj.h>
31 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP)
32 #include <qdf_event.h>
33 #endif
34 #include <wlan_mlo_t2lm.h>
35 
36 /* MAX MLO dev support */
37 #ifndef WLAN_UMAC_MLO_MAX_VDEVS
38 #define WLAN_UMAC_MLO_MAX_VDEVS 2
39 #endif
40 
41 /* MAX instances of ML devices */
42 #ifndef WLAN_UMAC_MLO_MAX_DEV
43 #define WLAN_UMAC_MLO_MAX_DEV 2
44 #endif
45 
46 /* Max PEER support */
47 #define MAX_MLO_PEER 512
48 
49 struct mlo_mlme_ext_ops;
50 struct vdev_mlme_obj;
51 struct wlan_t2lm_context;
52 
53 /* Max LINK PEER support */
54 #define MAX_MLO_LINK_PEERS WLAN_UMAC_MLO_MAX_VDEVS
55 
56 /* MAX MLO peer_id supported by FW is 128 */
57 #define MAX_MLO_PEER_ID 128
58 #define MLO_INVALID_PEER_ID 0xFFFF
59 
60 /* IE nomenclature */
61 #define ID_POS 0
62 #define TAG_LEN_POS 1
63 #define IDEXT_POS 2
64 #define MIN_IE_LEN 2
65 #define MULTI_LINK_CTRL_1 3
66 #define MULTI_LINK_CTRL_2 4
67 #define STA_CTRL_1 2
68 #define STA_CTRL_2 3
69 #define STA_PROFILE_SUB_ELEM_ID 0
70 #define PER_STA_PROF_MAC_ADDR_START 4
71 
72 #ifdef WLAN_MLO_MULTI_CHIP
73 
74 #ifndef WLAN_MAX_MLO_GROUPS
75 #define WLAN_MAX_MLO_GROUPS 2
76 #endif
77 
78 /**
79  * enum MLO_LINK_STATE - MLO link state enums
80  * @MLO_LINK_SETUP_INIT: MLO link SETUP exchange not yet done
81  * @MLO_LINK_SETUP_DONE: MLO link SETUP exchange started
82  * @MLO_LINK_READY: MLO link SETUP done and READY sent
83  * @MLO_LINK_TEARDOWN: MLO teardown done.
84  * @MLO_LINK_UNINITIALIZED: MLO link in blank state
85  */
86 enum MLO_LINK_STATE {
87 	MLO_LINK_SETUP_INIT,
88 	MLO_LINK_SETUP_DONE,
89 	MLO_LINK_READY,
90 	MLO_LINK_TEARDOWN,
91 	MLO_LINK_UNINITIALIZED,
92 };
93 
94 /**
95  * enum MLO_SOC_LIST - MLO SOC LIST
96  * @WLAN_MLO_GROUP_DEFAULT_SOC_LIST:  All MLO SoCs that are part of this MLO
97  *                                    group, (inclusive of both setup sequence
98  *                                    completed, not yet completed)
99  * @WLAN_MLO_GROUP_CURRENT_SOC_LIST:  Current MLO SoCs that are probed for which
100  *                                    the setup sequence has been completed
101  */
102 enum MLO_SOC_LIST {
103 	WLAN_MLO_GROUP_DEFAULT_SOC_LIST,
104 	WLAN_MLO_GROUP_CURRENT_SOC_LIST,
105 };
106 
107 /*
108  * Maximum number of MLO LINKS across the system,
109  * this is not the MLO links within and AP-MLD.
110  */
111 
112 #define MAX_MLO_LINKS 6
113 #define MAX_MLO_CHIPS 5
114 
115 /**
116  * struct mlo_setup_info: MLO setup status per link
117  * @ml_grp_id: Unique id for ML grouping of Pdevs/links
118  * @tot_socs: Total number of soc participating in ML group
119  * @num_soc: Number of soc ready or probed
120  * @tot_links: Total links in ML group
121  * @num_links: Number of links probed in ML group
122  * @pdev_list: current pdev pointers belonging to this group
123  * @curr_soc_list: current psoc pointers belonging to this group
124  * @soc_list: Actual psoc pointers part of this group
125  * @soc_id_list: list of soc ids part of this mlo group
126  * @state: MLO link state
127  * @valid_link_bitmap: valid MLO link bitmap
128  * @state_lock: lock to protect access to link state
129  * @event: event for teardown completion
130  * @dp_handle: pointer to DP ML context
131  */
132 struct mlo_setup_info {
133 	uint8_t ml_grp_id;
134 	uint8_t tot_socs;
135 	uint8_t num_soc;
136 	uint8_t tot_links;
137 	uint8_t num_links;
138 	struct wlan_objmgr_pdev *pdev_list[MAX_MLO_LINKS];
139 	struct wlan_objmgr_psoc *curr_soc_list[MAX_MLO_CHIPS];
140 	struct wlan_objmgr_psoc *soc_list[MAX_MLO_CHIPS];
141 	uint8_t soc_id_list[MAX_MLO_CHIPS];
142 	enum MLO_LINK_STATE state[MAX_MLO_LINKS];
143 	uint16_t valid_link_bitmap;
144 	qdf_spinlock_t state_lock;
145 	qdf_event_t event;
146 	struct cdp_mlo_ctxt *dp_handle;
147 };
148 
149 /**
150  * struct mlo_state_params: MLO state params for pdev iteration
151  * @link_state_fail: Flag to check when pdev not in expected state
152  * @check_state: State on against which pdev is to be expected
153  * @grp_id: Id of the required MLO Group
154  */
155 struct mlo_state_params {
156 	bool link_state_fail;
157 	enum MLO_LINK_STATE check_state;
158 	uint8_t grp_id;
159 };
160 
161 #endif
162 
163 /*
164  * struct mlo_mgr_context - MLO manager context
165  * @ml_dev_list_lock: ML DEV list lock
166  * @aid_lock: AID global lock
167  * @ml_peerid_lock: ML peer ID global lock
168  * @ml_dev_list: Array of MLO device context
169  * @mlo_peer_id_bmap: bitmap to allocate MLO Peer ID
170  * @max_mlo_peer_id: Max MLO Peer ID
171  * @last_mlo_peer_id: Previously allocated ML peer ID
172  * @setup_info: Pointer to MLO setup_info of all groups
173  * @total_grp: Total number of MLO groups
174  * @mlme_ops: MLO MLME callback function pointers
175  * @msgq_ctx: Context switch mgr
176  * @mlo_is_force_primary_umac: Force Primary UMAC enable
177  * @mlo_forced_primary_umac_id: Force Primary UMAC ID
178  *
179  * NB: not using kernel-doc format since the kernel-doc script doesn't
180  *     handle the qdf_bitmap() macro
181  */
182 struct mlo_mgr_context {
183 #ifdef WLAN_MLO_USE_SPINLOCK
184 	qdf_spinlock_t ml_dev_list_lock;
185 	qdf_spinlock_t aid_lock;
186 	qdf_spinlock_t ml_peerid_lock;
187 #else
188 	qdf_mutex_t ml_dev_list_lock;
189 	qdf_mutex_t aid_lock;
190 	qdf_mutex_t ml_peerid_lock;
191 #endif
192 	qdf_list_t ml_dev_list;
193 	qdf_bitmap(mlo_peer_id_bmap, MAX_MLO_PEER_ID);
194 	uint16_t max_mlo_peer_id;
195 	uint16_t last_mlo_peer_id;
196 #ifdef WLAN_MLO_MULTI_CHIP
197 	struct mlo_setup_info *setup_info;
198 	uint8_t total_grp;
199 #endif
200 	struct mlo_mlme_ext_ops *mlme_ops;
201 	struct ctxt_switch_mgr *msgq_ctx;
202 	bool mlo_is_force_primary_umac;
203 	uint8_t mlo_forced_primary_umac_id;
204 };
205 
206 /*
207  * struct wlan_ml_vdev_aid_mgr - ML AID manager
208  * @aid_bitmap: AID bitmap array
209  * @start_aid: start of AID index
210  * @max_aid: Max allowed AID
211  * @aid_mgr:  Array of link vdev aid mgr
212  *
213  * NB: not using kernel-doc format since the kernel-doc script doesn't
214  *     handle the qdf_bitmap() macro
215  */
216 struct wlan_ml_vdev_aid_mgr {
217 	qdf_bitmap(aid_bitmap, WLAN_UMAC_MAX_AID);
218 	uint16_t start_aid;
219 	uint16_t max_aid;
220 	struct wlan_vdev_aid_mgr *aid_mgr[WLAN_UMAC_MLO_MAX_VDEVS];
221 };
222 
223 /**
224  * struct wlan_mlo_key_mgmt - MLO key management
225  * @link_mac_address: list of vdevs selected for connection with the MLAP
226  * @vdev_id: vdev id value
227  * @keys_saved: keys saved bool
228  */
229 struct wlan_mlo_key_mgmt {
230 	struct qdf_mac_addr link_mac_address;
231 	uint8_t vdev_id;
232 	bool keys_saved;
233 };
234 
235 /**
236  * struct mlo_sta_csa_params - CSA request parameters in mlo mgr
237  * @csa_param: csa parameters
238  * @link_id: the link index of AP which triggers CSA
239  * @mlo_csa_synced: Before vdev is up, csa information is only saved but not
240  *                  handled, and this value is false. Once vdev is up, the saved
241  *                  csa information is handled, and this value is changed to
242  *                  true. Note this value will be true if the vdev is doing
243  *                  restart.
244  * @csa_offload_event_recvd: True if WMI_CSA_HANDLING_EVENTID is already
245  *                           received. False if this is the first
246  *                           WMI_CSA_HANDLING_EVENTID.
247  * @valid_csa_param: True once csa_param is filled.
248  */
249 struct mlo_sta_csa_params {
250 	struct csa_offload_params csa_param;
251 	uint8_t link_id;
252 	bool mlo_csa_synced;
253 	bool csa_offload_event_recvd;
254 	bool valid_csa_param;
255 };
256 
257 /**
258  * struct mlo_sta_cu_params - critical update parameters in mlo mgr
259  * @vdev_id: vdev id
260  * @bpcc: bss parameter change count
261  * @initialized: flag about the parameter is valid or not
262  */
263 struct mlo_sta_cu_params {
264 	uint8_t vdev_id;
265 	uint8_t bpcc;
266 	bool initialized;
267 };
268 
269 /**
270  * struct mlo_sta_quiet_status - MLO sta quiet status
271  * @link_id: link id
272  * @quiet_status: true if corresponding ap in quiet status
273  * @valid_status: true if mlo_sta_quiet_status is filled
274  */
275 struct mlo_sta_quiet_status {
276 	uint8_t link_id;
277 	bool quiet_status;
278 	bool valid_status;
279 };
280 
281 /*
282  * struct wlan_mlo_sta - MLO sta additional info
283  * @wlan_connect_req_links: list of vdevs selected for connection with the MLAP
284  * @wlan_connected_links: list of vdevs associated with this MLO connection
285  * @key_mgmt:
286  * @connect_req: connect params
287  * @copied_conn_req: original connect req
288  * @copied_conn_req_lock: lock for the original connect request
289  * @assoc_rsp: Raw assoc response frame
290  * @mlo_quiet_status:
291  * @mlo_csa_param: CSA request parameters for mlo sta
292  * @mlo_cu_param: critical update parameters for mlo sta
293  * @disconn_req: disconnect req params
294  * @copied_reassoc_rsp: Reassoc response copied from assoc link roam handling
295  *                      to re-use while link connect in case of deferred/need
296  *                      basis link connect (e.g. MLO OWE roaming).
297  *
298  * NB: not using kernel-doc format since the kernel-doc script doesn't
299  *     handle the qdf_bitmap() macro
300  */
301 struct wlan_mlo_sta {
302 	qdf_bitmap(wlan_connect_req_links, WLAN_UMAC_MLO_MAX_VDEVS);
303 	qdf_bitmap(wlan_connected_links, WLAN_UMAC_MLO_MAX_VDEVS);
304 	struct wlan_mlo_key_mgmt key_mgmt[WLAN_UMAC_MLO_MAX_VDEVS - 1];
305 	struct wlan_cm_connect_req *connect_req;
306 	struct wlan_cm_connect_req *copied_conn_req;
307 #ifdef WLAN_MLO_USE_SPINLOCK
308 	qdf_spinlock_t copied_conn_req_lock;
309 #else
310 	qdf_mutex_t copied_conn_req_lock;
311 #endif
312 	struct element_info assoc_rsp;
313 	struct mlo_sta_quiet_status mlo_quiet_status[WLAN_UMAC_MLO_MAX_VDEVS];
314 	struct mlo_sta_csa_params mlo_csa_param[WLAN_UMAC_MLO_MAX_VDEVS];
315 	struct mlo_sta_cu_params mlo_cu_param[WLAN_UMAC_MLO_MAX_VDEVS];
316 	struct wlan_cm_disconnect_req *disconn_req;
317 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
318 	struct wlan_cm_connect_resp *copied_reassoc_rsp;
319 #endif
320 };
321 
322 /*
323  * struct wlan_mlo_ap - MLO AP related info
324  * @num_ml_vdevs: number of vdevs to form MLD
325  * @ml_aid_mgr: ML AID mgr
326  * @mlo_ap_lock: lock to sync VDEV SM event
327  * @mlo_vdev_quiet_bmap: Bitmap of vdevs for which quiet ie needs to enabled
328  *
329  * NB: not using kernel-doc format since the kernel-doc script doesn't
330  *     handle the qdf_bitmap() macro
331  */
332 struct wlan_mlo_ap {
333 	uint8_t num_ml_vdevs;
334 	struct wlan_ml_vdev_aid_mgr *ml_aid_mgr;
335 #ifdef WLAN_MLO_USE_SPINLOCK
336 	qdf_spinlock_t mlo_ap_lock;
337 #else
338 	qdf_mutex_t mlo_ap_lock;
339 #endif
340 	qdf_bitmap(mlo_vdev_quiet_bmap, WLAN_UMAC_MLO_MAX_VDEVS);
341 };
342 
343 /**
344  * struct wlan_mlo_peer_list - MLO peer list entry
345  * @peer_hash: MLO peer hash code
346  * @peer_list_lock: lock to access members of structure
347  */
348 struct wlan_mlo_peer_list {
349 	qdf_list_t peer_hash[WLAN_PEER_HASHSIZE];
350 #ifdef WLAN_MLO_USE_SPINLOCK
351 	qdf_spinlock_t peer_list_lock;
352 #else
353 	qdf_mutex_t peer_list_lock;
354 #endif
355 };
356 
357 /**
358  * struct wlan_mlo_dev_context - MLO device context
359  * @node: QDF list node member
360  * @mld_id: MLD id
361  * @mld_addr: MLO device MAC address
362  * @wlan_vdev_list: list of vdevs associated with this MLO connection
363  * @wlan_vdev_count: number of elements in the vdev list
364  * @mlo_peer_list: list peers in this MLO connection
365  * @wlan_max_mlo_peer_count: peer count across the links of specific MLO
366  * @mlo_dev_lock: lock to access struct
367  * @tsf_recalculation_lock: Lock to protect TSF (re)calculation
368  * @ref_cnt: reference count
369  * @ref_id_dbg: Reference count debug information
370  * @sta_ctx: MLO STA related information
371  * @ap_ctx: AP related information
372  * @t2lm_ctx: T2LM related information
373  */
374 struct wlan_mlo_dev_context {
375 	qdf_list_node_t node;
376 	uint8_t mld_id;
377 	struct qdf_mac_addr mld_addr;
378 	struct wlan_objmgr_vdev *wlan_vdev_list[WLAN_UMAC_MLO_MAX_VDEVS];
379 	uint16_t wlan_vdev_count;
380 	struct wlan_mlo_peer_list mlo_peer_list;
381 	uint16_t wlan_max_mlo_peer_count;
382 #ifdef WLAN_MLO_USE_SPINLOCK
383 	qdf_spinlock_t mlo_dev_lock;
384 	qdf_spinlock_t tsf_recalculation_lock;
385 #else
386 	qdf_mutex_t mlo_dev_lock;
387 	qdf_mutex_t tsf_recalculation_lock;
388 #endif
389 	qdf_atomic_t ref_cnt;
390 	qdf_atomic_t ref_id_dbg[WLAN_REF_ID_MAX];
391 	struct wlan_mlo_sta *sta_ctx;
392 	struct wlan_mlo_ap *ap_ctx;
393 	struct wlan_t2lm_context t2lm_ctx;
394 };
395 
396 /**
397  * struct wlan_mlo_link_peer_entry - Link peer entry
398  * @link_peer: Object manager peer
399  * @link_addr: MAC address of link peer
400  * @link_ix: Link index
401  * @is_primary: sets true if the peer is primary UMAC’s peer
402  * @hw_link_id: HW Link id of peer
403  * @assoc_rsp_buf: Assoc resp buffer
404  */
405 struct wlan_mlo_link_peer_entry {
406 	struct wlan_objmgr_peer *link_peer;
407 	struct qdf_mac_addr link_addr;
408 	uint8_t link_ix;
409 	bool is_primary;
410 	uint8_t hw_link_id;
411 	qdf_nbuf_t assoc_rsp_buf;
412 };
413 
414 /**
415  * enum mlo_peer_state - MLO peer state
416  * @ML_PEER_CREATED:     Initial state
417  * @ML_PEER_ASSOC_DONE:  ASSOC sent on assoc link
418  * @ML_PEER_DISCONN_INITIATED: Disconnect initiated on one of the links
419  */
420 enum mlo_peer_state {
421 	ML_PEER_CREATED,
422 	ML_PEER_ASSOC_DONE,
423 	ML_PEER_DISCONN_INITIATED,
424 };
425 
426 #if defined(UMAC_SUPPORT_MLNAWDS) || defined(MESH_MODE_SUPPORT)
427 /**
428  * struct mlnawds_config - MLO NAWDS configuration
429  * @caps: Bandwidth & NSS capabilities to be configured on NAWDS peer
430  * @puncture_bitmap: puncture bitmap to be configured on NAWDS peer
431  * @mac: MAC address of the NAWDS peer to which the caps & puncture bitmap is
432  * to be configured.
433  */
434 struct mlnawds_config {
435 	uint64_t caps;
436 	uint16_t puncture_bitmap;
437 	uint8_t  mac[QDF_MAC_ADDR_SIZE];
438 };
439 #endif
440 
441 /**
442  * struct mlpeer_auth_params - Deferred Auth params
443  * @vdev_id:  VDEV ID
444  * @psoc_id:  PSOC ID
445  * @link_addr: MAC address
446  * @mldaddr: MLD MAC address
447  * @algo:  Auth algorithm
448  * @seq: Auth sequence number
449  * @status_code: Auth status
450  * @challenge: Auth Challenge
451  * @challenge_length: Auth Challenge length
452  * @wbuf:  Auth wbuf
453  * @rs: Rx stats
454  */
455 struct mlpeer_auth_params {
456 	uint8_t vdev_id;
457 	uint8_t psoc_id;
458 	struct qdf_mac_addr link_addr;
459 	struct qdf_mac_addr mldaddr;
460 	uint16_t algo;
461 	uint16_t seq;
462 	uint16_t status_code;
463 	uint8_t *challenge;
464 	uint8_t challenge_length;
465 	qdf_nbuf_t wbuf;
466 	void *rs;
467 };
468 
469 /**
470  * struct wlan_mlo_eml_cap - EML capabilities of MLD
471  * @emlsr_supp: eMLSR Support
472  * @emlsr_pad_delay: eMLSR Padding Delay
473  * @emlsr_trans_delay: eMLSR transition delay
474  * @emlmr_supp: eMLMR Support
475  * @emlmr_delay: eMLMR Delay
476  * @trans_timeout: Transition Timeout
477  * @reserved: Reserved
478  */
479 struct wlan_mlo_eml_cap {
480 	uint16_t emlsr_supp:1,
481 		 emlsr_pad_delay:3,
482 		 emlsr_trans_delay:3,
483 		 emlmr_supp:1,
484 		 emlmr_delay:3,
485 		 trans_timeout:4,
486 		 reserved:1;
487 };
488 
489 /**
490  * struct wlan_mlo_msd_cap - MSD capabilities of MLD
491  * @medium_sync_duration: Medium Sync Duration
492  * @medium_sync_ofdm_ed_thresh: MSD threshold value
493  * @medium_sync_max_txop_num: Max number of TXOP
494  */
495 struct wlan_mlo_msd_cap {
496 	uint16_t medium_sync_duration:8,
497 		 medium_sync_ofdm_ed_thresh:4,
498 		 medium_sync_max_txop_num:4;
499 };
500 
501 /**
502  * struct wlan_mlo_mld_cap - MLD capabilities of MLD
503  * @max_simult_link: Maximum number of simultaneous links
504  * @srs_support: SRS support
505  * @tid2link_neg_support: TID to Link Negotiation Support
506  * @str_freq_sep: Frequency separation suggested by STR non-AP MLD
507  *                OR Type of AP-MLD
508  * @aar_support: AAR Support
509  * @reserved: Reserved
510  */
511 struct wlan_mlo_mld_cap {
512 	uint16_t max_simult_link:4,
513 		 srs_support:1,
514 		 tid2link_neg_support:2,
515 		 str_freq_sep:5,
516 		 aar_support:1,
517 		 reserved:3;
518 };
519 
520 /**
521  * struct wlan_mlo_peer_context - MLO peer context
522  *
523  * @peer_node:     peer list node for ml_dev qdf list
524  * @peer_list: list of peers on the MLO link
525  * @link_peer_cnt: Number of link peers attached
526  * @max_links: Max links for this ML peer
527  * @mlo_peer_id: unique ID for the peer
528  * @peer_mld_addr: MAC address of MLD link
529  * @mlo_ie: MLO IE struct
530  * @mlo_peer_lock: lock to access peer structure
531  * @assoc_id: Assoc ID derived by MLO manager
532  * @primary_umac_psoc_id:
533  * @ref_cnt: Reference counter to avoid use after free
534  * @ml_dev: MLO dev context
535  * @mlpeer_state: MLO peer state
536  * @avg_link_rssi: avg RSSI of ML peer
537  * @is_nawds_ml_peer: flag to indicate if ml_peer is NAWDS configured
538  * @nawds_config: eack link peer's NAWDS configuration
539  * @pending_auth: Holds pending auth request
540  * @t2lm_policy: TID-to-link mapping information
541  * @msd_cap_present: Medium Sync Capability present bit
542  * @mlpeer_emlcap: EML capability information for ML peer
543  * @mlpeer_msdcap: Medium Sync Delay capability information for ML peer
544  * @is_mesh_ml_peer: flag to indicate if ml_peer is MESH configured
545  * @mesh_config: eack link peer's MESH configuration
546  */
547 struct wlan_mlo_peer_context {
548 	qdf_list_node_t peer_node;
549 	struct wlan_mlo_link_peer_entry peer_list[MAX_MLO_LINK_PEERS];
550 	uint8_t link_peer_cnt;
551 	uint8_t max_links;
552 	uint32_t mlo_peer_id;
553 	struct qdf_mac_addr peer_mld_addr;
554 	uint8_t *mlo_ie;
555 #ifdef WLAN_MLO_USE_SPINLOCK
556 	qdf_spinlock_t mlo_peer_lock;
557 #else
558 	qdf_mutex_t mlo_peer_lock;
559 #endif
560 	uint16_t assoc_id;
561 	uint8_t primary_umac_psoc_id;
562 	qdf_atomic_t ref_cnt;
563 	struct wlan_mlo_dev_context *ml_dev;
564 	enum mlo_peer_state mlpeer_state;
565 	int8_t avg_link_rssi;
566 #ifdef UMAC_SUPPORT_MLNAWDS
567 	bool is_nawds_ml_peer;
568 	struct mlnawds_config nawds_config[MAX_MLO_LINK_PEERS];
569 #endif
570 #ifdef UMAC_MLO_AUTH_DEFER
571 	struct mlpeer_auth_params *pending_auth[MAX_MLO_LINK_PEERS];
572 #endif
573 #ifdef WLAN_FEATURE_11BE
574 	struct wlan_mlo_peer_t2lm_policy t2lm_policy;
575 #endif
576 	bool msd_cap_present;
577 	struct wlan_mlo_eml_cap mlpeer_emlcap;
578 	struct wlan_mlo_msd_cap mlpeer_msdcap;
579 #ifdef MESH_MODE_SUPPORT
580 	bool is_mesh_ml_peer;
581 	struct mlnawds_config mesh_config[MAX_MLO_LINK_PEERS];
582 #endif
583 };
584 
585 /**
586  * struct mlo_link_info - ML link info
587  * @link_addr: link mac address
588  * @link_id: link index
589  * @chan_freq: Operating channel frequency
590  * @nawds_config: peer's NAWDS configurarion
591  * @vdev_id: VDEV ID
592  * @mesh_config: peer's MESH configurarion
593  */
594 struct mlo_link_info {
595 	struct qdf_mac_addr link_addr;
596 	uint8_t link_id;
597 	uint16_t chan_freq;
598 #ifdef UMAC_SUPPORT_MLNAWDS
599 	struct mlnawds_config nawds_config;
600 #endif
601 	uint8_t vdev_id;
602 #ifdef MESH_MODE_SUPPORT
603 	struct mlnawds_config mesh_config;
604 #endif
605 };
606 
607 /**
608  * struct mlo_partner_info - mlo partner link info
609  * @num_partner_links: no. of partner links
610  * @partner_link_info: per partner link info
611  * @t2lm_enable_val: enum wlan_t2lm_enable
612  */
613 struct mlo_partner_info {
614 	uint8_t num_partner_links;
615 	struct mlo_link_info partner_link_info[WLAN_UMAC_MLO_MAX_VDEVS];
616 #ifdef WLAN_FEATURE_11BE
617 	enum wlan_t2lm_enable t2lm_enable_val;
618 #endif
619 };
620 
621 /**
622  * struct mlo_probereq_info - mlo probe req link info
623  * @mlid: MLID requested in the probe req
624  * @num_links: no. of link info in probe req
625  * @link_id: target link id of APs
626  * @is_mld_id_valid: Indicates if mld_id is valid for a given request
627  * @skip_mbssid: Skip mbssid IE
628  */
629 struct mlo_probereq_info {
630 	uint8_t mlid;
631 	uint8_t num_links;
632 	uint8_t link_id[WLAN_UMAC_MLO_MAX_VDEVS];
633 	bool is_mld_id_valid;
634 	bool skip_mbssid;
635 };
636 
637 /**
638  * struct ml_rv_partner_link_info: Partner link information of an ML reconfig IE
639  * @link_id: Link id advertised by the AP
640  * @is_delete_timer_p: Delete timer is present or not
641  * @delete_timer: number of TBTTs of the AP
642  */
643 struct ml_rv_partner_link_info {
644 	uint8_t link_id;
645 	uint8_t is_delete_timer_p;
646 	uint16_t delete_timer;
647 };
648 
649 /**
650  * struct ml_rv_info: Reconfig Multi link information of a 11be beacon
651  * @mld_mac_addr: MLD mac address
652  * @num_links: Number of links supported by ML AP
653  * @link_info: Array containing partner links information
654  */
655 struct ml_rv_info {
656 	struct qdf_mac_addr mld_mac_addr;
657 	uint8_t num_links;
658 	struct ml_rv_partner_link_info link_info[WLAN_UMAC_MLO_MAX_VDEVS];
659 };
660 
661 /**
662  * struct mlo_tgt_link_info - ML target link info
663  * @vdev_id: link peer vdev id
664  * @hw_mld_link_id: HW link id
665  */
666 struct mlo_tgt_link_info {
667 	uint8_t vdev_id;
668 	uint8_t hw_mld_link_id;
669 };
670 
671 /**
672  * struct mlo_tgt_partner_info - mlo target partner link info
673  * @num_partner_links: no. of partner links
674  * @link_info: per partner link info
675  */
676 struct mlo_tgt_partner_info {
677 	uint8_t num_partner_links;
678 	struct mlo_tgt_link_info link_info[WLAN_UMAC_MLO_MAX_VDEVS];
679 };
680 
681 /**
682  * struct mlo_mlme_ext_ops - MLME callback functions
683  * @mlo_mlme_ext_validate_conn_req: Callback to validate connect request
684  * @mlo_mlme_ext_create_link_vdev: Callback to create link vdev for ML STA
685  * @mlo_mlme_ext_peer_create: Callback to create link peer
686  * @mlo_mlme_ext_peer_assoc: Callback to initiate peer assoc
687  * @mlo_mlme_ext_peer_assoc_fail: Callback to notify peer assoc failure
688  * @mlo_mlme_ext_peer_delete: Callback to initiate link peer delete
689  * @mlo_mlme_ext_assoc_resp: Callback to initiate assoc resp
690  * @mlo_mlme_get_link_assoc_req: Callback to get link assoc req buffer
691  * @mlo_mlme_ext_deauth: Callback to initiate deauth
692  * @mlo_mlme_ext_clone_security_param: Callback to clone mlo security params
693  * @mlo_mlme_ext_peer_process_auth: Callback to process pending auth
694  * @mlo_mlme_ext_handle_sta_csa_param: Callback to handle sta csa param
695  * @mlo_mlme_ext_sta_op_class:
696  */
697 struct mlo_mlme_ext_ops {
698 	QDF_STATUS (*mlo_mlme_ext_validate_conn_req)(
699 		    struct vdev_mlme_obj *vdev_mlme, void *ext_data);
700 	QDF_STATUS (*mlo_mlme_ext_create_link_vdev)(
701 		    struct vdev_mlme_obj *vdev_mlme, void *ext_data);
702 	QDF_STATUS (*mlo_mlme_ext_peer_create)(struct wlan_objmgr_vdev *vdev,
703 					struct wlan_mlo_peer_context *ml_peer,
704 					struct qdf_mac_addr *addr,
705 					qdf_nbuf_t frm_buf);
706 	void (*mlo_mlme_ext_peer_assoc)(struct wlan_objmgr_peer *peer);
707 	void (*mlo_mlme_ext_peer_assoc_fail)(struct wlan_objmgr_peer *peer);
708 	void (*mlo_mlme_ext_peer_delete)(struct wlan_objmgr_peer *peer);
709 	void (*mlo_mlme_ext_assoc_resp)(struct wlan_objmgr_peer *peer);
710 	qdf_nbuf_t (*mlo_mlme_get_link_assoc_req)(struct wlan_objmgr_peer *peer,
711 						  uint8_t link_ix);
712 	void (*mlo_mlme_ext_deauth)(struct wlan_objmgr_peer *peer,
713 				    uint8_t is_disassoc);
714 	QDF_STATUS (*mlo_mlme_ext_clone_security_param)(
715 		    struct vdev_mlme_obj *vdev_mlme,
716 		    struct wlan_cm_connect_req *req);
717 #ifdef UMAC_MLO_AUTH_DEFER
718 	void (*mlo_mlme_ext_peer_process_auth)(
719 	      struct mlpeer_auth_params *auth_param);
720 #endif
721 	void (*mlo_mlme_ext_handle_sta_csa_param)(
722 				struct wlan_objmgr_vdev *vdev,
723 				struct csa_offload_params *csa_param);
724 	QDF_STATUS (*mlo_mlme_ext_sta_op_class)(
725 			struct vdev_mlme_obj *vdev_mlme,
726 			uint8_t *ml_ie);
727 
728 };
729 
730 /* maximum size of vdev bitmap array for MLO link set active command */
731 #define MLO_VDEV_BITMAP_SZ 2
732 
733 /* maximum size of link number param array for MLO link set active command */
734 #define MLO_LINK_NUM_SZ 2
735 
736 /**
737  * enum mlo_link_force_mode: MLO link force modes
738  * @MLO_LINK_FORCE_MODE_ACTIVE:
739  *  Force specific links active
740  * @MLO_LINK_FORCE_MODE_INACTIVE:
741  *  Force specific links inactive
742  * @MLO_LINK_FORCE_MODE_ACTIVE_NUM:
743  *  Force active a number of links, firmware to decide which links to inactive
744  * @MLO_LINK_FORCE_MODE_INACTIVE_NUM:
745  *  Force inactive a number of links, firmware to decide which links to inactive
746  * @MLO_LINK_FORCE_MODE_NO_FORCE:
747  *  Cancel the force operation of specific links, allow firmware to decide
748  * @MLO_LINK_FORCE_MODE_ACTIVE_INACTIVE: Force specific links active and
749  *  force specific links inactive
750  */
751 enum mlo_link_force_mode {
752 	MLO_LINK_FORCE_MODE_ACTIVE       = 1,
753 	MLO_LINK_FORCE_MODE_INACTIVE     = 2,
754 	MLO_LINK_FORCE_MODE_ACTIVE_NUM   = 3,
755 	MLO_LINK_FORCE_MODE_INACTIVE_NUM = 4,
756 	MLO_LINK_FORCE_MODE_NO_FORCE     = 5,
757 	MLO_LINK_FORCE_MODE_ACTIVE_INACTIVE = 6,
758 };
759 
760 /**
761  * enum mlo_link_force_reason: MLO link force reasons
762  * @MLO_LINK_FORCE_REASON_CONNECT:
763  *  Set force specific links because of new connection
764  * @MLO_LINK_FORCE_REASON_DISCONNECT:
765  *  Set force specific links because of new dis-connection
766  * @MLO_LINK_FORCE_REASON_LINK_REMOVAL:
767  *  Set force specific links because of AP side link removal
768  */
769 enum mlo_link_force_reason {
770 	MLO_LINK_FORCE_REASON_CONNECT    = 1,
771 	MLO_LINK_FORCE_REASON_DISCONNECT = 2,
772 	MLO_LINK_FORCE_REASON_LINK_REMOVAL = 3,
773 };
774 
775 /**
776  * struct mlo_link_set_active_resp: MLO link set active response structure
777  * @status: Return status, 0 for success, non-zero otherwise
778  * @active_sz: size of current active vdev bitmap array
779  * @active: current active vdev bitmap array
780  * @inactive_sz: size of current inactive vdev bitmap array
781  * @inactive: current inactive vdev bitmap array
782  */
783 struct mlo_link_set_active_resp {
784 	uint32_t status;
785 	uint32_t active_sz;
786 	uint32_t active[MLO_VDEV_BITMAP_SZ];
787 	uint32_t inactive_sz;
788 	uint32_t inactive[MLO_VDEV_BITMAP_SZ];
789 };
790 
791 /**
792  * struct mlo_link_num_param: MLO link set active number params
793  * @num_of_link: number of links to active/inactive
794  * @vdev_type: type of vdev
795  * @vdev_subtype: subtype of vdev
796  * @home_freq: home frequency of the link
797  */
798 struct mlo_link_num_param {
799 	uint32_t num_of_link;
800 	uint32_t vdev_type;
801 	uint32_t vdev_subtype;
802 	uint32_t home_freq;
803 };
804 
805 /**
806  * struct mlo_link_set_active_param: MLO link set active params
807  * @force_mode: operation to take (enum mlo_link_force_mode)
808  * @reason: reason for the operation (enum mlo_link_force_reason)
809  * @num_link_entry: number of the valid entries for link_num
810  * @num_vdev_bitmap: number of the valid entries for vdev_bitmap
811  * @num_inactive_vdev_bitmap: number of the valid entries for
812  *  inactive_vdev_bitmap
813  * @link_num: link number param array
814  *  It's present only when force_mode is MLO_LINK_FORCE_MODE_ACTIVE_NUM or
815  *  MLO_LINK_FORCE_MODE_INACTIVE_NUM
816  * @vdev_bitmap: active/inactive vdev bitmap array
817  *  It will be present when force_mode is MLO_LINK_FORCE_MODE_ACTIVE,
818  *  MLO_LINK_FORCE_MODE_INACTIVE, MLO_LINK_FORCE_MODE_NO_FORCE,
819  *  MLO_LINK_FORCE_MODE_ACTIVE_NUM or MLO_LINK_FORCE_MODE_INACTIVE_NUM,
820  *  and MLO_LINK_FORCE_MODE_ACTIVE_INACTIVE.
821  *  For MLO_LINK_FORCE_MODE_ACTIVE_INACTIVE, it includes the active vdev
822  *  bitmaps
823  * @inactive_vdev_bitmap: inactive vdev bitmap array
824  *  It will be present when force_mode is MLO_LINK_FORCE_MODE_ACTIVE_INACTIVE,
825  *  it includes the inactive vdev bitmaps
826  */
827 struct mlo_link_set_active_param {
828 	uint32_t force_mode;
829 	uint32_t reason;
830 	uint32_t num_link_entry;
831 	uint32_t num_vdev_bitmap;
832 	uint32_t num_inactive_vdev_bitmap;
833 	struct mlo_link_num_param link_num[MLO_LINK_NUM_SZ];
834 	uint32_t vdev_bitmap[MLO_VDEV_BITMAP_SZ];
835 	uint32_t inactive_vdev_bitmap[MLO_VDEV_BITMAP_SZ];
836 };
837 
838 /**
839  * struct mlo_link_set_active_ctx - Context for MLO link set active request
840  * @vdev: pointer to vdev on which the request issued
841  * @set_mlo_link_cb: callback function for MLO link set active request
842  * @validate_set_mlo_link_cb: callback to validate set link request
843  * @cb_arg: callback context
844  */
845 struct mlo_link_set_active_ctx {
846 	struct wlan_objmgr_vdev *vdev;
847 	void (*set_mlo_link_cb)(struct wlan_objmgr_vdev *vdev, void *arg,
848 				struct mlo_link_set_active_resp *evt);
849 	QDF_STATUS (*validate_set_mlo_link_cb)(
850 			struct wlan_objmgr_psoc *psoc,
851 			struct mlo_link_set_active_param *param);
852 	void *cb_arg;
853 };
854 
855 /**
856  * struct mlo_link_set_active_req - MLO link set active request
857  * @ctx: context for MLO link set active request
858  * @param: MLO link set active params
859  */
860 struct mlo_link_set_active_req {
861 	struct mlo_link_set_active_ctx ctx;
862 	struct mlo_link_set_active_param param;
863 };
864 
865 /**
866  * enum mlo_chip_recovery_type - MLO chip recovery types
867  * @MLO_RECOVERY_MODE_0: CRASH_PARTNER_CHIPS & recover all chips
868  * @MLO_RECOVERY_MODE_1: Crash & recover asserted chip alone
869  * @MLO_RECOVERY_MODE_MAX: Max limit for recovery types
870  */
871 enum mlo_chip_recovery_type {
872 	MLO_RECOVERY_MODE_0 = 1,
873 	MLO_RECOVERY_MODE_1 = 2,
874 
875 	/* Add new types above */
876 	MLO_RECOVERY_MODE_MAX = 0xf
877 };
878 
879 /**
880  * enum wlan_t2lm_status - Target status codes in event of t2lm
881  * @WLAN_MAP_SWITCH_TIMER_TSF: Mapping switch time value in TSF to be included
882  * in probe response frames
883  * @WLAN_MAP_SWITCH_TIMER_EXPIRED: Indication that the new proposed T2LM has
884  * been applied, Update the required data structures and other modules.
885  * @WLAN_EXPECTED_DUR_EXPIRED: Indication that the proposed T2LM ineffective
886  * after this duration and all TIDs fall back to default mode.
887  */
888 enum wlan_t2lm_status {
889 	WLAN_MAP_SWITCH_TIMER_TSF,
890 	WLAN_MAP_SWITCH_TIMER_EXPIRED,
891 	WLAN_EXPECTED_DUR_EXPIRED,
892 };
893 
894 /**
895  * struct mlo_vdev_host_tid_to_link_map_resp - TID-to-link mapping response
896  * @vdev_id: Vdev id
897  * @status: Target status for t2lm ie info
898  * @mapping_switch_tsf: Mapping switch time in tsf for probe response frames
899  */
900 struct mlo_vdev_host_tid_to_link_map_resp {
901 	uint8_t vdev_id;
902 	enum wlan_t2lm_status status;
903 	uint32_t mapping_switch_tsf;
904 };
905 
906 /**
907  * struct mlo_link_removal_cmd_params - MLO link removal command parameters
908  * @vdev_id: vdev ID of the link to be removed
909  * @reconfig_ml_ie: Entire ML reconfiguration element
910  * @reconfig_ml_ie_size: size of the field @reconfig_ml_ie
911  */
912 struct mlo_link_removal_cmd_params {
913 	uint8_t vdev_id;
914 	uint8_t *reconfig_ml_ie;
915 	uint32_t reconfig_ml_ie_size;
916 };
917 
918 /**
919  * struct mlo_link_removal_tbtt_info - MLO link removal TBTT info. This
920  * information will be in correspondence with an outgoing beacon instance.
921  * @tbtt_count: Delete timer TBTT count in the reported beacon
922  * @qtimer_reading: Q-timer reading when the reported beacon is sent out
923  * @tsf: TSF of the reported beacon
924  */
925 struct mlo_link_removal_tbtt_info {
926 	uint32_t tbtt_count;
927 	uint64_t qtimer_reading;
928 	uint64_t tsf;
929 };
930 
931 /**
932  * struct mlo_link_removal_evt_params - MLO link removal event parameters
933  * @vdev_id: vdev ID of the link undergoing removal
934  * @tbtt_info: TBTT information of the link undergoing removal
935  */
936 struct mlo_link_removal_evt_params {
937 	uint8_t vdev_id;
938 	struct mlo_link_removal_tbtt_info tbtt_info;
939 };
940 
941 /**
942  * struct mgmt_rx_mlo_link_removal_info - Information, sent in MGMT Rx event, of
943  * a link undergoing removal from its MLD
944  * @vdev_id: Vdev ID of the link undergoing removal
945  * @hw_link_id: HW link ID of the link undergoing removal
946  * @tbtt_count: Delete timer TBTT count of the link undergoing removal
947  */
948 struct mgmt_rx_mlo_link_removal_info {
949 	uint8_t vdev_id;
950 	uint8_t hw_link_id;
951 	uint16_t tbtt_count;
952 };
953 #endif
954