*** BLURB HERE ***
Weili Qian (2): ecc: check need_debug before calling WD_DEBUG uadk: remove unused ioctl cmd
Wenkai Lin (1): uadk: v1: remove dummy
Makefile.am | 1 - include/uacce.h | 1 - v1/internal/wd_dummy_usr_if.h | 45 ------------ v1/test/test_dummy.c | 126 ---------------------------------- v1/wd_adapter.c | 13 ---- wd_ecc.c | 8 ++- 6 files changed, 5 insertions(+), 189 deletions(-) delete mode 100644 v1/internal/wd_dummy_usr_if.h delete mode 100644 v1/test/test_dummy.c
From: Weili Qian qianweili@huawei.com
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 24f167f..d36a697 100644 --- a/wd_ecc.c +++ b/wd_ecc.c @@ -1020,20 +1020,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; @@ -1045,6 +1044,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; }
From: Weili Qian qianweili@huawei.com
Remove unused ioctl cmd UACCE_CMD_GET_SS_DMA.
Signed-off-by: Weili Qian qianweili@huawei.com Signed-off-by: JiangShui Yang yangjiangshui@h-partners.com --- include/uacce.h | 1 - 1 file changed, 1 deletion(-)
diff --git a/include/uacce.h b/include/uacce.h index fb3fb22..bb8d740 100644 --- a/include/uacce.h +++ b/include/uacce.h @@ -15,7 +15,6 @@ extern "C" {
#define UACCE_CMD_START _IO('W', 0) #define UACCE_CMD_PUT_Q _IO('W', 1) -#define UACCE_CMD_GET_SS_DMA _IOR('W', 100, unsigned long)
/** * UACCE Device flags:
From: Wenkai Lin linwenkai6@hisilicon.com
dummy is no longer use, remove it.
Signed-off-by: Wenkai Lin linwenkai6@hisilicon.com Signed-off-by: JiangShui Yang yangjiangshui@h-partners.com --- Makefile.am | 1 - v1/internal/wd_dummy_usr_if.h | 45 ------------ v1/test/test_dummy.c | 126 ---------------------------------- v1/wd_adapter.c | 13 ---- 4 files changed, 185 deletions(-) delete mode 100644 v1/internal/wd_dummy_usr_if.h delete mode 100644 v1/test/test_dummy.c
diff --git a/Makefile.am b/Makefile.am index 68f3106..1049639 100644 --- a/Makefile.am +++ b/Makefile.am @@ -60,7 +60,6 @@ libwd_la_SOURCES=wd.c wd_mempool.c wd.h wd_alg.c wd_alg.h \ v1/wd_bmm.c v1/wd_bmm.h \ v1/wd_ecc.c v1/wd_ecc.h \ v1/wd_sgl.c v1/wd_sgl.h \ - v1/drv/dummy_drv.c v1/drv/dummy_drv.h \ v1/drv/hisi_qm_udrv.c v1/drv/hisi_qm_udrv.h \ v1/drv/hisi_zip_udrv.c v1/drv/hisi_zip_udrv.h \ v1/drv/hisi_hpre_udrv.c v1/drv/hisi_hpre_udrv.h \ diff --git a/v1/internal/wd_dummy_usr_if.h b/v1/internal/wd_dummy_usr_if.h deleted file mode 100644 index b5673ec..0000000 --- a/v1/internal/wd_dummy_usr_if.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2019 Huawei Technologies Co.,Ltd.All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * This file defines the dummy algo interface between the user - * and kernel space - */ - -#ifndef __DUMMY_USR_IF_H -#define __DUMMY_USR_IF_H - - -/* Algorithm name */ -#define AN_DUMMY_MEMCPY "memcopy" - -#define AAN_AFLAGS "aflags" -#define AAN_MAX_COPY_SIZE "max_copy_size" - -struct wd_dummy_cpy_param { - int flags; - int max_copy_size; -}; - -struct wd_dummy_cpy_msg { - char *src_addr; - char *tgt_addr; - size_t size; - void *ptr; - __u32 ret; -}; - -#endif diff --git a/v1/test/test_dummy.c b/v1/test/test_dummy.c deleted file mode 100644 index 75ab33a..0000000 --- a/v1/test/test_dummy.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2018-2019 Huawei Technologies Co.,Ltd.All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "../config.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <unistd.h> - -#include "wd_sched.h" -#include "wd_dummy_usr_if.h" -#include "dummy_hw_usr_if.h" - -#define CPSZ 4096 - -#define SYS_ERR_COND(cond, msg) if(cond) { \ - perror(msg); \ - exit(EXIT_FAILURE); } - -struct wd_dummy_cpy_msg *msgs; - -int wd_dummy_memcpy(struct wd_queue *q, void *dst, void *src, size_t size) -{ - struct wd_dummy_cpy_msg req, *resp; - int ret; - - req.src_addr = src; - req.tgt_addr = dst; - req.size = size; - - ret = wd_send(q, (void *)&req); - if (ret) - return ret; - - return wd_recv_sync(q, (void **)&resp, 1000); -} - -static void wd_dummy_sched_init_cache(struct wd_scheduler *sched, int i) -{ - sched->msgs[i].msg = &msgs[i]; - msgs[i].src_addr = sched->msgs[i].data_in; - msgs[i].tgt_addr = sched->msgs[i].data_out; - msgs[i].size = sched->msg_data_size; -} - -static int input_num = 10; -static int wd_dummy_sched_input(struct wd_msg *msg, void *priv) -{ - SYS_ERR_COND(input_num <= 0, "input"); - input_num--; - memset(msg->data_in, '0'+input_num, CPSZ); - memset(msg->data_out, 'x', CPSZ); - - return 0; -} - -static int wd_dummy_sched_output(struct wd_msg *msg, void *priv) -{ - int i; - char *in, *out; - - for (i = 0; i < CPSZ; i++) { - in = (char *)msg->data_in; - out = (char *)msg->data_out; - if(in[i] != out[i]) { - printf("verify result fail on %d\n", i); - break; - } - - } - printf("verify result (%d) success (remained=%d)\n", in[0], input_num); - - return 0; -} - -struct wd_scheduler sched = { - .q_num = 1, - .ss_region_size = 0, - .msg_cache_num = 4, - .msg_data_size = CPSZ, - .init_cache = wd_dummy_sched_init_cache, - .input = wd_dummy_sched_input, - .output = wd_dummy_sched_output, -}; - -int main(int argc, char *argv[]) -{ - int ret, i; - int max_step = 20; - - sched.qs = calloc(sched.q_num, sizeof(*sched.qs)); - SYS_ERR_COND(!sched.qs, "calloc"); - - msgs = calloc(sched.msg_cache_num, sizeof(*msgs)); - SYS_ERR_COND(!msgs, "calloc"); - - for (i = 0; i < sched.q_num; i++) - sched.qs[i].capa.alg = "memcpy"; - - ret = wd_sched_init(&sched); - SYS_ERR_COND(ret, "wd_sched_init"); - - while(input_num || !wd_sched_empty(&sched)) { - ret = wd_sched_work(&sched, input_num); - SYS_ERR_COND(ret < 0, "wd_sched_work"); - SYS_ERR_COND(max_step-- < 0, "max_step"); - } - - wd_sched_fini(&sched); - free(sched.qs); - return EXIT_SUCCESS; -} diff --git a/v1/wd_adapter.c b/v1/wd_adapter.c index d574200..b9b841d 100644 --- a/v1/wd_adapter.c +++ b/v1/wd_adapter.c @@ -20,7 +20,6 @@
#include "config.h" #include "v1/wd_util.h" -#include "v1/drv/dummy_drv.h" #include "v1/drv/hisi_qm_udrv.h" #include "v1/drv/hisi_rng_udrv.h" #include "v1/wd_adapter.h" @@ -29,18 +28,6 @@ #define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1)
static const struct wd_drv_dio_if hw_dio_tbl[] = { { - .hw_type = "dummy_v1", - .open = dummy_set_queue_dio, - .close = dummy_unset_queue_dio, - .send = dummy_add_to_dio_q, - .recv = dummy_get_from_dio_q, - }, { - .hw_type = "dummy_v2", - .open = dummy_set_queue_dio, - .close = dummy_unset_queue_dio, - .send = dummy_add_to_dio_q, - .recv = dummy_get_from_dio_q, - }, { .hw_type = HISI_QM_API_VER_BASE WD_UACCE_API_VER_NOIOMMU_SUBFIX, .open = qm_init_queue, .close = qm_uninit_queue,