don't switch from system clock to PHC with SW timestamping (#2179041)

Resolves: #2179041
This commit is contained in:
Miroslav Lichvar 2023-03-20 11:47:20 +01:00
parent 847cc1d4eb
commit f180642b5e
1 changed files with 29 additions and 0 deletions

View File

@ -420,3 +420,32 @@ index ae9c4d3..96e097a 100644
/*
* A port going down can affect the BMCA result.
commit 8cf63218e4cc33d63bb783bf322d4a0d2f4be73e
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed Mar 15 11:24:16 2023 +0100
port: Don't switch to PHC with SW timestamping.
When ptp4l was configured to use SW timestamping, but the interface
supported also HW timestamping, ptp4l detected a change of the PHC on
start, switched to it from the system clock, and tried to control the
PHC using SW timestamps.
Don't switch the PHC if the current PHC index is -1, which is expected
with SW timestamping and in the free-running mode.
Fixes: afeabf3c90ed ("ptp4l: add VLAN over bond support")
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
diff --git a/port.c b/port.c
index 96e097a..32ee83b 100644
--- a/port.c
+++ b/port.c
@@ -2570,6 +2570,7 @@ static void port_change_phc(struct port *p)
/* Try to switch only if the interface is up, it has HW time stamping
using a non-vclock PHC, and the PHC actually changed. */
if (!(p->link_status & LINK_UP) ||
+ p->phc_index < 0 ||
!interface_tsinfo_valid(p->iface) ||
interface_get_vclock(p->iface) >= 0 ||
interface_phc_index(p->iface) < 0 ||