This change adds 'allowedLostResponses' as a per-port parameter
with a default value of 3 (per IEEE 802.1AS-2011, clause 11.5.3).
(Note that this matches the value of the previously #define'd
ALLOWED_LOST_RESPONSES, so this change does not alter any prevailing
behavior)

It is now configurable to be able to comply with IEEE 802.1AS-2020,
clause 11.5.3 which specifies a default value of 9 (and in the range of
1-255).

Signed-off-by: Kishen Maloor <kishen.mal...@intel.com>
---
 config.c       | 1 +
 port.c         | 6 +++---
 port_private.h | 1 +
 ptp4l.8        | 6 ++++++
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/config.c b/config.c
index 0482554feb28..5e68fc8ff65a 100644
--- a/config.c
+++ b/config.c
@@ -250,6 +250,7 @@ struct config_item config_tab[] = {
        PORT_ITEM_INT("run_cmlds", 0, 0, 1),
        PORT_ITEM_INT("cmlds_portNumber", 0, 0, UINT16_MAX),
        PORT_ITEM_STR("cmlds_uds_address", "/var/run/ptp4l"),
+       PORT_ITEM_INT("allowedLostResponses", 3, 1, 255),
        GLOB_ITEM_INT("clock_class_threshold", CLOCK_CLASS_THRESHOLD_DEFAULT, 
6, CLOCK_CLASS_THRESHOLD_DEFAULT),
        GLOB_ITEM_ENU("clock_servo", CLOCK_SERVO_PI, clock_servo_enu),
        GLOB_ITEM_ENU("clock_type", CLOCK_TYPE_ORDINARY, clock_type_enu),
diff --git a/port.c b/port.c
index 946b8235ecd5..6bb13177f3fc 100644
--- a/port.c
+++ b/port.c
@@ -45,7 +45,6 @@
 #include "unicast_service.h"
 #include "util.h"
 
-#define ALLOWED_LOST_RESPONSES 3
 #define ANNOUNCE_SPAN 1
 #define CMLDS_TRANSPORTSPECIFIC 0x20
 #define CMLDS_DOMAINNUMBER 0
@@ -722,7 +721,7 @@ int port_capable(struct port *p)
                goto not_capable;
        }
 
-       if (p->pdr_missing > ALLOWED_LOST_RESPONSES) {
+       if (p->pdr_missing > p->allowedLostResponses) {
                if (p->asCapable)
                        pr_debug("%s: missed %d peer delay resp, "
                                "resetting asCapable", p->log_name, 
p->pdr_missing);
@@ -1338,7 +1337,7 @@ static void port_nrate_initialize(struct port *p)
        }
 
        /* We start in the 'incapable' state. */
-       p->pdr_missing = ALLOWED_LOST_RESPONSES + 1;
+       p->pdr_missing = p->allowedLostResponses + 1;
 
        p->peer_portid_valid = 0;
 
@@ -3576,6 +3575,7 @@ struct port *port_open(const char *phc_device,
        p->pwr.totalTimeInaccuracy =
                config_get_int(cfg, p->name, 
"power_profile.2017.totalTimeInaccuracy");
        p->slave_event_monitor = clock_slave_monitor(clock);
+       p->allowedLostResponses = config_get_int(cfg, p->name, 
"allowedLostResponses");
 
        if (!port_is_uds(p) && unicast_client_initialize(p)) {
                goto err_transport;
diff --git a/port_private.h b/port_private.h
index 664d14944919..16228ed4d530 100644
--- a/port_private.h
+++ b/port_private.h
@@ -148,6 +148,7 @@ struct port {
        UInteger8           versionNumber; /* UInteger4 */
        UInteger8           delay_response_counter;
        UInteger8           delay_response_timeout;
+       UInteger8           allowedLostResponses;
        bool                iface_rate_tlv;
        Integer64           portAsymmetry;
        struct PortStats    stats;
diff --git a/ptp4l.8 b/ptp4l.8
index d999352cd45a..d28fa98120be 100644
--- a/ptp4l.8
+++ b/ptp4l.8
@@ -484,6 +484,12 @@ The default is 3600 seconds or one hour.
 
 .SH PROGRAM AND CLOCK OPTIONS
 
+.TP
+.B allowedLostResponses
+The number of Pdelay_Req messages without valid responses above which a port
+is considered to be not exchanging peer delay messages with its neighbor.
+The default value is 3.
+
 .TP
 .B asCapable
 If set to 'true', all the checks which can unset asCapable variable (as
-- 
2.31.1



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

Reply via email to