All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Quentin Monnet <quentin@isovalent.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>, bpf <bpf@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>
Subject: Re: [PATCH bpf-next v3 2/3] tools: bpftool: keep errors for map-of-map dumps if distinct from ENOENT
Date: Thu, 10 Sep 2020 09:42:36 -0700	[thread overview]
Message-ID: <CAEf4BzZpp7Rfg5N-1G570NQ1FqKjthpeiuWkNUn-uXQv9Gx8Vg@mail.gmail.com> (raw)
In-Reply-To: <20200910102652.10509-3-quentin@isovalent.com>

On Thu, Sep 10, 2020 at 3:27 AM Quentin Monnet <quentin@isovalent.com> wrote:
>
> When dumping outer maps or prog_array maps, and on lookup failure,
> bpftool simply skips the entry with no error message. This is because
> the kernel returns non-zero when no value is found for the provided key,
> which frequently happen for those maps if they have not been filled.
>
> When such a case occurs, errno is set to ENOENT. It seems unlikely we
> could receive other error codes at this stage (we successfully retrieved
> map info just before), but to be on the safe side, let's skip the entry
> only if errno was ENOENT, and not for the other errors.
>
> v3: New patch
>
> Signed-off-by: Quentin Monnet <quentin@isovalent.com>
> ---
>  tools/bpf/bpftool/map.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
> index c8159cb4fb1e..d8581d5e98a1 100644
> --- a/tools/bpf/bpftool/map.c
> +++ b/tools/bpf/bpftool/map.c
> @@ -240,8 +240,8 @@ print_entry_error(struct bpf_map_info *map_info, void *key, int lookup_errno)
>          * means there is no entry for that key. Do not print an error message
>          * in that case.
>          */
> -       if (map_is_map_of_maps(map_info->type) ||
> -           map_is_map_of_progs(map_info->type))
> +       if ((map_is_map_of_maps(map_info->type) ||
> +            map_is_map_of_progs(map_info->type)) && lookup_errno == ENOENT)
>                 return;


Ah, ok, you decided to split it out into a separate patch. Ok.

Acked-by: Andrii Nakryiko <andriin@fb.com>

>
>         if (json_output) {
> --
> 2.25.1
>

  reply	other threads:[~2020-09-10 16:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 10:26 [PATCH bpf-next v3 0/2] tools: bpftool: support creating outer maps Quentin Monnet
2020-09-10 10:26 ` [PATCH bpf-next v3 1/3] tools: bpftool: clean up function to dump map entry Quentin Monnet
2020-09-10 16:41   ` Andrii Nakryiko
2020-09-10 16:43     ` Andrii Nakryiko
2020-09-10 10:26 ` [PATCH bpf-next v3 2/3] tools: bpftool: keep errors for map-of-map dumps if distinct from ENOENT Quentin Monnet
2020-09-10 16:42   ` Andrii Nakryiko [this message]
2020-09-10 16:45     ` Quentin Monnet
2020-09-10 10:26 ` [PATCH bpf-next v3 3/3] tools: bpftool: add "inner_map" to "bpftool map create" outer maps Quentin Monnet
2020-09-11  0:30 ` [PATCH bpf-next v3 0/2] tools: bpftool: support creating " Alexei Starovoitov

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=CAEf4BzZpp7Rfg5N-1G570NQ1FqKjthpeiuWkNUn-uXQv9Gx8Vg@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    --cc=quentin@isovalent.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.