Skip to content

Commit

Permalink
config: port: convert 'path_trace_enabled' to the new scheme.
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Cochran <[email protected]>
  • Loading branch information
richardcochran committed Aug 23, 2015
1 parent 54f4506 commit e1dcf8e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
9 changes: 2 additions & 7 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion ds.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
8 changes: 5 additions & 3 deletions port.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion ptp4l.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit e1dcf8e

Please sign in to comment.