aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/drivers/net/lib/py/env.py
diff options
context:
space:
mode:
authorJakub Kicinski <[email protected]>2025-05-15 23:16:47 +0000
committerJakub Kicinski <[email protected]>2025-05-16 23:32:06 +0000
commitb9e03e263610a8d872c753bc882676d3cba1797b (patch)
tree288fe189eb630074a69d7cea7e63c290d584264f /tools/testing/selftests/drivers/net/lib/py/env.py
parenttools: ynl-gen: submsg: render the structs (diff)
downloadkernel-b9e03e263610a8d872c753bc882676d3cba1797b.tar.gz
kernel-b9e03e263610a8d872c753bc882676d3cba1797b.zip
tools: ynl-gen: submsg: support parsing and rendering sub-messages
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. Reviewed-by: Donald Hunter <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'tools/testing/selftests/drivers/net/lib/py/env.py')
0 files changed, 0 insertions, 0 deletions