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>
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>
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>
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>
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>
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>
This servo uses linear regression to estimate current time and
frequency error. The number of points used in the regression is
variable (from 4 to 64 in powers of 2) and is selected by a long-term
statistic of the prediction error.
Future improvements could include tracking of sudden frequency changes
(e.g. due to temperature variations), better stability of the error
statistic when a large offset is corrected, options to set the speed of
the adaptation, minimum and maximum number of points, or an option to
prefer frequency accuracy over time accuracy.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
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>
When peer delay is < min_neighbor_prop_delay the port is flagged
as non 802.1AS capable. min_neighbor_prop_delay defaults to -20ms.
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>