dp_be_tx.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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_BE_TX_H
  19. #define __DP_BE_TX_H
  20. /**
  21. * DOC: dp_be_tx.h
  22. *
  23. * BE specific TX Datapath header file. Need not be exposed to common DP code.
  24. *
  25. */
  26. #include <dp_types.h>
  27. #include "dp_be.h"
  28. struct __attribute__((__packed__)) dp_tx_comp_peer_id {
  29. uint16_t peer_id:13,
  30. ml_peer_valid:1,
  31. reserved:2;
  32. };
  33. /* Invalid TX Bank ID value */
  34. #define DP_BE_INVALID_BANK_ID -1
  35. /**
  36. * dp_tx_hw_enqueue_be() - Enqueue to TCL HW for transmit for BE target
  37. * @soc: DP Soc Handle
  38. * @vdev: DP vdev handle
  39. * @tx_desc: Tx Descriptor Handle
  40. * @fw_metadata: Metadata to send to Target Firmware along with frame
  41. * @tx_exc_metadata: Handle that holds exception path meta data
  42. * @msdu_info: msdu_info containing information about TX buffer
  43. *
  44. * Gets the next free TCL HW DMA descriptor and sets up required parameters
  45. * from software Tx descriptor
  46. *
  47. * Return: QDF_STATUS_SUCCESS: success
  48. * QDF_STATUS_E_RESOURCES: Error return
  49. */
  50. QDF_STATUS dp_tx_hw_enqueue_be(struct dp_soc *soc, struct dp_vdev *vdev,
  51. struct dp_tx_desc_s *tx_desc,
  52. uint16_t fw_metadata,
  53. struct cdp_tx_exception_metadata *metadata,
  54. struct dp_tx_msdu_info_s *msdu_info);
  55. /**
  56. * dp_tx_comp_get_params_from_hal_desc_be() - Get TX desc from HAL comp desc
  57. * @soc: DP soc handle
  58. * @tx_comp_hal_desc: HAL TX Comp Descriptor
  59. * @r_tx_desc: SW Tx Descriptor retrieved from HAL desc.
  60. *
  61. * Return: None
  62. */
  63. void dp_tx_comp_get_params_from_hal_desc_be(struct dp_soc *soc,
  64. void *tx_comp_hal_desc,
  65. struct dp_tx_desc_s **r_tx_desc);
  66. /**
  67. * dp_tx_init_bank_profiles() - Init TX bank profiles
  68. * @soc: DP soc handle
  69. *
  70. * Return: QDF_STATUS_SUCCESS or QDF error code.
  71. */
  72. QDF_STATUS dp_tx_init_bank_profiles(struct dp_soc_be *soc);
  73. /**
  74. * dp_tx_deinit_bank_profiles() - De-Init TX bank profiles
  75. * @soc: DP soc handle
  76. *
  77. * Return: None
  78. */
  79. void dp_tx_deinit_bank_profiles(struct dp_soc_be *soc);
  80. /**
  81. * dp_tx_get_bank_profile() - get TX bank profile for vdev
  82. * @soc: DP soc handle
  83. * @be_vdev: BE vdev pointer
  84. *
  85. * Return: bank profile allocated to vdev or DP_BE_INVALID_BANK_ID
  86. */
  87. int dp_tx_get_bank_profile(struct dp_soc_be *soc,
  88. struct dp_vdev_be *be_vdev);
  89. /**
  90. * dp_tx_put_bank_profile() - release TX bank profile for vdev
  91. * @soc: DP soc handle
  92. *
  93. * Return: None
  94. */
  95. void dp_tx_put_bank_profile(struct dp_soc_be *soc, struct dp_vdev_be *be_vdev);
  96. /**
  97. * dp_tx_update_bank_profile() - release existing and allocate new bank profile
  98. * @soc: DP soc handle
  99. * @be_vdev: pointer to be_vdev structure
  100. *
  101. * The function releases the existing bank profile allocated to the vdev and
  102. * looks for a new bank profile based on updated dp_vdev TX params.
  103. *
  104. * Return: None
  105. */
  106. void dp_tx_update_bank_profile(struct dp_soc_be *be_soc,
  107. struct dp_vdev_be *be_vdev);
  108. /**
  109. * dp_tx_desc_pool_init_be() - Initialize Tx Descriptor pool(s)
  110. * @soc: Handle to DP Soc structure
  111. * @num_elem: number of descriptor in pool
  112. * @pool_id: pool ID to allocate
  113. *
  114. * Return: QDF_STATUS_SUCCESS - success, others - failure
  115. */
  116. QDF_STATUS dp_tx_desc_pool_init_be(struct dp_soc *soc,
  117. uint16_t num_elem,
  118. uint8_t pool_id);
  119. /**
  120. * dp_tx_desc_pool_deinit_be() - De-initialize Tx Descriptor pool(s)
  121. * @soc: Handle to DP Soc structure
  122. * @tx_desc_pool: Tx descriptor pool handler
  123. * @pool_id: pool ID to deinit
  124. *
  125. * Return: None
  126. */
  127. void dp_tx_desc_pool_deinit_be(struct dp_soc *soc,
  128. struct dp_tx_desc_pool_s *tx_desc_pool,
  129. uint8_t pool_id);
  130. #ifdef WLAN_FEATURE_NEAR_FULL_IRQ
  131. /**
  132. * dp_tx_comp_nf_handler() - Tx completion ring Near full scenario handler
  133. * @int_ctx: Interrupt context
  134. * @soc: Datapath SoC handle
  135. * @hal_ring_hdl: TX completion ring handle
  136. * @ring_id: TX completion ring number
  137. * @quota: Quota of the work to be done
  138. *
  139. * Return: work done
  140. */
  141. uint32_t dp_tx_comp_nf_handler(struct dp_intr *int_ctx, struct dp_soc *soc,
  142. hal_ring_handle_t hal_ring_hdl, uint8_t ring_id,
  143. uint32_t quota);
  144. #else
  145. static inline
  146. uint32_t dp_tx_comp_nf_handler(struct dp_intr *int_ctx, struct dp_soc *soc,
  147. hal_ring_handle_t hal_ring_hdl, uint8_t ring_id,
  148. uint32_t quota)
  149. {
  150. return 0;
  151. }
  152. #endif /* WLAN_FEATURE_NEAR_FULL_IRQ */
  153. #endif