blob: d3e55f54a05e2007399f457e01c7424b5196c9ed [file] [log] [blame]
Scott Petersoned0980c2017-04-13 04:45:44 -04001/*******************************************************************************
2 *
3 * Intel(R) 40-10 Gigabit Ethernet Connection Network 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
24/* Modeled on trace-events-sample.h */
25
26/* The trace subsystem name for i40e will be "i40e".
27 *
28 * This file is named i40e_trace.h.
29 *
30 * Since this include file's name is different from the trace
31 * subsystem name, we'll have to define TRACE_INCLUDE_FILE at the end
32 * of this file.
33 */
34#undef TRACE_SYSTEM
35#define TRACE_SYSTEM i40e
36
37/* See trace-events-sample.h for a detailed description of why this
38 * guard clause is different from most normal include files.
39 */
40#if !defined(_I40E_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
41#define _I40E_TRACE_H_
42
43#include <linux/tracepoint.h>
44
45/**
46 * i40e_trace() macro enables shared code to refer to trace points
47 * like:
48 *
49 * trace_i40e{,vf}_example(args...)
50 *
51 * ... as:
52 *
53 * i40e_trace(example, args...)
54 *
55 * ... to resolve to the PF or VF version of the tracepoint without
56 * ifdefs, and to allow tracepoints to be disabled entirely at build
57 * time.
58 *
59 * Trace point should always be referred to in the driver via this
60 * macro.
61 *
62 * Similarly, i40e_trace_enabled(trace_name) wraps references to
63 * trace_i40e{,vf}_<trace_name>_enabled() functions.
64 */
65#define _I40E_TRACE_NAME(trace_name) (trace_ ## i40e ## _ ## trace_name)
66#define I40E_TRACE_NAME(trace_name) _I40E_TRACE_NAME(trace_name)
67
68#define i40e_trace(trace_name, args...) I40E_TRACE_NAME(trace_name)(args)
69
70#define i40e_trace_enabled(trace_name) I40E_TRACE_NAME(trace_name##_enabled)()
71
72/* Events common to PF and VF. Corresponding versions will be defined
73 * for both, named trace_i40e_* and trace_i40evf_*. The i40e_trace()
74 * macro above will select the right trace point name for the driver
75 * being built from shared code.
76 */
77
78/* Events related to a vsi & ring */
79DECLARE_EVENT_CLASS(
80 i40e_tx_template,
81
82 TP_PROTO(struct i40e_ring *ring,
83 struct i40e_tx_desc *desc,
84 struct i40e_tx_buffer *buf),
85
86 TP_ARGS(ring, desc, buf),
87
88 /* The convention here is to make the first fields in the
89 * TP_STRUCT match the TP_PROTO exactly. This enables the use
90 * of the args struct generated by the tplist tool (from the
91 * bcc-tools package) to be used for those fields. To access
92 * fields other than the tracepoint args will require the
93 * tplist output to be adjusted.
94 */
95 TP_STRUCT__entry(
96 __field(void*, ring)
97 __field(void*, desc)
98 __field(void*, buf)
99 __string(devname, ring->netdev->name)
100 ),
101
102 TP_fast_assign(
103 __entry->ring = ring;
104 __entry->desc = desc;
105 __entry->buf = buf;
106 __assign_str(devname, ring->netdev->name);
107 ),
108
109 TP_printk(
110 "netdev: %s ring: %p desc: %p buf %p",
111 __get_str(devname), __entry->ring,
112 __entry->desc, __entry->buf)
113);
114
115DEFINE_EVENT(
116 i40e_tx_template, i40e_clean_tx_irq,
117 TP_PROTO(struct i40e_ring *ring,
118 struct i40e_tx_desc *desc,
119 struct i40e_tx_buffer *buf),
120
121 TP_ARGS(ring, desc, buf));
122
123DEFINE_EVENT(
124 i40e_tx_template, i40e_clean_tx_irq_unmap,
125 TP_PROTO(struct i40e_ring *ring,
126 struct i40e_tx_desc *desc,
127 struct i40e_tx_buffer *buf),
128
129 TP_ARGS(ring, desc, buf));
130
131DECLARE_EVENT_CLASS(
132 i40e_rx_template,
133
134 TP_PROTO(struct i40e_ring *ring,
135 union i40e_32byte_rx_desc *desc,
136 struct sk_buff *skb),
137
138 TP_ARGS(ring, desc, skb),
139
140 TP_STRUCT__entry(
141 __field(void*, ring)
142 __field(void*, desc)
143 __field(void*, skb)
144 __string(devname, ring->netdev->name)
145 ),
146
147 TP_fast_assign(
148 __entry->ring = ring;
149 __entry->desc = desc;
150 __entry->skb = skb;
151 __assign_str(devname, ring->netdev->name);
152 ),
153
154 TP_printk(
155 "netdev: %s ring: %p desc: %p skb %p",
156 __get_str(devname), __entry->ring,
157 __entry->desc, __entry->skb)
158);
159
160DEFINE_EVENT(
161 i40e_rx_template, i40e_clean_rx_irq,
162 TP_PROTO(struct i40e_ring *ring,
163 union i40e_32byte_rx_desc *desc,
164 struct sk_buff *skb),
165
166 TP_ARGS(ring, desc, skb));
167
168DEFINE_EVENT(
169 i40e_rx_template, i40e_clean_rx_irq_rx,
170 TP_PROTO(struct i40e_ring *ring,
171 union i40e_32byte_rx_desc *desc,
172 struct sk_buff *skb),
173
174 TP_ARGS(ring, desc, skb));
175
176DECLARE_EVENT_CLASS(
177 i40e_xmit_template,
178
179 TP_PROTO(struct sk_buff *skb,
180 struct i40e_ring *ring),
181
182 TP_ARGS(skb, ring),
183
184 TP_STRUCT__entry(
185 __field(void*, skb)
186 __field(void*, ring)
187 __string(devname, ring->netdev->name)
188 ),
189
190 TP_fast_assign(
191 __entry->skb = skb;
192 __entry->ring = ring;
193 __assign_str(devname, ring->netdev->name);
194 ),
195
196 TP_printk(
197 "netdev: %s skb: %p ring: %p",
198 __get_str(devname), __entry->skb,
199 __entry->ring)
200);
201
202DEFINE_EVENT(
203 i40e_xmit_template, i40e_xmit_frame_ring,
204 TP_PROTO(struct sk_buff *skb,
205 struct i40e_ring *ring),
206
207 TP_ARGS(skb, ring));
208
209DEFINE_EVENT(
210 i40e_xmit_template, i40e_xmit_frame_ring_drop,
211 TP_PROTO(struct sk_buff *skb,
212 struct i40e_ring *ring),
213
214 TP_ARGS(skb, ring));
215
216/* Events unique to the PF. */
217
218#endif /* _I40E_TRACE_H_ */
219/* This must be outside ifdef _I40E_TRACE_H */
220
221/* This trace include file is not located in the .../include/trace
222 * with the kernel tracepoint definitions, because we're a loadable
223 * module.
224 */
225#undef TRACE_INCLUDE_PATH
226#define TRACE_INCLUDE_PATH .
227#undef TRACE_INCLUDE_FILE
228#define TRACE_INCLUDE_FILE i40e_trace
229#include <trace/define_trace.h>