xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h (revision d0c05845839e5f2ba5a8dcebe0cd3e4cd4e8dfcf)
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  * @tsf_recalculation_lock: Lock to protect TSF (re)calculation
292  * @ref_cnt: reference count
293  * @ref_id_dbg: Reference count debug information
294  * @sta_ctx: MLO STA related information
295  * @ap_ctx: AP related information
296  */
297 struct wlan_mlo_dev_context {
298 	qdf_list_node_t node;
299 	uint8_t mld_id;
300 	struct qdf_mac_addr mld_addr;
301 	struct wlan_objmgr_vdev *wlan_vdev_list[WLAN_UMAC_MLO_MAX_VDEVS];
302 	uint16_t wlan_vdev_count;
303 	struct wlan_mlo_peer_list mlo_peer_list;
304 	uint16_t wlan_max_mlo_peer_count;
305 #ifdef WLAN_MLO_USE_SPINLOCK
306 	qdf_spinlock_t mlo_dev_lock;
307 	qdf_spinlock_t tsf_recalculation_lock;
308 #else
309 	qdf_mutex_t mlo_dev_lock;
310 	qdf_mutex_t tsf_recalculation_lock;
311 #endif
312 	qdf_atomic_t ref_cnt;
313 	qdf_atomic_t ref_id_dbg[WLAN_REF_ID_MAX];
314 	struct wlan_mlo_sta *sta_ctx;
315 	struct wlan_mlo_ap *ap_ctx;
316 };
317 
318 /*
319  * struct wlan_mlo_link_peer_entry – Link peer entry
320  * @link_peer: Object manager peer
321  * @link_addr: MAC address of link peer
322  * @link_ix: Link index
323  * @is_primary: sets true if the peer is primary UMAC’s peer
324  * @hw_link_id: HW Link id of peer
325  * @assoc_rsp_buf: Assoc resp buffer
326  */
327 struct wlan_mlo_link_peer_entry {
328 	struct wlan_objmgr_peer *link_peer;
329 	struct qdf_mac_addr link_addr;
330 	uint8_t link_ix;
331 	bool is_primary;
332 	uint8_t hw_link_id;
333 	qdf_nbuf_t assoc_rsp_buf;
334 };
335 
336 /*
337  * enum mlo_peer_state – MLO peer state
338  * @ML_PEER_CREATED:     Initial state
339  * @ML_PEER_ASSOC_DONE:  ASSOC sent on assoc link
340  * @ML_PEER_DISCONN_INITIATED: Disconnect initiated on one of the links
341  */
342 enum mlo_peer_state {
343 	ML_PEER_CREATED,
344 	ML_PEER_ASSOC_DONE,
345 	ML_PEER_DISCONN_INITIATED,
346 };
347 
348 #ifdef UMAC_SUPPORT_MLNAWDS
349 /*
350  * struct mlnawds_config - MLO NAWDS configuration
351  * @caps: Bandwidth & NSS capabilities to be configured on NAWDS peer
352  * @puncture_bitmap: puncture bitmap to be configured on NAWDS peer
353  * @mac: MAC address of the NAWDS peer to which the caps & puncture bitmap is
354  * to be configured.
355  */
356 struct mlnawds_config {
357 	uint64_t caps;
358 	uint16_t puncture_bitmap;
359 	uint8_t  mac[QDF_MAC_ADDR_SIZE];
360 };
361 #endif
362 
363 /*
364  * struct mlpeer_auth_params - Deferred Auth params
365  * @vdev_id:  VDEV ID
366  * @psoc_id:  PSOC ID
367  * @link_addr: MAC address
368  * @mldmacaddr: MLD MAC address
369  * @algo:  Auth algorithm
370  * @seq: Auth sequence number
371  * @status_code: Auth status
372  * @challenge: Auth Challenge
373  * @challenge_length: Auth Challenge length
374  * @wbuf:  Auth wbuf
375  * @rs: Rx stats
376  */
377 struct mlpeer_auth_params {
378 	uint8_t vdev_id;
379 	uint8_t psoc_id;
380 	struct qdf_mac_addr link_addr;
381 	struct qdf_mac_addr mldaddr;
382 	uint16_t algo;
383 	uint16_t seq;
384 	uint16_t status_code;
385 	uint8_t *challenge;
386 	uint8_t challenge_length;
387 	qdf_nbuf_t wbuf;
388 	void *rs;
389 };
390 
391 #ifdef WLAN_FEATURE_11BE
392 
393 /**
394  * enum wlan_t2lm_direction - Indicates the direction for which TID-to-link
395  * mapping is available.
396  * @WLAN_T2LM_DL_DIRECTION: Downlink
397  * @WLAN_T2LM_UL_DIRECTION: Uplink
398  * @WLAN_T2LM_BIDI_DIRECTION: Both downlink and uplink
399  * @WLAN_T2LM_MAX_DIRECTION: Max direction, this is used only internally
400  * @WLAN_T2LM_INVALID_DIRECTION: Invalid, this is used only internally to check
401  * if the mapping present in wlan_t2lm_of_tids structure is valid or not.
402  */
403 enum wlan_t2lm_direction {
404 	WLAN_T2LM_DL_DIRECTION,
405 	WLAN_T2LM_UL_DIRECTION,
406 	WLAN_T2LM_BIDI_DIRECTION,
407 	WLAN_T2LM_MAX_DIRECTION,
408 	WLAN_T2LM_INVALID_DIRECTION,
409 };
410 
411 /* Total 8 TIDs are supported, TID 0 to TID 7 */
412 #define T2LM_MAX_NUM_TIDS 8
413 
414 /**
415  * enum wlan_t2lm_category - T2LM category
416  *
417  * @WLAN_T2LM_CATEGORY_NONE: none
418  * @WLAN_T2LM_CATEGORY_REQUEST: T2LM request
419  * @WLAN_T2LM_CATEGORY_RESPONSE: T2LM response
420  * @WLAN_T2LM_CATEGORY_TEARDOWN: T2LM teardown
421  * @WLAN_T2LM_CATEGORY_INVALID: Invalid
422  */
423 enum wlan_t2lm_category {
424 	WLAN_T2LM_CATEGORY_NONE = 0,
425 	WLAN_T2LM_CATEGORY_REQUEST = 1,
426 	WLAN_T2LM_CATEGORY_RESPONSE = 2,
427 	WLAN_T2LM_CATEGORY_TEARDOWN = 3,
428 	WLAN_T2LM_CATEGORY_INVALID,
429 };
430 
431 /**
432  * enum wlan_t2lm_tx_status - Status code applicable for the T2LM frames
433  * transmitted by the current peer.
434  *
435  * @WLAN_T2LM_TX_STATUS_NONE: Status code is not applicable
436  * @WLAN_T2LM_TX_STATUS_SUCCESS: AP/STA successfully transmitted the T2LM frame
437  * @WLAN_T2LM_TX_STATUS_FAILURE: Tx failure received from the FW.
438  * @WLAN_T2LM_TX_STATUS_RX_TIMEOUT: T2LM response frame not received from the
439  *                              peer for the transmitted T2LM request frame.
440  * @WLAN_T2LM_TX_STATUS_INVALID: Invalid status code
441  */
442 enum wlan_t2lm_tx_status {
443 	WLAN_T2LM_TX_STATUS_NONE = 0,
444 	WLAN_T2LM_TX_STATUS_SUCCESS = 1,
445 	WLAN_T2LM_TX_STATUS_FAILURE = 2,
446 	WLAN_T2LM_TX_STATUS_RX_TIMEOUT = 3,
447 	WLAN_T2LM_TX_STATUS_INVALID,
448 };
449 
450 /**
451  * enum wlan_t2lm_resp_frm_type - T2LM status corresponds to T2LM response frame
452  *
453  * @WLAN_T2LM_RESP_TYPE_SUCCESS: T2LM mapping provided in the T2LM request is
454  *                       accepted either by the AP or STA
455  * @WLAN_T2LM_RESP_TYPE_DENIED_TID_TO_LINK_MAPPING: T2LM Request denied because
456  *                       the requested TID-to-link mapping is unacceptable.
457  * @WLAN_T2LM_RESP_TYPE_PREFERRED_TID_TO_LINK_MAPPING: T2LM Request rejected and
458  *                       preferred TID-to-link mapping is suggested.
459  * @WLAN_T2LM_RESP_TYPE_INVALID: Status code is not applicable.
460  */
461 enum wlan_t2lm_resp_frm_type {
462 	WLAN_T2LM_RESP_TYPE_SUCCESS = 0,
463 	WLAN_T2LM_RESP_TYPE_DENIED_TID_TO_LINK_MAPPING = 133,
464 	WLAN_T2LM_RESP_TYPE_PREFERRED_TID_TO_LINK_MAPPING = 134,
465 	WLAN_T2LM_RESP_TYPE_INVALID,
466 };
467 
468 /**
469  * enum wlan_t2lm_enable - TID-to-link negotiation supported by the mlo peer
470  *
471  * @WLAN_T2LM_NOT_SUPPORTED: T2LM is not supported by the MLD
472  * @WLAN_MAP_EACH_TID_TO_SAME_OR_DIFFERENET_LINK_SET: MLD supports the mapping
473  *             of each TID to the same or different link set (Disjoint mapping).
474  * @WLAN_MAP_ALL_TIDS_TO_SAME_LINK_SET: MLD only supports the mapping of all
475  *             TIDs to the same link set.
476  * @WLAN_T2LM_ENABLE_INVALID: invalid
477  */
478 enum wlan_t2lm_enable {
479 	WLAN_T2LM_NOT_SUPPORTED = 0,
480 	WLAN_MAP_EACH_TID_TO_SAME_OR_DIFFERENET_LINK_SET = 1,
481 	WLAN_MAP_ALL_TIDS_TO_SAME_LINK_SET = 2,
482 	WLAN_T2LM_ENABLE_INVALID,
483 };
484 
485 /**
486  * struct wlan_t2lm_of_tids - TID-to-Link mapping information for the frames
487  * transmitted on the uplink, downlink and bidirectional.
488  *
489  * @is_homogeneous_mapping: The t2lm_provisioned_links is homogeneous mapping
490  * @direction:  0 - Downlink, 1 - uplink 2 - Both uplink and downlink
491  * @default_link_mapping: value 1 indicates the default T2LM, where all the TIDs
492  *                        are mapped to all the links.
493  *                        value 0 indicates the preferred T2LM mapping
494  * @t2lm_provisioned_links: Indicates TID to link mapping of all the TIDS.
495  */
496 struct wlan_t2lm_of_tids {
497 	bool is_homogeneous_mapping;
498 	enum wlan_t2lm_direction direction;
499 	bool default_link_mapping;
500 	uint16_t t2lm_provisioned_links[T2LM_MAX_NUM_TIDS];
501 };
502 
503 /**
504  * struct wlan_prev_t2lm_negotiated_info - Previous successful T2LM negotiation
505  * is saved here.
506  *
507  * @dialog_token: Save the dialog token used in T2LM request and response frame.
508  * @t2lm_info: Provides the TID to LINK mapping information
509  */
510 struct wlan_prev_t2lm_negotiated_info {
511 	uint16_t dialog_token;
512 	struct wlan_t2lm_of_tids t2lm_info[WLAN_T2LM_MAX_DIRECTION];
513 };
514 
515 /**
516  * struct wlan_t2lm_onging_negotiation_info - Current ongoing T2LM negotiation
517  * (information about transmitted T2LM request/response frame)
518  *
519  * @category: T2LM category as T2LM request frame
520  * @dialog_token: Save the dialog token used in T2LM request and response frame.
521  * @t2lm_info: Provides the TID-to-link mapping info for UL/DL/BiDi
522  * @t2lm_tx_status: Status code corresponds to the transmitted T2LM frames
523  * @t2lm_resp_type: T2LM status corresponds to T2LM response frame.
524  */
525 struct wlan_t2lm_onging_negotiation_info {
526 	enum wlan_t2lm_category category;
527 	uint8_t dialog_token;
528 	struct wlan_t2lm_of_tids t2lm_info[WLAN_T2LM_MAX_DIRECTION];
529 	enum wlan_t2lm_tx_status t2lm_tx_status;
530 	enum wlan_t2lm_resp_frm_type t2lm_resp_type;
531 };
532 
533 /**
534  * struct wlan_mlo_peer_t2lm_policy - TID-to-link mapping information
535  *
536  * @self_gen_dialog_token: self generated dialog token used to send T2LM request
537  *                         frame;
538  * @t2lm_enable_val: TID-to-link enable value supported by this peer.
539  * @t2lm_negotiated_info: Previous successful T2LM negotiation is saved here.
540  * @ongoing_tid_to_link_mapping: This has the ongoing TID-to-link mapping info
541  *                               transmitted by this peer to the connected peer.
542  */
543 struct wlan_mlo_peer_t2lm_policy {
544 	uint8_t self_gen_dialog_token;
545 	enum wlan_t2lm_enable t2lm_enable_val;
546 	struct wlan_prev_t2lm_negotiated_info t2lm_negotiated_info;
547 	struct wlan_t2lm_onging_negotiation_info ongoing_tid_to_link_mapping;
548 };
549 #endif /* WLAN_FEATURE_11BE */
550 
551 /**
552  * struct wlan_mlo_eml_cap - EML capabilities of MLD
553  * @emlsr_supp: eMLSR Support
554  * @emlsr_pad_delay: eMLSR Padding Delay
555  * @emlsr_trans_delay: eMLSR transition delay
556  * @emlmr_supp: eMLMR Support
557  * @emlmr_delay: eMLMR Delay
558  * @trans_timeout: Transition Timeout
559  * @reserved: Reserved
560  */
561 struct wlan_mlo_eml_cap {
562 	uint16_t emlsr_supp:1,
563 		 emlsr_pad_delay:3,
564 		 emlsr_trans_delay:3,
565 		 emlmr_supp:1,
566 		 emlmr_delay:3,
567 		 trans_timeout:4,
568 		 reserved:1;
569 };
570 
571 /**
572  * struct wlan_mlo_mld_cap - MLD capabilities of MLD
573  * @max_simult_link: Maximum number of simultaneous links
574  * @srs_support: SRS support
575  * @tid2link_neg_support: TID to Link Negotiation Support
576  * @str_freq_sep: Frequency separation suggested by STR non-AP MLD
577  *                OR Type of AP-MLD
578  * @aar_support: AAR Support
579  * @reserved: Reserved
580  */
581 struct wlan_mlo_mld_cap {
582 	uint16_t max_simult_link:4,
583 		 srs_support:1,
584 		 tid2link_neg_support:2,
585 		 str_freq_sep:5,
586 		 aar_support:1,
587 		 reserved:3;
588 };
589 
590 /*
591  * struct wlan_mlo_peer_context - MLO peer context
592  *
593  * @peer_node:     peer list node for ml_dev qdf list
594  * @peer_list: list of peers on the MLO link
595  * @link_peer_cnt: Number of link peers attached
596  * @max_links: Max links for this ML peer
597  * @mlo_peer_id: unique ID for the peer
598  * @peer_mld_addr: MAC address of MLD link
599  * @mlo_ie: MLO IE struct
600  * @mlo_peer_lock: lock to access peer strucutre
601  * @assoc_id: Assoc ID derived by MLO manager
602  * @ref_cnt: Reference counter to avoid use after free
603  * @ml_dev: MLO dev context
604  * @mlpeer_state: MLO peer state
605  * @avg_link_rssi: avg RSSI of ML peer
606  * @is_nawds_ml_peer: flag to indicate if ml_peer is NAWDS configured
607  * @nawds_config: eack link peer's NAWDS configuration
608  * @pending_auth: Holds pending auth request
609  * @t2lm_policy: TID-to-link mapping information
610  */
611 struct wlan_mlo_peer_context {
612 	qdf_list_node_t peer_node;
613 	struct wlan_mlo_link_peer_entry peer_list[MAX_MLO_LINK_PEERS];
614 	uint8_t link_peer_cnt;
615 	uint8_t max_links;
616 	uint32_t mlo_peer_id;
617 	struct qdf_mac_addr peer_mld_addr;
618 	uint8_t *mlo_ie;
619 #ifdef WLAN_MLO_USE_SPINLOCK
620 	qdf_spinlock_t mlo_peer_lock;
621 #else
622 	qdf_mutex_t mlo_peer_lock;
623 #endif
624 	uint16_t assoc_id;
625 	uint8_t primary_umac_psoc_id;
626 	qdf_atomic_t ref_cnt;
627 	struct wlan_mlo_dev_context *ml_dev;
628 	enum mlo_peer_state mlpeer_state;
629 	int8_t avg_link_rssi;
630 #ifdef UMAC_SUPPORT_MLNAWDS
631 	bool is_nawds_ml_peer;
632 	struct mlnawds_config nawds_config[MAX_MLO_LINK_PEERS];
633 #endif
634 #ifdef UMAC_MLO_AUTH_DEFER
635 	struct mlpeer_auth_params *pending_auth[MAX_MLO_LINK_PEERS];
636 #endif
637 #ifdef WLAN_FEATURE_11BE
638 	struct wlan_mlo_peer_t2lm_policy t2lm_policy;
639 #endif
640 	struct wlan_mlo_eml_cap mlpeer_emlcap;
641 };
642 
643 /*
644  * struct mlo_link_info – ML link info
645  * @link_addr: link mac address
646  * @link_id: link index
647  * @chan_freq: Operating channel frequency
648  * @nawds_config: peer's NAWDS configurarion
649  * @vdev_id: VDEV ID
650  */
651 struct mlo_link_info {
652 	struct qdf_mac_addr link_addr;
653 	uint8_t link_id;
654 	uint16_t chan_freq;
655 #ifdef UMAC_SUPPORT_MLNAWDS
656 	struct mlnawds_config nawds_config;
657 #endif
658 	uint8_t vdev_id;
659 };
660 
661 /*
662  * struct mlo_partner_info – mlo partner link info
663  * @num_partner_links: no. of partner links
664  * @partner_link_info: per partner link info
665  * @t2lm_enable_val: enum wlan_t2lm_enable
666  */
667 struct mlo_partner_info {
668 	uint8_t num_partner_links;
669 	struct mlo_link_info partner_link_info[WLAN_UMAC_MLO_MAX_VDEVS];
670 #ifdef WLAN_FEATURE_11BE
671 	enum wlan_t2lm_enable t2lm_enable_val;
672 #endif
673 };
674 
675 /*
676  * struct mlo_probereq_info – mlo probe req link info
677  * @num_links: no. of link info in probe req
678  * @link_id: target link id of APs
679  */
680 struct mlo_probereq_info {
681 	uint8_t mlid;
682 	uint8_t num_links;
683 	uint8_t link_id[WLAN_UMAC_MLO_MAX_VDEVS];
684 };
685 
686 /*
687  * struct mlo_tgt_link_info – ML target link info
688  * @vdev_id: link peer vdev id
689  * @hw_mld_link_id: HW link id
690  */
691 struct mlo_tgt_link_info {
692 	uint8_t vdev_id;
693 	uint8_t hw_mld_link_id;
694 };
695 
696 /*
697  * struct mlo_tgt_partner_info – mlo target partner link info
698  * @num_partner_links: no. of partner links
699  * @link_info: per partner link info
700  */
701 struct mlo_tgt_partner_info {
702 	uint8_t num_partner_links;
703 	struct mlo_tgt_link_info link_info[WLAN_UMAC_MLO_MAX_VDEVS];
704 };
705 
706 /*
707  * struct mlo_mlme_ext_ops - MLME callback functions
708  * @mlo_mlme_ext_validate_conn_req: Callback to validate connect request
709  * @mlo_mlme_ext_create_link_vdev: Callback to create link vdev for ML STA
710  * @mlo_mlme_ext_peer_create: Callback to create link peer
711  * @mlo_mlme_ext_peer_assoc: Callback to initiate peer assoc
712  * @mlo_mlme_ext_peer_assoc_fail: Callback to notify peer assoc failure
713  * @mlo_mlme_ext_peer_delete: Callback to initiate link peer delete
714  * @mlo_mlme_ext_assoc_resp: Callback to initiate assoc resp
715  * @mlo_mlme_get_link_assoc_req: Calback to get link assoc req buffer
716  * @mlo_mlme_ext_deauth: Callback to initiate deauth
717  * @mlo_mlme_ext_clone_security_param: Callback to clone mlo security params
718  * @mlo_mlme_ext_peer_process_auth: Callback to process pending auth
719  * @mlo_mlme_ext_handle_sta_csa_param: Callback to handle sta csa param
720  */
721 struct mlo_mlme_ext_ops {
722 	QDF_STATUS (*mlo_mlme_ext_validate_conn_req)(
723 		    struct vdev_mlme_obj *vdev_mlme, void *ext_data);
724 	QDF_STATUS (*mlo_mlme_ext_create_link_vdev)(
725 		    struct vdev_mlme_obj *vdev_mlme, void *ext_data);
726 	QDF_STATUS (*mlo_mlme_ext_peer_create)(struct wlan_objmgr_vdev *vdev,
727 					struct wlan_mlo_peer_context *ml_peer,
728 					struct qdf_mac_addr *addr,
729 					qdf_nbuf_t frm_buf);
730 	void (*mlo_mlme_ext_peer_assoc)(struct wlan_objmgr_peer *peer);
731 	void (*mlo_mlme_ext_peer_assoc_fail)(struct wlan_objmgr_peer *peer);
732 	void (*mlo_mlme_ext_peer_delete)(struct wlan_objmgr_peer *peer);
733 	void (*mlo_mlme_ext_assoc_resp)(struct wlan_objmgr_peer *peer);
734 	qdf_nbuf_t (*mlo_mlme_get_link_assoc_req)(struct wlan_objmgr_peer *peer,
735 						  uint8_t link_ix);
736 	void (*mlo_mlme_ext_deauth)(struct wlan_objmgr_peer *peer);
737 	QDF_STATUS (*mlo_mlme_ext_clone_security_param)(
738 		    struct vdev_mlme_obj *vdev_mlme,
739 		    struct wlan_cm_connect_req *req);
740 #ifdef UMAC_MLO_AUTH_DEFER
741 	void (*mlo_mlme_ext_peer_process_auth)(
742 	      struct mlpeer_auth_params *auth_param);
743 #endif
744 	void (*mlo_mlme_ext_handle_sta_csa_param)(
745 				struct wlan_objmgr_vdev *vdev,
746 				struct csa_offload_params *csa_param);
747 	QDF_STATUS (*mlo_mlme_ext_sta_op_class)(
748 			struct vdev_mlme_obj *vdev_mlme,
749 			uint8_t *ml_ie);
750 
751 };
752 
753 /* maximum size of vdev bitmap array for MLO link set active command */
754 #define MLO_VDEV_BITMAP_SZ 2
755 
756 /* maximum size of link number param array for MLO link set active command */
757 #define MLO_LINK_NUM_SZ 2
758 
759 /**
760  * enum mlo_link_force_mode: MLO link force modes
761  * @MLO_LINK_FORCE_MODE_ACTIVE:
762  *  Force specific links active
763  * @MLO_LINK_FORCE_MODE_INACTIVE:
764  *  Force specific links inactive
765  * @MLO_LINK_FORCE_MODE_ACTIVE_NUM:
766  *  Force active a number of links, firmware to decide which links to inactive
767  * @MLO_LINK_FORCE_MODE_INACTIVE_NUM:
768  *  Force inactive a number of links, firmware to decide which links to inactive
769  * @MLO_LINK_FORCE_MODE_NO_FORCE:
770  *  Cancel the force operation of specific links, allow firmware to decide
771  */
772 enum mlo_link_force_mode {
773 	MLO_LINK_FORCE_MODE_ACTIVE       = 1,
774 	MLO_LINK_FORCE_MODE_INACTIVE     = 2,
775 	MLO_LINK_FORCE_MODE_ACTIVE_NUM   = 3,
776 	MLO_LINK_FORCE_MODE_INACTIVE_NUM = 4,
777 	MLO_LINK_FORCE_MODE_NO_FORCE     = 5,
778 };
779 
780 /**
781  * enum mlo_link_force_reason: MLO link force reasons
782  * @MLO_LINK_FORCE_REASON_CONNECT:
783  *  Set force specific links because of new connection
784  * @MLO_LINK_FORCE_REASON_DISCONNECT:
785  *  Set force specific links because of new dis-connection
786  */
787 enum mlo_link_force_reason {
788 	MLO_LINK_FORCE_REASON_CONNECT    = 1,
789 	MLO_LINK_FORCE_REASON_DISCONNECT = 2,
790 };
791 
792 /**
793  * struct mlo_link_set_active_resp: MLO link set active response structure
794  * @status: Return status, 0 for success, non-zero otherwise
795  * @active_sz: size of current active vdev bitmap array
796  * @active: current active vdev bitmap array
797  * @inactive_sz: size of current inactive vdev bitmap array
798  * @inactive: current inactive vdev bitmap array
799  */
800 struct mlo_link_set_active_resp {
801 	uint32_t status;
802 	uint32_t active_sz;
803 	uint32_t active[MLO_VDEV_BITMAP_SZ];
804 	uint32_t inactive_sz;
805 	uint32_t inactive[MLO_VDEV_BITMAP_SZ];
806 };
807 
808 /**
809  * struct mlo_link_num_param: MLO link set active number params
810  * @num_of_link: number of links to active/inactive
811  * @vdev_type: type of vdev
812  * @vdev_subtype: subtype of vdev
813  * @home_freq: home frequency of the link
814  */
815 struct mlo_link_num_param {
816 	uint32_t num_of_link;
817 	uint32_t vdev_type;
818 	uint32_t vdev_subtype;
819 	uint32_t home_freq;
820 };
821 
822 /**
823  * struct mlo_link_set_active_param: MLO link set active params
824  * @force_mode: operation to take (enum mlo_link_force_mode)
825  * @reason: reason for the operation (enum mlo_link_force_reason)
826  * @num_link_entry: number of the valid entries for link_num
827  * @num_vdev_bitmap: number of the valid entries for vdev_bitmap
828  * @link_num: link number param array
829  *  It's present only when force_mode is MLO_LINK_FORCE_MODE_ACTIVE_NUM or
830  *  MLO_LINK_FORCE_MODE_INACTIVE_NUM
831  * @vdev_bitmap: active/inactive vdev bitmap array
832  *  It will be present when force_mode is MLO_LINK_FORCE_MODE_ACTIVE,
833  *  MLO_LINK_FORCE_MODE_INACTIVE, MLO_LINK_FORCE_MODE_NO_FORCE,
834  *  MLO_LINK_FORCE_MODE_ACTIVE_NUM or MLO_LINK_FORCE_MODE_INACTIVE_NUM
835  */
836 struct mlo_link_set_active_param {
837 	uint32_t force_mode;
838 	uint32_t reason;
839 	uint32_t num_link_entry;
840 	uint32_t num_vdev_bitmap;
841 	struct mlo_link_num_param link_num[MLO_LINK_NUM_SZ];
842 	uint32_t vdev_bitmap[MLO_VDEV_BITMAP_SZ];
843 };
844 
845 /*
846  * struct mlo_link_set_active_ctx - Context for MLO link set active request
847  * @vdev: pointer to vdev on which the request issued
848  * @cb: callback function for MLO link set active request
849  * @cb_arg: callback context
850  */
851 struct mlo_link_set_active_ctx {
852 	struct wlan_objmgr_vdev *vdev;
853 	void (*set_mlo_link_cb)(struct wlan_objmgr_vdev *vdev, void *arg,
854 				struct mlo_link_set_active_resp *evt);
855 	void *cb_arg;
856 };
857 
858 /*
859  * struct mlo_link_set_active_req - MLO link set active request
860  * @ctx: context for MLO link set active request
861  * @param: MLO link set active params
862  */
863 struct mlo_link_set_active_req {
864 	struct mlo_link_set_active_ctx ctx;
865 	struct mlo_link_set_active_param param;
866 };
867 
868 /*
869  * enum mlo_chip_recovery_type - MLO chip recovery types
870  * @MLO_RECOVERY_MODE_0: CRASH_PARTNER_CHIPS & recover all chips
871  * @MLO_RECOVERY_MODE_1: Crash & recover asserted chip alone
872  * @MLO_RECOVERY_MODE_MAX: Max limit for recovery types
873  */
874 enum mlo_chip_recovery_type {
875 	MLO_RECOVERY_MODE_0 = 1,
876 	MLO_RECOVERY_MODE_1 = 2,
877 
878 	/* Add new types above */
879 	MLO_RECOVERY_MODE_MAX = 0xf
880 };
881 #endif
882