Re: [PATCH bpf-next 2/2] selftests/bpf: add inline assembly helpers to access array elements

From: Andrii Nakryiko
Date: Wed Jan 03 2024 - 16:21:39 EST


On Wed, Jan 3, 2024 at 12:06 PM Barret Rhoden <brho@xxxxxxxxxx> wrote:
>
> On 1/3/24 14:51, Andrii Nakryiko wrote:
> > I'm curious how bpf_cmp_likely/bpf_cmp_unlikely (just applied to
> > bpf-next) compares to this?
>
> these work great!
>
> e.g.
>
> if (bpf_cmp_likely(idx, <, NR_MAP_ELEMS))
> map_elems[idx] = i;
>
> works fine. since that's essentially the code that bpf_array_elem() was
> trying to replace, i'd rather just use the new bpf_cmp helpers than have
> the special array_elem helpers.

ok, cool, thanks for checking! The less special macros, the better.

>
> thanks,
>
> barret
>
>