Modify the pmc to allow non-blocking operation. Run it on each clock
update to have the sync offset updated from currentUtcOffset with every
other call.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.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>
If the delay is known, print it together with the offset and frequency.
Remove the time stamp from the output to fit it into 80 chars.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.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>
Use pr_* functions to print messages and add -m, -q, -l options to allow
configuration of the printing level and where should be the messages sent.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
There really is no such state, but there probably should have been one.
In any case, we do have one just to make the code simpler, but this should
not appear in the management responses. This patch fixes the issue by
covering over our tracks before sending a response.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Add a new option to wait for ptp4l to be in a synchronized state.
Periodically check PORT_DATA_SET and wait until there is a port in
SLAVE, MASTER or GRAND_MASTER state. Also, set the default
synchronization offset according to the currentUtcOffset value from
TIME_PROPERTIES_DATA_SET and the direction of the clock synchronization.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
The PPS time stamps are always made by the system clock, don't allow
running the PPS loop with other clocks.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
In the PPS loop, instead of setting the system clock from the PHC only
once on start, read PHC with each PPS sample and use the time stamp to
get the whole number of seconds in the offset. This will prevent phc2sys
from losing track of the system clock.
Also, check if the PPS is synchronized to the PHC.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
With non-PPS loops let the servo make the inital correction. Move the
code to the PPS loop and change it to use the sample filtering to reduce
the error in the initial correction.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Instead of always starting at zero frequency offset, read the currently
stored value on start and pass it to the servo. As the read may silently
fail and return zero, set the clock frequency back to the read value to
make sure it's always equal to the actual frequency of the clock.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
We use the PTP_SYS_OFFSET ioctl method in preference to doing
clock_gettime from user space, the assumption being that the kernel space
measurement will always be more accurate.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
this patch changes sk_interface_phc to sk_get_ts_info, by allowing the function
to store all the data returned by Ethtool's get_ts_info IOCTL in a struct. A new
struct "sk_ts_info" contains the same data as well as a field for specifying the
structure as valid (in order to support old kernels without the IOCTL). The
valid field should be set only when the IOCTL successfully populates the fields.
A follow-on patch will add new functionality possible because of these
changes. This patch only updates the programs which use the call to perform the
minimum they already do, using the new interface.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
This patch adds support for sk_interface_phc to lookup the /dev/ptpX device
using ethtool's get_ts_info ioctl
-v2-
* set ethdev to null initially
* rebased on top of phc2sys changes
-v3-
* fixed typo regarding slash
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
The main loop has become a bit messy, mixing two completely disjunct code
paths. This patch separates the two use cases for the sake of clarity.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
As some PHC hardware/drivers don't provide PPS, it may be useful to keep the
system clock synchronized to PHC via clock_gettime(). While the precision
of the clock is only in microsecond range, the error seems to be quite stable.
The -d parameter now can be omitted if -s is provided.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
As some PHC hardware/drivers don't provide PPS, it may be useful to keep the
system clock synchronized to PHC via clock_gettime(). While the precision
of the clock is only in microsecond range, the error seems to be quite stable.
The -d parameter now can be omitted if -s is provided.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>