From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Borkmann Subject: Re: [PATCH bpf-next v3 00/13] tools: bpf: extend bpftool prog load Date: Wed, 11 Jul 2018 22:18:14 +0200 Message-ID: <35cae017-9ccb-5bdc-c686-e1d80908d809@iogearbox.net> References: <20180710214307.4834-1-jakub.kicinski@netronome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: oss-drivers@netronome.com, netdev@vger.kernel.org To: Jakub Kicinski , alexei.starovoitov@gmail.com, Andrey Ignatov Return-path: Received: from www62.your-server.de ([213.133.104.62]:40598 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732855AbeGKUYR (ORCPT ); Wed, 11 Jul 2018 16:24:17 -0400 In-Reply-To: <20180710214307.4834-1-jakub.kicinski@netronome.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 07/10/2018 11:42 PM, Jakub Kicinski wrote: > Hi! > > This series starts with two minor clean ups to test_offload.py > selftest script. > > The next 11 patches extend the abilities of bpftool prog load > beyond the simple cgroup use cases. Three new parameters are > added: > > - type - allows specifying program type, independent of how > code sections are named; > - map - allows reusing existing maps, instead of creating a new > map on every program load; > - dev - offload/binding to a device. > > A number of changes to libbpf is required to accomplish the task. > The section - program type logic mapping is exposed. We should > probably aim to use the libbpf program section naming everywhere. > For reuse of maps we need to allow users to set FD for bpf map > object in libbpf. > > Examples > > Load program my_xdp.o and pin it as /sys/fs/bpf/my_xdp, for xdp > program type: > > $ bpftool prog load my_xdp.o /sys/fs/bpf/my_xdp \ > type xdp > > As above but for offload: > > $ bpftool prog load my_xdp.o /sys/fs/bpf/my_xdp \ > type xdp \ > dev netdevsim0 > > Load program my_maps.o, but for the first map reuse map id 17, > and for the map called "other_map" reuse pinned map /sys/fs/bpf/map0: > > $ bpftool prog load my_maps.o /sys/fs/bpf/prog \ > map idx 0 id 17 \ > map name other_map pinned /sys/fs/bpf/map0 > > --- > v3: > - fix return codes in patch 5; > - rename libbpf_prog_type_by_string() -> libbpf_prog_type_by_name(); > - fold file path into xattr in patch 8; > - add patch 10; > - use dup3() in patch 12; > - depend on fd value in patch 12; > - close old fd in patch 12. > v2: > - add compat for reallocarray(). Applied to bpf-next, thanks Jakub!