i40e_trace.h 5.9 KB

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