[PATCH v6 bpf-next 2/3] selftests/bpf: remove bpf_util.h from BPF C progs

2019-06-10 Thread Hechao Li
test BPF programs. This can also make it clear that bpf_util.h is a user-space utility while bpf_helpers.h is a kernel space utility. Signed-off-by: Hechao Li --- tools/testing/selftests/bpf/bpf_endian.h | 1 + tools/testing/selftests/bpf/progs/sockmap_parse_prog.c | 1

[PATCH v6 bpf-next 3/3] bpf: use libbpf_num_possible_cpus internally

2019-06-10 Thread Hechao Li
Use the newly added bpf_num_possible_cpus() in bpftool and selftests and remove duplicate implementations. Signed-off-by: Hechao Li --- tools/bpf/bpftool/common.c | 53 +++--- tools/testing/selftests/bpf/bpf_util.h | 37 +++--- 2 files changed, 10

[PATCH v6 bpf-next 0/3] Add a new API libbpf_num_possible_cpus()

2019-06-10 Thread Hechao Li
One commit to remove bpf_util.h from test BPF C programs. One commit to reuse libbpf_num_possible_cpus() in bpftools and bpf_util.h. Hechao Li (3): bpf: add a new API libbpf_num_possible_cpus() selftests/bpf: remove bpf_util.h from BPF C progs bpf: use libbpf_num_possible_cpus interna

[PATCH v6 bpf-next 1/3] bpf: add a new API libbpf_num_possible_cpus()

2019-06-10 Thread Hechao Li
Adding a new API libbpf_num_possible_cpus() that helps user with per-CPU map operations. Signed-off-by: Hechao Li --- tools/lib/bpf/libbpf.c | 57 tools/lib/bpf/libbpf.h | 16 +++ tools/lib/bpf/libbpf.map | 1 + 3 files changed, 74

[PATCH v2 bpf-next] selftests/bpf : clean up feature/ when make clean

2019-06-10 Thread Hechao Li
leaving feature-reallocarray being 1, which causes reallocarray not defined when re-compliing with GCC 7.x. This diff adds feature folder to EXTRA_CLEAN to avoid this problem. v2: Rephrase the commit message. Signed-off-by: Hechao Li Acked-by: Andrii Nakryiko --- tools/testing/selftests/bpf

Re: [PATCH v1 bpf-next] selftests/bpf : Clean up feature/ when make clean

2019-06-10 Thread Hechao Li
Andrii Nakryiko wrote on Mon [2019-Jun-10 11:05:28 -0700]: > On Mon, Jun 10, 2019 at 9:57 AM Hechao Li wrote: > > > > I got an error when compiling selftests/bpf: > > > > libbpf.c:411:10: error: implicit declaration of function 'reallocarray'; > >

[PATCH v1 bpf-next] selftests/bpf : Clean up feature/ when make clean

2019-06-10 Thread Hechao Li
ocarray=1 in FEATURE-DUMP.libbpf and it was fixed by manually removing feature/ folder. This diff adds feature/ to EXTRA_CLEAN to avoid this problem. Signed-off-by: Hechao Li --- tools/testing/selftests/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/t

[PATCH v5 bpf-next 1/2] bpf: add a new API libbpf_num_possible_cpus()

2019-06-07 Thread Hechao Li
Adding a new API libbpf_num_possible_cpus() that helps user with per-CPU map operations. Signed-off-by: Hechao Li --- tools/lib/bpf/libbpf.c | 57 tools/lib/bpf/libbpf.h | 16 +++ tools/lib/bpf/libbpf.map | 1 + 3 files changed, 74

[PATCH v5 bpf-next 2/2] bpf: use libbpf_num_possible_cpus

2019-06-07 Thread Hechao Li
Use the newly added bpf_num_possible_cpus() in bpftool and selftests and remove duplicate implementations. This patch also removed bpf_util.h from some test BPF programs since it is a userspace utility. Signed-off-by: Hechao Li --- tools/bpf/bpftool/common.c| 53

[PATCH v5 bpf-next 0/2] bpf: Add a new API libbpf_num_possible_cpus()

2019-06-07 Thread Hechao Li
changed. v3: Make sure libbpf_num_possible_cpus never returns 0 so that user only has to check if ret value < 0. v4: Fix error code when reading 0 bytes from possible CPU file. v5: Fix selftests compliation issue. Hechao Li (2): bpf: add a new API libbpf_num_possible_cpus() bpf:

[PATCH v4 bpf-next 0/2] bpf: Add a new API libbpf_num_possible_cpus()

2019-06-07 Thread Hechao Li
possible CPU file Hechao Li (2): bpf: add a new API libbpf_num_possible_cpus() bpf: use libbpf_num_possible_cpus in bpftool and selftests tools/bpf/bpftool/common.c | 53 +++- tools/lib/bpf/libbpf.c | 57 ++ tools/lib/bpf

[PATCH v4 bpf-next 1/2] bpf: add a new API libbpf_num_possible_cpus()

2019-06-07 Thread Hechao Li
Adding a new API libbpf_num_possible_cpus() that helps user with per-CPU map operations. Signed-off-by: Hechao Li Acked-by: Song Liu --- tools/lib/bpf/libbpf.c | 57 tools/lib/bpf/libbpf.h | 16 +++ tools/lib/bpf/libbpf.map | 1 + 3 files

[PATCH v4 bpf-next 2/2] bpf: use libbpf_num_possible_cpus in bpftool and selftests

2019-06-07 Thread Hechao Li
Use the newly added bpf_num_possible_cpus() in bpftool and selftests and remove duplicate implementations. Signed-off-by: Hechao Li Acked-by: Song Liu --- tools/bpf/bpftool/common.c | 53 +++--- tools/testing/selftests/bpf/bpf_util.h | 37 +++--- 2

[PATCH v3 bpf-next 2/2] bpf: use libbpf_num_possible_cpus in bpftool and selftests

2019-06-06 Thread Hechao Li
Use the newly added bpf_num_possible_cpus() in bpftool and selftests and remove duplicate implementations. Signed-off-by: Hechao Li --- tools/bpf/bpftool/common.c | 53 +++--- tools/testing/selftests/bpf/bpf_util.h | 37 +++--- 2 files changed, 10

[PATCH v3 bpf-next 1/2] bpf: add a new API libbpf_num_possible_cpus()

2019-06-06 Thread Hechao Li
Adding a new API libbpf_num_possible_cpus() that helps user with per-CPU map operations. Signed-off-by: Hechao Li --- tools/lib/bpf/libbpf.c | 57 tools/lib/bpf/libbpf.h | 16 +++ tools/lib/bpf/libbpf.map | 1 + 3 files changed, 74

[PATCH v3 bpf-next 0/2] bpf: Add a new API libbpf_num_possible_cpus()

2019-06-06 Thread Hechao Li
Getting number of possible CPUs is commonly used for per-CPU BPF maps and perf_event_maps. Add a new API libbpf_num_possible_cpus() that helps user with per-CPU related operations and remove duplicate implementations in bpftool and selftests. Hechao Li (2): bpf: add a new API