Commit Graph

11 Commits (e20d8228f95180e37805f9c7d7c573466a9d4b2a)

Author SHA1 Message Date
Michael Brown ffc5b93f95 tmv: Add tmv_sign()
The sign of time values is tested in tsproc.c.  Add an abstraction
tmv_sign() to return the sign of a time value.

Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
2018-03-07 07:55:51 -08:00
Michael Brown ea82ae6c28 tmv: Add missing uses of tmv_to_nanoseconds()
Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
2018-03-07 07:55:51 -08:00
Michael Brown 12c9805eab tmv: Add missing uses of tmv_dbl()
Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
2018-03-07 07:55:51 -08:00
Michael Brown 288810bb36 tmv: Add missing uses of tmv_zero()
Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
2018-03-07 07:55:51 -08:00
Richard Cochran 2d5d8a0395 tsproc: Allow clock synchronization immediately after jump.
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>
2017-04-08 21:17:01 +02:00
Richard Cochran a0cbeb7367 tsproc: Clarify the internal mode handling.
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>
2017-04-08 21:17:01 +02:00
Richard Cochran 74ab3b3728 tsproc: Track the validity of the filtered delay explicitly.
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>
2017-04-08 21:13:36 +02:00
Richard Cochran 3f2ef92052 tsproc: Fix time stamp handling with P2P one shot mode.
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>
2016-04-03 13:33:10 +02:00
Miroslav Lichvar 999c86f4a9 tsproc: allow zero remote timestamps in delay update
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>
2015-11-20 20:00:37 +01:00
Miroslav Lichvar 06fcfe123c tsproc: add raw and weighting modes.
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>
2015-03-27 10:58:04 +01:00
Miroslav Lichvar c452e862dd Refactor time stamp processing.
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>
2015-03-27 10:58:04 +01:00