Re: [PATCH bpf-next] tools: bpftool: add a command to dump the trace pipe

2018-12-06 Thread Quentin Monnet
2018-12-05 19:18 UTC-0800 ~ Alexei Starovoitov > On Wed, Dec 05, 2018 at 06:15:23PM +0000, Quentin Monnet wrote: >>>> + >>>> + /* Allow room for NULL terminating byte and pipe file name */ >>>> + snprintf(format, sizeof(format), "%%*s %%%zds %%99s %

Re: [PATCH bpf-next] tools: bpftool: add a command to dump the trace pipe

2018-12-05 Thread Quentin Monnet
2018-12-05 08:50 UTC-0800 ~ Alexei Starovoitov On Wed, Dec 05, 2018 at 10:28:24AM +, Quentin Monnet wrote: BPF programs can use the bpf_trace_printk() helper to print debug information into the trace pipe. Add a subcommand "bpftool prog tracelog" to simply dump this pipe to t

[PATCH bpf-next] tools: bpftool: add a command to dump the trace pipe

2018-12-05 Thread Quentin Monnet
ot;. Changes include dumping pipe content to stdout instead of stderr and adding JSON support (content is dumped as an array of strings, one per line read from the pipe). This version is dual-licensed, with Daniel's permission. Cc: Daniel Borkmann Suggested-by: Daniel Borkmann Signed-off-by: Quen

[PATCH bpf-next] bpf: fix documentation for eBPF helpers

2018-12-03 Thread Quentin Monnet
hree first helpers for maps, the man page explicitly states that the helpers are sorted in chronological order). While at it, bring other minor formatting edits for eBPF helpers documentation: mostly blank lines removal, RST formatting, or other small nits for consistency. Signed-off-by: Quen

[PATCH bpf-next 2/5] tools: bpftool: fix bash completion for bpftool prog (attach|detach)

2018-11-30 Thread Quentin Monnet
b7d3826c2ed6 ("bpf: bpftool, add support for attaching programs to maps") Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- tools/bpf/bpftool/bash-completion/bpftool | 73 +-- 1 file changed, 49 insertions(+), 24 deletions(-) diff --git a/tool

[PATCH bpf-next 0/5] tools: bpftool: fixes and small improvements

2018-11-30 Thread Quentin Monnet
details. Quentin Monnet (5): tools: bpftool: use "/proc/self/" i.o. crafting links with getpid() tools: bpftool: fix bash completion for bpftool prog (attach|detach) tools: bpftool: fix bash completion for new map types (queue and stack) tools: bpftool: mark offloaded pro

[PATCH bpf-next 1/5] tools: bpftool: use "/proc/self/" i.o. crafting links with getpid()

2018-11-30 Thread Quentin Monnet
f from the relevant files, now we do not use getpid() anymore. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- tools/bpf/bpftool/common.c | 5 ++--- tools/bpf/bpftool/jit_disasm.c | 11 +-- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/tools/bpf/bpft

[PATCH bpf-next 3/5] tools: bpftool: fix bash completion for new map types (queue and stack)

2018-11-30 Thread Quentin Monnet
ACK to bpftool-map") Signed-off-by: Quentin Monnet --- tools/bpf/bpftool/bash-completion/bpftool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool index b7e6c4f25ad1..9a60080f085f 100644 ---

[PATCH bpf-next 5/5] tools: bpftool: add owner_prog_type and owner_jited to bpftool output

2018-11-30 Thread Quentin Monnet
;: true } ] As we move the table used for associating names to program types, complete it with the missing types (lwt_seg6local and sk_reuseport). Also add missing types to the help message for "bpftool prog" (sk_reuseport and flow_dissector). Suggested-by: Daniel Borkmann

[PATCH bpf-next 4/5] tools: bpftool: mark offloaded programs more explicitly in plain output

2018-11-30 Thread Quentin Monnet
a04f5eef06a7f555 offloaded_to foo loaded_at 2018-10-19T16:40:36+0100 uid 0 xlated 16B not jited memlock 4096B Suggested-by: Daniel Borkmann Signed-off-by: Quentin Monnet Acked-by: Jakub Kicinski --- tools/bpf/bpftool/common.c | 2 +- 1 file changed, 1 insertion

Re: [PATCH bpf-next] bpf: libbpf: retry program creation without the name

2018-11-26 Thread Quentin Monnet
2018-11-26 11:08 UTC-0800 ~ Vlad Dumitrescu > On Fri, Nov 23, 2018 at 2:51 AM Quentin Monnet > wrote: >> >> 2018-11-21 09:28 UTC-0800 ~ Stanislav Fomichev >>> On 11/21, Quentin Monnet wrote: >>>> 2018-11-20 15:26 UTC-0800 ~ Stanislav Fomichev &

Re: [PATCH bpf-next 1/3] bpf: helper to pop data from messages

2018-11-26 Thread Quentin Monnet
2018-11-26 02:05 UTC+0100 ~ Daniel Borkmann > On 11/23/2018 02:38 AM, John Fastabend wrote: >> This adds a BPF SK_MSG program helper so that we can pop data from a >> msg. We use this to pop metadata from a previous push data call. >> >> Signed-off-by: John Fastabend >> --- >>

Re: [PATCH bpf-next] bpf: libbpf: retry program creation without the name

