From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
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 v3] selftests/net: convert so_txtime to drv-net
Date: Thu, 09 Apr 2026 11:01:49 -0400 [thread overview]
Message-ID: <willemdebruijn.kernel.1b750e4c127c7@gmail.com> (raw)
In-Reply-To: <willemdebruijn.kernel.1e324d665bb85@gmail.com>
Willem de Bruijn wrote:
> Jakub Kicinski wrote:
> > On Sun, 5 Apr 2026 22:49:22 -0400 Willem de Bruijn wrote:
> > > +@ksft_variants(_test_variants_mono())
> > > +def test_so_txtime_mono(cfg, ipver, args_tx, args_rx):
> > > + """Run all variants of monotonic (fq) tests."""
> > > + cmd(f"tc qdisc replace dev {cfg.ifname} root fq")
> > > + test_so_txtime(cfg, "mono", ipver, args_tx, args_rx, False)
> > > +
> > > +
> > > +def _test_variants_etf():
> > > + for ipver in ["4", "6"]:
> > > + for testcase in [
> > > + ["no_delay", "a,-1", "a,-1", True],
> > > + ["zero_delay", "a,0", "a,0", True],
> > > + ["one_pkt", "a,10", "a,10", False],
> > > + ["in_order", "a,10,b,20", "a,10,b,20", False],
> > > + ["reverse_order", "a,20,b,10", "b,10,a,20", False],
> > > + ]:
> > > + name = f"_v{ipver}_{testcase[0]}"
> >
> > nit: looking at the results in NIPA:
> > https://netdev-ctrl.bots.linux.dev/logs/vmksft/net-drv/results/593442/5-so-txtime-py/stdout
> > the leading _ seems unnecessary?
> >
> > > + yield KsftNamedVariant(
> > > + name, ipver, testcase[1], testcase[2], testcase[3]
> > > + )
> > > +
> > > +
> > > +@ksft_variants(_test_variants_etf())
> > > +def test_so_txtime_etf(cfg, ipver, args_tx, args_rx, expect_fail):
> > > + """Run all variants of etf tests."""
> > > + try:
> > > + # ETF does not support change, so remove and re-add it instead.
> > > + cmd_prefix = f"tc qdisc replace dev {cfg.ifname} root"
> > > + cmd(f"{cmd_prefix} pfifo_fast")
> > > + cmd(f"{cmd_prefix} etf clockid CLOCK_TAI delta 400000")
> > > + except Exception as e:
> > > + raise KsftSkipEx("tc does not support qdisc etf. skipping") from e
> > > +
> > > + test_so_txtime(cfg, "tai", ipver, args_tx, args_rx, expect_fail)
> >
> > I _think_ we'll leave ETF installed on the device after the test?
> > That seems not super great. As we discussed before rebuilding the
> > whole hierarchy will be tedious but we could at least replace with
> > mq on exit and let it put whatever the default qdisc is as its leaves?
>
> Good point. We can not set mq on netkit. It fails netif_is_multiqueue
> in mq_init_common. I'll do the following.
>
> @@ -81,6 +81,8 @@ def main() -> None:
> """Boilerplate ksft main."""
> with NetDrvEpEnv(__file__) as cfg:
> ksft_run([test_so_txtime_mono, test_so_txtime_etf], args=(cfg,))
> + if not cfg._ns:
> + cmd(f"tc qdisc replace dev {cfg.ifname} root mq")
> ksft_exit()
Actually, looking at a private field is not a good idea.
> Alternatively could record the root qdisc at the start of the test and
> restore that.
This should work:
def main() -> None:
"""Boilerplate ksft main."""
with NetDrvEpEnv(__file__) as cfg:
+ # Record original root qdisc
+ cmd_obj = cmd((f"tc -j qdisc show dev {cfg.ifname} root"))
+ qdisc_root = json.loads(cmd_obj.stdout)[0].get("kind", None)
+
ksft_run([test_so_txtime_mono, test_so_txtime_etf], args=(cfg,))
+
+ # Restore original root qdisc. If mq, populate with default_qdisc nodes
+ if (qdisc_root):
+ cmd(f"tc qdisc replace dev {cfg.ifname} root {qdisc_root}")
ksft_exit()
Do we want to add a tc command similar to ip, bpftool, etc.
next prev parent reply other threads:[~2026-04-09 15:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-06 2:49 [PATCH net-next v3] selftests/net: convert so_txtime to drv-net Willem de Bruijn
2026-04-08 2:15 ` Jakub Kicinski
2026-04-09 3:10 ` Willem de Bruijn
2026-04-09 15:01 ` Willem de Bruijn [this message]
2026-04-10 1:50 ` Jakub Kicinski
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.1b750e4c127c7@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.