1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2013 - 2018 Intel Corporation. */
4 /* Modeled on trace-events-sample.h */
6 /* The trace subsystem name for i40e will be "i40e".
8 * This file is named i40e_trace.h.
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
15 #define TRACE_SYSTEM i40e
17 /* See trace-events-sample.h for a detailed description of why this
18 * guard clause is different from most normal include files.
20 #if !defined(_I40E_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
21 #define _I40E_TRACE_H_
23 #include <linux/tracepoint.h>
26 * i40e_trace() macro enables shared code to refer to trace points
29 * trace_i40e{,vf}_example(args...)
33 * i40e_trace(example, args...)
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
39 * Trace point should always be referred to in the driver via this
42 * Similarly, i40e_trace_enabled(trace_name) wraps references to
43 * trace_i40e{,vf}_<trace_name>_enabled() functions.
45 #define _I40E_TRACE_NAME(trace_name) (trace_ ## i40e ## _ ## trace_name)
46 #define I40E_TRACE_NAME(trace_name) _I40E_TRACE_NAME(trace_name)
48 #define i40e_trace(trace_name, args...) I40E_TRACE_NAME(trace_name)(args)
50 #define i40e_trace_enabled(trace_name) I40E_TRACE_NAME(trace_name##_enabled)()
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.
58 #define NO_DEV "(i40e no_device)"
60 TRACE_EVENT(i40e_napi_poll
,
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
),
66 TP_ARGS(napi
, q
, budget
, budget_per_ring
, rx_cleaned
, tx_cleaned
,
67 rx_clean_complete
, tx_clean_complete
),
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
)
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
)
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();
93 __assign_str(dev_name
);
94 __assign_bitmask(irq_affinity
, cpumask_bits(&q
->affinity_mask
),
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
)
107 /* Events related to a vsi & ring */
111 TP_PROTO(struct i40e_ring
*ring
,
112 struct i40e_tx_desc
*desc
,
113 struct i40e_tx_buffer
*buf
),
115 TP_ARGS(ring
, desc
, buf
),
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.
128 __string(devname
, ring
->netdev
->name
)
132 __entry
->ring
= ring
;
133 __entry
->desc
= desc
;
135 __assign_str(devname
);
139 "netdev: %s ring: %p desc: %p buf %p",
140 __get_str(devname
), __entry
->ring
,
141 __entry
->desc
, __entry
->buf
)
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
),
150 TP_ARGS(ring
, desc
, buf
));
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
),
158 TP_ARGS(ring
, desc
, buf
));
163 TP_PROTO(struct i40e_ring
*ring
,
164 union i40e_16byte_rx_desc
*desc
,
165 struct xdp_buff
*xdp
),
167 TP_ARGS(ring
, desc
, xdp
),
173 __string(devname
, ring
->netdev
->name
)
177 __entry
->ring
= ring
;
178 __entry
->desc
= desc
;
180 __assign_str(devname
);
184 "netdev: %s ring: %p desc: %p xdp %p",
185 __get_str(devname
), __entry
->ring
,
186 __entry
->desc
, __entry
->xdp
)
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
),
195 TP_ARGS(ring
, desc
, xdp
));
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
),
203 TP_ARGS(ring
, desc
, xdp
));
208 TP_PROTO(struct sk_buff
*skb
,
209 struct i40e_ring
*ring
),
216 __string(devname
, ring
->netdev
->name
)
221 __entry
->ring
= ring
;
222 __assign_str(devname
);
226 "netdev: %s skb: %p ring: %p",
227 __get_str(devname
), __entry
->skb
,
232 i40e_xmit_template
, i40e_xmit_frame_ring
,
233 TP_PROTO(struct sk_buff
*skb
,
234 struct i40e_ring
*ring
),
239 i40e_xmit_template
, i40e_xmit_frame_ring_drop
,
240 TP_PROTO(struct sk_buff
*skb
,
241 struct i40e_ring
*ring
),
245 /* Events unique to the PF. */
247 #endif /* _I40E_TRACE_H_ */
248 /* This must be outside ifdef _I40E_TRACE_H */
250 /* This trace include file is not located in the .../include/trace
251 * with the kernel tracepoint definitions, because we're a loadable
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>