dp_be_tx.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2022 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_TX_H
  20. #define __DP_BE_TX_H
  21. /**
  22. * DOC: dp_be_tx.h
  23. *
  24. * BE specific TX Datapath header file. Need not be exposed to common DP code.
  25. *
  26. */
  27. #include <dp_types.h>
  28. #include "dp_be.h"
  29. struct __attribute__((__packed__)) dp_tx_comp_peer_id {
  30. uint16_t peer_id:13,
  31. ml_peer_valid:1,
  32. reserved:2;
  33. };
  34. /* Invalid TX Bank ID value */
  35. #define DP_BE_INVALID_BANK_ID -1
  36. /* Extraction of msdu queue information from per packet sawf metadata */
  37. #define DP_TX_HLOS_TID_GET(_var) \
  38. (((_var) & 0x0e) >> 1)
  39. #define DP_TX_FLOW_OVERRIDE_GET(_var) \
  40. ((_var) & 0x1)
  41. #define DP_TX_WHO_CLFY_INF_SEL_GET(_var) \
  42. (((_var) & 0x30) >> 4)
  43. #define DP_TX_FLOW_OVERRIDE_ENABLE 0x1
  44. #define DP_TX_FAST_DESC_SIZE 24
  45. #define DP_TX_L3_L4_CSUM_ENABLE 0x1f
  46. /**
  47. * dp_tx_hw_enqueue_be() - Enqueue to TCL HW for transmit for BE target
  48. * @soc: DP Soc Handle
  49. * @vdev: DP vdev handle
  50. * @tx_desc: Tx Descriptor Handle
  51. * @fw_metadata: Metadata to send to Target Firmware along with frame
  52. * @tx_exc_metadata: Handle that holds exception path meta data
  53. * @msdu_info: msdu_info containing information about TX buffer
  54. *
  55. * Gets the next free TCL HW DMA descriptor and sets up required parameters
  56. * from software Tx descriptor
  57. *
  58. * Return: QDF_STATUS_SUCCESS: success
  59. * QDF_STATUS_E_RESOURCES: Error return
  60. */
  61. QDF_STATUS dp_tx_hw_enqueue_be(struct dp_soc *soc, struct dp_vdev *vdev,
  62. struct dp_tx_desc_s *tx_desc,
  63. uint16_t fw_metadata,
  64. struct cdp_tx_exception_metadata *metadata,
  65. struct dp_tx_msdu_info_s *msdu_info);
  66. /**
  67. * dp_tx_hw_enqueue_be() - This is a fast send API to directly enqueue to HW
  68. * @soc: DP Soc Handle
  69. * @vdev_id: DP vdev ID
  70. * @nbuf: network buffer to be transmitted
  71. *
  72. * Gets the next free TCL HW DMA descriptor and sets up required parameters
  73. * from software Tx descriptor
  74. *
  75. * Return: NULL for success
  76. * nbuf for failure
  77. */
  78. qdf_nbuf_t dp_tx_fast_send_be(struct cdp_soc_t *soc, uint8_t vdev_id,
  79. qdf_nbuf_t nbuf);
  80. /**
  81. * dp_tx_comp_get_params_from_hal_desc_be() - Get TX desc from HAL comp desc
  82. * @soc: DP soc handle
  83. * @tx_comp_hal_desc: HAL TX Comp Descriptor
  84. * @r_tx_desc: SW Tx Descriptor retrieved from HAL desc.
  85. *
  86. * Return: None
  87. */
  88. void dp_tx_comp_get_params_from_hal_desc_be(struct dp_soc *soc,
  89. void *tx_comp_hal_desc,
  90. struct dp_tx_desc_s **r_tx_desc);
  91. /**
  92. * dp_tx_process_htt_completion_be() - Tx HTT Completion Indication Handler
  93. * @soc: Handle to DP soc structure
  94. * @tx_desc: software descriptor head pointer
  95. * @status : Tx completion status from HTT descriptor
  96. * @ring_id: ring number
  97. *
  98. * This function will process HTT Tx indication messages from Target
  99. *
  100. * Return: none
  101. */
  102. void dp_tx_process_htt_completion_be(struct dp_soc *soc,
  103. struct dp_tx_desc_s *tx_desc,
  104. uint8_t *status,
  105. uint8_t ring_id);
  106. /**
  107. * dp_tx_init_bank_profiles() - Init TX bank profiles
  108. * @soc: DP soc handle
  109. *
  110. * Return: QDF_STATUS_SUCCESS or QDF error code.
  111. */
  112. QDF_STATUS dp_tx_init_bank_profiles(struct dp_soc_be *soc);
  113. /**
  114. * dp_tx_deinit_bank_profiles() - De-Init TX bank profiles
  115. * @soc: DP soc handle
  116. *
  117. * Return: None
  118. */
  119. void dp_tx_deinit_bank_profiles(struct dp_soc_be *soc);
  120. /**
  121. * dp_tx_get_bank_profile() - get TX bank profile for vdev
  122. * @soc: DP soc handle
  123. * @be_vdev: BE vdev pointer
  124. *
  125. * Return: bank profile allocated to vdev or DP_BE_INVALID_BANK_ID
  126. */
  127. int dp_tx_get_bank_profile(struct dp_soc_be *soc,
  128. struct dp_vdev_be *be_vdev);
  129. /**
  130. * dp_tx_put_bank_profile() - release TX bank profile for vdev
  131. * @soc: DP soc handle
  132. *
  133. * Return: None
  134. */
  135. void dp_tx_put_bank_profile(struct dp_soc_be *soc, struct dp_vdev_be *be_vdev);
  136. /**
  137. * dp_tx_update_bank_profile() - release existing and allocate new bank profile
  138. * @soc: DP soc handle
  139. * @be_vdev: pointer to be_vdev structure
  140. *
  141. * The function releases the existing bank profile allocated to the vdev and
  142. * looks for a new bank profile based on updated dp_vdev TX params.
  143. *
  144. * Return: None
  145. */
  146. void dp_tx_update_bank_profile(struct dp_soc_be *be_soc,
  147. struct dp_vdev_be *be_vdev);
  148. /**
  149. * dp_tx_desc_pool_init_be() - Initialize Tx Descriptor pool(s)
  150. * @soc: Handle to DP Soc structure
  151. * @num_elem: number of descriptor in pool
  152. * @pool_id: pool ID to allocate
  153. *
  154. * Return: QDF_STATUS_SUCCESS - success, others - failure
  155. */
  156. QDF_STATUS dp_tx_desc_pool_init_be(struct dp_soc *soc,
  157. uint32_t num_elem,
  158. uint8_t pool_id);
  159. /**
  160. * dp_tx_desc_pool_deinit_be() - De-initialize Tx Descriptor pool(s)
  161. * @soc: Handle to DP Soc structure
  162. * @tx_desc_pool: Tx descriptor pool handler
  163. * @pool_id: pool ID to deinit
  164. *
  165. * Return: None
  166. */
  167. void dp_tx_desc_pool_deinit_be(struct dp_soc *soc,
  168. struct dp_tx_desc_pool_s *tx_desc_pool,
  169. uint8_t pool_id);
  170. #ifdef WLAN_FEATURE_11BE_MLO
  171. /**
  172. * dp_tx_mlo_mcast_handler_be() - Tx handler for Mcast packets
  173. * @soc: Handle to DP Soc structure
  174. * @vdev: DP vdev handle
  175. * @nbuf: nbuf to be enqueued
  176. *
  177. * Return: None
  178. */
  179. void dp_tx_mlo_mcast_handler_be(struct dp_soc *soc,
  180. struct dp_vdev *vdev,
  181. qdf_nbuf_t nbuf);
  182. #ifdef WLAN_MCAST_MLO
  183. #ifdef WLAN_MLO_MULTI_CHIP
  184. /**
  185. * dp_tx_mlo_mcast_pkt_send() - handler to send MLO Mcast packets
  186. * @be_vdev: Handle to DP be_vdev structure
  187. * @ptnr_vdev: DP ptnr_vdev handle
  188. * @nbuf: nbuf to be enqueued
  189. *
  190. * Return: None
  191. */
  192. void dp_tx_mlo_mcast_pkt_send(struct dp_vdev_be *be_vdev,
  193. struct dp_vdev *ptnr_vdev,
  194. void *arg);
  195. /**
  196. * dp_tx_mcast_mlo_reinject_routing_set() - mlo mcast reinject routing handler
  197. * @be_vdev: Handle to DP be_vdev structure
  198. * @cmd: cmd to set TQM/FW based reinjection
  199. *
  200. * Return: None
  201. */
  202. void dp_tx_mcast_mlo_reinject_routing_set(struct dp_soc *soc, void *arg);
  203. #endif
  204. #endif
  205. #endif
  206. #ifdef WLAN_FEATURE_NEAR_FULL_IRQ
  207. /**
  208. * dp_tx_comp_nf_handler() - Tx completion ring Near full scenario handler
  209. * @int_ctx: Interrupt context
  210. * @soc: Datapath SoC handle
  211. * @hal_ring_hdl: TX completion ring handle
  212. * @ring_id: TX completion ring number
  213. * @quota: Quota of the work to be done
  214. *
  215. * Return: work done
  216. */
  217. uint32_t dp_tx_comp_nf_handler(struct dp_intr *int_ctx, struct dp_soc *soc,
  218. hal_ring_handle_t hal_ring_hdl, uint8_t ring_id,
  219. uint32_t quota);
  220. #else
  221. static inline
  222. uint32_t dp_tx_comp_nf_handler(struct dp_intr *int_ctx, struct dp_soc *soc,
  223. hal_ring_handle_t hal_ring_hdl, uint8_t ring_id,
  224. uint32_t quota)
  225. {
  226. return 0;
  227. }
  228. #endif /* WLAN_FEATURE_NEAR_FULL_IRQ */
  229. /**
  230. * dp_tx_compute_tx_delay_be() - Compute HW Tx completion delay
  231. * @soc: Handle to DP Soc structure
  232. * @vdev: vdev
  233. * @ts: Tx completion status
  234. * @delay_us: Delay to be calculated in microseconds
  235. *
  236. * Return: QDF_STATUS
  237. */
  238. QDF_STATUS dp_tx_compute_tx_delay_be(struct dp_soc *soc,
  239. struct dp_vdev *vdev,
  240. struct hal_tx_completion_status *ts,
  241. uint32_t *delay_us);
  242. #endif