cdp_txrx_mlo.h 4.0 KB

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