dp_tx.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*
  2. * Copyright (c) 2016-2017 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_FREE_SINGLE_BUF(soc, buf) \
  33. do { \
  34. qdf_nbuf_unmap(soc->osdev, buf, QDF_DMA_TO_DEVICE); \
  35. qdf_nbuf_free(buf); \
  36. } while (0)
  37. #define DP_TX_FREE_DMA_TO_DEVICE(soc, vdev, buf) \
  38. do { \
  39. qdf_nbuf_unmap(soc->osdev, buf, QDF_DMA_TO_DEVICE); \
  40. if (!vdev->mesh_vdev) { \
  41. qdf_nbuf_free(buf); \
  42. } else { \
  43. vdev->osif_tx_free_ext((buf)); \
  44. } \
  45. } while (0)
  46. #define OCB_HEADER_VERSION 1
  47. /**
  48. * struct dp_tx_frag_info_s
  49. * @vaddr: hlos vritual address for buffer
  50. * @paddr_lo: physical address lower 32bits
  51. * @paddr_hi: physical address higher bits
  52. * @len: length of the buffer
  53. */
  54. struct dp_tx_frag_info_s {
  55. uint8_t *vaddr;
  56. uint32_t paddr_lo;
  57. uint16_t paddr_hi;
  58. uint16_t len;
  59. };
  60. /**
  61. * struct dp_tx_seg_info_s - Segmentation Descriptor
  62. * @nbuf: NBUF pointer if segment corresponds to separate nbuf
  63. * @frag_cnt: Fragment count in this segment
  64. * @total_len: Total length of segment
  65. * @frags: per-Fragment information
  66. * @next: pointer to next MSDU segment
  67. */
  68. struct dp_tx_seg_info_s {
  69. qdf_nbuf_t nbuf;
  70. uint16_t frag_cnt;
  71. uint16_t total_len;
  72. struct dp_tx_frag_info_s frags[DP_TX_MAX_NUM_FRAGS];
  73. struct dp_tx_seg_info_s *next;
  74. };
  75. /**
  76. * struct dp_tx_sg_info_s - Scatter Gather Descriptor
  77. * @num_segs: Number of segments (TSO/ME) in the frame
  78. * @total_len: Total length of the frame
  79. * @curr_seg: Points to current segment descriptor to be processed. Chain of
  80. * descriptors for SG frames/multicast-unicast converted packets.
  81. *
  82. * Used for SG (802.3 or Raw) frames and Multicast-Unicast converted frames to
  83. * carry fragmentation information
  84. * Raw Frames will be handed over to driver as an SKB chain with MPDU boundaries
  85. * indicated through flags in SKB CB (first_msdu and last_msdu). This will be
  86. * converted into set of skb sg (nr_frags) structures.
  87. */
  88. struct dp_tx_sg_info_s {
  89. uint32_t num_segs;
  90. uint32_t total_len;
  91. struct dp_tx_seg_info_s *curr_seg;
  92. };
  93. /**
  94. * struct dp_tx_queue - Tx queue
  95. * @desc_pool_id: Descriptor Pool to be used for the tx queue
  96. * @ring_id: TCL descriptor ring ID corresponding to the tx queue
  97. *
  98. * Tx queue contains information of the software (Descriptor pool)
  99. * and hardware resources (TCL ring id) to be used for a particular
  100. * transmit queue (obtained from skb_queue_mapping in case of linux)
  101. */
  102. struct dp_tx_queue {
  103. uint8_t desc_pool_id;
  104. uint8_t ring_id;
  105. };
  106. /**
  107. * struct dp_tx_msdu_info_s - MSDU Descriptor
  108. * @frm_type: Frame type - Regular/TSO/SG/Multicast enhancement
  109. * @tx_queue: Tx queue on which this MSDU should be transmitted
  110. * @num_seg: Number of segments (TSO)
  111. * @tid: TID (override) that is sent from HLOS
  112. * @u.tso_info: TSO information for TSO frame types
  113. * (chain of the TSO segments, number of segments)
  114. * @u.sg_info: Scatter Gather information for non-TSO SG frames
  115. *
  116. * This structure holds the complete MSDU information needed to program the
  117. * Hardware TCL and MSDU extension descriptors for different frame types
  118. *
  119. */
  120. struct dp_tx_msdu_info_s {
  121. enum dp_tx_frm_type frm_type;
  122. struct dp_tx_queue tx_queue;
  123. uint32_t num_seg;
  124. uint8_t tid;
  125. union {
  126. struct qdf_tso_info_t tso_info;
  127. struct dp_tx_sg_info_s sg_info;
  128. } u;
  129. uint32_t meta_data[5];
  130. };
  131. QDF_STATUS dp_tx_vdev_attach(struct dp_vdev *vdev);
  132. QDF_STATUS dp_tx_vdev_detach(struct dp_vdev *vdev);
  133. QDF_STATUS dp_tx_soc_attach(struct dp_soc *soc);
  134. QDF_STATUS dp_tx_soc_detach(struct dp_soc *soc);
  135. QDF_STATUS dp_tx_pdev_detach(struct dp_pdev *pdev);
  136. QDF_STATUS dp_tx_pdev_attach(struct dp_pdev *pdev);
  137. qdf_nbuf_t dp_tx_send(void *data_vdev, qdf_nbuf_t nbuf);
  138. uint32_t dp_tx_comp_handler(struct dp_soc *soc, uint32_t ring_id,
  139. uint32_t budget);
  140. int32_t
  141. dp_tx_prepare_send_me(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  142. /* TODO TX_FEATURE_NOT_YET */
  143. static inline void dp_tx_comp_process_exception(struct dp_tx_desc_s *tx_desc)
  144. {
  145. return;
  146. }
  147. static inline QDF_STATUS dp_tx_flow_control(struct dp_vdev *vdev)
  148. {
  149. return QDF_STATUS_SUCCESS;
  150. }
  151. /* TODO TX_FEATURE_NOT_YET */
  152. #endif