dcavalca / rpms / linuxptp

Forked from rpms/linuxptp 2 years ago
Clone
Miroslav Lichvar a83fd1
commit 3399fa15ae28610c1b288b573c4233a42c48f762
Miroslav Lichvar a83fd1
Author: Amar Subramanyam via Linuxptp-devel <linuxptp-devel@lists.sourceforge.net>
Miroslav Lichvar a83fd1
Date:   Wed May 26 12:24:06 2021 +0300
Miroslav Lichvar a83fd1
Miroslav Lichvar a83fd1
    Log optimization for ptp4l in jbod and client only mode (clientOnly=1 and boundary_clock_jbod=1)
Miroslav Lichvar a83fd1
    
Miroslav Lichvar a83fd1
    The LISTENING port prints continuously
Miroslav Lichvar a83fd1
    "selected best master clock 000000.0000.000003
Miroslav Lichvar a83fd1
    updating UTC offset to 37"
Miroslav Lichvar a83fd1
    
Miroslav Lichvar a83fd1
    We limited the log such that now it prints only when there is a
Miroslav Lichvar a83fd1
    change in the best-master clock.
Miroslav Lichvar a83fd1
    
Miroslav Lichvar a83fd1
    Signed-off-by: Amar Subramanyam <asubramanyam@altiostar.com>
Miroslav Lichvar a83fd1
    Signed-off-by: Karthikkumar Valoor <kvaloor@altiostar.com>
Miroslav Lichvar a83fd1
    Signed-off-by: Ramana Reddy <rreddy@altiostar.com>
Miroslav Lichvar a83fd1
Miroslav Lichvar a83fd1
diff --git a/clock.c b/clock.c
Miroslav Lichvar a83fd1
index e545a9b..d428ae2 100644
Miroslav Lichvar a83fd1
--- a/clock.c
Miroslav Lichvar a83fd1
+++ b/clock.c
Miroslav Lichvar a83fd1
@@ -705,7 +705,8 @@ static void clock_update_slave(struct clock *c)
Miroslav Lichvar a83fd1
 	if (c->tds.currentUtcOffset < c->utc_offset) {
Miroslav Lichvar a83fd1
 		pr_warning("running in a temporal vortex");
Miroslav Lichvar a83fd1
 	}
