libbpf missing set_link_xdp_fd ?
Hello,
bpf_load is implementing the set_link_xdp_fd() function and it seems this function is not available in libbpf.
Should it be the case or should it be part of another library ?
BR,
Signature · 2 lines
Eric Leblond <[email protected]> Blog: https://home.regit.org/
Quoted 4 lines · On Sun, 24 Sep 2017 20:07:11 +0200 Eric Leblond <[email protected]> wrote:
Hello,
bpf_loadis implementing theset_link_xdp_fd()function and it seems this function is not available in libbpf.
I also ran into this problem, when I wanted to switch my XDP programs into using tools/lib/bpf/.
E.g.: https://github.com/netoptimizer/prototype-kernel/commit/5397e596c30416763
Quoted 1 line
Should it be the case or should it be part of another library ?
I'm not sure... maybe Alexei, Daniel or Wang have an opinion?
Signature · 4 lines
Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer
Quoted 10 lines · Jesper Dangaard Brouer
Quoted 4 lines · On Sun, 24 Sep 2017 20:07:11 +0200 Eric Leblond <[email protected]> wrote:
Hello,
bpf_loadis implementing theset_link_xdp_fd()function and it seems this function is not available in libbpf.I also ran into this problem, when I wanted to switch my XDP programs into using
tools/lib/bpf/.
Right.
Quoted 5 lines
E.g.: https://github.com/netoptimizer/prototype-kernel/commit/5397e596c30416763
Quoted 1 line
Should it be the case or should it be part of another library ?
I'm not sure... maybe Alexei, Daniel or Wang have an opinion?
It seems that none of the actual attach infra is handled in tools/lib/bpf/, meaning neither attaching the fd to kprobes/ uprobes/tracepoints nor tc or xdp, so adding a special case only for xdp into the lib feels that we probably might be better off putting this either into its own mini lib on top of that, or as a small helper included in the samples / selftests and the like where its needed.
Best,
Daniel
Quoted 18 lines · Daniel Borkmann
Quoted 10 lines · Jesper Dangaard Brouer
Quoted 4 lines · On Sun, 24 Sep 2017 20:07:11 +0200 Eric Leblond <[email protected]> wrote:
Hello,
bpf_loadis implementing theset_link_xdp_fd()function and it seems this function is not available in libbpf.I also ran into this problem, when I wanted to switch my XDP programs into using
tools/lib/bpf/.Right.
Quoted 4 lines
E.g.: https://github.com/netoptimizer/prototype-kernel/commit/5397e596c30416763
Quoted 1 line
Should it be the case or should it be part of another library ?
Quoted 7 lines
Quoted 1 line
I'm not sure... maybe Alexei, Daniel or Wang have an opinion?
It seems that none of the actual attach infra is handled in
tools/lib/bpf/, meaning neither attaching the fd to kprobes/ uprobes/tracepoints nor tc or xdp, so adding a special case only for xdp into the lib feels that we probably might be better off putting this either into its own mini lib on top of that,
That could potentially go to tools/lib/xdp/, probably would be the best option.
Quoted 5 lines
or as a small helper included in the samples / selftests and the like where its needed.
Best,
Daniel
Quoted 21 lines · Daniel Borkmann
Quoted 20 lines · Daniel Borkmann
Quoted 10 lines · Jesper Dangaard Brouer
Quoted 4 lines · On Sun, 24 Sep 2017 20:07:11 +0200 Eric Leblond <[email protected]> wrote:
Hello,
bpf_loadis implementing theset_link_xdp_fd()function and it seems this function is not available in libbpf.I also ran into this problem, when I wanted to switch my XDP programs into using
tools/lib/bpf/.Right.
Quoted 5 lines
E.g.: https://github.com/netoptimizer/prototype-kernel/commit/5397e596c30416763
Quoted 1 line
Should it be the case or should it be part of another library ?
I'm not sure... maybe Alexei, Daniel or Wang have an opinion?
Quoted 8 lines
Quoted 5 lines
It seems that none of the actual attach infra is handled in
tools/lib/bpf/, meaning neither attaching the fd to kprobes/ uprobes/tracepoints nor tc or xdp, so adding a special case only for xdp into the lib feels that we probably might be better off putting this either into its own mini lib on top of that,That could potentially go to
tools/lib/xdp/, probably would be the best option.
I'm afraid it may spiral out of control.
If we create such dirs, we'd need one for xdp, tc, cgroup, tracepoint, kprobe. Differentiating the libraries by type of attach point is imo too fine grained.
Why not to put everything into toos/lib/bpf ?
New file for netlink stuff is easy enough and we can gatekeep it with some knob in the Makefile, so perf build won't need to include it.
Quoted 31 lines · Alexei Starovoitov
Quoted 21 lines · Daniel Borkmann
Quoted 20 lines · Daniel Borkmann
Quoted 10 lines · Jesper Dangaard Brouer
Quoted 4 lines · On Sun, 24 Sep 2017 20:07:11 +0200 Eric Leblond <[email protected]> wrote:
Hello,
bpf_loadis implementing theset_link_xdp_fd()function and it seems this function is not available in libbpf.I also ran into this problem, when I wanted to switch my XDP programs into using
tools/lib/bpf/.Right.
Quoted 5 lines
E.g.: https://github.com/netoptimizer/prototype-kernel/commit/5397e596c30416763
Quoted 1 line
Should it be the case or should it be part of another library ?
I'm not sure... maybe Alexei, Daniel or Wang have an opinion?
Quoted 8 lines
Quoted 5 lines
It seems that none of the actual attach infra is handled in
tools/lib/bpf/, meaning neither attaching the fd to kprobes/ uprobes/tracepoints nor tc or xdp, so adding a special case only for xdp into the lib feels that we probably might be better off putting this either into its own mini lib on top of that,That could potentially go to
tools/lib/xdp/, probably would be the best option.
Quoted 7 lines
I'm afraid it may spiral out of control.
If we create such dirs, we'd need one for xdp, tc, cgroup, tracepoint, kprobe. Differentiating the libraries by type of attach point is imo too fine grained.Why not to put everything into toos/lib/bpf ?
New file for netlink stuff is easy enough and we can gatekeep it with some knob in theMakefile, so perf build won't need to include it.
Personally, I don't really have a strong opinion on that. This could probably be made a bit modular for each attach handler with the option to compile some of them out if not desired, so could work as well.
Quoted 7 lines · Jesper Dangaard Brouer
Quoted 4 lines · On Sun, 24 Sep 2017 20:07:11 +0200 Eric Leblond <[email protected]> wrote:
Hello,
bpf_loadis implementing theset_link_xdp_fd()function and it seems this function is not available in libbpf.
Quoted 8 lines
I also ran into this problem, when I wanted to switch my XDP programs into using
tools/lib/bpf/.E.g.: https://github.com/netoptimizer/prototype-kernel/commit/5397e596c30416763
Quoted 1 line
Should it be the case or should it be part of another library ?
I'm not sure... maybe Alexei, Daniel or Wang have an opinion?
tools/lib/bpf is aiming at provide a better way to parse bpf object file, load bpf program and maps. It doesn't operate link layer. set_link_xdp_fd() and other socket and link related functions are better to be implement separately. Two choices: 1. Move them into a library in samples/bpf.
2. make libbpf support XDP. The second choice looks good, but I'm not familiar with XDP API and don't know how to give a good abstraction.
In my opinion it should be part of another library.
Thank you.