xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlo_mgr/inc/wlan_mlo_mgr_link_switch.h (revision 737b028eeab9d1c8c0971fb81ffcb33313bb90f0)
1 /*
2  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /*
18  * DOC: contains MLO manager public file containing link switch functionality
19  */
20 #ifndef _WLAN_MLO_MGR_LINK_SWITCH_H_
21 #define _WLAN_MLO_MGR_LINK_SWITCH_H_
22 
23 #include <wlan_mlo_mgr_public_structs.h>
24 #include <wlan_cm_public_struct.h>
25 
26 struct wlan_channel;
27 
28 #define WLAN_MLO_LSWITCH_MAX_HISTORY 5
29 #ifndef WLAN_MAX_ML_BSS_LINKS
30 #define WLAN_MAX_ML_BSS_LINKS 1
31 #endif
32 
33 /**
34  * enum wlan_mlo_link_switch_cnf_reason: Link Switch reject reason
35  *
36  * @MLO_LINK_SWITCH_CNF_REASON_BSS_PARAMS_CHANGED: Link's BSS params changed
37  * @MLO_LINK_SWITCH_CNF_REASON_CONCURRECNY_CONFLICT: Rejected because of
38  * Concurrency
39  * @MLO_LINK_SWITCH_CNF_REASON_HOST_INTERNAL_ERROR: Host internal error
40  * @MLO_LINK_SWITCH_CNF_REASON_MAX: Maximum reason for link switch rejection
41  */
42 enum wlan_mlo_link_switch_cnf_reason {
43 	MLO_LINK_SWITCH_CNF_REASON_BSS_PARAMS_CHANGED = 1,
44 	MLO_LINK_SWITCH_CNF_REASON_CONCURRECNY_CONFLICT = 2,
45 	MLO_LINK_SWITCH_CNF_REASON_HOST_INTERNAL_ERROR = 3,
46 	MLO_LINK_SWITCH_CNF_REASON_MAX,
47 };
48 
49 /**
50  * enum wlan_mlo_link_switch_cnf_status: Link Switch Confirmation status
51  *
52  * @MLO_LINK_SWITCH_CNF_STATUS_ACCEPT: Link switch accepted
53  * @MLO_LINK_SWITCH_CNF_STATUS_REJECT: Rejected because link switch cnf reason
54  * @MLO_LINK_SWITCH_CNF_STATUS_MAX: Maximum reason for link status
55  */
56 enum wlan_mlo_link_switch_cnf_status {
57 	MLO_LINK_SWITCH_CNF_STATUS_ACCEPT = 0,
58 	MLO_LINK_SWITCH_CNF_STATUS_REJECT = 1,
59 	MLO_LINK_SWITCH_CNF_STATUS_MAX,
60 };
61 
62 /**
63  * struct wlan_mlo_link_switch_cnf: structure to hold link switch conf info
64  *
65  * @vdev_id: VDEV ID of link switch link
66  * @status: Link Switch Confirmation status
67  * @reason: Link Switch Reject reason
68  */
69 struct wlan_mlo_link_switch_cnf {
70 	uint32_t vdev_id;
71 	enum wlan_mlo_link_switch_cnf_status status;
72 	enum wlan_mlo_link_switch_cnf_reason reason;
73 };
74 
75 /**
76  * enum wlan_mlo_link_switch_reason- Reason for link switch
77  *
78  * @MLO_LINK_SWITCH_REASON_RSSI_CHANGE: Link switch reason is because of RSSI
79  * @MLO_LINK_SWITCH_REASON_LOW_QUALITY: Link switch reason is because of low
80  * quality
81  * @MLO_LINK_SWITCH_REASON_C2_CHANGE: Link switch reason is because of C2 Metric
82  * @MLO_LINK_SWITCH_REASON_HOST_FORCE: Link switch reason is because of host
83  * force active/inactive
84  * @MLO_LINK_SWITCH_REASON_T2LM: Link switch reason is because of T2LM
85  * @MLO_LINK_SWITCH_REASON_MAX: Link switch reason max
86  */
87 enum wlan_mlo_link_switch_reason {
88 	MLO_LINK_SWITCH_REASON_RSSI_CHANGE = 1,
89 	MLO_LINK_SWITCH_REASON_LOW_QUALITY = 2,
90 	MLO_LINK_SWITCH_REASON_C2_CHANGE   = 3,
91 	MLO_LINK_SWITCH_REASON_HOST_FORCE  = 4,
92 	MLO_LINK_SWITCH_REASON_T2LM        = 5,
93 	MLO_LINK_SWITCH_REASON_MAX,
94 };
95 
96 /*
97  * enum mlo_link_switch_req_state - Enum to maintain the current state of
98  * link switch request.
99  * @MLO_LINK_SWITCH_STATE_IDLE: The last link switch request is inactive
100  * @MLO_LINK_SWITCH_STATE_INIT: Link switch is in pre-start state.
101  * @MLO_LINK_SWITCH_STATE_DISCONNECT_CURR_LINK: Current link disconnect
102  *                                              in progress.
103  * @MLO_LINK_SWITCH_STATE_SET_MAC_ADDR: MAC address update in progress
104  * @MLO_LINK_SWITCH_STATE_CONNECT_NEW_LINK: New link connect in progress.
105  * @MLO_LINK_SWITCH_STATE_COMPLETE_SUCCESS: Link switch completed successfully
106  * @MLO_LINK_SWITCH_STATE_ABORT_TRANS: Do not allow any further state
107  *                                     transition, only allowed to move to
108  *                                     MLO_LINK_SWITCH_STATE_IDLE state.
109  */
110 enum mlo_link_switch_req_state {
111 	MLO_LINK_SWITCH_STATE_IDLE,
112 	MLO_LINK_SWITCH_STATE_INIT,
113 	MLO_LINK_SWITCH_STATE_DISCONNECT_CURR_LINK,
114 	MLO_LINK_SWITCH_STATE_SET_MAC_ADDR,
115 	MLO_LINK_SWITCH_STATE_CONNECT_NEW_LINK,
116 	MLO_LINK_SWITCH_STATE_COMPLETE_SUCCESS,
117 	MLO_LINK_SWITCH_STATE_ABORT_TRANS,
118 };
119 
120 /**
121  * struct wlan_mlo_link_switch_req - Data Structure because of link switch
122  * request
123  * @vdev_id: VDEV Id of the link which is under link switch
124  * @curr_ieee_link_id: Current link id of the ML link
125  * @new_ieee_link_id: Link id of the link to which going to link switched
126  * @peer_mld_addr: Peer MLD address
127  * @new_primary_freq: primary frequency of link switch link
128  * @new_phymode: Phy mode of link switch link
129  * @state: Current state of link switch
130  * @reason: Link switch reason
131  * @restore_vdev_flag: VDEV Flag to be restored post link switch.
132  * @link_switch_ts: Link switch timestamp
133  */
134 struct wlan_mlo_link_switch_req {
135 	uint8_t vdev_id;
136 	uint8_t curr_ieee_link_id;
137 	uint8_t new_ieee_link_id;
138 	struct qdf_mac_addr peer_mld_addr;
139 	uint32_t new_primary_freq;
140 	uint32_t new_phymode;
141 	enum mlo_link_switch_req_state state;
142 	enum wlan_mlo_link_switch_reason reason;
143 	bool restore_vdev_flag;
144 	qdf_time_t link_switch_ts;
145 };
146 
147 /**
148  * struct mlo_link_switch_stats - hold information regarding link switch stats
149  * @total_num_link_switch: Total number of link switch
150  * @req_reason: Reason of link switch received from FW
151  * @cnf_reason: Confirm reason sent to FW
152  * @req_ts: Link switch timestamp
153  * @lswitch_status: structure to hold link switch status
154  */
155 struct mlo_link_switch_stats {
156 	uint32_t total_num_link_switch;
157 	struct {
158 		enum wlan_mlo_link_switch_reason req_reason;
159 		enum wlan_mlo_link_switch_cnf_reason cnf_reason;
160 		qdf_time_t req_ts;
161 	} lswitch_status[WLAN_MLO_LSWITCH_MAX_HISTORY];
162 };
163 
164 /**
165  * struct mlo_link_switch_context - Link switch data structure.
166  * @links_info: Hold information regarding all the links of ml connection
167  * @last_req: Last link switch request received from FW
168  * @lswitch_stats: History of the link switch stats
169  *                 Includes both fail and success stats.
170  */
171 struct mlo_link_switch_context {
172 	struct mlo_link_info links_info[WLAN_MAX_ML_BSS_LINKS];
173 	struct wlan_mlo_link_switch_req last_req;
174 	struct mlo_link_switch_stats lswitch_stats[MLO_LINK_SWITCH_CNF_STATUS_MAX];
175 };
176 
177 /**
178  * mlo_mgr_update_link_info_mac_addr() - MLO mgr update link info mac address
179  * @vdev: Object manager vdev
180  * @mlo_mac_update: ML link mac addresses update.
181  *
182  * Update link mac addresses for the ML links
183  * Return: none
184  */
185 void
186 mlo_mgr_update_link_info_mac_addr(struct wlan_objmgr_vdev *vdev,
187 				  struct wlan_mlo_link_mac_update *mlo_mac_update);
188 
189 /**
190  * mlo_mgr_update_link_info_reset() - Reset link info of ml dev context
191  * @psoc: psoc pointer
192  * @ml_dev: MLO device context
193  *
194  * Reset link info of ml links
195  * Return: QDF_STATUS
196  */
197 void mlo_mgr_update_link_info_reset(struct wlan_objmgr_psoc *psoc,
198 				    struct wlan_mlo_dev_context *ml_dev);
199 
200 /**
201  * mlo_mgr_update_ap_link_info() - Update AP links information
202  * @vdev: Object Manager vdev
203  * @link_id: Link id of the AP MLD link
204  * @ap_link_addr: AP link addresses
205  * @channel: wlan channel information of the link
206  *
207  * Update AP link information for each link of AP MLD
208  * Return: void
209  */
210 void mlo_mgr_update_ap_link_info(struct wlan_objmgr_vdev *vdev, uint8_t link_id,
211 				 uint8_t *ap_link_addr,
212 				 struct wlan_channel channel);
213 
214 /**
215  * mlo_mgr_clear_ap_link_info() - Clear AP link information
216  * @vdev: Object Manager vdev
217  * @ap_link_addr: AP link addresses
218  *
219  * Clear AP link info
220  * Return: void
221  */
222 void mlo_mgr_clear_ap_link_info(struct wlan_objmgr_vdev *vdev,
223 				uint8_t *ap_link_addr);
224 
225 /**
226  * mlo_mgr_reset_ap_link_info() - Reset AP links information
227  * @vdev: Object Manager vdev
228  *
229  * Reset AP links information in MLD
230  */
231 void mlo_mgr_reset_ap_link_info(struct wlan_objmgr_vdev *vdev);
232 
233 /**
234  * mlo_mgr_update_ap_channel_info() - Update AP channel information
235  * @vdev: Object Manager vdev
236  * @link_id: Link id of the AP MLD link
237  * @ap_link_addr: AP link addresses
238  * @channel: wlan channel information of the link
239  *
240  * Update AP channel information for each link of AP MLD
241  * Return: void
242  */
243 void mlo_mgr_update_ap_channel_info(struct wlan_objmgr_vdev *vdev,
244 				    uint8_t link_id,
245 				    uint8_t *ap_link_addr,
246 				    struct wlan_channel channel);
247 
248 /**
249  * mlo_mgr_get_ap_link() - Assoc mlo link info from link id
250  * @vdev: Object Manager vdev
251  *
252  * Get Assoc link info.
253  *
254  * Return: Pointer of link info
255  */
256 struct mlo_link_info *mlo_mgr_get_ap_link(struct wlan_objmgr_vdev *vdev);
257 
258 #ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
259 /**
260  * mlo_mgr_get_ap_link_by_link_id() - Get mlo link info from link id
261  * @mlo_dev_ctx: mlo context
262  * @link_id: Link id of the AP MLD link
263  *
264  * Search for the @link_id in the array in link_ctx in mlo_dev_ctx.
265  * Returns the pointer of mlo_link_info element matching the @link_id,
266  * or else NULL.
267  *
268  * Return: Pointer of link info
269  */
270 struct mlo_link_info*
271 mlo_mgr_get_ap_link_by_link_id(struct wlan_mlo_dev_context *mlo_dev_ctx,
272 			       int link_id);
273 
274 /**
275  * mlo_mgr_update_csa_link_info - update mlo sta csa params
276  * @mlo_dev_ctx: mlo dev ctx
277  * @csa_param: csa parameters to be updated
278  * @link_id: link id
279  * Return : true if csa parameters are updated
280  */
281 bool mlo_mgr_update_csa_link_info(struct wlan_mlo_dev_context *mlo_dev_ctx,
282 				  struct csa_offload_params *csa_param,
283 				  uint8_t link_id);
284 
285 /**
286  * mlo_mgr_osif_update_connect_info() - Update connection info to OSIF
287  * layer on successful connection complete.
288  * @vdev: VDEV object manager.
289  * @link_id: IEEE protocol link id.
290  *
291  * The API will call OSIF connection update callback to update IEEE link id
292  * as part of connection to MLO capable BSS. This is specifically needed to
293  * make OSIF aware of all the links part of connection even about the links
294  * for which VDEV doesn't exist.
295  *
296  * Return: void
297  */
298 void mlo_mgr_osif_update_connect_info(struct wlan_objmgr_vdev *vdev,
299 				      int32_t link_id);
300 
301 /**
302  * mlo_mgr_link_switch_disconnect_done() - Notify MLO manager on link switch
303  * disconnect complete.
304  * @vdev: VDEV object manager
305  * @status: Status of disconnect
306  * @is_link_switch_resp: Set to true is disconnect response is for link switch
307  * disconnect request else false.
308  *
309  * The API to decide on next sequence of tasks based on status on disconnect
310  * request send as part of link switch. If the status is error, then abort
311  * link switch or else continue.
312  *
313  * If API is called with @is_link_switch_resp argument as false, then some
314  * other thread initiated disconnect, in this scenario change the state of
315  * link switch to abort further state transition and return, in actual link
316  * switch flow check this state to abort link switch.
317  *
318  * Return: QDF_STATUS
319  */
320 QDF_STATUS mlo_mgr_link_switch_disconnect_done(struct wlan_objmgr_vdev *vdev,
321 					       QDF_STATUS status,
322 					       bool is_link_switch_resp);
323 
324 /**
325  * mlo_mgr_link_switch_set_mac_addr_resp() - Handle response of set MAC addr
326  * for VDEV under going link switch.
327  * @vdev: VDEV object manager
328  * @resp_status: Status of MAC address set request.
329  *
330  * The function will handle the response for set MAC address request sent to FW
331  * as part of link switch. If the response is error, then abort the link switch
332  * and send the appropirate status to FW
333  *
334  * Return: QDF_STATUS
335  */
336 QDF_STATUS mlo_mgr_link_switch_set_mac_addr_resp(struct wlan_objmgr_vdev *vdev,
337 						 uint8_t resp_status);
338 
339 /**
340  * mlo_mgr_link_switch_start_connect() - Start link switch connect on new link
341  * @vdev: VDEV pointer.
342  *
343  * Call the API to initiate connection for link switch post successful set mac
344  * address on @vdev.
345  *
346  * Return:QDF_STATUS
347  */
348 QDF_STATUS mlo_mgr_link_switch_start_connect(struct wlan_objmgr_vdev *vdev);
349 
350 /**
351  * mlo_mgr_link_switch_connect_done() - Link switch connect done indication.
352  * @vdev: VDEV object manager
353  * @status: Status of connect request.
354  *
355  * The callback from connection manager with connect response.
356  * If the response is failure, don't change the state of link switch.
357  * If the response if success, set link switch state to
358  * MLO_LINK_SWITCH_STATE_COMPLETE_SUCCESS.
359  * Finally call remove link switch cmd from serialization.
360  *
361  * Return: void
362  */
363 void mlo_mgr_link_switch_connect_done(struct wlan_objmgr_vdev *vdev,
364 				      QDF_STATUS status);
365 
366 /**
367  * mlo_mgr_link_switch_init_state() - Set the current state of link switch
368  * to init state.
369  * @mlo_dev_ctx: MLO dev context
370  *
371  * Sets the current state of link switch to MLO_LINK_SWITCH_STATE_IDLE with
372  * MLO dev context lock held.
373  *
374  * Return: void
375  */
376 void mlo_mgr_link_switch_init_state(struct wlan_mlo_dev_context *mlo_dev_ctx);
377 
378 /**
379  * mlo_mgr_link_switch_trans_next_state() - Transition to next state based
380  * on current state.
381  * @mlo_dev_ctx: MLO dev context
382  *
383  * Move to next state in link switch process based on current state with
384  * MLO dev context lock held.
385  *
386  * Return: void
387  */
388 QDF_STATUS
389 mlo_mgr_link_switch_trans_next_state(struct wlan_mlo_dev_context *mlo_dev_ctx);
390 
391 /**
392  * mlo_mgr_link_switch_trans_abort_state() - Transition to abort trans state.
393  * @mlo_dev_ctx: ML dev context pointer of VDEV
394  *
395  * Transition the current link switch state to MLO_LINK_SWITCH_STATE_ABORT_TRANS
396  * state, no further state transitions are allowed in the ongoing link switch
397  * request.
398  *
399  * Return: void
400  */
401 void
402 mlo_mgr_link_switch_trans_abort_state(struct wlan_mlo_dev_context *mlo_dev_ctx);
403 
404 /**
405  * mlo_mgr_link_switch_get_curr_state() - Get the current state of link switch.
406  * @mlo_dev_ctx: MLO dev context.
407  *
408  * Get the current state of link switch with MLO dev context lock held.
409  *
410  * Return: void
411  */
412 enum mlo_link_switch_req_state
413 mlo_mgr_link_switch_get_curr_state(struct wlan_mlo_dev_context *mlo_dev_ctx);
414 
415 /**
416  * mlo_mgr_is_link_switch_in_progress() - Check in link ctx in MLO dev context
417  * if the last received link switch is in progress.
418  * @vdev: VDEV object manager
419  *
420  * The API is to be called for VDEV which has MLO dev context and link context
421  * initialized. Returns the value of 'is_in_progress' flag in last received
422  * link switch request.
423  *
424  * Return: bool
425  */
426 bool mlo_mgr_is_link_switch_in_progress(struct wlan_objmgr_vdev *vdev);
427 
428 /**
429  * mlo_mgr_link_switch_notification() - Notify MLO manager on start
430  * of link switch
431  * @vdev: VDEV object manager
432  * @lswitch_req: Link switch request params from FW
433  * @notify_reason: Reason for link switch notification
434  *
435  * The link switch notifier callback to MLO manager invoked before starting
436  * link switch disconnect
437  *
438  * Return: QDF_STATUS
439  */
440 QDF_STATUS mlo_mgr_link_switch_notification(struct wlan_objmgr_vdev *vdev,
441 					    struct wlan_mlo_link_switch_req *lswitch_req,
442 					    enum wlan_mlo_link_switch_notify_reason notify_reason);
443 
444 /**
445  * mlo_mgr_is_link_switch_on_assoc_vdev() - API to query whether link switch
446  * is on-going on assoc VDEV.
447  * @vdev: VDEV object manager
448  *
449  * Return: bool
450  */
451 bool mlo_mgr_is_link_switch_on_assoc_vdev(struct wlan_objmgr_vdev *vdev);
452 
453 /**
454  * mlo_mgr_link_switch_get_assoc_vdev() - Get current link switch VDEV
455  * pointer if it is assoc VDEV.
456  * @vdev: VDEV object manager.
457  *
458  * If the current link switch VDEV is assoc VDEV, fetch the pointer of that VDEV
459  *
460  * Return: VDEV object manager pointer
461  */
462 struct wlan_objmgr_vdev *
463 mlo_mgr_link_switch_get_assoc_vdev(struct wlan_objmgr_vdev *vdev);
464 
465 /**
466  * mlo_mgr_ser_link_switch_cmd() - The API will serialize link switch
467  * command in serialization queue.
468  * @vdev: VDEV objmgr pointer
469  * @req: Link switch request parameters
470  *
471  * On receiving link switch request with valid parameters from FW, this
472  * API will serialize the link switch command to procced for link switch
473  * on @vdev once the command comes to active queue.
474  *
475  * Return: QDF_STATUS
476  */
477 QDF_STATUS mlo_mgr_ser_link_switch_cmd(struct wlan_objmgr_vdev *vdev,
478 				       struct wlan_mlo_link_switch_req *req);
479 
480 /**
481  * mlo_mgr_remove_link_switch_cmd() - The API will remove the link switch
482  * command from active serialization queue.
483  * @vdev: VDEV object manager
484  *
485  * Once link switch process on @vdev is completed either in success of failure
486  * case, the API removes the link switch command from serialization queue.
487  *
488  * Return: void
489  */
490 void mlo_mgr_remove_link_switch_cmd(struct wlan_objmgr_vdev *vdev);
491 
492 /**
493  * mlo_mgr_link_switch_notify() - API to notify registered link switch notify
494  * callbacks.
495  * @vdev: VDEV object manager
496  * @req: Link switch request params from FW.
497  *
498  * The API calls all the registered link switch notifiers with appropriate
499  * reason for notifications. Callback handlers to take necessary action based
500  * on the reason.
501  * If any callback returns error API will return error or else success.
502  *
503  * Return: QDF_STATUS.
504  */
505 QDF_STATUS
506 mlo_mgr_link_switch_notify(struct wlan_objmgr_vdev *vdev,
507 			   struct wlan_mlo_link_switch_req *req);
508 
509 /**
510  * mlo_mgr_link_switch_validate_request() - Validate link switch request
511  * received from FW.
512  * @vdev: VDEV object manager
513  * @req: Request params from FW
514  *
515  * The API performs initial validation of link switch params received from FW
516  * before serializing the link switch cmd. If any of the params is invalid or
517  * the current status of MLO manager can't allow link switch, the API returns
518  * failure and link switch has to be terminated.
519  *
520  * Return: QDF_STATUS
521  */
522 QDF_STATUS
523 mlo_mgr_link_switch_validate_request(struct wlan_objmgr_vdev *vdev,
524 				     struct wlan_mlo_link_switch_req *req);
525 
526 /**
527  * mlo_mgr_link_switch_request_params() - Link switch request params from FW.
528  * @psoc: PSOC object manager
529  * @evt_params: Link switch params received from FW.
530  *
531  * The @params contain link switch request parameters received from FW as
532  * an indication to host to trigger link switch sequence on the specified
533  * VDEV. If the @params are not valid link switch will be terminated.
534  *
535  * Return: QDF_STATUS
536  */
537 QDF_STATUS mlo_mgr_link_switch_request_params(struct wlan_objmgr_psoc *psoc,
538 					      void *evt_params);
539 /**
540  * mlo_mgr_link_state_switch_info_handler() - Handle Link State change related
541  * information and generate corresponding connectivity logging event
542  * @psoc: Pointer to PSOC object
543  * @info: Source info to be sent for the logging event
544  *
545  * Return: QDF_STATUS
546  */
547 QDF_STATUS
548 mlo_mgr_link_state_switch_info_handler(struct wlan_objmgr_psoc *psoc,
549 				       struct mlo_link_switch_state_info *info);
550 
551 /**
552  * mlo_mgr_link_switch_complete() - Link switch complete notification to FW
553  * @vdev: VDV object manager
554  *
555  * Notify the status of link switch to FW once the link switch sequence is
556  * completed.
557  *
558  * Return: QDF_STATUS;
559  */
560 QDF_STATUS mlo_mgr_link_switch_complete(struct wlan_objmgr_vdev *vdev);
561 
562 /**
563  * mlo_mgr_link_switch_send_cnf_cmd() - Send status of link switch request to FW
564  * @psoc: PSOC object manager
565  * @cnf_params: Link switch confirm params to send to FW
566  *
567  * The API sends the link switch confirm params received to FW.
568  * Returns error incase it failed to notify FW.
569  *
570  * Return: QDF_STATUS
571  */
572 QDF_STATUS
573 mlo_mgr_link_switch_send_cnf_cmd(struct wlan_objmgr_psoc *psoc,
574 				 struct wlan_mlo_link_switch_cnf *cnf_params);
575 
576 /**
577  * mlo_mgr_link_switch_defer_disconnect_req() - Defer disconnect request from
578  * source other than link switch
579  * @vdev: VDEV object manager
580  * @source: Disconnect requestor
581  * @reason: Reason for disconnect
582  *
583  * If link switch is in progress for @vdev, then queue to disconnect request
584  * received in the MLO dev context and move link switch state to abort and
585  * on completion of link switch schedule pending disconnect requests.
586  *
587  * If link switch is not in progress or already another disconnect in queued in
588  * MLO dev context then reject the disconnect defer request.
589  *
590  * Return: QDF_STATUS.
591  */
592 QDF_STATUS
593 mlo_mgr_link_switch_defer_disconnect_req(struct wlan_objmgr_vdev *vdev,
594 					 enum wlan_cm_source source,
595 					 enum wlan_reason_code reason);
596 
597 /**
598  * mlo_mgr_link_switch_init() - API to initialize link switch
599  * @psoc: PSOC object manager
600  * @ml_dev: MLO dev context
601  *
602  * Initializes the MLO link context in @ml_dev and allocates various
603  * buffers needed.
604  *
605  * Return: QDF_STATUS
606  */
607 QDF_STATUS mlo_mgr_link_switch_init(struct wlan_objmgr_psoc *psoc,
608 				    struct wlan_mlo_dev_context *ml_dev);
609 
610 /**
611  * mlo_mgr_link_switch_deinit() - API to de-initialize link switch
612  * @ml_dev: MLO dev context
613  *
614  * De-initialize the MLO link context in @ml_dev on and frees memory
615  * allocated as part of initialization.
616  *
617  * Return: QDF_STATUS
618  */
619 QDF_STATUS mlo_mgr_link_switch_deinit(struct wlan_mlo_dev_context *ml_dev);
620 
621 static inline bool
622 mlo_mgr_is_link_switch_supported(struct wlan_objmgr_vdev *vdev)
623 {
624 	return true;
625 }
626 
627 #else
628 static inline struct mlo_link_info
629 *mlo_mgr_get_ap_link_by_link_id(struct wlan_mlo_dev_context *mlo_dev_ctx,
630 				int link_id)
631 {
632 	return NULL;
633 }
634 
635 static inline bool
636 mlo_mgr_is_link_switch_supported(struct wlan_objmgr_vdev *vdev)
637 {
638 	return false;
639 }
640 
641 static inline void
642 mlo_mgr_osif_update_connect_info(struct wlan_objmgr_vdev *vdev, int32_t link_id)
643 {
644 }
645 
646 static inline QDF_STATUS
647 mlo_mgr_link_switch_disconnect_done(struct wlan_objmgr_vdev *vdev,
648 				    QDF_STATUS status,
649 				    bool is_link_switch_resp)
650 {
651 	return QDF_STATUS_SUCCESS;
652 }
653 
654 static inline QDF_STATUS
655 mlo_mgr_link_switch_set_mac_addr_resp(struct wlan_objmgr_vdev *vdev,
656 				      uint8_t resp_status)
657 {
658 	return QDF_STATUS_E_NOSUPPORT;
659 }
660 
661 static inline QDF_STATUS
662 mlo_mgr_link_switch_start_connect(struct wlan_objmgr_vdev *vdev)
663 {
664 	return QDF_STATUS_E_NOSUPPORT;
665 }
666 
667 static inline void
668 mlo_mgr_link_switch_connect_done(struct wlan_objmgr_vdev *vdev,
669 				 QDF_STATUS status)
670 {
671 }
672 
673 static inline QDF_STATUS
674 mlo_mgr_link_switch_deinit(struct wlan_mlo_dev_context *ml_dev)
675 {
676 	return QDF_STATUS_SUCCESS;
677 }
678 
679 static inline QDF_STATUS
680 mlo_mgr_link_switch_init(struct wlan_objmgr_psoc *psoc,
681 			 struct wlan_mlo_dev_context *ml_dev)
682 {
683 	return QDF_STATUS_SUCCESS;
684 }
685 
686 static inline void
687 mlo_mgr_link_switch_init_state(struct wlan_mlo_dev_context *mlo_dev_ctx)
688 {
689 }
690 
691 static inline QDF_STATUS
692 mlo_mgr_link_switch_trans_next_state(struct wlan_mlo_dev_context *mlo_dev_ctx)
693 {
694 	return QDF_STATUS_E_INVAL;
695 }
696 
697 static inline void
698 mlo_mgr_link_switch_trans_abort_state(struct wlan_mlo_dev_context *mlo_dev_ctx)
699 {
700 }
701 
702 static inline enum mlo_link_switch_req_state
703 mlo_mgr_link_switch_get_curr_state(struct wlan_mlo_dev_context *mlo_dev_ctx)
704 {
705 	return MLO_LINK_SWITCH_STATE_IDLE;
706 }
707 
708 static inline bool
709 mlo_mgr_is_link_switch_in_progress(struct wlan_objmgr_vdev *vdev)
710 {
711 	return false;
712 }
713 
714 static inline QDF_STATUS
715 mlo_mgr_link_switch_notification(struct wlan_objmgr_vdev *vdev,
716 				 struct wlan_mlo_link_switch_req *lswitch_req,
717 				 enum wlan_mlo_link_switch_notify_reason notify_reason)
718 {
719 	return QDF_STATUS_E_NOSUPPORT;
720 }
721 
722 static inline bool
723 mlo_mgr_is_link_switch_on_assoc_vdev(struct wlan_objmgr_vdev *vdev)
724 {
725 	return false;
726 }
727 
728 static inline struct wlan_objmgr_vdev *
729 mlo_mgr_link_switch_get_assoc_vdev(struct wlan_objmgr_vdev *vdev)
730 {
731 	return NULL;
732 }
733 
734 static inline QDF_STATUS
735 mlo_mgr_ser_link_switch_cmd(struct wlan_objmgr_vdev *vdev,
736 			    struct wlan_mlo_link_switch_req *req)
737 {
738 	return QDF_STATUS_E_NOSUPPORT;
739 }
740 
741 static inline void
742 mlo_mgr_remove_link_switch_cmd(struct wlan_objmgr_vdev *vdev)
743 {
744 }
745 
746 static inline QDF_STATUS
747 mlo_mgr_link_switch_notify(struct wlan_objmgr_vdev *vdev,
748 			   struct wlan_mlo_link_switch_req *req)
749 {
750 	return QDF_STATUS_E_NOSUPPORT;
751 }
752 
753 static inline QDF_STATUS
754 mlo_mgr_link_switch_validate_request(struct wlan_objmgr_vdev *vdev,
755 				     struct wlan_mlo_link_switch_req *req)
756 {
757 	return QDF_STATUS_E_NOSUPPORT;
758 }
759 
760 static inline QDF_STATUS
761 mlo_mgr_link_switch_request_params(struct wlan_objmgr_psoc *psoc,
762 				   void *evt_params)
763 {
764 	return QDF_STATUS_E_NOSUPPORT;
765 }
766 
767 static inline QDF_STATUS
768 mlo_mgr_link_switch_complete(struct wlan_objmgr_vdev *vdev)
769 {
770 	return QDF_STATUS_E_NOSUPPORT;
771 }
772 
773 static inline QDF_STATUS
774 mlo_mgr_link_switch_send_cnf_cmd(struct wlan_objmgr_psoc *psoc,
775 				 struct wlan_mlo_link_switch_cnf *cnf_params)
776 {
777 	return QDF_STATUS_E_NOSUPPORT;
778 }
779 
780 static inline QDF_STATUS
781 mlo_mgr_link_switch_defer_disconnect_req(struct wlan_objmgr_vdev *vdev,
782 					 enum wlan_cm_source source,
783 					 enum wlan_reason_code reason)
784 {
785 	return QDF_STATUS_E_NOSUPPORT;
786 }
787 
788 static inline bool
789 mlo_mgr_update_csa_link_info(struct wlan_mlo_dev_context *mlo_dev_ctx,
790 			     struct csa_offload_params *csa_param,
791 			     uint8_t link_id)
792 {
793 	return false;
794 }
795 #endif
796 #endif
797