Commit Graph

79 Commits (29463cd3068c29a510ce5651588943175362da0e)

Author SHA1 Message Date
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
Richard Cochran c2fad7bd51 Fix the BMC state decision algorithm.
We failed to make the distinction between plain old "better" and
"better by topology," but the BMC algorithm really counts on this.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:56 +01:00
Richard Cochran 807ec32c96 Fix wrong result from the best master clock algorithm.
The BMC should never return 'faulty', and I don't know what I was thinking
here, so let's just fix it.

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 a442a928f8 Fix typo in the initial priority field of the parent data set.
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 1092c4237b Make use of the configuration file for the default data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:55 +01:00
Richard Cochran ec5e783e84 Add code to read a configuration file.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:55 +01:00
Richard Cochran 32ee558ef8 Add a command line option to set the message level.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:55 +01:00
Richard Cochran f135133a88 Print the synchronization statistics at the information level.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:55 +01:00
Richard Cochran 0536aa7413 Issue a warning when the path delay turns out negative.
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 851675833a Do not print debug messages by default.
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 50b82c200d Do not treat signaling and management messages as errors.
Instead we just ignore them for now.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:55 +01:00
Richard Cochran a736b0c2ff Make the slave only mode a non-default option.
Now that we have the master code in place, there is no longer any need
to restrict ourselves.

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 7dbdf2985c Provide methods to obtain a clock's parent and time properties data sets.
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 3481c99c70 Add an access method for a clock's currentDS.stepsRemoved.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:54 +01:00
Richard Cochran b76c4e108f Introduce an event recommending the grand master state.
We already have a grand master state. Adding this event will simplify the
overall logic, since it will avoid the silly requirement to set the
qualification timeout to zero when entering the grand master 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 347b42b7d5 udp: Use the bind to device socket option.
Without this Linux specific option, multicast packets arrive on one
interface are delivered by the kernel to all others.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:54 +01:00
Richard Cochran 95d5c36c0f udp: turn off multicast loop back.
This option is on by default, but we don't want or need it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:54 +01:00
Richard Cochran 5555a2f029 udp: Use the IP_ADD_MEMBERSHIP socket option.
For some reason, MCAST_JOIN_GROUP is not working under uClinux. We can
just stick with the more traditional method.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-01-07 08:07:53 +01:00
Richard Cochran 447d4d442c udp: bring a warning or error if the driver changes our hwtstamp options.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2011-12-18 09:35:41 +01:00