Add provision to disable delay requests. Designated masters who do not
need to calculate pdelay can use this option. This is required by
Automotive Profile to reduce network load.

Change-Id: Iba4dbc4f6243f9e895393a1a20a5328ea89b5a36
Signed-off-by: Vedang Patel <vedang.pa...@intel.com>
---
 config.c                      |  1 +
 configs/automotive-master.cfg |  1 +
 configs/default.cfg           |  1 +
 port.c                        | 10 ++++++++++
 port_private.h                |  1 +
 ptp4l.8                       |  5 +++++
 6 files changed, 19 insertions(+)

diff --git a/config.c b/config.c
index eaa083306d75..8469592303a3 100644
--- a/config.c
+++ b/config.c
@@ -245,6 +245,7 @@ struct config_item config_tab[] = {
        PORT_ITEM_INT("ingressLatency", 0, INT_MIN, INT_MAX),
        PORT_ITEM_INT("inhibit_announce", 0, 0, 1),
        PORT_ITEM_INT("inhibit_multicast_service", 0, 0, 1),
+       PORT_ITEM_INT("inhibit_delay_req", 0, 0, 1),
        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),
diff --git a/configs/automotive-master.cfg b/configs/automotive-master.cfg
index e3ad5a35ebe2..2edee7666877 100644
--- a/configs/automotive-master.cfg
+++ b/configs/automotive-master.cfg
@@ -26,3 +26,4 @@ BMCA                  noop
 masterOnly             1
 inhibit_announce       1
 asCapable               true
+inhibit_delay_req       1
diff --git a/configs/default.cfg b/configs/default.cfg
index 243355357829..e23dfd7c60f8 100644
--- a/configs/default.cfg
+++ b/configs/default.cfg
@@ -37,6 +37,7 @@ G.8275.portDS.localPriority   128
 asCapable               auto
 BMCA                    ptp
 inhibit_announce        0
+inhibit_pdelay_req      0
 ignore_source_id        0
 #
 # Run time options
diff --git a/port.c b/port.c
index 373bc886eb27..08fc87d40845 100644
--- a/port.c
+++ b/port.c
@@ -1056,6 +1056,10 @@ int port_set_announce_tmo(struct port *p)
 
 int port_set_delay_tmo(struct port *p)
 {
+       if (p->inhibit_delay_req) {
+               return 0;
+       }
+
        if (p->delayMechanism == DM_P2P) {
                return set_tmo_log(p->fda.fd[FD_DELAY_TIMER], 1,
                               p->logPdelayReqInterval);
@@ -1642,6 +1646,12 @@ int port_initialize(struct port *p)
                p->asCapable = NOT_CAPABLE;
        }
 
+       p->inhibit_delay_req       = config_get_int(cfg, p->name, 
"inhibit_delay_req");
+       if (p->inhibit_delay_req && p->asCapable != ALWAYS_CAPABLE) {
+               pr_err("inhibit_delay_req can only be set when asCapable == 
'true'.");
+               return -1;
+       }
+
        for (i = 0; i < N_TIMER_FDS; i++) {
                fd[i] = -1;
        }
diff --git a/port_private.h b/port_private.h
index 47a4c4f9e48a..2e2de36a72ed 100644
--- a/port_private.h
+++ b/port_private.h
@@ -100,6 +100,7 @@ struct port {
        int bmca;
        int inhibit_announce;
        int ignore_source_id;
+       int inhibit_delay_req;
        /* portDS */
        struct PortIdentity portIdentity;
        enum port_state     state; /*portState*/
diff --git a/ptp4l.8 b/ptp4l.8
index fad21bf57724..bca81afe7ecc 100644
--- a/ptp4l.8
+++ b/ptp4l.8
@@ -186,6 +186,11 @@ the interval specified by this config option after the 
interval_update_timer
 expires. It's specified as a power of two in seconds. The default value is 0 (1
 second).
 .TP
+.B inhibit_delay_req
+Don't send any delay requests. This will need the asCapable config option to be
+set to 'true'. This is useful when running as a designated master who does not
+need to calculate offset from slave. The default is 0 (disabled).
+.TP
 .B announceReceiptTimeout
 The number of missed Announce messages before the last Announce messages
 expires.
-- 
2.7.3



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to