selftests/bpf: add lwt ip encap tests to test_progs
Subsystems (3)
PATCH v3 1/1 selftests/bpf: add lwt ip encap tests to test_progs
Port test_lwt_ip_encap.sh tests onto test_progs.
In addition, this commit adds "egress_md" tests which test a similar flow as egress tests only they use gre devices in collect_md mode for encapsulation and set the tunnel key using bpf_set_tunnel_key().
This introduces minor changes to the test setup and test_lwt_ip_encap.c:
- GRE key must exist as bpf_set_tunnel_key() explicitly sets the TUNNEL_KEY flag
- Source address for GRE traffic is set to IP*_5 instead of IP*_1 since GRE traffic is sent via veth5 so its address is selected when using bpf_set_tunnel_key()
Note: currently these programs use the legacy section name convention as iproute2 lwt configuration does not support providing function names.
Since the shell version is not routinely tested, remove it and rely on the C version.
----
v2: remove lwt_ip_encap.sh
v2:
- set CONFIG_NET_VRF and CONFIG_NET_L3_MASTER_DEV in reference .config
- add wait after sending large packet to allow it to get delivered as in the .sh test
--- tools/testing/selftests/bpf/Makefile | 1 - tools/testing/selftests/bpf/config | 2 + .../selftests/bpf/prog_tests/lwt_ip_encap.c | 585 ++++++++++++++++++ .../selftests/bpf/progs/test_lwt_ip_encap.c | 51 +- .../selftests/bpf/test_lwt_ip_encap.sh | 475 -------------- 5 files changed, 634 insertions(+), 480 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/lwt_ip_encap.c delete mode 100755 tools/testing/selftests/bpf/test_lwt_ip_encap.sh
tools/testing/selftests/bpf/Makefile +0 -1
@@ -63,7 +63,6 @@ TEST_PROGS := test_kmod.sh \ test_flow_dissector.sh \ test_xdp_vlan_mode_generic.sh \ test_xdp_vlan_mode_native.sh \ - test_lwt_ip_encap.sh \ test_tcp_check_syncookie.sh \ test_tc_tunnel.sh \ test_tc_edt.sh \
tools/testing/selftests/bpf/config +2 -0
@@ -64,3 +64,5 @@ CONFIG_TEST_BPF=m CONFIG_USERFAULTFD=y CONFIG_VXLAN=y CONFIG_XDP_SOCKETS=y +CONFIG_NET_VRF=y +CONFIG_NET_L3_MASTER_DEV=y
tools/testing/selftests/bpf/prog_tests/lwt_ip_encap.c new file +585 -0
585 lines not on this page · raw message
tools/testing/selftests/bpf/progs/test_lwt_ip_encap.c +47 -4
90 lines not on this page · raw message
tools/testing/selftests/bpf/test_lwt_ip_encap.sh deleted +0 -475
475 lines not on this page · raw message
Signature · 1 line
2.34.1
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Quoted 9 lines · On Wed, 24 Aug 2022 14:06:32 +0300 you wrote:
Port
test_lwt_ip_encap.shtests ontotest_progs.In addition, this commit adds "
egress_md" tests which test a similar flow as egress tests only they use gre devices incollect_mdmode for encapsulation and set the tunnel key usingbpf_set_tunnel_key().This introduces minor changes to the test setup and
test_lwt_ip_encap.c:[...]
Here is the summary with links:
- [bpf-next,v3] selftests/bpf: add lwt ip encap tests to test_progs
https://git.kernel.org/bpf/bpf-next/c/a8df1b0636af
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 15 lines · On Wed, Aug 24, 2022 at 10:20 AM <[email protected]> wrote:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Quoted 8 lines · On Wed, 24 Aug 2022 14:06:32 +0300 you wrote:
Port
test_lwt_ip_encap.shtests ontotest_progs.In addition, this commit adds "
egress_md" tests which test a similar flow as egress tests only they use gre devices incollect_mdmode for encapsulation and set the tunnel key usingbpf_set_tunnel_key().This introduces minor changes to the test setup and
test_lwt_ip_encap.c:
Quoted 7 lines
Quoted 1 line
[...]
Here is the summary with links:
- [bpf-next,v3] selftests/bpf: add lwt ip encap tests totest_progshttps://git.kernel.org/bpf/bpf-next/c/a8df1b0636afYou are awesome, thank you!
Sorry. I had to revert this patch.
It added 1 min 40 seconds to test_progs that I manually run every time I apply patches.
Essentially it doubled the test_progs run-time.
Please find a way to test the same functionality in a few seconds.
Quoted 23 lines · Alexei Starovoitov
Quoted 21 lines · On Wed, Aug 24, 2022 at 10:20 AM <[email protected]> wrote:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Quoted 9 lines · On Wed, 24 Aug 2022 14:06:32 +0300 you wrote:
Port
test_lwt_ip_encap.shtests ontotest_progs.In addition, this commit adds "
egress_md" tests which test a similar flow as egress tests only they use gre devices incollect_mdmode for encapsulation and set the tunnel key usingbpf_set_tunnel_key().This introduces minor changes to the test setup and
test_lwt_ip_encap.c:[...]
Here is the summary with links:
- [bpf-next,v3] selftests/bpf: add lwt ip encap tests totest_progshttps://git.kernel.org/bpf/bpf-next/c/a8df1b0636af
Quoted 7 lines
Quoted 1 line
You are awesome, thank you!
Sorry. I had to revert this patch.
It added 1 min 40 seconds totest_progsthat I manually run every time I apply patches.
Essentially it doubled thetest_progsrun-time.
Please find a way to test the same functionality in a few seconds.
Sorry about that! I ported some of the delays from the original script in an effort to improve robustness which is probably the bulk of the run time. I'll find a different approach.
Eyal.