From 6d05d3cb44c52bcd1739575b55e02dc8bdfcf41a Mon Sep 17 00:00:00 2001 From: Allison Henderson Date: Mon, 1 Jun 2026 22:06:54 -0700 Subject: [PATCH 1/4] selftests: rds: Rename run.sh to rds_run.sh This patch renames run.sh to rds_run.sh. This gives the test a self-describing name that appears in the netdev CI dashboard. Suggested-by: Matthieu Baerts Signed-off-by: Allison Henderson Link: https://patch.msgid.link/20260602050657.26389-2-achender@kernel.org Signed-off-by: Jakub Kicinski --- tools/testing/selftests/net/rds/Makefile | 2 +- tools/testing/selftests/net/rds/README.txt | 8 ++++---- tools/testing/selftests/net/rds/{run.sh => rds_run.sh} | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) rename tools/testing/selftests/net/rds/{run.sh => rds_run.sh} (96%) diff --git a/tools/testing/selftests/net/rds/Makefile b/tools/testing/selftests/net/rds/Makefile index fe363be8e358..ec10ae24e4cf 100644 --- a/tools/testing/selftests/net/rds/Makefile +++ b/tools/testing/selftests/net/rds/Makefile @@ -3,7 +3,7 @@ all: @echo mk_build_dir="$(shell pwd)" > include.sh -TEST_PROGS := run.sh +TEST_PROGS := rds_run.sh TEST_FILES := \ include.sh \ diff --git a/tools/testing/selftests/net/rds/README.txt b/tools/testing/selftests/net/rds/README.txt index bac6f15a80d5..8aa41148b1b5 100644 --- a/tools/testing/selftests/net/rds/README.txt +++ b/tools/testing/selftests/net/rds/README.txt @@ -14,9 +14,9 @@ configs required for the RDMA transport. The kernel may optionally be configured to omit the coverage report as well. 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 +73,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" diff --git a/tools/testing/selftests/net/rds/run.sh b/tools/testing/selftests/net/rds/rds_run.sh similarity index 96% rename from tools/testing/selftests/net/rds/run.sh rename to tools/testing/selftests/net/rds/rds_run.sh index 07af2f927a2a..63080fef492b 100755 --- a/tools/testing/selftests/net/rds/run.sh +++ b/tools/testing/selftests/net/rds/rds_run.sh @@ -209,8 +209,9 @@ while getopts "d:l:c:u:t:T:" opt; do TRANSPORT=${OPTARG} ;; :) - echo "USAGE: run.sh [-d logdir] [-l packet_loss] [-c packet_corruption]" \ - "[-u packet_duplicate] [-t timeout] [-T tcp|rdma|tcp,rdma]" + 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 +225,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 From d2e76c5b1418f0df09046322684acb0932c98c1c Mon Sep 17 00:00:00 2001 From: Allison Henderson Date: Mon, 1 Jun 2026 22:06:55 -0700 Subject: [PATCH 2/4] selftests: rds: pin RDS sockets to their intended transport 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. Signed-off-by: Allison Henderson Link: https://patch.msgid.link/20260602050657.26389-3-achender@kernel.org Signed-off-by: Jakub Kicinski --- tools/testing/selftests/net/rds/test.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/testing/selftests/net/rds/test.py b/tools/testing/selftests/net/rds/test.py index 08f2a846a8ab..9e4df01cb0d4 100755 --- a/tools/testing/selftests/net/rds/test.py +++ b/tools/testing/selftests/net/rds/test.py @@ -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}") From c5eb137685f348b1b1c04a1c67885e69fcf02d6a Mon Sep 17 00:00:00 2001 From: Allison Henderson Date: Mon, 1 Jun 2026 22:06:56 -0700 Subject: [PATCH 3/4] selftests: rds: support RDS built as loadable modules 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). config.sh no longer forces CONFIG_MODULES=n, so a user who follows the SKIP message to run config.sh does not silently end up with modules disabled again. 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. Signed-off-by: Allison Henderson Link: https://patch.msgid.link/20260602050657.26389-4-achender@kernel.org Signed-off-by: Jakub Kicinski --- tools/testing/selftests/net/rds/config | 1 - tools/testing/selftests/net/rds/config.sh | 3 - tools/testing/selftests/net/rds/rds_run.sh | 64 ++++++++++++++-------- 3 files changed, 42 insertions(+), 26 deletions(-) diff --git a/tools/testing/selftests/net/rds/config b/tools/testing/selftests/net/rds/config index 3d62d0c750a8..97db7ecb892a 100644 --- a/tools/testing/selftests/net/rds/config +++ b/tools/testing/selftests/net/rds/config @@ -1,4 +1,3 @@ -CONFIG_MODULES=n CONFIG_NET_NS=y CONFIG_NET_SCH_NETEM=y CONFIG_RDS=y diff --git a/tools/testing/selftests/net/rds/config.sh b/tools/testing/selftests/net/rds/config.sh index be0668359a07..2df2226310ef 100755 --- a/tools/testing/selftests/net/rds/config.sh +++ b/tools/testing/selftests/net/rds/config.sh @@ -37,9 +37,6 @@ if [[ "$CONF_FILE" != "" ]]; then FLAGS=(--file "$CONF_FILE") fi -# no modules -scripts/config "${FLAGS[@]}" --disable CONFIG_MODULES - # enable RDS scripts/config "${FLAGS[@]}" --enable CONFIG_RDS scripts/config "${FLAGS[@]}" --enable CONFIG_RDS_TCP diff --git a/tools/testing/selftests/net/rds/rds_run.sh b/tools/testing/selftests/net/rds/rds_run.sh index 63080fef492b..f01c81415331 100755 --- a/tools/testing/selftests/net/rds/rds_run.sh +++ b/tools/testing/selftests/net/rds/rds_run.sh @@ -93,38 +93,58 @@ check_gcov_conf() fi } +# Checks if a kconfig is enabled (set to =y or =m) +# $1: kconfig symbol to check +# $2: (optional) module name backing $1 +# Ex: check_conf_enabled CONFIG_RDS_TCP rds_tcp +# Modules for configs set to =m will be probed +# If omitted, only a built-in (=y) config is accepted. +# Returns on success. exits 4 on failure # Kselftest framework requirement - SKIP code is 4. check_conf_enabled() { - if ! grep -x "$1=y" "$kconfig" > /dev/null 2>&1; then - echo "selftests: [SKIP] This test requires $1 enabled" - echo "Please run tools/testing/selftests/net/rds/config.sh and rebuild the kernel" - exit 4 + if grep -x "$1=y" "$kconfig" > /dev/null 2>&1; then + return fi + if [ -n "${2:-}" ] && grep -x "$1=m" "$kconfig" > /dev/null 2>&1; then + probe_module "$2" + return + fi + echo "selftests: [SKIP] This test requires $1 enabled" + echo "Please run" \ + "tools/testing/selftests/net/rds/config.sh and rebuild the kernel" + exit 4 } check_rdma_conf_enabled() { - if ! grep -x "$1=y" "$kconfig" > /dev/null 2>&1; then - echo "selftests: [SKIP] rdma transport requires $1 enabled" - echo "To enable, run " \ - "tools/testing/selftests/net/rds/config.sh -r and rebuild" + if grep -x "$1=y" "$kconfig" > /dev/null 2>&1; then + return + fi + if [ -n "${2:-}" ] && grep -x "$1=m" "$kconfig" > /dev/null 2>&1; then + probe_module "$2" + return + fi + echo "selftests: [SKIP] rdma transport requires $1 enabled" + echo "To enable, run" \ + "tools/testing/selftests/net/rds/config.sh -r and rebuild" + exit 4 +} + +# Load the module backing a config that is built as a loadable module +# (=m). Built-in (=y) configs are already available and don't reach +# here. Exits with the SKIP code if a required module cannot be loaded. +probe_module() { + if ! modprobe -q "$1"; then + echo "selftests: [SKIP] could not load required module $1" exit 4 fi } -check_conf_disabled() { - if grep -x "$1=y" "$kconfig" > /dev/null 2>&1; then - echo "selftests: [SKIP] This test requires $1 disabled" - echo "Please run tools/testing/selftests/net/rds/config.sh and rebuild the kernel" - exit 4 - fi -} check_conf() { - check_conf_enabled CONFIG_NET_SCH_NETEM - check_conf_enabled CONFIG_VETH + check_conf_enabled CONFIG_NET_SCH_NETEM sch_netem + check_conf_enabled CONFIG_VETH veth check_conf_enabled CONFIG_NET_NS - check_conf_enabled CONFIG_RDS_TCP - check_conf_enabled CONFIG_RDS - check_conf_disabled CONFIG_MODULES + check_conf_enabled CONFIG_RDS_TCP rds_tcp + check_conf_enabled CONFIG_RDS rds } # Check kernel config and host environment for RDS-RDMA support. @@ -139,8 +159,8 @@ check_rdma_conf() # Kconfig will enforce CONFIG_INFINIBAND_* as dependencies # of CONFIG_RDMA_RXE - check_rdma_conf_enabled CONFIG_RDMA_RXE - check_rdma_conf_enabled CONFIG_RDS_RDMA + check_rdma_conf_enabled CONFIG_RDMA_RXE rdma_rxe + check_rdma_conf_enabled CONFIG_RDS_RDMA rds_rdma if ! which rdma > /dev/null 2>&1; then echo "selftests: [SKIP] rdma transport requires the 'rdma'" \ From e3ab0affc10f444a86e1e3e7b35cf7a4d30ed456 Mon Sep 17 00:00:00 2001 From: Allison Henderson Date: Mon, 1 Jun 2026 22:06:57 -0700 Subject: [PATCH 4/4] selftests: rds: report missing RDMA prereqs as XFAIL Make the RDMA test return XFAIL rather than skip when RXE is not available, since the RDMA datapath is not run in netdev CI. Change the three RDMA-prerequisite checks in check_rdma_conf() and check_rdma_conf_enabled() to exit with KSFT_XFAIL (2) and tag their messages [XFAIL] instead of [SKIP]. Signed-off-by: Allison Henderson Link: https://patch.msgid.link/20260602050657.26389-5-achender@kernel.org Signed-off-by: Jakub Kicinski --- tools/testing/selftests/net/rds/rds_run.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/net/rds/rds_run.sh b/tools/testing/selftests/net/rds/rds_run.sh index f01c81415331..cdf487ec97dc 100755 --- a/tools/testing/selftests/net/rds/rds_run.sh +++ b/tools/testing/selftests/net/rds/rds_run.sh @@ -123,10 +123,10 @@ check_rdma_conf_enabled() { probe_module "$2" return fi - echo "selftests: [SKIP] rdma transport requires $1 enabled" + echo "selftests: [XFAIL] rdma transport requires $1 enabled" echo "To enable, run" \ "tools/testing/selftests/net/rds/config.sh -r and rebuild" - exit 4 + exit 2 } # Load the module backing a config that is built as a loadable module @@ -148,7 +148,7 @@ check_conf() { } # Check kernel config and host environment for RDS-RDMA support. -# Exits with SKIP (4) if the user requested rdma but prerequisites +# Exits with XFAIL (2) if the user requested rdma but prerequisites # are not met. check_rdma_conf() { @@ -163,9 +163,9 @@ check_rdma_conf() check_rdma_conf_enabled CONFIG_RDS_RDMA rds_rdma if ! which rdma > /dev/null 2>&1; then - echo "selftests: [SKIP] rdma transport requires the 'rdma'" \ - " tool (iproute2)" - exit 4 + echo "selftests: [XFAIL] rdma transport requires the 'rdma'" \ + "tool (iproute2)" + exit 2 fi }