When using long chains of transparent clocks, the recommended practice is to measure the rate ratio without adjusting the local clock. Then the residence times should be corrected to reflect the master's frequency.
This patch expands the clock_rate_ratio() method to provide the estimated ratio when the clock is free running. Signed-off-by: Richard Cochran <[email protected]> --- clock.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clock.c b/clock.c index ed440d7..b0d0542 100644 --- a/clock.c +++ b/clock.c @@ -115,6 +115,7 @@ struct clock { struct tsproc *tsproc; struct freq_estimator fest; struct time_status_np status; + double master_local_rr; /* maintained when free_running */ double nrr; struct clock_description desc; struct clock_stats stats; @@ -611,6 +612,8 @@ static enum servo_state clock_no_adjust(struct clock *c, tmv_t ingress, f->origin1 = origin; f->count = 0; + c->master_local_rr = ratio; + return state; } @@ -1061,6 +1064,7 @@ struct clock *clock_create(enum clock_type type, struct config *config, return NULL; } c->initial_delay = dbl_tmv(config_get_int(config, NULL, "initial_delay")); + c->master_local_rr = 1.0; c->nrr = 1.0; c->stats_interval = config_get_int(config, NULL, "summary_interval"); c->stats.offset = stats_create(); @@ -1775,5 +1779,8 @@ void clock_check_ts(struct clock *c, uint64_t ts) double clock_rate_ratio(struct clock *c) { + if (c->free_running) { + return c->master_local_rr; + } return servo_rate_ratio(c->servo); } -- 2.11.0 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
