Please ignore/delete my previous email with identical subject, line wrapping ruined the formatting.
Purpose of this patch: This fixes an issue with transitioning to the transition of the servo state from SERVO_LOCKED (s2) to SERVO_LOCKED_STABLE (s3), which is controlled by the servo_offset_threshold=x and servo_num_offset_values=y config option. The current code switched to SERVO_LOCKED_STABLE as soon as the offset was y times below x, this patch changes this to switching to SERVO_LOCKED_STABLE only after y _consecutive_ offset values being below x, following the ptp4l-manpage documentation. Signed-off-by: Jürgen Appel <j...@dfm.dk> --- servo.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/servo.c b/servo.c index daaa41c..ea171cd 100644 --- a/servo.c +++ b/servo.c @@ -103,8 +103,12 @@ static int check_offset_threshold(struct servo *s, int64_t offset) long long int abs_offset = llabs(offset); if (s->offset_threshold) { - if (abs_offset < s->offset_threshold && s->curr_offset_values) - s->curr_offset_values--; + if (abs_offset < s->offset_threshold) { + if (s->curr_offset_values) + s->curr_offset_values--; + } else { + s->curr_offset_values = s->num_offset_values; + } return s->curr_offset_values ? 0 : 1; } return 0; -- 2.34.1 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel