From 83e26ec68b7613255b88611d7ec8b85777f447a1 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sat, 15 Aug 2015 13:28:54 +0200 Subject: [PATCH] config: port: convert 'ingressLatency' to the new scheme. Signed-off-by: Richard Cochran --- config.c | 9 ++------- ds.h | 1 - port.c | 4 +++- ptp4l.c | 4 ---- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/config.c b/config.c index 20a0d89..b3ca2b9 100644 --- a/config.c +++ b/config.c @@ -99,6 +99,7 @@ struct config_item config_tab[] = { 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), + PORT_ITEM_INT("ingressLatency", 0, INT_MIN, INT_MAX), PORT_ITEM_INT("logAnnounceInterval", 1, INT8_MIN, INT8_MAX), PORT_ITEM_INT("logMinDelayReqInterval", 0, INT8_MIN, INT8_MAX), PORT_ITEM_INT("logMinPdelayReqInterval", 0, INT8_MIN, INT8_MAX), @@ -274,13 +275,7 @@ static enum parser_result parse_pod_setting(const char *option, int val; enum parser_result r; - 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")) { + if (!strcmp(option, "fault_badpeernet_interval")) { pod->flt_interval_pertype[FT_BAD_PEER_NETWORK].type = FTMO_LINEAR_SECONDS; if (!strcasecmp("ASAP", value)) { pod->flt_interval_pertype[FT_BAD_PEER_NETWORK].val = 0; diff --git a/ds.h b/ds.h index f36543e..678136f 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 rx_timestamp_offset; /*nanoseconds*/ }; #endif diff --git a/port.c b/port.c index 8aabbfa..b527492 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 rx_timestamp_offset; int tx_timestamp_offset; enum fault_type last_fault_type; unsigned int versionNumber; /*UInteger4*/ @@ -2238,7 +2239,7 @@ enum fsm_event port_event(struct port *p, int fd_index) return EV_NONE; } if (msg_sots_valid(msg)) { - ts_add(&msg->hwts.ts, -p->pod.rx_timestamp_offset); + ts_add(&msg->hwts.ts, -p->rx_timestamp_offset); clock_check_ts(p->clock, msg->hwts.ts); } if (port_ignore(p, msg)) { @@ -2537,6 +2538,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->rx_timestamp_offset = config_get_int(cfg, p->name, "ingressLatency"); p->tx_timestamp_offset = config_get_int(cfg, p->name, "egressLatency"); p->clock = clock; p->trp = transport_create(cfg, interface->transport); diff --git a/ptp4l.c b/ptp4l.c index e092b08..b7a1ef1 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -78,10 +78,6 @@ static struct config cfg_settings = { .boundary_clock_jbod = 0, }, - .pod = { - .rx_timestamp_offset = 0, - }, - .timestamping = TS_HARDWARE, .dm = DM_E2E, .transport = TRANS_UDP_IPV4,