Skip to content

Commit 24592ad

Browse files
tohojoAlexei Starovoitov
authored andcommitted
libbpf: Support batch_size option to bpf_prog_test_run
Add support for setting the new batch_size parameter to BPF_PROG_TEST_RUN to libbpf; just add it as an option and pass it through to the kernel. Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Martin KaFai Lau <kafai@fb.com> Link: https://lore.kernel.org/bpf/20220309105346.100053-4-toke@redhat.com
1 parent 1a7551f commit 24592ad

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

tools/lib/bpf/bpf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,7 @@ int bpf_prog_test_run_opts(int prog_fd, struct bpf_test_run_opts *opts)
995995

996996
memset(&attr, 0, sizeof(attr));
997997
attr.test.prog_fd = prog_fd;
998+
attr.test.batch_size = OPTS_GET(opts, batch_size, 0);
998999
attr.test.cpu = OPTS_GET(opts, cpu, 0);
9991000
attr.test.flags = OPTS_GET(opts, flags, 0);
10001001
attr.test.repeat = OPTS_GET(opts, repeat, 0);

tools/lib/bpf/bpf.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,9 @@ struct bpf_test_run_opts {
512512
__u32 duration; /* out: average per repetition in ns */
513513
__u32 flags;
514514
__u32 cpu;
515+
__u32 batch_size;
515516
};
516-
#define bpf_test_run_opts__last_field cpu
517+
#define bpf_test_run_opts__last_field batch_size
517518

518519
LIBBPF_API int bpf_prog_test_run_opts(int prog_fd,
519520
struct bpf_test_run_opts *opts);

0 commit comments

Comments
 (0)