From: Andrii Nakryiko <andriin@fb.com>
To: Joanne Koong <joannekoong@fb.com>, <bpf@vger.kernel.org>
Cc: <Kernel-team@fb.com>, <andrii@kernel.org>
Subject: Re: [PATCH v5 bpf-next 3/5] selftests/bpf: Add bloom filter map test cases
Date: Tue, 26 Oct 2021 20:35:05 -0700 [thread overview]
Message-ID: <003cb6df-a076-16ef-832a-dbb140a063a1@fb.com> (raw)
In-Reply-To: <20211022220249.2040337-4-joannekoong@fb.com>
On 10/22/21 3:02 PM, Joanne Koong wrote:
> This patch adds test cases for bpf bloom filter maps. They include tests
> checking against invalid operations by userspace, tests for using the
> bloom filter map as an inner map, and a bpf program that queries the
> bloom filter map for values added by a userspace program.
>
> Signed-off-by: Joanne Koong <joannekoong@fb.com>
> ---
> .../bpf/prog_tests/bloom_filter_map.c | 204 ++++++++++++++++++
> .../selftests/bpf/progs/bloom_filter_map.c | 82 +++++++
> 2 files changed, 286 insertions(+)
> create mode 100644 tools/testing/selftests/bpf/prog_tests/bloom_filter_map.c
> create mode 100644 tools/testing/selftests/bpf/progs/bloom_filter_map.c
>
[...]
> diff --git a/tools/testing/selftests/bpf/progs/bloom_filter_map.c b/tools/testing/selftests/bpf/progs/bloom_filter_map.c
> new file mode 100644
> index 000000000000..7f72102ea6a7
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/bloom_filter_map.c
> @@ -0,0 +1,82 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2021 Facebook */
> +
> +#include <linux/bpf.h>
> +#include <bpf/bpf_helpers.h>
> +
> +char _license[] SEC("license") = "GPL";
> +
> +struct bpf_map;
> +
> +struct {
> + __uint(type, BPF_MAP_TYPE_ARRAY);
> + __uint(max_entries, 1000);
> + __type(key, __u32);
> + __type(value, __u32);
> +} map_random_data SEC(".maps");
> +
> +struct map_bloom_type {
> + __uint(type, BPF_MAP_TYPE_BLOOM_FILTER);
> + __uint(value_size, sizeof(__u32));
you should be able to use __type(value, __u32); no? let's do that to
confirm that kernel accepts it (please check that there are no warnings
from libbpf about retrying without BTF)
> + __uint(max_entries, 10000);
> + __uint(map_extra, 5);
> +} map_bloom SEC(".maps");
> +
> +struct {
> + __uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS);
> + __uint(max_entries, 1);
> + __uint(key_size, sizeof(int));
> + __uint(value_size, sizeof(int));
this should also work with __type(key, int) and __type(value, int),
we've added logic to libbpf recently that takes care of this (see a big
switch inside bpf_object__create_map()).
> + __array(values, struct map_bloom_type);
> +} outer_map SEC(".maps");
> +
[...]
next prev parent reply other threads:[~2021-10-27 3:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-22 22:02 [PATCH v5 bpf-next 0/5] Implement bloom filter map Joanne Koong
2021-10-22 22:02 ` [PATCH v5 bpf-next 1/5] bpf: Add bloom filter map implementation Joanne Koong
2021-10-26 0:43 ` Martin KaFai Lau
2021-10-26 19:47 ` Joanne Koong
2021-10-27 3:18 ` Andrii Nakryiko
2021-10-27 19:13 ` Joanne Koong
2021-10-27 19:16 ` Andrii Nakryiko
2021-10-22 22:02 ` [PATCH v5 bpf-next 2/5] libbpf: Add "map_extra" as a per-map-type extra flag Joanne Koong
2021-10-26 1:31 ` Martin KaFai Lau
2021-10-27 3:30 ` Andrii Nakryiko
2021-10-27 18:39 ` Joanne Koong
2021-10-27 18:41 ` Andrii Nakryiko
2021-10-22 22:02 ` [PATCH v5 bpf-next 3/5] selftests/bpf: Add bloom filter map test cases Joanne Koong
2021-10-27 3:35 ` Andrii Nakryiko [this message]
2021-10-22 22:02 ` [PATCH v5 bpf-next 4/5] bpf/benchs: Add benchmark tests for bloom filter throughput + false positive Joanne Koong
2021-10-27 3:49 ` Andrii Nakryiko
2021-10-22 22:02 ` [PATCH v5 bpf-next 5/5] bpf/benchs: Add benchmarks for comparing hashmap lookups w/ vs. w/out bloom filter Joanne Koong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=003cb6df-a076-16ef-832a-dbb140a063a1@fb.com \
--to=andriin@fb.com \
--cc=Kernel-team@fb.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=joannekoong@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).