clock: add option to specify initial path delay.

This option allows the clock to be updated before the path delay is
measured in order to speed up the initial correction of the clock, e.g.
in domains using a very long logMinDelayReqInterval.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
master
Miroslav Lichvar 2018-02-15 12:48:39 +01:00 committed by Richard Cochran
parent 16e9abceee
commit 4b957cf566
3 changed files with 12 additions and 1 deletions

View File

@ -110,6 +110,7 @@ struct clock {
tmv_t master_offset; tmv_t master_offset;
tmv_t path_delay; tmv_t path_delay;
tmv_t ingress_ts; tmv_t ingress_ts;
tmv_t initial_delay;
struct tsproc *tsproc; struct tsproc *tsproc;
struct freq_estimator fest; struct freq_estimator fest;
struct time_status_np status; struct time_status_np status;
@ -1070,6 +1071,7 @@ struct clock *clock_create(enum clock_type type, struct config *config,
pr_err("Failed to create time stamp processor"); pr_err("Failed to create time stamp processor");
return NULL; return NULL;
} }
c->initial_delay = dbl_tmv(config_get_int(config, NULL, "initial_delay"));
c->nrr = 1.0; c->nrr = 1.0;
c->stats_interval = config_get_int(config, NULL, "summary_interval"); c->stats_interval = config_get_int(config, NULL, "summary_interval");
c->stats.offset = stats_create(); c->stats.offset = stats_create();
@ -1710,8 +1712,10 @@ static void handle_state_decision_event(struct clock *c)
if (!cid_eq(&best_id, &c->best_id)) { if (!cid_eq(&best_id, &c->best_id)) {
clock_freq_est_reset(c); clock_freq_est_reset(c);
tsproc_reset(c->tsproc, 1); tsproc_reset(c->tsproc, 1);
if (c->initial_delay)
tsproc_set_delay(c->tsproc, c->initial_delay);
c->ingress_ts = tmv_zero(); c->ingress_ts = tmv_zero();
c->path_delay = 0; c->path_delay = c->initial_delay;
c->nrr = 1.0; c->nrr = 1.0;
fresh_best = 1; fresh_best = 1;
} }

View File

@ -193,6 +193,7 @@ struct config_item config_tab[] = {
GLOB_ITEM_INT("gmCapable", 1, 0, 1), GLOB_ITEM_INT("gmCapable", 1, 0, 1),
PORT_ITEM_INT("hybrid_e2e", 0, 0, 1), PORT_ITEM_INT("hybrid_e2e", 0, 0, 1),
PORT_ITEM_INT("ingressLatency", 0, INT_MIN, INT_MAX), PORT_ITEM_INT("ingressLatency", 0, INT_MIN, INT_MAX),
GLOB_ITEM_INT("initial_delay", 0, 0, INT_MAX),
GLOB_ITEM_INT("kernel_leap", 1, 0, 1), GLOB_ITEM_INT("kernel_leap", 1, 0, 1),
PORT_ITEM_INT("logAnnounceInterval", 1, INT8_MIN, INT8_MAX), PORT_ITEM_INT("logAnnounceInterval", 1, INT8_MIN, INT8_MAX),
PORT_ITEM_INT("logMinDelayReqInterval", 0, INT8_MIN, INT8_MAX), PORT_ITEM_INT("logMinDelayReqInterval", 0, INT8_MIN, INT8_MAX),

View File

@ -453,6 +453,12 @@ the synchronized clock. When a larger offset is measured, a warning message
will be printed and the servo will be reset. When set to 0, the sanity check is will be printed and the servo will be reset. When set to 0, the sanity check is
disabled. The default is 200000000 (20%). disabled. The default is 200000000 (20%).
.TP .TP
.B initial_delay
The initial path delay of the clock in nanoseconds used for synchronization of
the clock before the delay is measured using the E2E or P2P delay mechanism. If
set to 0, the clock will not be updated until the delay is measured.
The default is 0.
.TP
.B ntpshm_segment .B ntpshm_segment
The number of the SHM segment used by ntpshm servo. The number of the SHM segment used by ntpshm servo.
The default is 0. The default is 0.