[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEf4Bzb8RviBbC0fVMzKmoY6oU0B1v_8CrnUr1RaffPWb7SpLQ@mail.gmail.com>
Date: Thu, 4 Jan 2024 14:45:56 -0800
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Barret Rhoden <brho@...gle.com>
Cc: Andrii Nakryiko <andrii@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>, mattbobrowski@...gle.com, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: add inline assembly helpers
to access array elements
On Thu, Jan 4, 2024 at 1:37 PM Barret Rhoden <brho@...gle.com> wrote:
>
> On 1/3/24 14:51, Andrii Nakryiko wrote:
> >> +
> >> +/*
> >> + * Helper to load and run a program.
> >> + * Call must define skel, map_elems, and bss_elems.
> >> + * Destroy the skel when you're done.
> >> + */
> >> +#define load_and_run(PROG) ({
> > does this have to be a macro? Can you write it as a function?
>
> can do. (if we keep these patches).
>
> i used a macro for the ## PROG below, but i can do something with ints
> and switches to turn on the autoload for a single prog. or just
> copy-paste the boilerplate.
why can't you pass the `struct bpf_program *prog` parameter?
>
> >> + int err; \
> >> + skel = array_elem_test__open(); \
> >> + if (!ASSERT_OK_PTR(skel, "array_elem_test open")) \
> >> + return; \
> >> + bpf_program__set_autoload(skel->progs.x_ ## PROG, true); \
>
> thanks,
>
> barret
>
>
Powered by blists - more mailing lists