On 11/10/2023 2:48 PM, Luigi Mantellini wrote:
> I prefer another approach :
> 
> 
> 1) All should have the same request ptp version (es: delay-resp copy ptp
> version from delay-req, management answers copy from queries, ... and so.
NAK this would cause trying to respond with 2.1 packets to the 2.1
delay-req which will cause some hw to still not generate timestamps

> 
> 2) The major and  version numbers are explicit port level options
NAK the standard says that version is implemented by the PTP Instance
issuing a PTP message, not a per-port option.

Thanks,
Maciek

> 
> 
> 
> 1) permits to fight with other legacy (And broken) network nodes and it
> is enabled from a port level config like "ptp_version_auto"
> 
> 2) permits to handle broken local HW. Here we have two port level
> configs like "ptp_major_number" and "ptp_minor_number"
> 
> 
> ciao
> 
> 
> luigi
> 
> 
> 
> 
> In data venerdì 10 novembre 2023 14:10:37 CET, Maciek Machnikowski ha
> scritto:
> 
>> Caution: This message was sent from an external source. Please take care
> 
>> when clicking links or opening attachments. When in doubt, contact your IT
> 
>> Department
> 
>>
> 
>>
> 
>> Some hardware can't properly timestamp packets with the new PTP
> 
>> header version 2.1. This patch introduces a global var ptp_hdr_ver
> 
>> that can be changed externally to allow legacy PTP version to be
> 
>> advertised.
> 
>>
> 
>> Forcing 2.1 also breaks interoperability with some older
> 
>> grandmasters which will ignore packets with ptp_minor version set.
> 
>>
> 
>> v2: clarify compatibility issue caused by the change
> 
>> v3: fix subject line
> 
>>
> 
>> Signed-off-by: Maciek Machnikowski <mac...@machnikowski.net>
> 
>> ---
> 
>>  msg.c  |  1 +
> 
>>  msg.h  |  5 +++++
> 
>>  port.c | 18 +++++++++---------
> 
>>  3 files changed, 15 insertions(+), 9 deletions(-)
> 
>>
> 
>> diff --git a/msg.c b/msg.c
> 
>> index ab841f0..7a7b149 100644
> 
>> --- a/msg.c
> 
>> +++ b/msg.c
> 
>> @@ -29,6 +29,7 @@
> 
>>  #include "tlv.h"
> 
>>
> 
>>  int assume_two_step = 0;
> 
>> +uint8_t ptp_hdr_ver = PTP_VERSION;
> 
>>
> 
>>  /*
> 
>>   * Head room fits a VLAN Ethernet header, and 'msg' is 64 bit aligned.
> 
>> diff --git a/msg.h b/msg.h
> 
>> index 484435d..9c80f45 100644
> 
>> --- a/msg.h
> 
>> +++ b/msg.h
> 
>> @@ -441,6 +441,11 @@ static inline Boolean msg_unicast(struct ptp_message
> 
>> *m) return field_is_set(m, 0, UNICAST);
> 
>>  }
> 
>>
> 
>> +/**
> 
>> + * Work around HW assuming PTP message version 2.0
> 
>> + */
> 
>> +extern uint8_t ptp_hdr_ver;
> 
>> +
> 
>>  /**
> 
>>   * Work around buggy 802.1AS switches.
> 
>>   */
> 
>> diff --git a/port.c b/port.c
> 
>> index 5803cd3..d79a510 100644
> 
>> --- a/port.c
> 
>> +++ b/port.c
> 
>> @@ -1538,7 +1538,7 @@ static int port_pdelay_request(struct port *p)
> 
>>         msg->hwts.type = p->timestamping;
> 
>>
> 
>>         msg->header.tsmt               = PDELAY_REQ |
> p->transportSpecific;
> 
>> -       msg->header.ver                = PTP_VERSION;
> 
>> +       msg->header.ver                = ptp_hdr_ver;
> 
>>         msg->header.messageLength      = sizeof(struct pdelay_req_msg);
> 
>>         msg->header.domainNumber       = clock_domain_number(p->clock);
> 
>>         msg->header.correction         = -p->asymmetry;
> 
>> @@ -1601,7 +1601,7 @@ int port_delay_request(struct port *p)
> 
>>         msg->hwts.type = p->timestamping;
> 
>>
> 
>>         msg->header.tsmt               = DELAY_REQ | p->transportSpecific;
> 
>> -       msg->header.ver                = PTP_VERSION;
> 
>> +       msg->header.ver                = ptp_hdr_ver;
> 
>>         msg->header.messageLength      = sizeof(struct delay_req_msg);
> 
>>         msg->header.domainNumber       = clock_domain_number(p->clock);
> 
>>         msg->header.correction         = -p->asymmetry;
> 
>> @@ -1653,7 +1653,7 @@ int port_tx_announce(struct port *p, struct address
> 
>> *dst, uint16_t sequence_id) msg->hwts.type = p->timestamping;
> 
>>
> 
>>         msg->header.tsmt               = ANNOUNCE | p->transportSpecific;
> 
>> -       msg->header.ver                = PTP_VERSION;
> 
>> +       msg->header.ver                = ptp_hdr_ver;
> 
>>         msg->header.messageLength      = sizeof(struct announce_msg);
> 
>>         msg->header.domainNumber       = clock_domain_number(p->clock);
> 
>>         msg->header.sourcePortIdentity = p->portIdentity;
> 
>> @@ -1735,7 +1735,7 @@ int port_tx_sync(struct port *p, struct address
> *dst,
> 
>> uint16_t sequence_id) msg->hwts.type = p->timestamping;
> 
>>
> 
>>         msg->header.tsmt               = SYNC | p->transportSpecific;
> 
>> -       msg->header.ver                = PTP_VERSION;
> 
>> +       msg->header.ver                = ptp_hdr_ver;
> 
>>         msg->header.messageLength      = sizeof(struct sync_msg);
> 
>>         msg->header.domainNumber       = clock_domain_number(p->clock);
> 
>>         msg->header.sourcePortIdentity = p->portIdentity;
> 
>> @@ -1770,7 +1770,7 @@ int port_tx_sync(struct port *p, struct address
> *dst,
> 
>> uint16_t sequence_id) fup->hwts.type = p->timestamping;
> 
>>
> 
>>         fup->header.tsmt               = FOLLOW_UP | p->transportSpecific;
> 
>> -       fup->header.ver                = PTP_VERSION;
> 
>> +       fup->header.ver                = ptp_hdr_ver;
> 
>>         fup->header.messageLength      = sizeof(struct follow_up_msg);
> 
>>         fup->header.domainNumber       = clock_domain_number(p->clock);
> 
>>         fup->header.sourcePortIdentity = p->portIdentity;
> 
>> @@ -2119,7 +2119,7 @@ static int process_delay_req(struct port *p, struct
> 
>> ptp_message *m) msg->hwts.type = p->timestamping;
> 
>>
> 
>>         msg->header.tsmt               = DELAY_RESP |
> p->transportSpecific;
> 
>> -       msg->header.ver                = PTP_VERSION;
> 
>> +       msg->header.ver                = ptp_hdr_ver;
> 
>>         msg->header.messageLength      = sizeof(struct delay_resp_msg);
> 
>>         msg->header.domainNumber       = m->header.domainNumber;
> 
>>         msg->header.correction         = m->header.correction;
> 
>> @@ -2310,7 +2310,7 @@ int process_pdelay_req(struct port *p, struct
> 
>> ptp_message *m) rsp->hwts.type = p->timestamping;
> 
>>
> 
>>         rsp->header.tsmt               = PDELAY_RESP |
> p->transportSpecific;
> 
>> -       rsp->header.ver                = PTP_VERSION;
> 
>> +       rsp->header.ver                = ptp_hdr_ver;
> 
>>         rsp->header.messageLength      = sizeof(struct pdelay_resp_msg);
> 
>>         rsp->header.domainNumber       = m->header.domainNumber;
> 
>>         rsp->header.sourcePortIdentity = p->portIdentity;
> 
>> @@ -2356,7 +2356,7 @@ int process_pdelay_req(struct port *p, struct
> 
>> ptp_message *m) fup->hwts.type = p->timestamping;
> 
>>
> 
>>         fup->header.tsmt               = PDELAY_RESP_FOLLOW_UP |
> 
>> p->transportSpecific; -       fup->header.ver                =
> PTP_VERSION;
> 
>> +       fup->header.ver                = ptp_hdr_ver;
> 
>>         fup->header.messageLength      = sizeof(struct
> pdelay_resp_fup_msg);
> 
>> fup->header.domainNumber       = m->header.domainNumber;
> 
>>         fup->header.correction         = m->header.correction;
> 
>> @@ -3204,7 +3204,7 @@ port_management_construct(struct PortIdentity pid,
> 
>> struct port *ingress, msg->hwts.type = ingress->timestamping;
> 
>>
> 
>>         msg->header.tsmt               = MANAGEMENT |
> 
>> ingress->transportSpecific; -       msg->header.ver                =
> 
>> PTP_VERSION;
> 
>> +       msg->header.ver                = ptp_hdr_ver;
> 
>>         msg->header.messageLength      = sizeof(struct management_msg);
> 
>>         msg->header.domainNumber       =
> 
>> clock_domain_number(ingress->clock); msg->header.sourcePortIdentity = pid;
> 
>> --
> 
>> 2.30.2
> 
>>
> 
>>
> 
>>
> 
>> _______________________________________________
> 
>> Linuxptp-devel mailing list
> 
>> Linuxptp-devel@lists.sourceforge.net
> 
>>
> https://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sour
> 
>>
> ceforge.net%2Flists%2Flistinfo%2Flinuxptp-devel&data=05%7C01%7Cluigi.mantell
> 
>>
> ini%40sm-optics.com%7C7209ac53114f49d6817f08dbe1eec643%7C213385be51b14c00838
> 
>>
> 4b599671fbf95%7C0%7C0%7C638352187880607373%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM
> 
>>
> C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sd
> 
>> ata=FZoMXrd7WE%2BTj4KlbTTGipc8wdP2XrF9x%2BAq8oS0y2Q%3D&reserved=0
> 
> 
> 
> -- 
> 
> *Luigi Mantellini* 
> 
> Senior Software Developer
> 
> Tel. (+39) 342 182 3893
> 
> luigi.mantell...@sm-optics.com <mailto:luigi.mantell...@sm-optics.com> 
> 
> 
> 
>       
> 
> *SM-Optics s.r.l.* 
> 
> SIAE Microelettronica Group
> 
> Via Michelangelo Buonarroti, 2
> 
> 20093 Cologno Monzese, Milano
> 
> ITALY
> 
> Tel. (+39) 02 273 251
> 
> Fax (+39) 02 253
> 
> https://www.sm-optics.com <https://www.sm-optics.com> 
> 
> 


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

Reply via email to