summaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
authorLeon Hwang <hffilwlqm@gmail.com>2023-08-01 22:26:20 +0800
committerAlexei Starovoitov <ast@kernel.org>2023-08-02 14:21:12 -0700
commitbf4ea1d0b2cb2251f9e5619c81daa98591087c33 (patch)
treef23d51c0091df06cb2cf045bcb1f099ea9d4c225 /include/trace
parent416c6d01244ecbf0abfdb898fd091b50ef951b48 (diff)
downloadlinux-bf4ea1d0b2cb2251f9e5619c81daa98591087c33.tar.gz
linux-bf4ea1d0b2cb2251f9e5619c81daa98591087c33.tar.bz2
linux-bf4ea1d0b2cb2251f9e5619c81daa98591087c33.zip
bpf, xdp: Add tracepoint to xdp attaching failure
When error happens in dev_xdp_attach(), it should have a way to tell users the error message like the netlink approach. To avoid breaking uapi, adding a tracepoint in bpf_xdp_link_attach() is an appropriate way to notify users the error message. Hence, bpf libraries are able to retrieve the error message by this tracepoint, and then report the error message to users. Signed-off-by: Leon Hwang <hffilwlqm@gmail.com> Link: https://lore.kernel.org/r/20230801142621.7925-2-hffilwlqm@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/xdp.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/trace/events/xdp.h b/include/trace/events/xdp.h
index c40fc97f9417..cd89f1d5ce7b 100644
--- a/include/trace/events/xdp.h
+++ b/include/trace/events/xdp.h
@@ -404,6 +404,23 @@ TRACE_EVENT(mem_return_failed,
)
);
+TRACE_EVENT(bpf_xdp_link_attach_failed,
+
+ TP_PROTO(const char *msg),
+
+ TP_ARGS(msg),
+
+ TP_STRUCT__entry(
+ __string(msg, msg)
+ ),
+
+ TP_fast_assign(
+ __assign_str(msg, msg);
+ ),
+
+ TP_printk("errmsg=%s", __get_str(msg))
+);
+
#endif /* _TRACE_XDP_H */
#include <trace/define_trace.h>