Re: [PATCH net-next] bpf: samples: Fix compile of test_lru_dist.c

2016-11-28 Thread Martin Lau
On Mon, Nov 28, 2016 at 10:17:23AM +0100, Daniel Borkmann wrote: > On 11/28/2016 05:32 AM, David Ahern wrote: > >Build of samples/bpf on debian/jessie fails with: > > > > HOSTCC /home/dsa/kernel-3.git/samples/bpf/test_lru_dist.o > >/home/dsa/kernel-3.git/samples/bpf/test_lru_dist.c: In

Re: [PATCH bpf-next 05/13] bpf: get better bpf_prog ksyms based on btf func type_id

2018-10-15 Thread Martin Lau
On Fri, Oct 12, 2018 at 11:54:42AM -0700, Yonghong Song wrote: > This patch added interface to load a program with the following > additional information: >. prog_btf_fd >. func_info and func_info_len > where func_info will provides function range and type_id > corresponding to each

Re: [PATCH bpf-next 05/13] bpf: get better bpf_prog ksyms based on btf func type_id

2018-10-17 Thread Martin Lau
On Tue, Oct 16, 2018 at 05:32:13PM -0700, Yonghong Song wrote: > > > On 10/15/18 4:12 PM, Martin Lau wrote: > > On Fri, Oct 12, 2018 at 11:54:42AM -0700, Yonghong Song wrote: > >> This patch added interface to load a program with the following > >> additional in

Re: [PATCH bpf-next v2 02/13] bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO

2018-10-17 Thread Martin Lau
On Wed, Oct 17, 2018 at 10:25:21AM -0700, Yonghong Song wrote: > > > On 10/17/18 9:13 AM, Edward Cree wrote: > > On 17/10/18 08:23, Yonghong Song wrote: > >> This patch adds BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO > >> support to the type section. BTF_KIND_FUNC_PROTO is used > >> to specify the

Re: [PATCH bpf-next v2 02/13] bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO

2018-10-18 Thread Martin Lau
On Thu, Oct 18, 2018 at 08:41:52PM +0100, Edward Cree wrote: > On 18/10/18 19:12, Martin Lau wrote: > > The BTF verification and bpf_prog_load() has to treat > > them differently. > > > > Are you suggesting they can be treated the same for > >

Re: [PATCH bpf-next v2 02/13] bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO

2018-10-18 Thread Martin Lau
On Thu, Oct 18, 2018 at 05:47:11PM +0100, Edward Cree wrote: > On 17/10/18 18:50, Martin Lau wrote: > > On Wed, Oct 17, 2018 at 10:25:21AM -0700, Yonghong Song wrote: > >> What you stated is true, BTF_KIND_FUNC_PROTO corresponds to > >> dwarf subroutine tag which has

Re: [PATCH bpf-next] bpf: Extend the sk_lookup() helper to XDP hookpoint.

2018-10-18 Thread Martin Lau
On Thu, Oct 18, 2018 at 04:52:40PM -0700, Joe Stringer wrote: > On Thu, 18 Oct 2018 at 14:20, Daniel Borkmann wrote: > > > > On 10/18/2018 11:06 PM, Joe Stringer wrote: > > > On Thu, 18 Oct 2018 at 11:54, Nitin Hande wrote: > > [...] > > >> Open Issue > > >> * The underlying code relies on

Re: [PATCH bpf-next v2 02/13] bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO

2018-10-19 Thread Martin Lau
On Fri, Oct 19, 2018 at 06:04:11PM +0100, Edward Cree wrote: > On 18/10/18 22:19, Martin Lau wrote: > > As I have mentioned earlier, it is also special to > > the kernel because the BTF verifier and bpf_prog_load() > > need to do different checks for FUNC and FUNC_PROTO to >

Re: [PATCH bpf-next v2 02/13] bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO

2018-10-19 Thread Martin Lau
On Fri, Oct 19, 2018 at 12:36:49PM -0700, Martin Lau wrote: > On Fri, Oct 19, 2018 at 06:04:11PM +0100, Edward Cree wrote: > > On 18/10/18 22:19, Martin Lau wrote: > > > As I have mentioned earlier, it is also special to > > > the kernel because the BTF verifier and

