mbox series

[bpf-next,v2,0/2] selftests: bpf: Migrate test_xdp_meta.sh to test_progs

Message ID 20241213-xdp_meta-v2-0-634582725b90@bootlin.com
Headers show
Series selftests: bpf: Migrate test_xdp_meta.sh to test_progs | expand

Message

Bastien Curutchet Dec. 13, 2024, 3:06 p.m. UTC
Hi all,

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

test_xdp_meta.sh uses the BPF programs defined in progs/test_xdp_meta.c
to do a simple XDP/TC functional test that checks the metadata
allocation performed by the bpf_xdp_adjust_meta() helper.

This is already partly covered by two tests under prog_tests/:
- xdp_context_test_run.c uses bpf_prog_test_run_opts() to verify the
validity of the xdp_md context after a call to bpf_xdp_adjust_meta()
- xdp_metadata.c ensures that these meta-data can be exchanged through
an AF_XDP socket.

However test_xdp_meta.sh also verifies that the meta-data initialized
in the struct xdp_md is forwarded to the struct __sk_buff used by BPF
programs at 'TC level'. To cover this, I add a test case in
xdp_context_test_run.c that uses the same BPF programs from
progs/test_xdp_meta.c.

---
Changes in v2:
- Add missing close_netns()
- Use a unique 'close' label
- Link to v1: https://lore.kernel.org/r/20241206-xdp_meta-v1-0-5c150618f6e9@bootlin.com

---
Bastien Curutchet (2):
      selftests/bpf: test_xdp_meta: Rename BPF sections
      selftests/bpf: Migrate test_xdp_meta.sh into xdp_context_test_run.c

 tools/testing/selftests/bpf/Makefile               |  1 -
 .../bpf/prog_tests/xdp_context_test_run.c          | 87 ++++++++++++++++++++++
 tools/testing/selftests/bpf/progs/test_xdp_meta.c  |  4 +-
 tools/testing/selftests/bpf/test_xdp_meta.sh       | 58 ---------------
 4 files changed, 89 insertions(+), 61 deletions(-)
---
base-commit: 0c30734c4f35c4784d3d3ca1bb89d9779045878c
change-id: 20241203-xdp_meta-868307cd0e03

Best regards,

Comments

patchwork-bot+netdevbpf@kernel.org Dec. 16, 2024, 9:50 p.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (net)
by Martin KaFai Lau <martin.lau@kernel.org>:

On Fri, 13 Dec 2024 16:06:19 +0100 you wrote:
> Hi all,
> 
> This patch series continues the work to migrate the script tests into
> prog_tests.
> 
> test_xdp_meta.sh uses the BPF programs defined in progs/test_xdp_meta.c
> to do a simple XDP/TC functional test that checks the metadata
> allocation performed by the bpf_xdp_adjust_meta() helper.
> 
> [...]

Here is the summary with links:
  - [bpf-next,v2,1/2] selftests/bpf: test_xdp_meta: Rename BPF sections
    https://git.kernel.org/bpf/bpf-next/c/8dccbecbb969
  - [bpf-next,v2,2/2] selftests/bpf: Migrate test_xdp_meta.sh into xdp_context_test_run.c
    (no matching commit)

You are awesome, thank you!