Without the proposed patch the result of pmc "get time_status" when lost
synchronization with external GM shows:
pmc -u -b 0 'get time_status' :
c86314.fffe.30006e-0 seq 0 RESPONSE MANAGEMENT TIME_STATUS_NP
master_offset 192
ingress_time 0
cumulativeScaledRateOffset +0.000000000
scaledLastGmPhaseChange 0
gmTimeBaseIndicator 0
lastGmPhaseChange 0x0000'0000000000000000.0000
gmPresent true
gmIdentity ec4670.fffe.00ee5f
while result of the "get port_data_set" is:
c86314.fffe.30006e-1 seq 0 RESPONSE MANAGEMENT PORT_DATA_SET
portIdentity c86314.fffe.30006e-1
portState LISTENING
logMinDelayReqInterval 1
peerMeanPathDelay 0
logAnnounceInterval 1
announceReceiptTimeout 3
logSyncInterval 0
delayMechanism 1
logMinPdelayReqInterval 0
versionNumber 2
After applying the patch the gmIdentity and gmPresent are the same as when
issued right after ptp4l startup (before any synchronization with external GM) :
c86314.fffe.30006e-0 seq 0 RESPONSE MANAGEMENT TIME_STATUS_NP
master_offset 126
ingress_time 0
cumulativeScaledRateOffset +0.000000000
scaledLastGmPhaseChange 0
gmTimeBaseIndicator 0
lastGmPhaseChange 0x0000'0000000000000000.0000
gmPresent false
gmIdentity c86314.fffe.30006e
Actually it may also be relevant to reset master_offset on lost sync. Combined
patch below:
--- a/clock.c 2021-11-08 10:41:45.027820026 +0100
+++ b/clock.c 2021-11-08 10:42:50.656801920 +0100
@@ -1994,6 +1994,7 @@
if (!tmv_is_zero(c->initial_delay))
tsproc_set_delay(c->tsproc, c->initial_delay);
c->ingress_ts = tmv_zero();
+ c->master_offset = tmv_zero();
c->path_delay = c->initial_delay;
c->master_local_rr = 1.0;
c->nrr = 1.0;
@@ -2001,6 +2002,7 @@
if (cid_eq(&best_id, &c->dds.clockIdentity)) {
pr_notice("selected local clock %s as best master",
cid2str(&best_id));
+ c->dad.pds.grandmasterIdentity = c->dds.clockIdentity;
} else {
pr_notice("selected best master clock %s",
cid2str(&best_id));
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel