When G.8275.masterOnly is true, the port always returns NULL when
computing its best foreign master.  As a result, the port will never
enter the SLAVE state, and the clock will ignore Announce messages
received on that port.

This attribute is specifically called out in G.8275.1 and G.8275.2,
and it is implied by the "master only" mode G.8265.1.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 config.c       | 1 +
 default.cfg    | 1 +
 gPTP.cfg       | 1 +
 port.c         | 4 ++++
 port_private.h | 1 +
 ptp4l.8        | 7 +++++++
 6 files changed, 15 insertions(+)

diff --git a/config.c b/config.c
index 0b656b7..8011e57 100644
--- a/config.c
+++ b/config.c
@@ -202,6 +202,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.masterOnly", 0, 0, 1),
        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),
diff --git a/default.cfg b/default.cfg
index d7b78f2..5773ccb 100644
--- a/default.cfg
+++ b/default.cfg
@@ -29,6 +29,7 @@ syncReceiptTimeout    0
 delayAsymmetry         0
 fault_reset_interval   4
 neighborPropDelayThresh        20000000
+G.8275.masterOnly              0
 G.8275.portDS.localPriority    128
 #
 # Run time options
diff --git a/gPTP.cfg b/gPTP.cfg
index 14859e1..9bbaddd 100644
--- a/gPTP.cfg
+++ b/gPTP.cfg
@@ -27,6 +27,7 @@ delayAsymmetry                0
 fault_reset_interval   4
 neighborPropDelayThresh        800
 min_neighbor_prop_delay        -20000000
+G.8275.masterOnly              0
 G.8275.portDS.localPriority    128
 #
 # Run time options
diff --git a/port.c b/port.c
index 0cee2fe..663f36e 100644
--- a/port.c
+++ b/port.c
@@ -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->master_only             = config_get_int(cfg, p->name, 
"G.8275.masterOnly");
        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");
@@ -2198,6 +2199,9 @@ struct foreign_clock *port_compute_best(struct port *p)
 
        p->best = NULL;
 
+       if (p->master_only)
+               return p->best;
+
        LIST_FOREACH(fc, &p->foreign_masters, list) {
                tmp = TAILQ_FIRST(&fc->messages);
                if (!tmp)
diff --git a/port_private.h b/port_private.h
index 711dce1..391db64 100644
--- a/port_private.h
+++ b/port_private.h
@@ -109,6 +109,7 @@ struct port {
        int                 follow_up_info;
        int                 freq_est_interval;
        int                 hybrid_e2e;
+       int                 master_only;
        int                 match_transport_specific;
        int                 min_neighbor_prop_delay;
        int                 net_sync_monitor;
diff --git a/ptp4l.8 b/ptp4l.8
index 11e3cc0..0b17f10 100644
--- a/ptp4l.8
+++ b/ptp4l.8
@@ -245,6 +245,13 @@ 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.masterOnly
+Setting this option to one (1) prevents the port from entering the
+SLAVE state. In addition, the local clock will ignore Announce
+messages received on this port. This option's intended use is to
+support the Telecom Profiles according to ITU-T G.8265.1, G.8275.1,
+and G.8275.2. The default value is zero or false.
+.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
-- 
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