i40e_trace.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright(c) 2013 - 2018 Intel Corporation. */
  3. /* Modeled on trace-events-sample.h */
  4. /* The trace subsystem name for i40e will be "i40e".
  5. *
  6. * This file is named i40e_trace.h.
  7. *
  8. * Since this include file's name is different from the trace
  9. * subsystem name, we'll have to define TRACE_INCLUDE_FILE at the end
  10. * of this file.
  11. */
  12. #undef TRACE_SYSTEM
  13. #define TRACE_SYSTEM i40e
  14. /* See trace-events-sample.h for a detailed description of why this
  15. * guard clause is different from most normal include files.
  16. */
  17. #if !defined(_I40E_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
  18. #define _I40E_TRACE_H_
  19. #include <linux/tracepoint.h>
  20. /**
  21. * i40e_trace() macro enables shared code to refer to trace points
  22. * like:
  23. *
  24. * trace_i40e{,vf}_example(args...)
  25. *
  26. * ... as:
  27. *
  28. * i40e_trace(example, args...)
  29. *
  30. * ... to resolve to the PF or VF version of the tracepoint without
  31. * ifdefs, and to allow tracepoints to be disabled entirely at build
  32. * time.
  33. *
  34. * Trace point should always be referred to in the driver via this
  35. * macro.
  36. *
  37. * Similarly, i40e_trace_enabled(trace_name) wraps references to
  38. * trace_i40e{,vf}_<trace_name>_enabled() functions.
  39. */
  40. #define _I40E_TRACE_NAME(trace_name) (trace_ ## i40e ## _ ## trace_name)
  41. #define I40E_TRACE_NAME(trace_name) _I40E_TRACE_NAME(trace_name)
  42. #define i40e_trace(trace_name, args...) I40E_TRACE_NAME(trace_name)(args)
  43. #define i40e_trace_enabled(trace_name) I40E_TRACE_NAME(trace_name##_enabled)()
  44. /* Events common to PF and VF. Corresponding versions will be defined
  45. * for both, named trace_i40e_* and trace_i40evf_*. The i40e_trace()
  46. * macro above will select the right trace point name for the driver
  47. * being built from shared code.
  48. */
  49. /* Events related to a vsi & ring */
  50. DECLARE_EVENT_CLASS(
  51. i40e_tx_template,
  52. TP_PROTO(struct i40e_ring *ring,
  53. struct i40e_tx_desc *desc,
  54. struct i40e_tx_buffer *buf),
  55. TP_ARGS(ring, desc, buf),
  56. /* The convention here is to make the first fields in the
  57. * TP_STRUCT match the TP_PROTO exactly. This enables the use
  58. * of the args struct generated by the tplist tool (from the
  59. * bcc-tools package) to be used for those fields. To access
  60. * fields other than the tracepoint args will require the
  61. * tplist output to be adjusted.
  62. */
  63. TP_STRUCT__entry(
  64. __field(void*, ring)
  65. __field(void*, desc)
  66. __field(void*, buf)
  67. __string(devname, ring->netdev->name)
  68. ),
  69. TP_fast_assign(
  70. __entry->ring = ring;
  71. __entry->desc = desc;
  72. __entry->buf = buf;
  73. __assign_str(devname, ring->netdev->name);
  74. ),
  75. TP_printk(
  76. "netdev: %s ring: %p desc: %p buf %p",
  77. __get_str(devname), __entry->ring,
  78. __entry->desc, __entry->buf)
  79. );
  80. DEFINE_EVENT(
  81. i40e_tx_template, i40e_clean_tx_irq,
  82. TP_PROTO(struct i40e_ring *ring,
  83. struct i40e_tx_desc *desc,
  84. struct i40e_tx_buffer *buf),
  85. TP_ARGS(ring, desc, buf));
  86. DEFINE_EVENT(
  87. i40e_tx_template, i40e_clean_tx_irq_unmap,
  88. TP_PROTO(struct i40e_ring *ring,
  89. struct i40e_tx_desc *desc,
  90. struct i40e_tx_buffer *buf),
  91. TP_ARGS(ring, desc, buf));
  92. DECLARE_EVENT_CLASS(
  93. i40e_rx_template,
  94. TP_PROTO(struct i40e_ring *ring,
  95. union i40e_32byte_rx_desc *desc,
  96. struct sk_buff *skb),
  97. TP_ARGS(ring, desc, skb),
  98. TP_STRUCT__entry(
  99. __field(void*, ring)
  100. __field(void*, desc)
  101. __field(void*, skb)
  102. __string(devname, ring->netdev->name)
  103. ),
  104. TP_fast_assign(
  105. __entry->ring = ring;
  106. __entry->desc = desc;
  107. __entry->skb = skb;
  108. __assign_str(devname, ring->netdev->name);
  109. ),
  110. TP_printk(
  111. "netdev: %s ring: %p desc: %p skb %p",
  112. __get_str(devname), __entry->ring,
  113. __entry->desc, __entry->skb)
  114. );
  115. DEFINE_EVENT(
  116. i40e_rx_template, i40e_clean_rx_irq,
  117. TP_PROTO(struct i40e_ring *ring,
  118. union i40e_32byte_rx_desc *desc,
  119. struct sk_buff *skb),
  120. TP_ARGS(ring, desc, skb));
  121. DEFINE_EVENT(
  122. i40e_rx_template, i40e_clean_rx_irq_rx,
  123. TP_PROTO(struct i40e_ring *ring,
  124. union i40e_32byte_rx_desc *desc,
  125. struct sk_buff *skb),
  126. TP_ARGS(ring, desc, skb));
  127. DECLARE_EVENT_CLASS(
  128. i40e_xmit_template,
  129. TP_PROTO(struct sk_buff *skb,
  130. struct i40e_ring *ring),
  131. TP_ARGS(skb, ring),
  132. TP_STRUCT__entry(
  133. __field(void*, skb)
  134. __field(void*, ring)
  135. __string(devname, ring->netdev->name)
  136. ),
  137. TP_fast_assign(
  138. __entry->skb = skb;
  139. __entry->ring = ring;
  140. __assign_str(devname, ring->netdev->name);
  141. ),
  142. TP_printk(
  143. "netdev: %s skb: %p ring: %p",
  144. __get_str(devname), __entry->skb,
  145. __entry->ring)
  146. );
  147. DEFINE_EVENT(
  148. i40e_xmit_template, i40e_xmit_frame_ring,
  149. TP_PROTO(struct sk_buff *skb,
  150. struct i40e_ring *ring),
  151. TP_ARGS(skb, ring));
  152. DEFINE_EVENT(
  153. i40e_xmit_template, i40e_xmit_frame_ring_drop,
  154. TP_PROTO(struct sk_buff *skb,
  155. struct i40e_ring *ring),
  156. TP_ARGS(skb, ring));
  157. /* Events unique to the PF. */
  158. #endif /* _I40E_TRACE_H_ */
  159. /* This must be outside ifdef _I40E_TRACE_H */
  160. /* This trace include file is not located in the .../include/trace
  161. * with the kernel tracepoint definitions, because we're a loadable
  162. * module.
  163. */
  164. #undef TRACE_INCLUDE_PATH
  165. #define TRACE_INCLUDE_PATH .
  166. #undef TRACE_INCLUDE_FILE
  167. #define TRACE_INCLUDE_FILE i40e_trace
  168. #include <trace/define_trace.h>