[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m2plg8n8e8.fsf@gmail.com>
Date: Fri, 16 May 2025 11:43:11 +0100
From: Donald Hunter <donald.hunter@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, andrew+netdev@...n.ch, horms@...nel.org,
daniel@...earbox.net, nicolas.dichtel@...nd.com,
jacob.e.keller@...el.com
Subject: Re: [PATCH net-next 6/9] tools: ynl-gen: submsg: support parsing
and rendering sub-messages
Jakub Kicinski <kuba@...nel.org> writes:
> Adjust parsing and rendering appropriately to make sub-messages work.
> Rendering is pretty trivial, as the submsg -> netlink conversion looks
> like rendering a nest in which only one attr was set. Only trick
> is that we use the enum value of the sub-message rather than the nest
> as the type, and effectively skip one layer of nesting. A real double
> nested struct would look like this:
>
> [SELECTOR]
> [SUBMSG]
> [NEST]
> [MSG1-ATTR]
>
> A submsg "is" the nest so by skipping I mean:
>
> [SELECTOR]
> [SUBMSG]
> [MSG1-ATTR]
>
> There is no extra validation in YNL if caller has set the selector
> matching the submsg type (e.g. link type = "macvlan" but the nest
> attrs are set to carry "veth"). Let the kernel handle that.
>
> Parsing side is a little more specialized as we need to render and
> insert a new kind of function which switches between what to parse
> based on the selector. But code isn't too complicated.
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
Reviewed-by: Donald Hunter <donald.hunter@...il.com>
Powered by blists - more mailing lists