phc2sys: don't synchronize clock to itself in automatic mode.

When no source is found in the automatic mode and a clock is selected as
the default source, set its state temporarily to slave to prevent the
clock from being synchronized to itself and drifting quickly away.

Also, don't use this mode with only one PTP clock and don't include the
system clock.

This fixes phc2sys with SHM servo (e.g. used by timemaster).
master
Miroslav Lichvar 2015-02-10 16:54:43 +01:00 committed by Richard Cochran
parent e9ac26f909
commit 09e5e6e934
1 changed files with 6 additions and 1 deletions

View File

@ -332,9 +332,14 @@ static void reconfigure(struct node *node)
}
last = c;
}
if (dst_cnt && !src) {
if (dst_cnt > 1 && !src) {
if (!rt || rt->dest_only) {
node->master = last;
/* Reset to original state in next reconfiguration. */
node->master->new_state = node->master->state;
node->master->state = PS_SLAVE;
if (rt)
rt->state = PS_SLAVE;
pr_info("no source, selecting %s as the default clock",
last->device);
return;