public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>,
	 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, 03 Apr 2026 19:54:14 -0400	[thread overview]
Message-ID: <willemdebruijn.kernel.3b5ea6b5c49cc@gmail.com> (raw)
In-Reply-To: <20260403132855.7616daee@kernel.org>

Jakub Kicinski wrote:
> 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 ?

That's indeed a lot simpler.

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

      reply	other threads:[~2026-04-03 23:54 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
2026-04-03 23:54   ` Willem de Bruijn [this message]

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=willemdebruijn.kernel.3b5ea6b5c49cc@gmail.com \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.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