diff options
author | Alexei Starovoitov <ast@kernel.org> | 2023-08-02 14:21:12 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-08-02 14:21:12 -0700 |
commit | 87dc2bb3291832994d216c7c86e3f4898022272f (patch) | |
tree | 48d166244fee603c968d23d1c6ddc55767a29566 /net/core/dev.c | |
parent | 416c6d01244ecbf0abfdb898fd091b50ef951b48 (diff) | |
parent | 7fedbf32fcc779a07abdba1347e759ad52bded2c (diff) |
Merge branch 'bpf-xdp-add-tracepoint-to-xdp-attaching-failure'
Leon Hwang says:
====================
bpf, xdp: Add tracepoint to xdp attaching failure
This series introduces a new tracepoint in bpf_xdp_link_attach(). By
this tracepoint, error message will be captured when error happens in
dev_xdp_attach(), e.g. invalid attaching flags.
v4 -> v5:
* Initialise the extack variable.
* Fix code style issue of variable declaration lines.
v3 -> v4:
* Fix selftest-crashed issue.
====================
Link: https://lore.kernel.org/r/20230801142621.7925-1-hffilwlqm@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 8e7d0cb540cd..002fec07de73 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -133,6 +133,7 @@ #include <trace/events/net.h> #include <trace/events/skb.h> #include <trace/events/qdisc.h> +#include <trace/events/xdp.h> #include <linux/inetdevice.h> #include <linux/cpu_rmap.h> #include <linux/static_key.h> @@ -9470,6 +9471,7 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog) { struct net *net = current->nsproxy->net_ns; struct bpf_link_primer link_primer; + struct netlink_ext_ack extack = {}; struct bpf_xdp_link *link; struct net_device *dev; int err, fd; @@ -9497,12 +9499,13 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog) goto unlock; } - err = dev_xdp_attach_link(dev, NULL, link); + err = dev_xdp_attach_link(dev, &extack, link); rtnl_unlock(); if (err) { link->dev = NULL; bpf_link_cleanup(&link_primer); + trace_bpf_xdp_link_attach_failed(extack._msg); goto out_put_dev; } |