All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alban Crequy <alban@kinvolk.io>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: "Alban Crequy" <alban.crequy@gmail.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	netdev <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Iago López Galeiras" <iago@kinvolk.io>,
	"Thilo Fromm" <thilo@kinvolk.io>
Subject: Re: [PATCH bpf-next v1] tools/bpftool: create map of maps
Date: Thu, 7 Mar 2019 10:14:14 +0100	[thread overview]
Message-ID: <CADZs7q77wnbQSOT-mgX9KRC5ZbBxwt1_GaPDqeQ3jijFa09nMA@mail.gmail.com> (raw)
In-Reply-To: <20190305093240.53095a37@cakuba.hsd1.ca.comcast.net>

Thanks for the reviews, Jakub and Quentin! I will address it and
resend a new version when bpf-next opens again.
I'm also preparing some other patches on "bpftool map" about pinning
and passing file descriptors to help applications that don't support
map pinning directly.

On Tue, Mar 5, 2019 at 6:32 PM Jakub Kicinski
<jakub.kicinski@netronome.com> wrote:
>
> On Tue,  5 Mar 2019 17:38:03 +0100, Alban Crequy wrote:
> > From: Alban Crequy <alban@kinvolk.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@kinvolk.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.
>
> >               }
> >       }
> >

  reply	other threads:[~2019-03-07  9:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-05 16:38 [PATCH bpf-next v1] tools/bpftool: create map of maps Alban Crequy
2019-03-05 17:32 ` Jakub Kicinski
2019-03-07  9:14   ` Alban Crequy [this message]
2019-03-05 18:27 ` Quentin Monnet

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=CADZs7q77wnbQSOT-mgX9KRC5ZbBxwt1_GaPDqeQ3jijFa09nMA@mail.gmail.com \
    --to=alban@kinvolk.io \
    --cc=alban.crequy@gmail.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=iago@kinvolk.io \
    --cc=jakub.kicinski@netronome.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=thilo@kinvolk.io \
    /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.