1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM net
5 #if !defined(_TRACE_NET_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/skbuff.h>
9 #include <linux/netdevice.h>
10 #include <linux/if_vlan.h>
12 #include <linux/tracepoint.h>
14 TRACE_EVENT(net_dev_start_xmit
,
16 TP_PROTO(const struct sk_buff
*skb
, const struct net_device
*dev
),
21 __string( name
, dev
->name
)
22 __field( u16
, queue_mapping
)
23 __field( const void *, skbaddr
)
24 __field( bool, vlan_tagged
)
25 __field( u16
, vlan_proto
)
26 __field( u16
, vlan_tci
)
27 __field( u16
, protocol
)
28 __field( u8
, ip_summed
)
29 __field( unsigned int, len
)
30 __field( unsigned int, data_len
)
31 __field( int, network_offset
)
32 __field( bool, transport_offset_valid
)
33 __field( int, transport_offset
)
34 __field( u8
, tx_flags
)
35 __field( u16
, gso_size
)
36 __field( u16
, gso_segs
)
37 __field( u16
, gso_type
)
42 __entry
->queue_mapping
= skb
->queue_mapping
;
43 __entry
->skbaddr
= skb
;
44 __entry
->vlan_tagged
= skb_vlan_tag_present(skb
);
45 __entry
->vlan_proto
= ntohs(skb
->vlan_proto
);
46 __entry
->vlan_tci
= skb_vlan_tag_get(skb
);
47 __entry
->protocol
= ntohs(skb
->protocol
);
48 __entry
->ip_summed
= skb
->ip_summed
;
49 __entry
->len
= skb
->len
;
50 __entry
->data_len
= skb
->data_len
;
51 __entry
->network_offset
= skb_network_offset(skb
);
52 __entry
->transport_offset_valid
=
53 skb_transport_header_was_set(skb
);
54 __entry
->transport_offset
= skb_transport_header_was_set(skb
) ?
55 skb_transport_offset(skb
) : 0;
56 __entry
->tx_flags
= skb_shinfo(skb
)->tx_flags
;
57 __entry
->gso_size
= skb_shinfo(skb
)->gso_size
;
58 __entry
->gso_segs
= skb_shinfo(skb
)->gso_segs
;
59 __entry
->gso_type
= skb_shinfo(skb
)->gso_type
;
62 TP_printk("dev=%s queue_mapping=%u skbaddr=%p vlan_tagged=%d vlan_proto=0x%04x vlan_tci=0x%04x protocol=0x%04x ip_summed=%d len=%u data_len=%u network_offset=%d transport_offset_valid=%d transport_offset=%d tx_flags=%d gso_size=%d gso_segs=%d gso_type=%#x",
63 __get_str(name
), __entry
->queue_mapping
, __entry
->skbaddr
,
64 __entry
->vlan_tagged
, __entry
->vlan_proto
, __entry
->vlan_tci
,
65 __entry
->protocol
, __entry
->ip_summed
, __entry
->len
,
67 __entry
->network_offset
, __entry
->transport_offset_valid
,
68 __entry
->transport_offset
, __entry
->tx_flags
,
69 __entry
->gso_size
, __entry
->gso_segs
, __entry
->gso_type
)
72 TRACE_EVENT(net_dev_xmit
,
74 TP_PROTO(struct sk_buff
*skb
,
76 struct net_device
*dev
,
77 unsigned int skb_len
),
79 TP_ARGS(skb
, rc
, dev
, skb_len
),
82 __field( void *, skbaddr
)
83 __field( unsigned int, len
)
85 __string( name
, dev
->name
)
89 __entry
->skbaddr
= skb
;
90 __entry
->len
= skb_len
;
95 TP_printk("dev=%s skbaddr=%p len=%u rc=%d",
96 __get_str(name
), __entry
->skbaddr
, __entry
->len
, __entry
->rc
)
99 TRACE_EVENT(net_dev_xmit_timeout
,
101 TP_PROTO(struct net_device
*dev
,
104 TP_ARGS(dev
, queue_index
),
107 __string( name
, dev
->name
)
108 __string( driver
, netdev_drivername(dev
))
109 __field( int, queue_index
)
114 __assign_str(driver
);
115 __entry
->queue_index
= queue_index
;
118 TP_printk("dev=%s driver=%s queue=%d",
119 __get_str(name
), __get_str(driver
), __entry
->queue_index
)
122 DECLARE_EVENT_CLASS(net_dev_template
,
124 TP_PROTO(struct sk_buff
*skb
),
129 __field( void *, skbaddr
)
130 __field( unsigned int, len
)
131 __string( name
, skb
->dev
->name
)
135 __entry
->skbaddr
= skb
;
136 __entry
->len
= skb
->len
;
140 TP_printk("dev=%s skbaddr=%p len=%u",
141 __get_str(name
), __entry
->skbaddr
, __entry
->len
)
144 DEFINE_EVENT(net_dev_template
, net_dev_queue
,
146 TP_PROTO(struct sk_buff
*skb
),
151 DEFINE_EVENT(net_dev_template
, netif_receive_skb
,
153 TP_PROTO(struct sk_buff
*skb
),
158 DEFINE_EVENT(net_dev_template
, netif_rx
,
160 TP_PROTO(struct sk_buff
*skb
),
165 DECLARE_EVENT_CLASS(net_dev_rx_verbose_template
,
167 TP_PROTO(const struct sk_buff
*skb
),
172 __string( name
, skb
->dev
->name
)
173 __field( unsigned int, napi_id
)
174 __field( u16
, queue_mapping
)
175 __field( const void *, skbaddr
)
176 __field( bool, vlan_tagged
)
177 __field( u16
, vlan_proto
)
178 __field( u16
, vlan_tci
)
179 __field( u16
, protocol
)
180 __field( u8
, ip_summed
)
182 __field( bool, l4_hash
)
183 __field( unsigned int, len
)
184 __field( unsigned int, data_len
)
185 __field( unsigned int, truesize
)
186 __field( bool, mac_header_valid
)
187 __field( int, mac_header
)
188 __field( unsigned char, nr_frags
)
189 __field( u16
, gso_size
)
190 __field( u16
, gso_type
)
195 #ifdef CONFIG_NET_RX_BUSY_POLL
196 __entry
->napi_id
= skb
->napi_id
;
198 __entry
->napi_id
= 0;
200 __entry
->queue_mapping
= skb
->queue_mapping
;
201 __entry
->skbaddr
= skb
;
202 __entry
->vlan_tagged
= skb_vlan_tag_present(skb
);
203 __entry
->vlan_proto
= ntohs(skb
->vlan_proto
);
204 __entry
->vlan_tci
= skb_vlan_tag_get(skb
);
205 __entry
->protocol
= ntohs(skb
->protocol
);
206 __entry
->ip_summed
= skb
->ip_summed
;
207 __entry
->hash
= skb
->hash
;
208 __entry
->l4_hash
= skb
->l4_hash
;
209 __entry
->len
= skb
->len
;
210 __entry
->data_len
= skb
->data_len
;
211 __entry
->truesize
= skb
->truesize
;
212 __entry
->mac_header_valid
= skb_mac_header_was_set(skb
);
213 __entry
->mac_header
= skb_mac_header(skb
) - skb
->data
;
214 __entry
->nr_frags
= skb_shinfo(skb
)->nr_frags
;
215 __entry
->gso_size
= skb_shinfo(skb
)->gso_size
;
216 __entry
->gso_type
= skb_shinfo(skb
)->gso_type
;
219 TP_printk("dev=%s napi_id=%#x queue_mapping=%u skbaddr=%p vlan_tagged=%d vlan_proto=0x%04x vlan_tci=0x%04x protocol=0x%04x ip_summed=%d hash=0x%08x l4_hash=%d len=%u data_len=%u truesize=%u mac_header_valid=%d mac_header=%d nr_frags=%d gso_size=%d gso_type=%#x",
220 __get_str(name
), __entry
->napi_id
, __entry
->queue_mapping
,
221 __entry
->skbaddr
, __entry
->vlan_tagged
, __entry
->vlan_proto
,
222 __entry
->vlan_tci
, __entry
->protocol
, __entry
->ip_summed
,
223 __entry
->hash
, __entry
->l4_hash
, __entry
->len
,
224 __entry
->data_len
, __entry
->truesize
,
225 __entry
->mac_header_valid
, __entry
->mac_header
,
226 __entry
->nr_frags
, __entry
->gso_size
, __entry
->gso_type
)
229 DEFINE_EVENT(net_dev_rx_verbose_template
, napi_gro_frags_entry
,
231 TP_PROTO(const struct sk_buff
*skb
),
236 DEFINE_EVENT(net_dev_rx_verbose_template
, napi_gro_receive_entry
,
238 TP_PROTO(const struct sk_buff
*skb
),
243 DEFINE_EVENT(net_dev_rx_verbose_template
, netif_receive_skb_entry
,
245 TP_PROTO(const struct sk_buff
*skb
),
250 DEFINE_EVENT(net_dev_rx_verbose_template
, netif_receive_skb_list_entry
,
252 TP_PROTO(const struct sk_buff
*skb
),
257 DEFINE_EVENT(net_dev_rx_verbose_template
, netif_rx_entry
,
259 TP_PROTO(const struct sk_buff
*skb
),
264 DECLARE_EVENT_CLASS(net_dev_rx_exit_template
,
278 TP_printk("ret=%d", __entry
->ret
)
281 DEFINE_EVENT(net_dev_rx_exit_template
, napi_gro_frags_exit
,
288 DEFINE_EVENT(net_dev_rx_exit_template
, napi_gro_receive_exit
,
295 DEFINE_EVENT(net_dev_rx_exit_template
, netif_receive_skb_exit
,
302 DEFINE_EVENT(net_dev_rx_exit_template
, netif_rx_exit
,
309 DEFINE_EVENT(net_dev_rx_exit_template
, netif_receive_skb_list_exit
,
316 #endif /* _TRACE_NET_H */
318 /* This part must be outside protection */
319 #include <trace/define_trace.h>