[ntp:hackers] IEEE 1588 support in NTP?

Martin Burnicki martin.burnicki at meinberg.de
Fri Oct 28 14:40:35 PDT 2005


Bjorn Gabrielsson wrote:
> Martin Burnicki <martin.burnicki at meinberg.de> writes:
> > Please keep in mind that PTP yields an accuracy in the nanosecond range
> > *only* if special network adapters with PTP support are used on all PTP
> > nodes.
> >
> > PTP support for network adapters means that the adapters include a
> > hardware timestamp unit which takes a time stamp whenever a PTP packet
> > goes on the wire or is coming in from the wire.
>
> Are 1588 going into general ethernet chipsets?

Yes. IEEE1588 uses standard UDP multicast packets, so it can basically be run 
using any ethernet NIC.

Here is a short summary on the 3 ways to assign timestamps to specific 
outgoing and incoming network packets:

1.) Inside the application, if a packet is sent or received. This is very 
portable since it runs completely in user space, and this is the way 
currently used by NTP. You can also run this on operating systems where you 
don't have access to the source code of the NIC drivers. However, this is the 
most inaccurate way since the time stamps depend on the latency of the IP 
stack, and on network collisions.

2.) Inside the NIC driver, e.g. in the interrupt service routine. This avoids 
the latencies of the IP stack, but you must modify the source code of the 
driver, or have a driver which takes time stamps if certain packets are being 
sent or received. Also, you don't know the latency due to network collisions 
when sending packets.

3.) By the NIC hardware. You need a time stamp unit (TSU) which listens on the 
data lines between the MAC and the PHY. The TSU contains a pattern matching 
unit which detects the pattern of the desired packet type in the serial bit 
stream on those data lines. If such a pattern is detected then the pattern 
matching unit must capture a time stamp of a high speed counter which is also 
part of the TSU. Since this method takes time stamps when a packet goes on 
the wire or arrives on the wire is also capable to eliminate the latency due 
to network collisions. 
The driver must be able to read those time stamps from the TSU and either 
assign them to the packets or pass them up the protocol stack to the 
application which then assigns the time stamps to the packets.
The TSU can be implemented in a programmable logic device like an ASIC or 
FPGA.
This method is the most accurate, but it requires a NIC with a TSU, and a 
kernel driver which supports the TSU.
The problem here is that most commonly used NICs have the MAC and the PHY in a 
single chip, and the data lines on which the TSU must listen is not 
accessible outside the chip. 

You must also be aware that the timing accuracy is significantly degraded if 
the PTP packets go through switches or routers which don't have a special 
handling for such packets, so packets may be queued which introduces again an 
unknown latency.

An overview of the principles of PTP and the way it uses hardware packet 
timestamping can be found here:
http://home.zhwin.ch/~wei/IEEE1588/IEEE_1588_Tutorial_engl.pdf


Best regards,

Martin
-- 
Martin Burnicki

Meinberg Funkuhren
Bad Pyrmont
Germany


More information about the hackers mailing list