From 17bfd66f31e712ffd9364bfb43c9899e10e84a7d Mon Sep 17 00:00:00 2001 From: Kai Ye Date: Sat, 2 Apr 2022 11:19:16 +0800 Subject: [PATCH 41/57] cipher: optimize the process of ctx initialization Optimize the process of ctx initialization as switching to soft work. If the ctx resources of a thread are insufficient at the beginning, the thread can't apply for resources again. Therefore, an flag checking is required. Signed-off-by: Kai Ye --- src/uadk_cipher.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/uadk_cipher.c b/src/uadk_cipher.c index 91895cc..8a2c39d 100644 --- a/src/uadk_cipher.c +++ b/src/uadk_cipher.c @@ -851,6 +851,9 @@ static void uadk_e_ctx_init(EVP_CIPHER_CTX *ctx, struct cipher_priv_ctx *priv) priv->req.iv_bytes = EVP_CIPHER_CTX_iv_length(ctx); priv->req.iv = priv->iv; + if (priv->switch_flag == UADK_DO_SOFT) + return; + ret = uadk_e_init_cipher(); if (unlikely(!ret)) { priv->switch_flag = UADK_DO_SOFT; -- 2.27.0