Subject: Re: [PATCH net-next v2 3/6] tools: ynl: Add array-nest attr decoding to ynl

From: Jakub Kicinski <[email-masked]>
Date: Wed, 22 Mar 2023 11:27:01 -0700

On Wed, 22 Mar 2023 11:27:25 +0000 Donald Hunter wrote:
> > So in terms of C this treats the payload of the attr as a packed array?
> > That's not what array-nest is, array-nest wraps every entry in another
> > nlattr:
> > https://docs.kernel.org/next/userspace-api/netlink/genetlink-legacy.html#array-nest
> >
> > It's not a C array dumped into an attribute.
> >
> > IIRC I was intending to use 'binary' for packed arrays. Still use
> > sub-type to carry the type, but main type should be 'binary'.
> >
> > If that sounds reasonable could you document or remind me to document
> > this as the expected behavior? Sub-type appears completely undocumented
> > now :S  
> 
> That sounds reasonable, yes. I will also rename the method to
> 'as_c_array'. I think it should just be restricted to scalar subtypes,
> i.e. u16, u32, etc. Do you agree?

We can limit it to scalars for now. There are some arrays of structs
(from memory TC GRED had VCs defined as array of structs?) but that
should hopefully be rare and can be added later.