summaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/libbpf.c
diff options
context:
space:
mode:
authorStanislav Fomichev2018-11-21 02:11:20 +0100
committerDaniel Borkmann2018-11-21 23:26:04 +0100
commit94cb310cfaa16582cd49ebbeea5925e8f49324a1 (patch)
tree0e274f0cd618cb816e0432d048d1ce67cca498f8 /tools/lib/bpf/libbpf.c
parentbpf, libbpf: introduce bpf_object__probe_caps to test BPF capabilities (diff)
downloadkernel-qcow2-linux-94cb310cfaa16582cd49ebbeea5925e8f49324a1.tar.gz
kernel-qcow2-linux-94cb310cfaa16582cd49ebbeea5925e8f49324a1.tar.xz
kernel-qcow2-linux-94cb310cfaa16582cd49ebbeea5925e8f49324a1.zip
bpf: libbpf: remove map name retry from bpf_create_map_xattr
Instead, check for a newly created caps.name bpf_object capability. If kernel doesn't support names, don't specify the attribute. See commit 23499442c319 ("bpf: libbpf: retry map creation without the name") for rationale. Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/lib/bpf/libbpf.c')
-rw-r--r--tools/lib/bpf/libbpf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index dffdd68b5e6b..f28e64dd8b5a 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1211,7 +1211,8 @@ bpf_object__create_maps(struct bpf_object *obj)
continue;
}
- create_attr.name = map->name;
+ if (obj->caps.name)
+ create_attr.name = map->name;
create_attr.map_ifindex = map->map_ifindex;
create_attr.map_type = def->type;
create_attr.map_flags = def->map_flags;