Skip to contentSkip to conversation

selftests: rds: ROCE support follow ups

PATCH Superseded Allison Henderson 2 participants 8 messages May 22 – May 23

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Allison Henderson

author maintainer
#0 lore raw

cover selftests: rds: ROCE support follow ups

Hi all,

This is a follow up series to the "Add ROCE support to rds selftests" series. The first patch renames run.sh to rds_run.sh, and also adds two wrappers to the TEST_PROGS target to run the same test over the rdma and tcp transports. The wrappers rds_rdma_run.sh and rds_tcp_run.sh also provide self-describing names that appear on the netdev CI dashboard.

The second patch addresses a sashiko complaint that I thought was worth circling back for. In the patch "pin RDS sockets to their intended transport," sockets are pinned the specific transport they are meant to test. By default, socket transports are implicitly selected based on the network topology, but it is possible that they can fail back to other transports if the underlying connection could not be established. So the patch pins them to the intended transport to avoid false positives.

Lastly the third patch "support RDS built as loadable module," lifts the CONFIG_MODULES=n requirement, and updates the check_*conf_enabled() to allow modules set to "=m" and further load the backing modules for any component set as such.

Questions, comments and feedback appreciated!

Thanks everyone!
Allison

Allison Henderson (3):
selftests: rds: add per-transport run wrappers
selftests: rds: pin RDS sockets to their intended transport
selftests: rds: support RDS built as loadable modules

 tools/testing/selftests/net/rds/Makefile      |  6 +-
 tools/testing/selftests/net/rds/README.txt    | 13 ++--
 tools/testing/selftests/net/rds/config        |  1 -
 .../testing/selftests/net/rds/rds_rdma_run.sh | 11 ++++
 .../selftests/net/rds/{run.sh => rds_run.sh}  | 63 ++++++++++++-------
 .../testing/selftests/net/rds/rds_tcp_run.sh  | 11 ++++
 tools/testing/selftests/net/rds/test.py       | 18 ++++++
 7 files changed, 95 insertions(+), 28 deletions(-)
 create mode 100755 tools/testing/selftests/net/rds/rds_rdma_run.sh
 rename tools/testing/selftests/net/rds/{run.sh => rds_run.sh} (80%)
 create mode 100755 tools/testing/selftests/net/rds/rds_tcp_run.sh
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH 1/3 selftests: rds: add per-transport run wrappers

This patch renames run.sh to rds_run.sh, and then adds two wrapper scripts, rds_rdma_run.sh and rds_tcp_run.sh which run rds_run.sh with the corresponding transport option, rdma or tcp respectively. These wrapper scripts are added to TEST_PROGS in place of run.sh so that they run and report as a separate test results on the netdev CI dashboard.

Listing the wrappers in TEST_PROGS also gives the framework a self-describing name for each test. The underlying rds_run.sh remains directly usable with the full set of options.

---
 tools/testing/selftests/net/rds/Makefile            |  6 +++++-
 tools/testing/selftests/net/rds/README.txt          | 13 +++++++++----
 tools/testing/selftests/net/rds/rds_rdma_run.sh     | 11 +++++++++++
 .../selftests/net/rds/{run.sh => rds_run.sh}        |  4 ++--
 tools/testing/selftests/net/rds/rds_tcp_run.sh      | 11 +++++++++++
 5 files changed, 38 insertions(+), 7 deletions(-)
tools/testing/selftests/net/rds/Makefile +5 -1
index fe363be8e3586..b176e637fc55b 100644
@@ -3,9 +3,13 @@
 all:
 	@echo mk_build_dir="$(shell pwd)" > include.sh
 
-TEST_PROGS := run.sh
+TEST_PROGS := \
+	rds_tcp_run.sh \
+	rds_rdma_run.sh \
+# end of TEST_PROGS
 
 TEST_FILES := \
+	rds_run.sh \
 	include.sh \
 	settings \
 	test.py \
