Hi,
I have a boundary clock with ports eth0 and pru10:
ptp4l config (most important params shown):
[eth0]
boundary_clock_jbod 1
[pru10]
boundary_clock_jbod 1
GMC is connected to pru10, nothing connected to eth0. I start ptp4l and phc2sys:
ptp4l -f <cfg>
phc2sys -arm
Everything goes well:
phc2sys[1530231.490]: reconfiguring after port state change
phc2sys[1530231.491]: pru10: UNCALIBRATED -> new state SLAVE
phc2sys[1530231.491]: selecting eth0 (MASTER) for synchronization
phc2sys[1530231.492]: dst_cnt: 1
CLOCK_REALTIMEis finally added to list of dst clocks (line 477 of phc2sys.c)
phc2sys[1530231.493]: selecting CLOCK_REALTIME for synchronization:
phc2sys[1530231.494]: selecting pru10 (SLAVE) as the master clock
ptp4l[1530234.487]: master offset 20 s2 freq -9940 path delay
9
phc2sys is syncing CLOCK_REALTIME and eth0 as expected
phc2sys[1530235.310]: CLOCK_REALTIME phc offset -2833 s0 freq -9911 delay
3091
phc2sys[1530236.360]: eth0 phc offset -100 s0 freq -9882
--------
Now I disconnect GMC. I would expect that the last sync source is taken and
this last sync source syncs also the CLOCK_REALTIME.
phc2sys[1530250.221]: reconfiguring after port state change
phc2sys[1530250.221]: pru10: SLAVE -> new state MASTER
phc2sys[1530250.221]: selecting pru10 (MASTER) for synchronization
phc2sys[1530250.221]: selecting eth0 (MASTER) for synchronization
phc2sys[1530250.222]: dst_cnt: 2
phc2sys[1530250.222]: no source, selecting pru10 (SLAVE aka MASTER) as the
default clock
ok. So far. But the CLOCK_REALTIME is not added to list of dst clocks! As a
consequence, CLOCK_REALTIME is not synced anymore.
phc2sys[1530254.251]: eth0 phc offset -89483 s0 freq -9955
phc2sys[1530256.350]: eth0 phc offset -39106 s0 freq +34863
Is this the intended behaviour?
I see the problem here:
static void reconfigure(struct node *node)
{
....
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);
Here we return if last sync source is taken, but CLOCK_REALTIME is not added to
node->dst_clocks!...
return;
}
}
if (src_cnt > 1) {
pr_info("multiple master clocks available,
postponing sync...");
node->master = NULL;
return;
}
if (src_cnt > 0 && !src) {
pr_info("master clock not ready, waiting...");
node->master = NULL;
return;
}
if (!src_cnt && !dst_cnt) {
pr_info("no PHC ready, waiting...");
node->master = NULL;
return;
}
if ((!src_cnt && (!rt || rt->dest_only)) ||
(!dst_cnt && !rt)) {
pr_info("nothing to synchronize");
node->master = NULL;
return;
}
if (!src_cnt) {
src = rt;
rt->state = PS_SLAVE;
} else if (rt) {
if (rt->state != PS_MASTER) {
rt->state = PS_MASTER;
clock_reinit(node, rt,
rt->state);
}
.. here we add the CLOCK_REALTIME in the normal sync case:
LIST_INSERT_HEAD(&node->dst_clocks, rt,
dst_list);
pr_info("selecting %s for synchronization",
rt->device);
}
node->master = src;
pr_info("selecting %s as the master clock", src->device);
}
Best regards, Chris
_______________________________________________
Linuxptp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-users