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