config: convert 'tsproc_mode' to the new scheme.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2015-08-15 21:20:19 +02:00
parent bf29022005
commit a8b550887d
6 changed files with 13 additions and 30 deletions

View File

@ -879,7 +879,8 @@ struct clock *clock_create(struct config *config, int phc_index,
}
c->servo_state = SERVO_UNLOCKED;
c->servo_type = servo;
c->tsproc = tsproc_create(dds->tsproc_mode, dds->delay_filter,
c->tsproc = tsproc_create(config_get_int(config, NULL, "tsproc_mode"),
dds->delay_filter,
config_get_int(config, NULL, "delay_filter_length"));
if (!c->tsproc) {
pr_err("Failed to create time stamp processor");

View File

@ -124,6 +124,14 @@ static struct config_enum nw_trans_enu[] = {
{ NULL, 0 },
};
static struct config_enum tsproc_enu[] = {
{ "filter", TSPROC_FILTER },
{ "raw", TSPROC_RAW },
{ "filter_weight", TSPROC_FILTER_WEIGHT },
{ "raw_weight", TSPROC_RAW_WEIGHT },
{ NULL, 0 },
};
struct config_item config_tab[] = {
PORT_ITEM_INT("announceReceiptTimeout", 3, 2, UINT8_MAX),
GLOB_ITEM_INT("assume_two_step", 0, 0, 1),
@ -174,6 +182,7 @@ struct config_item config_tab[] = {
PORT_ITEM_INT("syncReceiptTimeout", 0, 0, UINT8_MAX),
GLOB_ITEM_INT("timeSource", INTERNAL_OSCILLATOR, 0x10, 0xfe),
PORT_ITEM_INT("transportSpecific", 0, 0, 0x0F),
PORT_ITEM_ENU("tsproc_mode", TSPROC_FILTER, tsproc_enu),
GLOB_ITEM_INT("twoStepFlag", 1, 0, 1),
GLOB_ITEM_INT("tx_timestamp_timeout", 1, 1, INT_MAX),
PORT_ITEM_INT("udp_ttl", 1, 1, 255),
@ -375,19 +384,7 @@ static enum parser_result parse_port_setting(struct config *cfg,
if (r != NOT_PARSED)
return r;
if (!strcmp(option, "tsproc_mode")) {
if (!strcasecmp("filter", value))
iface->tsproc_mode = TSPROC_FILTER;
else if (!strcasecmp("raw", value))
iface->tsproc_mode = TSPROC_RAW;
else if (!strcasecmp("filter_weight", value))
iface->tsproc_mode = TSPROC_FILTER_WEIGHT;
else if (!strcasecmp("raw_weight", value))
iface->tsproc_mode = TSPROC_RAW_WEIGHT;
else
return BAD_VALUE;
} else if (!strcmp(option, "delay_filter")) {
if (!strcmp(option, "delay_filter")) {
if (!strcasecmp("moving_average", value))
iface->delay_filter = FILTER_MOVING_AVERAGE;
else if (!strcasecmp("moving_median", value))
@ -491,18 +488,6 @@ static enum parser_result parse_global_setting(const char *option,
for (i = 0; i < OUI_LEN; i++)
cfg->dds.clock_desc.manufacturerIdentity[i] = oui[i];
} else if (!strcmp(option, "tsproc_mode")) {
if (!strcasecmp("filter", value))
cfg->dds.tsproc_mode = TSPROC_FILTER;
else if (!strcasecmp("raw", value))
cfg->dds.tsproc_mode = TSPROC_RAW;
else if (!strcasecmp("filter_weight", value))
cfg->dds.tsproc_mode = TSPROC_FILTER_WEIGHT;
else if (!strcasecmp("raw_weight", value))
cfg->dds.tsproc_mode = TSPROC_RAW_WEIGHT;
else
return BAD_VALUE;
} else if (!strcmp(option, "delay_filter")) {
if (!strcasecmp("moving_average", value))
cfg->dds.delay_filter = FILTER_MOVING_AVERAGE;

View File

@ -36,7 +36,6 @@ struct interface {
STAILQ_ENTRY(interface) list;
char name[MAX_IFNAME_SIZE + 1];
struct sk_ts_info ts_info;
enum tsproc_mode tsproc_mode;
enum filter_type delay_filter;
};

1
ds.h
View File

@ -53,7 +53,6 @@ struct clock_description {
struct default_ds {
struct defaultDS dds;
struct clock_description clock_desc;
enum tsproc_mode tsproc_mode;
enum filter_type delay_filter;
};

2
port.c
View File

@ -2565,7 +2565,7 @@ struct port *port_open(int phc_index,
p->flt_interval_pertype[FT_UNSPECIFIED].val =
config_get_int(cfg, p->name, "fault_reset_interval");
p->tsproc = tsproc_create(interface->tsproc_mode,
p->tsproc = tsproc_create(config_get_int(cfg, p->name, "tsproc_mode"),
interface->delay_filter,
config_get_int(cfg, p->name, "delay_filter_length"));
if (!p->tsproc) {

View File

@ -57,7 +57,6 @@ static struct config cfg_settings = {
.userDescription = { .max_symbols = 128 },
.manufacturerIdentity = { 0, 0, 0 },
},
.tsproc_mode = TSPROC_FILTER,
.delay_filter = FILTER_MOVING_MEDIAN,
},