Netdev List
 help / color / mirror / Atom feed
From: Stanislav Fomichev <sdf@fomichev.me>
To: Quentin Monnet <quentin.monnet@netronome.com>
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	ast@kernel.org, daniel@iogearbox.net, shuah@kernel.org,
	jakub.kicinski@netronome.com, guro@fb.com,
	jiong.wang@netronome.com, sdf@google.com,
	bhole_prashant_q7@lab.ntt.co.jp, john.fastabend@gmail.com,
	jbenc@redhat.com, treeze.taeung@gmail.com, yhs@fb.com,
	osk@fb.com, sandipan@linux.vnet.ibm.com
Subject: Re: [PATCH v4 bpf-next 5/7] bpftool: add loadall command
Date: Fri, 9 Nov 2018 07:42:46 -0800	[thread overview]
Message-ID: <20181109154246.f4vpeewji6wk6iww@mini-arch> (raw)
In-Reply-To: <30359d0f-40c0-27c9-cd4e-bba60c6cb138@netronome.com>

On 11/09, Quentin Monnet wrote:
> 2018-11-08 16:22 UTC-0800 ~ Stanislav Fomichev <sdf@fomichev.me>
> > From: Stanislav Fomichev <sdf@google.com>
> > 
> > This patch adds new *loadall* command which slightly differs from the
> > existing *load*. *load* command loads all programs from the obj file,
> > but pins only the first programs. *loadall* pins all programs from the
> > obj file under specified directory.
> > 
> > The intended usecase is flow_dissector, where we want to load a bunch
> > of progs, pin them all and after that construct a jump table.
> > 
> > Signed-off-by: Stanislav Fomichev <sdf@google.com>
> > ---
> >  .../bpftool/Documentation/bpftool-prog.rst    | 14 +++-
> >  tools/bpf/bpftool/bash-completion/bpftool     |  4 +-
> >  tools/bpf/bpftool/common.c                    | 31 ++++----
> >  tools/bpf/bpftool/main.h                      |  1 +
> >  tools/bpf/bpftool/prog.c                      | 74 ++++++++++++++-----
> >  5 files changed, 82 insertions(+), 42 deletions(-)
> > 
> > diff --git a/tools/bpf/bpftool/Documentation/bpftool-prog.rst b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
> > index ac4e904b10fb..d943d9b67a1d 100644
> > --- a/tools/bpf/bpftool/Documentation/bpftool-prog.rst
> > +++ b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
> 
> > @@ -24,7 +25,7 @@ MAP COMMANDS
> >  |	**bpftool** **prog dump xlated** *PROG* [{**file** *FILE* | **opcodes** | **visual**}]
> >  |	**bpftool** **prog dump jited**  *PROG* [{**file** *FILE* | **opcodes**}]
> >  |	**bpftool** **prog pin** *PROG* *FILE*
> > -|	**bpftool** **prog load** *OBJ* *FILE* [**type** *TYPE*] [**map** {**idx** *IDX* | **name** *NAME*} *MAP*] [**dev** *NAME*]
> > +|	**bpftool** **prog { load | loadall }** *OBJ* *FILE* [**type** *TYPE*] [**map** {**idx** *IDX* | **name** *NAME*} *MAP*] [**dev** *NAME*]
> >  |       **bpftool** **prog attach** *PROG* *ATTACH_TYPE* *MAP*
> >  |       **bpftool** **prog detach** *PROG* *ATTACH_TYPE* *MAP*
> >  |	**bpftool** **prog help**
> > @@ -79,8 +80,13 @@ DESCRIPTION
> >  		  contain a dot character ('.'), which is reserved for future
> >  		  extensions of *bpffs*.
> >  
> > -	**bpftool prog load** *OBJ* *FILE* [**type** *TYPE*] [**map** {**idx** *IDX* | **name** *NAME*} *MAP*] [**dev** *NAME*]
> > -		  Load bpf program from binary *OBJ* and pin as *FILE*.
> > +	**bpftool prog { load | loadall }** *OBJ* *FILE* [**type** *TYPE*] [**map** {**idx** *IDX* | **name** *NAME*} *MAP*] [**dev** *NAME*]
> > +		  Load bpf program(s) from binary *OBJ* and pin as *FILE*.
> > +		  Both **bpftool prog load** and **bpftool prog loadall** load
> > +		  all maps and programs from the *OBJ* and differ only in
> > +		  pinning. **load** pins only the first program from the *OBJ*
> > +		  as *FILE*. **loadall** pins all programs from the *OBJ*
> > +		  under *FILE* directory.
> >  		  **type** is optional, if not specified program type will be
> >  		  inferred from section names.
> >  		  By default bpftool will create new maps as declared in the ELF
> 
> Thanks a lot for all the changes! The series looks really good to me
> now. The last nit I might have is that we could maybe replace "FILE"
> with "PATH" (as it can now be a directory), in the doc an below. No need
> to respin just for this, though.
Agreed, makes sense, will do another respin to address Jakub's comments
anyway. Thanks for a review!

