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

From: Simon Horman <[email-masked]>
Date: Fri, 19 Apr 2024 12:31:38 +0100

On Tue, Apr 16, 2024 at 01:40:04PM -0700, Vadim Fedorenko wrote:
> Some simple benchmarks are added to understand the baseline of
> performance.
> 
> Signed-off-by: Vadim Fedorenko <[email-masked]>

...

> 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..86048f02e6ac
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/benchs/bench_bpf_crypto.c
> @@ -0,0 +1,190 @@
> +// 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"
> +#include "../progs/crypto_share.h"
> +
> +#define MAX_CIPHER_LEN 32
> +static char *input;
> +static struct crypto_ctx {
> +	struct crypto_bench *skel;
> +	int pfd;
> +} ctx;
> +
> +static struct crypto_args {
> +	u32 crypto_len;
> +	char *crypto_cipher;
> +} args = {
> +	.crypto_len = 16,
> +	.crypto_cipher = "ecb(aes)",
> +};
> +
> +enum {
> +	ARG_CRYPTO_LEN = 5000,
> +	ARG_CRYPTO_CIPHER = 5001,
> +};
> +
> +static const struct argp_option opts[] = {
> +	{ "crypto-len", ARG_CRYPTO_LEN, "CRYPTO_LEN", 0,
> +	  "Set the length of crypto buffer" },
> +	{ "crypto-cipher", ARG_CRYPTO_CIPHER, "CRYPTO_CIPHER", 0,
> +	  "Set the cipher to use (defaul:ecb(aes))" },

nit: should this be 'default' ?

Flagged by checkpatch.pl --codespell

> +	{},
> +};

...