tools/testing/selftests/net/rds/README.txt +9 -4
index bac6f15a80d52..2296568c39444 100644
@@ -13,10 +13,15 @@ with the necessary gcov options; pass -r to also enable the kernel
 configs required for the RDMA transport.  The kernel may optionally be
 configured to omit the coverage report as well.
 
+The test framework runs the rds_tcp_run.sh and rds_rdma_run.sh wrappers,
+which invoke rds_run.sh with the matching transport so that the tcp and
+rdma results are reported independently.  rds_run.sh may also be run
+directly with the options below.
+
 USAGE:
-	run.sh [-d logdir] [-l packet_loss] [-c packet_corruption]
-	       [-u packet_duplicate] [-t timeout]
-	       [-T tcp|rdma|tcp,rdma]
+	rds_run.sh [-d logdir] [-l packet_loss] [-c packet_corruption]
+	           [-u packet_duplicate] [-t timeout]
+	           [-T tcp|rdma|tcp,rdma]
 
 OPTIONS:
 	-d	Log directory.  If set, logs will be stored in the
@@ -73,5 +78,5 @@ EXAMPLE:
         "export PYTHONPATH=tools/testing/selftests/net/; \
          export SUDO_USER=example_user; \
          export RDS_LOG_DIR=tools/testing/selftests/net/rds/rds_logs; \
-         tools/testing/selftests/net/rds/run.sh -T tcp,rdma"
+         tools/testing/selftests/net/rds/rds_run.sh -T tcp,rdma"
 
tools/testing/selftests/net/rds/rds_rdma_run.sh new file +11 -0
new file mode 100755
index 0000000000000..eddd389431573
@@ -0,0 +1,11 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Runs the RDS selftest over the RDMA (RoCE/RXE) transport.
+#
+# This is a wrapper script for rds_run.sh to run and report results when using
+# the -T rdma option
+#
+# Exits with the kselftest SKIP code if rds RDMA prerequisites are not met
+
+exec "$(dirname "$0")/rds_run.sh" -T rdma "$@"
tools/testing/selftests/net/rds/rds_run.sh renamed from tools/testing/selftests/net/rds/run.sh +2 -2
similarity index 98%
rename from tools/testing/selftests/net/rds/run.sh
rename to tools/testing/selftests/net/rds/rds_run.sh
index 07af2f927a2a7..ef16039be1ae5 100755
@@ -209,7 +209,7 @@ while getopts "d:l:c:u:t:T:" opt; do
       TRANSPORT=${OPTARG}
       ;;
     :)
-      echo "USAGE: run.sh [-d logdir] [-l packet_loss] [-c packet_corruption]" \
+      echo "USAGE: rds_run.sh [-d logdir] [-l packet_loss] [-c packet_corruption]" \
            "[-u packet_duplicate] [-t timeout] [-T tcp|rdma|tcp,rdma]"
       exit 1
       ;;
@@ -224,7 +224,7 @@ done
 IFS=',' read -ra transports <<< "$TRANSPORT"
 for t in "${transports[@]}"; do
     if [ "$t" != "tcp" ] && [ "$t" != "rdma" ]; then
-        echo "run.sh: unknown transport '$t' (expected tcp or rdma)"
+        echo "rds_run.sh: unknown transport '$t' (expected tcp or rdma)"
         exit 1
     fi
 done
tools/testing/selftests/net/rds/rds_tcp_run.sh new file +11 -0
new file mode 100755
index 0000000000000..fad4d047aac61
@@ -0,0 +1,11 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Runs the RDS selftest over the TCP transport.
+#
+# This is a wrapper script for rds_run.sh to run and report results when using
+# the -T tcp option
+#
+# Exits with the kselftest SKIP code if rds TCP prerequisites are not met
+
+exec "$(dirname "$0")/rds_run.sh" -T tcp "$@"
Signature · 1 line
2.25.1
author maintainer
#2 lore raw

PATCH 2/3 selftests: rds: pin RDS sockets to their intended transport

In reply to Allison Henderson

