Commit Graph

416 Commits (09f8fe0e0b1225c9b2bd47d807dd6a7892a0732b)

Author SHA1 Message Date
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
Richard Cochran afbec38d6e Release all resources when quitting the main loop.
This will allow running under valgrind to detect memory leaks
and the like.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-27 21:11:14 +02:00
Richard Cochran 40dc2e13ef Make the clock release method a public function.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-27 21:09:59 +02:00
Richard Cochran 577d34facf Provide a method to release the message cache.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-27 21:09:10 +02:00
Richard Cochran 889c707ba1 Break out of the main loop on Control-C.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-27 21:07:38 +02:00
Richard Cochran 2b819b6b76 uds: fix bug in file descriptor array opening.
By not touching the event descriptor, uds is leaving the value as zero,
resulting in polling on stdin.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-27 21:05:34 +02:00
Richard Cochran 3936316468 Correct the TAI-UTC offset when it is reasonable to do so.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-27 18:57:43 +02:00
Richard Cochran 1bfb6fd217 Warn if the master's time properties are suspicious.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-26 20:36:43 +02:00
Richard Cochran d377229ab4 Update the hard coded TAI-UTC offset.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-26 18:48:54 +02:00