netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 66/69] ynl: fix nested policy attribute type
@ 2023-06-05  9:46 Arkadiusz Kubalewski
  2023-06-05 18:06 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Arkadiusz Kubalewski @ 2023-06-05  9:46 UTC (permalink / raw)
  To: netdev, linux-kernel, kuba, davem, pabeni, edumazet, chuck.lever
  Cc: Arkadiusz Kubalewski

When nested attribute is used, 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.

Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
---
 tools/net/ynl/ynl-gen-c.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
index 28afb0846143..89603866d4a0 100755
--- a/tools/net/ynl/ynl-gen-c.py
+++ b/tools/net/ynl/ynl-gen-c.py
@@ -113,7 +113,10 @@ class Type(SpecAttr):
         return '{ .type = ' + policy + ', }'
 
     def attr_policy(self, cw):
-        policy = c_upper('nla-' + self.attr['type'])
+        if (self.attr['type'] == 'nest'):
+            policy = c_upper('nla-' + self.attr['type'] + 'ed')
+        else:
+            policy = c_upper('nla-' + self.attr['type'])
 
         spec = self._attr_policy(policy)
         cw.p(f"\t[{self.enum_name}] = {spec},")
-- 
2.31.1


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

* Re: [PATCH 66/69] ynl: fix nested policy attribute type
  2023-06-05  9:46 [PATCH 66/69] ynl: fix nested policy attribute type Arkadiusz Kubalewski
@ 2023-06-05 18:06 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2023-06-05 18:06 UTC (permalink / raw)
  To: Arkadiusz Kubalewski
  Cc: netdev, linux-kernel, davem, pabeni, edumazet, chuck.lever

On Mon,  5 Jun 2023 11:46:17 +0200 Arkadiusz Kubalewski wrote:
> When nested attribute is used, 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.
> 
> Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
> ---
>  tools/net/ynl/ynl-gen-c.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
> index 28afb0846143..89603866d4a0 100755
> --- a/tools/net/ynl/ynl-gen-c.py
> +++ b/tools/net/ynl/ynl-gen-c.py
> @@ -113,7 +113,10 @@ class Type(SpecAttr):
>          return '{ .type = ' + policy + ', }'
>  
>      def attr_policy(self, cw):
> -        policy = c_upper('nla-' + self.attr['type'])
> +        if (self.attr['type'] == 'nest'):
> +            policy = c_upper('nla-' + self.attr['type'] + 'ed')
> +        else:
> +            policy = c_upper('nla-' + self.attr['type'])
>  
>          spec = self._attr_policy(policy)
>          cw.p(f"\t[{self.enum_name}] = {spec},")

For nests the policy should come from

  class TypeNest -> def _attr_policy()

why do we need to tweak the default implementation in the parent class?
-- 
pw-bot: cr

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

end of thread, other threads:[~2023-06-05 18:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-05  9:46 [PATCH 66/69] ynl: fix nested policy attribute type Arkadiusz Kubalewski
2023-06-05 18:06 ` Jakub Kicinski

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).