Re: [PATCH bpf-next 1/3] libbpf: xsk: use bpf_link
From: Magnus Karlsson <hidden>
Date: 2021-02-17 07:17:20
Also in:
bpf
On Wed, Feb 17, 2021 at 3:26 AM Dan Siemon [off-list ref] wrote:
On Mon, 2021-02-15 at 22:38 +0100, Toke Høiland-Jørgensen wrote:quoted
The idea is to keep libbpf focused on bpf, and move the AF_XDP stuff to libxdp (so the socket stuff in xsk.h). We're adding the existing code wholesale, and keeping API compatibility during the move, so all that's needed is adding -lxdp when compiling. And obviously the existing libbpf code isn't going anywhere until such a time as there's a general backwards compatibility-breaking deprecation in libbpf (which I believe Andrii is planning to do in an upcoming and as-of-yet unannounced v1.0 release).I maintain a Rust binding to the AF_XDP parts of libbpf [1][2]. On the chance that more significant changes can be entertained in the switch to libxdp... The fact that many required functions like the ring access functions exist only in xsk.h makes building a binding more difficult because we need to wrap it with an extra C function [3]. From that perspective, it would be great if those could move to xsk.c.
The only reason they were put in xsk.h is performance. But with LTO (link-time optimizations) being present in most C-compilers these days, it might not be a valid argument anymore. I will perform some experiments and let you know. As you say, it would be much nicer to hide away these functions in the library proper and make your life easier.
[1] - https://github.com/aterlo/afxdp-rs [2] - https://github.com/alexforster/libbpf-sys [3] - https://github.com/alexforster/libbpf-sys/blob/master/bindings.c