From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Carolina Jubran <cjubran@nvidia.com>,
Richard Cochran <richardcochran@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Dragos Tatulea <dtatulea@nvidia.com>,
Tariq Toukan <tariqt@nvidia.com>
Subject: Re: [PATCH net] ptp: Allow exposing cycles only for clocks with free-running counter
Date: Wed, 29 Oct 2025 20:33:55 +0000 [thread overview]
Message-ID: <03fa25f0-b7f5-4b3e-8a93-0637d0222719@linux.dev> (raw)
In-Reply-To: <20251029083813.2276997-1-cjubran@nvidia.com>
On 29/10/2025 08:38, Carolina Jubran wrote:
> The PTP core falls back to gettimex64 and getcrosststamp when
> getcycles64 or getcyclesx64 are not implemented. This causes the CYCLES
> ioctls to retrieve PHC real time instead of free-running cycles.
>
> Reject PTP_SYS_OFFSET_{PRECISE,EXTENDED}_CYCLES for clocks without
> free-running counter support since the result would represent PHC real
> time and system time rather than cycles and system time.
>
> Fixes: faf23f54d366 ("ptp: Add ioctl commands to expose raw cycle counter values")
> Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
> ---
> drivers/ptp/ptp_chardev.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index 8106eb617c8c..c61cf9edac48 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -561,10 +561,14 @@ long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd,
> return ptp_mask_en_single(pccontext->private_clkdata, argptr);
>
> case PTP_SYS_OFFSET_PRECISE_CYCLES:
> + if (!ptp->has_cycles)
> + return -EOPNOTSUPP;
> return ptp_sys_offset_precise(ptp, argptr,
> ptp->info->getcrosscycles);
>
> case PTP_SYS_OFFSET_EXTENDED_CYCLES:
> + if (!ptp->has_cycles)
> + return -EOPNOTSUPP;
> return ptp_sys_offset_extended(ptp, argptr,
> ptp->info->getcyclesx64);
> default:
Fair point.
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
next prev parent reply other threads:[~2025-10-29 20:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 8:38 Carolina Jubran
2025-10-29 10:09 ` Pavan Chebbi
2025-10-29 20:33 ` Vadim Fedorenko [this message]
2025-10-31 23:40 ` patchwork-bot+netdevbpf
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=03fa25f0-b7f5-4b3e-8a93-0637d0222719@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=cjubran@nvidia.com \
--cc=davem@davemloft.net \
--cc=dtatulea@nvidia.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=tariqt@nvidia.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
all inboxes | Powered by JetHome®