• Miroslav Lichvar's avatar
    ptp: add PTP_SYS_OFFSET_EXTENDED ioctl · 36180087
    Miroslav Lichvar authored
    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
    Cc: Richard Cochran <richardcochran@gmail.com>
    Cc: Jacob Keller <jacob.e.keller@intel.com>
    Cc: Marcelo Tosatti <mtosatti@redhat.com>
    Signed-off-by: default avatarMiroslav Lichvar <mlichvar@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>