Hi > -----Original Message----- > From: Tan Tee Min <tee.min....@linux.intel.com> > Sent: Friday, February 24, 2023 3:02 AM > To: linuxptp-devel@lists.sourceforge.net > Subject: [Linuxptp-devel] [PATCH 1/1] port: add ptpTimescale to the flag field > for 802.1AS-2011 > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the > content is safe > > Currently, the time properties flags only added to the flag > field of Announce message header. > > According to 802.1AS-2011 Chapter 10.5.2.2.6 Flags (Octet2), ptpTimescale > applies to all message types. Thus, add ptpTimescale bit to the flag field > of the header of Pdelay_Req, Pdelay_Resp, Pdelay_Resp_Follow_Up, > Follow_Up, Sync and Signaling messages. >
Agree that 802.1AS-2011 and 802.1AS-2021-Cor1 are marked as All for ptpTimescale. However, this is updated (fixed) in 802.1AS-2020 to message type "Announce" which aligns to 1588-2008 and 1588-2019. May need second eye to confirm which direction is right way to do. > Signed-off-by: Tan Tee Min <tee.min....@linux.intel.com> > --- > port.c | 8 ++++++++ > port_signaling.c | 2 ++ > 2 files changed, 10 insertions(+) > > diff --git a/port.c b/port.c > index 6baf5c8..7bc3563 100644 > --- a/port.c > +++ b/port.c > @@ -1463,6 +1463,7 @@ static void port_syfufsm(struct port *p, enum > syfu_event event, > > static int port_pdelay_request(struct port *p) > { > + struct timePropertiesDS tp = clock_time_properties(p->clock); > struct ptp_message *msg; > int err; > > @@ -1489,6 +1490,7 @@ static int port_pdelay_request(struct port *p) > msg->header.control = CTL_OTHER; > msg->header.logMessageInterval = port_is_ieee8021as(p) ? > p->logPdelayReqInterval : 0x7f; > + msg->header.flagField[1] |= tp.flags & PTP_TIMESCALE; > > if (unicast_client_enabled(p) && p->unicast_master_table->peer_name) > { > msg->address = p->unicast_master_table->peer_addr.address; > @@ -1633,6 +1635,7 @@ int port_tx_announce(struct port *p, struct address > *dst, uint16_t sequence_id) > > int port_tx_sync(struct port *p, struct address *dst, uint16_t sequence_id) > { > + struct timePropertiesDS tp = clock_time_properties(p->clock); > struct ptp_message *msg, *fup; > int err, event; > > @@ -1681,6 +1684,7 @@ int port_tx_sync(struct port *p, struct address *dst, > uint16_t sequence_id) > msg->header.sequenceId = sequence_id; > msg->header.control = CTL_SYNC; > msg->header.logMessageInterval = p->logSyncInterval; > + msg->header.flagField[1] |= tp.flags & PTP_TIMESCALE; > > if (p->timestamping != TS_ONESTEP && p->timestamping != > TS_P2P1STEP) { > msg->header.flagField[0] |= TWO_STEP; > @@ -1717,6 +1721,7 @@ int port_tx_sync(struct port *p, struct address *dst, > uint16_t sequence_id) > fup->header.sequenceId = sequence_id; > fup->header.control = CTL_FOLLOW_UP; > fup->header.logMessageInterval = p->logSyncInterval; > + fup->header.flagField[1] |= tp.flags & PTP_TIMESCALE; > > fup->follow_up.preciseOriginTimestamp = tmv_to_Timestamp(msg- > >hwts.ts); > > @@ -2194,6 +2199,7 @@ void process_follow_up(struct port *p, struct > ptp_message *m) > > int process_pdelay_req(struct port *p, struct ptp_message *m) > { > + struct timePropertiesDS tp = clock_time_properties(p->clock); > struct ptp_message *rsp, *fup; > enum transport_event event; > int err; > @@ -2258,6 +2264,7 @@ int process_pdelay_req(struct port *p, struct > ptp_message *m) > rsp->header.sequenceId = m->header.sequenceId; > rsp->header.control = CTL_OTHER; > rsp->header.logMessageInterval = 0x7f; > + rsp->header.flagField[1] |= tp.flags & PTP_TIMESCALE; > > /* > * NB - We do not have any fraction nanoseconds for the correction > @@ -2306,6 +2313,7 @@ int process_pdelay_req(struct port *p, struct > ptp_message *m) > fup->header.sequenceId = m->header.sequenceId; > fup->header.control = CTL_OTHER; > fup->header.logMessageInterval = 0x7f; > + fup->header.flagField[1] |= tp.flags & PTP_TIMESCALE; > > fup->pdelay_resp_fup.requestingPortIdentity = m- > >header.sourcePortIdentity; > > diff --git a/port_signaling.c b/port_signaling.c > index ed217c0..e028449 100644 > --- a/port_signaling.c > +++ b/port_signaling.c > @@ -57,6 +57,7 @@ struct ptp_message > *port_signaling_uc_construct(struct port *p, > struct address *address, > struct PortIdentity *tpid) > { > + struct timePropertiesDS tp = clock_time_properties(p->clock); > struct ptp_message *msg; > > msg = port_signaling_construct(p, tpid); > @@ -64,6 +65,7 @@ struct ptp_message > *port_signaling_uc_construct(struct port *p, > return NULL; > } > > + msg->header.flagField[1] |= tp.flags & PTP_TIMESCALE; > msg->header.flagField[0] |= UNICAST; > msg->address = *address; > > -- > 1.9.1 > > > > _______________________________________________ > Linuxptp-devel mailing list > Linuxptp-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linuxptp-devel _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel