Add option to set NTP SHM segment number.

Instead of setting it to the PTP domain number, add a new option to
ptp4l and phc2sys to set it as needed. The default value is 0. This
allows multiple ptp4l/phc2sys instances running in the same domain.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
master
Miroslav Lichvar 2014-07-09 16:25:08 +02:00 committed by Richard Cochran
parent 1773d21f26
commit 3760f8b653
6 changed files with 23 additions and 4 deletions

View File

@ -284,7 +284,6 @@ static enum parser_result parse_global_setting(const char *option,
if (r != PARSED_OK)
return r;
dds->domainNumber = uval;
*cfg->ntpshm_segment = uval;
} else if (!strcmp(option, "clockClass")) {
r = get_ranged_uint(value, &uval, 0, UINT8_MAX);
@ -408,6 +407,12 @@ static enum parser_result parse_global_setting(const char *option,
return r;
cfg->dds.sanity_freq_limit = val;
} else if (!strcmp(option, "ntpshm_segment")) {
r = get_ranged_int(value, &val, INT_MIN, INT_MAX);
if (r != PARSED_OK)
return r;
*cfg->ntpshm_segment = 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]))

View File

@ -53,6 +53,7 @@ first_step_threshold 0.00002
max_frequency 900000000
clock_servo pi
sanity_freq_limit 200000000
ntpshm_segment 0
#
# Transport options
#

View File

@ -53,6 +53,7 @@ first_step_threshold 0.00002
max_frequency 900000000
clock_servo pi
sanity_freq_limit 200000000
ntpshm_segment 0
#
# Transport options
#

View File

@ -116,7 +116,7 @@ option.
Specify which clock servo should be used. Valid values are pi for a PI
controller, linreg for an adaptive controller using linear regression, and
ntpshm for the NTP SHM reference clock to allow another process to synchronize
the local clock (the SHM segment number is set to the domain number).
the local clock.
The default is pi.
.TP
.BI \-P " kp"
@ -166,6 +166,10 @@ the synchronized clock. When a larger offset is measured, a warning message
will be printed and the servo will be reset. When set to 0, the sanity check is
disabled. The default is 200000000 (20%).
.TP
.BI \-M " segment"
The number of the SHM segment used by ntpshm servo.
The default is 0.
.TP
.BI \-u " summary-updates"
Specify the number of clock updates included in summary statistics. The
statistics include offset root mean square (RMS), maximum absolute offset,

View File

@ -1159,6 +1159,7 @@ static void usage(char *progname)
" -R [rate] slave clock update rate in HZ (1.0)\n"
" -N [num] number of master clock readings per update (5)\n"
" -L [limit] sanity frequency limit in ppb (200000000)\n"
" -M [num] NTP SHM segment number (0)\n"
" -u [num] number of clock updates in summary stats (0)\n"
" -n [num] domain number (0)\n"
" -x apply leap seconds by servo instead of kernel\n"
@ -1199,7 +1200,7 @@ int main(int argc, char *argv[])
progname = strrchr(argv[0], '/');
progname = progname ? 1+progname : argv[0];
while (EOF != (c = getopt(argc, argv,
"arc:d:s:E:P:I:S:F:R:N:O:L:i:u:wn:xz:l:mqvh"))) {
"arc:d:s:E:P:I:S:F:R:N:O:L:M:i:u:wn:xz:l:mqvh"))) {
switch (c) {
case 'a':
autocfg = 1;
@ -1276,6 +1277,10 @@ int main(int argc, char *argv[])
if (get_arg_val_i(c, optarg, &node.sanity_freq_limit, 0, INT_MAX))
return -1;
break;
case 'M':
if (get_arg_val_i(c, optarg, &ntpshm_segment, INT_MIN, INT_MAX))
return -1;
break;
case 'u':
if (get_arg_val_ui(c, optarg, &node.stats_max_count,
0, UINT_MAX))
@ -1287,7 +1292,6 @@ int main(int argc, char *argv[])
case 'n':
if (get_arg_val_i(c, optarg, &domain_number, 0, 255))
return -1;
ntpshm_segment = domain_number;
break;
case 'x':
node.kernel_leap = 0;

View File

@ -376,6 +376,10 @@ the synchronized clock. When a larger offset is measured, a warning message
will be printed and the servo will be reset. When set to 0, the sanity check is
disabled. The default is 200000000 (20%).
.TP
.B ntpshm_segment
The number of the SHM segment used by ntpshm servo.
The default is 0.
.TP
.B ptp_dst_mac
The MAC address where should be PTP messages sent.
Relevant only with L2 transport. The default is 01:1B:19:00:00:00.