On Tue, 15 Mar 2022 at 17:14, Miroslav Lichvar <mlich...@redhat.com> wrote:

> On Tue, Mar 08, 2022 at 10:55:14PM +0100, Erez Geva wrote:
> > Add reserved octet to the new port hardware clock structure.
>
> > @@ -354,6 +354,7 @@ struct port_hwclock_np {
> >       struct PortIdentity portIdentity;
> >       Integer32 phc_index;
> >       UInteger8 flags;
> > +     uint8_t reserved;
> >  } PACKED;
>
> FWIW, there is a code in the {clock,port}_management_fill_response
> functions that pads the TLVs to 16 bits:
>
>         if (datalen % 2) {
>
>                 tlv->data[datalen] = 0;
>
>                 datalen++;
>
>         }
>
>
>
The reserved field was added in other cases.
Regardless of the padding.

P.S.
I check  pmc_tlv_datalen()
It lacks most of the new TLVs and it does not pad to 16 bits.


If we require the TLV declarations to be correctly padded, it might be
> a good idea to replace this code with an assertion or return error to
> catch bugs when new TLVs are introduced.
>

Fine by me.
If Richard agrees, we can add a warning, a error or assertion.

Erez


> --
> Miroslav Lichvar
>
>
>
> _______________________________________________
> 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

Reply via email to