This commit adds functionality to increase the sync and pdelay request
intervals once gptp synchronization has been achieved. This is useful
while running Automotive Profile where the network is usually static.
Here, we are assuming that the gPTP synchronization is achieved whenever
the last 'n' offsets calculated using the Sync messages are below a
certain threshold. Both, the number of offsets to consider and the offset
threshold are configurable.
In order to support the interval update, a new clock servo state
CLOCK_SERVO_STABLE has been added. The clock will transition to this
state whenever the above condition is satisfied. When this transition
occurs, the slave will send an "interval request" signaling message
asking the master to change the sync interval. It will also update the
pdelay request interval locally.
Four new config options have been added to provide this functionality:
- servo_offset_threshold: All the offset values being considered should
be below this value.
- servo_num_offset_values: number of previously received offset values
to consider.
- operLogSyncInterval: slave will ask the master to switch to this
interval for sending sync messages when the offset stabilizes.
- operLogPdelayReqInterval: the slave will set this interval for pdelay
request messages when the offset stabilizes.
Signed-off-by: Vedang Patel <vedang.patel@intel.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>
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>
Introduce a new function to inform the servo about upcoming leap second.
This is used when the kernel leap is disabled to allow the servo to
handle better the sudden 1 second step in the offset when the leap
second is inserted or deleted.
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>
With the new linreg servo the frequency offset and time offset are
controlled separately. The ratio between master's frequency and the
current frequency of the local clock is known and can be used when
calculating delay or peer delay to improve their accuracy.
This greatly improves the stability of the delay when the servo is
correcting a large offset.
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>
This patch adds a new servo method to let the algorithm know about the
master clock's reported sync message interval. This information can be
used by the servo to adapt its synchronization parameters.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Current date stored in nanoseconds doesn't fit in 64-bit double format.
Keep the offset and the time stamp in integer nanoseconds.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
passing a string as the servo type seems ugly when there are only a few
choices. This patch modifies the servo_create to take an enum instead.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
If software time stamping is to be used, then the servo will want to
have appropriate filtering.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>