Subject: [PATCH net-next v3 05/12] selftests: net: relocate gro and toeplitz tests to drivers/net

From: Jakub Kicinski <[email-masked]>
Date: Wed, 19 Nov 2025 18:10:17 -0800

The GRO test can run on a real device or a veth.
The Toeplitz hash test can only run on a real device.
Move them from net/ to drivers/net/ and drivers/net/hw/ respectively.

There are two scripts which set up the environment for these tests
setup_loopback.sh and setup_veth.sh. Move those scripts to net/lib.
The paths to the setup files are a little ugly but they will be
deleted shortly.

toeplitz_client.sh is not a test in itself, but rather a helper
to send traffic, so add it to TEST_FILES rather than TEST_PROGS.

Reviewed-by: Petr Machata <[email-masked]>
Reviewed-by: Willem de Bruijn <[email-masked]>
Signed-off-by: Jakub Kicinski <[email-masked]>
---
cc: [email-masked]

v2:
 - fix accidental modification of gitignore
v1: https://lore.kernel.org/[email-masked]
---
 tools/testing/selftests/drivers/net/Makefile               | 2 ++
 tools/testing/selftests/drivers/net/hw/Makefile            | 7 ++++++-
 tools/testing/selftests/net/Makefile                       | 7 -------
 tools/testing/selftests/net/lib/Makefile                   | 2 ++
 tools/testing/selftests/{ => drivers}/net/gro.c            | 2 +-
 tools/testing/selftests/{net => drivers/net/hw}/toeplitz.c | 2 +-
 tools/testing/selftests/drivers/net/.gitignore             | 1 +
 tools/testing/selftests/{ => drivers}/net/gro.sh           | 4 ++--
 tools/testing/selftests/drivers/net/hw/.gitignore          | 1 +
 .../testing/selftests/{net => drivers/net/hw}/toeplitz.sh  | 2 +-
 .../selftests/{net => drivers/net/hw}/toeplitz_client.sh   | 0
 tools/testing/selftests/net/.gitignore                     | 2 --
 tools/testing/selftests/net/{ => lib}/setup_loopback.sh    | 0
 tools/testing/selftests/net/{ => lib}/setup_veth.sh        | 0
 14 files changed, 17 insertions(+), 15 deletions(-)
 rename tools/testing/selftests/{ => drivers}/net/gro.c (99%)
 rename tools/testing/selftests/{net => drivers/net/hw}/toeplitz.c (99%)
 rename tools/testing/selftests/{ => drivers}/net/gro.sh (95%)
 rename tools/testing/selftests/{net => drivers/net/hw}/toeplitz.sh (98%)
 rename tools/testing/selftests/{net => drivers/net/hw}/toeplitz_client.sh (100%)
 rename tools/testing/selftests/net/{ => lib}/setup_loopback.sh (100%)
 rename tools/testing/selftests/net/{ => lib}/setup_veth.sh (100%)

