Subject: Re: [PATCH net-next v4 4/7] tools: ynl: Add fixed-header support to ynl

From: Donald Hunter <[email-masked]>
Date: Mon, 27 Mar 2023 09:10:49 +0100

Jakub Kicinski <[email-masked]> writes:

> On Fri, 24 Mar 2023 19:18:57 +0000 Donald Hunter wrote:
>> diff --git a/Documentation/netlink/genetlink-legacy.yaml b/Documentation/netlink/genetlink-legacy.yaml
>> index d50c78b9f42d..3b8984122383 100644
>> --- a/Documentation/netlink/genetlink-legacy.yaml
>> +++ b/Documentation/netlink/genetlink-legacy.yaml
>> @@ -261,6 +261,13 @@ properties:
>>        async-enum:
>>          description: Name for the enum type with notifications/events.
>>          type: string
>> +      # Start genetlink-legacy
>> +      fixed-header: &fixed-header
>> +        description: |
>> +          Name of the structure defininig the optional fixed-length protocol header. This header is
>
> Typo in 'defininig', could you also wrap at 80 chars?
> Old school kernel style.

Will do. The spec does spill beyond 100 chars tho.

>> +          placed in a message after the netlink and genetlink headers and before any attributes.
>> +        type: string
>> +      # End genetlink-legacy
>
>>  class GenlMsg:
>> -    def __init__(self, nl_msg):
>> +    def __init__(self, nl_msg, fixed_header_members = []):
>
> spaces around = or no spaces? I don't really know myself but I'm used
> to having no spaces.

Happy to go with existing convention in the codebase and will remove spaces.

>> @@ -540,7 +555,7 @@ class YnlFamily(SpecFamily):
>>                          print('Unexpected message: ' + repr(gm))
>>                          continue
>>  
>> -                rsp.append(self._decode(gm.raw_attrs, op.attr_set.name))
>> +                rsp.append(self._decode(gm.raw_attrs, op.attr_set.name) | gm.fixed_header_attrs)
>
> nit: also line wrap?

Will do.