bpf: Add a new API
Subsystems (3)
Quoted 18 lines · Hechao Li
Getting number of possible CPUs is commonly used for per-CPU BPF maps and
perf_event_maps. Add a new APIlibbpf_num_possible_cpus()that helps user with per-CPU related operations and remove duplicate implementations in bpftool and selftests.v4: Fixed error code when reading 0 bytes from possible CPU file
Hechao Li (2):
bpf: add a new APIlibbpf_num_possible_cpus()
bpf: uselibbpf_num_possible_cpusin bpftool and selfteststools/bpf/bpftool/common.c | 53 +++--------------------- tools/lib/bpf/libbpf.c | 57 ++++++++++++++++++++++++++ tools/lib/bpf/libbpf.h | 16 ++++++++ tools/lib/bpf/libbpf.map | 1 + tools/testing/selftests/bpf/bpf_util.h | 37 +++-------------- 5 files changed, 84 insertions(+), 80 deletions(-)
Quoted 5 lines
Series applied, thanks!
P.s.: Please retain full history (
v1->v2->v3->v4) in cover letter next time as that is typical convention and helps readers of git log to follow what has been changed over time.
Hello!
I'm getting the following errors on an attempt to build bpf tests. Reverting the last patch fixes it.
Please, take a look.
Thank you!
clang -I. -I./include/uapi -I../../../include/uapi -idirafter /usr/local/include -idirafter /opt/fb/devtoolset/bin/../lib/clang/4.0.0/include -idirafter /usr/include -Wno-compare-distinct-pointer-types \
-O2 -target bpf -emit-llvm -c progs/sockmap_parse_prog.c -o - | \
llc -march=bpf -mcpu=generic -filetype=obj -o /data/users/guro/linux/tools/testing/selftests/bpf/sockmap_parse_prog.o
In file included from progs/sockmap_parse_prog.c:3:
./bpf_util.h:9:10: fatal error: 'libbpf.h' file not found
#include <libbpf.h>
^~~~~~~~~~1 error generated.
...
clang -I. -I./include/uapi -I../../../include/uapi -idirafter /usr/local/include -idirafter /opt/fb/devtoolset/bin/../lib/clang/4.0.0/include -idirafter /usr/include -Wno-compare-distinct-pointer-types \
-O2 -target bpf -emit-llvm -c progs/test_sysctl_prog.c -o - | \
llc -march=bpf -mcpu=generic -filetype=obj -o /data/users/guro/linux/tools/testing/selftests/bpf/test_sysctl_prog.o
In file included from progs/test_sysctl_prog.c:11:
./bpf_util.h:9:10: fatal error: 'libbpf.h' file not found
#include <libbpf.h>
^~~~~~~~~~
1 error generated.
clang -I. -I./include/uapi -I../../../include/uapi -idirafter /usr/local/include -idirafter /opt/fb/devtoolset/bin/../lib/clang/4.0.0/include -idirafter /usr/include -Wno-compare-distinct-pointer-types \
-O2 -target bpf -emit-llvm -c progs/sockmap_verdict_prog.c -o - | \
llc -march=bpf -mcpu=generic -filetype=obj -o /data/users/guro/linux/tools/testing/selftests/bpf/sockmap_verdict_prog.o
In file included from progs/sockmap_verdict_prog.c:3:
./bpf_util.h:9:10: fatal error: 'libbpf.h' file not found
#include <libbpf.h>
^~~~~~~~~~1 error generated.
...
clang -I. -I./include/uapi -I../../../include/uapi -idirafter /usr/local/include -idirafter /opt/fb/devtoolset/bin/../lib/clang/4.0.0/include -idirafter /usr/include -Wno-compare-distinct-pointer-types \
-O2 -target bpf -emit-llvm -c progs/sockmap_tcp_msg_prog.c -o - | \
llc -march=bpf -mcpu=generic -filetype=obj -o /data/users/guro/linux/tools/testing/selftests/bpf/sockmap_tcp_msg_prog.o
In file included from progs/sockmap_tcp_msg_prog.c:3:
./bpf_util.h:9:10: fatal error: 'libbpf.h' file not found
#include <libbpf.h>
^~~~~~~~~~1 error generated.
Daniel Borkmann
maintainerQuoted 31 lines · Roman Gushchin
Quoted 18 lines · Hechao Li
Getting number of possible CPUs is commonly used for per-CPU BPF maps and
perf_event_maps. Add a new APIlibbpf_num_possible_cpus()that helps user with per-CPU related operations and remove duplicate implementations in bpftool and selftests.v4: Fixed error code when reading 0 bytes from possible CPU file
Hechao Li (2):
bpf: add a new APIlibbpf_num_possible_cpus()
bpf: uselibbpf_num_possible_cpusin bpftool and selfteststools/bpf/bpftool/common.c | 53 +++--------------------- tools/lib/bpf/libbpf.c | 57 ++++++++++++++++++++++++++ tools/lib/bpf/libbpf.h | 16 ++++++++ tools/lib/bpf/libbpf.map | 1 + tools/testing/selftests/bpf/bpf_util.h | 37 +++-------------- 5 files changed, 84 insertions(+), 80 deletions(-)Quoted 5 lines
Series applied, thanks!
P.s.: Please retain full history (
v1->v2->v3->v4) in cover letter next time as that is typical convention and helps readers of git log to follow what has been changed over time.Hello!
I'm getting the following errors on an attempt to build bpf tests. Reverting the last patch fixes it.
[...]
Quoted 9 lines
clang -I. -I./include/uapi -I../../../include/uapi -idirafter /usr/local/include -idirafter /opt/fb/devtoolset/bin/../lib/clang/4.0.0/include -idirafter /usr/include -Wno-compare-distinct-pointer-types \ -O2 -target bpf -emit-llvm -c progs/sockmap_parse_prog.c -o - | \ llc -march=bpf -mcpu=generic -filetype=obj -o /data/users/guro/linux/tools/testing/selftests/bpf/sockmap_parse_prog.o In file included from progs/sockmap_parse_prog.c:3: ./bpf_util.h:9:10: fatal error: 'libbpf.h' file not found #include <libbpf.h> ^~~~~~~~~~1 error generated.
True, I've therefore tossed the series from bpf-next. Hechao, please fix and resubmit.