History

bpf, xdp: allow to pass flags to dev_change_xdp_fd

Add an IFLA_XDP_FLAGS attribute that can be passed for setting up XDP along with IFLA_XDP_FD, which eventually allows user space to implement typical add/replace/delete logic for programs. Right now, calling into dev_change_xdp_fd() will always replace previous programs. When passed XDP_FLAGS_UPDATE_IF_NOEXIST, we can handle this more graceful when requested by returning -EBUSY in case we try to attach a new program, but we find that another one is already attached. This will be used by upcoming front-end for iproute2 as well.

Daniel Borkmann committed 9 years ago

Commit 85de8571 parent 0f29f054 files · +36 −4Browse files

Showing the changes to include/uapi/linux (1 of 4 files). Show all

Unified · Split

include/uapi/linux/if_link.h+4−0
@@ -876,10 +876,14 @@ enum { · 875 unmodified lines
876876
877877 /* XDP section */
878878
879+#define XDP_FLAGS_UPDATE_IF_NOEXIST (1U << 0)
880+#define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST)
881+
879882 enum {
880883 IFLA_XDP_UNSPEC,
881884 IFLA_XDP_FD,
882885 IFLA_XDP_ATTACHED,
886+ IFLA_XDP_FLAGS,
883887 __IFLA_XDP_MAX,
884888 };
885889