Skip to content

selftests/bpf: Migrate test_xdp_redirect_multi.sh to test_progs

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

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected] change-id 20250103-redirect-multi-245d6eafb5d1

Versions newest first

  1. v5 Latest6 patches 0 repliesApplied 6/6
  2. v414 patches 2 repliesSuperseded
  3. v314 patches 5 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v210 patches2 repliesSuperseded
v110 patches0 repliesSuperseded

Changes in v5 from the cover letter

- Remove the patches that were applied from previous iteration
- Add PATCH 1 & 2 to avoid using the root namespace so the veth indexes
don't get incremented on every ./test_progs call
- PATCH 3: Remove unnecessary <linux/ip.h> header
- Link to v4: https://lore.kernel.org/r/[email protected]

Patches in v5 All 6 applied

#Subject and filesSizeRepliesApplied
1/6selftests/bpf: test_xdp_veth: Create struct net_configurationtools/testing/selftests/bpf/prog_tests/test_xdp_veth.c+59 -490 repliesApplied
2/6selftests/bpf: test_xdp_veth: Use a dedicated namespacetools/testing/selftests/bpf/prog_tests/test_xdp_veth.c+33 -190 repliesApplied
3/6selftests/bpf: Optionally select broadcasting flagstools/testing/selftests/bpf/progs/xdp_redirect_multi_kern.c+29 -120 repliesApplied
4/6selftests/bpf: test_xdp_veth: Add XDP broadcast redirection teststools/testing/selftests/bpf/prog_tests/test_xdp_veth.c tools/testing/selftests/bpf/progs/xdp_redirect_map.c+205 -00 repliesApplied
5/6selftests/bpf: test_xdp_veth: Add XDP program on egress testtools/testing/selftests/bpf/prog_tests/test_xdp_veth.c tools/testing/selftests/bpf/progs/xdp_redirect_map.c+172 -00 repliesApplied
6/6selftests/bpf: Remove test_xdp_redirect_multi.shtools/testing/selftests/bpf/Makefile tools/testing/selftests/bpf/test_xdp_redirect_multi.sh tools/testing/selftests/bpf/xdp_redirect_multi.c+0 -4420 repliesApplied

Reviews trailers per patch

4 of 6 patches have a Reviewed-by or Acked-by.

PatchStanislav Fomichev
1/6
2/6
3/6A-b
4/6A-b
5/6A-b
6/6A-b

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

Read the v5 thread

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

Hi all,

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

test_xdp_redirect_multi.sh tests the XDP redirections done through bpf_redirect_map().

This is already partly covered by test_xdp_veth.c that already tests map redirections at XDP level. What isn't covered yet by test_xdp_veth is the use of the broadcast flags (BPF_F_BROADCAST or BPF_F_EXCLUDE_INGRESS) and XDP egress programs.

Hence, this patch series add test cases to test_xdp_veth.c to get rid of the test_xdp_redirect_multi.sh:
- PATCH 1 & 2 Rework test_xdp_veth.c to avoid using the root namespace
- PATCH 3 and 4 cover the broadcast flags
- PATCH 5 covers the XDP egress programs

NOTE: While working on this iteration I ran into a memory leak in net/core/rtnetlink.c that leads to oom-kill when running ./test_progs in a loop. This leak has been fixed by commit 1438f5d07b9a ("rtnetlink:
fix netns leak with rtnl_setlink()") in the net tree.

---
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't get incremented on every ./test_progs call
- PATCH 3: Remove unnecessary <linux/ip.h> header
- Link to v4: https://lore.kernel.org/r/[email protected]

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/[email protected]

Changes in v3:
- Add append_tid() helper and use unique names to allow parallel testing
- Check create_network()'s return value through ASSERT_OK()
- Remove check_ping() and unused defines
- Change next_veth type (from string to int)
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Use serial_test_* to avoid conflict between tests
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Bastien Curutchet (eBPF Foundation) (6):
selftests/bpf: test_xdp_veth: Create struct net_configuration selftests/bpf: test_xdp_veth: Use a dedicated namespace selftests/bpf: Optionally select broadcasting flags selftests/bpf: test_xdp_veth: Add XDP broadcast redirection tests selftests/bpf: test_xdp_veth: Add XDP program on egress test selftests/bpf: Remove test_xdp_redirect_multi.sh

 tools/testing/selftests/bpf/Makefile               |   2 -
 .../selftests/bpf/prog_tests/test_xdp_veth.c       | 435 ++++++++++++++++++---
 .../testing/selftests/bpf/progs/xdp_redirect_map.c |  88 +++++
 .../selftests/bpf/progs/xdp_redirect_multi_kern.c  |  41 +-
 .../selftests/bpf/test_xdp_redirect_multi.sh       | 214 ----------
 tools/testing/selftests/bpf/xdp_redirect_multi.c   | 226 -----------
 6 files changed, 491 insertions(+), 515 deletions(-)

---
base-commit: 36ab3d3de536753a4b9b2b4c4ce26af41917a378
change-id: 20250103-redirect-multi-245d6eafb5d1

Best regards,

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