dp_tx.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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_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. *
  108. * This structure holds the complete MSDU information needed to program the
  109. * Hardware TCL and MSDU extension descriptors for different frame types
  110. *
  111. */
  112. struct dp_tx_msdu_info_s {
  113. enum dp_tx_frm_type frm_type;
  114. struct dp_tx_queue tx_queue;
  115. uint32_t num_seg;
  116. uint8_t tid;
  117. union {
  118. struct qdf_tso_info_t tso_info;
  119. struct dp_tx_sg_info_s sg_info;
  120. } u;
  121. uint32_t meta_data[5];
  122. };
  123. QDF_STATUS dp_tx_vdev_attach(struct dp_vdev *vdev);
  124. QDF_STATUS dp_tx_vdev_detach(struct dp_vdev *vdev);
  125. void dp_tx_vdev_update_search_flags(struct dp_vdev *vdev);
  126. QDF_STATUS dp_tx_soc_attach(struct dp_soc *soc);
  127. QDF_STATUS dp_tx_soc_detach(struct dp_soc *soc);
  128. QDF_STATUS dp_tx_pdev_detach(struct dp_pdev *pdev);
  129. QDF_STATUS dp_tx_pdev_attach(struct dp_pdev *pdev);
  130. qdf_nbuf_t dp_tx_send(void *data_vdev, qdf_nbuf_t nbuf);
  131. #ifdef CONVERGED_TDLS_ENABLE
  132. qdf_nbuf_t dp_tx_non_std(struct cdp_vdev *vdev_handle,
  133. enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list);
  134. #endif
  135. uint32_t dp_tx_comp_handler(struct dp_soc *soc, void *hal_srng, uint32_t quota);
  136. int32_t
  137. dp_tx_prepare_send_me(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  138. #ifndef CONVERGED_TDLS_ENABLE
  139. static inline void dp_tx_update_tdls_flags(struct dp_tx_desc_s *tx_desc)
  140. {
  141. return;
  142. }
  143. static inline void dp_non_std_tx_comp_free_buff(struct dp_tx_desc_s *tx_desc,
  144. struct dp_vdev *vdev)
  145. {
  146. return;
  147. }
  148. #endif
  149. #ifdef FEATURE_WDS
  150. void dp_tx_mec_handler(struct dp_vdev *vdev, uint8_t *status);
  151. #endif
  152. /* TODO TX_FEATURE_NOT_YET */
  153. static inline void dp_tx_comp_process_exception(struct dp_tx_desc_s *tx_desc)
  154. {
  155. return;
  156. }
  157. /* TODO TX_FEATURE_NOT_YET */
  158. #endif