lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPREpbZZBPvF0MpG4GbGdcpPRUcGgNqFKFZZ=XDvdUyVffH2Ug@mail.gmail.com>
Date: Tue, 20 Jan 2026 13:20:29 -0500
From: Kevin Yang <yyd@...gle.com>
To: Gerhard Engleder <gerhard@...leder-embedded.com>
Cc: netdev@...r.kernel.org, Richard Cochran <richardcochran@...il.com>, 
	Jakub Kicinski <kuba@...nel.org>, Joshua Washington <joshwash@...gle.com>, Paolo Abeni <pabeni@...hat.com>, 
	Eric Dumazet <edumazet@...gle.com>, David Miller <davem@...emloft.net>, 
	Andrew Lunn <andrew+netdev@...n.ch>, Harshitha Ramamurthy <hramamurthy@...gle.com>, 
	Willem de Bruijn <willemb@...gle.com>
Subject: Re: [PATCH net-next 1/2] net: extend ndo_get_tstamp for other
 timestamp types

On Fri, Jan 16, 2026 at 3:36 PM Gerhard Engleder
<gerhard@...leder-embedded.com> wrote:
>
> On 15.01.26 23:22, Kevin Yang wrote:
> > Network device hardware timestamps (hwtstamps) and the system's
> > clock (ktime) often originate from different clock domains.
> > This makes it hard to directly calculate the duration between
> > a hardware-timestamped event and a system-time event by simple
> > subtraction.
> >
> > This patch extends ndo_get_tstamp to allow a netdev to provide
> > a hwtstamp into the system's CLOCK_REALTIME domain. This allows a
> > driver to either perform a conversion by estimating or, if the
> > clocks are kept synchronized, return the original timestamp directly.
> > Other clock domains, e.g. CLOCK_MONOTONIC_RAW can also be added when
> > a use surfaces.
> >
> > This is useful for features that need to measure the delay between
> > a packet's hardware arrival/departure and a later software event.
> > For example, the TCP stack can use this to measure precise
> > packet receive delays, which is a requirement for the upcoming
> > TCP Swift [1] congestion control algorithm.
> >
> > [1] Kumar, Gautam, et al. "Swift: Delay is simple and effective
> > for congestion control in the datacenter." Proceedings of the
> > Annual conference of the ACM Special Interest Group on Data
> > Communication on the applications, technologies, architectures,
> > and protocols for computer communication. 2020.
> >
> > Signed-off-by: Kevin Yang <yyd@...gle.com>
> > Reviewed-by: Willem de Bruijn <willemb@...gle.com>
> > ---
> >   drivers/net/ethernet/engleder/tsnep_main.c |  8 +++++---
> >   drivers/net/ethernet/intel/igc/igc_main.c  |  8 +++++---
> >   include/linux/netdevice.h                  | 21 ++++++++++++++-------
> >   3 files changed, 24 insertions(+), 13 deletions(-)
> >
>
>
> ...
>
> >
> > +enum netdev_tstamp_type {
> > +     NETDEV_TSTAMP_RAW = 0,
> > +     NETDEV_TSTAMP_CYCLE,
> > +     NETDEV_TSTAMP_REALTIME,
> > +};
>
> Would it make sense to document the types? By your change of the
> ndo_get_tstamp() documentation below, the info that cycles is
> about a free running cycle counter is lost.
Good point. I will add a section in kdoc.

>
> IMO the name RAW for the timestamp of the adjustable physical clock is
> not a good fit, because NETDEV_TSTAMP_CYCLE is more raw (not adjustable)
> than NETDEV_TSTAMP_RAW (adjustable). Maybe NETDEV_TSTAMP_PHC instead of
> NETDEV_TSTAMP_RAW?
Agreed, will do in v2.

>
> If I understand your second patch correctly, then NETDEV_TSTAMP_REALTIME
> can provide a timestamp with low accuracy, which can even jump backwards
> (a later received package can get an earlier timestamp due to the simple
> synchronisation in gve_hwts_realtime_update). Should the expected
> quality of the timestamps be documented here?
Good point. I will mention this in the kdoc in v2.
>
> > +
> >   /*
> >    * This structure defines the management hooks for network devices.
> >    * The following hooks can be defined; unless noted otherwise, they are
> > @@ -1406,11 +1412,10 @@ struct netdev_net_notifier {
> >    *     Get the forwarding path to reach the real device from the HW destination address
> >    * ktime_t (*ndo_get_tstamp)(struct net_device *dev,
> >    *                       const struct skb_shared_hwtstamps *hwtstamps,
> > - *                        bool cycles);
> > - *   Get hardware timestamp based on normal/adjustable time or free running
> > - *   cycle counter. This function is required if physical clock supports a
> > - *   free running cycle counter.
> > - *
> > + *                        enum netdev_tstamp_type type);
> > + *   Get hardware timestamp based on the type requested, or return 0 if the
> > + *   requested type is not supported. This function is required if physical
> > + *   clock supports a free running cycle counter.
>
> ...
>
> Gerhard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