Commit Graph

309 Commits (master)

Author SHA1 Message Date
Richard Cochran 9ee5c1fb8e Let a slaved port update the time properties on every announce message.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-04-02 19:28:10 +02:00
Libor Pechacek 0367bb5f1b Distinguish between ignored and malformed packets
When there is a peer speaking PTPv1 in the network we want to silently ignore
the packets instead of flooding system log with error messages.  At the same
time we still want to report malformed packets.  For that we reuse standard
error numbers and do more fine-grained error reporting in packet processing
routines.

Signed-off-by: Libor Pechacek <lpechacek@suse.cz>
2013-03-28 18:48:52 +01:00
Delio Brignoli 789a5c8e37 Add support for FT_BAD_PEER_NETWORK
Handle reception of >=3 sequential multiple pdelay responses from
distinct peers as a fault of type FT_BAD_PEER_NETWORK.

Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2013-03-20 19:10:22 +01:00
Delio Brignoli b936d35b6d Add support for multiple fault types
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2013-03-20 19:10:22 +01:00
Delio Brignoli 455ebe7d22 Rename set_tmo() to set_tmo_log(), add set_tmo_lin()
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2013-03-20 19:10:22 +01:00
Delio Brignoli d374ad6bf7 Explicitly detect and handle changes of the peer's port id by resetting asCapable and the port's nrate
This patch also changes port_capable() to reset the port's nrate every time asCapable changes
from true to false.

Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2013-03-20 19:10:09 +01:00
Delio Brignoli 9650cb687d Log changes to asCapable
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2013-03-17 18:50:31 +01:00
Delio Brignoli 3cc285c691 Free peer delay responses and followup messages when sending a new peer delay request
If messages are not freed, it is possible (with purposely crafted traffic) to trigger
a peer delay calculation which will use message's data from the previous round.

Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2013-03-14 05:17:41 +01:00
Delio Brignoli 4626487ff3 Implement neighborPropDelayThresh check in port_capable()
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2013-03-14 05:17:38 +01:00
Richard Cochran 48aa6712a9 Add support for the log peer delay interval management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:27:12 +01:00
Richard Cochran 9b5e37bbf8 Add support for the delay mechanism management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:23:32 +01:00
Richard Cochran d30d397c2b Add support for the version number management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:18:19 +01:00
Richard Cochran 06a65003f4 Add support for the log sync interval management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:14:05 +01:00
Richard Cochran d2f8bc5e38 Add support for the announce receipt timeout management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:10:51 +01:00
Richard Cochran 555c42e3d0 Add support for the log announce interval management request.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-03-04 20:06:36 +01:00
Geoff Salmon 36a5921e88 support GET CLOCK_DESCRIPTION and USER_DESCRIPTION mgmt messages
Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-02-25 18:11:03 +01:00
Miroslav Lichvar c547145834 Check shift used in freq_est and stats max_count calculation.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2013-02-12 19:59:50 +01:00
Richard Cochran c7098364f2 Make the counters for the frequency and rate estimators unsigned.
These are simple 'up' counters.
There is no need for negative values here.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-02-09 08:51:19 +01:00
Richard Cochran 6dc1b90306 Send peer delay requests continuously in P2P mode.
When a port makes a transition from one state to another, it resets all of
the message timers. While this is the correct behavior for E2E mode, the
P2P mode requires sending peer delay requests most of the time.

Even though all the other timer logic is identical, still making an
exception for P2P mode would make the code even harder to follow. So this
patch introduces two nearly identical helper functions to handle timer
reprogramming during a state transition.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-02-06 19:27:48 +01:00
Geoff Salmon 3921557672 send NOT_SUPPORTED errors for all unhandled, known management IDs
Now that there are clock/port_management_set functions, the IDs that
GETs are handled for, like DEFUALT_DATA_SET, still need to be in the
case for sending NOT_SUPPORTED errors.

Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-02-06 18:10:36 +01:00
Geoff Salmon 507bee9e73 adds stub clock/port_management_set functions
Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-02-06 18:10:36 +01:00
Geoff Salmon 0e497b9a45 send UNKNOWN_ID error for unknown management TLVs
Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-02-06 18:10:36 +01:00
Geoff Salmon 1500605ff5 factors out functions for sending mgmt errors from clock and port
Adds port_management_send_error and clock_management_send_error to
avoid repeatedly checking the result of port_managment_send_error and
calling pr_err if it failed. Future patches send more mgmt errors so
this will avoid repeated code.

Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-02-06 18:10:35 +01:00
Geoff Salmon d5af4196fc fixes typo port_managment_error -> port_management_error
Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
2013-02-06 18:10:35 +01:00
Richard Cochran f530ae9333 Hide the grandmaster port state.
There really is no such state, but there probably should have been one.
In any case, we do have one just to make the code simpler, but this should
not appear in the management responses. This patch fixes the issue by
covering over our tracks before sending a response.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-02-06 13:34:49 +01:00
Richard Cochran 4f866b2761 Merge the branch with the 'asCapable' support.
Conflicts:
	port.c

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-02-03 18:43:56 +01:00
Richard Cochran 0dbdd9c2cd Stop handling file descriptor events after a port reset.
If the port resets itself after detecting a fault, then the polling events
for that port are no longer valid. This patch fixes a latent bug that
would appear if a fault and another event were to happen simultaneously.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2013-02-03 17:58:12 +01:00
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
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 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
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 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 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 aa6708d09a Use the management message memory layout for the timePropertiesDS.
Reforming the data structure in this way will greatly simplify the
implementation of the management message for this data set.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-12-02 11:24:31 +01:00
Richard Cochran 71c4bf203c Use the management message memory layout for the parentDS.
Reforming the data structure in this way will greatly simplify the
implementation of the management message for this data set.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-11-30 22:35:26 +01:00
Richard Cochran b26a36d493 Implement the NULL management message.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-11-30 20:26:22 +01:00
Richard Cochran b96e73994b Support one step sync operation.
The Linux kernel supports a hardware time stamping mode that allows
sending a one step sync message. This commit adds support for this mode
by expanding the time stamp type enumeration. In order to enable this
mode, the configuration must specify both hardware time stamping and set
the twoStepFlag to false.

We still do not support the one step peer delay request mechanism since
there is neither kernel nor hardware support for it at this time.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-11-30 11:34:29 +01:00
Jacob Keller 004b62d22b sk: change sk_interface_phc to sk_get_ts_info
this patch changes sk_interface_phc to sk_get_ts_info, by allowing the function
to store all the data returned by Ethtool's get_ts_info IOCTL in a struct. A new
struct "sk_ts_info" contains the same data as well as a field for specifying the
structure as valid (in order to support old kernels without the IOCTL). The
valid field should be set only when the IOCTL successfully populates the fields.

A follow-on patch will add new functionality possible because of these
changes. This patch only updates the programs which use the call to perform the
minimum they already do, using the new interface.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-11-14 20:22:10 +01:00
Miroslav Lichvar 7894339cdd Fix errors found by Coverity Static Analysis.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-10-18 19:58:40 +02:00
Miroslav Lichvar 937f3aec5b Don't try calling SIOCETHTOOL on UDS.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2012-10-11 20:35:11 +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 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 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 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 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 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 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
Richard Cochran 9da511d6f6 Provide a method to obtain a port's identity.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-26 14:39:57 +02:00
Richard Cochran f9953c6ef3 Drop stale delay requests after the clock jumps in time.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-22 05:05:11 +02:00
Richard Cochran 83bd97be80 Let a slaved port report the sync interval.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-21 20:10:35 +02:00
Jacob Keller 7a69db2379 ptp4l: Allow per-port customized port defaults
this patch allows each port to maintain its own pod structure since it is only
used in ports. This will allow the user to configure any special settings per
port. It takes a copy of the default pod, and a future patch will allow the
configuration file to set per-port specific changes

-v2
* Minor change to fix merge with previous patch

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-08-21 14:30:54 +02:00
Jacob Keller 64dcf257e3 ptp4l: pass struct interface directly instead of passing it's sub arguments
the port_open function takes a large number of command options, a few of which
are actually all values of struct interface. This patch modifies the port_open
call to take a struct interface value instead of all the other values. This
simplifies the overall work necessary and allows for adding new port
configuration values by appending them to the struct interface

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
2012-08-21 07:28:14 +02:00
Richard Cochran d04deb8ba6 Append the follow up information TLV when enabled.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 20:31:24 +02:00
Richard Cochran 9f72080260 Append the path trace list to announce messages when enabled.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 20:31:24 +02:00
Richard Cochran e1c2027266 Keep the path trace list up to date.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 20:31:24 +02:00
Richard Cochran 316fb63453 Filter incoming announce messages according to the path trace rule.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-10 20:31:23 +02:00
Richard Cochran ba5c5704e6 Move the protocol version macro to a public header.
This will be needed by the management client program.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-05 21:46:03 +02:00
Richard Cochran 353b0a2743 Answer all management requests with 'not supported'
Our management interface is not yet terribly useful,
but at least we are honest about it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-05 21:46:03 +02:00
Richard Cochran 21c2fe30c7 Provide a method to send a management error status message.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-05 21:46:03 +02:00
Richard Cochran f233528ea4 Provide a port method to allocate a management message reply.
This function will be needed for both positive replies and error status
messages.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-05 21:42:00 +02:00
Richard Cochran 247edc89d3 Filter port management messages by the target port number.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-02 07:08:04 +02:00
Richard Cochran 4f04c4139d Add a functional framework to manage the clock and its ports.
This commit only adds support for forwarding the management messages.
The actual local effects of the management commands still need to be
implemented.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-02 07:08:03 +02:00
Richard Cochran 4b0f4fda42 Replace hard coded logMinPdelayReqInterval with configuration option.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-07-28 06:29:15 +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 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 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 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
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
Richard Cochran 335100c1a6 Differentiate the BMC related logging from the synchronization logging.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:56 +01:00
Richard Cochran ba6cf8b767 uClinux: provide missing system calls.
The timerfd calls are missing from Sourcery CodeBench Lite 2011.09-23.
We can remove this code once these calls are properly integrated into a
current tool chain.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:56 +01:00
Richard Cochran 59163df8b1 Make use of the configuration file for the port data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:55 +01:00
Richard Cochran e47549e73f Ignore messages from ourselves and from the wrong domain.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:55 +01:00
Richard Cochran 95185673f5 Fix message leak in the port event handler.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:55 +01:00
Richard Cochran e2c02e49c7 Implement the master sync timer and message.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:55 +01:00
Richard Cochran 39f5b2c449 Fix delay response message format.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:54 +01:00
Richard Cochran e96d26f13f Group the sequence numbers together in one structure.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:54 +01:00
Richard Cochran 72703ba36a Implement the master announce timer and message.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:54 +01:00
Richard Cochran da17f75359 Implement the port master qualification timer.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:54 +01:00
Richard Cochran 62afef45db Clear all timers when changing port state.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:54 +01:00
Richard Cochran 10753faccf Implement the synchronization events.
This will allow a port to get from the uncalibrated into the slave state.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:54 +01:00
Richard Cochran 68aea3058c Use the timeout table for the delay request messages.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2011-11-27 14:24:03 +01:00
Richard Cochran ebd353aff6 Link it all together, but in slave-only mode.
Since the master implementation is still lacking, we will just keep
the slave-only flag hard coded for now.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2011-11-13 12:39:49 +01:00
Richard Cochran dae76b951a Implement the port layer.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2011-11-13 08:41:05 +01:00