Subject: Re: Extending socket timestamping API for NTP

From: Miroslav Lichvar <[email-masked]>
Date: Mon, 27 Mar 2017 12:13:24 +0200

On Fri, Mar 24, 2017 at 10:17:51AM -0700, Denny Page wrote:
> > On Mar 24, 2017, at 02:45, Miroslav Lichvar <[email-masked]> wrote:
> > How common is to have link speed changing in normal operation on LAN?
> 
> In my case, it’s currently every few minutes because I’m doing hw timestamp testing. :)
> 
> But this does speak to my point. If it’s cached by the application, the application has to check it regularly to minimize the possibility of bad timestamps. If the link speed doesn’t change, every call by the application is wasted overhead. If it’s cached by the driver, there is no waste, and the stamps are always correct.

At least on the HW I'm testing, reading the link speed from user space
doesn't take much. It's about 10-15x faster than reading the PHC for
instance, which must be done periodically in any case.

> I should have remembered this yesterday... I went and looked at my favorite driver, Intel's igb. Not only is the igb driver already caching link speed, it is also performing timestamp correction based on that link speed.

Isn't the i210 the only NIC for which the correction is actually
implemented? Will this ever be done for all HW with timestamping
support, so that the applications wouldn't have to care about link
speed?

> I believe that timestamp correction, whether it be speed based latency, header -> trailer, or whatever else might be needed later down the line, are properly done in the driver. It’s a lot for the application to try and figure out if it should or should not be doing corrections and what correction to apply. The driver knows.

I agree, but I'm not sure how feasible that is.

-- 
Miroslav Lichvar