On Tue, 15 Mar 2022 at 23:38, Erez <[email protected]> wrote:

>
>
> On Tue, 15 Mar 2022 at 17:14, Miroslav Lichvar <[email protected]>
> 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.
>

The padding is for variable length TLVs, like CLOCK_DESCRIPTION.
Fixed size TLVs should be aligned.
So we can not issue a warning or error there.
We can issue a warning in pmc_tlv_datalen().
But as committers skip it not sure if it is helpful.

Erez


> Erez
>
>
>> --
>> Miroslav Lichvar
>>
>>
>>
>> _______________________________________________
>> Linuxptp-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
>>
>
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to