dp_tx_capture.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /*
  2. * Copyright (c) 2017-2019 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_CAPTURE_H_
  19. #define _DP_TX_CAPTURE_H_
  20. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  21. #define DP_TX_PPDU_PROC_MAX_DEPTH 512
  22. struct dp_soc;
  23. struct dp_pdev;
  24. struct dp_vdev;
  25. struct dp_peer;
  26. struct dp_tx_desc_s;
  27. struct dp_pdev_tx_capture {
  28. /* For deferred PPDU status processing */
  29. qdf_spinlock_t ppdu_stats_lock;
  30. qdf_workqueue_t *ppdu_stats_workqueue;
  31. qdf_work_t ppdu_stats_work;
  32. STAILQ_HEAD(, ppdu_info) ppdu_stats_queue;
  33. STAILQ_HEAD(, ppdu_info) ppdu_stats_defer_queue;
  34. uint32_t ppdu_stats_queue_depth;
  35. uint32_t ppdu_stats_defer_queue_depth;
  36. uint32_t ppdu_stats_next_sched;
  37. qdf_spinlock_t msdu_comp_q_list_lock;
  38. uint32_t missed_ppdu_id;
  39. uint32_t last_msdu_id;
  40. qdf_event_t miss_ppdu_event;
  41. uint32_t ppdu_dropped;
  42. };
  43. /* Tx TID */
  44. struct dp_tx_tid {
  45. /* TID */
  46. uint8_t tid;
  47. /* max ppdu_id in a tid */
  48. uint32_t max_ppdu_id;
  49. /* tx_tid lock */
  50. qdf_spinlock_t tid_lock;
  51. qdf_nbuf_queue_t msdu_comp_q;
  52. };
  53. struct dp_peer_tx_capture {
  54. struct dp_tx_tid tx_tid[DP_MAX_TIDS];
  55. /*
  56. * for a ppdu, framectrl and qos ctrl is same
  57. * for each ppdu, we update and used on rest of mpdu
  58. */
  59. uint32_t tx_wifi_ppdu_id;
  60. struct ieee80211_frame tx_wifi_hdr;
  61. struct ieee80211_qoscntl tx_qoscntl;
  62. };
  63. /*
  64. * dp_peer_tid_queue_init() – Initialize ppdu stats queue per TID
  65. * @peer: Datapath peer
  66. *
  67. */
  68. void dp_peer_tid_queue_init(struct dp_peer *peer);
  69. /*
  70. * dp_peer_tid_queue_cleanup() – remove ppdu stats queue per TID
  71. * @peer: Datapath peer
  72. *
  73. */
  74. void dp_peer_tid_queue_cleanup(struct dp_peer *peer);
  75. /*
  76. * dp_peer_update_80211_hdr: update 80211 hdr
  77. * @vdev: DP VDEV
  78. * @peer: DP PEER
  79. *
  80. * return: void
  81. */
  82. void dp_peer_update_80211_hdr(struct dp_vdev *vdev, struct dp_peer *peer);
  83. /**
  84. * dp_tx_ppdu_stats_attach - Initialize Tx PPDU stats and enhanced capture
  85. * @pdev: DP PDEV
  86. *
  87. * Return: none
  88. */
  89. void dp_tx_ppdu_stats_attach(struct dp_pdev *pdev);
  90. /**
  91. * dp_tx_ppdu_stats_detach - Cleanup Tx PPDU stats and enhanced capture
  92. * @pdev: DP PDEV
  93. *
  94. * Return: none
  95. */
  96. void dp_tx_ppdu_stats_detach(struct dp_pdev *pdev);
  97. /**
  98. * dp_process_ppdu_stats_update_failed_bitmap(): Function to
  99. * get ppdu stats update
  100. * @pdev: dp_pdev
  101. * @data: tx completion ppdu desc
  102. * @ppdu_id: ppdu id
  103. * @size: bitmap size
  104. *
  105. * return: status
  106. */
  107. void dp_process_ppdu_stats_update_failed_bitmap(struct dp_pdev *pdev,
  108. void *data,
  109. uint32_t ppdu_id,
  110. uint32_t size);
  111. /**
  112. * dp_update_msdu_to_list(): Function to queue msdu from wbm
  113. * @pdev: dp_pdev
  114. * @peer: dp_peer
  115. * @ts: hal tx completion status
  116. * @netbuf: msdu
  117. *
  118. * return: status
  119. */
  120. QDF_STATUS
  121. dp_update_msdu_to_list(struct dp_soc *soc,
  122. struct dp_pdev *pdev,
  123. struct dp_peer *peer,
  124. struct hal_tx_completion_status *ts,
  125. qdf_nbuf_t netbuf);
  126. /**
  127. * dp_tx_add_to_comp_queue() - add completion msdu to queue
  128. * @soc: DP Soc handle
  129. * @tx_desc: software Tx descriptor
  130. * @ts : Tx completion status from HAL/HTT descriptor
  131. * @peer: DP peer
  132. *
  133. * Return: none
  134. */
  135. QDF_STATUS dp_tx_add_to_comp_queue(struct dp_soc *soc,
  136. struct dp_tx_desc_s *desc,
  137. struct hal_tx_completion_status *ts,
  138. struct dp_peer *peer);
  139. /*
  140. * dp_config_enh_tx_capture()- API to enable/disable enhanced tx capture
  141. * @pdev_handle: DP_PDEV handle
  142. * @val: user provided value
  143. *
  144. * Return: QDF_STATUS
  145. */
  146. QDF_STATUS
  147. dp_config_enh_tx_capture(struct cdp_pdev *pdev_handle, uint8_t val);
  148. /*
  149. * dp_deliver_mgmt_frm: Process
  150. * @pdev: DP PDEV handle
  151. * @nbuf: buffer containing the htt_ppdu_stats_tx_mgmtctrl_payload_tlv
  152. *
  153. * return: void
  154. */
  155. void dp_deliver_mgmt_frm(struct dp_pdev *pdev, qdf_nbuf_t nbuf);
  156. /**
  157. * dp_tx_ppdu_stats_attach(): Function to initialize tx ppdu stats on attach
  158. * @pdev: dp_pdev
  159. *
  160. * return: status
  161. */
  162. void dp_tx_ppdu_stats_attach(struct dp_pdev *pdev);
  163. /**
  164. * dp_tx_ppdu_stats_detach(): Function to deinit tx ppdu stats on detach
  165. * @pdev: dp_pdev
  166. *
  167. * return: status
  168. */
  169. void dp_tx_ppdu_stats_detach(struct dp_pdev *pdev);
  170. /**
  171. * dp_process_ppdu_stats_process(): workqueue function for ppdu stats
  172. * @context: context
  173. *
  174. * return: status
  175. */
  176. void dp_tx_ppdu_stats_process(void *context);
  177. /**
  178. * dp_ppdu_desc_deliver(): Function to deliver Tx PPDU status descriptor
  179. * to upper layer
  180. * @pdev: DP pdev handle
  181. * @ppdu_info: per PPDU TLV descriptor
  182. *
  183. * return: void
  184. */
  185. void dp_ppdu_desc_deliver(struct dp_pdev *pdev,
  186. struct ppdu_info *ppdu_info);
  187. #endif
  188. #endif