[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200522012034.sufpu7e62itcn2vg@ast-mbp.dhcp.thefacebook.com>
Date: Thu, 21 May 2020 18:20:34 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Andrii Nakryiko <andriin@...com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org, ast@...com,
daniel@...earbox.net, andrii.nakryiko@...il.com,
kernel-team@...com, "Paul E . McKenney" <paulmck@...nel.org>,
Jonathan Lemon <jonathan.lemon@...il.com>
Subject: Re: [PATCH v2 bpf-next 5/7] selftests/bpf: add BPF ringbuf selftests
On Sun, May 17, 2020 at 12:57:25PM -0700, Andrii Nakryiko wrote:
> diff --git a/tools/testing/selftests/bpf/progs/test_ringbuf_multi.c b/tools/testing/selftests/bpf/progs/test_ringbuf_multi.c
> new file mode 100644
> index 000000000000..7eb85dd9cd66
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/test_ringbuf_multi.c
> @@ -0,0 +1,77 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright (c) 2019 Facebook
oops ;)
> +
> +#include <linux/bpf.h>
> +#include <bpf/bpf_helpers.h>
> +
> +char _license[] SEC("license") = "GPL";
> +
> +struct sample {
> + int pid;
> + int seq;
> + long value;
> + char comm[16];
> +};
> +
> +struct ringbuf_map {
> + __uint(type, BPF_MAP_TYPE_RINGBUF);
> + __uint(max_entries, 1 << 12);
> +} ringbuf1 SEC(".maps"),
> + ringbuf2 SEC(".maps");
> +
> +struct {
> + __uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS);
> + __uint(max_entries, 4);
> + __type(key, int);
> + __array(values, struct ringbuf_map);
> +} ringbuf_arr SEC(".maps") = {
> + .values = {
> + [0] = &ringbuf1,
> + [2] = &ringbuf2,
> + },
> +};
the tests look great. Very easy to understand the usage model.
Powered by blists - more mailing lists