[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210920141526.3940002-10-memxor@gmail.com>
Date: Mon, 20 Sep 2021 19:45:24 +0530
From: Kumar Kartikeya Dwivedi <memxor@...il.com>
To: bpf@...r.kernel.org
Cc: Kumar Kartikeya Dwivedi <memxor@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Toke Høiland-Jørgensen <toke@...hat.com>,
netdev@...r.kernel.org
Subject: [PATCH bpf-next v4 09/11] tools: bpftool: Add separate fd_array map support for light skeleton
This prepares bpftool to pass fd_array_sz parameter, so that the map can
be created by bpf_load_and_run function to hold map and BTF fds.
---
tools/bpf/bpftool/gen.c | 3 ++-
tools/bpf/bpftool/prog.c | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
index e3ec47a6a612..5bd3650956a4 100644
--- a/tools/bpf/bpftool/gen.c
+++ b/tools/bpf/bpftool/gen.c
@@ -532,10 +532,11 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *h
codegen("\
\n\
+ opts.fd_array_sz = %d; \n\
opts.insns_sz = %d; \n\
opts.insns = (void *)\"\\ \n\
",
- opts.insns_sz);
+ opts.fd_array_sz, opts.insns_sz);
print_hex(opts.insns, opts.insns_sz);
codegen("\
\n\
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 9c3e343b7d87..1d6286d727f4 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -1693,6 +1693,7 @@ static int try_loader(struct gen_loader_opts *gen)
opts.data_sz = gen->data_sz;
opts.insns = gen->insns;
opts.insns_sz = gen->insns_sz;
+ opts.fd_array_sz = gen->fd_array_sz;
fds_before = count_open_fds();
err = bpf_load_and_run(&opts);
fd_delta = count_open_fds() - fds_before;
--
2.33.0
Powered by blists - more mailing lists