]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: test_xdp_veth: Add prog_config[] table
authorBastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com>
Fri, 31 Jan 2025 07:21:46 +0000 (08:21 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 3 Feb 2025 11:33:52 +0000 (03:33 -0800)
commitedb996fae276927df96c3c332e18a658bc0f2492
treec4cf0d7804de8f3482ebeb5a99ee6dc33f073f70
parent7e9f3c875d1cae35a3f23dc527d408ea4b90e562
selftests/bpf: test_xdp_veth: Add prog_config[] table

The BPF program attached to each veth is hardcoded through the
use of the struct skeletons. It prevents from re-using the initialization
code in new test cases.

Replace the struct skeletons by a bpf_object table.
Add a struct prog_configuration that holds the name of BPF program to
load on a given veth pair.
Use bpf_object__find_program_by_name() / bpf_xdp_attach() API instead of
bpf_program__attach_xdp() to retrieve the BPF programs from their names.
Detach BPF progs in the cleanup() as it's not automatically done by this
API.

Signed-off-by: Bastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20250131-redirect-multi-v4-7-970b33678512@bootlin.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/test_xdp_veth.c