qdf_tracepoint.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. /*
  2. * Copyright (c) 2021, 2023 Qualcomm Innovation Center, Inc. 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. /**
  19. * DOC: qdf_tracepoint.h
  20. * This file defines HLOS agnostic functions providing external interface
  21. * for triggering tracepoints.
  22. */
  23. #if !defined(_QDF_TRACEPOINT_H)
  24. #define _QDF_TRACEPOINT_H
  25. #include <i_qdf_tracepoint.h>
  26. #include <qdf_nbuf.h>
  27. #include <qdf_trace.h>
  28. #ifdef WLAN_TRACEPOINTS
  29. /**
  30. * qdf_trace_dp_packet() - Trace packet in tx or rx path
  31. * @nbuf: network buffer pointer
  32. * @dir: tx or rx direction
  33. * @tso_desc: TSO descriptor
  34. * @enq_time: tx hw enqueue wall clock time in milliseconds
  35. *
  36. * Return: None
  37. */
  38. void qdf_trace_dp_packet(qdf_nbuf_t nbuf, enum qdf_proto_dir dir,
  39. struct qdf_tso_seg_elem_t *tso_desc,
  40. uint64_t enq_time);
  41. #else
  42. static inline
  43. void qdf_trace_dp_packet(qdf_nbuf_t nbuf, enum qdf_proto_dir dir,
  44. struct qdf_tso_seg_elem_t *tso_desc,
  45. uint64_t enq_time)
  46. {
  47. }
  48. #endif
  49. /**
  50. * qdf_trace_dp_rx_tcp_pkt_enabled() - Get the dp_rx_tcp_pkt tracepoint
  51. * enabled or disabled state
  52. *
  53. * Return: True if the tracepoint is enabled else false
  54. */
  55. static inline
  56. bool qdf_trace_dp_rx_tcp_pkt_enabled(void)
  57. {
  58. return __qdf_trace_dp_rx_tcp_pkt_enabled();
  59. }
  60. /**
  61. * qdf_trace_dp_rx_tcp_pkt() - Trace tcp packet in rx direction
  62. * @nbuf: pointer to network buffer
  63. * @tcp_seq_num: TCP sequence number
  64. * @tcp_ack_num: TCP acknowlegment number
  65. * @srcport: TCP source port
  66. * @dstport: TCP destination port
  67. * @latency: latency in milliseconds
  68. *
  69. * Return: None
  70. */
  71. static inline
  72. void qdf_trace_dp_rx_tcp_pkt(qdf_nbuf_t nbuf, uint32_t tcp_seq_num,
  73. uint32_t tcp_ack_num, uint16_t srcport,
  74. uint16_t dstport, uint64_t latency)
  75. {
  76. __qdf_trace_dp_rx_tcp_pkt(nbuf, tcp_seq_num, tcp_ack_num,
  77. srcport, dstport, latency);
  78. }
  79. /**
  80. * qdf_trace_dp_tx_comp_tcp_pkt_enabled() - Get the dp_tx_comp_tcp_pkt
  81. * tracepoint enabled or disabled state
  82. *
  83. * Return: True if the tracepoint is enabled else false
  84. */
  85. static inline
  86. bool qdf_trace_dp_tx_comp_tcp_pkt_enabled(void)
  87. {
  88. return __qdf_trace_dp_tx_comp_tcp_pkt_enabled();
  89. }
  90. /**
  91. * qdf_trace_dp_tx_comp_tcp_pkt() - Trace tcp packet in tx completion
  92. * @nbuf: pointer to network buffer
  93. * @tcp_seq_num: TCP sequence number
  94. * @tcp_ack_num: TCP acknowlegment number
  95. * @srcport: TCP source port
  96. * @dstport: TCP destination port
  97. * @latency: latency in milliseconds
  98. *
  99. * Return: None
  100. */
  101. static inline
  102. void qdf_trace_dp_tx_comp_tcp_pkt(qdf_nbuf_t nbuf, uint32_t tcp_seq_num,
  103. uint32_t tcp_ack_num, uint16_t srcport,
  104. uint16_t dstport, uint64_t latency)
  105. {
  106. __qdf_trace_dp_tx_comp_tcp_pkt(nbuf, tcp_seq_num, tcp_ack_num, srcport,
  107. dstport, latency);
  108. }
  109. /**
  110. * qdf_trace_dp_rx_udp_pkt_enabled() - Get the dp_rx_udp_pkt tracepoint
  111. * enabled or disabled state
  112. *
  113. * Return: True if the tracepoint is enabled else false
  114. */
  115. static inline
  116. bool qdf_trace_dp_rx_udp_pkt_enabled(void)
  117. {
  118. return __qdf_trace_dp_rx_udp_pkt_enabled();
  119. }
  120. /**
  121. * qdf_trace_dp_rx_udp_pkt() - Trace udp packet in rx direction
  122. * @nbuf: pointer to network buffer
  123. * @ip_id: ip identification field
  124. * @srcport: UDP source port
  125. * @dstport: UDP destination port
  126. * @latency: latency in milliseconds
  127. *
  128. * Return: None
  129. */
  130. static inline
  131. void qdf_trace_dp_rx_udp_pkt(qdf_nbuf_t nbuf, uint16_t ip_id,
  132. uint16_t srcport, uint16_t dstport,
  133. uint64_t latency)
  134. {
  135. __qdf_trace_dp_rx_udp_pkt(nbuf, ip_id, srcport, dstport, latency);
  136. }
  137. /**
  138. * qdf_trace_dp_tx_comp_udp_pkt_enabled() - Get the dp_tx_comp_udp_pkt
  139. * tracepoint enabled or disabled state
  140. *
  141. * Return: True if the tracepoint is enabled else false
  142. */
  143. static inline
  144. bool qdf_trace_dp_tx_comp_udp_pkt_enabled(void)
  145. {
  146. return __qdf_trace_dp_tx_comp_udp_pkt_enabled();
  147. }
  148. /**
  149. * qdf_trace_dp_tx_comp_udp_pkt() - Trace udp packet in tx completion
  150. * @nbuf: pointer to network buffer
  151. * @ip_id: ip identification field
  152. * @srcport: UDP source port
  153. * @dstport: UDP destination port
  154. * @latency: latency in milliseconds
  155. *
  156. * Return: None
  157. */
  158. static inline
  159. void qdf_trace_dp_tx_comp_udp_pkt(qdf_nbuf_t nbuf, uint16_t ip_id,
  160. uint16_t srcport, uint16_t dstport,
  161. uint64_t latency)
  162. {
  163. __qdf_trace_dp_tx_comp_udp_pkt(nbuf, ip_id, srcport, dstport, latency);
  164. }
  165. /**
  166. * qdf_trace_dp_rx_pkt_enabled() - Get the dp_rx_pkt tracepoint
  167. * enabled or disabled state
  168. *
  169. * Return: True if the tracepoint is enabled else false
  170. */
  171. static inline
  172. bool qdf_trace_dp_rx_pkt_enabled(void)
  173. {
  174. return __qdf_trace_dp_rx_pkt_enabled();
  175. }
  176. /**
  177. * qdf_trace_dp_rx_pkt() - Trace non-tcp/udp packet in rx direction
  178. * @nbuf: pointer to network buffer
  179. * @ether_type: type in ethernet header
  180. * @latency: latency in milliseconds
  181. *
  182. * Return: None
  183. */
  184. static inline
  185. void qdf_trace_dp_rx_pkt(qdf_nbuf_t nbuf, uint16_t ether_type,
  186. uint64_t latency)
  187. {
  188. __qdf_trace_dp_rx_pkt(nbuf, ether_type, latency);
  189. }
  190. /**
  191. * qdf_trace_dp_tx_comp_pkt_enabled() - Get the dp_tx_comp_pkt tracepoint
  192. * enabled or disabled state
  193. *
  194. * Return: True if the tracepoint is enabled else false
  195. */
  196. static inline
  197. bool qdf_trace_dp_tx_comp_pkt_enabled(void)
  198. {
  199. return __qdf_trace_dp_tx_comp_pkt_enabled();
  200. }
  201. /**
  202. * qdf_trace_dp_tx_comp_pkt() - Trace non-tcp/udp packet in rx direction
  203. * @nbuf: pointer to network buffer
  204. * @ether_type: type in ethernet header
  205. * @latency: latency in milliseconds
  206. *
  207. * Return: None
  208. */
  209. static inline
  210. void qdf_trace_dp_tx_comp_pkt(qdf_nbuf_t nbuf, uint16_t ether_type,
  211. uint64_t latency)
  212. {
  213. __qdf_trace_dp_tx_comp_pkt(nbuf, ether_type, latency);
  214. }
  215. /**
  216. * qdf_trace_dp_del_reg_write_enabled() - Get the dp_del_reg_write tracepoint
  217. * enabled or disabled state
  218. *
  219. * Return: True if the tracepoint is enabled else false
  220. */
  221. static inline
  222. bool qdf_trace_dp_del_reg_write_enabled(void)
  223. {
  224. return __qdf_trace_dp_del_reg_write_enabled();
  225. }
  226. /**
  227. * qdf_trace_dp_del_reg_write() - Trace delayed register writes
  228. * @srng_id: srng id
  229. * @enq_val: enqueue value
  230. * @deq_val: dequeue value
  231. * @enq_time: enqueue time in qtimer ticks
  232. * @deq_time: dequeue time in qtimer ticks
  233. *
  234. * Return: None
  235. */
  236. static inline
  237. void qdf_trace_dp_del_reg_write(uint8_t srng_id, uint32_t enq_val,
  238. uint32_t deq_val, uint64_t enq_time,
  239. uint64_t deq_time)
  240. {
  241. __qdf_trace_dp_del_reg_write(srng_id, enq_val, deq_val, enq_time,
  242. deq_time);
  243. }
  244. /**
  245. * qdf_trace_dp_ce_tasklet_sched_latency_enabled() - Get the
  246. * dp_ce_tasklet_sched_latency tracepoint enabled or disabled state
  247. *
  248. * Return: True if the tracepoint is enabled else false
  249. */
  250. static inline
  251. bool qdf_trace_dp_ce_tasklet_sched_latency_enabled(void)
  252. {
  253. return __qdf_trace_dp_ce_tasklet_sched_latency_enabled();
  254. }
  255. /**
  256. * qdf_trace_dp_ce_tasklet_sched_latency() - Trace ce tasklet scheduling
  257. * latency
  258. * @ce_id: ce id
  259. * @sched_latency: ce tasklet sched latency in nanoseconds
  260. *
  261. * Return: None
  262. */
  263. static inline void
  264. qdf_trace_dp_ce_tasklet_sched_latency(uint8_t ce_id, uint64_t sched_latency)
  265. {
  266. __qdf_trace_dp_ce_tasklet_sched_latency(ce_id, sched_latency);
  267. }
  268. #endif /* _QDF_TRACEPOINT_H */