dp_tx_capture.h 5.0 KB

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