diff options
author | Niyaz Murshed <niyaz.murshed@arm.com> | 2024-06-04 02:35:46 +0000 |
---|---|---|
committer | Fan Zhang <fanzhang.oss@gmail.com> | 2024-06-25 10:32:55 +0000 |
commit | 290dc7b63ea4f97b8d9a05b9aa840e97e0bff7ad (patch) | |
tree | 8f9053150ef07c19daa9473e573a9bf7c7867ba4 | |
parent | ed9843826ab653717989709cb70de2f97331c459 (diff) |
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 <niyaz.murshed@arm.com>
-rw-r--r-- | src/plugins/crypto_openssl/main.c | 11 |
1 files changed, 11 insertions, 0 deletions
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) |