On Fri, Sep 17, 2021 at 9:10 AM Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote: > > On Wed, Sep 15, 2021 at 9:17 PM Yonghong Song <yhs@xxxxxx> wrote: > > > > > > > > On 9/15/21 6:58 PM, Andrii Nakryiko wrote: > > > Allow to use bpf_program__set_attach_target to only set target attach > > > program FD, while letting libbpf to use target attach function name from > > > SEC() definition. This might be useful for some scenarios where > > > bpf_object contains multiple related freplace BPF programs intended to > > > replace different sub-programs in target BPF program. In such case all > > > programs will have the same attach_prog_fd, but different > > > attach_func_name. It's conveninent to specify such target function names > > > > typo: conveninent => convenient > > > > > declaratively in SEC() definitions, but attach_prog_fd is a dynamic > > > runtime setting. > > > > > > To simplify such scenario, allow bpf_program__set_attach_target() to > > > delay BTF ID resolution till the BPF program load time by providing NULL > > > attach_func_name. In that case the behavior will be similar to using > > > bpf_object_open_opts.attach_prog_fd (which is marked deprecated since > > > v0.7), but has the benefit of allowing more control by user in what is > > > attached to what. Such setup allows having BPF programs attached to > > > different target attach_prog_fd with target funtions still declaratively > > Applied with "conveninent" and "funtions" typos fixed. Thanks!