126 Star 3 Fork 18

src-openEuler/libwd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0049-sec-optimze-for-directly-assigning-values-to-structu.patch 3.57 KB
一键复制 编辑 原始数据 按行查看 历史
JangShui Yang 提交于 2024-04-07 18:05 . libwd: update the source code
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/libwd.git
git@gitee.com:src-openeuler/libwd.git
src-openeuler
libwd
libwd
master

搜索帮助