From 290dc7b63ea4f97b8d9a05b9aa840e97e0bff7ad Mon Sep 17 00:00:00 2001 From: Niyaz Murshed Date: Tue, 4 Jun 2024 02:35:46 +0000 Subject: crypto: Add prefetching for src and dst Adding prefetching to openssl plugin improves both sync and async mode ipsec performance by more than 5% on N1 ampere. Sync mode (1420b) core count old (MPPS) new (MPPS) %diff 1c 0.972 1.01 3.90 2c 1.91 2.02 5.87 3c 2.86 3.04 6.03 Async mode (1420b) core count old (MPPS) new (MPPS) %diff 1c 1.296 1.37 5.70 2c 2.58 2.753 6.70 3c 3.74 3.9 4.27 6c 7.52 7.832 4.14 Type: improvement Change-Id: Ieef22c37e1330ac9f8b7e09a25c24162516b6c26 Signed-off-by: Niyaz Murshed --- src/plugins/crypto_openssl/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/plugins/crypto_openssl') diff --git a/src/plugins/crypto_openssl/main.c b/src/plugins/crypto_openssl/main.c index b070cf336a5..c59b5d34a29 100644 --- a/src/plugins/crypto_openssl/main.c +++ b/src/plugins/crypto_openssl/main.c @@ -219,6 +219,17 @@ openssl_ops_enc_aead (vlib_main_t *vm, vnet_crypto_op_t *ops[], vnet_crypto_op_t *op = ops[i]; int len = 0; + if (i + 2 < n_ops) + { + CLIB_PREFETCH (ops[i + 1]->src, 4 * CLIB_CACHE_PREFETCH_BYTES, LOAD); + CLIB_PREFETCH (ops[i + 1]->dst, 4 * CLIB_CACHE_PREFETCH_BYTES, + STORE); + + CLIB_PREFETCH (ops[i + 2]->src, 4 * CLIB_CACHE_PREFETCH_BYTES, LOAD); + CLIB_PREFETCH (ops[i + 2]->dst, 4 * CLIB_CACHE_PREFETCH_BYTES, + STORE); + } + ctx = ptd->evp_cipher_enc_ctx[op->key_index]; EVP_EncryptInit_ex (ctx, 0, 0, NULL, op->iv); if (op->aad_len) -- cgit 1.2.3-korg