Subject: Re: [PATCH net-next v2 1/8] net-timestamp: explicit SO_TIMESTAMPING ancillary data struct

From: Chad Reese <[email-masked]>
Date: Tue, 08 Jul 2014 00:42:46 -0700

On 07/07/2014 11:04 PM, Richard Cochran wrote:
> On Mon, Jul 07, 2014 at 02:03:38PM -0700, Chad Reese wrote:
>> On 07/07/2014 01:11 PM, Richard Cochran wrote:
>>> Don't reimplement clock servos in your driver. Instead, leave that to
>>> the PTP stack (like using linuxptp's phc2sys).
>>
>> I obviously did it wrong. The one line comment in
>> Documentation/networking/timestamping.txt was not enough for me to
>> figure out the proper usage of syststamp.
>
> Sorry about not having clearly deprecated syststamp. We'll do that now.
> Next time, putting the PTP maintainer on CC will help catch such things.
>
>> I was trying to stick with standard linux userspace APIs.
>
> There is a standard PTP hardware clock subsystem and API, as explained
> in Documentation/ptp/ptp.txt.
>
>> People
>> have no interest in the PTP clock at all. All they want is for the
>> standard system time to be correct.
>
> You can't have the time correct unless you synchronize it to
> something. That is what NTP and PTP are all about. When using a PTP
> hardware clock, it is necessary to synchronize the Linux system time
> to it. The right way to accomplish this is using a userland PTP
> stack, and the wrong way is to implement a servo in every last MAC
> driver.

You keep saying I implemented a clock servo in the MAC driver. I didn't, 
as is apparent in the code. The only kludge was a conversion from the 
PTP clock to system time with a simple offset function. I will fully 
admit it wasn't great, but it was good enough.

> What I don't understand is, how does your device get the PTP time
> without running the PTP protocol?

I wrote a PTPv2 daemon for Cavium that ran in userspace. It implemented 
all the v2 spec with support for both IP and 802.3 transport. This was 
done from scratch as there wasn't an opensource PTPv2 daemon at the 
time. All this work actually started before there was any PTP timestamp 
support in the kernel. I originally started writing PTP to run on bare 
metal.

> How can your device work without implementing a PTP clock? What am I
> missing?

I'm guessing the details of our PTP implementation are not available to 
the opensource community. It was packaged as a product by Cavium's 
marketing along with other software to support base stations.

Chad