diff --git a/clock.c b/clock.c index 0856f81..73cf016 100644 --- a/clock.c +++ b/clock.c @@ -819,7 +819,9 @@ struct clock *clock_create(struct config *config, int phc_index, snprintf(udsif->name, sizeof(udsif->name), "%s", uds_path); udsif->transport = TRANS_UDS; - udsif->delay_filter_length = 1; + if (config_set_section_int(config, udsif->name, "delay_filter_length", 1)) { + return NULL; + } c->config = config; c->free_running = dds->free_running; @@ -874,7 +876,7 @@ 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, - dds->delay_filter_length); + config_get_int(config, NULL, "delay_filter_length")); if (!c->tsproc) { pr_err("Failed to create time stamp processor"); return NULL; diff --git a/config.c b/config.c index b3ca2b9..f9d5777 100644 --- a/config.c +++ b/config.c @@ -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("delay_filter_length", 10, 1, 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), @@ -355,12 +356,6 @@ static enum parser_result parse_port_setting(struct config *cfg, else return BAD_VALUE; - } else if (!strcmp(option, "delay_filter_length")) { - r = get_ranged_int(value, &val, 1, INT_MAX); - if (r != PARSED_OK) - return r; - iface->delay_filter_length = val; - } else if (!strcmp(option, "boundary_clock_jbod")) { r = get_ranged_int(value, &val, 0, 1); if (r != PARSED_OK) @@ -611,12 +606,6 @@ static enum parser_result parse_global_setting(const char *option, else return BAD_VALUE; - } else if (!strcmp(option, "delay_filter_length")) { - r = get_ranged_int(value, &val, 1, INT_MAX); - if (r != PARSED_OK) - return r; - cfg->dds.delay_filter_length = val; - } else if (!strcmp(option, "boundary_clock_jbod")) { r = get_ranged_int(value, &val, 0, 1); if (r != PARSED_OK) @@ -810,7 +799,6 @@ void config_init_interface(struct interface *iface, struct config *cfg) sk_get_ts_info(iface->name, &iface->ts_info); iface->delay_filter = cfg->dds.delay_filter; - iface->delay_filter_length = cfg->dds.delay_filter_length; iface->boundary_clock_jbod = cfg->dds.boundary_clock_jbod; } diff --git a/config.h b/config.h index c1ada46..df7b733 100644 --- a/config.h +++ b/config.h @@ -41,7 +41,6 @@ struct interface { struct sk_ts_info ts_info; enum tsproc_mode tsproc_mode; enum filter_type delay_filter; - int delay_filter_length; int boundary_clock_jbod; }; diff --git a/ds.h b/ds.h index 678136f..30d33d8 100644 --- a/ds.h +++ b/ds.h @@ -61,7 +61,6 @@ struct default_ds { struct clock_description clock_desc; enum tsproc_mode tsproc_mode; enum filter_type delay_filter; - int delay_filter_length; int boundary_clock_jbod; }; diff --git a/port.c b/port.c index b527492..ba3108d 100644 --- a/port.c +++ b/port.c @@ -2553,7 +2553,7 @@ struct port *port_open(int phc_index, p->tsproc = tsproc_create(interface->tsproc_mode, interface->delay_filter, - interface->delay_filter_length); + config_get_int(cfg, p->name, "delay_filter_length")); if (!p->tsproc) { pr_err("Failed to create time stamp processor"); goto err_transport; diff --git a/ptp4l.c b/ptp4l.c index b7a1ef1..c68fd60 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -74,7 +74,6 @@ static struct config cfg_settings = { }, .tsproc_mode = TSPROC_FILTER, .delay_filter = FILTER_MOVING_MEDIAN, - .delay_filter_length = 10, .boundary_clock_jbod = 0, },