Miroslav Lichvar a83fd1
-	if ((c->tds.flags & UTC_OFF_VALID && c->tds.flags & TIME_TRACEABLE) ||
Miroslav Lichvar a83fd1
+	if (((c->tds.flags & UTC_OFF_VALID && c->tds.flags & TIME_TRACEABLE) &&
Miroslav Lichvar a83fd1
+	    (c->tds.currentUtcOffset != c->utc_offset)) ||
Miroslav Lichvar a83fd1
 	    (c->tds.currentUtcOffset > c->utc_offset)) {
Miroslav Lichvar a83fd1
 		pr_info("updating UTC offset to %d", c->tds.currentUtcOffset);
Miroslav Lichvar a83fd1
 		c->utc_offset = c->tds.currentUtcOffset;
Miroslav Lichvar a83fd1
@@ -1939,14 +1940,6 @@ static void handle_state_decision_event(struct clock *c)
Miroslav Lichvar a83fd1
 		best_id = c->dds.clockIdentity;
Miroslav Lichvar a83fd1
 	}
Miroslav Lichvar a83fd1
 
Miroslav Lichvar a83fd1
-	if (cid_eq(&best_id, &c->dds.clockIdentity)) {
Miroslav Lichvar a83fd1
-		pr_notice("selected local clock %s as best master",
Miroslav Lichvar a83fd1
-			  cid2str(&best_id));
Miroslav Lichvar a83fd1
-	} else {
Miroslav Lichvar a83fd1
-		pr_notice("selected best master clock %s",
Miroslav Lichvar a83fd1
-			  cid2str(&best_id));
Miroslav Lichvar a83fd1
-	}
Miroslav Lichvar a83fd1
-
Miroslav Lichvar a83fd1
 	if (!cid_eq(&best_id, &c->best_id)) {
Miroslav Lichvar a83fd1
 		clock_freq_est_reset(c);
Miroslav Lichvar a83fd1
 		tsproc_reset(c->tsproc, 1);
Miroslav Lichvar a83fd1
@@ -1957,6 +1950,13 @@ static void handle_state_decision_event(struct clock *c)
Miroslav Lichvar a83fd1
 		c->master_local_rr = 1.0;
Miroslav Lichvar a83fd1
 		c->nrr = 1.0;
Miroslav Lichvar a83fd1
 		fresh_best = 1;
Miroslav Lichvar a83fd1
+		if (cid_eq(&best_id, &c->dds.clockIdentity)) {
Miroslav Lichvar a83fd1
+			pr_notice("selected local clock %s as best master",
Miroslav Lichvar a83fd1
+					cid2str(&best_id));
Miroslav Lichvar a83fd1
+		} else {
Miroslav Lichvar a83fd1
+			pr_notice("selected best master clock %s",
Miroslav Lichvar a83fd1
+					cid2str(&best_id));
Miroslav Lichvar a83fd1
+		}
Miroslav Lichvar a83fd1
 	}
Miroslav Lichvar a83fd1
 
Miroslav Lichvar a83fd1
 	c->best = best;
Miroslav Lichvar a83fd1
Miroslav Lichvar a83fd1
commit 766baf345cd4fb025d186f9c9bea5276aba398bc
Miroslav Lichvar a83fd1
Author: Amar Subramanyam via Linuxptp-devel <linuxptp-devel@lists.sourceforge.net>
Miroslav Lichvar a83fd1
Date:   Wed May 26 12:24:07 2021 +0300
Miroslav Lichvar a83fd1
Miroslav Lichvar a83fd1
    Log optimization for ptp4l in jbod and client only mode (clientOnly=1 and boundary_clock_jbod=1)
Miroslav Lichvar a83fd1
    
Miroslav Lichvar a83fd1
    The port other than SLAVE (LISTENING port) prints an error
Miroslav Lichvar a83fd1
    "port 1: master state recommended in slave only mode
Miroslav Lichvar a83fd1
    ptp4l[1205469.356]: port 1: defaultDS.priority1 probably misconfigured"
Miroslav Lichvar a83fd1
    for every ANNOUNCE RECEIPT Timeout.
Miroslav Lichvar a83fd1
    
Miroslav Lichvar a83fd1
    This log is printed when the event EV_RS_MASTER is thrown
Miroslav Lichvar a83fd1
    in clientOnly mode. But single port clientOnly mode will never
Miroslav Lichvar a83fd1
    hit this event instead EV_RS_GRAND_MASTER will be hit.
Miroslav Lichvar a83fd1
    EV_RS_MASTER is thrown when clientOnly=1 and boundary_clock_jbod=1
Miroslav Lichvar a83fd1
    which results in continuous printing. So EV_RS_MASTER check when
Miroslav Lichvar a83fd1
    clientOnly=1 to print this error can be avoided.
Miroslav Lichvar a83fd1
    
Miroslav Lichvar a83fd1
    Signed-off-by: Amar Subramanyam <asubramanyam@altiostar.com>
Miroslav Lichvar a83fd1
    Signed-off-by: Karthikkumar Valoor <kvaloor@altiostar.com>
Miroslav Lichvar a83fd1
    Signed-off-by: Ramana Reddy <rreddy@altiostar.com>
Miroslav Lichvar a83fd1
Miroslav Lichvar a83fd1
diff --git a/port.c b/port.c
Miroslav Lichvar a83fd1
index 250d46d..b5b775f 100644
Miroslav Lichvar a83fd1
--- a/port.c
Miroslav Lichvar a83fd1
+++ b/port.c
Miroslav Lichvar a83fd1
@@ -2536,7 +2536,7 @@ void port_dispatch(struct port *p, enum fsm_event event, int mdiff)
Miroslav Lichvar a83fd1
 static void bc_dispatch(struct port *p, enum fsm_event event, int mdiff)
Miroslav Lichvar a83fd1
 {
Miroslav Lichvar a83fd1
 	if (clock_slave_only(p->clock)) {
Miroslav Lichvar a83fd1
-		if (event == EV_RS_MASTER || event == EV_RS_GRAND_MASTER) {
Miroslav Lichvar a83fd1
+		if (event == EV_RS_GRAND_MASTER) {
Miroslav Lichvar a83fd1
 			port_slave_priority_warning(p);
Miroslav Lichvar a83fd1
 		}
Miroslav Lichvar a83fd1
 	}