Skip to content

selftests: bpf: Migrate test_xdp_redirect.sh to test_progs

Bastien Curutchet (eBPF Foundation) bpf linux-kselftest lkml netdev 2 versions – Applied

Status from this message: Applied. Thanks.

Get series with b4
b4 am [email protected] change-id 20241219-xdp_redirect-2b8ec79dc24e

Versions newest first

  1. v2 Latest3 patches 1 replyApplied 2/3
  2. v13 patches 7 repliesSuperseded

Changes in v2 from the cover letter

- Use directly skel->progs instead of 'bpf_object__find_program_by_name()'
- Use 'ip -n NSX' in SYS calls instead of opening NSX with open_netns()
- Use #define for static indexes of veth1 and veth2
- Delete the useless second ping
- Set nstoken to NULL after close_netns()
- Merge the two added tests into one with 3 subtests (one for each flag:
0, DRV, SKB)
- Link to v1: https://lore.kernel.org/r/[email protected]

Patches in v2 Applied · 2/3

#Subject and filesSizeRepliesApplied
1/3selftests/bpf: test_xdp_redirect: Rename BPF sectionstools/testing/selftests/bpf/progs/test_xdp_redirect.c tools/testing/selftests/bpf/test_xdp_redirect.sh+4 -40 repliesApplied
2/3selftests/bpf: Migrate test_xdp_redirect.sh to xdp_do_redirect.ctools/testing/selftests/bpf/Makefile tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c tools/testing/selftests/bpf/test_xdp_redirect.sh+165 -801 reply
3/3selftests/bpf: Migrate test_xdp_redirect.c to test_xdp_do_redirect.ctools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c tools/testing/selftests/bpf/progs/test_xdp_do_redirect.c tools/testing/selftests/bpf/progs/test_xdp_redirect.c+15 -300 repliesApplied

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchAlexis Lothoré (eBPF Foundation)
1/3R-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/3] selftests: bpf: Migrate test_xdp_redirect.sh to test_progs

Hi all,

This patch series continues the work to migrate the *.sh tests into prog_tests.

test_xdp_redirect.sh tests the XDP redirections done through bpf_redirect().

These XDP redirections are already tested by prog_tests/xdp_do_redirect.c but IMO it doesn't cover the exact same code path because xdp_do_redirect.c uses bpf_prog_test_run_opts() to trigger redirections of 'fake packets' while test_xdp_redirect.sh redirects packets coming from the network. Also, the test_xdp_redirect.sh script tests the redirections with both SKB and DRV modes while xdp_do_redirect.c only tests the DRV mode.

The patch series adds two new test cases in prog_tests/xdp_do_redirect.c to replace the test_xdp_redirect.sh script.

---
Changes in v2:
- Use directly skel->progs instead of 'bpf_object__find_program_by_name()'
- Use 'ip -n NSX' in SYS calls instead of opening NSX with open_netns()
- Use #define for static indexes of veth1 and veth2
- Delete the useless second ping
- Set nstoken to NULL after close_netns()
- Merge the two added tests into one with 3 subtests (one for each flag:
0, DRV, SKB)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Bastien Curutchet (eBPF Foundation) (3):
selftests/bpf: test_xdp_redirect: Rename BPF sections selftests/bpf: Migrate test_xdp_redirect.sh to xdp_do_redirect.c selftests/bpf: Migrate test_xdp_redirect.c to test_xdp_do_redirect.c

 tools/testing/selftests/bpf/Makefile               |   1 -
 .../selftests/bpf/prog_tests/xdp_do_redirect.c     | 164 +++++++++++++++++++++
 .../selftests/bpf/progs/test_xdp_do_redirect.c     |  12 ++
 .../selftests/bpf/progs/test_xdp_redirect.c        |  26 ----
 tools/testing/selftests/bpf/test_xdp_redirect.sh   |  79 ----------
 5 files changed, 176 insertions(+), 106 deletions(-)

---
base-commit: b27feb5365c6a1bf7e71ba5c795717ee0eec298d
change-id: 20241219-xdp_redirect-2b8ec79dc24e

Best regards,

Signature · 1 line
Bastien Curutchet (eBPF Foundation) <[email protected]>