netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] tools: ynl-gen: fix nested policy attribute type
@ 2023-06-13 23:17 Arkadiusz Kubalewski
  2023-06-13 23:17 ` [PATCH net-next] tools: ynl-gen: fix NLA_POLICY_MAX on enums with value Arkadiusz Kubalewski
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Arkadiusz Kubalewski @ 2023-06-13 23:17 UTC (permalink / raw)
  To: netdev, linux-kernel, kuba, davem, pabeni, edumazet, chuck.lever
  Cc: Arkadiusz Kubalewski

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@intel.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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-06-15  4:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-13 23:17 [PATCH net-next] tools: ynl-gen: fix nested policy attribute type Arkadiusz Kubalewski
2023-06-13 23:17 ` [PATCH net-next] tools: ynl-gen: fix NLA_POLICY_MAX on enums with value Arkadiusz Kubalewski
2023-06-13 23:17 ` [PATCH net-next] tools: ynl-gen: generate docs for <name>_max/_mask enums Arkadiusz Kubalewski
2023-06-14  0:59   ` Jakub Kicinski
2023-06-14 12:48     ` Kubalewski, Arkadiusz
2023-06-14 17:38       ` Jakub Kicinski
2023-06-14 22:11         ` Kubalewski, Arkadiusz
2023-06-15  4:17           ` Jakub Kicinski
2023-06-14  0:50 ` [PATCH net-next] tools: ynl-gen: fix nested policy attribute type Jakub Kicinski
2023-06-14 12:28   ` Kubalewski, Arkadiusz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).