From: Alexis Lothoré (eBPF Foundation) Date: Wed, 9 Oct 2024 10:12:07 +0000 (+0200) Subject: selftests/bpf: fix bpf_map_redirect call for cpu map test X-Git-Tag: v6.13-rc1~135^2~319^2~6^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ac8d16b2d3772934f4cba44cb01bad05b4b2864c;p=thirdparty%2Flinux.git selftests/bpf: fix bpf_map_redirect call for cpu map test xdp_redir_prog currently redirects packets based on the entry at index 1 in cpu_map, but the corresponding test only manipulates the entry at index 0. This does not really affect the test in its current form since the program is detached before having the opportunity to execute, but it needs to be fixed before being able improve the corresponding test (ie, not only test attach/detach but also the redirect feature) Fix this XDP program by making it redirect packets based on entry 0 in cpu_map instead of entry 1. Signed-off-by: Alexis Lothoré (eBPF Foundation) Link: https://lore.kernel.org/r/20241009-convert_xdp_tests-v3-1-51cea913710c@bootlin.com Signed-off-by: Martin KaFai Lau --- diff --git a/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c b/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c index 20ec6723df18a..d848fe96924e3 100644 --- a/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c +++ b/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c @@ -15,7 +15,7 @@ struct { SEC("xdp") int xdp_redir_prog(struct xdp_md *ctx) { - return bpf_redirect_map(&cpu_map, 1, 0); + return bpf_redirect_map(&cpu_map, 0, 0); } SEC("xdp")