libwd/0044-uadk-v1-remove-dummy.patch
JangShui Yang e072f742a4 libwd: update the source code
(cherry picked from commit dc42b3a676205c1a1c922628a993887e1ad2988f)
2024-04-07 18:59:45 +08:00

248 lines
6.5 KiB
Diff

From deec45b9919adbdf968eae688003b96e69a77011 Mon Sep 17 00:00:00 2001
From: Wenkai Lin <linwenkai6@hisilicon.com>
Date: Wed, 3 Apr 2024 11:24:54 +0800
Subject: [PATCH 44/44] uadk: v1: remove dummy
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,
--
2.25.1