config: port: convert 'path_trace_enabled' to the new scheme.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2015-08-15 12:55:44 +02:00
parent 54f45063df
commit e1dcf8ea11
4 changed files with 7 additions and 12 deletions

View File

@ -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;

1
ds.h
View File

@ -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];

8
port.c
View File

@ -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)

View File

@ -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 */