aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/bpf_iter_sockmap.c
diff options
context:
space:
mode:
authorLorenz Bauer <lmb@cloudflare.com>2020-09-28 10:08:04 +0100
committerAlexei Starovoitov <ast@kernel.org>2020-09-28 16:48:02 -0700
commit27870317337a6c24af503304620de8064c8d2e4a (patch)
treeac3c4957aae2f9d8abd3d313fe0934933d21b46c /tools/testing/selftests/bpf/progs/bpf_iter_sockmap.c
parentselftests: bpf: Add helper to compare socket cookies (diff)
downloadlinux-dev-27870317337a6c24af503304620de8064c8d2e4a.tar.xz
linux-dev-27870317337a6c24af503304620de8064c8d2e4a.zip
selftests: bpf: Remove shared header from sockmap iter test
The shared header to define SOCKMAP_MAX_ENTRIES is a bit overkill. Dynamically allocate the sock_fd array based on bpf_map__max_entries instead. Suggested-by: Yonghong Song <yhs@fb.com> Signed-off-by: Lorenz Bauer <lmb@cloudflare.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/bpf/20200928090805.23343-4-lmb@cloudflare.com
Diffstat (limited to 'tools/testing/selftests/bpf/progs/bpf_iter_sockmap.c')
-rw-r--r--tools/testing/selftests/bpf/progs/bpf_iter_sockmap.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_sockmap.c b/tools/testing/selftests/bpf/progs/bpf_iter_sockmap.c
index 0e27f73dd803..1af7555f6057 100644
--- a/tools/testing/selftests/bpf/progs/bpf_iter_sockmap.c
+++ b/tools/testing/selftests/bpf/progs/bpf_iter_sockmap.c
@@ -2,7 +2,6 @@
/* Copyright (c) 2020 Cloudflare */
#include "bpf_iter.h"
#include "bpf_tracing_net.h"
-#include "bpf_iter_sockmap.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include <errno.h>
@@ -11,14 +10,14 @@ char _license[] SEC("license") = "GPL";
struct {
__uint(type, BPF_MAP_TYPE_SOCKMAP);
- __uint(max_entries, SOCKMAP_MAX_ENTRIES);
+ __uint(max_entries, 64);
__type(key, __u32);
__type(value, __u64);
} sockmap SEC(".maps");
struct {
__uint(type, BPF_MAP_TYPE_SOCKHASH);
- __uint(max_entries, SOCKMAP_MAX_ENTRIES);
+ __uint(max_entries, 64);
__type(key, __u32);
__type(value, __u64);
} sockhash SEC(".maps");