2018-11-23 Thread Quentin Monnet
2018-11-21 09:28 UTC-0800 ~ Stanislav Fomichev On 11/21, Quentin Monnet wrote: 2018-11-20 15:26 UTC-0800 ~ Stanislav Fomichev On 11/20, Alexei Starovoitov wrote: On Wed, Nov 21, 2018 at 12:18:57AM +0100, Daniel Borkmann wrote: On 11/21/2018 12:04 AM, Alexei Starovoitov wrote: On Tue, Nov

Re: [PATCH bpf-next] bpf: libbpf: retry program creation without the name

2018-11-20 Thread Quentin Monnet
2018-11-20 15:26 UTC-0800 ~ Stanislav Fomichev > On 11/20, Alexei Starovoitov wrote: >> On Wed, Nov 21, 2018 at 12:18:57AM +0100, Daniel Borkmann wrote: >>> On 11/21/2018 12:04 AM, Alexei Starovoitov wrote: On Tue, Nov 20, 2018 at 01:19:05PM -0800, Stanislav Fomichev wrote: > On 11/20,

[PATCH iproute2] bpf: initialise map symbol before retrieving and comparing its type

2018-11-19 Thread Quentin Monnet
ymbol type properly with newer llvm compiler") Reported-by: Ron Philip Signed-off-by: Quentin Monnet Reviewed-by: Jiong Wang --- lib/bpf.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/bpf.c b/lib/bpf.c index 45f279fa4a41..6aff8f7bad7f 100644 --

Re: [PATCH bpf-next v2] bpftool: make libbfd optional

2018-11-12 Thread Quentin Monnet
2018-11-12 14:02 UTC-0800 ~ Jakub Kicinski > On Mon, 12 Nov 2018 13:44:10 -0800, Stanislav Fomichev wrote: >> Make it possible to build bpftool without libbfd. libbfd and libopcodes are >> typically provided in dev/dbg packages (binutils-dev in debian) which we >> usually don't have installed on

Re: [PATCH v5 bpf-next 0/7] bpftool: support loading flow dissector

2018-11-09 Thread Quentin Monnet
se_attach_detach_args > * for -> while in bpf_object__pin_{programs,maps} recovery > > v4 changes: > * addressed another round of comments/style issues from Jakub Kicinski & > Quentin Monnet (thanks!) > * implemented bpf_object__pin_maps and bpf_object__pin_programs helpers and &

Re: [PATCH v4 bpf-next 5/7] bpftool: add loadall command

2018-11-09 Thread Quentin Monnet
2018-11-08 16:22 UTC-0800 ~ Stanislav Fomichev > From: Stanislav Fomichev > > 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 >

[PATCH bpf-next 9/9] bpf: do not pass netdev to translate() and prepare() offload callbacks

2018-11-09 Thread Quentin Monnet
s retrieve the net device themselves from the offload object attached to prog - if they need it at all. There is currently no need to pass the netdev as an argument to those functions. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- drivers/net/ethernet/netronome/

[PATCH bpf-next 5/9] bpf: call verifier_prep from its callback in struct bpf_offload_dev

2018-11-09 Thread Quentin Monnet
by any callback, we can now remove it from struct bpf_prog_offload. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- .../net/ethernet/netronome/nfp/bpf/offload.c | 11 +++ drivers/net/netdevsim/bpf.c | 32 ++- include/linux/bpf.h

[PATCH bpf-next 4/9] bpf: call finalize() from its callback in struct bpf_offload_dev

2018-11-09 Thread Quentin Monnet
In a way similar to the change previously brought to the verify_insn hook, switch to the newly added ops in struct bpf_prog_offload for calling the functions used to perform final verification steps for offloaded programs. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- kernel

[PATCH bpf-next 7/9] bpf: pass destroy() as a callback and remove its ndo_bpf subcommand

2018-11-09 Thread Quentin Monnet
(), which is no longer used. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- .../net/ethernet/netronome/nfp/bpf/offload.c | 7 ++ drivers/net/netdevsim/bpf.c | 4 +--- include/linux/bpf.h | 1 + include/linux/netdevice.h

[PATCH bpf-next 6/9] bpf: pass translate() as a callback and remove its ndo_bpf subcommand

2018-11-09 Thread Quentin Monnet
As part of the transition from ndo_bpf() to callbacks attached to struct bpf_offload_dev for some of the eBPF offload operations, move the functions related to code translation to the struct and remove the subcommand that was used to call them through the NDO. Signed-off-by: Quentin Monnet

[PATCH bpf-next 8/9] bpf: pass prog instead of env to bpf_prog_offload_verifier_prep()

2018-11-09 Thread Quentin Monnet
: the two drivers supporting this, nfp and netdevsim, only need a pointer to the struct bpf_prog instance held by env. Update the callback accordingly, on kernel side and in these two drivers. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- drivers/net/ethernet/netronome/nfp/bpf

[PATCH bpf-next 2/9] bpf: pass a struct with offload callbacks to bpf_offload_dev_create()

2018-11-09 Thread Quentin Monnet
t it, rename "nfp_bpf_analyzer_ops" as "nfp_bpf_dev_ops" (and similarly for netdevsim). Suggested-by: Jakub Kicinski Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- drivers/net/ethernet/netronome/nfp/bpf/main.c| 2 +- drivers/net/ethernet/netronome/nfp/bpf/main.h| 2 +- dr

[PATCH bpf-next 1/9] nfp: bpf: move nfp_bpf_analyzer_ops from verifier.c to offload.c

2018-11-09 Thread Quentin Monnet
We are about to add several new callbacks to the struct, all of them defined in offload.c. Move the struct bpf_prog_offload_ops object in that file. As a consequence, nfp_verify_insn() and nfp_finalize() can no longer be static. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski

[PATCH bpf-next 3/9] bpf: call verify_insn from its callback in struct bpf_offload_dev

2018-11-09 Thread Quentin Monnet
bpf_prog_offload instead. To avoid table lookups for each eBPF instruction to verify, we remember the offdev attached to a netdev and modify bpf_offload_find_netdev() to avoid performing more than once a lookup for a given offload object. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski

[PATCH bpf-next 0/9] bpf: pass device ops as callbacks and remove some ndo_bpf subcommands

2018-11-09 Thread Quentin Monnet
and netdevsim drivers. Quentin Monnet (9): nfp: bpf: move nfp_bpf_analyzer_ops from verifier.c to offload.c bpf: pass a struct with offload callbacks to bpf_offload_dev_create() bpf: call verify_insn from its callback in struct bpf_offload_dev bpf: call finalize() from its callback in struct

Re: [PATCH v3 bpf-next 4/4] bpftool: support loading flow dissector

2018-11-08 Thread Quentin Monnet
2018-11-08 10:01 UTC-0800 ~ Stanislav Fomichev > On 11/08, Quentin Monnet wrote: >> Hi Stanislav, thanks for the changes! More comments below. > Thank you for another round of review! > >> 2018-11-07 21:39 UTC-0800 ~ Stanislav Fomichev >>> This commit adds

[PATCH bpf 2/4] tools: bpftool: fix plain output and doc for --bpffs option

2018-11-08 Thread Quentin Monnet
oad". Also fix the plain output: do not add a blank line after each program block, in order to remain consistent with what bpftool does when the option is not passed. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- tools/bpf/bpftool/Documentation/bpftool-prog.rst | 3 ++- tool

[PATCH bpf 4/4] tools: bpftool: update references to other man pages in documentation

2018-11-08 Thread Quentin Monnet
Update references to other bpftool man pages at the bottom of each manual page. Also reference the "bpf(2)" and "bpf-helpers(7)" man pages. References are sorted by number of man section, then by "prog-and-map-go-first", the other pages in alphabetical order.

[PATCH bpf 0/4] tools: bpftool: bring several minor fixes to bpftool

2018-11-08 Thread Quentin Monnet
Hi, This set contains minor fixes for bpftool code and documentation. Please refer to individual patches for details. Quentin Monnet (4): tools: bpftool: prevent infinite loop in get_fdinfo() tools: bpftool: fix plain output and doc for --bpffs option tools: bpftool: pass an argument

[PATCH bpf 1/4] tools: bpftool: prevent infinite loop in get_fdinfo()

2018-11-08 Thread Quentin Monnet
: 71bb428fe2c1 ("tools: bpf: add bpftool") Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- tools/bpf/bpftool/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c index 1149565be4b1..acd839e0e

[PATCH bpf 3/4] tools: bpftool: pass an argument to silence open_obj_pinned()

2018-11-08 Thread Quentin Monnet
{pathname="/sys/fs/bpf/xdp", bpf_fd=0}, 72) = -1 EACCES (Permission denied) Error: bpf obj get (/sys/fs/bpf): Permission denied ... To fix it, pass a bool as a second argument to the function, and prevent it from printing an error when the argument is set to true. Signed-off-by

Re: [PATCH v3 bpf-next 4/4] bpftool: support loading flow dissector

2018-11-08 Thread Quentin Monnet
Hi Stanislav, thanks for the changes! More comments below. 2018-11-07 21:39 UTC-0800 ~ Stanislav Fomichev This commit adds support for loading/attaching/detaching flow dissector program. The structure of the flow dissector program is assumed to be the same as in the selftests: *

Re: [PATCH bpf-next 2/2] bpftool: support loading flow dissector

