[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250513222011.844106-1-kuba@kernel.org>
Date: Tue, 13 May 2025 15:20:11 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org,
edumazet@...gle.com,
pabeni@...hat.com,
andrew+netdev@...n.ch,
horms@...nel.org,
Jakub Kicinski <kuba@...nel.org>,
donald.hunter@...il.com,
jacob.e.keller@...el.com
Subject: [PATCH net-next] tools: ynl-gen: array-nest: support arrays of nests
TC needs arrays of nests, but just a put for now.
Fairly straightforward addition.
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
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.
CC: donald.hunter@...il.com
CC: jacob.e.keller@...el.com
---
tools/net/ynl/pyynl/ynl_gen_c.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index 3b064c61a374..cd150d704e28 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -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);')
--
2.49.0
Powered by blists - more mailing lists