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

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2015-08-15 13:23:45 +02:00
parent 3ff0e4a589
commit a19318b413
4 changed files with 6 additions and 11 deletions

View File

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

1
ds.h
View File

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

6
port.c
View File

@ -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 */
@ -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;
}
@ -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;
}
@ -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)

View File

@ -79,7 +79,6 @@ static struct config cfg_settings = {
},
.pod = {
.tx_timestamp_offset = 0,
.rx_timestamp_offset = 0,
},