[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190305093240.53095a37@cakuba.hsd1.ca.comcast.net>
Date: Tue, 5 Mar 2019 09:32:40 -0800
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: Alban Crequy <alban.crequy@...il.com>
Cc: ast@...nel.org, daniel@...earbox.net, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, alban@...volk.io, iago@...volk.io
Subject: Re: [PATCH bpf-next v1] tools/bpftool: create map of maps
On Tue, 5 Mar 2019 17:38:03 +0100, Alban Crequy wrote:
> From: Alban Crequy <alban@...volk.io>
>
> Before this patch, there was no way to fill attr.inner_map_fd, necessary
> for array_of_maps or hash_of_maps.
>
> This patch adds keyword 'innermap' to pass the innermap, either as an id
> or as a pinned map.
>
> Example of commands:
>
> $ sudo bpftool map create /sys/fs/bpf/innermap type hash \
> key 8 value 8 entries 64 name innermap flags 1
> $ sudo bpftool map create /sys/fs/bpf/outermap type hash_of_maps \
> innermap pinned /sys/fs/bpf/innermap key 64 value 4 \
> entries 64 name myoutermap flags 1
> $ sudo bpftool map show pinned /sys/fs/bpf/outermap
> 47: hash_of_maps name myoutermap flags 0x1
> key 64B value 4B max_entries 64 memlock 12288B
>
> Documentation and bash completion updated as well.
>
> Signed-off-by: Alban Crequy <alban@...volk.io>
bpf-next is closed let's continue reviewing, but you'll probably have
to repost after the merge window :(
> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
> index e0c650d91784..7d8ce903a471 100644
> --- a/tools/bpf/bpftool/map.c
> +++ b/tools/bpf/bpftool/map.c
> @@ -1151,6 +1151,9 @@ static int do_create(int argc, char **argv)
> return -1;
> }
> NEXT_ARG();
> + } else if (is_prefix(*argv, "innermap")) {
> + NEXT_ARG();
> + attr.inner_map_fd = map_parse_fd(&argc, &argv);
You need to check if the return value is not -1, and also close this
file descriptor (a) when done, (b) when error happens.
> }
> }
>
Powered by blists - more mailing lists