Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 bmc.h       | 5 +++++
 clock.c     | 6 +++++-
 config.c    | 9 +++++++++
 default.cfg | 1 +
 gPTP.cfg    | 1 +
 port.c      | 6 +++++-
 6 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/bmc.h b/bmc.h
index 3f4b5fa..2901cda 100644
--- a/bmc.h
+++ b/bmc.h
@@ -29,6 +29,11 @@
 #define B_BETTER      -1
 #define B_BETTER_TOPO -2
 
+enum {
+       DS_CMP_IEEE1588,
+       DS_CMP_G8275,
+};
+
 /**
  * BMC state decision algorithm.
  * @param c  The local clock.
diff --git a/clock.c b/clock.c
index 1886c26..9339b1a 100644
--- a/clock.c
+++ b/clock.c
@@ -1059,7 +1059,11 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
        }
        c->servo_state = SERVO_UNLOCKED;
        c->servo_type = servo;
-       c->dscmp = dscmp;
+       if (config_get_int(config, NULL, "dataset_comparison") == DS_CMP_G8275) 
{
+               c->dscmp = telecom_dscmp;
+       } else {
+               c->dscmp = dscmp;
+       }
        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 f75092e..0b656b7 100644
--- a/config.c
+++ b/config.c
@@ -22,6 +22,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+
+#include "bmc.h"
 #include "config.h"
 #include "ether.h"
 #include "hash.h"
@@ -133,6 +135,12 @@ static struct config_enum clock_servo_enu[] = {
        { NULL, 0 },
 };
 
+static struct config_enum dataset_comp_enu[] = {
+       { "ieee1588", DS_CMP_IEEE1588 },
+       { "G.8275.x", DS_CMP_G8275    },
+       { NULL, 0 },
+};
+
 static struct config_enum delay_filter_enu[] = {
        { "moving_average", FILTER_MOVING_AVERAGE },
        { "moving_median",  FILTER_MOVING_MEDIAN  },
@@ -178,6 +186,7 @@ struct config_item config_tab[] = {
        GLOB_ITEM_INT("clockAccuracy", 0xfe, 0, UINT8_MAX),
        GLOB_ITEM_INT("clockClass", 248, 0, UINT8_MAX),
        GLOB_ITEM_ENU("clock_servo", CLOCK_SERVO_PI, clock_servo_enu),
+       GLOB_ITEM_ENU("dataset_comparison", DS_CMP_IEEE1588, dataset_comp_enu),
        PORT_ITEM_INT("delayAsymmetry", 0, INT_MIN, INT_MAX),
        PORT_ITEM_ENU("delay_filter", FILTER_MOVING_MEDIAN, delay_filter_enu),
        PORT_ITEM_INT("delay_filter_length", 10, 1, INT_MAX),
diff --git a/default.cfg b/default.cfg
index 24836dd..d7b78f2 100644
--- a/default.cfg
+++ b/default.cfg
@@ -15,6 +15,7 @@ free_running          0
 freq_est_interval      1
 dscp_event             0
 dscp_general           0
+dataset_comparison     ieee1588
 G.8275.defaultDS.localPriority 128
 #
 # Port Data Set
diff --git a/gPTP.cfg b/gPTP.cfg
index 095a444..14859e1 100644
--- a/gPTP.cfg
+++ b/gPTP.cfg
@@ -13,6 +13,7 @@ clockAccuracy         0xFE
 offsetScaledLogVariance        0xFFFF
 free_running           0
 freq_est_interval      1
+dataset_comparison     ieee1588
 G.8275.defaultDS.localPriority 128
 #
 # Port Data Set
diff --git a/port.c b/port.c
index 8c52ade..0cee2fe 100644
--- a/port.c
+++ b/port.c
@@ -2786,7 +2786,11 @@ struct port *port_open(int phc_index,
        }
 
        p->state_machine = clock_slave_only(clock) ? ptp_slave_fsm : ptp_fsm;
-       p->dscmp = dscmp;
+       if (config_get_int(cfg, NULL, "dataset_comparison") == DS_CMP_G8275) {
+               p->dscmp = telecom_dscmp;
+       } else {
+               p->dscmp = dscmp;
+       }
        p->phc_index = phc_index;
        p->jbod = config_get_int(cfg, interface->name, "boundary_clock_jbod");
        transport = config_get_int(cfg, interface->name, "network_transport");
-- 
2.11.0


------------------------------------------------------------------------------
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
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to