--- /dev/null
+From 543bdc1578cd380631558a884318551a0e9fdab2 Mon Sep 17 00:00:00 2001
+From: Willem de Bruijn <willemb@google.com>
+Date: Mon, 11 May 2026 18:19:20 -0400
+Subject: selftests: drv-net: cope with slow env in so_txtime.py test
+
+From: Willem de Bruijn <willemb@google.com>
+
+commit 543bdc1578cd380631558a884318551a0e9fdab2 upstream.
+
+This test was converted from shell script to drv-net test.
+
+The new version is flaky in dbg builds on the netdev.bots dashboard.
+The previous shell script had more protections to avoid these. Added
+in commit a7ee79b9c455 ("selftests: net: cope with slow env in
+so_txtime.sh test").
+
+Add the same overall protection:
+
+- Suppress so_txtime process failure if KSFT_MACHINE_SLOW
+
+Also relax two timeouts to reduce the number of process failures
+themselves
+
+- Increase SO_RCVTIMEO to 2 seconds
+- Increase process start-up stabilization to 2 seconds
+
+Delays were experimentally arrived at while running with vng
+built with kernel/configs/debug.config
+
+Fixes: 5c6baef3885c ("selftests: drv-net: convert so_txtime to drv-net")
+Reported-by: Jakub Kicinski <kuba@kernel.org>
+Closes: https://lore.kernel.org/netdev/20260510174219.74aeee6d@kernel.org/
+Signed-off-by: Willem de Bruijn <willemb@google.com>
+Link: https://patch.msgid.link/20260511222138.2045551-1-willemdebruijn.kernel@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/drivers/net/so_txtime.c | 10 ++++++++--
+ tools/testing/selftests/drivers/net/so_txtime.py | 11 +++++++++--
+ 2 files changed, 17 insertions(+), 4 deletions(-)
+
+--- a/tools/testing/selftests/drivers/net/so_txtime.c
++++ b/tools/testing/selftests/drivers/net/so_txtime.c
+@@ -38,6 +38,7 @@
+ static int cfg_clockid = CLOCK_TAI;
+ static uint16_t cfg_port = 8000;
+ static int cfg_variance_us = 4000;
++static bool cfg_machine_slow;
+ static uint64_t cfg_start_time_ns;
+ static int cfg_mark;
+ static bool cfg_rx;
+@@ -142,7 +143,7 @@ static void do_recv_one(int fdr, struct
+
+ if (llabs(tstop - texpect) > cfg_variance_us) {
+ fprintf(stderr, "exceeds variance (%d us)\n", cfg_variance_us);
+- if (!getenv("KSFT_MACHINE_SLOW"))
++ if (!cfg_machine_slow)
+ errors++;
+ }
+ }
+@@ -263,7 +264,7 @@ static void start_time_wait(void)
+ now = gettime_ns(CLOCK_REALTIME);
+ if (cfg_start_time_ns < now) {
+ fprintf(stderr, "FAIL: start time already passed\n");
+- if (!getenv("KSFT_MACHINE_SLOW"))
++ if (!cfg_machine_slow)
+ errors++;
+ return;
+ }
+@@ -326,6 +327,9 @@ static int setup_rx(struct sockaddr *add
+ if (bind(fd, addr, alen))
+ error(1, errno, "bind");
+
++ if (cfg_machine_slow)
++ tv.tv_sec = 2;
++
+ if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)))
+ error(1, errno, "setsockopt rcv timeout");
+
+@@ -512,6 +516,8 @@ static void parse_opts(int argc, char **
+ setup_sockaddr(domain, saddr, &cfg_src_addr);
+
+ cfg_num_pkt = parse_io(argv[optind], cfg_buf);
++
++ cfg_machine_slow = getenv("KSFT_MACHINE_SLOW");
+ }
+
+ int main(int argc, char **argv)
+--- a/tools/testing/selftests/drivers/net/so_txtime.py
++++ b/tools/testing/selftests/drivers/net/so_txtime.py
+@@ -6,6 +6,7 @@
+ Test delivery time in FQ and ETF qdiscs.
+ """
+
++import os
+ import time
+
+ from lib.py import ksft_exit, ksft_run, ksft_variants
+@@ -15,17 +16,23 @@ from lib.py import NetDrvEpEnv, bkg, cmd
+
+ def test_so_txtime(cfg, clockid, ipver, args_tx, args_rx, expect_success):
+ """Main function. Run so_txtime as sender and receiver."""
++ slow_machine = os.environ.get('KSFT_MACHINE_SLOW')
++
+ bin_path = cfg.test_dir / "so_txtime"
+
+- tstart = time.time_ns() + 200_000_000
++ tstart = time.time_ns() + (2000_000_000 if slow_machine else 200_000_000)
+
+ cmd_addr = f"-S {cfg.addr_v[ipver]} -D {cfg.remote_addr_v[ipver]}"
+ cmd_base = f"{bin_path} -{ipver} -c {clockid} -t {tstart} {cmd_addr}"
+ cmd_rx = f"{cmd_base} {args_rx} -r"
+ cmd_tx = f"{cmd_base} {args_tx}"
+
++ expect_fail = not expect_success
++ if slow_machine:
++ expect_success = False
++
+ with bkg(cmd_rx, host=cfg.remote, fail=expect_success,
+- expect_fail=(not expect_success), exit_wait=True):
++ expect_fail=expect_fail, exit_wait=True):
+ cmd(cmd_tx)
+
+
--- /dev/null
+From e38fec239d923de5bfb65f7fce15ca52c5a3aa7f Mon Sep 17 00:00:00 2001
+From: Willem de Bruijn <willemb@google.com>
+Date: Sun, 21 Jun 2026 16:01:18 -0400
+Subject: selftests: drv-net: so_txtime: relax variance bounds
+
+From: Willem de Bruijn <willemb@google.com>
+
+commit e38fec239d923de5bfb65f7fce15ca52c5a3aa7f upstream.
+
+The net-next-hw spinners on netdev.bots.linux.dev observe failing
+so-txtime-py tests. A review of stdout shows most failures to be
+due to exceeding the 4ms grace period. All I saw were within 8ms.
+So increase to that.
+
+Double the bounds from 4 to 8ms. This is still is small enough to
+differentiate the delays programmed by the test, 10 and 20ms.
+
+Fixes: 5c6baef3885c ("selftests: drv-net: convert so_txtime to drv-net")
+Reported-by: Jakub Kicinski <kuba@kernel.org>
+Closes: https://lore.kernel.org/netdev/20260610170651.1b644001@kernel.org/
+Signed-off-by: Willem de Bruijn <willemb@google.com>
+Link: https://patch.msgid.link/20260621200137.1564776-1-willemdebruijn.kernel@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/drivers/net/so_txtime.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/tools/testing/selftests/drivers/net/so_txtime.c
++++ b/tools/testing/selftests/drivers/net/so_txtime.c
+@@ -37,7 +37,7 @@
+
+ static int cfg_clockid = CLOCK_TAI;
+ static uint16_t cfg_port = 8000;
+-static int cfg_variance_us = 4000;
++static int cfg_variance_us = 8000;
+ static bool cfg_machine_slow;
+ static uint64_t cfg_start_time_ns;
+ static int cfg_mark;