The RDS selftests create AF_RDS sockets but never selects a transport, so the transport is chosen implicitly based on network topology when the socket is bound. If underlying connection establishment fails, RDS can fall back to another transport (e.g. loopback) and the test still passes, silently bypassing the intended datapath it is meant to exercise.

Set SO_RDS_TRANSPORT to the proper RDS_TRANS_IB or RDS_TRANS_TCP before they are bound, so the test fails loudly if the intended transport is unavailable rather than passing on a different path.

---
 tools/testing/selftests/net/rds/test.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
tools/testing/selftests/net/rds/test.py +18 -0
index 08f2a846a8ab5..9e4df01cb0d4b 100755
@@ -59,6 +59,14 @@ rdma_addrs = [
 OP_FLAG_TCP     = 0x1
 OP_FLAG_RDMA    = 0x2
 
+# from include/uapi/linux/rds.h: SO_RDS_TRANSPORT pins a socket to a
+# specific RDS transport so connection setup cannot silently fall back
+# to another (e.g. loopback) transport.
+SOL_RDS          = 276
+SO_RDS_TRANSPORT = 8
+RDS_TRANS_TCP    = 2
+RDS_TRANS_IB     = 0
+
 signal_handler_label = ""
 
 tap_idx = 0
@@ -214,11 +222,21 @@ def snd_rcv_packets(env):
             netns_socket(netns_list[0], socket.AF_RDS, socket.SOCK_SEQPACKET),
             netns_socket(netns_list[1], socket.AF_RDS, socket.SOCK_SEQPACKET),
         ]
+
+        # Pin the sockets to the TCP transport so it doesn't fail over to a
+        # different transport during this test
+        for s in sockets:
+            s.setsockopt(SOL_RDS, SO_RDS_TRANSPORT, RDS_TRANS_TCP)
     elif flags & OP_FLAG_RDMA:
         sockets = [
             socket.socket(socket.AF_RDS, socket.SOCK_SEQPACKET),
             socket.socket(socket.AF_RDS, socket.SOCK_SEQPACKET),
         ]
+
+        # Pin the sockets to the RDMA transport so it doesn't fail over to a
+        # different transport during this test
+        for s in sockets:
+            s.setsockopt(SOL_RDS, SO_RDS_TRANSPORT, RDS_TRANS_IB)
     else:
         raise RuntimeError(f"Invalid transport flag sets no transports: {flags}")
 
Signature · 1 line
2.25.1
author maintainer
#3 lore raw

PATCH 3/3 selftests: rds: support RDS built as loadable modules

In reply to Allison Henderson

Commit 92cc6708f4a2 ("selftests: rds: config: disable modules") set CONFIG_MODULES=n since run.sh required this kconfig. But disabling modules also forces every =m option to =n rather than =y, which can silently drop unrelated features.

This patch removes CONFIG_MODULES=n from the rds selftest config and updates the check_*conf_enabled() routines to accept a config as either built-in (=y) or modular (=m). A new probe_module() function is added to load the backing module when a component is set to be modular (=m).

rds.ko itself is auto-loaded on socket creation, and rds_rdma.ko is auto-loaded when SO_RDS_TRANSPORT is set with RDS_TRANS_IB, but the TCP transport (rds_tcp.ko) is not auto-loaded on the bind path, so the backing modules are loaded explicitly here.

---
 tools/testing/selftests/net/rds/config     |  1 -
 tools/testing/selftests/net/rds/rds_run.sh | 59 ++++++++++++++--------
 2 files changed, 39 insertions(+), 21 deletions(-)
tools/testing/selftests/net/rds/config +0 -1
index 3d62d0c750a80..97db7ecb892aa 100644
@@ -1,4 +1,3 @@
-CONFIG_MODULES=n
 CONFIG_NET_NS=y
 CONFIG_NET_SCH_NETEM=y
 CONFIG_RDS=y
tools/testing/selftests/net/rds/rds_run.sh +39 -20

