Re: [PATCH net-next v3 00/12] net: dsa: microchip: PTP support for KSZ956x

From: Richard Cochran
Date: Sat Nov 21 2020 - 20:37:18 EST


On Sat, Nov 21, 2020 at 03:26:11AM +0200, Vladimir Oltean wrote:
> On Thu, Nov 19, 2020 at 06:51:15PM +0000, Tristram.Ha@xxxxxxxxxxxxx wrote:
> > The receive and transmit latencies are different for different connected speed. So the
> > driver needs to change them when the link changes. For that reason the PTP stack
> > should not use its own latency values as generally the application does not care about
> > the linked speed.
>
> The thing is, ptp4l already has ingressLatency and egressLatency
> settings, and I would not be surprised if those config options would get
> extended to cover values at multiple link speeds.
>
> In the general case, the ksz9477 MAC could be attached to any external
> PHY, having its own propagation delay characteristics, or any number of
> other things that cause clock domain crossings. I'm not sure how feasible
> it is for the kernel to abstract this away completely, and adjust
> timestamps automatically based on any and all combinations of MAC and
> PHY. Maybe this is just wishful thinking.

The idea that the driver will correctly adjust time stamps according
to link speed sounds nice in theory, but in practice it fails. There
is a at least one other driver that attempted this, but, surprise,
surprise, the hard coded correction values turned out to be wrong.

I think the best way would be to let user space monitor the link speed
and apply the matching correction value. That way, we avoid bogus,
hard coded values in kernel space. (This isn't implemented in
linuxptp, but it certainly could be.)

Thanks,
Richard