]> asedeno.scripts.mit.edu Git - linux.git/commit
ptp: add PTP_SYS_OFFSET_EXTENDED ioctl
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 9 Nov 2018 10:14:44 +0000 (11:14 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 10 Nov 2018 03:43:51 +0000 (19:43 -0800)
commit361800876f80da3915c46e388fc682532228b2c3
tree70275bdce7fd76b3142ee743433828670488bade
parent83d0bdc7390b890905634186baaa294475cd6a06
ptp: add PTP_SYS_OFFSET_EXTENDED ioctl

The PTP_SYS_OFFSET ioctl, which can be used to measure the offset
between a PHC and the system clock, includes the total time that the
driver needs to read the PHC timestamp.

This typically involves reading of multiple PCI registers (sometimes in
multiple iterations) and the register that contains the lowest bits of
the timestamp is not read in the middle between the two readings of the
system clock. This asymmetry causes the measured offset to have a
significant error.

Introduce a new ioctl, driver function, and helper functions, which
allow the reading of the lowest register to be isolated from the other
readings in order to reduce the asymmetry. The ioctl returns three
timestamps for each measurement:
- system time right before reading the lowest bits of the PHC timestamp
- PHC time
- system time immediately after reading the lowest bits of the PHC
  timestamp

Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Jacob Keller <jacob.e.keller@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/ptp/ptp_chardev.c
include/linux/ptp_clock_kernel.h
include/uapi/linux/ptp_clock.h