[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230613231709.150622-1-arkadiusz.kubalewski@intel.com>
Date: Wed, 14 Jun 2023 01:17:07 +0200
From: Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>
To: netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
kuba@...nel.org,
davem@...emloft.net,
pabeni@...hat.com,
edumazet@...gle.com,
chuck.lever@...cle.com
Cc: Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>
Subject: [PATCH net-next] tools: ynl-gen: fix nested policy attribute type
When nested multi-attribute is used in yaml spec, generated type in
the netlink policy is NLA_NEST, which is wrong as there is no such type.
Fix be adding `ed` sufix for policy generated for 'nest' type attribute
when the attribute is parsed as TypeMultiAttr class.
Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>
---
tools/net/ynl/ynl-gen-c.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
index 9adcd785db0b..0b5e0802a9a7 100755
--- a/tools/net/ynl/ynl-gen-c.py
+++ b/tools/net/ynl/ynl-gen-c.py
@@ -498,6 +498,16 @@ class TypeArrayNest(Type):
else:
raise Exception(f"Sub-type {self.attr['sub-type']} not supported yet")
+ def attr_policy(self, cw):
+ t = self.attr['type']
+ if (t == 'nest'):
+ policy = c_upper(f'nla-{t}ed')
+ else:
+ policy = c_upper(f'nla-{t}')
+
+ spec = self._attr_policy(policy)
+ cw.p(f"\t[{self.enum_name}] = {spec},")
+
def _attr_typol(self):
return f'.type = YNL_PT_NEST, .nest = &{self.nested_render_name}_nest, '
--
2.37.3
Powered by blists - more mailing lists