Burkhard Ilsen
2017-04-03 07:20:44 UTC
Hello everyone,
while debugging my 802.1AS endpoint I recognized that the servo was idle
after the first step.
It stopped processing sync messages until the next peer delay was measured.
The reason is that t3 is reset after the first step letting
tsproc_update_offset() fail.
I think tsproc_update_offset() should not fail in this case because the
filtered delay is still available and t3 is not needed.
T3 is needed only when using raw_mode or weighting.
I propose checking the variables only if they are used:
--- a\tsproc.c
+++ b\tsproc.c
@@ -163,12 +163,17 @@
{
tmv_t delay, 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;
- if (tsp->raw_mode || tsp->weighting)
+ if (!tsp->raw_mode && tmv_is_zero(tsp->filtered_delay))
+ return -1;
+
+ if (tsp->raw_mode || tsp->weighting) {
+ if (tmv_is_zero(tsp->t3))
+ return -1;
raw_delay = get_raw_delay(tsp);
+ }
delay = tsp->raw_mode ? raw_delay : tsp->filtered_delay;
while debugging my 802.1AS endpoint I recognized that the servo was idle
after the first step.
It stopped processing sync messages until the next peer delay was measured.
The reason is that t3 is reset after the first step letting
tsproc_update_offset() fail.
I think tsproc_update_offset() should not fail in this case because the
filtered delay is still available and t3 is not needed.
T3 is needed only when using raw_mode or weighting.
I propose checking the variables only if they are used:
--- a\tsproc.c
+++ b\tsproc.c
@@ -163,12 +163,17 @@
{
tmv_t delay, 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;
- if (tsp->raw_mode || tsp->weighting)
+ if (!tsp->raw_mode && tmv_is_zero(tsp->filtered_delay))
+ return -1;
+
+ if (tsp->raw_mode || tsp->weighting) {
+ if (tmv_is_zero(tsp->t3))
+ return -1;
raw_delay = get_raw_delay(tsp);
+ }
delay = tsp->raw_mode ? raw_delay : tsp->filtered_delay;