On 6/14/2021 5:03 AM, Miklas, Marcin via Linuxptp-devel wrote:
> From: Marcin Miklas <marcin.mik...@harman.com>
> 
> 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.
> 

If I recall, this has been discussed on the list multiple times before.

https://sourceforge.net/p/linuxptp/mailman/message/34977023/

According to the normal 1588 standard, the bit is not supposed to be set
for these messages.

Perhaps an optional configuration to set these would be acceptable
though. (Then the gPTP config file could use that flag to make sure it
is set)

> 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 8175f28..f906a6c 100644
> --- a/port.c
> +++ b/port.c
> @@ -1362,6 +1362,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++;
> @@ -1556,6 +1557,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;
> @@ -1592,6 +1594,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;
> @@ -2123,6 +2126,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;
> @@ -2170,6 +2174,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;
> 


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

Reply via email to