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