The clockid parameter to the function to get the system clock's maximum
adjustment is redundant, so let us just remove it.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
When using software time stamping and a free running clock, the
statistics appear to be off by the TAI offset. This patch fixes the
issue by setting the internal UTC timescale flag in such cases.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Due to a bug in older kernels, frequency reading may silently fail and
return 0. Set the frequency to the read value to make sure the servo
has the actual frequency of the clock.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Add kernel_leap option for ptp4l and -x option for phc2sys to disable
setting of the STA_INS/STA_DEL bit to slowly correct the one-second
offset by servo.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Extend the clock_utc_correct function to handle leap seconds announced
in the time properties data set. With software time stamping, it sets the
STA_INS/STA_DEL bit for the system clock. Clock updates are suspended
in the last second of the day.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
New clock options should go into 'struct default_ds' so that we can avoid
growing clock_create indefinitely.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Add new options to ptp4l and phc2sys to print summary statistics of the
clock instead of the individual samples.
[ RC - Fix () function prototype with (void).
- Use unsigned for sample counter.
- Fix over-zealous line breaks. ]
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Change the label of the frequency offset in the clock messages printed
by ptp4l and phc2sys from "adj" to "freq" to indicate it's a frequency
value.
Also, modify clock_no_adjust() to print the frequency offset instead of
the ratio and use PRId64 instead of lld to print int64_t values.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
The clock_sync_interval() function is called when logSyncInterval
changes from zero. Call it also when the clock is created to have
fest.max_count set accordingly to freq_est_interval even with zero
logSyncInterval.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Now that there are clock/port_management_set functions, the IDs that
GETs are handled for, like DEFUALT_DATA_SET, still need to be in the
case for sending NOT_SUPPORTED errors.
Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
Adds port_management_send_error and clock_management_send_error to
avoid repeatedly checking the result of port_managment_send_error and
calling pr_err if it failed. Future patches send more mgmt errors so
this will avoid repeated code.
Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
Adds struct containing clock description info that will be needed for
USER_DESCRIPTION and CLOCK_DESCRIPTION management messages.
Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
If the port resets itself after detecting a fault, then the polling events
for that port are no longer valid. This patch fixes a latent bug that
would appear if a fault and another event were to happen simultaneously.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
A timeout of 15 seconds is not always acceptable, make it configurable.
By popular consensus, instead of using a linear number of seconds, use
the 2^N format for the time interval, just like the other intervals in
the PTP data sets. In addition to numeric values, let the configuration
file support 'ASAP' to have the fault reset immediately.
[RC - moved the handling of special case tmo=0 and added a break out
of the fd event loop in case the fds have been closed.
- changed the linear seconds option to log second instead.
- changed the commit message to reflect the final version. ]
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Arm the fault-clearing timer only when an event causes a port to change state
to PS_FAULTY. Previously, if poll() returned because of an fd event other than
the fault-clearing timeout, the fault clearing timer would re-arm for
each port in PS_FAULTY state.
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
Similarly to the servo in phc2sys, when clock is stepped, set
immediately also its frequency. This significantly improves the initial
convergence with large frequency offsets.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
The code previously treated all supported request as 'get' actions and
ignored the actual action field in the message. This commit makes the
code look at the action field when processing the requests.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reforming the data structure in this way will greatly simplify the
implementation of the management message for this data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reforming the data structure in this way will greatly simplify the
implementation of the management message for this data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reforming the data structure in this way will greatly simplify the
implementation of the management message for this data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.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>