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 <richardcoch...@gmail.com>
Reported-by: Burkhard Ilsen <burkhardil...@gmail.com>
---
 tsproc.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tsproc.c b/tsproc.c
index 550f32c..63c989d 100644
--- a/tsproc.c
+++ b/tsproc.c
@@ -180,20 +180,28 @@ int tsproc_update_offset(struct tsproc *tsp, tmv_t 
*offset, double *weight)
 {
        tmv_t delay = 0, raw_delay = 0;
 
-       if (tmv_is_zero(tsp->t1) || tmv_is_zero(tsp->t2) ||
-           tmv_is_zero(tsp->t3))
+       if (tmv_is_zero(tsp->t1) || tmv_is_zero(tsp->t2))
                return -1;
 
        switch (tsp->mode) {
        case TSPROC_FILTER:
+               if (!tsp->filtered_delay_valid) {
+                       return -1;
+               }
                delay = tsp->filtered_delay;
                break;
        case TSPROC_RAW:
        case TSPROC_RAW_WEIGHT:
+               if (tmv_is_zero(tsp->t3)) {
+                       return -1;
+               }
                raw_delay = get_raw_delay(tsp);
                delay = raw_delay;
                break;
        case TSPROC_FILTER_WEIGHT:
+               if (tmv_is_zero(tsp->t3) || !tsp->filtered_delay_valid) {
+                       return -1;
+               }
                raw_delay = get_raw_delay(tsp);
                delay = tsp->filtered_delay;
                break;
-- 
2.1.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to