All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: netdev@vger.kernel.org
Cc: bpf@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, ast@kernel.org,
	daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
	saeedm@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, ttoukan.linux@gmail.com
Subject: [PATCH net v2 2/8] tools: ynl: fix get_mask utility routine
Date: Thu,  9 Mar 2023 13:25:26 +0100	[thread overview]
Message-ID: <31613fd1f414d8d4d0b82e7dd1d60c6d087bd0d5.1678364613.git.lorenzo@kernel.org> (raw)
In-Reply-To: <cover.1678364612.git.lorenzo@kernel.org>

Fix get_mask utility routine in order to take into account possible gaps
in the elements list.

Fixes: be5bea1cc0bf ("net: add basic C code generators for Netlink")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 tools/net/ynl/lib/nlspec.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/net/ynl/lib/nlspec.py b/tools/net/ynl/lib/nlspec.py
index a34d088f6743..960a356e8225 100644
--- a/tools/net/ynl/lib/nlspec.py
+++ b/tools/net/ynl/lib/nlspec.py
@@ -138,10 +138,8 @@ class SpecEnumSet(SpecElement):
 
     def get_mask(self):
         mask = 0
-        idx = self.yaml.get('value-start', 0)
-        for _ in self.entries.values():
-            mask |= 1 << idx
-            idx += 1
+        for e in self.entries.values():
+            mask += e.user_value()
         return mask
 
 
-- 
2.39.2


  parent reply	other threads:[~2023-03-09 12:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 12:25 [PATCH net v2 0/8] update xdp_features flag according to NIC re-configuration Lorenzo Bianconi
2023-03-09 12:25 ` [PATCH net v2 1/8] tools: ynl: fix render-max for flags definition Lorenzo Bianconi
2023-03-09 12:25 ` Lorenzo Bianconi [this message]
2023-03-09 12:25 ` [PATCH net v2 3/8] xdp: add xdp_set_features_flag utility routine Lorenzo Bianconi
2023-03-09 12:25 ` [PATCH net v2 4/8] net: thunderx: take into account xdp_features setting tx/rx queues Lorenzo Bianconi
2023-03-09 12:25 ` [PATCH net v2 5/8] net: ena: " Lorenzo Bianconi
2023-03-09 12:25 ` [PATCH net v2 6/8] veth: take into account device reconfiguration for xdp_features flag Lorenzo Bianconi
2023-03-13 14:15   ` Matthieu Baerts
2023-03-13 15:50     ` Eric Dumazet
2023-03-13 15:53       ` Eric Dumazet
2023-03-13 16:31         ` Matthieu Baerts
2023-03-13 16:35         ` Lorenzo Bianconi
2023-03-13 16:37           ` Eric Dumazet
2023-03-13 16:47             ` Lorenzo Bianconi
2023-04-06  0:56   ` Martin KaFai Lau
2023-03-09 12:25 ` [PATCH net v2 7/8] net/mlx5e: " Lorenzo Bianconi
2023-03-15 23:39   ` Jakub Kicinski
2023-03-16  0:29     ` Jakub Kicinski
2023-03-16  2:46       ` Saeed Mahameed
2023-03-16  2:53         ` Jakub Kicinski
2023-03-16  5:03           ` Saeed Mahameed
2023-03-16  5:37             ` Jakub Kicinski
2023-03-09 12:25 ` [PATCH net v2 8/8] mvpp2: take care of xdp_features when reconfiguring queues Lorenzo Bianconi
2023-03-11  5:50 ` [PATCH net v2 0/8] update xdp_features flag according to NIC re-configuration patchwork-bot+netdevbpf

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=31613fd1f414d8d4d0b82e7dd1d60c6d087bd0d5.1678364613.git.lorenzo@kernel.org \
    --to=lorenzo@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=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=sgoutham@marvell.com \
    --cc=shayagr@amazon.com \
    --cc=teknoraver@meta.com \
    --cc=toke@redhat.com \
    --cc=ttoukan.linux@gmail.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.