Re: [chrony-dev] SW/HW timestamping on Linux

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


On Mon, Nov 21, 2016 at 10:28:26AM -0800, Denny Page wrote:
> The only layer we know the size of is the UDP layer. The Ethernet layer can have VLAN tag. Yes, it’s only 32 bits, but error is error. The IP layer may have option headers. This is rare with IPv4, but not with IPv6.

With TX timestamping the kernel gives us ethernet frames and we have to
painfully extract the UDP data from them. IPv6 Options are not
currently supported.

So, in order to make this as simple as possible, we could make an
assumption that received packets have the same format as transmitted
packets. At least with VLANs this might work more often than not.

> The only way to correct the hardware timestamp is to know the entire length of the frame at the Ethernet level. I don’t see how this happens without using raw sockets.

I'd rather avoid raw sockets, at least for now. Even if the length
will be off by couple bytes, it should still be more accurate than SW
timestamps.

> The formula would be: timestamp += (ether_bytes + 4) * 8 / link_bps.

Ok, so if we store offset of UDP data from the beginning of a
transmitted frame at layer 2, it would be this?

	(udp_data_offset + NTP packet length + 4)

-- 
Miroslav Lichvar

-- 
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/