dp_tx.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. * Copyright (c) 2016 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_STATS_ADD(x, y, z)
  24. #define DP_STATS_SUB(x, y, z)
  25. #define DP_STATS_MSDU_INCR(x, y, z)
  26. #define DP_TX_MAX_NUM_FRAGS 6
  27. #define DP_TX_DESC_FLAG_ALLOCATED 0x1
  28. #define DP_TX_DESC_FLAG_TO_FW 0x2
  29. #define DP_TX_DESC_FLAG_FRAG 0x4
  30. #define DP_TX_DESC_FLAG_RAW 0x8
  31. #define DP_TX_DESC_FLAG_MESH 0x10
  32. #define DP_TX_DESC_FLAG_QUEUED_TX 0x20
  33. #define DP_TX_DESC_FLAG_COMPLETED_TX 0x40
  34. #define DP_TX_FREE_SINGLE_BUF(soc, vdev, buf) \
  35. do { \
  36. qdf_nbuf_unmap(soc->osdev, buf, QDF_DMA_FROM_DEVICE); \
  37. qdf_nbuf_free(buf); \
  38. } while (0)
  39. #define OCB_HEADER_VERSION 1
  40. /**
  41. * struct dp_tx_frag_info_s
  42. * @vaddr: hlos vritual address for buffer
  43. * @paddr_lo: physical address lower 32bits
  44. * @paddr_hi: physical address higher bits
  45. * @len: length of the buffer
  46. */
  47. struct dp_tx_frag_info_s {
  48. uint8_t *vaddr;
  49. uint32_t paddr_lo;
  50. uint16_t paddr_hi;
  51. uint16_t len;
  52. };
  53. /**
  54. * struct dp_tx_seg_info_s - Segmentation Descriptor
  55. * @nbuf: NBUF pointer if segment corresponds to separate nbuf
  56. * @frag_cnt: Fragment count in this segment
  57. * @total_len: Total length of segment
  58. * @frags: per-Fragment information
  59. * @next: pointer to next MSDU segment
  60. */
  61. struct dp_tx_seg_info_s {
  62. qdf_nbuf_t nbuf;
  63. uint16_t frag_cnt;
  64. uint16_t total_len;
  65. struct dp_tx_frag_info_s frags[DP_TX_MAX_NUM_FRAGS];
  66. struct dp_tx_seg_info_s *next;
  67. };
  68. /**
  69. * struct dp_tx_sg_info_s - Scatter Gather Descriptor
  70. * @num_segs: Number of segments (TSO/ME) in the frame
  71. * @total_len: Total length of the frame
  72. * @curr_seg: Points to current segment descriptor to be processed. Chain of
  73. * descriptors for SG frames/multicast-unicast converted packets.
  74. *
  75. * Used for SG (802.3 or Raw) frames and Multicast-Unicast converted frames to
  76. * carry fragmentation information
  77. * Raw Frames will be handed over to driver as an SKB chain with MPDU boundaries
  78. * indicated through flags in SKB CB (first_msdu and last_msdu). This will be
  79. * converted into set of skb sg (nr_frags) structures.
  80. */
  81. struct dp_tx_sg_info_s {
  82. uint32_t num_segs;
  83. uint32_t total_len;
  84. struct dp_tx_seg_info_s *curr_seg;
  85. };
  86. /**
  87. * struct dp_tx_queue - Tx queue
  88. * @desc_pool_id: Descriptor Pool to be used for the tx queue
  89. * @ring_id: TCL descriptor ring ID corresponding to the tx queue
  90. *
  91. * Tx queue contains information of the software (Descriptor pool)
  92. * and hardware resources (TCL ring id) to be used for a particular
  93. * transmit queue (obtained from skb_queue_mapping in case of linux)
  94. */
  95. struct dp_tx_queue {
  96. uint8_t desc_pool_id;
  97. uint8_t ring_id;
  98. };
  99. /**
  100. * struct dp_tx_msdu_info_s - MSDU Descriptor
  101. * @frm_type: Frame type - Regular/TSO/SG/Multicast enhancement
  102. * @tx_queue: Tx queue on which this MSDU should be transmitted
  103. * @num_seg: Number of segments (TSO)
  104. * @tid: TID (override) that is sent from HLOS
  105. * @u.tso_info: TSO information for TSO frame types
  106. * (chain of the TSO segments, number of segments)
  107. * @u.sg_info: Scatter Gather information for non-TSO SG frames
  108. *
  109. * This structure holds the complete MSDU information needed to program the
  110. * Hardware TCL and MSDU extension descriptors for different frame types
  111. *
  112. */
  113. struct dp_tx_msdu_info_s {
  114. enum dp_tx_frm_type frm_type;
  115. struct dp_tx_queue tx_queue;
  116. uint32_t num_seg;
  117. uint8_t tid;
  118. union {
  119. struct qdf_tso_info_t tso_info;
  120. struct dp_tx_sg_info_s sg_info;
  121. } u;
  122. };
  123. struct meta_hdr_s {
  124. uint8_t magic;
  125. uint8_t flags;
  126. uint8_t channel;
  127. uint8_t keyix;
  128. uint8_t rssi;
  129. uint8_t silence;
  130. uint8_t power;
  131. uint8_t retries;
  132. uint8_t max_tries[2];
  133. uint8_t rates[2];
  134. uint8_t unused[4];
  135. };
  136. #define METAHDR_FLAG_TX (1<<0) /* packet transmission */
  137. #define METAHDR_FLAG_TX_FAIL (1<<1) /* transmission failed */
  138. #define METAHDR_FLAG_TX_USED_ALT_RATE (1<<2) /* used alternate bitrate */
  139. #define METAHDR_FLAG_AUTO_RATE (1<<5)
  140. #define METAHDR_FLAG_NOENCRYPT (1<<6)
  141. #define METAHDR_FLAG_NOQOS (1<<7)
  142. #define METAHDR_FLAG_RX_ERR (1<<3) /* failed crc check */
  143. #define METAHDR_FLAG_RX_MORE (1<<4) /* first part of a frag skb */
  144. #define METAHDR_FLAG_LOG (1<<7)
  145. #define METAHDR_FLAG_RX_4SS (1<<1) /* rx 4ss frame */
  146. QDF_STATUS dp_tx_vdev_attach(struct dp_vdev *vdev);
  147. QDF_STATUS dp_tx_vdev_detach(struct dp_vdev *vdev);
  148. QDF_STATUS dp_tx_soc_attach(struct dp_soc *soc);
  149. QDF_STATUS dp_tx_soc_detach(struct dp_soc *soc);
  150. QDF_STATUS dp_tx_pdev_detach(struct dp_pdev *pdev);
  151. QDF_STATUS dp_tx_pdev_attach(struct dp_pdev *pdev);
  152. qdf_nbuf_t dp_tx_send(void *data_vdev, qdf_nbuf_t nbuf);
  153. uint32_t dp_tx_comp_handler(struct dp_soc *soc, uint32_t ring_id,
  154. uint32_t budget);
  155. /* TODO TX_FEATURE_NOT_YET */
  156. static inline void dp_tx_comp_process_exception(struct dp_tx_desc_s *tx_desc)
  157. {
  158. return;
  159. }
  160. static inline QDF_STATUS dp_tx_flow_control(struct dp_vdev *vdev)
  161. {
  162. return QDF_STATUS_SUCCESS;
  163. }
  164. static inline QDF_STATUS dp_tx_prepare_tso(struct dp_vdev *vdev,
  165. qdf_nbuf_t nbuf, struct dp_tx_msdu_info_s *msdu_info)
  166. {
  167. return QDF_STATUS_SUCCESS;
  168. }
  169. static inline qdf_nbuf_t dp_tx_prepare_me(struct dp_vdev *vdev,
  170. qdf_nbuf_t nbuf, struct dp_tx_msdu_info_s *msdu_info)
  171. {
  172. return nbuf;
  173. }
  174. /* TODO TX_FEATURE_NOT_YET */
  175. #endif