netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Donald Hunter <donald.hunter@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net,  netdev@vger.kernel.org,
	 edumazet@google.com, pabeni@redhat.com,  shuah@kernel.org,
	 petrm@nvidia.com, linux-kselftest@vger.kernel.org,
	 jiri@resnulli.us
Subject: Re: [PATCH net-next 2/6] tools: ynl: don't return None for dumps
Date: Thu, 11 Apr 2024 11:12:46 +0100	[thread overview]
Message-ID: <m24jc8i4wx.fsf@gmail.com> (raw)
In-Reply-To: <20240411012815.174400-3-kuba@kernel.org> (Jakub Kicinski's message of "Wed, 10 Apr 2024 18:28:11 -0700")

Jakub Kicinski <kuba@kernel.org> writes:

> YNL currently reports None for empty dump:
>
>  $ cli.py ...netdev.yaml --dump page-pool-get
>  None
>
> This doesn't matter for the CLI but when writing YNL based tests
> having to deal with either list or None is annoying. Limit the
> None conversion to non-dump ops:
>
>  $ cli.py ...netdev.yaml --dump page-pool-get
>  []

Makes sense and I'll need to update my --multi patch to retain this
behaviour.

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

> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: donald.hunter@gmail.com
> CC: jiri@resnulli.us
> ---
>  tools/net/ynl/lib/ynl.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
> index 0ba5f6fb8747..a67f7b6fef92 100644
> --- a/tools/net/ynl/lib/ynl.py
> +++ b/tools/net/ynl/lib/ynl.py
> @@ -995,9 +995,11 @@ genl_family_name_to_id = None
>                      rsp_msg.update(self._decode_struct(decoded.raw, op.fixed_header))
>                  rsp.append(rsp_msg)
>  
> +        if dump:
> +            return rsp
>          if not rsp:
>              return None
> -        if not dump and len(rsp) == 1:
> +        if len(rsp) == 1:
>              return rsp[0]
>          return rsp

  reply	other threads:[~2024-04-11 10:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11  1:28 [PATCH net-next 0/6] selftests: net: exercise page pool reporting via netlink Jakub Kicinski
2024-04-11  1:28 ` [PATCH net-next 1/6] net: netdevsim: add some fake page pool use Jakub Kicinski
2024-04-11  1:28 ` [PATCH net-next 2/6] tools: ynl: don't return None for dumps Jakub Kicinski
2024-04-11 10:12   ` Donald Hunter [this message]
2024-04-11  1:28 ` [PATCH net-next 3/6] selftests: net: print report check location in python tests Jakub Kicinski
2024-04-12  7:45   ` Petr Machata
2024-04-11  1:28 ` [PATCH net-next 4/6] selftests: net: print full exception on failure Jakub Kicinski
2024-04-12  8:02   ` Petr Machata
2024-04-11  1:28 ` [PATCH net-next 5/6] selftests: net: support use of NetdevSimDev under "with" in python Jakub Kicinski
2024-04-12  8:07   ` Petr Machata
2024-04-11  1:28 ` [PATCH net-next 6/6] selftests: net: exercise page pool reporting via netlink Jakub Kicinski
2024-04-12  8:20   ` Petr Machata
2024-04-12 13:48     ` Jakub Kicinski

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=m24jc8i4wx.fsf@gmail.com \
    --to=donald.hunter@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=shuah@kernel.org \
    /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).