[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250428160611.226e3e61@kernel.org>
Date: Mon, 28 Apr 2025 16:06:11 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Saeed Mahameed <saeed@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>, Paolo Abeni
<pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com>, Saeed Mahameed
<saeedm@...dia.com>, netdev@...r.kernel.org, Tariq Toukan
<tariqt@...dia.com>, Gal Pressman <gal@...dia.com>, Leon Romanovsky
<leonro@...dia.com>, Jiri Pirko <jiri@...dia.com>
Subject: Re: [PATCH net-next V3 01/15] tools: ynl-gen: allow noncontiguous
enums
On Fri, 25 Apr 2025 14:47:54 -0700 Saeed Mahameed wrote:
> In case the enum has holes, instead of hard stop, avoid the policy value
> checking and it to the code.
We guarantee that YNL generates full type validation for enum types.
IOW that the policy will reject values outside of the enum.
We need to preserve this guarantee.
Best we can do for sparse enums is probably to generate a function
callback that does the checking.
We could add something like a bitmap validation for small sparse values
(treat the mask in the policy as mask of allowed values).
But hard to justify the complexity with just a single case of the
problem. (actually classic netlink has a similar problem for AF_*
values, but there "->mask as a bitmap" validation don't do, since
the elements of the enum go up to 256).
Powered by blists - more mailing lists