Skip to contentSkip to conversation

selftests: drv-net: use env.rpath in the HDS test

PATCH In review Jakub Kicinski 3 participants 5 messages Feb 28, 2025 – Mar 5, 2025

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/2 selftests: drv-net: use env.rpath in the HDS test

Commit 29b036be1b0b ("selftests: drv-net: test XDP, HDS auto and the ioctl path") added a new test case in the net tree, now that this code has made its way to net-next convert it to use the env.rpath() helper instead of manually computing the relative path.

---
 tools/testing/selftests/drivers/net/hds.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/testing/selftests/drivers/net/hds.py +1 -2
index 873f5219e41d..7cc74faed743 100755
@@ -20,8 +20,7 @@ from lib.py import defer, ethtool, ip
 
 
 def _xdp_onoff(cfg):
-    test_dir = os.path.dirname(os.path.realpath(__file__))
-    prog = test_dir + "/../../net/lib/xdp_dummy.bpf.o"
+    prog = cfg.rpath("../../net/lib/xdp_dummy.bpf.o")
     ip("link set dev %s xdp obj %s sec xdp" %
        (cfg.ifname, prog))
     ip("link set dev %s xdp off" % cfg.ifname)
Signature · 1 line
2.48.1
author maintainer
#1 lore raw

PATCH 2/2 selftests: net: use the dummy bpf from net/lib

Commit 29b036be1b0b ("selftests: drv-net: test XDP, HDS auto and the ioctl path") added an sample XDP_PASS prog in net/lib, so that we can reuse it in various sub-directories. Delete the old sample and use the one from the lib in existing tests.

---
 tools/testing/selftests/net/xdp_dummy.bpf.c   | 13 -------------
 tools/testing/selftests/net/udpgro_bench.sh   |  2 +-
 tools/testing/selftests/net/udpgro_frglist.sh |  2 +-
 tools/testing/selftests/net/udpgro_fwd.sh     |  2 +-
 tools/testing/selftests/net/veth.sh           |  2 +-
 5 files changed, 4 insertions(+), 17 deletions(-)
 delete mode 100644 tools/testing/selftests/net/xdp_dummy.bpf.c
tools/testing/selftests/net/xdp_dummy.bpf.c deleted +0 -13
deleted file mode 100644
index d988b2e0cee8..000000000000
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#define KBUILD_MODNAME "xdp_dummy"
-#include <linux/bpf.h>
-#include <bpf/bpf_helpers.h>
-
-SEC("xdp")
-int xdp_dummy_prog(struct xdp_md *ctx)
-{
-	return XDP_PASS;
-}
-
-char _license[] SEC("license") = "GPL";
tools/testing/selftests/net/udpgro_bench.sh +1 -1
index c51ea90a1395..815fad8c53a8 100755
@@ -7,7 +7,7 @@ source net_helper.sh
 
 readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
 
-BPF_FILE="xdp_dummy.bpf.o"
+BPF_FILE="lib/xdp_dummy.bpf.o"
 
 cleanup() {
 	local -r jobs="$(jobs -p)"
tools/testing/selftests/net/udpgro_frglist.sh +1 -1
index 17404f49cdb6..5f3d1a110d11 100755
@@ -7,7 +7,7 @@ source net_helper.sh
 
 readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
 
-BPF_FILE="xdp_dummy.bpf.o"
+BPF_FILE="lib/xdp_dummy.bpf.o"
 
 cleanup() {
 	local -r jobs="$(jobs -p)"
tools/testing/selftests/net/udpgro_fwd.sh +1 -1
index 550d8eb3e224..f22f6c66997e 100755
@@ -3,7 +3,7 @@
 
 source net_helper.sh
 
-BPF_FILE="xdp_dummy.bpf.o"
+BPF_FILE="lib/xdp_dummy.bpf.o"
 readonly BASE="ns-$(mktemp -u XXXXXX)"
 readonly SRC=2
 readonly DST=1
tools/testing/selftests/net/veth.sh +1 -1
index 6bb7dfaa30b6..9709dd067c72 100755
@@ -1,7 +1,7 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 
-BPF_FILE="xdp_dummy.bpf.o"
+BPF_FILE="lib/xdp_dummy.bpf.o"
 readonly STATS="$(mktemp -p /tmp ns-XXXXXX)"
 readonly BASE=`basename $STATS`
 readonly SRC=2
Signature · 1 line
2.48.1
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH net-next 2/2] selftests: net: use the dummy bpf from net/lib

Quoted 6 lines · Jakub Kicinski

Commit 29b036be1b0b ("selftests: drv-net: test XDP, HDS auto and the ioctl path") added an sample XDP_PASS prog in net/lib, so that we can reuse it in various sub-directories. Delete the old sample and use the one from the lib in existing tests.

#4 lore raw
In reply to Jakub Kicinski
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Fri, 28 Feb 2025 13:29:55 -0800 you wrote:

Commit 29b036be1b0b ("selftests: drv-net: test XDP, HDS auto and the ioctl path") added a new test case in the net tree, now that this code has made its way to net-next convert it to use the env.rpath() helper instead of manually computing the relative path.

[...]

Here is the summary with links:
- [net-next,1/2] selftests: drv-net: use env.rpath in the HDS test

    https://git.kernel.org/netdev/net-next/c/ea4342739df3

- [net-next,2/2] selftests: net: use the dummy bpf from net/lib (no matching commit)

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html