]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Fix ring_buffer__poll() to return number of consumed samples
authorAndrii Nakryiko <andrii@kernel.org>
Mon, 30 Nov 2020 22:33:35 +0000 (14:33 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 2 Dec 2020 04:21:45 +0000 (20:21 -0800)
commit8cbe2e40fd938ae617148334eb0b4f7b6a9946f5
tree8ac1c6128617881180417463ec9ac139bf4a80c8
parent4743f10a907d8abdfa0eb102a15d64f62362e1ba
libbpf: Fix ring_buffer__poll() to return number of consumed samples

Fix ring_buffer__poll() to return the number of non-discarded records
consumed, just like its documentation states. It's also consistent with
ring_buffer__consume() return. Fix up selftests with wrong expected results.

Fixes: 56ad61d8aa95 ("libbpf: Add BPF ring buffer support")
Fixes: b7d03ba86d3a ("selftests/bpf: Add BPF ringbuf selftests")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201130223336.904192-1-andrii@kernel.org
tools/lib/bpf/ringbuf.c
tools/testing/selftests/bpf/prog_tests/ringbuf.c
tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c