netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	davem@davemloft.net, pabeni@redhat.com, edumazet@google.com,
	chuck.lever@oracle.com
Subject: Re: [PATCH 66/69] ynl: fix nested policy attribute type
Date: Mon, 5 Jun 2023 11:06:31 -0700	[thread overview]
Message-ID: <20230605110631.5a7d8074@kernel.org> (raw)
In-Reply-To: <20230605094617.3564079-1-arkadiusz.kubalewski@intel.com>

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

      reply	other threads:[~2023-06-05 18:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05  9:46 [PATCH 66/69] ynl: fix nested policy attribute type Arkadiusz Kubalewski
2023-06-05 18:06 ` Jakub Kicinski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230605110631.5a7d8074@kernel.org \
    --to=kuba@kernel.org \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).