]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - include/trace/events/xdp.h
Merge tag 'batadv-next-for-davem-20170802' of git://git.open-mesh.org/linux-merge
[mirror_ubuntu-jammy-kernel.git] / include / trace / events / xdp.h
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 FN(REDIRECT)
17
18 #define __XDP_ACT_TP_FN(x) \
19 TRACE_DEFINE_ENUM(XDP_##x);
20 #define __XDP_ACT_SYM_FN(x) \
21 { XDP_##x, #x },
22 #define __XDP_ACT_SYM_TAB \
23 __XDP_ACT_MAP(__XDP_ACT_SYM_FN) { -1, 0 }
24 __XDP_ACT_MAP(__XDP_ACT_TP_FN)
25
26 TRACE_EVENT(xdp_exception,
27
28 TP_PROTO(const struct net_device *dev,
29 const struct bpf_prog *xdp, u32 act),
30
31 TP_ARGS(dev, xdp, act),
32
33 TP_STRUCT__entry(
34 __string(name, dev->name)
35 __array(u8, prog_tag, 8)
36 __field(u32, act)
37 ),
38
39 TP_fast_assign(
40 BUILD_BUG_ON(sizeof(__entry->prog_tag) != sizeof(xdp->tag));
41 memcpy(__entry->prog_tag, xdp->tag, sizeof(xdp->tag));
42 __assign_str(name, dev->name);
43 __entry->act = act;
44 ),
45
46 TP_printk("prog=%s device=%s action=%s",
47 __print_hex_str(__entry->prog_tag, 8),
48 __get_str(name),
49 __print_symbolic(__entry->act, __XDP_ACT_SYM_TAB))
50 );
51
52 TRACE_EVENT(xdp_redirect,
53
54 TP_PROTO(const struct net_device *from,
55 const struct net_device *to,
56 const struct bpf_prog *xdp, u32 act),
57
58 TP_ARGS(from, to, xdp, act),
59
60 TP_STRUCT__entry(
61 __string(name_from, from->name)
62 __string(name_to, to->name)
63 __array(u8, prog_tag, 8)
64 __field(u32, act)
65 ),
66
67 TP_fast_assign(
68 BUILD_BUG_ON(sizeof(__entry->prog_tag) != sizeof(xdp->tag));
69 memcpy(__entry->prog_tag, xdp->tag, sizeof(xdp->tag));
70 __assign_str(name_from, from->name);
71 __assign_str(name_to, to->name);
72 __entry->act = act;
73 ),
74
75 TP_printk("prog=%s from=%s to=%s action=%s",
76 __print_hex_str(__entry->prog_tag, 8),
77 __get_str(name_from), __get_str(name_to),
78 __print_symbolic(__entry->act, __XDP_ACT_SYM_TAB))
79 );
80 #endif /* _TRACE_XDP_H */
81
82 #include <trace/define_trace.h>