diff --git a/clock.c b/clock.c index 1d5e2b6..ee20a3c 100644 --- a/clock.c +++ b/clock.c @@ -810,6 +810,7 @@ struct clock *clock_create(struct config *config, int phc_index, struct interface *udsif = &c->uds_interface; struct interface *iface; struct timespec ts; + int sfl; clock_gettime(CLOCK_REALTIME, &ts); srandom(ts.tv_sec ^ ts.tv_nsec); @@ -890,8 +891,9 @@ struct clock *clock_create(struct config *config, int phc_index, pr_err("failed to create stats"); return NULL; } - if (dds->sanity_freq_limit) { - c->sanity_check = clockcheck_create(dds->sanity_freq_limit); + sfl = config_get_int(config, NULL, "sanity_freq_limit"); + if (sfl) { + c->sanity_check = clockcheck_create(sfl); if (!c->sanity_check) { pr_err("Failed to create clock sanity check"); return NULL; diff --git a/config.c b/config.c index 3ad052f..1007a27 100644 --- a/config.c +++ b/config.c @@ -123,6 +123,7 @@ struct config_item config_tab[] = { GLOB_ITEM_DBL("pi_proportional_exponent", -0.3, -DBL_MAX, DBL_MAX), GLOB_ITEM_DBL("pi_proportional_norm_max", 0.7, DBL_MIN, 1.0), GLOB_ITEM_DBL("pi_proportional_scale", 0.0, 0.0, DBL_MAX), + GLOB_ITEM_INT("sanity_freq_limit", 200000000, 0, INT_MAX), GLOB_ITEM_DBL("step_threshold", 0.0, 0.0, DBL_MAX), GLOB_ITEM_INT("summary_interval", 0, INT_MIN, INT_MAX), PORT_ITEM_INT("syncReceiptTimeout", 0, 0, UINT8_MAX), @@ -452,12 +453,6 @@ static enum parser_result parse_global_setting(const char *option, return r; dds->clockQuality.offsetScaledLogVariance = uval; - } else if (!strcmp(option, "sanity_freq_limit")) { - r = get_ranged_int(value, &val, 0, INT_MAX); - if (r != PARSED_OK) - return r; - cfg->dds.sanity_freq_limit = val; - } else if (!strcmp(option, "ptp_dst_mac")) { if (MAC_LEN != sscanf(value, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5])) diff --git a/ds.h b/ds.h index 1f48cc1..505dc76 100644 --- a/ds.h +++ b/ds.h @@ -52,7 +52,6 @@ struct clock_description { struct default_ds { struct defaultDS dds; - int sanity_freq_limit; int time_source; struct clock_description clock_desc; enum tsproc_mode tsproc_mode; diff --git a/ptp4l.c b/ptp4l.c index 43a5523..fcddd99 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -52,7 +52,6 @@ static struct config cfg_settings = { .priority2 = 128, .domainNumber = 0, }, - .sanity_freq_limit = 200000000, .time_source = INTERNAL_OSCILLATOR, .clock_desc = { .productDescription = { @@ -246,7 +245,7 @@ int main(int argc, char *argv[]) } if (cfg_settings.clock_servo == CLOCK_SERVO_NTPSHM) { config_set_int(cfg, "kernel_leap", 0); - cfg_settings.dds.sanity_freq_limit = 0; + config_set_int(cfg, "sanity_freq_limit", 0); } print_set_progname(progname);