Subject: Re: [PATCH net 2/2] net: dsa: Deny PTP on master if switch supports it

From: Richard Cochran <[email-masked]>
Date: Fri, 27 Dec 2019 09:51:26 -0800

On Fri, Dec 27, 2019 at 02:44:35AM +0200, Vladimir Oltean wrote:
> Why? Well, in short, the PTP API in place today is a bit rudimentary and
> relies on applications to retrieve the TX timestamps by polling the
> error queue and looking at the cmsg structure. But there is no timestamp
> identification of any sorts (except whether it's HW or SW), you don't
> know how many more timestamps are there to come, which one is this one,
> from whom it is, etc.

IOW, you can only get one HW time stamp from the stack.  This is a
fundamental limitation of the so_timestamping API.  If user space
really wanted multiple HW and SW time stamps, then some new way would
have to be invented, but it would be lots of work.

IMHO, as a practical matter, multiple time stamps would be interesting
from a profiling point of view, but less so for synchronization
applications.

> So it is a fact of life that PTP timestamping on the DSA master is
> incompatible with timestamping on the switch MAC. And if the switch
> supports PTP, taking the timestamps from the switch MAC is highly
> preferable anyway, due to the fact that those don't contain the queuing
> latencies of the switch. So just disallow PTP on the DSA master if there
> is any PTP-capable switch attached.

I agreed that MAC time stamps are not very useful when there is a PTP
switch in front.

Acked-by: Richard Cochran <[email-masked]>