From e6af4608c4d672490398a8cbcb17b8ee5033c191 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Mon, 16 Apr 2018 16:20:06 -0700 Subject: [PATCH] config: Add a configuration option for preventing loops in TC mode. According to 1588, PTP message loops are simply someone else's problem with respect to transparent clocks. Since we are running the BMCA for syntonization anyway, we might as well go ahead and implement the spanning tree for PTP messages. Signed-off-by: Richard Cochran --- config.c | 1 + default.cfg | 1 + port.c | 1 + ptp4l.8 | 6 ++++++ 4 files changed, 9 insertions(+) diff --git a/config.c b/config.c index 6d00641..57c239b 100644 --- a/config.c +++ b/config.c @@ -254,6 +254,7 @@ struct config_item config_tab[] = { GLOB_ITEM_DBL("step_threshold", 0.0, 0.0, DBL_MAX), GLOB_ITEM_INT("summary_interval", 0, INT_MIN, INT_MAX), PORT_ITEM_INT("syncReceiptTimeout", 0, 0, UINT8_MAX), + GLOB_ITEM_INT("tc_spanning_tree", 0, 1, 1), GLOB_ITEM_INT("timeSource", INTERNAL_OSCILLATOR, 0x10, 0xfe), GLOB_ITEM_ENU("time_stamping", TS_HARDWARE, timestamping_enu), PORT_ITEM_INT("transportSpecific", 0, 0, 0x0F), diff --git a/default.cfg b/default.cfg index f70f386..86eb15e 100644 --- a/default.cfg +++ b/default.cfg @@ -40,6 +40,7 @@ path_trace_enabled 0 follow_up_info 0 hybrid_e2e 0 net_sync_monitor 0 +tc_spanning_tree 0 tx_timestamp_timeout 1 use_syslog 1 verbose 0 diff --git a/port.c b/port.c index a7d7928..d0e3ca0 100644 --- a/port.c +++ b/port.c @@ -2830,6 +2830,7 @@ struct port *port_open(int phc_index, p->hybrid_e2e = config_get_int(cfg, p->name, "hybrid_e2e"); p->net_sync_monitor = config_get_int(cfg, p->name, "net_sync_monitor"); p->path_trace_enabled = config_get_int(cfg, p->name, "path_trace_enabled"); + p->tc_spanning_tree = config_get_int(cfg, p->name, "tc_spanning_tree"); p->rx_timestamp_offset = config_get_int(cfg, p->name, "ingressLatency"); p->rx_timestamp_offset <<= 16; p->tx_timestamp_offset = config_get_int(cfg, p->name, "egressLatency"); diff --git a/ptp4l.8 b/ptp4l.8 index 003d54e..ae6e491 100644 --- a/ptp4l.8 +++ b/ptp4l.8 @@ -399,6 +399,12 @@ Treat one-step responses as two-step if enabled. It is used to work around buggy 802.1AS switches. The default is 0 (disabled). .TP +.B tc_spanning_tree +When running as a Transparent Clock, increment the "stepsRemoved" +field of Announce messages that pass through the switch. Enabling +this option ensures that PTP message loops never form, provided the +switches all implement this option together with the BMCA. +.TP .B tx_timestamp_timeout The number of milliseconds to poll waiting for the tx time stamp from the kernel when a message has recently been sent.