From e1dcf8ea110eb814cc01e3747c02f579a28c9e54 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sat, 15 Aug 2015 12:55:44 +0200 Subject: [PATCH] config: port: convert 'path_trace_enabled' to the new scheme. Signed-off-by: Richard Cochran --- config.c | 9 ++------- ds.h | 1 - port.c | 8 +++++--- ptp4l.c | 1 - 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/config.c b/config.c index 2c97002..2c10158 100644 --- a/config.c +++ b/config.c @@ -103,6 +103,7 @@ struct config_item config_tab[] = { GLOB_ITEM_INT("logging_level", LOG_INFO, PRINT_LEVEL_MIN, PRINT_LEVEL_MAX), GLOB_ITEM_INT("max_frequency", 900000000, 0, INT_MAX), GLOB_ITEM_INT("ntpshm_segment", 0, INT_MIN, INT_MAX), + PORT_ITEM_INT("path_trace_enabled", 0, 0, 1), GLOB_ITEM_DBL("pi_integral_const", 0.0, 0.0, DBL_MAX), GLOB_ITEM_DBL("pi_integral_exponent", 0.4, -DBL_MAX, DBL_MAX), GLOB_ITEM_DBL("pi_integral_norm_max", 0.3, DBL_MIN, 2.0), @@ -270,13 +271,7 @@ static enum parser_result parse_pod_setting(const char *option, enum parser_result r; - if (!strcmp(option, "path_trace_enabled")) { - r = get_ranged_int(value, &val, 0, 1); - if (r != PARSED_OK) - return r; - pod->path_trace_enabled = val; - - } else if (!strcmp(option, "follow_up_info")) { + if (!strcmp(option, "follow_up_info")) { r = get_ranged_int(value, &val, 0, 1); if (r != PARSED_OK) return r; diff --git a/ds.h b/ds.h index d30c418..f1a0170 100644 --- a/ds.h +++ b/ds.h @@ -125,7 +125,6 @@ struct portDS { #define FRI_ASAP (-128) struct port_defaults { - int path_trace_enabled; int follow_up_info; int freq_est_interval; /*log seconds*/ struct fault_interval flt_interval_pertype[FT_CNT]; diff --git a/port.c b/port.c index 7c7b73b..bb1fd4b 100644 --- a/port.c +++ b/port.c @@ -111,6 +111,7 @@ struct port { Integer8 logMinPdelayReqInterval; UInteger32 neighborPropDelayThresh; int min_neighbor_prop_delay; + int path_trace_enabled; enum fault_type last_fault_type; unsigned int versionNumber; /*UInteger4*/ /* foreignMasterDS */ @@ -484,7 +485,7 @@ static int path_trace_ignore(struct port *p, struct ptp_message *m) struct path_trace_tlv *ptt; int i, cnt; - if (!p->pod.path_trace_enabled) { + if (!p->path_trace_enabled) { return 0; } if (msg_type(m) != ANNOUNCE) { @@ -1249,7 +1250,7 @@ static int port_tx_announce(struct port *p) pdulen = sizeof(struct announce_msg); msg->hwts.type = p->timestamping; - if (p->pod.path_trace_enabled) + if (p->path_trace_enabled) pdulen += path_trace_append(p, msg, dad); msg->header.tsmt = ANNOUNCE | p->transportSpecific; @@ -1529,7 +1530,7 @@ static int update_current_master(struct port *p, struct ptp_message *m) tds.timeSource = m->announce.timeSource; clock_update_time_properties(p->clock, tds); } - if (p->pod.path_trace_enabled) { + if (p->path_trace_enabled) { ptt = (struct path_trace_tlv *) m->announce.suffix; dad = clock_parent_ds(p->clock); memcpy(dad->ptl, ptt->cid, ptt->length); @@ -2530,6 +2531,7 @@ struct port *port_open(int phc_index, p->name = interface->name; p->asymmetry = config_get_int(cfg, p->name, "delayAsymmetry"); p->asymmetry <<= 16; + p->path_trace_enabled = config_get_int(cfg, p->name, "path_trace_enabled"); p->clock = clock; p->trp = transport_create(cfg, interface->transport); if (!p->trp) diff --git a/ptp4l.c b/ptp4l.c index f31cec8..ba189a4 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -80,7 +80,6 @@ static struct config cfg_settings = { }, .pod = { - .path_trace_enabled = 0, .follow_up_info = 0, .freq_est_interval = 1, /* Default to very a large neighborPropDelay threshold */