Commit Graph

559 Commits (289699e3c9eeac98b9961fb0bda2d243214cf577)

Author SHA1 Message Date
Richard Cochran beb3d5d821 Expand the transport layer interface with a peer transmission method.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-05 17:48:59 +02:00
Richard Cochran cd0fbc5c95 Throw a fault when multiple peers are detected.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-05 17:48:59 +02:00
Richard Cochran 9dc860642f Add a helper function to compare message source ports.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-05 17:48:59 +02:00
Richard Cochran b35a45d1a4 Add a command line option to select the peer delay mechanism.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-05 17:48:59 +02:00
Richard Cochran a8a5409b04 Expose the peer delay flavors in their own header file.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-05 17:48:59 +02:00
Richard Cochran 4df18c6fc9 Implement the port peer delay mechanism.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-05 17:48:50 +02:00
Richard Cochran 806d1e9b77 Add a clock method to accept a peer delay estimate from a slave port.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-05 15:03:51 +02:00
Richard Cochran d345ac5e4e Add port fields to remember peer delay messages.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-05 11:40:59 +02:00
Richard Cochran e213ff0479 Add the peer delay messages into the message layer.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-02 17:20:04 +02:00
Richard Cochran 28dc3613d7 Fix a misspelled field name.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-02 16:45:44 +02:00
Richard Cochran 2d06c5856d Warn when receiving delay requests on a peer to peer port.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-02 10:23:47 +02:00
Richard Cochran 59f00b5061 Let each interface use its own transport.
This will allow running a boundary clock that bridges different kinds of
PTP networks.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-01 19:28:13 +02:00
Eliot Blennerhassett 433b6f635e raw: fix filter reject for non 1588 frames
Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
2012-03-31 20:30:59 +02:00
Christian Riesch d5f953fed9 Output an error message when no interface is specified
Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
2012-03-27 19:21:16 +02:00
Richard Cochran 04e59b0b27 Show every port state transition, including (re)initialization.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-24 13:14:47 +01:00
Richard Cochran f2ffeae0f4 Automatically clear any port fault after fifteen seconds.
The current port code is very defensive. As the code now stands, we throw
a fault whenever we cannot send or receive a packet. Even a downed link
on an interface will cause a port fault.

This commit adds a very simple minded way of clearing the faults. We just
try to enable the port again after waiting a bit.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-24 12:46:24 +01:00
Richard Cochran 2607806579 Rationalize the port reset logic.
This commit makes each pair of port functions, open/close and
initialize/disable, balance each other in how they allocate or free
resources. This change lays some ground work to allow proper fault
handling and disable/enable logic later on.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-21 14:12:04 +01:00
Richard Cochran 1b78bb0b54 Add a missing doxygen comment to the main program.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-21 13:57:05 +01:00
Richard Cochran 0ca8143da5 Remove a useless variable from the file descriptor array data type.
It was a cute idea to have the raw Ethernet layer use just one socket,
but it ended up not working on some specific PTP time stamping hardware.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-21 13:55:56 +01:00
Richard Cochran 39b10a5a16 Add a method to remove a port from the clock's polling array.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-21 13:08:09 +01:00
Richard Cochran 2ff091b14b Throw a fault event if the BMC algorithm fails.
That makes more sense than re-initializing, perhaps.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-21 12:20:45 +01:00
Richard Cochran 3ff62648fa Make the number of transmit time stamp retries configurable.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-20 20:19:25 +01:00
Richard Cochran da69203517 Rework the configuration file interface.
This change will make it easier to extend the configuration file contents
to include arbitrary new data structures.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-20 20:09:40 +01:00
Richard Cochran 32d461d4ed Add a transport over raw Ethernet packets.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-18 09:31:21 +01:00
Richard Cochran 5dbca8a6cd Add a header defining the Ethernet header and MAC addresses.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-18 09:31:21 +01:00
Richard Cochran 7d54d444f5 Leave some headroom in the message buffers.
This room will be used by the Layer 2 protocols.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-18 09:31:21 +01:00
Richard Cochran aa142c5240 Improve error reporting on receive path.
In some error cases, no message is logged. Now we always complain loudly
when an error occurs.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-18 09:31:21 +01:00
Richard Cochran 9d4d68e667 Add missing release method to the UDPv4 transport.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-17 17:30:21 +01:00
Richard Cochran 319aae1403 Move some sharable socket code into its own source file.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-17 17:30:21 +01:00
Richard Cochran 9c9dc35f13 Clean up dynamic fields when closing a port.
In the course of development we added more and more allocations into the
port code without freeing them on close. We do not yet call the close
function, so there was never an issue. Once we start to reset the ports,
to clear faults for example, then we will need this.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-13 09:11:01 +01:00
Richard Cochran 29463cd306 Make the transport layer more opaque.
Although the UDP/IPv4 layer does not need any state per instance (other
than the two file descriptors), the raw Ethernet layer will need this.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-13 08:28:37 +01:00
Richard Cochran 7421e74aca Clear out saved time stamps after setting the clock.
When we create a discontinuity in the clock time, we must avoid mixing
local time stamps from before and after the jump.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-11 10:58:24 +01:00
Richard Cochran 2fcac204de Do not calculate the path delay without valid sync time stamps.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-11 10:52:01 +01:00
Richard Cochran e38488ae48 Add time value operations to clear to zero and test for zero.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-11 10:46:45 +01:00
Richard Cochran 5f0c034494 Throw an error at the port level on missing transmit time stamps.
We always wait for the transmit time stamp after sending an event message.
Thus a missing time stamp is clearly a fault, even if the hardware can
only handle one time stamp at a time.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-11 10:04:42 +01:00
Richard Cochran 51162c01af Warn loudly whenever event messages are missing time stamps.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-11 09:53:28 +01:00
Richard Cochran a9e88a0a49 Fix segfault after missing transmit time stamp.
If the networking stack fails to provide a transmit time stamp, then we
might feed uninitialized stack data to the CMSG(3) macros. This can result
in a segfault or other badness.

The fix is to simply clear the control buffer in advance.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-11 09:45:23 +01:00
Richard Cochran 150da0cba9 Remove silly and incorrect error message.
Commit 32133050 introduced a bug that gives a bogus error message on
every 'general' (non-event) PTP packet. If we want to catch missing
time stamps, then it has to occur at the port level.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-04 11:33:22 +01:00
Richard Cochran eb5b7b1e60 Verbosely identify the port and message after network errors.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-04 08:36:37 +01:00
Richard Cochran 321330501f Be more verbose about errors on the receive path.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-04 08:23:40 +01:00
Richard Cochran 6daff667c5 Initialize the time properties data set.
We can reuse the same function that sets the data sets in case of
becoming grand master.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-02-26 18:03:16 +01:00
Richard Cochran d6ce3fbb3d Fix compilation for uclinux toolchain lacking <sys/timerfd.h>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-02-19 18:26:54 +01:00
Richard Cochran 4d0b2e5001 Clean up all of the binaries for the 'distclean' target.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-02-19 18:26:38 +01:00
Richard Cochran 4b10792002 Add a utility program to set driver level time stamping policy.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-24 19:22:13 +01: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
Richard Cochran 43bd313eb1 Go ahead and use a negative path delay estimate.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-21 15:24:15 +01:00
Richard Cochran 6d73cea86a Implement timeouts with log seconds less than zero.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-09 10:04:43 +01:00
Richard Cochran c0ebf12f79 Add command line options to control the logging destination.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-09 10:04:43 +01:00
Richard Cochran 86ddff4a0a Print messages to the syslog by default.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-09 10:04:43 +01:00
Richard Cochran 222c9bb62b Fix the port finite state machine.
The state machine needs to know whether a new master has just been
selected in order to choose between the slave and uncalibrated states.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:56 +01:00