From: Donald Hunter <donald.hunter@gmail.com>
To: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Cc: kuba@kernel.org, netdev@vger.kernel.org, davem@davemloft.net,
pabeni@redhat.com, edumazet@google.com,
simon.horman@corigine.com
Subject: Re: [PATCH net-next v5 1/2] tools: ynl-gen: fix enum index in _decode_enum(..)
Date: Tue, 25 Jul 2023 13:53:52 +0100 [thread overview]
Message-ID: <m24jlsywwv.fsf@gmail.com> (raw)
In-Reply-To: <20230725101642.267248-2-arkadiusz.kubalewski@intel.com> (Arkadiusz Kubalewski's message of "Tue, 25 Jul 2023 12:16:41 +0200")
Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com> writes:
> Remove wrong index adjustment, which is leftover from adding
> support for sparse enums.
> enum.entries_by_val() function shall not subtract the start-value, as
> it is indexed with real enum value.
>
> Fixes: c311aaa74ca1 ("tools: ynl: fix enum-as-flags in the generic CLI")
> Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
> ---
> tools/net/ynl/lib/ynl.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
> index 1b3a36fbb1c3..027b1c0aecb4 100644
> --- a/tools/net/ynl/lib/ynl.py
> +++ b/tools/net/ynl/lib/ynl.py
> @@ -420,8 +420,8 @@ class YnlFamily(SpecFamily):
> def _decode_enum(self, rsp, attr_spec):
> raw = rsp[attr_spec['name']]
> enum = self.consts[attr_spec['enum']]
> - i = attr_spec.get('value-start', 0)
> if 'enum-as-flags' in attr_spec and attr_spec['enum-as-flags']:
> + i = 0
> value = set()
> while raw:
> if raw & 1:
> @@ -429,7 +429,7 @@ class YnlFamily(SpecFamily):
> raw >>= 1
> i += 1
> else:
> - value = enum.entries_by_val[raw - i].name
> + value = enum.entries_by_val[raw].name
> rsp[attr_spec['name']] = value
>
> def _decode_binary(self, attr, attr_spec):
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
next prev parent reply other threads:[~2023-07-25 12:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 10:16 [PATCH net-next v4 0/2] tools: ynl-gen: fix parse multi-attr enum attribute Arkadiusz Kubalewski
2023-07-25 10:16 ` [PATCH net-next v5 1/2] tools: ynl-gen: fix enum index in _decode_enum(..) Arkadiusz Kubalewski
2023-07-25 12:53 ` Donald Hunter [this message]
2023-07-25 10:16 ` [PATCH net-next v5 2/2] tools: ynl-gen: fix parse multi-attr enum attribute Arkadiusz Kubalewski
2023-07-25 12:56 ` Donald Hunter
2023-07-26 3:13 ` [PATCH net-next v4 0/2] " Jakub Kicinski
2023-07-26 21:00 ` 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=m24jlsywwv.fsf@gmail.com \
--to=donald.hunter@gmail.com \
--cc=arkadiusz.kubalewski@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=simon.horman@corigine.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).