Netdev Archive on lore.kernel.org
 help / color / Atom feed
From: Hechao Li <hechaol@fb.com>
To: <bpf@vger.kernel.org>
Cc: <netdev@vger.kernel.org>, <daniel@iogearbox.net>,
	<ast@kernel.org>, <kernel-team@fb.com>,
	Hechao Li <hechaol@fb.com>
Subject: [PATCH v5 bpf-next 0/2] bpf: Add a new API libbpf_num_possible_cpus()
Date: Fri, 7 Jun 2019 19:19:23 -0700
Message-ID: <20190608021925.4060095-1-hechaol@fb.com> (raw)

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


             reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-08  2:19 Hechao Li [this message]
2019-06-08  2:19 ` [PATCH v5 bpf-next 1/2] bpf: add " Hechao Li
2019-06-08  2:19 ` [PATCH v5 bpf-next 2/2] bpf: use libbpf_num_possible_cpus Hechao Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190608021925.4060095-1-hechaol@fb.com \
    --to=hechaol@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git