This patch adds code that sends an event messages received on one port out
all the other ports and calculates the residence time. The correction,
ingress port, and the original message are remembered in a TC transmit
descriptor. These descriptors are recycled in a memory pool in a similar
way to the message buffers.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
The transparent clock code will want to set qualification timeouts and
perform end to end delay measurements. This patch exposes the needed
methods.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
As we add more and more options, it is getting to be a chore to add
each new option to multiple configuration files. As we add more
profiles, each with its own example configuration file, the problem
will only get worse.
This patch condenses the gPTP example down to those options which
differ from the built in defaults.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
When masterOnly is true, the port always returns NULL when computing
its best foreign master. As a result, the port will never enter the
SLAVE state, and the clock will ignore Announce messages received on
that port.
This attribute is specifically called out in G.8275.1 and G.8275.2,
and it is implied by the "master only" mode G.8265.1. In addition,
this option will probably appear in the next revision of IEEE 1588.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
The first half of the telecom algorithm from G.8275.1 and G.8275.2
differs from the one in 1588, making use of profile specific
"localPriority" attributes.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
The Telecom Profiles G.8275.1 and G.8275.2 have invented a new
per-port and per-clock attribute, not in 1588, called "localPriority".
The use of this attribute is a distinguishing feature of the telecom
data set comparison algorithm.
This patch adds the attribute, hard coded to its default value.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
There is no need to keep two copies of the data set comparison
function. This patch adds a method that allows the port code to
obtain the function from the clock code.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Add a batch mode, where the commands are taken from the command line
instead of the standard input.
[ RC: keep automatic variables in alphabetical order and in reverse
Christmas tree style. ]
Signed-off-by: Ethel <ethel.nilsson@est.tech>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
When using a PPS source with no source clock specified with the -s
option, avoid referencing a NULL pointer and using CLOCK_INVALID in
system calls.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Check if a signal was received when waiting for ptp4l in the automatic
mode to not get stuck in an infinite loop.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
If a ptp4l or phc2sys process is terminated (e.g. due to a crash) and
timemaster was running for at least one second (i.e. it's not an error
in ptp4l/phc2sys configuration), start the process again. Restart all
processes corresponding to the same time source at the same time to
ensure phc2sys is always connected to the currently running ptp4l.
Add a new option to disable the restarting.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Use the rtnl_get_ts_device() function to get the name of the slave
interface which will be timestamping PTP packets and use it instead of
the master interface to check the timestamping capabilities and PHC.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Change the rtnl_get_ts_label() function to accept the name of the master
interface and the buffer for the slave interface directly instead of the
struct interface from config.h.
Also, rename the function to rtnl_get_ts_device().
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
As of 510777deca message layer no longer returns -ETIME. Callers of
msg_post_recv() are expected to check for missing time stamps themselves,
but the message duplication function followed the obsolete code pattern
of expecting that msg_post_recv() performs the check. This patch fixes
the method to check properly for this error condition.
Fixes: 51b540875f ("msg: Introduce a method to copy a message.")
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
As of 510777deca message layer no longer returns -ETIME. Callers of
msg_post_recv() are expected to check for missing time stamps themselves.
This patch updates the two forgotten call sites.
Fixes: 510777deca ("msg: Move the check for missing HW time stamps into caller.")
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
In pmc, there is a little bug (only text, not functional):
When pmc is called with the management id 'LOG_SYNC_INTERVAL',
the response is '... seq 0 RESPONSE MANAGEMENT ANNOUNCE_RECEIPT_TIMEOUT' .
It should be '... seq 0 RESPONSE MANAGEMENT LOG_SYNC_INTERVAL'.
This patch fixes this.
[RC: Include explanation from 0/1 in commit message. ]
Signed-off-by: Peter Schneider <peter@psch.de>
[RC: Added -f flag help and removed extraneous text.]
Signed-off-by: Peter Schneider <peter@psch.de>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Use struct config item 'kernel_leap' for parameter handling. Copy this to
node.kernel_leap afterwards. Check for 'servo_type' == CLOCK_SERVO_NTPSHM.
Signed-off-by: Peter Schneider <peter@psch.de>
Replaced usage of variable 'use_syslog' with struct config item
'use_syslog'. Original variable removed.
Signed-off-by: Peter Schneider <peter@psch.de>
Replaced usage of variable 'message_tag' with struct config item
'message_tag'. Original variable removed.
Signed-off-by: Peter Schneider <peter@psch.de>
Replaced usage of variable 'print_level' with struct config item
'logging_level'. Original variable still used for range checking.
Signed-off-by: Peter Schneider <peter@psch.de>
Replaced usage of variable 'domain_number' with struct config item
'domainNumber'. Original variable still used for range checking. Removed
(now obsolete) third parameter of init_pmc().
Signed-off-by: Peter Schneider <peter@psch.de>
When using long chains of transparent clocks, the recommended practice is
to measure the rate ratio without adjusting the local clock. Then the
residence times should be corrected to reflect the master's frequency.
This patch expands the clock_rate_ratio() method to provide the estimated
ratio when the clock is free running.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
If the "free_running" option is set, the "no adjust" calculates and
prints an estimation of the phase and frequency offsets to the remote
master. Because the phase estimate requires a delay measurement, this
calculation is not performed without having the delay estimate first.
However, a typical transparent clock application will want to use the
frequency offset to correct the residence times to match the master's
frequency.
This patch adds a call to the "no adjust" routine even if no valid
delay measurement has been made.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
The transparent clock will want to have two copies of certain messages,
one for forwarding and one for internal use (in the BMCA and for
syntonization). This patch add a function that duplicates a given
message, including all of the attached TLVs.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Now that we have a helper routine to find the suffix, use that instead of
open coding the same logic. This simplifies the code and consolidates the
definition of which message types are allowed to carry TLVs.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
When a messages is sent with the DEFER_EVENT flag, the lower transport
code does not fetch the time stamp right away. This patch introduces
a method that allows a second call to retrieve the waiting transmit
time stamp.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Up until now, the code has always fetched the time stamp immediately
after transmitting a message. However, a transparent clock will want
to forward a given incoming message out all egress ports with as
little delay as possible, in order to minimize the residence time of
the message within the switch.
This patch adds a new transmit mode for event messages that will be
used to signal the new behavior.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
The majority of the callers of transport_send() use hard coded magic
numbers. This patch fixes them to use the corresponding enumerated
values instead.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Originally the 'event' parameter to transport_send() was a single
Boolean flag. Over time, we grew an enumerated list of event
flavors, but the function signatures were never updated. This patch
changes the methods to use the proper type.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
When compiling with "-O1 -D_FORTIFY_SOURCE=1", gcc throws a false positive
warning. The code is not performance sensitive, so this patch silences
the warning by initializing the offending local variable explicitly.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
The PortAddress structure has no space for the actual address and should
be used only as a pointer to a larger buffer.
The issue was reported by gcc with enabled source fortification.
[ RC: Replace magic number with sizeof() macro. ]
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
The make install target tries to install a man page that does not
exist. This patch fixes the makefile to install the existing man
pages only.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch makes a number of subroutines into global functions in order
to share code with the TC implementations to come.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch places the internal port data structure into a common header
for use by the original BC and the new TC code.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
When computing the next port state based on a FSM event, much of the logic
will stay the same for OC, BC, and TC nodes.
- handling a fault ASAP
- INITIALIZING state handling
- showing the transition in the log
- sending notifications
This patch moves this common code into a global port method, making it
available to future TC implementations.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This paves the way to allow different implementations for the upcoming
Transparent Clock code.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>