From f38338827b2130a681c56ab2c70105c620de2d56 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Fri, 31 Aug 2012 15:49:19 +0200 Subject: [PATCH] Provide the clock with the estimated neighbor rate ratio. Signed-off-by: Richard Cochran --- clock.c | 4 +++- clock.h | 3 ++- port.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/clock.c b/clock.c index 82692bc..b0e65a5 100644 --- a/clock.c +++ b/clock.c @@ -70,6 +70,7 @@ struct clock { tmv_t path_delay; struct mave *avg_delay; struct freq_estimator fest; + double nrr; tmv_t c1; tmv_t c2; tmv_t t1; @@ -685,9 +686,10 @@ void clock_path_delay(struct clock *c, struct timespec req, struct timestamp rx, pr_debug("path delay %10lld %10lld", c->path_delay, pd); } -void clock_peer_delay(struct clock *c, tmv_t ppd) +void clock_peer_delay(struct clock *c, tmv_t ppd, double nrr) { c->path_delay = ppd; + c->nrr = nrr; } void clock_remove_fda(struct clock *c, struct port *p, struct fdarray fda) diff --git a/clock.h b/clock.h index 56eac92..c801da7 100644 --- a/clock.h +++ b/clock.h @@ -142,8 +142,9 @@ void clock_path_delay(struct clock *c, struct timespec req, struct timestamp rx, * Provide the estimated peer delay from a slave port. * @param c The clock instance. * @param ppd The peer delay as measured on a slave port. + * @param nrr The neighbor rate ratio as measured on a slave port. */ -void clock_peer_delay(struct clock *c, tmv_t ppd); +void clock_peer_delay(struct clock *c, tmv_t ppd, double nrr); /** * Poll for events and dispatch them. diff --git a/port.c b/port.c index 0ff5a73..4c3cc52 100644 --- a/port.c +++ b/port.c @@ -1183,7 +1183,7 @@ calc: port_nrate_calculate(p, t3, t4, tmv_add(c1, c2)); if (p->state == PS_UNCALIBRATED || p->state == PS_SLAVE) { - clock_peer_delay(p->clock, p->peer_delay); + clock_peer_delay(p->clock, p->peer_delay, p->nrate.ratio); } }