dp_tx.h 5.5 KB

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