From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Tony Nguyen <anthony.l.nguyen@intel.com>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, edumazet@google.com,
pabeni@redhat.com, horms@kernel.org, andrew@lunn.ch,
Willem de Bruijn <willemb@google.com>,
Joshua A Hay <joshua.a.hay@intel.com>
Subject: Re: [PATCH net-next 3/7] idpf: support pacing offload
Date: Sat, 11 Jul 2026 16:13:06 -0400 [thread overview]
Message-ID: <willemdebruijn.kernel.3e2302b5fcd6@gmail.com> (raw)
In-Reply-To: <4e86865a-a152-46ef-9f0b-74dd42b7cf66@intel.com>
Tony Nguyen wrote:
>
>
> On 7/6/2026 6:34 AM, Willem de Bruijn wrote:
>
> ...
> > +static void idpf_tx_splitq_set_txtime(const struct idpf_tx_queue *tx_q,
> > + const struct sk_buff *skb,
> > + struct idpf_tx_splitq_params *tx_params)
> > +{
> > + const int ts_gran_pow2 = 9;
> > + u64 ts, now;
> > +
> > + /* Skip if netpoll: not needed and not safe to call ktime helpers */
> > + if (netpoll_tx_running(skb->dev))
> > + return;
> > +
> > + switch (skb->tstamp_type) {
> > + case SKB_CLOCK_REALTIME:
> > + ts = ktime_to_ns(ktime_add(skb->tstamp,
> > + ktime_mono_to_any(0, TK_OFFS_TAI) -
> > + ktime_mono_to_any(0, TK_OFFS_REAL)));
> > + break;
> > + case SKB_CLOCK_MONOTONIC:
> > + ts = ktime_to_ns(ktime_mono_to_any(skb->tstamp, TK_OFFS_TAI));
> > + break;
> > + case SKB_CLOCK_TAI:
> > + ts = ktime_to_ns(skb->tstamp);
> > + break;
> > + default:
> > + WARN_ON_ONCE(1);
> > + return;
> > + }
> > +
> > + now = ktime_get_clocktai_ns();
> > + if (ts < now)
> > + return;
> > +
> > + /* beyond offload horizon? set overflow bit only */
> > + if (ts > now + ((u64)skb->dev->pacing_offload_horizon * NSEC_PER_USEC)) {
> > + tx_params->offload.desc_ts[2] = 1 << 7;
> > + return;
> > + }
> > +
> > + ts >>= ts_gran_pow2;
> > +
> > + tx_params->offload.desc_ts[0] = ts & 0xff;
> > + tx_params->offload.desc_ts[1] = (ts >> 8) & 0xff;
> > + tx_params->offload.desc_ts[2] = ((ts >> 16) & 0x7f);
> > +
> > + /* 0 is valid 24b timestamp, but also means field unset.
> > + * Add 512 ns (ts_gran_pow2) to avoid this case
> > + */
> > + if ((ts & 0x7fffff) == 0)
> > + tx_params->offload.desc_ts[0] = 1;
> > +}
>
> Slight nit but seems like this check can be moved before the assignments
> (and then return) as we don't need to assign the other 2 bytes in this
> situation?
Thanks for the reviews. I'll address this and Paolo's points in v2.
next prev parent reply other threads:[~2026-07-11 20:13 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 [this message]
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
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=willemdebruijn.kernel.3e2302b5fcd6@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=andrew@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=joshua.a.hay@intel.com \
--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