cdp_txrx_mlo.h 3.9 KB

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