On Fri, Aug 12, 2022 at 4:38 PM Quentin Monnet <quentin@xxxxxxxxxxxxx> wrote: > > diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h > > index 9c50beabdd14..125c580e45f8 100644 > > --- a/tools/lib/bpf/bpf.h > > +++ b/tools/lib/bpf/bpf.h > > @@ -35,6 +35,9 @@ > > extern "C" { > > #endif > > > > +#define PROG_LOAD_ATTEMPTS 5 > > +int sys_bpf_prog_load(union bpf_attr *attr, unsigned int size, int attempts); > > + > > bpf.h is the user-facing header, should these go into libbpf_internal.h > instead? libbpf_internal.h makes more sense, I wil move it. > > + union bpf_attr attr = { > > + .prog_type = BPF_PROG_TYPE_SOCKET_FILTER, > > + .prog_name = "test", > > + .license = ptr_to_u64("GPL"), > > + .insns = ptr_to_u64(insns), > > + .insn_cnt = (__u32)ARRAY_SIZE(insns), > > + }; > > I think you cannot initialise "attr" directly, you need a "memset(&attr, > 0, sizeof(attr));" first, in case the struct contains padding between > the fields. Thanks for the reminder. I forgot the padding issue. I will post version 2. Thanks Hangbin