All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com, ast@kernel.org,
	daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
	saeedm@nvidia.com, tariqt@nvidia.com, leon@kernel.org,
	shayagr@amazon.com, akiyano@amazon.com, darinzon@amazon.com,
	sgoutham@marvell.com, lorenzo.bianconi@redhat.com,
	toke@redhat.com, teknoraver@meta.com
Subject: Re: [PATCH net-next 1/8] tools: ynl: fix render-max for flags definition
Date: Wed, 8 Mar 2023 00:06:49 -0800	[thread overview]
Message-ID: <20230308000649.03adbcce@kernel.org> (raw)
In-Reply-To: <b4359cc25819674de797029eb7e4a746853c1df4.1678200041.git.lorenzo@kernel.org>

On Tue,  7 Mar 2023 15:53:58 +0100 Lorenzo Bianconi wrote:
> Properly manage render-max property for flags definition type
> introducing mask value and setting it to (last_element << 1) - 1
> instead of adding max value set to last_element + 1
> 
> Fixes: be5bea1cc0bf ("net: add basic C code generators for Netlink")
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  tools/net/ynl/ynl-gen-c.py | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
> index 274e9c566f61..f2e41dd962d4 100755
> --- a/tools/net/ynl/ynl-gen-c.py
> +++ b/tools/net/ynl/ynl-gen-c.py
> @@ -1995,9 +1995,14 @@ def render_uapi(family, cw):
>  
>              if const.get('render-max', False):
>                  cw.nl()
> -                max_name = c_upper(name_pfx + 'max')
> -                cw.p('__' + max_name + ',')
> -                cw.p(max_name + ' = (__' + max_name + ' - 1)')
> +                if const['type'] == 'flags':
> +                    max_name = c_upper(name_pfx + 'mask')
> +                    max_val = f' = {(entry.user_value() << 1) - 1},'

Hm, why not use const.get_mask() here? Rather than the last entry?

> +                    cw.p(max_name + max_val)
> +                else:
> +                    max_name = c_upper(name_pfx + 'max')
> +                    cw.p('__' + max_name + ',')
> +                    cw.p(max_name + ' = (__' + max_name + ' - 1)')
>              cw.block_end(line=';')
>              cw.nl()
>          elif const['type'] == 'const':


  reply	other threads:[~2023-03-08  8:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 14:53 [PATCH net-next 0/8] update xdp_features flag according to NIC re-configuration Lorenzo Bianconi
2023-03-07 14:53 ` [PATCH net-next 1/8] tools: ynl: fix render-max for flags definition Lorenzo Bianconi
2023-03-08  8:06   ` Jakub Kicinski [this message]
2023-03-08 10:28     ` Lorenzo Bianconi
2023-03-07 14:53 ` [PATCH net-next 2/8] tools: ynl: fix get_mask utility routine Lorenzo Bianconi
2023-03-07 14:54 ` [PATCH net-next 3/8] xdp: add xdp_set_features_flag " Lorenzo Bianconi
2023-03-07 14:54 ` [PATCH net-next 4/8] net: thunderx: take into account xdp_features setting tx/rx queues Lorenzo Bianconi
2023-03-07 14:54 ` [PATCH net-next 5/8] net: ena: " Lorenzo Bianconi
2023-03-08 10:25   ` Shay Agroskin
2023-03-07 14:54 ` [PATCH net-next 6/8] veth: take into account device reconfiguration for xdp_features flag Lorenzo Bianconi
2023-03-07 14:54 ` [PATCH net-next 7/8] net/mlx5e: " Lorenzo Bianconi
2023-03-08 10:33   ` Tariq Toukan
2023-03-08 15:47     ` Lorenzo Bianconi
2023-03-09  7:23       ` Tariq Toukan
2023-03-09  7:32         ` Jakub Kicinski
2023-03-09  8:40           ` Lorenzo Bianconi
2023-03-09  8:43         ` Lorenzo Bianconi
2023-03-07 14:54 ` [PATCH net-next 8/8] mvpp2: take care of xdp_features when reconfiguring queues Lorenzo Bianconi

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=20230308000649.03adbcce@kernel.org \
    --to=kuba@kernel.org \
    --cc=akiyano@amazon.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=darinzon@amazon.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=leon@kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=sgoutham@marvell.com \
    --cc=shayagr@amazon.com \
    --cc=tariqt@nvidia.com \
    --cc=teknoraver@meta.com \
    --cc=toke@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.