> > @@ -1035,7 +1067,8 @@ static int do_help(int argc, char **argv)
> >  		"       %s %s dump xlated PROG [{ file FILE | opcodes | visual }]\n"
> >  		"       %s %s dump jited  PROG [{ file FILE | opcodes }]\n"
> >  		"       %s %s pin   PROG FILE\n"
> > -		"       %s %s load  OBJ  FILE [type TYPE] [dev NAME] \\\n"
> > +		"       %s %s { load | loadall } OBJ  FILE \\\n"
> > +		"                         [type TYPE] [dev NAME] \\\n"
> >  		"                         [map { idx IDX | name NAME } MAP]\n"
> >  		"       %s %s attach PROG ATTACH_TYPE MAP\n"
> >  		"       %s %s detach PROG ATTACH_TYPE MAP\n"

  reply	other threads:[~2018-11-10  1:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09  0:22 [PATCH v4 bpf-next 0/7] bpftool: support loading flow dissector Stanislav Fomichev
2018-11-09  0:22 ` [PATCH v4 bpf-next 1/7] selftests/bpf: rename flow dissector section to flow_dissector Stanislav Fomichev
2018-11-09  0:22 ` [PATCH v4 bpf-next 2/7] libbpf: cleanup after partial failure in bpf_object__pin Stanislav Fomichev
2018-11-09  3:37   ` Jakub Kicinski
2018-11-09 15:41     ` Stanislav Fomichev
2018-11-09  0:22 ` [PATCH v4 bpf-next 3/7] libbpf: bpf_program__pin: add special case for instances.nr == 1 Stanislav Fomichev
2018-11-09  0:22 ` [PATCH v4 bpf-next 4/7] libbpf: add internal pin_name Stanislav Fomichev
2018-11-09  3:38   ` Jakub Kicinski
2018-11-09  0:22 ` [PATCH v4 bpf-next 5/7] bpftool: add loadall command Stanislav Fomichev
2018-11-09  3:41   ` Jakub Kicinski
2018-11-09 13:29   ` Quentin Monnet
2018-11-09 15:42     ` Stanislav Fomichev [this message]
2018-11-09  0:22 ` [PATCH v4 bpf-next 6/7] bpftool: add pinmaps argument to the load/loadall Stanislav Fomichev
2018-11-09  3:43   ` Jakub Kicinski
2018-11-09  0:22 ` [PATCH v4 bpf-next 7/7] bpftool: support loading flow dissector Stanislav Fomichev
2018-11-09  3:50   ` 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=20181109154246.f4vpeewji6wk6iww@mini-arch \
    --to=sdf@fomichev.me \
    --cc=ast@kernel.org \
    --cc=bhole_prashant_q7@lab.ntt.co.jp \
    --cc=daniel@iogearbox.net \
    --cc=guro@fb.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=jbenc@redhat.com \
    --cc=jiong.wang@netronome.com \
    --cc=john.fastabend@gmail.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=osk@fb.com \
    --cc=quentin.monnet@netronome.com \
    --cc=sandipan@linux.vnet.ibm.com \
    --cc=sdf@google.com \
    --cc=shuah@kernel.org \
    --cc=treeze.taeung@gmail.com \
    --cc=yhs@fb.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox