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>
In the near future, the transports will need to consult the configuration
database in order to obtain various options. This patch also introduces
the idea of a configuration file into the phc2sys and pmc programs.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This function allows the ports to read configuration variables without
changing the port method signatures.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This will help us to simplify the passing of parameters between the main
program. clock, and ports.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
When running with Synchronous Ethernet (SyncE), the correct clock
frequency is provided by the link partner. In this case, only the
offset needs correcting.
This patch provides SyncE nodes with an way to keep the frequency
correction dialed to zero.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch lets the pmc program change the priority1 and priority2
elements of the "default data set" at run time.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch adds support for changing the priority1 and priority2
elements of the "default data set" at run time.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Instead of killing the whole process group, which may contain other
processes than timemaster and its children (e.g. when it is started from
a shell script), save the PIDs and kill the processes individually.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Add weight parameter to the sample function. Samples with smaller weight
are less reliable, they can be ignored by the servo or the adjustments
of the clock can be smaller.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.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>
Introduce a time stamp processor for offset/delay calculations and use
it in the clock and port modules.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Convert time stamps to tmv_t and apply all corrections before passing
them to clock/port functions to reduce the number of parameters.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
When no source is found in the automatic mode and a clock is selected as
the default source, set its state temporarily to slave to prevent the
clock from being synchronized to itself and drifting quickly away.
Also, don't use this mode with only one PTP clock and don't include the
system clock.
This fixes phc2sys with SHM servo (e.g. used by timemaster).
In ntp-4.2.8p1 the segment access was made configurable with the
refclock mode option. Set the mode to 1 to create all SHM segments
with owner-only access.