[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b62ba959-9c51-4eb7-ac4c-6abaa5935592@nvidia.com>
Date: Tue, 18 Nov 2025 11:38:16 +0200
From: Gal Pressman <gal@...dia.com>
To: Donald Hunter <donald.hunter@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Andrew Lunn <andrew+netdev@...n.ch>,
netdev@...r.kernel.org, Simon Horman <horms@...nel.org>,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
Stanislav Fomichev <sdf@...ichev.me>, bpf@...r.kernel.org,
Nimrod Oren <noren@...dia.com>
Subject: Re: [PATCH net-next 1/3] tools: ynl: cli: Add --list-attrs option to
show operation attributes
On 17/11/2025 17:56, Donald Hunter wrote:
>> + def print_attr_list(attr_names, attr_set):
>> + """Print a list of attributes with their types and documentation."""
>> + for attr_name in attr_names:
>> + if attr_name in attr_set.attrs:
>> + attr = attr_set.attrs[attr_name]
>> + attr_info = f' - {attr_name}: {attr.type}'
>> + if 'enum' in attr.yaml:
>> + attr_info += f" (enum: {attr.yaml['enum']})"
>> + if attr.yaml.get('doc'):
>> + doc_text = textwrap.indent(attr.yaml['doc'], ' ')
>> + attr_info += f"\n{doc_text}"
>> + print(attr_info)
>> + else:
>> + print(f' - {attr_name}')
>
> Does this line execute? I think this scenario indicates a malformed
> spec that would fail codegen.
You're right, removed.
>> + if args.list_attrs:
>> + op = ynl.msgs.get(args.list_attrs)
>> + if not op:
>> + print(f'Operation {args.list_attrs} not found')
>> + exit(1)
>> +
>> + print(f'Operation: {op.name}')
>> +
>> + for mode in ['do', 'dump', 'event']:
>> + if mode in op.yaml:
>> + print_mode_attrs(mode, op.yaml[mode], op.attr_set, True)
>> +
>> + if 'notify' in op.yaml:
>> + mode_spec = op.yaml['notify']
>> + ref_spec = ynl.msgs.get(mode_spec).yaml.get('do')
>> + if ref_spec:
>> + print_mode_attrs(mode, ref_spec, op.attr_set, False)
>
> I guess mode is set to 'event' after the for loop. I'd prefer to not
> see it used outside the loop, and just use literal 'event' here.
This is actually a bug, mode needs to be 'notify'.
Powered by blists - more mailing lists