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