dcavalca / rpms / linuxptp

Forked from rpms/linuxptp 2 years ago
Clone

Blame SOURCES/linuxptp-logmsgs.patch

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