Signed-off-by: Miroslav Lichvar <mlich...@redhat.com> --- clock.c | 22 ++++++++++++++++++---- clock.h | 5 ++++- port.c | 3 ++- 3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/clock.c b/clock.c index b841e81..9bc0352 100644 --- a/clock.c +++ b/clock.c @@ -108,8 +108,11 @@ struct clock { double nrr; tmv_t c1; tmv_t c2; + tmv_t c3; tmv_t t1; tmv_t t2; + tmv_t t3; + tmv_t t4; struct clock_description desc; struct clock_stats stats; int stats_interval; @@ -1295,16 +1298,20 @@ void clock_path_delay(struct clock *c, struct timespec req, struct timestamp rx, tmv_t c1, c2, c3, pd, t1, t2, t3, t4; double rr; + c->t3 = timespec_to_tmv(req); + c->t4 = timestamp_to_tmv(rx); + c->c3 = correction_to_tmv(correction); + if (tmv_is_zero(c->t1)) return; c1 = c->c1; c2 = c->c2; - c3 = correction_to_tmv(correction); + c3 = c->c3; t1 = c->t1; t2 = c->t2; - t3 = timespec_to_tmv(req); - t4 = timestamp_to_tmv(rx); + t3 = c->t3; + t4 = c->t4; rr = clock_rate_ratio(c); /* @@ -1341,10 +1348,13 @@ void clock_path_delay(struct clock *c, struct timespec req, struct timestamp rx, stats_add_value(c->stats.delay, tmv_to_nanoseconds(pd)); } -void clock_peer_delay(struct clock *c, tmv_t ppd, double nrr) +void clock_peer_delay(struct clock *c, tmv_t ppd, tmv_t req, tmv_t rx, + double nrr) { c->path_delay = ppd; c->nrr = nrr; + c->t3 = req; + c->t4 = rx; if (c->stats.delay) stats_add_value(c->stats.delay, tmv_to_nanoseconds(ppd)); @@ -1453,6 +1463,8 @@ enum servo_state clock_synchronize(struct clock *c, clockadj_step(c->clkid, -tmv_to_nanoseconds(c->master_offset)); c->t1 = tmv_zero(); c->t2 = tmv_zero(); + c->t3 = tmv_zero(); + c->t4 = tmv_zero(); if (c->sanity_check) { clockcheck_set_freq(c->sanity_check, -adj); clockcheck_step(c->sanity_check, @@ -1534,6 +1546,8 @@ static void handle_state_decision_event(struct clock *c) filter_reset(c->delay_filter); c->t1 = tmv_zero(); c->t2 = tmv_zero(); + c->t3 = tmv_zero(); + c->t4 = tmv_zero(); c->path_delay = 0; c->nrr = 1.0; fresh_best = 1; diff --git a/clock.h b/clock.h index 4834464..b3a5c9f 100644 --- a/clock.h +++ b/clock.h @@ -179,9 +179,12 @@ 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 req The transmission time of the pdelay request message. + * @param rx The reception time of the pdelay request message. * @param nrr The neighbor rate ratio as measured on a slave port. */ -void clock_peer_delay(struct clock *c, tmv_t ppd, double nrr); +void clock_peer_delay(struct clock *c, tmv_t ppd, tmv_t req, tmv_t rx, + double nrr); /** * Poll for events and dispatch them. diff --git a/port.c b/port.c index 18a956d..7f9aa3d 100644 --- a/port.c +++ b/port.c @@ -1854,7 +1854,8 @@ 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, p->nrate.ratio); + clock_peer_delay(p->clock, p->peer_delay, t1, t2, + p->nrate.ratio); } msg_put(p->peer_delay_req); -- 2.1.0 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel