From f180642b5e63f094ea36d9213305ef551cd1822c Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 20 Mar 2023 11:47:20 +0100 Subject: [PATCH] don't switch from system clock to PHC with SW timestamping (#2179041) Resolves: #2179041 --- linuxptp-vlanbond.patch | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/linuxptp-vlanbond.patch b/linuxptp-vlanbond.patch index 7ab0a9a..590e1e6 100644 --- a/linuxptp-vlanbond.patch +++ b/linuxptp-vlanbond.patch @@ -420,3 +420,32 @@ index ae9c4d3..96e097a 100644 /* * A port going down can affect the BMCA result. +commit 8cf63218e4cc33d63bb783bf322d4a0d2f4be73e +Author: Miroslav Lichvar +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 + +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 ||