i40e_trace.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /*******************************************************************************
  2. *
  3. * Intel(R) 40-10 Gigabit Ethernet Virtual Function Driver
  4. * Copyright(c) 2013 - 2017 Intel Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. * The full GNU General Public License is included in this distribution in
  16. * the file called "COPYING".
  17. *
  18. * Contact Information:
  19. * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  20. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  21. *
  22. ******************************************************************************/
  23. /* Modeled on trace-events-sample.h */
  24. /* The trace subsystem name for i40evf will be "i40evf".
  25. *
  26. * This file is named i40e_trace.h.
  27. *
  28. * Since this include file's name is different from the trace
  29. * subsystem name, we'll have to define TRACE_INCLUDE_FILE at the end
  30. * of this file.
  31. */
  32. #undef TRACE_SYSTEM
  33. #define TRACE_SYSTEM i40evf
  34. /* See trace-events-sample.h for a detailed description of why this
  35. * guard clause is different from most normal include files.
  36. */
  37. #if !defined(_I40E_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
  38. #define _I40E_TRACE_H_
  39. #include <linux/tracepoint.h>
  40. /**
  41. * i40e_trace() macro enables shared code to refer to trace points
  42. * like:
  43. *
  44. * trace_i40e{,vf}_example(args...)
  45. *
  46. * ... as:
  47. *
  48. * i40e_trace(example, args...)
  49. *
  50. * ... to resolve to the PF or VF version of the tracepoint without
  51. * ifdefs, and to allow tracepoints to be disabled entirely at build
  52. * time.
  53. *
  54. * Trace point should always be referred to in the driver via this
  55. * macro.
  56. *
  57. * Similarly, i40e_trace_enabled(trace_name) wraps references to
  58. * trace_i40e{,vf}_<trace_name>_enabled() functions.
  59. */
  60. #define _I40E_TRACE_NAME(trace_name) (trace_ ## i40evf ## _ ## trace_name)
  61. #define I40E_TRACE_NAME(trace_name) _I40E_TRACE_NAME(trace_name)
  62. #define i40e_trace(trace_name, args...) I40E_TRACE_NAME(trace_name)(args)
  63. #define i40e_trace_enabled(trace_name) I40E_TRACE_NAME(trace_name##_enabled)()
  64. /* Events common to PF and VF. Corresponding versions will be defined
  65. * for both, named trace_i40e_* and trace_i40evf_*. The i40e_trace()
  66. * macro above will select the right trace point name for the driver
  67. * being built from shared code.
  68. */
  69. /* Events related to a vsi & ring */
  70. DECLARE_EVENT_CLASS(
  71. i40evf_tx_template,
  72. TP_PROTO(struct i40e_ring *ring,
  73. struct i40e_tx_desc *desc,
  74. struct i40e_tx_buffer *buf),
  75. TP_ARGS(ring, desc, buf),
  76. /* The convention here is to make the first fields in the
  77. * TP_STRUCT match the TP_PROTO exactly. This enables the use
  78. * of the args struct generated by the tplist tool (from the
  79. * bcc-tools package) to be used for those fields. To access
  80. * fields other than the tracepoint args will require the
  81. * tplist output to be adjusted.
  82. */
  83. TP_STRUCT__entry(
  84. __field(void*, ring)
  85. __field(void*, desc)
  86. __field(void*, buf)
  87. __string(devname, ring->netdev->name)
  88. ),
  89. TP_fast_assign(
  90. __entry->ring = ring;
  91. __entry->desc = desc;
  92. __entry->buf = buf;
  93. __assign_str(devname, ring->netdev->name);
  94. ),
  95. TP_printk(
  96. "netdev: %s ring: %p desc: %p buf %p",
  97. __get_str(devname), __entry->ring,
  98. __entry->desc, __entry->buf)
  99. );
  100. DEFINE_EVENT(
  101. i40evf_tx_template, i40evf_clean_tx_irq,
  102. TP_PROTO(struct i40e_ring *ring,
  103. struct i40e_tx_desc *desc,
  104. struct i40e_tx_buffer *buf),
  105. TP_ARGS(ring, desc, buf));
  106. DEFINE_EVENT(
  107. i40evf_tx_template, i40evf_clean_tx_irq_unmap,
  108. TP_PROTO(struct i40e_ring *ring,
  109. struct i40e_tx_desc *desc,
  110. struct i40e_tx_buffer *buf),
  111. TP_ARGS(ring, desc, buf));
  112. DECLARE_EVENT_CLASS(
  113. i40evf_rx_template,
  114. TP_PROTO(struct i40e_ring *ring,
  115. union i40e_32byte_rx_desc *desc,
  116. struct sk_buff *skb),
  117. TP_ARGS(ring, desc, skb),
  118. TP_STRUCT__entry(
  119. __field(void*, ring)
  120. __field(void*, desc)
  121. __field(void*, skb)
  122. __string(devname, ring->netdev->name)
  123. ),
  124. TP_fast_assign(
  125. __entry->ring = ring;
  126. __entry->desc = desc;
  127. __entry->skb = skb;
  128. __assign_str(devname, ring->netdev->name);
  129. ),
  130. TP_printk(
  131. "netdev: %s ring: %p desc: %p skb %p",
  132. __get_str(devname), __entry->ring,
  133. __entry->desc, __entry->skb)
  134. );
  135. DEFINE_EVENT(
  136. i40evf_rx_template, i40evf_clean_rx_irq,
  137. TP_PROTO(struct i40e_ring *ring,
  138. union i40e_32byte_rx_desc *desc,
  139. struct sk_buff *skb),
  140. TP_ARGS(ring, desc, skb));
  141. DEFINE_EVENT(
  142. i40evf_rx_template, i40evf_clean_rx_irq_rx,
  143. TP_PROTO(struct i40e_ring *ring,
  144. union i40e_32byte_rx_desc *desc,
  145. struct sk_buff *skb),
  146. TP_ARGS(ring, desc, skb));
  147. DECLARE_EVENT_CLASS(
  148. i40evf_xmit_template,
  149. TP_PROTO(struct sk_buff *skb,
  150. struct i40e_ring *ring),
  151. TP_ARGS(skb, ring),
  152. TP_STRUCT__entry(
  153. __field(void*, skb)
  154. __field(void*, ring)
  155. __string(devname, ring->netdev->name)
  156. ),
  157. TP_fast_assign(
  158. __entry->skb = skb;
  159. __entry->ring = ring;
  160. __assign_str(devname, ring->netdev->name);
  161. ),
  162. TP_printk(
  163. "netdev: %s skb: %p ring: %p",
  164. __get_str(devname), __entry->skb,
  165. __entry->ring)
  166. );
  167. DEFINE_EVENT(
  168. i40evf_xmit_template, i40evf_xmit_frame_ring,
  169. TP_PROTO(struct sk_buff *skb,
  170. struct i40e_ring *ring),
  171. TP_ARGS(skb, ring));
  172. DEFINE_EVENT(
  173. i40evf_xmit_template, i40evf_xmit_frame_ring_drop,
  174. TP_PROTO(struct sk_buff *skb,
  175. struct i40e_ring *ring),
  176. TP_ARGS(skb, ring));
  177. /* Events unique to the VF. */
  178. #endif /* _I40E_TRACE_H_ */
  179. /* This must be outside ifdef _I40E_TRACE_H */
  180. /* This trace include file is not located in the .../include/trace
  181. * with the kernel tracepoint definitions, because we're a loadable
  182. * module.
  183. */
  184. #undef TRACE_INCLUDE_PATH
  185. #define TRACE_INCLUDE_PATH .
  186. #undef TRACE_INCLUDE_FILE
  187. #define TRACE_INCLUDE_FILE i40e_trace
  188. #include <trace/define_trace.h>