On Wed, Feb 24, 2021 at 10:27:05AM +0000, Karthikkumar V wrote:

> diff --git a/clock.c b/clock.c
> index c1fcff6..6dd4661 100644
> --- a/clock.c
> +++ b/clock.c
> @@ -136,6 +136,7 @@ struct clock {
>       struct monitor *slave_event_monitor;
>       int step_window_counter;
>       int step_window;
> +  UInteger8 clock_class_threshold;

Please:
- indent with TAB
- put this field just before max_steps_removed in the struct.

>  };
>  
>  struct clock the_clock;
> @@ -978,6 +979,7 @@ struct clock *clock_create(enum clock_type type, struct 
> config *config,
>       c->default_dataset.localPriority =
>               config_get_int(config, NULL, "G.8275.defaultDS.localPriority");
>       c->max_steps_removed = config_get_int(config, NULL,"maxStepsRemoved");
> +  c->clock_class_threshold = config_get_int(config, NULL, 
> "clock_class_threshold");

Indent with TAB not 2 spaces.

>  
>       /* Harmonize the twoStepFlag with the time_stamping option. */
>       if (config_harmonize_onestep(config)) {
> @@ -1711,6 +1713,15 @@ 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) {

Drop useless test.  The caller ensures that 'c' can never be NULL.
The body of function should be one line:

        return c->clock_class_threshold;

Indent with TABS.

> +               return c->clock_class_threshold;
> +       }
> +       return CLOCK_CLASS_THRESHOLD_DEFAULT; /* Return Default Value  */
> +}
> +
> +
>  UInteger16 clock_steps_removed(struct clock *c)
>  {
>       return c->cur.stepsRemoved;
> diff --git a/clock.h b/clock.h
> index e7daf97..845d54f 100644
> --- a/clock.h
> +++ b/clock.h
> @@ -290,6 +290,13 @@ int clock_slave_only(struct clock *c);
>  UInteger8 clock_max_steps_removed(struct clock *c);
>  
>  /**
> + * Obtain the clock class threshold field from a clock's default data set.
> + * @param c  The clock instance.
> + * @return   Configured clock class threshold value.
> + */
> +UInteger8 clock_get_clock_class_threshold(struct clock *c);
> +
> +/**
>   * Obtain the steps removed field from a clock's current data set.
>   * @param c  The clock instance.
>   * @return   The value of the clock's steps removed field.
> diff --git a/config.c b/config.c
> index c3deddb..bf1049f 100644
> --- a/config.c
> +++ b/config.c
> @@ -231,6 +231,7 @@ struct config_item config_tab[] = {
>       GLOB_ITEM_INT("clockAccuracy", 0xfe, 0, UINT8_MAX),
>       GLOB_ITEM_INT("clockClass", 248, 0, UINT8_MAX),
>       GLOB_ITEM_STR("clockIdentity", "000000.0000.000000"),
> +     GLOB_ITEM_INT("clock_class_threshold", CLOCK_CLASS_THRESHOLD_DEFAULT, 
> 6, CLOCK_CLASS_THRESHOLD_DEFAULT),
>       GLOB_ITEM_ENU("clock_servo", CLOCK_SERVO_PI, clock_servo_enu),
>       GLOB_ITEM_ENU("clock_type", CLOCK_TYPE_ORDINARY, clock_type_enu),
>       GLOB_ITEM_ENU("dataset_comparison", DS_CMP_IEEE1588, dataset_comp_enu),
> diff --git a/configs/default.cfg b/configs/default.cfg
> index 9604219..3054ad6 100644
> --- a/configs/default.cfg
> +++ b/configs/default.cfg
> @@ -29,6 +29,7 @@ logMinDelayReqInterval      0
>  logMinPdelayReqInterval      0
>  operLogPdelayReqInterval 0
>  announceReceiptTimeout       3
> +clock_class_threshold        248

This really is not part of the "Port Data Set".
Please the option under "Run time options" please.

Thanks,
Richard


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

Reply via email to