xref: /wlan-driver/qca-wifi-host-cmn/umac/mlo_mgr/inc/wlan_mlo_mgr_link_switch.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2023-2024 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  * @pdev: pdev object manager
277  * @mlo_dev_ctx: mlo dev ctx
278  * @csa_param: csa parameters to be updated
279  * @link_id: link id
280  * Return : true if csa parameters are updated
281  */
282 bool mlo_mgr_update_csa_link_info(struct wlan_objmgr_pdev *pdev,
283 				  struct wlan_mlo_dev_context *mlo_dev_ctx,
284 				  struct csa_offload_params *csa_param,
285 				  uint8_t link_id);
286 
287 /**
288  * mlo_mgr_osif_update_connect_info() - Update connection info to OSIF
289  * layer on successful connection complete.
290  * @vdev: VDEV object manager.
291  * @link_id: IEEE protocol link id.
292  *
293  * The API will call OSIF connection update callback to update IEEE link id
294  * as part of connection to MLO capable BSS. This is specifically needed to
295  * make OSIF aware of all the links part of connection even about the links
296  * for which VDEV doesn't exist.
297  *
298  * Return: void
299  */
300 void mlo_mgr_osif_update_connect_info(struct wlan_objmgr_vdev *vdev,
301 				      int32_t link_id);
302 
303 /**
304  * mlo_mgr_link_switch_disconnect_done() - Notify MLO manager on link switch
305  * disconnect complete.
306  * @vdev: VDEV object manager
307  * @status: Status of disconnect
308  * @is_link_switch_resp: Set to true is disconnect response is for link switch
309  * disconnect request else false.
310  *
311  * The API to decide on next sequence of tasks based on status on disconnect
312  * request send as part of link switch. If the status is error, then abort
313  * link switch or else continue.
314  *
315  * If API is called with @is_link_switch_resp argument as false, then some
316  * other thread initiated disconnect, in this scenario change the state of
317  * link switch to abort further state transition and return, in actual link
318  * switch flow check this state to abort link switch.
319  *
320  * Return: QDF_STATUS
321  */
322 QDF_STATUS mlo_mgr_link_switch_disconnect_done(struct wlan_objmgr_vdev *vdev,
323 					       QDF_STATUS status,
324 					       bool is_link_switch_resp);
325 
326 /**
327  * mlo_mgr_link_switch_set_mac_addr_resp() - Handle response of set MAC addr
328  * for VDEV under going link switch.
329  * @vdev: VDEV object manager
330  * @resp_status: Status of MAC address set request.
331  *
332  * The function will handle the response for set MAC address request sent to FW
333  * as part of link switch. If the response is error, then abort the link switch
334  * and send the appropirate status to FW
335  *
336  * Return: QDF_STATUS
337  */
338 QDF_STATUS mlo_mgr_link_switch_set_mac_addr_resp(struct wlan_objmgr_vdev *vdev,
339 						 uint8_t resp_status);
340 
341 /**
342  * mlo_mgr_link_switch_start_connect() - Start link switch connect on new link
343  * @vdev: VDEV pointer.
344  *
345  * Call the API to initiate connection for link switch post successful set mac
346  * address on @vdev.
347  *
348  * Return:QDF_STATUS
349  */
350 QDF_STATUS mlo_mgr_link_switch_start_connect(struct wlan_objmgr_vdev *vdev);
351 
352 /**
353  * mlo_mgr_link_switch_connect_done() - Link switch connect done indication.
354  * @vdev: VDEV object manager
355  * @status: Status of connect request.
356  *
357  * The callback from connection manager with connect response.
358  * If the response is failure, don't change the state of link switch.
359  * If the response if success, set link switch state to
360  * MLO_LINK_SWITCH_STATE_COMPLETE_SUCCESS.
361  * Finally call remove link switch cmd from serialization.
362  *
363  * Return: void
364  */
365 void mlo_mgr_link_switch_connect_done(struct wlan_objmgr_vdev *vdev,
366 				      QDF_STATUS status);
367 
368 /**
369  * mlo_mgr_link_switch_init_state() - Set the current state of link switch
370  * to init state.
371  * @mlo_dev_ctx: MLO dev context
372  *
373  * Sets the current state of link switch to MLO_LINK_SWITCH_STATE_IDLE with
374  * MLO dev context lock held.
375  *
376  * Return: void
377  */
378 void mlo_mgr_link_switch_init_state(struct wlan_mlo_dev_context *mlo_dev_ctx);
379 
380 /**
381  * mlo_mgr_link_switch_trans_next_state() - Transition to next state based
382  * on current state.
383  * @mlo_dev_ctx: MLO dev context
384  *
385  * Move to next state in link switch process based on current state with
386  * MLO dev context lock held.
387  *
388  * Return: void
389  */
390 QDF_STATUS
391 mlo_mgr_link_switch_trans_next_state(struct wlan_mlo_dev_context *mlo_dev_ctx);
392 
393 /**
394  * mlo_mgr_link_switch_trans_abort_state() - Transition to abort trans state.
395  * @mlo_dev_ctx: ML dev context pointer of VDEV
396  *
397  * Transition the current link switch state to MLO_LINK_SWITCH_STATE_ABORT_TRANS
398  * state, no further state transitions are allowed in the ongoing link switch
399  * request.
400  *
401  * Return: void
402  */
403 void
404 mlo_mgr_link_switch_trans_abort_state(struct wlan_mlo_dev_context *mlo_dev_ctx);
405 
406 /**
407  * mlo_mgr_link_switch_get_curr_state() - Get the current state of link switch.
408  * @mlo_dev_ctx: MLO dev context.
409  *
410  * Get the current state of link switch with MLO dev context lock held.
411  *
412  * Return: void
413  */
414 enum mlo_link_switch_req_state
415 mlo_mgr_link_switch_get_curr_state(struct wlan_mlo_dev_context *mlo_dev_ctx);
416 
417 /**
418  * mlo_mgr_is_link_switch_in_progress() - Check in link ctx in MLO dev context
419  * if the last received link switch is in progress.
420  * @vdev: VDEV object manager
421  *
422  * The API is to be called for VDEV which has MLO dev context and link context
423  * initialized. Returns the value of 'is_in_progress' flag in last received
424  * link switch request.
425  *
426  * Return: bool
427  */
428 bool mlo_mgr_is_link_switch_in_progress(struct wlan_objmgr_vdev *vdev);
429 
430 /**
431  * mlo_mgr_link_switch_notification() - Notify MLO manager on start
432  * of link switch
433  * @vdev: VDEV object manager
434  * @lswitch_req: Link switch request params from FW
435  * @notify_reason: Reason for link switch notification
436  *
437  * The link switch notifier callback to MLO manager invoked before starting
438  * link switch disconnect
439  *
440  * Return: QDF_STATUS
441  */
442 QDF_STATUS mlo_mgr_link_switch_notification(struct wlan_objmgr_vdev *vdev,
443 					    struct wlan_mlo_link_switch_req *lswitch_req,
444 					    enum wlan_mlo_link_switch_notify_reason notify_reason);
445 
446 /**
447  * mlo_mgr_is_link_switch_on_assoc_vdev() - API to query whether link switch
448  * is on-going on assoc VDEV.
449  * @vdev: VDEV object manager
450  *
451  * Return: bool
452  */
453 bool mlo_mgr_is_link_switch_on_assoc_vdev(struct wlan_objmgr_vdev *vdev);
454 
455 /**
456  * mlo_mgr_link_switch_get_assoc_vdev() - Get current link switch VDEV
457  * pointer if it is assoc VDEV.
458  * @vdev: VDEV object manager.
459  *
460  * If the current link switch VDEV is assoc VDEV, fetch the pointer of that VDEV
461  *
462  * Return: VDEV object manager pointer
463  */
464 struct wlan_objmgr_vdev *
465 mlo_mgr_link_switch_get_assoc_vdev(struct wlan_objmgr_vdev *vdev);
466 
467 /**
468  * mlo_mgr_ser_link_switch_cmd() - The API will serialize link switch
469  * command in serialization queue.
470  * @vdev: VDEV objmgr pointer
471  * @req: Link switch request parameters
472  *
473  * On receiving link switch request with valid parameters from FW, this
474  * API will serialize the link switch command to procced for link switch
475  * on @vdev once the command comes to active queue.
476  *
477  * Return: QDF_STATUS
478  */
479 QDF_STATUS mlo_mgr_ser_link_switch_cmd(struct wlan_objmgr_vdev *vdev,
480 				       struct wlan_mlo_link_switch_req *req);
481 
482 /**
483  * mlo_mgr_remove_link_switch_cmd() - The API will remove the link switch
484  * command from active serialization queue.
485  * @vdev: VDEV object manager
486  *
487  * Once link switch process on @vdev is completed either in success of failure
488  * case, the API removes the link switch command from serialization queue.
489  *
490  * Return: void
491  */
492 void mlo_mgr_remove_link_switch_cmd(struct wlan_objmgr_vdev *vdev);
493 
494 /**
495  * mlo_mgr_link_switch_notify() - API to notify registered link switch notify
496  * callbacks.
497  * @vdev: VDEV object manager
498  * @req: Link switch request params from FW.
499  *
500  * The API calls all the registered link switch notifiers with appropriate
501  * reason for notifications. Callback handlers to take necessary action based
502  * on the reason.
503  * If any callback returns error API will return error or else success.
504  *
505  * Return: QDF_STATUS.
506  */
507 QDF_STATUS
508 mlo_mgr_link_switch_notify(struct wlan_objmgr_vdev *vdev,
509 			   struct wlan_mlo_link_switch_req *req);
510 
511 /**
512  * mlo_mgr_link_switch_validate_request() - Validate link switch request
513  * received from FW.
514  * @vdev: VDEV object manager
515  * @req: Request params from FW
516  *
517  * The API performs initial validation of link switch params received from FW
518  * before serializing the link switch cmd. If any of the params is invalid or
519  * the current status of MLO manager can't allow link switch, the API returns
520  * failure and link switch has to be terminated.
521  *
522  * Return: QDF_STATUS
523  */
524 QDF_STATUS
525 mlo_mgr_link_switch_validate_request(struct wlan_objmgr_vdev *vdev,
526 				     struct wlan_mlo_link_switch_req *req);
527 
528 /**
529  * mlo_mgr_link_switch_request_params() - Link switch request params from FW.
530  * @psoc: PSOC object manager
531  * @evt_params: Link switch params received from FW.
532  *
533  * The @params contain link switch request parameters received from FW as
534  * an indication to host to trigger link switch sequence on the specified
535  * VDEV. If the @params are not valid link switch will be terminated.
536  *
537  * Return: QDF_STATUS
538  */
539 QDF_STATUS mlo_mgr_link_switch_request_params(struct wlan_objmgr_psoc *psoc,
540 					      void *evt_params);
541 /**
542  * mlo_mgr_link_state_switch_info_handler() - Handle Link State change related
543  * information and generate corresponding connectivity logging event
544  * @psoc: Pointer to PSOC object
545  * @info: Source info to be sent for the logging event
546  *
547  * Return: QDF_STATUS
548  */
549 QDF_STATUS
550 mlo_mgr_link_state_switch_info_handler(struct wlan_objmgr_psoc *psoc,
551 				       struct mlo_link_switch_state_info *info);
552 
553 /**
554  * mlo_mgr_link_switch_complete() - Link switch complete notification to FW
555  * @vdev: VDV object manager
556  *
557  * Notify the status of link switch to FW once the link switch sequence is
558  * completed.
559  *
560  * Return: QDF_STATUS;
561  */
562 QDF_STATUS mlo_mgr_link_switch_complete(struct wlan_objmgr_vdev *vdev);
563 
564 /**
565  * mlo_mgr_link_switch_send_cnf_cmd() - Send status of link switch request to FW
566  * @psoc: PSOC object manager
567  * @cnf_params: Link switch confirm params to send to FW
568  *
569  * The API sends the link switch confirm params received to FW.
570  * Returns error incase it failed to notify FW.
571  *
572  * Return: QDF_STATUS
573  */
574 QDF_STATUS
575 mlo_mgr_link_switch_send_cnf_cmd(struct wlan_objmgr_psoc *psoc,
576 				 struct wlan_mlo_link_switch_cnf *cnf_params);
577 
578 /**
579  * mlo_mgr_link_switch_defer_disconnect_req() - Defer disconnect request from
580  * source other than link switch
581  * @vdev: VDEV object manager
582  * @source: Disconnect requestor
583  * @reason: Reason for disconnect
584  *
585  * If link switch is in progress for @vdev, then queue to disconnect request
586  * received in the MLO dev context and move link switch state to abort and
587  * on completion of link switch schedule pending disconnect requests.
588  *
589  * If link switch is not in progress or already another disconnect in queued in
590  * MLO dev context then reject the disconnect defer request.
591  *
592  * Return: QDF_STATUS.
593  */
594 QDF_STATUS
595 mlo_mgr_link_switch_defer_disconnect_req(struct wlan_objmgr_vdev *vdev,
596 					 enum wlan_cm_source source,
597 					 enum wlan_reason_code reason);
598 
599 /**
600  * mlo_mgr_link_switch_init() - API to initialize link switch
601  * @psoc: PSOC object manager
602  * @ml_dev: MLO dev context
603  *
604  * Initializes the MLO link context in @ml_dev and allocates various
605  * buffers needed.
606  *
607  * Return: QDF_STATUS
608  */
609 QDF_STATUS mlo_mgr_link_switch_init(struct wlan_objmgr_psoc *psoc,
610 				    struct wlan_mlo_dev_context *ml_dev);
611 
612 /**
613  * mlo_mgr_link_switch_deinit() - API to de-initialize link switch
614  * @ml_dev: MLO dev context
615  *
616  * De-initialize the MLO link context in @ml_dev on and frees memory
617  * allocated as part of initialization.
618  *
619  * Return: QDF_STATUS
620  */
621 QDF_STATUS mlo_mgr_link_switch_deinit(struct wlan_mlo_dev_context *ml_dev);
622 
623 static inline bool
mlo_mgr_is_link_switch_supported(struct wlan_objmgr_vdev * vdev)624 mlo_mgr_is_link_switch_supported(struct wlan_objmgr_vdev *vdev)
625 {
626 	return true;
627 }
628 
629 #else
630 static inline struct mlo_link_info
mlo_mgr_get_ap_link_by_link_id(struct wlan_mlo_dev_context * mlo_dev_ctx,int link_id)631 *mlo_mgr_get_ap_link_by_link_id(struct wlan_mlo_dev_context *mlo_dev_ctx,
632 				int link_id)
633 {
634 	return NULL;
635 }
636 
637 static inline bool
mlo_mgr_is_link_switch_supported(struct wlan_objmgr_vdev * vdev)638 mlo_mgr_is_link_switch_supported(struct wlan_objmgr_vdev *vdev)
639 {
640 	return false;
641 }
642 
643 static inline void
mlo_mgr_osif_update_connect_info(struct wlan_objmgr_vdev * vdev,int32_t link_id)644 mlo_mgr_osif_update_connect_info(struct wlan_objmgr_vdev *vdev, int32_t link_id)
645 {
646 }
647 
648 static inline QDF_STATUS
mlo_mgr_link_switch_disconnect_done(struct wlan_objmgr_vdev * vdev,QDF_STATUS status,bool is_link_switch_resp)649 mlo_mgr_link_switch_disconnect_done(struct wlan_objmgr_vdev *vdev,
650 				    QDF_STATUS status,
651 				    bool is_link_switch_resp)
652 {
653 	return QDF_STATUS_SUCCESS;
654 }
655 
656 static inline QDF_STATUS
mlo_mgr_link_switch_set_mac_addr_resp(struct wlan_objmgr_vdev * vdev,uint8_t resp_status)657 mlo_mgr_link_switch_set_mac_addr_resp(struct wlan_objmgr_vdev *vdev,
658 				      uint8_t resp_status)
659 {
660 	return QDF_STATUS_E_NOSUPPORT;
661 }
662 
663 static inline QDF_STATUS
mlo_mgr_link_switch_start_connect(struct wlan_objmgr_vdev * vdev)664 mlo_mgr_link_switch_start_connect(struct wlan_objmgr_vdev *vdev)
665 {
666 	return QDF_STATUS_E_NOSUPPORT;
667 }
668 
669 static inline void
mlo_mgr_link_switch_connect_done(struct wlan_objmgr_vdev * vdev,QDF_STATUS status)670 mlo_mgr_link_switch_connect_done(struct wlan_objmgr_vdev *vdev,
671 				 QDF_STATUS status)
672 {
673 }
674 
675 static inline QDF_STATUS
mlo_mgr_link_switch_deinit(struct wlan_mlo_dev_context * ml_dev)676 mlo_mgr_link_switch_deinit(struct wlan_mlo_dev_context *ml_dev)
677 {
678 	return QDF_STATUS_SUCCESS;
679 }
680 
681 static inline QDF_STATUS
mlo_mgr_link_switch_init(struct wlan_objmgr_psoc * psoc,struct wlan_mlo_dev_context * ml_dev)682 mlo_mgr_link_switch_init(struct wlan_objmgr_psoc *psoc,
683 			 struct wlan_mlo_dev_context *ml_dev)
684 {
685 	return QDF_STATUS_SUCCESS;
686 }
687 
688 static inline void
mlo_mgr_link_switch_init_state(struct wlan_mlo_dev_context * mlo_dev_ctx)689 mlo_mgr_link_switch_init_state(struct wlan_mlo_dev_context *mlo_dev_ctx)
690 {
691 }
692 
693 static inline QDF_STATUS
mlo_mgr_link_switch_trans_next_state(struct wlan_mlo_dev_context * mlo_dev_ctx)694 mlo_mgr_link_switch_trans_next_state(struct wlan_mlo_dev_context *mlo_dev_ctx)
695 {
696 	return QDF_STATUS_E_INVAL;
697 }
698 
699 static inline void
mlo_mgr_link_switch_trans_abort_state(struct wlan_mlo_dev_context * mlo_dev_ctx)700 mlo_mgr_link_switch_trans_abort_state(struct wlan_mlo_dev_context *mlo_dev_ctx)
701 {
702 }
703 
704 static inline enum mlo_link_switch_req_state
mlo_mgr_link_switch_get_curr_state(struct wlan_mlo_dev_context * mlo_dev_ctx)705 mlo_mgr_link_switch_get_curr_state(struct wlan_mlo_dev_context *mlo_dev_ctx)
706 {
707 	return MLO_LINK_SWITCH_STATE_IDLE;
708 }
709 
710 static inline bool
mlo_mgr_is_link_switch_in_progress(struct wlan_objmgr_vdev * vdev)711 mlo_mgr_is_link_switch_in_progress(struct wlan_objmgr_vdev *vdev)
712 {
713 	return false;
714 }
715 
716 static inline QDF_STATUS
mlo_mgr_link_switch_notification(struct wlan_objmgr_vdev * vdev,struct wlan_mlo_link_switch_req * lswitch_req,enum wlan_mlo_link_switch_notify_reason notify_reason)717 mlo_mgr_link_switch_notification(struct wlan_objmgr_vdev *vdev,
718 				 struct wlan_mlo_link_switch_req *lswitch_req,
719 				 enum wlan_mlo_link_switch_notify_reason notify_reason)
720 {
721 	return QDF_STATUS_E_NOSUPPORT;
722 }
723 
724 static inline bool
mlo_mgr_is_link_switch_on_assoc_vdev(struct wlan_objmgr_vdev * vdev)725 mlo_mgr_is_link_switch_on_assoc_vdev(struct wlan_objmgr_vdev *vdev)
726 {
727 	return false;
728 }
729 
730 static inline struct wlan_objmgr_vdev *
mlo_mgr_link_switch_get_assoc_vdev(struct wlan_objmgr_vdev * vdev)731 mlo_mgr_link_switch_get_assoc_vdev(struct wlan_objmgr_vdev *vdev)
732 {
733 	return NULL;
734 }
735 
736 static inline QDF_STATUS
mlo_mgr_ser_link_switch_cmd(struct wlan_objmgr_vdev * vdev,struct wlan_mlo_link_switch_req * req)737 mlo_mgr_ser_link_switch_cmd(struct wlan_objmgr_vdev *vdev,
738 			    struct wlan_mlo_link_switch_req *req)
739 {
740 	return QDF_STATUS_E_NOSUPPORT;
741 }
742 
743 static inline void
mlo_mgr_remove_link_switch_cmd(struct wlan_objmgr_vdev * vdev)744 mlo_mgr_remove_link_switch_cmd(struct wlan_objmgr_vdev *vdev)
745 {
746 }
747 
748 static inline QDF_STATUS
mlo_mgr_link_switch_notify(struct wlan_objmgr_vdev * vdev,struct wlan_mlo_link_switch_req * req)749 mlo_mgr_link_switch_notify(struct wlan_objmgr_vdev *vdev,
750 			   struct wlan_mlo_link_switch_req *req)
751 {
752 	return QDF_STATUS_E_NOSUPPORT;
753 }
754 
755 static inline QDF_STATUS
mlo_mgr_link_switch_validate_request(struct wlan_objmgr_vdev * vdev,struct wlan_mlo_link_switch_req * req)756 mlo_mgr_link_switch_validate_request(struct wlan_objmgr_vdev *vdev,
757 				     struct wlan_mlo_link_switch_req *req)
758 {
759 	return QDF_STATUS_E_NOSUPPORT;
760 }
761 
762 static inline QDF_STATUS
mlo_mgr_link_switch_request_params(struct wlan_objmgr_psoc * psoc,void * evt_params)763 mlo_mgr_link_switch_request_params(struct wlan_objmgr_psoc *psoc,
764 				   void *evt_params)
765 {
766 	return QDF_STATUS_E_NOSUPPORT;
767 }
768 
769 static inline QDF_STATUS
mlo_mgr_link_switch_complete(struct wlan_objmgr_vdev * vdev)770 mlo_mgr_link_switch_complete(struct wlan_objmgr_vdev *vdev)
771 {
772 	return QDF_STATUS_E_NOSUPPORT;
773 }
774 
775 static inline QDF_STATUS
mlo_mgr_link_switch_send_cnf_cmd(struct wlan_objmgr_psoc * psoc,struct wlan_mlo_link_switch_cnf * cnf_params)776 mlo_mgr_link_switch_send_cnf_cmd(struct wlan_objmgr_psoc *psoc,
777 				 struct wlan_mlo_link_switch_cnf *cnf_params)
778 {
779 	return QDF_STATUS_E_NOSUPPORT;
780 }
781 
782 static inline QDF_STATUS
mlo_mgr_link_switch_defer_disconnect_req(struct wlan_objmgr_vdev * vdev,enum wlan_cm_source source,enum wlan_reason_code reason)783 mlo_mgr_link_switch_defer_disconnect_req(struct wlan_objmgr_vdev *vdev,
784 					 enum wlan_cm_source source,
785 					 enum wlan_reason_code reason)
786 {
787 	return QDF_STATUS_E_NOSUPPORT;
788 }
789 
790 static inline bool
mlo_mgr_update_csa_link_info(struct wlan_mlo_dev_context * mlo_dev_ctx,struct csa_offload_params * csa_param,uint8_t link_id)791 mlo_mgr_update_csa_link_info(struct wlan_mlo_dev_context *mlo_dev_ctx,
792 			     struct csa_offload_params *csa_param,
793 			     uint8_t link_id)
794 {
795 	return false;
796 }
797 #endif
798 #endif
799