Hi,

Sorry for sending the patch twice. Please check below example output 
(servo_offset_threshold=1000, step_threshold=0.02, servo_num_offset_values=5):
…
ptp4l[218.354]: master offset         20 s3 freq  +72300 path delay       728
ptp4l[218.604]: master offset         36 s3 freq  +72324 path delay       728
ptp4l[219.354]: master offset         60 s3 freq  +72359 path delay       728
ptp4l[219.604]: master offset         80 s3 freq  +72394 path delay       724
ptp4l[220.354]: master offset  -59631040 s0 freq  +72394 path delay       724   
 >>>> S3 -> S0 (clock offset > step_threshold)
ptp4l[220.604]: master offset         49 s0 freq  +72394 path delay       723
ptp4l[221.354]: master offset         29 s2 freq  +72283 path delay       723
ptp4l[221.604]: master offset         26 s2 freq  +72315 path delay       726
ptp4l[222.354]: master offset         94 s2 freq  +72403 path delay       726
ptp4l[222.604]: master offset         82 s2 freq  +72405 path delay       726
ptp4l[223.354]: master offset         50 s3 freq  +72379 path delay       726
ptp4l[223.604]: master offset         70 s3 freq  +72413 path delay       726
ptp4l[224.359]: master offset       -294 s3 freq  +71976 path delay       726
…
ptp4l[379.729]: master offset         49 s3 freq  +72730 path delay       734
ptp4l[380.479]: master offset         67 s3 freq  +72761 path delay       732
ptp4l[380.729]: master offset         59 s3 freq  +72762 path delay       732
ptp4l[381.479]: master offset      -4961 s2 freq  +66581 path delay       728   
 >>>> S3 -> S2 (clock offset > servo_offset_threshold)
ptp4l[381.729]: master offset      -3449 s2 freq  +67591 path delay       728
ptp4l[382.479]: master offset        388 s2 freq  +71729 path delay       723
ptp4l[382.729]: master offset        688 s2 freq  +72166 path delay       723
ptp4l[383.484]: master offset        802 s2 freq  +72425 path delay       717
ptp4l[383.734]: master offset        866 s2 freq  +72642 path delay       717
ptp4l[384.484]: master offset        950 s3 freq  +72895 path delay       717   
 >>>> S2 -> S3 (clock offset < servo_offset_threshold) x servo_num_offset_values
ptp4l[384.734]: master offset        886 s3 freq  +72980 path delay       717
ptp4l[385.484]: master offset        705 s3 freq  +72909 path delay       722
...

Cheers,
Pawel

> -----Original Message-----
> From: Modrzejewski, Pawel via Linuxptp-devel <linuxptp-
> de...@lists.sourceforge.net>
> Sent: Monday, January 10, 2022 2:34 PM
> To: linuxptp-devel@lists.sourceforge.net
> Subject: [EXTERNAL] [Linuxptp-devel] [PATCH] servo: allows servo state
> transition back from S3 to S2
> 
> [EXTERNAL EMAIL]
> 
> Currently servo state stays in S3 (SERVO_LOCKED_STABLE) even though
> clock offset increases above servo_offset_threshold value (but is still
> below step_threshold value). With this change servo will switch to S2
> (SERVO_LOCKED) every time clock offset is bigger than
> servo_offset_threshold.
> It will still switch to S0 (SERVO_UNLOCKED) when clock offset is bigger than
> step_threshold. It allows one to check only servo state and potentially
> simplifies
> synchronization status monitoring.
> 
> Signed-off-by: Paweł Modrzejewski <pawel.modrzejew...@harman.com>
> ---
>  servo.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/servo.c b/servo.c
> index 46042aa..ad4ce7e 100644
> --- a/servo.c
> +++ b/servo.c
> @@ -101,6 +101,8 @@ static int check_offset_threshold(struct servo *s,
> int64_t 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 && s-
> >curr_offset_values < s->num_offset_values)
> +                     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

_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to