XDP - bpf_program__attach_xdp() missing options?

Alasdair McWilliam <[email protected]> Thu, 6 Jun 2024 16:39:05 +0000
Newsgroups org.kernel.vger.xdp-newbies
Message-ID <AS8P194MB2042B7542EBB198002E31F7386FA2@AS8P194MB2042.EURP194.PROD.OUTLOOK.COM>
Hello,=0A=
=0A=
I am in the process of refactoring/refreshing an internal system that heavi=
ly uses libbpf/libxdp - and taking the time to refresh API usage.=0A=
=0A=
Previously we've used the bpf_xdp_attach() API to attach an XDP program to =
a device, and in doing so we can specify XDP mode flags etc.=0A=
=0A=
I've noticed a general shift towards use of bpf_link infrastructure, and be=
hold there is an API to link XDP programs to a NIC: bpf_program__attach_xdp=
(), which looks to just proxy to the internal bpf_program_attach_fd() routi=
ne.=0A=
=0A=
While the internal implementation looks to support passing of link options =
via flags, the higher level XDP API simply passes NULL into the opts parame=
ter, so the link creation flags will default to zero. But then, when chasin=
g through the syscall into the kernel, it does look like link mode flags ar=
e supported within the kernel and it would do the right thing.=0A=
=0A=
I'm wondering if the lack of flags/options in bpf_program__attach_xdp() API=
 is just an oversight, or if I'm missing something - would someone be able =
to confirm my thoughts?=0A=
=0A=
If so I'll stick to bpf_xdp_attach() for now!=0A=
=0A=
Thanks=0A=
Alasdair=