diff --git a/tools/testing/selftests/drivers/net/Makefile b/tools/testing/selftests/drivers/net/Makefile
index 33f4816216ec..7083a8707c4e 100644
--- a/tools/testing/selftests/drivers/net/Makefile
+++ b/tools/testing/selftests/drivers/net/Makefile
@@ -6,10 +6,12 @@ TEST_INCLUDES := $(wildcard lib/py/*.py) \
 		 ../../net/lib.sh \
 
 TEST_GEN_FILES := \
+	gro \
 	napi_id_helper \
 # end of TEST_GEN_FILES
 
 TEST_PROGS := \
+	gro.sh \
 	hds.py \
 	napi_id.py \
 	napi_threaded.py \
diff --git a/tools/testing/selftests/drivers/net/hw/Makefile b/tools/testing/selftests/drivers/net/hw/Makefile
index 8133d1a0051c..c9dced8c934a 100644
--- a/tools/testing/selftests/drivers/net/hw/Makefile
+++ b/tools/testing/selftests/drivers/net/hw/Makefile
@@ -1,6 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0+ OR MIT
 
-TEST_GEN_FILES = iou-zcrx
+TEST_GEN_FILES := \
+	iou-zcrx \
+	toeplitz \
+# end of TEST_GEN_FILES
 
 TEST_PROGS = \
 	csum.py \
@@ -21,12 +24,14 @@ TEST_PROGS = \
 	rss_ctx.py \
 	rss_flow_label.py \
 	rss_input_xfrm.py \
+	toeplitz.sh \
 	tso.py \
 	xsk_reconfig.py \
 	#
 
 TEST_FILES := \
 	ethtool_lib.sh \
+	toeplitz_client.sh \
 	#
 
 TEST_INCLUDES := \
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index b5127e968108..b66ba04f19d9 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -38,7 +38,6 @@ TEST_PROGS := \
 	fq_band_pktlimit.sh \
 	gre_gso.sh \
 	gre_ipv6_lladdr.sh \
-	gro.sh \
 	icmp.sh \
 	icmp_redirect.sh \
 	io_uring_zerocopy_tx.sh \
@@ -121,8 +120,6 @@ TEST_PROGS := \
 # end of TEST_PROGS
 
 TEST_PROGS_EXTENDED := \
-	toeplitz.sh \
-	toeplitz_client.sh \
 	xfrm_policy_add_speed.sh \
 # end of TEST_PROGS_EXTENDED
 
@@ -130,7 +127,6 @@ TEST_GEN_FILES := \
 	bind_bhash \
 	cmsg_sender \
 	fin_ack_lat \
-	gro \
 	hwtstamp_config \
 	io_uring_zerocopy_tx \
 	ioam6_parser \
@@ -159,7 +155,6 @@ TEST_GEN_FILES := \
 	tcp_mmap \
 	tfo \
 	timestamping \
-	toeplitz \
 	txring_overwrite \
 	txtimestamp \
 	udpgso \
@@ -193,8 +188,6 @@ TEST_FILES := \
 	in_netns.sh \
 	lib.sh \
 	settings \
-	setup_loopback.sh \
-	setup_veth.sh \
 # end of TEST_FILES
 
 # YNL files, must be before "include ..lib.mk"
diff --git a/tools/testing/selftests/net/lib/Makefile b/tools/testing/selftests/net/lib/Makefile
index ce795bc0a1af..c10796933d42 100644
--- a/tools/testing/selftests/net/lib/Makefile
+++ b/tools/testing/selftests/net/lib/Makefile
@@ -8,6 +8,8 @@ CFLAGS += -I../../
 TEST_FILES := \
 	../../../../net/ynl \
 	../../../../../Documentation/netlink/specs \
+	setup_loopback.sh \
+	setup_veth.sh \
 # end of TEST_FILES
 
 TEST_GEN_FILES := \
diff --git a/tools/testing/selftests/net/gro.c b/tools/testing/selftests/drivers/net/gro.c
similarity index 99%
rename from tools/testing/selftests/net/gro.c
rename to tools/testing/selftests/drivers/net/gro.c
index cfc39f70635d..9b9be0cf8f7f 100644
--- a/tools/testing/selftests/net/gro.c
+++ b/tools/testing/selftests/drivers/net/gro.c
@@ -57,7 +57,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "../kselftest.h"
+#include "../../kselftest.h"
 
 #define DPORT 8000
 #define SPORT 1500
diff --git a/tools/testing/selftests/net/toeplitz.c b/tools/testing/selftests/drivers/net/hw/toeplitz.c
similarity index 99%
rename from tools/testing/selftests/net/toeplitz.c
rename to tools/testing/selftests/drivers/net/hw/toeplitz.c
index 9ba03164d73a..bf74aa25345d 100644
--- a/tools/testing/selftests/net/toeplitz.c
+++ b/tools/testing/selftests/drivers/net/hw/toeplitz.c
@@ -52,7 +52,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-#include "../kselftest.h"
+#include "../../../kselftest.h"
 
 #define TOEPLITZ_KEY_MIN_LEN	40
 #define TOEPLITZ_KEY_MAX_LEN	60
diff --git a/tools/testing/selftests/drivers/net/.gitignore b/tools/testing/selftests/drivers/net/.gitignore
index 585ecb4d5dc4..3633c7a3ed65 100644
--- a/tools/testing/selftests/drivers/net/.gitignore
+++ b/tools/testing/selftests/drivers/net/.gitignore
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
+gro
 napi_id_helper
 psp_responder
diff --git a/tools/testing/selftests/net/gro.sh b/tools/testing/selftests/drivers/net/gro.sh
similarity index 95%
rename from tools/testing/selftests/net/gro.sh
rename to tools/testing/selftests/drivers/net/gro.sh
index 4c5144c6f652..bd3cf6d02eda 100755
--- a/tools/testing/selftests/net/gro.sh
+++ b/tools/testing/selftests/drivers/net/gro.sh
@@ -90,9 +90,9 @@ while getopts "i:t:p:" opt; do
 done
 
 if [ -n "$dev" ]; then
-	source setup_loopback.sh
+	source $(dirname $0)/../../net/lib/setup_loopback.sh
 else
-	source setup_veth.sh
+	source $(dirname $0)/../../net/lib/setup_veth.sh
 fi
 
 setup
diff --git a/tools/testing/selftests/drivers/net/hw/.gitignore b/tools/testing/selftests/drivers/net/hw/.gitignore
index 6942bf575497..46540468a775 100644
--- a/tools/testing/selftests/drivers/net/hw/.gitignore
+++ b/tools/testing/selftests/drivers/net/hw/.gitignore
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 iou-zcrx
 ncdevmem
+toeplitz
diff --git a/tools/testing/selftests/net/toeplitz.sh b/tools/testing/selftests/drivers/net/hw/toeplitz.sh
similarity index 98%
rename from tools/testing/selftests/net/toeplitz.sh
rename to tools/testing/selftests/drivers/net/hw/toeplitz.sh
index 8ff172f7bb1b..d236b666dd3b 100755
--- a/tools/testing/selftests/net/toeplitz.sh
+++ b/tools/testing/selftests/drivers/net/hw/toeplitz.sh
@@ -11,7 +11,7 @@
 # invoke as ./toeplitz.sh (-i <iface>) -u|-t -4|-6 \
 # [(-rss -irq_prefix <irq-pattern-prefix>)|(-rps <rps_map>)]
 
-source setup_loopback.sh
+source $(dirname $0)/../../../net/lib/setup_loopback.sh
 readonly SERVER_IP4="192.168.1.200/24"
 readonly SERVER_IP6="fda8::1/64"
 readonly SERVER_MAC="aa:00:00:00:00:02"
diff --git a/tools/testing/selftests/net/toeplitz_client.sh b/tools/testing/selftests/drivers/net/hw/toeplitz_client.sh
similarity index 100%
rename from tools/testing/selftests/net/toeplitz_client.sh
rename to tools/testing/selftests/drivers/net/hw/toeplitz_client.sh
diff --git a/tools/testing/selftests/net/.gitignore b/tools/testing/selftests/net/.gitignore
index e89a60581a13..e139b7186c6c 100644
--- a/tools/testing/selftests/net/.gitignore
+++ b/tools/testing/selftests/net/.gitignore
@@ -7,7 +7,6 @@ cmsg_sender
 diag_uid
 epoll_busy_poll
 fin_ack_lat
-gro
 hwtstamp_config
 io_uring_zerocopy_tx
 ioam6_parser
@@ -56,7 +55,6 @@ tcp_port_share
 tfo
 timestamping
 tls
-toeplitz
 tools
 tun
 txring_overwrite
diff --git a/tools/testing/selftests/net/setup_loopback.sh b/tools/testing/selftests/net/lib/setup_loopback.sh
similarity index 100%
rename from tools/testing/selftests/net/setup_loopback.sh
rename to tools/testing/selftests/net/lib/setup_loopback.sh
diff --git a/tools/testing/selftests/net/setup_veth.sh b/tools/testing/selftests/net/lib/setup_veth.sh
similarity index 100%
rename from tools/testing/selftests/net/setup_veth.sh
rename to tools/testing/selftests/net/lib/setup_veth.sh
-- 
2.51.1