Subject: Re: [PATCH bpf-next v3 03/12] bpf: XDP metadata RX kfuncs

From: Jakub Kicinski <[email-masked]>
Date: Thu, 8 Dec 2022 17:30:53 -0800

On Thu, 8 Dec 2022 11:07:43 -0800 Stanislav Fomichev wrote:
> > >       bpf_free_used_maps(aux);
> > >       bpf_free_used_btfs(aux);
> > > -     if (bpf_prog_is_offloaded(aux))
> > > +     if (bpf_prog_is_dev_bound(aux))
> > >               bpf_prog_offload_destroy(aux->prog);  
> >
> > This also looks a touch like a mix of terms (condition vs function
> > called).  
> 
> Here, not sure, open to suggestions. These
> bpf_prog_offload_init/bpf_prog_offload_destroy are generic enough
> (now) that I'm calling them for both dev_bound/offloaded.
> 
> The following paths trigger for both offloaded/dev_bound cases:
> 
> if (bpf_prog_is_dev_bound()) bpf_prog_offload_init();
> if (bpf_prog_is_dev_bound()) bpf_prog_offload_destroy();
> 
> Do you think it's worth it having completely separate
> dev_bound/offloaded paths? Or, alternatively, can rename to
> bpf_prog_dev_bound_{init,destroy} but still handle both cases?

Any offload should be bound, right? So I think functions which handle
both can use the bound naming scheme, only the offload-specific ones 
should explicitly use offload?