libwd/0026-uadk-fix-for-sec-software-compute-check.patch
2024-11-19 11:51:09 +08:00

43 lines
1.6 KiB
Diff

From b6790254696fd1d67a798d9d2523cf3ec03b6e3d Mon Sep 17 00:00:00 2001
From: Wenkai Lin <linwenkai6@hisilicon.com>
Date: Thu, 10 Oct 2024 15:54:18 +0800
Subject: [PATCH 26/39] uadk: fix for sec software compute check
For aead stream mode, the final message is not sent to hardware when
the qm V3 version is used or when the length of the message is 0,
so software compute check should return true to stop qm_recv process.
Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
Signed-off-by: Qi Tao <taoqi10@huawei.com>
---
drv/hisi_sec.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drv/hisi_sec.c b/drv/hisi_sec.c
index 6377586..9d69831 100644
--- a/drv/hisi_sec.c
+++ b/drv/hisi_sec.c
@@ -2647,8 +2647,17 @@ static void parse_aead_bd2(struct hisi_qp *qp, struct hisi_sec_sqe *sqe,
static bool soft_compute_check(struct hisi_qp *qp, struct wd_aead_msg *msg)
{
/* Asynchronous mode does not use the sent message, so ignores it */
- if (msg->cmode == WD_CIPHER_GCM)
- return (msg->msg_state == AEAD_MSG_END) && qp->q_info.qp_mode == CTX_MODE_SYNC;
+ if (qp->q_info.qp_mode == CTX_MODE_ASYNC)
+ return false;
+ /*
+ * For aead gcm stream mode, due to some hardware limitations,
+ * the final message was not sent to hardware if the qm is
+ * not higher than v3 version or the input length of the
+ * message is 0, the software calculation has been executed.
+ */
+ if (msg->msg_state == AEAD_MSG_END && msg->cmode == WD_CIPHER_GCM &&
+ (qp->q_info.hw_type <= HISI_QM_API_VER3_BASE || !msg->in_bytes))
+ return true;
return false;
}
--
2.25.1