Hi Richard, Thanks for the modification. With this change, we tested in our setup and we could find that it works as intended. Please go ahead and merge this change.
Thanks, Karthik > -----Original Message----- > From: Richard Cochran <richardcoch...@gmail.com> > Sent: 27 September 2021 22:57 > To: Karthikkumar Valoor <kval...@altiostar.com> > Cc: linuxptp-devel@lists.sourceforge.net > Subject: Re: [Linuxptp-devel] [PATCH] Delay Response Timeout Feature addition > for PTP4L > > CAUTION: This email originated from outside of Altiostar. Do not click on > links > or open attachments unless you recognize the sender and you are sure the > content is safe. You will never be asked to reset your Altiostar password via > email. > > > On Tue, Aug 24, 2021 at 05:12:11AM +0000, Karthikkumar V via Linuxptp-devel > wrote: > > > @@ -1997,6 +1998,9 @@ void process_delay_resp(struct port *p, struct > ptp_message *m) > > return; > > } > > > > + /* Valid Delay Response received, reset the counter */ > > + p->delay_response_counter = 0; > > + > > c3 = correction_to_tmv(m->header.correction); > > t3 = req->hwts.ts; > > t4 = timestamp_to_tmv(m->ts.pdu); @@ -2680,7 +2684,24 @@ static > > enum fsm_event bc_event(struct port *p, int fd_index) > > pr_debug("%s: delay timeout", p->log_name); > > port_set_delay_tmo(p); > > delay_req_prune(p); > > - return port_delay_request(p) ? EV_FAULT_DETECTED : EV_NONE; > > + if (port_delay_request(p)) { > > + return EV_FAULT_DETECTED; > > + } > > + /* Successfully send Delay Request, > > + * increment delay response counter > > + */ > > How about this instead? > > if (p->delay_response_timeout && p->state == PS_SLAVE) { > p->delay_response_counter++; > if (p->delay_response_counter >= > p->delay_response_timeout) { > p->delay_response_counter = 0; > tsproc_reset(clock_get_tsproc(p->clock), 1); > pr_err("%s: delay response timeout", > p->log_name); > return EV_SYNCHRONIZATION_FAULT; > } > } > return EV_NONE; > > I fixed that up and also corrected the man page text. Please check the patch, > below, and if you like it then I'll merge it like that. > > Thanks, > Richard > > > From 547aa74794c1bdc656b6416ff66ff8a0fb234e39 Mon Sep 17 00:00:00 2001 > From: Karthikkumar V via Linuxptp-devel <linuxptp-devel@lists.sourceforge.net> > Date: Tue, 24 Aug 2021 05:12:11 +0000 > Subject: [PATCH] Delay Response Timeout Feature addition for PTP4L > > This code changes brings in the ability to program delay response timeout > within > which, if the upstream master does not send a valid delay response within the > configurable delay response timeout duration, device will move out of lock > state.Default delay_response_timeout is 0 (disabled). > > Signed-off-by: Karthikkumar V <kval...@altiostar.com> > Signed-off-by: Ramana Reddy <rre...@altiostar.com> > Reviewed-by: Miroslav Lichvar <mlich...@redhat.com> > Signed-off-by: Richard Cochran <richardcoch...@gmail.com> > --- > clock.c | 5 +++++ > clock.h | 7 +++++++ > config.c | 1 + > configs/default.cfg | 1 + > port.c | 18 +++++++++++++++++- > port_private.h | 2 ++ > ptp4l.8 | 6 ++++++ > 7 files changed, 39 insertions(+), 1 deletion(-) > > diff --git a/clock.c b/clock.c > index ec70f91..7333313 100644 > --- a/clock.c > +++ b/clock.c > @@ -1730,6 +1730,11 @@ UInteger16 clock_steps_removed(struct clock *c) > return c->cur.stepsRemoved; > } > > +struct tsproc *clock_get_tsproc(struct clock *c) { > + return c->tsproc; > +} > + > int clock_switch_phc(struct clock *c, int phc_index) { > struct servo *servo; > diff --git a/clock.h b/clock.h > index 845d54f..e2a3e36 100644 > --- a/clock.h > +++ b/clock.h > @@ -303,6 +303,13 @@ UInteger8 clock_get_clock_class_threshold(struct > clock *c); > */ > UInteger16 clock_steps_removed(struct clock *c); > > +/** > + * Obtain the Time Stamp Processor instance from a clock. > + * @param c The clock instance. > + * @return The Time Stamp Processor associated with the clock. > + */ > +struct tsproc *clock_get_tsproc(struct clock *c); > + > /** > * Switch to a new PTP Hardware Clock, for use with the "jbod" mode. > * @param c The clock instance. > diff --git a/config.c b/config.c > index eb8b988..f3c52ba 100644 > --- a/config.c > +++ b/config.c > @@ -239,6 +239,7 @@ struct config_item config_tab[] = { > PORT_ITEM_ENU("delay_filter", FILTER_MOVING_MEDIAN, > delay_filter_enu), > PORT_ITEM_INT("delay_filter_length", 10, 1, INT_MAX), > PORT_ITEM_ENU("delay_mechanism", DM_E2E, delay_mech_enu), > + PORT_ITEM_INT("delay_response_timeout", 0, 0, UINT8_MAX), > GLOB_ITEM_INT("dscp_event", 0, 0, 63), > GLOB_ITEM_INT("dscp_general", 0, 0, 63), > GLOB_ITEM_INT("domainNumber", 0, 0, 127), diff --git > a/configs/default.cfg b/configs/default.cfg index d615610..cd383b5 100644 > --- a/configs/default.cfg > +++ b/configs/default.cfg > @@ -30,6 +30,7 @@ logMinPdelayReqInterval 0 > operLogPdelayReqInterval 0 > announceReceiptTimeout 3 > syncReceiptTimeout 0 > +delay_response_timeout 0 > delayAsymmetry 0 > fault_reset_interval 4 > neighborPropDelayThresh 20000000 > diff --git a/port.c b/port.c > index c82bdaf..d5119b7 100644 > --- a/port.c > +++ b/port.c > @@ -1732,6 +1732,7 @@ int port_initialize(struct port *p) > p->operLogPdelayReqInterval = config_get_int(cfg, p->name, > "operLogPdelayReqInterval"); > p->neighborPropDelayThresh = config_get_int(cfg, p->name, > "neighborPropDelayThresh"); > p->min_neighbor_prop_delay = config_get_int(cfg, p->name, > "min_neighbor_prop_delay"); > + p->delay_response_timeout = config_get_int(cfg, p->name, > + "delay_response_timeout"); > > if (config_get_int(cfg, p->name, "asCapable") == AS_CAPABLE_TRUE) { > p->asCapable = ALWAYS_CAPABLE; @@ -1997,6 +1998,9 @@ void > process_delay_resp(struct port *p, struct ptp_message *m) > return; > } > > + /* Valid Delay Response received, reset the counter */ > + p->delay_response_counter = 0; > + > c3 = correction_to_tmv(m->header.correction); > t3 = req->hwts.ts; > t4 = timestamp_to_tmv(m->ts.pdu); @@ -2680,7 +2684,19 @@ static enum > fsm_event bc_event(struct port *p, int fd_index) > pr_debug("%s: delay timeout", p->log_name); > port_set_delay_tmo(p); > delay_req_prune(p); > - return port_delay_request(p) ? EV_FAULT_DETECTED : EV_NONE; > + if (port_delay_request(p)) { > + return EV_FAULT_DETECTED; > + } > + if (p->delay_response_timeout && p->state == PS_SLAVE) { > + p->delay_response_counter++; > + if (p->delay_response_counter >= > p->delay_response_timeout) { > + p->delay_response_counter = 0; > + tsproc_reset(clock_get_tsproc(p->clock), 1); > + pr_err("%s: delay response timeout", > p->log_name); > + return EV_SYNCHRONIZATION_FAULT; > + } > + } > + return EV_NONE; > > case FD_QUALIFICATION_TIMER: > pr_debug("%s: qualification timeout", p->log_name); diff --git > a/port_private.h b/port_private.h index 2a98ef4..5391879 100644 > --- a/port_private.h > +++ b/port_private.h > @@ -143,6 +143,8 @@ struct port { > struct fault_interval flt_interval_pertype[FT_CNT]; > enum fault_type last_fault_type; > UInteger8 versionNumber; /* UInteger4 */ > + UInteger8 delay_response_counter; > + UInteger8 delay_response_timeout; > struct PortStats stats; > /* foreignMasterDS */ > LIST_HEAD(fm, foreign_clock) foreign_masters; diff --git a/ptp4l.8 > b/ptp4l.8 > index a0779ef..8c2969f 100644 > --- a/ptp4l.8 > +++ b/ptp4l.8 > @@ -204,6 +204,12 @@ running in gPTP mode according to the 802.1AS-2011 > standard. Setting this option to zero will disable the sync message timeout. > The default is 0 or disabled. > .TP > +.B delay_response_timeout > +The number of delay response messages that may go missing before > +triggering a synchronization fault. Setting this option to zero will > +disable the delay response timeout. > +The default is 0 or disabled. > +.TP > .B transportSpecific > The transport specific field. Must be in the range 0 to 255. > The default is 0. > -- > 2.20.1 > _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel