From: Tariq Toukan <tariqt@nvidia.com>
To: Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
"Richard Cochran" <richardcochran@gmail.com>,
<netdev@vger.kernel.org>, <linux-rdma@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, Gal Pressman <gal@nvidia.com>,
Thomas Gleixner <tglx@linutronix.de>,
Carolina Jubran <cjubran@nvidia.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
"Dragos Tatulea" <dtatulea@nvidia.com>
Subject: [PATCH net-next V2 0/3] Support exposing raw cycle counters in PTP and mlx5
Date: Tue, 12 Aug 2025 17:17:05 +0300 [thread overview]
Message-ID: <1755008228-88881-1-git-send-email-tariqt@nvidia.com> (raw)
Hi,
This series by Carolina adds support in ptp and usage in mlx5 for
exposing the raw free-running cycle counter of PTP hardware clocks.
This is V2. Find previous one here:
https://lore.kernel.org/all/1752556533-39218-1-git-send-email-tariqt@nvidia.com/
Find detailed description by Carolina below [1].
Regards,
Tariq
V2:
- Extend the cover letter with more motivation and use cases.
[1]
This patch series introduces support for exposing the raw free-running
cycle counter of PTP hardware clocks. When the device is in free-running
mode, it emits timestamps as raw cycle values instead of nanoseconds.
These values may be passed directly to user space through:
- fwctl: exposes internal device event records that include raw
cycle-based timestamps.
- DPDK: retrieves CQEs that contain raw cycle counters, which are passed
to user space unmodified.
To address this, the series introduces two new ioctl commands that allow
userspace to query the device's raw cycle counter together with host
time:
- PTP_SYS_OFFSET_PRECISE_CYCLES
- PTP_SYS_OFFSET_EXTENDED_CYCLES
These commands work like their existing counterparts but return the
device timestamp in cycle units instead of real-time nanoseconds. This
allows user space to collect (cycle, time) pairs and build a mapping
between the device’s free-running clock and host time.
This can also be useful in the XDP fast path: if a driver inserts the
raw cycle value into metadata instead of a real-time timestamp, it can
avoid the overhead of converting cycles to time in the kernel. Then
userspace can resolve the cycle-to-time mapping using this ioctl when
needed.
The ioctl enables user space to correlate those with host time, without
requiring the PHC to be synchronized, so long as the drift remains
stable during collection.
Adds the new PTP ioctls and integrates support in ptp_ioctl():
- ptp: Add ioctl commands to expose raw cycle counter values
Support for exposing raw cycles in mlx5:
- net/mlx5: Extract MTCTR register read logic into helper function
- net/mlx5: Support getcyclesx and getcrosscycles
Carolina Jubran (3):
ptp: Add ioctl commands to expose raw cycle counter values
net/mlx5: Extract MTCTR register read logic into helper function
net/mlx5: Support getcyclesx and getcrosscycles
.../ethernet/mellanox/mlx5/core/lib/clock.c | 113 ++++++++++++++++--
drivers/ptp/ptp_chardev.c | 34 ++++--
include/uapi/linux/ptp_clock.h | 4 +
3 files changed, 130 insertions(+), 21 deletions(-)
base-commit: bc4c0a48bdad7f225740b8e750fdc1da6d85e1eb
--
2.40.1
next reply other threads:[~2025-08-12 14:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 14:17 Tariq Toukan [this message]
2025-08-12 14:17 ` [PATCH net-next V2 1/3] ptp: Add ioctl commands to expose raw cycle counter values Tariq Toukan
2025-08-19 8:43 ` Paolo Abeni
2025-08-25 17:52 ` Mark Bloch
2025-08-28 10:00 ` Richard Cochran
2025-09-04 12:09 ` Carolina Jubran
2025-09-04 13:14 ` Richard Cochran
2025-09-09 5:52 ` Tariq Toukan
2025-09-09 8:31 ` Paolo Abeni
2025-09-04 13:13 ` Richard Cochran
2025-08-12 14:17 ` [PATCH net-next V2 2/3] net/mlx5: Extract MTCTR register read logic into helper function Tariq Toukan
2025-08-12 14:17 ` [PATCH net-next V2 3/3] net/mlx5: Support getcyclesx and getcrosscycles Tariq Toukan
2025-09-09 8:40 ` [PATCH net-next V2 0/3] Support exposing raw cycle counters in PTP and mlx5 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=1755008228-88881-1-git-send-email-tariqt@nvidia.com \
--to=tariqt@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=cjubran@nvidia.com \
--cc=davem@davemloft.net \
--cc=dtatulea@nvidia.com \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=saeedm@nvidia.com \
--cc=tglx@linutronix.de \
--cc=vladimir.oltean@nxp.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®