When running a "jbod" Boundary Clock, as long as we have one slaved port, we always want the clocks on the other ports to be synchronized, regardless of their port state.
Signed-off-by: Richard Cochran <richardcoch...@gmail.com> --- phc2sys.c | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/phc2sys.c b/phc2sys.c index 47ee3b8..cf47990 100644 --- a/phc2sys.c +++ b/phc2sys.c @@ -310,14 +310,23 @@ static void reconfigure(struct node *node) c->state = c->new_state; - if (c->state == PS_SLAVE) { - src = c; - src_cnt++; - } else if (c->state == PS_UNCALIBRATED) { - src_cnt++; - } else if (c->state == PS_MASTER) { + switch (c->state) { + case PS_FAULTY: + case PS_DISABLED: + case PS_LISTENING: + case PS_PRE_MASTER: + case PS_MASTER: + case PS_PASSIVE: pr_info("selecting %s for synchronization", c->device); dst_cnt++; + break; + case PS_UNCALIBRATED: + src_cnt++; + break; + case PS_SLAVE: + src = c; + src_cnt++; + break; } } if (src_cnt > 1) { @@ -559,6 +568,23 @@ static int do_pps_loop(struct node *node, struct clock *clock, int fd) return 0; } +static int update_needed(struct clock *c) +{ + switch (c->state) { + case PS_FAULTY: + case PS_DISABLED: + case PS_LISTENING: + case PS_PRE_MASTER: + case PS_MASTER: + case PS_PASSIVE: + return 1; + case PS_UNCALIBRATED: + case PS_SLAVE: + break; + } + return 0; +} + static int do_loop(struct node *node, int subscriptions) { struct timespec interval; @@ -590,7 +616,7 @@ static int do_loop(struct node *node, int subscriptions) continue; LIST_FOREACH(clock, &node->clocks, list) { - if (clock->state != PS_MASTER) + if (!update_needed(clock)) continue; if (clock->clkid == CLOCK_REALTIME && -- 1.7.10.4 ------------------------------------------------------------------------------ _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel