dp_rh_tx.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. 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_RH_TX_H
  19. #define __DP_RH_TX_H
  20. #include <dp_types.h>
  21. #define DP_RH_TX_HDR_SIZE_NATIVE_WIFI 30
  22. #define DP_RH_TX_HDR_SIZE_802_11_RAW 36
  23. #define DP_RH_TX_HDR_SIZE_ETHERNET 14
  24. #define DP_RH_TX_HDR_SIZE_IP 16
  25. #define DP_RH_TX_HDR_SIZE_802_1Q 4
  26. #define DP_RH_TX_HDR_SIZE_LLC_SNAP 8
  27. #define DP_RH_TX_HDR_SIZE_OUTER_HDR_MAX DP_RH_TX_HDR_SIZE_802_11_RAW
  28. #define DP_RH_TX_TLV_HDR_SIZE sizeof(struct tlv_32_hdr)
  29. #define DP_RH_TX_TCL_DESC_SIZE (HAL_TX_DESC_LEN_BYTES + DP_RH_TX_TLV_HDR_SIZE)
  30. /*
  31. * NB: intentionally not using kernel-doc comment because the kernel-doc
  32. * script does not handle the qdf_dma_mem_context macro
  33. * struct dp_tx_tcl_desc_pool_s - Tx Extension Descriptor Pool
  34. * @elem_count: Number of descriptors in the pool
  35. * @elem_size: Size of each descriptor
  36. * @desc_pages: multiple page allocation information for actual descriptors
  37. * @freelist: freelist of TCL descriptors
  38. * @memctx:
  39. */
  40. struct dp_tx_tcl_desc_pool_s {
  41. uint16_t elem_count;
  42. int elem_size;
  43. struct qdf_mem_multi_page_t desc_pages;
  44. uint32_t *freelist;
  45. qdf_dma_mem_context(memctx);
  46. };
  47. /**
  48. * dp_tx_hw_enqueue_rh() - Enqueue to TCL HW for transmit
  49. * @soc: DP Soc Handle
  50. * @vdev: DP vdev handle
  51. * @tx_desc: Tx Descriptor Handle
  52. * @fw_metadata: Metadata to send to Target Firmware along with frame
  53. * @tx_exc_metadata: Handle that holds exception path meta data
  54. * @msdu_info: Holds the MSDU information to be transmitted
  55. *
  56. * Gets the next free TCL HW DMA descriptor and sets up required parameters
  57. * from software Tx descriptor
  58. *
  59. * Return: QDF_STATUS_SUCCESS: success
  60. * QDF_STATUS_E_RESOURCES: Error return
  61. */
  62. QDF_STATUS
  63. dp_tx_hw_enqueue_rh(struct dp_soc *soc, struct dp_vdev *vdev,
  64. struct dp_tx_desc_s *tx_desc, uint16_t fw_metadata,
  65. struct cdp_tx_exception_metadata *tx_exc_metadata,
  66. struct dp_tx_msdu_info_s *msdu_info);
  67. /**
  68. * dp_tx_comp_get_params_from_hal_desc_rh() - Get TX desc from HAL comp desc
  69. * @soc: DP soc handle
  70. * @tx_comp_hal_desc: HAL TX Comp Descriptor
  71. * @r_tx_desc: SW Tx Descriptor retrieved from HAL desc.
  72. *
  73. * Return: QDF_STATUS return codes
  74. */
  75. QDF_STATUS
  76. dp_tx_comp_get_params_from_hal_desc_rh(struct dp_soc *soc,
  77. void *tx_comp_hal_desc,
  78. struct dp_tx_desc_s **r_tx_desc);
  79. /**
  80. * dp_tx_process_htt_completion_rh() - Tx HTT Completion Indication Handler
  81. * @soc: Handle to DP soc structure
  82. * @tx_desc: software descriptor head pointer
  83. * @status : Tx completion status from HTT descriptor
  84. * @ring_id: ring number
  85. *
  86. * This function will process HTT Tx indication messages from Target
  87. *
  88. * Return: none
  89. */
  90. void dp_tx_process_htt_completion_rh(struct dp_soc *soc,
  91. struct dp_tx_desc_s *tx_desc,
  92. uint8_t *status,
  93. uint8_t ring_id);
  94. /**
  95. * dp_tx_desc_pool_init_rh() - Initialize Tx Descriptor pool(s)
  96. * @soc: Handle to DP Soc structure
  97. * @num_elem: pool descriptor number
  98. * @pool_id: pool to allocate
  99. * @spcl_tx_desc: if special desc
  100. *
  101. * Return: QDF_STATUS_SUCCESS - success, others - failure
  102. */
  103. QDF_STATUS dp_tx_desc_pool_init_rh(struct dp_soc *soc,
  104. uint32_t num_elem,
  105. uint8_t pool_id,
  106. bool spcl_tx_desc);
  107. /**
  108. * dp_tx_desc_pool_deinit_rh() - De-initialize Tx Descriptor pool(s)
  109. * @soc: Handle to DP Soc structure
  110. * @tx_desc_pool: Tx descriptor pool handler
  111. * @pool_id: pool to deinit
  112. * @spcl_tx_desc: if special desc
  113. *
  114. * Return: None.
  115. */
  116. void dp_tx_desc_pool_deinit_rh(struct dp_soc *soc,
  117. struct dp_tx_desc_pool_s *tx_desc_pool,
  118. uint8_t pool_id, bool spcl_tx_desc);
  119. /**
  120. * dp_tx_compute_tx_delay_rh() - Compute HW Tx completion delay
  121. * @soc: Handle to DP Soc structure
  122. * @vdev: vdev
  123. * @ts: Tx completion status
  124. * @delay_us: Delay to be calculated in microseconds
  125. *
  126. * Return: QDF_STATUS
  127. */
  128. QDF_STATUS dp_tx_compute_tx_delay_rh(struct dp_soc *soc,
  129. struct dp_vdev *vdev,
  130. struct hal_tx_completion_status *ts,
  131. uint32_t *delay_us);
  132. /**
  133. * dp_tx_desc_pool_alloc_rh() - Allocate coherent memory for TCL descriptors
  134. * @soc: Handle to DP Soc structure
  135. * @num_elem: Number of elements to allocate
  136. * @pool_id: TCL descriptor pool ID
  137. *
  138. * Return: QDF_STATUS_SUCCESS - success, others - failure
  139. */
  140. QDF_STATUS dp_tx_desc_pool_alloc_rh(struct dp_soc *soc, uint32_t num_elem,
  141. uint8_t pool_id);
  142. /**
  143. * dp_tx_desc_pool_free_rh() - Free TCL descriptor memory
  144. * @soc: Handle to DP Soc structure
  145. * @pool_id: TCL descriptor pool ID
  146. *
  147. * Return: none
  148. */
  149. void dp_tx_desc_pool_free_rh(struct dp_soc *soc, uint8_t pool_id);
  150. /**
  151. * dp_tx_compl_handler_rh() - TX completion handler for Rhine
  152. * @soc: Handle to DP Soc structure
  153. * @htt_msg: TX completion HTT message
  154. *
  155. * Return: none
  156. */
  157. void dp_tx_compl_handler_rh(struct dp_soc *soc, qdf_nbuf_t htt_msg);
  158. /**
  159. * dp_flush_tx_ring_rh() - flush tx ring write index
  160. * @pdev: dp pdev handle
  161. * @ring_id: Tx ring id
  162. *
  163. * Return: 0 on success and error code on failure
  164. */
  165. int dp_flush_tx_ring_rh(struct dp_pdev *pdev, int ring_id);
  166. #endif