Signed-off-by: Anders Selhammer <anders.selham...@est.tech>
---
 clock.c     | 15 ++++++++++++---
 config.c    | 12 +++++++++++-
 default.cfg |  3 +++
 gPTP.cfg    |  3 +++
 port.c      |  1 +
 5 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/clock.c b/clock.c
index 272c7da..15bd6c5 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, "bmca")) {
+       case ALTERNATE_BMCA:
+               c->dscmp = dscmp_alternate;
+               break;
+       case IEEE1588_BMCA:
+       default:
+               c->dscmp = dscmp_ieee1588;
+
+       }
+       c->localPriority = config_get_int(config, NULL, "localPriorityD0");
        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..ebc7328 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 bmca_enu[] = {
+       { "ieee1588",  IEEE1588_BMCA  },
+       { "alternate", ALTERNATE_BMCA },
+       { NULL, 0 },
+};
+
 static struct config_enum clock_servo_enu[] = {
        { "pi",     CLOCK_SERVO_PI     },
        { "linreg", CLOCK_SERVO_LINREG },
@@ -173,6 +180,7 @@ static struct config_enum tsproc_enu[] = {
 struct config_item config_tab[] = {
        PORT_ITEM_INT("announceReceiptTimeout", 3, 2, UINT8_MAX),
        GLOB_ITEM_INT("assume_two_step", 0, 0, 1),
+       GLOB_ITEM_ENU("bmca", IEEE1588_BMCA, bmca_enu),
        PORT_ITEM_INT("boundary_clock_jbod", 0, 0, 1),
        GLOB_ITEM_INT("check_fup_sync", 0, 0, 1),
        GLOB_ITEM_INT("clockAccuracy", 0xfe, 0, UINT8_MAX),
@@ -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("localPriorityD0", 128, 0, UINT8_MAX),
+       PORT_ITEM_INT("localPriorityR", 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..b6ad3dc 100644
--- a/default.cfg
+++ b/default.cfg
@@ -4,6 +4,7 @@
 #
 twoStepFlag            1
 slaveOnly              0
+localPriorityD0                128
 priority1              128
 priority2              128
 domainNumber           0
@@ -18,6 +19,7 @@ dscp_general          0
 #
 # Port Data Set
 #
+localPriorityR         128
 logAnnounceInterval    1
 logSyncInterval                0
 logMinDelayReqInterval 0
@@ -71,6 +73,7 @@ uds_address           /var/run/ptp4l
 #
 # Default interface options
 #
+bmca                   ieee1588
 network_transport      UDPv4
 delay_mechanism                E2E
 time_stamping          hardware
diff --git a/gPTP.cfg b/gPTP.cfg
index 1e7a33e..4a83376 100644
--- a/gPTP.cfg
+++ b/gPTP.cfg
@@ -4,6 +4,7 @@
 #
 twoStepFlag            1
 gmCapable              1
+localPriorityD0                128
 priority1              248
 priority2              248
 domainNumber           0
@@ -16,6 +17,7 @@ freq_est_interval     1
 #
 # Port Data Set
 #
+localPriorityR         128
 logAnnounceInterval    1
 logSyncInterval                -3
 logMinPdelayReqInterval        0
@@ -67,6 +69,7 @@ uds_address           /var/run/ptp4l
 #
 # Default interface options
 #
+bmca                   ieee1588
 network_transport      L2
 delay_mechanism                P2P
 time_stamping          hardware
diff --git a/port.c b/port.c
index 458f77b..93138b1 100644
--- a/port.c
+++ b/port.c
@@ -2836,6 +2836,7 @@ 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, 
"localPriorityR");
        p->delayMechanism = config_get_int(cfg, p->name, "delay_mechanism");
        p->versionNumber = PTP_VERSION;
 
-- 
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
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to