[PATCH bpf-next] selftests/bpf: fix compilation error for flow_dissector.c

2019-05-29 Thread Alan Maguire
sts/flow_dissector.c:150:49: error: ‘IFF_NAPI_FRAGS’ undeclared Adding include/uapi/linux/if_tun.h to tools/include/uapi/linux resolves the problem and ensures the compilation of the file does not depend on having up-to-date kernel headers locally. Signed-off-by: Alan Maguire --- tools/include

[RFC PATCH bpf-next] selftests/bpf: measure RTT from xdp using xdping

2019-05-29 Thread Alan Maguire
in native mode for ixgbe as both client and server works fine. Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/.gitignore | 1 + tools/testing/selftests/bpf/Makefile| 5 +- tools/testing/selftests/bpf/progs/xdping_kern.c | 184 ++ too

[PATCH bpf-next v2] selftests/bpf: measure RTT from xdp using xdping

2019-05-29 Thread Alan Maguire
to lack of shared code (Song Liu) - added checks to ensure that SKB and native mode are not requested together (Song Liu) Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/.gitignore | 1 + tools/testing/selftests/bpf/Makefile| 5 +- tools/testing/sel

[PATCH bpf-next v3] selftests/bpf: measure RTT from xdp using xdping

2019-05-30 Thread Alan Maguire
and server programs due to lack of shared code (Song Liu) - added checks to ensure that SKB and native mode are not requested together (Song Liu) Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/.gitignore | 1 + tools/testing/selftests/bpf/Makefile| 5

[PATCH bpf-next v4] selftests/bpf: measure RTT from xdp using xdping

2019-05-31 Thread Alan Maguire
hecks into icmp_check() function called by client and server programs and reworked client and server programs due to lack of shared code (Song Liu) - added checks to ensure that SKB and native mode are not requested together (Song Liu) Signed-off-by: Alan Maguire --- tools/testing/sel

support for popping multiple MPLS labels with iproute2?

2019-05-31 Thread Alan Maguire
I was wondering if there is a way to pop multiple MPLS labels at once for local delivery using iproute2? Adding multiple labels for encapsulation is supported via label1/label2/... syntax, but I can't find a way to do the same for popping multiple labels for local delivery. For example if I run

[PATCH bpf-next v5] selftests/bpf: measure RTT from xdp using xdping

2019-05-31 Thread Alan Maguire
Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/.gitignore | 1 + tools/testing/selftests/bpf/Makefile| 5 +- tools/testing/selftests/bpf/progs/xdping_kern.c | 184 + tools/testing/selftests/bpf/test_xdping.sh | 99 + tools/testing

Re: support for popping multiple MPLS labels with iproute2?

2019-06-04 Thread Alan Maguire
On Fri, 31 May 2019, David Ahern wrote: > On 5/31/19 6:24 AM, Alan Maguire wrote: > > I was wondering if there is a way to pop multiple MPLS labels at > > once for local delivery using iproute2? > > > > Adding multiple labels for encapsulation is supported via > >

Re: [RFC PATCH bpf-next 1/2] bpf: share BTF "show" implementation between kernel and libbpf

2021-01-14 Thread Alan Maguire
On Mon, 11 Jan 2021, Andrii Nakryiko wrote: > On Mon, Jan 11, 2021 at 9:34 AM Alan Maguire wrote: > > Currently the only "show" function for userspace is to write the > > representation of the typed data to a string via > > > > LIBBPF_API int > > btf__s

[PATCH v2 bpf-next 0/4] libbpf: BTF dumper support for typed data

2021-01-17 Thread Alan Maguire
ound in it should be fixed there or vice versa; mirroring the tests should help with this also (Andrii) [1] https://lore.kernel.org/bpf/1610386373-24162-1-git-send-email-alan.magu...@oracle.com/T/#t Alan Maguire (4): libbpf: add btf_has_size() and btf_int() inlines libbpf: make skip_mods_an

[PATCH v2 bpf-next 2/4] libbpf: make skip_mods_and_typedefs available internally in libbpf

2021-01-17 Thread Alan Maguire
btf_dump.c will need it for type-based data display. Signed-off-by: Alan Maguire --- tools/lib/bpf/libbpf.c | 4 +--- tools/lib/bpf/libbpf_internal.h | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 2abbc38

[PATCH v2 bpf-next 4/4] selftests/bpf: add dump type data tests to btf dump tests

2021-01-17 Thread Alan Maguire
Test various type data dumping operations by comparing expected format with the dumped string; an snprintf-style printf function is used to record the string dumped. Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/prog_tests/btf_dump.c | 233 ++ 1 file changed

[PATCH v2 bpf-next 3/4] libbpf: BTF dumper support for typed data

2021-01-17 Thread Alan Maguire
6744073709551615, }, }, ... Signed-off-by: Alan Maguire --- tools/lib/bpf/btf.h | 17 + tools/lib/bpf/btf_dump.c | 974 +++ tools/lib/bpf/libbpf.map | 5 + 3 files changed, 996 insertions(+) diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/b

[PATCH v2 bpf-next 1/4] libbpf: add btf_has_size() and btf_int() inlines

2021-01-17 Thread Alan Maguire
BTF type data dumping will use them in later patches, and they are useful generally when handling BTF data. Signed-off-by: Alan Maguire --- tools/lib/bpf/btf.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h index 1237bcd

Re: [PATCH v2 bpf-next 3/4] libbpf: BTF dumper support for typed data

2021-01-22 Thread Alan Maguire
On Thu, 21 Jan 2021, Andrii Nakryiko wrote: > On Wed, Jan 20, 2021 at 10:56 PM Andrii Nakryiko > wrote: > > > > On Sun, Jan 17, 2021 at 2:22 PM Alan Maguire > > wrote: > > > > > > Add a BTF dumper for typed data, so that the user can dump

Re: one prog multi fentry. Was: [PATCH bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-16 Thread Alan Maguire
On Tue, 15 Dec 2020, Alexei Starovoitov wrote: > On Wed, Dec 09, 2020 at 11:21:43PM +0000, Alan Maguire wrote: > > Right, that's exactly it. A pair of generic tracing BPF programs are > > used, and they attach to kprobe/kretprobes, and when they run they > > use

Re: one prog multi fentry. Was: [PATCH bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-17 Thread Alan Maguire
On Wed, 16 Dec 2020, Alexei Starovoitov wrote: > > > $ ksnoop "ip_send_skb(skb->sk)" > > > > > > ...will trace the skb->sk value. The user-space side of the program > > > matches the function/arg name and looks up the referenced type, setting it > > > in the function's map. For field referenc

[PATCH v2 bpf-next 0/3] bpf: support module BTF in BTF display helpers

2020-12-04 Thread Alan Maguire
likely be supported directly in the BPF program via __builtin_btf_type_id(); but I need to determine a good test to determine if that builtin supports object ids. Changes since RFC - add patch to remove module mutex - modify to use obj_id instead of module name as identifier in "struct btf_ptr&

[PATCH v2 bpf-next 2/3] bpf: add module support to btf display helpers

2020-12-04 Thread Alan Maguire
the object id specifies the module the type is in, or if no such id is found in the module list, we fall back to vmlinux. Signed-off-by: Alan Maguire --- include/linux/btf.h| 12 include/uapi/linux/bpf.h | 13 +++-- kernel/bpf/btf.c

[PATCH v2 bpf-next 3/3] selftests/bpf: verify module-specific types can be shown via bpf_snprintf_btf

2020-12-04 Thread Alan Maguire
t net_device". Currently the tests take the messy approach of determining object and type ids for the relevant module/function; __builtin_btf_type_id() supports object ids by returning a 64-bit value, but need to find a good way to determine if that support is present. Signed-off-by: Alan M

[PATCH v2 bpf-next 1/3] bpf: eliminate btf_module_mutex as RCU synchronization can be used

2020-12-04 Thread Alan Maguire
auditing example in Documentation/RCU/listRCU.rst ; and as such we can eliminate the lock and use list_del_rcu()/call_rcu() on module removal, and list_add_rcu() for module addition. Signed-off-by: Alan Maguire --- kernel/bpf/btf.c | 31 +-- 1 file changed, 17 insertions

Re: [PATCH bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-05 Thread Alan Maguire
t; selftests. Manual testing was performed with debug log messages sprinkled > across selftests and libbpf, confirming expected values are substituted. > Better testing will be performed as part of the work adding module BTF types > support to bpf_snprintf_btf() helpers. > > Cc: Al

Re: [PATCH v2 bpf-next 0/3] bpf: support module BTF in BTF display helpers

2020-12-05 Thread Alan Maguire
On Sat, 5 Dec 2020, Yonghong Song wrote: > > > __builtin_btf_type_id() is really only supported in llvm12 > and 64bit return value support is pushed to llvm12 trunk > a while back. The builtin is introduced in llvm11 but has a > corner bug, so llvm12 is recommended. So if people use the builti

Re: [PATCH bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-07 Thread Alan Maguire
t; selftests. Manual testing was performed with debug log messages sprinkled > across selftests and libbpf, confirming expected values are substituted. > Better testing will be performed as part of the work adding module BTF types > support to bpf_snprintf_btf() helpers. > > Cc: Al

Re: [PATCH bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-08 Thread Alan Maguire
On Mon, 7 Dec 2020, Andrii Nakryiko wrote: > On Sat, Dec 5, 2020 at 4:38 PM Alan Maguire wrote: > > Thanks so much for doing this Andrii! When I tested, I ran into a problem; > > it turns out when a module struct such as "veth_stats" is used, it's > > classif

Re: [PATCH bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-08 Thread Alan Maguire
On Mon, 7 Dec 2020, Andrii Nakryiko wrote: > On Mon, Dec 7, 2020 at 7:12 PM Alexei Starovoitov > wrote: > > > > On Mon, Dec 07, 2020 at 04:38:16PM +, Alan Maguire wrote: > > > Sorry about this Andrii, but I'm a bit stuck here. > > > > > > I&

Re: [PATCH v2 bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-09 Thread Alan Maguire
->v2: > - fix crash on failing to resolve target spec (Alan). > > Cc: Alan Maguire > Signed-off-by: Andrii Nakryiko Thanks for this! Can confirm the segmentation fault has gone away. I tested with the veth_stats_rx program (though will switch to btf_test module later), and

Re: [PATCH bpf-next] libbpf: support module BTF for BPF_TYPE_ID_TARGET CO-RE relocation

2020-12-09 Thread Alan Maguire
On Tue, 8 Dec 2020, Alexei Starovoitov wrote: > On Tue, Dec 08, 2020 at 10:13:35PM +0000, Alan Maguire wrote: > > > > Does this approach prevent more complex run-time specification of BTF > > object fd though? For example, I've been working on a simple tracer >

Re: [PATCH bpf-next 5/5] tools/bpftool: add support for in-kernel and named BTF in `btf show`

2020-11-09 Thread Alan Maguire
to the latest changes etc and BTF generation seemed to work fine for modules during kernel build). For the "bpftool btf show" functionality, feel free to add Tested-by: Alan Maguire Thanks! Alan

[RFC bpf-next 2/3] libbpf: bpf__find_by_name[_kind] should use btf__get_nr_types()

2020-11-13 Thread Alan Maguire
lly for vmlinux + module BTF, where the latter is much smaller. Use btf__get_nr_types() instead. Signed-off-by: Alan Maguire --- tools/lib/bpf/btf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index 2d0d064..0fccf4b 100644 --

[RFC bpf-next 3/3] selftests/bpf: verify module-specific types can be shown via bpf_snprintf_btf

2020-11-13 Thread Alan Maguire
t_device". Signed-off-by: Alan Maguire --- .../selftests/bpf/prog_tests/snprintf_btf_mod.c| 96 ++ tools/testing/selftests/bpf/progs/btf_ptr.h| 1 + tools/testing/selftests/bpf/progs/veth_stats_rx.c | 73 3 files changed, 170 insertions(+) cr

[RFC bpf-next 0/3] bpf: support module BTF in btf display helpers

2020-11-13 Thread Alan Maguire
of a module-specific type id will fail in patch 3. Patch 3 is a selftest that uses veth (when built as a module) and a kprobe to display both a module-specific and kernel-specific type; both are arguments to veth_stats_rx(). Alan Maguire (3): bpf: add module support to btf disp

[RFC bpf-next 1/3] bpf: add module support to btf display helpers

2020-11-13 Thread Alan Maguire
bpf_snprintf_btf and bpf_seq_printf_btf use a "struct btf_ptr *" argument that specifies type information about the type to be displayed. Augment this information to include a module name, allowing such display to support module types. Signed-off-by: Alan Maguire --- include/l

[PATCH bpf-next] libbpf: bpf__find_by_name[_kind] should use btf__get_nr_types()

2020-11-15 Thread Alan Maguire
lly for vmlinux + module BTF, where the latter is much smaller. Use btf__get_nr_types() instead. Fixes: ba451366bf44 ("libbpf: Implement basic split BTF support") Signed-off-by: Alan Maguire --- tools/lib/bpf/btf.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --gi

Re: [RFC bpf-next 1/3] bpf: add module support to btf display helpers

2020-11-15 Thread Alan Maguire
On Sat, 14 Nov 2020, Yonghong Song wrote: > > > On 11/14/20 8:04 AM, Alexei Starovoitov wrote: > > On Fri, Nov 13, 2020 at 10:59 PM Andrii Nakryiko > > wrote: > >> > >> On Fri, Nov 13, 2020 at 10:11 AM Alan Maguire > >> wrote: > >>>

[RFC PATCH bpf-next] ksnoop: kernel argument/return value tracing/display using BTF

2021-01-04 Thread Alan Maguire
edicate, e.g. ksnoop "ip_send_skb(skb->dev == 0, skb)" ...as this will be evaluated before the skb is stringified, and we potentially avoid that operation if the predicate fails. The same is _not_ true however in the stash case; for ksnoop "ip_send_skb(skb, return!=0)"

Re: [RFC PATCH bpf-next] ksnoop: kernel argument/return value tracing/display using BTF

2021-01-05 Thread Alan Maguire
On Tue, 5 Jan 2021, Cong Wang wrote: > On Mon, Jan 4, 2021 at 7:29 AM Alan Maguire wrote: > > > > BPF Type Format (BTF) provides a description of kernel data structures > > and of the types kernel functions utilize as arguments and return values. > > >

[PATCH bpf] bpftool: fix compilation failure for net.o with older glibc

2021-01-06 Thread Alan Maguire
needed for compilation anyhow. [1] https://lore.kernel.org/netdev/1461512707-23058-1-git-send-email-mikko.rapeli__34748.27880641$1462831734$gmane$o...@iki.fi/ Fixes: f6f3bac08ff9 ("tools/bpf: bpftool: add net support") Signed-off-by: Alan Maguire --- tools/bpf/bpftool/net.c | 1

[RFC PATCH bpf-next 0/2] bpf, libbpf: share BTF data show functionality

2021-01-11 Thread Alan Maguire
format. The test closely mirrors the BPF program associated with the snprintf_btf.c; in this case however the string representations are verified in userspace rather than in BPF program context. Alan Maguire (2): bpf: share BTF "show" implementation between kernel and libbpf selftests

[RFC PATCH bpf-next 2/2] selftests/bpf: test libbpf-based type display

2021-01-11 Thread Alan Maguire
Test btf__snprintf with various base/kernel types and ensure display is as expected; tests are identical to those in snprintf_btf test save for the fact these run in userspace rather than BPF program context. Signed-off-by: Alan Maguire --- .../selftests/bpf/prog_tests/snprintf_btf_user.c

[RFC PATCH bpf-next 1/2] bpf: share BTF "show" implementation between kernel and libbpf

2021-01-11 Thread Alan Maguire
d\n", skb_id); else btf__snprintf(btf, buf, sizeof(buf), skb_id, skb, 0); Suggested-by: Alexei Starovoitov Signed-off-by: Alan Maguire --- include/linux/btf.h | 121 +--- include/linux/btf_common.h | 286 + kernel/bpf/Makefile |2 +

Re: [PATCH bpf-next 00/11] libbpf: split BTF support

2020-10-30 Thread Alan Maguire
On Thu, 29 Oct 2020, Andrii Nakryiko wrote: > On Thu, Oct 29, 2020 at 5:33 PM Song Liu wrote: > > > > > > > > > On Oct 28, 2020, at 5:58 PM, Andrii Nakryiko wrote: > > > > > > This patch set adds support for generating and deduplicating split BTF. > > > This > > > is an enhancement to the BTF,

Re: [RFC PATCH bpf-next 2/4] bpf: make BTF show support generic, apply to seq files/bpf_trace_printk

2020-08-14 Thread Alan Maguire
On Wed, 12 Aug 2020, Alexei Starovoitov wrote: > On Thu, Aug 06, 2020 at 03:42:23PM +0100, Alan Maguire wrote: > > > > The bpf_trace_printk tracepoint is augmented with a "trace_id" > > field; it is used to allow tracepoint filtering as typed display > > i

Re: [RFC PATCH bpf-next 2/4] bpf: make BTF show support generic, apply to seq files/bpf_trace_printk

2020-08-18 Thread Alan Maguire
On Fri, 14 Aug 2020, Alexei Starovoitov wrote: > On Fri, Aug 14, 2020 at 02:06:37PM +0100, Alan Maguire wrote: > > On Wed, 12 Aug 2020, Alexei Starovoitov wrote: > > > > > On Thu, Aug 06, 2020 at 03:42:23PM +0100, Alan Maguire wrote: > > > > > &

Re: [PATCH bpf-next] libbpf: add perf_buffer APIs for better integration with outside epoll loop

2020-08-21 Thread Alan Maguire
am I missing something? > Also exercise and check new APIs in perf_buffer selftest. > > Signed-off-by: Andrii Nakryiko A few question around the test below, but Reviewed-by: Alan Maguire > --- > tools/lib/bpf/libbpf.c| 51 ++- >

[PATCH net] iptunnel: NULL pointer deref for ip_md_tunnel_xmit

2019-03-06 Thread Alan Maguire
Fixes: c8b34e680a09 ("ip_tunnel: Add tnl_update_pmtu in ip_md_tunnel_xmit") Reported-by: Naresh Kamboju Signed-off-by: Alan Maguire Acked-by: Alexei Starovoitov Tested-by: Anders Roxell --- net/ipv4/ip_tunnel.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/ip

Re: [PATCH bpf-next 09/13] bpf: add bpf_skb_adjust_room encap flags

2019-03-20 Thread Alan Maguire
d fail becuase GRO reassembly set the transport header, and as shrinkage was limited to ensure we still had an IPv4/IPv6 header's worth of space between the network and transport headers, the operation would fail. I think that problem is fixed here, is that right? Reviewed-by: Alan Maguire Thank

Re: [PATCH bpf-next 08/13] bpf: add bpf_skb_adjust_room flag BPF_F_ADJ_ROOM_FIXED_GSO

2019-03-21 Thread Alan Maguire
0) minor nit - could we add this flag to the documentation for bpf_skb_adjust_room? Same suggestion for the encap flags in patch 8 too. Thanks! Reviewed-by: Alan Maguire > +#define BPF_F_ADJ_ROOM_MASK (BPF_F_ADJ_ROOM_FIXED_GSO) > + > /* Mode for BPF_FUNC_skb_adjust_room helper. *

[PATCH bpf-next] bpf: test_tc_tunnel.sh needs reverse path filtering disabled

2019-03-25 Thread Alan Maguire
("selftests/bpf: bpf tunnel encap test") Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/test_tc_tunnel.sh | 8 1 file changed, 8 insertions(+) diff --git a/tools/testing/selftests/bpf/test_tc_tunnel.sh b/tools/testing/selftests/bpf/test_tc_tunnel.sh index dcf3206..c805

MPLS encapsulation and arp table overflow

2019-05-01 Thread Alan Maguire
I'm seeing the following repeated error [ 130.821362] neighbour: arp_cache: neighbor table overflow! when using MPLSoverGRE or MPLSoverUDP tunnels on bits synced with bpf-next as of this morning. The test script below reliably reproduces the problem, while working fine on a 4.14 (I haven't bisec

Re: [PATCH net] neighbor: Reset gc_entries counter if new entry is released before insert

2019-05-02 Thread Alan Maguire
> this case the cleanup path needs to drop the gc_entries counter. There > is no memory leak, only a counter leak. > > Fixes: 58956317c8d ("neighbor: Improve garbage collection") > Reported-by: Ian Kumlien > Reported-by: Alan Maguire > Signed-off-by: David Ahern

Re: [PATCH net] neighbor: Call __ipv4_neigh_lookup_noref in neigh_xmit

2019-05-02 Thread Alan Maguire
ntable show | head -10 | grep alloc > > which increase for each packet showing the unnecessary overhread. > > Fix by having neigh_xmit use __ipv4_neigh_lookup_noref for NEIGH_ARP_TABLE. > > Fixes: cd9ff4de0107 ("ipv4: Make neigh lookup keys for > loopback/point-to-p

Re: MPLS encapsulation and arp table overflow

2019-05-02 Thread Alan Maguire
On Wed, 1 May 2019, David Ahern wrote: > On 5/1/19 10:03 AM, Alan Maguire wrote: > > I'm seeing the following repeated error > > > > [ 130.821362] neighbour: arp_cache: neighbor table overflow! > > > > when using MPLSoverGRE or MPLSoverUDP tunnels on bi

Re: [PATCH bpf-next 05/10] bpf: implement accurate raw_tp context access via BTF

2019-10-07 Thread Alan Maguire
On Fri, 4 Oct 2019, Alexei Starovoitov wrote: > libbpf analyzes bpf C program, searches in-kernel BTF for given type name > and stores it into expected_attach_type. > The kernel verifier expects this btf_id to point to something like: > typedef void (*btf_trace_kfree_skb)(void *, struct sk_buff *s

Re: [PATCH bpf-next] selftests/bpf: fix dependency ordering for attach_probe test

2019-10-07 Thread Alan Maguire
}() APIs") > Signed-off-by: Andrii Nakryiko Reviewed-by: Alan Maguire > --- > tools/testing/selftests/bpf/Makefile | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/bpf/Makefile > b/tools/testing/selftests/bpf/Makefile > ind

[PATCH bpf-next 0/4] L2 encap support for bpf_skb_adjust_room

2019-04-01 Thread Alan Maguire
Patch #4 extends the tests again to support MPLSoverGRE and MPLSoverUDP encap, along with existing test coverage. Alan Maguire (4): selftests_bpf: extend test_tc_tunnel for UDP encap bpf: add layer 2 encap support to bpf_skb_adjust_room bpf: sync bpf.h to tools/ for BPF_F_ADJ_ROOM_ENCAP_L2 sel

[PATCH bpf-next 1/4] selftests_bpf: extend test_tc_tunnel for UDP encap

2019-04-01 Thread Alan Maguire
ned-off-by: Alan Maguire --- tools/testing/selftests/bpf/progs/test_tc_tunnel.c | 149 ++--- tools/testing/selftests/bpf/test_tc_tunnel.sh | 72 +++--- 2 files changed, 157 insertions(+), 64 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/test_tc_tunnel.

[PATCH bpf-next 3/4] bpf: sync bpf.h to tools/ for BPF_F_ADJ_ROOM_ENCAP_L2

2019-04-01 Thread Alan Maguire
Sync include/uapi/linux/bpf.h with tools/ equivalent to add BPF_F_ADJ_ROOM_ENCAP_L2(len) macro. Signed-off-by: Alan Maguire --- tools/include/uapi/linux/bpf.h | 5 + 1 file changed, 5 insertions(+) diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 8370245

[PATCH bpf-next 2/4] bpf: add layer 2 encap support to bpf_skb_adjust_room

2019-04-01 Thread Alan Maguire
CAP_L4_UDP | BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 | BPF_F_ADJ_ROOM_ENCAP_L2(inner_maclen)); Signed-off-by: Alan Maguire --- include/uapi/linux/bpf.h | 5 + net/core/filter.c| 19 ++- 2 files changed, 19 insertions(+), 5 deletions(-) di

[PATCH bpf-next 4/4] selftests_bpf: extend test_tc_tunnel.sh test for L2 encap

2019-04-01 Thread Alan Maguire
Update test_tc_tunnel to verify adding inner L2 header encapsulation (an MPLS label) works. Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/progs/test_tc_tunnel.c | 172 + tools/testing/selftests/bpf/test_tc_tunnel.sh | 59 +++ 2 files changed, 170

[PATCH v2 bpf-next 0/4] L2 encap support for bpf_skb_adjust_room

2019-04-08 Thread Alan Maguire
added support for ethernet L2 encap to tests; testing against gre[6]tap tunnels (patch 4). Alan Maguire (4): selftests_bpf: add UDP encap to test_tc_tunnel bpf: add layer 2 encap support to bpf_skb_adjust_room bpf: sync bpf.h to tools/ for BPF_F_ADJ_ROOM_ENCAP_L2 selftests_bpf: add L2 enc

[PATCH v2 bpf-next 1/4] selftests_bpf: add UDP encap to test_tc_tunnel

2019-04-08 Thread Alan Maguire
commit 868d523535c2 ("bpf: add bpf_skb_adjust_room encap flags") introduced support to bpf_skb_adjust_room for GSO-friendly GRE and UDP encapsulation and later introduced associated test_tc_tunnel tests. Here those tests are extended to cover UDP encapsulation also. Signed-off-by: Al

[PATCH v2 bpf-next 2/4] bpf: add layer 2 encap support to bpf_skb_adjust_room

2019-04-08 Thread Alan Maguire
CAP_L4_UDP | BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 | BPF_F_ADJ_ROOM_ENCAP_L2(inner_maclen)); Signed-off-by: Alan Maguire --- include/uapi/linux/bpf.h | 10 ++ net/core/filter.c| 15 ++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/include/

[PATCH v2 bpf-next 4/4] selftests_bpf: add L2 encap to test_tc_tunnel

2019-04-08 Thread Alan Maguire
Update test_tc_tunnel to verify adding inner L2 header encapsulation (an MPLS label or ethernet header) works. Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/progs/test_tc_tunnel.c | 232 ++--- tools/testing/selftests/bpf/test_tc_tunnel.sh | 121 +++ 2

[PATCH v2 bpf-next 3/4] bpf: sync bpf.h to tools/ for BPF_F_ADJ_ROOM_ENCAP_L2

2019-04-08 Thread Alan Maguire
Sync include/uapi/linux/bpf.h with tools/ equivalent to add BPF_F_ADJ_ROOM_ENCAP_L2(len) macro. Signed-off-by: Alan Maguire --- tools/include/uapi/linux/bpf.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index

[PATCH v3 bpf-next 4/4] selftests_bpf: add L2 encap to test_tc_tunnel

2019-04-09 Thread Alan Maguire
Update test_tc_tunnel to verify adding inner L2 header encapsulation (an MPLS label or ethernet header) works. Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/config | 4 + tools/testing/selftests/bpf/progs/test_tc_tunnel.c | 219 ++--- tools

[PATCH v3 bpf-next 2/4] bpf: add layer 2 encap support to bpf_skb_adjust_room

2019-04-09 Thread Alan Maguire
CAP_L4_UDP | BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 | BPF_F_ADJ_ROOM_ENCAP_L2(inner_maclen)); Signed-off-by: Alan Maguire --- include/uapi/linux/bpf.h | 10 ++ net/core/filter.c| 12 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/

[PATCH v3 bpf-next 1/4] selftests_bpf: extend test_tc_tunnel for UDP encap

2019-04-09 Thread Alan Maguire
commit 868d523535c2 ("bpf: add bpf_skb_adjust_room encap flags") introduced support to bpf_skb_adjust_room for GSO-friendly GRE and UDP encapsulation and later introduced associated test_tc_tunnel tests. Here those tests are extended to cover UDP encapsulation also. Signed-off-by: Al

[PATCH v3 bpf-next 0/4] L2 encap support for bpf_skb_adjust_room

2019-04-09 Thread Alan Maguire
41 -6). 0 checksums work fine (patch 1) - added definitions for mask and shift used in setting L2 length (patch 2) - allow udp encap with fixed GSO (patch 2) - changed "elen" to "l2_len" to be more descriptive (patch 4) Alan Maguire (4): selftests_bpf: extend test_tc_t

[PATCH v3 bpf-next 3/4] bpf: sync bpf.h to tools/ for BPF_F_ADJ_ROOM_ENCAP_L2

2019-04-09 Thread Alan Maguire
Sync include/uapi/linux/bpf.h with tools/ equivalent to add BPF_F_ADJ_ROOM_ENCAP_L2(len) macro. Signed-off-by: Alan Maguire --- tools/include/uapi/linux/bpf.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index

Re: [PATCH bpf-next] selftests/bpf: bring back (void *) cast to set_ipv4_csum in test_tc_tunnel

2019-04-11 Thread Alan Maguire
> > progs/test_tc_tunnel.c:160:17: warning: taking address of packed member > > 'ip' of class or structure > > 'v4hdr' may result in an unaligned pointer value > > [-Waddress-of-packed-member] > > set_ipv4_csum(&h_outer.ip); > &

[PATCH bpf-next] bpf: fix whitespace for ENCAP_L2 defines in bpf.h

2019-04-12 Thread Alan Maguire
replace tab after #define with space in line with rest of definitions Signed-off-by: Alan Maguire --- include/uapi/linux/bpf.h | 6 +++--- tools/include/uapi/linux/bpf.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi

Re: [PATCH bpf-next] selftests/bpf: reserve flags in bpf_skb_net_shrink

2019-04-12 Thread Alan Maguire
) > Signed-off-by: Willem de Bruijn Reviewed-by: Alan Maguire One thought; should we add a line to the growth-only flags in the description of bpf_skb_adjust_room (ENCAP_L[234]) in bpf.h; something like: "This flag is valid for use with positive len_diff values only." ? Don't

Re: [PATCH bpf-next 0/2] update skb->protocol in bpf_skb_net_grow

2019-04-23 Thread Alan Maguire
straightforward logic > Patch 2 tests it with a 6in4 tunnel > > Willem de Bruijn (2): > bpf: update skb->protocol in bpf_skb_net_grow > selftests/bpf: expand test_tc_tunnel with SIT encap > For the series Reviewed-by: Alan Maguire Tested-by: Alan Maguire > net/c

[RFC PATCH bpf-next 1/4] bpf: provide function to get vmlinux BTF information

2020-08-06 Thread Alan Maguire
It will be used later for BPF structure display support Signed-off-by: Alan Maguire --- include/linux/bpf.h | 2 ++ kernel/bpf/verifier.c | 18 -- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index cef4ef0..55eb67d

[RFC PATCH bpf-next 2/4] bpf: make BTF show support generic, apply to seq files/bpf_trace_printk

2020-08-06 Thread Alan Maguire
t; field; it is used to allow tracepoint filtering as typed display information can easily be interspersed with other tracing data, making it hard to read. Specifying a trace_id will allow users to selectively trace data, eliminating noise. Signed-off-by: Alan Maguire --- include/linux/bpf.h

[RFC PATCH bpf-next 0/4] bpf: add bpf-based bpf_trace_printk()-like support

2020-08-06 Thread Alan Maguire
on of the target dummy value which is either all zeros or all 0xff values; the idea is this exercises the "skip if zero" and "print everything" cases. - added support in BPF for using the %pT format specifier in bpf_trace_printk() - added BPF tests which ensure %pT format spe

[RFC PATCH bpf-next 3/4] bpf: add bpf_trace_btf helper

2020-08-06 Thread Alan Maguire
/union members; they are not displayed by default Signed-off-by: Alan Maguire --- include/linux/bpf.h| 1 + include/linux/btf.h| 9 ++-- include/uapi/linux/bpf.h | 63 + kernel/bpf/core.c | 5 ++ kernel

[RFC PATCH bpf-next 4/4] selftests/bpf: add bpf_trace_btf helper tests

2020-08-06 Thread Alan Maguire
Basic tests verifying various flag combinations for bpf_trace_btf() using a tp_btf program to trace skb data. Signed-off-by: Alan Maguire --- tools/testing/selftests/bpf/prog_tests/trace_btf.c | 45 ++ .../selftests/bpf/progs/netif_receive_skb.c| 43

[PATCH bpf] bpf: doc: remove references to warning message when using bpf_trace_printk()

2020-08-07 Thread Alan Maguire
ad of trace_printk()") Signed-off-by: Alan Maguire --- Documentation/bpf/bpf_design_QA.rst | 11 --- 1 file changed, 11 deletions(-) diff --git a/Documentation/bpf/bpf_design_QA.rst b/Documentation/bpf/bpf_design_QA.rst index 12a246f..2df7b06 100644 --- a/Documentation/bpf/bpf_design_QA

[PATCH v2 bpf-next 0/2] bpf: fix use of trace_printk() in BPF

2020-07-10 Thread Alan Maguire
, patch 1) - use "tp/raw_syscalls/sys_enter" and a usleep(1) to trigger events in the selftest ensuring test runs faster (Andrii, patch 2) [1] https://lore.kernel.org/r/20200628194334.6238b...@oasis.local.home Alan Maguire (2): bpf: use dedicated bpf_trace_printk event instead of tr

[PATCH v2 bpf-next 2/2] selftests/bpf: add selftests verifying bpf_trace_printk() behaviour

2020-07-10 Thread Alan Maguire
Simple selftests that verifies bpf_trace_printk() returns a sensible value and tracing messages appear. Signed-off-by: Alan Maguire --- .../selftests/bpf/prog_tests/trace_printk.c| 74 ++ tools/testing/selftests/bpf/progs/trace_printk.c | 21 ++ 2 files changed

[PATCH v2 bpf-next 1/2] bpf: use dedicated bpf_trace_printk event instead of trace_printk()

2020-07-10 Thread Alan Maguire
https://lore.kernel.org/r/20200628194334.6238b...@oasis.local.home Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Alan Maguire --- kernel/trace/Makefile| 2 ++ kernel/trace/bpf_trace.c | 41 - kernel/trace/bpf_trace.h

[PATCH v3 bpf-next 2/2] selftests/bpf: add selftests verifying bpf_trace_printk() behaviour

2020-07-13 Thread Alan Maguire
Simple selftests that verifies bpf_trace_printk() returns a sensible value and tracing messages appear. Signed-off-by: Alan Maguire Acked-by: Andrii Nakryiko --- .../selftests/bpf/prog_tests/trace_printk.c| 75 ++ tools/testing/selftests/bpf/progs/trace_printk.c

[PATCH v3 bpf-next 0/2] bpf: fix use of trace_printk() in BPF

2020-07-13 Thread Alan Maguire
l not prevent tracing output from being logged (Steven, patch 1) - use "tp/raw_syscalls/sys_enter" and a usleep(1) to trigger events in the selftest ensuring test runs faster (Andrii, patch 2) [1] https://lore.kernel.org/r/20200628194334.6238b...@oasis.local.home Alan Maguire (2): bpf

[PATCH v3 bpf-next 1/2] bpf: use dedicated bpf_trace_printk event instead of trace_printk()

2020-07-13 Thread Alan Maguire
https://lore.kernel.org/r/20200628194334.6238b...@oasis.local.home Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Alan Maguire Acked-by: Andrii Nakryiko --- kernel/trace/Makefile| 2 ++ kernel/trace/bpf_trace.c | 42 +- kernel/trace/bpf_trace.h

[PATCH v5 bpf-next 1/6] bpf: provide function to get vmlinux BTF information

2020-09-18 Thread Alan Maguire
It will be used later for BPF structure display support Signed-off-by: Alan Maguire --- include/linux/bpf.h | 2 ++ kernel/bpf/verifier.c | 18 -- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index c6d9f2c..c0ad5d8

[PATCH v5 bpf-next 3/6] bpf: add bpf_btf_snprintf helper

2020-09-18 Thread Alan Maguire
/union members; they are not displayed by default Signed-off-by: Alan Maguire --- include/linux/bpf.h| 1 + include/linux/btf.h| 9 +++-- include/uapi/linux/bpf.h | 68 kernel/bpf/helpers.c | 4 ++ kernel/tra

[PATCH v5 bpf-next 0/6] bpf: add helpers to support BTF-based kernel data display

2020-09-18 Thread Alan Maguire
- added support in BPF for using the %pT format specifier in bpf_trace_printk() - added BPF tests which ensure %pT format specifier use works (Alexei). Alan Maguire (6): bpf: provide function to get vmlinux BTF information bpf: move to generic BTF show support, apply it to seq files/string

[PATCH v5 bpf-next 5/6] bpf: add bpf_seq_btf_write helper

2020-09-18 Thread Alan Maguire
bpf_btf_snprintf helper, and the helper returns 0 on success or a negative error value. Suggested-by: Alexei Starovoitov Signed-off-by: Alan Maguire --- include/linux/btf.h| 3 ++ include/uapi/linux/bpf.h | 10 ++ kernel/bpf/btf.c | 17 +++--- kernel/trace

[PATCH v5 bpf-next 6/6] selftests/bpf: add test for bpf_seq_btf_write helper

2020-09-18 Thread Alan Maguire
off-by: Alan Maguire --- tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 66 ++ .../selftests/bpf/progs/bpf_iter_task_btf.c| 49 2 files changed, 115 insertions(+) create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_task_btf.c diff --gi

[PATCH v5 bpf-next 4/6] selftests/bpf: add bpf_btf_snprintf helper tests

2020-09-18 Thread Alan Maguire
Tests verifying snprintf()ing of various data structures, flags combinations using a tp_btf program. Signed-off-by: Alan Maguire --- .../selftests/bpf/prog_tests/btf_snprintf.c| 55 + .../selftests/bpf/progs/netif_receive_skb.c| 260 + 2 files changed

[PATCH v5 bpf-next 2/6] bpf: move to generic BTF show support, apply it to seq files/strings

2020-09-18 Thread Alan Maguire
te pointer values. BTF_SHOW_UNSAFE - do not copy data to safe buffer before display. BTF_SHOW_ZERO - show zeroed values (by default they are not shown). Signed-off-by: Alan Maguire --- include/linux/btf.h | 36 ++ kernel/bpf/btf.c| 971 ++-

[PATCH v6 bpf-next 3/6] bpf: add bpf_snprintf_btf helper

2020-09-23 Thread Alan Maguire
/union members; they are not displayed by default Signed-off-by: Alan Maguire --- include/linux/bpf.h| 1 + include/linux/btf.h| 9 ++-- include/uapi/linux/bpf.h | 68 +++ kernel/bpf/core.c | 1 + kernel/bpf/helpers.c

[PATCH v6 bpf-next 4/6] selftests/bpf: add bpf_snprintf_btf helper tests

2020-09-23 Thread Alan Maguire
Tests verifying snprintf()ing of various data structures, flags combinations using a tp_btf program. Signed-off-by: Alan Maguire --- .../selftests/bpf/prog_tests/snprintf_btf.c| 54 + .../selftests/bpf/progs/netif_receive_skb.c| 260 + 2 files changed

[PATCH v6 bpf-next 0/6] bpf: add helpers to support BTF-based kernel data display

2020-09-23 Thread Alan Maguire
sing the %pT format specifier in bpf_trace_printk() - added BPF tests which ensure %pT format specifier use works (Alexei). Alan Maguire (6): bpf: provide function to get vmlinux BTF information bpf: move to generic BTF show support, apply it to seq files/strings bpf: add bpf_snprintf_btf h

[PATCH v6 bpf-next 2/6] bpf: move to generic BTF show support, apply it to seq files/strings

2020-09-23 Thread Alan Maguire
te pointer values. BTF_SHOW_UNSAFE - do not copy data to safe buffer before display. BTF_SHOW_ZERO - show zeroed values (by default they are not shown). Signed-off-by: Alan Maguire --- include/linux/btf.h | 36 ++ kernel/bpf/btf.c| 980 ++-

[PATCH v6 bpf-next 1/6] bpf: provide function to get vmlinux BTF information

2020-09-23 Thread Alan Maguire
It will be used later for BPF structure display support Signed-off-by: Alan Maguire --- include/linux/bpf.h | 2 ++ kernel/bpf/verifier.c | 18 -- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index fc5c901..049e50f

[PATCH v6 bpf-next 5/6] bpf: add bpf_seq_printf_btf helper

2020-09-23 Thread Alan Maguire
bpf_snprintf_btf helper, and the helper returns 0 on success or a negative error value. Suggested-by: Alexei Starovoitov Signed-off-by: Alan Maguire --- include/linux/btf.h| 2 ++ include/uapi/linux/bpf.h | 10 ++ kernel/bpf/btf.c | 4 ++-- kernel/bpf/core.c

[PATCH v6 bpf-next 6/6] selftests/bpf: add test for bpf_seq_printf_btf helper

2020-09-23 Thread Alan Maguire
off-by: Alan Maguire --- tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 66 ++ .../selftests/bpf/progs/bpf_iter_task_btf.c| 49 2 files changed, 115 insertions(+) create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_task_btf.c diff --gi

  1   2   >