Netdev List
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, edumazet@google.com,
	horms@kernel.org, andrew@lunn.ch,
	Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next 6/7] selftests: drv-net: extend so_txtime with hw offload
Date: Fri, 10 Jul 2026 17:26:52 +0200	[thread overview]
Message-ID: <531c4085-e7eb-4915-ae63-c53571930aa7@redhat.com> (raw)
In-Reply-To: <20260706133433.3142805-7-willemdebruijn.kernel@gmail.com>

On 7/6/26 3:34 PM, Willem de Bruijn wrote:
> @@ -38,6 +41,34 @@ def test_so_txtime(cfg, clockid, ipver, args_tx, args_rx, expect_success):
>          cmd(cmd_tx)
>  
>  
> +def _dev_setup_pacing_offload(cfg):
> +    """Configure pacing-offload-horizon."""
> +    ethnl = EthtoolFamily()
> +
> +    try:
> +        rings = ethnl.rings_get({'header': {'dev-index': cfg.ifindex}})
> +    except NlError:
> +        raise KsftSkipEx('ring-get not supported by device')

pylint complains:

tools/testing/selftests/drivers/net/so_txtime.py:51:8: W0707: Consider
explicitly re-raising using 'except NlError as exc' and 'raise
KsftSkipEx('ring-get not supported by device') from exc'
(raise-missing-from)

> +
> +    if 'pacing-offload-horizon' not in rings or \
> +       'pacing-offload-horizon-max' not in rings:
> +        raise KsftSkipEx('pacing offload horizon not supported by device')
> +
> +    if rings['pacing-offload-horizon-max'] < 50_000:
> +        raise KsftSkipEx('pacing offload max horizon too small')
> +
> +    cur_horizon = rings['pacing-offload-horizon']
> +    new_horizon = 50_000
> +    ethnl.rings_set({
> +        'header': {'dev-index': cfg.ifindex},
> +        'pacing-offload-horizon': new_horizon,
> +    })
> +    defer(ethnl.rings_set, {
> +        'header': {'dev-index': cfg.ifindex},
> +        'pacing-offload-horizon': cur_horizon
> +    })
> +
> +
>  def _qdisc_setup(ifname, qdisc, optargs=""):
>      """Replace root qdisc. Restore the original after the test.
>  
> @@ -56,6 +87,7 @@ def _test_variants_fq():
>              ["one_pkt", "a,10", "a,10"],
>              ["in_order", "a,10,b,20", "a,10,b,20"],
>              ["reverse_order", "a,20,b,10", "b,10,a,20"],
> +            ["beyond_hw_horizon", "a,70", "a,70"],
>          ]:
>              name = f"v{ipver}_{testcase[0]}"
>              yield KsftNamedVariant(name, ipver, testcase[1], testcase[2])
> @@ -64,15 +96,42 @@ def _test_variants_fq():
>  @ksft_variants(_test_variants_fq())
>  def test_so_txtime_fq_mono(cfg, ipver, args_tx, args_rx):
>      """Run all variants of monotonic (fq) tests."""
> -    cfg.require_ipver(ipver)
>      _qdisc_setup(cfg.ifname, "fq")
>      test_so_txtime(cfg, "mono", ipver, args_tx, args_rx, True)
>  
>  
> +@ksft_variants(_test_variants_fq())
> +def test_so_txtime_fq_mono_hw(cfg, ipver, args_tx, args_rx):
> +    """Run all variants of monotonic fq tests, with offload horizon."""
> +    cfg.require_nsim(nsim_test=False)
> +
> +    _dev_setup_pacing_offload(cfg)
> +    try:
> +        _qdisc_setup(cfg.ifname, "fq", "offload_horizon 50ms")
> +    except Exception as e:
> +        raise KsftSkipEx("netdev does not support offload. skipping") from e
> +
> +    # Expect all tests to use only hw pacing, except beyond_hw_horizon.
> +    hw_only = "-h" if args_tx != "a,70" else ""
> +    test_so_txtime(cfg, "mono", ipver, f"{hw_only} {args_tx}", args_rx, True)
> +
> +
> +@ksft_variants(_test_variants_fq())
> +def test_so_txtime_pfifofast_mono_hw(cfg, ipver, args_tx, args_rx):
> +    """Run all variants of monotonic tests, without fq pacing sw backup."""
> +    cfg.require_nsim(nsim_test=False)
> +
> +    _dev_setup_pacing_offload(cfg)
> +    _qdisc_setup(cfg.ifname, "pfifo_fast")
> +
> +    # Expect all tests to pass, except beyond_hw_horizon without sw fallback.
> +    expect_pass = False if args_tx == "a,70" else True

pylint says:

tools/testing/selftests/drivers/net/so_txtime.py:128:18: R1719: The if
expression can be replaced with 'not test' (simplifiable-if-expression)

/P


  reply	other threads:[~2026-07-10 15:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 13:34 [PATCH net-next 0/7] hardware pacing offload Willem de Bruijn
2026-07-06 13:34 ` [PATCH net-next 1/7] net: ethtool: add hardware pacing offload support to rings Willem de Bruijn
2026-07-06 13:34 ` [PATCH net-next 2/7] net_sched: sch_fq: clear past skb->tstamp if offloading pacing Willem de Bruijn
2026-07-06 13:34 ` [PATCH net-next 3/7] idpf: support pacing offload Willem de Bruijn
2026-07-10 15:04   ` Paolo Abeni
2026-07-10 21:37   ` Tony Nguyen
2026-07-11 20:13     ` Willem de Bruijn
2026-07-06 13:34 ` [PATCH net-next 4/7] selftests: drv-net: refactor so_txtime errqueue handling Willem de Bruijn
2026-07-06 13:34 ` [PATCH net-next 5/7] selftests: drv-net: in so_txtime tell apart sw from hw pacing Willem de Bruijn
2026-07-06 13:34 ` [PATCH net-next 6/7] selftests: drv-net: extend so_txtime with hw offload Willem de Bruijn
2026-07-10 15:26   ` Paolo Abeni [this message]
2026-07-06 13:34 ` [PATCH net-next 7/7] net: pktgen: add support for SO_TXTIME Willem de Bruijn
2026-07-10 15:20   ` Paolo Abeni

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=531c4085-e7eb-4915-ae63-c53571930aa7@redhat.com \
    --to=pabeni@redhat.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --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