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 yekai13@huawei.com --- src/uadk_cipher.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/uadk_cipher.c b/src/uadk_cipher.c index 5ebad64..be75233 100644 --- a/src/uadk_cipher.c +++ b/src/uadk_cipher.c @@ -847,8 +847,8 @@ static void uadk_e_ctx_init(EVP_CIPHER_CTX *ctx, struct cipher_priv_ctx *priv) struct sched_params params = {0}; int ret;
- 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)) { @@ -857,6 +857,9 @@ static void uadk_e_ctx_init(EVP_CIPHER_CTX *ctx, struct cipher_priv_ctx *priv) return; }
+ priv->req.iv_bytes = EVP_CIPHER_CTX_iv_length(ctx); + priv->req.iv = priv->iv; + /* * The internal RR scheduler used by environment variables, * the cipher algorithm does not distinguish between