cdp_txrx_mlo.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * Copyright (c) 2021-2022 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. #ifndef _CDP_TXRX_MLO_H_
  17. #define _CDP_TXRX_MLO_H_
  18. #include "cdp_txrx_ops.h"
  19. struct cdp_mlo_ctxt;
  20. /**
  21. * cdp_ctrl_mlo_mgr - opaque handle for mlo manager context
  22. */
  23. struct cdp_ctrl_mlo_mgr;
  24. struct
  25. cdp_mlo_ctxt *dp_mlo_ctxt_attach_wifi3(struct cdp_ctrl_mlo_mgr *ctrl_ctxt);
  26. void dp_mlo_ctxt_detach_wifi3(struct cdp_mlo_ctxt *ml_ctxt);
  27. static inline
  28. struct cdp_mlo_ctxt *cdp_mlo_ctxt_attach(struct cdp_ctrl_mlo_mgr *ctrl_ctxt)
  29. {
  30. return dp_mlo_ctxt_attach_wifi3(ctrl_ctxt);
  31. }
  32. static inline
  33. void cdp_mlo_ctxt_detach(struct cdp_mlo_ctxt *ml_ctxt)
  34. {
  35. dp_mlo_ctxt_detach_wifi3(ml_ctxt);
  36. }
  37. static inline void cdp_soc_mlo_soc_setup(ol_txrx_soc_handle soc,
  38. struct cdp_mlo_ctxt *mlo_ctx)
  39. {
  40. if (!soc || !soc->ops) {
  41. QDF_BUG(0);
  42. return;
  43. }
  44. if (!soc->ops->mlo_ops ||
  45. !soc->ops->mlo_ops->mlo_soc_setup)
  46. return;
  47. soc->ops->mlo_ops->mlo_soc_setup(soc, mlo_ctx);
  48. }
  49. static inline void cdp_soc_mlo_soc_teardown(ol_txrx_soc_handle soc,
  50. struct cdp_mlo_ctxt *mlo_ctx,
  51. bool is_force_down)
  52. {
  53. if (!soc || !soc->ops) {
  54. QDF_BUG(0);
  55. return;
  56. }
  57. if (!soc->ops->mlo_ops ||
  58. !soc->ops->mlo_ops->mlo_soc_teardown)
  59. return;
  60. soc->ops->mlo_ops->mlo_soc_teardown(soc, mlo_ctx, is_force_down);
  61. }
  62. /*
  63. * cdp_update_mlo_ptnr_list - Add vdev to MLO partner list
  64. * @soc: soc handle
  65. * @vdev_ids: list of partner vdevs
  66. * @num_vdevs: number of items in list
  67. * @vdev_id: caller's vdev id
  68. *
  69. * return: QDF_STATUS
  70. */
  71. static inline QDF_STATUS
  72. cdp_update_mlo_ptnr_list(ol_txrx_soc_handle soc, int8_t vdev_ids[],
  73. uint8_t num_vdevs, uint8_t vdev_id)
  74. {
  75. if (!soc || !soc->ops || !soc->ops->mlo_ops)
  76. return QDF_STATUS_E_INVAL;
  77. if (soc->ops->mlo_ops->update_mlo_ptnr_list)
  78. return soc->ops->mlo_ops->update_mlo_ptnr_list(soc, vdev_ids,
  79. num_vdevs, vdev_id);
  80. return QDF_STATUS_SUCCESS;
  81. }
  82. static inline void cdp_mlo_setup_complete(ol_txrx_soc_handle soc,
  83. struct cdp_mlo_ctxt *mlo_ctx)
  84. {
  85. if (!soc || !soc->ops) {
  86. QDF_BUG(0);
  87. return;
  88. }
  89. if (!soc->ops->mlo_ops ||
  90. !soc->ops->mlo_ops->mlo_setup_complete)
  91. return;
  92. soc->ops->mlo_ops->mlo_setup_complete(mlo_ctx);
  93. }
  94. /*
  95. * cdp_mlo_update_delta_tsf2 - Update delta_tsf2
  96. * @soc: soc handle
  97. * @pdev_id: pdev id
  98. * @delta_tsf2: delta_tsf2
  99. *
  100. * return: none
  101. */
  102. static inline void cdp_mlo_update_delta_tsf2(ol_txrx_soc_handle soc,
  103. uint8_t pdev_id,
  104. uint64_t delta_tsf2)
  105. {
  106. if (!soc || !soc->ops) {
  107. QDF_BUG(0);
  108. return;
  109. }
  110. if (!soc->ops->mlo_ops ||
  111. !soc->ops->mlo_ops->mlo_update_delta_tsf2)
  112. return;
  113. soc->ops->mlo_ops->mlo_update_delta_tsf2(soc, pdev_id, delta_tsf2);
  114. }
  115. /*
  116. * cdp_mlo_update_delta_tqm - Update delta_tqm
  117. * @soc: soc handle
  118. * @delta_tqm: delta_tqm
  119. *
  120. * return: none
  121. */
  122. static inline void cdp_mlo_update_delta_tqm(ol_txrx_soc_handle soc,
  123. uint64_t delta_tqm)
  124. {
  125. if (!soc || !soc->ops) {
  126. QDF_BUG(0);
  127. return;
  128. }
  129. if (!soc->ops->mlo_ops ||
  130. !soc->ops->mlo_ops->mlo_update_delta_tqm)
  131. return;
  132. soc->ops->mlo_ops->mlo_update_delta_tqm(soc, delta_tqm);
  133. }
  134. #endif /*_CDP_TXRX_MLO_H_*/