1 /* 2 * Copyright (c) 2021, The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2023 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 containing init/deinit public api's 20 */ 21 #ifndef _WLAN_MLO_MGR_MAIN_H_ 22 #define _WLAN_MLO_MGR_MAIN_H_ 23 24 #include <qdf_atomic.h> 25 #include <wlan_objmgr_psoc_obj.h> 26 #include <wlan_objmgr_pdev_obj.h> 27 #include <wlan_objmgr_vdev_obj.h> 28 29 #ifdef WLAN_FEATURE_11BE_MLO 30 #include <wlan_mlo_mgr_public_structs.h> 31 32 /** 33 * wlan_mlo_mgr_init() - Initialize the MLO data structures 34 * 35 * Return: QDF_STATUS 36 */ 37 QDF_STATUS wlan_mlo_mgr_init(void); 38 39 /** 40 * wlan_mlo_mgr_deinit() - De-init the MLO data structures 41 * 42 * Return: QDF_STATUS 43 */ 44 QDF_STATUS wlan_mlo_mgr_deinit(void); 45 46 /** 47 * wlan_mlo_mgr_vdev_created_notification() - mlo mgr vdev create handler 48 * @vdev: vdev object 49 * @arg_list: Argument list 50 * 51 * This function is called as part of vdev creation. This will initialize 52 * the MLO dev context if the interface type is ML. 53 * 54 * Return: QDF_STATUS 55 */ 56 QDF_STATUS wlan_mlo_mgr_vdev_created_notification(struct wlan_objmgr_vdev *vdev, 57 void *arg_list); 58 59 /** 60 * wlan_mlo_mgr_vdev_destroyed_notification() - mlo mgr vdev delete handler 61 * @vdev: vdev object 62 * @arg_list: Argument list 63 * 64 * This function is called as part of vdev delete. This will de-initialize 65 * the MLO dev context if the interface type is ML. 66 * 67 * Return: QDF_STATUS 68 */ 69 QDF_STATUS wlan_mlo_mgr_vdev_destroyed_notification(struct wlan_objmgr_vdev *vdev, 70 void *arg_list); 71 72 #ifdef WLAN_MLO_USE_SPINLOCK 73 /** 74 * ml_link_lock_create - Create MLO link mutex/spinlock 75 * @mlo_ctx: MLO manager global context 76 * 77 * Creates mutex/spinlock 78 * 79 * Return: void 80 */ 81 static inline 82 void ml_link_lock_create(struct mlo_mgr_context *mlo_ctx) 83 { 84 qdf_spinlock_create(&mlo_ctx->ml_dev_list_lock); 85 } 86 87 /** 88 * ml_link_lock_destroy - Destroy ml link mutex/spinlock 89 * @mlo_ctx: MLO manager global context 90 * 91 * Destroy mutex/spinlock 92 * 93 * Return: void 94 */ 95 static inline void 96 ml_link_lock_destroy(struct mlo_mgr_context *mlo_ctx) 97 { 98 qdf_spinlock_destroy(&mlo_ctx->ml_dev_list_lock); 99 } 100 101 /** 102 * ml_link_lock_acquire - acquire ml link mutex/spinlock 103 * @mlo_ctx: MLO manager global context 104 * 105 * acquire mutex/spinlock 106 * 107 * return: void 108 */ 109 static inline 110 void ml_link_lock_acquire(struct mlo_mgr_context *mlo_ctx) 111 { 112 qdf_spin_lock_bh(&mlo_ctx->ml_dev_list_lock); 113 } 114 115 /** 116 * ml_link_lock_release - release MLO dev mutex/spinlock 117 * @mlo_ctx: MLO manager global context 118 * 119 * release mutex/spinlock 120 * 121 * return: void 122 */ 123 static inline 124 void ml_link_lock_release(struct mlo_mgr_context *mlo_ctx) 125 { 126 qdf_spin_unlock_bh(&mlo_ctx->ml_dev_list_lock); 127 } 128 129 /** 130 * mlo_dev_lock_create - Create MLO device mutex/spinlock 131 * @mldev: ML device context 132 * 133 * Creates mutex/spinlock 134 * 135 * Return: void 136 */ 137 static inline void 138 mlo_dev_lock_create(struct wlan_mlo_dev_context *mldev) 139 { 140 qdf_spinlock_create(&mldev->mlo_dev_lock); 141 } 142 143 /** 144 * mlo_dev_lock_destroy - Destroy CM SM mutex/spinlock 145 * @mldev: ML device context 146 * 147 * Destroy mutex/spinlock 148 * 149 * Return: void 150 */ 151 static inline void 152 mlo_dev_lock_destroy(struct wlan_mlo_dev_context *mldev) 153 { 154 qdf_spinlock_destroy(&mldev->mlo_dev_lock); 155 } 156 157 /** 158 * mlo_dev_lock_acquire - acquire CM SM mutex/spinlock 159 * @mldev: ML device context 160 * 161 * acquire mutex/spinlock 162 * 163 * return: void 164 */ 165 static inline 166 void mlo_dev_lock_acquire(struct wlan_mlo_dev_context *mldev) 167 { 168 qdf_spin_lock_bh(&mldev->mlo_dev_lock); 169 } 170 171 /** 172 * mlo_dev_lock_release - release MLO dev mutex/spinlock 173 * @mldev: ML device context 174 * 175 * release mutex/spinlock 176 * 177 * return: void 178 */ 179 static inline 180 void mlo_dev_lock_release(struct wlan_mlo_dev_context *mldev) 181 { 182 qdf_spin_unlock_bh(&mldev->mlo_dev_lock); 183 } 184 185 /** 186 * ml_aid_lock_create - Create MLO aid mutex/spinlock 187 * @mlo_ctx: MLO manager global context 188 * 189 * Creates mutex/spinlock 190 * 191 * Return: void 192 */ 193 static inline 194 void ml_aid_lock_create(struct mlo_mgr_context *mlo_ctx) 195 { 196 qdf_spinlock_create(&mlo_ctx->aid_lock); 197 } 198 199 /** 200 * ml_aid_lock_destroy - Destroy ml aid mutex/spinlock 201 * @mlo_ctx: MLO manager global context 202 * 203 * Destroy mutex/spinlock 204 * 205 * Return: void 206 */ 207 static inline void 208 ml_aid_lock_destroy(struct mlo_mgr_context *mlo_ctx) 209 { 210 qdf_spinlock_destroy(&mlo_ctx->aid_lock); 211 } 212 213 /** 214 * ml_aid_lock_acquire - acquire ml aid mutex/spinlock 215 * @mlo_ctx: MLO manager global context 216 * 217 * acquire mutex/spinlock 218 * 219 * return: void 220 */ 221 static inline 222 void ml_aid_lock_acquire(struct mlo_mgr_context *mlo_ctx) 223 { 224 qdf_spin_lock_bh(&mlo_ctx->aid_lock); 225 } 226 227 /** 228 * ml_aid_lock_release - release MLO aid mutex/spinlock 229 * @mlo_ctx: MLO manager global context 230 * 231 * release mutex/spinlock 232 * 233 * return: void 234 */ 235 static inline 236 void ml_aid_lock_release(struct mlo_mgr_context *mlo_ctx) 237 { 238 qdf_spin_unlock_bh(&mlo_ctx->aid_lock); 239 } 240 241 /** 242 * ml_peerid_lock_create - Create MLO peer mutex/spinlock 243 * @mlo_ctx: MLO manager global context 244 * 245 * Creates mutex/spinlock 246 * 247 * Return: void 248 */ 249 static inline 250 void ml_peerid_lock_create(struct mlo_mgr_context *mlo_ctx) 251 { 252 qdf_spinlock_create(&mlo_ctx->ml_peerid_lock); 253 } 254 255 /** 256 * ml_peerid_lock_destroy - Destroy ml peerid mutex/spinlock 257 * @mlo_ctx: MLO manager global context 258 * 259 * Destroy mutex/spinlock 260 * 261 * Return: void 262 */ 263 static inline void 264 ml_peerid_lock_destroy(struct mlo_mgr_context *mlo_ctx) 265 { 266 qdf_spinlock_destroy(&mlo_ctx->ml_peerid_lock); 267 } 268 269 /** 270 * ml_peerid_lock_acquire - acquire ml peerid mutex/spinlock 271 * @mlo_ctx: MLO manager global context 272 * 273 * acquire mutex/spinlock 274 * 275 * return: void 276 */ 277 static inline 278 void ml_peerid_lock_acquire(struct mlo_mgr_context *mlo_ctx) 279 { 280 qdf_spin_lock_bh(&mlo_ctx->ml_peerid_lock); 281 } 282 283 /** 284 * ml_peerid_lock_release - release MLO peerid mutex/spinlock 285 * @mlo_ctx: MLO manager global context 286 * 287 * release mutex/spinlock 288 * 289 * return: void 290 */ 291 static inline 292 void ml_peerid_lock_release(struct mlo_mgr_context *mlo_ctx) 293 { 294 qdf_spin_unlock_bh(&mlo_ctx->ml_peerid_lock); 295 } 296 297 /** 298 * mlo_peer_lock_create - Create MLO peer mutex/spinlock 299 * @mlpeer: ML peer 300 * 301 * Creates mutex/spinlock 302 * 303 * Return: void 304 */ 305 static inline void 306 mlo_peer_lock_create(struct wlan_mlo_peer_context *mlpeer) 307 { 308 qdf_spinlock_create(&mlpeer->mlo_peer_lock); 309 } 310 311 /** 312 * mlo_peer_lock_destroy - Destroy MLO peer mutex/spinlock 313 * @mlpeer: ML peer 314 * 315 * Destroy mutex/spinlock 316 * 317 * Return: void 318 */ 319 static inline void 320 mlo_peer_lock_destroy(struct wlan_mlo_peer_context *mlpeer) 321 { 322 qdf_spinlock_destroy(&mlpeer->mlo_peer_lock); 323 } 324 325 /** 326 * mlo_peer_lock_acquire - acquire mlo peer mutex/spinlock 327 * @mlpeer: MLO peer context 328 * 329 * acquire mutex/spinlock 330 * 331 * return: void 332 */ 333 static inline 334 void mlo_peer_lock_acquire(struct wlan_mlo_peer_context *mlpeer) 335 { 336 qdf_spin_lock_bh(&mlpeer->mlo_peer_lock); 337 } 338 339 /** 340 * mlo_peer_lock_release - release MLO peer mutex/spinlock 341 * @mlpeer: MLO peer context 342 * 343 * release mutex/spinlock 344 * 345 * return: void 346 */ 347 static inline 348 void mlo_peer_lock_release(struct wlan_mlo_peer_context *mlpeer) 349 { 350 qdf_spin_unlock_bh(&mlpeer->mlo_peer_lock); 351 } 352 353 /** 354 * ml_peerlist_lock_create - Create MLO peer list mutex/spinlock 355 * @ml_peerlist: ML peer list context 356 * 357 * Creates mutex/spinlock 358 * 359 * Return: void 360 */ 361 static inline void 362 ml_peerlist_lock_create(struct wlan_mlo_peer_list *ml_peerlist) 363 { 364 qdf_spinlock_create(&ml_peerlist->peer_list_lock); 365 } 366 367 /** 368 * ml_peerlist_lock_destroy - Destroy MLO peer list mutex/spinlock 369 * @ml_peerlist: ML peer list context 370 * 371 * Destroy mutex/spinlock 372 * 373 * Return: void 374 */ 375 static inline void 376 ml_peerlist_lock_destroy(struct wlan_mlo_peer_list *ml_peerlist) 377 { 378 qdf_spinlock_destroy(&ml_peerlist->peer_list_lock); 379 } 380 381 /** 382 * ml_peerlist_lock_acquire - acquire ML peer list mutex/spinlock 383 * @ml_peerlist: ML peer list context 384 * 385 * acquire mutex/spinlock 386 * 387 * return: void 388 */ 389 static inline 390 void ml_peerlist_lock_acquire(struct wlan_mlo_peer_list *ml_peerlist) 391 { 392 qdf_spin_lock_bh(&ml_peerlist->peer_list_lock); 393 } 394 395 /** 396 * ml_peerlist_lock_release - release ML peer list mutex/spinlock 397 * @ml_peerlist: ML peer list context 398 * 399 * release mutex/spinlock 400 * 401 * return: void 402 */ 403 static inline 404 void ml_peerlist_lock_release(struct wlan_mlo_peer_list *ml_peerlist) 405 { 406 qdf_spin_unlock_bh(&ml_peerlist->peer_list_lock); 407 } 408 409 /** 410 * copied_conn_req_lock_create - Create original connect req mutex/spinlock 411 * @sta_ctx: MLO STA related information 412 * 413 * Create mutex/spinlock 414 * 415 * return: void 416 */ 417 static inline 418 void copied_conn_req_lock_create(struct wlan_mlo_sta *sta_ctx) 419 { 420 qdf_spinlock_create(&sta_ctx->copied_conn_req_lock); 421 } 422 423 /** 424 * copied_conn_req_lock_destroy - Destroy original connect req mutex/spinlock 425 * @sta_ctx: MLO STA related information 426 * 427 * Destroy mutex/spinlock 428 * 429 * return: void 430 */ 431 static inline 432 void copied_conn_req_lock_destroy(struct wlan_mlo_sta *sta_ctx) 433 { 434 qdf_spinlock_destroy(&sta_ctx->copied_conn_req_lock); 435 } 436 437 /** 438 * copied_conn_req_lock_acquire - Acquire original connect req mutex/spinlock 439 * @sta_ctx: MLO STA related information 440 * 441 * Acquire mutex/spinlock 442 * 443 * return: void 444 */ 445 static inline 446 void copied_conn_req_lock_acquire(struct wlan_mlo_sta *sta_ctx) 447 { 448 qdf_spin_lock_bh(&sta_ctx->copied_conn_req_lock); 449 } 450 451 /** 452 * copied_conn_req_lock_release - Release original connect req mutex/spinlock 453 * @sta_ctx: MLO STA related information 454 * 455 * Release mutex/spinlock 456 * 457 * return: void 458 */ 459 static inline 460 void copied_conn_req_lock_release(struct wlan_mlo_sta *sta_ctx) 461 { 462 qdf_spin_unlock_bh(&sta_ctx->copied_conn_req_lock); 463 } 464 465 /** 466 * tsf_recalculation_lock_create - Create TSF recalculation mutex/spinlock 467 * @mldev: ML device context 468 * 469 * Creates mutex/spinlock 470 * 471 * Return: void 472 */ 473 static inline void 474 tsf_recalculation_lock_create(struct wlan_mlo_dev_context *mldev) 475 { 476 qdf_spinlock_create(&mldev->tsf_recalculation_lock); 477 } 478 479 /** 480 * tsf_recalculation_lock_destroy - Destroy TSF recalculation mutex/spinlock 481 * @mldev: ML device context 482 * 483 * Destroy mutex/spinlock 484 * 485 * Return: void 486 */ 487 static inline void 488 tsf_recalculation_lock_destroy(struct wlan_mlo_dev_context *mldev) 489 { 490 qdf_spinlock_destroy(&mldev->tsf_recalculation_lock); 491 } 492 493 /** 494 * tsf_recalculation_lock_acquire - Acquire TSF recalculation mutex/spinlock 495 * @mldev: ML device context 496 * 497 * Acquire mutex/spinlock 498 * 499 * return: void 500 */ 501 static inline 502 void tsf_recalculation_lock_acquire(struct wlan_mlo_dev_context *mldev) 503 { 504 qdf_spin_lock_bh(&mldev->tsf_recalculation_lock); 505 } 506 507 /** 508 * tsf_recalculation_lock_release - Release TSF recalculation mutex/spinlock 509 * @mldev: ML device context 510 * 511 * release mutex/spinlock 512 * 513 * return: void 514 */ 515 static inline 516 void tsf_recalculation_lock_release(struct wlan_mlo_dev_context *mldev) 517 { 518 qdf_spin_unlock_bh(&mldev->tsf_recalculation_lock); 519 } 520 521 /** 522 * mlo_ap_lock_create - Create MLO AP mutex/spinlock 523 * @ap_ctx: ML device AP context 524 * 525 * Creates mutex/spinlock 526 * 527 * Return: void 528 */ 529 static inline 530 void mlo_ap_lock_create(struct wlan_mlo_ap *ap_ctx) 531 { 532 qdf_spinlock_create(&ap_ctx->mlo_ap_lock); 533 } 534 535 /** 536 * mlo_ap_lock_destroy - Destroy MLO AP mutex/spinlock 537 * @ap_ctx: ML device AP context 538 * 539 * Destroy mutex/spinlock 540 * 541 * Return: void 542 */ 543 static inline 544 void mlo_ap_lock_destroy(struct wlan_mlo_ap *ap_ctx) 545 { 546 qdf_spinlock_destroy(&ap_ctx->mlo_ap_lock); 547 } 548 549 /** 550 * mlo_ap_lock_acquire - Acquire MLO AP mutex/spinlock 551 * @ap_ctx: ML device AP context 552 * 553 * acquire mutex/spinlock 554 * 555 * return: void 556 */ 557 static inline 558 void mlo_ap_lock_acquire(struct wlan_mlo_ap *ap_ctx) 559 { 560 qdf_spin_lock_bh(&ap_ctx->mlo_ap_lock); 561 } 562 563 /** 564 * mlo_ap_lock_release - Release MLO AP mutex/spinlock 565 * @ap_ctx: ML device AP context 566 * 567 * release mutex/spinlock 568 * 569 * return: void 570 */ 571 static inline 572 void mlo_ap_lock_release(struct wlan_mlo_ap *ap_ctx) 573 { 574 qdf_spin_unlock_bh(&ap_ctx->mlo_ap_lock); 575 } 576 #else /* WLAN_MLO_USE_SPINLOCK */ 577 static inline 578 void ml_link_lock_create(struct mlo_mgr_context *mlo_ctx) 579 { 580 qdf_mutex_create(&mlo_ctx->ml_dev_list_lock); 581 } 582 583 static inline void 584 ml_link_lock_destroy(struct mlo_mgr_context *mlo_ctx) 585 { 586 qdf_mutex_destroy(&mlo_ctx->ml_dev_list_lock); 587 } 588 589 static inline 590 void ml_link_lock_acquire(struct mlo_mgr_context *mlo_ctx) 591 { 592 qdf_mutex_acquire(&mlo_ctx->ml_dev_list_lock); 593 } 594 595 static inline 596 void ml_link_lock_release(struct mlo_mgr_context *mlo_ctx) 597 { 598 qdf_mutex_release(&mlo_ctx->ml_dev_list_lock); 599 } 600 601 static inline 602 void mlo_dev_lock_create(struct wlan_mlo_dev_context *mldev) 603 { 604 qdf_mutex_create(&mldev->mlo_dev_lock); 605 } 606 607 static inline 608 void mlo_dev_lock_destroy(struct wlan_mlo_dev_context *mldev) 609 { 610 qdf_mutex_destroy(&mldev->mlo_dev_lock); 611 } 612 613 static inline void mlo_dev_lock_acquire(struct wlan_mlo_dev_context *mldev) 614 { 615 qdf_mutex_acquire(&mldev->mlo_dev_lock); 616 } 617 618 static inline void mlo_dev_lock_release(struct wlan_mlo_dev_context *mldev) 619 { 620 qdf_mutex_release(&mldev->mlo_dev_lock); 621 } 622 623 static inline 624 void ml_aid_lock_create(struct mlo_mgr_context *mlo_ctx) 625 { 626 qdf_mutex_create(&mlo_ctx->aid_lock); 627 } 628 629 static inline void 630 ml_aid_lock_destroy(struct mlo_mgr_context *mlo_ctx) 631 { 632 qdf_mutex_destroy(&mlo_ctx->aid_lock); 633 } 634 635 static inline 636 void ml_aid_lock_acquire(struct mlo_mgr_context *mlo_ctx) 637 { 638 qdf_mutex_acquire(&mlo_ctx->aid_lock); 639 } 640 641 static inline 642 void ml_aid_lock_release(struct mlo_mgr_context *mlo_ctx) 643 { 644 qdf_mutex_release(&mlo_ctx->aid_lock); 645 } 646 647 static inline 648 void ml_peerid_lock_create(struct mlo_mgr_context *mlo_ctx) 649 { 650 qdf_mutex_create(&mlo_ctx->ml_peerid_lock); 651 } 652 653 static inline void 654 ml_peerid_lock_destroy(struct mlo_mgr_context *mlo_ctx) 655 { 656 qdf_mutex_destroy(&mlo_ctx->ml_peerid_lock); 657 } 658 659 static inline 660 void ml_peerid_lock_acquire(struct mlo_mgr_context *mlo_ctx) 661 { 662 qdf_mutex_acquire(&mlo_ctx->ml_peerid_lock); 663 } 664 665 static inline 666 void ml_peerid_lock_release(struct mlo_mgr_context *mlo_ctx) 667 { 668 qdf_mutex_release(&mlo_ctx->ml_peerid_lock); 669 } 670 671 static inline void 672 mlo_peer_lock_create(struct wlan_mlo_peer_context *mlpeer) 673 { 674 qdf_mutex_create(&mlpeer->mlo_peer_lock); 675 } 676 677 static inline void 678 mlo_peer_lock_destroy(struct wlan_mlo_peer_context *mlpeer) 679 { 680 qdf_mutex_destroy(&mlpeer->mlo_peer_lock); 681 } 682 683 static inline 684 void mlo_peer_lock_acquire(struct wlan_mlo_peer_context *mlpeer) 685 { 686 qdf_mutex_acquire(&mlpeer->mlo_peer_lock); 687 } 688 689 static inline 690 void mlo_peer_lock_release(struct wlan_mlo_peer_context *mlpeer) 691 { 692 qdf_mutex_release(&mlpeer->mlo_peer_lock); 693 } 694 695 static inline void 696 ml_peerlist_lock_create(struct wlan_mlo_peer_list *ml_peerlist) 697 { 698 qdf_mutex_create(&ml_peerlist->peer_list_lock); 699 } 700 701 static inline void 702 ml_peerlist_lock_destroy(struct wlan_mlo_peer_list *ml_peerlist) 703 { 704 qdf_mutex_destroy(&ml_peerlist->peer_list_lock); 705 } 706 707 static inline 708 void ml_peerlist_lock_acquire(struct wlan_mlo_peer_list *ml_peerlist) 709 { 710 qdf_mutex_acquire(&ml_peerlist->peer_list_lock); 711 } 712 713 static inline 714 void ml_peerlist_lock_release(struct wlan_mlo_peer_list *ml_peerlist) 715 { 716 qdf_mutex_release(&ml_peerlist->peer_list_lock); 717 } 718 719 static inline 720 void copied_conn_req_lock_create(struct wlan_mlo_sta *sta_ctx) 721 { 722 qdf_mutex_create(&sta_ctx->copied_conn_req_lock); 723 } 724 725 static inline 726 void copied_conn_req_lock_destroy(struct wlan_mlo_sta *sta_ctx) 727 { 728 qdf_mutex_destroy(&sta_ctx->copied_conn_req_lock); 729 } 730 731 static inline 732 void copied_conn_req_lock_acquire(struct wlan_mlo_sta *sta_ctx) 733 { 734 qdf_mutex_acquire(&sta_ctx->copied_conn_req_lock); 735 } 736 737 static inline 738 void copied_conn_req_lock_release(struct wlan_mlo_sta *sta_ctx) 739 { 740 qdf_mutex_release(&sta_ctx->copied_conn_req_lock); 741 } 742 743 /** 744 * tsf_recalculation_lock_create - Create TSF recalculation mutex/spinlock 745 * @mldev: ML device context 746 * 747 * Creates mutex/spinlock 748 * 749 * Return: void 750 */ 751 static inline void 752 tsf_recalculation_lock_create(struct wlan_mlo_dev_context *mldev) 753 { 754 qdf_mutex_create(&mldev->tsf_recalculation_lock); 755 } 756 757 /** 758 * tsf_recalculation_lock_destroy - Destroy TSF recalculation mutex/spinlock 759 * @mldev: ML device context 760 * 761 * Destroy mutex/spinlock 762 * 763 * Return: void 764 */ 765 static inline void 766 tsf_recalculation_lock_destroy(struct wlan_mlo_dev_context *mldev) 767 { 768 qdf_mutex_destroy(&mldev->tsf_recalculation_lock); 769 } 770 771 /** 772 * tsf_recalculation_lock_acquire - Acquire TSF recalculation mutex/spinlock 773 * @mldev: ML device context 774 * 775 * Acquire mutex/spinlock 776 * 777 * return: void 778 */ 779 static inline 780 void tsf_recalculation_lock_acquire(struct wlan_mlo_dev_context *mldev) 781 { 782 qdf_mutex_acquire(&mldev->tsf_recalculation_lock); 783 } 784 785 /** 786 * tsf_recalculation_lock_release - Release TSF recalculation mutex/spinlock 787 * @mldev: ML device context 788 * 789 * release mutex/spinlock 790 * 791 * return: void 792 */ 793 static inline 794 void tsf_recalculation_lock_release(struct wlan_mlo_dev_context *mldev) 795 { 796 qdf_mutex_release(&mldev->tsf_recalculation_lock); 797 } 798 799 static inline 800 void mlo_ap_lock_create(struct wlan_mlo_ap *ap_ctx) 801 { 802 qdf_mutex_create(&ap_ctx->mlo_ap_lock); 803 } 804 805 static inline 806 void mlo_ap_lock_destroy(struct wlan_mlo_ap *ap_ctx) 807 { 808 qdf_mutex_destroy(&ap_ctx->mlo_ap_lock); 809 } 810 811 static inline 812 void mlo_ap_lock_acquire(struct wlan_mlo_ap *ap_ctx) 813 { 814 qdf_mutex_acquire(&ap_ctx->mlo_ap_lock); 815 } 816 817 static inline 818 void mlo_ap_lock_release(struct wlan_mlo_ap *ap_ctx) 819 { 820 qdf_mutex_release(&ap_ctx->mlo_ap_lock); 821 } 822 #endif /* WLAN_MLO_USE_SPINLOCK */ 823 824 /** 825 * wlan_mlo_mgr_psoc_enable() - MLO psoc enable handler 826 * @psoc: psoc pointer 827 * 828 * API to execute operations on psoc enable 829 * 830 * Return: QDF_STATUS 831 */ 832 QDF_STATUS wlan_mlo_mgr_psoc_enable(struct wlan_objmgr_psoc *psoc); 833 834 /** 835 * wlan_mlo_mgr_psoc_disable() - MLO psoc disable handler 836 * @psoc: psoc pointer 837 * 838 * API to execute operations on psoc disable 839 * 840 * Return: QDF_STATUS 841 */ 842 QDF_STATUS wlan_mlo_mgr_psoc_disable(struct wlan_objmgr_psoc *psoc); 843 844 /** 845 * wlan_mlo_mgr_update_mld_addr() - Update MLD MAC address 846 * @old_mac: Old MLD MAC address 847 * @new_mac: New MLD MAC address 848 * 849 * API to update MLD MAC address once ML dev context is created. 850 * 851 * Return: QDF_STATUS 852 */ 853 QDF_STATUS wlan_mlo_mgr_update_mld_addr(struct qdf_mac_addr *old_mac, 854 struct qdf_mac_addr *new_mac); 855 856 /** 857 * wlan_mlo_is_mld_ctx_exist() - check whether MLD exist with MLD MAC address 858 * @mldaddr: MLD MAC address 859 * 860 * API to check whether MLD is present with MLD MAC address. 861 * 862 * Return: true, if it is present 863 * false, if it is not present 864 */ 865 bool wlan_mlo_is_mld_ctx_exist(struct qdf_mac_addr *mldaddr); 866 867 /** 868 * wlan_mlo_get_sta_mld_ctx_count() - Get number of sta mld device context 869 * 870 * API to get number of sta mld device context 871 * 872 * Return: number of sta mld device context 873 */ 874 uint8_t wlan_mlo_get_sta_mld_ctx_count(void); 875 876 /** 877 * wlan_mlo_get_mld_ctx_by_mldaddr() - Get mld device context using mld 878 * MAC address 879 * 880 * @mldaddr: MAC address of the MLD device 881 * 882 * API to get mld device context using the mld mac address 883 * 884 * Return: Pointer to mlo device context 885 */ 886 struct wlan_mlo_dev_context 887 *wlan_mlo_get_mld_ctx_by_mldaddr(struct qdf_mac_addr *mldaddr); 888 889 /** 890 * wlan_mlo_check_valid_config() - Check vap config is valid for mld 891 * 892 * @ml_dev: Pointer to structure of mlo device context 893 * @pdev: Reference pdev to check against MLD list 894 * @opmode: Operating mode of vdev (SAP/STA etc..) 895 * 896 * API to check if vaps config is valid 897 * 898 * Return: QDF_STATUS 899 */ 900 QDF_STATUS wlan_mlo_check_valid_config(struct wlan_mlo_dev_context *ml_dev, 901 struct wlan_objmgr_pdev *pdev, 902 enum QDF_OPMODE opmode); 903 904 /** 905 * mlo_mgr_ml_peer_exist_on_diff_ml_ctx() - Check if MAC address matches any 906 * MLD address 907 * @peer_addr: Address to search for a match 908 * @peer_vdev_id: vdev ID of peer 909 * 910 * The API iterates through all the ML dev ctx in the global MLO 911 * manager to check if MAC address pointed by @peer_addr matches 912 * the MLD address of any ML dev context or its ML peers. 913 * If @peer_vdev_id is a valid pointer address, then API returns 914 * true only if the matching MAC address is not part of the same 915 * ML dev context. 916 * 917 * Return: True if a matching entity is found else false. 918 */ 919 bool mlo_mgr_ml_peer_exist_on_diff_ml_ctx(uint8_t *peer_addr, 920 uint8_t *peer_vdev_id); 921 #else 922 static inline QDF_STATUS wlan_mlo_mgr_init(void) 923 { 924 return QDF_STATUS_SUCCESS; 925 } 926 927 static inline QDF_STATUS wlan_mlo_mgr_deinit(void) 928 { 929 return QDF_STATUS_SUCCESS; 930 } 931 932 static inline QDF_STATUS 933 wlan_mlo_mgr_update_mld_addr(struct qdf_mac_addr *old_mac, 934 struct qdf_mac_addr *new_mac) 935 { 936 return QDF_STATUS_SUCCESS; 937 } 938 939 static inline 940 bool mlo_mgr_ml_peer_exist_on_diff_ml_ctx(uint8_t *peer_addr, 941 uint8_t *peer_vdev_id) 942 { 943 return false; 944 } 945 946 static inline 947 uint8_t wlan_mlo_get_sta_mld_ctx_count(void) 948 { 949 return 0; 950 } 951 #endif 952 #endif 953