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 | 15 ++++++++------- dm.h | 3 +++ port.c | 12 ++++++++++-- port.h | 7 +++++++ ptp4l.8 | 15 ++++++++++----- ptp4l.c | 10 ++++++++-- unicast_client.c | 11 ++++++++--- 8 files changed, 57 insertions(+), 20 deletions(-) diff --git a/clock.c b/clock.c index f808b35..1c68071 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_NONE)) { 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..b30d22e 100644 --- a/config.c +++ b/config.c @@ -168,9 +168,10 @@ static struct config_enum delay_filter_enu[] = { }; static struct config_enum delay_mech_enu[] = { - { "Auto", DM_AUTO }, - { "E2E", DM_E2E }, - { "P2P", DM_P2P }, + { "Auto", DM_AUTO }, + { "E2E", DM_E2E }, + { "P2P", DM_P2P }, + { "NO_MECHANISM", DM_NONE }, { NULL, 0 }, }; @@ -205,10 +206,10 @@ static struct config_enum timestamping_enu[] = { }; static struct config_enum tsproc_enu[] = { - { "filter", TSPROC_FILTER }, - { "raw", TSPROC_RAW }, - { "filter_weight", TSPROC_FILTER_WEIGHT }, - { "raw_weight", TSPROC_RAW_WEIGHT }, + { "filter", TSPROC_FILTER }, + { "raw", TSPROC_RAW }, + { "filter_weight", TSPROC_FILTER_WEIGHT }, + { "raw_weight", TSPROC_RAW_WEIGHT }, { NULL, 0 }, }; diff --git a/dm.h b/dm.h index 2491c63..9f76915 100644 --- a/dm.h +++ b/dm.h @@ -33,6 +33,9 @@ enum delay_mechanism { /** Peer delay mechanism. */ DM_P2P, + + /** No Delay Mechanism. */ + DM_NONE = 0xFE, }; #endif diff --git a/port.c b/port.c index d9dac38..3d5cb41 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_NONE) { 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_NONE) { + 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..cdb9d42 100644 --- a/ptp4l.8 +++ b/ptp4l.8 @@ -42,6 +42,10 @@ 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 +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 +249,8 @@ 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, NO_MECHANISM +and Auto. The default is E2E. .TP .B hybrid_e2e @@ -338,10 +343,10 @@ smaller than this value the port is marked as not 802.1AS capable. .TP .B tsproc_mode Select the time stamp processing mode used to calculate offset and delay. -Possible values are filter, raw, filter_weight, raw_weight. Raw modes perform -well when the rate of sync messages (logSyncInterval) is similar to the rate of -delay messages (logMinDelayReqInterval or logMinPdelayReqInterval). Weighting -is useful with larger network jitters (e.g. software time stamping). +Possible values are filter, raw, filter_weight, raw_weight, no_delay. Raw modes +perform well when the rate of sync messages (logSyncInterval) is similar to the +rate of delay messages (logMinDelayReqInterval or logMinPdelayReqInterval). +Weighting is useful with larger network jitters (e.g. software time stamping). The default is filter. .TP .B delay_filter diff --git a/ptp4l.c b/ptp4l.c index c61175b..31b14e8 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" " 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_NONE)) + 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..b5551e1 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_NONE) { 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_NONE) { 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_NONE) { + 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