xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h (revision aeb2ffde14d914a2adf90754989f139d4c934d4c)
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  * @state_lock: lock to protect access to link state
97  * @qdf_event_t: event for tearodwn completion
98  */
99 #define MAX_MLO_LINKS 6
100 #define MAX_MLO_CHIPS 5
101 struct mlo_setup_info {
102 	uint8_t ml_grp_id;
103 	uint8_t tot_socs;
104 	uint8_t num_soc;
105 	uint8_t tot_links;
106 	uint8_t num_links;
107 	struct wlan_objmgr_pdev *pdev_list[MAX_MLO_LINKS];
108 	struct wlan_objmgr_psoc *soc_list[MAX_MLO_CHIPS];
109 	enum MLO_LINK_STATE state[MAX_MLO_LINKS];
110 	qdf_spinlock_t state_lock;
111 	qdf_event_t event;
112 };
113 
114 /**
115  * struct mlo_state_params: MLO state params for pdev iteration
116  * @link_state_fail: Flag to check when pdev not in expected state
117  * @check_state: State on against which pdev is to be expected
118  */
119 struct mlo_state_params {
120 	bool link_state_fail;
121 	enum MLO_LINK_STATE check_state;
122 };
123 
124 #define MAX_MLO_GROUP 1
125 #endif
126 
127 /*
128  * struct mlo_mgr_context - MLO manager context
129  * @ml_dev_list_lock: ML DEV list lock
130  * @aid_lock: AID global lock
131  * @ml_peerid_lock: ML peer ID global lock
132  * @context: Array of MLO device context
133  * @mlo_peer_id_bmap: bitmap to allocate MLO Peer ID
134  * @max_mlo_peer_id: Max MLO Peer ID
135  * @info: MLO setup info
136  * @mlme_ops: MLO MLME callback function pointers
137  * @msgq_ctx: Context switch mgr
138  * @mlo_is_force_primary_umac: Force Primary UMAC enable
139  * @mlo_forced_primary_umac_id: Force Primary UMAC ID
140  * @dp_handle: pointer to DP ML context
141  */
142 struct mlo_mgr_context {
143 #ifdef WLAN_MLO_USE_SPINLOCK
144 	qdf_spinlock_t ml_dev_list_lock;
145 	qdf_spinlock_t aid_lock;
146 	qdf_spinlock_t ml_peerid_lock;
147 #else
148 	qdf_mutex_t ml_dev_list_lock;
149 	qdf_mutex_t aid_lock;
150 	qdf_mutex_t ml_peerid_lock;
151 #endif
152 	qdf_list_t ml_dev_list;
153 	qdf_bitmap(mlo_peer_id_bmap, MAX_MLO_PEER_ID);
154 	uint16_t max_mlo_peer_id;
155 #ifdef WLAN_MLO_MULTI_CHIP
156 	struct mlo_setup_info setup_info;
157 #endif
158 	struct mlo_mlme_ext_ops *mlme_ops;
159 	struct ctxt_switch_mgr *msgq_ctx;
160 	bool mlo_is_force_primary_umac;
161 	uint8_t mlo_forced_primary_umac_id;
162 	void *dp_handle;
163 };
164 
165 /*
166  * struct wlan_ml_vdev_aid_mgr – ML AID manager
167  * @aid_bitmap: AID bitmap array
168  * @start_aid: start of AID index
169  * @max_aid: Max allowed AID
170  * @aid_mgr[]:  Array of link vdev aid mgr
171  */
172 struct wlan_ml_vdev_aid_mgr {
173 	qdf_bitmap(aid_bitmap, WLAN_UMAC_MAX_AID);
174 	uint16_t start_aid;
175 	uint16_t max_aid;
176 	struct wlan_vdev_aid_mgr *aid_mgr[WLAN_UMAC_MLO_MAX_VDEVS];
177 };
178 
179 /*
180  * struct wlan_mlo_key_mgmt - MLO key management
181  * @link_mac_address: list of vdevs selected for connection with the MLAP
182  * @ptk: Pairwise transition keys
183  * @gtk: Group transition key
184  */
185 struct wlan_mlo_key_mgmt {
186 	struct qdf_mac_addr link_mac_address;
187 	uint32_t ptk;
188 	uint32_t gtk;
189 };
190 
191 /**
192  * struct mlo_sta_csa _params - CSA request parameters in mlo mgr
193  * @csa_param: csa parameters
194  * @link_id: the link index of AP which triggers CSA
195  * @mlo_csa_synced: Before vdev is up, csa information is only saved but not
196  *                  handled, and this value is false. Once vdev is up, the saved
197  *                  csa information is handled, and this value is changed to
198  *                  true. Note this value will be true if the vdev is doing
199  *                  restart.
200  * @csa_offload_event_recvd: True if WMI_CSA_HANDLING_EVENTID is already
201  *                           received. False if this is the first
202  *                           WMI_CSA_HANDLING_EVENTID.
203  * @valid_csa_param: True once csa_param is filled.
204  */
205 struct mlo_sta_csa_params {
206 	struct csa_offload_params csa_param;
207 	uint8_t link_id;
208 	bool mlo_csa_synced;
209 	bool csa_offload_event_recvd;
210 	bool valid_csa_param;
211 };
212 
213 /*
214  * struct mlo_sta_quiet_status - MLO sta quiet status
215  * @link_id: link id
216  * @quiet_status: true if corresponding ap in quiet status
217  * @valid_status: true if mlo_sta_quiet_status is filled
218  */
219 struct mlo_sta_quiet_status {
220 	uint8_t link_id;
221 	bool quiet_status;
222 	bool valid_status;
223 };
224 
225 /*
226  * struct wlan_mlo_sta - MLO sta additional info
227  * @wlan_connect_req_links: list of vdevs selected for connection with the MLAP
228  * @wlan_connected_links: list of vdevs associated with this MLO connection
229  * @connect req: connect params
230  * @copied_conn_req: original connect req
231  * @copied_conn_req_lock: lock for the original connect request
232  * @assoc_rsp: Raw assoc response frame
233  * @mlo_csa_param: CSA request parameters for mlo sta
234  * @disconn_req: disconnect req params
235  */
236 struct wlan_mlo_sta {
237 	qdf_bitmap(wlan_connect_req_links, WLAN_UMAC_MLO_MAX_VDEVS);
238 	qdf_bitmap(wlan_connected_links, WLAN_UMAC_MLO_MAX_VDEVS);
239 	struct wlan_mlo_key_mgmt key_mgmt[WLAN_UMAC_MLO_MAX_VDEVS - 1];
240 	struct wlan_cm_connect_req *connect_req;
241 	struct wlan_cm_connect_req *copied_conn_req;
242 #ifdef WLAN_MLO_USE_SPINLOCK
243 	qdf_spinlock_t copied_conn_req_lock;
244 #else
245 	qdf_mutex_t copied_conn_req_lock;
246 #endif
247 	struct element_info assoc_rsp;
248 	struct mlo_sta_quiet_status mlo_quiet_status[WLAN_UMAC_MLO_MAX_VDEVS];
249 	struct mlo_sta_csa_params mlo_csa_param[WLAN_UMAC_MLO_MAX_VDEVS];
250 	struct wlan_cm_disconnect_req *disconn_req;
251 };
252 
253 /*
254  * struct wlan_mlo_ap - MLO AP related info
255  * @num_ml_vdevs: number of vdevs to form MLD
256  * @ml_aid_mgr: ML AID mgr
257  * @mlo_vdev_quiet_bmap: Bitmap of vdevs for which quiet ie needs to enabled
258  */
259 struct wlan_mlo_ap {
260 	uint8_t num_ml_vdevs;
261 	struct wlan_ml_vdev_aid_mgr *ml_aid_mgr;
262 	qdf_bitmap(mlo_vdev_quiet_bmap, WLAN_UMAC_MLO_MAX_VDEVS);
263 };
264 
265 /*
266  * struct wlan_mlo_peer_list - MLO peer list entry
267  * @peer_hash: MLO peer hash code
268  * @peer_list_lock: lock to access members of structure
269  */
270 struct wlan_mlo_peer_list {
271 	qdf_list_t peer_hash[WLAN_PEER_HASHSIZE];
272 #ifdef WLAN_MLO_USE_SPINLOCK
273 	qdf_spinlock_t peer_list_lock;
274 #else
275 	qdf_mutex_t peer_list_lock;
276 #endif
277 };
278 
279 /*
280  * struct wlan_mlo_dev_context - MLO device context
281  * @node: QDF list node member
282  * @mld_id: MLD id
283  * @mld_addr: MLO device MAC address
284  * @wlan_vdev_list: list of vdevs associated with this MLO connection
285  * @wlan_vdev_count: number of elements in the vdev list
286  * @mlo_peer: list peers in this MLO connection
287  * @wlan_max_mlo_peer_count: peer count across the links of specific MLO
288  * @mlo_dev_lock: lock to access struct
289  * @ref_cnt: reference count
290  * @ref_id_dbg: Reference count debug information
291  * @sta_ctx: MLO STA related information
292  * @ap_ctx: AP related information
293  */
294 struct wlan_mlo_dev_context {
295 	qdf_list_node_t node;
296 	uint8_t mld_id;
297 	struct qdf_mac_addr mld_addr;
298 	struct wlan_objmgr_vdev *wlan_vdev_list[WLAN_UMAC_MLO_MAX_VDEVS];
299 	uint16_t wlan_vdev_count;
300 	struct wlan_mlo_peer_list mlo_peer_list;
301 	uint16_t wlan_max_mlo_peer_count;
302 #ifdef WLAN_MLO_USE_SPINLOCK
303 	qdf_spinlock_t mlo_dev_lock;
304 #else
305 	qdf_mutex_t mlo_dev_lock;
306 #endif
307 	qdf_atomic_t ref_cnt;
308 	qdf_atomic_t ref_id_dbg[WLAN_REF_ID_MAX];
309 	struct wlan_mlo_sta *sta_ctx;
310 	struct wlan_mlo_ap *ap_ctx;
311 };
312 
313 /*
314  * struct wlan_mlo_link_peer_entry – Link peer entry
315  * @link_peer: Object manager peer
316  * @link_addr: MAC address of link peer
317  * @link_ix: Link index
318  * @is_primary: sets true if the peer is primary UMAC’s peer
319  * @hw_link_id: HW Link id of peer
320  * @assoc_rsp_buf: Assoc resp buffer
321  */
322 struct wlan_mlo_link_peer_entry {
323 	struct wlan_objmgr_peer *link_peer;
324 	struct qdf_mac_addr link_addr;
325 	uint8_t link_ix;
326 	bool is_primary;
327 	uint8_t hw_link_id;
328 	qdf_nbuf_t assoc_rsp_buf;
329 };
330 
331 /*
332  * enum mlo_peer_state – MLO peer state
333  * @ML_PEER_CREATED:     Initial state
334  * @ML_PEER_ASSOC_DONE:  ASSOC sent on assoc link
335  * @ML_PEER_DISCONN_INITIATED: Disconnect initiated on one of the links
336  */
337 enum mlo_peer_state {
338 	ML_PEER_CREATED,
339 	ML_PEER_ASSOC_DONE,
340 	ML_PEER_DISCONN_INITIATED,
341 };
342 
343 #ifdef UMAC_SUPPORT_MLNAWDS
344 /*
345  * struct mlnawds_config - MLO NAWDS configuration
346  * @caps: Bandwidth & NSS capabilities to be configured on NAWDS peer
347  * @puncture_bitmap: puncture bitmap to be configured on NAWDS peer
348  * @mac: MAC address of the NAWDS peer to which the caps & puncture bitmap is
349  * to be configured.
350  */
351 struct mlnawds_config {
352 	uint64_t caps;
353 	uint16_t puncture_bitmap;
354 	uint8_t  mac[QDF_MAC_ADDR_SIZE];
355 };
356 #endif
357 
358 /*
359  * struct mlpeer_auth_params - Deferred Auth params
360  * @vdev_id:  VDEV ID
361  * @psoc_id:  PSOC ID
362  * @link_addr: MAC address
363  * @algo:  Auth algorithm
364  * @seq: Auth sequence number
365  * @status_code: Auth status
366  * @challenge: Auth Challenge
367  * @challenge_length: Auth Challenge length
368  * @wbuf:  Auth wbuf
369  * @rs: Rx stats
370  */
371 struct mlpeer_auth_params {
372 	uint8_t vdev_id;
373 	uint8_t psoc_id;
374 	struct qdf_mac_addr link_addr;
375 	uint16_t algo;
376 	uint16_t seq;
377 	uint16_t status_code;
378 	uint8_t *challenge;
379 	uint8_t challenge_length;
380 	qdf_nbuf_t wbuf;
381 	void *rs;
382 };
383 
384 /*
385  * struct wlan_mlo_peer_context - MLO peer context
386  *
387  * @peer_node:     peer list node for ml_dev qdf list
388  * @peer_list: list of peers on the MLO link
389  * @link_peer_cnt: Number of link peers attached
390  * @max_links: Max links for this ML peer
391  * @mlo_peer_id: unique ID for the peer
392  * @peer_mld_addr: MAC address of MLD link
393  * @mlo_ie: MLO IE struct
394  * @mlo_peer_lock: lock to access peer strucutre
395  * @assoc_id: Assoc ID derived by MLO manager
396  * @ref_cnt: Reference counter to avoid use after free
397  * @ml_dev: MLO dev context
398  * @mlpeer_state: MLO peer state
399  * @avg_link_rssi: avg RSSI of ML peer
400  * @is_nawds_ml_peer: flag to indicate if ml_peer is NAWDS configured
401  * @nawds_config: eack link peer's NAWDS configuration
402  * @pending_auth: Holds pending auth request
403  */
404 struct wlan_mlo_peer_context {
405 	qdf_list_node_t peer_node;
406 	struct wlan_mlo_link_peer_entry peer_list[MAX_MLO_LINK_PEERS];
407 	uint8_t link_peer_cnt;
408 	uint8_t max_links;
409 	uint32_t mlo_peer_id;
410 	struct qdf_mac_addr peer_mld_addr;
411 	uint8_t *mlo_ie;
412 #ifdef WLAN_MLO_USE_SPINLOCK
413 	qdf_spinlock_t mlo_peer_lock;
414 #else
415 	qdf_mutex_t mlo_peer_lock;
416 #endif
417 	uint16_t assoc_id;
418 	uint8_t primary_umac_psoc_id;
419 	qdf_atomic_t ref_cnt;
420 	struct wlan_mlo_dev_context *ml_dev;
421 	enum mlo_peer_state mlpeer_state;
422 	int8_t avg_link_rssi;
423 #ifdef UMAC_SUPPORT_MLNAWDS
424 	bool is_nawds_ml_peer;
425 	struct mlnawds_config nawds_config[MAX_MLO_LINK_PEERS];
426 #endif
427 #ifdef UMAC_MLO_AUTH_DEFER
428 	struct mlpeer_auth_params *pending_auth[MAX_MLO_LINK_PEERS];
429 #endif
430 };
431 
432 /*
433  * struct mlo_link_info – ML link info
434  * @link_addr: link mac address
435  * @link_id: link index
436  * @chan_freq: Operating channel frequency
437  * @nawds_config: peer's NAWDS configurarion
438  * @vdev_id: VDEV ID
439  */
440 struct mlo_link_info {
441 	struct qdf_mac_addr link_addr;
442 	uint8_t link_id;
443 	uint16_t chan_freq;
444 #ifdef UMAC_SUPPORT_MLNAWDS
445 	struct mlnawds_config nawds_config;
446 #endif
447 	uint8_t vdev_id;
448 };
449 
450 /*
451  * struct mlo_partner_info – mlo partner link info
452  * @num_partner_links: no. of partner links
453  * @partner_link_info: per partner link info
454  */
455 struct mlo_partner_info {
456 	uint8_t num_partner_links;
457 	struct mlo_link_info partner_link_info[WLAN_UMAC_MLO_MAX_VDEVS];
458 };
459 
460 /*
461  * struct mlo_tgt_link_info – ML target link info
462  * @vdev_id: link peer vdev id
463  * @hw_mld_link_id: HW link id
464  */
465 struct mlo_tgt_link_info {
466 	uint8_t vdev_id;
467 	uint8_t hw_mld_link_id;
468 };
469 
470 /*
471  * struct mlo_tgt_partner_info – mlo target partner link info
472  * @num_partner_links: no. of partner links
473  * @link_info: per partner link info
474  */
475 struct mlo_tgt_partner_info {
476 	uint8_t num_partner_links;
477 	struct mlo_tgt_link_info link_info[WLAN_UMAC_MLO_MAX_VDEVS];
478 };
479 
480 /*
481  * struct mlo_mlme_ext_ops - MLME callback functions
482  * @mlo_mlme_ext_validate_conn_req: Callback to validate connect request
483  * @mlo_mlme_ext_create_link_vdev: Callback to create link vdev for ML STA
484  * @mlo_mlme_ext_peer_create: Callback to create link peer
485  * @mlo_mlme_ext_peer_assoc: Callback to initiate peer assoc
486  * @mlo_mlme_ext_peer_assoc_fail: Callback to notify peer assoc failure
487  * @mlo_mlme_ext_peer_delete: Callback to initiate link peer delete
488  * @mlo_mlme_ext_assoc_resp: Callback to initiate assoc resp
489  * @mlo_mlme_get_link_assoc_req: Calback to get link assoc req buffer
490  * @mlo_mlme_ext_deauth: Callback to initiate deauth
491  * @mlo_mlme_ext_clone_security_param: Callback to clone mlo security params
492  * @mlo_mlme_ext_peer_process_auth: Callback to process pending auth
493  * @mlo_mlme_ext_handle_sta_csa_param: Callback to handle sta csa param
494  */
495 struct mlo_mlme_ext_ops {
496 	QDF_STATUS (*mlo_mlme_ext_validate_conn_req)(
497 		    struct vdev_mlme_obj *vdev_mlme, void *ext_data);
498 	QDF_STATUS (*mlo_mlme_ext_create_link_vdev)(
499 		    struct vdev_mlme_obj *vdev_mlme, void *ext_data);
500 	QDF_STATUS (*mlo_mlme_ext_peer_create)(struct wlan_objmgr_vdev *vdev,
501 					struct wlan_mlo_peer_context *ml_peer,
502 					struct qdf_mac_addr *addr,
503 					qdf_nbuf_t frm_buf);
504 	void (*mlo_mlme_ext_peer_assoc)(struct wlan_objmgr_peer *peer);
505 	void (*mlo_mlme_ext_peer_assoc_fail)(struct wlan_objmgr_peer *peer);
506 	void (*mlo_mlme_ext_peer_delete)(struct wlan_objmgr_peer *peer);
507 	void (*mlo_mlme_ext_assoc_resp)(struct wlan_objmgr_peer *peer);
508 	qdf_nbuf_t (*mlo_mlme_get_link_assoc_req)(struct wlan_objmgr_peer *peer,
509 						  uint8_t link_ix);
510 	void (*mlo_mlme_ext_deauth)(struct wlan_objmgr_peer *peer);
511 	QDF_STATUS (*mlo_mlme_ext_clone_security_param)(
512 		    struct vdev_mlme_obj *vdev_mlme,
513 		    struct wlan_cm_connect_req *req);
514 #ifdef UMAC_MLO_AUTH_DEFER
515 	void (*mlo_mlme_ext_peer_process_auth)(
516 	      struct mlpeer_auth_params *auth_param);
517 #endif
518 	void (*mlo_mlme_ext_handle_sta_csa_param)(
519 				struct wlan_objmgr_vdev *vdev,
520 				struct csa_offload_params *csa_param);
521 };
522 
523 /* maximum size of vdev bitmap array for MLO link set active command */
524 #define MLO_VDEV_BITMAP_SZ 2
525 
526 /* maximum size of link number param array for MLO link set active command */
527 #define MLO_LINK_NUM_SZ 2
528 
529 /**
530  * enum mlo_link_force_mode: MLO link force modes
531  * @MLO_LINK_FORCE_MODE_ACTIVE:
532  *  Force specific links active
533  * @MLO_LINK_FORCE_MODE_INACTIVE:
534  *  Force specific links inactive
535  * @MLO_LINK_FORCE_MODE_ACTIVE_NUM:
536  *  Force active a number of links, firmware to decide which links to inactive
537  * @MLO_LINK_FORCE_MODE_INACTIVE_NUM:
538  *  Force inactive a number of links, firmware to decide which links to inactive
539  * @MLO_LINK_FORCE_MODE_NO_FORCE:
540  *  Cancel the force operation of specific links, allow firmware to decide
541  */
542 enum mlo_link_force_mode {
543 	MLO_LINK_FORCE_MODE_ACTIVE       = 1,
544 	MLO_LINK_FORCE_MODE_INACTIVE     = 2,
545 	MLO_LINK_FORCE_MODE_ACTIVE_NUM   = 3,
546 	MLO_LINK_FORCE_MODE_INACTIVE_NUM = 4,
547 	MLO_LINK_FORCE_MODE_NO_FORCE     = 5,
548 };
549 
550 /**
551  * enum mlo_link_force_reason: MLO link force reasons
552  * @MLO_LINK_FORCE_REASON_CONNECT:
553  *  Set force specific links because of new connection
554  * @MLO_LINK_FORCE_REASON_DISCONNECT:
555  *  Set force specific links because of new dis-connection
556  */
557 enum mlo_link_force_reason {
558 	MLO_LINK_FORCE_REASON_CONNECT    = 1,
559 	MLO_LINK_FORCE_REASON_DISCONNECT = 2,
560 };
561 
562 /**
563  * struct mlo_link_set_active_resp: MLO link set active response structure
564  * @status: Return status, 0 for success, non-zero otherwise
565  * @active_sz: size of current active vdev bitmap array
566  * @active: current active vdev bitmap array
567  * @inactive_sz: size of current inactive vdev bitmap array
568  * @inactive: current inactive vdev bitmap array
569  */
570 struct mlo_link_set_active_resp {
571 	uint32_t status;
572 	uint32_t active_sz;
573 	uint32_t active[MLO_VDEV_BITMAP_SZ];
574 	uint32_t inactive_sz;
575 	uint32_t inactive[MLO_VDEV_BITMAP_SZ];
576 };
577 
578 /**
579  * struct mlo_link_num_param: MLO link set active number params
580  * @num_of_link: number of links to active/inactive
581  * @vdev_type: type of vdev
582  * @vdev_subtype: subtype of vdev
583  * @home_freq: home frequency of the link
584  */
585 struct mlo_link_num_param {
586 	uint32_t num_of_link;
587 	uint32_t vdev_type;
588 	uint32_t vdev_subtype;
589 	uint32_t home_freq;
590 };
591 
592 /**
593  * struct mlo_link_set_active_param: MLO link set active params
594  * @force_mode: operation to take (enum mlo_link_force_mode)
595  * @reason: reason for the operation (enum mlo_link_force_reason)
596  * @num_link_entry: number of the valid entries for link_num
597  * @num_vdev_bitmap: number of the valid entries for vdev_bitmap
598  * @link_num: link number param array
599  *  It's present only when force_mode is MLO_LINK_FORCE_MODE_ACTIVE_NUM or
600  *  MLO_LINK_FORCE_MODE_INACTIVE_NUM
601  * @vdev_bitmap: active/inactive vdev bitmap array
602  *  It will be present when force_mode is MLO_LINK_FORCE_MODE_ACTIVE,
603  *  MLO_LINK_FORCE_MODE_INACTIVE, MLO_LINK_FORCE_MODE_NO_FORCE,
604  *  MLO_LINK_FORCE_MODE_ACTIVE_NUM or MLO_LINK_FORCE_MODE_INACTIVE_NUM
605  */
606 struct mlo_link_set_active_param {
607 	uint32_t force_mode;
608 	uint32_t reason;
609 	uint32_t num_link_entry;
610 	uint32_t num_vdev_bitmap;
611 	struct mlo_link_num_param link_num[MLO_LINK_NUM_SZ];
612 	uint32_t vdev_bitmap[MLO_VDEV_BITMAP_SZ];
613 };
614 
615 /*
616  * struct mlo_link_set_active_ctx - Context for MLO link set active request
617  * @vdev: pointer to vdev on which the request issued
618  * @cb: callback function for MLO link set active request
619  * @cb_arg: callback context
620  */
621 struct mlo_link_set_active_ctx {
622 	struct wlan_objmgr_vdev *vdev;
623 	void (*set_mlo_link_cb)(struct wlan_objmgr_vdev *vdev, void *arg,
624 				struct mlo_link_set_active_resp *evt);
625 	void *cb_arg;
626 };
627 
628 /*
629  * struct mlo_link_set_active_req - MLO link set active request
630  * @ctx: context for MLO link set active request
631  * @param: MLO link set active params
632  */
633 struct mlo_link_set_active_req {
634 	struct mlo_link_set_active_ctx ctx;
635 	struct mlo_link_set_active_param param;
636 };
637 #endif
638