代码拉取完成,页面将自动刷新
From 705e33d624defc335cdb1c96335da684868858a3 Mon Sep 17 00:00:00 2001
From: Wenkai Lin <linwenkai6@hisilicon.com>
Date: Fri, 29 Mar 2024 16:59:34 +0800
Subject: [PATCH 49/52] sec: optimze for directly assigning values to
structures
It is more reasonable to use pointers for value assignment.
Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
Signed-off-by: Qi Tao <taoqi10@huawei.com>
---
drv/hisi_sec.c | 36 ++++++++++++------------------------
1 file changed, 12 insertions(+), 24 deletions(-)
diff --git a/drv/hisi_sec.c b/drv/hisi_sec.c
index 6625c41..b218cd8 100644
--- a/drv/hisi_sec.c
+++ b/drv/hisi_sec.c
@@ -542,66 +542,54 @@ static int hisi_sec_aead_recv_v3(struct wd_alg_driver *drv, handle_t ctx, void *
static int cipher_send(struct wd_alg_driver *drv, handle_t ctx, void *msg)
{
- handle_t h_qp = (handle_t)wd_ctx_get_priv(ctx);
- struct hisi_qp *qp = (struct hisi_qp *)h_qp;
- struct hisi_qm_queue_info q_info = qp->q_info;
+ struct hisi_qp *qp = (struct hisi_qp *)wd_ctx_get_priv(ctx);
- if (q_info.hw_type == HISI_QM_API_VER2_BASE)
+ if (qp->q_info.hw_type == HISI_QM_API_VER2_BASE)
return hisi_sec_cipher_send(drv, ctx, msg);
return hisi_sec_cipher_send_v3(drv, ctx, msg);
}
static int cipher_recv(struct wd_alg_driver *drv, handle_t ctx, void *msg)
{
- handle_t h_qp = (handle_t)wd_ctx_get_priv(ctx);
- struct hisi_qp *qp = (struct hisi_qp *)h_qp;
- struct hisi_qm_queue_info q_info = qp->q_info;
+ struct hisi_qp *qp = (struct hisi_qp *)wd_ctx_get_priv(ctx);
- if (q_info.hw_type == HISI_QM_API_VER2_BASE)
+ if (qp->q_info.hw_type == HISI_QM_API_VER2_BASE)
return hisi_sec_cipher_recv(drv, ctx, msg);
return hisi_sec_cipher_recv_v3(drv, ctx, msg);
}
static int digest_send(struct wd_alg_driver *drv, handle_t ctx, void *msg)
{
- handle_t h_qp = (handle_t)wd_ctx_get_priv(ctx);
- struct hisi_qp *qp = (struct hisi_qp *)h_qp;
- struct hisi_qm_queue_info q_info = qp->q_info;
+ struct hisi_qp *qp = (struct hisi_qp *)wd_ctx_get_priv(ctx);
- if (q_info.hw_type == HISI_QM_API_VER2_BASE)
+ if (qp->q_info.hw_type == HISI_QM_API_VER2_BASE)
return hisi_sec_digest_send(drv, ctx, msg);
return hisi_sec_digest_send_v3(drv, ctx, msg);
}
static int digest_recv(struct wd_alg_driver *drv, handle_t ctx, void *msg)
{
- handle_t h_qp = (handle_t)wd_ctx_get_priv(ctx);
- struct hisi_qp *qp = (struct hisi_qp *)h_qp;
- struct hisi_qm_queue_info q_info = qp->q_info;
+ struct hisi_qp *qp = (struct hisi_qp *)wd_ctx_get_priv(ctx);
- if (q_info.hw_type == HISI_QM_API_VER2_BASE)
+ if (qp->q_info.hw_type == HISI_QM_API_VER2_BASE)
return hisi_sec_digest_recv(drv, ctx, msg);
return hisi_sec_digest_recv_v3(drv, ctx, msg);
}
static int aead_send(struct wd_alg_driver *drv, handle_t ctx, void *msg)
{
- handle_t h_qp = (handle_t)wd_ctx_get_priv(ctx);
- struct hisi_qp *qp = (struct hisi_qp *)h_qp;
- struct hisi_qm_queue_info q_info = qp->q_info;
+ struct hisi_qp *qp = (struct hisi_qp *)wd_ctx_get_priv(ctx);
- if (q_info.hw_type == HISI_QM_API_VER2_BASE)
+ if (qp->q_info.hw_type == HISI_QM_API_VER2_BASE)
return hisi_sec_aead_send(drv, ctx, msg);
return hisi_sec_aead_send_v3(drv, ctx, msg);
}
static int aead_recv(struct wd_alg_driver *drv, handle_t ctx, void *msg)
{
- handle_t h_qp = (handle_t)wd_ctx_get_priv(ctx);
- struct hisi_qp *qp = (struct hisi_qp *)h_qp;
- struct hisi_qm_queue_info q_info = qp->q_info;
+ struct hisi_qp *qp = (struct hisi_qp *)wd_ctx_get_priv(ctx);
- if (q_info.hw_type == HISI_QM_API_VER2_BASE)
+ if (qp->q_info.hw_type == HISI_QM_API_VER2_BASE)
return hisi_sec_aead_recv(drv, ctx, msg);
return hisi_sec_aead_recv_v3(drv, ctx, msg);
}
--
2.25.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。