Re: [PATCH bpf-next v10 4/4] selftests: bpf: crypto: add benchmark for crypto functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/22/24 3:50 PM, Vadim Fedorenko wrote:
diff --git a/tools/testing/selftests/bpf/benchs/bench_bpf_crypto.c b/tools/testing/selftests/bpf/benchs/bench_bpf_crypto.c
new file mode 100644
index 000000000000..0b8c1f2fe7e6
--- /dev/null
+++ b/tools/testing/selftests/bpf/benchs/bench_bpf_crypto.c
@@ -0,0 +1,185 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
+
+#include <argp.h>
+#include "bench.h"
+#include "crypto_bench.skel.h"
+
+#define MAX_CIPHER_LEN 32
+static char *input;

[ ... ]

+static void *crypto_producer(void *input)

The bench result has all 0s in the output:

$> ./bench -p 4 crypto-decrypt
Setting up benchmark 'crypto-decrypt'...
Benchmark 'crypto-decrypt' started.
Iter   0 (209.082us): hits    0.000M/s (  0.000M/prod), drops    0.000M/s, total operations    0.000M/s
Iter   1 (154.618us): hits    0.000M/s (  0.000M/prod), drops    0.000M/s, total operations    0.000M/s
Iter   2 (-36.658us): hits    0.000M/s (  0.000M/prod), drops    0.000M/s, total operations    0.000M/s

This "void *input" arg shadowed the global variable.

+{
+	LIBBPF_OPTS(bpf_test_run_opts, opts,
+		.repeat = 64,
+		.data_in = input,
+		.data_size_in = args.crypto_len,
+	);
+
+	while (true)
+		(void)bpf_prog_test_run_opts(ctx.pfd, &opts);
+	return NULL;
+}





[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux