Commit Graph

83 Commits (f28a3b36649a31ea282a99f93129a187c5197a06)

Author SHA1 Message Date
Miroslav Lichvar ecbbf4cdb1 Move Unix domain sockets to /var/run.
According to FHS, /var/run is the right place for them.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-02-06 19:30:01 +01:00
Miroslav Lichvar 09fdc45220 phc2sys: Add option to set step threshold.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-02-06 19:30:01 +01:00
Richard Cochran f530ae9333 Hide the grandmaster port state.
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>
2013-02-06 13:34:49 +01:00
Miroslav Lichvar 74692bb1b0 phc2sys: include PTP management client.
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>
2013-02-03 19:08:34 +01:00
Miroslav Lichvar 24a1a6a81e phc2sys: allow PPS loop only with system clock.
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>
2013-01-18 07:11:19 +01:00
Miroslav Lichvar c5ce4ef764 phc2sys: read PHC with each PPS sample.
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>
2013-01-18 07:11:19 +01:00
Miroslav Lichvar f09b4bb7e3 phc2sys: remove unnecessary clock step with non-PPS loops.
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>
2013-01-16 20:28:22 +01:00
Miroslav Lichvar fc1a695493 phc2sys: don't zero clock frequency on start.
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>
2013-01-16 20:28:21 +01:00
Miroslav Lichvar 2d4b2f1640 phc2sys: move phc loop to its own function.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-01-16 20:28:21 +01:00
Miroslav Lichvar 627bc0fdf7 phc2sys: use servo code from ptp4l.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-01-16 20:28:21 +01:00
Miroslav Lichvar 3d4ff7882f phc2sys: check that specified interface has a PHC. 2012-12-18 18:52:02 +01:00
Miroslav Lichvar 84c7ac6b52 Fix -Wformat warnings. 2012-12-18 18:52:02 +01:00
Richard Cochran 39e8ee0642 Add command line options to print the software version.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-10 15:11:51 +01:00
Richard Cochran 4ef70c3d2e phc2sys: use the system offset method if available
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>
2012-11-29 17:43:51 +01:00
Jacob Keller 004b62d22b sk: change sk_interface_phc to sk_get_ts_info
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>
2012-11-14 20:22:10 +01:00
Miroslav Lichvar 1a83619b17 phc2sys: add option to set slave-master time offset.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-11-08 18:17:31 +01:00
Miroslav Lichvar 3d599e2d5d phc2sys: update help message.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-11-01 19:35:10 +01:00
Miroslav Lichvar d0714a9fac phc2sys: add selecting clock by name.
This allows synchronization of a PHC to the system clock.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-11-01 19:35:10 +01:00
Jacob Keller a0fc92957f phc2sys: add sk.o to phc2sys for sk_interface_phc
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>
2012-09-28 06:55:14 +02:00
Richard Cochran eb09fe01d7 phc2sys: refactor and rationalize the output messages.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-26 08:42:19 +02:00
Richard Cochran c890a4b935 phc2sys: disentangle the PPS loop from the read_phc loop.
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>
2012-09-25 20:09:58 +02:00
Richard Cochran 99d7c128a1 phc2sys: remove useless option.
The 'rdelay' option has been obsoleted by the newer read_phc() logic.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-25 20:09:58 +02:00
Richard Cochran 0ff2d47d61 phc2sys: remove unused variable.
The 'src' parameter to the do_servo() function is never used, so
remove it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-25 19:39:50 +02:00
Miroslav Lichvar ce6533fd75 phc2sys: fix operation without -s option.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-09-20 09:55:27 +02:00
Miroslav Lichvar 6330764538 phc2sys: add options for number of PHC readings and update rate 2012-08-31 17:14:55 +02:00
Miroslav Lichvar bf21c7c6a9 phc2sys: improve servo start up 2012-08-31 17:14:55 +02:00
Miroslav Lichvar d42914c335 Improve stability of PHC reading in phc2sys.
Make five PHC readings in sequence and pick the quickest one.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-08-30 14:48:32 +02:00
Miroslav Lichvar 2fcf5cbb4f Add non-PPS mode to phc2sys.
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>
2012-08-30 14:47:01 +02:00
Richard Cochran be87b05f52 Revert "Add non-PPS mode to phc2sys."
This reverts commit 998093b6f7.
Will apply this patch again, with the correct author info.
2012-08-30 14:45:50 +02:00
Richard Cochran 0a5caa8476 Revert "Improve stability of PHC reading in phc2sys."
This reverts commit f08d264e1d.
Will apply this patch again, with the correct author info.
2012-08-30 14:44:46 +02:00
Richard Cochran f08d264e1d Improve stability of PHC reading in phc2sys.
Make five PHC readings in sequence and pick the quickest one.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-08-29 15:29:56 +02:00
Richard Cochran 998093b6f7 Add non-PPS mode to phc2sys.
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>
2012-08-29 15:29:43 +02:00
Richard Cochran af3cbb5fbd Add a tool to synchronize the system time from a PTP hardware clock.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-24 19:12:57 +01:00