commit 2ef188d3f196f2713c5f664f26e18e574992f04f Author: Vadim Fedorenko Date: Fri Jan 13 12:38:44 2023 -0800 port: start sync rx timer on grant 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 diff --git a/port.c b/port.c index 02b49a1..558a422 100644 --- a/port.c +++ b/port.c @@ -1235,7 +1235,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 633a4fe..5b46d1c 100644 --- a/unicast_client.c +++ b/unicast_client.c @@ -512,6 +512,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;