cdp_txrx_mlo.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. static inline void cdp_mlo_setup_complete(ol_txrx_soc_handle soc,
  72. struct cdp_mlo_ctxt *mlo_ctx)
  73. {
  74. if (!soc || !soc->ops) {
  75. QDF_BUG(0);
  76. return;
  77. }
  78. if (!soc->ops->mlo_ops ||
  79. !soc->ops->mlo_ops->mlo_setup_complete)
  80. return;
  81. soc->ops->mlo_ops->mlo_setup_complete(mlo_ctx);
  82. }
  83. /*
  84. * cdp_mlo_update_delta_tsf2 - Update delta_tsf2
  85. * @soc: soc handle
  86. * @pdev_id: pdev id
  87. * @delta_tsf2: delta_tsf2
  88. *
  89. * return: none
  90. */
  91. static inline void cdp_mlo_update_delta_tsf2(ol_txrx_soc_handle soc,
  92. uint8_t pdev_id,
  93. uint64_t delta_tsf2)
  94. {
  95. if (!soc || !soc->ops) {
  96. QDF_BUG(0);
  97. return;
  98. }
  99. if (!soc->ops->mlo_ops ||
  100. !soc->ops->mlo_ops->mlo_update_delta_tsf2)
  101. return;
  102. soc->ops->mlo_ops->mlo_update_delta_tsf2(soc, pdev_id, delta_tsf2);
  103. }
  104. /*
  105. * cdp_mlo_update_delta_tqm - Update delta_tqm
  106. * @soc: soc handle
  107. * @delta_tqm: delta_tqm
  108. *
  109. * return: none
  110. */
  111. static inline void cdp_mlo_update_delta_tqm(ol_txrx_soc_handle soc,
  112. uint64_t delta_tqm)
  113. {
  114. if (!soc || !soc->ops) {
  115. QDF_BUG(0);
  116. return;
  117. }
  118. if (!soc->ops->mlo_ops ||
  119. !soc->ops->mlo_ops->mlo_update_delta_tqm)
  120. return;
  121. soc->ops->mlo_ops->mlo_update_delta_tqm(soc, delta_tqm);
  122. }
  123. /*
  124. * cdp_mlo_get_mld_vdev_stats - Get MLD vdev stats
  125. * @soc: soc handle
  126. * @vdev_id: vdev_id of one of the vdev's of the MLD group
  127. * @buf: buffer to hold vdev_stats
  128. * @link_vdev_only: flag to indicate if stats are required for specific vdev
  129. *
  130. * return: QDF_STATUS
  131. */
  132. static inline QDF_STATUS
  133. cdp_mlo_get_mld_vdev_stats(ol_txrx_soc_handle soc,
  134. uint8_t vdev_id, struct cdp_vdev_stats *buf,
  135. bool link_vdev_only)
  136. {
  137. if (!soc || !soc->ops) {
  138. QDF_BUG(0);
  139. return QDF_STATUS_E_FAILURE;
  140. }
  141. if (!soc->ops->mlo_ops || !soc->ops->mlo_ops->mlo_get_mld_vdev_stats)
  142. return QDF_STATUS_E_FAILURE;
  143. return soc->ops->mlo_ops->mlo_get_mld_vdev_stats(soc,
  144. vdev_id,
  145. buf,
  146. link_vdev_only);
  147. }
  148. #endif /*_CDP_TXRX_MLO_H_*/