From a19318b413aeaca234bef5f26b4af1240ee2824b Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sat, 15 Aug 2015 13:23:45 +0200 Subject: [PATCH] config: port: convert 'egressLatency' to the new scheme. Signed-off-by: Richard Cochran --- config.c | 9 ++------- ds.h | 1 - port.c | 6 ++++-- ptp4l.c | 1 - 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/config.c b/config.c index a4282f8..20a0d89 100644 --- a/config.c +++ b/config.c @@ -95,6 +95,7 @@ struct config_item config_tab[] = { GLOB_ITEM_INT("assume_two_step", 0, 0, 1), GLOB_ITEM_INT("check_fup_sync", 0, 0, 1), PORT_ITEM_INT("delayAsymmetry", 0, INT_MIN, INT_MAX), + PORT_ITEM_INT("egressLatency", 0, INT_MIN, INT_MAX), GLOB_ITEM_DBL("first_step_threshold", 0.00002, 0.0, DBL_MAX), PORT_ITEM_INT("follow_up_info", 0, 0, 1), PORT_ITEM_INT("freq_est_interval", 1, 0, INT_MAX), @@ -273,13 +274,7 @@ static enum parser_result parse_pod_setting(const char *option, int val; enum parser_result r; - 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")) { + if (!strcmp(option, "ingressLatency")) { r = get_ranged_int(value, &val, INT_MIN, INT_MAX); if (r != PARSED_OK) return r; diff --git a/ds.h b/ds.h index 23e5033..f36543e 100644 --- a/ds.h +++ b/ds.h @@ -125,7 +125,6 @@ struct portDS { struct port_defaults { struct fault_interval flt_interval_pertype[FT_CNT]; - int tx_timestamp_offset; /*nanoseconds*/ int rx_timestamp_offset; /*nanoseconds*/ }; diff --git a/port.c b/port.c index d01ff73..8aabbfa 100644 --- a/port.c +++ b/port.c @@ -114,6 +114,7 @@ struct port { int freq_est_interval; int min_neighbor_prop_delay; int path_trace_enabled; + int tx_timestamp_offset; enum fault_type last_fault_type; unsigned int versionNumber; /*UInteger4*/ /* foreignMasterDS */ @@ -521,7 +522,7 @@ static int peer_prepare_and_send(struct port *p, struct ptp_message *msg, return -1; } if (msg_sots_valid(msg)) { - ts_add(&msg->hwts.ts, p->pod.tx_timestamp_offset); + ts_add(&msg->hwts.ts, p->tx_timestamp_offset); } return 0; } @@ -2311,7 +2312,7 @@ int port_prepare_and_send(struct port *p, struct ptp_message *msg, int event) return -1; } if (msg_sots_valid(msg)) { - ts_add(&msg->hwts.ts, p->pod.tx_timestamp_offset); + ts_add(&msg->hwts.ts, p->tx_timestamp_offset); } return 0; } @@ -2536,6 +2537,7 @@ struct port *port_open(int phc_index, p->follow_up_info = config_get_int(cfg, p->name, "follow_up_info"); p->freq_est_interval = config_get_int(cfg, p->name, "freq_est_interval"); p->path_trace_enabled = config_get_int(cfg, p->name, "path_trace_enabled"); + p->tx_timestamp_offset = config_get_int(cfg, p->name, "egressLatency"); p->clock = clock; p->trp = transport_create(cfg, interface->transport); if (!p->trp) diff --git a/ptp4l.c b/ptp4l.c index 713bd4e..e092b08 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -79,7 +79,6 @@ static struct config cfg_settings = { }, .pod = { - .tx_timestamp_offset = 0, .rx_timestamp_offset = 0, },