[PATCH] uadk_engine: fix env poll timeout in abnormal scenarios

In abnormal scenarios, if the alg cores of hardware device are closed, the hw async task may return busy and can not finish the task. There is be a max loop count to avoid infinite loop. But there is already a 'MAX_POLL_TIMES' (1000) in uadk default poll policy. If engine use 'ENGINE_RECV_MAX_CNT' to control the poll loop count, the actual count will be: MAX_POLL_TIMES * ENGINE_RECV_MAX_CNT which is too large. This will cause the process use a very long time to exit. So modify the env poll loop time count. Signed-off-by: Zhiqi Song <songzhiqi1@huawei.com> --- README | 2 +- src/uadk.h | 1 + src/uadk_aead.c | 2 +- src/uadk_cipher.c | 2 +- src/uadk_dh.c | 2 +- src/uadk_digest.c | 2 +- src/uadk_pkey.c | 2 +- src/uadk_rsa.c | 2 +- 8 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README b/README index cd27ccb..9586e60 100644 --- a/README +++ b/README @@ -180,7 +180,7 @@ Usage 1. Firstly, modify the openssl.cnf file, add the following settings at the beginning of this file: ``` -openssl_cnf=openssl_def +openssl_conf=openssl_def [openssl_def] engines=engine_section [engine_section] diff --git a/src/uadk.h b/src/uadk.h index ed7dbf1..d212033 100644 --- a/src/uadk.h +++ b/src/uadk.h @@ -22,6 +22,7 @@ #define ENV_STRING_LEN 256 #define ENGINE_SEND_MAX_CNT 90000000 #define ENGINE_RECV_MAX_CNT 60000000 +#define ENGINE_ENV_RECV_MAX_CNT 60000 #define UADK_UNINIT 0 #define UADK_INIT_SUCCESS 1 #define UADK_INIT_FAIL 2 diff --git a/src/uadk_aead.c b/src/uadk_aead.c index e127af8..619b50c 100644 --- a/src/uadk_aead.c +++ b/src/uadk_aead.c @@ -81,7 +81,7 @@ static int uadk_e_aead_env_poll(void *ctx) if (ret < 0 || recv == expt) return ret; rx_cnt++; - } while (rx_cnt < ENGINE_RECV_MAX_CNT); + } while (rx_cnt < ENGINE_ENV_RECV_MAX_CNT); fprintf(stderr, "failed to poll msg: timeout!\n"); diff --git a/src/uadk_cipher.c b/src/uadk_cipher.c index 736a8af..deed97d 100644 --- a/src/uadk_cipher.c +++ b/src/uadk_cipher.c @@ -364,7 +364,7 @@ static int uadk_e_cipher_env_poll(void *ctx) if (ret < 0 || recv == expt) return ret; rx_cnt++; - } while (rx_cnt < ENGINE_RECV_MAX_CNT); + } while (rx_cnt < ENGINE_ENV_RECV_MAX_CNT); fprintf(stderr, "failed to poll msg: timeout!\n"); diff --git a/src/uadk_dh.c b/src/uadk_dh.c index b451a5f..32874d1 100644 --- a/src/uadk_dh.c +++ b/src/uadk_dh.c @@ -297,7 +297,7 @@ static int uadk_e_dh_env_poll(void *ctx) return ret; } rx_cnt++; - } while (rx_cnt < ENGINE_RECV_MAX_CNT); + } while (rx_cnt < ENGINE_ENV_RECV_MAX_CNT); fprintf(stderr, "failed to poll msg: timeout!\n"); diff --git a/src/uadk_digest.c b/src/uadk_digest.c index fc979bc..c5065a4 100644 --- a/src/uadk_digest.c +++ b/src/uadk_digest.c @@ -390,7 +390,7 @@ static int uadk_e_digest_env_poll(void *ctx) if (ret < 0 || recv == expt) return ret; rx_cnt++; - } while (rx_cnt < ENGINE_RECV_MAX_CNT); + } while (rx_cnt < ENGINE_ENV_RECV_MAX_CNT); fprintf(stderr, "failed to poll msg: timeout!\n"); diff --git a/src/uadk_pkey.c b/src/uadk_pkey.c index 2cec16e..7c115fe 100644 --- a/src/uadk_pkey.c +++ b/src/uadk_pkey.c @@ -182,7 +182,7 @@ static int uadk_e_ecc_env_poll(void *ctx) return ret; } rx_cnt++; - } while (rx_cnt < ENGINE_RECV_MAX_CNT); + } while (rx_cnt < ENGINE_ENV_RECV_MAX_CNT); fprintf(stderr, "failed to poll msg: timeout!\n"); diff --git a/src/uadk_rsa.c b/src/uadk_rsa.c index 09d34b4..1594b74 100644 --- a/src/uadk_rsa.c +++ b/src/uadk_rsa.c @@ -719,7 +719,7 @@ static int uadk_e_rsa_env_poll(void *ctx) return ret; } rx_cnt++; - } while (rx_cnt < ENGINE_RECV_MAX_CNT); + } while (rx_cnt < ENGINE_ENV_RECV_MAX_CNT); fprintf(stderr, "failed to poll msg: timeout!\n"); -- 2.30.0
participants (1)
-
Zhiqi Song