When "notSlave" 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.
Signed-off-by: Richard Cochran <richardcoch...@gmail.com> --- config.c | 1 + default.cfg | 1 + gPTP.cfg | 1 + port.c | 5 +++++ ptp4l.8 | 7 +++++++ 5 files changed, 15 insertions(+) diff --git a/config.c b/config.c index 97fd649..626d215 100644 --- a/config.c +++ b/config.c @@ -215,6 +215,7 @@ struct config_item config_tab[] = { PORT_ITEM_INT("min_neighbor_prop_delay", -20000000, INT_MIN, -1), PORT_ITEM_INT("neighborPropDelayThresh", 20000000, 0, INT_MAX), PORT_ITEM_ENU("network_transport", TRANS_UDP_IPV4, nw_trans_enu), + PORT_ITEM_INT("notSlave", 0, 0, 1), GLOB_ITEM_INT("ntpshm_segment", 0, INT_MIN, INT_MAX), GLOB_ITEM_INT("offsetScaledLogVariance", 0xffff, 0, UINT16_MAX), PORT_ITEM_INT("path_trace_enabled", 0, 0, 1), diff --git a/default.cfg b/default.cfg index 1e8d334..93dff29 100644 --- a/default.cfg +++ b/default.cfg @@ -29,6 +29,7 @@ syncReceiptTimeout 0 delayAsymmetry 0 fault_reset_interval 4 neighborPropDelayThresh 20000000 +notSlave 0 portDS.localPriority 128 # # Run time options diff --git a/gPTP.cfg b/gPTP.cfg index b0c94db..0126ff9 100644 --- a/gPTP.cfg +++ b/gPTP.cfg @@ -27,6 +27,7 @@ delayAsymmetry 0 fault_reset_interval 4 neighborPropDelayThresh 800 min_neighbor_prop_delay -20000000 +notSlave 0 portDS.localPriority 128 # # Run time options diff --git a/port.c b/port.c index b957429..b5e2ac5 100644 --- a/port.c +++ b/port.c @@ -120,6 +120,7 @@ struct port { int freq_est_interval; int hybrid_e2e; int min_neighbor_prop_delay; + int not_slave; int path_trace_enabled; int rx_timestamp_offset; int tx_timestamp_offset; @@ -1489,6 +1490,7 @@ static int port_initialize(struct port *p) p->logMinPdelayReqInterval = config_get_int(cfg, p->name, "logMinPdelayReqInterval"); p->neighborPropDelayThresh = config_get_int(cfg, p->name, "neighborPropDelayThresh"); p->min_neighbor_prop_delay = config_get_int(cfg, p->name, "min_neighbor_prop_delay"); + p->not_slave = config_get_int(cfg, p->name, "notSlave"); for (i = 0; i < N_TIMER_FDS; i++) { fd[i] = -1; @@ -2059,6 +2061,9 @@ struct foreign_clock *port_compute_best(struct port *p) p->best = NULL; + if (p->not_slave) + return p->best; + LIST_FOREACH(fc, &p->foreign_masters, list) { tmp = TAILQ_FIRST(&fc->messages); if (!tmp) diff --git a/ptp4l.8 b/ptp4l.8 index 0aeabcc..bd25cc5 100644 --- a/ptp4l.8 +++ b/ptp4l.8 @@ -227,6 +227,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 notSlave +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 Profile according to ITU-T G.8275.1. The default +value is zero or false. +.TP .B portDS.localPriority The Telecom Profile (ITU-T G.8275.1) specifies an alternate Best Master Clock Algorithm (BMCA) with a unique data set comparison -- 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