From: Kishen Maloor <kishen.mal...@intel.com>

This change defines 'allowedLostResponses' as a per-port parameter
with a default value of 3 (per IEEE 802.1AS-2011, clause 11.5.3).
(Note that this also matches the value of the previously #define'd
ALLOWED_LOST_RESPONSES).

It is now configurable 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>
Signed-off-by: Chwee-Lin Choong <chwee.lin.cho...@intel.com>
---
 config.c       | 1 +
 port.c         | 6 +++---
 port_private.h | 1 +
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/config.c b/config.c
index b104f1b..8d5bab7 100644
--- a/config.c
+++ b/config.c
@@ -235,6 +235,7 @@ static struct config_enum bmca_enu[] = {
 };
 
 struct config_item config_tab[] = {
+       PORT_ITEM_INT("allowedLostResponses", 3, 1, 255),
        PORT_ITEM_INT("announceReceiptTimeout", 3, 2, UINT8_MAX),
        PORT_ITEM_ENU("asCapable", AS_CAPABLE_AUTO, as_capable_enu),
        GLOB_ITEM_INT("assume_two_step", 0, 0, 1),
diff --git a/port.c b/port.c
index 5803cd3..69ac9e3 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
 
 enum syfu_event {
@@ -720,7 +719,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);
@@ -1244,7 +1243,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;
 
@@ -3405,6 +3404,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 3b02d2f..1ef816a 100644
--- a/port_private.h
+++ b/port_private.h
@@ -146,6 +146,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;
-- 
2.42.0



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

Reply via email to