dp_be_rx.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #ifndef _DP_BE_RX_H_
  20. #define _DP_BE_RX_H_
  21. #include <dp_types.h>
  22. #include "dp_be.h"
  23. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  24. /*
  25. * dp_rx_intrabss_fwd_be() - API for intrabss fwd. For EAPOL
  26. * pkt with DA not equal to vdev mac addr, fwd is not allowed.
  27. * @soc: core txrx main context
  28. * @ta_peer: source peer entry
  29. * @rx_tlv_hdr: start address of rx tlvs
  30. * @nbuf: nbuf that has to be intrabss forwarded
  31. * @msdu_metadata: msdu metadata
  32. *
  33. * Return: true if it is forwarded else false
  34. */
  35. bool dp_rx_intrabss_fwd_be(struct dp_soc *soc,
  36. struct dp_peer *ta_peer,
  37. uint8_t *rx_tlv_hdr,
  38. qdf_nbuf_t nbuf,
  39. struct hal_rx_msdu_metadata msdu_metadata);
  40. #endif
  41. uint32_t dp_rx_process_be(struct dp_intr *int_ctx,
  42. hal_ring_handle_t hal_ring_hdl, uint8_t reo_ring_num,
  43. uint32_t quota);
  44. /**
  45. * dp_rx_desc_pool_init_be() - Initialize Rx Descriptor pool(s)
  46. * @soc: Handle to DP Soc structure
  47. * @rx_desc_pool: Rx descriptor pool handler
  48. * @pool_id: Rx descriptor pool ID
  49. *
  50. * Return: QDF_STATUS_SUCCESS - succeeded, others - failed
  51. */
  52. QDF_STATUS dp_rx_desc_pool_init_be(struct dp_soc *soc,
  53. struct rx_desc_pool *rx_desc_pool,
  54. uint32_t pool_id);
  55. /**
  56. * dp_rx_desc_pool_deinit_be() - De-initialize Rx Descriptor pool(s)
  57. * @soc: Handle to DP Soc structure
  58. * @rx_desc_pool: Rx descriptor pool handler
  59. * @pool_id: Rx descriptor pool ID
  60. *
  61. * Return: None
  62. */
  63. void dp_rx_desc_pool_deinit_be(struct dp_soc *soc,
  64. struct rx_desc_pool *rx_desc_pool,
  65. uint32_t pool_id);
  66. /**
  67. * dp_wbm_get_rx_desc_from_hal_desc_be() - Get corresponding Rx Desc
  68. * address from WBM ring Desc
  69. * @soc: Handle to DP Soc structure
  70. * @ring_desc: ring descriptor structure pointer
  71. * @r_rx_desc: pointer to a pointer of Rx Desc
  72. *
  73. * Return: QDF_STATUS_SUCCESS - succeeded, others - failed
  74. */
  75. QDF_STATUS dp_wbm_get_rx_desc_from_hal_desc_be(struct dp_soc *soc,
  76. void *ring_desc,
  77. struct dp_rx_desc **r_rx_desc);
  78. /**
  79. * dp_rx_desc_cookie_2_va_be() - Convert RX Desc cookie ID to VA
  80. * @soc:Handle to DP Soc structure
  81. * @cookie: cookie used to lookup virtual address
  82. *
  83. * Return: Rx descriptor virtual address
  84. */
  85. struct dp_rx_desc *dp_rx_desc_cookie_2_va_be(struct dp_soc *soc,
  86. uint32_t cookie);
  87. #if !defined(DP_FEATURE_HW_COOKIE_CONVERSION) || \
  88. defined(DP_HW_COOKIE_CONVERT_EXCEPTION)
  89. /**
  90. * dp_rx_desc_sw_cc_check() - check if RX desc VA is got correctly,
  91. if not, do SW cookie conversion.
  92. * @soc:Handle to DP Soc structure
  93. * @rx_buf_cookie: RX desc cookie ID
  94. * @r_rx_desc: double pointer for RX desc
  95. *
  96. * Return: None
  97. */
  98. static inline void
  99. dp_rx_desc_sw_cc_check(struct dp_soc *soc,
  100. uint32_t rx_buf_cookie,
  101. struct dp_rx_desc **r_rx_desc)
  102. {
  103. if (qdf_unlikely(!(*r_rx_desc))) {
  104. *r_rx_desc = (struct dp_rx_desc *)
  105. dp_cc_desc_find(soc,
  106. rx_buf_cookie);
  107. }
  108. }
  109. #else
  110. static inline void
  111. dp_rx_desc_sw_cc_check(struct dp_soc *soc,
  112. uint32_t rx_buf_cookie,
  113. struct dp_rx_desc **r_rx_desc)
  114. {
  115. }
  116. #endif /* DP_FEATURE_HW_COOKIE_CONVERSION && DP_HW_COOKIE_CONVERT_EXCEPTION */
  117. #define DP_PEER_METADATA_OFFLOAD_GET_BE(_peer_metadata) (0)
  118. #ifdef DP_USE_REDUCED_PEER_ID_FIELD_WIDTH
  119. static inline uint16_t
  120. dp_rx_peer_metadata_peer_id_get_be(struct dp_soc *soc, uint32_t peer_metadata)
  121. {
  122. struct htt_rx_peer_metadata_v1 *metadata =
  123. (struct htt_rx_peer_metadata_v1 *)&peer_metadata;
  124. uint16_t peer_id;
  125. peer_id = metadata->peer_id |
  126. (metadata->ml_peer_valid << soc->peer_id_shift);
  127. return peer_id;
  128. }
  129. #else
  130. /* Combine ml_peer_valid and peer_id field */
  131. #define DP_BE_PEER_METADATA_PEER_ID_MASK 0x00003fff
  132. #define DP_BE_PEER_METADATA_PEER_ID_SHIFT 0
  133. static inline uint16_t
  134. dp_rx_peer_metadata_peer_id_get_be(struct dp_soc *soc, uint32_t peer_metadata)
  135. {
  136. return ((peer_metadata & DP_BE_PEER_METADATA_PEER_ID_MASK) >>
  137. DP_BE_PEER_METADATA_PEER_ID_SHIFT);
  138. }
  139. #endif
  140. static inline uint16_t
  141. dp_rx_peer_metadata_vdev_id_get_be(struct dp_soc *soc, uint32_t peer_metadata)
  142. {
  143. struct htt_rx_peer_metadata_v1 *metadata =
  144. (struct htt_rx_peer_metadata_v1 *)&peer_metadata;
  145. return metadata->vdev_id;
  146. }
  147. #ifdef WLAN_FEATURE_NEAR_FULL_IRQ
  148. /**
  149. * dp_rx_nf_process() - Near Full state handler for RX rings.
  150. * @int_ctx: interrupt context
  151. * @hal_ring_hdl: Rx ring handle
  152. * @reo_ring_num: RX ring number
  153. * @quota: Quota of work to be done
  154. *
  155. * Return: work done in the handler
  156. */
  157. uint32_t dp_rx_nf_process(struct dp_intr *int_ctx,
  158. hal_ring_handle_t hal_ring_hdl,
  159. uint8_t reo_ring_num,
  160. uint32_t quota);
  161. #else
  162. static inline
  163. uint32_t dp_rx_nf_process(struct dp_intr *int_ctx,
  164. hal_ring_handle_t hal_ring_hdl,
  165. uint8_t reo_ring_num,
  166. uint32_t quota)
  167. {
  168. return 0;
  169. }
  170. #endif /*WLAN_FEATURE_NEAR_FULL_IRQ */
  171. #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP)
  172. struct dp_soc *
  173. dp_rx_replensih_soc_get(struct dp_soc *soc, uint8_t reo_ring_num);
  174. #else
  175. static inline struct dp_soc *
  176. dp_rx_replensih_soc_get(struct dp_soc *soc, uint8_t reo_ring_num)
  177. {
  178. return soc;
  179. }
  180. #endif
  181. #endif