[PATCH bpf-next] selftests/bpf: convert test_xdp_features.sh to test_progs

2024-09-09 Thread eBPF Foundation
space when they do not match the expected payload Signed-off-by: Alexis Lothoré (eBPF Foundation) --- The xdp_features rewrite has been tested in a x86_64 qemu environment on my machine and in CI. In my environment, the test takes a bit less than 2s to execute. # ./test_progs -a xdp_feature

[PATCH bpf-next v2] selftests/bpf: convert test_xdp_features.sh to test_progs

2024-09-10 Thread eBPF Foundation
space when they do not match the expected payload - make sure to perform host <-> network endianness conversion on constants rather than packet parts Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - fix endianness management in userspace packet parsing (call htonl on

[PATCH bpf] selftests/bpf: add missing header include for htons

2024-10-08 Thread eBPF Foundation
("selftests/bpf: Add csum helpers") Signed-off-by: Alexis Lothoré (eBPF Foundation) --- tools/testing/selftests/bpf/network_helpers.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/bpf/network_helpers.h b/tools/testing/selftests/bpf/network_helpe

[PATCH bpf-next v3 0/3] selftests/bpf: add coverage for xdp_features in test_progs

2024-10-09 Thread eBPF Foundation
on veth:OK #560 xdp_cpumap_attach:OK Summary: 1/3 PASSED, 0 SKIPPED, 0 FAILED --- Alexis Lothoré (eBPF Foundation) (3): selftests/bpf: fix bpf_map_redirect call for cpu map test selftests/bpf: make xdp_cpumap_attach keep redirect prog attached selftests/bpf: check program

[PATCH bpf-next v3 2/3] selftests/bpf: make xdp_cpumap_attach keep redirect prog attached

2024-10-09 Thread eBPF Foundation
with some dummy context While at it, bring the following minor improvements: - isolate test interface in its own namespace - replicate the test on a veth pair Signed-off-by: Alexis Lothoré (eBPF Foundation) --- This change is based on the similar update brought to xdp_devmap_attach ([1]) and then

[PATCH bpf-next v3 3/3] selftests/bpf: check program redirect in xdp_cpumap_attach

2024-10-09 Thread eBPF Foundation
program performs the configured redirect as well. The check is based on a global variable incremented by a chained program executed only if the redirect program properly executes. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v3: - new patch --- tools/testing/selftests/bpf

[PATCH bpf-next v3 1/3] selftests/bpf: fix bpf_map_redirect call for cpu map test

2024-10-09 Thread eBPF Foundation
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) --- Changes in v3: - new patch

[PATCH bpf-next v2 6/6] selftests/bpf: remove test_tcp_check_syncookie

2024-10-20 Thread eBPF Foundation
Now that btf_skc_cls_ingress has the same coverage as test_tcp_check_syncookie, remove the second one and keep the first one as it is integrated in test_progs Signed-off-by: Alexis Lothoré (eBPF Foundation) --- tools/testing/selftests/bpf/.gitignore | 1 - tools/testing/selftests

[PATCH bpf-next v2 5/6] selftests/bpf: test MSS value returned with bpf_tcp_gen_syncookie

2024-10-20 Thread eBPF Foundation
One remaining difference between test_tcp_check_syncookie.sh and btf_skc_cls_ingress is a small test on the mss value embedded in the cookie generated with the eBPF helper. Bring the corresponding test in btf_skc_cls_ingress. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- tools/testing

[PATCH bpf-next v2 1/6] selftests/bpf: factorize conn and syncookies tests in a single runner

2024-10-20 Thread eBPF Foundation
those two tests by moving the code into a single runner, parameterized by a "gen_cookies" argument. Split the performed checks accordingly. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- .../selftests/bpf/prog_tests/btf_skc_cls_ingress.c | 106 +++-- 1 file c

[PATCH bpf-next v2 4/6] selftests/bpf: add ipv4 and dual ipv4/ipv6 support in btf_skc_cls_ingress

2024-10-20 Thread eBPF Foundation
switch from start_server to start_server_str to allow to check some socket options - the introduction of new subtests for ipv4 and ipv4/ipv6 Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - fix odd indent on switch cases - add missing return or goto in default cases in switches

[PATCH bpf-next v2 3/6] selftests/bpf: get rid of global vars in btf_skc_cls_ingress

2024-10-20 Thread eBPF Foundation
of converting the CHECK on skel->bss->linum, just remove it, since there is already a call to print_err_line after the test to print the failing line in the bpf program Signed-off-by: Alexis Lothoré (eBPF Foundation) --- .../selftests/bpf/prog_tests/btf_skc_cls_ingress.

[PATCH bpf-next v2 2/6] selftests/bpf: add missing ns cleanups in btf_skc_cls_ingress

2024-10-20 Thread eBPF Foundation
namespace management to netns_{new,free} Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - slightly reword commit message to fix mistake - remove `ip link set lo up` in dedicated ns, handled by netns_new --- .../selftests/bpf/prog_tests/btf_skc_cls_ingress.c | 33

[PATCH bpf-next v2 0/6] selftests/bpf: integrate test_tcp_check_syncookie.sh into test_progs

2024-10-20 Thread eBPF Foundation
btf_skc_cls_ingress/syncookie_ipv4:OK #38/5btf_skc_cls_ingress/syncookie_ipv6:OK #38/6btf_skc_cls_ingress/syncookie_dual:OK #38 btf_skc_cls_ingress:OK Summary: 1/6 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - fix initial test author

[PATCH bpf-next 0/6] selftests/bpf: integrate test_tcp_check_syncookie.sh into test_progs

2024-10-16 Thread eBPF Foundation
btf_skc_cls_ingress/syncookie_ipv4:OK #38/5btf_skc_cls_ingress/syncookie_ipv6:OK #38/6btf_skc_cls_ingress/syncookie_dual:OK #38 btf_skc_cls_ingress:OK Summary: 1/6 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Alexis Lothoré (eBPF Foundation) (6

[PATCH bpf-next 2/6] selftests/bpf: add missing ns cleanups in btf_skc_cls_ingress

2024-10-16 Thread eBPF Foundation
namespace management to netns_{new,free} Signed-off-by: Alexis Lothoré (eBPF Foundation) --- .../selftests/bpf/prog_tests/btf_skc_cls_ingress.c | 31 ++ 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c

[PATCH bpf-next 1/6] selftests/bpf: factorize conn and syncookies tests in a single runner

2024-10-16 Thread eBPF Foundation
those two tests by moving the code into a single runner, parameterized by a "gen_cookies" argument. Split the performed checks accordingly. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- .../selftests/bpf/prog_tests/btf_skc_cls_ingress.c | 106 +++-- 1 file c

[PATCH bpf-next 3/6] selftests/bpf: get rid of global vars in btf_skc_cls_ingress

2024-10-16 Thread eBPF Foundation
of converting the CHECK on skel->bss->linum, just remove it, since there is already a call to print_err_line after the test to print the failing line in the bpf program Signed-off-by: Alexis Lothoré (eBPF Foundation) --- .../selftests/bpf/prog_tests/btf_skc_cls_ingress.

[PATCH bpf-next 6/6] selftests/bpf: remove test_tcp_check_syncookie

2024-10-16 Thread eBPF Foundation
Now that btf_skc_cls_ingress has the same coverage as test_tcp_check_syncookie, remove the second one and keep the first one as it is integrated in test_progs Signed-off-by: Alexis Lothoré (eBPF Foundation) --- tools/testing/selftests/bpf/.gitignore | 1 - tools/testing/selftests

[PATCH bpf-next 4/6] selftests/bpf: add ipv4 and dual ipv4/ipv6 support in btf_skc_cls_ingress

2024-10-16 Thread eBPF Foundation
switch from start_server to start_server_str to allow to check some socket options - the introduction of new subtests for ipv4 and ipv4/ipv6 Signed-off-by: Alexis Lothoré (eBPF Foundation) --- The rework has been tested in a local Qemu environment and in CI: # ./test_progs -a btf_skc_cls_ingress

[PATCH bpf-next 5/6] selftests/bpf: test MSS value returned with bpf_tcp_gen_syncookie

2024-10-16 Thread eBPF Foundation
One remaining difference between test_tcp_check_syncookie.sh and btf_skc_cls_ingress is a small test on the mss value embedded in the cookie generated with the eBPF helper. Bring the corresponding test in btf_skc_cls_ingress. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- tools/testing

[PATCH bpf-next 09/10] selftests/bpf: migrate bpf flow dissectors tests to test_progs

2024-11-13 Thread eBPF Foundation
also run in CI. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- The content of this new test is heavily based on the initial test_flow_dissector.c. I have kept most of the packet build function (even if not all packet types are used for the test) to allow extending the test later if needed

[PATCH bpf-next 03/10] selftests/bpf: replace CHECK calls with ASSERT macros in flow_dissector test

