config: convert 'sanity_freq_limit' to the new scheme.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2015-08-15 14:37:24 +02:00
parent 0aff268a4e
commit 5277396b3a
4 changed files with 6 additions and 11 deletions

View File

@ -810,6 +810,7 @@ struct clock *clock_create(struct config *config, int phc_index,
struct interface *udsif = &c->uds_interface; struct interface *udsif = &c->uds_interface;
struct interface *iface; struct interface *iface;
struct timespec ts; struct timespec ts;
int sfl;
clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_REALTIME, &ts);
srandom(ts.tv_sec ^ ts.tv_nsec); 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"); pr_err("failed to create stats");
return NULL; return NULL;
} }
if (dds->sanity_freq_limit) { sfl = config_get_int(config, NULL, "sanity_freq_limit");
c->sanity_check = clockcheck_create(dds->sanity_freq_limit); if (sfl) {
c->sanity_check = clockcheck_create(sfl);
if (!c->sanity_check) { if (!c->sanity_check) {
pr_err("Failed to create clock sanity check"); pr_err("Failed to create clock sanity check");
return NULL; return NULL;

View File

@ -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_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_norm_max", 0.7, DBL_MIN, 1.0),
GLOB_ITEM_DBL("pi_proportional_scale", 0.0, 0.0, DBL_MAX), 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_DBL("step_threshold", 0.0, 0.0, DBL_MAX),
GLOB_ITEM_INT("summary_interval", 0, INT_MIN, INT_MAX), GLOB_ITEM_INT("summary_interval", 0, INT_MIN, INT_MAX),
PORT_ITEM_INT("syncReceiptTimeout", 0, 0, UINT8_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; return r;
dds->clockQuality.offsetScaledLogVariance = uval; 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")) { } else if (!strcmp(option, "ptp_dst_mac")) {
if (MAC_LEN != sscanf(value, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", if (MAC_LEN != sscanf(value, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
&mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5])) &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]))

1
ds.h
View File

@ -52,7 +52,6 @@ struct clock_description {
struct default_ds { struct default_ds {
struct defaultDS dds; struct defaultDS dds;
int sanity_freq_limit;
int time_source; int time_source;
struct clock_description clock_desc; struct clock_description clock_desc;
enum tsproc_mode tsproc_mode; enum tsproc_mode tsproc_mode;

View File

@ -52,7 +52,6 @@ static struct config cfg_settings = {
.priority2 = 128, .priority2 = 128,
.domainNumber = 0, .domainNumber = 0,
}, },
.sanity_freq_limit = 200000000,
.time_source = INTERNAL_OSCILLATOR, .time_source = INTERNAL_OSCILLATOR,
.clock_desc = { .clock_desc = {
.productDescription = { .productDescription = {
@ -246,7 +245,7 @@ int main(int argc, char *argv[])
} }
if (cfg_settings.clock_servo == CLOCK_SERVO_NTPSHM) { if (cfg_settings.clock_servo == CLOCK_SERVO_NTPSHM) {
config_set_int(cfg, "kernel_leap", 0); 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); print_set_progname(progname);