Signed-off-by: Anders Selhammer <[email protected]>
---
bmc.h | 5 +++++
clock.c | 15 ++++++++++++---
config.c | 12 +++++++++++-
default.cfg | 3 +++
gPTP.cfg | 3 +++
port.c | 2 ++
ptp4l.8 | 33 +++++++++++++++++++++++++++++++++
7 files changed, 69 insertions(+), 4 deletions(-)
diff --git a/bmc.h b/bmc.h
index b8f3561..aca6db2 100644
--- a/bmc.h
+++ b/bmc.h
@@ -32,6 +32,11 @@ typedef int (*dscmp_type)(struct dataset*, struct dataset*);
struct clock; /*forward declaration*/
struct port; /*forward declaration*/
+enum dscmp_type {
+ DSCMP_IEEE1588,
+ DSCMP_G8275,
+};
+
/**
* BMC state decision algorithm.
* @param c The local clock.
diff --git a/clock.c b/clock.c
index 272c7da..1547cdb 100644
--- a/clock.c
+++ b/clock.c
@@ -35,10 +35,10 @@
#include "msg.h"
#include "phc.h"
#include "port.h"
-#include "servo.h"
-#include "stats.h"
#include "print.h"
#include "rtnl.h"
+#include "servo.h"
+#include "stats.h"
#include "tlv.h"
#include "tsproc.h"
#include "uds.h"
@@ -1068,7 +1068,16 @@ struct clock *clock_create(enum clock_type type, struct
config *config,
}
c->servo_state = SERVO_UNLOCKED;
c->servo_type = servo;
- c->dscmp = dscmp_ieee1588;
+ switch (config_get_int(config, NULL, "dscmp")) {
+ case DSCMP_IEEE1588:
+ c->dscmp = dscmp_G8275;
+ break;
+ case DSCMP_G8275:
+ default:
+ c->dscmp = dscmp_ieee1588;
+ }
+ c->localPriority =
+ config_get_int(config, NULL, "G.8275.defaultDS.localPriority");
c->tsproc = tsproc_create(config_get_int(config, NULL, "tsproc_mode"),
config_get_int(config, NULL, "delay_filter"),
config_get_int(config, NULL,
"delay_filter_length"));
diff --git a/config.c b/config.c
index 320cc1b..5444905 100644
--- a/config.c
+++ b/config.c
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "bmc.h"
#include "config.h"
#include "ether.h"
#include "hash.h"
@@ -125,6 +126,12 @@ struct config_item {
#define PORT_ITEM_STR(label, _default) \
CONFIG_ITEM_STRING(label, 1, _default)
+static struct config_enum dscmp_enu[] = {
+ { "ieee1588", DSCMP_IEEE1588 },
+ { "G8275", DSCMP_G8275 },
+ { NULL, 0 },
+};
+
static struct config_enum clock_servo_enu[] = {
{ "pi", CLOCK_SERVO_PI },
{ "linreg", CLOCK_SERVO_LINREG },
@@ -182,6 +189,7 @@ struct config_item config_tab[] = {
PORT_ITEM_ENU("delay_filter", FILTER_MOVING_MEDIAN, delay_filter_enu),
PORT_ITEM_INT("delay_filter_length", 10, 1, INT_MAX),
PORT_ITEM_ENU("delay_mechanism", DM_E2E, delay_mech_enu),
+ GLOB_ITEM_ENU("dscmp", DSCMP_IEEE1588, dscmp_enu),
GLOB_ITEM_INT("dscp_event", 0, 0, 63),
GLOB_ITEM_INT("dscp_general", 0, 0, 63),
GLOB_ITEM_INT("domainNumber", 0, 0, 127),
@@ -198,14 +206,16 @@ struct config_item config_tab[] = {
PORT_ITEM_INT("ingressLatency", 0, INT_MIN, INT_MAX),
GLOB_ITEM_INT("initial_delay", 0, 0, INT_MAX),
GLOB_ITEM_INT("kernel_leap", 1, 0, 1),
+ GLOB_ITEM_INT("G.8275.defaultDS.localPriority", 128, 0, UINT8_MAX),
+ PORT_ITEM_INT("G.8275.portDS.localPriority", 128, 0, UINT8_MAX),
PORT_ITEM_INT("logAnnounceInterval", 1, INT8_MIN, INT8_MAX),
PORT_ITEM_INT("logMinDelayReqInterval", 0, INT8_MIN, INT8_MAX),
PORT_ITEM_INT("logMinPdelayReqInterval", 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_STR("message_tag", NULL),
GLOB_ITEM_STR("manufacturerIdentity", "00:00:00"),
GLOB_ITEM_INT("max_frequency", 900000000, 0, INT_MAX),
+ GLOB_ITEM_STR("message_tag", NULL),
PORT_ITEM_INT("min_neighbor_prop_delay", -20000000, INT_MIN, -1),
PORT_ITEM_INT("neighborPropDelayThresh", 20000000, 0, INT_MAX),
PORT_ITEM_INT("net_sync_monitor", 0, 0, 1),
diff --git a/default.cfg b/default.cfg
index e76aeae..fff0271 100644
--- a/default.cfg
+++ b/default.cfg
@@ -15,6 +15,8 @@ free_running 0
freq_est_interval 1
dscp_event 0
dscp_general 0
+dscmp ieee1588
+G.8275.defaultDS.localPriority 128
#
# Port Data Set
#
@@ -27,6 +29,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 1e7a33e..e2f2a0f 100644
--- a/gPTP.cfg
+++ b/gPTP.cfg
@@ -13,6 +13,8 @@ clockAccuracy 0xFE
offsetScaledLogVariance 0xFFFF
free_running 0
freq_est_interval 1
+dscmp ieee1588
+G.8275.defaultDS.localPriority 128
#
# Port Data Set
#
@@ -25,6 +27,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 458f77b..3d03bb7 100644
--- a/port.c
+++ b/port.c
@@ -2836,6 +2836,8 @@ struct port *port_open(int phc_index,
p->portIdentity.clockIdentity = clock_identity(clock);
p->portIdentity.portNumber = number;
p->state = PS_INITIALIZING;
+ p->localPriority =
+ config_get_int(cfg, interface->name,
"G.8275.portDS.localPriority");
p->delayMechanism = config_get_int(cfg, p->name, "delay_mechanism");
p->versionNumber = PTP_VERSION;
diff --git a/ptp4l.8 b/ptp4l.8
index 950e07c..a201a53 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
+"dscmp" is set to "G8275".
+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.
@@ -341,6 +356,24 @@ The offsetScaledLogVariance attribute of the local clock.
It characterizes the
stability of the clock.
The default is 0xFFFF.
.TP
+.B dscmp
+The dscmp attribute of the local clock. It used to select which dataset
comparison function to use in the Best Master Clock Algorithm (BMCA).
+The default is ieee1588.
+.TP
+.B G.8275.defaultDS.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 the
+local clock and is used as a tie breaker whenever clockClass,
+clockAccuracy, offsetScaledLogVariance, and priority2 are equal. This
+option is only used when "dscmp" is set to "G8275".
+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 domainNumber
The domain attribute of the local clock.
The default is 0.
--
1.8.3.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel