diff --git a/config.c b/config.c index d5fa378..7679f44 100644 --- a/config.c +++ b/config.c @@ -132,6 +132,18 @@ static enum parser_result parse_pod_setting(const char *option, return r; pod->min_neighbor_prop_delay = val; + } else if (!strcmp(option, "egressLatency")) { + r = get_ranged_int(value, &val, INT_MIN, INT_MAX); + if (r != PARSED_OK) + return r; + pod->tx_timestamp_offset = val; + + } else if (!strcmp(option, "ingressLatency")) { + r = get_ranged_int(value, &val, INT_MIN, INT_MAX); + if (r != PARSED_OK) + return r; + pod->rx_timestamp_offset = val; + } else if (!strcmp(option, "fault_badpeernet_interval")) { pod->flt_interval_pertype[FT_BAD_PEER_NETWORK].type = FTMO_LINEAR_SECONDS; if (!strcasecmp("ASAP", value)) { diff --git a/default.cfg b/default.cfg index 9e794ba..0e20726 100644 --- a/default.cfg +++ b/default.cfg @@ -70,6 +70,8 @@ delay_mechanism E2E time_stamping hardware delay_filter moving_median delay_filter_length 10 +egressLatency 0 +ingressLatency 0 # # Clock description # diff --git a/ds.h b/ds.h index ea25fbb..00260ed 100644 --- a/ds.h +++ b/ds.h @@ -137,6 +137,8 @@ struct port_defaults { struct fault_interval flt_interval_pertype[FT_CNT]; UInteger32 neighborPropDelayThresh; /*nanoseconds*/ int min_neighbor_prop_delay; /*nanoseconds*/ + int tx_timestamp_offset; /*nanoseconds*/ + int rx_timestamp_offset; /*nanoseconds*/ }; #endif diff --git a/gPTP.cfg b/gPTP.cfg index e15a05a..689abd8 100644 --- a/gPTP.cfg +++ b/gPTP.cfg @@ -69,3 +69,5 @@ delay_mechanism P2P time_stamping hardware delay_filter moving_median delay_filter_length 10 +egressLatency 0 +ingressLatency 0 diff --git a/ptp4l.8 b/ptp4l.8 index 687beb6..bee42e9 100644 --- a/ptp4l.8 +++ b/ptp4l.8 @@ -205,6 +205,18 @@ The default is moving_median. .B delay_filter_length The length of the delay filter in samples. The default is 10. +.TP +.B egressLatency +Specifies the difference in nanoseconds between the actual transmission +time at the reference plane and the reported transmit time stamp. This +value will be added to egress time stamps obtained from the hardware. +The default is 0. +.TP +.B ingressLatency +Specifies the difference in nanoseconds between the reported receive +time stamp and the actual reception time at reference plane. This value +will be subtracted from ingress time stamps obtained from the hardware. +The default is 0. .SH PROGRAM AND CLOCK OPTIONS diff --git a/ptp4l.c b/ptp4l.c index 83824f7..c18406f 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -92,6 +92,8 @@ static struct config cfg_settings = { /* Default to very a large neighborPropDelay threshold */ .neighborPropDelayThresh = 20000000, .min_neighbor_prop_delay = -20000000, + .tx_timestamp_offset = 0, + .rx_timestamp_offset = 0, }, .timestamping = TS_HARDWARE,