Add a configuration file option for the 802.1AS gmCapable flag.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
d72e795727
commit
101e9dcc0e
6
config.c
6
config.c
|
@ -255,6 +255,12 @@ static enum parser_result parse_global_setting(const char *option,
|
||||||
dds->flags &= ~DDS_SLAVE_ONLY;
|
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")) {
|
} else if (!strcmp(option, "priority1")) {
|
||||||
r = get_ranged_uint(value, &uval, 0, UINT8_MAX);
|
r = get_ranged_uint(value, &uval, 0, UINT8_MAX);
|
||||||
if (r != PARSED_OK)
|
if (r != PARSED_OK)
|
||||||
|
|
2
gPTP.cfg
2
gPTP.cfg
|
@ -3,7 +3,7 @@
|
||||||
# Default Data Set
|
# Default Data Set
|
||||||
#
|
#
|
||||||
twoStepFlag 1
|
twoStepFlag 1
|
||||||
slaveOnly 0
|
gmCapable 1
|
||||||
priority1 248
|
priority1 248
|
||||||
priority2 248
|
priority2 248
|
||||||
domainNumber 0
|
domainNumber 0
|
||||||
|
|
7
ptp4l.8
7
ptp4l.8
|
@ -212,8 +212,15 @@ The default is 1 (enabled).
|
||||||
.TP
|
.TP
|
||||||
.B slaveOnly
|
.B slaveOnly
|
||||||
The local clock is a slave-only clock if enabled.
|
The local clock is a slave-only clock if enabled.
|
||||||
|
This option is only for use with 1588 clocks and should not be enabled
|
||||||
|
for 802.1AS clocks.
|
||||||
The default is 0 (disabled).
|
The default is 0 (disabled).
|
||||||
.TP
|
.TP
|
||||||
|
.B gmCapable
|
||||||
|
If this option is enabled, then the local clock is able to become grand master.
|
||||||
|
This is only for use with 802.1AS clocks and has no effect on 1588 clocks.
|
||||||
|
The default is 1 (enabled).
|
||||||
|
.TP
|
||||||
.B priority1
|
.B priority1
|
||||||
The priority1 attribute of the local clock. It is used in the best master
|
The priority1 attribute of the local clock. It is used in the best master
|
||||||
selection algorithm, lower values take precedence. Must be in the range 0 to
|
selection algorithm, lower values take precedence. Must be in the range 0 to
|
||||||
|
|
9
ptp4l.c
9
ptp4l.c
|
@ -284,7 +284,14 @@ int main(int argc, char *argv[])
|
||||||
if (config && (c = config_read(config, &cfg_settings))) {
|
if (config && (c = config_read(config, &cfg_settings))) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
if (ds->flags & DDS_SLAVE_ONLY) {
|
if (!cfg_settings.dds.grand_master_capable &&
|
||||||
|
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 ||
|
||||||
|
ds->flags & DDS_SLAVE_ONLY) {
|
||||||
ds->clockQuality.clockClass = 255;
|
ds->clockQuality.clockClass = 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue