From: Roman Gushchin <guro@fb.com>
To: <netdev@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <kernel-team@fb.com>,
<ast@kernel.org>, <daniel@iogearbox.net>,
<jakub.kicinski@netronome.com>, <kafai@fb.com>, <guro@fb.com>,
Quentin Monnet <quentin.monnet@netronome.com>,
David Ahern <dsahern@gmail.com>
Subject: [PATCH v4 net-next 0/4] bpftool: cgroup bpf operations
Date: Wed, 13 Dec 2017 15:18:50 +0000 [thread overview]
Message-ID: <20171213151854.21960-1-guro@fb.com> (raw)
This patchset adds basic cgroup bpf operations to bpftool.
Right now there is no convenient way to perform these operations.
The /samples/bpf/load_sock_ops.c implements attach/detacg operations,
but only for BPF_CGROUP_SOCK_OPS programs. Bps (part of bcc) implements
bpf introspection, but lacks any cgroup-related specific.
I find having a tool to perform these basic operations in the kernel tree
very useful, as it can be used in the corresponding bpf documentation
without creating additional dependencies. And bpftool seems to be
a right tool to extend with such functionality.
v4:
- ATTACH_FLAGS and ATTACH_TYPE are listed and described in docs and usage
- ATTACH_FLAG names converted to "multi" and "override"
- do_attach() recognizes ATTACH_FLAG abbreviations, e.g "mul"
- Local variables sorted ("reverse Christmas tree")
- unknown attach flags value will be never truncated
v3:
- SRC replaced with OBJ in prog load docs
- Output unknown attach type in hex
- License header in SPDX format
- Minor style fixes (e.g. variable reordering)
v2:
- Added prog load operations
- All cgroup operations are looking like bpftool cgroup <command>
- All cgroup-related stuff is moved to a separate file
- Added support for attach flags
- Added support for attaching/detaching programs by id, pinned name, etc
- Changed cgroup detach arguments order
- Added empty json output for succesful programs
- Style fixed: includes order, strncmp and macroses, error handling
- Added man pages
v1:
https://lwn.net/Articles/740366/
Roman Gushchin (4):
libbpf: add ability to guess program type based on section name
libbpf: prefer global symbols as bpf program name source
bpftool: implement prog load command
bpftool: implement cgroup bpf operations
tools/bpf/bpftool/Documentation/bpftool-cgroup.rst | 118 ++++++++
tools/bpf/bpftool/Documentation/bpftool-map.rst | 2 +-
tools/bpf/bpftool/Documentation/bpftool-prog.rst | 12 +-
tools/bpf/bpftool/Documentation/bpftool.rst | 8 +-
tools/bpf/bpftool/cgroup.c | 307 +++++++++++++++++++++
tools/bpf/bpftool/common.c | 71 ++---
tools/bpf/bpftool/main.c | 3 +-
tools/bpf/bpftool/main.h | 2 +
tools/bpf/bpftool/prog.c | 29 +-
tools/lib/bpf/libbpf.c | 53 ++++
10 files changed, 566 insertions(+), 39 deletions(-)
create mode 100644 tools/bpf/bpftool/Documentation/bpftool-cgroup.rst
create mode 100644 tools/bpf/bpftool/cgroup.c
--
2.14.3
next reply other threads:[~2017-12-13 15:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 15:18 Roman Gushchin [this message]
2017-12-13 15:18 ` [PATCH v4 net-next 1/4] libbpf: add ability to guess program type based on section name Roman Gushchin
2017-12-13 15:18 ` [PATCH v4 net-next 2/4] libbpf: prefer global symbols as bpf program name source Roman Gushchin
2017-12-13 15:18 ` [PATCH v4 net-next 3/4] bpftool: implement prog load command Roman Gushchin
2017-12-13 15:18 ` [PATCH v4 net-next 4/4] bpftool: implement cgroup bpf operations Roman Gushchin
2017-12-13 16:13 ` David Ahern
2017-12-13 22:12 ` Jakub Kicinski
2017-12-14 12:22 ` [PATCH v4 net-next 0/4] bpftool: " Quentin Monnet
2017-12-14 12:45 ` Daniel Borkmann
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=20171213151854.21960-1-guro@fb.com \
--to=guro@fb.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=dsahern@gmail.com \
--cc=jakub.kicinski@netronome.com \
--cc=kafai@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=quentin.monnet@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
all inboxes | Powered by JetHome®