As per IEEE1588-2019, Table 21 adding NO_MECHANISM support. In this
case port does not implement the delay mechanism.

Signed-off-by: Greg Armstrong <greg.armstrong...@renesas.com>
Signed-off-by: Leon Goldin <leon.goldin...@renesas.com>
Signed-off-by: Devasish Dey <devasish....@syncmonk.net>
Signed-off-by: Vipin Sharma <vipin.sha...@syncmonk.net>
---
 clock.c          |  4 +++-
 config.c         |  1 +
 dm.h             |  3 +++
 port.c           |  8 ++++++++
 port.h           |  7 +++++++
 ptp4l.8          |  2 +-
 unicast_client.c | 11 ++++++++---
 7 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/clock.c b/clock.c
index 16ca6ed..d37bb87 100644
--- a/clock.c
+++ b/clock.c
@@ -1998,8 +1998,10 @@ static void handle_state_decision_event(struct clock *c)
                if (c->sanity_check)
                        clockcheck_reset(c->sanity_check);
                tsproc_reset(c->tsproc, 1);
-               if (!tmv_is_zero(c->initial_delay))
+               if (!tmv_is_zero(c->initial_delay) || (best &&
+                       port_delay_mechanism(best->port) == DM_NO_MECHANISM)) {
                        tsproc_set_delay(c->tsproc, c->initial_delay);
+               }
                c->ingress_ts = tmv_zero();
                c->path_delay = c->initial_delay;
                c->master_local_rr = 1.0;
diff --git a/config.c b/config.c
index 6ba9996..b5cf397 100644
--- a/config.c
+++ b/config.c
@@ -171,6 +171,7 @@ static struct config_enum delay_mech_enu[] = {
        { "Auto", DM_AUTO },
        { "E2E",  DM_E2E },
        { "P2P",  DM_P2P },
+       { "NONE", DM_NO_MECHANISM },
        { NULL, 0 },
 };
 
diff --git a/dm.h b/dm.h
index 2491c63..47bd847 100644
--- a/dm.h
+++ b/dm.h
@@ -33,6 +33,9 @@ enum delay_mechanism {
 
        /** Peer delay mechanism. */
        DM_P2P,
+
+       /** No Delay Mechanism. */
+       DM_NO_MECHANISM = 0xFE,
 };
 
 #endif
diff --git a/port.c b/port.c
index ce1ff33..15af41a 100644
--- a/port.c
+++ b/port.c
@@ -1854,6 +1854,9 @@ int port_initialize(struct port *p)
                pr_err("inhibit_delay_req can only be set when asCapable == 
'true'.");
                return -1;
        }
+       if (port_delay_mechanism(p) == DM_NO_MECHANISM) {
+               p->inhibit_delay_req = 1;
+       }
 
        for (i = 0; i < N_TIMER_FDS; i++) {
                fd[i] = -1;
@@ -3396,6 +3399,11 @@ enum port_state port_state(struct port *port)
        return port->state;
 }
 
+enum delay_mechanism port_delay_mechanism(struct port *port)
+{
+       return port->delayMechanism;
+}
+
 int port_state_update(struct port *p, enum fsm_event event, int mdiff)
 {
        enum port_state next = p->state_machine(p->state, event, mdiff);
diff --git a/port.h b/port.h
index 37a4e19..4854698 100644
--- a/port.h
+++ b/port.h
@@ -227,6 +227,13 @@ struct ptp_message *port_signaling_construct(struct port 
*p,
  */
 enum port_state port_state(struct port *port);
 
+/**
+ * Return  port's delay mechanism method.
+ * @param port A port instance.
+ * @return     one of the @ref delay_mechanism values.
+ */
+enum delay_mechanism port_delay_mechanism(struct port *port);
+
 /**
  * Update a port's current state based on a given event.
  * @param p        A pointer previously obtained via port_open().
diff --git a/ptp4l.8 b/ptp4l.8
index e33454a..1268802 100644
--- a/ptp4l.8
+++ b/ptp4l.8
@@ -245,7 +245,7 @@ the fault be reset immediately.
 The default is 16 seconds.
 .TP
 .B delay_mechanism
-Select the delay mechanism. Possible values are E2E, P2P and Auto.
+Select the delay mechanism. Possible values are E2E, P2P, NONE and Auto.
 The default is E2E.
 .TP
 .B hybrid_e2e
diff --git a/unicast_client.c b/unicast_client.c
index 8ebe06f..20f9558 100644
--- a/unicast_client.c
+++ b/unicast_client.c
@@ -26,6 +26,7 @@
 
 #define E2E_SYDY_MASK  (1 << ANNOUNCE | 1 << SYNC | 1 << DELAY_RESP)
 #define P2P_SYDY_MASK  (1 << ANNOUNCE | 1 << SYNC)
+#define E2E_SY_MASK (1 << ANNOUNCE | 1 << SYNC)
 
 static int attach_ack(struct ptp_message *msg, uint8_t message_type_flags)
 {
@@ -200,7 +201,8 @@ static int unicast_client_renew(struct port *p,
                if (err) {
                        goto out;
                }
-               if (p->delayMechanism != DM_P2P) {
+               if (p->delayMechanism != DM_P2P &&
+                               p->delayMechanism != DM_NO_MECHANISM) {
                        err = attach_request(msg, p->logMinDelayReqInterval,
                                             DELAY_RESP,
                                             p->unicast_req_duration);
@@ -253,9 +255,10 @@ static int unicast_client_sydy(struct port *p,
        if (err) {
                goto out;
        }
-       if (p->delayMechanism != DM_P2P) {
+       if (p->delayMechanism != DM_P2P &&
+                       p->delayMechanism != DM_NO_MECHANISM) {
                err = attach_request(msg, p->logMinDelayReqInterval, DELAY_RESP,
-                                    p->unicast_req_duration);
+                               p->unicast_req_duration);
                if (err) {
                        goto out;
                }
@@ -400,6 +403,8 @@ int unicast_client_initialize(struct port *p)
                }
                if (p->delayMechanism == DM_P2P) {
                        master->sydymsk = P2P_SYDY_MASK;
+               } else if (p->delayMechanism == DM_NO_MECHANISM) {
+                       master->sydymsk = E2E_SY_MASK;
                } else {
                        master->sydymsk = E2E_SYDY_MASK;
                }
-- 
2.17.1



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

Reply via email to