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

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


Miroslav,

We actually don’t know the length of the data at layer 2. We can’t even guarantee the length at layer 3. Dispensing with layer numbers from now on.

We have three levels we have to concern ourselves with:

  Ethernet
  IP
  UDP

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.

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.

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

Denny


On Nov 21, 2016, at 00:30, Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:

We know the length of the
transmitted data at layer 2. Maybe we could use the same length of the
headers for received packets on the same interface? The link speed
should not be too difficult to get. Can you suggest a formula?



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