dp_tx_capture.h 5.4 KB

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