From 450b1ed844f6f5e0e2a0881b08a0afd1d6a2d76a Mon Sep 17 00:00:00 2001 From: Vedang Patel Date: Thu, 28 Mar 2019 20:32:31 -0700 Subject: [PATCH] port: Add inhibit_delay_req. 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. Signed-off-by: Vedang Patel --- config.c | 3 ++- configs/automotive-master.cfg | 1 + configs/default.cfg | 1 + port.c | 10 ++++++++++ port_private.h | 1 + ptp4l.8 | 5 +++++ 6 files changed, 20 insertions(+), 1 deletion(-) diff --git a/config.c b/config.c index 0da7ce4..93ea5da 100644 --- a/config.c +++ b/config.c @@ -244,8 +244,9 @@ struct config_item config_tab[] = { PORT_ITEM_INT("ignore_transport_specific", 0, 0, 1), 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), GLOB_ITEM_INT("initial_delay", 0, 0, INT_MAX), + PORT_ITEM_INT("inhibit_delay_req", 0, 0, 1), + PORT_ITEM_INT("inhibit_multicast_service", 0, 0, 1), 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/configs/automotive-master.cfg b/configs/automotive-master.cfg index e3ad5a3..2edee76 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 2433553..e23dfd7 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 0aaf846..5a4a116 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); @@ -1657,6 +1661,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 bb1d86e..9a5022d 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 df7da82..1a01108 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.