summaryrefslogtreecommitdiffstats
path: root/tools/bpf/bpftool/map.c
diff options
context:
space:
mode:
authorStanislav Fomichev <sdf@google.com>2019-01-16 20:10:03 +0100
committerDaniel Borkmann <daniel@iogearbox.net>2019-01-17 10:30:31 +0100
commit549d4d3da7c4a75c25ea2726223ab96a1eeb135f (patch)
tree0e9311833bba261a792a79059e21fd7c63ede121 /tools/bpf/bpftool/map.c
parentbpftool: add peek command (diff)
downloadlinux-549d4d3da7c4a75c25ea2726223ab96a1eeb135f.tar.xz
linux-549d4d3da7c4a75c25ea2726223ab96a1eeb135f.zip
bpftool: add push and enqueue commands
This is intended to be used with queues and stacks and be more user-friendly than 'update' without the key. Example: bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q bpftool map push pinned /sys/fs/bpf/q value 0 1 2 3 bpftool map peek pinned /sys/fs/bpf/q value: 00 01 02 03 bpftool map create /sys/fs/bpf/s type stack value 4 entries 10 name s bpftool map enqueue pinned /sys/fs/bpf/s value 0 1 2 3 bpftool map peek pinned /sys/fs/bpf/s value: 00 01 02 03 Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to '')
-rw-r--r--tools/bpf/bpftool/map.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index d7344fcd2089..6b5fcbe2d9d4 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -1169,6 +1169,8 @@ static int do_help(int argc, char **argv)
" %s %s pin MAP FILE\n"
" %s %s event_pipe MAP [cpu N index M]\n"
" %s %s peek MAP\n"
+ " %s %s push MAP value VALUE\n"
+ " %s %s enqueue MAP value VALUE\n"
" %s %s help\n"
"\n"
" " HELP_SPEC_MAP "\n"
@@ -1186,7 +1188,8 @@ static int do_help(int argc, char **argv)
bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
- bin_name, argv[-2], bin_name, argv[-2]);
+ bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
+ bin_name, argv[-2]);
return 0;
}
@@ -1204,6 +1207,8 @@ static const struct cmd cmds[] = {
{ "event_pipe", do_event_pipe },
{ "create", do_create },
{ "peek", do_lookup },
+ { "push", do_update },
+ { "enqueue", do_update },
{ 0 }
};