xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h (revision b118e31770646189d507115705e6a8341392c990)
1 /*
2  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 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 
35 /* MAX MLO dev support */
36 #ifndef WLAN_UMAC_MLO_MAX_VDEVS
37 #define WLAN_UMAC_MLO_MAX_VDEVS 2
38 #endif
39 
40 /* MAX instances of ML devices */
41 #ifndef WLAN_UMAC_MLO_MAX_DEV
42 #define WLAN_UMAC_MLO_MAX_DEV 2
43 #endif
44 
45 /* Max PEER support */
46 #define MAX_MLO_PEER 512
47 
48 struct mlo_mlme_ext_ops;
49 struct vdev_mlme_obj;
50 
51 /* Max LINK PEER support */
52 #define MAX_MLO_LINK_PEERS WLAN_UMAC_MLO_MAX_VDEVS
53 
54 #define MAX_MLO_PEER_ID 2048
55 #define MLO_INVALID_PEER_ID 0xFFFF
56 
57 /* IE nomenclature */
58 #define ID_POS 0
59 #define TAG_LEN_POS 1
60 #define IDEXT_POS 2
61 #define MIN_IE_LEN 2
62 #define MULTI_LINK_CTRL_1 3
63 #define MULTI_LINK_CTRL_2 4
64 #define STA_CTRL_1 2
65 #define STA_CTRL_2 3
66 #define STA_PROFILE_SUB_ELEM_ID 0
67 #define PER_STA_PROF_MAC_ADDR_START 4
68 
69 #ifdef WLAN_MLO_MULTI_CHIP
70 /*
71  * enum MLO_LINK_STATE – MLO link state enums
72  * @MLO_LINK_SETUP_INIT - MLO link SETUP exchange not yet done
73  * @MLO_LINK_SETUP_DONE - MLO link SETUP exchange started
74  * @MLO_LINK_READY - MLO link SETUP done and READY sent
75  * @MLO_LINK_TEARDOWN - MLO teardown done.
76  * @MLO_LINK_UNINITIALIZED - MLO link in blank state
77  */
78 enum MLO_LINK_STATE {
79 	MLO_LINK_SETUP_INIT,
80 	MLO_LINK_SETUP_DONE,
81 	MLO_LINK_READY,
82 	MLO_LINK_TEARDOWN,
83 	MLO_LINK_UNINITIALIZED,
84 };
85 
86 /**
87  * struct mlo_setup_info: MLO setup status per link
88  * @ml_grp_id: Unique id for ML grouping of Pdevs/links
89  * @tot_socs: Total number of soc participating in ML group
90  * @num_soc: Number of soc ready or probed
91  * @tot_links: Total links in ML group
92  * @num_links: Number of links probed in ML group
93  * @pdev_list[MAX_MLO_LINKS]: pdev pointers belonging to this group
94  * @soc_list[MAX_MLO_CHIPS]: psoc pointers belonging to this group
95  * @state[MAX_MLO_LINKS]: MLO link state
96  * @valid_link_bitmap: valid MLO link bitmap
97  * @state_lock: lock to protect access to link state
98  * @qdf_event_t: event for teardown completion
99  */
100 #define MAX_MLO_LINKS 6
101 #define MAX_MLO_CHIPS 5
102 struct mlo_setup_info {
103 	uint8_t ml_grp_id;
104 	uint8_t tot_socs;
105 	uint8_t num_soc;
106 	uint8_t tot_links;
107 	uint8_t num_links;
108 	struct wlan_objmgr_pdev *pdev_list[MAX_MLO_LINKS];
109 	struct wlan_objmgr_psoc *soc_list[MAX_MLO_CHIPS];
110 	enum MLO_LINK_STATE state[MAX_MLO_LINKS];
111 	uint16_t valid_link_bitmap;
112 	qdf_spinlock_t state_lock;
113 	qdf_event_t event;
114 };
115 
116 /**
117  * struct mlo_state_params: MLO state params for pdev iteration
118  * @link_state_fail: Flag to check when pdev not in expected state
119  * @check_state: State on against which pdev is to be expected
120  */
121 struct mlo_state_params {
122 	bool link_state_fail;
123 	enum MLO_LINK_STATE check_state;
124 };
125 
126 #define MAX_MLO_GROUP 1
127 #endif
128 
129 /*
130  * struct mlo_mgr_context - MLO manager context
131  * @ml_dev_list_lock: ML DEV list lock
132  * @aid_lock: AID global lock
133  * @ml_peerid_lock: ML peer ID global lock
134  * @context: Array of MLO device context
135  * @mlo_peer_id_bmap: bitmap to allocate MLO Peer ID
136  * @max_mlo_peer_id: Max MLO Peer ID
137  * @info: MLO setup info
138  * @mlme_ops: MLO MLME callback function pointers
139  * @msgq_ctx: Context switch mgr
140  * @mlo_is_force_primary_umac: Force Primary UMAC enable
141  * @mlo_forced_primary_umac_id: Force Primary UMAC ID
142  * @dp_handle: pointer to DP ML context
143  */
144 struct mlo_mgr_context {
145 #ifdef WLAN_MLO_USE_SPINLOCK
146 	qdf_spinlock_t ml_dev_list_lock;
147 	qdf_spinlock_t aid_lock;
148 	qdf_spinlock_t ml_peerid_lock;
149 #else
150 	qdf_mutex_t ml_dev_list_lock;
151 	qdf_mutex_t aid_lock;
152 	qdf_mutex_t ml_peerid_lock;
153 #endif
154 	qdf_list_t ml_dev_list;
155 	qdf_bitmap(mlo_peer_id_bmap, MAX_MLO_PEER_ID);
156 	uint16_t max_mlo_peer_id;
157 #ifdef WLAN_MLO_MULTI_CHIP
158 	struct mlo_setup_info setup_info;
159 #endif
160 	struct mlo_mlme_ext_ops *mlme_ops;
161 	struct ctxt_switch_mgr *msgq_ctx;
162 	bool mlo_is_force_primary_umac;
163 	uint8_t mlo_forced_primary_umac_id;
164 	void *dp_handle;
165 };
166 
167 /*
168  * struct wlan_ml_vdev_aid_mgr – ML AID manager
169  * @aid_bitmap: AID bitmap array
170  * @start_aid: start of AID index
171  * @max_aid: Max allowed AID
172  * @aid_mgr[]:  Array of link vdev aid mgr
173  */
174 struct wlan_ml_vdev_aid_mgr {
175 	qdf_bitmap(aid_bitmap, WLAN_UMAC_MAX_AID);
176 	uint16_t start_aid;
177 	uint16_t max_aid;
178 	struct wlan_vdev_aid_mgr *aid_mgr[WLAN_UMAC_MLO_MAX_VDEVS];
179 };
180 
181 /*
182  * struct wlan_mlo_key_mgmt - MLO key management
183  * @link_mac_address: list of vdevs selected for connection with the MLAP
184  * @ptk: Pairwise transition keys
185  * @gtk: Group transition key
186  */
187 struct wlan_mlo_key_mgmt {
188 	struct qdf_mac_addr link_mac_address;
189 	uint32_t ptk;
190 	uint32_t gtk;
191 };
192 
193 /**
194  * struct mlo_sta_csa _params - CSA request parameters in mlo mgr
195  * @csa_param: csa parameters
196  * @link_id: the link index of AP which triggers CSA
197  * @mlo_csa_synced: Before vdev is up, csa information is only saved but not
198  *                  handled, and this value is false. Once vdev is up, the saved
199  *                  csa information is handled, and this value is changed to
200  *                  true. Note this value will be true if the vdev is doing
201  *                  restart.
202  * @csa_offload_event_recvd: True if WMI_CSA_HANDLING_EVENTID is already
203  *                           received. False if this is the first
204  *                           WMI_CSA_HANDLING_EVENTID.
205  * @valid_csa_param: True once csa_param is filled.
206  */
207 struct mlo_sta_csa_params {
208 	struct csa_offload_params csa_param;
209 	uint8_t link_id;
210 	bool mlo_csa_synced;
211 	bool csa_offload_event_recvd;
212 	bool valid_csa_param;
213 };
214 
215 /*
216  * struct mlo_sta_quiet_status - MLO sta quiet status
217  * @link_id: link id
218  * @quiet_status: true if corresponding ap in quiet status
219  * @valid_status: true if mlo_sta_quiet_status is filled
220  */
221 struct mlo_sta_quiet_status {
222 	uint8_t link_id;
223 	bool quiet_status;
224 	bool valid_status;
225 };
226 
227 /*
228  * struct wlan_mlo_sta - MLO sta additional info
229  * @wlan_connect_req_links: list of vdevs selected for connection with the MLAP
230  * @wlan_connected_links: list of vdevs associated with this MLO connection
231  * @connect req: connect params
232  * @copied_conn_req: original connect req
233  * @copied_conn_req_lock: lock for the original connect request
234  * @assoc_rsp: Raw assoc response frame
235  * @mlo_csa_param: CSA request parameters for mlo sta
236  * @disconn_req: disconnect req params
237  */
238 struct wlan_mlo_sta {
239 	qdf_bitmap(wlan_connect_req_links, WLAN_UMAC_MLO_MAX_VDEVS);
240 	qdf_bitmap(wlan_connected_links, WLAN_UMAC_MLO_MAX_VDEVS);
241 	struct wlan_mlo_key_mgmt key_mgmt[WLAN_UMAC_MLO_MAX_VDEVS - 1];
242 	struct wlan_cm_connect_req *connect_req;
243 	struct wlan_cm_connect_req *copied_conn_req;
244 #ifdef WLAN_MLO_USE_SPINLOCK
245 	qdf_spinlock_t copied_conn_req_lock;
246 #else
247 	qdf_mutex_t copied_conn_req_lock;
248 #endif
249 	struct element_info assoc_rsp;
250 	struct mlo_sta_quiet_status mlo_quiet_status[WLAN_UMAC_MLO_MAX_VDEVS];
251 	struct mlo_sta_csa_params mlo_csa_param[WLAN_UMAC_MLO_MAX_VDEVS];
252 	struct wlan_cm_disconnect_req *disconn_req;
253 };
254 
255 /*
256  * struct wlan_mlo_ap - MLO AP related info
257  * @num_ml_vdevs: number of vdevs to form MLD
258  * @ml_aid_mgr: ML AID mgr
259  * @mlo_vdev_quiet_bmap: Bitmap of vdevs for which quiet ie needs to enabled
260  */
261 struct wlan_mlo_ap {
262 	uint8_t num_ml_vdevs;
263 	struct wlan_ml_vdev_aid_mgr *ml_aid_mgr;
264 	qdf_bitmap(mlo_vdev_quiet_bmap, WLAN_UMAC_MLO_MAX_VDEVS);
265 };
266 
267 /*
268  * struct wlan_mlo_peer_list - MLO peer list entry
269  * @peer_hash: MLO peer hash code
270  * @peer_list_lock: lock to access members of structure
271  */
272 struct wlan_mlo_peer_list {
273 	qdf_list_t peer_hash[WLAN_PEER_HASHSIZE];
274 #ifdef WLAN_MLO_USE_SPINLOCK
275 	qdf_spinlock_t peer_list_lock;
276 #else
277 	qdf_mutex_t peer_list_lock;
278 #endif
279 };
280 
281 /*
282  * struct wlan_mlo_dev_context - MLO device context
283  * @node: QDF list node member
284  * @mld_id: MLD id
285  * @mld_addr: MLO device MAC address
286  * @wlan_vdev_list: list of vdevs associated with this MLO connection
287  * @wlan_vdev_count: number of elements in the vdev list
288  * @mlo_peer: list peers in this MLO connection
289  * @wlan_max_mlo_peer_count: peer count across the links of specific MLO
290  * @mlo_dev_lock: lock to access struct
291  * @ref_cnt: reference count
292  * @ref_id_dbg: Reference count debug information
293  * @sta_ctx: MLO STA related information
294  * @ap_ctx: AP related information
295  */
296 struct wlan_mlo_dev_context {
297 	qdf_list_node_t node;
298 	uint8_t mld_id;
299 	struct qdf_mac_addr mld_addr;
300 	struct wlan_objmgr_vdev *wlan_vdev_list[WLAN_UMAC_MLO_MAX_VDEVS];
301 	uint16_t wlan_vdev_count;
302 	struct wlan_mlo_peer_list mlo_peer_list;
303 	uint16_t wlan_max_mlo_peer_count;
304 #ifdef WLAN_MLO_USE_SPINLOCK
305 	qdf_spinlock_t mlo_dev_lock;
306 #else
307 	qdf_mutex_t mlo_dev_lock;
308 #endif
309 	qdf_atomic_t ref_cnt;
310 	qdf_atomic_t ref_id_dbg[WLAN_REF_ID_MAX];
311 	struct wlan_mlo_sta *sta_ctx;
312 	struct wlan_mlo_ap *ap_ctx;
313 };
314 
315 /*
316  * struct wlan_mlo_link_peer_entry – Link peer entry
317  * @link_peer: Object manager peer
318  * @link_addr: MAC address of link peer
319  * @link_ix: Link index
320  * @is_primary: sets true if the peer is primary UMAC’s peer
321  * @hw_link_id: HW Link id of peer
322  * @assoc_rsp_buf: Assoc resp buffer
323  */
324 struct wlan_mlo_link_peer_entry {
325 	struct wlan_objmgr_peer *link_peer;
326 	struct qdf_mac_addr link_addr;
327 	uint8_t link_ix;
328 	bool is_primary;
329 	uint8_t hw_link_id;
330 	qdf_nbuf_t assoc_rsp_buf;
331 };
332 
333 /*
334  * enum mlo_peer_state – MLO peer state
335  * @ML_PEER_CREATED:     Initial state
336  * @ML_PEER_ASSOC_DONE:  ASSOC sent on assoc link
337  * @ML_PEER_DISCONN_INITIATED: Disconnect initiated on one of the links
338  */
339 enum mlo_peer_state {
340 	ML_PEER_CREATED,
341 	ML_PEER_ASSOC_DONE,
342 	ML_PEER_DISCONN_INITIATED,
343 };
344 
345 #ifdef UMAC_SUPPORT_MLNAWDS
346 /*
347  * struct mlnawds_config - MLO NAWDS configuration
348  * @caps: Bandwidth & NSS capabilities to be configured on NAWDS peer
349  * @puncture_bitmap: puncture bitmap to be configured on NAWDS peer
350  * @mac: MAC address of the NAWDS peer to which the caps & puncture bitmap is
351  * to be configured.
352  */
353 struct mlnawds_config {
354 	uint64_t caps;
355 	uint16_t puncture_bitmap;
356 	uint8_t  mac[QDF_MAC_ADDR_SIZE];
357 };
358 #endif
359 
360 /*
361  * struct mlpeer_auth_params - Deferred Auth params
362  * @vdev_id:  VDEV ID
363  * @psoc_id:  PSOC ID
364  * @link_addr: MAC address
365  * @algo:  Auth algorithm
366  * @seq: Auth sequence number
367  * @status_code: Auth status
368  * @challenge: Auth Challenge
369  * @challenge_length: Auth Challenge length
370  * @wbuf:  Auth wbuf
371  * @rs: Rx stats
372  */
373 struct mlpeer_auth_params {
374 	uint8_t vdev_id;
375 	uint8_t psoc_id;
376 	struct qdf_mac_addr link_addr;
377 	uint16_t algo;
378 	uint16_t seq;
379 	uint16_t status_code;
380 	uint8_t *challenge;
381 	uint8_t challenge_length;
382 	qdf_nbuf_t wbuf;
383 	void *rs;
384 };
385 
386 #ifdef WLAN_FEATURE_T2LM
387 
388 /**
389  * enum wlan_t2lm_direction - Indicates the direction for which TID-to-link
390  * mapping is available.
391  * @WLAN_T2LM_DL_DIRECTION: Downlink
392  * @WLAN_T2LM_UL_DIRECTION: Uplink
393  * @WLAN_T2LM_BIDI_DIRECTION: Both downlink and uplink
394  * @WLAN_T2LM_MAX_DIRECTION: Max direction, this is used only internally
395  * @WLAN_T2LM_INVALID_DIRECTION: Invalid, this is used only internally to check
396  * if the mapping present in wlan_t2lm_of_tids structure is valid or not.
397  */
398 enum wlan_t2lm_direction {
399 	WLAN_T2LM_DL_DIRECTION,
400 	WLAN_T2LM_UL_DIRECTION,
401 	WLAN_T2LM_BIDI_DIRECTION,
402 	WLAN_T2LM_MAX_DIRECTION,
403 	WLAN_T2LM_INVALID_DIRECTION,
404 };
405 
406 /* Total 8 TIDs are supported, TID 0 to TID 7 */
407 #define T2LM_MAX_NUM_TIDS 8
408 
409 /**
410  * enum wlan_t2lm_category - T2LM category
411  *
412  * @WLAN_T2LM_CATEGORY_NONE: none
413  * @WLAN_T2LM_CATEGORY_REQUEST: T2LM request
414  * @WLAN_T2LM_CATEGORY_RESPONSE: T2LM response
415  * @WLAN_T2LM_CATEGORY_TEARDOWN: T2LM teardown
416  * @WLAN_T2LM_CATEGORY_INVALID: Invalid
417  */
418 enum wlan_t2lm_category {
419 	WLAN_T2LM_CATEGORY_NONE = 0,
420 	WLAN_T2LM_CATEGORY_REQUEST = 1,
421 	WLAN_T2LM_CATEGORY_RESPONSE = 2,
422 	WLAN_T2LM_CATEGORY_TEARDOWN = 3,
423 	WLAN_T2LM_CATEGORY_INVALID,
424 };
425 
426 /**
427  * enum wlan_t2lm_tx_status - Status code applicable for the T2LM frames
428  * transmitted by the current peer.
429  *
430  * @WLAN_T2LM_TX_STATUS_NONE: Status code is not applicable
431  * @WLAN_T2LM_TX_STATUS_SUCCESS: AP/STA successfully transmitted the T2LM frame
432  * @WLAN_T2LM_TX_STATUS_FAILURE: Tx failure received from the FW.
433  * @WLAN_T2LM_TX_STATUS_RX_TIMEOUT: T2LM response frame not received from the
434  *                              peer for the transmitted T2LM request frame.
435  * @WLAN_T2LM_TX_STATUS_INVALID: Invalid status code
436  */
437 enum wlan_t2lm_tx_status {
438 	WLAN_T2LM_TX_STATUS_NONE = 0,
439 	WLAN_T2LM_TX_STATUS_SUCCESS = 1,
440 	WLAN_T2LM_TX_STATUS_FAILURE = 2,
441 	WLAN_T2LM_TX_STATUS_RX_TIMEOUT = 3,
442 	WLAN_T2LM_TX_STATUS_INVALID,
443 };
444 
445 /**
446  * enum wlan_t2lm_resp_frm_type - T2LM status corresponds to T2LM response frame
447  *
448  * @WLAN_T2LM_RESP_TYPE_SUCCESS: T2LM mapping provided in the T2LM request is
449  *                       accepted either by the AP or STA
450  * @WLAN_T2LM_RESP_TYPE_DENIED_TID_TO_LINK_MAPPING: T2LM Request denied because
451  *                       the requested TID-to-link mapping is unacceptable.
452  * @WLAN_T2LM_RESP_TYPE_PREFERRED_TID_TO_LINK_MAPPING: T2LM Request rejected and
453  *                       preferred TID-to-link mapping is suggested.
454  * @WLAN_T2LM_RESP_TYPE_INVALID: Status code is not applicable.
455  */
456 enum wlan_t2lm_resp_frm_type {
457 	WLAN_T2LM_RESP_TYPE_SUCCESS = 0,
458 	WLAN_T2LM_RESP_TYPE_DENIED_TID_TO_LINK_MAPPING = 133,
459 	WLAN_T2LM_RESP_TYPE_PREFERRED_TID_TO_LINK_MAPPING = 134,
460 	WLAN_T2LM_RESP_TYPE_INVALID,
461 };
462 
463 /**
464  * enum wlan_t2lm_enable - TID-to-link negotiation supported by the mlo peer
465  *
466  * @WLAN_T2LM_NOT_SUPPORTED: T2LM is not supported by the MLD
467  * @WLAN_MAP_EACH_TID_TO_SAME_OR_DIFFERENET_LINK_SET: MLD supports the mapping
468  *             of each TID to the same or different link set (Disjoint mapping).
469  * @WLAN_MAP_ALL_TIDS_TO_SAME_LINK_SET: MLD only supports the mapping of all
470  *             TIDs to the same link set.
471  * @WLAN_T2LM_ENABLE_INVALID: invalid
472  */
473 enum wlan_t2lm_enable {
474 	WLAN_T2LM_NOT_SUPPORTED = 0,
475 	WLAN_MAP_EACH_TID_TO_SAME_OR_DIFFERENET_LINK_SET = 1,
476 	WLAN_MAP_ALL_TIDS_TO_SAME_LINK_SET = 2,
477 	WLAN_T2LM_ENABLE_INVALID,
478 };
479 
480 /**
481  * struct wlan_t2lm_of_tids - TID-to-Link mapping information for the frames
482  * transmitted on the uplink, downlink and bidirectional.
483  *
484  * @is_homogeneous_mapping: The t2lm_provisioned_links is homogeneous mapping
485  * @direction:  0 - Downlink, 1 - uplink 2 - Both uplink and downlink
486  * @default_link_mapping: value 1 indicates the default T2LM, where all the TIDs
487  *                        are mapped to all the links.
488  *                        value 0 indicates the preferred T2LM mapping
489  * @t2lm_provisioned_links: Indicates TID to link mapping of all the TIDS.
490  */
491 struct wlan_t2lm_of_tids {
492 	bool is_homogeneous_mapping;
493 	enum wlan_t2lm_direction direction;
494 	bool default_link_mapping;
495 	uint16_t t2lm_provisioned_links[T2LM_MAX_NUM_TIDS];
496 };
497 
498 /**
499  * struct wlan_prev_t2lm_negotiated_info - Previous successful T2LM negotiation
500  * is saved here.
501  *
502  * @dialog_token: Save the dialog token used in T2LM request and response frame.
503  * @t2lm_info: Provides the TID to LINK mapping information
504  */
505 struct wlan_prev_t2lm_negotiated_info {
506 	uint16_t dialog_token;
507 	struct wlan_t2lm_of_tids t2lm_info[WLAN_T2LM_MAX_DIRECTION];
508 };
509 
510 /**
511  * struct wlan_t2lm_onging_negotiation_info - Current ongoing T2LM negotiation
512  * (information about transmitted T2LM request/response frame)
513  *
514  * @category: T2LM category as T2LM request frame
515  * @dialog_token: Save the dialog token used in T2LM request and response frame.
516  * @t2lm_info: Provides the TID-to-link mapping info for UL/DL/BiDi
517  * @t2lm_tx_status: Status code corresponds to the transmitted T2LM frames
518  * @t2lm_resp_type: T2LM status corresponds to T2LM response frame.
519  */
520 struct wlan_t2lm_onging_negotiation_info {
521 	enum wlan_t2lm_category category;
522 	uint8_t dialog_token;
523 	struct wlan_t2lm_of_tids t2lm_info[WLAN_T2LM_MAX_DIRECTION];
524 	enum wlan_t2lm_tx_status t2lm_tx_status;
525 	enum wlan_t2lm_resp_frm_type t2lm_resp_type;
526 };
527 
528 /**
529  * struct wlan_mlo_peer_t2lm_policy - TID-to-link mapping information
530  *
531  * @self_gen_dialog_token: self generated dialog token used to send T2LM request
532  *                         frame;
533  * @t2lm_enable_val: TID-to-link enable value supported by this peer.
534  * @t2lm_negotiated_info: Previous successful T2LM negotiation is saved here.
535  * @ongoing_tid_to_link_mapping: This has the ongoing TID-to-link mapping info
536  *                               transmitted by this peer to the connected peer.
537  */
538 struct wlan_mlo_peer_t2lm_policy {
539 	uint8_t self_gen_dialog_token;
540 	enum wlan_t2lm_enable t2lm_enable_val;
541 	struct wlan_prev_t2lm_negotiated_info t2lm_negotiated_info;
542 	struct wlan_t2lm_onging_negotiation_info ongoing_tid_to_link_mapping;
543 };
544 #endif /* WLAN_FEATURE_T2LM */
545 
546 /*
547  * struct wlan_mlo_peer_context - MLO peer context
548  *
549  * @peer_node:     peer list node for ml_dev qdf list
550  * @peer_list: list of peers on the MLO link
551  * @link_peer_cnt: Number of link peers attached
552  * @max_links: Max links for this ML peer
553  * @mlo_peer_id: unique ID for the peer
554  * @peer_mld_addr: MAC address of MLD link
555  * @mlo_ie: MLO IE struct
556  * @mlo_peer_lock: lock to access peer strucutre
557  * @assoc_id: Assoc ID derived by MLO manager
558  * @ref_cnt: Reference counter to avoid use after free
559  * @ml_dev: MLO dev context
560  * @mlpeer_state: MLO peer state
561  * @avg_link_rssi: avg RSSI of ML peer
562  * @is_nawds_ml_peer: flag to indicate if ml_peer is NAWDS configured
563  * @nawds_config: eack link peer's NAWDS configuration
564  * @pending_auth: Holds pending auth request
565  * @t2lm_policy: TID-to-link mapping information
566  */
567 struct wlan_mlo_peer_context {
568 	qdf_list_node_t peer_node;
569 	struct wlan_mlo_link_peer_entry peer_list[MAX_MLO_LINK_PEERS];
570 	uint8_t link_peer_cnt;
571 	uint8_t max_links;
572 	uint32_t mlo_peer_id;
573 	struct qdf_mac_addr peer_mld_addr;
574 	uint8_t *mlo_ie;
575 #ifdef WLAN_MLO_USE_SPINLOCK
576 	qdf_spinlock_t mlo_peer_lock;
577 #else
578 	qdf_mutex_t mlo_peer_lock;
579 #endif
580 	uint16_t assoc_id;
581 	uint8_t primary_umac_psoc_id;
582 	qdf_atomic_t ref_cnt;
583 	struct wlan_mlo_dev_context *ml_dev;
584 	enum mlo_peer_state mlpeer_state;
585 	int8_t avg_link_rssi;
586 #ifdef UMAC_SUPPORT_MLNAWDS
587 	bool is_nawds_ml_peer;
588 	struct mlnawds_config nawds_config[MAX_MLO_LINK_PEERS];
589 #endif
590 #ifdef UMAC_MLO_AUTH_DEFER
591 	struct mlpeer_auth_params *pending_auth[MAX_MLO_LINK_PEERS];
592 #endif
593 #ifdef WLAN_FEATURE_T2LM
594 	struct wlan_mlo_peer_t2lm_policy t2lm_policy;
595 #endif
596 };
597 
598 /*
599  * struct mlo_link_info – ML link info
600  * @link_addr: link mac address
601  * @link_id: link index
602  * @chan_freq: Operating channel frequency
603  * @nawds_config: peer's NAWDS configurarion
604  * @vdev_id: VDEV ID
605  */
606 struct mlo_link_info {
607 	struct qdf_mac_addr link_addr;
608 	uint8_t link_id;
609 	uint16_t chan_freq;
610 #ifdef UMAC_SUPPORT_MLNAWDS
611 	struct mlnawds_config nawds_config;
612 #endif
613 	uint8_t vdev_id;
614 };
615 
616 /*
617  * struct mlo_partner_info – mlo partner link info
618  * @num_partner_links: no. of partner links
619  * @partner_link_info: per partner link info
620  * @t2lm_enable_val: enum wlan_t2lm_enable
621  */
622 struct mlo_partner_info {
623 	uint8_t num_partner_links;
624 	struct mlo_link_info partner_link_info[WLAN_UMAC_MLO_MAX_VDEVS];
625 #ifdef WLAN_FEATURE_T2LM
626 	enum wlan_t2lm_enable t2lm_enable_val;
627 #endif
628 };
629 
630 /*
631  * struct mlo_probereq_info – mlo probe req link info
632  * @num_links: no. of link info in probe req
633  * @link_id: target link id of APs
634  */
635 struct mlo_probereq_info {
636 	uint8_t mlid;
637 	uint8_t num_links;
638 	uint8_t link_id[WLAN_UMAC_MLO_MAX_VDEVS];
639 };
640 
641 /*
642  * struct mlo_tgt_link_info – ML target link info
643  * @vdev_id: link peer vdev id
644  * @hw_mld_link_id: HW link id
645  */
646 struct mlo_tgt_link_info {
647 	uint8_t vdev_id;
648 	uint8_t hw_mld_link_id;
649 };
650 
651 /*
652  * struct mlo_tgt_partner_info – mlo target partner link info
653  * @num_partner_links: no. of partner links
654  * @link_info: per partner link info
655  */
656 struct mlo_tgt_partner_info {
657 	uint8_t num_partner_links;
658 	struct mlo_tgt_link_info link_info[WLAN_UMAC_MLO_MAX_VDEVS];
659 };
660 
661 /*
662  * struct mlo_mlme_ext_ops - MLME callback functions
663  * @mlo_mlme_ext_validate_conn_req: Callback to validate connect request
664  * @mlo_mlme_ext_create_link_vdev: Callback to create link vdev for ML STA
665  * @mlo_mlme_ext_peer_create: Callback to create link peer
666  * @mlo_mlme_ext_peer_assoc: Callback to initiate peer assoc
667  * @mlo_mlme_ext_peer_assoc_fail: Callback to notify peer assoc failure
668  * @mlo_mlme_ext_peer_delete: Callback to initiate link peer delete
669  * @mlo_mlme_ext_assoc_resp: Callback to initiate assoc resp
670  * @mlo_mlme_get_link_assoc_req: Calback to get link assoc req buffer
671  * @mlo_mlme_ext_deauth: Callback to initiate deauth
672  * @mlo_mlme_ext_clone_security_param: Callback to clone mlo security params
673  * @mlo_mlme_ext_peer_process_auth: Callback to process pending auth
674  * @mlo_mlme_ext_handle_sta_csa_param: Callback to handle sta csa param
675  */
676 struct mlo_mlme_ext_ops {
677 	QDF_STATUS (*mlo_mlme_ext_validate_conn_req)(
678 		    struct vdev_mlme_obj *vdev_mlme, void *ext_data);
679 	QDF_STATUS (*mlo_mlme_ext_create_link_vdev)(
680 		    struct vdev_mlme_obj *vdev_mlme, void *ext_data);
681 	QDF_STATUS (*mlo_mlme_ext_peer_create)(struct wlan_objmgr_vdev *vdev,
682 					struct wlan_mlo_peer_context *ml_peer,
683 					struct qdf_mac_addr *addr,
684 					qdf_nbuf_t frm_buf);
685 	void (*mlo_mlme_ext_peer_assoc)(struct wlan_objmgr_peer *peer);
686 	void (*mlo_mlme_ext_peer_assoc_fail)(struct wlan_objmgr_peer *peer);
687 	void (*mlo_mlme_ext_peer_delete)(struct wlan_objmgr_peer *peer);
688 	void (*mlo_mlme_ext_assoc_resp)(struct wlan_objmgr_peer *peer);
689 	qdf_nbuf_t (*mlo_mlme_get_link_assoc_req)(struct wlan_objmgr_peer *peer,
690 						  uint8_t link_ix);
691 	void (*mlo_mlme_ext_deauth)(struct wlan_objmgr_peer *peer);
692 	QDF_STATUS (*mlo_mlme_ext_clone_security_param)(
693 		    struct vdev_mlme_obj *vdev_mlme,
694 		    struct wlan_cm_connect_req *req);
695 #ifdef UMAC_MLO_AUTH_DEFER
696 	void (*mlo_mlme_ext_peer_process_auth)(
697 	      struct mlpeer_auth_params *auth_param);
698 #endif
699 	void (*mlo_mlme_ext_handle_sta_csa_param)(
700 				struct wlan_objmgr_vdev *vdev,
701 				struct csa_offload_params *csa_param);
702 };
703 
704 /* maximum size of vdev bitmap array for MLO link set active command */
705 #define MLO_VDEV_BITMAP_SZ 2
706 
707 /* maximum size of link number param array for MLO link set active command */
708 #define MLO_LINK_NUM_SZ 2
709 
710 /**
711  * enum mlo_link_force_mode: MLO link force modes
712  * @MLO_LINK_FORCE_MODE_ACTIVE:
713  *  Force specific links active
714  * @MLO_LINK_FORCE_MODE_INACTIVE:
715  *  Force specific links inactive
716  * @MLO_LINK_FORCE_MODE_ACTIVE_NUM:
717  *  Force active a number of links, firmware to decide which links to inactive
718  * @MLO_LINK_FORCE_MODE_INACTIVE_NUM:
719  *  Force inactive a number of links, firmware to decide which links to inactive
720  * @MLO_LINK_FORCE_MODE_NO_FORCE:
721  *  Cancel the force operation of specific links, allow firmware to decide
722  */
723 enum mlo_link_force_mode {
724 	MLO_LINK_FORCE_MODE_ACTIVE       = 1,
725 	MLO_LINK_FORCE_MODE_INACTIVE     = 2,
726 	MLO_LINK_FORCE_MODE_ACTIVE_NUM   = 3,
727 	MLO_LINK_FORCE_MODE_INACTIVE_NUM = 4,
728 	MLO_LINK_FORCE_MODE_NO_FORCE     = 5,
729 };
730 
731 /**
732  * enum mlo_link_force_reason: MLO link force reasons
733  * @MLO_LINK_FORCE_REASON_CONNECT:
734  *  Set force specific links because of new connection
735  * @MLO_LINK_FORCE_REASON_DISCONNECT:
736  *  Set force specific links because of new dis-connection
737  */
738 enum mlo_link_force_reason {
739 	MLO_LINK_FORCE_REASON_CONNECT    = 1,
740 	MLO_LINK_FORCE_REASON_DISCONNECT = 2,
741 };
742 
743 /**
744  * struct mlo_link_set_active_resp: MLO link set active response structure
745  * @status: Return status, 0 for success, non-zero otherwise
746  * @active_sz: size of current active vdev bitmap array
747  * @active: current active vdev bitmap array
748  * @inactive_sz: size of current inactive vdev bitmap array
749  * @inactive: current inactive vdev bitmap array
750  */
751 struct mlo_link_set_active_resp {
752 	uint32_t status;
753 	uint32_t active_sz;
754 	uint32_t active[MLO_VDEV_BITMAP_SZ];
755 	uint32_t inactive_sz;
756 	uint32_t inactive[MLO_VDEV_BITMAP_SZ];
757 };
758 
759 /**
760  * struct mlo_link_num_param: MLO link set active number params
761  * @num_of_link: number of links to active/inactive
762  * @vdev_type: type of vdev
763  * @vdev_subtype: subtype of vdev
764  * @home_freq: home frequency of the link
765  */
766 struct mlo_link_num_param {
767 	uint32_t num_of_link;
768 	uint32_t vdev_type;
769 	uint32_t vdev_subtype;
770 	uint32_t home_freq;
771 };
772 
773 /**
774  * struct mlo_link_set_active_param: MLO link set active params
775  * @force_mode: operation to take (enum mlo_link_force_mode)
776  * @reason: reason for the operation (enum mlo_link_force_reason)
777  * @num_link_entry: number of the valid entries for link_num
778  * @num_vdev_bitmap: number of the valid entries for vdev_bitmap
779  * @link_num: link number param array
780  *  It's present only when force_mode is MLO_LINK_FORCE_MODE_ACTIVE_NUM or
781  *  MLO_LINK_FORCE_MODE_INACTIVE_NUM
782  * @vdev_bitmap: active/inactive vdev bitmap array
783  *  It will be present when force_mode is MLO_LINK_FORCE_MODE_ACTIVE,
784  *  MLO_LINK_FORCE_MODE_INACTIVE, MLO_LINK_FORCE_MODE_NO_FORCE,
785  *  MLO_LINK_FORCE_MODE_ACTIVE_NUM or MLO_LINK_FORCE_MODE_INACTIVE_NUM
786  */
787 struct mlo_link_set_active_param {
788 	uint32_t force_mode;
789 	uint32_t reason;
790 	uint32_t num_link_entry;
791 	uint32_t num_vdev_bitmap;
792 	struct mlo_link_num_param link_num[MLO_LINK_NUM_SZ];
793 	uint32_t vdev_bitmap[MLO_VDEV_BITMAP_SZ];
794 };
795 
796 /*
797  * struct mlo_link_set_active_ctx - Context for MLO link set active request
798  * @vdev: pointer to vdev on which the request issued
799  * @cb: callback function for MLO link set active request
800  * @cb_arg: callback context
801  */
802 struct mlo_link_set_active_ctx {
803 	struct wlan_objmgr_vdev *vdev;
804 	void (*set_mlo_link_cb)(struct wlan_objmgr_vdev *vdev, void *arg,
805 				struct mlo_link_set_active_resp *evt);
806 	void *cb_arg;
807 };
808 
809 /*
810  * struct mlo_link_set_active_req - MLO link set active request
811  * @ctx: context for MLO link set active request
812  * @param: MLO link set active params
813  */
814 struct mlo_link_set_active_req {
815 	struct mlo_link_set_active_ctx ctx;
816 	struct mlo_link_set_active_param param;
817 };
818 
819 /*
820  * enum mlo_chip_recovery_type - MLO chip recovery types
821  * @MLO_RECOVERY_MODE_0: CRASH_PARTNER_CHIPS & recover all chips
822  * @MLO_RECOVERY_MODE_1: Crash & recover asserted chip alone
823  * @MLO_RECOVERY_MODE_MAX: Max limit for recovery types
824  */
825 enum mlo_chip_recovery_type {
826 	MLO_RECOVERY_MODE_0 = 1,
827 	MLO_RECOVERY_MODE_1 = 2,
828 
829 	/* Add new types above */
830 	MLO_RECOVERY_MODE_MAX = 0xf
831 };
832 #endif
833