101 lines
3.6 KiB
Diff
101 lines
3.6 KiB
Diff
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
|
|
|