[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZgUhS8_Yno2dAyie@Laptop-X1>
Date: Thu, 28 Mar 2024 15:50:35 +0800
From: Hangbin Liu <liuhangbin@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Donald Hunter <donald.hunter@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
Jacob Keller <jacob.e.keller@...el.com>,
Stanislav Fomichev <sdf@...gle.com>
Subject: Re: [PATCH net-next 1/2] ynl: rename array-nest to indexed-array
On Tue, Mar 26, 2024 at 08:46:10PM -0700, Jakub Kicinski wrote:
> On Tue, 26 Mar 2024 14:37:27 +0800 Hangbin Liu wrote:
> > diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
> > index 5fa7957f6e0f..7239e673a28a 100644
> > --- a/tools/net/ynl/lib/ynl.py
> > +++ b/tools/net/ynl/lib/ynl.py
> > @@ -686,8 +686,9 @@ class YnlFamily(SpecFamily):
> > decoded = attr.as_scalar(attr_spec['type'], attr_spec.byte_order)
> > if 'enum' in attr_spec:
> > decoded = self._decode_enum(decoded, attr_spec)
> > - elif attr_spec["type"] == 'array-nest':
> > - decoded = self._decode_array_nest(attr, attr_spec)
> > + elif attr_spec["type"] == 'indexed-array' and 'sub-type' in attr_spec:
> > + if attr_spec["sub-type"] == 'nest':
> > + decoded = self._decode_array_nest(attr, attr_spec)
>
> We need to make sure somehow cleanly that we treat unknown subtype the
> same we would treat unknown type. In this elif ladder we have:
>
> else:
> if not self.process_unknown:
> raise Exception(f'Unknown {attr_spec["type"]} with name {attr_spec["name"]}')
>
> So we should raise an exception if sub-type != nest.
I agree we need raise exception when only support nest sub-type. But
what about after adding other sub-types in patch 2/2. e.g.
if attr_spec["sub-type"] == 'nest':
decoded = self._decode_array_nest(attr, attr_spec)
else:
decoded = self._decode_index_array(attr, attr_spec)
Should we remove the exception in patch 2?
Thanks
Hangbin
Powered by blists - more mailing lists