Skip to contentSkip to conversation

tools: ynl-gen: array-nest: support arrays of nests

PATCH Applied Jakub Kicinski 3 participants 3 messages May 13, 2025 – May 16, 2025

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 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 need
396786af1cea ("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
index 3b064c61a374..cd150d704e28 100755
@@ -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
#1 lore raw
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.

---
Sorry for trickling out random changes, I need
396786af1cea ("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