Re: [PATCH bpf-next v2 02/13] bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO

2018-10-19 Thread Martin Lau
On Fri, Oct 19, 2018 at 10:26:53PM +0100, Edward Cree wrote: > On 19/10/18 20:36, Martin Lau wrote: > > On Fri, Oct 19, 2018 at 06:04:11PM +0100, Edward Cree wrote: > >> But you *do* have such a new section. > >> The patch comment talks about a 'FuncInfo Table

Re: [PATCH bpf] bpf: Fix IPv6 dport byte order in bpf_sk_lookup_udp

2018-11-07 Thread Martin Lau
On Wed, Nov 07, 2018 at 01:36:07PM -0800, Andrey Ignatov wrote: > Lookup functions in sk_lookup have different expectations about byte > order of provided arguments. > > Specifically __inet_lookup, __udp4_lib_lookup and __udp6_lib_lookup > expect dport to be in network byte order and do

Re: [PATCH v5 bpf-next 2/7] libbpf: cleanup after partial failure in bpf_object__pin

2018-11-12 Thread Martin Lau
On Mon, Nov 12, 2018 at 03:29:25PM -0800, Stanislav Fomichev wrote: > On 11/12, Martin Lau wrote: > > On Mon, Nov 12, 2018 at 02:10:11PM -0800, Stanislav Fomichev wrote: > > > On 11/12, Martin Lau wrote: > > > > On Fri, Nov 09, 2018 at 08:21:41AM -

Re: [PATCH bpf-next] selftests/bpf: Fix uninitialized duration warning

