From: Christy Lee <christylee@fb.com>
To: <andrii@kernel.org>, <acme@kernel.org>
Cc: <christyc.y.lee@gmail.com>, <bpf@vger.kernel.org>,
<kernel-team@fb.com>, <linux-perf-users@vger.kernel.org>,
Christy Lee <christylee@fb.com>
Subject: [PATCH bpf-next 1/5] samples/bpf: stop using bpf_map__def() API
Date: Wed, 5 Jan 2022 15:00:53 -0800 [thread overview]
Message-ID: <20220105230057.853163-2-christylee@fb.com> (raw)
In-Reply-To: <20220105230057.853163-1-christylee@fb.com>
libbpf bpf_map__def() API is being deprecated, replace samples/bpf's
usage with the appropriate getters and setters.
Signed-off-by: Christy Lee <christylee@fb.com>
---
samples/bpf/xdp_rxq_info_user.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/samples/bpf/xdp_rxq_info_user.c b/samples/bpf/xdp_rxq_info_user.c
index 74a2926eba08..4033f345aa29 100644
--- a/samples/bpf/xdp_rxq_info_user.c
+++ b/samples/bpf/xdp_rxq_info_user.c
@@ -209,7 +209,7 @@ static struct datarec *alloc_record_per_cpu(void)
static struct record *alloc_record_per_rxq(void)
{
- unsigned int nr_rxqs = bpf_map__def(rx_queue_index_map)->max_entries;
+ unsigned int nr_rxqs = bpf_map__max_entries(rx_queue_index_map);
struct record *array;
array = calloc(nr_rxqs, sizeof(struct record));
@@ -222,7 +222,7 @@ static struct record *alloc_record_per_rxq(void)
static struct stats_record *alloc_stats_record(void)
{
- unsigned int nr_rxqs = bpf_map__def(rx_queue_index_map)->max_entries;
+ unsigned int nr_rxqs = bpf_map__max_entries(rx_queue_index_map);
struct stats_record *rec;
int i;
@@ -241,7 +241,7 @@ static struct stats_record *alloc_stats_record(void)
static void free_stats_record(struct stats_record *r)
{
- unsigned int nr_rxqs = bpf_map__def(rx_queue_index_map)->max_entries;
+ unsigned int nr_rxqs = bpf_map__max_entries(rx_queue_index_map);
int i;
for (i = 0; i < nr_rxqs; i++)
@@ -289,7 +289,7 @@ static void stats_collect(struct stats_record *rec)
map_collect_percpu(fd, 0, &rec->stats);
fd = bpf_map__fd(rx_queue_index_map);
- max_rxqs = bpf_map__def(rx_queue_index_map)->max_entries;
+ max_rxqs = bpf_map__max_entries(rx_queue_index_map);
for (i = 0; i < max_rxqs; i++)
map_collect_percpu(fd, i, &rec->rxq[i]);
}
@@ -335,7 +335,7 @@ static void stats_print(struct stats_record *stats_rec,
struct stats_record *stats_prev,
int action, __u32 cfg_opt)
{
- unsigned int nr_rxqs = bpf_map__def(rx_queue_index_map)->max_entries;
+ unsigned int nr_rxqs = bpf_map__max_entries(rx_queue_index_map);
unsigned int nr_cpus = bpf_num_possible_cpus();
double pps = 0, err = 0;
struct record *rec, *prev;
--
2.30.2
next prev parent reply other threads:[~2022-01-05 23:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-05 23:00 [PATCH bpf-next 0/5] libbpf 1.0: deprecate bpf_map__def() API Christy Lee
2022-01-05 23:00 ` Christy Lee [this message]
2022-01-05 23:00 ` [PATCH bpf-next 2/5] bpftool: stop using " Christy Lee
2022-01-05 23:00 ` [PATCH bpf-next 3/5] perf: " Christy Lee
2022-01-06 0:20 ` Andrii Nakryiko
2022-01-06 20:24 ` Arnaldo Carvalho de Melo
2022-01-05 23:00 ` [PATCH bpf-next 4/5] selftests/bpf: " Christy Lee
2022-01-05 23:00 ` [PATCH bpf-next 5/5] libbpf: deprecate " Christy Lee
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=20220105230057.853163-2-christylee@fb.com \
--to=christylee@fb.com \
--cc=acme@kernel.org \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=christyc.y.lee@gmail.com \
--cc=kernel-team@fb.com \
--cc=linux-perf-users@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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.