dp_tx.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. /*
  2. * Copyright (c) 2016-2019 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_TX_H
  19. #define __DP_TX_H
  20. #include <qdf_types.h>
  21. #include <qdf_nbuf.h>
  22. #include "dp_types.h"
  23. #define DP_TX_MAX_NUM_FRAGS 6
  24. #define DP_TX_DESC_FLAG_ALLOCATED 0x1
  25. #define DP_TX_DESC_FLAG_TO_FW 0x2
  26. #define DP_TX_DESC_FLAG_FRAG 0x4
  27. #define DP_TX_DESC_FLAG_RAW 0x8
  28. #define DP_TX_DESC_FLAG_MESH 0x10
  29. #define DP_TX_DESC_FLAG_QUEUED_TX 0x20
  30. #define DP_TX_DESC_FLAG_COMPLETED_TX 0x40
  31. #define DP_TX_DESC_FLAG_ME 0x80
  32. #define DP_TX_DESC_FLAG_TDLS_FRAME 0x100
  33. #define DP_TX_FREE_SINGLE_BUF(soc, buf) \
  34. do { \
  35. qdf_nbuf_unmap(soc->osdev, buf, QDF_DMA_TO_DEVICE); \
  36. qdf_nbuf_free(buf); \
  37. } while (0)
  38. #define OCB_HEADER_VERSION 1
  39. /**
  40. * struct dp_tx_frag_info_s
  41. * @vaddr: hlos vritual address for buffer
  42. * @paddr_lo: physical address lower 32bits
  43. * @paddr_hi: physical address higher bits
  44. * @len: length of the buffer
  45. */
  46. struct dp_tx_frag_info_s {
  47. uint8_t *vaddr;
  48. uint32_t paddr_lo;
  49. uint16_t paddr_hi;
  50. uint16_t len;
  51. };
  52. /**
  53. * struct dp_tx_seg_info_s - Segmentation Descriptor
  54. * @nbuf: NBUF pointer if segment corresponds to separate nbuf
  55. * @frag_cnt: Fragment count in this segment
  56. * @total_len: Total length of segment
  57. * @frags: per-Fragment information
  58. * @next: pointer to next MSDU segment
  59. */
  60. struct dp_tx_seg_info_s {
  61. qdf_nbuf_t nbuf;
  62. uint16_t frag_cnt;
  63. uint16_t total_len;
  64. struct dp_tx_frag_info_s frags[DP_TX_MAX_NUM_FRAGS];
  65. struct dp_tx_seg_info_s *next;
  66. };
  67. /**
  68. * struct dp_tx_sg_info_s - Scatter Gather Descriptor
  69. * @num_segs: Number of segments (TSO/ME) in the frame
  70. * @total_len: Total length of the frame
  71. * @curr_seg: Points to current segment descriptor to be processed. Chain of
  72. * descriptors for SG frames/multicast-unicast converted packets.
  73. *
  74. * Used for SG (802.3 or Raw) frames and Multicast-Unicast converted frames to
  75. * carry fragmentation information
  76. * Raw Frames will be handed over to driver as an SKB chain with MPDU boundaries
  77. * indicated through flags in SKB CB (first_msdu and last_msdu). This will be
  78. * converted into set of skb sg (nr_frags) structures.
  79. */
  80. struct dp_tx_sg_info_s {
  81. uint32_t num_segs;
  82. uint32_t total_len;
  83. struct dp_tx_seg_info_s *curr_seg;
  84. };
  85. /**
  86. * struct dp_tx_queue - Tx queue
  87. * @desc_pool_id: Descriptor Pool to be used for the tx queue
  88. * @ring_id: TCL descriptor ring ID corresponding to the tx queue
  89. *
  90. * Tx queue contains information of the software (Descriptor pool)
  91. * and hardware resources (TCL ring id) to be used for a particular
  92. * transmit queue (obtained from skb_queue_mapping in case of linux)
  93. */
  94. struct dp_tx_queue {
  95. uint8_t desc_pool_id;
  96. uint8_t ring_id;
  97. };
  98. /**
  99. * struct dp_tx_msdu_info_s - MSDU Descriptor
  100. * @frm_type: Frame type - Regular/TSO/SG/Multicast enhancement
  101. * @tx_queue: Tx queue on which this MSDU should be transmitted
  102. * @num_seg: Number of segments (TSO)
  103. * @tid: TID (override) that is sent from HLOS
  104. * @u.tso_info: TSO information for TSO frame types
  105. * (chain of the TSO segments, number of segments)
  106. * @u.sg_info: Scatter Gather information for non-TSO SG frames
  107. * @meta_data: Mesh meta header information
  108. * @exception_fw: Duplicate frame to be sent to firmware
  109. *
  110. * This structure holds the complete MSDU information needed to program the
  111. * Hardware TCL and MSDU extension descriptors for different frame types
  112. *
  113. */
  114. struct dp_tx_msdu_info_s {
  115. enum dp_tx_frm_type frm_type;
  116. struct dp_tx_queue tx_queue;
  117. uint32_t num_seg;
  118. uint8_t tid;
  119. union {
  120. struct qdf_tso_info_t tso_info;
  121. struct dp_tx_sg_info_s sg_info;
  122. } u;
  123. uint32_t meta_data[6];
  124. uint8_t exception_fw;
  125. };
  126. QDF_STATUS dp_tx_vdev_attach(struct dp_vdev *vdev);
  127. QDF_STATUS dp_tx_vdev_detach(struct dp_vdev *vdev);
  128. void dp_tx_vdev_update_search_flags(struct dp_vdev *vdev);
  129. QDF_STATUS dp_tx_soc_attach(struct dp_soc *soc);
  130. QDF_STATUS dp_tx_soc_detach(struct dp_soc *soc);
  131. /**
  132. * dp_tso_attach() - TSO Attach handler
  133. * @txrx_soc: Opaque Dp handle
  134. *
  135. * Reserve TSO descriptor buffers
  136. *
  137. * Return: QDF_STATUS_E_FAILURE on failure or
  138. * QDF_STATUS_SUCCESS on success
  139. */
  140. QDF_STATUS dp_tso_soc_attach(void *txrx_soc);
  141. /**
  142. * dp_tso_detach() - TSO Detach handler
  143. * @txrx_soc: Opaque Dp handle
  144. *
  145. * Deallocate TSO descriptor buffers
  146. *
  147. * Return: QDF_STATUS_E_FAILURE on failure or
  148. * QDF_STATUS_SUCCESS on success
  149. */
  150. QDF_STATUS dp_tso_soc_detach(void *txrx_soc);
  151. QDF_STATUS dp_tx_pdev_detach(struct dp_pdev *pdev);
  152. QDF_STATUS dp_tx_pdev_attach(struct dp_pdev *pdev);
  153. qdf_nbuf_t dp_tx_send(void *data_vdev, qdf_nbuf_t nbuf);
  154. qdf_nbuf_t dp_tx_send_exception(void *data_vdev, qdf_nbuf_t nbuf,
  155. struct cdp_tx_exception_metadata *tx_exc);
  156. qdf_nbuf_t dp_tx_send_mesh(void *data_vdev, qdf_nbuf_t nbuf);
  157. #ifdef FEATURE_WLAN_TDLS
  158. qdf_nbuf_t dp_tx_non_std(struct cdp_vdev *vdev_handle,
  159. enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list);
  160. #endif
  161. uint32_t dp_tx_comp_handler(struct dp_soc *soc, void *hal_srng, uint32_t quota);
  162. QDF_STATUS
  163. dp_tx_prepare_send_me(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  164. #ifdef FEATURE_WDS
  165. void dp_tx_mec_handler(struct dp_vdev *vdev, uint8_t *status);
  166. #else
  167. static inline void dp_tx_mec_handler(struct dp_vdev *vdev, uint8_t *status)
  168. {
  169. return;
  170. }
  171. #endif
  172. #ifdef ATH_SUPPORT_IQUE
  173. void dp_tx_me_exit(struct dp_pdev *pdev);
  174. #else
  175. static inline void dp_tx_me_exit(struct dp_pdev *pdev)
  176. {
  177. return;
  178. }
  179. #endif
  180. #ifdef FEATURE_PERPKT_INFO
  181. QDF_STATUS
  182. dp_get_completion_indication_for_stack(struct dp_soc *soc,
  183. struct dp_pdev *pdev,
  184. struct dp_peer *peer,
  185. struct hal_tx_completion_status *ts,
  186. qdf_nbuf_t netbuf,
  187. uint64_t time_latency);
  188. void dp_send_completion_to_stack(struct dp_soc *soc, struct dp_pdev *pdev,
  189. uint16_t peer_id, uint32_t ppdu_id,
  190. qdf_nbuf_t netbuf);
  191. #endif
  192. void dp_iterate_update_peer_list(void *pdev_hdl);
  193. #ifdef ATH_TX_PRI_OVERRIDE
  194. #define DP_TX_TID_OVERRIDE(_msdu_info, _nbuf) \
  195. ((_msdu_info)->tid = qdf_nbuf_get_priority(_nbuf))
  196. #else
  197. #define DP_TX_TID_OVERRIDE(_msdu_info, _nbuf)
  198. #endif
  199. /* TODO TX_FEATURE_NOT_YET */
  200. static inline void dp_tx_comp_process_exception(struct dp_tx_desc_s *tx_desc)
  201. {
  202. return;
  203. }
  204. /* TODO TX_FEATURE_NOT_YET */
  205. #endif