]> Git Repo - linux.git/commit
ptp/ioctl: support MONOTONIC{,_RAW} timestamps for PTP_SYS_OFFSET_EXTENDED
authorMahesh Bandewar <[email protected]>
Wed, 4 Sep 2024 14:13:05 +0000 (07:13 -0700)
committerDavid S. Miller <[email protected]>
Sun, 8 Sep 2024 17:40:33 +0000 (18:40 +0100)
commitc259acab839e57eab0318f32da4ae803a8d59397
tree2d04bad4ad9273e95fc0bd221bd70ec91ac3d3cd
parentd5c4546062fd6f5dbce575c7ea52ad66d1968678
ptp/ioctl: support MONOTONIC{,_RAW} timestamps for PTP_SYS_OFFSET_EXTENDED

The ability to read the PHC (Physical Hardware Clock) alongside
multiple system clocks is currently dependent on the specific
hardware architecture. This limitation restricts the use of
PTP_SYS_OFFSET_PRECISE to certain hardware configurations.

The generic soultion which would work across all architectures
is to read the PHC along with the latency to perform PHC-read as
offered by PTP_SYS_OFFSET_EXTENDED which provides pre and post
timestamps.  However, these timestamps are currently limited
to the CLOCK_REALTIME timebase. Since CLOCK_REALTIME is affected
by NTP (or similar time synchronization services), it can
experience significant jumps forward or backward. This hinders
the precise latency measurements that PTP_SYS_OFFSET_EXTENDED
is designed to provide.

This problem could be addressed by supporting MONOTONIC_RAW
timestamps within PTP_SYS_OFFSET_EXTENDED. Unlike CLOCK_REALTIME
or CLOCK_MONOTONIC, the MONOTONIC_RAW timebase is unaffected
by NTP adjustments.

This enhancement can be implemented by utilizing one of the three
reserved words within the PTP_SYS_OFFSET_EXTENDED struct to pass
the clock-id for timestamps.  The current behavior aligns with
clock-id for CLOCK_REALTIME timebase (value of 0), ensuring
backward compatibility of the UAPI.

Signed-off-by: Mahesh Bandewar <[email protected]>
Signed-off-by: Vadim Fedorenko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
drivers/ptp/ptp_chardev.c
include/linux/ptp_clock_kernel.h
include/uapi/linux/ptp_clock.h
This page took 0.070668 seconds and 4 git commands to generate.