Re: [PATCH v4 bpf-next 9/9] selftests/bpf: add batch ops testing to array bpf map

From: Andrii Nakryiko
Date: Tue Jan 14 2020 - 19:46:15 EST


On Tue, Jan 14, 2020 at 8:46 AM Brian Vazquez <brianvv@xxxxxxxxxx> wrote:
>
> Tested bpf_map_lookup_batch() and bpf_map_update_batch()
> functionality.
>
> $ ./test_maps
> ...
> test_array_map_batch_ops:PASS
> ...
>
> Signed-off-by: Brian Vazquez <brianvv@xxxxxxxxxx>
> Signed-off-by: Yonghong Song <yhs@xxxxxx>
> ---
> .../bpf/map_tests/array_map_batch_ops.c | 131 ++++++++++++++++++
> 1 file changed, 131 insertions(+)
> create mode 100644 tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c
>
> diff --git a/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c b/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c
> new file mode 100644
> index 0000000000000..05b7caea6a444
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c
> @@ -0,0 +1,131 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <stdio.h>
> +#include <errno.h>
> +#include <string.h>
> +
> +#include <bpf/bpf.h>
> +#include <bpf/libbpf.h>
> +
> +#include <test_maps.h>
> +
> +static void map_batch_update(int map_fd, __u32 max_entries, int *keys,
> + int *values)
> +{
> + int i, err;
> +
> + DECLARE_LIBBPF_OPTS(bpf_map_batch_opts, opts,

Here, below, and in other patch: DECLARE_LIBBPF_OPTS declares a local
variable, so it shouldn't be separated from all the other variable
declarations.


> + .elem_flags = 0,
> + .flags = 0,
> + );
> +

[...]