]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
libbpf: Support resizable hashtable
authorMykyta Yatsenko <yatsenko@meta.com>
Fri, 5 Jun 2026 11:41:25 +0000 (04:41 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 5 Jun 2026 15:00:08 +0000 (08:00 -0700)
Add BPF_MAP_TYPE_RHASH to libbpf's map type name table and feature
probing so that libbpf-based tools can create and identify resizable
hash maps.

Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Link: https://lore.kernel.org/r/20260605-rhash-v7-8-5b8e05f8630d@meta.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf_probes.c

index ab2071fdd3e8b39a1f5215c0e14052568f2da72b..1354bcbc8b30ae5daa92f124e08bd9de39daa606 100644 (file)
@@ -192,6 +192,7 @@ static const char * const map_type_name[] = {
        [BPF_MAP_TYPE_CGRP_STORAGE]             = "cgrp_storage",
        [BPF_MAP_TYPE_ARENA]                    = "arena",
        [BPF_MAP_TYPE_INSN_ARRAY]               = "insn_array",
+       [BPF_MAP_TYPE_RHASH]                    = "rhash",
 };
 
 static const char * const prog_type_name[] = {
index b70d9637ecf5dbcaf142a0e595c049fcb7682f58..e40819465ddc704148910c94416dbf792c020462 100644 (file)
@@ -309,6 +309,9 @@ static int probe_map_create(enum bpf_map_type map_type)
                value_size      = sizeof(__u64);
                opts.map_flags  = BPF_F_NO_PREALLOC;
                break;
+       case BPF_MAP_TYPE_RHASH:
+               opts.map_flags  = BPF_F_NO_PREALLOC;
+               break;
        case BPF_MAP_TYPE_CGROUP_STORAGE:
        case BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE:
                key_size        = sizeof(struct bpf_cgroup_storage_key);