[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f35cb9c8-7a5d-4fb7-b69b-aa14ab7f1dd5@fiberby.net>
Date: Thu, 23 Oct 2025 18:37:09 +0000
From: Asbjørn Sloth Tønnesen <ast@...erby.net>
To: Jakub Kicinski <kuba@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Chia-Yu Chang <chia-yu.chang@...ia-bell-labs.com>,
Chuck Lever <chuck.lever@...cle.com>, Donald Hunter
<donald.hunter@...il.com>, Jonathan Corbet <corbet@....net>,
"Matthieu Baerts (NGI0)" <matttbe@...nel.org>,
Simon Horman <horms@...nel.org>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 0/7] ynl: add ignore-index flag for indexed-array
On 10/23/25 1:45 AM, Jakub Kicinski wrote:
> On Wed, 22 Oct 2025 18:26:53 +0000 Asbjørn Sloth Tønnesen wrote:
>> This patchset adds a way to mark if an indedex array is just an
>> array, and the index is uninteresting, as previously discussed[1].
>>
>> Which is the case in most of the indexed-arrays in the current specs.
>>
>> As the name indexed-array kinda implies that the index is interesting,
>> then I am using `ignore-index` to mark if the index is unused.
>>
>> This adds some noise to YNL, and as it's only few indexed-arrays which
>> actually use the index, then if we can come up with some good naming,
>> it may be better to reverse it so it's the default behaviour.
>
> C code already does this, right? We just collect the attributes
> completely ignoring the index.
In the userspace C code, for sub-type nest the index is preserved
in struct member idx, and elided for other sub-types.
> So why do we need to extend the spec.
For me it's mostly the naming "indexed-array". Earlier it was
"array-nest", then we renamed it to "indexed-array" because
it doesn't always contain nests. I think it's counter-intuitive
to elide the index by default, for something called "indexed-array".
The majority of the families using it don't care about the index.
What if we called it "ordered-array", and then always counted from 1
(for families that cares) when packing in user-space code?
> Have you found any case where the index matters and can be
> non-contiguous (other than the known TC kerfuffle).
IFLA_OFFLOAD_XSTATS_HW_S_INFO could be re-defined as a nest,
IFLA_OFFLOAD_XSTATS_L3_STATS is the only index atm.
IFLA_INET_CONF / IFLA_INET6_CONF is on input, but those are
also special by having different types depending on direction.
I found a bunch of other ones, using a static index, but they
can also be defined as a multi-attr wrapped in an additional
outer nest, like IFLA_VF_VLAN_LIST already is.
> FWIW another concept is what TypeValue does.
> "Inject" the index into the child nest as an extra member.
> Most flexible but also prolly a PITA for user space to init those
> for requests.
Same as is done in the userspace C code for indexed-arrays with
sub-type nest. For most families it doesn't matter if the C code
inits the index or not.
Powered by blists - more mailing lists