dp_be_rx.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #ifndef _DP_BE_RX_H_
  19. #define _DP_BE_RX_H_
  20. #include <dp_types.h>
  21. #include "dp_be.h"
  22. uint32_t dp_rx_process_be(struct dp_intr *int_ctx,
  23. hal_ring_handle_t hal_ring_hdl, uint8_t reo_ring_num,
  24. uint32_t quota);
  25. /**
  26. * dp_rx_desc_pool_init_be() - Initialize Rx Descriptor pool(s)
  27. * @soc: Handle to DP Soc structure
  28. * @rx_desc_pool: Rx descriptor pool handler
  29. * @pool_id: Rx descriptor pool ID
  30. *
  31. * Return: QDF_STATUS_SUCCESS - succeeded, others - failed
  32. */
  33. QDF_STATUS dp_rx_desc_pool_init_be(struct dp_soc *soc,
  34. struct rx_desc_pool *rx_desc_pool,
  35. uint32_t pool_id);
  36. /**
  37. * dp_rx_desc_pool_deinit_be() - De-initialize Rx Descriptor pool(s)
  38. * @soc: Handle to DP Soc structure
  39. * @rx_desc_pool: Rx descriptor pool handler
  40. * @pool_id: Rx descriptor pool ID
  41. *
  42. * Return: None
  43. */
  44. void dp_rx_desc_pool_deinit_be(struct dp_soc *soc,
  45. struct rx_desc_pool *rx_desc_pool,
  46. uint32_t pool_id);
  47. /**
  48. * dp_wbm_get_rx_desc_from_hal_desc_be() - Get corresponding Rx Desc
  49. * address from WBM ring Desc
  50. * @soc: Handle to DP Soc structure
  51. * @ring_desc: ring descriptor structure pointer
  52. * @r_rx_desc: pointer to a pointer of Rx Desc
  53. *
  54. * Return: QDF_STATUS_SUCCESS - succeeded, others - failed
  55. */
  56. QDF_STATUS dp_wbm_get_rx_desc_from_hal_desc_be(struct dp_soc *soc,
  57. void *ring_desc,
  58. struct dp_rx_desc **r_rx_desc);
  59. /**
  60. * dp_rx_desc_cookie_2_va_be() - Convert RX Desc cookie ID to VA
  61. * @soc:Handle to DP Soc structure
  62. * @cookie: cookie used to lookup virtual address
  63. *
  64. * Return: Rx descriptor virtual address
  65. */
  66. struct dp_rx_desc *dp_rx_desc_cookie_2_va_be(struct dp_soc *soc,
  67. uint32_t cookie);
  68. #if !defined(DP_FEATURE_HW_COOKIE_CONVERSION) || \
  69. defined(DP_HW_COOKIE_CONVERT_EXCEPTION)
  70. /**
  71. * dp_rx_desc_sw_cc_check() - check if RX desc VA is got correctly,
  72. if not, do SW cookie conversion.
  73. * @soc:Handle to DP Soc structure
  74. * @rx_buf_cookie: RX desc cookie ID
  75. * @r_rx_desc: double pointer for RX desc
  76. *
  77. * Return: None
  78. */
  79. static inline void
  80. dp_rx_desc_sw_cc_check(struct dp_soc *soc,
  81. uint32_t rx_buf_cookie,
  82. struct dp_rx_desc **r_rx_desc)
  83. {
  84. if (qdf_unlikely(!(*r_rx_desc))) {
  85. *r_rx_desc = (struct dp_rx_desc *)
  86. dp_cc_desc_find(soc,
  87. rx_buf_cookie);
  88. }
  89. }
  90. #else
  91. static inline void
  92. dp_rx_desc_sw_cc_check(struct dp_soc *soc,
  93. uint32_t rx_buf_cookie,
  94. struct dp_rx_desc **r_rx_desc)
  95. {
  96. }
  97. #endif /* DP_FEATURE_HW_COOKIE_CONVERSION && DP_HW_COOKIE_CONVERT_EXCEPTION */
  98. #ifdef WLAN_FEATURE_NEAR_FULL_IRQ
  99. /**
  100. * dp_rx_nf_process() - Near Full state handler for RX rings.
  101. * @int_ctx: interrupt context
  102. * @hal_ring_hdl: Rx ring handle
  103. * @reo_ring_num: RX ring number
  104. * @quota: Quota of work to be done
  105. *
  106. * Return: work done in the handler
  107. */
  108. uint32_t dp_rx_nf_process(struct dp_intr *int_ctx,
  109. hal_ring_handle_t hal_ring_hdl,
  110. uint8_t reo_ring_num,
  111. uint32_t quota);
  112. #else
  113. static inline
  114. uint32_t dp_rx_nf_process(struct dp_intr *int_ctx,
  115. hal_ring_handle_t hal_ring_hdl,
  116. uint8_t reo_ring_num,
  117. uint32_t quota)
  118. {
  119. return 0;
  120. }
  121. #endif /*WLAN_FEATURE_NEAR_FULL_IRQ */
  122. #endif