[PATCH net-next 3/3] bpf: Append prog->aux->name in bpf_get_prog_name()

2017-10-05 Thread Martin KaFai Lau
a0038000 t bpf_prog_a04f5eef06a7f555__123456789ABCDE a005 t bpf_prog_a04f5eef06a7f555 Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> Acked-by: Alexei Starovoitov <a...@fb.com> --- kernel/bpf/core.c | 17 +++--

[PATCH net-next 0/3] bpf: Misc improvements and a new usage on bpf obj name

2017-10-05 Thread Martin KaFai Lau
The first two patches make improvements on the bpf obj name. The last patch adds the prog name to kallsyms. Martin KaFai Lau (3): bpf: Change bpf_obj_name_cpy() to better ensure map's name is init by 0 bpf: Use char in prog and map name bpf: Append prog->aux->name in bpf_get_pro

Re: [PATCH net-next 2/5] bpf: Add map_name to bpf_map_info

2017-09-29 Thread Martin KaFai Lau
On Sat, Sep 30, 2017 at 02:07:46AM +, Jakub Kicinski wrote: > Hi Martin! > > On Wed, 27 Sep 2017 14:37:53 -0700, Martin KaFai Lau wrote: > > diff --git a/include/linux/bpf.h b/include/linux/bpf.h > > index 33ccc474fb04..252f4bc9eb25 100644 > > --- a/include/linux/bp

[PATCH net-next] bpf: Fix compiler warning on info.map_ids for 32bit platform

2017-09-29 Thread Martin KaFai Lau
This patch uses u64_to_user_ptr() to cast info.map_ids to a userspace ptr. It also tags the user_map_ids with '__user' for sparse check. Fixes: cb4d2b3f03d8 ("bpf: Add name, load_time, uid and map_ids to bpf_prog_info") Signed-off-by: Martin KaFai Lau <ka...@fb.com> --- kernel/b

Re: [net-next:master 332/339] kernel//bpf/syscall.c:1404:23: warning: cast to pointer from integer of different size

2017-09-29 Thread Martin KaFai Lau
On Fri, Sep 29, 2017 at 06:54:16AM +, kbuild test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git > master > head: fa8fefaa678ea390b873195d19c09930da84a4bb > commit: cb4d2b3f03d8eed90be3a194e5b54b734ec4bbe9 [332/339] bpf: Add name, > load_time, uid

[PATCH net-next 3/5] bpf: libbpf: Provide basic API support to specify BPF obj name

2017-09-27 Thread Martin KaFai Lau
r bpf_prog, bpf_load.c does not collect the function symbol name. We can consider to collect them later if there is a need to continue supporting the bpf_load.c. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogear

[PATCH net-next 2/5] bpf: Add map_name to bpf_map_info

2017-09-27 Thread Martin KaFai Lau
This patch allows userspace to specify a name for a map during BPF_MAP_CREATE. The map's name can later be exported to user space via BPF_OBJ_GET_INFO_BY_FD. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan..

[PATCH net-next 1/5] bpf: Add name, load_time, uid and map_ids to bpf_prog_info

2017-09-27 Thread Martin KaFai Lau
ted to the newly added members 'nr_map_ids' and 'map_ids' of the bpf_prog_info. On the input, nr_map_ids tells how big the userspace's map_ids buffer is. On the output, nr_map_ids tells the exact user_map_cnt and it will only copy up to the userspace's map_ids buffer is allowed. Signed-off-by: Martin KaFai

[PATCH net-next 5/5] bpf: Test new fields in bpf_attr and bpf_{prog,map}_info

2017-09-27 Thread Martin KaFai Lau
This patch tests newly added fields of the bpf_attr, bpf_prog_info and bpf_map_info. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- tools/testing/selftests/bpf/

[PATCH net-next 0/5] bpf: Extend bpf_{prog,map}_info

2017-09-27 Thread Martin KaFai Lau
This patch series adds more fields to bpf_prog_info and bpf_map_info. Please see individual patch for details. Martin KaFai Lau (5): bpf: Add name, load_time, uid and map_ids to bpf_prog_info bpf: Add map_name to bpf_map_info bpf: libbpf: Provide basic API support to specify BPF obj name

[PATCH net-next 4/5] bpf: Swap the order of checking prog_info and map_info

2017-09-27 Thread Martin KaFai Lau
This patch swaps the checking order. It now checks the map_info first and then prog_info. It is a prep work for adding test to the newly added fields (the map_ids of prog_info field in particular). Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.c

Re: [PATCH net-next] ipv6: do lazy dst->__use update when per cpu dst is available

2017-09-27 Thread Martin KaFai Lau
On Wed, Sep 27, 2017 at 06:03:33PM +, Eric Dumazet wrote: > >> diff --git a/net/ipv6/route.c b/net/ipv6/route.c > > > > > Hi Paolo, > > > > Eric and I discussed about this issue recently as well :). > > > > What about the following change: > > > > diff --git a/include/net/dst.h

Re: [PATCH net] ipv6: remove incorrect WARN_ON() in fib6_del()

2017-09-25 Thread Martin KaFai Lau
On Tue, Sep 26, 2017 at 01:16:05AM +, Wei Wang wrote: > On Mon, Sep 25, 2017 at 5:56 PM, Martin KaFai Lau <ka...@fb.com> wrote: > > On Mon, Sep 25, 2017 at 05:35:22PM +, Wei Wang wrote: > >> From: Wei Wang <wei...@google.com> > >> > >> fib6

Re: [PATCH net] ipv6: remove incorrect WARN_ON() in fib6_del()

2017-09-25 Thread Martin KaFai Lau
On Mon, Sep 25, 2017 at 05:35:22PM +, Wei Wang wrote: > From: Wei Wang > > fib6_del() generates WARN_ON() when rt->dst.obsolete > 0. This does not > make sense because it is possible that the route passed in is already > deleted by some other thread and rt->dst.obsolete is

Re: [PATCH net] net: prevent dst uses after free

2017-09-21 Thread Martin KaFai Lau
cpu saw 1 -> 0 transition in > dst_release() and queued the dst for freeing after one RCU grace period. > > Lets unify skb_dst_force() and skb_dst_force_safe(), since we should > always perform the complete check against dst refcount, and not assume > it is not zero. Acke

Re: [PATCH net] bpf: do not disable/enable BH in bpf_map_free_id()

2017-09-19 Thread Martin KaFai Lau
er solution would be to change htab_map_delete_elem() to > defer the free_htab_elem() call after > raw_spin_unlock_irqrestore(>lock, flags), but this might be not > enough to cover other code paths. Thanks for fixing it. Acked-by: Martin KaFai Lau <ka...@fb.com>

Re: [PATCH net-next] bpf: fix numa_node validation

2017-09-05 Thread Martin KaFai Lau
f 0b > 66 0f 1f 44 00 00 55 48 89 e5 41 57 41 56 41 > RIP: cache_alloc_node+0x1d4/0x1e0 mm/slab.c:3292 RSP: 8801c0c97638 > ---[ end trace d745f355da2e33ce ]--- > Kernel panic - not syncing: Fatal exception > > Fixes: 96eabe7a40aa ("bpf: Allow selecting numa node during ma

[PATCH net-next 3/3] bpf: Only set node->ref = 1 if it has not been set

2017-09-01 Thread Martin KaFai Lau
LRU hash Second column: Number of lookups/s Before: > echo "$((2**20+1)): $(./map_perf_test 1024 1 $((2**20+1)) 1000 | awk > '{print $3}')" 1048577: 260097 After: > echo "$((2**20+1)): $(./map_perf_test 1024 1 $((2**20+1)) 1000 | awk > '{print $3}')" 1048577

[PATCH net-next 0/3] bpf: Improve LRU map lookup performance

2017-09-01 Thread Martin KaFai Lau
This patchset improves the lookup performance of the LRU map. Please see individual patch for details. Martin KaFai Lau (3): bpf: Add lru_hash_lookup performance test bpf: Inline LRU map lookup bpf: Only set node->ref = 1 if it has not been set kernel/bpf/bpf_lru_list.h|

[PATCH net-next 2/3] bpf: Inline LRU map lookup

2017-09-01 Thread Martin KaFai Lau
8193: 773731 16385: 729673 32769: 721989 65537: 715530 131073: 671665 262145: 516987 524289: 321125 1048577: 260048 Signed-off-by: Martin KaFai Lau <ka...@fb.com> --- kernel/bpf/hashtab.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/kernel/bpf/hashtab.c b/k

[PATCH net-next 1/3] bpf: Add lru_hash_lookup performance test

2017-09-01 Thread Martin KaFai Lau
rly name the test params in stress_lru_hmap_alloc() in map_perf_test_kern.c. Signed-off-by: Martin KaFai Lau <ka...@fb.com> --- samples/bpf/map_perf_test_kern.c | 44 +++ samples/bpf/map_perf_test_user.c | 77 ++-- 2 files cha

Re: [PATCH net-next 06/11] bnxt_en: Improve -ENOMEM logic in NAPI poll loop.

2017-08-28 Thread Martin KaFai Lau
consistently cannot allocate new buffers. Improve it by counting > -ENOMEM event as 1 towards the NAPI budget. > > Cc: Martin KaFai Lau <ka...@fb.com> > Signed-off-by: Michael Chan <michael.c...@broadcom.com> Thanks for fixing it. Reported-by: Martin KaFai Lau <ka...

Re: [PATCH net-next] selftests/bpf: check the instruction dumps are populated

2017-08-28 Thread Martin KaFai Lau
bj_get_info_by_fd()"), > which made bpf_obj_get_info_by_fd() usable for retrieving > the image dumps. Acked-by: Martin KaFai Lau <ka...@fb.com> > > Signed-off-by: Jakub Kicinski <jakub.kicin...@netronome.com> > --- > tools/testing/selftests/bpf/test_progs.c |

Re: [PATCH net] ipv6: fix sparse warning on rt6i_node

2017-08-25 Thread Martin KaFai Lau
gt; rcu API is used for it. > After this fix, sparse no longer generates the above warning. > > Fixes: c5cff8561d2d ("ipv6: add rcu grace period before freeing fib6_node") > Signed-off-by: Wei Wang <wei...@google.com> > Acked-by: Eric Dumazet <eduma...@google.com> Acke

Re: [PATCH net] bpf: fix map value attribute for hash of maps

2017-08-22 Thread Martin KaFai Lau
hash of maps support") > Signed-off-by: Daniel Borkmann <dan...@iogearbox.net> > Acked-by: Alexei Starovoitov <a...@kernel.org> Acked-by: Martin KaFai Lau <ka...@fb.com> > --- > kernel/bpf/hashtab.c | 30 +- > 1 file changed, 17 insertio

Re: [net-next:master 1184/1189] include/linux/bpf.h:324:21: error: 'NUMA_NO_NODE' undeclared

2017-08-20 Thread Martin KaFai Lau
On Sat, Aug 19, 2017 at 11:33:13PM -0700, David Miller wrote: > From: kbuild test robot > Date: Sun, 20 Aug 2017 13:43:54 +0800 > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git > > master > > head: 228498596c44041c710f5a633904205bc1cd9177

Re: [net-next:master 1184/1189] include/linux/bpf.h:324:21: error: 'NUMA_NO_NODE' undeclared

2017-08-20 Thread Martin KaFai Lau
On Sun, Aug 20, 2017 at 01:43:54PM +0800, kbuild test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git > master > head: 228498596c44041c710f5a633904205bc1cd9177 > commit: 96eabe7a40aa17e613cf3db2c742ee8b1fc764d0 [1184/1189] bpf: Allow > selecting numa

Re: [PATCH net v2] ipv6: add rcu grace period before freeing fib6_node

2017-08-19 Thread Martin KaFai Lau
g fib6_node and > makes sure the functions that dereference it takes rcu_read_lock(). > > Note: there is no "Fixes" tag because this bug was there in a very > early stage. > > Signed-off-by: Wei Wang <wei...@google.com> > Acked-by: Eric Dumazet <eduma...@google.c

Re: [PATCH net] ipv6: add rcu grace period before freeing fib6_node

2017-08-19 Thread Martin KaFai Lau
bool status = false; > >> + > >> + rcu_read_lock(); > >> + fn = rcu_dereference(rt->rt6i_node); > >> + > >> + if (fn) { > >> + *cookie = fn->fn_sernum; > >> + status = true; > >>

Re: [PATCH net] ipv6: add rcu grace period before freeing fib6_node

2017-08-18 Thread Martin KaFai Lau
On Fri, Aug 18, 2017 at 05:36:55PM -0700, Wei Wang wrote: > From: Wei Wang > > We currently keep rt->rt6i_node pointing to the fib6_node for the route. > And some functions make use of this pointer to dereference the fib6_node > from rt structure, e.g. rt6_check(). However, as

Re: [PATCH V4 net 0/2] ipv6: fix flowlabel issue for reset packet

2017-08-18 Thread Martin KaFai Lau
On Fri, Aug 18, 2017 at 07:50:03AM -0700, Tom Herbert wrote: > > We had been using the auto_flowlabels=1 (i.e. essentially enable flowlabel) > > mainly because we want to take the benefit of dst_negative_advice() when > > tcp_write_timeout() happens. > > > > During our test, our system handles

[PATCH net-next 0/2] bpf: Allow selecting numa node during map creation

2017-08-18 Thread Martin KaFai Lau
This series allows user to pick the numa node during map creation. The first patch has the details Martin KaFai Lau (2): bpf: Allow selecting numa node during map creation bpf: Allow numa selection in INNER_LRU_HASH_PREALLOC test of map_perf_test include/linux/bpf.h

[PATCH net-next 1/2] bpf: Allow selecting numa node during map creation

2017-08-18 Thread Martin KaFai Lau
ugh to stay in the cache. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> Acked-by: Alexei Starovoitov <a...@fb.com> --- include/linux/bpf.h | 10 +- include/uapi/linux/bpf.h | 10 +- kernel/bpf/arraymap.c|

[PATCH net-next 2/2] bpf: Allow numa selection in INNER_LRU_HASH_PREALLOC test of map_perf_test

2017-08-18 Thread Martin KaFai Lau
This patch makes the needed changes to allow each process of the INNER_LRU_HASH_PREALLOC test to provide its numa node id when creating the lru map. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> Acked-by: Alexei Starovoitov

[PATCH net-next] bpf: Fix map-in-map checking in the verifier

2017-08-17 Thread Martin KaFai Lau
m> Signed-off-by: Martin KaFai Lau <ka...@fb.com> --- kernel/bpf/verifier.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 40f669ddb571..4f6e7eb42ba0 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -1523,6

Re: [PATCH V4 net 0/2] ipv6: fix flowlabel issue for reset packet

2017-08-17 Thread Martin KaFai Lau
On Tue, Aug 15, 2017 at 05:15:46PM -0700, Tom Herbert wrote: > On Tue, Aug 15, 2017 at 3:42 PM, Shaohua Li wrote: > > On Tue, Aug 15, 2017 at 07:08:31AM -0700, Tom Herbert wrote: > >> On Mon, Aug 14, 2017 at 7:52 PM, Shaohua Li wrote: > >> > On Fri, Aug 11, 2017

Re: [PATCH net] bpf: fix bpf_prog_get_info_by_fd to dump correct xlated_prog_len

2017-07-29 Thread Martin KaFai Lau
_size(prog->len) also > includes the size of struct bpf_prog itself plus program instructions > and is usually used either in context of accounting or for bpf_prog_alloc() > et al, thus we copy out of bounds in bpf_prog_get_info_by_fd() > potentially. Use the correct bpf_prog_insn_size() ins

Re: [PATCH net] bpf: don't indicate success when copy_from_user fails

2017-07-29 Thread Martin KaFai Lau
ixing it. (I am on PTO and cannot use my usual email account). Acked-by: Martin KaFai Lau <ka...@fb.com> > > Fixes: 1e2709769086 ("bpf: Add BPF_OBJ_GET_INFO_BY_FD") > Signed-off-by: Daniel Borkmann <dan...@iogearbox.net> > --- > kernel/bpf/syscall.c

Re: [PATCH net] bpf: prevent leaking pointer via xadd on unpriviledged

2017-06-29 Thread Martin KaFai Lau
R10=fp > 11: (b7) r0 = 0 > 12: (95) exit > > Prevent this by checking xadd src reg for pointer types. Also > add a couple of test cases related to this. > > Fixes: 1be7f75d1668 ("bpf: enable non-root eBPF programs") > Fixes: 17a5267067f3 ("bpf: verifier (add verifier core)") > Signed-off-by: Daniel Borkmann <dan...@iogearbox.net> Acked-by: Martin KaFai Lau <ka...@fb.com>

[PATCH net-next] bpf: Fix out-of-bound access on interpreters[]

2017-06-28 Thread Martin KaFai Lau
22.350984] == Fixes: b870aa901f4b ("bpf: use different interpreter depending on required stack size") Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- kerne

[PATCH net-next 2/2] bpf: Add test for syscall on fd array/htab lookup

2017-06-28 Thread Martin KaFai Lau
Checks are added to the existing sockex3 and test_map_in_map test. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- samples/bpf/sockex3_user.c | 15 ++- samples/bpf/test_map_in_map_user.c | 17 ++

[PATCH net-next 1/2] bpf: Add syscall lookup support for fd array and htab

2017-06-28 Thread Martin KaFai Lau
-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- include/linux/bpf.h | 3 +++ kernel/bpf/arraymap.c | 27 +++ kernel/bpf/hashtab.c| 21 + kernel/bpf/map_in_map.c | 5 + kernel/bpf/map_i

[PATCH net-next 0/2] bpf: Add syscall lookup support for fd array and htab

2017-06-28 Thread Martin KaFai Lau
This patchset adds BPF_MAP_LOOKUP_ELEM syscall support for BPF_MAP_TYPE_PROG_ARRAY, BPF_MAP_TYPE_ARRAY_OF_MAPS and BPF_MAP_TYPE_HASH_OF_MAPS Martin KaFai Lau (2): bpf: Add syscall lookup support for fd array and htab bpf: Add test for syscall on fd array/htab lookup include/linux/bpf.h

[PATCH iproute2 net-next] bpf: Add support for IFLA_XDP_PROG_ID

2017-06-21 Thread Martin KaFai Lau
This patch adds support to the newly added IFLA_XDP_PROG_ID. ./ip link show dev eth0 3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 xdpgeneric/id:2 qdisc [...] Signed-off-by: Martin KaFai Lau <ka...@fb.com> --- include/linux/if_link.h | 1 + ip/iplink_xdp.c | 12 +++

Re: [PATCH net-next] bpf: expose prog id for cls_bpf and act_bpf

2017-06-21 Thread Martin KaFai Lau
GET_FD_BY_ID command, and dump related prog info via > BPF_OBJ_GET_INFO_BY_FD command for bpf(2). Acked-by: Martin KaFai Lau <ka...@fb.com>

[PATCH v3 net-next 9/9] bpf: qede: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-15 Thread Martin KaFai Lau
Add support to qede to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Mintz Yuval <yuval.mi...@cavium.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- drivers/net/ethernet/q

[PATCH v3 net-next 6/9] bpf: thunderx: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-15 Thread Martin KaFai Lau
Add support to thunderx to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Sunil Goutham <sgout...@cavium.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- drivers/net

[PATCH v3 net-next 3/9] bpf: mlx5e: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-15 Thread Martin KaFai Lau
Add support to mlx5e to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Tariq Toukan <tar...@mellanox.com> Cc: Saeed Mahameed <sae...@mellanox.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <

[PATCH v3 net-next 4/9] bpf: virtio_net: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-15 Thread Martin KaFai Lau
Add support to virtio_net to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: John Fastabend <john.fastab...@gmail.com> Cc: Jason Wang <jasow...@redhat.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkma

[PATCH v3 net-next 7/9] bpf: ixgbe: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-15 Thread Martin KaFai Lau
Add support to ixgbe to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Alexander Duyck <alexander.h.du...@intel.com> Cc: John Fastabend <john.fastab...@gmail.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-

[PATCH v3 net-next 0/9] bpf: xdp: Report bpf_prog ID in IFLA_XDP

2017-06-15 Thread Martin KaFai Lau
by Jakub Kicinski. The existing prog_attached and the new prog_id are put under a struct for XDP_QUERY_PROG. Martin KaFai Lau (9): net: Add IFLA_XDP_PROG_ID bpf: mlx4: Report bpf_prog ID during XDP_QUERY_PROG bpf: mlx5e: Report bpf_prog ID during XDP_QUERY_PROG bpf: virtio_net: Report bpf_prog

[PATCH v3 net-next 2/9] bpf: mlx4: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-15 Thread Martin KaFai Lau
Add support to mlx4 to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Tariq Toukan <tar...@mellanox.com> Cc: Saeed Mahameed <sae...@mellanox.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@

[PATCH v3 net-next 5/9] bpf: bnxt: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-15 Thread Martin KaFai Lau
Add support to bnxt to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Michael Chan <michael.c...@broadcom.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- drivers/ne

[PATCH v3 net-next 8/9] bpf: nfp: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-15 Thread Martin KaFai Lau
Add support to nfp to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Jakub Kicinski <jakub.kicin...@netronome.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- drivers/ne

[PATCH v3 net-next 1/9] net: Add IFLA_XDP_PROG_ID

2017-06-15 Thread Martin KaFai Lau
th0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 xdp(prog_id:1) qdisc fq_codel state UP mode DEFAULT group default qlen 1000 Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- includ

Re: [PATCH v2 net-next 8/9] bpf: nfp: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-13 Thread Martin KaFai Lau
On Tue, Jun 13, 2017 at 07:19:50PM -0700, Jakub Kicinski wrote: > On Tue, 13 Jun 2017 17:37:50 -0700, Martin KaFai Lau wrote: > > On Tue, Jun 13, 2017 at 04:52:32PM -0700, Jakub Kicinski wrote: > > > On Tue, 13 Jun 2017 14:08:40 -0700, Martin KaFai Lau wrote: > > > &g

Re: [PATCH v2 net-next 8/9] bpf: nfp: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-13 Thread Martin KaFai Lau
On Tue, Jun 13, 2017 at 04:52:32PM -0700, Jakub Kicinski wrote: > On Tue, 13 Jun 2017 14:08:40 -0700, Martin KaFai Lau wrote: > > - case XDP_QUERY_PROG: > > - xdp->prog_attached = !!nn->dp.xdp_prog; > > + case XDP_QUERY_PROG: { > > +

[PATCH v2 net-next 8/9] bpf: nfp: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-13 Thread Martin KaFai Lau
Add support to nfp to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Jakub Kicinski <jakub.kicin...@netronome.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- drivers/ne

[PATCH v2 net-next 3/9] bpf: mlx5e: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-13 Thread Martin KaFai Lau
Add support to mlx5e to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Tariq Toukan <tar...@mellanox.com> Cc: Saeed Mahameed <sae...@mellanox.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <

[PATCH v2 net-next 5/9] bpf: bnxt: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-13 Thread Martin KaFai Lau
Add support to bnxt to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Michael Chan <michael.c...@broadcom.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- drivers/ne

[PATCH v2 net-next 9/9] bpf: qede: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-13 Thread Martin KaFai Lau
Add support to qede to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Mintz Yuval <yuval.mi...@cavium.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- drivers/net/ethernet/q

[PATCH v2 net-next 1/9] net: Add IFLA_XDP_PROG_ID

2017-06-13 Thread Martin KaFai Lau
th0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 xdp(prog_id:1) qdisc fq_codel state UP mode DEFAULT group default qlen 1000 Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- includ

[PATCH v2 net-next 6/9] bpf: thunderx: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-13 Thread Martin KaFai Lau
Add support to thunderx to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Sunil Goutham <sgout...@cavium.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- drivers/net

[PATCH v2 net-next 7/9] bpf: ixgbe: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-13 Thread Martin KaFai Lau
Add support to ixgbe to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Alexander Duyck <alexander.h.du...@intel.com> Cc: John Fastabend <john.fastab...@gmail.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-

[PATCH v2 net-next 0/9] bpf: xdp: Report bpf_prog ID in IFLA_XDP

2017-06-13 Thread Martin KaFai Lau
. Martin KaFai Lau (9): net: Add IFLA_XDP_PROG_ID bpf: mlx4: Report bpf_prog ID during XDP_QUERY_PROG bpf: mlx5e: Report bpf_prog ID during XDP_QUERY_PROG bpf: virtio_net: Report bpf_prog ID during XDP_QUERY_PROG bpf: bnxt: Report bpf_prog ID during XDP_QUERY_PROG bpf: thunderx: Report

[PATCH v2 net-next 4/9] bpf: virtio_net: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-13 Thread Martin KaFai Lau
Add support to virtio_net to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: John Fastabend <john.fastab...@gmail.com> Cc: Jason Wang <jasow...@redhat.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkma

[PATCH v2 net-next 2/9] bpf: mlx4: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-13 Thread Martin KaFai Lau
Add support to mlx4 to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Tariq Toukan <tar...@mellanox.com> Cc: Saeed Mahameed <sae...@mellanox.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@

Re: [PATCH net-next 03/10] bpf: mlx5e: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-13 Thread Martin KaFai Lau
On Tue, Jun 13, 2017 at 07:04:26PM +0300, Saeed Mahameed wrote: > On Tue, Jun 13, 2017 at 4:00 AM, Martin KaFai Lau <ka...@fb.com> wrote: > > Add support to mlx5e to report bpf_prog ID during XDP_QUERY_PROG. > > > > Signed-off-by: Martin KaFai Lau <ka...@fb.

Re: [PATCH net-next 00/10] bpf: xdp: Report bpf_prog ID in IFLA_XDP

2017-06-12 Thread Martin KaFai Lau
On Mon, Jun 12, 2017 at 06:26:02PM -0700, Jakub Kicinski wrote: > On Mon, 12 Jun 2017 18:00:15 -0700, Martin KaFai Lau wrote: > > This is the first usage of the new bpf_prog ID. It is for > > reporting the ID of a xdp_prog through netlink. > > > > It rides on the exi

Re: [PATCH net-next 08/10] bpf: nfp: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-12 Thread Martin KaFai Lau
On Mon, Jun 12, 2017 at 06:28:42PM -0700, Jakub Kicinski wrote: > On Mon, 12 Jun 2017 18:00:23 -0700, Martin KaFai Lau wrote: > > + case XDP_QUERY_PROG: { > > + const struct bpf_prog *xdp_prog; > > + > > + xdp_prog = READ_ONCE(nn->dp.xdp_prog)

[PATCH net-next 03/10] bpf: mlx5e: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-12 Thread Martin KaFai Lau
Add support to mlx5e to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Tariq Toukan <tar...@mellanox.com> Cc: Saeed Mahameed <sae...@mellanox.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@

[PATCH net-next 02/10] bpf: mlx4: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-12 Thread Martin KaFai Lau
Add support to mlx4 to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Tariq Toukan <tar...@mellanox.com> Cc: Saeed Mahameed <sae...@mellanox.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@

[PATCH net-next 09/10] bpf: qede: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-12 Thread Martin KaFai Lau
Add support to qede to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Mintz, Yuval <yuval.mi...@cavium.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- drivers/net/ethernet/q

[PATCH net-next 07/10] bpf: ixgbe: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-12 Thread Martin KaFai Lau
Add support to ixgbe to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Alexander Duyck <alexander.h.du...@intel.com> Cc: John Fastabend <john.fastab...@gmail.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-

[PATCH net-next 01/10] net: Add IFLA_XDP_PROG_ID

2017-06-12 Thread Martin KaFai Lau
default qlen 1000 Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- include/linux/netdevice.h| 3 ++- include/uapi/linux/if_link.h | 1 + net/core/dev.c | 23 +++

[PATCH net-next 10/10] net: Remove prog_attached from struct netdev_xdp

2017-06-12 Thread Martin KaFai Lau
prog_attached can be implied by prog_id (!!prog_id) and all drivers supporting xdp has been stopped setting prog_attached. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- include/linu

[PATCH net-next 08/10] bpf: nfp: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-12 Thread Martin KaFai Lau
Add support to nfp to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Jakub Kicinski <jakub.kicin...@netronome.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- drivers/ne

[PATCH net-next 05/10] bpf: bnxt: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-12 Thread Martin KaFai Lau
Add support to bnxt to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Michael Chan <michael.c...@broadcom.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- drivers/ne

[PATCH net-next 04/10] bpf: virtio_net: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-12 Thread Martin KaFai Lau
Add support to virtio_net to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: John Fastabend <john.fastab...@gmail.com> Cc: Jason Wang <jasow...@redhat.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkma

[PATCH net-next 00/10] bpf: xdp: Report bpf_prog ID in IFLA_XDP

2017-06-12 Thread Martin KaFai Lau
is changed one by one. The final patch removes the prog_attached from 'struct netdev_xdp' because prog_id > 0 implies the presence of xdp_prog. I have tested with generic_xdp, mlx4 and mlx5. Martin KaFai Lau (10): net: Add IFLA_XDP_PROG_ID bpf: mlx4: Report bpf_prog ID during XDP_QUERY_PROG

[PATCH net-next 06/10] bpf: thunderx: Report bpf_prog ID during XDP_QUERY_PROG

2017-06-12 Thread Martin KaFai Lau
Add support to thunderx to report bpf_prog ID during XDP_QUERY_PROG. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Cc: Sunil Goutham <sgout...@cavium.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- drivers/net

[PATCH net-next 1/2] bpf: Fix test_bpf_obj_id() when the bpf_jit_enable sysctl is diabled

2017-06-08 Thread Martin KaFai Lau
to remove after making changes. Fixes: 95b9afd3987f ("bpf: Test for bpf ID") Reported-by: Yonghong Song <y...@fb.com> Signed-off-by: Martin KaFai Lau <ka...@fb.com> --- tools/testing/selftests/bpf/test_progs.c | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(

[PATCH net-next 2/2] bpf: Fix test_obj_id.c for llvm 5.0

2017-06-08 Thread Martin KaFai Lau
304329) This patch makes changes to the section name and the function name. Fixes: 95b9afd3987f ("bpf: Test for bpf ID") Reported-by: Alexei Starovoitov <a...@fb.com> Reported-by: Yonghong Song <y...@fb.com> Signed-off-by: Martin KaFai Lau <ka...@fb.com> --- tools/testing

[PATCH v3 net-next 1/8] bpf: Introduce bpf_prog ID

2017-06-05 Thread Martin KaFai Lau
to the prog_idr. After bpf_prog_select_runtime(), the prog is read-only. Hence, the id is stored in 'struct bpf_prog_aux'. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- include

[PATCH v3 net-next 6/8] bpf: Add jited_len to struct bpf_prog

2017-06-05 Thread Martin KaFai Lau
Add jited_len to struct bpf_prog. It will be useful for the struct bpf_prog_info which will be added in the later patch. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- arch/arm64/

[PATCH v3 net-next 7/8] bpf: Add BPF_OBJ_GET_INFO_BY_FD

2017-06-05 Thread Martin KaFai Lau
the bpf_attr. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- include/linux/filter.h | 2 - include/uapi/linux/bpf.h | 28 kernel/bpf/s

[PATCH v3 net-next 3/8] bpf: Add BPF_(PROG|MAP)_GET_NEXT_ID command

2017-06-05 Thread Martin KaFai Lau
. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- include/uapi/linux/bpf.h | 7 +++ kernel/bpf/syscall.c | 38 ++ 2 files changed, 45 inserti

[PATCH v3 net-next 2/8] bpf: Introduce bpf_map ID

2017-06-05 Thread Martin KaFai Lau
This patch generates an unique ID for each created bpf_map. The approach is similar to the earlier patch for bpf_prog ID. It is worth to note that the bpf_map's ID and bpf_prog's ID are in two independent ID spaces and both have the same valid range: [1, INT_MAX). Signed-off-by: Martin KaFai Lau

[PATCH v3 net-next 5/8] bpf: Add BPF_MAP_GET_FD_BY_ID

2017-06-05 Thread Martin KaFai Lau
;id. In the error path of bpf_map_inc_not_zero(), it may have to call __bpf_map_put(map, false) which does not need to take the map_idr_lock when freeing the map->id. It is currently limited to CAP_SYS_ADMIN which we can consider to lift it in followup patches. Signed-off-by: Martin KaFai L

[PATCH v3 net-next 8/8] bpf: Test for bpf ID

2017-06-05 Thread Martin KaFai Lau
Add test to exercise the bpf_prog/map id generation, bpf_(prog|map)_get_next_id(), bpf_(prog|map)_get_fd_by_id() and bpf_get_obj_info_by_fd(). Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.

[PATCH v3 net-next 0/8] Introduce bpf ID

2017-06-05 Thread Martin KaFai Lau
info_by_fd(). Martin KaFai Lau (8): bpf: Introduce bpf_prog ID bpf: Introduce bpf_map ID bpf: Add BPF_(PROG|MAP)_GET_NEXT_ID command bpf: Add BPF_PROG_GET_FD_BY_ID bpf: Add BPF_MAP_GET_FD_BY_ID bpf: Add jited_len to struct bpf_prog bpf: Add BPF_OBJ_GET_INFO_BY_FD bpf: Test for bpf ID

[PATCH v3 net-next 4/8] bpf: Add BPF_PROG_GET_FD_BY_ID

2017-06-05 Thread Martin KaFai Lau
->id. In the error path of bpf_prog_inc_not_zero(), it may have to call __bpf_prog_put(map, false) which does not need to take the prog_idr_lock when freeing the prog->id. It is currently limited to CAP_SYS_ADMIN which we can consider to lift it in followup patches. Signed-off-by: Martin KaF

Re: [PATCH v2 net-next 0/8] Introduce bpf ID

2017-06-02 Thread Martin KaFai Lau
On Wed, May 31, 2017 at 07:35:18PM -0400, David Miller wrote: > From: Martin KaFai Lau <ka...@fb.com> > Date: Wed, 31 May 2017 11:58:54 -0700 > > > This patch series: > > 1) Introduce ID for both bpf_prog and bpf_map. > > 2) Add bpf commands to iterate the prog IDs

[PATCH v2 net-next 8/8] bpf: Test for bpf ID

2017-05-31 Thread Martin KaFai Lau
Add test to exercise the bpf_prog/map id generation, bpf_(prog|map)_get_next_id(), bpf_(prog|map)_get_fd_by_id() and bpf_get_obj_info_by_fd(). Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.

[PATCH v2 net-next 3/8] bpf: Add BPF_(PROG|MAP)_GET_NEXT_ID command

2017-05-31 Thread Martin KaFai Lau
. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- include/uapi/linux/bpf.h | 7 +++ kernel/bpf/syscall.c | 38 ++ 2 files changed, 45 inserti

[PATCH v2 net-next 2/8] bpf: Introduce bpf_map ID

2017-05-31 Thread Martin KaFai Lau
This patch generates an unique ID for each created bpf_map. The approach is similar to the earlier patch for bpf_prog ID. It is worth to note that the bpf_map's ID and bpf_prog's ID are in two independent ID spaces and both have the same valid range: [1, INT_MAX). Signed-off-by: Martin KaFai Lau

[PATCH v2 net-next 4/8] bpf: Add BPF_PROG_GET_FD_BY_ID

2017-05-31 Thread Martin KaFai Lau
->id. In the error path of bpf_prog_inc_not_zero(), it may have to call __bpf_prog_put(map, false) which does not need to take the prog_idr_lock when freeing the prog->id. It is currently limited to CAP_SYS_ADMIN which we can consider to lift it in followup patches. Signed-off-by: Martin KaF

[PATCH v2 net-next 0/8] Introduce bpf ID

2017-05-31 Thread Martin KaFai Lau
in bpf_prog_get_info_by_fd() and bpf_map_get_info_by_fd(). Martin KaFai Lau (8): bpf: Introduce bpf_prog ID bpf: Introduce bpf_map ID bpf: Add BPF_(PROG|MAP)_GET_NEXT_ID command bpf: Add BPF_PROG_GET_FD_BY_ID bpf: Add BPF_MAP_GET_FD_BY_ID bpf: Add jited_len to struct bpf_prog bpf: Add

[PATCH v2 net-next 6/8] bpf: Add jited_len to struct bpf_prog

2017-05-31 Thread Martin KaFai Lau
Add jited_len to struct bpf_prog. It will be useful for the struct bpf_prog_info which will be added in the later patch. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- arch/arm64/

[PATCH v2 net-next 7/8] bpf: Add BPF_OBJ_GET_INFO_BY_FD

2017-05-31 Thread Martin KaFai Lau
the bpf_attr. Signed-off-by: Martin KaFai Lau <ka...@fb.com> Acked-by: Alexei Starovoitov <a...@fb.com> Acked-by: Daniel Borkmann <dan...@iogearbox.net> --- include/linux/filter.h | 2 - include/uapi/linux/bpf.h | 28 kernel/bpf/s

<    1   2   3   4   5   6   7   8   >