dp_rh_tx.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. *
  99. * Return: QDF_STATUS_SUCCESS - success, others - failure
  100. */
  101. QDF_STATUS dp_tx_desc_pool_init_rh(struct dp_soc *soc,
  102. uint32_t num_elem,
  103. uint8_t pool_id);
  104. /**
  105. * dp_tx_desc_pool_deinit_rh() - De-initialize Tx Descriptor pool(s)
  106. * @soc: Handle to DP Soc structure
  107. * @tx_desc_pool: Tx descriptor pool handler
  108. * @pool_id: pool to deinit
  109. *
  110. * Return: None.
  111. */
  112. void dp_tx_desc_pool_deinit_rh(struct dp_soc *soc,
  113. struct dp_tx_desc_pool_s *tx_desc_pool,
  114. uint8_t pool_id);
  115. /**
  116. * dp_tx_compute_tx_delay_rh() - Compute HW Tx completion delay
  117. * @soc: Handle to DP Soc structure
  118. * @vdev: vdev
  119. * @ts: Tx completion status
  120. * @delay_us: Delay to be calculated in microseconds
  121. *
  122. * Return: QDF_STATUS
  123. */
  124. QDF_STATUS dp_tx_compute_tx_delay_rh(struct dp_soc *soc,
  125. struct dp_vdev *vdev,
  126. struct hal_tx_completion_status *ts,
  127. uint32_t *delay_us);
  128. /**
  129. * dp_tx_desc_pool_alloc_rh() - Allocate coherent memory for TCL descriptors
  130. * @soc: Handle to DP Soc structure
  131. * @num_elem: Number of elements to allocate
  132. * @pool_id: TCL descriptor pool ID
  133. *
  134. * Return: QDF_STATUS_SUCCESS - success, others - failure
  135. */
  136. QDF_STATUS dp_tx_desc_pool_alloc_rh(struct dp_soc *soc, uint32_t num_elem,
  137. uint8_t pool_id);
  138. /**
  139. * dp_tx_desc_pool_free_rh() - Free TCL descriptor memory
  140. * @soc: Handle to DP Soc structure
  141. * @pool_id: TCL descriptor pool ID
  142. *
  143. * Return: none
  144. */
  145. void dp_tx_desc_pool_free_rh(struct dp_soc *soc, uint8_t pool_id);
  146. /**
  147. * dp_tx_compl_handler_rh() - TX completion handler for Rhine
  148. * @soc: Handle to DP Soc structure
  149. * @htt_msg: TX completion HTT message
  150. *
  151. * Return: none
  152. */
  153. void dp_tx_compl_handler_rh(struct dp_soc *soc, qdf_nbuf_t htt_msg);
  154. #endif