diff --git a/clock.c b/clock.c index faf2dea..47592ac 100644 --- a/clock.c +++ b/clock.c @@ -106,6 +106,7 @@ struct clock { int utc_offset; int time_flags; /* grand master role */ int time_source; /* grand master role */ + UInteger8 max_steps_removed; enum servo_state servo_state; enum timestamp_type timestamping; tmv_t master_offset; @@ -930,6 +931,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"); /* Harmonize the twoStepFlag with the time_stamping option. */ if (config_harmonize_onestep(config)) { @@ -1564,6 +1566,11 @@ int clock_slave_only(struct clock *c) return c->dds.flags & DDS_SLAVE_ONLY; } +UInteger8 clock_max_steps_removed(struct clock *c) +{ + return c->max_steps_removed; +} + UInteger16 clock_steps_removed(struct clock *c) { return c->cur.stepsRemoved; diff --git a/clock.h b/clock.h index cc2910a..07aba18 100644 --- a/clock.h +++ b/clock.h @@ -260,6 +260,13 @@ int clock_poll(struct clock *c); */ int clock_slave_only(struct clock *c); +/** + * Obtain the max steps removed field from a clock's default data set. + * @param c The clock instance. + * @return The value of the clock's max steps removed field. + */ +UInteger8 clock_max_steps_removed(struct clock *c); + /** * Obtain the steps removed field from a clock's current data set. * @param c The clock instance. diff --git a/config.c b/config.c index 3530ce6..3455b5a 100644 --- a/config.c +++ b/config.c @@ -235,6 +235,7 @@ struct config_item config_tab[] = { PORT_ITEM_INT("logSyncInterval", 0, INT8_MIN, INT8_MAX), GLOB_ITEM_INT("logging_level", LOG_INFO, PRINT_LEVEL_MIN, PRINT_LEVEL_MAX), PORT_ITEM_INT("masterOnly", 0, 0, 1), + GLOB_ITEM_INT("maxStepsRemoved", 255, 2, UINT8_MAX), GLOB_ITEM_STR("message_tag", NULL), GLOB_ITEM_STR("manufacturerIdentity", "00:00:00"), GLOB_ITEM_INT("max_frequency", 900000000, 0, INT_MAX), diff --git a/configs/G.8275.1.cfg b/configs/G.8275.1.cfg index f40cda0..288fa4f 100644 --- a/configs/G.8275.1.cfg +++ b/configs/G.8275.1.cfg @@ -7,5 +7,6 @@ [global] dataset_comparison G.8275.x G.8275.defaultDS.localPriority 128 +maxStepsRemoved 255 masterOnly 0 G.8275.portDS.localPriority 128 diff --git a/configs/G.8275.2.cfg b/configs/G.8275.2.cfg index 3d7a908..15bc609 100644 --- a/configs/G.8275.2.cfg +++ b/configs/G.8275.2.cfg @@ -7,6 +7,7 @@ [global] dataset_comparison G.8275.x G.8275.defaultDS.localPriority 128 +maxStepsRemoved 255 masterOnly 0 G.8275.portDS.localPriority 128 hybrid_e2e 1 diff --git a/configs/default.cfg b/configs/default.cfg index c5a8b57..2ac6eb7 100644 --- a/configs/default.cfg +++ b/configs/default.cfg @@ -17,6 +17,7 @@ dscp_event 0 dscp_general 0 dataset_comparison ieee1588 G.8275.defaultDS.localPriority 128 +maxStepsRemoved 255 # # Port Data Set # diff --git a/port.c b/port.c index 5e0aed7..01e99a2 100644 --- a/port.c +++ b/port.c @@ -1711,10 +1711,7 @@ int process_announce(struct port *p, struct ptp_message *m) { int result = 0; - /* Do not qualify announce messages with stepsRemoved >= 255, see - * IEEE1588-2008 section 9.3.2.5 (d) - */ - if (m->announce.stepsRemoved >= 255) { + if (m->announce.stepsRemoved >= clock_max_steps_removed(p->clock)) { return result; } diff --git a/ptp4l.8 b/ptp4l.8 index 39bf36e..90454fa 100644 --- a/ptp4l.8 +++ b/ptp4l.8 @@ -414,6 +414,13 @@ timing network without loops) only when using the default values of G.8275.defaultDS.localPriority and G.8275.portDS.localPriority. Careful network engineering is needed when using non-default values. .TP +.B maxStepsRemoved +When using this option, if the value of stepsRemoved of an Announce +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 domainNumber The domain attribute of the local clock. The default is 0.