[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180710214307.4834-1-jakub.kicinski@netronome.com>
Date: Tue, 10 Jul 2018 14:42:54 -0700
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: alexei.starovoitov@...il.com, daniel@...earbox.net,
Andrey Ignatov <rdna@...com>
Cc: oss-drivers@...ronome.com, netdev@...r.kernel.org,
Jakub Kicinski <jakub.kicinski@...ronome.com>
Subject: [PATCH bpf-next v3 00/13] tools: bpf: extend bpftool prog load
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().
Jakub Kicinski (13):
selftests/bpf: remove duplicated word from test offloads
selftests/bpf: add Error: prefix in check_extack helper
tools: bpftool: refactor argument parsing for prog load
tools: bpftool: add support for loading programs for offload
tools: libbpf: expose the prog type guessing from section name logic
tools: bpftool: allow users to specify program type for prog load
tools: libbpf: recognize offload neutral maps
tools: libbpf: add extended attributes version of bpf_object__open()
tools: bpftool: reimplement bpf_prog_load() for prog load
tools: libbpf: move library error code into a separate file
tools: bpf: make use of reallocarray
tools: libbpf: allow map reuse
tools: bpftool: allow reuse of maps with bpftool prog load
.../bpftool/Documentation/bpftool-prog.rst | 33 ++-
tools/bpf/bpftool/Makefile | 6 +-
tools/bpf/bpftool/bash-completion/bpftool | 96 +++++-
tools/bpf/bpftool/main.h | 19 ++
tools/bpf/bpftool/map.c | 4 +-
tools/bpf/bpftool/prog.c | 245 ++++++++++++++-
tools/bpf/bpftool/xlated_dumper.c | 6 +-
tools/build/feature/Makefile | 4 +
tools/build/feature/test-reallocarray.c | 8 +
tools/include/linux/compiler-gcc.h | 4 +
tools/include/linux/overflow.h | 278 ++++++++++++++++++
tools/include/tools/libc_compat.h | 20 ++
tools/lib/bpf/Build | 2 +-
tools/lib/bpf/Makefile | 6 +-
tools/lib/bpf/libbpf.c | 188 +++++++-----
tools/lib/bpf/libbpf.h | 11 +
tools/lib/bpf/libbpf_errno.c | 74 +++++
tools/testing/selftests/bpf/test_offload.py | 10 +-
18 files changed, 906 insertions(+), 108 deletions(-)
create mode 100644 tools/build/feature/test-reallocarray.c
create mode 100644 tools/include/linux/overflow.h
create mode 100644 tools/include/tools/libc_compat.h
create mode 100644 tools/lib/bpf/libbpf_errno.c
--
2.17.1
Powered by blists - more mailing lists