Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: alexei.starovoitov@gmail.com, daniel@iogearbox.net
Cc: oss-drivers@netronome.com, netdev@vger.kernel.org,
	Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCH bpf-next 00/11] tools: bpf: extend bpftool prog load
Date: Tue,  3 Jul 2018 19:54:06 -0700	[thread overview]
Message-ID: <20180704025417.8848-1-jakub.kicinski@netronome.com> (raw)

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

             reply	other threads:[~2018-07-04  2:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-04  2:54 Jakub Kicinski [this message]
2018-07-04  2:54 ` [PATCH bpf-next 01/11] selftests/bpf: remove duplicated word from test offloads Jakub Kicinski
2018-07-04  2:54 ` [PATCH bpf-next 02/11] selftests/bpf: add Error: prefix in check_extack helper Jakub Kicinski
2018-07-04  2:54 ` [PATCH bpf-next 03/11] tools: bpftool: refactor argument parsing for prog load Jakub Kicinski
2018-07-04  2:54 ` [PATCH bpf-next 04/11] tools: bpftool: add support for loading programs for offload Jakub Kicinski
2018-07-04  2:54 ` [PATCH bpf-next 05/11] tools: libbpf: expose the prog type guessing from section name logic Jakub Kicinski
2018-07-04  2:54 ` [PATCH bpf-next 06/11] tools: bpftool: allow users to specify program type for prog load Jakub Kicinski
2018-07-04  2:54 ` [PATCH bpf-next 07/11] tools: libbpf: recognize offload neutral maps Jakub Kicinski
2018-07-04  2:54 ` [PATCH bpf-next 08/11] tools: libbpf: add extended attributes version of bpf_object__open() Jakub Kicinski
2018-07-04  2:54 ` [PATCH bpf-next 09/11] tools: bpftool: reimplement bpf_prog_load() for prog load Jakub Kicinski
2018-07-04  2:54 ` [PATCH bpf-next 10/11] tools: libbpf: allow map reuse Jakub Kicinski
2018-07-04  2:54 ` [PATCH bpf-next 11/11] tools: bpftool: allow reuse of maps with bpftool prog load Jakub Kicinski
2018-07-05  8:35   ` Daniel Borkmann
2018-07-05 22:57     ` Jakub Kicinski
2018-07-06  7:16       ` Daniel Borkmann
2018-07-06 15:30         ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180704025417.8848-1-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox