]>
git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blob - include/trace/events/xdp.h
1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM xdp
5 #if !defined(_TRACE_XDP_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/netdevice.h>
9 #include <linux/filter.h>
10 #include <linux/tracepoint.h>
12 #define __XDP_ACT_MAP(FN) \
19 #define __XDP_ACT_TP_FN(x) \
20 TRACE_DEFINE_ENUM(XDP_##x);
21 #define __XDP_ACT_SYM_FN(x) \
23 #define __XDP_ACT_SYM_TAB \
24 __XDP_ACT_MAP(__XDP_ACT_SYM_FN) { -1, 0 }
25 __XDP_ACT_MAP(__XDP_ACT_TP_FN
)
27 TRACE_EVENT(xdp_exception
,
29 TP_PROTO(const struct net_device
*dev
,
30 const struct bpf_prog
*xdp
, u32 act
),
32 TP_ARGS(dev
, xdp
, act
),
41 __entry
->prog_id
= xdp
->aux
->id
;
43 __entry
->ifindex
= dev
->ifindex
;
46 TP_printk("prog_id=%d action=%s ifindex=%d",
48 __print_symbolic(__entry
->act
, __XDP_ACT_SYM_TAB
),
52 DECLARE_EVENT_CLASS(xdp_redirect_template
,
54 TP_PROTO(const struct net_device
*dev
,
55 const struct bpf_prog
*xdp
,
56 int to_ifindex
, int err
,
57 const struct bpf_map
*map
, u32 map_index
),
59 TP_ARGS(dev
, xdp
, to_ifindex
, err
, map
, map_index
),
66 __field(int, to_ifindex
)
68 __field(int, map_index
)
72 __entry
->prog_id
= xdp
->aux
->id
;
73 __entry
->act
= XDP_REDIRECT
;
74 __entry
->ifindex
= dev
->ifindex
;
76 __entry
->to_ifindex
= to_ifindex
;
77 __entry
->map_id
= map
? map
->id
: 0;
78 __entry
->map_index
= map_index
;
81 TP_printk("prog_id=%d action=%s ifindex=%d to_ifindex=%d err=%d",
83 __print_symbolic(__entry
->act
, __XDP_ACT_SYM_TAB
),
84 __entry
->ifindex
, __entry
->to_ifindex
,
88 DEFINE_EVENT(xdp_redirect_template
, xdp_redirect
,
89 TP_PROTO(const struct net_device
*dev
,
90 const struct bpf_prog
*xdp
,
91 int to_ifindex
, int err
,
92 const struct bpf_map
*map
, u32 map_index
),
93 TP_ARGS(dev
, xdp
, to_ifindex
, err
, map
, map_index
)
96 DEFINE_EVENT(xdp_redirect_template
, xdp_redirect_err
,
97 TP_PROTO(const struct net_device
*dev
,
98 const struct bpf_prog
*xdp
,
99 int to_ifindex
, int err
,
100 const struct bpf_map
*map
, u32 map_index
),
101 TP_ARGS(dev
, xdp
, to_ifindex
, err
, map
, map_index
)
104 #define _trace_xdp_redirect(dev, xdp, to) \
105 trace_xdp_redirect(dev, xdp, to, 0, NULL, 0);
107 #define _trace_xdp_redirect_err(dev, xdp, to, err) \
108 trace_xdp_redirect_err(dev, xdp, to, err, NULL, 0);
110 DEFINE_EVENT_PRINT(xdp_redirect_template
, xdp_redirect_map
,
111 TP_PROTO(const struct net_device
*dev
,
112 const struct bpf_prog
*xdp
,
113 int to_ifindex
, int err
,
114 const struct bpf_map
*map
, u32 map_index
),
115 TP_ARGS(dev
, xdp
, to_ifindex
, err
, map
, map_index
),
116 TP_printk("prog_id=%d action=%s ifindex=%d to_ifindex=%d err=%d"
117 " map_id=%d map_index=%d",
119 __print_symbolic(__entry
->act
, __XDP_ACT_SYM_TAB
),
120 __entry
->ifindex
, __entry
->to_ifindex
,
122 __entry
->map_id
, __entry
->map_index
)
125 DEFINE_EVENT_PRINT(xdp_redirect_template
, xdp_redirect_map_err
,
126 TP_PROTO(const struct net_device
*dev
,
127 const struct bpf_prog
*xdp
,
128 int to_ifindex
, int err
,
129 const struct bpf_map
*map
, u32 map_index
),
130 TP_ARGS(dev
, xdp
, to_ifindex
, err
, map
, map_index
),
131 TP_printk("prog_id=%d action=%s ifindex=%d to_ifindex=%d err=%d"
132 " map_id=%d map_index=%d",
134 __print_symbolic(__entry
->act
, __XDP_ACT_SYM_TAB
),
135 __entry
->ifindex
, __entry
->to_ifindex
,
137 __entry
->map_id
, __entry
->map_index
)
140 #define _trace_xdp_redirect_map(dev, xdp, fwd, map, idx) \
141 trace_xdp_redirect_map(dev, xdp, fwd ? fwd->ifindex : 0, \
144 #define _trace_xdp_redirect_map_err(dev, xdp, fwd, map, idx, err) \
145 trace_xdp_redirect_map_err(dev, xdp, fwd ? fwd->ifindex : 0, \
148 #endif /* _TRACE_XDP_H */
150 #include <trace/define_trace.h>