net: ptp: calculate link delay with right timestamps

At the starting of ptp syncrhonization, there may be not Sync frame
TX/RX timestamps in first time link delay calculation.
So, need a check for that in case of wrong link delay calculated.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
This commit is contained in:
Yangbo Lu 2025-05-06 14:07:19 +08:00 committed by Benjamin Cabé
commit e9efff6e33

View file

@ -556,6 +556,10 @@ void ptp_clock_delay(uint64_t egress, uint64_t ingress)
{
int64_t delay;
if (ptp_clk.timestamp.t1 == 0 || ptp_clk.timestamp.t2 == 0) {
return;
}
ptp_clk.timestamp.t3 = egress;
ptp_clk.timestamp.t4 = ingress;