[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180704025417.8848-1-jakub.kicinski@netronome.com>
Date: Tue, 3 Jul 2018 19:54:06 -0700
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: alexei.starovoitov@...il.com, daniel@...earbox.net
Cc: oss-drivers@...ronome.com, netdev@...r.kernel.org,
Jakub Kicinski <jakub.kicinski@...ronome.com>
Subject: [PATCH bpf-next 00/11] tools: bpf: extend bpftool prog load
Hi!
This series starts with two minor clean ups to test_offload.py
selftest script.
The next 9 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
---
This set needs a net-next -> bpf-next merge back, which I believe is
imminent. It should not conflict with Okash's work on BTF.
Jakub Kicinski (11):
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: allow map reuse
tools: bpftool: allow reuse of maps with bpftool prog load
.../bpftool/Documentation/bpftool-prog.rst | 33 ++-
tools/bpf/bpftool/bash-completion/bpftool | 96 ++++++-
tools/bpf/bpftool/main.h | 18 ++
tools/bpf/bpftool/map.c | 4 +-
tools/bpf/bpftool/prog.c | 245 +++++++++++++++++-
tools/lib/bpf/libbpf.c | 107 ++++++--
tools/lib/bpf/libbpf.h | 11 +
tools/testing/selftests/bpf/test_offload.py | 10 +-
8 files changed, 476 insertions(+), 48 deletions(-)
--
2.17.1
Powered by blists - more mailing lists