Skip to content

Commit

Permalink
config: convert 'gmCapable' to the new scheme.
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Cochran <[email protected]>
  • Loading branch information
richardcochran committed Aug 23, 2015
1 parent 5eeea13 commit 2816133
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ struct clock *clock_create(struct config *config, int phc_index,
c->config = config;
c->free_running = config_get_int(config, NULL, "free_running");
c->freq_est_interval = config_get_int(config, NULL, "freq_est_interval");
c->grand_master_capable = dds->grand_master_capable;
c->grand_master_capable = config_get_int(config, NULL, "gmCapable");
c->kernel_leap = dds->kernel_leap;
c->utc_offset = CURRENT_UTC_OFFSET;
c->time_source = dds->time_source;
Expand Down
7 changes: 1 addition & 6 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ struct config_item config_tab[] = {
PORT_ITEM_INT("follow_up_info", 0, 0, 1),
GLOB_ITEM_INT("free_running", 0, 0, 1),
PORT_ITEM_INT("freq_est_interval", 1, 0, INT_MAX),
GLOB_ITEM_INT("gmCapable", 1, 0, 1),
PORT_ITEM_INT("ingressLatency", 0, INT_MIN, INT_MAX),
PORT_ITEM_INT("logAnnounceInterval", 1, INT8_MIN, INT8_MAX),
PORT_ITEM_INT("logMinDelayReqInterval", 0, INT8_MIN, INT8_MAX),
Expand Down Expand Up @@ -412,12 +413,6 @@ static enum parser_result parse_global_setting(const char *option,
dds->flags &= ~DDS_SLAVE_ONLY;
}

} else if (!strcmp(option, "gmCapable")) {
r = get_ranged_int(value, &val, 0, 1);
if (r != PARSED_OK)
return r;
cfg->dds.grand_master_capable = val;

} else if (!strcmp(option, "priority1")) {
r = get_ranged_uint(value, &uval, 0, UINT8_MAX);
if (r != PARSED_OK)
Expand Down
1 change: 0 additions & 1 deletion ds.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ struct clock_description {

struct default_ds {
struct defaultDS dds;
int grand_master_capable; /*802.1AS only*/
int stats_interval; /*log seconds*/
int kernel_leap;
int sanity_freq_limit;
Expand Down
5 changes: 2 additions & 3 deletions ptp4l.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ static struct config cfg_settings = {
.priority2 = 128,
.domainNumber = 0,
},
.grand_master_capable = 1,
.stats_interval = 0,
.kernel_leap = 1,
.sanity_freq_limit = 200000000,
Expand Down Expand Up @@ -237,13 +236,13 @@ int main(int argc, char *argv[])
sk_check_fupsync = config_get_int(cfg, NULL, "check_fup_sync");
sk_tx_timeout = config_get_int(cfg, NULL, "tx_timestamp_timeout");

if (!cfg_settings.dds.grand_master_capable &&
if (!config_get_int(cfg, NULL, "gmCapable") &&
ds->flags & DDS_SLAVE_ONLY) {
fprintf(stderr,
"Cannot mix 1588 slaveOnly with 802.1AS !gmCapable.\n");
return -1;
}
if (!cfg_settings.dds.grand_master_capable ||
if (!config_get_int(cfg, NULL, "gmCapable") ||
ds->flags & DDS_SLAVE_ONLY) {
ds->clockQuality.clockClass = 255;
}
Expand Down

0 comments on commit 2816133

Please sign in to comment.