xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlo_mgr/inc/wlan_mlo_t2lm.h (revision b62151f8dd0743da724a4533988c78d2c7385d4f)
1 /*
2  * Copyright (c) 2022-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 T2LM APIs
19  */
20 
21 #ifndef _WLAN_MLO_T2LM_H_
22 #define _WLAN_MLO_T2LM_H_
23 
24 #include <wlan_cmn_ieee80211.h>
25 #include <wlan_mlo_mgr_public_structs.h>
26 #ifdef WMI_AP_SUPPORT
27 #include <wlan_cmn.h>
28 #endif
29 
30 struct mlo_vdev_host_tid_to_link_map_resp;
31 struct wlan_mlo_dev_context;
32 
33 /* Max T2LM TIDS count */
34 #define T2LM_MAX_NUM_TIDS 8
35 
36 #ifdef WMI_AP_SUPPORT
37 /* Max no. of Preferred links */
38 #define MAX_PREFERRED_LINKS 4
39 #endif
40 
41 /* Max T2LM callback handlers */
42 #define MAX_T2LM_HANDLERS 50
43 
44 #define T2LM_EXPECTED_DURATION_MAX_VALUE 0xFFFFFF
45 
46 /* Mapping switch time represented as bits 10 to 25 of the TSF value */
47 #define WLAN_T2LM_MAPPING_SWITCH_TSF_BITS 0x3FFFC00
48 
49 /* There is a delay involved to receive and process the beacon/probe response
50  * T2LM IE from AP. To match mapping switch timer expiry in both AP and STA,
51  * advance timer expiry in STA by 100ms (= 98 * 1024 / 1000 = 100).
52  */
53 #define WLAN_T2LM_MAPPING_SWITCH_TIME_DELAY 98
54 
55 /**
56  * enum wlan_t2lm_direction - Indicates the direction for which TID-to-link
57  * mapping is available.
58  *
59  * @WLAN_T2LM_DL_DIRECTION: Downlink
60  * @WLAN_T2LM_UL_DIRECTION: Uplink
61  * @WLAN_T2LM_BIDI_DIRECTION: Both downlink and uplink
62  * @WLAN_T2LM_MAX_DIRECTION: Max direction, this is used only internally
63  * @WLAN_T2LM_INVALID_DIRECTION: Invalid, this is used only internally to check
64  *                               if the mapping present in wlan_t2lm_info
65  *                               structure is valid or not.
66  */
67 enum wlan_t2lm_direction {
68 	WLAN_T2LM_DL_DIRECTION,
69 	WLAN_T2LM_UL_DIRECTION,
70 	WLAN_T2LM_BIDI_DIRECTION,
71 	WLAN_T2LM_MAX_DIRECTION,
72 	WLAN_T2LM_INVALID_DIRECTION,
73 };
74 
75 #ifdef WMI_AP_SUPPORT
76 /**
77  * enum wlan_link_band_caps - Represents the band capability of
78  * a link.
79  *
80  * @WLAN_LINK_BAND_INVALID: Invalid band
81  * @WLAN_LINK_BAND_2GHZ: 2GHz link
82  * @WLAN_LINK_BAND_5GHZ: 5GHz link
83  * @WLAN_LINK_BAND_5GHZ_LOW: 5GHz Low band link
84  * @WLAN_LINK_BAND_5GHZ_HIGH: 5GHz High band link
85  * @WLAN_LINK_BAND_6GHZ: 6GHz link
86  * @WLAN_LINK_BAND_6GHZ_LOW: 6GHz Low band link
87  * @WLAN_LINK_BAND_6GHZ_HIGH: 6GHz High band link
88  */
89 enum wlan_link_band_caps {
90 	WLAN_LINK_BAND_INVALID = 0,
91 	WLAN_LINK_BAND_2GHZ = 1,
92 	WLAN_LINK_BAND_5GHZ = 2,
93 	WLAN_LINK_BAND_5GHZ_LOW = 3,
94 	WLAN_LINK_BAND_5GHZ_HIGH = 4,
95 	WLAN_LINK_BAND_6GHZ = 5,
96 	WLAN_LINK_BAND_6GHZ_LOW = 6,
97 	WLAN_LINK_BAND_6GHZ_HIGH = 7,
98 };
99 
100 /**
101  * struct wlan_link_preference - Preferred link structure
102  * @num_pref_links: non-zero values indicate that preferred link order
103  * is present.
104  * @pref_order: Preferred links in order.it is in form of hardware link id.
105  * @timeout: timeout values for all the access categories.
106  * @tlt_characterization_params: Bitmask to select Tx-Link Tuple from ordered
107  *  list.
108  *  Bit 0-15: Each bit maps to the corresponding Link ID
109  *  Bit 16-31: Reserved
110  */
111 struct wlan_link_preference {
112 	uint8_t num_pref_links;
113 	uint8_t pref_order[MAX_PREFERRED_LINKS];
114 	uint32_t timeout[WIFI_AC_MAX];
115 	uint32_t tlt_characterization_params;
116 };
117 
118 /**
119  * struct wlan_t2lm_of_tids - TID-to-link mapping for a given direction
120  * @direction: direction from 'enum wlan_t2lm_direction'
121  * @t2lm_provisioned_links: Link mapping for all the TIDs. Represented as
122  *                          bitmap of type wlan_link_band_caps enum.
123  */
124 struct wlan_t2lm_of_tids {
125 	enum wlan_t2lm_direction direction;
126 	uint16_t t2lm_provisioned_links[T2LM_MAX_NUM_TIDS];
127 };
128 
129 /**
130  * struct wlan_preferred_links - Preferred link structure
131  * @peer_mld_mac_addr: STA MLD macaddr
132  * @num_t2lm_of_tids: non-zero value indicates that this structure is
133  * carrying the TID-to-link mapping.It indicates for how many directions,
134  * the TID-to-link mapping is present.
135  * @homogeneous_mapping: non-zero value indicates the provided mapping
136  * is homogeneous.
137  * @t2lm: Valid TID-to-link mapping for the directions
138  * @num_pref_links: non-zero values indicate that preferred link order is
139  * present.
140  * @preffered_link_order: Preferred links in order.
141  * The links will be represented interms of wlan_link_band_caps enum.
142  * @timeout: Timeout values for all the access categories.
143  */
144 struct wlan_preferred_links {
145 	uint8_t peer_mld_mac_addr[6];
146 	uint8_t num_t2lm_of_tids;
147 	int8_t homogeneous_mapping;
148 	struct wlan_t2lm_of_tids t2lm[WLAN_T2LM_MAX_DIRECTION];
149 	uint8_t num_pref_links;
150 	enum wlan_link_band_caps preffered_link_order[MAX_PREFERRED_LINKS];
151 	uint32_t timeout[WIFI_AC_MAX];
152 };
153 #endif
154 
155 /**
156  * struct wlan_t2lm_info - TID-to-Link mapping information for the frames
157  * transmitted on the uplink, downlink and bidirectional.
158  *
159  * @direction:  0 - Downlink, 1 - uplink 2 - Both uplink and downlink
160  * @default_link_mapping: value 1 indicates the default T2LM, where all the TIDs
161  *                        are mapped to all the links.
162  *                        value 0 indicates the preferred T2LM mapping
163  * @mapping_switch_time_present: Indicates if mapping switch time field present
164  *                               in the T2LM IE
165  * @expected_duration_present: Indicates if expected duration present in the
166  *                             T2LM IE
167  * @mapping_switch_time: Mapping switch time of this T2LM IE
168  * @expected_duration: Expected duration of this T2LM IE
169  * @ieee_link_map_tid: Indicates ieee link id mapping of all the TIDS
170  * @hw_link_map_tid: Indicates hw link id mapping of all the TIDS
171  * @timer_started: flag to check if T2LM timer is started for this T2LM IE
172  * @link_mapping_size: value 1 indicates the length of Link Mapping Of TIDn
173  *                     field is 1 octet, value 0 indicates the length of the
174  *                     Link Mapping of TIDn field is 2 octets
175  */
176 struct wlan_t2lm_info {
177 	enum wlan_t2lm_direction direction;
178 	bool default_link_mapping;
179 	bool mapping_switch_time_present;
180 	bool expected_duration_present;
181 	uint16_t mapping_switch_time;
182 	uint32_t expected_duration;
183 	uint16_t ieee_link_map_tid[T2LM_MAX_NUM_TIDS];
184 	uint16_t hw_link_map_tid[T2LM_MAX_NUM_TIDS];
185 	bool timer_started;
186 	bool link_mapping_size;
187 };
188 
189 /**
190  * enum wlan_t2lm_category - T2LM category
191  *
192  * @WLAN_T2LM_CATEGORY_NONE: none
193  * @WLAN_T2LM_CATEGORY_REQUEST: T2LM request
194  * @WLAN_T2LM_CATEGORY_RESPONSE: T2LM response
195  * @WLAN_T2LM_CATEGORY_TEARDOWN: T2LM teardown
196  * @WLAN_T2LM_CATEGORY_INVALID: Invalid
197  */
198 enum wlan_t2lm_category {
199 	WLAN_T2LM_CATEGORY_NONE = 0,
200 	WLAN_T2LM_CATEGORY_REQUEST = 1,
201 	WLAN_T2LM_CATEGORY_RESPONSE = 2,
202 	WLAN_T2LM_CATEGORY_TEARDOWN = 3,
203 	WLAN_T2LM_CATEGORY_INVALID,
204 };
205 
206 /**
207  * enum wlan_t2lm_tx_status - Status code applicable for the T2LM frames
208  * transmitted by the current peer.
209  *
210  * @WLAN_T2LM_TX_STATUS_NONE: Status code is not applicable
211  * @WLAN_T2LM_TX_STATUS_SUCCESS: AP/STA successfully transmitted the T2LM frame
212  * @WLAN_T2LM_TX_STATUS_FAILURE: Tx failure received from the FW.
213  * @WLAN_T2LM_TX_STATUS_RX_TIMEOUT: T2LM response frame not received from the
214  *                              peer for the transmitted T2LM request frame.
215  * @WLAN_T2LM_TX_STATUS_INVALID: Invalid status code
216  */
217 enum wlan_t2lm_tx_status {
218 	WLAN_T2LM_TX_STATUS_NONE = 0,
219 	WLAN_T2LM_TX_STATUS_SUCCESS = 1,
220 	WLAN_T2LM_TX_STATUS_FAILURE = 2,
221 	WLAN_T2LM_TX_STATUS_RX_TIMEOUT = 3,
222 	WLAN_T2LM_TX_STATUS_INVALID,
223 };
224 
225 /**
226  * enum wlan_t2lm_resp_frm_type - T2LM status corresponds to T2LM response frame
227  *
228  * @WLAN_T2LM_RESP_TYPE_SUCCESS: T2LM mapping provided in the T2LM request is
229  *                       accepted either by the AP or STA
230  * @WLAN_T2LM_RESP_TYPE_DENIED_TID_TO_LINK_MAPPING: T2LM Request denied because
231  *                       the requested TID-to-link mapping is unacceptable.
232  * @WLAN_T2LM_RESP_TYPE_PREFERRED_TID_TO_LINK_MAPPING: T2LM Request rejected and
233  *                       preferred TID-to-link mapping is suggested.
234  * @WLAN_T2LM_RESP_TYPE_INVALID: Status code is not applicable.
235  */
236 enum wlan_t2lm_resp_frm_type {
237 	WLAN_T2LM_RESP_TYPE_SUCCESS = 0,
238 	WLAN_T2LM_RESP_TYPE_DENIED_TID_TO_LINK_MAPPING = 133,
239 	WLAN_T2LM_RESP_TYPE_PREFERRED_TID_TO_LINK_MAPPING = 134,
240 	WLAN_T2LM_RESP_TYPE_INVALID,
241 };
242 
243 /**
244  * enum wlan_t2lm_enable - TID-to-link negotiation supported by the mlo peer
245  *
246  * @WLAN_T2LM_NOT_SUPPORTED: T2LM is not supported by the MLD
247  * @WLAN_T2LM_MAP_ALL_TIDS_TO_SAME_LINK_SET: MLD only supports the mapping of
248  *    all TIDs to the same link set.
249  * @WLAN_T2LM_MAP_RESERVED: reserved value
250  * @WLAN_T2LM_MAP_EACH_TID_TO_SAME_OR_DIFFERENET_LINK_SET: MLD supports the
251  *    mapping of each TID to the same or different link set (Disjoint mapping).
252  * @WLAN_T2LM_ENABLE_INVALID: invalid
253  */
254 enum wlan_t2lm_enable {
255 	WLAN_T2LM_NOT_SUPPORTED = 0,
256 	WLAN_T2LM_MAP_ALL_TIDS_TO_SAME_LINK_SET = 1,
257 	WLAN_T2LM_MAP_RESERVED = 2,
258 	WLAN_T2LM_MAP_EACH_TID_TO_SAME_OR_DIFFERENET_LINK_SET = 3,
259 	WLAN_T2LM_ENABLE_INVALID,
260 };
261 
262 /**
263  * struct wlan_prev_t2lm_negotiated_info - Previous successful T2LM negotiation
264  * is saved here.
265  *
266  * @dialog_token: Save the dialog token used in T2LM request and response frame.
267  * @t2lm_info: Provides the TID to LINK mapping information
268  * @link_preference: Provides the preferred link information
269  */
270 struct wlan_prev_t2lm_negotiated_info {
271 	uint16_t dialog_token;
272 	struct wlan_t2lm_info t2lm_info[WLAN_T2LM_MAX_DIRECTION];
273 #ifdef WMI_AP_SUPPORT
274 	struct wlan_link_preference link_preference;
275 #endif
276 };
277 
278 /**
279  * struct wlan_t2lm_onging_negotiation_info - Current ongoing T2LM negotiation
280  * (information about transmitted T2LM request/response frame)
281  *
282  * @category: T2LM category as T2LM request frame
283  * @dialog_token: Save the dialog token used in T2LM request and response frame.
284  * @t2lm_info: Provides the TID-to-link mapping info for UL/DL/BiDi
285  * @t2lm_tx_status: Status code corresponds to the transmitted T2LM frames
286  * @t2lm_resp_type: T2LM status corresponds to T2LM response frame.
287  * @link_preference: Provides the preferred link information
288  * @t2lm_info_present: It will show the t2lm_info present or not
289  * @pref_link_present: It will show the preference link is present or not
290  * @ml_grp_id: MLO Group id which it belongs to
291  */
292 struct wlan_t2lm_onging_negotiation_info {
293 	enum wlan_t2lm_category category;
294 	uint8_t dialog_token;
295 	struct wlan_t2lm_info t2lm_info[WLAN_T2LM_MAX_DIRECTION];
296 	enum wlan_t2lm_tx_status t2lm_tx_status;
297 	enum wlan_t2lm_resp_frm_type t2lm_resp_type;
298 #ifdef WMI_AP_SUPPORT
299 	struct wlan_link_preference link_preference;
300 	bool t2lm_info_present;
301 	bool pref_link_present;
302 	uint8_t ml_grp_id;
303 #endif
304 };
305 
306 /**
307  * struct wlan_mlo_peer_t2lm_policy - TID-to-link mapping information
308  *
309  * @self_gen_dialog_token: self generated dialog token used to send T2LM request
310  *                         frame;
311  * @t2lm_enable_val: TID-to-link enable value supported by this peer.
312  * @t2lm_negotiated_info: Previous successful T2LM negotiation is saved here.
313  * @ongoing_tid_to_link_mapping: This has the ongoing TID-to-link mapping info
314  *                               transmitted by this peer to the connected peer.
315  */
316 struct wlan_mlo_peer_t2lm_policy {
317 	uint8_t self_gen_dialog_token;
318 	enum wlan_t2lm_enable t2lm_enable_val;
319 	struct wlan_prev_t2lm_negotiated_info t2lm_negotiated_info;
320 	struct wlan_t2lm_onging_negotiation_info ongoing_tid_to_link_mapping;
321 };
322 
323 /**
324  * struct wlan_mlo_t2lm_ie - T2LM information
325  *
326  * @disabled_link_bitmap: Bitmap of disabled links. This is used to update the
327  *                        disabled link field of RNR IE
328  * @t2lm: T2LM info structure
329  */
330 struct wlan_mlo_t2lm_ie {
331 	uint16_t disabled_link_bitmap;
332 	struct wlan_t2lm_info t2lm;
333 };
334 
335 /*
336  * In a beacon or probe response frame, at max two T2LM IEs can be present
337  * first one to represent the already existing mapping and the other one
338  * represents the new T2LM mapping that is yet to establish.
339  */
340 #define WLAN_MAX_T2LM_IE 2
341 /**
342  * struct wlan_t2lm_timer - T2LM timer information
343  *
344  * @t2lm_timer: T2LM timer
345  * @timer_interval: T2LM Timer value
346  * @timer_started: T2LM timer started or not
347  * @timer_out_time: T2LM timer target out time
348  * @t2lm_dev_lock: lock to access struct
349  */
350 struct wlan_t2lm_timer {
351 	qdf_timer_t t2lm_timer;
352 	uint32_t timer_interval;
353 	uint32_t timer_out_time;
354 	bool timer_started;
355 #ifdef WLAN_MLO_USE_SPINLOCK
356 	qdf_spinlock_t t2lm_dev_lock;
357 #else
358 	qdf_mutex_t t2lm_dev_lock;
359 #endif
360 };
361 
362 struct wlan_mlo_dev_context;
363 
364 /**
365  * typedef wlan_mlo_t2lm_link_update_handler - T2LM handler API to notify the
366  * link update.
367  * @mldev: Pointer to mlo_dev_context
368  * @arg: ieee_link_map
369  *
370  * Return: QDF_STATUS
371  */
372 typedef QDF_STATUS (*wlan_mlo_t2lm_link_update_handler)(
373 		struct wlan_mlo_dev_context *mldev, void *arg);
374 
375 /**
376  * struct wlan_t2lm_context - T2LM IE information
377  *
378  * @established_t2lm: Indicates the already established broadcast T2LM IE
379  *                    advertised by the AP in beacon/probe response frames.
380  *                    In this T2LM IE, expected duration flag is set to 1 and
381  *                    mapping switch time present flag is set to 0 when the
382  *                    mapping is non-default.
383  * @upcoming_t2lm: Indicates the new broadcast T2LM IE advertised by the AP in
384  *                 beacon/probe response frames. STA needs to use this mapping
385  *                 when expected duration in the established T2LM is expires.
386  * @t2lm_timer: T2LM timer information
387  * @t2lm_dev_lock: t2lm dev context lock
388  * @tsf: time sync func value received via beacon
389  * @link_update_handler: handler to update T2LM link
390  * @is_valid_handler: T2LM handler is valid or not
391  */
392 struct wlan_t2lm_context {
393 	struct wlan_mlo_t2lm_ie established_t2lm;
394 	struct wlan_mlo_t2lm_ie upcoming_t2lm;
395 	struct wlan_t2lm_timer t2lm_timer;
396 #ifdef WLAN_MLO_USE_SPINLOCK
397 	qdf_spinlock_t t2lm_dev_lock;
398 #else
399 	qdf_mutex_t t2lm_dev_lock;
400 #endif
401 	uint64_t tsf;
402 	wlan_mlo_t2lm_link_update_handler
403 		link_update_handler[MAX_T2LM_HANDLERS];
404 	bool is_valid_handler[MAX_T2LM_HANDLERS];
405 };
406 
407 #ifdef WLAN_FEATURE_11BE
408 
409 #define t2lm_alert(format, args...) \
410 	QDF_TRACE_FATAL(QDF_MODULE_ID_T2LM, format, ## args)
411 
412 #define t2lm_err(format, args...) \
413 	QDF_TRACE_ERROR(QDF_MODULE_ID_T2LM, format, ## args)
414 
415 #define t2lm_warn(format, args...) \
416 	QDF_TRACE_WARN(QDF_MODULE_ID_T2LM, format, ## args)
417 
418 #define t2lm_info(format, args...) \
419 	QDF_TRACE_INFO(QDF_MODULE_ID_T2LM, format, ## args)
420 
421 #define t2lm_debug(format, args...) \
422 	QDF_TRACE_DEBUG(QDF_MODULE_ID_T2LM, format, ## args)
423 
424 #define t2lm_rl_debug(format, args...) \
425 	QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_T2LM, format, ## args)
426 
427 #define WLAN_T2LM_MAX_NUM_LINKS 16
428 
429 #ifdef WLAN_MLO_USE_SPINLOCK
430 /**
431  * t2lm_dev_lock_create - Create T2LM device mutex/spinlock
432  * @t2lm_ctx: T2LM context
433  *
434  * Creates mutex/spinlock
435  *
436  * Return: void
437  */
438 static inline void
439 t2lm_dev_lock_create(struct wlan_t2lm_context *t2lm_ctx)
440 {
441 	qdf_spinlock_create(&t2lm_ctx->t2lm_dev_lock);
442 }
443 
444 /**
445  * t2lm_dev_lock_destroy - Destroy T2LM mutex/spinlock
446  * @t2lm_ctx: T2LM context
447  *
448  * Destroy mutex/spinlock
449  *
450  * Return: void
451  */
452 static inline void
453 t2lm_dev_lock_destroy(struct wlan_t2lm_context *t2lm_ctx)
454 {
455 	qdf_spinlock_destroy(&t2lm_ctx->t2lm_dev_lock);
456 }
457 
458 /**
459  * t2lm_dev_lock_acquire - acquire T2LM mutex/spinlock
460  * @t2lm_ctx: T2LM context
461  *
462  * acquire mutex/spinlock
463  *
464  * return: void
465  */
466 static inline
467 void t2lm_dev_lock_acquire(struct wlan_t2lm_context *t2lm_ctx)
468 {
469 	qdf_spin_lock_bh(&t2lm_ctx->t2lm_dev_lock);
470 }
471 
472 /**
473  * t2lm_dev_lock_release - release T2LM dev mutex/spinlock
474  * @t2lm_ctx: T2LM context
475  *
476  * release mutex/spinlock
477  *
478  * return: void
479  */
480 static inline
481 void t2lm_dev_lock_release(struct wlan_t2lm_context *t2lm_ctx)
482 {
483 	qdf_spin_unlock_bh(&t2lm_ctx->t2lm_dev_lock);
484 }
485 #else /* WLAN_MLO_USE_SPINLOCK */
486 static inline
487 void t2lm_dev_lock_create(struct wlan_t2lm_context *t2lm_ctx)
488 {
489 	qdf_mutex_create(&t2lm_ctx->t2lm_dev_lock);
490 }
491 
492 static inline
493 void t2lm_dev_lock_destroy(struct wlan_t2lm_context *t2lm_ctx)
494 {
495 	qdf_mutex_destroy(&t2lm_ctx->t2lm_dev_lock);
496 }
497 
498 static inline void t2lm_dev_lock_acquire(struct wlan_t2lm_context *t2lm_ctx)
499 {
500 	qdf_mutex_acquire(&t2lm_ctx->t2lm_dev_lock);
501 }
502 
503 static inline void t2lm_dev_lock_release(struct wlan_t2lm_context *t2lm_ctx)
504 {
505 	qdf_mutex_release(&t2lm_ctx->t2lm_dev_lock);
506 }
507 #endif
508 
509 /**
510  * wlan_register_t2lm_link_update_notify_handler() - API to register the
511  * handlers to receive link update notification
512  * @handler: handler for T2LM link update
513  * @mldev: Pointer to mlo context
514  *
515  * Return: Index on which handler is registered
516  */
517 int wlan_register_t2lm_link_update_notify_handler(
518 		wlan_mlo_t2lm_link_update_handler handler,
519 		struct wlan_mlo_dev_context *mldev);
520 
521 /**
522  * wlan_unregister_t2lm_link_update_notify_handler() - API to unregister the
523  * T2LM related handlers
524  * @mldev: Pointer to mlo context
525  * @index: Index on which the handler was registered
526  *
527  * Return: None
528  */
529 void wlan_unregister_t2lm_link_update_notify_handler(
530 		struct wlan_mlo_dev_context *mldev, uint8_t index);
531 
532 /**
533  * wlan_mlo_dev_t2lm_notify_link_update() - API to call the registered handlers
534  * when there is a link update happens using T2LM
535  * @mldev: Pointer to mlo context
536  *
537  * Return: QDF_STATUS
538  */
539 QDF_STATUS wlan_mlo_dev_t2lm_notify_link_update(
540 		struct wlan_mlo_dev_context *mldev);
541 
542 /**
543  * wlan_mlo_parse_t2lm_ie() - API to parse the T2LM IE
544  * @t2lm: Pointer to T2LM structure
545  * @ie: Pointer to T2LM IE
546  *
547  * Return: QDF_STATUS
548  */
549 QDF_STATUS wlan_mlo_parse_t2lm_ie(
550 	struct wlan_t2lm_onging_negotiation_info *t2lm, uint8_t *ie);
551 
552 /**
553  * wlan_mlo_add_t2lm_ie() - API to add TID-to-link mapping IE
554  * @frm: Pointer to buffer
555  * @t2lm: Pointer to t2lm mapping structure
556  * @vdev: Pointer to vdev structure
557  *
558  * Return: Updated frame pointer
559  */
560 uint8_t *wlan_mlo_add_t2lm_ie(uint8_t *frm,
561 			      struct wlan_t2lm_onging_negotiation_info *t2lm,
562 			      struct wlan_objmgr_vdev *vdev);
563 
564 /**
565  * wlan_mlo_vdev_tid_to_link_map_event() - API to process the revceived T2LM
566  * event.
567  * @psoc: psoc object
568  * @event: Pointer to received T2LM info
569  *
570  * Return: QDF_STATUS
571  */
572 QDF_STATUS wlan_mlo_vdev_tid_to_link_map_event(
573 			struct wlan_objmgr_psoc *psoc,
574 			struct mlo_vdev_host_tid_to_link_map_resp *event);
575 
576 /**
577  * wlan_mlo_parse_t2lm_action_frame() - API to parse T2LM action frame
578  * @t2lm: Pointer to T2LM structure
579  * @action_frm: Pointer to action frame
580  * @category: T2LM action frame category
581  *
582  * Return: 0 - success, else failure
583  */
584 int wlan_mlo_parse_t2lm_action_frame(
585 		struct wlan_t2lm_onging_negotiation_info *t2lm,
586 		struct wlan_action_frame *action_frm,
587 		enum wlan_t2lm_category category);
588 
589 /**
590  * wlan_mlo_add_t2lm_action_frame() - API to add T2LM action frame
591  * @frm: Pointer to a frame to add T2LM IE
592  * @args: T2LM action frame related info
593  * @buf: Pointer to T2LM IE values
594  * @category: T2LM action frame category
595  *
596  * Return: Pointer to the updated frame buffer
597  */
598 uint8_t *wlan_mlo_add_t2lm_action_frame(
599 		uint8_t *frm, struct wlan_action_frame_args *args,
600 		uint8_t *buf, enum wlan_t2lm_category category);
601 
602 /**
603  * wlan_mlo_parse_bcn_prbresp_t2lm_ie() - API to parse the T2LM IE from beacon/
604  * probe response frame
605  * @t2lm_ctx: T2LM context
606  * @ie: Pointer to T2LM IE
607  *
608  * Return: QDF_STATUS
609  */
610 QDF_STATUS wlan_mlo_parse_bcn_prbresp_t2lm_ie(
611 		struct wlan_t2lm_context *t2lm_ctx, uint8_t *ie);
612 
613 /**
614  * wlan_mlo_parse_t2lm_info() - Parse T2LM IE fields
615  * @ie: Pointer to T2LM IE
616  * @t2lm: Pointer to T2LM structure
617  *
618  * Return: QDF_STATUS
619  */
620 QDF_STATUS wlan_mlo_parse_t2lm_info(uint8_t *ie,
621 				    struct wlan_t2lm_info *t2lm);
622 
623 /**
624  * wlan_mlo_add_t2lm_info_ie() - Add T2LM IE for UL/DL/Bidirection
625  * @frm: Pointer to buffer
626  * @t2lm: Pointer to t2lm mapping structure
627  * @vdev: Pointer to vdev structure
628  *
629  * Return: Updated frame pointer
630  */
631 uint8_t *wlan_mlo_add_t2lm_info_ie(uint8_t *frm, struct wlan_t2lm_info *t2lm,
632 				   struct wlan_objmgr_vdev *vdev);
633 
634 /**
635  * wlan_mlo_t2lm_timer_init() - API to initialize t2lm timer
636  * @vdev: Pointer to vdev
637  *
638  * Return: qdf status
639  */
640 QDF_STATUS
641 wlan_mlo_t2lm_timer_init(struct wlan_objmgr_vdev *vdev);
642 
643 /**
644  * wlan_mlo_t2lm_timer_deinit() - API to deinit t2lm timer
645  * @vdev: Pointer to vdev
646  *
647  * Return: qdf status
648  */
649 QDF_STATUS
650 wlan_mlo_t2lm_timer_deinit(struct wlan_objmgr_vdev *vdev);
651 
652 /**
653  * wlan_mlo_t2lm_timer_start() - API to start T2LM timer
654  * @vdev: Pointer to vdev
655  * @interval: T2LM timer interval
656  *
657  * Return: qdf status
658  */
659 QDF_STATUS
660 wlan_mlo_t2lm_timer_start(struct wlan_objmgr_vdev *vdev,
661 			  uint32_t interval);
662 
663 /**
664  * wlan_mlo_t2lm_timer_stop() - API to stop TID-to-link mapping timer
665  * @vdev: Pointer to vdev
666  *
667  * Return: qdf status
668  */
669 QDF_STATUS
670 wlan_mlo_t2lm_timer_stop(struct wlan_objmgr_vdev *vdev);
671 
672 /**
673  * wlan_mlo_t2lm_timer_expiry_handler() - API to handle t2lm timer expiry
674  * @vdev: Pointer to vdev structure
675  *
676  * Return: none
677  */
678 void
679 wlan_mlo_t2lm_timer_expiry_handler(void *vdev);
680 
681 /**
682  * wlan_handle_t2lm_timer() - API to handle TID-to-link mapping timer
683  * @vdev: Pointer to vdev
684  *
685  * Return: qdf status
686  */
687 QDF_STATUS
688 wlan_handle_t2lm_timer(struct wlan_objmgr_vdev *vdev);
689 
690 /**
691  * wlan_process_bcn_prbrsp_t2lm_ie() - API to process the received T2LM IE from
692  * beacon/probe response.
693  * @vdev: Pointer to vdev
694  * @rx_t2lm_ie: Received T2LM IE
695  * @tsf: Local TSF value
696  *
697  * Return QDF_STATUS
698  */
699 QDF_STATUS wlan_process_bcn_prbrsp_t2lm_ie(struct wlan_objmgr_vdev *vdev,
700 					   struct wlan_t2lm_context *rx_t2lm_ie,
701 					   uint64_t tsf);
702 
703 /**
704  * wlan_send_tid_to_link_mapping() - API to send T2LM info received from beacon,
705  * probe response or action frame to FW.
706  *
707  * @vdev: Pointer to vdev
708  * @t2lm: T2LM info
709  *
710  * Return QDF_STATUS
711  */
712 QDF_STATUS wlan_send_tid_to_link_mapping(struct wlan_objmgr_vdev *vdev,
713 					 struct wlan_t2lm_info *t2lm);
714 /**
715  * wlan_get_t2lm_mapping_status() - API to get T2LM info
716  * @vdev: Pointer to vdev
717  * @t2lm: T2LM info
718  *
719  * Return: QDF_STATUS
720  */
721 QDF_STATUS wlan_get_t2lm_mapping_status(struct wlan_objmgr_vdev *vdev,
722 					struct wlan_t2lm_info *t2lm);
723 
724 /**
725  * wlan_send_peer_level_tid_to_link_mapping() - API to send peer level T2LM info
726  * negotiated using action frames to FW.
727  *
728  * @vdev: Pointer to vdev
729  * @peer: pointer to peer
730  *
731  * Return QDF_STATUS
732  */
733 QDF_STATUS
734 wlan_send_peer_level_tid_to_link_mapping(struct wlan_objmgr_vdev *vdev,
735 					 struct wlan_objmgr_peer *peer);
736 
737 #else
738 static inline QDF_STATUS wlan_mlo_parse_t2lm_ie(
739 	struct wlan_t2lm_onging_negotiation_info *t2lm, uint8_t *ie)
740 {
741 	return QDF_STATUS_E_FAILURE;
742 }
743 
744 static inline
745 int8_t *wlan_mlo_add_t2lm_ie(uint8_t *frm,
746 			     struct wlan_t2lm_onging_negotiation_info *t2lm,
747 			     struct wlan_objmgr_vdev *vdev)
748 {
749 	return frm;
750 }
751 
752 static inline
753 int wlan_mlo_parse_t2lm_action_frame(
754 		struct wlan_t2lm_onging_negotiation_info *t2lm,
755 		struct wlan_action_frame *action_frm,
756 		enum wlan_t2lm_category category)
757 {
758 	return 0;
759 }
760 
761 static inline
762 uint8_t *wlan_mlo_add_t2lm_action_frame(
763 		uint8_t *frm, struct wlan_action_frame_args *args,
764 		uint8_t *buf, enum wlan_t2lm_category category)
765 {
766 	return frm;
767 }
768 
769 static inline
770 QDF_STATUS wlan_mlo_parse_bcn_prbresp_t2lm_ie(
771 		struct wlan_t2lm_context *t2lm_ctx, uint8_t *ie)
772 {
773 	return QDF_STATUS_E_FAILURE;
774 }
775 
776 static inline
777 QDF_STATUS wlan_mlo_parse_t2lm_info(uint8_t *ie,
778 				    struct wlan_t2lm_info *t2lm)
779 {
780 	return QDF_STATUS_E_FAILURE;
781 }
782 
783 static inline
784 uint8_t *wlan_mlo_add_t2lm_info_ie(uint8_t *frm, struct wlan_t2lm_info *t2lm,
785 				   struct wlan_objmgr_vdev *vdev)
786 {
787 	return frm;
788 }
789 
790 static inline QDF_STATUS
791 wlan_mlo_t2lm_timer_init(struct wlan_objmgr_vdev *vdev)
792 {
793 	return QDF_STATUS_E_NOSUPPORT;
794 }
795 
796 static inline QDF_STATUS
797 wlan_mlo_t2lm_timer_deinit(struct wlan_objmgr_vdev *vdev)
798 {
799 	return QDF_STATUS_E_NOSUPPORT;
800 }
801 
802 static inline QDF_STATUS
803 wlan_mlo_t2lm_timer_start(struct wlan_objmgr_vdev *vdev,
804 			  uint32_t interval)
805 {
806 	return QDF_STATUS_E_NOSUPPORT;
807 }
808 
809 static inline QDF_STATUS
810 wlan_mlo_t2lm_timer_stop(struct wlan_objmgr_vdev *vdev)
811 {
812 	return QDF_STATUS_E_NOSUPPORT;
813 }
814 
815 static inline void
816 wlan_mlo_t2lm_timer_expiry_handler(void *vdev)
817 {}
818 
819 static inline QDF_STATUS
820 wlan_handle_t2lm_timer(struct wlan_objmgr_vdev *vdev)
821 {
822 	return QDF_STATUS_E_NOSUPPORT;
823 }
824 
825 static inline QDF_STATUS
826 wlan_process_bcn_prbrsp_t2lm_ie(struct wlan_objmgr_vdev *vdev,
827 				struct wlan_t2lm_context *rx_t2lm_ie,
828 				uint64_t tsf)
829 {
830 	return QDF_STATUS_SUCCESS;
831 }
832 
833 static inline
834 int wlan_register_t2lm_link_update_notify_handler(
835 		wlan_mlo_t2lm_link_update_handler handler,
836 		struct wlan_mlo_dev_context *mldev)
837 {
838 	return 0;
839 }
840 
841 static inline
842 void wlan_unregister_t2lm_link_update_notify_handler(
843 		struct wlan_mlo_dev_context *mldev, uint8_t index)
844 {
845 }
846 
847 static inline QDF_STATUS wlan_mlo_dev_t2lm_notify_link_update(
848 		struct wlan_mlo_dev_context *mldev)
849 {
850 	return QDF_STATUS_SUCCESS;
851 }
852 
853 static inline
854 QDF_STATUS wlan_send_tid_to_link_mapping(struct wlan_objmgr_vdev *vdev,
855 					 struct wlan_t2lm_info *t2lm)
856 {
857 	return QDF_STATUS_SUCCESS;
858 }
859 
860 static inline QDF_STATUS
861 wlan_send_peer_level_tid_to_link_mapping(struct wlan_objmgr_vdev *vdev,
862 					 struct wlan_objmgr_peer *peer)
863 {
864 	return QDF_STATUS_SUCCESS;
865 }
866 #endif /* WLAN_FEATURE_11BE */
867 #endif /* _WLAN_MLO_T2LM_H_ */
868