netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next v3 00/13] tools: bpf: extend bpftool prog load
@ 2018-07-10 21:42 Jakub Kicinski
  2018-07-10 21:42 ` [PATCH bpf-next v3 01/13] selftests/bpf: remove duplicated word from test offloads Jakub Kicinski
                   ` (13 more replies)
  0 siblings, 14 replies; 23+ messages in thread
From: Jakub Kicinski @ 2018-07-10 21:42 UTC (permalink / raw)
  To: alexei.starovoitov, daniel, Andrey Ignatov
  Cc: oss-drivers, netdev, Jakub Kicinski

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2018-07-14  1:33 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-10 21:42 [PATCH bpf-next v3 00/13] tools: bpf: extend bpftool prog load Jakub Kicinski
2018-07-10 21:42 ` [PATCH bpf-next v3 01/13] selftests/bpf: remove duplicated word from test offloads Jakub Kicinski
2018-07-10 21:42 ` [PATCH bpf-next v3 02/13] selftests/bpf: add Error: prefix in check_extack helper Jakub Kicinski
2018-07-10 21:42 ` [PATCH bpf-next v3 03/13] tools: bpftool: refactor argument parsing for prog load Jakub Kicinski
2018-07-10 21:42 ` [PATCH bpf-next v3 04/13] tools: bpftool: add support for loading programs for offload Jakub Kicinski
2018-07-10 21:42 ` [PATCH bpf-next v3 05/13] tools: libbpf: expose the prog type guessing from section name logic Jakub Kicinski
2018-07-11  3:01   ` Andrey Ignatov
2018-07-10 21:43 ` [PATCH bpf-next v3 06/13] tools: bpftool: allow users to specify program type for prog load Jakub Kicinski
2018-07-10 21:43 ` [PATCH bpf-next v3 07/13] tools: libbpf: recognize offload neutral maps Jakub Kicinski
2018-07-10 21:43 ` [PATCH bpf-next v3 08/13] tools: libbpf: add extended attributes version of bpf_object__open() Jakub Kicinski
2018-07-11  3:03   ` Andrey Ignatov
2018-07-10 21:43 ` [PATCH bpf-next v3 09/13] tools: bpftool: reimplement bpf_prog_load() for prog load Jakub Kicinski
2018-07-10 21:43 ` [PATCH bpf-next v3 10/13] tools: libbpf: move library error code into a separate file Jakub Kicinski
2018-07-10 21:43 ` [PATCH bpf-next v3 11/13] tools: bpf: make use of reallocarray Jakub Kicinski
2018-07-13 23:53   ` [bpf-next,v3,11/13] " Guenter Roeck
2018-07-14  0:07     ` Jakub Kicinski
2018-07-14  0:31       ` Guenter Roeck
2018-07-14  1:16         ` Jakub Kicinski
2018-07-10 21:43 ` [PATCH bpf-next v3 12/13] tools: libbpf: allow map reuse Jakub Kicinski
2018-07-11  3:45   ` Andrey Ignatov
2018-07-11  4:53     ` Jakub Kicinski
2018-07-10 21:43 ` [PATCH bpf-next v3 13/13] tools: bpftool: allow reuse of maps with bpftool prog load Jakub Kicinski
2018-07-11 20:18 ` [PATCH bpf-next v3 00/13] tools: bpf: extend " Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).