xref: /openbmc/linux/include/trace/events/xdp.h (revision 020c5260)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM xdp
3 
4 #if !defined(_TRACE_XDP_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_XDP_H
6 
7 #include <linux/netdevice.h>
8 #include <linux/filter.h>
9 #include <linux/tracepoint.h>
10 
11 #define __XDP_ACT_MAP(FN)	\
12 	FN(ABORTED)		\
13 	FN(DROP)		\
14 	FN(PASS)		\
15 	FN(TX)
16 
17 #define __XDP_ACT_TP_FN(x)	\
18 	TRACE_DEFINE_ENUM(XDP_##x);
19 #define __XDP_ACT_SYM_FN(x)	\
20 	{ XDP_##x, #x },
21 #define __XDP_ACT_SYM_TAB	\
22 	__XDP_ACT_MAP(__XDP_ACT_SYM_FN) { -1, 0 }
23 __XDP_ACT_MAP(__XDP_ACT_TP_FN)
24 
25 TRACE_EVENT(xdp_exception,
26 
27 	TP_PROTO(const struct net_device *dev,
28 		 const struct bpf_prog *xdp, u32 act),
29 
30 	TP_ARGS(dev, xdp, act),
31 
32 	TP_STRUCT__entry(
33 		__string(name, dev->name)
34 		__array(u8, prog_tag, 8)
35 		__field(u32, act)
36 	),
37 
38 	TP_fast_assign(
39 		BUILD_BUG_ON(sizeof(__entry->prog_tag) != sizeof(xdp->tag));
40 		memcpy(__entry->prog_tag, xdp->tag, sizeof(xdp->tag));
41 		__assign_str(name, dev->name);
42 		__entry->act = act;
43 	),
44 
45 	TP_printk("prog=%s device=%s action=%s",
46 		  __print_hex_str(__entry->prog_tag, 8),
47 		  __get_str(name),
48 		  __print_symbolic(__entry->act, __XDP_ACT_SYM_TAB))
49 );
50 
51 #endif /* _TRACE_XDP_H */
52 
53 #include <trace/define_trace.h>
54