From 4545fd1150964b15adb93adcacb64f3fc18991aa Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Tue, 14 Feb 2017 20:03:15 +0100 Subject: [PATCH] telecom: Add a configuration option for G.8275.portDS.localPriority. Signed-off-by: Richard Cochran --- config.c | 1 + default.cfg | 1 + gPTP.cfg | 1 + port.c | 3 ++- port_private.h | 1 + ptp4l.8 | 15 +++++++++++++++ 6 files changed, 21 insertions(+), 1 deletion(-) diff --git a/config.c b/config.c index 9c26ccd..f75092e 100644 --- a/config.c +++ b/config.c @@ -193,6 +193,7 @@ struct config_item config_tab[] = { GLOB_ITEM_INT("free_running", 0, 0, 1), PORT_ITEM_INT("freq_est_interval", 1, 0, INT_MAX), GLOB_ITEM_INT("G.8275.defaultDS.localPriority", 128, 1, UINT8_MAX), + PORT_ITEM_INT("G.8275.portDS.localPriority", 128, 1, UINT8_MAX), GLOB_ITEM_INT("gmCapable", 1, 0, 1), PORT_ITEM_INT("hybrid_e2e", 0, 0, 1), PORT_ITEM_INT("ignore_transport_specific", 0, 0, 1), diff --git a/default.cfg b/default.cfg index 9736568..24836dd 100644 --- a/default.cfg +++ b/default.cfg @@ -28,6 +28,7 @@ syncReceiptTimeout 0 delayAsymmetry 0 fault_reset_interval 4 neighborPropDelayThresh 20000000 +G.8275.portDS.localPriority 128 # # Run time options # diff --git a/gPTP.cfg b/gPTP.cfg index 02fd395..095a444 100644 --- a/gPTP.cfg +++ b/gPTP.cfg @@ -26,6 +26,7 @@ delayAsymmetry 0 fault_reset_interval 4 neighborPropDelayThresh 800 min_neighbor_prop_delay -20000000 +G.8275.portDS.localPriority 128 # # Run time options # diff --git a/port.c b/port.c index fc65153..3279417 100644 --- a/port.c +++ b/port.c @@ -77,7 +77,7 @@ static void announce_to_dataset(struct ptp_message *m, struct port *p, out->identity = a->grandmasterIdentity; out->quality = a->grandmasterClockQuality; out->priority2 = a->grandmasterPriority2; - out->localPriority = 128; + out->localPriority = p->localPriority; out->stepsRemoved = a->stepsRemoved; out->sender = m->header.sourcePortIdentity; out->receiver = p->portIdentity; @@ -1568,6 +1568,7 @@ int port_initialize(struct port *p) p->transportSpecific = config_get_int(cfg, p->name, "transportSpecific"); p->transportSpecific <<= 4; p->match_transport_specific = !config_get_int(cfg, p->name, "ignore_transport_specific"); + p->localPriority = config_get_int(cfg, p->name, "G.8275.portDS.localPriority"); p->logSyncInterval = config_get_int(cfg, p->name, "logSyncInterval"); p->logMinPdelayReqInterval = config_get_int(cfg, p->name, "logMinPdelayReqInterval"); p->neighborPropDelayThresh = config_get_int(cfg, p->name, "neighborPropDelayThresh"); diff --git a/port_private.h b/port_private.h index f8771c7..436e7b7 100644 --- a/port_private.h +++ b/port_private.h @@ -100,6 +100,7 @@ struct port { int announce_span; UInteger8 syncReceiptTimeout; UInteger8 transportSpecific; + UInteger8 localPriority; Integer8 logSyncInterval; Enumeration8 delayMechanism; Integer8 logMinPdelayReqInterval; diff --git a/ptp4l.8 b/ptp4l.8 index 10f55f2..11e3cc0 100644 --- a/ptp4l.8 +++ b/ptp4l.8 @@ -245,6 +245,21 @@ The default is UDPv4. Upper limit for peer delay in nanoseconds. If the estimated peer delay is greater than this value the port is marked as not 802.1AS capable. .TP +.B G.8275.portDS.localPriority +The Telecom Profiles (ITU-T G.8275.1 and G.8275.2) specify an +alternate Best Master Clock Algorithm (BMCA) with a unique data set +comparison algorithm. The value of this option is associated with +Announce messages arriving on a particular port and is used as a tie +breaker whenever clockClass, clockAccuracy, offsetScaledLogVariance, +and priority2 are equal. This option is only used when +"dataset_comparison" is set to "telecom". +The default value is 128. + +Warning: the BMCA is guaranteed to produce a spanning tree (that is, a +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 min_neighbor_prop_delay Lower limit for peer delay in nanoseconds. If the estimated peer delay is smaller than this value the port is marked as not 802.1AS capable.