Skip to content

Commit

Permalink
Improve efficiency of nullf servo synchronization
Browse files Browse the repository at this point in the history
The nullf servo can now enter the SERVO_LOCKED_STABLE state by
transitioning first to the SERVO_LOCKED state when the offset is less than
the set value for offset_threshold. If offset_threshold is not set, the
SERVO_LOCKED state can be entered when the offset is less than or equal to
the set value for step_threshold.

Signed-off-by: Rahul Rameshbabu <[email protected]>
  • Loading branch information
Rahul Rameshbabu via Linuxptp-devel authored and richardcochran committed Feb 6, 2023
1 parent 6e02bb2 commit 64e223c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
9 changes: 6 additions & 3 deletions nullf.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@ static double nullf_sample(struct servo *servo, int64_t offset,
uint64_t local_ts, double weight,
enum servo_state *state)
{
if (!offset) {
long long int abs_offset = llabs(offset);

if ((servo->offset_threshold && abs_offset < servo->offset_threshold) ||
(servo->step_threshold && servo->step_threshold >= abs_offset)) {
*state = SERVO_LOCKED;
return 0.0;
}

if ((servo->first_update && servo->first_step_threshold &&
servo->first_step_threshold < llabs(offset)) ||
(servo->step_threshold && servo->step_threshold < llabs(offset))) {
servo->first_step_threshold < abs_offset) ||
(servo->step_threshold && servo->step_threshold < abs_offset)) {
*state = SERVO_JUMP;
} else {
*state = SERVO_UNLOCKED;
Expand Down
12 changes: 6 additions & 6 deletions phc2sys.8
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,12 @@ Same as option

.TP
.B step_threshold
Specifies the step threshold of the servo. It is the maximum offset that
the servo corrects by changing the clock frequency instead of stepping
the clock. The clock is stepped on start regardless of the option if the
offset is larger than 20 microseconds (unless the -F option is used).
It's specified in seconds. The value of 0.0 disables stepping after
the start. The default is 0.0.
Specifies the step threshold of the servo. It is the maximum offset that the
servo corrects by changing the clock frequency (phase when using nullf servo)
instead of stepping the clock. The clock is stepped on start regardless of the
option if the offset is larger than 20 microseconds (unless the -F option is
used). It's specified in seconds. The value of 0.0 disables stepping after the
start. The default is 0.0.
Same as option
.B \-S
(see above).
Expand Down
14 changes: 7 additions & 7 deletions ptp4l.8
Original file line number Diff line number Diff line change
Expand Up @@ -591,18 +591,18 @@ the PI controller from the sync interval.
The default is 0.3.
.TP
.B step_threshold
The maximum offset the servo will correct by changing the clock
frequency instead of stepping the clock. When set to 0.0, the servo will
never step the clock except on start. It's specified in seconds.
The maximum offset the servo will correct by changing the clock frequency (phase
when using nullf servo) instead of stepping the clock. When set to 0.0, the
servo will never step the clock except on start. It's specified in seconds.
The default is 0.0.
This option used to be called
.BR pi_offset_const .
.TP
.B first_step_threshold
The maximum offset the servo will correct by changing the clock
frequency instead of stepping the clock. This is only applied on the first
update. It's specified in seconds. When set to 0.0, the servo won't step
the clock on start.
The maximum offset the servo will correct by changing the clock frequency (phase
when using nullf servo) instead of stepping the clock. This is only applied on
the first update. It's specified in seconds. When set to 0.0, the servo won't
step the clock on start.
The default is 0.00002 (20 microseconds).
This option used to be called
.BR pi_f_offset_const .
Expand Down
8 changes: 4 additions & 4 deletions ts2phc.8
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ command line option.

.TP
.B first_step_threshold
The maximum offset, specified in seconds, that the servo will correct
by changing the clock frequency instead of stepping the clock. This is
only applied on the first update. When set to 0.0, the servo will not
step the clock on start.
The maximum offset, specified in seconds, that the servo will correct by
changing the clock frequency (phase when using nullf servo) instead of stepping
the clock. This is only applied on the first update. When set to 0.0, the servo
will not step the clock on start.
The default is 0.00002 (20 microseconds).
.TP
.B free_running
Expand Down

0 comments on commit 64e223c

Please sign in to comment.