From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: netdev-bot+sashiko@kernel.org, willemdebruijn.kernel@gmail.com
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
edumazet@google.com, pabeni@redhat.com, horms@kernel.org,
andrew+netdev@lunn.ch, willemb@google.com
Subject: Re: [PATCH net-next v9 4/7] idpf: support pacing offload
Date: Fri, 11 Sep 2026 20:46:14 -0400 [thread overview]
Message-ID: <willemdebruijn.kernel.2c67480e5739@gmail.com> (raw)
In-Reply-To: <178914679743.219967.4781990764758262872@kernel.org>
netdev-bot+sashiko@ wrote:
> Thank you for your contribution! Sashiko AI review found 4 potential
> issue(s) to consider:
>
> Critical: 0 · High: 1 · Medium: 1 · Low: 2
>
> - [High] idpf advertises a non-zero netdev->max_pacing_offload_horizon
> (and therefore programs absolute CLOCK_TAI departure times into the…
> - [Medium] The EDT horizon advertised to the networking core is taken
> verbatim from firmware and only bounds-checked against U32_MAX, while…
> - [Low] idpf_vport_set_pacing_offload() writes
> netdev->max_pacing_offload_horizon (idpf_lib.c:832) from the…
> - [Low] In idpf_send_get_edt_caps_msg() the firmware-supplied granularity
> is a u64 (gran_ns = le64_to_cpu(caps.tstamp_granularity_ns)) but is…
>
> --
>
> idpf: support pacing offload
>
> This adds EDT (earliest departure time) support to idpf: EDT capabilities
> are negotiated over virtchnl, the negotiated horizon is published as
> netdev->max_pacing_offload_horizon, and skb->tstamp is programmed into the
> 23-bit timestamp field of the flow scheduling Tx descriptor.
>
> A few questions below on the capability gating and on the horizon
> encoding.
>
> > diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> > index 827c795afcb62..cd1b173e3b276 100644
> > --- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
> > +++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> > @@ -817,6 +817,21 @@ static void idpf_attach_and_open(struct idpf_adapter *adapter)
> > }
> > }
> >
> > +static void idpf_vport_set_pacing_offload(struct idpf_vport *vport,
> > + struct net_device *netdev)
> > +{
> > + struct idpf_adapter *adapter = vport->adapter;
> > + u32 max_horizon = 0;
> > +
> > + if (adapter->edt_caps.time_horizon_ns &&
> > + idpf_is_queue_model_split(vport->dflt_qv_rsrc.txq_model) &&
> > + !idpf_is_cap_ena(adapter, IDPF_OTHER_CAPS,
> > + VIRTCHNL2_CAP_SPLITQ_QSCHED))
> > + max_horizon = adapter->edt_caps.time_horizon_ns;
> > +
>
> [Severity: High]
> The commit message says:
>
> Negotiate the feature with the device using virtchnl. Support is
> conditional on
> ...
> - PTP to ensure the NIC clock is synced to CLOCK_TAI.
This is the only [High] in the series.
The issue is that PTP support is expected, but this is not an explicit
condition checked before advertising EDT.
Previous versions of the commit message explicitly stated that
preconditions are not always explicitly verified (also: split-queue,
flow-based scheduling, firmware advertises EDT):
"Do not explicitly check all preconditions. Trust the firmware to
only advertise EDT when all are met."
The patch now verifies these three other preconditions, so I dropped
that statement from the commit message (on flagging by another bot).
Only now it flags that one condition is still not checked.
If I have to respin, I'll add back a comment.
> [Severity: Medium]
> Can the advertised horizon exceed what the descriptor can encode? The
> hardware field is 23 bits of granularity units:
>
> drivers/net/ethernet/intel/idpf/idpf_lan_txrx.h:
> /* [23:23] Horizon Overflow bit, [22:0] timestamp */
> u8 ts[3];
In practice this is not a concern with this hardware. The driver
does not check every condition of a potential faulty or malicious
firmware.
> [Severity: Low]
> Does this validate a different value than the one it then uses? gran_ns is
> a u64, but is_power_of_2() takes unsigned long:
>
> include/linux/log2.h:
> static __always_inline __attribute__((const))
> bool is_power_of_2(unsigned long n)
> {
> return n - 1 < (n ^ (n - 1));
> }
>
> IDPF has no "depends on 64BIT" in its Kconfig, so on 32-bit builds the
> upper 32 bits are dropped for the check while ilog2(gran_ns) takes the
> __ilog2_u64 path on the full value. A response of 0x100000001 truncates to
> 1, passes the check, and yields tstamp_granularity_pow2 = 32, which is
> copied into idpf_tx_queue.ts_gran_pow2 and used as the shift in
> idpf_tx_splitq_set_txtime(). The same truncation rejects a legitimate
> granularity of 2^32 on 32-bit. Would testing the u64 directly, e.g.
> gran_ns & (gran_ns - 1), plus an upper bound, be better here?
Low severity, but good idea if respinning.
next prev parent reply other threads:[~2026-09-12 0:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 17:10 [PATCH net-next v9 0/7] hardware pacing offload Willem de Bruijn
2026-09-10 17:10 ` [PATCH net-next v9 1/7] net: rtnetlink: add pacing_offload attribute to net_device Willem de Bruijn
2026-09-11 17:13 ` netdev-bot+sashiko
2026-09-12 0:25 ` Willem de Bruijn
2026-09-10 17:10 ` [PATCH net-next v9 2/7] net_sched: sch_fq: check device pacing offload Willem de Bruijn
2026-09-11 17:13 ` netdev-bot+sashiko
2026-09-12 0:33 ` Willem de Bruijn
2026-09-10 17:10 ` [PATCH net-next v9 3/7] net_sched: sch_fq: clear past skb->tstamp if offloading pacing Willem de Bruijn
2026-09-11 17:13 ` netdev-bot+sashiko
2026-09-12 0:36 ` Willem de Bruijn
2026-09-10 17:10 ` [PATCH net-next v9 4/7] idpf: support pacing offload Willem de Bruijn
2026-09-11 17:13 ` netdev-bot+sashiko
2026-09-12 0:46 ` Willem de Bruijn [this message]
2026-09-10 17:10 ` [PATCH net-next v9 5/7] selftests: drv-net: refactor so_txtime errqueue handling Willem de Bruijn
2026-09-10 17:10 ` [PATCH net-next v9 6/7] selftests: drv-net: in so_txtime tell apart sw from hw pacing Willem de Bruijn
2026-09-11 17:13 ` netdev-bot+sashiko
2026-09-12 0:47 ` Willem de Bruijn
2026-09-10 17:10 ` [PATCH net-next v9 7/7] selftests: drv-net: extend so_txtime with hw offload Willem de Bruijn
2026-09-11 17:13 ` netdev-bot+sashiko
2026-09-12 0:57 ` 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=willemdebruijn.kernel.2c67480e5739@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev-bot+sashiko@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.