tools: ynl-gen: array-nest: support arrays of nests
Subsystems (3)
Jakub Kicinski
maintainerPATCH 1/1 tools: ynl-gen: array-nest: support arrays of nests
TC needs arrays of nests, but just a put for now.
Fairly straightforward addition.
---
Sorry for trickling out random changes, I need396786af1cea ("tools: ynl-gen: Allow multi-attr without nested-attributes again") to reach net-next before I post submsg support. Otherwise there
will be a conflict.
--- tools/net/ynl/pyynl/ynl_gen_c.py | 3 +++ 1 file changed, 3 insertions(+)
tools/net/ynl/pyynl/ynl_gen_c.py +3 -0
@@ -825,6 +825,9 @@ from lib import SpecFamily, SpecAttrSet, SpecAttr, SpecOperation, SpecEnumSet, S elif self.sub_type == 'binary' and 'exact-len' in self.checks: ri.cw.p(f'for (i = 0; i < {var}->_count.{self.c_name}; i++)') ri.cw.p(f"ynl_attr_put(nlh, i, {var}->{self.c_name}[i], {self.checks['exact-len']});") + elif self.sub_type == 'nest': + ri.cw.p(f'for (i = 0; i < {var}->_count.{self.c_name}; i++)') + ri.cw.p(f"{self.nested_render_name}_put(nlh, i, &{var}->{self.c_name}[i]);") else: raise Exception(f"Put for ArrayNest sub-type {self.attr['sub-type']} not supported, yet") ri.cw.p('ynl_attr_nest_end(nlh, array);')
Signature · 1 line
2.49.0
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Tue, 13 May 2025 15:20:11 -0700 you wrote:
TC needs arrays of nests, but just a put for now.
Fairly straightforward addition.Signed-off-by Jakub Kicinski <[email protected]>---
Sorry for trickling out random changes, I need396786af1cea("tools: ynl-gen: Allow multi-attr without nested-attributes again") to reach net-next before I post submsg support. Otherwise there
will be a conflict.[...]
Here is the summary with links:
- [net-next] tools: ynl-gen: array-nest: support arrays of nests
https://git.kernel.org/netdev/net-next/c/87948df5af4b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 4 lines · Jakub Kicinski
TC needs arrays of nests, but just a put for now.
Fairly straightforward addition.Signed-off-by Jakub Kicinski <[email protected]>