dp_tx_capture.h 6.0 KB

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