Skip to content

Commit

Permalink
config: port: convert 'follow_up_info' 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 e1dcf8e commit becc626
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
9 changes: 2 additions & 7 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ struct config_item config_tab[] = {
GLOB_ITEM_INT("check_fup_sync", 0, 0, 1),
PORT_ITEM_INT("delayAsymmetry", 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("logAnnounceInterval", 1, INT8_MIN, INT8_MAX),
PORT_ITEM_INT("logMinDelayReqInterval", 0, INT8_MIN, INT8_MAX),
PORT_ITEM_INT("logMinPdelayReqInterval", 0, INT8_MIN, INT8_MAX),
Expand Down Expand Up @@ -271,13 +272,7 @@ static enum parser_result parse_pod_setting(const char *option,

enum parser_result r;

if (!strcmp(option, "follow_up_info")) {
r = get_ranged_int(value, &val, 0, 1);
if (r != PARSED_OK)
return r;
pod->follow_up_info = val;

} else if (!strcmp(option, "neighborPropDelayThresh")) {
if (!strcmp(option, "neighborPropDelayThresh")) {
r = get_ranged_uint(value, &uval, 0, UINT32_MAX);
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 follow_up_info;
int freq_est_interval; /*log seconds*/
struct fault_interval flt_interval_pertype[FT_CNT];
UInteger32 neighborPropDelayThresh; /*nanoseconds*/
Expand Down
10 changes: 6 additions & 4 deletions port.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ struct port {
Enumeration8 delayMechanism;
Integer8 logMinPdelayReqInterval;
UInteger32 neighborPropDelayThresh;
int follow_up_info;
int min_neighbor_prop_delay;
int path_trace_enabled;
enum fault_type last_fault_type;
Expand Down Expand Up @@ -654,7 +655,7 @@ static int port_sync_incapable(struct port *p)

static int port_is_ieee8021as(struct port *p)
{
return p->pod.follow_up_info ? 1 : 0;
return p->follow_up_info ? 1 : 0;
}

static void port_management_send_error(struct port *p, struct port *ingress,
Expand Down Expand Up @@ -1334,7 +1335,7 @@ static int port_tx_sync(struct port *p)
pdulen = sizeof(struct follow_up_msg);
fup->hwts.type = p->timestamping;

if (p->pod.follow_up_info)
if (p->follow_up_info)
pdulen += follow_up_info_append(p, fup);

fup->header.tsmt = FOLLOW_UP | p->transportSpecific;
Expand Down Expand Up @@ -1687,7 +1688,7 @@ static void process_follow_up(struct port *p, struct ptp_message *m)
if (memcmp(&master, &m->header.sourcePortIdentity, sizeof(master)))
return;

if (p->pod.follow_up_info) {
if (p->follow_up_info) {
struct follow_up_info_tlv *fui = follow_up_info_extract(m);
if (!fui)
return;
Expand Down Expand Up @@ -1861,7 +1862,7 @@ static void port_peer_delay(struct port *p)

p->peerMeanPathDelay = tmv_to_TimeInterval(p->peer_delay);

if (p->pod.follow_up_info)
if (p->follow_up_info)
port_nrate_calculate(p, t3c, t4);

if (p->state == PS_UNCALIBRATED || p->state == PS_SLAVE) {
Expand Down Expand Up @@ -2531,6 +2532,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->follow_up_info = config_get_int(cfg, p->name, "follow_up_info");
p->path_trace_enabled = config_get_int(cfg, p->name, "path_trace_enabled");
p->clock = clock;
p->trp = transport_create(cfg, interface->transport);
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 = {
.follow_up_info = 0,
.freq_est_interval = 1,
/* Default to very a large neighborPropDelay threshold */
.neighborPropDelayThresh = 20000000,
Expand Down

0 comments on commit becc626

Please sign in to comment.