[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190608021925.4060095-1-hechaol@fb.com>
Date: Fri, 7 Jun 2019 19:19:23 -0700
From: Hechao Li <hechaol@...com>
To: <bpf@...r.kernel.org>
CC: <netdev@...r.kernel.org>, <daniel@...earbox.net>, <ast@...nel.org>,
<kernel-team@...com>, Hechao Li <hechaol@...com>
Subject: [PATCH v5 bpf-next 0/2] bpf: Add a new API libbpf_num_possible_cpus()
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.
v2: Save errno before calling pr_warning in case it is 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: use libbpf_num_possible_cpus in bpftool and selftests
tools/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(-)
--
2.17.1
Powered by blists - more mailing lists