2018-11-07 Thread Quentin Monnet
2018-11-07 12:32 UTC-0800 ~ Jakub Kicinski On Wed, 7 Nov 2018 20:08:53 +, Quentin Monnet wrote: + err = bpf_obj_pin(bpf_program__fd(prog), pinfile); + if (err) { + p_err("failed to pin progr

Re: [PATCH bpf-next 2/2] bpftool: support loading flow dissector

2018-11-07 Thread Quentin Monnet
Hi Stanislav, 2018-11-07 11:35 UTC-0800 ~ Stanislav Fomichev > This commit adds support for loading/attaching/detaching flow > dissector program. The structure of the flow dissector program is > assumed to be the same as in the selftests: > > * flow_dissector section with the main entry point >

Re: [PATCH bpf-next] tools: bpftool: adjust rlimit RLIMIT_MEMLOCK when loading programs, maps

2018-11-07 Thread Quentin Monnet
2018-11-07 16:59 UTC+ ~ Martin Lau > On Wed, Nov 07, 2018 at 12:29:30PM +0000, Quentin Monnet wrote: >> The limit for memory locked in the kernel by a process is usually set to >> 64 bytes by default. This can be an issue when creating large BPF maps > hmm... 64 _k_bytes?

[PATCH bpf-next] tools: bpftool: adjust rlimit RLIMIT_MEMLOCK when loading programs, maps

2018-11-07 Thread Quentin Monnet
as in iproute2: the rlimit is raised to infinity before trying to load programs or to create maps with bpftool. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- tools/bpf/bpftool/common.c | 8 tools/bpf/bpftool/main.h | 2 ++ tools/bpf/bpftool/map.c| 2 ++ tools/bpf/bpftool

[PATCH bpf-next] selftests/bpf: enable (uncomment) all tests in test_libbpf.sh

2018-11-07 Thread Quentin Monnet
present at the time when test_libbpf.sh and test_libbpf_open.c were created. RFC -> v1: - Compile test_xdp without the "-target bpf" flag, and try to load it instead of ../../samples/bpf/tracex3_kern.o. - Delete test_xdp_noinline.o subtest. Cc: Jesper Dangaard Brouer Signed-off-by: Quentin Monnet A

Re: [RFC bpf-next] libbpf: increase rlimit before trying to create BPF maps

2018-11-02 Thread Quentin Monnet
2018-11-02 10:08 UTC+0100 ~ Daniel Borkmann > On 11/01/2018 06:18 PM, Quentin Monnet wrote: >> 2018-10-30 15:23 UTC+ ~ Quentin Monnet >>> The limit for memory locked in the kernel by a process is usually set to >>> 64 bytes by default. This can be an issue w

Re: [RFC bpf-next] libbpf: increase rlimit before trying to create BPF maps

2018-11-01 Thread Quentin Monnet
2018-10-30 15:23 UTC+ ~ Quentin Monnet > The limit for memory locked in the kernel by a process is usually set to > 64 bytes by default. This can be an issue when creating large BPF maps. > A workaround is to raise this limit for the current process before > trying to create a

[RFC bpf-next] libbpf: increase rlimit before trying to create BPF maps

2018-10-30 Thread Quentin Monnet
as a RFC to see if people would prefer the bcc approach instead, or the rlimit change to be in bpftool rather than in libbpf. Signed-off-by: Quentin Monnet --- tools/lib/bpf/bpf.c | 5 + 1 file changed, 5 insertions(+) diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c index 03f9bcc4ef50

Re: [PATCH bpf-next] selftests/bpf: enable (uncomment) all tests in test_libbpf.sh

2018-10-22 Thread Quentin Monnet
2018-10-21 23:04 UTC+0200 ~ Jesper Dangaard Brouer > On Sun, 21 Oct 2018 16:37:08 +0100 > Quentin Monnet wrote: > >> 2018-10-21 11:57 UTC+0200 ~ Jesper Dangaard Brouer >>> On Sat, 20 Oct 2018 23:00:24 +0100 >>> Quentin Monnet wrote: >>> >> &g

Re: [PATCH bpf-next] selftests/bpf: enable (uncomment) all tests in test_libbpf.sh

2018-10-21 Thread Quentin Monnet
2018-10-21 11:57 UTC+0200 ~ Jesper Dangaard Brouer > On Sat, 20 Oct 2018 23:00:24 +0100 > Quentin Monnet wrote: > [...] >> --- a/tools/testing/selftests/bpf/test_libbpf.sh >> +++ b/tools/testing/selftests/bpf/test_libbpf.sh >> @@ -33,17 +33,11 @@

[PATCH bpf-next 3/3] tools: bpftool: fix completion for "bpftool map update"

2018-10-20 Thread Quentin Monnet
g. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- tools/bpf/bpftool/bash-completion/bpftool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool index c56545e87b0d..3f78e6404

[PATCH bpf-next 2/3] tools: bpftool: print nb of cmds to stdout (not stderr) for batch mode

2018-10-20 Thread Quentin Monnet
. Reported-by: David Beckett Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- tools/bpf/bpftool/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c index 828dde30e9ec..75a3296dc0bc 100644 --- a/tools/bpf

[PATCH bpf-next 1/3] tools: bpftool: document restriction on '.' in names to pin in bpffs

2018-10-20 Thread Quentin Monnet
Names used to pin eBPF programs and maps under the eBPF virtual file system cannot contain a dot character, which is reserved for future extensions of this file system. Document this in bpftool man pages to avoid users getting confused if pinning fails because of a dot. Signed-off-by: Quentin

[PATCH bpf-next 0/3] tools: bpftool: bring minor fixes to bpftool

2018-10-20 Thread Quentin Monnet
Hi, These are three minor fixes for bpftool, its documentation and its bash completion function. Please refer to individual patches for details. Quentin Monnet (3): tools: bpftool: document restriction on '.' in names to pin in bpffs tools: bpftool: print nb of cmds to stdout (not stderr

[PATCH bpf-next] selftests/bpf: enable (uncomment) all tests in test_libbpf.sh

2018-10-20 Thread Quentin Monnet
error for test_l4lb_noinline.o, even with the version of libbpf present at the time when test_libbpf.sh and test_libbpf_open.c were created. Cc: Jesper Dangaard Brouer Signed-off-by: Quentin Monnet --- tools/testing/selftests/bpf/test_libbpf.sh | 12 +++- tools/testing/selftests/bpf/te

[PATCH bpf-next] selftests/bpf: fix return value comparison for tests in test_libbpf.sh

2018-10-20 Thread Quentin Monnet
-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- tools/testing/selftests/bpf/test_libbpf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_libbpf.sh b/tools/testing/selftests/bpf/test_libbpf.sh index d97dc914cd49..156d89f1edcc 100755 --- a/tools

Re: [PATCH bpf] bpf: fix doc of bpf_skb_adjust_room() in uapi

2018-10-17 Thread Quentin Monnet
2018-10-17 16:24 UTC+0200 ~ Nicolas Dichtel len_diff is signed. Fixes: fa15601ab31e ("bpf: add documentation for eBPF helpers (33-41)") CC: Quentin Monnet Signed-off-by: Nicolas Dichtel --- include/uapi/linux/bpf.h | 2 +- tools/include/uapi/linux/bpf.h | 2 +- 2 files

[PATCH bpf-next 11/12] nfp: bpf: support pointers to other stack frames for BPF-to-BPF calls

2018-10-07 Thread Quentin Monnet
an address to one of its local variables located in the stack, as an argument). Thanks to Jakub and Jiong for figuring out how to deal with this case, I just had to turn their email discussion into this patch. Suggested-by: Jiong Wang Suggested-by: Jakub Kicinski Signed-off-by: Quentin Monnet

[PATCH bpf-next 09/12] nfp: bpf: fix return address from register-saving subroutine to callee

2018-10-07 Thread Quentin Monnet
. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- drivers/net/ethernet/netronome/nfp/bpf/jit.c | 28 +++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/netronome/nfp/bpf/jit.c b/drivers/net/ethernet/netronome/nfp/bpf/jit.c

[PATCH bpf-next 10/12] nfp: bpf: optimise save/restore for R6~R9 based on register usage

2018-10-07 Thread Quentin Monnet
those registers, we can avoid appending the subroutines at the end of the program. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- drivers/net/ethernet/netronome/nfp/bpf/jit.c | 85 ++- drivers/net/ethernet/netronome/nfp/bpf/main.h | 2 + drivers/net

[PATCH bpf-next 05/12] nfp: bpf: account for BPF-to-BPF calls when preparing nfp JIT

2018-10-07 Thread Quentin Monnet
t to determine where to add prologues for subprograms. Signed-off-by: Quentin Monnet Reviewed-by: Jiong Wang Reviewed-by: Jakub Kicinski --- drivers/net/ethernet/netronome/nfp/bpf/jit.c | 35 +++ drivers/net/ethernet/netronome/nfp/bpf/main.h | 3 ++- 2 files changed,

[PATCH bpf-next 12/12] bpf: allow offload of programs with BPF-to-BPF function calls

2018-10-07 Thread Quentin Monnet
Now that there is at least one driver supporting BPF-to-BPF function calls, lift the restriction, in the verifier, on hardware offload of eBPF programs containing such calls. But prevent jit_subprogs(), still in the verifier, from being run for offloaded programs. Signed-off-by: Quentin Monnet

[PATCH bpf-next 04/12] nfp: bpf: ignore helper-related checks for BPF calls in nfp verifier

2018-10-07 Thread Quentin Monnet
at it, rename the function that runs those checks to make it clear they apply to _helper_ calls only. Signed-off-by: Quentin Monnet Reviewed-by: Jiong Wang Reviewed-by: Jakub Kicinski --- drivers/net/ethernet/netronome/nfp/bpf/main.h | 8 drivers/net/ethernet/netronome/nfp/bpf/verifier.c | 9

[PATCH bpf-next 01/12] bpf: add verifier callback to get stack usage info for offloaded progs

2018-10-07 Thread Quentin Monnet
callback (returning 0) in the drivers providing the structs, namely netdevsim and nfp. This will be useful in the nfp driver, in later commits, to extract the number of subprograms as well as the stack depth for those subprograms. Signed-off-by: Quentin Monnet Reviewed-by: Jiong Wang Reviewed

[PATCH bpf-next 00/12] nfp: bpf: add support for BPF-to-BPF function calls

2018-10-07 Thread Quentin Monnet
for the JIT-compiler, and everything related to stack accesses. Quentin Monnet (12): bpf: add verifier callback to get stack usage info for offloaded progs nfp: bpf: rename nfp_prog->stack_depth as nfp_prog->stack_frame_depth nfp: bpf: copy eBPF subprograms information from kernel ve

[PATCH bpf-next 08/12] nfp: bpf: update fixup function for BPF-to-BPF calls support

2018-10-07 Thread Quentin Monnet
the stack. Signed-off-by: Quentin Monnet Signed-off-by: Jiong Wang Reviewed-by: Jakub Kicinski --- drivers/net/ethernet/netronome/nfp/bpf/jit.c | 25 ++--- drivers/net/ethernet/netronome/nfp/bpf/main.h | 2 ++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git

[PATCH bpf-next 03/12] nfp: bpf: copy eBPF subprograms information from kernel verifier

2018-10-07 Thread Quentin Monnet
of a subprogram will be marked with a flag in a later patch. Signed-off-by: Quentin Monnet Reviewed-by: Jiong Wang Reviewed-by: Jakub Kicinski --- drivers/net/ethernet/netronome/nfp/bpf/main.h | 12 drivers/net/ethernet/netronome/nfp/bpf/offload.c | 2 ++ drivers/net

[PATCH bpf-next 02/12] nfp: bpf: rename nfp_prog->stack_depth as nfp_prog->stack_frame_depth

2018-10-07 Thread Quentin Monnet
e of the whole stack memory). Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- drivers/net/ethernet/netronome/nfp/bpf/jit.c | 10 +- drivers/net/ethernet/netronome/nfp/bpf/main.h| 4 ++-- drivers/net/ethernet/netronome/nfp/bpf/offload.c | 2 +- 3 files changed, 8 insert

[PATCH bpf-next 06/12] nfp: bpf: add main logics for BPF-to-BPF calls support in nfp driver

2018-10-07 Thread Quentin Monnet
additional requirements associated to BPF-to-BPF calls (storing R6-R9 and return addresses), are added in a later patch. Signed-off-by: Quentin Monnet Signed-off-by: Jiong Wang Reviewed-by: Jakub Kicinski --- drivers/net/ethernet/netronome/nfp/bpf/jit.c | 235 +- drivers/ne

[PATCH bpf-next 07/12] nfp: bpf: account for additional stack usage when checking stack limit

2018-10-07 Thread Quentin Monnet
of the verification step rather than translation. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- drivers/net/ethernet/netronome/nfp/bpf/offload.c | 8 --- drivers/net/ethernet/netronome/nfp/bpf/verifier.c | 68 +++ 2 files changed, 68 insertions(+), 8

Re: [PATCH bpf] tools: bpftool: return from do_event_pipe() on bad arguments

2018-08-23 Thread Quentin Monnet
2018-08-23 20:35 UTC+0300 ~ Sergei Shtylyov > Hello! > > On 08/23/2018 07:46 PM, Quentin Monnet wrote: > >> When command line parsing fails in the while loop in do_event_pipe() >> because the number of arguments is incorrect or because the keyword is >> unknown,

[PATCH bpf] tools: bpftool: return from do_event_pipe() on bad arguments

2018-08-23 Thread Quentin Monnet
ftool: add simple perf event output reader") Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- tools/bpf/bpftool/map_perf_ring.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/map_perf_ring.c b/tools/bpf/bpftool/map_perf_ring.c index 18

[PATCH bpf-next 1/3] bpf: fix documentation for eBPF helpers

2018-07-12 Thread Quentin Monnet
Minor formatting edits for eBPF helpers documentation, including blank lines removal, fix of item list for return values in bpf_fib_lookup(), and missing prefix on bpf_skb_load_bytes_relative(). Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- include/uapi/linux/bpf.h | 6

[PATCH bpf-next 2/3] tools: bpf: synchronise BPF UAPI header with tools

2018-07-12 Thread Quentin Monnet
Update with latest changes from include/uapi/linux/bpf.h header. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- tools/include/uapi/linux/bpf.h | 32 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/tools/include/uapi/linux/bpf.h b

[PATCH bpf-next 0/3] bpf: install eBPF helper man page along with bpftool doc

2018-07-12 Thread Quentin Monnet
for generating the documentation (man pages) about eBPF helpers. The targets defined in this file can also be called from the bpftool directory (please refer to relevant commit logs for details). Quentin Monnet (3): bpf: fix documentation for eBPF helpers tools: bpf: synchronise BPF UAPI header

[PATCH bpf-next 3/3] tools: bpf: build and install man page for eBPF helpers from bpftool/

2018-07-12 Thread Quentin Monnet
e from bpftool directory makes us able to package the helpers man page with bpftool, and to install it along with bpftool documentation, so that the doc for helpers becomes easily available to developers through the "man" program. Cc: linux-...@vger.kernel.org Suggested-by: Daniel Borkm

Re: [PATCH bpf-net] bpf: Change bpf_fib_lookup to return lookup status

2018-06-19 Thread Quentin Monnet
Hi David, 2018-06-17 08:18 UTC-0700 ~ dsah...@kernel.org > From: David Ahern > > For ACLs implemented using either FIB rules or FIB entries, the BPF > program needs the FIB lookup status to be able to drop the packet. > Since the bpf_fib_lookup API has not reached a released kernel yet, >

Re: [PATCH bpf-next] bpf: clean up eBPF helpers documentation

2018-05-30 Thread Quentin Monnet
On 29 May 2018 at 20:44, Daniel Borkmann wrote: > On 05/29/2018 08:27 PM, Song Liu wrote: >> On Tue, May 29, 2018 at 4:27 AM, Quentin Monnet >> wrote: >>> These are minor edits for the eBPF helpers documentation in >>> include/uapi/linux/bpf.h. >>

Re: [PATCH bpf-next 06/11] bpf: add bpf_skb_cgroup_id helper

2018-05-29 Thread Quentin Monnet
Hi Daniel, 2018-05-28 02:43 UTC+0200 ~ Daniel Borkmann > Add a new bpf_skb_cgroup_id() helper that allows to retrieve the > cgroup id from the skb's socket. This is useful in particular to > enable bpf_get_cgroup_classid()-like behavior for cgroup v1 in > cgroup v2 by allowing ID based matching

[PATCH bpf-next] bpf: clean up eBPF helpers documentation

2018-05-29 Thread Quentin Monnet
e in description of the return value for "bpf_get_stack()" helper. - Removing unnecessary blank lines between "Description" and "Return" sections for the few helpers that would use it, for consistency. Signed-off-by: Quentin Monnet --- include/uapi/linux/bpf.h | 21

Re: [PATCH v3 2/2] bpf: add selftest for rawir_event type program

2018-05-18 Thread Quentin Monnet
2018-05-18 14:33 UTC+0100 ~ Sean Young <s...@mess.org> > On Fri, May 18, 2018 at 11:13:07AM +0100, Quentin Monnet wrote: >> 2018-05-17 22:01 UTC+0100 ~ Sean Young <s...@mess.org> >>> On Thu, May 17, 2018 at 10:17:59AM -0700, Y Song wrote: >>>> On W

Re: [PATCH v3 2/2] bpf: add selftest for rawir_event type program

2018-05-18 Thread Quentin Monnet
2018-05-17 22:01 UTC+0100 ~ Sean Young > On Thu, May 17, 2018 at 10:17:59AM -0700, Y Song wrote: >> On Wed, May 16, 2018 at 2:04 PM, Sean Young wrote: >>> This is simple test over rc-loopback. >>> >>> Signed-off-by: Sean Young >>> --- >>>

Re: [PATCH bpf-next] bpf: change eBPF helper doc parsing script to allow for smaller indent

2018-05-17 Thread Quentin Monnet
2018-05-17 17:38 UTC+0200 ~ Daniel Borkmann <dan...@iogearbox.net> > On 05/17/2018 02:43 PM, Quentin Monnet wrote: >> Documentation for eBPF helpers can be parsed from bpf.h and eventually >> turned into a man page. Commit 6f96674dbd8c ("bpf: relax constraints on >

[PATCH bpf-next] bpf: change eBPF helper doc parsing script to allow for smaller indent

2018-05-17 Thread Quentin Monnet
n `git show`, so it is likely other helper authors will use the same length. Therefore, allow for helper documentation to use 5 spaces only for the first indent level. Signed-off-by: Quentin Monnet <quentin.mon...@netronome.com> --- scripts/bpf_helpers_doc.py | 8 1 file change

Re: [PATCH v3 1/2] media: rc: introduce BPF_PROG_RAWIR_EVENT

2018-05-17 Thread Quentin Monnet
2018-05-16 22:04 UTC+0100 ~ Sean Young > Add support for BPF_PROG_RAWIR_EVENT. This type of BPF program can call > rc_keydown() to reported decoded IR scancodes, or rc_repeat() to report > that the last key should be repeated. > > The bpf program can be attached to using the

Re: [PATCH bpf-next v4 3/4] bpf: selftest additions for SOCKHASH

2018-05-04 Thread Quentin Monnet
2018-05-03 11:28:27 UTC-0700 ~ John Fastabend > This runs existing SOCKMAP tests with SOCKHASH map type. To do this > we push programs into include file and build two BPF programs. One > for SOCKHASH and one for SOCKMAP. > > We then run the entire test suite with each

[PATCH bpf-next v2] bpf: relax constraints on formatting for eBPF helper documentation

2018-05-02 Thread Quentin Monnet
ets from each regex used with match() in the script. They are redundant, as match() tries to match from the beginning of the string by default. v2: Remove unnecessary caret when a regex is used with match(). Signed-off-by: Quentin Monnet <quentin.mon...@netronome.com> --- scripts/bpf_helpers

[PATCH bpf-nex] tools: bpftool: change time format for program 'loaded at:' information

2018-05-01 Thread Quentin Monnet
"ns_inode": 4026531993, "ifname": "foo" }, "loaded_at": 1524068387, "uid": 0, "bytes_xlated": 16, "jited": false, "bytes_memlock&

Re: [PATCH bpf-next] bpf: relax constraints on formatting for eBPF helper documentation

2018-04-30 Thread Quentin Monnet
2018-04-30 17:33 UTC+0100 ~ Edward Cree <ec...@solarflare.com> > On 30/04/18 16:59, Quentin Monnet wrote: >> The Python script used to parse and extract eBPF helpers documentation >> from include/uapi/linux/bpf.h expects a very specific formatting for the >> descript

[PATCH bpf-next] bpf: relax constraints on formatting for eBPF helper documentation

2018-04-30 Thread Quentin Monnet
>> Start of description... *> > Another line of description *..And yet another line of description *> Return *.>0 on success, or a negative error in case of failure ... */ Signed-off-by: Quentin

Re: [PATCH bpf-next 2/3] bpf: fix formatting for bpf_get_stack() helper doc

2018-04-30 Thread Quentin Monnet
2018-04-30 09:12 UTC-0600 ~ David Ahern > On 4/30/18 9:08 AM, Alexei Starovoitov wrote: >>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h >>> index 530ff6588d8f..8daef7326bb7 100644 >>> --- a/include/uapi/linux/bpf.h >>> +++ b/include/uapi/linux/bpf.h >>> @@

[PATCH bpf-next 2/3] bpf: fix formatting for bpf_get_stack() helper doc

2018-04-30 Thread Quentin Monnet
Fix formatting (indent) for bpf_get_stack() helper documentation, so that the doc is rendered correctly with the Python script. Fixes: c195651e565a ("bpf: add bpf_get_stack helper") Cc: Yonghong Song <y...@fb.com> Signed-off-by: Quentin Monnet <quentin.mon...@netronome.com>

[PATCH bpf-next 3/3] bpf: update bpf.h uapi header for tools

2018-04-30 Thread Quentin Monnet
Bring fixes for eBPF helper documentation formatting to bpf.h under tools/ as well. Signed-off-by: Quentin Monnet <quentin.mon...@netronome.com> --- tools/include/uapi/linux/bpf.h | 62 +- 1 file changed, 31 insertions(+), 31 deletions(-) diff

[PATCH bpf-next 1/3] bpf: fix formatting for bpf_perf_event_read() helper doc

2018-04-30 Thread Quentin Monnet
. Fixes: c6b5fb8690fa ("bpf: add documentation for eBPF helpers (42-50)") Signed-off-by: Quentin Monnet <quentin.mon...@netronome.com> --- include/uapi/linux/bpf.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/l

[PATCH bpf-next 0/3] bpf: fix formatting for eBPF helper doc

2018-04-30 Thread Quentin Monnet
is fine, but description and return value appear as empty). There is no change to text contents in this set. Quentin Monnet (3): bpf: fix formatting for bpf_perf_event_read() helper doc bpf: fix formatting for bpf_get_stack() helper documentation bpf: update bpf.h uapi header for tools

Re: [PATCH bpf-next 0/2] Fix BPF helpers documentation

2018-04-29 Thread Quentin Monnet
bpf: Sync bpf.h to tools/ > > include/uapi/linux/bpf.h | 12 ++-- > tools/include/uapi/linux/bpf.h | 12 ++-- > 2 files changed, 12 insertions(+), 12 deletions(-) Correct. Thanks a lot for the fix, Andrey! Reviewed-by: Quentin Monnet <quentin.mon...@netronome.com>

[PATCH bpf-next v4 03/10] bpf: add documentation for eBPF helpers (12-22)

2018-04-25 Thread Quentin Monnet
t_stackid(): Add a note about PERF_MAX_STACK_DEPTH being configurable. Cc: Alexei Starovoitov <a...@kernel.org> Signed-off-by: Quentin Monnet <quentin.mon...@netronome.com> Acked-by: Alexei Starovoitov <a...@kernel.org> --- include/uapi/linux/bpf.h | 254

[PATCH bpf-next v4 02/10] bpf: add documentation for eBPF helpers (01-11)

2018-04-25 Thread Quentin Monnet
e description of BPF_F_INGRESS flag. Cc: Alexei Starovoitov <a...@kernel.org> Signed-off-by: Quentin Monnet <quentin.mon...@netronome.com> Acked-by: Alexei Starovoitov <a...@kernel.org> --- include/uapi/linux/bpf.h | 230 +++ 1 file chang

[PATCH bpf-next v4 07/10] bpf: add documentation for eBPF helpers (51-57)

2018-04-25 Thread Quentin Monnet
ndrey Ignatov <r...@fb.com> Signed-off-by: Quentin Monnet <quentin.mon...@netronome.com> Acked-by: Yonghong Song <y...@fb.com> [for bpf_perf_event_read_value(), bpf_perf_prog_read_value()] Acked-by: Andrey Ignatov <r...@fb.com> [for bpf_bind()] --- include/uapi/linux/bpf.h | 180 +

[PATCH bpf-next v4 10/10] bpf: update bpf.h uapi header for tools

2018-04-25 Thread Quentin Monnet
Update tools/include/uapi/linux/bpf.h file in order to reflect the changes for BPF helper functions documentation introduced in previous commits. Signed-off-by: Quentin Monnet <quentin.mon...@netronome.com> --- tools/include/uapi/linux/bpf.h | 1776 +++--

[PATCH bpf-next v4 05/10] bpf: add documentation for eBPF helpers (33-41)

2018-04-25 Thread Quentin Monnet
tate that the helper is not restricted to programs attached to sockets. - bpf_skb_adjust_room(): Clarify comment about invalidated verifier checks. - bpf_xdp_adjust_meta(): Clarify comment about invalidated verifier checks. Cc: Daniel Borkmann <dan...@iogearbox.net> Signed-off-by: Q

