From: Jacob Keller <jacob.e.keller@intel.com>
To: Harshitha Ramamurthy <hramamurthy@google.com>, <netdev@vger.kernel.org>
Cc: <joshwash@google.com>, <andrew+netdev@lunn.ch>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <richardcochran@gmail.com>,
<willemb@google.com>, <nktgrg@google.com>, <jfraker@google.com>,
<ziweixiao@google.com>, <maolson@google.com>,
<thostet@google.com>, <jordanrhee@google.com>,
<jefrogers@google.com>, <alok.a.tiwari@oracle.com>,
<yyd@google.com>, <linux-kernel@vger.kernel.org>,
Naman Gulati <namangulati@google.com>
Subject: Re: [PATCH net-next v3 3/3] gve: implement PTP gettimex64
Date: Fri, 3 Apr 2026 14:17:59 -0700 [thread overview]
Message-ID: <d02145e3-8ac4-4057-a888-3ce074a295ea@intel.com> (raw)
In-Reply-To: <20260403194427.1830609-4-hramamurthy@google.com>
On 4/3/2026 12:44 PM, Harshitha Ramamurthy wrote:
> From: Jordan Rhee <jordanrhee@google.com>
>
> Enable chrony and phc2sys to synchronize system clock to NIC clock.
>
> The system cycle counters are sampled by the device to minimize the
> uncertainty window. If the system times are sampled in the host, the
> delta between pre and post readings is 100us or more due to AQ command
> latency. The system times returned by the device have a delta of ~1us,
> which enables significantly more accurate clock synchronization.
>
> Reviewed-by: Willem de Bruijn <willemb@google.com>
> Reviewed-by: Kevin Yang <yyd@google.com>
> Reviewed-by: Naman Gulati <namangulati@google.com>
> Signed-off-by: Jordan Rhee <jordanrhee@google.com>
> Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
> ---
> +/*
> + * Convert a raw cycle count (e.g. from get_cycles()) to the system clock
> + * type specified by clockid. The system_time_snapshot must be taken before
> + * the cycle counter is sampled.
> + */
> +static int gve_cycles_to_timespec64(struct gve_priv *priv, clockid_t clockid,
> + struct system_time_snapshot *snap,
> + u64 cycles, struct timespec64 *ts)
> +{
> + struct gve_cycles_to_clock_callback_ctx ctx = {0};
> + struct system_device_crosststamp xtstamp;
> + int err;
> +
> + ctx.cycles = cycles;
> + err = get_device_system_crosststamp(gve_cycles_to_clock_fn, &ctx, snap,
> + &xtstamp);
> + if (err) {
> + dev_err_ratelimited(&priv->pdev->dev,
> + "get_device_system_crosststamp() failed to convert %lld cycles to system time: %d\n",
> + cycles,
> + err);
> + return err;
> + }
> +
This looks a lot like a cross timestamp (i.e. something like PCIe PTM)
Why not just implement the .crosstimestamp and PTP_SYS_OFF_PRECISE? Does
that not work properly? Or is this not really a cross timestamp despite
use of the get_device_system_crosststamp handler? :D
Thanks,
Jake
> + switch (clockid) {
> + case CLOCK_REALTIME:
> + *ts = ktime_to_timespec64(xtstamp.sys_realtime);
> + break;
> + case CLOCK_MONOTONIC_RAW:
> + *ts = ktime_to_timespec64(xtstamp.sys_monoraw);
> + break;
> + default:
> + dev_err_ratelimited(&priv->pdev->dev,
> + "Cycle count conversion to clockid %d not supported\n",
> + clockid);
> + return -EOPNOTSUPP;
> + }
> +
> + return 0;
> +}
> +
next prev parent reply other threads:[~2026-04-03 21:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 19:44 [PATCH net-next v3 0/3] gve: add support for PTP gettimex64 Harshitha Ramamurthy
2026-04-03 19:44 ` [PATCH net-next v3 1/3] gve: skip error logging for retryable AdminQ commands Harshitha Ramamurthy
2026-04-03 21:11 ` Jacob Keller
2026-04-03 21:29 ` Jordan Rhee
2026-04-03 19:44 ` [PATCH net-next v3 2/3] gve: make nic clock reads thread safe Harshitha Ramamurthy
2026-04-03 19:44 ` [PATCH net-next v3 3/3] gve: implement PTP gettimex64 Harshitha Ramamurthy
2026-04-03 21:17 ` Jacob Keller [this message]
2026-04-06 20:41 ` Jordan Rhee
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=d02145e3-8ac4-4057-a888-3ce074a295ea@intel.com \
--to=jacob.e.keller@intel.com \
--cc=alok.a.tiwari@oracle.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hramamurthy@google.com \
--cc=jefrogers@google.com \
--cc=jfraker@google.com \
--cc=jordanrhee@google.com \
--cc=joshwash@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maolson@google.com \
--cc=namangulati@google.com \
--cc=netdev@vger.kernel.org \
--cc=nktgrg@google.com \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=thostet@google.com \
--cc=willemb@google.com \
--cc=yyd@google.com \
--cc=ziweixiao@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