From c6e046e2a2f690d73b46a736f4c9a6347440b85b Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Mon, 26 Aug 2013 14:36:49 +0200 Subject: [PATCH] Add a configuration file option for the sync receive timeout. Signed-off-by: Richard Cochran --- config.c | 6 ++++++ default.cfg | 1 + ds.h | 1 + gPTP.cfg | 1 + port.c | 1 + ptp4l.8 | 7 +++++++ ptp4l.c | 1 + 7 files changed, 18 insertions(+) diff --git a/config.c b/config.c index cec0922..ebb19c9 100644 --- a/config.c +++ b/config.c @@ -95,6 +95,12 @@ static enum parser_result parse_pod_setting(const char *option, return r; pod->announceReceiptTimeout = uval; + } else if (!strcmp(option, "syncReceiptTimeout")) { + r = get_ranged_uint(value, &uval, 0, UINT8_MAX); + if (r != PARSED_OK) + return r; + pod->syncReceiptTimeout = uval; + } else if (!strcmp(option, "transportSpecific")) { r = get_ranged_uint(value, &uval, 0, 0x0F); if (r != PARSED_OK) diff --git a/default.cfg b/default.cfg index c5493d6..efdd0f2 100644 --- a/default.cfg +++ b/default.cfg @@ -20,6 +20,7 @@ logSyncInterval 0 logMinDelayReqInterval 0 logMinPdelayReqInterval 0 announceReceiptTimeout 3 +syncReceiptTimeout 0 delayAsymmetry 0 fault_reset_interval 4 neighborPropDelayThresh 20000000 diff --git a/ds.h b/ds.h index 9977e40..55ad043 100644 --- a/ds.h +++ b/ds.h @@ -123,6 +123,7 @@ struct port_defaults { Integer8 logMinDelayReqInterval; Integer8 logMinPdelayReqInterval; UInteger8 announceReceiptTimeout; + UInteger8 syncReceiptTimeout; UInteger8 transportSpecific; int path_trace_enabled; int follow_up_info; diff --git a/gPTP.cfg b/gPTP.cfg index 00215b4..85865bc 100644 --- a/gPTP.cfg +++ b/gPTP.cfg @@ -19,6 +19,7 @@ logAnnounceInterval 1 logSyncInterval -3 logMinPdelayReqInterval 0 announceReceiptTimeout 3 +syncReceiptTimeout 3 delayAsymmetry 0 fault_reset_interval 4 neighborPropDelayThresh 800 diff --git a/port.c b/port.c index 2276ea5..4cfcdef 100644 --- a/port.c +++ b/port.c @@ -1283,6 +1283,7 @@ static int port_initialize(struct port *p) p->peerMeanPathDelay = 0; p->logAnnounceInterval = p->pod.logAnnounceInterval; p->announceReceiptTimeout = p->pod.announceReceiptTimeout; + p->syncReceiptTimeout = p->pod.syncReceiptTimeout; p->transportSpecific = p->pod.transportSpecific; p->logSyncInterval = p->pod.logSyncInterval; p->logMinPdelayReqInterval = p->pod.logMinPdelayReqInterval; diff --git a/ptp4l.8 b/ptp4l.8 index 6f42c1c..c68d01d 100644 --- a/ptp4l.8 +++ b/ptp4l.8 @@ -148,6 +148,13 @@ The number of missed Announce messages before the last Announce messages expires. The default is 3. .TP +.B syncReceiptTimeout +The number of sync/follow up messages that may go missing before +triggering a Best Master Clock election. This option is used for +running in gPTP mode according to the 802.1AS-2011 standard. Setting +this option to zero will disable the sync message timeout. +The default is 0 or disabled. +.TP .B transportSpecific The transport specific field. Must be in the range 0 to 255. The default is 0. diff --git a/ptp4l.c b/ptp4l.c index a83e3fe..9577250 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -77,6 +77,7 @@ static struct config cfg_settings = { .logMinDelayReqInterval = 0, .logMinPdelayReqInterval = 0, .announceReceiptTimeout = 3, + .syncReceiptTimeout = 0, .transportSpecific = 0, .path_trace_enabled = 0, .follow_up_info = 0,