Hi,
gPTP requires that PTP_TIMESCALE flag is set in messages. I noticed that PDelayReq, PDelayResp, PDelayRespFollowUp, Sync, FollowUp and Signaling all have that flag set to 0. One of the bridges just ignores communication with ptp4l because of that. The fault is on both sides, because gPTP specification says that PTP_TIMESCALE should be set to 1 and ignored on reception. Since fixing linuxptp is easier I created a patch which should fix that problem. flagField[1] was not set at all during messages construction. The patch is only changing messages construction for gPTP relevant messages because only those I could test. Regards, Marcin Miklas
From 4409a54e47cc6497bf3ed8289f0ebf166ae58af0 Mon Sep 17 00:00:00 2001 From: Marcin Miklas <marcin.mik...@harman.com> Date: Tue, 9 Mar 2021 15:47:48 +0100 Subject: [PATCH] Add setting of PTP_TIMESCALE flag In gPTP PTP_TIMESCALE flag should be set to 1. It looks like the flags where not properly set for any of messages used in gPTP. Some of the automotive gPTP bridges where rejecting the PDelayReq messages because of missing flag. I would say that both linuxptp and the bridge doesn't conform to gPTP specification where it is said that the PTP_TIMESCALE should be set to 1 and ignored on reception. Signed-off-by: Marcin Miklas <marcin.mik...@harman.com> --- port.c | 5 +++++ port_signaling.c | 1 + 2 files changed, 6 insertions(+) diff --git a/port.c b/port.c index da7c327..977c8c5 100644 --- a/port.c +++ b/port.c @@ -1356,6 +1356,7 @@ static int port_pdelay_request(struct port *p) msg->header.ver = PTP_VERSION; msg->header.messageLength = sizeof(struct pdelay_req_msg); msg->header.domainNumber = clock_domain_number(p->clock); + msg->header.flagField[1] = clock_time_properties(p->clock).flags; msg->header.correction = -p->asymmetry; msg->header.sourcePortIdentity = p->portIdentity; msg->header.sequenceId = p->seqnum.delayreq++; @@ -1550,6 +1551,7 @@ int port_tx_sync(struct port *p, struct address *dst) msg->header.ver = PTP_VERSION; msg->header.messageLength = sizeof(struct sync_msg); msg->header.domainNumber = clock_domain_number(p->clock); + msg->header.flagField[1] = clock_time_properties(p->clock).flags; msg->header.sourcePortIdentity = p->portIdentity; msg->header.sequenceId = p->seqnum.sync++; msg->header.control = CTL_SYNC; @@ -1586,6 +1588,7 @@ int port_tx_sync(struct port *p, struct address *dst) fup->header.ver = PTP_VERSION; fup->header.messageLength = sizeof(struct follow_up_msg); fup->header.domainNumber = clock_domain_number(p->clock); + fup->header.flagField[1] = clock_time_properties(p->clock).flags; fup->header.sourcePortIdentity = p->portIdentity; fup->header.sequenceId = p->seqnum.sync - 1; fup->header.control = CTL_FOLLOW_UP; @@ -2117,6 +2120,7 @@ int process_pdelay_req(struct port *p, struct ptp_message *m) rsp->header.ver = PTP_VERSION; rsp->header.messageLength = sizeof(struct pdelay_resp_msg); rsp->header.domainNumber = m->header.domainNumber; + rsp->header.flagField[1] = clock_time_properties(p->clock).flags; rsp->header.sourcePortIdentity = p->portIdentity; rsp->header.sequenceId = m->header.sequenceId; rsp->header.control = CTL_OTHER; @@ -2164,6 +2168,7 @@ int process_pdelay_req(struct port *p, struct ptp_message *m) fup->header.ver = PTP_VERSION; fup->header.messageLength = sizeof(struct pdelay_resp_fup_msg); fup->header.domainNumber = m->header.domainNumber; + fup->header.flagField[1] = clock_time_properties(p->clock).flags; fup->header.correction = m->header.correction; fup->header.sourcePortIdentity = p->portIdentity; fup->header.sequenceId = m->header.sequenceId; diff --git a/port_signaling.c b/port_signaling.c index ed217c0..c76bfdf 100644 --- a/port_signaling.c +++ b/port_signaling.c @@ -44,6 +44,7 @@ struct ptp_message *port_signaling_construct(struct port *p, msg->header.ver = PTP_VERSION; msg->header.messageLength = sizeof(struct signaling_msg); msg->header.domainNumber = clock_domain_number(p->clock); + msg->header.flagField[1] = clock_time_properties(p->clock).flags; msg->header.sourcePortIdentity = p->portIdentity; msg->header.sequenceId = p->seqnum.signaling++; msg->header.control = CTL_OTHER; -- 2.25.1
_______________________________________________ Linuxptp-users mailing list Linuxptp-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-users