Skip to content

More accurate PHC<->system clock synchronization

Miroslav Lichvar netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 10 repliesIn review

Changes in v1 from the cover letter

- added new patches
- separated PHC timestamp from ptp_system_timestamp
- fixed memory leak in PTP_SYS_OFFSET_EXTENDED
- changed PTP_SYS_OFFSET_EXTENDED to work with array of arrays
- fixed PTP_SYS_OFFSET_EXTENDED to break correctly from loop
- fixed timecounter updates in drivers
- split gettimex in igb driver
- fixed ptp_read_* functions to be available without CONFIG_PTP_1588_CLOCK

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8ptp: reorder declarations in ptp_ioctl()drivers/ptp/ptp_chardev.c+7 -70 replies
2/8ptp: check gettime64 return code in PTP_SYS_OFFSET ioctldrivers/ptp/ptp_chardev.c+4 -10 replies
3/8ptp: add PTP_SYS_OFFSET_EXTENDED ioctldrivers/ptp/ptp_chardev.c include/linux/ptp_clock_kernel.h include/uapi/linux/ptp_clock.h+76 -09 replies
4/8ptp: deprecate gettime64() in favor of gettimex64()drivers/ptp/ptp_chardev.c drivers/ptp/ptp_clock.c include/linux/ptp_clock_kernel.h+10 -20 replies
5/8e1000e: extend PTP gettime function to read system clockdrivers/net/ethernet/intel/e1000e/e1000.h drivers/net/ethernet/intel/e1000e/netdev.c drivers/net/ethernet/intel/e1000e/ptp.c+45 -161 reply
6/8igb: extend PTP gettime function to read system clockdrivers/net/ethernet/intel/igb/igb_ptp.c+55 -101 reply
7/8ixgbe: extend PTP gettime function to read system clockdrivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c+44 -102 replies
8/8tg3: extend PTP gettime function to read system clockdrivers/net/ethernet/broadcom/tg3.c+13 -60 replies

Reviews trailers per patch

3 of 8 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJacob KellerRichard CochranJeff Kirsher
SeriesR-b A-b
1/8
2/8
3/8
4/8
5/8A-b
6/8A-b
7/8A-b
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH net-next 0/8] More accurate PHC<->system clock synchronization

RFC->v1:
- added new patches
- separated PHC timestamp from ptp_system_timestamp
- fixed memory leak in PTP_SYS_OFFSET_EXTENDED
- changed PTP_SYS_OFFSET_EXTENDED to work with array of arrays
- fixed PTP_SYS_OFFSET_EXTENDED to break correctly from loop
- fixed timecounter updates in drivers
- split gettimex in igb driver
- fixed ptp_read_* functions to be available without CONFIG_PTP_1588_CLOCK

This series enables a more accurate synchronization between PTP hardware clocks and the system clock.

The first two patches are minor cleanup/bug fixes.

The third 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 get a smaller upper bound on the maximum error.

The fourth patch deprecates the original gettime function.

The remaining patches update the gettime function in order to support the new ioctl in the e1000e, igb, ixgbe, and tg3 drivers.

Tests with few different NICs in different machines show that:
- with an I219 (e1000e) the measured delay was reduced from 2500 to 1300 ns and the error in the measured offset, when compared to the cross timestamping supported by the driver, was reduced by a factor of 5
- with an I210 (igb) the delay was reduced from 5100 to 1700 ns
- with an I350 (igb) the delay was reduced from 2300 to 750 ns
- with an X550 (ixgbe) the delay was reduced from 1950 to 650 ns
- with a BCM5720 (tg3) the delay was reduced from 2400 to 1200 ns

Miroslav Lichvar (8):
ptp: reorder declarations in ptp_ioctl()
ptp: check gettime64 return code in PTP_SYS_OFFSET ioctl
ptp: add PTP_SYS_OFFSET_EXTENDED ioctl
ptp: deprecate gettime64() in favor of gettimex64()
e1000e: extend PTP gettime function to read system clock
igb: extend PTP gettime function to read system clock
ixgbe: extend PTP gettime function to read system clock
tg3: extend PTP gettime function to read system clock

 drivers/net/ethernet/broadcom/tg3.c          | 19 ++++--
 drivers/net/ethernet/intel/e1000e/e1000.h    |  3 +
 drivers/net/ethernet/intel/e1000e/netdev.c   | 42 ++++++++++---
 drivers/net/ethernet/intel/e1000e/ptp.c      | 16 +++--
 drivers/net/ethernet/intel/igb/igb_ptp.c     | 65 +++++++++++++++++---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 54 +++++++++++++---
 drivers/ptp/ptp_chardev.c                    | 55 ++++++++++++++---
 drivers/ptp/ptp_clock.c                      |  5 +-
 include/linux/ptp_clock_kernel.h             | 33 ++++++++++
 include/uapi/linux/ptp_clock.h               | 12 ++++
 10 files changed, 253 insertions(+), 51 deletions(-)
Signature · 1 line
2.17.2