Skip to content

Commit

Permalink
config: port: convert 'egressLatency' 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 3ff0e4a commit a19318b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
9 changes: 2 additions & 7 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ struct config_item config_tab[] = {
GLOB_ITEM_INT("assume_two_step", 0, 0, 1),
GLOB_ITEM_INT("check_fup_sync", 0, 0, 1),
PORT_ITEM_INT("delayAsymmetry", 0, INT_MIN, INT_MAX),
PORT_ITEM_INT("egressLatency", 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("freq_est_interval", 1, 0, INT_MAX),
Expand Down Expand Up @@ -273,13 +274,7 @@ static enum parser_result parse_pod_setting(const char *option,
int val;
enum parser_result r;

if (!strcmp(option, "egressLatency")) {
r = get_ranged_int(value, &val, INT_MIN, INT_MAX);
if (r != PARSED_OK)
return r;
pod->tx_timestamp_offset = val;

} else if (!strcmp(option, "ingressLatency")) {
if (!strcmp(option, "ingressLatency")) {
r = get_ranged_int(value, &val, INT_MIN, INT_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 {

struct port_defaults {
struct fault_interval flt_interval_pertype[FT_CNT];
int tx_timestamp_offset; /*nanoseconds*/
int rx_timestamp_offset; /*nanoseconds*/
};

Expand Down
6 changes: 4 additions & 2 deletions port.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ struct port {
int freq_est_interval;
int min_neighbor_prop_delay;
int path_trace_enabled;
int tx_timestamp_offset;
enum fault_type last_fault_type;
unsigned int versionNumber; /*UInteger4*/
/* foreignMasterDS */
Expand Down Expand Up @@ -521,7 +522,7 @@ static int peer_prepare_and_send(struct port *p, struct ptp_message *msg,
return -1;
}
if (msg_sots_valid(msg)) {
ts_add(&msg->hwts.ts, p->pod.tx_timestamp_offset);
ts_add(&msg->hwts.ts, p->tx_timestamp_offset);
}
return 0;
}
Expand Down Expand Up @@ -2311,7 +2312,7 @@ int port_prepare_and_send(struct port *p, struct ptp_message *msg, int event)
return -1;
}
if (msg_sots_valid(msg)) {
ts_add(&msg->hwts.ts, p->pod.tx_timestamp_offset);
ts_add(&msg->hwts.ts, p->tx_timestamp_offset);
}
return 0;
}
Expand Down Expand Up @@ -2536,6 +2537,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->tx_timestamp_offset = config_get_int(cfg, p->name, "egressLatency");
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 @@ -79,7 +79,6 @@ static struct config cfg_settings = {
},

.pod = {
.tx_timestamp_offset = 0,
.rx_timestamp_offset = 0,
},

Expand Down

0 comments on commit a19318b

Please sign in to comment.