Let the clock servo know the expected sync interval.
This patch adds a new servo method to let the algorithm know about the master clock's reported sync message interval. This information can be used by the servo to adapt its synchronization parameters. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
617a905643
commit
3695137619
2
clock.c
2
clock.c
|
@ -1127,6 +1127,8 @@ void clock_sync_interval(struct clock *c, int n)
|
|||
pr_warning("summary_interval is too long");
|
||||
}
|
||||
c->stats.max_count = (1 << shift);
|
||||
|
||||
servo_sync_interval(c->servo, n < 0 ? 1.0 / (1 << -n) : 1 << n);
|
||||
}
|
||||
|
||||
struct timePropertiesDS *clock_time_properties(struct clock *c)
|
||||
|
|
5
pi.c
5
pi.c
|
@ -132,6 +132,10 @@ static double pi_sample(struct servo *servo,
|
|||
return ppb;
|
||||
}
|
||||
|
||||
static void pi_sync_interval(struct servo *servo, double interval)
|
||||
{
|
||||
}
|
||||
|
||||
struct servo *pi_servo_create(int fadj, int max_ppb, int sw_ts)
|
||||
{
|
||||
struct pi_servo *s;
|
||||
|
@ -142,6 +146,7 @@ struct servo *pi_servo_create(int fadj, int max_ppb, int sw_ts)
|
|||
|
||||
s->servo.destroy = pi_destroy;
|
||||
s->servo.sample = pi_sample;
|
||||
s->servo.sync_interval = pi_sync_interval;
|
||||
s->drift = fadj;
|
||||
s->maxppb = max_ppb;
|
||||
s->first_update = 1;
|
||||
|
|
5
servo.c
5
servo.c
|
@ -41,3 +41,8 @@ double servo_sample(struct servo *servo,
|
|||
{
|
||||
return servo->sample(servo, offset, local_ts, state);
|
||||
}
|
||||
|
||||
void servo_sync_interval(struct servo *servo, double interval)
|
||||
{
|
||||
servo->sync_interval(servo, interval);
|
||||
}
|
||||
|
|
7
servo.h
7
servo.h
|
@ -86,4 +86,11 @@ double servo_sample(struct servo *servo,
|
|||
uint64_t local_ts,
|
||||
enum servo_state *state);
|
||||
|
||||
/**
|
||||
* Inform a clock servo about the master's sync interval.
|
||||
* @param servo Pointer to a servo obtained via @ref servo_create().
|
||||
* @param interval The sync interval in seconds.
|
||||
*/
|
||||
void servo_sync_interval(struct servo *servo, double interval);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,8 @@ struct servo {
|
|||
double (*sample)(struct servo *servo,
|
||||
int64_t offset, uint64_t local_ts,
|
||||
enum servo_state *state);
|
||||
|
||||
void (*sync_interval)(struct servo *servo, double interval);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue