From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jakub Kicinski Subject: [PATCH bpf-next 0/8] bpf: offload: report device back to user space (take 2) Date: Tue, 19 Dec 2017 20:09:58 -0800 Message-ID: <20171220041006.25629-1-jakub.kicinski@netronome.com> Cc: ktkhai@virtuozzo.com, oss-drivers@netronome.com, Jakub Kicinski To: netdev@vger.kernel.org, alexei.starovoitov@gmail.com, daniel@iogearbox.net Return-path: Received: from mail-pl0-f68.google.com ([209.85.160.68]:35505 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753632AbdLTELZ (ORCPT ); Tue, 19 Dec 2017 23:11:25 -0500 Received: by mail-pl0-f68.google.com with SMTP id b96so8318977pli.2 for ; Tue, 19 Dec 2017 20:11:25 -0800 (PST) Sender: netdev-owner@vger.kernel.org List-ID: Hi! This series is a redo of reporting offload device information to user space after the first attempt did not take into account name spaces. As requested by Kirill offloads are now protected by an r/w sem. This allows us to remove the workqueue and free the offload state fully when device is removed (suggested by Alexei). Net namespace is reported with a device/inode pair. The accompanying bpftool support is placed in common code because maps will have very similar info. Note that the UAPI information can't be nicely encapsulated into a struct, because in case we need to grow the device information the new fields will have to be added at the end of struct bpf_prog_info, we can't grow structures in the middle of bpf_prog_info. Jakub Kicinski (8): bpf: offload: don't require rtnl for dev list manipulation bpf: offload: don't use prog->aux->offload as boolean bpf: offload: allow netdev to disappear while verifier is running bpf: offload: free prog->aux->offload when device disappears bpf: offload: free program id when device disappears bpf: offload: report device information for offloaded programs tools: bpftool: report device information for offloaded programs selftests/bpf: test device info reporting for bound progs drivers/net/ethernet/netronome/nfp/bpf/main.h | 2 +- drivers/net/ethernet/netronome/nfp/bpf/verifier.c | 2 +- drivers/net/netdevsim/bpf.c | 2 +- fs/nsfs.c | 2 +- include/linux/bpf.h | 16 ++- include/linux/bpf_verifier.h | 16 +-- include/linux/netdevice.h | 4 +- include/linux/proc_ns.h | 1 + include/uapi/linux/bpf.h | 3 + kernel/bpf/offload.c | 114 ++++++++++++++++------ kernel/bpf/syscall.c | 19 +++- kernel/bpf/verifier.c | 20 ++-- tools/bpf/bpftool/common.c | 52 ++++++++++ tools/bpf/bpftool/main.h | 2 + tools/bpf/bpftool/prog.c | 3 + tools/include/uapi/linux/bpf.h | 3 + tools/testing/selftests/bpf/test_offload.py | 107 +++++++++++++++++--- 17 files changed, 287 insertions(+), 81 deletions(-) -- 2.15.1