Subject: Re: [PATCH net-next] selftests/net: convert so_txtime to drv-net

From: Willem de Bruijn <[email-masked]>
Date: Fri, 03 Apr 2026 19:54:14 -0400

Jakub Kicinski wrote:
> On Fri,  3 Apr 2026 13:50:12 -0400 Willem de Bruijn wrote:
> > From: Willem de Bruijn <[email-masked]>
> > 
> > In preparation for extending to pacing hardware offload, convert the
> > so_txtime.sh test to a drv-net test that can be run against netdevsim
> > and real hardware.
> > 
> > Also move so_txtime.c to lib so that it is easily accessible for the
> > new drv-net test, similar to gro.c in commit 8888bf4fb980 ("selftests:
> > net: move gro to lib for HW vs SW reuse").
> > 
> > Also update so_txtime.c to not exit on first failure, but run to
> > completion and report exit code there. This helps with debugging
> > unexpected results, especially when processing multiple packets,
> > as in the "reverse_order" testcase.
> 
> > diff --git a/tools/testing/selftests/drivers/net/config b/tools/testing/selftests/drivers/net/config
> > index 77ccf83d87e0..a3301d4da540 100644
> > --- a/tools/testing/selftests/drivers/net/config
> > +++ b/tools/testing/selftests/drivers/net/config
> > @@ -3,6 +3,8 @@ CONFIG_DEBUG_INFO_BTF=y
> >  CONFIG_DEBUG_INFO_BTF_MODULES=n
> >  CONFIG_INET_PSP=y
> >  CONFIG_IPV6=y
> > +CONFIG_NET_SCH_ETF=m
> > +CONFIG_NET_SCH_FQ=m
> 
> I think our sort order puts _ after characters
> 
> >  CONFIG_NETCONSOLE=m
> >  CONFIG_NETCONSOLE_DYNAMIC=y
> >  CONFIG_NETCONSOLE_EXTENDED_LOG=y
> > diff --git a/tools/testing/selftests/drivers/net/so_txtime.py b/tools/testing/selftests/drivers/net/so_txtime.py
> > new file mode 100755
> > index 000000000000..565cecf307dd
> > --- /dev/null
> > +++ b/tools/testing/selftests/drivers/net/so_txtime.py
> > @@ -0,0 +1,87 @@
> > +#!/usr/bin/env python3
> > +# SPDX-License-Identifier: GPL-2.0
> > +
> > +"""Regression tests for the SO_TXTIME interface.
> > +
> > +Test delivery time in FQ and ETF qdiscs.
> > +"""
> 
> > +import time
> > +
> > +from lib.py import ksft_exit, ksft_run
> > +from lib.py import KsftNamedVariant, KsftSkipEx, ksft_variants
> > +from lib.py import NetDrvEpEnv, bkg, cmd
> > +
> > +
> > +def test_so_txtime(cfg, clockid, ipver, args_tx, args_rx, expect_fail):
> > +  bin_path = cfg.net_lib_dir / "so_txtime"
> > +
> > +  tstart = time.time_ns() + 100_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}"
> > +
> > +  try:
> > +    with bkg(cmd_rx, host=cfg.remote, exit_wait=True):
> > +      cmd(cmd_tx)
> > +  except:
> > +    if not expect_fail:
> > +      raise
> 
> ruff check says:
> tools/testing/selftests/drivers/net/so_txtime.py:29: [E722] Do not use bare `except`
> 
> Why not pass fail=(not expect_fail) to bkg ?

That's indeed a lot simpler.

Thanks for the feedback! Will include all these changes in v2.