Re: [PATCH net-next v2] selftests: drv-net: so_txtime: only send test traffic to sch_etf

Willem de Bruijn <[email protected]>
Newsgroups org.kernel.vger.netdev
Message-ID <CAF=yD-+DG1YMtgDh=9qTyLFdM5GwLFSp3f-WprtdtDAFn4Ac8Q@mail.gmail.com>
On Tue, Aug 11, 2026 at 11:27 AM Jakub Kicinski <[email protected]> wrote:
>
> On Tue, 11 Aug 2026 10:29:12 -0400 Willem de Bruijn wrote:
> > I can reproduce after
> >
> > tc qdisc replace dev eth0 root handle pfifo_fast
> > tc qdisc replace dev eth0 root handle 1: pfifo_fast
> >
> > It is not possible to replace tc qdisc replace with a del + add pair,
> > due to "Error: Cannot delete qdisc with handle of zero." on systems
> > with the default 0: qdisc, like my debian trixie.
> >
> > The simplest change, then, is to replace the qdisc twice, first for
> > the kind, then for the handle.
> >
> > @@ -45,17 +45,18 @@ def _qdisc_setup(ifname, qdisc, optargs=""):
> >      """
> >      orig = tc(f"qdisc show dev {ifname} root", json=True)[0].get("kind", None)
> >      defer(tc, f"qdisc replace dev {ifname} root {orig}")
> > +    tc(f"qdisc replace dev {ifname} root {qdisc} {optargs}")
> >      tc(f"qdisc replace dev {ifname} root handle 1: {qdisc} {optargs}")
> >
> > It's an extra replace, so a bit ugly. But avoiding that requires
> > parsing the json for existing handle, branching on that.
> >
> > I'm testing the above some more, will send that if no concerns.
>
> If we are adding an extra command adding del would seem more intuitive?
> But no preference.

Agreed. It's a slightly bigger patch, because it has to be wrapped in a try
block. But its purpose is more obvious.

https://lore.kernel.org/netdev/[email protected]/T/#u

> The issue may be because the ring reconfig test now also sets up qdiscs.
> And we don't have a proper way to restore previous qdisc config in the
> tests. If another test needs to change qdiscs we should probably add
> better infra, but for now I think the simple workaround you suggest is
> best.

Interesting, and that also has special logic to work around default handle 0:

"
    elif root is None or root["kind"] in ("mq", "noqueue"):
        # The auto-attached root mq has handle 0: on any device (real or sim),
        # which the kernel rejects as a qdisc parent. A 0: handle means the mq
        # is the untouched kernel default - no custom child qdiscs can hang off
        # an unaddressable parent - so installing a real handle and restoring
        # the default mq on exit preserves the device's effective policy.
        mq_handle = "1:"
"

Again, sorry for needing an extra fix to what was already a fix :/ We hit a
corner case that even with my testing I just did not reach.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.