Skip to content

RFC More accurate PHC<->system clock synchronization

Miroslav Lichvar intel-wired-lan netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4ptp: add PTP_SYS_OFFSET_EXTENDED ioctldrivers/ptp/ptp_chardev.c include/linux/ptp_clock_kernel.h include/uapi/linux/ptp_clock.h+77 -04 replies
2/4e1000e: add support for extended PHC gettimedrivers/net/ethernet/intel/e1000e/e1000.h drivers/net/ethernet/intel/e1000e/netdev.c drivers/net/ethernet/intel/e1000e/ptp.c+62 -100 replies
3/4igb: add support for extended PHC gettimedrivers/net/ethernet/intel/igb/igb_ptp.c+43 -03 replies
4/4ixgbe: add support for extended PHC gettimedrivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c+57 -08 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJacob KellerVinicius Costa Gomes
SeriesA-b
1/4A-b
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH 0/4] More accurate PHC<->system clock synchronization

This series adds support for a more accurate synchronization between a PTP hardware clock and the system clock.

The first patch adds an extended version of the PTP_SYS_OFFSET ioctl, which returns three timestamps for each measurement. The idea is to shorten the interval between the system timestamps to contain just the reading of the lowest register of the PHC in order to reduce the error in the measured offset and give a better bound on the maximum error.

The other patches add support for the new ioctl to the e1000e, igb, and ixgbe driver. Tests with few different NICs in different machines (and PCIe slots) show that:
- with an I219 (e1000e) the measured delay improved from 2500 to 1300 ns and the error in the measured offset, when compared to cross timestamping, was reduced by a factor of 5
- with an I210 (igb) the delay improved from 5100 to 1700 ns
- with an I350 (igb) the delay improved from 2300 to 750 ns
- with an X550 (ixgbe) the delay improved from 1950 to 650 ns

There is some duplication of code in the igb and ixgbe drivers, which I don't like very much, but I thought it's better than extending and wrapping the existing functions like in the e1000e driver. Also, mixing SYSTIM and "system time" in the code will probably be confusing.

I wasn't able to find a better name for the ioctl, the structures, and the driver function. If anyone has suggestions, please let me know.

Miroslav Lichvar (4):
ptp: add PTP_SYS_OFFSET_EXTENDED ioctl
e1000e: add support for extended PHC gettime
igb: add support for extended PHC gettime
ixgbe: add support for extended PHC gettime

 drivers/net/ethernet/intel/e1000e/e1000.h    |  3 ++
 drivers/net/ethernet/intel/e1000e/netdev.c   | 48 +++++++++++++----
 drivers/net/ethernet/intel/e1000e/ptp.c      | 21 ++++++++
 drivers/net/ethernet/intel/igb/igb_ptp.c     | 43 +++++++++++++++
 drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 57 ++++++++++++++++++++
 drivers/ptp/ptp_chardev.c                    | 39 ++++++++++++++
 include/linux/ptp_clock_kernel.h             | 26 +++++++++
 include/uapi/linux/ptp_clock.h               | 12 +++++
 8 files changed, 239 insertions(+), 10 deletions(-)
Signature · 1 line
2.17.2