Introduce the maxStepsRemoved attribute

Add attribute maxStepsRemoved which is included in IEEE1588-2017 (v2.1)
It is an optional attribute which can decide if an Announce message is
considered in the operation of the BMCA or not.

Signed-off-by: Anders Selhammer <anders.selhammer@est.tech>
master
Anders Selhammer 2018-09-14 10:57:30 +02:00 committed by Richard Cochran
parent 399907db7f
commit 1173e774dd
8 changed files with 26 additions and 4 deletions

View File

@ -106,6 +106,7 @@ struct clock {
int utc_offset; int utc_offset;
int time_flags; /* grand master role */ int time_flags; /* grand master role */
int time_source; /* grand master role */ int time_source; /* grand master role */
UInteger8 max_steps_removed;
enum servo_state servo_state; enum servo_state servo_state;
enum timestamp_type timestamping; enum timestamp_type timestamping;
tmv_t master_offset; tmv_t master_offset;
@ -930,6 +931,7 @@ struct clock *clock_create(enum clock_type type, struct config *config,
} }
c->default_dataset.localPriority = c->default_dataset.localPriority =
config_get_int(config, NULL, "G.8275.defaultDS.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. */ /* Harmonize the twoStepFlag with the time_stamping option. */
if (config_harmonize_onestep(config)) { if (config_harmonize_onestep(config)) {
@ -1564,6 +1566,11 @@ int clock_slave_only(struct clock *c)
return c->dds.flags & DDS_SLAVE_ONLY; 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) UInteger16 clock_steps_removed(struct clock *c)
{ {
return c->cur.stepsRemoved; return c->cur.stepsRemoved;

View File

@ -260,6 +260,13 @@ int clock_poll(struct clock *c);
*/ */
int clock_slave_only(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. * Obtain the steps removed field from a clock's current data set.
* @param c The clock instance. * @param c The clock instance.

View File

@ -235,6 +235,7 @@ struct config_item config_tab[] = {
PORT_ITEM_INT("logSyncInterval", 0, INT8_MIN, INT8_MAX), PORT_ITEM_INT("logSyncInterval", 0, INT8_MIN, INT8_MAX),
GLOB_ITEM_INT("logging_level", LOG_INFO, PRINT_LEVEL_MIN, PRINT_LEVEL_MAX), GLOB_ITEM_INT("logging_level", LOG_INFO, PRINT_LEVEL_MIN, PRINT_LEVEL_MAX),
PORT_ITEM_INT("masterOnly", 0, 0, 1), PORT_ITEM_INT("masterOnly", 0, 0, 1),
GLOB_ITEM_INT("maxStepsRemoved", 255, 2, UINT8_MAX),
GLOB_ITEM_STR("message_tag", NULL), GLOB_ITEM_STR("message_tag", NULL),
GLOB_ITEM_STR("manufacturerIdentity", "00:00:00"), GLOB_ITEM_STR("manufacturerIdentity", "00:00:00"),
GLOB_ITEM_INT("max_frequency", 900000000, 0, INT_MAX), GLOB_ITEM_INT("max_frequency", 900000000, 0, INT_MAX),

View File

@ -7,5 +7,6 @@
[global] [global]
dataset_comparison G.8275.x dataset_comparison G.8275.x
G.8275.defaultDS.localPriority 128 G.8275.defaultDS.localPriority 128
maxStepsRemoved 255
masterOnly 0 masterOnly 0
G.8275.portDS.localPriority 128 G.8275.portDS.localPriority 128

View File

@ -7,6 +7,7 @@
[global] [global]
dataset_comparison G.8275.x dataset_comparison G.8275.x
G.8275.defaultDS.localPriority 128 G.8275.defaultDS.localPriority 128
maxStepsRemoved 255
masterOnly 0 masterOnly 0
G.8275.portDS.localPriority 128 G.8275.portDS.localPriority 128
hybrid_e2e 1 hybrid_e2e 1

View File

@ -17,6 +17,7 @@ dscp_event 0
dscp_general 0 dscp_general 0
dataset_comparison ieee1588 dataset_comparison ieee1588
G.8275.defaultDS.localPriority 128 G.8275.defaultDS.localPriority 128
maxStepsRemoved 255
# #
# Port Data Set # Port Data Set
# #

5
port.c
View File

@ -1711,10 +1711,7 @@ int process_announce(struct port *p, struct ptp_message *m)
{ {
int result = 0; int result = 0;
/* Do not qualify announce messages with stepsRemoved >= 255, see if (m->announce.stepsRemoved >= clock_max_steps_removed(p->clock)) {
* IEEE1588-2008 section 9.3.2.5 (d)
*/
if (m->announce.stepsRemoved >= 255) {
return result; return result;
} }

View File

@ -414,6 +414,13 @@ timing network without loops) only when using the default values of
G.8275.defaultDS.localPriority and G.8275.portDS.localPriority. G.8275.defaultDS.localPriority and G.8275.portDS.localPriority.
Careful network engineering is needed when using non-default values. Careful network engineering is needed when using non-default values.
.TP .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 .B domainNumber
The domain attribute of the local clock. The domain attribute of the local clock.
The default is 0. The default is 0.