From: Jakub Kicinski <kuba@kernel.org>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, horms@kernel.org,
Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next] selftests/net: convert so_txtime to drv-net
Date: Fri, 3 Apr 2026 13:28:55 -0700 [thread overview]
Message-ID: <20260403132855.7616daee@kernel.org> (raw)
In-Reply-To: <20260403175047.152646-1-willemdebruijn.kernel@gmail.com>
On Fri, 3 Apr 2026 13:50:12 -0400 Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
>
> 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 ?
> +def main() -> None:
pylint --disable=R should be clean, please
I usually add something like:
"""Boilerplate ksft main"""
> + with NetDrvEpEnv(__file__) as cfg:
> + ksft_run([test_so_txtime_mono], args=(cfg,))
> + ksft_run([test_so_txtime_etf], args=(cfg,))
ksft_run() is not supposed to be called multiple times, it will break
KTAP format
> diff --git a/tools/testing/selftests/net/lib/Makefile b/tools/testing/selftests/net/lib/Makefile
> index ff83603397d0..8c50b6631524 100644
> --- a/tools/testing/selftests/net/lib/Makefile
> +++ b/tools/testing/selftests/net/lib/Makefile
> @@ -15,6 +15,7 @@ TEST_GEN_FILES := \
> $(patsubst %.c,%.o,$(wildcard *.bpf.c)) \
> csum \
> gro \
> + so_txtime \
is there a reason for the binary to be in lib?
gro is used by drivers/net and drivers/net/hw
if the C helper / binary is only used by a single target it should live
in the same dir as the python code
next prev parent reply other threads:[~2026-04-03 20:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 17:50 [PATCH net-next] selftests/net: convert so_txtime to drv-net Willem de Bruijn
2026-04-03 20:00 ` Willem de Bruijn
2026-04-03 20:28 ` Jakub Kicinski [this message]
2026-04-03 23:54 ` Willem de Bruijn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260403132855.7616daee@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.com \
--cc=willemdebruijn.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox