From f8078f00f7eac64596ecd4dbb411c1c76be8817e Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Tue, 5 May 2020 16:22:17 -0700 Subject: [PATCH] Let the free running port state reflect the synchronization uncertain flag. When using the "free running" option, a slaved port remains in the UNCALIBRATED state. If the actual servo resides in and external program, for example when following the 802.1AS recommendations, that program can signal the synchronization state using the "synchronization uncertain" management message. This patch lets the port state transitions from UNCALIBRATED to SLAVE based on that message. Signed-off-by: Richard Cochran --- clock.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/clock.c b/clock.c index 11082fe..a559cd4 100644 --- a/clock.c +++ b/clock.c @@ -589,10 +589,16 @@ static void clock_stats_display(struct clock_stats *s) static enum servo_state clock_no_adjust(struct clock *c, tmv_t ingress, tmv_t origin) { - double fui; - double ratio, freq; struct freq_estimator *f = &c->fest; - enum servo_state state = SERVO_UNLOCKED; + double freq, fui, ratio; + enum servo_state state; + + if (c->local_sync_uncertain == SYNC_UNCERTAIN_FALSE) { + state = SERVO_LOCKED; + } else { + state = SERVO_UNLOCKED; + } + /* * The ratio of the local clock freqency to the master clock * is estimated by: