diff options
| author | Toke Høiland-Jørgensen <[email protected]> | 2020-03-25 17:23:28 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2020-03-28 21:24:41 +0000 |
| commit | bd5ca3ef93cd8fb7e913f15eeb78e67a0d802274 (patch) | |
| tree | 20b66080e37c4e8fb4686963675ef38f6ef9c10d /tools/lib/bpf/libbpf.h | |
| parent | tools: Add EXPECTED_FD-related definitions in if_link.h (diff) | |
| download | kernel-bd5ca3ef93cd8fb7e913f15eeb78e67a0d802274.tar.gz kernel-bd5ca3ef93cd8fb7e913f15eeb78e67a0d802274.zip | |
libbpf: Add function to set link XDP fd while specifying old program
This adds a new function to set the XDP fd while specifying the FD of the
program to replace, using the newly added IFLA_XDP_EXPECTED_FD netlink
parameter. The new function uses the opts struct mechanism to be extendable
in the future.
Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/libbpf.h')
| -rw-r--r-- | tools/lib/bpf/libbpf.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h index d38d7a629417..bf7a35a9556d 100644 --- a/tools/lib/bpf/libbpf.h +++ b/tools/lib/bpf/libbpf.h @@ -444,7 +444,15 @@ struct xdp_link_info { __u8 attach_mode; }; +struct bpf_xdp_set_link_opts { + size_t sz; + __u32 old_fd; +}; +#define bpf_xdp_set_link_opts__last_field old_fd + LIBBPF_API int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags); +LIBBPF_API int bpf_set_link_xdp_fd_opts(int ifindex, int fd, __u32 flags, + const struct bpf_xdp_set_link_opts *opts); LIBBPF_API int bpf_get_link_xdp_id(int ifindex, __u32 *prog_id, __u32 flags); LIBBPF_API int bpf_get_link_xdp_info(int ifindex, struct xdp_link_info *info, size_t info_size, __u32 flags); |
