Re: [PATCH 2/2] net: fec: Reload PTP registers after link-state change

From: Csókás Bence
Date: Tue Sep 17 2024 - 03:53:21 EST


Hi!

On 9/16/24 17:05, Frank Li wrote:
On Mon, Sep 16, 2024 at 04:19:31PM +0200, Csókás, Bence wrote:
On link-state change, the controller gets reset,
which clears all PTP registers, including PHC time,
calibrated clock correction values etc. For correct
IEEE 1588 operation we need to restore these after
the reset.

I am not sure if it necessary. timer will be big offset after reset. ptpd
should set_time then do clock frequency adjust, supposed just few ms, ptp
time will get resync.

of course, restore these value may reduce the resync time.

Frank

There's 3 problems with that:
1. ATCORR, ATINC and ATPER will not be restored, therefore precision will be immediately lost.
2. ptpd does NOT set the time, only once, on startup. Currently, on link-down, ptpd tries to correct for the missing 54 years by making the PHC tick 3% faster (therefore the PPS signal will have a frequency error as well), which will never get it there. One work-around is to periodically re-start ptpd, but this is obviously sub-optimal.
3. If the PTP server goes away, there's no way to restore the time. Whereas if you save and reload it, you can continue, although with degraded precision.

Bence