Re: [RFC PATCH net-next 7/9] net: dsa: microchip: ksz9477: add hardware time stamping support

Christian Eggers
2020-11-12T15:30:07Z

Hi Vladimir,

On Tuesday, 10 November 2020, 20:32:45 CET, Vladimir Oltean wrote:
> But something is still wrong if you need to special-case the negative
> correctionField, it looks like the arithmetic is not done on the correct
> number of bits, either by the driver or by the hardware.
I got it! The problem was caused because I subtracted the "full" timestamp
(reconstructed 64 bit seconds) from the correction field. When the KSZ updates
the correction field of the PDelay_Resp message on tx, only the "partial" (2
bit seconds) egress time stamp will be added. So the invalid values in the
correction field were caused because much more seconds were subtracted on rx
than added on tx.

> And zeroing out the correctionField of the Pdelay_Resp on transmission,
> to put that value into t_Tail_Tag? How can you squeeze a 48-bit value
> into a 32-bit value without truncation?
The answer is simple: Only the lower 32 bit (tail tag) must be subtracted as
only 32 bit will be added on egress.

v2 is on the way...

regards
Christian