1 /* 2 * Copyright (c) 2021, The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 /* 19 * DOC: contains mlo manager structure definitions 20 */ 21 #ifndef __MLO_MGR_PUBLIC_STRUCTS_H 22 #define __MLO_MGR_PUBLIC_STRUCTS_H 23 24 #include <wlan_objmgr_cmn.h> 25 #include <qdf_list.h> 26 #include <qdf_atomic.h> 27 #include <qdf_nbuf.h> 28 #include <wlan_cmn_ieee80211.h> 29 #include <wlan_cmn.h> 30 #include <wlan_objmgr_global_obj.h> 31 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP) 32 #include <qdf_event.h> 33 #endif 34 35 /* MAX MLO dev support */ 36 #ifndef WLAN_UMAC_MLO_MAX_VDEVS 37 #define WLAN_UMAC_MLO_MAX_VDEVS 2 38 #endif 39 40 /* MAX instances of ML devices */ 41 #ifndef WLAN_UMAC_MLO_MAX_DEV 42 #define WLAN_UMAC_MLO_MAX_DEV 2 43 #endif 44 45 /* Max PEER support */ 46 #define MAX_MLO_PEER 512 47 48 struct mlo_mlme_ext_ops; 49 struct vdev_mlme_obj; 50 51 /* Max LINK PEER support */ 52 #define MAX_MLO_LINK_PEERS WLAN_UMAC_MLO_MAX_VDEVS 53 54 #define MAX_MLO_PEER_ID 2048 55 #define MLO_INVALID_PEER_ID 0xFFFF 56 57 /* IE nomenclature */ 58 #define ID_POS 0 59 #define TAG_LEN_POS 1 60 #define IDEXT_POS 2 61 #define MIN_IE_LEN 2 62 #define MULTI_LINK_CTRL_1 3 63 #define MULTI_LINK_CTRL_2 4 64 #define STA_CTRL_1 2 65 #define STA_CTRL_2 3 66 #define STA_PROFILE_SUB_ELEM_ID 0 67 #define PER_STA_PROF_MAC_ADDR_START 4 68 69 #ifdef WLAN_MLO_MULTI_CHIP 70 /* 71 * enum MLO_LINK_STATE – MLO link state enums 72 * @MLO_LINK_SETUP_INIT - MLO link SETUP exchange not yet done 73 * @MLO_LINK_SETUP_DONE - MLO link SETUP exchange started 74 * @MLO_LINK_READY - MLO link SETUP done and READY sent 75 * @MLO_LINK_TEARDOWN - MLO teardown done. 76 * @MLO_LINK_UNINITIALIZED - MLO link in blank state 77 */ 78 enum MLO_LINK_STATE { 79 MLO_LINK_SETUP_INIT, 80 MLO_LINK_SETUP_DONE, 81 MLO_LINK_READY, 82 MLO_LINK_TEARDOWN, 83 MLO_LINK_UNINITIALIZED, 84 }; 85 86 /** 87 * struct mlo_setup_info: MLO setup status per link 88 * @ml_grp_id: Unique id for ML grouping of Pdevs/links 89 * @tot_socs: Total number of soc participating in ML group 90 * @num_soc: Number of soc ready or probed 91 * @tot_links: Total links in ML group 92 * @num_links: Number of links probed in ML group 93 * @pdev_list[MAX_MLO_LINKS]: pdev pointers belonging to this group 94 * @soc_list[MAX_MLO_CHIPS]: psoc pointers belonging to this group 95 * @state[MAX_MLO_LINKS]: MLO link state 96 * @valid_link_bitmap: valid MLO link bitmap 97 * @state_lock: lock to protect access to link state 98 * @qdf_event_t: event for teardown completion 99 */ 100 #define MAX_MLO_LINKS 6 101 #define MAX_MLO_CHIPS 5 102 struct mlo_setup_info { 103 uint8_t ml_grp_id; 104 uint8_t tot_socs; 105 uint8_t num_soc; 106 uint8_t tot_links; 107 uint8_t num_links; 108 struct wlan_objmgr_pdev *pdev_list[MAX_MLO_LINKS]; 109 struct wlan_objmgr_psoc *soc_list[MAX_MLO_CHIPS]; 110 enum MLO_LINK_STATE state[MAX_MLO_LINKS]; 111 uint16_t valid_link_bitmap; 112 qdf_spinlock_t state_lock; 113 qdf_event_t event; 114 }; 115 116 /** 117 * struct mlo_state_params: MLO state params for pdev iteration 118 * @link_state_fail: Flag to check when pdev not in expected state 119 * @check_state: State on against which pdev is to be expected 120 */ 121 struct mlo_state_params { 122 bool link_state_fail; 123 enum MLO_LINK_STATE check_state; 124 }; 125 126 #define MAX_MLO_GROUP 1 127 #endif 128 129 /* 130 * struct mlo_mgr_context - MLO manager context 131 * @ml_dev_list_lock: ML DEV list lock 132 * @aid_lock: AID global lock 133 * @ml_peerid_lock: ML peer ID global lock 134 * @context: Array of MLO device context 135 * @mlo_peer_id_bmap: bitmap to allocate MLO Peer ID 136 * @max_mlo_peer_id: Max MLO Peer ID 137 * @info: MLO setup info 138 * @mlme_ops: MLO MLME callback function pointers 139 * @msgq_ctx: Context switch mgr 140 * @mlo_is_force_primary_umac: Force Primary UMAC enable 141 * @mlo_forced_primary_umac_id: Force Primary UMAC ID 142 * @dp_handle: pointer to DP ML context 143 */ 144 struct mlo_mgr_context { 145 #ifdef WLAN_MLO_USE_SPINLOCK 146 qdf_spinlock_t ml_dev_list_lock; 147 qdf_spinlock_t aid_lock; 148 qdf_spinlock_t ml_peerid_lock; 149 #else 150 qdf_mutex_t ml_dev_list_lock; 151 qdf_mutex_t aid_lock; 152 qdf_mutex_t ml_peerid_lock; 153 #endif 154 qdf_list_t ml_dev_list; 155 qdf_bitmap(mlo_peer_id_bmap, MAX_MLO_PEER_ID); 156 uint16_t max_mlo_peer_id; 157 #ifdef WLAN_MLO_MULTI_CHIP 158 struct mlo_setup_info setup_info; 159 #endif 160 struct mlo_mlme_ext_ops *mlme_ops; 161 struct ctxt_switch_mgr *msgq_ctx; 162 bool mlo_is_force_primary_umac; 163 uint8_t mlo_forced_primary_umac_id; 164 void *dp_handle; 165 }; 166 167 /* 168 * struct wlan_ml_vdev_aid_mgr – ML AID manager 169 * @aid_bitmap: AID bitmap array 170 * @start_aid: start of AID index 171 * @max_aid: Max allowed AID 172 * @aid_mgr[]: Array of link vdev aid mgr 173 */ 174 struct wlan_ml_vdev_aid_mgr { 175 qdf_bitmap(aid_bitmap, WLAN_UMAC_MAX_AID); 176 uint16_t start_aid; 177 uint16_t max_aid; 178 struct wlan_vdev_aid_mgr *aid_mgr[WLAN_UMAC_MLO_MAX_VDEVS]; 179 }; 180 181 /* 182 * struct wlan_mlo_key_mgmt - MLO key management 183 * @link_mac_address: list of vdevs selected for connection with the MLAP 184 * @ptk: Pairwise transition keys 185 * @gtk: Group transition key 186 */ 187 struct wlan_mlo_key_mgmt { 188 struct qdf_mac_addr link_mac_address; 189 uint32_t ptk; 190 uint32_t gtk; 191 }; 192 193 /** 194 * struct mlo_sta_csa _params - CSA request parameters in mlo mgr 195 * @csa_param: csa parameters 196 * @link_id: the link index of AP which triggers CSA 197 * @mlo_csa_synced: Before vdev is up, csa information is only saved but not 198 * handled, and this value is false. Once vdev is up, the saved 199 * csa information is handled, and this value is changed to 200 * true. Note this value will be true if the vdev is doing 201 * restart. 202 * @csa_offload_event_recvd: True if WMI_CSA_HANDLING_EVENTID is already 203 * received. False if this is the first 204 * WMI_CSA_HANDLING_EVENTID. 205 * @valid_csa_param: True once csa_param is filled. 206 */ 207 struct mlo_sta_csa_params { 208 struct csa_offload_params csa_param; 209 uint8_t link_id; 210 bool mlo_csa_synced; 211 bool csa_offload_event_recvd; 212 bool valid_csa_param; 213 }; 214 215 /* 216 * struct mlo_sta_quiet_status - MLO sta quiet status 217 * @link_id: link id 218 * @quiet_status: true if corresponding ap in quiet status 219 * @valid_status: true if mlo_sta_quiet_status is filled 220 */ 221 struct mlo_sta_quiet_status { 222 uint8_t link_id; 223 bool quiet_status; 224 bool valid_status; 225 }; 226 227 /* 228 * struct wlan_mlo_sta - MLO sta additional info 229 * @wlan_connect_req_links: list of vdevs selected for connection with the MLAP 230 * @wlan_connected_links: list of vdevs associated with this MLO connection 231 * @connect req: connect params 232 * @copied_conn_req: original connect req 233 * @copied_conn_req_lock: lock for the original connect request 234 * @assoc_rsp: Raw assoc response frame 235 * @mlo_csa_param: CSA request parameters for mlo sta 236 * @disconn_req: disconnect req params 237 */ 238 struct wlan_mlo_sta { 239 qdf_bitmap(wlan_connect_req_links, WLAN_UMAC_MLO_MAX_VDEVS); 240 qdf_bitmap(wlan_connected_links, WLAN_UMAC_MLO_MAX_VDEVS); 241 struct wlan_mlo_key_mgmt key_mgmt[WLAN_UMAC_MLO_MAX_VDEVS - 1]; 242 struct wlan_cm_connect_req *connect_req; 243 struct wlan_cm_connect_req *copied_conn_req; 244 #ifdef WLAN_MLO_USE_SPINLOCK 245 qdf_spinlock_t copied_conn_req_lock; 246 #else 247 qdf_mutex_t copied_conn_req_lock; 248 #endif 249 struct element_info assoc_rsp; 250 struct mlo_sta_quiet_status mlo_quiet_status[WLAN_UMAC_MLO_MAX_VDEVS]; 251 struct mlo_sta_csa_params mlo_csa_param[WLAN_UMAC_MLO_MAX_VDEVS]; 252 struct wlan_cm_disconnect_req *disconn_req; 253 }; 254 255 /* 256 * struct wlan_mlo_ap - MLO AP related info 257 * @num_ml_vdevs: number of vdevs to form MLD 258 * @ml_aid_mgr: ML AID mgr 259 * @mlo_vdev_quiet_bmap: Bitmap of vdevs for which quiet ie needs to enabled 260 */ 261 struct wlan_mlo_ap { 262 uint8_t num_ml_vdevs; 263 struct wlan_ml_vdev_aid_mgr *ml_aid_mgr; 264 qdf_bitmap(mlo_vdev_quiet_bmap, WLAN_UMAC_MLO_MAX_VDEVS); 265 }; 266 267 /* 268 * struct wlan_mlo_peer_list - MLO peer list entry 269 * @peer_hash: MLO peer hash code 270 * @peer_list_lock: lock to access members of structure 271 */ 272 struct wlan_mlo_peer_list { 273 qdf_list_t peer_hash[WLAN_PEER_HASHSIZE]; 274 #ifdef WLAN_MLO_USE_SPINLOCK 275 qdf_spinlock_t peer_list_lock; 276 #else 277 qdf_mutex_t peer_list_lock; 278 #endif 279 }; 280 281 /* 282 * struct wlan_mlo_dev_context - MLO device context 283 * @node: QDF list node member 284 * @mld_id: MLD id 285 * @mld_addr: MLO device MAC address 286 * @wlan_vdev_list: list of vdevs associated with this MLO connection 287 * @wlan_vdev_count: number of elements in the vdev list 288 * @mlo_peer: list peers in this MLO connection 289 * @wlan_max_mlo_peer_count: peer count across the links of specific MLO 290 * @mlo_dev_lock: lock to access struct 291 * @tsf_recalculation_lock: Lock to protect TSF (re)calculation 292 * @ref_cnt: reference count 293 * @ref_id_dbg: Reference count debug information 294 * @sta_ctx: MLO STA related information 295 * @ap_ctx: AP related information 296 */ 297 struct wlan_mlo_dev_context { 298 qdf_list_node_t node; 299 uint8_t mld_id; 300 struct qdf_mac_addr mld_addr; 301 struct wlan_objmgr_vdev *wlan_vdev_list[WLAN_UMAC_MLO_MAX_VDEVS]; 302 uint16_t wlan_vdev_count; 303 struct wlan_mlo_peer_list mlo_peer_list; 304 uint16_t wlan_max_mlo_peer_count; 305 #ifdef WLAN_MLO_USE_SPINLOCK 306 qdf_spinlock_t mlo_dev_lock; 307 qdf_spinlock_t tsf_recalculation_lock; 308 #else 309 qdf_mutex_t mlo_dev_lock; 310 qdf_mutex_t tsf_recalculation_lock; 311 #endif 312 qdf_atomic_t ref_cnt; 313 qdf_atomic_t ref_id_dbg[WLAN_REF_ID_MAX]; 314 struct wlan_mlo_sta *sta_ctx; 315 struct wlan_mlo_ap *ap_ctx; 316 }; 317 318 /* 319 * struct wlan_mlo_link_peer_entry – Link peer entry 320 * @link_peer: Object manager peer 321 * @link_addr: MAC address of link peer 322 * @link_ix: Link index 323 * @is_primary: sets true if the peer is primary UMAC’s peer 324 * @hw_link_id: HW Link id of peer 325 * @assoc_rsp_buf: Assoc resp buffer 326 */ 327 struct wlan_mlo_link_peer_entry { 328 struct wlan_objmgr_peer *link_peer; 329 struct qdf_mac_addr link_addr; 330 uint8_t link_ix; 331 bool is_primary; 332 uint8_t hw_link_id; 333 qdf_nbuf_t assoc_rsp_buf; 334 }; 335 336 /* 337 * enum mlo_peer_state – MLO peer state 338 * @ML_PEER_CREATED: Initial state 339 * @ML_PEER_ASSOC_DONE: ASSOC sent on assoc link 340 * @ML_PEER_DISCONN_INITIATED: Disconnect initiated on one of the links 341 */ 342 enum mlo_peer_state { 343 ML_PEER_CREATED, 344 ML_PEER_ASSOC_DONE, 345 ML_PEER_DISCONN_INITIATED, 346 }; 347 348 #ifdef UMAC_SUPPORT_MLNAWDS 349 /* 350 * struct mlnawds_config - MLO NAWDS configuration 351 * @caps: Bandwidth & NSS capabilities to be configured on NAWDS peer 352 * @puncture_bitmap: puncture bitmap to be configured on NAWDS peer 353 * @mac: MAC address of the NAWDS peer to which the caps & puncture bitmap is 354 * to be configured. 355 */ 356 struct mlnawds_config { 357 uint64_t caps; 358 uint16_t puncture_bitmap; 359 uint8_t mac[QDF_MAC_ADDR_SIZE]; 360 }; 361 #endif 362 363 /* 364 * struct mlpeer_auth_params - Deferred Auth params 365 * @vdev_id: VDEV ID 366 * @psoc_id: PSOC ID 367 * @link_addr: MAC address 368 * @mldmacaddr: MLD MAC address 369 * @algo: Auth algorithm 370 * @seq: Auth sequence number 371 * @status_code: Auth status 372 * @challenge: Auth Challenge 373 * @challenge_length: Auth Challenge length 374 * @wbuf: Auth wbuf 375 * @rs: Rx stats 376 */ 377 struct mlpeer_auth_params { 378 uint8_t vdev_id; 379 uint8_t psoc_id; 380 struct qdf_mac_addr link_addr; 381 struct qdf_mac_addr mldaddr; 382 uint16_t algo; 383 uint16_t seq; 384 uint16_t status_code; 385 uint8_t *challenge; 386 uint8_t challenge_length; 387 qdf_nbuf_t wbuf; 388 void *rs; 389 }; 390 391 #ifdef WLAN_FEATURE_11BE 392 393 /** 394 * enum wlan_t2lm_direction - Indicates the direction for which TID-to-link 395 * mapping is available. 396 * @WLAN_T2LM_DL_DIRECTION: Downlink 397 * @WLAN_T2LM_UL_DIRECTION: Uplink 398 * @WLAN_T2LM_BIDI_DIRECTION: Both downlink and uplink 399 * @WLAN_T2LM_MAX_DIRECTION: Max direction, this is used only internally 400 * @WLAN_T2LM_INVALID_DIRECTION: Invalid, this is used only internally to check 401 * if the mapping present in wlan_t2lm_of_tids structure is valid or not. 402 */ 403 enum wlan_t2lm_direction { 404 WLAN_T2LM_DL_DIRECTION, 405 WLAN_T2LM_UL_DIRECTION, 406 WLAN_T2LM_BIDI_DIRECTION, 407 WLAN_T2LM_MAX_DIRECTION, 408 WLAN_T2LM_INVALID_DIRECTION, 409 }; 410 411 /* Total 8 TIDs are supported, TID 0 to TID 7 */ 412 #define T2LM_MAX_NUM_TIDS 8 413 414 /** 415 * enum wlan_t2lm_category - T2LM category 416 * 417 * @WLAN_T2LM_CATEGORY_NONE: none 418 * @WLAN_T2LM_CATEGORY_REQUEST: T2LM request 419 * @WLAN_T2LM_CATEGORY_RESPONSE: T2LM response 420 * @WLAN_T2LM_CATEGORY_TEARDOWN: T2LM teardown 421 * @WLAN_T2LM_CATEGORY_INVALID: Invalid 422 */ 423 enum wlan_t2lm_category { 424 WLAN_T2LM_CATEGORY_NONE = 0, 425 WLAN_T2LM_CATEGORY_REQUEST = 1, 426 WLAN_T2LM_CATEGORY_RESPONSE = 2, 427 WLAN_T2LM_CATEGORY_TEARDOWN = 3, 428 WLAN_T2LM_CATEGORY_INVALID, 429 }; 430 431 /** 432 * enum wlan_t2lm_tx_status - Status code applicable for the T2LM frames 433 * transmitted by the current peer. 434 * 435 * @WLAN_T2LM_TX_STATUS_NONE: Status code is not applicable 436 * @WLAN_T2LM_TX_STATUS_SUCCESS: AP/STA successfully transmitted the T2LM frame 437 * @WLAN_T2LM_TX_STATUS_FAILURE: Tx failure received from the FW. 438 * @WLAN_T2LM_TX_STATUS_RX_TIMEOUT: T2LM response frame not received from the 439 * peer for the transmitted T2LM request frame. 440 * @WLAN_T2LM_TX_STATUS_INVALID: Invalid status code 441 */ 442 enum wlan_t2lm_tx_status { 443 WLAN_T2LM_TX_STATUS_NONE = 0, 444 WLAN_T2LM_TX_STATUS_SUCCESS = 1, 445 WLAN_T2LM_TX_STATUS_FAILURE = 2, 446 WLAN_T2LM_TX_STATUS_RX_TIMEOUT = 3, 447 WLAN_T2LM_TX_STATUS_INVALID, 448 }; 449 450 /** 451 * enum wlan_t2lm_resp_frm_type - T2LM status corresponds to T2LM response frame 452 * 453 * @WLAN_T2LM_RESP_TYPE_SUCCESS: T2LM mapping provided in the T2LM request is 454 * accepted either by the AP or STA 455 * @WLAN_T2LM_RESP_TYPE_DENIED_TID_TO_LINK_MAPPING: T2LM Request denied because 456 * the requested TID-to-link mapping is unacceptable. 457 * @WLAN_T2LM_RESP_TYPE_PREFERRED_TID_TO_LINK_MAPPING: T2LM Request rejected and 458 * preferred TID-to-link mapping is suggested. 459 * @WLAN_T2LM_RESP_TYPE_INVALID: Status code is not applicable. 460 */ 461 enum wlan_t2lm_resp_frm_type { 462 WLAN_T2LM_RESP_TYPE_SUCCESS = 0, 463 WLAN_T2LM_RESP_TYPE_DENIED_TID_TO_LINK_MAPPING = 133, 464 WLAN_T2LM_RESP_TYPE_PREFERRED_TID_TO_LINK_MAPPING = 134, 465 WLAN_T2LM_RESP_TYPE_INVALID, 466 }; 467 468 /** 469 * enum wlan_t2lm_enable - TID-to-link negotiation supported by the mlo peer 470 * 471 * @WLAN_T2LM_NOT_SUPPORTED: T2LM is not supported by the MLD 472 * @WLAN_MAP_EACH_TID_TO_SAME_OR_DIFFERENET_LINK_SET: MLD supports the mapping 473 * of each TID to the same or different link set (Disjoint mapping). 474 * @WLAN_MAP_ALL_TIDS_TO_SAME_LINK_SET: MLD only supports the mapping of all 475 * TIDs to the same link set. 476 * @WLAN_T2LM_ENABLE_INVALID: invalid 477 */ 478 enum wlan_t2lm_enable { 479 WLAN_T2LM_NOT_SUPPORTED = 0, 480 WLAN_MAP_EACH_TID_TO_SAME_OR_DIFFERENET_LINK_SET = 1, 481 WLAN_MAP_ALL_TIDS_TO_SAME_LINK_SET = 2, 482 WLAN_T2LM_ENABLE_INVALID, 483 }; 484 485 /** 486 * struct wlan_t2lm_of_tids - TID-to-Link mapping information for the frames 487 * transmitted on the uplink, downlink and bidirectional. 488 * 489 * @is_homogeneous_mapping: The t2lm_provisioned_links is homogeneous mapping 490 * @direction: 0 - Downlink, 1 - uplink 2 - Both uplink and downlink 491 * @default_link_mapping: value 1 indicates the default T2LM, where all the TIDs 492 * are mapped to all the links. 493 * value 0 indicates the preferred T2LM mapping 494 * @t2lm_provisioned_links: Indicates TID to link mapping of all the TIDS. 495 */ 496 struct wlan_t2lm_of_tids { 497 bool is_homogeneous_mapping; 498 enum wlan_t2lm_direction direction; 499 bool default_link_mapping; 500 uint16_t t2lm_provisioned_links[T2LM_MAX_NUM_TIDS]; 501 }; 502 503 /** 504 * struct wlan_prev_t2lm_negotiated_info - Previous successful T2LM negotiation 505 * is saved here. 506 * 507 * @dialog_token: Save the dialog token used in T2LM request and response frame. 508 * @t2lm_info: Provides the TID to LINK mapping information 509 */ 510 struct wlan_prev_t2lm_negotiated_info { 511 uint16_t dialog_token; 512 struct wlan_t2lm_of_tids t2lm_info[WLAN_T2LM_MAX_DIRECTION]; 513 }; 514 515 /** 516 * struct wlan_t2lm_onging_negotiation_info - Current ongoing T2LM negotiation 517 * (information about transmitted T2LM request/response frame) 518 * 519 * @category: T2LM category as T2LM request frame 520 * @dialog_token: Save the dialog token used in T2LM request and response frame. 521 * @t2lm_info: Provides the TID-to-link mapping info for UL/DL/BiDi 522 * @t2lm_tx_status: Status code corresponds to the transmitted T2LM frames 523 * @t2lm_resp_type: T2LM status corresponds to T2LM response frame. 524 */ 525 struct wlan_t2lm_onging_negotiation_info { 526 enum wlan_t2lm_category category; 527 uint8_t dialog_token; 528 struct wlan_t2lm_of_tids t2lm_info[WLAN_T2LM_MAX_DIRECTION]; 529 enum wlan_t2lm_tx_status t2lm_tx_status; 530 enum wlan_t2lm_resp_frm_type t2lm_resp_type; 531 }; 532 533 /** 534 * struct wlan_mlo_peer_t2lm_policy - TID-to-link mapping information 535 * 536 * @self_gen_dialog_token: self generated dialog token used to send T2LM request 537 * frame; 538 * @t2lm_enable_val: TID-to-link enable value supported by this peer. 539 * @t2lm_negotiated_info: Previous successful T2LM negotiation is saved here. 540 * @ongoing_tid_to_link_mapping: This has the ongoing TID-to-link mapping info 541 * transmitted by this peer to the connected peer. 542 */ 543 struct wlan_mlo_peer_t2lm_policy { 544 uint8_t self_gen_dialog_token; 545 enum wlan_t2lm_enable t2lm_enable_val; 546 struct wlan_prev_t2lm_negotiated_info t2lm_negotiated_info; 547 struct wlan_t2lm_onging_negotiation_info ongoing_tid_to_link_mapping; 548 }; 549 #endif /* WLAN_FEATURE_11BE */ 550 551 /** 552 * struct wlan_mlo_eml_cap - EML capabilities of MLD 553 * @emlsr_supp: eMLSR Support 554 * @emlsr_pad_delay: eMLSR Padding Delay 555 * @emlsr_trans_delay: eMLSR transition delay 556 * @emlmr_supp: eMLMR Support 557 * @emlmr_delay: eMLMR Delay 558 * @trans_timeout: Transition Timeout 559 * @reserved: Reserved 560 */ 561 struct wlan_mlo_eml_cap { 562 uint16_t emlsr_supp:1, 563 emlsr_pad_delay:3, 564 emlsr_trans_delay:3, 565 emlmr_supp:1, 566 emlmr_delay:3, 567 trans_timeout:4, 568 reserved:1; 569 }; 570 571 /** 572 * struct wlan_mlo_msd_cap - MSD capabilities of MLD 573 * @medium_sync_duration: Medium Sync Duration 574 * @medium_sync_ofdm_ed_thresh: MSD threshold value 575 * @medium_sync_max_txop_num: Max number of TXOP 576 */ 577 struct wlan_mlo_msd_cap { 578 uint16_t medium_sync_duration:8, 579 medium_sync_ofdm_ed_thresh:4, 580 medium_sync_max_txop_num:4; 581 }; 582 583 /** 584 * struct wlan_mlo_mld_cap - MLD capabilities of MLD 585 * @max_simult_link: Maximum number of simultaneous links 586 * @srs_support: SRS support 587 * @tid2link_neg_support: TID to Link Negotiation Support 588 * @str_freq_sep: Frequency separation suggested by STR non-AP MLD 589 * OR Type of AP-MLD 590 * @aar_support: AAR Support 591 * @reserved: Reserved 592 */ 593 struct wlan_mlo_mld_cap { 594 uint16_t max_simult_link:4, 595 srs_support:1, 596 tid2link_neg_support:2, 597 str_freq_sep:5, 598 aar_support:1, 599 reserved:3; 600 }; 601 602 /* 603 * struct wlan_mlo_peer_context - MLO peer context 604 * 605 * @peer_node: peer list node for ml_dev qdf list 606 * @peer_list: list of peers on the MLO link 607 * @link_peer_cnt: Number of link peers attached 608 * @max_links: Max links for this ML peer 609 * @mlo_peer_id: unique ID for the peer 610 * @peer_mld_addr: MAC address of MLD link 611 * @mlo_ie: MLO IE struct 612 * @mlo_peer_lock: lock to access peer strucutre 613 * @assoc_id: Assoc ID derived by MLO manager 614 * @ref_cnt: Reference counter to avoid use after free 615 * @ml_dev: MLO dev context 616 * @mlpeer_state: MLO peer state 617 * @avg_link_rssi: avg RSSI of ML peer 618 * @is_nawds_ml_peer: flag to indicate if ml_peer is NAWDS configured 619 * @nawds_config: eack link peer's NAWDS configuration 620 * @pending_auth: Holds pending auth request 621 * @t2lm_policy: TID-to-link mapping information 622 * @msd_cap_present: Medium Sync Capability present bit 623 * @mlpeer_emlcap: EML capability information for ML peer 624 * @mlpeer_msdcap: Medium Sync Delay capability information for ML peer 625 */ 626 struct wlan_mlo_peer_context { 627 qdf_list_node_t peer_node; 628 struct wlan_mlo_link_peer_entry peer_list[MAX_MLO_LINK_PEERS]; 629 uint8_t link_peer_cnt; 630 uint8_t max_links; 631 uint32_t mlo_peer_id; 632 struct qdf_mac_addr peer_mld_addr; 633 uint8_t *mlo_ie; 634 #ifdef WLAN_MLO_USE_SPINLOCK 635 qdf_spinlock_t mlo_peer_lock; 636 #else 637 qdf_mutex_t mlo_peer_lock; 638 #endif 639 uint16_t assoc_id; 640 uint8_t primary_umac_psoc_id; 641 qdf_atomic_t ref_cnt; 642 struct wlan_mlo_dev_context *ml_dev; 643 enum mlo_peer_state mlpeer_state; 644 int8_t avg_link_rssi; 645 #ifdef UMAC_SUPPORT_MLNAWDS 646 bool is_nawds_ml_peer; 647 struct mlnawds_config nawds_config[MAX_MLO_LINK_PEERS]; 648 #endif 649 #ifdef UMAC_MLO_AUTH_DEFER 650 struct mlpeer_auth_params *pending_auth[MAX_MLO_LINK_PEERS]; 651 #endif 652 #ifdef WLAN_FEATURE_11BE 653 struct wlan_mlo_peer_t2lm_policy t2lm_policy; 654 #endif 655 bool msd_cap_present; 656 struct wlan_mlo_eml_cap mlpeer_emlcap; 657 struct wlan_mlo_msd_cap mlpeer_msdcap; 658 }; 659 660 /* 661 * struct mlo_link_info – ML link info 662 * @link_addr: link mac address 663 * @link_id: link index 664 * @chan_freq: Operating channel frequency 665 * @nawds_config: peer's NAWDS configurarion 666 * @vdev_id: VDEV ID 667 */ 668 struct mlo_link_info { 669 struct qdf_mac_addr link_addr; 670 uint8_t link_id; 671 uint16_t chan_freq; 672 #ifdef UMAC_SUPPORT_MLNAWDS 673 struct mlnawds_config nawds_config; 674 #endif 675 uint8_t vdev_id; 676 }; 677 678 /* 679 * struct mlo_partner_info – mlo partner link info 680 * @num_partner_links: no. of partner links 681 * @partner_link_info: per partner link info 682 * @t2lm_enable_val: enum wlan_t2lm_enable 683 */ 684 struct mlo_partner_info { 685 uint8_t num_partner_links; 686 struct mlo_link_info partner_link_info[WLAN_UMAC_MLO_MAX_VDEVS]; 687 #ifdef WLAN_FEATURE_11BE 688 enum wlan_t2lm_enable t2lm_enable_val; 689 #endif 690 }; 691 692 /* 693 * struct mlo_probereq_info – mlo probe req link info 694 * @num_links: no. of link info in probe req 695 * @link_id: target link id of APs 696 */ 697 struct mlo_probereq_info { 698 uint8_t mlid; 699 uint8_t num_links; 700 uint8_t link_id[WLAN_UMAC_MLO_MAX_VDEVS]; 701 }; 702 703 /* 704 * struct mlo_tgt_link_info – ML target link info 705 * @vdev_id: link peer vdev id 706 * @hw_mld_link_id: HW link id 707 */ 708 struct mlo_tgt_link_info { 709 uint8_t vdev_id; 710 uint8_t hw_mld_link_id; 711 }; 712 713 /* 714 * struct mlo_tgt_partner_info – mlo target partner link info 715 * @num_partner_links: no. of partner links 716 * @link_info: per partner link info 717 */ 718 struct mlo_tgt_partner_info { 719 uint8_t num_partner_links; 720 struct mlo_tgt_link_info link_info[WLAN_UMAC_MLO_MAX_VDEVS]; 721 }; 722 723 /* 724 * struct mlo_mlme_ext_ops - MLME callback functions 725 * @mlo_mlme_ext_validate_conn_req: Callback to validate connect request 726 * @mlo_mlme_ext_create_link_vdev: Callback to create link vdev for ML STA 727 * @mlo_mlme_ext_peer_create: Callback to create link peer 728 * @mlo_mlme_ext_peer_assoc: Callback to initiate peer assoc 729 * @mlo_mlme_ext_peer_assoc_fail: Callback to notify peer assoc failure 730 * @mlo_mlme_ext_peer_delete: Callback to initiate link peer delete 731 * @mlo_mlme_ext_assoc_resp: Callback to initiate assoc resp 732 * @mlo_mlme_get_link_assoc_req: Calback to get link assoc req buffer 733 * @mlo_mlme_ext_deauth: Callback to initiate deauth 734 * @mlo_mlme_ext_clone_security_param: Callback to clone mlo security params 735 * @mlo_mlme_ext_peer_process_auth: Callback to process pending auth 736 * @mlo_mlme_ext_handle_sta_csa_param: Callback to handle sta csa param 737 */ 738 struct mlo_mlme_ext_ops { 739 QDF_STATUS (*mlo_mlme_ext_validate_conn_req)( 740 struct vdev_mlme_obj *vdev_mlme, void *ext_data); 741 QDF_STATUS (*mlo_mlme_ext_create_link_vdev)( 742 struct vdev_mlme_obj *vdev_mlme, void *ext_data); 743 QDF_STATUS (*mlo_mlme_ext_peer_create)(struct wlan_objmgr_vdev *vdev, 744 struct wlan_mlo_peer_context *ml_peer, 745 struct qdf_mac_addr *addr, 746 qdf_nbuf_t frm_buf); 747 void (*mlo_mlme_ext_peer_assoc)(struct wlan_objmgr_peer *peer); 748 void (*mlo_mlme_ext_peer_assoc_fail)(struct wlan_objmgr_peer *peer); 749 void (*mlo_mlme_ext_peer_delete)(struct wlan_objmgr_peer *peer); 750 void (*mlo_mlme_ext_assoc_resp)(struct wlan_objmgr_peer *peer); 751 qdf_nbuf_t (*mlo_mlme_get_link_assoc_req)(struct wlan_objmgr_peer *peer, 752 uint8_t link_ix); 753 void (*mlo_mlme_ext_deauth)(struct wlan_objmgr_peer *peer); 754 QDF_STATUS (*mlo_mlme_ext_clone_security_param)( 755 struct vdev_mlme_obj *vdev_mlme, 756 struct wlan_cm_connect_req *req); 757 #ifdef UMAC_MLO_AUTH_DEFER 758 void (*mlo_mlme_ext_peer_process_auth)( 759 struct mlpeer_auth_params *auth_param); 760 #endif 761 void (*mlo_mlme_ext_handle_sta_csa_param)( 762 struct wlan_objmgr_vdev *vdev, 763 struct csa_offload_params *csa_param); 764 QDF_STATUS (*mlo_mlme_ext_sta_op_class)( 765 struct vdev_mlme_obj *vdev_mlme, 766 uint8_t *ml_ie); 767 768 }; 769 770 /* maximum size of vdev bitmap array for MLO link set active command */ 771 #define MLO_VDEV_BITMAP_SZ 2 772 773 /* maximum size of link number param array for MLO link set active command */ 774 #define MLO_LINK_NUM_SZ 2 775 776 /** 777 * enum mlo_link_force_mode: MLO link force modes 778 * @MLO_LINK_FORCE_MODE_ACTIVE: 779 * Force specific links active 780 * @MLO_LINK_FORCE_MODE_INACTIVE: 781 * Force specific links inactive 782 * @MLO_LINK_FORCE_MODE_ACTIVE_NUM: 783 * Force active a number of links, firmware to decide which links to inactive 784 * @MLO_LINK_FORCE_MODE_INACTIVE_NUM: 785 * Force inactive a number of links, firmware to decide which links to inactive 786 * @MLO_LINK_FORCE_MODE_NO_FORCE: 787 * Cancel the force operation of specific links, allow firmware to decide 788 */ 789 enum mlo_link_force_mode { 790 MLO_LINK_FORCE_MODE_ACTIVE = 1, 791 MLO_LINK_FORCE_MODE_INACTIVE = 2, 792 MLO_LINK_FORCE_MODE_ACTIVE_NUM = 3, 793 MLO_LINK_FORCE_MODE_INACTIVE_NUM = 4, 794 MLO_LINK_FORCE_MODE_NO_FORCE = 5, 795 }; 796 797 /** 798 * enum mlo_link_force_reason: MLO link force reasons 799 * @MLO_LINK_FORCE_REASON_CONNECT: 800 * Set force specific links because of new connection 801 * @MLO_LINK_FORCE_REASON_DISCONNECT: 802 * Set force specific links because of new dis-connection 803 */ 804 enum mlo_link_force_reason { 805 MLO_LINK_FORCE_REASON_CONNECT = 1, 806 MLO_LINK_FORCE_REASON_DISCONNECT = 2, 807 }; 808 809 /** 810 * struct mlo_link_set_active_resp: MLO link set active response structure 811 * @status: Return status, 0 for success, non-zero otherwise 812 * @active_sz: size of current active vdev bitmap array 813 * @active: current active vdev bitmap array 814 * @inactive_sz: size of current inactive vdev bitmap array 815 * @inactive: current inactive vdev bitmap array 816 */ 817 struct mlo_link_set_active_resp { 818 uint32_t status; 819 uint32_t active_sz; 820 uint32_t active[MLO_VDEV_BITMAP_SZ]; 821 uint32_t inactive_sz; 822 uint32_t inactive[MLO_VDEV_BITMAP_SZ]; 823 }; 824 825 /** 826 * struct mlo_link_num_param: MLO link set active number params 827 * @num_of_link: number of links to active/inactive 828 * @vdev_type: type of vdev 829 * @vdev_subtype: subtype of vdev 830 * @home_freq: home frequency of the link 831 */ 832 struct mlo_link_num_param { 833 uint32_t num_of_link; 834 uint32_t vdev_type; 835 uint32_t vdev_subtype; 836 uint32_t home_freq; 837 }; 838 839 /** 840 * struct mlo_link_set_active_param: MLO link set active params 841 * @force_mode: operation to take (enum mlo_link_force_mode) 842 * @reason: reason for the operation (enum mlo_link_force_reason) 843 * @num_link_entry: number of the valid entries for link_num 844 * @num_vdev_bitmap: number of the valid entries for vdev_bitmap 845 * @link_num: link number param array 846 * It's present only when force_mode is MLO_LINK_FORCE_MODE_ACTIVE_NUM or 847 * MLO_LINK_FORCE_MODE_INACTIVE_NUM 848 * @vdev_bitmap: active/inactive vdev bitmap array 849 * It will be present when force_mode is MLO_LINK_FORCE_MODE_ACTIVE, 850 * MLO_LINK_FORCE_MODE_INACTIVE, MLO_LINK_FORCE_MODE_NO_FORCE, 851 * MLO_LINK_FORCE_MODE_ACTIVE_NUM or MLO_LINK_FORCE_MODE_INACTIVE_NUM 852 */ 853 struct mlo_link_set_active_param { 854 uint32_t force_mode; 855 uint32_t reason; 856 uint32_t num_link_entry; 857 uint32_t num_vdev_bitmap; 858 struct mlo_link_num_param link_num[MLO_LINK_NUM_SZ]; 859 uint32_t vdev_bitmap[MLO_VDEV_BITMAP_SZ]; 860 }; 861 862 /* 863 * struct mlo_link_set_active_ctx - Context for MLO link set active request 864 * @vdev: pointer to vdev on which the request issued 865 * @cb: callback function for MLO link set active request 866 * @cb_arg: callback context 867 */ 868 struct mlo_link_set_active_ctx { 869 struct wlan_objmgr_vdev *vdev; 870 void (*set_mlo_link_cb)(struct wlan_objmgr_vdev *vdev, void *arg, 871 struct mlo_link_set_active_resp *evt); 872 void *cb_arg; 873 }; 874 875 /* 876 * struct mlo_link_set_active_req - MLO link set active request 877 * @ctx: context for MLO link set active request 878 * @param: MLO link set active params 879 */ 880 struct mlo_link_set_active_req { 881 struct mlo_link_set_active_ctx ctx; 882 struct mlo_link_set_active_param param; 883 }; 884 885 /* 886 * enum mlo_chip_recovery_type - MLO chip recovery types 887 * @MLO_RECOVERY_MODE_0: CRASH_PARTNER_CHIPS & recover all chips 888 * @MLO_RECOVERY_MODE_1: Crash & recover asserted chip alone 889 * @MLO_RECOVERY_MODE_MAX: Max limit for recovery types 890 */ 891 enum mlo_chip_recovery_type { 892 MLO_RECOVERY_MODE_0 = 1, 893 MLO_RECOVERY_MODE_1 = 2, 894 895 /* Add new types above */ 896 MLO_RECOVERY_MODE_MAX = 0xf 897 }; 898 #endif 899