summaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorEelco Chaudron <echaudro@redhat.com>2020-03-06 08:59:23 +0000
committerAlexei Starovoitov <ast@kernel.org>2020-03-12 17:47:38 -0700
commitd831ee84bfc9173eecf30dbbc2553ae81b996c60 (patch)
tree52c110beaf9330261d28ed885ea246cb66e39ee8 /kernel/trace
parent4823b7210b90a10b88b0c56198f894b27a767509 (diff)
downloadlinux-d831ee84bfc9173eecf30dbbc2553ae81b996c60.tar.gz
linux-d831ee84bfc9173eecf30dbbc2553ae81b996c60.tar.bz2
linux-d831ee84bfc9173eecf30dbbc2553ae81b996c60.zip
bpf: Add bpf_xdp_output() helper
Introduce new helper that reuses existing xdp perf_event output implementation, but can be called from raw_tracepoint programs that receive 'struct xdp_buff *' as a tracepoint argument. Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: John Fastabend <john.fastabend@gmail.com> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com> Link: https://lore.kernel.org/bpf/158348514556.2239.11050972434793741444.stgit@xdp-tutorial
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/bpf_trace.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index b5071c7e93ca..e619eedb5919 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -1145,6 +1145,7 @@ static const struct bpf_func_proto bpf_perf_event_output_proto_raw_tp = {
};
extern const struct bpf_func_proto bpf_skb_output_proto;
+extern const struct bpf_func_proto bpf_xdp_output_proto;
BPF_CALL_3(bpf_get_stackid_raw_tp, struct bpf_raw_tracepoint_args *, args,
struct bpf_map *, map, u64, flags)
@@ -1220,6 +1221,8 @@ tracing_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
#ifdef CONFIG_NET
case BPF_FUNC_skb_output:
return &bpf_skb_output_proto;
+ case BPF_FUNC_xdp_output:
+ return &bpf_xdp_output_proto;
#endif
default:
return raw_tp_prog_func_proto(func_id, prog);