dp_rh_tx.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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: None
  74. */
  75. void dp_tx_comp_get_params_from_hal_desc_rh(struct dp_soc *soc,
  76. void *tx_comp_hal_desc,
  77. struct dp_tx_desc_s **r_tx_desc);
  78. /**
  79. * dp_tx_process_htt_completion_rh() - Tx HTT Completion Indication Handler
  80. * @soc: Handle to DP soc structure
  81. * @tx_desc: software descriptor head pointer
  82. * @status : Tx completion status from HTT descriptor
  83. * @ring_id: ring number
  84. *
  85. * This function will process HTT Tx indication messages from Target
  86. *
  87. * Return: none
  88. */
  89. void dp_tx_process_htt_completion_rh(struct dp_soc *soc,
  90. struct dp_tx_desc_s *tx_desc,
  91. uint8_t *status,
  92. uint8_t ring_id);
  93. /**
  94. * dp_tx_desc_pool_init_rh() - Initialize Tx Descriptor pool(s)
  95. * @soc: Handle to DP Soc structure
  96. * @num_elem: pool descriptor number
  97. * @pool_id: pool to allocate
  98. * @spcl_tx_desc: if special desc
  99. *
  100. * Return: QDF_STATUS_SUCCESS - success, others - failure
  101. */
  102. QDF_STATUS dp_tx_desc_pool_init_rh(struct dp_soc *soc,
  103. uint32_t num_elem,
  104. uint8_t pool_id,
  105. bool spcl_tx_desc);
  106. /**
  107. * dp_tx_desc_pool_deinit_rh() - De-initialize Tx Descriptor pool(s)
  108. * @soc: Handle to DP Soc structure
  109. * @tx_desc_pool: Tx descriptor pool handler
  110. * @pool_id: pool to deinit
  111. * @spcl_tx_desc: if special desc
  112. *
  113. * Return: None.
  114. */
  115. void dp_tx_desc_pool_deinit_rh(struct dp_soc *soc,
  116. struct dp_tx_desc_pool_s *tx_desc_pool,
  117. uint8_t pool_id, bool spcl_tx_desc);
  118. /**
  119. * dp_tx_compute_tx_delay_rh() - Compute HW Tx completion delay
  120. * @soc: Handle to DP Soc structure
  121. * @vdev: vdev
  122. * @ts: Tx completion status
  123. * @delay_us: Delay to be calculated in microseconds
  124. *
  125. * Return: QDF_STATUS
  126. */
  127. QDF_STATUS dp_tx_compute_tx_delay_rh(struct dp_soc *soc,
  128. struct dp_vdev *vdev,
  129. struct hal_tx_completion_status *ts,
  130. uint32_t *delay_us);
  131. /**
  132. * dp_tx_desc_pool_alloc_rh() - Allocate coherent memory for TCL descriptors
  133. * @soc: Handle to DP Soc structure
  134. * @num_elem: Number of elements to allocate
  135. * @pool_id: TCL descriptor pool ID
  136. *
  137. * Return: QDF_STATUS_SUCCESS - success, others - failure
  138. */
  139. QDF_STATUS dp_tx_desc_pool_alloc_rh(struct dp_soc *soc, uint32_t num_elem,
  140. uint8_t pool_id);
  141. /**
  142. * dp_tx_desc_pool_free_rh() - Free TCL descriptor memory
  143. * @soc: Handle to DP Soc structure
  144. * @pool_id: TCL descriptor pool ID
  145. *
  146. * Return: none
  147. */
  148. void dp_tx_desc_pool_free_rh(struct dp_soc *soc, uint8_t pool_id);
  149. /**
  150. * dp_tx_compl_handler_rh() - TX completion handler for Rhine
  151. * @soc: Handle to DP Soc structure
  152. * @htt_msg: TX completion HTT message
  153. *
  154. * Return: none
  155. */
  156. void dp_tx_compl_handler_rh(struct dp_soc *soc, qdf_nbuf_t htt_msg);
  157. /**
  158. * dp_flush_tx_ring_rh() - flush tx ring write index
  159. * @pdev: dp pdev handle
  160. * @ring_id: Tx ring id
  161. *
  162. * Return: 0 on success and error code on failure
  163. */
  164. int dp_flush_tx_ring_rh(struct dp_pdev *pdev, int ring_id);
  165. #endif