From: Miroslav Lichvar <mlich...@redhat.com>

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 <mlich...@redhat.com>
---
 clock.c  | 6 +++++-
 config.c | 1 +
 ptp4l.8  | 6 ++++++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/clock.c b/clock.c
index 6dbc45e..4532664 100644
--- a/clock.c
+++ b/clock.c
@@ -110,6 +110,7 @@ struct clock {
        tmv_t master_offset;
        tmv_t path_delay;
        tmv_t ingress_ts;
+       tmv_t initial_delay;
        struct tsproc *tsproc;
        struct freq_estimator fest;
        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");
                return NULL;
        }
+       c->initial_delay = dbl_tmv(config_get_int(config, NULL, 
"initial_delay"));
        c->nrr = 1.0;
        c->stats_interval = config_get_int(config, NULL, "summary_interval");
        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)) {
                clock_freq_est_reset(c);
                tsproc_reset(c->tsproc, 1);
+               if (c->initial_delay)
+                       tsproc_set_delay(c->tsproc, c->initial_delay);
                c->ingress_ts = tmv_zero();
-               c->path_delay = 0;
+               c->path_delay = c->initial_delay;
                c->nrr = 1.0;
                fresh_best = 1;
        }
diff --git a/config.c b/config.c
index bbaf36e..56d1556 100644
--- a/config.c
+++ b/config.c
@@ -193,6 +193,7 @@ struct config_item config_tab[] = {
        GLOB_ITEM_INT("gmCapable", 1, 0, 1),
        PORT_ITEM_INT("hybrid_e2e", 0, 0, 1),
        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),
        PORT_ITEM_INT("logAnnounceInterval", 1, INT8_MIN, INT8_MAX),
        PORT_ITEM_INT("logMinDelayReqInterval", 0, INT8_MIN, INT8_MAX),
diff --git a/ptp4l.8 b/ptp4l.8
index a724151..4cf0b0c 100644
--- a/ptp4l.8
+++ b/ptp4l.8
@@ -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
 disabled. The default is 200000000 (20%).
 .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
 The number of the SHM segment used by ntpshm servo.
 The default is 0.
-- 
1.8.3.1


------------------------------------------------------------------------------
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
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to