dp_tx.h 5.0 KB

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