Subject: Re: [PATCH net-next 1/2] ynl: rename array-nest to indexed-array

From: Jakub Kicinski <[email-masked]>
Date: Thu, 28 Mar 2024 09:02:20 -0700

On Thu, 28 Mar 2024 15:50:35 +0800 Hangbin Liu wrote:
> 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?

Looking a bit closer you should probably have:

-            elif attr_spec["type"] == 'array-nest':
-                decoded = self._decode_array_nest(attr, attr_spec)
+            elif attr_spec["type"] == 'indexed-array':
+                decoded = self._decode_array_attr(attr, attr_spec)
             elif attr_spec["type"] == 'bitfield32':

and do the sub-type handling inside (now renamed) _decode_array_attr()
Throw the exception there appropriately.