xref: /openbmc/linux/include/trace/events/skb.h (revision b24413180f5600bcb3bb70fbed5cf186b60864bd)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2d0b6e04aSLi Zefan #undef TRACE_SYSTEM
3d0b6e04aSLi Zefan #define TRACE_SYSTEM skb
4d0b6e04aSLi Zefan 
5ad8d75ffSSteven Rostedt #if !defined(_TRACE_SKB_H) || defined(TRACE_HEADER_MULTI_READ)
6ad8d75ffSSteven Rostedt #define _TRACE_SKB_H
7ad8d75ffSSteven Rostedt 
8ad8d75ffSSteven Rostedt #include <linux/skbuff.h>
9e9b3cc1bSNeil Horman #include <linux/netdevice.h>
10ad8d75ffSSteven Rostedt #include <linux/tracepoint.h>
11ad8d75ffSSteven Rostedt 
12ad8d75ffSSteven Rostedt /*
13ad8d75ffSSteven Rostedt  * Tracepoint for free an sk_buff:
14ad8d75ffSSteven Rostedt  */
15ad8d75ffSSteven Rostedt TRACE_EVENT(kfree_skb,
16ad8d75ffSSteven Rostedt 
17ad8d75ffSSteven Rostedt 	TP_PROTO(struct sk_buff *skb, void *location),
18ad8d75ffSSteven Rostedt 
19ad8d75ffSSteven Rostedt 	TP_ARGS(skb, location),
20ad8d75ffSSteven Rostedt 
21ad8d75ffSSteven Rostedt 	TP_STRUCT__entry(
22ad8d75ffSSteven Rostedt 		__field(	void *,		skbaddr		)
23ad8d75ffSSteven Rostedt 		__field(	void *,		location	)
24ca9da2ddSDavid Sharp 		__field(	unsigned short,	protocol	)
25ad8d75ffSSteven Rostedt 	),
26ad8d75ffSSteven Rostedt 
27ad8d75ffSSteven Rostedt 	TP_fast_assign(
28ad8d75ffSSteven Rostedt 		__entry->skbaddr = skb;
29ad8d75ffSSteven Rostedt 		__entry->location = location;
30ca9da2ddSDavid Sharp 		__entry->protocol = ntohs(skb->protocol);
31ad8d75ffSSteven Rostedt 	),
32ad8d75ffSSteven Rostedt 
33ad8d75ffSSteven Rostedt 	TP_printk("skbaddr=%p protocol=%u location=%p",
34ad8d75ffSSteven Rostedt 		__entry->skbaddr, __entry->protocol, __entry->location)
35ad8d75ffSSteven Rostedt );
36ad8d75ffSSteven Rostedt 
3707dc22e7SKoki Sanagi TRACE_EVENT(consume_skb,
3807dc22e7SKoki Sanagi 
3907dc22e7SKoki Sanagi 	TP_PROTO(struct sk_buff *skb),
4007dc22e7SKoki Sanagi 
4107dc22e7SKoki Sanagi 	TP_ARGS(skb),
4207dc22e7SKoki Sanagi 
4307dc22e7SKoki Sanagi 	TP_STRUCT__entry(
4407dc22e7SKoki Sanagi 		__field(	void *,	skbaddr	)
4507dc22e7SKoki Sanagi 	),
4607dc22e7SKoki Sanagi 
4707dc22e7SKoki Sanagi 	TP_fast_assign(
4807dc22e7SKoki Sanagi 		__entry->skbaddr = skb;
4907dc22e7SKoki Sanagi 	),
5007dc22e7SKoki Sanagi 
5107dc22e7SKoki Sanagi 	TP_printk("skbaddr=%p", __entry->skbaddr)
5207dc22e7SKoki Sanagi );
5307dc22e7SKoki Sanagi 
54e9b3cc1bSNeil Horman TRACE_EVENT(skb_copy_datagram_iovec,
55e9b3cc1bSNeil Horman 
56e9b3cc1bSNeil Horman 	TP_PROTO(const struct sk_buff *skb, int len),
57e9b3cc1bSNeil Horman 
58e9b3cc1bSNeil Horman 	TP_ARGS(skb, len),
59e9b3cc1bSNeil Horman 
60e9b3cc1bSNeil Horman 	TP_STRUCT__entry(
61e9b3cc1bSNeil Horman 		__field(	const void *,		skbaddr		)
62e9b3cc1bSNeil Horman 		__field(	int,			len		)
63e9b3cc1bSNeil Horman 	),
64e9b3cc1bSNeil Horman 
65e9b3cc1bSNeil Horman 	TP_fast_assign(
66e9b3cc1bSNeil Horman 		__entry->skbaddr = skb;
67e9b3cc1bSNeil Horman 		__entry->len = len;
68e9b3cc1bSNeil Horman 	),
69e9b3cc1bSNeil Horman 
70e9b3cc1bSNeil Horman 	TP_printk("skbaddr=%p len=%d", __entry->skbaddr, __entry->len)
71e9b3cc1bSNeil Horman );
72e9b3cc1bSNeil Horman 
73ad8d75ffSSteven Rostedt #endif /* _TRACE_SKB_H */
74ad8d75ffSSteven Rostedt 
75ad8d75ffSSteven Rostedt /* This part must be outside protection */
76ad8d75ffSSteven Rostedt #include <trace/define_trace.h>
77