All of lore.kernel.org
 help / color / mirror / Atom feed
From: Donald Hunter <donald.hunter@gmail.com>
To: Alessandro Marcolini <alessandromarcolini99@gmail.com>
Cc: davem@davemloft.net,  edumazet@google.com,  kuba@kernel.org,
	pabeni@redhat.com,  sdf@google.com,  chuck.lever@oracle.com,
	lorenzo@kernel.org,  jacob.e.keller@intel.com,  jiri@resnulli.us,
	netdev@vger.kernel.org
Subject: Re: [PATCH v3 net-next 3/3] tools: ynl: add support for encoding multi-attr
Date: Fri, 02 Feb 2024 14:34:51 +0000	[thread overview]
Message-ID: <m2y1c3szn8.fsf@gmail.com> (raw)
In-Reply-To: <9399f6f7bda6c845194419952dfbcf0d42142652.1706882196.git.alessandromarcolini99@gmail.com> (Alessandro Marcolini's message of "Fri, 2 Feb 2024 15:00:05 +0100")

Alessandro Marcolini <alessandromarcolini99@gmail.com> writes:

> Multi-attr elements could not be encoded because of missing logic in the
> ynl code. Enable encoding of these attributes by checking if the
> attribute is a multi-attr and if the value to be processed is a list.
>
> This has been tested both with the taprio and ets qdisc which contain
> this kind of attributes.
>
> Signed-off-by: Alessandro Marcolini <alessandromarcolini99@gmail.com>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

> ---
>  tools/net/ynl/lib/ynl.py | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
> index 0f4193cc2e3b..d5779d023b10 100644
> --- a/tools/net/ynl/lib/ynl.py
> +++ b/tools/net/ynl/lib/ynl.py
> @@ -444,6 +444,11 @@ class YnlFamily(SpecFamily):
>          except KeyError:
>              raise Exception(f"Space '{space}' has no attribute '{name}'")
>          nl_type = attr.value
> +        if attr.is_multi and isinstance(value, list):
> +            attr_payload = b''
> +            for subvalue in value:
> +                attr_payload += self._add_attr(space, name, subvalue, search_attrs)
> +            return attr_payload
>          if attr["type"] == 'nest':
>              nl_type |= Netlink.NLA_F_NESTED
>              attr_payload = b''

  reply	other threads:[~2024-02-02 15:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 14:00 [PATCH v3 net-next 0/3] Add support for encoding multi-attr to ynl Alessandro Marcolini
2024-02-02 14:00 ` [PATCH v3 net-next 1/3] tools: ynl: correct typo and docstring Alessandro Marcolini
2024-02-02 14:00 ` [PATCH v3 net-next 2/3] doc: netlink: specs: tc: add multi-attr to tc-taprio-sched-entry Alessandro Marcolini
2024-02-02 14:00 ` [PATCH v3 net-next 3/3] tools: ynl: add support for encoding multi-attr Alessandro Marcolini
2024-02-02 14:34   ` Donald Hunter [this message]
2024-02-03  2:17   ` Jakub Kicinski
2024-02-03 12:00     ` Alessandro Marcolini
2024-02-02 15:05 ` [PATCH v3 net-next 0/3] Add support for encoding multi-attr to ynl Donald Hunter
2024-02-02 15:31   ` Alessandro Marcolini

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=m2y1c3szn8.fsf@gmail.com \
    --to=donald.hunter@gmail.com \
    --cc=alessandromarcolini99@gmail.com \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@google.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.