Commit Graph

524 Commits (46db4005895000d3ee97159c349ee6cd1dcf97a5)

Author SHA1 Message Date
Jacob Keller d67892abd7 ptp4l: modify servo setup to take an enum rather than string
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>
2012-09-29 06:24:43 +02: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
Richard Cochran 8f00d29265 Discover and utilize the initial clock frequency adjustment.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-22 11:30:50 +02:00
Richard Cochran 671358b21d Warn if a slave only node is selected by the bmc.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-22 11:30:50 +02:00
Richard Cochran 6ce135eaac Merge branch 'as2' 2012-09-20 12:59:27 +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
Delio Brignoli 1e6a169431 Do not expect or open a /dev/ptpX device when in free_running mode
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2012-09-15 10:59:49 +02:00
Richard Cochran 6c54c31dca Introduce the time status management message.
This non-portable, implementation specific message is designed to inform
external programs about the relationship between the local clock and the
remote master clock.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-12 17:44:20 +02:00
Richard Cochran f3b0ca69d3 trivial: fix a spelling error in a comment.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-12 17:30:37 +02:00
Richard Cochran 4e09ff8585 Introduce a helper function to convert from tmv to nanoseconds.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-12 17:30:37 +02:00
Richard Cochran d4e761138e bugfix: use a sensible test to detect a new master.
The code to detect a new master used pointer equality using a stale
pointer within the clock instance. Instead, the clock needs to remember
the identity of the foreign master in order to correctly detect a
change of master.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-12 17:30:36 +02:00
Miroslav Lichvar 9edd319f11 Use clock_adjtime from glibc if available.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-09-06 08:23:21 +02:00
Richard Cochran 7a50ead1d0 bugfix: correct wrong type for the cumulativeScaledRateOffset field.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-04 09:21:02 +02:00
Richard Cochran 8f5bd0edda Guard against divide by zero.
If a buggy driver or hardware delivers bogus time stamps, then we might
crash with a divide by zero exception.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-04 08:16:53 +02:00
Richard Cochran 35170cf6e4 Introduce a macro for the constant 2^41.
We are going to need this more than once for working with the
cumulativeScaledRateOffset fields.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-04 07:37:10 +02:00
Richard Cochran 8cc3433b8b Add an implementation specific management code.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-02 14:40:28 +02:00
Richard Cochran 5ca99377b6 Be tolerant of wrong a OUI in the follow up information.
Certain AVB bridges send their own OUI instead of the offical one.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-02 14:40:27 +02:00
Richard Cochran 8a4b2ab9b8 Remove unnecessary wait state from frequency estimator.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-02 14:40:27 +02:00
Richard Cochran 843661dfa2 Calculate the master/local rate ratio in two ways.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-02 14:40:07 +02:00
Richard Cochran e5edeacb9a Extract the follow up info and pass it to the clock.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-02 14:40:07 +02:00
Richard Cochran 94dd186cdf Add a clock method to receive the follow up information TLV.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-02 14:40:07 +02:00
Richard Cochran f38338827b Provide the clock with the estimated neighbor rate ratio.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-02 14:40:07 +02:00
Richard Cochran 5e40b5ec01 Estimate the neighbor rate ratio from a slaved port.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-02 14:40:07 +02:00
Richard Cochran f86997185e Give the frequency estimation interval to the port as well.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-02 14:40:07 +02:00
Richard Cochran c06f3adc84 Differentiate between the E2E and P2P delay timeout intervals.
We have one timer used for both delay request mechanisms, and we ought
to set the message interval accordingly.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-02 14:40:07 +02:00
Richard Cochran ace0d71a80 Adjust the peer delay request message interval field.
IEEE 802.1AS-2011 specifies using the current logMinPdelayReqInterval
for this field.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-02 14:40:06 +02:00
Richard Cochran db36fb52ca Reset the master/local frequency estimator when changing masters.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-02 14:40:06 +02:00
Richard Cochran 1bb8ebbdc5 Invert the frequency ratio estimation.
In 802.1AS-2011 the ratio is defined as master/local, so we should follow
suit.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-31 17:28:14 +02:00
Richard Cochran 829c785414 Rework the frequency ratio estimator to use the tmv functions.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-31 17:28:14 +02:00
Richard Cochran 95598b4fde Provide a conversion function from tmv to double.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-31 17:28:14 +02:00
Richard Cochran 845e947bcb Correct a comment about the frequency ratio estimation.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-31 17:28:14 +02:00
Richard Cochran 1925f07b3f Fix copy-pasto in config file parsing of the logging level.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-31 17:28:14 +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
Richard Cochran 41ffd8dfb8 Add an acknowledgment in the readme of the hardware donors.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-31 16:55:45 +02:00
Richard Cochran 28ac1cb1b1 Bring the readme up to date.
- all of the original goals have been implemented
- add gPTP to the list of supported features

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-30 14:55:35 +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 afd2a50b5b pmc: add a simple interactive help command.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-28 19:16:08 +02:00
Richard Cochran 81648e81ed Always set the clock class to 255 when slave only mode is configured.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-28 18:47:45 +02:00
Richard Cochran 852d587fd3 Drop the reference to best when freeing the foreign masters.
This fixes the following issue reported by valgrind, which occurs
after a port disable/initialize subsequent to having entered slave
mode.

==10651== Invalid read of size 4
==10651==    at 0x804E6E2: fc_clear (port.c:175)
==10651==    by 0x805132F: port_event (port.c:1352)
==10651==    by 0x804B383: clock_poll (clock.c:597)
==10651==    by 0x80498AE: main (ptp4l.c:278)
==10651==  Address 0x41cba60 is 16 bytes inside a block of size 60 free'd
==10651==    at 0x4023B6A: free (vg_replace_malloc.c:366)
==10651==    by 0x804EB09: free_foreign_masters (port.c:287)
==10651==    by 0x804FB14: port_disable (port.c:722)
==10651==    by 0x8051228: port_dispatch (port.c:1298)
==10651==    by 0x804B3C6: clock_poll (clock.c:602)
==10651==    by 0x80498AE: main (ptp4l.c:278)

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-28 07:51:04 +02:00
Miroslav Lichvar 2040933d74 Configure logging facility sooner.
Error messages from initialization were missing.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-08-27 21:20:08 +02:00