[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0d9f51e9-7e07-48dd-bf18-ea28ab6b1e83@google.com>
Date: Thu, 4 Jan 2024 16:37:21 -0500
From: Barret Rhoden <brho@...gle.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.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 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.
>> + 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