[PATCH bpf-next v4 09/10] bpf: add documentation for eBPF helpers (65-66)

2018-04-25 Thread Quentin Monnet
versions). Cc: Nikita V. Shirokov <tehn...@tehnerd.com> Cc: Eyal Birger <eyal.bir...@gmail.com> Signed-off-by: Quentin Monnet <quentin.mon...@netronome.com> --- include/uapi/linux/bpf.h | 30 ++ 1 file changed, 30 insertions(+) diff --git a/include/

[PATCH bpf-next v4 06/10] bpf: add documentation for eBPF helpers (42-50)

2018-04-25 Thread Quentin Monnet
Martin KaFai Lau <ka...@fb.com> Cc: Sargun Dhillon <sar...@sargun.me> Cc: Thomas Graf <tg...@suug.ch> Cc: Gianluca Borello <g.bore...@gmail.com> Cc: Chenbo Feng <fe...@google.com> Signed-off-by: Quentin Monnet <quentin.mon...@netronome.com> Acked-by: Alexei Star

[PATCH bpf-next v4 08/10] bpf: add documentation for eBPF helpers (58-64)

2018-04-25 Thread Quentin Monnet
r Dangaard Brouer <bro...@redhat.com> Cc: John Fastabend <john.fastab...@gmail.com> Signed-off-by: Quentin Monnet <quentin.mon...@netronome.com> --- include/uapi/linux/bpf.h | 147 +++ 1 file changed, 147 insertions(+) diff --git a

[PATCH bpf-next v4 04/10] bpf: add documentation for eBPF helpers (23-32)

2018-04-25 Thread Quentin Monnet
g a task in net_cls controller disables cgroup-bpf. - bpf_get_route_realm(): State that CONFIG_CGROUP_NET_CLASSID is required to use this helper. - bpf_skb_load_bytes(): Fix comment on current use cases for the helper. Cc: Daniel Borkmann <dan...@iogearbox.net> Signed-off-by: Quentin Monnet

  1   2   >