Re: [PATCH bpf-next v2] selftests/bpf: test access to ringbuf position with map pointer
From: Menglong Dong
Date: Tue Mar 24 2026 - 05:33:21 EST
On 2026/3/24 10:53 Leon Hwang <leon.hwang@xxxxxxxxx> write:
> On 23/3/26 10:18, Menglong Dong wrote:
> > Add the testing to access the bpf_ringbuf with the map pointer.
> > "consumer_pos" and "producer_pos" is accessed in this testing. We reserve
> > 128 bytes in the ringbuf to test the producer_pos, which should be
> > "128 + 8", and the "8" is BPF_RINGBUF_HDR_SZ.
> >
> > It will be helpful if we want to evaluate the usage of the ringbuf in bpf
> > prog with the consumer and producer position.
> >
>
> 128 is a plain test for ringbuf, like those in
> ringbuf_overwrite_mode_subtest().
>
> The reserved size can be 0; however, a test for it is missing. It would
> be better to add a test against 0-size here or there.
>
> > Signed-off-by: Menglong Dong <dongml2@xxxxxxxxxxxxxxx>
> > Reviewed-by: Emil Tsalapatis <emil@xxxxxxxxxxxxxxx>
>
> Acked-by: Leon Hwang <leon.hwang@xxxxxxxxx>
>
> One nit below.
>
> > ---
[...]
> > +
>
> NIT: Use BPF_RINGBUF_HDR_SZ directly. Is it missing in vmlinux.h?
Yeah, it is available in vmlinux.h, I should use it directly. I'll
respin a V3.
Thanks!
Menglong Dong
>
> Thanks,
> Leon
>
> > return 1;
> > }
> >
>
>
>