2024-11-13 Thread eBPF Foundation
The flow dissector test currently relies on generic CHECK macros to perform tests. Update those to newer, more-specific ASSERT macros. This update allows to get rid of the global duration variable, which was needed by the CHECK macros Signed-off-by: Alexis Lothoré (eBPF Foundation

[PATCH bpf-next 00/10] selftests/bpf: migrate test_flow_dissector.sh to test_progs

2024-11-13 Thread eBPF Foundation
sector (eg: __skb_flow_bpf_to_target) --- Alexis Lothoré (eBPF Foundation) (10): selftests/bpf: add a macro to compare raw memory selftests/bpf: use ASSERT_MEMEQ to compare bpf flow keys selftests/bpf: replace CHECK calls with ASSERT macros in flow_dissector test selftests/bpf

[PATCH bpf-next 02/10] selftests/bpf: use ASSERT_MEMEQ to compare bpf flow keys

2024-11-13 Thread eBPF Foundation
run_tests_skb_less (it was only used by the CHECK macro for its duration field) Signed-off-by: Alexis Lothoré (eBPF Foundation) --- .../selftests/bpf/prog_tests/flow_dissector.c | 36 -- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests

[PATCH bpf-next 07/10] selftests/bpf: migrate flow_dissector namespace exclusivity test

2024-11-13 Thread eBPF Foundation
ssector in root namespace Since the new test is performing operations in the root net namespace, make sure to set it as a "serial" test to make sure not to conflict with any other test. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- .../selftests/bpf/prog_tests/flow_d

[PATCH bpf-next 06/10] selftests/bpf: add gre packets testing to flow_dissector

2024-11-13 Thread eBPF Foundation
The bpf_flow program is able to handle GRE headers in IP packets. Add a few test data input simulating those GRE packets, with 2 different cases: - parse GRE and the encapsulated packet - parse GRE only Signed-off-by: Alexis Lothoré (eBPF Foundation) --- .../selftests/bpf/prog_tests

[PATCH bpf-next 10/10] selftests/bpf: remove test_flow_dissector.sh

2024-11-13 Thread eBPF Foundation
Now that test_flow_dissector.sh has been converted to test_progs, remove the legacy test. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- tools/testing/selftests/bpf/.gitignore | 1 - tools/testing/selftests/bpf/Makefile | 3 +- tools/testing/selftests/bpf

[PATCH bpf-next 08/10] selftests/bpf: Enable generic tc actions in selftests config

2024-11-13 Thread eBPF Foundation
Enable CONFIG_NET_ACT_GACT to allow adding simple actions with tc filters. This is for example needed to migrate test_flow_dissector into the automated testing performed in CI. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- tools/testing/selftests/bpf/config | 1 + 1 file changed, 1

[PATCH bpf-next 01/10] selftests/bpf: add a macro to compare raw memory

2024-11-13 Thread eBPF Foundation
comparision Signed-off-by: Alexis Lothoré (eBPF Foundation) --- tools/testing/selftests/bpf/test_progs.h | 25 + 1 file changed, 25 insertions(+) diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h index

[PATCH bpf-next 05/10] selftests/bpf: expose all subtests from flow_dissector

2024-11-13 Thread eBPF Foundation
flow_dissector by using test__start_subtest(). Signed-off-by: Alexis Lothoré (eBPF Foundation) --- This change resulsts in the exposure of 42 subtests with the current content from flow_dissector: # ./test_progs -a flow_dissector #102/1 flow_dissector/ipv4-skb:OK #102/2 flow_dissector/ipv6-skb:OK

[PATCH bpf-next 04/10] selftests/bpf: re-split main function into dedicated tests

2024-11-13 Thread eBPF Foundation
of being able to run them separately. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- .../selftests/bpf/prog_tests/flow_dissector.c | 92 ++ 1 file changed, 57 insertions(+), 35 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/flow_dissector.c b

[PATCH bpf-next] selftests/bpf: ensure proper root namespace cleanup when test fail

2024-11-28 Thread eBPF Foundation
s/bpf: migrate flow_dissector namespace exclusivity test") Signed-off-by: Alexis Lothoré (eBPF Foundation) --- This small fix addresses an issue discovered while trying to add a new test in my recently merged work on flow_dissector migration. This new test is still only present in bpf-next, henc

[PATCH bpf-next v3 07/14] selftests/bpf: migrate flow_dissector namespace exclusivity test

2024-11-19 Thread eBPF Foundation
ssector in root namespace Since the new test is performing operations in the root net namespace, make sure to set it as a "serial" test to make sure not to conflict with any other test. Acked-by: Stanislav Fomichev Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v3

[PATCH bpf-next v3 10/14] selftests/bpf: document pseudo-header checksum helpers

2024-11-19 Thread eBPF Foundation
network_helpers.h provides helpers to compute checksum for pseudo headers but no helpers to compute the global checksums. Before adding those, clarify csum_tcpudp_magic and csum_ipv6_magic purpose by adding some documentation. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v3

[PATCH bpf-next v3 13/14] selftests/bpf: migrate bpf flow dissectors tests to test_progs

2024-11-19 Thread eBPF Foundation
also run in CI. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v3: - use updated helpers - do not cast test structure, propagate it as const - remove duplicate assert - remove intermediate function for simple test teardown Changes in v2: - use new helpers added to network_helpers

[PATCH bpf-next v3 14/14] selftests/bpf: remove test_flow_dissector.sh

2024-11-19 Thread eBPF Foundation
Now that test_flow_dissector.sh has been converted to test_progs, remove the legacy test. Acked-by: Stanislav Fomichev Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v3: - none Changes in v2: - fetch Acked-by tag --- tools/testing/selftests/bpf/.gitignore | 1

[PATCH bpf-next v3 03/14] selftests/bpf: replace CHECK calls with ASSERT macros in flow_dissector test

2024-11-19 Thread eBPF Foundation
(eBPF Foundation) --- Changes in v3: -none Changes in v2: - fetch acked-by tag --- .../selftests/bpf/prog_tests/flow_dissector.c | 41 +++--- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/flow_dissector.c b/tools

[PATCH bpf-next v3 04/14] selftests/bpf: re-split main function into dedicated tests

2024-11-19 Thread eBPF Foundation
of being able to run them separately. While at it, make sure that tests attaching the bpf programs are run in a dedicated ns. Acked-by: Stanislav Fomichev Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v3: -none Changes in v2: - fix some error path sequences (eg: closing properly

[PATCH bpf-next v3 01/14] selftests/bpf: add a macro to compare raw memory

2024-11-19 Thread eBPF Foundation
00 00 00 00 00 00 [...] Acked-by: Stanislav Fomichev Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v3: - none Changes in v2: - replace DUMP_BUFFER with a real function - make this function take a prefix - add formatting example in the commit message --- tools/testing/selftests

[PATCH bpf-next v3 00/14] selftests/bpf: migrate test_flow_dissector.sh to test_progs

2024-11-19 Thread eBPF Foundation
nges in v2: - allow tests to run in parallel - move some generic helpers to network_helpers.h - define proper function for ASSERT_MEMEQ - fetch acked-by tags - Link to v1: https://lore.kernel.org/r/20241113-flow_dissector-v1-0-27c4df059...@bootlin.com --- Alexis Lothoré (eBPF Foundation) (14):

[PATCH bpf-next v3 02/14] selftests/bpf: use ASSERT_MEMEQ to compare bpf flow keys

2024-11-19 Thread eBPF Foundation
run_tests_skb_less (it was only used by the CHECK macro for its duration field) Acked-by: Stanislav Fomichev Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v3: - none Changes in v2: - fetch acked-by tag --- .../selftests/bpf/prog_tests/flow_dissector.c | 36 -- 1 file

[PATCH bpf-next v3 06/14] selftests/bpf: add gre packets testing to flow_dissector

2024-11-19 Thread eBPF Foundation
The bpf_flow program is able to handle GRE headers in IP packets. Add a few test data input simulating those GRE packets, with 2 different cases: - parse GRE and the encapsulated packet - parse GRE only Acked-by: Stanislav Fomichev Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in

[PATCH bpf-next v3 05/14] selftests/bpf: expose all subtests from flow_dissector

2024-11-19 Thread eBPF Foundation
flow_dissector by using test__start_subtest(). Acked-by: Stanislav Fomichev Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v3: -none Changes in v2: - fetch Acked-by tag This change resulsts in the exposure of 42 subtests with the current content from flow_dissector: # ./test_progs -a

[PATCH bpf-next v3 11/14] selftests/bpf: use the same udp and tcp headers in tests under test_progs

2024-11-19 Thread eBPF Foundation
error is due to struct udphdr being defined in both and . Use only in every test. While at it, perform the same for tcp.h. For some tests, the change needs to be done in the eBPF program part as well, because of some headers sharing between both sides. Signed-off-by: Alexis Lothoré (eBPF

[PATCH bpf-next v3 12/14] selftests/bpf: add network helpers to generate udp checksums

2024-11-19 Thread eBPF Foundation
network_helpers.c provides some helpers to generate ip checksums or ip pseudo-header checksums, but not for upper layers (eg: udp checksums) Add helpers for udp checksum to allow manually building udp packets. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v3: - reuse pseudo

[PATCH bpf-next v3 08/14] selftests/bpf: Enable generic tc actions in selftests config

2024-11-19 Thread eBPF Foundation
Enable CONFIG_NET_ACT_GACT to allow adding simple actions with tc filters. This is for example needed to migrate test_flow_dissector into the automated testing performed in CI. Acked-by: Stanislav Fomichev Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v3: - none Changes in v2

[PATCH bpf-next v3 09/14] selftests/bpf: move ip checksum helper to network helpers

2024-11-19 Thread eBPF Foundation
xdp_metadata test has a small helper computing ipv4 checksums to allow manually building packets. Move this helper to network_helpers to share it with other tests. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v3: - use csum_partial for intermediate helper name to keep sync

[PATCH bpf-next v2 12/13] selftests/bpf: migrate bpf flow dissectors tests to test_progs

2024-11-14 Thread eBPF Foundation
also run in CI. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - use new helpers added to network_helpers The content of this new test is heavily based on the initial test_flow_dissector.c. I have kept most of the packet build function (even if not all packet types are used for

[PATCH bpf-next v2 08/13] selftests/bpf: Enable generic tc actions in selftests config

2024-11-14 Thread eBPF Foundation
Enable CONFIG_NET_ACT_GACT to allow adding simple actions with tc filters. This is for example needed to migrate test_flow_dissector into the automated testing performed in CI. Acked-by: Stanislav Fomichev Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - fetch Acked-by tag

[PATCH bpf-next v2 01/13] selftests/bpf: add a macro to compare raw memory

2024-11-14 Thread eBPF Foundation
00 00 00 00 00 00 [...] Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - replace DUMP_BUFFER with a real function - make this function take a prefix - add formatting example in the commit message --- tools/testing/selftests/bpf/test_progs.c | 15 +++ tools/testing

[PATCH bpf-next v2 04/13] selftests/bpf: re-split main function into dedicated tests

2024-11-14 Thread eBPF Foundation
of being able to run them separately. While at it, make sure that tests attaching the bpf programs are run in a dedicated ns. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - fix some error path sequences (eg: closing properly tap interface) - isolate tests in dedicated ns - do

[PATCH bpf-next v2 05/13] selftests/bpf: expose all subtests from flow_dissector

2024-11-14 Thread eBPF Foundation
flow_dissector by using test__start_subtest(). Acked-by: Stanislav Fomichev Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - fetch Acked-by tag This change resulsts in the exposure of 42 subtests with the current content from flow_dissector: # ./test_progs -a flow_dissector #102/1

[PATCH bpf-next v2 07/13] selftests/bpf: migrate flow_dissector namespace exclusivity test

2024-11-14 Thread eBPF Foundation
ssector in root namespace Since the new test is performing operations in the root net namespace, make sure to set it as a "serial" test to make sure not to conflict with any other test. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- .../selftests/bpf/prog_tests/flow_d

[PATCH bpf-next v2 11/13] selftests/bpf: add network helpers to generate udp checksums

2024-11-14 Thread eBPF Foundation
network_helpers.c provides some helpers to generate ip checksums or ip pseudo-header checksums, but not for upper layers (eg: udp checksums) Add helpers for udp checksum to allow manually building udp packets. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - new patch

[PATCH bpf-next v2 10/13] selftests/bpf: rename pseudo headers checksum computation

2024-11-14 Thread eBPF Foundation
network_helpers.h provides helpers to compute checksum for pseudo headers but no helpers to compute the global checksums. Before adding those, rename the pseudo header checksum helper to clarify their role. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - new patch

[PATCH bpf-next v2 09/13] selftests/bpf: move ip checksum helper to network helpers

2024-11-14 Thread eBPF Foundation
xdp_metadata test has a small helper computing ipv checksums to allow manually building packets. Move this helper to network_helpers to share it with other tests. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - new patch --- tools/testing/selftests/bpf/network_helpers.h

[PATCH bpf-next v2 06/13] selftests/bpf: add gre packets testing to flow_dissector

2024-11-14 Thread eBPF Foundation
The bpf_flow program is able to handle GRE headers in IP packets. Add a few test data input simulating those GRE packets, with 2 different cases: - parse GRE and the encapsulated packet - parse GRE only Acked-by: Stanislav Fomichev Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in

[PATCH bpf-next v2 03/13] selftests/bpf: replace CHECK calls with ASSERT macros in flow_dissector test

2024-11-14 Thread eBPF Foundation
(eBPF Foundation) --- Changes in v2: - fetch acked-by tag --- .../selftests/bpf/prog_tests/flow_dissector.c | 41 +++--- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/flow_dissector.c b/tools/testing/selftests/bpf

[PATCH bpf-next v2 00/13] selftests/bpf: migrate test_flow_dissector.sh to test_progs

2024-11-14 Thread eBPF Foundation
--- Alexis Lothoré (eBPF Foundation) (13): selftests/bpf: add a macro to compare raw memory selftests/bpf: use ASSERT_MEMEQ to compare bpf flow keys selftests/bpf: replace CHECK calls with ASSERT macros in flow_dissector test selftests/bpf: re-split main function into dedic

[PATCH bpf-next v2 13/13] selftests/bpf: remove test_flow_dissector.sh

2024-11-14 Thread eBPF Foundation
Now that test_flow_dissector.sh has been converted to test_progs, remove the legacy test. Acked-by: Stanislav Fomichev Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - fetch Acked-by tag --- tools/testing/selftests/bpf/.gitignore | 1 - tools/testing/selftests

[PATCH bpf-next v2 02/13] selftests/bpf: use ASSERT_MEMEQ to compare bpf flow keys

2024-11-14 Thread eBPF Foundation
run_tests_skb_less (it was only used by the CHECK macro for its duration field) Acked-by: Stanislav Fomichev Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - fetch acked-by tag --- .../selftests/bpf/prog_tests/flow_dissector.c | 36 -- 1 file changed, 6 insertions

[PATCH RFC bpf-next 0/4] bpf, arm64: support up to 12 arguments

2025-04-11 Thread eBPF Foundation
s64/aapcs64.rst#id82 [3] https://lore.kernel.org/bpf/20240705125336.46820-1-puran...@kernel.org/ [4] https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Alexis Lothoré (eBPF Foundation) (3): bpf: add struct largest member size in func model

[PATCH RFC bpf-next 4/4] bpf/selftests: enable tracing tests for ARM64

2025-04-11 Thread eBPF Foundation
The fentry_many_args, fexit_many_args and struct_many_args tests were disabled on ARM64 due to the lack of many args support. With the previous commits bringing in this missing support, drop the last denied tests. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- tools/testing/selftests/bpf

[PATCH RFC bpf-next 1/4] bpf: add struct largest member size in func model

2025-04-11 Thread eBPF Foundation
arch-specific concerns (ie: guessing the final needed alignment for an argument) isolated in each JIT compiler. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- include/linux/bpf.h | 1 + kernel/bpf/btf.c| 25 + 2 files changed, 26 insertions(+) diff --git a/include/

[PATCH RFC bpf-next 3/4] bpf/selftests: add tests to validate proper arguments alignment on ARM64

2025-04-11 Thread eBPF Foundation
ame arguments, except that the second one requires a more specific alignment to be set by the trampoline when preparing arguments before calling the the target function. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- .../selftests/bpf/prog_tests/tracing_struct.c | 23 to

[PATCH] bpf/selftests: test_select_reuseport_kern: remove unused header

2025-02-27 Thread eBPF Foundation
test_select_reuseport_kern.c is currently including , but it does not use any definition from there. Remove stdlib.h inclusion from test_select_reuseport_kern.c Signed-off-by: Alexis Lothoré (eBPF Foundation) --- I stumbled upon this specific header include while trying to build selftests on

[PATCH] selftests/bpf: DENYLIST.aarch64: enable kprobe_multi tests for ARM64

2025-02-19 Thread eBPF Foundation
architecture. Remove the tests depending on kprobe_multi from DENYLIST.aarch64 to allow those to run in CI. CONFIG_FPROBE is already correctly set in tools/testing/selftests/bpf/config Signed-off-by: Alexis Lothoré (eBPF Foundation) --- The tests being enabled with this series have been run locally

[PATCH bpf-next v3 2/2] selftests/bpf: enable many-args tests for arm64

2025-05-27 Thread eBPF Foundation
Now that support for up to 12 args is enabled for tracing programs on ARM64, enable the existing tests for this feature on this architecture. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - keep tracing struct tests disabled, as structs passed on stack are not handled by

[PATCH bpf-next v2 2/2] selftests/bpf: enable many-args tests for arm64

2025-05-22 Thread eBPF Foundation
Now that support for up to 12 args is enabled for tracing programs on ARM64, enable the existing tests for this feature on this architecture. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Changes in v2: - keep tracing struct tests disabled, as structs passed on stack are not handled by

[PATCH bpf 4/7] bpf/s390: prevent trampoline attachment when args location on stack is uncertain

2025-06-13 Thread eBPF Foundation
the existing check (ensuring that the number of args passed on stack is not higher than MAX_NR_STACK_ARGS) into the newly created check function. Fixes: 528eb2cb87bc ("s390/bpf: Implement arch_prepare_bpf_trampoline()") Signed-off-by: Alexis Lothoré (eBPF Foundation) --- arc

[PATCH bpf 0/7] bpf: deny trampoline attachment if args can not be located exactly on stack

2025-06-13 Thread eBPF Foundation
-many_args_arm64-v1-0-0a32fe723...@bootlin.com/ [2] https://lore.kernel.org/bpf/caadnvqkr3ftnt1uqvrxbe0a2o37zyro2phqcohunw6pe5t2...@mail.gmail.com/ Signed-off-by: Alexis Lothoré (eBPF Foundation) --- Alexis Lothoré (eBPF Foundation) (7): bpf/x86: use define for max regs count used for

[PATCH bpf 5/7] bpf/powerpc64: use define for max regs count used for arguments

2025-06-13 Thread eBPF Foundation
powerpc allows using up to 8 registers to pass arguments between function calls. This value is hardcoded in multiple places, use a define for this value. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- arch/powerpc/net/bpf_jit_comp.c | 10 +++--- 1 file changed, 7 insertions(+), 3

[PATCH bpf 2/7] bpf/x86: prevent trampoline attachment when args location on stack is uncertain

2025-06-13 Thread eBPF Foundation
max bpf args check in the new function. Fixes: 473e3150e30a ("bpf, x86: allow function arguments up to 12 for TRACING") Signed-off-by: Alexis Lothoré (eBPF Foundation) --- arch/x86/net/bpf_jit_comp.c | 36 ++-- 1 file changed, 30 insertions(+), 6 deletion

[PATCH bpf 3/7] bpf/riscv: prevent trampoline attachment when args location on stack is uncertain

2025-06-13 Thread eBPF Foundation
max bpf args check in the new function. Fixes: 6801b0aef79d ("riscv, bpf: Add 12-argument support for RV64 bpf trampoline") Signed-off-by: Alexis Lothoré (eBPF Foundation) --- arch/riscv/net/bpf_jit_comp64.c | 26 -- 1 file changed, 24 insertions(+), 2 deletion

[PATCH bpf 1/7] bpf/x86: use define for max regs count used for arguments

2025-06-13 Thread eBPF Foundation
x86 allows using up to 6 registers to pass arguments between function calls. This value is hardcoded in multiple places, use a define for this value. Signed-off-by: Alexis Lothoré (eBPF Foundation) --- arch/x86/net/bpf_jit_comp.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions

[PATCH bpf 6/7] bpf/powerpc64: prevent trampoline attachment when args location on stack is uncertain

2025-06-13 Thread eBPF Foundation
max bpf args check in the new function. Fixes: d243b62b7bd3 ("powerpc64/bpf: Add support for bpf trampolines") Signed-off-by: Alexis Lothoré (eBPF Foundation) --- arch/powerpc/net/bpf_jit_comp.c | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --

[PATCH bpf 7/7] selftests/bpf: ensure that functions passing structs on stack can not be hooked

2025-06-13 Thread eBPF Foundation
arguments on stack (-> more than 8 args) Signed-off-by: Alexis Lothoré (eBPF Foundation) --- .../selftests/bpf/prog_tests/tracing_struct.c | 37 +--- .../selftests/bpf/progs/tracing_struct_many_args.c | 70 -- .../testing/selftests/bpf/test_kmods/bpf_testmod.c |

[PATCH 1/2] bpf, arm64: remove structs on stack constraint

2025-07-09 Thread eBPF Foundation
[3] https://lore.kernel.org/bpf/20250707-btf_skip_structs_on_stack-v3-0-29569e086...@bootlin.com/ Signed-off-by: Alexis Lothoré (eBPF Foundation) --- arch/arm64/net/bpf_jit_comp.c | 5 - 1 file changed, 5 deletions(-) diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_co

[PATCH 0/2] bpf, arm64: relax constraint in BPF JIT compiler

2025-07-09 Thread eBPF Foundation
Lothoré (eBPF Foundation) --- Alexis Lothoré (eBPF Foundation) (2): bpf, arm64: remove structs on stack constraint selftests/bpf: enable tracing_struct tests for arm64 arch/arm64/net/bpf_jit_comp.c| 5 - tools/testing/selftests/bpf/DENYLIST.aarch64 | 1 - 2 files

[PATCH 2/2] selftests/bpf: enable tracing_struct tests for arm64

2025-07-09 Thread eBPF Foundation
Now that the constraint preventing attachment to functions consuming struct on stack has been removed from the kernel (and moved to pahole, with a slightly smarter detection, to prevent only those that are packed), re-enable the tracing_struct tests for arm64. Signed-off-by: Alexis Lothoré (eBPF

[PATCH bpf-next v4 06/14] selftests/bpf: test_xdp_veth: Rename config[]

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
The network topology is held by the config[] table. This 'config' name is a bit too generic if we want to add other configuration variables. Rename config[] to net_config[]. Acked-by: Stanislav Fomichev Signed-off-by: Bastien Curutchet (eBPF Foundation) --- .../selftests/bpf/

[PATCH bpf-next v4 05/14] selftests/bpf: test_xdp_veth: Split network configuration

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
e BPF configuration to the test itself. Split the test description in two parts, first the description of the network topology, then the description of the test case. Remove the veth indexes from the ASCII art as dynamic ones are used Acked-by: Stanislav Fomichev Signed-off-by: Bastien Curutchet (eBPF Found

[PATCH bpf-next v4 04/14] selftests/bpf: test_xdp_veth: Use int to describe next veth

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
used as an offset in the network configuration table. Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/selftests/bpf/prog_tests/test_xdp_veth.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests

[PATCH bpf-next v4 03/14] selftests/bpf: test_xdp_veth: Remove unecessarry check_ping()

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
check_ping() directly returns a SYS_NOFAIL without any previous treatment. It's called only once in the file and hardcodes the used namespace and ip address. Replace check_ping() with a direct call of SYS_NOFAIL in the test. Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/te

[PATCH bpf-next v4 09/14] selftests/bpf: test_xdp_veth: Use unique names

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
each test. Set a fixed size to remote_addr field so the struct veth_configuration can also have a fixed size. Signed-off-by: Bastien Curutchet (eBPF Foundation) --- .../selftests/bpf/prog_tests/test_xdp_veth.c | 51 ++ 1 file changed, 33 insertions(+), 18 deletions

[PATCH bpf-next v4 10/14] selftests/bpf: test_xdp_veth: Add new test cases for XDP flags

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
The XDP redirection is tested without any flag provided to the xdp_attach() function. Add two subtests that check the correct behaviour with XDP_FLAGS_{DRV/SKB}_MODE flags Acked-by: Stanislav Fomichev Signed-off-by: Bastien Curutchet (eBPF Foundation) --- .../selftests/bpf/prog_tests

[PATCH bpf-next v4 07/14] selftests/bpf: test_xdp_veth: Add prog_config[] table

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
tchet (eBPF Foundation) --- .../selftests/bpf/prog_tests/test_xdp_veth.c | 133 + 1 file changed, 80 insertions(+), 53 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/test_xdp_veth.c b/tools/testing/selftests/bpf/prog_tests/test_xdp_veth.c

[PATCH bpf-next v4 11/14] selftests/bpf: Optionally select broadcasting flags

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
ed-by: Stanislav Fomichev Signed-off-by: Bastien Curutchet (eBPF Foundation) --- .../selftests/bpf/progs/xdp_redirect_multi_kern.c | 41 +++--- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/xdp_redirect_multi_kern.c b/tools/te

[PATCH bpf-next v4 08/14] selftests/bpf: test_xdp_veth: Add XDP flags to prog_configuration

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
XDP flags are hardcoded to 0 at attachment. Add flags attributes to the struct prog_configuration to allow flag modifications for each test case. Acked-by: Stanislav Fomichev Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/selftests/bpf/prog_tests/test_xdp_veth.c | 14

[PATCH bpf-next v4 12/14] selftests/bpf: test_xdp_veth: Add XDP broadcast redirection tests

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
map to select the broadcast flags. Use a BPF map with an entry per veth to check whether packets are received or not Acked-by: Stanislav Fomichev Signed-off-by: Bastien Curutchet (eBPF Foundation) --- .../selftests/bpf/prog_tests/test_xdp_veth.c | 150 + .../testing

[PATCH bpf-next v4 14/14] selftests/bpf: Remove test_xdp_redirect_multi.sh

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/selftests/bpf/Makefile | 2 - .../selftests/bpf/test_xdp_redirect_multi.sh | 214 --- tools/testing/selftests/bpf/xdp_redirect_multi.c | 226 - 3 files changed, 442

[PATCH bpf-next v4 00/14] selftests/bpf: Migrate test_xdp_redirect_multi.sh to test_progs

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
ulti.sh Signed-off-by: Bastien Curutchet (eBPF Foundation) --- Changes in v4: - Remove the NO_IP #define - append_tid() takes string's size as input to ensure there is enough space to fit the thread ID at the end - Fix PATCH 12's commit log - Link to v3: https://lore.kernel.org/r/202

[PATCH bpf-next v4 01/14] selftests/bpf: helpers: Add append_tid()

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
Some tests can't be run in parallel because they use same namespace names or veth names. Create an helper that appends the thread ID to a given string. 8 characters are used for it (7 digits + '\0') Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testin

[PATCH bpf-next v4 02/14] selftests/bpf: test_xdp_veth: Remove unused defines

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
IP_CMD_MAX_LEN and NS_SUFFIX_LEN aren't used anywhere. Remove these unused defines Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/selftests/bpf/prog_tests/test_xdp_veth.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_

[PATCH bpf-next v4 13/14] selftests/bpf: test_xdp_veth: Add XDP program on egress test

2025-01-30 Thread Bastien Curutchet (eBPF Foundation)
BPF map. Use a BPF program that stores the source MAC of received packets in a map to check the test results. Acked-by: Stanislav Fomichev Signed-off-by: Bastien Curutchet (eBPF Foundation) --- .../selftests/bpf/prog_tests/test_xdp_veth.c | 125 + .../testing/selftests

[PATCH bpf-next] selftests/bpf: Remove with_addr.sh and with_tunnels.sh

2025-02-04 Thread Bastien Curutchet (eBPF Foundation)
sed scripts and their Makefile entries. Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/selftests/bpf/Makefile| 4 +-- tools/testing/selftests/bpf/with_addr.sh| 54 - tools/testing/selftests/bpf/with_tunnels.sh | 36 -

[PATCH bpf-next v5 2/6] selftests/bpf: test_xdp_veth: Use a dedicated namespace

2025-02-12 Thread Bastien Curutchet (eBPF Foundation)
er to ensure the uniqueness of this namespace's name during parallel runs. Remove the use of the append_tid() on the veth names as they now belong to an already unique namespace. Simplify cleanup_network() by directly deleting the namespaces Signed-off-by: Bastien Curutchet (eBPF

[PATCH bpf-next v5 1/6] selftests/bpf: test_xdp_veth: Create struct net_configuration

2025-02-12 Thread Bastien Curutchet (eBPF Foundation)
ributes in upcoming patch. Signed-off-by: Bastien Curutchet (eBPF Foundation) --- .../selftests/bpf/prog_tests/test_xdp_veth.c | 108 +++-- 1 file changed, 59 insertions(+), 49 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/test_xdp_veth.c b/tools/testing

[PATCH bpf-next v5 0/6] selftests/bpf: Migrate test_xdp_redirect_multi.sh to test_progs

2025-02-12 Thread Bastien Curutchet (eBPF Foundation)
8f5d07b9a ("rtnetlink: fix netns leak with rtnl_setlink()") in the net tree. Signed-off-by: Bastien Curutchet (eBPF Foundation) --- Changes in v5: - Remove the patches that were applied from previous iteration - Add PATCH 1 & 2 to avoid using the root namespace so the veth indexes don

  1   2   >