In case of broken network there is a possibility of having management
packets with proper data but absolute absence of sync packets. In such
case the selected best master will stuck in HAVE_SYDY state without
actually synchronising and will never fail because sync rx timeout timer
is armed just after first receive of both SYNC and FOLLOW-UP packets.

The patch arms sync rx timeout timer once sync grant is received.

Signed-off-by: Vadim Fedorenko <vad...@meta.com>
---
 port.c           | 2 +-
 port_private.h   | 1 +
 unicast_client.c | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/port.c b/port.c
index 36b73f5..b6448ae 100644
--- a/port.c
+++ b/port.c
@@ -1233,7 +1233,7 @@ int port_set_qualification_tmo(struct port *p)
                       1+clock_steps_removed(p->clock), p->logAnnounceInterval);
 }
 
-static int port_set_sync_rx_tmo(struct port *p)
+int port_set_sync_rx_tmo(struct port *p)
 {
        return set_tmo_log(p->fda.fd[FD_SYNC_RX_TIMER],
                           p->syncReceiptTimeout, p->logSyncInterval);
diff --git a/port_private.h b/port_private.h
index d27dceb..24d0045 100644
--- a/port_private.h
+++ b/port_private.h
@@ -182,6 +182,7 @@ int port_is_enabled(struct port *p);
 void port_link_status(void *ctx, int index, int linkup);
 int port_set_announce_tmo(struct port *p);
 int port_set_delay_tmo(struct port *p);
+int port_set_sync_rx_tmo(struct port *p);
 int port_set_qualification_tmo(struct port *p);
 void port_show_transition(struct port *p, enum port_state next,
                          enum fsm_event event);
diff --git a/unicast_client.c b/unicast_client.c
index 81113ae..3484003 100644
--- a/unicast_client.c
+++ b/unicast_client.c
@@ -502,6 +502,7 @@ void unicast_client_grant(struct port *p, struct 
ptp_message *m,
                        }
                        unicast_client_set_renewal(p, ucma, g->durationField);
                        clock_sync_interval(p->clock, g->logInterMessagePeriod);
+                       port_set_sync_rx_tmo(p);
                        break;
                }
                break;
-- 
2.30.2



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to