55 lines
1.6 KiB
Diff
55 lines
1.6 KiB
Diff
From ba54780c666c7f655cf6b18d0072e1e892656252 Mon Sep 17 00:00:00 2001
|
|
From: Weili Qian <qianweili@huawei.com>
|
|
Date: Wed, 3 Apr 2024 11:24:52 +0800
|
|
Subject: [PATCH 42/44] ecc: check need_debug before calling WD_DEBUG
|
|
|
|
Before calling WD_DEBUG, check whether debug logs need to be recorded
|
|
to prevent the syslog syscall from affecting the performance.
|
|
|
|
Signed-off-by: Weili Qian <qianweili@huawei.com>
|
|
Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com>
|
|
---
|
|
wd_ecc.c | 8 +++++---
|
|
1 file changed, 5 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/wd_ecc.c b/wd_ecc.c
|
|
index e75bca0..65727e7 100644
|
|
--- a/wd_ecc.c
|
|
+++ b/wd_ecc.c
|
|
@@ -997,20 +997,19 @@ static int fill_user_curve_cfg(struct wd_ecc_curve *param,
|
|
struct wd_ecc_sess_setup *setup)
|
|
{
|
|
struct wd_ecc_curve *src_param = setup->cv.cfg.pparam;
|
|
- __u32 curve_id;
|
|
+ bool need_debug = wd_need_debug();
|
|
+ __u32 curve_id = 0;
|
|
int ret = 0;
|
|
|
|
if (setup->cv.type == WD_CV_CFG_ID) {
|
|
curve_id = setup->cv.cfg.id;
|
|
ret = fill_param_by_id(param, setup->key_bits, curve_id);
|
|
- WD_DEBUG("set curve id %u!\n", curve_id);
|
|
} else if (setup->cv.type == WD_CV_CFG_PARAM) {
|
|
ret = set_key_cv(param, src_param);
|
|
if (ret) {
|
|
WD_ERR("failed to set key cv!\n");
|
|
return ret;
|
|
}
|
|
- WD_DEBUG("set curve by user param!\n");
|
|
} else {
|
|
WD_ERR("invalid: fill curve cfg type %u is error!\n", setup->cv.type);
|
|
return -WD_EINVAL;
|
|
@@ -1022,6 +1021,9 @@ static int fill_user_curve_cfg(struct wd_ecc_curve *param,
|
|
return -WD_EINVAL;
|
|
}
|
|
|
|
+ if (need_debug)
|
|
+ WD_DEBUG("curve cfg type is %u, curve_id is %u!\n", setup->cv.type, curve_id);
|
|
+
|
|
return ret;
|
|
}
|
|
|
|
--
|
|
2.25.1
|
|
|