aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests
diff options
context:
space:
mode:
authorToke Høiland-Jørgensen <toke@redhat.com>2019-07-26 18:06:58 +0200
committerAlexei Starovoitov <ast@kernel.org>2019-07-29 13:50:48 -0700
commit1375dc4a4579d5e767dd8c2d2abcd929ff59d0a7 (patch)
treebb73276e8395f7b22d4e1095fb5ec1f6e27b6c3c /tools/testing/selftests
parenttools/libbpf_probes: Add new devmap_hash type (diff)
downloadlinux-dev-1375dc4a4579d5e767dd8c2d2abcd929ff59d0a7.tar.xz
linux-dev-1375dc4a4579d5e767dd8c2d2abcd929ff59d0a7.zip
tools: Add definitions for devmap_hash map type
This adds selftest and bpftool updates for the devmap_hash map type. Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Acked-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests')
-rw-r--r--tools/testing/selftests/bpf/test_maps.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
index 5443b9bd75ed..e1f1becda529 100644
--- a/tools/testing/selftests/bpf/test_maps.c
+++ b/tools/testing/selftests/bpf/test_maps.c
@@ -508,6 +508,21 @@ static void test_devmap(unsigned int task, void *data)
close(fd);
}
+static void test_devmap_hash(unsigned int task, void *data)
+{
+ int fd;
+ __u32 key, value;
+
+ fd = bpf_create_map(BPF_MAP_TYPE_DEVMAP_HASH, sizeof(key), sizeof(value),
+ 2, 0);
+ if (fd < 0) {
+ printf("Failed to create devmap_hash '%s'!\n", strerror(errno));
+ exit(1);
+ }
+
+ close(fd);
+}
+
static void test_queuemap(unsigned int task, void *data)
{
const int MAP_SIZE = 32;
@@ -1684,6 +1699,7 @@ static void run_all_tests(void)
test_arraymap_percpu_many_keys();
test_devmap(0, NULL);
+ test_devmap_hash(0, NULL);
test_sockmap(0, NULL);
test_map_large();