This patch addresses the following issues when ptp4l is ran on multiple ports with jbod and client only mode (i.e clientOnly=1 and boundary_clock_jbod=1):-
1.SYNCHRONIZATION FAULT occurs at every ANNOUNCE RECEIPT Timeout on LISTENING port, which leads to PTP port state of SLAVE port to flap between SLAVE and UNCALIBRATED states continuously. 2.When both ports are receiving announce messages, the port other than SLAVE port is always in LISTENING state, this results in BMCA algorithm being triggered at every ANNOUNCE RECEIPT Timeout even though there is no change in successive announce messages. 3.The port other than SLAVE (LISTENING port) prints an error "port 1: master state recommended in slave only mode ptp4l[1205469.356]: port 1: defaultDS.priority1 probably misconfigured" for every ANNOUNCE RECEIPT Timeout. 4.When the port other than the SLAVE port Stops receiving announce packets, BMCA is triggered at every ANNOUNCE RECEIPT Timeout indefinitely. Signed-off-by: Amar Subramanyam <asubraman...@altiostar.com> Signed-off-by: Karthikkumar Valoor <kval...@altiostar.com> Signed-off-by: Ramana Reddy <rre...@altiostar.com> --- clock.c | 17 +++++++++++++++++ clock.h | 7 +++++++ port.c | 16 ++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/clock.c b/clock.c index e545a9b..aedba6d 100644 --- a/clock.c +++ b/clock.c @@ -1870,6 +1870,23 @@ enum servo_state clock_synchronize(struct clock *c, tmv_t ingress, tmv_t origin) return state; } +int clock_get_client_state(struct clock *c) +{ + struct port *piter; + + if (!clock_slave_only(c)) { + return 1; + } + + LIST_FOREACH(piter, &c->ports, list) { + enum port_state ps = port_state(piter); + if (ps == PS_SLAVE || ps == PS_UNCALIBRATED) { + return 0; + } + } + return 1; +} + void clock_sync_interval(struct clock *c, int n) { int shift; diff --git a/clock.h b/clock.h index 845d54f..4779ec9 100644 --- a/clock.h +++ b/clock.h @@ -326,6 +326,13 @@ enum servo_state clock_synchronize(struct clock *c, tmv_t ingress, tmv_t origin); /** + * Inform if any of the port is in SLAVE state. + * @param c The clock instance. + * @return Return 0 if any port is in SLAVE state, 1 otherwise. + */ +int clock_get_client_state(struct clock *c); + +/** * Inform a slaved clock about the master's sync interval. * @param c The clock instance. * @param n The logarithm base two of the sync interval. diff --git a/port.c b/port.c index 10bb9e1..7d10bb8 100644 --- a/port.c +++ b/port.c @@ -390,6 +390,15 @@ static int add_foreign_master(struct port *p, struct ptp_message *m) diff = announce_compare(m, tmp); } + /* + * In multiport slave only mode, there maybe + * announce messages on LISTENING port. Re-arm + * the timer if any other configured port is in SLAVE state + */ + if (p->jbod && !clock_get_client_state(p->clock)) { + port_set_announce_tmo(p); + } + return broke_threshold || diff; } @@ -2654,6 +2663,13 @@ static enum fsm_event bc_event(struct port *p, int fd_index) port_set_announce_tmo(p); } + /* + * As one of the port is in SLAVE state stop retriggering BMCA + */ + if (p->jbod && !clock_get_client_state(p->clock)) { + port_clr_tmo(p->fda.fd[FD_ANNOUNCE_TIMER]); + } + delay_req_prune(p); if (clock_slave_only(p->clock) && p->delayMechanism != DM_P2P && port_renew_transport(p)) { -- 1.8.3.1 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel