Commit Graph

438 Commits (eb93926bc926fa8e212525ff4fb5016685fe9e60)

Author SHA1 Message Date
Richard Cochran 7460d2756a Add a configuration option to specify the L2 MAC addresses.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-27 22:41:00 +02:00
Richard Cochran 928abf32f2 Add the transport specific field into the config file.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-27 22:41:00 +02:00
Richard Cochran 6258aa0bad Drop incoming packets on transportSpecific mismatch.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-27 22:41:00 +02:00
Delio Brignoli 9bdf92a7cf Add transmit support for the transportSpecific field
Add transportSpecific parameter to config file parser
Set transportSpecific field in message headers as using the configuration (default to 0)

[ RC - reduced this patch to just the addition of the field ]

Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-27 13:15:56 +02:00
Richard Cochran e29ef34432 Fix typo in the readme's driver support matrix.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-27 09:01:03 +02:00
Delio Brignoli 3a64baee50 Define CC = $(CROSS_COMPILE)gcc in makefile and add EXTRA_CFLAGS, EXTRA_LDFLAGS
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2012-07-24 14:47:49 +02:00
Richard Cochran 480a16596f Update the readme file for Linux kernel 3.5.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-24 14:08:59 +02:00
Richard Cochran 040c644f85 Bring the driver support matrix up to date with Linux version 3.4.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-15 21:44:45 +02:00
Richard Cochran 6ad9af1a25 Correctly handle a negative log message interval.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-08 13:24:08 +02:00
Richard Cochran d7a67e9f89 Prevent message buffer corruption on receive.
An oversize incoming packet might overwrite the reference counter in a
message. Prevent this by providing a buffer large enough for the largest
possible packet.

This will also be needed to support TLV suffixes.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-08 13:11:38 +02:00
Richard Cochran c1973c5e11 Update data sets after loss of foreign master.
If an announce timeout occurs on a port, and no other port is slaved, then
the clock must become a grand master by default.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-08 12:14:28 +02:00
Richard Cochran 7ac297a082 Fix unsafe reference of foreign master announce message.
When computing a port's best foreign master, we make use of a message
reference that possibly might have been dropped by calling msg_put in
the fc_prune subroutine. This commit fixes the issue by copying the
needed data from the message before pruning.

[ Actually, since msg_put only places the message into a list without
  altering its contents, there was no ill effect. But using a message
  after having released it is just plain wrong. ]

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-08 11:24:23 +02:00
Richard Cochran 3616692203 Remove unneeded newline from pr_info message.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-08 10:44:05 +02:00
Richard Cochran 646bf8bc26 Recover from lost link when running in slave only mode.
Under Linux, when the link goes down our multicast socket becomes stale.
We always poll(2) for events, but the link down does not trigger any event
to let us know that something is wrong. Once the port enters master mode
and starts announcing itself, the socket throws an error. This in turn
causes a fault, and we reopen the socket when clearing the fault.

However, in the case of slave only mode, if the port is listening then
it will never send, discover the link error, or repair the socket. This
patch fixes the issue by simply reopening the socket after an announce
timeout.

[ Another way would be to use a netlink socket, but that would add too
  much complexity as it poorly matches our port/interface model. ]

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-07 20:18:02 +02:00
Richard Cochran 3d7372d529 Fix memory leak, reference counting, and list handling in message code.
The message code is horribly broken in three ways.

1. Clearing the message also sets the reference count to zero.
2. The recycling code in msg_put does not test the reference count.
3. The allocation code does not remove the message from the pool,
   although this code was never reached because of point 2.

This patch fixes the issues and also adds some debugging code to trace
the message pool statistics.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-07 20:18:02 +02:00
Richard Cochran b34f74bf03 Log the relative time rather than the process identification.
When diagnosing a log file, it can be useful to know the relative time
between the log entries. In contrast, the PID is mostly useless, since
the program does not ever fork.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-06-10 12:27:59 +02:00
Richard Cochran ed504c10ca Tell how to get the sources in the readme file.
Also fix a poorly worded sentence in the system requirements.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-06-10 12:19:26 +02:00
Richard Cochran 8b8576428f Fix the TLV structure declaration for actual use later.
This structure is not very useful for message parsing. This commit fixes
the declaration in preparation for TLV handling.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-06-09 20:51:58 +02:00
Richard Cochran ff44e305b1 Refactor the post receive method to check the length first.
This patch is in preparation for handling the suffix TLV data. We will
need to use the structure size more than once.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-06-03 19:56:56 +02:00
Richard Cochran 018ba27ff8 Add declarations for the signaling and management message types.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-06-03 19:11:36 +02:00
Richard Cochran 2633df45cf Add the suffix field onto the general messages.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-06-03 18:55:42 +02:00
Jacob Keller 0afedd7993 ptp4l: use ethtool operation to double check PHC
If the new ethtool operation is supported, then use it to verify that the PHC
selected by the user is correct. If the user doesn't specify a PHC and ethtool
is supported then automatically select the PHC device.

If the user specifies a PHC device, and the ethtool operation is suppported,
automatically confirm that the PHC device requested is correct. This check is
performed for all ports, in order to verify that a boundary clock setup is
valid.

The check for PHC device validity is not done in the transport because the
only thing necessary for performing the check is the port name. Handled this
in the port_open code instead.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-05-10 06:53:15 +02:00
Jacob Keller 821798da9d ptp4l: throw a fault for other port event failures
this patch makes sure every function is checked for a negative return value
and ensures that a fault is detected when these fail

-v2-
* Fixed only check the ones with return value

-v3-
* Modified the delay_req functions to return 0 on nonfault cases

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-05-08 08:32:26 +02:00
Richard Cochran d7bcdca7a9 Clamp maximum adjustment to numerical limit.
On 32 bit platforms, a PHC driver might allow a larger adjustment than
can fit into the 'long' type used in the clock_adjtime interface. This
patch fixes the issue by using the smaller of the two maxima.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-05-05 12:49:45 +02:00
Richard Cochran f2aae280b3 Make the PI constants configurable.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-05-03 11:17:34 +02:00
Richard Cochran aea4cfcd50 Add transport over UDP IPv6.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-20 16:30:01 +02:00
Richard Cochran 4af8c74450 Use the peer transmission methods in the port logic.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-05 17:48:59 +02:00
Richard Cochran 3983406818 raw: Implement the peer transmission option.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-05 17:48:59 +02:00
Richard Cochran a0efbfd138 udp: Implement the peer transmission option.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-04-05 17:48:59 +02:00
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