2018-11-12 Thread Martin Lau
On Fri, Nov 09, 2018 at 10:18:16AM -0800, Joe Stringer wrote: > Daniel Borkmann reports: > > test_progs.c: In function ‘main’: > test_progs.c:81:3: warning: ‘duration’ may be used uninitialized in this > function [-Wmaybe-uninitialized] >printf("%s:PASS:%s %d nsec\n", __func__, tag,

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

2018-11-07 Thread Martin Lau
On Wed, Nov 07, 2018 at 12:29:30PM +, 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? > and/or loading many programs. A workaround is to raise this

Re: [PATCH bpf-next] filter: add BPF_ADJ_ROOM_DATA mode to bpf_skb_adjust_room()

2018-11-09 Thread Martin Lau
On Thu, Nov 08, 2018 at 04:11:37PM +0100, Nicolas Dichtel wrote: > This new mode enables to add or remove an l2 header in a programmatic way > with cls_bpf. > For example, it enables to play with mpls headers. > > Signed-off-by: Nicolas Dichtel > --- > include/uapi/linux/bpf.h | 3 ++ >

Re: [PATCH bpf-next] filter: add BPF_ADJ_ROOM_DATA mode to bpf_skb_adjust_room()

2018-11-12 Thread Martin Lau
On Sun, Nov 11, 2018 at 12:43:27AM +0100, Nicolas Dichtel wrote: > Le 09/11/2018 à 19:51, Martin Lau a écrit : > > On Thu, Nov 08, 2018 at 04:11:37PM +0100, Nicolas Dichtel wrote: > [snip] > >> +static int bpf_skb_data_shrink(struct sk_buff *skb, u32 len) > >> +{ >

Re: [PATCH v5 bpf-next 2/7] libbpf: cleanup after partial failure in bpf_object__pin

2018-11-12 Thread Martin Lau
On Fri, Nov 09, 2018 at 08:21:41AM -0800, Stanislav Fomichev wrote: [ ... ] > @@ -1918,23 +2160,20 @@ void *bpf_object__priv(struct bpf_object *obj) > } > > static struct bpf_program * > -__bpf_program__next(struct bpf_program *prev, struct bpf_object *obj) > +__bpf_program__iter(struct

Re: [PATCH bpf-next v2 2/3] bpf: Support socket lookup in CGROUP_SOCK_ADDR progs

2018-11-09 Thread Martin Lau
On Fri, Nov 09, 2018 at 10:54:01AM -0800, Andrey Ignatov wrote: > Make bpf_sk_lookup_tcp, bpf_sk_lookup_udp and bpf_sk_release helpers > available in programs of type BPF_PROG_TYPE_CGROUP_SOCK_ADDR. > > Such programs operate on sockets and have access to socket and struct > sockaddr passed by

Re: [PATCH bpf-next 4/4] selftest/bpf: Use bpf_sk_lookup_{tcp,udp} in test_sock_addr

2018-11-09 Thread Martin Lau
On Thu, Nov 08, 2018 at 08:54:25AM -0800, Andrey Ignatov wrote: > Use bpf_sk_lookup_tcp, bpf_sk_lookup_udp and bpf_sk_release helpers from > test_sock_addr programs to make sure they're available and can lookup > and release socket properly for IPv4/IPv4, TCP/UDP. > > Reading from a few fields of

Re: [PATCH bpf-next 2/4] bpf: Split bpf_sk_lookup

2018-11-09 Thread Martin Lau
On Thu, Nov 08, 2018 at 08:54:23AM -0800, Andrey Ignatov wrote: > Split bpf_sk_lookup to separate core functionality, that can be reused > to make socket lookup available to more program types, from > functionality specific to program types that have access to skb. > > Core functionality is

Re: [PATCH bpf-next 3/4] bpf: Support socket lookup in CGROUP_SOCK_ADDR progs

2018-11-09 Thread Martin Lau
On Thu, Nov 08, 2018 at 08:54:24AM -0800, Andrey Ignatov wrote: > Make bpf_sk_lookup_tcp, bpf_sk_lookup_udp and bpf_sk_release helpers > available in programs of type BPF_PROG_TYPE_CGROUP_SOCK_ADDR. > > Such programs operate on sockets and have access to socket and struct > sockaddr passed by

Re: [PATCH v5 bpf-next 2/7] libbpf: cleanup after partial failure in bpf_object__pin

2018-11-12 Thread Martin Lau
On Mon, Nov 12, 2018 at 02:10:11PM -0800, Stanislav Fomichev wrote: > On 11/12, Martin Lau wrote: > > On Fri, Nov 09, 2018 at 08:21:41AM -0800, Stanislav Fomichev wrote: > > [ ... ] > > > @@ -1918,23 +2160,20 @@ void *bpf_object__priv(struct bpf_object *obj) > > >

Re: [PATCH bpf-next] bpf: fix a libbpf loader issue

2018-11-21 Thread Martin Lau
On Wed, Nov 21, 2018 at 11:22:42AM -0800, Yonghong Song wrote: > Commit 2993e0515bb4 ("tools/bpf: add support to read .BTF.ext sections") > added support to read .BTF.ext sections from an object file, create > and pass prog_btf_fd and func_info to the kernel. > > The program btf_fd (prog->btf_fd)

Re: [PATCH bpf-next 1/2] libbpf: Add version script for DSO

2018-11-23 Thread Martin Lau
On Wed, Nov 21, 2018 at 02:22:14PM -0800, Alexei Starovoitov wrote: > On 11/21/18 12:18 PM, Yonghong Song wrote: > > > > > > On 11/21/18 9:40 AM, Andrey Ignatov wrote: > >> More and more projects use libbpf and one day it'll likely be packaged > >> and distributed as DSO and that requires ABI

Re: [PATCH bpf-next 2/2] tools/bpf: change selftest test_btf for both jit and non-jit

2018-11-26 Thread Martin Lau
On Sat, Nov 24, 2018 at 11:20:45PM -0800, Yonghong Song wrote: > The selftest test_btf is changed to test both jit and non-jit. > The test result should be the same regardless of whether jit > is enabled or not. Acked-by: Martin KaFai Lau

Re: [PATCH bpf-next 1/2] bpf: btf: support proper non-jit func info

2018-11-26 Thread Martin Lau
On Sat, Nov 24, 2018 at 11:20:44PM -0800, Yonghong Song wrote: > Commit 838e96904ff3 ("bpf: Introduce bpf_func_info") > added bpf func info support. The userspace is able > to get better ksym's for bpf programs with jit, and > is able to print out func prototypes. > > For a program containing