From: Weili Qian <qianweili@huawei.com> After calling the asynchronous interface to send a request, if the return value is not 0, -WD_HW_EACCESS, or -EBUSY, it is considered that the request was sent successfully. In this case, the request receiving operation continues, which may cause a request receiving timeout. Therefore, add checks for other return values. Signed-off-by: Weili Qian <qianweili@huawei.com> --- src/uadk_dh.c | 11 +++++++---- src/uadk_pkey.c | 11 +++++++---- src/uadk_rsa.c | 11 +++++++---- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/uadk_dh.c b/src/uadk_dh.c index e49250b..ce00953 100644 --- a/src/uadk_dh.c +++ b/src/uadk_dh.c @@ -755,12 +755,15 @@ static int dh_do_async(struct uadk_dh_sess *dh_sess, struct async_op *op) do { ret = wd_do_dh_async(dh_sess->sess, &dh_sess->req); if (unlikely(ret < 0)) { - if (unlikely(ret == -WD_HW_EACCESS)) - uadk_e_dh_set_status(); - else if (unlikely(cnt++ > ENGINE_SEND_MAX_CNT)) + if (unlikely(ret != -EBUSY)) { + fprintf(stderr, "do dh async operation failed.\n"); + if (unlikely(ret == -WD_HW_EACCESS)) + uadk_e_dh_set_status(); + } else if (unlikely(cnt++ > ENGINE_SEND_MAX_CNT)) { fprintf(stderr, "do dh async operation timeout.\n"); - else + } else { continue; + } async_free_poll_task(op->idx, 0); ret = UADK_E_FAIL; diff --git a/src/uadk_pkey.c b/src/uadk_pkey.c index c5f711b..5878be7 100644 --- a/src/uadk_pkey.c +++ b/src/uadk_pkey.c @@ -342,12 +342,15 @@ static int uadk_ecc_do_async(handle_t sess, struct wd_ecc_req *req, do { ret = wd_do_ecc_async(sess, req); if (unlikely(ret < 0)) { - if (unlikely(ret == -WD_HW_EACCESS)) - uadk_e_ecc_set_status(); - else if (unlikely(cnt++ > ENGINE_SEND_MAX_CNT)) + if (unlikely(ret != -EBUSY)) { + fprintf(stderr, "do ecc async operation failed.\n"); + if (unlikely(ret == -WD_HW_EACCESS)) + uadk_e_ecc_set_status(); + } else if (unlikely(cnt++ > ENGINE_SEND_MAX_CNT)) { fprintf(stderr, "do ecc async operation timeout.\n"); - else + } else { continue; + } async_free_poll_task(op->idx, 0); ret = 0; diff --git a/src/uadk_rsa.c b/src/uadk_rsa.c index 318f8ed..11663d8 100644 --- a/src/uadk_rsa.c +++ b/src/uadk_rsa.c @@ -1162,12 +1162,15 @@ static int rsa_do_async(struct uadk_rsa_sess *rsa_sess, struct async_op *op) do { ret = wd_do_rsa_async(rsa_sess->sess, &rsa_sess->req); if (unlikely(ret < 0)) { - if (unlikely(ret == -WD_HW_EACCESS)) - uadk_e_rsa_set_status(); - else if (unlikely(cnt++ > ENGINE_SEND_MAX_CNT)) + if (unlikely(ret != -EBUSY)) { + fprintf(stderr, "do rsa async operation failed.\n"); + if (unlikely(ret == -WD_HW_EACCESS)) + uadk_e_rsa_set_status(); + } else if (unlikely(cnt++ > ENGINE_SEND_MAX_CNT)) { fprintf(stderr, "do rsa async operation timeout.\n"); - else + } else { continue; + } async_free_poll_task(op->idx, 0); ret = UADK_E_FAIL; -- 2.43.0