]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tools: ynl-gen: array-nest: support arrays of nests
authorJakub Kicinski <kuba@kernel.org>
Tue, 13 May 2025 22:20:11 +0000 (15:20 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 15 May 2025 22:42:26 +0000 (15:42 -0700)
TC needs arrays of nests, but just a put for now.
Fairly straightforward addition.

Link: https://patch.msgid.link/20250513222011.844106-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/pyynl/ynl_gen_c.py

index 68dfb2cd13af863cf62102379e752f23674f8bb5..9e143520e2f7c057a15ad43a1cf2173adb413905 100755 (executable)
@@ -825,6 +825,9 @@ class TypeArrayNest(Type):
         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);')