[PATCH v4 3/5] bpf: add a test for BPF ELF load
Stephen Hemminger
stephen at networkplumber.org
Sat Nov 8 02:08:05 CET 2025
On Fri, 7 Nov 2025 17:33:08 +0000
Marat Khalili <marat.khalili at huawei.com> wrote:
> > +/*
> > + * Test BPF function that will be loaded from ELF
> > + * This function:
> > + * 1. Reads values from input structure
> > + * 2. Performs some computations
> > + * 3. Writes results to output structure
> > + * 4. Returns sum of values
> > + */
> > +__attribute__((section("func"), used))
>
> Do we need `used` here and in other section attributes? I do not thing `clang
> -c` will eliminate non-static/inline functions from the object file, or maybe I
> don't understand the purpose (perhaps needs a comment).
>
> > +uint64_t
> > +test_func(struct dummy_vect8 *arg)
The BPF loader in DPDK uses section names as the way to find functions.
The original version of this code was autogenerated off of examples used
in kernel BPF.
More information about the dev
mailing list