1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2021 Intel Corporation. */
4 /* Modeled on trace-events-sample.h */
6 /* The trace subsystem name for ice will be "ice".
8 * This file is named ice_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 ice
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(_ICE_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
23 #include <linux/tracepoint.h>
25 /* ice_trace() macro enables shared code to refer to trace points
28 * trace_ice_example(args...)
32 * ice_trace(example, args...)
34 * ... to resolve to the PF version of the tracepoint without
35 * ifdefs, and to allow tracepoints to be disabled entirely at build
38 * Trace point should always be referred to in the driver via this
41 * Similarly, ice_trace_enabled(trace_name) wraps references to
42 * trace_ice_<trace_name>_enabled() functions.
43 * @trace_name: name of tracepoint
45 #define _ICE_TRACE_NAME(trace_name) (trace_##ice##_##trace_name)
46 #define ICE_TRACE_NAME(trace_name) _ICE_TRACE_NAME(trace_name)
48 #define ice_trace(trace_name, args...) ICE_TRACE_NAME(trace_name)(args)
50 #define ice_trace_enabled(trace_name) ICE_TRACE_NAME(trace_name##_enabled)()
52 /* This is for events common to PF. Corresponding versions will be named
53 * trace_ice_*. The ice_trace() macro above will select the right trace point
54 * name for the driver.
57 /* Begin tracepoints */
59 /* Global tracepoints */
61 /* Events related to DIM, q_vectors and ring containers */
62 DECLARE_EVENT_CLASS(ice_rx_dim_template,
63 TP_PROTO(struct ice_q_vector *q_vector, struct dim *dim),
64 TP_ARGS(q_vector, dim),
65 TP_STRUCT__entry(__field(struct ice_q_vector *, q_vector)
66 __field(struct dim *, dim)
67 __string(devname, q_vector->rx.rx_ring->netdev->name)),
69 TP_fast_assign(__entry->q_vector = q_vector;
71 __assign_str(devname, q_vector->rx.rx_ring->netdev->name);),
73 TP_printk("netdev: %s Rx-Q: %d dim-state: %d dim-profile: %d dim-tune: %d dim-st-right: %d dim-st-left: %d dim-tired: %d",
75 __entry->q_vector->rx.rx_ring->q_index,
77 __entry->dim->profile_ix,
78 __entry->dim->tune_state,
79 __entry->dim->steps_right,
80 __entry->dim->steps_left,
84 DEFINE_EVENT(ice_rx_dim_template, ice_rx_dim_work,
85 TP_PROTO(struct ice_q_vector *q_vector, struct dim *dim),
86 TP_ARGS(q_vector, dim)
89 DECLARE_EVENT_CLASS(ice_tx_dim_template,
90 TP_PROTO(struct ice_q_vector *q_vector, struct dim *dim),
91 TP_ARGS(q_vector, dim),
92 TP_STRUCT__entry(__field(struct ice_q_vector *, q_vector)
93 __field(struct dim *, dim)
94 __string(devname, q_vector->tx.tx_ring->netdev->name)),
96 TP_fast_assign(__entry->q_vector = q_vector;
98 __assign_str(devname, q_vector->tx.tx_ring->netdev->name);),
100 TP_printk("netdev: %s Tx-Q: %d dim-state: %d dim-profile: %d dim-tune: %d dim-st-right: %d dim-st-left: %d dim-tired: %d",
102 __entry->q_vector->tx.tx_ring->q_index,
104 __entry->dim->profile_ix,
105 __entry->dim->tune_state,
106 __entry->dim->steps_right,
107 __entry->dim->steps_left,
111 DEFINE_EVENT(ice_tx_dim_template, ice_tx_dim_work,
112 TP_PROTO(struct ice_q_vector *q_vector, struct dim *dim),
113 TP_ARGS(q_vector, dim)
116 /* Events related to a vsi & ring */
117 DECLARE_EVENT_CLASS(ice_tx_template,
118 TP_PROTO(struct ice_tx_ring *ring, struct ice_tx_desc *desc,
119 struct ice_tx_buf *buf),
121 TP_ARGS(ring, desc, buf),
122 TP_STRUCT__entry(__field(void *, ring)
123 __field(void *, desc)
125 __string(devname, ring->netdev->name)),
127 TP_fast_assign(__entry->ring = ring;
128 __entry->desc = desc;
130 __assign_str(devname, ring->netdev->name);),
132 TP_printk("netdev: %s ring: %pK desc: %pK buf %pK", __get_str(devname),
133 __entry->ring, __entry->desc, __entry->buf)
136 #define DEFINE_TX_TEMPLATE_OP_EVENT(name) \
137 DEFINE_EVENT(ice_tx_template, name, \
138 TP_PROTO(struct ice_tx_ring *ring, \
139 struct ice_tx_desc *desc, \
140 struct ice_tx_buf *buf), \
141 TP_ARGS(ring, desc, buf))
143 DEFINE_TX_TEMPLATE_OP_EVENT(ice_clean_tx_irq);
144 DEFINE_TX_TEMPLATE_OP_EVENT(ice_clean_tx_irq_unmap);
145 DEFINE_TX_TEMPLATE_OP_EVENT(ice_clean_tx_irq_unmap_eop);
147 DECLARE_EVENT_CLASS(ice_rx_template,
148 TP_PROTO(struct ice_rx_ring *ring, union ice_32b_rx_flex_desc *desc),
152 TP_STRUCT__entry(__field(void *, ring)
153 __field(void *, desc)
154 __string(devname, ring->netdev->name)),
156 TP_fast_assign(__entry->ring = ring;
157 __entry->desc = desc;
158 __assign_str(devname, ring->netdev->name);),
160 TP_printk("netdev: %s ring: %pK desc: %pK", __get_str(devname),
161 __entry->ring, __entry->desc)
163 DEFINE_EVENT(ice_rx_template, ice_clean_rx_irq,
164 TP_PROTO(struct ice_rx_ring *ring, union ice_32b_rx_flex_desc *desc),
168 DECLARE_EVENT_CLASS(ice_rx_indicate_template,
169 TP_PROTO(struct ice_rx_ring *ring, union ice_32b_rx_flex_desc *desc,
170 struct sk_buff *skb),
172 TP_ARGS(ring, desc, skb),
174 TP_STRUCT__entry(__field(void *, ring)
175 __field(void *, desc)
177 __string(devname, ring->netdev->name)),
179 TP_fast_assign(__entry->ring = ring;
180 __entry->desc = desc;
182 __assign_str(devname, ring->netdev->name);),
184 TP_printk("netdev: %s ring: %pK desc: %pK skb %pK", __get_str(devname),
185 __entry->ring, __entry->desc, __entry->skb)
188 DEFINE_EVENT(ice_rx_indicate_template, ice_clean_rx_irq_indicate,
189 TP_PROTO(struct ice_rx_ring *ring, union ice_32b_rx_flex_desc *desc,
190 struct sk_buff *skb),
191 TP_ARGS(ring, desc, skb)
194 DECLARE_EVENT_CLASS(ice_xmit_template,
195 TP_PROTO(struct ice_tx_ring *ring, struct sk_buff *skb),
199 TP_STRUCT__entry(__field(void *, ring)
201 __string(devname, ring->netdev->name)),
203 TP_fast_assign(__entry->ring = ring;
205 __assign_str(devname, ring->netdev->name);),
207 TP_printk("netdev: %s skb: %pK ring: %pK", __get_str(devname),
208 __entry->skb, __entry->ring)
211 #define DEFINE_XMIT_TEMPLATE_OP_EVENT(name) \
212 DEFINE_EVENT(ice_xmit_template, name, \
213 TP_PROTO(struct ice_tx_ring *ring, struct sk_buff *skb), \
216 DEFINE_XMIT_TEMPLATE_OP_EVENT(ice_xmit_frame_ring);
217 DEFINE_XMIT_TEMPLATE_OP_EVENT(ice_xmit_frame_ring_drop);
219 DECLARE_EVENT_CLASS(ice_tx_tstamp_template,
220 TP_PROTO(struct sk_buff *skb, int idx),
224 TP_STRUCT__entry(__field(void *, skb)
227 TP_fast_assign(__entry->skb = skb;
228 __entry->idx = idx;),
230 TP_printk("skb %pK idx %d",
231 __entry->skb, __entry->idx)
233 #define DEFINE_TX_TSTAMP_OP_EVENT(name) \
234 DEFINE_EVENT(ice_tx_tstamp_template, name, \
235 TP_PROTO(struct sk_buff *skb, int idx), \
238 DEFINE_TX_TSTAMP_OP_EVENT(ice_tx_tstamp_request);
239 DEFINE_TX_TSTAMP_OP_EVENT(ice_tx_tstamp_fw_req);
240 DEFINE_TX_TSTAMP_OP_EVENT(ice_tx_tstamp_fw_done);
241 DEFINE_TX_TSTAMP_OP_EVENT(ice_tx_tstamp_complete);
243 /* End tracepoints */
245 #endif /* _ICE_TRACE_H_ */
246 /* This must be outside ifdef _ICE_TRACE_H */
248 /* This trace include file is not located in the .../include/trace
249 * with the kernel tracepoint definitions, because we're a loadable
252 #undef TRACE_INCLUDE_PATH
253 #define TRACE_INCLUDE_PATH .
254 #undef TRACE_INCLUDE_FILE
255 #define TRACE_INCLUDE_FILE ../../drivers/net/ethernet/intel/ice/ice_trace
256 #include <trace/define_trace.h>