Commit Graph

977 Commits (992e29205528414cdd8fd7e8415a3493676f022b)

Author SHA1 Message Date
Delio Brignoli da594e78d9 Make the fault reset interval a per-port configuration parameter.
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>
2013-02-03 17:53:33 +01:00
Delio Brignoli eec07ae240 Fix fault-clearing timer being erroneously re-armed
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>
2013-01-30 18:05:38 +01:00
Richard Cochran 285b88ade4 Let a port become 'capable' according to 802.1AS.
This patch implements the capable flag as follows.

1. After calculating the neighbor rate, we are capable.
2. If we miss too many responses, we are incapable.
3. If we get multiple responses, we throw a fault,
   and so we are also incapable.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-01-27 20:58:19 +01:00
Richard Cochran b9aae07f87 Add another Intel driver into the driver support matrix.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-01-27 20:58:19 +01:00
Richard Cochran ea833f3d6b Add a default of 'incapable' for 802.1AS mode.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-01-27 20:58:19 +01:00
Richard Cochran ad8a197a0b Add port logic for the 'capable' flag from 802.1AS.
This commit only provides helper functions that will implement the effect
of a port being not capable. We let the port be always 'capable' for now,
until we actually have added the details of that flag.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-01-27 20:58:19 +01:00
Richard Cochran 90f791d881 Introduce a test for running in 802.1AS mode.
We use the follow_up_info to control behavior that is specific to the
802.1AS standard. In several instances, that standard goes against the
1588 standard or requires new run time logic that exceeds what can be
reasonably described as a 1588 profile.

Since we will need a few more run time exceptions in order to support
802.1AS, we introduce a helper function to identify this case, rather
than hard coding a test for follow_up_info, in order to be more clear
about it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-01-27 20:58:19 +01:00
Richard Cochran a1cd223962 Start P2P messages right away when listening after initializing.
Because of an oversight in the event code, a port will not send peer delay
request messages while in the initial listening state. This patch fixes
the issue by expanding this special, initial case.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-01-27 20:58:19 +01:00
Geoff Salmon 533c77115a Check that TLV length is correct when receiving TLVs.
The function, tlv_post_recv, and the functions it calls don't check
the length of the tlv before flipping the byte order of fields. An
attacker (or a really buggy client) can craft a message causing the
byte order of data outside the received message to be flipped.

None of the supported tlvs are large enough to flip bytes outside the
ptp_message struct, which could corrupt the heap. However, it's easy
to mess up the message's refcnt field, leading to memory leaks.

The fix is to check that the tlv length is what is expected when
receiving, and tlv_post_recv needs to return an int to signal when a
tlv is invalid.

Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-01-22 21:08:23 +01:00
Richard Cochran d666149e91 Add missing documentation for msg_post_recv.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-01-22 18:31:17 +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 d8cb9be46a Remove unnecessary states in PI servo.
Step the clock as soon as the second sample is collected.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-01-16 20:28:21 +01:00
Miroslav Lichvar af2a4f47fb Modify PI servo to set frequency when jumping.
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>
2013-01-16 20:28:21 +01:00
Miroslav Lichvar ab29608e0b Modify servo_sample() to accept integer values.
Current date stored in nanoseconds doesn't fit in 64-bit double format.
Keep the offset and the time stamp in integer nanoseconds.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-01-16 20:28:21 +01:00
Miroslav Lichvar 8a23bf1d66 Fix initial drift calculation in PI servo.
Convert the calculated drift to ppb and also clamp it.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-01-16 20:28:21 +01:00
Geoff Salmon d4db76d64c udp6: implement getting physical and protocol addrs 2013-01-14 19:12:18 +01:00
Geoff Salmon c54f8a523b udp: implement getting physical and protocol addrs 2013-01-14 19:12:18 +01:00
Geoff Salmon f3ac2cad65 add sk_interface_addr for getting an interface's IP 2013-01-14 19:12:18 +01:00
Geoff Salmon d6779889cc raw: implement getting physical and protocol addrs 2013-01-14 19:12:18 +01:00
Geoff Salmon e010937783 transport: adds interface for getting type, and physical/protocol address
Needed for CLOCK_DESCRIPTION management TLV.
2013-01-14 19:12:18 +01:00
Geoff Salmon 5c47cbfedf Make enum transport_type match the networkProtocol enumeration
This means no conversion is necessary between the transport_type and
the networkProtocol field of the PortAddress struct. Not currently an
issue, but will be needed for implementing the CLOCK_DESCRIPTION
management TLV.
2013-01-14 19:12:17 +01:00
Geoff Salmon 7607774f30 Avoid calling msg_pre_send/post_recv unless actually forwarding a message 2012-12-31 22:53:32 +01:00
Geoff Salmon 8b40f4305b pmc: prefer exact matches for command names
Previously if a command's full name was a prefix of another command
then parse_id would return AMBIGUOUS_ID. This was a problem for the
TIME and various TIME_* messages.
2012-12-31 19:03:49 +01:00
Richard Cochran c8952c20c5 Add the SF download URL into the readme file.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-21 13:58:03 +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
Miroslav Lichvar b5ec128574 Update twoStepFlag description in man page. 2012-12-18 18:52:01 +01:00
Richard Cochran 3f9fe6d4b7 Update the readme with another Linux PHC driver.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-18 18:51:41 +01:00
Richard Cochran 49e4491883 Version 1.0
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-12 16:52:47 +01:00
Richard Cochran b810153ed5 Add asymmetry correction.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Jacob Keller <Jacob.e.keller@intel.com>
2012-12-11 14:36:30 +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 c3119807a3 Add utility functions to get the software version string.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-10 15:11:51 +01:00
Richard Cochran 0c49d16244 Add a compile time version string definition.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-10 15:11:51 +01:00
Richard Cochran 02f5b741e7 Add a shell script to generate the version string.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-09 10:16:18 +01:00
Richard Cochran 480f9e7d7a pmc: show the flags from the default data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-04 16:03:33 +01:00
Richard Cochran c129d0ec95 pmc: fix missing include.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-04 14:36:01 +01:00
Richard Cochran 3710004596 pmc: reduce the message time out waiting for replies.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-04 14:27:25 +01:00
Richard Cochran 5b099afec7 pmc: show the port state as a string.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-04 14:26:50 +01:00
Richard Cochran 2aaae0854e Distinguish between get and set management requests.
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>
2012-12-04 13:25:50 +01:00
Richard Cochran 502b52163c pmc: correct the integer format string wrt decimal verses hexadecimal.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-04 13:21:53 +01:00
Richard Cochran 2352c05a3b pmc: support getting the port data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-02 21:07:43 +01:00
Richard Cochran 0e244e7f36 Respond to the port data set management query.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-02 21:06:37 +01:00
Richard Cochran 970bc7f95c Maintain the peer mean path delay field of the port data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-02 20:48:29 +01:00
Richard Cochran 28c08dfac6 Convert the port data set TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-02 20:34:44 +01:00
Richard Cochran c101dafb18 pmc: support getting the time properties data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-02 20:13:06 +01:00