On Mon, Feb 08, 2021 at 11:34:25AM +0000, Karthikkumar V via Linuxptp-devel wrote:
> diff --git a/clock.c b/clock.c > index a34737a..11b94f5 100644 > --- a/clock.c > +++ b/clock.c > @@ -132,6 +132,7 @@ struct clock { > struct interface *udsif; > LIST_HEAD(clock_subscribers_head, clock_subscriber) subscribers; > struct monitor *slave_event_monitor; > + UInteger8 clock_class_threshold; Rather than pasting this at the end, please group this with other, related fields. > }; > > struct clock the_clock; > @@ -1656,6 +1658,14 @@ UInteger8 clock_max_steps_removed(struct clock *c) > return c->max_steps_removed; > } > > +UInteger8 clock_get_clock_class_threshold(struct clock *c) > +{ > + if(c != NULL){ Observe coding style. > + return c->clock_class_threshold; > + } > + return CLOCK_CLASS_THRESHOLD_DEFAULT; /* Return Default Value */ Comment is redundant. > +} > + > UInteger16 clock_steps_removed(struct clock *c) > { > return c->cur.stepsRemoved; > diff --git a/config.c b/config.c > index 4095b33..41735d3 100644 > --- a/config.c > +++ b/config.c > @@ -332,6 +332,7 @@ struct config_item config_tab[] = { > GLOB_ITEM_INT("utc_offset", CURRENT_UTC_OFFSET, 0, INT_MAX), > GLOB_ITEM_INT("verbose", 0, 0, 1), > GLOB_ITEM_INT("write_phase_mode", 0, 0, 1), > + GLOB_ITEM_INT("clockClassThreshold", CLOCK_CLASS_THRESHOLD_DEFAULT, 6, > CLOCK_CLASS_THRESHOLD_DEFAULT), Preserve alphabetical order. > }; > > static struct unicast_master_table *current_uc_mtab; > diff --git a/port.c b/port.c > index f44d239..ae2a00e 100644 > --- a/port.c > +++ b/port.c > @@ -1861,6 +1861,11 @@ int process_announce(struct port *p, struct > ptp_message *m) > return result; > } > > + /* If the clock class is greater than clock_class_threshold , ignore > this master */ > + if(m->announce.grandmasterClockQuality.clockClass > > clock_get_clock_class_threshold(p->clock)){ Coding style! > + return result; > + } > + > switch (p->state) { > case PS_INITIALIZING: > case PS_FAULTY: Thanks, Richard _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel