After a servo jump, the call to tsproc_reset() clears tsp->t3. This
causes the next call to tsproc_update_offset() to fail. However the
offset calculation does not necessarily depend on t3, i.e. when
filtered_delay is available and neither raw nor weighting is used.
This patch fixes the issue by allowing the stored filtered delay to be
used when appropriate.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Reported-by: Burkhard Ilsen <burkhardilsen@gmail.com>
The time stamp processor features four modes resulting from the
combination of two independent Boolean options. Even though we have a
proper enumerated type to represent the mode, still the code coverts
the mode into two variables.
The tests on the variables are currently simple enough, but soon we
will want to add some more complexity. In the interest of clarity,
this patch converts the paired Boolean tests into a switch/case
pattern.
No functional change.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
We will want to test whether a valid filtered delay value has been
calculated or not. However, we cannot simply test for zero since that is
a legitimate possible delay value. This patch adds a flag that reflects
the state of the filtered delay field.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
When the P2P link partner is using one shot mode, the residence time
in the peer (t3 - t2) is reflected in the correction field of the
peer delay response message, and t2 and t3 are both zero.
The function port_peer_delay() calls clock_peer_delay(), passing in
the zero valued 't2' to the 'rx' argument. The latter function then
stores the zero value in the 't4' field of the clock's tsproc
instance.
As a result, tsproc_update_offset() returns an error to
clock_synchronize(), and so a slave clock will never leave the
"uncalibrated" state.
This patch fixes the issue by removing the test for a non-zero 't4'
field within the tsproc.
Acked-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
When remote timestamps from P2P delay measurement are not known (the
remote processing time is saved in the correction field), they are set
to zero. Fix tsproc to not require non-zero t1 and t4.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Add new time stamp processing modes to return raw delay and offset based
on the raw delay instead of the long-term filtered delay, and to return
also a weight of the sample. The weight is set to the ratio between the
two delays. This gives smaller weight to samples where the sync and/or
delay messages were delayed significantly in the network and possibly
include a large error.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Introduce a time stamp processor for offset/delay calculations and use
it in the clock and port modules.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>