On 2/14/2021 9:59 PM, Karthikkumar V wrote:
> Implemented code review comments.
> This code changes brings in the ability to program the acceptable
> clockClass threshold beyond which device will move to holdover/free-run.
> Default clockClass threshold is 248.
> Example Use-Case
> This is needed in the cases where T-SC/T-BC Slave might want to listen
> only on PRC clockCLass and anything beyond that might not be acceptible
> and would want to go to holdover (with SyncE backup or internal
> oscillator).
>
> Signed-off-by: Karthikkumar V <kval...@altiostar.com>
> Signed-off-by: Ramana Reddy <rre...@altiostar.com>
> ---
> clock.c | 4 ++--
> config.c | 2 +-
> configs/default.cfg | 2 +-
> port.c | 7 +++++--
> ptp4l.8 | 5 +++++
> 5 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/clock.c b/clock.c
> index 542f409..c40476f 100644
> --- a/clock.c
> +++ b/clock.c
> @@ -969,7 +969,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,
> "clockClassThreshold");
> + c->clock_class_threshold = config_get_int(config, NULL,
> "clock_class_threshold");
>
Why this change? It seems weird to remove this variable and introduce
another? clockClassThreshold is supposed to be the standard isn't it?
> /* Harmonize the twoStepFlag with the time_stamping option. */
> if (config_harmonize_onestep(config)) {
> @@ -1660,7 +1660,7 @@ UInteger8 clock_max_steps_removed(struct clock *c)
>
> UInteger8 clock_get_clock_class_threshold(struct clock *c)
> {
> - if(c != NULL){
> + if (c != NULL) {
> return c->clock_class_threshold;
> }
> return CLOCK_CLASS_THRESHOLD_DEFAULT; /* Return Default Value */
> diff --git a/config.c b/config.c
> index 41735d3..c840d98 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),
> @@ -332,7 +333,6 @@ 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),
> };
>
> static struct unicast_master_table *current_uc_mtab;
> diff --git a/configs/default.cfg b/configs/default.cfg
> index 473bbb9..e863239 100644
> --- a/configs/default.cfg
> +++ b/configs/default.cfg
> @@ -29,7 +29,7 @@ logMinDelayReqInterval 0
> logMinPdelayReqInterval 0
> operLogPdelayReqInterval 0
> announceReceiptTimeout 3
> -clockClassThreshold 248
> +clock_class_threshold 248
> syncReceiptTimeout 0
> delayAsymmetry 0
> fault_reset_interval 4
> diff --git a/port.c b/port.c
> index ae2a00e..024370f 100644
> --- a/port.c
> +++ b/port.c
> @@ -1861,8 +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)){
> + if (m->announce.grandmasterClockQuality.clockClass >
> + clock_get_clock_class_threshold(p->clock)) {
> + pl_err(60, "%s: Master clock quality received is "
> + "greater than configured, ignoring master!",
> + p->log_name);
> return result;
> }
>
> diff --git a/ptp4l.8 b/ptp4l.8
> index 260aae3..b13471b 100644
> --- a/ptp4l.8
> +++ b/ptp4l.8
> @@ -455,6 +455,11 @@ message is greater than or equal to the value of
> maxStepsRemoved the
> Announce message is not considered in the operation of the BMCA.
> The default value is 255.
> .TP
> +.B clock_class_threshold
> +The maximum clock class value from master, acceptible to sub-ordinate
> +clock beyond which it moves out of lock state.
> +The default value is 248.
> +.TP
>
> .B domainNumber
> The domain attribute of the local clock.
>
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel