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 | 12 ++++++++++-- port.h | 7 +++++++ ptp4l.8 | 7 ++++++- ptp4l.c | 10 ++++++++-- unicast_client.c | 11 ++++++++--- 8 files changed, 46 insertions(+), 9 deletions(-) diff --git a/clock.c b/clock.c index f808b35..56adea7 100644 --- a/clock.c +++ b/clock.c @@ -1996,8 +1996,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 d9dac38..4ec7a02 100644 --- a/port.c +++ b/port.c @@ -1195,7 +1195,7 @@ int port_set_announce_tmo(struct port *p) int port_set_delay_tmo(struct port *p) { - if (p->inhibit_delay_req) { + if (p->inhibit_delay_req || p->delayMechanism == DM_NO_MECHANISM) { return 0; } @@ -2031,7 +2031,10 @@ static int process_delay_req(struct port *p, struct ptp_message *m) return 0; } - if (p->delayMechanism == DM_P2P) { + if (p->delayMechanism == DM_NO_MECHANISM) { + pr_warning("port %hu: delay request not supported", portnum(p)); + return 0; + } else if (p->delayMechanism == DM_P2P) { pr_warning("%s: delay request on P2P port", p->log_name); return 0; } @@ -3383,6 +3386,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..d0a8cff 100644 --- a/ptp4l.8 +++ b/ptp4l.8 @@ -42,6 +42,11 @@ port using the E2E mechanism. Select the peer delay (P2P) mechanism. A warning will be printed when a delay request is received on port using the P2P mechanism. .TP +.B \-N +Select the NONE mechanism. The PTP port does not support delay mechanism. +This is used when PTP instance supports only frequency transfer or path delay +is neglected by the PTP instance. +.TP .B \-2 Select the IEEE 802.3 network transport. .TP @@ -245,7 +250,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/ptp4l.c b/ptp4l.c index c61175b..de04bb9 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -43,7 +43,8 @@ static void usage(char *progname) " Delay Mechanism\n\n" " -A Auto, starting with E2E\n" " -E E2E, delay request-response (default)\n" - " -P P2P, peer delay mechanism\n\n" + " -P P2P, peer delay mechanism\n" + " -N NO_MECHANISM, no mechanism\n\n" " Network Transport\n\n" " -2 IEEE 802.3\n" " -4 UDP IPV4 (default)\n" @@ -89,7 +90,7 @@ int main(int argc, char *argv[]) /* Process the command line arguments. */ progname = strrchr(argv[0], '/'); progname = progname ? 1+progname : argv[0]; - while (EOF != (c = getopt_long(argc, argv, "AEP246HSLf:i:p:sl:mqvh", + while (EOF != (c = getopt_long(argc, argv, "AEPN246HSLf:i:p:sl:mqvh", opts, &index))) { switch (c) { case 0: @@ -108,6 +109,11 @@ int main(int argc, char *argv[]) if (config_set_int(cfg, "delay_mechanism", DM_P2P)) goto out; break; + case 'N': + if (config_set_int(cfg, + "delay_mechanism", DM_NO_MECHANISM)) + goto out; + break; case '2': if (config_set_int(cfg, "network_transport", TRANS_IEEE_802_3)) 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