dp_li_rx.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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_LI_RX_H_
  19. #define _DP_LI_RX_H_
  20. #include <dp_types.h>
  21. #include <dp_rx.h>
  22. #include "dp_li.h"
  23. uint32_t dp_rx_process_li(struct dp_intr *int_ctx,
  24. hal_ring_handle_t hal_ring_hdl, uint8_t reo_ring_num,
  25. uint32_t quota);
  26. /**
  27. * dp_rx_desc_pool_init_li() - Initialize Rx Descriptor pool(s)
  28. * @soc: Handle to DP Soc structure
  29. * @rx_desc_pool: Rx descriptor pool handler
  30. * @pool_id: Rx descriptor pool ID
  31. *
  32. * Return: None
  33. */
  34. QDF_STATUS dp_rx_desc_pool_init_li(struct dp_soc *soc,
  35. struct rx_desc_pool *rx_desc_pool,
  36. uint32_t pool_id);
  37. /**
  38. * dp_rx_desc_pool_deinit_li() - De-initialize Rx Descriptor pool(s)
  39. * @soc: Handle to DP Soc structure
  40. * @rx_desc_pool: Rx descriptor pool handler
  41. * @pool_id: Rx descriptor pool ID
  42. *
  43. * Return: None
  44. */
  45. void dp_rx_desc_pool_deinit_li(struct dp_soc *soc,
  46. struct rx_desc_pool *rx_desc_pool,
  47. uint32_t pool_id);
  48. /**
  49. * dp_wbm_get_rx_desc_from_hal_desc_li() - Get corresponding Rx Desc
  50. * address from WBM ring Desc
  51. * @soc: Handle to DP Soc structure
  52. * @ring_desc: ring descriptor structure pointer
  53. * @r_rx_desc: pointer to a pointer of Rx Desc
  54. *
  55. * Return: QDF_STATUS_SUCCESS - succeeded, others - failed
  56. */
  57. QDF_STATUS dp_wbm_get_rx_desc_from_hal_desc_li(
  58. struct dp_soc *soc,
  59. void *ring_desc,
  60. struct dp_rx_desc **r_rx_desc);
  61. /**
  62. * dp_rx_desc_cookie_2_va_li() - Convert RX Desc cookie ID to VA
  63. * @soc:Handle to DP Soc structure
  64. * @cookie: cookie used to lookup virtual address
  65. *
  66. * Return: Rx descriptor virtual address
  67. */
  68. static inline
  69. struct dp_rx_desc *dp_rx_desc_cookie_2_va_li(struct dp_soc *soc,
  70. uint32_t cookie)
  71. {
  72. return dp_rx_cookie_2_va_rxdma_buf(soc, cookie);
  73. }
  74. #define DP_PEER_METADATA_VDEV_ID_MASK 0x003f0000
  75. #define DP_PEER_METADATA_VDEV_ID_SHIFT 16
  76. #define DP_PEER_METADATA_OFFLOAD_MASK 0x01000000
  77. #define DP_PEER_METADATA_OFFLOAD_SHIFT 24
  78. #define DP_PEER_METADATA_VDEV_ID_GET_LI(_peer_metadata) \
  79. (((_peer_metadata) & DP_PEER_METADATA_VDEV_ID_MASK) \
  80. >> DP_PEER_METADATA_VDEV_ID_SHIFT)
  81. #define DP_PEER_METADATA_OFFLOAD_GET_LI(_peer_metadata) \
  82. (((_peer_metadata) & DP_PEER_METADATA_OFFLOAD_MASK) \
  83. >> DP_PEER_METADATA_OFFLOAD_SHIFT)
  84. static inline uint16_t
  85. dp_rx_peer_metadata_peer_id_get_li(struct dp_soc *soc, uint32_t peer_metadata)
  86. {
  87. struct htt_rx_peer_metadata_v0 *metadata =
  88. (struct htt_rx_peer_metadata_v0 *)&peer_metadata;
  89. return metadata->peer_id;
  90. }
  91. #ifdef QCA_DP_RX_NBUF_AND_NBUF_DATA_PREFETCH
  92. static inline
  93. void dp_rx_prefetch_nbuf_data(qdf_nbuf_t nbuf, qdf_nbuf_t next)
  94. {
  95. struct rx_pkt_tlvs *pkt_tlvs;
  96. if (next) {
  97. /* prefetch skb->next and first few bytes of skb->cb */
  98. qdf_prefetch(next);
  99. /* skb->cb spread across 2 cache lines hence below prefetch */
  100. qdf_prefetch(&next->_skb_refdst);
  101. qdf_prefetch(&next->len);
  102. qdf_prefetch(&next->protocol);
  103. pkt_tlvs = (struct rx_pkt_tlvs *)next->data;
  104. /* sa_idx, da_idx, l3_pad in RX msdu_end TLV */
  105. qdf_prefetch(pkt_tlvs);
  106. /* msdu_done in RX attention TLV */
  107. qdf_prefetch(&pkt_tlvs->attn_tlv);
  108. /* fr_ds & to_ds in RX MPDU start TLV */
  109. if (qdf_nbuf_is_rx_chfrag_end(nbuf))
  110. qdf_prefetch(&pkt_tlvs->mpdu_start_tlv);
  111. }
  112. }
  113. #else
  114. static inline
  115. void dp_rx_prefetch_nbuf_data(qdf_nbuf_t nbuf, qdf_nbuf_t next)
  116. {
  117. }
  118. #endif
  119. #endif