head 1.1; branch 1.1.1; access; symbols netbsd-11-0-RC4:1.1.1.4 netbsd-11-0-RC3:1.1.1.4 netbsd-11-0-RC2:1.1.1.4 netbsd-11-0-RC1:1.1.1.4 perseant-exfatfs-base-20250801:1.1.1.4 netbsd-11:1.1.1.4.0.30 netbsd-11-base:1.1.1.4 netbsd-10-1-RELEASE:1.1.1.4 ntp-4-2-8p18:1.1.1.4 perseant-exfatfs-base-20240630:1.1.1.4 perseant-exfatfs:1.1.1.4.0.28 perseant-exfatfs-base:1.1.1.4 netbsd-8-3-RELEASE:1.1.1.4 netbsd-9-4-RELEASE:1.1.1.4 netbsd-10-0-RELEASE:1.1.1.4 netbsd-10-0-RC6:1.1.1.4 netbsd-10-0-RC5:1.1.1.4 netbsd-10-0-RC4:1.1.1.4 netbsd-10-0-RC3:1.1.1.4 netbsd-10-0-RC2:1.1.1.4 netbsd-10-0-RC1:1.1.1.4 netbsd-10:1.1.1.4.0.26 netbsd-10-base:1.1.1.4 ntp-4-2-8p15:1.1.1.4 netbsd-9-3-RELEASE:1.1.1.4 cjep_sun2x-base1:1.1.1.4 cjep_sun2x:1.1.1.4.0.24 cjep_sun2x-base:1.1.1.4 cjep_staticlib_x-base1:1.1.1.4 netbsd-9-2-RELEASE:1.1.1.4 cjep_staticlib_x:1.1.1.4.0.22 cjep_staticlib_x-base:1.1.1.4 netbsd-9-1-RELEASE:1.1.1.4 ntp-4-2-8p14:1.1.1.4 phil-wifi-20200421:1.1.1.4 phil-wifi-20200411:1.1.1.4 is-mlppp:1.1.1.4.0.20 is-mlppp-base:1.1.1.4 phil-wifi-20200406:1.1.1.4 netbsd-8-2-RELEASE:1.1.1.4 netbsd-9-0-RELEASE:1.1.1.4 netbsd-9-0-RC2:1.1.1.4 netbsd-9-0-RC1:1.1.1.4 phil-wifi-20191119:1.1.1.4 netbsd-9:1.1.1.4.0.18 netbsd-9-base:1.1.1.4 phil-wifi-20190609:1.1.1.4 netbsd-8-1-RELEASE:1.1.1.4 netbsd-8-1-RC1:1.1.1.4 pgoyette-compat-merge-20190127:1.1.1.4 pgoyette-compat-20190127:1.1.1.4 pgoyette-compat-20190118:1.1.1.4 pgoyette-compat-1226:1.1.1.4 pgoyette-compat-1126:1.1.1.4 pgoyette-compat-1020:1.1.1.4 pgoyette-compat-0930:1.1.1.4 ntp-4-2-8p12:1.1.1.4 pgoyette-compat-0906:1.1.1.4 netbsd-7-2-RELEASE:1.1.1.2.4.2 pgoyette-compat-0728:1.1.1.4 netbsd-8-0-RELEASE:1.1.1.4 phil-wifi:1.1.1.4.0.16 phil-wifi-base:1.1.1.4 pgoyette-compat-0625:1.1.1.4 netbsd-8-0-RC2:1.1.1.4 pgoyette-compat-0521:1.1.1.4 pgoyette-compat-0502:1.1.1.4 pgoyette-compat-0422:1.1.1.4 netbsd-8-0-RC1:1.1.1.4 pgoyette-compat-0415:1.1.1.4 pgoyette-compat-0407:1.1.1.4 ntp-4-2-8p11:1.1.1.4 pgoyette-compat-0330:1.1.1.4 pgoyette-compat-0322:1.1.1.4 pgoyette-compat-0315:1.1.1.4 netbsd-7-1-2-RELEASE:1.1.1.2.4.2 pgoyette-compat:1.1.1.4.0.14 pgoyette-compat-base:1.1.1.4 netbsd-7-1-1-RELEASE:1.1.1.2.4.2 matt-nb8-mediatek:1.1.1.4.0.12 matt-nb8-mediatek-base:1.1.1.4 perseant-stdc-iso10646:1.1.1.4.0.10 perseant-stdc-iso10646-base:1.1.1.4 netbsd-8:1.1.1.4.0.8 netbsd-8-base:1.1.1.4 prg-localcount2-base3:1.1.1.4 prg-localcount2-base2:1.1.1.4 prg-localcount2-base1:1.1.1.4 prg-localcount2:1.1.1.4.0.6 prg-localcount2-base:1.1.1.4 pgoyette-localcount-20170426:1.1.1.4 bouyer-socketcan-base1:1.1.1.4 ntp-4-2-8p10:1.1.1.4 pgoyette-localcount-20170320:1.1.1.4 netbsd-7-1:1.1.1.2.4.2.0.4 netbsd-7-1-RELEASE:1.1.1.2.4.2 netbsd-7-1-RC2:1.1.1.2.4.2 netbsd-7-nhusb-base-20170116:1.1.1.2.4.2 bouyer-socketcan:1.1.1.4.0.4 bouyer-socketcan-base:1.1.1.4 pgoyette-localcount-20170107:1.1.1.4 netbsd-7-1-RC1:1.1.1.2.4.2 ntp-4-2-8p9:1.1.1.4 pgoyette-localcount-20161104:1.1.1.4 netbsd-7-0-2-RELEASE:1.1.1.2.4.1.2.1 localcount-20160914:1.1.1.4 netbsd-7-nhusb:1.1.1.2.4.2.0.2 netbsd-7-nhusb-base:1.1.1.2.4.2 pgoyette-localcount-20160806:1.1.1.4 pgoyette-localcount-20160726:1.1.1.4 pgoyette-localcount:1.1.1.4.0.2 pgoyette-localcount-base:1.1.1.4 ntp-4-2-8p8:1.1.1.4 netbsd-7-0-1-RELEASE:1.1.1.2.4.1.2.1 ntp-4-2-8p7:1.1.1.4 ntp-4-2-8p5:1.1.1.3 ntp-4-2-8p4:1.1.1.3 netbsd-7-0:1.1.1.2.4.1.0.2 netbsd-7-0-RELEASE:1.1.1.2.4.1 netbsd-7-0-RC3:1.1.1.2.4.1 netbsd-7-0-RC2:1.1.1.2.4.1 ntp-4-2-8p3:1.1.1.3 netbsd-7-0-RC1:1.1.1.2.4.1 ntp-4-2-8p2:1.1.1.3 netbsd-5-1:1.1.1.3.0.6 netbsd-5-2:1.1.1.3.0.4 netbsd-5:1.1.1.3.0.2 ntp-4-2-8:1.1.1.3 netbsd-6-0-6-RELEASE:1.1.1.1 netbsd-6-1-5-RELEASE:1.1.1.1 netbsd-7:1.1.1.2.0.4 netbsd-7-base:1.1.1.2 yamt-pagecache-base9:1.1.1.2 yamt-pagecache-tag8:1.1.1.1 netbsd-6-1-4-RELEASE:1.1.1.1 netbsd-6-0-5-RELEASE:1.1.1.1 tls-earlyentropy:1.1.1.2.0.2 tls-earlyentropy-base:1.1.1.2 riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.2 riastradh-drm2-base3:1.1.1.2 netbsd-6-1-3-RELEASE:1.1.1.1 netbsd-6-0-4-RELEASE:1.1.1.1 ntp-2-4-7p404:1.1.1.2 netbsd-6-1-2-RELEASE:1.1.1.1 netbsd-6-0-3-RELEASE:1.1.1.1 netbsd-6-1-1-RELEASE:1.1.1.1 riastradh-drm2-base2:1.1.1.1 riastradh-drm2-base1:1.1.1.1 riastradh-drm2:1.1.1.1.0.16 riastradh-drm2-base:1.1.1.1 netbsd-6-1:1.1.1.1.0.22 netbsd-6-0-2-RELEASE:1.1.1.1 netbsd-6-1-RELEASE:1.1.1.1 khorben-n900:1.1.1.1.0.20 netbsd-6-1-RC4:1.1.1.1 netbsd-6-1-RC3:1.1.1.1 agc-symver:1.1.1.1.0.18 agc-symver-base:1.1.1.1 netbsd-6-1-RC2:1.1.1.1 netbsd-6-1-RC1:1.1.1.1 yamt-pagecache-base8:1.1.1.1 netbsd-6-0-1-RELEASE:1.1.1.1 yamt-pagecache-base7:1.1.1.1 matt-nb6-plus-nbase:1.1.1.1 yamt-pagecache-base6:1.1.1.1 netbsd-6-0:1.1.1.1.0.14 netbsd-6-0-RELEASE:1.1.1.1 netbsd-6-0-RC2:1.1.1.1 tls-maxphys:1.1.1.1.0.12 tls-maxphys-base:1.1.1.2 matt-nb6-plus:1.1.1.1.0.10 matt-nb6-plus-base:1.1.1.1 netbsd-6-0-RC1:1.1.1.1 yamt-pagecache-base5:1.1.1.1 yamt-pagecache-base4:1.1.1.1 netbsd-6:1.1.1.1.0.8 netbsd-6-base:1.1.1.1 ntp-4-2-6p5:1.1.1.1 yamt-pagecache-base3:1.1.1.1 yamt-pagecache-base2:1.1.1.1 yamt-pagecache:1.1.1.1.0.6 yamt-pagecache-base:1.1.1.1 cherry-xenmp:1.1.1.1.0.4 cherry-xenmp-base:1.1.1.1 bouyer-quota2-nbase:1.1.1.1 bouyer-quota2:1.1.1.1.0.2 bouyer-quota2-base:1.1.1.1 matt-mips64-premerge-20101231:1.1.1.1 matt-premerge-20091211:1.1.1.1 ntp-4-2-6:1.1.1.1 UDEL:1.1.1; locks; strict; comment @# @; 1.1 date 2009.12.13.16.53.52; author kardel; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2009.12.13.16.53.52; author kardel; state Exp; branches 1.1.1.1.6.1 1.1.1.1.8.1 1.1.1.1.12.1 1.1.1.1.14.1 1.1.1.1.22.1; next 1.1.1.2; 1.1.1.2 date 2013.12.27.23.30.35; author christos; state Exp; branches 1.1.1.2.4.1; next 1.1.1.3; commitid lUOr4MoxyTWJnPix; 1.1.1.3 date 2014.12.19.20.37.36; author christos; state Exp; branches 1.1.1.3.2.1 1.1.1.3.4.1 1.1.1.3.6.1; next 1.1.1.4; commitid ZhiTe4k7DUh9XG2y; 1.1.1.4 date 2016.05.01.15.57.23; author christos; state Exp; branches; next ; commitid b5SfeFzHnXqg0N4z; 1.1.1.1.6.1 date 2014.05.22.15.50.05; author yamt; state Exp; branches; next ; commitid qRWX0Nj0VOtU8yBx; 1.1.1.1.8.1 date 2014.12.25.02.34.31; author snj; state Exp; branches; next 1.1.1.1.8.2; commitid JG3hF57oHA79Lm3y; 1.1.1.1.8.2 date 2016.05.08.22.02.08; author snj; state Exp; branches; next 1.1.1.1.8.3; commitid zHEEBgqjSkM59J5z; 1.1.1.1.8.3 date 2017.05.04.06.03.55; author snj; state Exp; branches; next ; commitid EWPBrgkNodS6f2Qz; 1.1.1.1.12.1 date 2014.08.19.23.51.37; author tls; state Exp; branches; next ; commitid jTnpym9Qu0o4R1Nx; 1.1.1.1.14.1 date 2014.12.25.02.28.03; author snj; state Exp; branches; next 1.1.1.1.14.2; commitid 5AhJfEA9N5i2Jm3y; 1.1.1.1.14.2 date 2016.05.08.21.50.59; author snj; state Exp; branches; next 1.1.1.1.14.3; commitid HoBFZ1u5W2WC5J5z; 1.1.1.1.14.3 date 2017.05.04.05.53.46; author snj; state Exp; branches; next ; commitid jhaluCHGWFjNb2Qz; 1.1.1.1.22.1 date 2014.12.25.02.13.00; author snj; state Exp; branches; next 1.1.1.1.22.2; commitid YfAuzsC3wt5BDm3y; 1.1.1.1.22.2 date 2016.05.08.21.55.47; author snj; state Exp; branches; next 1.1.1.1.22.3; commitid m3WlINcpOIQj7J5z; 1.1.1.1.22.3 date 2017.05.04.06.00.59; author snj; state Exp; branches; next ; commitid ozyckFeSCY9ee2Qz; 1.1.1.2.4.1 date 2014.12.24.00.05.15; author riz; state Exp; branches 1.1.1.2.4.1.2.1; next 1.1.1.2.4.2; commitid KfwYQsQPJT87Yd3y; 1.1.1.2.4.2 date 2016.05.11.11.35.37; author martin; state Exp; branches; next ; commitid JpziLndfUrYvz36z; 1.1.1.2.4.1.2.1 date 2016.05.11.10.02.37; author martin; state Exp; branches; next ; commitid 7r5k5ayLJtXs336z; 1.1.1.3.2.1 date 2014.12.19.20.37.36; author msaitoh; state dead; branches; next 1.1.1.3.2.2; commitid ysuzPTeSQAKO335y; 1.1.1.3.2.2 date 2015.01.07.04.45.23; author msaitoh; state Exp; branches; next ; commitid ysuzPTeSQAKO335y; 1.1.1.3.4.1 date 2014.12.19.20.37.36; author msaitoh; state dead; branches; next 1.1.1.3.4.2; commitid d5X8VW3e9U6mR45y; 1.1.1.3.4.2 date 2015.01.07.10.10.05; author msaitoh; state Exp; branches; next ; commitid d5X8VW3e9U6mR45y; 1.1.1.3.6.1 date 2014.12.19.20.37.36; author msaitoh; state dead; branches; next 1.1.1.3.6.2; commitid cHl8i0Vq4fzxx55y; 1.1.1.3.6.2 date 2015.01.07.12.13.14; author msaitoh; state Exp; branches; next ; commitid cHl8i0Vq4fzxx55y; desc @@ 1.1 log @Initial revision @ text @
from Pogo, Walt Kelly
You need a little magic.
Last update: 03-May-2009 3:37 UTC
In the protocol described in the NTP specification and implemented today the transmit timestamp is captured before the MD5 digest is computed and the packet is sent, while the receive timestamp is captured after the packet is received. For enhanced accuracy it is desirable to capture the timestamps as close to the wire as possible; i.e., with hardware assist or with a modified driver.
The problem is, while the receive timestamp could in principle be piggybacked in the receive buffer, the transmit timestamp cannot ordinarily be transmitted in the same packet. A solution for this problem is the two-step or interleaved protocol described on this page and included in the the current reference implementation. In this experimental variant the transmit timestamp for one packet is actually carried in the immediately following packet. The trick, however, is to implement the interleaved protocol without changing the NTP packet header format, without compromising backwards compatibility and without compromising the error recovery properties.
Currently, the reference implementation uses only software timestamps (softstamps). The receive softstamp is captured at software interrupt time and before the buffer is queued for later processing. The reference implementation captures a softstamp before the message digest routine and another after the send-packet routine. In this design the latter timestamp can be considered most accurate, as it avoids the kernel latencies and queueing mechanisms. The difference, called the interleaved or output delay, varies from 16 ms for a dual-core, 2.8 GHz Pentium 4 running FreeBSD 6.1 to 1100 ms for a Sun Blade 1500 running Solaris 10.
Performacne varies widely between machines and network interface cards on a 100-Mb switched Ethernet where the NTP packet is about 1000 bits or 10 ms. On two identical Pentium 4 machines in symmetric mode, the measured output delay is 16 ms and remaining one-way delay components 45-150 ms. Two LAN segments account for 20 ms, which leaves 25-130 ms for input delay. On two identical UltraSPARC machines running Solaris 10 in symmetric mode, the measured output delay is 160 ms and remaining one-way delay components 195 ms. Two LAN segments account for 20 ms, which leaves 175 ms for input delay.
Performance with the Pentia show a residual jitter of about 20 ms, which is by far the best performance so far. However, much better performance could result if the input delay could be reduced or elminated with driver or hardware timestamps. Should that be done, performance should be in the same order as the the PPS and kernel discipline, which is in the order of 2 ms.
Interleaved modes can be used only in NTP symmetric and broadcast modes. It is activated by the xleave option with the peer or broadcast configuration commands. The NTP protocol automatically reconfigures in normal or interleaved mode as required. Ordinary broadcast clients can use the same servers as interleaved broadcast clients at the same time. Further details are in the white paper NTP Interleaved On-Wire Protocol and the briefing Interleaved Synchronization Protocols for LANs and Space Data Links.
from Pogo, Walt Kelly
You need a little magic.
Last update: 10-Mar-2014 05:25 UTC
d20 23 a42 14In the protocol described in the NTP specification and reference implementation up to now, the transmit timestamp, which is captured before the message digest is computed and the packet queued for output, is properly called as a softstamp The receive timestamp, which is captured after the input driver interrupt routine and before the packet is queued for input, is properly called a drivestamp. For enhanced accuracy it is desirable to capture the transmit timestamp as close to the wire as possible; for example, after the output driver interrupt routine.
In other words, we would like to replace the transmit softstamp with a drivestamp, but the problem is the transmit drivestamp is available only after the packet has been sent. A solution for this problem is the two-step or interleaved protocol described on this page and included in the the current reference implementation. In interleaved modes the transmit drivestamp for one packet is actually carried in the immediately following packet. The trick, however, is to implement the interleaved protocol without changing the NTP packet header format, without compromising backwards compatibility and without compromising the error recovery properties.
The reference implementation captures a softstamp before the message digest routine and a drivestamp after the output interrupt routine. In this design the latter timestamp can be considered most accurate, as it avoids the various queuing and transmission latencies. The difference between the two timestamps, which is called the interleaved or output delay, varies from 16 μs for a dual-core Pentium running FreeBSD 6.1 to 1100 μs for a Sun Blade 1500 running Solaris 10.
Interleaved mode can be used only in NTP symmetric and broadcast modes. It is activated by the xleave option with the peer or broadcast configuration commands. A broadcast server configured for interleaved mode is transparent to ordinary broadcast clients, so both ordinary and interleaved broadcast clients can use the same packets. An interleaved symmetric active peer automatically switches to ordinary symmetric mode if the other peer is not capable of operation in interleaved mode.
As demonstrated in the white paper Analysis and Simulation of the NTP On-Wire Protocols, the interleaved modes have the same resistance to lost packets, duplicate packets, packets crossed in flight and protocol restarts as the ordinary modes. An application of the interleaved symmetric mode in space missions is presented in the white paper Time Synchronization for Space Data Links.