85 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer
#4 lore raw
In reply to Allison Henderson
Quoted 6 lines · On Fri, 22 May 2026 14:54:27 -0700 Allison Henderson wrote:

This is a follow up series to the "Add ROCE support to rds selftests" series. The first patch renames run.sh to rds_run.sh, and also adds two wrappers to the TEST_PROGS target to run the same test over the rdma and tcp transports. The wrappers rds_rdma_run.sh and rds_tcp_run.sh also provide self-describing names that appear on the netdev CI dashboard.

Could you make the RDMA test return XFAIL rather than skip when RXE is not available? We try to use SKIP for cases which are easy to fix, like a tool missing. We won't be running RDMA tests in netdev..

Signature · 1 line
pw-bot: cr
author maintainer
#5 lore raw
Quoted 11 lines · Jakub Kicinski
Quoted 6 lines · On Fri, 22 May 2026 14:54:27 -0700 Allison Henderson wrote:

This is a follow up series to the "Add ROCE support to rds selftests" series. The first patch renames run.sh to rds_run.sh, and also adds two wrappers to the TEST_PROGS target to run the same test over the rdma and tcp transports. The wrappers rds_rdma_run.sh and rds_tcp_run.sh also provide self-describing names that appear on the netdev CI dashboard.

Could you make the RDMA test return XFAIL rather than skip when RXE is not available? We try to use SKIP for cases which are easy to fix, like a tool missing. We won't be running RDMA tests in netdev..

Sure, if you want I could also drop the wrappers since rds_run.sh defaults to tcp. Then patch 1 would just be a rename. Let me know what you prefer.

Allison

maintainer
#6 lore raw
Quoted 9 lines · On Fri, 22 May 2026 18:19:35 -0700 Allison Henderson wrote:
Quoted 8 lines · Jakub Kicinski
Quoted 6 lines · On Fri, 22 May 2026 14:54:27 -0700 Allison Henderson wrote:

This is a follow up series to the "Add ROCE support to rds selftests" series. The first patch renames run.sh to rds_run.sh, and also adds two wrappers to the TEST_PROGS target to run the same test over the rdma and tcp transports. The wrappers rds_rdma_run.sh and rds_tcp_run.sh also provide self-describing names that appear on the netdev CI dashboard.

Quoted 6 lines
Quoted 3 lines

Could you make the RDMA test return XFAIL rather than skip when RXE is not available? We try to use SKIP for cases which are easy to fix, like a tool missing. We won't be running RDMA tests in netdev..

Sure, if you want I could also drop the wrappers since rds_run.sh defaults to tcp. Then patch 1 would just be a rename. Let me know what you prefer.

Dropping the new wrapper SGTM. But IIRC Matthieu suggested the split, we should let him also chime in.

author maintainer
#7 lore raw
Quoted 14 lines · Jakub Kicinski
Quoted 13 lines · On Fri, 22 May 2026 18:19:35 -0700 Allison Henderson wrote:
Quoted 11 lines · Jakub Kicinski
Quoted 6 lines · On Fri, 22 May 2026 14:54:27 -0700 Allison Henderson wrote:

This is a follow up series to the "Add ROCE support to rds selftests" series. The first patch renames run.sh to rds_run.sh, and also adds two wrappers to the TEST_PROGS target to run the same test over the rdma and tcp transports. The wrappers rds_rdma_run.sh and rds_tcp_run.sh also provide self-describing names that appear on the netdev CI dashboard.

Could you make the RDMA test return XFAIL rather than skip when RXE is not available? We try to use SKIP for cases which are easy to fix, like a tool missing. We won't be running RDMA tests in netdev..

Quoted 5 lines
Quoted 2 lines

Sure, if you want I could also drop the wrappers since rds_run.sh defaults to tcp. Then patch 1 would just be a rename. Let me know what you prefer.

Dropping the new wrapper SGTM. But IIRC Matthieu suggested the split, we should let him also chime in.

Sure, the initial suggestion as a rename, and then I added the wrappers. I will wait for more folks to chime in though.

Allison