Commit 7b3a0638 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Daniel Borkmann
Browse files

selftests/bpf: Test libbpf's ringbuf size fix up logic



Make sure we always excercise libbpf's ringbuf map size adjustment logic
by specifying non-zero size that's definitely not a page size multiple.

Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220509004148.1801791-10-andrii@kernel.org
parent 0087a681
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -50,18 +50,6 @@ void test_ringbuf_multi(void)
	if (CHECK(!skel, "skel_open", "skeleton open failed\n"))
		return;

	err = bpf_map__set_max_entries(skel->maps.ringbuf1, page_size);
	if (CHECK(err != 0, "bpf_map__set_max_entries", "bpf_map__set_max_entries failed\n"))
		goto cleanup;

	err = bpf_map__set_max_entries(skel->maps.ringbuf2, page_size);
	if (CHECK(err != 0, "bpf_map__set_max_entries", "bpf_map__set_max_entries failed\n"))
		goto cleanup;

	err = bpf_map__set_max_entries(bpf_map__inner_map(skel->maps.ringbuf_arr), page_size);
	if (CHECK(err != 0, "bpf_map__set_max_entries", "bpf_map__set_max_entries failed\n"))
		goto cleanup;

	proto_fd = bpf_map_create(BPF_MAP_TYPE_RINGBUF, NULL, 0, 0, page_size, NULL);
	if (CHECK(proto_fd < 0, "bpf_map_create", "bpf_map_create failed\n"))
		goto cleanup;
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@ struct sample {

struct ringbuf_map {
	__uint(type, BPF_MAP_TYPE_RINGBUF);
	/* libbpf will adjust to valid page size */
	__uint(max_entries, 1000);
} ringbuf1 SEC(".maps"),
  ringbuf2 SEC(".maps");