Commit Graph

78 Commits (1b7088dea8a6f7077284d57d8294c5df28ad14c6)

Author SHA1 Message Date
Richard Cochran 7b438defe5 config: introduce a proper creation method.
Now that all of the legacy, open coded configuration fields are gone,
we can follow a normal create/destroy pattern for the configuration.
This patch add the new method and converts the programs to use it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:48:09 +02:00
Richard Cochran 13aec6d133 config: remove the last remaining legacy item.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:21:43 +02:00
Richard Cochran e27b036d09 config: convert 'uds_address' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran 852c288ebe config: convert 'p2p_dst_mac', letting it be a per-port option.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran a31f2d0ddf config: convert 'ptp_dst_mac', letting it be a per-port option.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran c05dcce724 config: introduce a string type.
Global default values will be static strings, but values from the
configuration file will be dynamic, so the code remembers whether or it
should free the string when cleaning up.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran 8836f3cc67 config: convert 'clock_servo' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran ed566513e0 config: convert 'time_stamping' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran b6a91303a9 config: convert 'delay_filter' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran a8b550887d config: convert 'tsproc_mode' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran bf29022005 config: convert 'delay_mechanism' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 3d1d93bcb2 config: convert 'network_transport' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran ea574c7e4f config: convert 'slaveOnly' and 'twoStepFlag' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 6fa42d3491 config: convert 'udp6_scope' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 0bb690c16c config: remove the 'port_defaults' structure.
This definition is now empty and can serve no purpose any more.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 38c891b2c8 config: clock, port: convert 'boundary_clock_jbod' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran eaa70f165f config: port: convert 'delay_filter_length' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 4c9c447429 config: convert 'ntpshm_segment' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 177a7104d5 config: convert 'pi_integral_norm_max' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 85c358ebe0 config: convert 'pi_integral_exponent' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 7533336234 config: convert 'pi_integral_scale' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran b57840cef9 config: convert 'pi_proportional_norm_max' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran d48c8ce8a5 config: convert 'pi_proportional_exponent' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 94048a2947 config: convert 'pi_proportional_scale' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 07b229907d config: convert 'pi_integral_const' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 25c903b0d2 config: convert 'pi_proportional_const' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran a7db9bad37 config: convert 'verbose' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran f5f77b182c config: convert 'use_syslog' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran caaf72c5ec config: convert 'logging_level' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran e8a2956ce0 config: convert the 'max_frequency' option to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 4f649b1ec4 config: convert the 'first_step_threshold' option to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran df578135d3 config: convert the 'step_threshold' option to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 28fbc390f6 config: add methods to set values taken from the command line.
This patch adds functions that will set and lock a certain value.  The
intended use of these methods is to give command line options priority
over the configuration file.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran a4329f7873 config: convert the 'check_fup_sync' option to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 42dda4d2b7 config: convert 'tx_timestamp_timeout' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 85bbf9d919 config: convert the 'assume_two_step' option to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran e7dbc068f6 config: introduce a new API for reading configuration settings.
This patch introduces generic code for adding and parsing new options.
The public 'get' methods return option values directly.  Although the
API is easy to use, it does not provide error checking in case the
option does not exist or if there is a type mismatch.

Therefore the code performs a BIST to ensure that the options are
properly populated.  In addition, the code terminates the program in
case of missing options or type mismatches.  This heavy handed
approach is meant to catch errors during development and should never
trigger during normal usage.

As a first element, we include an option for specifying the UDP TTL.

Users are required to call 'config_init', and so this patch add that into
all three programs, ptp4l, phc2sys and pmc.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:19 +02:00
Richard Cochran 8f5344eed9 config: Add a hash table into the data structure.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-16 11:20:23 +02:00
Miroslav Lichvar 06fcfe123c tsproc: add raw and weighting modes.
Add new time stamp processing modes to return raw delay and offset based
on the raw delay instead of the long-term filtered delay, and to return
also a weight of the sample. The weight is set to the ratio between the
two delays. This gives smaller weight to samples where the sync and/or
delay messages were delayed significantly in the network and possibly
include a large error.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2015-03-27 10:58:04 +01:00
Richard Cochran d70d38ade3 config: add a option to enable a poor man's boundary clock.
This patch adds a configuration option that allows running a boundary clock
using "just a bunch of devices". Normally each port is probed to make sure
they all share the same PTP hardware clock, but this option will allow a
heterogeneous collection of devices, should the user really want it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Jiri Benc <jbenc@redhat.com>
2014-12-16 21:33:23 +01:00
Miroslav Lichvar 48046e593e Don't include config.h in util.h
The config module is used by ptp4l only, but util is shared with other
programs.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-10-03 14:25:19 +02:00
Jiri Benc 5e0196d647 Dynamic allocation of interface config entries
Remove the limit of MAX_PORTS ports also when parsing command line
arguments.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
2014-09-21 13:15:59 +02:00
Miroslav Lichvar 9710fb1a22 Add new servo for NTP SHM reference clock.
This is a simple servo that provides the NTP SHM reference clock. It
doesn't make any clock adjustments and it always returns with the
unlocked state. It writes all samples to the SHM segment and another
process (e.g. chronyd or ntpd) is needed to read the samples and
actually synchronize the clock. The SHM segment number is set to the PTP
domain number to allow multiple SHM reference clocks running at the same
time.

This is mainly useful when other time sources are available on the
system (e.g. NTP, hardware reference clocks, or other PTP domains)
and a fallback to/from PTP is needed.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-06-14 10:49:04 +02:00
Miroslav Lichvar 5723da950f Remove unused field from struct config.
The sanity_freq_limit field was erroneously added to the config struct
in ed379b40, the right one is in the default_ds struct.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-06-12 11:24:39 +02:00
Miroslav Lichvar 31feb00194 Move PI step threshold and max frequency settings to common servo code.
These settings will be useful for all implemented servos, so move them
to the common servo code to avoid duplication. The configuration options
are renamed, but the they can be still set by their old names.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2014-03-14 09:52:39 +01:00
Miroslav Lichvar 85a1bcfa8e Add options to configure delay filter.
Add new options delay_filter and delay_filter_length to select the
filter and its length. They set both the clock delay filter and the port
peer delay filter. The default is now moving median with 10 samples.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-10-30 21:54:07 +01:00
Miroslav Lichvar ed379b4028 Add clock sanity check.
Check the sanity of the synchronized clock by comparing its uncorrected
frequency with the system monotonic clock. When the measured frequency
offset is larger than the value of the sanity_freq_limit option (20% by
default), a warning message will be printed and the servo will be reset.
Setting the option to zero disables the check.

This is useful to detect when the clock is broken or adjusted by another
program.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-10-27 08:24:01 +01:00
Richard Cochran 67b0386042 Extend the interface name length to allow any UDS address.
This patch increases the maximum length of an interface name to
accommodate a UNIX domain socket address of 108 bytes. (This value is
hard coded in the glibc headers, and so we cannot use the Linux kernel
header macro, UNIX_PATH_MAX.)

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-10-08 20:11:20 +02:00
Richard Cochran 9fe2ffd2ef Introduce a configuration file option for the server's UDS address.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-10-08 20:11:20 +02:00
Richard Cochran b7ebfab0cc Add a configuration file option for the extra sync-fup check.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-08-29 11:23:48 +02:00