diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2022-02-03 01:59:15 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2022-02-03 18:32:25 +0300 |
commit | e4e284a8c0d9823c07ee674445de05928be67231 (patch) | |
tree | adfcdb8b548bb9120dab439ad8a3e0c3aa4c8d30 /tools/testing/selftests/bpf/xdp_redirect_multi.c | |
parent | 32e608f82946e1e600f8c92b765c18b7189e596d (diff) | |
download | linux-e4e284a8c0d9823c07ee674445de05928be67231.tar.xz |
selftests/bpf: Redo the switch to new libbpf XDP APIs
Switch to using new bpf_xdp_*() APIs across all selftests. Take
advantage of a more straightforward and user-friendly semantics of
old_prog_fd (0 means "don't care") in few places.
This is a redo of 544356524dd6 ("selftests/bpf: switch to new libbpf XDP
APIs"), which was previously reverted to minimize conflicts during bpf
and bpf-next tree merge.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20220202225916.3313522-6-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/xdp_redirect_multi.c')
-rw-r--r-- | tools/testing/selftests/bpf/xdp_redirect_multi.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/testing/selftests/bpf/xdp_redirect_multi.c b/tools/testing/selftests/bpf/xdp_redirect_multi.c index 51c8224b4ccc..aaedbf4955c3 100644 --- a/tools/testing/selftests/bpf/xdp_redirect_multi.c +++ b/tools/testing/selftests/bpf/xdp_redirect_multi.c @@ -32,12 +32,12 @@ static void int_exit(int sig) int i; for (i = 0; ifaces[i] > 0; i++) { - if (bpf_get_link_xdp_id(ifaces[i], &prog_id, xdp_flags)) { - printf("bpf_get_link_xdp_id failed\n"); + if (bpf_xdp_query_id(ifaces[i], xdp_flags, &prog_id)) { + printf("bpf_xdp_query_id failed\n"); exit(1); } if (prog_id) - bpf_set_link_xdp_fd(ifaces[i], -1, xdp_flags); + bpf_xdp_detach(ifaces[i], xdp_flags, NULL); } exit(0); @@ -210,7 +210,7 @@ int main(int argc, char **argv) } /* bind prog_fd to each interface */ - ret = bpf_set_link_xdp_fd(ifindex, prog_fd, xdp_flags); + ret = bpf_xdp_attach(ifindex, prog_fd, xdp_flags, NULL); if (ret) { printf("Set xdp fd failed on %d\n", ifindex); goto err_out; |