[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8c20e4d9-28a9-626f-1e15-40cf105d7ce7@netronome.com>
Date: Fri, 12 Apr 2019 11:28:31 +0100
From: Quentin Monnet <quentin.monnet@...ronome.com>
To: Benjamin Poirier <bpoirier@...e.com>,
Daniel Borkmann <daniel@...earbox.net>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH v2 bpf-next 2/2] bpftool: Improve handling of ENOSPC on
reuseport_array map dumps
2019-04-12 12:03 UTC+0900 ~ Benjamin Poirier <bpoirier@...e.com>
> avoids outputting a series of
> value:
> No space left on device
>
> The value itself is not wrong but bpf_fd_reuseport_array_lookup_elem() can
> only return it if the map was created with value_size = 8. There's nothing
> bpftool can do about it. Instead of repeating this error for every key in
> the map, print an explanatory warning and a specialized error.
>
> example before:
> key: 00 00 00 00
> value:
> No space left on device
> key: 01 00 00 00
> value:
> No space left on device
> key: 02 00 00 00
> value:
> No space left on device
> Found 0 elements
>
> example after:
> Warning: cannot read values from reuseport_sockarray map with value_size != 8
> key: 00 00 00 00 value: <cannot read>
> key: 01 00 00 00 value: <cannot read>
> key: 02 00 00 00 value: <cannot read>
> Found 0 elements
>
> Signed-off-by: Benjamin Poirier <bpoirier@...e.com>
> ---
> tools/bpf/bpftool/map.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
> index 71840faaeab5..e6d72f777767 100644
> --- a/tools/bpf/bpftool/map.c
> +++ b/tools/bpf/bpftool/map.c
> @@ -716,8 +716,12 @@ static int dump_map_elem(int fd, void *key, void *value,
> } else {
> const char *msg = NULL;
>
> - if (errno == ENOENT)
> + if (lookup_errno == ENOENT) {
> msg = "<no entry>";
> + } else if (lookup_errno == ENOSPC && map_info->type ==
> + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY) {
Nit: This should be aligned on the open parenthesis (And preferably
split after the "&&", if the second condition fits on its own line?).
Thanks for the changes! This version looks much better to me than v1.
Quentin
Powered by blists - more mailing lists