diff --git a/0001-uadk-digest-add-stream-mode-for-digest-sync.patch b/0001-uadk-digest-add-stream-mode-for-digest-sync.patch new file mode 100644 index 0000000..f3f2a27 --- /dev/null +++ b/0001-uadk-digest-add-stream-mode-for-digest-sync.patch @@ -0,0 +1,213 @@ +From c1e75c6c27ea54dec9e31223af49e33aa0d38490 Mon Sep 17 00:00:00 2001 +From: Kai Ye +Date: Mon, 13 Dec 2021 18:55:32 +0800 +Subject: [PATCH 01/28] uadk/digest - add stream mode for digest sync + +Support the sec digest steam mode. Using the session to store +the stream BD state, using the iv_bytes to notify the BD state +from message. So one session only supports one stream. User +can use the has_next flag to indicate whether there is any +packet to be input. + +Signed-off-by: Kai Ye +--- + drv/hisi_sec.c | 50 ++++++++++++++++++++----------------- + include/drv/wd_digest_drv.h | 2 ++ + wd_digest.c | 20 ++++++++++++--- + 3 files changed, 46 insertions(+), 26 deletions(-) + +diff --git a/drv/hisi_sec.c b/drv/hisi_sec.c +index e43ded2..2fd23f3 100644 +--- a/drv/hisi_sec.c ++++ b/drv/hisi_sec.c +@@ -73,6 +73,8 @@ + /* The max BD data length is 16M-512B */ + #define MAX_INPUT_DATA_LEN 0xFFFE00 + #define MAX_CCM_AAD_LEN 65279 ++#define SHA1_ALIGN_SZ 64 ++#define SHA512_ALIGN_SZ 128 + + #define AUTHPAD_OFFSET 2 + #define AUTHTYPE_OFFSET 6 +@@ -1229,31 +1231,24 @@ static int fill_digest_bd2_alg(struct wd_digest_msg *msg, + static void qm_fill_digest_long_bd(struct wd_digest_msg *msg, + struct hisi_sec_sqe *sqe) + { +- struct wd_digest_tag *digest_tag = (void *)(uintptr_t)msg->usr_data; + __u64 total_bits; + + if (msg->has_next && (msg->iv_bytes == 0)) { + /* LONG BD FIRST */ + sqe->ai_apd_cs = AI_GEN_INNER; + sqe->ai_apd_cs |= AUTHPAD_NOPAD << AUTHPAD_OFFSET; +- msg->iv_bytes = msg->out_bytes; + } else if (msg->has_next && (msg->iv_bytes != 0)) { + /* LONG BD MIDDLE */ + sqe->ai_apd_cs = AI_GEN_IVIN_ADDR; + sqe->ai_apd_cs |= AUTHPAD_NOPAD << AUTHPAD_OFFSET; + sqe->type2.a_ivin_addr = sqe->type2.mac_addr; +- msg->iv_bytes = msg->out_bytes; + } else if (!msg->has_next && (msg->iv_bytes != 0)) { + /* LONG BD END */ + sqe->ai_apd_cs = AI_GEN_IVIN_ADDR; + sqe->ai_apd_cs |= AUTHPAD_PAD << AUTHPAD_OFFSET; + sqe->type2.a_ivin_addr = sqe->type2.mac_addr; +- total_bits = digest_tag->long_data_len * BYTE_BITS; ++ total_bits = msg->long_data_len * BYTE_BITS; + sqe->type2.long_a_data_len = total_bits; +- msg->iv_bytes = 0; +- } else { +- /* SHORT BD */ +- msg->iv_bytes = 0; + } + } + +@@ -1282,21 +1277,37 @@ static void parse_digest_bd2(struct hisi_sec_sqe *sqe, struct wd_digest_msg *rec + #endif + } + +-static int digest_len_check(struct wd_digest_msg *msg, enum sec_bd_type type) ++static int digest_long_bd_check(struct wd_digest_msg *msg) + { +- if (type == BD_TYPE2 && msg->in_bytes == 0) { +- WD_ERR("digest bd2 not supports 0 packet!\n"); ++ if (msg->alg >= WD_DIGEST_SHA512 && msg->in_bytes % SHA512_ALIGN_SZ) ++ return -WD_EINVAL; ++ else if (msg->in_bytes % SHA1_ALIGN_SZ) ++ return -WD_EINVAL; ++ ++ return 0; ++} ++ ++static int digest_len_check(struct wd_digest_msg *msg, enum sec_bd_type type) ++{ ++ int ret; ++ ++ /* End BD not need to check the input zero bytes */ ++ if (unlikely(type == BD_TYPE2 && (!msg->has_next && msg->in_bytes == 0))) { ++ WD_ERR("kunpeng 920, digest mode not support 0 size!\n"); + return -WD_EINVAL; + } + + if (unlikely(msg->in_bytes > MAX_INPUT_DATA_LEN)) { +- WD_ERR("failed to check digest input data length!\n"); ++ WD_ERR("input data length is too long, size:%u!\n", msg->in_bytes); + return -WD_EINVAL; + } + +- if (unlikely(msg->out_bytes & WORD_ALIGNMENT_MASK)) { +- WD_ERR("failed to check digest out length!\n"); +- return -WD_EINVAL; ++ if (msg->has_next) { ++ ret = digest_long_bd_check(msg); ++ if (ret) { ++ WD_ERR("input data isn't aligned, size:%u!\n", msg->in_bytes); ++ return -WD_EINVAL; ++ } + } + + return 0; +@@ -1435,31 +1446,24 @@ static int fill_digest_bd3_alg(struct wd_digest_msg *msg, + static void qm_fill_digest_long_bd3(struct wd_digest_msg *msg, + struct hisi_sec_sqe3 *sqe) + { +- struct wd_digest_tag *digest_tag = (void *)(uintptr_t)msg->usr_data; + __u64 total_bits; + + if (msg->has_next && (msg->iv_bytes == 0)) { + /* LONG BD FIRST */ + sqe->auth_mac_key |= AI_GEN_INNER << SEC_AI_GEN_OFFSET_V3; + sqe->stream_scene.stream_auth_pad = AUTHPAD_NOPAD; +- msg->iv_bytes = msg->out_bytes; + } else if (msg->has_next && (msg->iv_bytes != 0)) { + /* LONG BD MIDDLE */ + sqe->auth_mac_key |= AI_GEN_IVIN_ADDR << SEC_AI_GEN_OFFSET_V3; + sqe->stream_scene.stream_auth_pad = AUTHPAD_NOPAD; + sqe->auth_ivin.a_ivin_addr = sqe->mac_addr; +- msg->iv_bytes = msg->out_bytes; + } else if (!msg->has_next && (msg->iv_bytes != 0)) { + /* LONG BD END */ + sqe->auth_mac_key |= AI_GEN_IVIN_ADDR << SEC_AI_GEN_OFFSET_V3; + sqe->stream_scene.stream_auth_pad = AUTHPAD_PAD; + sqe->auth_ivin.a_ivin_addr = sqe->mac_addr; +- total_bits = digest_tag->long_data_len * BYTE_BITS; ++ total_bits = msg->long_data_len * BYTE_BITS; + sqe->stream_scene.long_a_data_len = total_bits; +- msg->iv_bytes = 0; +- } else { +- /* SHORT BD */ +- msg->iv_bytes = 0; + } + } + +diff --git a/include/drv/wd_digest_drv.h b/include/drv/wd_digest_drv.h +index 8ccf291..ac3b028 100644 +--- a/include/drv/wd_digest_drv.h ++++ b/include/drv/wd_digest_drv.h +@@ -45,6 +45,8 @@ struct wd_digest_msg { + __u8 *in; + /* output data pointer */ + __u8 *out; ++ /* total of data for stream mode */ ++ __u64 long_data_len; + }; + + struct wd_digest_driver { +diff --git a/wd_digest.c b/wd_digest.c +index 22aa98e..c110f7b 100644 +--- a/wd_digest.c ++++ b/wd_digest.c +@@ -46,6 +46,10 @@ struct wd_digest_sess { + unsigned char key[MAX_HMAC_KEY_SIZE]; + __u32 key_bytes; + void *sched_key; ++ /* Notify the BD state */ ++ int state; ++ /* Total of data for stream mode */ ++ __u64 long_data_len; + }; + + struct wd_env_config wd_digest_env_config; +@@ -286,11 +290,19 @@ static void fill_request_msg(struct wd_digest_msg *msg, + msg->in_bytes = req->in_bytes; + msg->out = req->out; + msg->out_bytes = req->out_bytes; +- msg->has_next = req->has_next; + msg->data_fmt = req->data_fmt; ++ msg->has_next = req->has_next; ++ sess->long_data_len += req->in_bytes; ++ msg->long_data_len = sess->long_data_len; ++ /* To store the stream bd state */ ++ msg->iv_bytes = sess->state; ++ if (req->has_next == 0) { ++ sess->long_data_len = 0; ++ sess->state = 0; ++ } + } + +-static int send_recv_sync(struct wd_ctx_internal *ctx, ++static int send_recv_sync(struct wd_ctx_internal *ctx, struct wd_digest_sess *dsess, + struct wd_digest_msg *msg) + { + __u64 recv_cnt = 0; +@@ -320,6 +332,8 @@ static int send_recv_sync(struct wd_ctx_internal *ctx, + goto out; + } + } ++ if (msg->has_next) ++ dsess->state = msg->out_bytes; + } while (ret < 0); + + out: +@@ -353,7 +367,7 @@ int wd_do_digest_sync(handle_t h_sess, struct wd_digest_req *req) + return ret; + + ctx = config->ctxs + idx; +- ret = send_recv_sync(ctx, &msg); ++ ret = send_recv_sync(ctx, dsess, &msg); + req->state = msg.result; + + return ret; +-- +2.31.1 + diff --git a/0002-test-digest-support-the-digest-stream-mode.patch b/0002-test-digest-support-the-digest-stream-mode.patch new file mode 100644 index 0000000..137e5ff --- /dev/null +++ b/0002-test-digest-support-the-digest-stream-mode.patch @@ -0,0 +1,508 @@ +From 08d633649d4a3c557bf042241e3953c3dd5cf586 Mon Sep 17 00:00:00 2001 +From: Kai Ye +Date: Thu, 9 Sep 2021 19:18:05 +0800 +Subject: [PATCH 02/28] test/digest: support the digest stream mode + +Test the digest stream mode by compare to no stream mode. +Tools supports the multiple thread testing. + +For example: +test_hisi_sec --digest 0 --sync --optype 3 --pktlen 1024 \ + --keylen 16 --times 1 --multi 2 +more details: + test_hisi_sec --help + +Signed-off-by: Kai Ye +--- + test/hisi_sec_test/test_hisi_sec.c | 370 ++++++++++++++++++++++++++++- + test/hisi_sec_test/test_hisi_sec.h | 4 +- + 2 files changed, 360 insertions(+), 14 deletions(-) + +diff --git a/test/hisi_sec_test/test_hisi_sec.c b/test/hisi_sec_test/test_hisi_sec.c +index a2dba05..e1521f6 100644 +--- a/test/hisi_sec_test/test_hisi_sec.c ++++ b/test/hisi_sec_test/test_hisi_sec.c +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -53,6 +54,8 @@ static unsigned int g_data_fmt = WD_FLAT_BUF; + static unsigned int g_sgl_num = 0; + static pthread_spinlock_t lock = 0; + ++static struct hash_testvec g_long_hash_tv; ++ + char *skcipher_names[MAX_ALGO_PER_TYPE] = + {"ecb(aes)", "cbc(aes)", "xts(aes)", "ofb(aes)", "cfb(aes)", "ecb(des3_ede)", + "cbc(des3_ede)", "cbc(sm4)", "xts(sm4)", "ofb(sm4)", "cfb(sm4)", "ecb(sm4)", NULL,}; +@@ -1509,7 +1512,7 @@ int get_digest_resource(struct hash_testvec **alg_tv, int* alg, int* mode) + } + if (g_ivlen == 1) { + tmp_tv = tv; +- tv = &long_hash_tv_template[0]; ++ tv = &g_long_hash_tv; + tv->dsize = tmp_tv->dsize; + } else if (g_ivlen == 2) { + tmp_tv = tv; +@@ -1587,7 +1590,7 @@ static int sec_digest_sync_once(void) + + /* if mode is HMAC, should set key */ + if (setup.mode == WD_DIGEST_HMAC) { +- ret = wd_digest_set_key(h_sess, (const __u8*)tv->key, tv->ksize); ++ ret = wd_digest_set_key(h_sess, (const __u8 *)tv->key, tv->ksize); + if (ret) { + SEC_TST_PRT("sess set key failed!\n"); + goto out_key; +@@ -1622,6 +1625,311 @@ out_src: + return ret; + } + ++static int sec_digest_sync_stream_cmp(void) ++{ ++ struct wd_digest_sess_setup setup = {0}; ++ struct hash_testvec *tv = NULL; ++ handle_t h_sess = 0; ++ struct wd_digest_req req; ++ unsigned long cnt = g_times; ++ int ret; ++ size_t unit_sz; ++ ++ /* config setup */ ++ ret = init_digest_ctx_config(CTX_TYPE_ENCRYPT, CTX_MODE_SYNC); ++ if (ret) { ++ SEC_TST_PRT("Fail to init sigle ctx config!\n"); ++ return ret; ++ } ++ ++ /* config arg */ ++ memset(&req, 0, sizeof(struct wd_digest_req)); ++ get_digest_resource(&tv, (int *)&setup.alg, (int *)&setup.mode); ++ ++ unit_sz = cal_unit_sz(BUFF_SIZE * 8, g_sgl_num); ++ req.in = create_buf(g_data_fmt, BUFF_SIZE * 8, unit_sz); ++ if (!req.in) { ++ ret = -ENOMEM; ++ goto out_src; ++ } ++ ++ req.in_bytes = tv->psize; ++ copy_mem(g_data_fmt, req.in, WD_FLAT_BUF, ++ (void *)tv->plaintext, tv->psize); ++ ++ req.out = create_buf(WD_FLAT_BUF, BUFF_SIZE, unit_sz); ++ if (!req.out) { ++ ret = -ENOMEM; ++ goto out_dst; ++ } ++ ++ req.out_buf_bytes = BUFF_SIZE; ++ req.out_bytes = tv->dsize; ++ req.data_fmt = g_data_fmt; ++ req.has_next = 0; ++ ++ h_sess = wd_digest_alloc_sess(&setup); ++ if (!h_sess) { ++ ret = -EINVAL; ++ goto out_sess; ++ } ++ ++ /* if mode is HMAC, should set key */ ++ ret = wd_digest_set_key(h_sess, (const __u8 *)tv->key, tv->ksize); ++ if (ret) { ++ SEC_TST_PRT("sess set key failed!\n"); ++ goto out_key; ++ } ++ ++ while (cnt) { ++ ret = wd_do_digest_sync(h_sess, &req); ++ cnt--; ++ } ++ ++ SEC_TST_PRT("one hash BD dump the out memory, cmp the stream mode:\n"); ++ dump_mem(WD_FLAT_BUF, req.out, 16); ++ ++out_key: ++ wd_digest_free_sess(h_sess); ++out_sess: ++ free_buf(WD_FLAT_BUF, req.out); ++out_dst: ++ free_buf(g_data_fmt, req.in); ++out_src: ++ digest_uninit_config(); ++ ++ return ret; ++} ++ ++static int sec_digest_sync_stream_mode(void) ++{ ++ struct wd_digest_sess_setup setup; ++ struct hash_testvec *tv = NULL; ++ handle_t h_sess = 0; ++ struct wd_digest_req req; ++ unsigned long cnt = g_times; ++ int ret, data_len; ++ void *bak_in = NULL; ++ ++ /* config setup */ ++ ret = init_digest_ctx_config(CTX_TYPE_ENCRYPT, CTX_MODE_SYNC); ++ if (ret) { ++ SEC_TST_PRT("Fail to init sigle ctx config!\n"); ++ return ret; ++ } ++ ++ /* config arg */ ++ memset(&req, 0, sizeof(struct wd_digest_req)); ++ get_digest_resource(&tv, (int *)&setup.alg, (int *)&setup.mode); ++ ++ req.in = malloc(BUFF_SIZE * 8); ++ if (!req.in) { ++ SEC_TST_PRT("req src in mem malloc failed!\n"); ++ ret = -1; ++ goto out; ++ } ++ bak_in = req.in; ++ ++ memcpy(req.in, tv->plaintext, tv->psize); ++ req.in_bytes = tv->psize; ++ ++ req.out = malloc(BUFF_SIZE); ++ if (!req.out) { ++ SEC_TST_PRT("req dst out mem malloc failed!\n"); ++ ret = -1; ++ goto out; ++ } ++ ++ req.out_buf_bytes = BUFF_SIZE; ++ req.out_bytes = tv->dsize; ++ req.data_fmt = g_data_fmt; ++ req.has_next = 0; ++ ++ h_sess = wd_digest_alloc_sess(&setup); ++ if (!h_sess) { ++ ret = -1; ++ goto out; ++ } ++ data_len = tv->psize; ++ ++ /* if mode is HMAC, should set key */ ++ ret = wd_digest_set_key(h_sess, (const __u8 *)tv->key, tv->ksize); ++ if (ret) { ++ SEC_TST_PRT("sess set key failed!\n"); ++ goto out; ++ } ++ ++ ++ while (cnt) { ++ do { ++ if (data_len > 256) { // soft block size ++ req.in_bytes = 256; ++ data_len -= 256; ++ req.has_next = 1; ++ } else { ++ req.has_next = 0; ++ req.in_bytes = data_len; ++ } ++ ret = wd_do_digest_sync(h_sess, &req); ++ ++ if (ret) ++ goto out; ++ ++ if (req.has_next != 0) ++ req.in += 256; ++ else ++ break; ++ } while (true); ++ data_len = tv->psize; ++ req.has_next = 0; ++ req.in = bak_in; ++ memcpy(req.in, tv->plaintext, tv->psize); ++ cnt--; ++ } ++ SEC_TST_PRT("long hash BD dump the out memory:--------->:\n"); ++ dump_mem(g_data_fmt, req.out, 16); ++ ++out: ++ free(req.out); ++ free(req.in); ++ if (h_sess) ++ wd_digest_free_sess(h_sess); ++ ++ digest_uninit_config(); ++ return ret; ++} ++ ++void *digest_sync_stream_mode_send_td(void *data) ++{ ++ int thread_id = (int)syscall(__NR_gettid); ++ struct wd_digest_sess_setup setup = {0}; ++ struct hash_testvec *tv = NULL; ++ unsigned long cnt = g_times; ++ struct wd_digest_req req; ++ int ret, data_len; ++ void *bak_in = NULL; ++ handle_t h_sess = 0; ++ ++ get_digest_resource(&tv, (int *)&setup.alg, (int *)&setup.mode); ++ ++ h_sess = wd_digest_alloc_sess(&setup); ++ if (!h_sess) { ++ ret = -EINVAL; ++ return NULL; ++ } ++ ++ /* if mode is HMAC, should set key */ ++ ret = wd_digest_set_key(h_sess, (const __u8 *)tv->key, tv->ksize); ++ if (ret) { ++ SEC_TST_PRT("sess set key failed!\n"); ++ goto out_key; ++ } ++ ++ /* config arg */ ++ memset(&req, 0, sizeof(struct wd_digest_req)); ++ ++ req.in = malloc(BUFF_SIZE * 8); ++ if (!req.in) { ++ SEC_TST_PRT("req src in mem malloc failed!\n"); ++ ret = -1; ++ goto out; ++ } ++ bak_in = req.in; ++ ++ memcpy(req.in, tv->plaintext, tv->psize); ++ req.in_bytes = tv->psize; ++ ++ req.out = malloc(BUFF_SIZE); ++ if (!req.out) { ++ SEC_TST_PRT("req dst out mem malloc failed!\n"); ++ ret = -1; ++ goto out; ++ } ++ ++ req.out_buf_bytes = BUFF_SIZE; ++ req.out_bytes = tv->dsize; ++ req.data_fmt = g_data_fmt; ++ req.has_next = 0; ++ ++ data_len = tv->psize; ++ ++ while (cnt) { ++ do { ++ if (data_len > 256) { // soft block size ++ req.in_bytes = 256; ++ data_len -= 256; ++ req.has_next = 1; ++ } else { ++ req.has_next = 0; ++ req.in_bytes = data_len; ++ } ++ ret = wd_do_digest_sync(h_sess, &req); ++ ++ if (ret) ++ goto out; ++ ++ if (req.has_next != 0) ++ req.in += 256; ++ else ++ break; ++ ++ } while (true); ++ data_len = tv->psize; ++ req.has_next = 0; ++ req.in = bak_in; ++ memcpy(req.in, tv->plaintext, tv->psize); ++ cnt--; ++ } ++ SEC_TST_PRT("Pid - %d, thread-id - %d, long hash BD dump the out memory:\n", getpid(), thread_id); ++ dump_mem(g_data_fmt, req.out, 16); ++out_key: ++ wd_digest_free_sess(h_sess); ++out: ++ if (req.out) ++ free(req.out); ++ if (bak_in) ++ free(bak_in); ++ return NULL; ++} ++ ++static int sec_digest_sync_stream_mode_multi(void) ++{ ++ static pthread_t sendtd[64]; ++ thread_data_d td_data; ++ int i, ret; ++ ++ /* config setup */ ++ ret = init_digest_ctx_config(CTX_TYPE_ENCRYPT, CTX_MODE_SYNC); ++ if (ret) { ++ SEC_TST_PRT("Fail to init sigle ctx config!\n"); ++ return ret; ++ } ++ ++ /* send thread */ ++ td_data.send_num = g_times; ++ td_data.recv_num = g_times; ++ for (i = 0; i < g_thread_num; i++) { ++ ret = pthread_create(&sendtd[i], NULL, digest_sync_stream_mode_send_td, &td_data); ++ if (ret) { ++ SEC_TST_PRT("Create send thread fail!\n"); ++ goto out_thr; ++ } ++ } ++ ++ /* join thread */ ++ for (i = 0; i < g_thread_num; i++) { ++ ret = pthread_join(sendtd[i], NULL); ++ if (ret) { ++ SEC_TST_PRT("Join sendtd thread fail!\n"); ++ goto out_thr; ++ } ++ } ++ ++out_thr: ++ digest_uninit_config(); ++ return ret; ++} ++ + static void *digest_async_cb(void *data) + { + // struct wd_digest_req *req = (struct wd_digest_req *)data; +@@ -1791,7 +2099,7 @@ static int sec_digest_async_once(void) + + /* if mode is HMAC, should set key */ + if (setup.mode == WD_DIGEST_HMAC) { +- ret = wd_digest_set_key(h_sess, (const __u8*)tv->key, tv->ksize); ++ ret = wd_digest_set_key(h_sess, (const __u8 *)tv->key, tv->ksize); + if (ret) { + SEC_TST_PRT("sess set key failed!\n"); + goto out_key; +@@ -1895,7 +2203,7 @@ static int sec_digest_sync_multi(void) + + /* if mode is HMAC, should set key */ + if (setup.mode == WD_DIGEST_HMAC) { +- ret = wd_digest_set_key(h_sess, (const __u8*)tv->key, tv->ksize); ++ ret = wd_digest_set_key(h_sess, (const __u8 *)tv->key, tv->ksize); + if (ret) { + SEC_TST_PRT("sess set key failed!\n"); + goto out_key; +@@ -1998,7 +2306,7 @@ static int sec_digest_async_multi(void) + + /* if mode is HMAC, should set key */ + if (setup.mode == WD_DIGEST_HMAC) { +- ret = wd_digest_set_key(h_sess, (const __u8*)tv->key, tv->ksize); ++ ret = wd_digest_set_key(h_sess, (const __u8 *)tv->key, tv->ksize); + if (ret) { + SEC_TST_PRT("sess set key failed!\n"); + goto out; +@@ -3471,7 +3779,7 @@ out_thr: + static void print_help(void) + { + SEC_TST_PRT("NAME\n"); +- SEC_TST_PRT(" test_hisi_sec: test wd sec function,etc\n"); ++ SEC_TST_PRT(" test_hisi_sec: test wd sec function,etc\n"); + SEC_TST_PRT("USAGE\n"); + SEC_TST_PRT(" test_hisi_sec [--cipher] [--digest] [--aead] [--perf]\n"); + SEC_TST_PRT(" test_hisi_sec [--optype] [--pktlen] [--keylen] [--times]\n"); +@@ -3498,6 +3806,7 @@ static void print_help(void) + SEC_TST_PRT(" [--optype]:\n"); + SEC_TST_PRT(" 0 : encryption operation or normal mode for hash\n"); + SEC_TST_PRT(" 1 : decryption operation or hmac mode for hash\n"); ++ SEC_TST_PRT(" 3 : hmac mode for stream hash mode\n"); + SEC_TST_PRT(" [--pktlen]:\n"); + SEC_TST_PRT(" set the length of BD message in bytes\n"); + SEC_TST_PRT(" [--keylen]:\n"); +@@ -3514,10 +3823,12 @@ static void print_help(void) + SEC_TST_PRT(" the number of QP queues used by the entire test task\n"); + SEC_TST_PRT(" [--help] = usage\n"); + SEC_TST_PRT("Example\n"); +- SEC_TST_PRT(" ./test_hisi_sec --cipher 0 --sync --optype 0 \n"); +- SEC_TST_PRT(" --pktlen 16 --keylen 16 --times 1 --multi 1\n"); +- SEC_TST_PRT(" ./test_hisi_sec --perf --sync --pktlen 1024 --block 1024 \n"); +- SEC_TST_PRT(" --blknum 100000 --times 10000 --multi 1 --ctxnum 1\n"); ++ SEC_TST_PRT(" ./test_hisi_sec --cipher 0 --sync --optype 0\n"); ++ SEC_TST_PRT("--pktlen 16 --keylen 16 --times 1 --multi 1\n"); ++ SEC_TST_PRT(" ./test_hisi_sec --digest 0 --sync --optype 3\n"); ++ SEC_TST_PRT("--pktlen 16 --keylen 16 --times 1 --multi 2\n"); ++ SEC_TST_PRT(" ./test_hisi_sec --perf --sync --pktlen 1024 --block 1024\n"); ++ SEC_TST_PRT("--blknum 100000 --times 10000 --multi 1 --ctxnum 1\n"); + SEC_TST_PRT("UPDATE:2020-11-06\n"); + } + +@@ -3684,6 +3995,28 @@ static int test_sec_default_case() + return test_sec_cipher_sync_once(); + } + ++static void long_hash_data_init(void) ++{ ++ g_long_hash_tv.plaintext = malloc(g_pktlen); ++ if (g_long_hash_tv.plaintext == NULL) ++ return; ++ ++ g_long_hash_tv.psize = g_pktlen; ++ ++ g_long_hash_tv.key = malloc(16); ++ if (g_long_hash_tv.key == NULL) { ++ free(g_long_hash_tv.plaintext); ++ return; ++ } ++ g_long_hash_tv.ksize = 16; ++} ++ ++static void long_hash_data_uninit(void) ++{ ++ free(g_long_hash_tv.plaintext); ++ free(g_long_hash_tv.key); ++} ++ + static int test_sec_run(__u32 sync_mode, __u32 alg_class) + { + int ret = 0; +@@ -3698,13 +4031,26 @@ static int test_sec_run(__u32 sync_mode, __u32 alg_class) + SEC_TST_PRT("currently cipher test is synchronize once, one thread!\n"); + } + } else if (alg_class == DIGEST_CLASS) { +- if (g_thread_num > 1) { +- SEC_TST_PRT("currently digest test is synchronize multi -%d threads!\n", g_thread_num); ++ SEC_TST_PRT("hisi_sec HMAC-digest mode.\n"); ++ long_hash_data_init(); ++ if (g_thread_num > 1 && g_direction != 3) { ++ SEC_TST_PRT("currently digest test is synchronize psize:%u, multi -%d threads!\n", g_pktlen, g_thread_num); + ret = sec_digest_sync_multi(); ++ } else if (g_thread_num > 1 && g_direction == 3) { ++ ret = sec_digest_sync_stream_mode_multi(); ++ (void)sec_digest_sync_stream_cmp(); ++ SEC_TST_PRT("currently digest long hash mode, psize:%u, multi thread!\n", g_pktlen); ++ } else if (g_thread_num == 1 && g_direction == 3) { ++ if (g_ivlen == 1) { ++ ret = sec_digest_sync_stream_mode(); ++ (void)sec_digest_sync_stream_cmp(); ++ SEC_TST_PRT("currently digest long hash mode, psize:%u, one thread!\n", g_pktlen); ++ } + } else { + ret = sec_digest_sync_once(); + SEC_TST_PRT("currently digest test is synchronize once, one thread!\n"); + } ++ long_hash_data_uninit(); + } else if (alg_class == AEAD_CLASS) { + if (g_thread_num > 1) { + SEC_TST_PRT("currently aead test is synchronize multi -%d threads!\n", g_thread_num); +diff --git a/test/hisi_sec_test/test_hisi_sec.h b/test/hisi_sec_test/test_hisi_sec.h +index f0d0812..defd3c4 100644 +--- a/test/hisi_sec_test/test_hisi_sec.h ++++ b/test/hisi_sec_test/test_hisi_sec.h +@@ -41,8 +41,8 @@ struct cipher_testvec { + }; + + struct hash_testvec { +- const char *key; +- const char *plaintext; ++ char *key; ++ char *plaintext; + const char *digest; + unsigned int psize; + unsigned short ksize; +-- +2.31.1 + diff --git a/0003-aead-cipher-digest-fix-some-code-issues.patch b/0003-aead-cipher-digest-fix-some-code-issues.patch new file mode 100644 index 0000000..e96da7f --- /dev/null +++ b/0003-aead-cipher-digest-fix-some-code-issues.patch @@ -0,0 +1,82 @@ +From a119cf2838ee41078c452f93d5b48bea2561dfcc Mon Sep 17 00:00:00 2001 +From: Kai Ye +Date: Tue, 14 Dec 2021 19:24:47 +0800 +Subject: [PATCH 03/28] aead/cipher/digest: fix some code issues + +1. Due to the schedule already has the a checking for poll + policy, so delete the checking for poll policy in poll. +2. modify some comments. + +Signed-off-by: Kai Ye +--- + wd_aead.c | 9 ++------- + wd_cipher.c | 5 ----- + wd_digest.c | 5 ----- + 3 files changed, 2 insertions(+), 17 deletions(-) + +diff --git a/wd_aead.c b/wd_aead.c +index 54bd28d..f93f791 100644 +--- a/wd_aead.c ++++ b/wd_aead.c +@@ -367,12 +367,12 @@ static int aead_param_check(struct wd_aead_sess *sess, + static int aead_init_check(struct wd_ctx_config *config, struct wd_sched *sched) + { + if (!config || !sched) { +- WD_ERR("failed to check aead init input param!\n"); ++ WD_ERR("wd aead config or sched is NULL!\n"); + return -WD_EINVAL; + } + + if (!wd_is_sva(config->ctxs[0].ctx)) { +- WD_ERR("failed to system is SVA mode!\n"); ++ WD_ERR("err, non sva, please check system!\n"); + return -WD_EINVAL; + } + +@@ -660,11 +660,6 @@ int wd_aead_poll(__u32 expt, __u32 *count) + handle_t h_ctx = wd_aead_setting.sched.h_sched_ctx; + struct wd_sched *sched = &wd_aead_setting.sched; + +- if (unlikely(!sched->poll_policy)) { +- WD_ERR("failed to check aead poll_policy!\n"); +- return -WD_EINVAL; +- } +- + return sched->poll_policy(h_ctx, expt, count); + } + +diff --git a/wd_cipher.c b/wd_cipher.c +index f9d643d..9977765 100644 +--- a/wd_cipher.c ++++ b/wd_cipher.c +@@ -580,11 +580,6 @@ int wd_cipher_poll(__u32 expt, __u32 *count) + handle_t h_ctx = wd_cipher_setting.sched.h_sched_ctx; + struct wd_sched *sched = &wd_cipher_setting.sched; + +- if (unlikely(!sched->poll_policy)) { +- WD_ERR("failed to check cipher poll_policy!\n"); +- return -WD_EINVAL; +- } +- + return sched->poll_policy(h_ctx, expt, count); + } + +diff --git a/wd_digest.c b/wd_digest.c +index c110f7b..1962f09 100644 +--- a/wd_digest.c ++++ b/wd_digest.c +@@ -484,11 +484,6 @@ int wd_digest_poll(__u32 expt, __u32 *count) + handle_t h_ctx = wd_digest_setting.sched.h_sched_ctx; + struct wd_sched *sched = &wd_digest_setting.sched; + +- if (unlikely(!sched->poll_policy)) { +- WD_ERR("failed to check digest poll_policy!\n"); +- return -WD_EINVAL; +- } +- + return sched->poll_policy(h_ctx, expt, count); + } + +-- +2.31.1 + diff --git a/0004-digest-v1-fixed-hmac-key-0-length-checking.patch b/0004-digest-v1-fixed-hmac-key-0-length-checking.patch new file mode 100644 index 0000000..ceb8e9d --- /dev/null +++ b/0004-digest-v1-fixed-hmac-key-0-length-checking.patch @@ -0,0 +1,28 @@ +From d27f5accc09bc63d81a6a972fd019e208cddc9a8 Mon Sep 17 00:00:00 2001 +From: Kai Ye +Date: Tue, 14 Dec 2021 19:24:48 +0800 +Subject: [PATCH 04/28] digest/v1: fixed hmac key 0 length checking + +The length of keylen checking v1 and v2 should be the same. + +Signed-off-by: Kai Ye +--- + v1/wd_digest.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/v1/wd_digest.c b/v1/wd_digest.c +index 6b22cdd..d684512 100644 +--- a/v1/wd_digest.c ++++ b/v1/wd_digest.c +@@ -243,7 +243,7 @@ int wcrypto_set_digest_key(void *ctx, __u8 *key, __u16 key_len) + return -WD_EINVAL; + } + +- if (key_len > MAX_HMAC_KEY_SIZE) { ++ if (key_len == 0 || key_len > MAX_HMAC_KEY_SIZE) { + WD_ERR("%s: input key length err!\n", __func__); + return -WD_EINVAL; + } +-- +2.31.1 + diff --git a/0005-digest-v1-check-the-length-of-the-key-need-to-be-cha.patch b/0005-digest-v1-check-the-length-of-the-key-need-to-be-cha.patch new file mode 100644 index 0000000..67d48d1 --- /dev/null +++ b/0005-digest-v1-check-the-length-of-the-key-need-to-be-cha.patch @@ -0,0 +1,31 @@ +From 6136bd700e5f5b23843a3e8aae9e3a925c37ca50 Mon Sep 17 00:00:00 2001 +From: Kai Ye +Date: Tue, 14 Dec 2021 19:24:49 +0800 +Subject: [PATCH 05/28] digest/v1: check the length of the key need to be + changed. + +The maximum length of the key is fixed by digest spec. + +Signed-off-by: Kai Ye +--- + v1/wd_digest.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/v1/wd_digest.c b/v1/wd_digest.c +index d684512..aae4823 100644 +--- a/v1/wd_digest.c ++++ b/v1/wd_digest.c +@@ -243,7 +243,9 @@ int wcrypto_set_digest_key(void *ctx, __u8 *key, __u16 key_len) + return -WD_EINVAL; + } + +- if (key_len == 0 || key_len > MAX_HMAC_KEY_SIZE) { ++ if ((ctxt->setup.alg <= WCRYPTO_SHA224 && key_len > ++ MAX_HMAC_KEY_SIZE >> 1) || key_len == 0 || ++ key_len > MAX_HMAC_KEY_SIZE) { + WD_ERR("%s: input key length err!\n", __func__); + return -WD_EINVAL; + } +-- +2.31.1 + diff --git a/0006-qm-v1-fixup-the-incorrect-configuration-of-the-type.patch b/0006-qm-v1-fixup-the-incorrect-configuration-of-the-type.patch new file mode 100644 index 0000000..e6355a7 --- /dev/null +++ b/0006-qm-v1-fixup-the-incorrect-configuration-of-the-type.patch @@ -0,0 +1,67 @@ +From 1903e366f228ac6ee9dfb826b75b9d698bb180d8 Mon Sep 17 00:00:00 2001 +From: Kai Ye +Date: Wed, 22 Dec 2021 14:38:03 +0800 +Subject: [PATCH 07/28] qm/v1: fixup the incorrect configuration of the type + +1. SEC should setting the sqc type is 0. it doesn't depend on +encryption or decryption direction. +2. Modify the HPRE sqc type configuration. + +Signed-off-by: Kai Ye +--- + v1/drv/hisi_qm_udrv.c | 5 +++++ + v1/wd.h | 5 ++++- + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/v1/drv/hisi_qm_udrv.c b/v1/drv/hisi_qm_udrv.c +index 7fb6599..02aaf81 100644 +--- a/v1/drv/hisi_qm_udrv.c ++++ b/v1/drv/hisi_qm_udrv.c +@@ -277,16 +277,19 @@ static bool hpre_alg_info_init(struct wd_queue *q, const char *alg) + struct qm_queue_info *info = qinfo->priv; + bool is_found = true; + ++ /* DH/RSA: qm sqc_type = 0, ECC: qm sqc_type = 1 */ + if (!strcmp(alg, "rsa")) { + qinfo->atype = WCRYPTO_RSA; + info->sqe_size = QM_HPRE_BD_SIZE; + info->sqe_fill[WCRYPTO_RSA] = qm_fill_rsa_sqe; + info->sqe_parse[WCRYPTO_RSA] = qm_parse_rsa_sqe; ++ priv->direction = 0; + } else if (!strcmp(alg, "dh")) { + qinfo->atype = WCRYPTO_DH; + info->sqe_size = QM_HPRE_BD_SIZE; + info->sqe_fill[WCRYPTO_DH] = qm_fill_dh_sqe; + info->sqe_parse[WCRYPTO_DH] = qm_parse_dh_sqe; ++ priv->direction = 0; + } else if (!strcmp(alg, "ecdh")) { + qinfo->atype = WCRYPTO_ECDH; + info->sqe_size = QM_HPRE_BD_SIZE; +@@ -414,6 +417,8 @@ static int qm_set_queue_alg_info(struct wd_queue *q) + } else if (zip_alg_info_init(qinfo, alg)) { + ret = WD_SUCCESS; + } else if (sec_alg_info_init(qinfo, alg)) { ++ /* setting the type is 0 for sqc_type */ ++ priv->direction = 0; + ret = WD_SUCCESS; + } else if (!strcmp(alg, "xts(aes)") || + !strcmp(alg, "xts(sm4)")) { +diff --git a/v1/wd.h b/v1/wd.h +index 30fbf89..3dd69eb 100644 +--- a/v1/wd.h ++++ b/v1/wd.h +@@ -73,7 +73,10 @@ struct wcrypto_cb_tag { + }; + + struct wcrypto_paras { +- /* 0--encipher/compress .etc, 1 ---decipher/decomp .etc */ ++ /* ++ * 0--encipher/compress .etc, 1 ---decipher/decomp .etc ++ * it not been used for HiSilicon SEC currently. ++ */ + __u8 direction; + __u8 is_poll; + +-- +2.31.1 + diff --git a/0007-qm-fixup-the-incorrect-configuration-of-the-type.patch b/0007-qm-fixup-the-incorrect-configuration-of-the-type.patch new file mode 100644 index 0000000..649783f --- /dev/null +++ b/0007-qm-fixup-the-incorrect-configuration-of-the-type.patch @@ -0,0 +1,30 @@ +From c602a3e77fbd95286e233c7ed257762687d8ebac Mon Sep 17 00:00:00 2001 +From: Kai Ye +Date: Wed, 22 Dec 2021 14:38:04 +0800 +Subject: [PATCH 08/28] qm: fixup the incorrect configuration of the type + +SEC should setting the sqc type is 0. it doesn't depend on +global configuration. + +Signed-off-by: Kai Ye +--- + drv/hisi_sec.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drv/hisi_sec.c b/drv/hisi_sec.c +index 2fd23f3..603bdda 100644 +--- a/drv/hisi_sec.c ++++ b/drv/hisi_sec.c +@@ -2306,7 +2306,8 @@ int hisi_sec_init(struct wd_ctx_config_internal *config, void *priv) + /* allocate qp for each context */ + for (i = 0; i < config->ctx_num; i++) { + h_ctx = config->ctxs[i].ctx; +- qm_priv.op_type = config->ctxs[i].op_type; ++ /* setting the type is 0 for sqc_type */ ++ qm_priv.op_type = 0; + qm_priv.qp_mode = config->ctxs[i].ctx_mode; + qm_priv.idx = i; + h_qp = hisi_qm_alloc_qp(&qm_priv, h_ctx); +-- +2.31.1 + diff --git a/0008-uadk_benchmark-use-the-uadk_tool-instead-of-uadk_ben.patch b/0008-uadk_benchmark-use-the-uadk_tool-instead-of-uadk_ben.patch new file mode 100644 index 0000000..1c82e90 --- /dev/null +++ b/0008-uadk_benchmark-use-the-uadk_tool-instead-of-uadk_ben.patch @@ -0,0 +1,1125 @@ +From 3e5fb836012fded133ead1c6c4bbed15396e3b1e Mon Sep 17 00:00:00 2001 +From: Kai Ye +Date: Thu, 23 Dec 2021 09:45:34 +0800 +Subject: [PATCH 09/28] uadk_benchmark: use the uadk_tool instead of + uadk_benchmark + +The uadk_tool include the benchmark and dfx function. The benchmark +supports performance test, and the dfx provides some maintenance +capabilities. Like library version and build time. Developers can +also add other features. + +Signed-off-by: Kai Ye +--- + Makefile.am | 2 +- + cleanup.sh | 4 +- + configure.ac | 2 +- + {uadk_benchmark => uadk_tool}/Makefile.am | 14 +-- + .../include/libcrypto.a | Bin + .../include/libcrypto.so.1.1 | Bin + .../include/openssl/aes.h | 0 + .../include/openssl/asn1.h | 0 + .../include/openssl/asn1_mac.h | 0 + .../include/openssl/asn1err.h | 0 + .../include/openssl/asn1t.h | 0 + .../include/openssl/async.h | 0 + .../include/openssl/asyncerr.h | 0 + .../include/openssl/bio.h | 0 + .../include/openssl/bioerr.h | 0 + .../include/openssl/blowfish.h | 0 + .../include/openssl/bn.h | 0 + .../include/openssl/bnerr.h | 0 + .../include/openssl/buffer.h | 0 + .../include/openssl/buffererr.h | 0 + .../include/openssl/camellia.h | 0 + .../include/openssl/cast.h | 0 + .../include/openssl/cmac.h | 0 + .../include/openssl/cms.h | 0 + .../include/openssl/cmserr.h | 0 + .../include/openssl/comp.h | 0 + .../include/openssl/comperr.h | 0 + .../include/openssl/conf.h | 0 + .../include/openssl/conf_api.h | 0 + .../include/openssl/conferr.h | 0 + .../include/openssl/crypto.h | 0 + .../include/openssl/cryptoerr.h | 0 + .../include/openssl/ct.h | 0 + .../include/openssl/cterr.h | 0 + .../include/openssl/des.h | 0 + .../include/openssl/dh.h | 0 + .../include/openssl/dherr.h | 0 + .../include/openssl/dsa.h | 0 + .../include/openssl/dsaerr.h | 0 + .../include/openssl/dtls1.h | 0 + .../include/openssl/e_os2.h | 0 + .../include/openssl/ebcdic.h | 0 + .../include/openssl/ec.h | 0 + .../include/openssl/ecdh.h | 0 + .../include/openssl/ecdsa.h | 0 + .../include/openssl/ecerr.h | 0 + .../include/openssl/engine.h | 0 + .../include/openssl/engineerr.h | 0 + .../include/openssl/err.h | 0 + .../include/openssl/evp.h | 0 + .../include/openssl/evperr.h | 0 + .../include/openssl/hmac.h | 0 + .../include/openssl/idea.h | 0 + .../include/openssl/kdf.h | 0 + .../include/openssl/kdferr.h | 0 + .../include/openssl/lhash.h | 0 + .../include/openssl/md2.h | 0 + .../include/openssl/md4.h | 0 + .../include/openssl/md5.h | 0 + .../include/openssl/mdc2.h | 0 + .../include/openssl/modes.h | 0 + .../include/openssl/obj_mac.h | 0 + .../include/openssl/objects.h | 0 + .../include/openssl/objectserr.h | 0 + .../include/openssl/ocsp.h | 0 + .../include/openssl/ocsperr.h | 0 + .../include/openssl/opensslconf.h | 0 + .../include/openssl/opensslv.h | 0 + .../include/openssl/ossl_typ.h | 0 + .../include/openssl/pem.h | 0 + .../include/openssl/pem2.h | 0 + .../include/openssl/pemerr.h | 0 + .../include/openssl/pkcs12.h | 0 + .../include/openssl/pkcs12err.h | 0 + .../include/openssl/pkcs7.h | 0 + .../include/openssl/pkcs7err.h | 0 + .../include/openssl/rand.h | 0 + .../include/openssl/rand_drbg.h | 0 + .../include/openssl/randerr.h | 0 + .../include/openssl/rc2.h | 0 + .../include/openssl/rc4.h | 0 + .../include/openssl/rc5.h | 0 + .../include/openssl/ripemd.h | 0 + .../include/openssl/rsa.h | 0 + .../include/openssl/rsaerr.h | 0 + .../include/openssl/safestack.h | 0 + .../include/openssl/seed.h | 0 + .../include/openssl/sha.h | 0 + .../include/openssl/srp.h | 0 + .../include/openssl/srtp.h | 0 + .../include/openssl/ssl.h | 0 + .../include/openssl/ssl2.h | 0 + .../include/openssl/ssl3.h | 0 + .../include/openssl/sslerr.h | 0 + .../include/openssl/stack.h | 0 + .../include/openssl/store.h | 0 + .../include/openssl/storeerr.h | 0 + .../include/openssl/symhacks.h | 0 + .../include/openssl/tls1.h | 0 + .../include/openssl/ts.h | 0 + .../include/openssl/tserr.h | 0 + .../include/openssl/txt_db.h | 0 + .../include/openssl/ui.h | 0 + .../include/openssl/uierr.h | 0 + .../include/openssl/whrlpool.h | 0 + .../include/openssl/x509.h | 0 + .../include/openssl/x509_vfy.h | 0 + .../include/openssl/x509err.h | 0 + .../include/openssl/x509v3.h | 0 + .../include/openssl/x509v3err.h | 0 + .../sec_soft_benchmark.c | 0 + .../sec_soft_benchmark.h | 0 + .../sec_uadk_benchmark.c | 0 + .../sec_uadk_benchmark.h | 0 + .../sec_wd_benchmark.c | 0 + .../sec_wd_benchmark.h | 0 + .../uadk_benchmark.c | 86 +++++++----------- + .../uadk_benchmark.h | 5 + + uadk_tool/uadk_dfx.c | 79 ++++++++++++++++ + uadk_tool/uadk_dfx.h | 10 ++ + uadk_tool/uadk_tool.c | 44 +++++++++ + 121 files changed, 183 insertions(+), 63 deletions(-) + mode change 100755 => 100644 cleanup.sh + rename {uadk_benchmark => uadk_tool}/Makefile.am (54%) + rename {uadk_benchmark => uadk_tool}/include/libcrypto.a (100%) + rename {uadk_benchmark => uadk_tool}/include/libcrypto.so.1.1 (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/aes.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/asn1.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/asn1_mac.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/asn1err.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/asn1t.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/async.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/asyncerr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/bio.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/bioerr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/blowfish.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/bn.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/bnerr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/buffer.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/buffererr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/camellia.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/cast.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/cmac.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/cms.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/cmserr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/comp.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/comperr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/conf.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/conf_api.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/conferr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/crypto.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/cryptoerr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ct.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/cterr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/des.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/dh.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/dherr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/dsa.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/dsaerr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/dtls1.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/e_os2.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ebcdic.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ec.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ecdh.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ecdsa.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ecerr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/engine.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/engineerr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/err.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/evp.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/evperr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/hmac.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/idea.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/kdf.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/kdferr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/lhash.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/md2.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/md4.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/md5.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/mdc2.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/modes.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/obj_mac.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/objects.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/objectserr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ocsp.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ocsperr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/opensslconf.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/opensslv.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ossl_typ.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/pem.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/pem2.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/pemerr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/pkcs12.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/pkcs12err.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/pkcs7.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/pkcs7err.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/rand.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/rand_drbg.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/randerr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/rc2.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/rc4.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/rc5.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ripemd.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/rsa.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/rsaerr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/safestack.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/seed.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/sha.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/srp.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/srtp.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ssl.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ssl2.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ssl3.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/sslerr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/stack.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/store.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/storeerr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/symhacks.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/tls1.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ts.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/tserr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/txt_db.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/ui.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/uierr.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/whrlpool.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/x509.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/x509_vfy.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/x509err.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/x509v3.h (100%) + rename {uadk_benchmark => uadk_tool}/include/openssl/x509v3err.h (100%) + rename {uadk_benchmark => uadk_tool}/sec_soft_benchmark.c (100%) + rename {uadk_benchmark => uadk_tool}/sec_soft_benchmark.h (100%) + rename {uadk_benchmark => uadk_tool}/sec_uadk_benchmark.c (100%) + rename {uadk_benchmark => uadk_tool}/sec_uadk_benchmark.h (100%) + rename {uadk_benchmark => uadk_tool}/sec_wd_benchmark.c (100%) + rename {uadk_benchmark => uadk_tool}/sec_wd_benchmark.h (100%) + rename {uadk_benchmark => uadk_tool}/uadk_benchmark.c (91%) + rename {uadk_benchmark => uadk_tool}/uadk_benchmark.h (93%) + create mode 100644 uadk_tool/uadk_dfx.c + create mode 100644 uadk_tool/uadk_dfx.h + create mode 100644 uadk_tool/uadk_tool.c + +diff --git a/Makefile.am b/Makefile.am +index f4f80fa..cd25bce 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -119,4 +119,4 @@ libhisi_hpre_la_DEPENDENCIES= libwd.la libwd_crypto.la + endif # WD_STATIC_DRV + + +-SUBDIRS=. test v1/test uadk_benchmark sample ++SUBDIRS=. test v1/test uadk_tool sample +diff --git a/cleanup.sh b/cleanup.sh +old mode 100755 +new mode 100644 +index d11d498..60adc98 +--- a/cleanup.sh ++++ b/cleanup.sh +@@ -11,8 +11,8 @@ FILES="aclocal.m4 autom4te.cache compile config.guess config.h.in config.log \ + test/Makefile test/Makefile.in test/hisi_hpre_test/Makefile.in \ + test/hisi_hpre_test/Makefile test/hisi_sec_test/Makefile \ + test/hisi_sec_test/Makefile.in test/hisi_zip_test/Makefile \ +- test/hisi_zip_test/Makefile.in uadk_benchmark/Makefile \ +- uadk_benchmark/Makefile.in \ ++ test/hisi_zip_test/Makefile.in uadk_tool/Makefile \ ++ uadk_tool/Makefile.in \ + v1/Makefile.in v1/Makefile.in v1/test/Makefile v1/test/Makefile.in \ + v1/test/test_mm/Makefile v1/test/test_mm/Makefile.in \ + v1/test/bmm_test/Makefile v1/test/bmm_test/Makefile.in" +diff --git a/configure.ac b/configure.ac +index aa524f5..b509393 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -87,7 +87,7 @@ AC_CONFIG_FILES([Makefile + test/hisi_hpre_test/Makefile + test/hisi_sec_test/Makefile + test/hisi_zip_test/Makefile +- uadk_benchmark/Makefile ++ uadk_tool/Makefile + sample/Makefile + v1/test/Makefile + v1/test/bmm_test/Makefile +diff --git a/uadk_benchmark/Makefile.am b/uadk_tool/Makefile.am +similarity index 54% +rename from uadk_benchmark/Makefile.am +rename to uadk_tool/Makefile.am +index 5fd16a9..36536a2 100644 +--- a/uadk_benchmark/Makefile.am ++++ b/uadk_tool/Makefile.am +@@ -1,24 +1,24 @@ + ACLOCAL_AMFLAGS = -I m4 -I./include + AM_CFLAGS=-Wall -fno-strict-aliasing -I$(top_srcdir) -I$(top_srcdir)/include \ +- -I$(top_srcdir)/uadk_benchmark/include -pthread ++ -I$(top_srcdir)/uadk_tool/include -pthread + + #AUTOMAKE_OPTIONS = subdir-objects + +-bin_PROGRAMS=uadk_benchmark ++bin_PROGRAMS=uadk_tool + +-uadk_benchmark_SOURCES=uadk_benchmark.c \ ++uadk_tool_SOURCES=uadk_tool.c uadk_dfx.c uadk_benchmark.c \ + sec_uadk_benchmark.c sec_wd_benchmark.c sec_soft_benchmark.c + + if WD_STATIC_DRV + AM_CFLAGS+=-Bstatic +-uadk_benchmark_LDADD=$(libwd_la_OBJECTS) \ ++uadk_tool_LDADD=$(libwd_la_OBJECTS) \ + $(libwd_crypto_la_OBJECTS) \ + ../.libs/libhisi_sec.a \ + ../.libs/libhisi_hpre.a \ + ../.libs/libhisi_zip.a \ + include/libcrypto.a -ldl -lnuma + else +-uadk_benchmark_LDADD=-L../.libs -l:libwd.so.2 -l:libwd_crypto.so.2 \ +- -L$(top_srcdir)/uadk_benchmark/include -l:libcrypto.so.1.1 -lnuma ++uadk_tool_LDADD=-L../.libs -l:libwd.so.2 -l:libwd_crypto.so.2 \ ++ -L$(top_srcdir)/uadk_tool/include -l:libcrypto.so.1.1 -lnuma + endif +-uadk_benchmark_LDFLAGS=-Wl,-rpath,'/usr/local/lib' ++uadk_tool_LDFLAGS=-Wl,-rpath,'/usr/local/lib' +diff --git a/uadk_benchmark/include/libcrypto.a b/uadk_tool/include/libcrypto.a +similarity index 100% +rename from uadk_benchmark/include/libcrypto.a +rename to uadk_tool/include/libcrypto.a +diff --git a/uadk_benchmark/include/libcrypto.so.1.1 b/uadk_tool/include/libcrypto.so.1.1 +similarity index 100% +rename from uadk_benchmark/include/libcrypto.so.1.1 +rename to uadk_tool/include/libcrypto.so.1.1 +diff --git a/uadk_benchmark/include/openssl/aes.h b/uadk_tool/include/openssl/aes.h +similarity index 100% +rename from uadk_benchmark/include/openssl/aes.h +rename to uadk_tool/include/openssl/aes.h +diff --git a/uadk_benchmark/include/openssl/asn1.h b/uadk_tool/include/openssl/asn1.h +similarity index 100% +rename from uadk_benchmark/include/openssl/asn1.h +rename to uadk_tool/include/openssl/asn1.h +diff --git a/uadk_benchmark/include/openssl/asn1_mac.h b/uadk_tool/include/openssl/asn1_mac.h +similarity index 100% +rename from uadk_benchmark/include/openssl/asn1_mac.h +rename to uadk_tool/include/openssl/asn1_mac.h +diff --git a/uadk_benchmark/include/openssl/asn1err.h b/uadk_tool/include/openssl/asn1err.h +similarity index 100% +rename from uadk_benchmark/include/openssl/asn1err.h +rename to uadk_tool/include/openssl/asn1err.h +diff --git a/uadk_benchmark/include/openssl/asn1t.h b/uadk_tool/include/openssl/asn1t.h +similarity index 100% +rename from uadk_benchmark/include/openssl/asn1t.h +rename to uadk_tool/include/openssl/asn1t.h +diff --git a/uadk_benchmark/include/openssl/async.h b/uadk_tool/include/openssl/async.h +similarity index 100% +rename from uadk_benchmark/include/openssl/async.h +rename to uadk_tool/include/openssl/async.h +diff --git a/uadk_benchmark/include/openssl/asyncerr.h b/uadk_tool/include/openssl/asyncerr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/asyncerr.h +rename to uadk_tool/include/openssl/asyncerr.h +diff --git a/uadk_benchmark/include/openssl/bio.h b/uadk_tool/include/openssl/bio.h +similarity index 100% +rename from uadk_benchmark/include/openssl/bio.h +rename to uadk_tool/include/openssl/bio.h +diff --git a/uadk_benchmark/include/openssl/bioerr.h b/uadk_tool/include/openssl/bioerr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/bioerr.h +rename to uadk_tool/include/openssl/bioerr.h +diff --git a/uadk_benchmark/include/openssl/blowfish.h b/uadk_tool/include/openssl/blowfish.h +similarity index 100% +rename from uadk_benchmark/include/openssl/blowfish.h +rename to uadk_tool/include/openssl/blowfish.h +diff --git a/uadk_benchmark/include/openssl/bn.h b/uadk_tool/include/openssl/bn.h +similarity index 100% +rename from uadk_benchmark/include/openssl/bn.h +rename to uadk_tool/include/openssl/bn.h +diff --git a/uadk_benchmark/include/openssl/bnerr.h b/uadk_tool/include/openssl/bnerr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/bnerr.h +rename to uadk_tool/include/openssl/bnerr.h +diff --git a/uadk_benchmark/include/openssl/buffer.h b/uadk_tool/include/openssl/buffer.h +similarity index 100% +rename from uadk_benchmark/include/openssl/buffer.h +rename to uadk_tool/include/openssl/buffer.h +diff --git a/uadk_benchmark/include/openssl/buffererr.h b/uadk_tool/include/openssl/buffererr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/buffererr.h +rename to uadk_tool/include/openssl/buffererr.h +diff --git a/uadk_benchmark/include/openssl/camellia.h b/uadk_tool/include/openssl/camellia.h +similarity index 100% +rename from uadk_benchmark/include/openssl/camellia.h +rename to uadk_tool/include/openssl/camellia.h +diff --git a/uadk_benchmark/include/openssl/cast.h b/uadk_tool/include/openssl/cast.h +similarity index 100% +rename from uadk_benchmark/include/openssl/cast.h +rename to uadk_tool/include/openssl/cast.h +diff --git a/uadk_benchmark/include/openssl/cmac.h b/uadk_tool/include/openssl/cmac.h +similarity index 100% +rename from uadk_benchmark/include/openssl/cmac.h +rename to uadk_tool/include/openssl/cmac.h +diff --git a/uadk_benchmark/include/openssl/cms.h b/uadk_tool/include/openssl/cms.h +similarity index 100% +rename from uadk_benchmark/include/openssl/cms.h +rename to uadk_tool/include/openssl/cms.h +diff --git a/uadk_benchmark/include/openssl/cmserr.h b/uadk_tool/include/openssl/cmserr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/cmserr.h +rename to uadk_tool/include/openssl/cmserr.h +diff --git a/uadk_benchmark/include/openssl/comp.h b/uadk_tool/include/openssl/comp.h +similarity index 100% +rename from uadk_benchmark/include/openssl/comp.h +rename to uadk_tool/include/openssl/comp.h +diff --git a/uadk_benchmark/include/openssl/comperr.h b/uadk_tool/include/openssl/comperr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/comperr.h +rename to uadk_tool/include/openssl/comperr.h +diff --git a/uadk_benchmark/include/openssl/conf.h b/uadk_tool/include/openssl/conf.h +similarity index 100% +rename from uadk_benchmark/include/openssl/conf.h +rename to uadk_tool/include/openssl/conf.h +diff --git a/uadk_benchmark/include/openssl/conf_api.h b/uadk_tool/include/openssl/conf_api.h +similarity index 100% +rename from uadk_benchmark/include/openssl/conf_api.h +rename to uadk_tool/include/openssl/conf_api.h +diff --git a/uadk_benchmark/include/openssl/conferr.h b/uadk_tool/include/openssl/conferr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/conferr.h +rename to uadk_tool/include/openssl/conferr.h +diff --git a/uadk_benchmark/include/openssl/crypto.h b/uadk_tool/include/openssl/crypto.h +similarity index 100% +rename from uadk_benchmark/include/openssl/crypto.h +rename to uadk_tool/include/openssl/crypto.h +diff --git a/uadk_benchmark/include/openssl/cryptoerr.h b/uadk_tool/include/openssl/cryptoerr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/cryptoerr.h +rename to uadk_tool/include/openssl/cryptoerr.h +diff --git a/uadk_benchmark/include/openssl/ct.h b/uadk_tool/include/openssl/ct.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ct.h +rename to uadk_tool/include/openssl/ct.h +diff --git a/uadk_benchmark/include/openssl/cterr.h b/uadk_tool/include/openssl/cterr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/cterr.h +rename to uadk_tool/include/openssl/cterr.h +diff --git a/uadk_benchmark/include/openssl/des.h b/uadk_tool/include/openssl/des.h +similarity index 100% +rename from uadk_benchmark/include/openssl/des.h +rename to uadk_tool/include/openssl/des.h +diff --git a/uadk_benchmark/include/openssl/dh.h b/uadk_tool/include/openssl/dh.h +similarity index 100% +rename from uadk_benchmark/include/openssl/dh.h +rename to uadk_tool/include/openssl/dh.h +diff --git a/uadk_benchmark/include/openssl/dherr.h b/uadk_tool/include/openssl/dherr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/dherr.h +rename to uadk_tool/include/openssl/dherr.h +diff --git a/uadk_benchmark/include/openssl/dsa.h b/uadk_tool/include/openssl/dsa.h +similarity index 100% +rename from uadk_benchmark/include/openssl/dsa.h +rename to uadk_tool/include/openssl/dsa.h +diff --git a/uadk_benchmark/include/openssl/dsaerr.h b/uadk_tool/include/openssl/dsaerr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/dsaerr.h +rename to uadk_tool/include/openssl/dsaerr.h +diff --git a/uadk_benchmark/include/openssl/dtls1.h b/uadk_tool/include/openssl/dtls1.h +similarity index 100% +rename from uadk_benchmark/include/openssl/dtls1.h +rename to uadk_tool/include/openssl/dtls1.h +diff --git a/uadk_benchmark/include/openssl/e_os2.h b/uadk_tool/include/openssl/e_os2.h +similarity index 100% +rename from uadk_benchmark/include/openssl/e_os2.h +rename to uadk_tool/include/openssl/e_os2.h +diff --git a/uadk_benchmark/include/openssl/ebcdic.h b/uadk_tool/include/openssl/ebcdic.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ebcdic.h +rename to uadk_tool/include/openssl/ebcdic.h +diff --git a/uadk_benchmark/include/openssl/ec.h b/uadk_tool/include/openssl/ec.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ec.h +rename to uadk_tool/include/openssl/ec.h +diff --git a/uadk_benchmark/include/openssl/ecdh.h b/uadk_tool/include/openssl/ecdh.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ecdh.h +rename to uadk_tool/include/openssl/ecdh.h +diff --git a/uadk_benchmark/include/openssl/ecdsa.h b/uadk_tool/include/openssl/ecdsa.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ecdsa.h +rename to uadk_tool/include/openssl/ecdsa.h +diff --git a/uadk_benchmark/include/openssl/ecerr.h b/uadk_tool/include/openssl/ecerr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ecerr.h +rename to uadk_tool/include/openssl/ecerr.h +diff --git a/uadk_benchmark/include/openssl/engine.h b/uadk_tool/include/openssl/engine.h +similarity index 100% +rename from uadk_benchmark/include/openssl/engine.h +rename to uadk_tool/include/openssl/engine.h +diff --git a/uadk_benchmark/include/openssl/engineerr.h b/uadk_tool/include/openssl/engineerr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/engineerr.h +rename to uadk_tool/include/openssl/engineerr.h +diff --git a/uadk_benchmark/include/openssl/err.h b/uadk_tool/include/openssl/err.h +similarity index 100% +rename from uadk_benchmark/include/openssl/err.h +rename to uadk_tool/include/openssl/err.h +diff --git a/uadk_benchmark/include/openssl/evp.h b/uadk_tool/include/openssl/evp.h +similarity index 100% +rename from uadk_benchmark/include/openssl/evp.h +rename to uadk_tool/include/openssl/evp.h +diff --git a/uadk_benchmark/include/openssl/evperr.h b/uadk_tool/include/openssl/evperr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/evperr.h +rename to uadk_tool/include/openssl/evperr.h +diff --git a/uadk_benchmark/include/openssl/hmac.h b/uadk_tool/include/openssl/hmac.h +similarity index 100% +rename from uadk_benchmark/include/openssl/hmac.h +rename to uadk_tool/include/openssl/hmac.h +diff --git a/uadk_benchmark/include/openssl/idea.h b/uadk_tool/include/openssl/idea.h +similarity index 100% +rename from uadk_benchmark/include/openssl/idea.h +rename to uadk_tool/include/openssl/idea.h +diff --git a/uadk_benchmark/include/openssl/kdf.h b/uadk_tool/include/openssl/kdf.h +similarity index 100% +rename from uadk_benchmark/include/openssl/kdf.h +rename to uadk_tool/include/openssl/kdf.h +diff --git a/uadk_benchmark/include/openssl/kdferr.h b/uadk_tool/include/openssl/kdferr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/kdferr.h +rename to uadk_tool/include/openssl/kdferr.h +diff --git a/uadk_benchmark/include/openssl/lhash.h b/uadk_tool/include/openssl/lhash.h +similarity index 100% +rename from uadk_benchmark/include/openssl/lhash.h +rename to uadk_tool/include/openssl/lhash.h +diff --git a/uadk_benchmark/include/openssl/md2.h b/uadk_tool/include/openssl/md2.h +similarity index 100% +rename from uadk_benchmark/include/openssl/md2.h +rename to uadk_tool/include/openssl/md2.h +diff --git a/uadk_benchmark/include/openssl/md4.h b/uadk_tool/include/openssl/md4.h +similarity index 100% +rename from uadk_benchmark/include/openssl/md4.h +rename to uadk_tool/include/openssl/md4.h +diff --git a/uadk_benchmark/include/openssl/md5.h b/uadk_tool/include/openssl/md5.h +similarity index 100% +rename from uadk_benchmark/include/openssl/md5.h +rename to uadk_tool/include/openssl/md5.h +diff --git a/uadk_benchmark/include/openssl/mdc2.h b/uadk_tool/include/openssl/mdc2.h +similarity index 100% +rename from uadk_benchmark/include/openssl/mdc2.h +rename to uadk_tool/include/openssl/mdc2.h +diff --git a/uadk_benchmark/include/openssl/modes.h b/uadk_tool/include/openssl/modes.h +similarity index 100% +rename from uadk_benchmark/include/openssl/modes.h +rename to uadk_tool/include/openssl/modes.h +diff --git a/uadk_benchmark/include/openssl/obj_mac.h b/uadk_tool/include/openssl/obj_mac.h +similarity index 100% +rename from uadk_benchmark/include/openssl/obj_mac.h +rename to uadk_tool/include/openssl/obj_mac.h +diff --git a/uadk_benchmark/include/openssl/objects.h b/uadk_tool/include/openssl/objects.h +similarity index 100% +rename from uadk_benchmark/include/openssl/objects.h +rename to uadk_tool/include/openssl/objects.h +diff --git a/uadk_benchmark/include/openssl/objectserr.h b/uadk_tool/include/openssl/objectserr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/objectserr.h +rename to uadk_tool/include/openssl/objectserr.h +diff --git a/uadk_benchmark/include/openssl/ocsp.h b/uadk_tool/include/openssl/ocsp.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ocsp.h +rename to uadk_tool/include/openssl/ocsp.h +diff --git a/uadk_benchmark/include/openssl/ocsperr.h b/uadk_tool/include/openssl/ocsperr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ocsperr.h +rename to uadk_tool/include/openssl/ocsperr.h +diff --git a/uadk_benchmark/include/openssl/opensslconf.h b/uadk_tool/include/openssl/opensslconf.h +similarity index 100% +rename from uadk_benchmark/include/openssl/opensslconf.h +rename to uadk_tool/include/openssl/opensslconf.h +diff --git a/uadk_benchmark/include/openssl/opensslv.h b/uadk_tool/include/openssl/opensslv.h +similarity index 100% +rename from uadk_benchmark/include/openssl/opensslv.h +rename to uadk_tool/include/openssl/opensslv.h +diff --git a/uadk_benchmark/include/openssl/ossl_typ.h b/uadk_tool/include/openssl/ossl_typ.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ossl_typ.h +rename to uadk_tool/include/openssl/ossl_typ.h +diff --git a/uadk_benchmark/include/openssl/pem.h b/uadk_tool/include/openssl/pem.h +similarity index 100% +rename from uadk_benchmark/include/openssl/pem.h +rename to uadk_tool/include/openssl/pem.h +diff --git a/uadk_benchmark/include/openssl/pem2.h b/uadk_tool/include/openssl/pem2.h +similarity index 100% +rename from uadk_benchmark/include/openssl/pem2.h +rename to uadk_tool/include/openssl/pem2.h +diff --git a/uadk_benchmark/include/openssl/pemerr.h b/uadk_tool/include/openssl/pemerr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/pemerr.h +rename to uadk_tool/include/openssl/pemerr.h +diff --git a/uadk_benchmark/include/openssl/pkcs12.h b/uadk_tool/include/openssl/pkcs12.h +similarity index 100% +rename from uadk_benchmark/include/openssl/pkcs12.h +rename to uadk_tool/include/openssl/pkcs12.h +diff --git a/uadk_benchmark/include/openssl/pkcs12err.h b/uadk_tool/include/openssl/pkcs12err.h +similarity index 100% +rename from uadk_benchmark/include/openssl/pkcs12err.h +rename to uadk_tool/include/openssl/pkcs12err.h +diff --git a/uadk_benchmark/include/openssl/pkcs7.h b/uadk_tool/include/openssl/pkcs7.h +similarity index 100% +rename from uadk_benchmark/include/openssl/pkcs7.h +rename to uadk_tool/include/openssl/pkcs7.h +diff --git a/uadk_benchmark/include/openssl/pkcs7err.h b/uadk_tool/include/openssl/pkcs7err.h +similarity index 100% +rename from uadk_benchmark/include/openssl/pkcs7err.h +rename to uadk_tool/include/openssl/pkcs7err.h +diff --git a/uadk_benchmark/include/openssl/rand.h b/uadk_tool/include/openssl/rand.h +similarity index 100% +rename from uadk_benchmark/include/openssl/rand.h +rename to uadk_tool/include/openssl/rand.h +diff --git a/uadk_benchmark/include/openssl/rand_drbg.h b/uadk_tool/include/openssl/rand_drbg.h +similarity index 100% +rename from uadk_benchmark/include/openssl/rand_drbg.h +rename to uadk_tool/include/openssl/rand_drbg.h +diff --git a/uadk_benchmark/include/openssl/randerr.h b/uadk_tool/include/openssl/randerr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/randerr.h +rename to uadk_tool/include/openssl/randerr.h +diff --git a/uadk_benchmark/include/openssl/rc2.h b/uadk_tool/include/openssl/rc2.h +similarity index 100% +rename from uadk_benchmark/include/openssl/rc2.h +rename to uadk_tool/include/openssl/rc2.h +diff --git a/uadk_benchmark/include/openssl/rc4.h b/uadk_tool/include/openssl/rc4.h +similarity index 100% +rename from uadk_benchmark/include/openssl/rc4.h +rename to uadk_tool/include/openssl/rc4.h +diff --git a/uadk_benchmark/include/openssl/rc5.h b/uadk_tool/include/openssl/rc5.h +similarity index 100% +rename from uadk_benchmark/include/openssl/rc5.h +rename to uadk_tool/include/openssl/rc5.h +diff --git a/uadk_benchmark/include/openssl/ripemd.h b/uadk_tool/include/openssl/ripemd.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ripemd.h +rename to uadk_tool/include/openssl/ripemd.h +diff --git a/uadk_benchmark/include/openssl/rsa.h b/uadk_tool/include/openssl/rsa.h +similarity index 100% +rename from uadk_benchmark/include/openssl/rsa.h +rename to uadk_tool/include/openssl/rsa.h +diff --git a/uadk_benchmark/include/openssl/rsaerr.h b/uadk_tool/include/openssl/rsaerr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/rsaerr.h +rename to uadk_tool/include/openssl/rsaerr.h +diff --git a/uadk_benchmark/include/openssl/safestack.h b/uadk_tool/include/openssl/safestack.h +similarity index 100% +rename from uadk_benchmark/include/openssl/safestack.h +rename to uadk_tool/include/openssl/safestack.h +diff --git a/uadk_benchmark/include/openssl/seed.h b/uadk_tool/include/openssl/seed.h +similarity index 100% +rename from uadk_benchmark/include/openssl/seed.h +rename to uadk_tool/include/openssl/seed.h +diff --git a/uadk_benchmark/include/openssl/sha.h b/uadk_tool/include/openssl/sha.h +similarity index 100% +rename from uadk_benchmark/include/openssl/sha.h +rename to uadk_tool/include/openssl/sha.h +diff --git a/uadk_benchmark/include/openssl/srp.h b/uadk_tool/include/openssl/srp.h +similarity index 100% +rename from uadk_benchmark/include/openssl/srp.h +rename to uadk_tool/include/openssl/srp.h +diff --git a/uadk_benchmark/include/openssl/srtp.h b/uadk_tool/include/openssl/srtp.h +similarity index 100% +rename from uadk_benchmark/include/openssl/srtp.h +rename to uadk_tool/include/openssl/srtp.h +diff --git a/uadk_benchmark/include/openssl/ssl.h b/uadk_tool/include/openssl/ssl.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ssl.h +rename to uadk_tool/include/openssl/ssl.h +diff --git a/uadk_benchmark/include/openssl/ssl2.h b/uadk_tool/include/openssl/ssl2.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ssl2.h +rename to uadk_tool/include/openssl/ssl2.h +diff --git a/uadk_benchmark/include/openssl/ssl3.h b/uadk_tool/include/openssl/ssl3.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ssl3.h +rename to uadk_tool/include/openssl/ssl3.h +diff --git a/uadk_benchmark/include/openssl/sslerr.h b/uadk_tool/include/openssl/sslerr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/sslerr.h +rename to uadk_tool/include/openssl/sslerr.h +diff --git a/uadk_benchmark/include/openssl/stack.h b/uadk_tool/include/openssl/stack.h +similarity index 100% +rename from uadk_benchmark/include/openssl/stack.h +rename to uadk_tool/include/openssl/stack.h +diff --git a/uadk_benchmark/include/openssl/store.h b/uadk_tool/include/openssl/store.h +similarity index 100% +rename from uadk_benchmark/include/openssl/store.h +rename to uadk_tool/include/openssl/store.h +diff --git a/uadk_benchmark/include/openssl/storeerr.h b/uadk_tool/include/openssl/storeerr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/storeerr.h +rename to uadk_tool/include/openssl/storeerr.h +diff --git a/uadk_benchmark/include/openssl/symhacks.h b/uadk_tool/include/openssl/symhacks.h +similarity index 100% +rename from uadk_benchmark/include/openssl/symhacks.h +rename to uadk_tool/include/openssl/symhacks.h +diff --git a/uadk_benchmark/include/openssl/tls1.h b/uadk_tool/include/openssl/tls1.h +similarity index 100% +rename from uadk_benchmark/include/openssl/tls1.h +rename to uadk_tool/include/openssl/tls1.h +diff --git a/uadk_benchmark/include/openssl/ts.h b/uadk_tool/include/openssl/ts.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ts.h +rename to uadk_tool/include/openssl/ts.h +diff --git a/uadk_benchmark/include/openssl/tserr.h b/uadk_tool/include/openssl/tserr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/tserr.h +rename to uadk_tool/include/openssl/tserr.h +diff --git a/uadk_benchmark/include/openssl/txt_db.h b/uadk_tool/include/openssl/txt_db.h +similarity index 100% +rename from uadk_benchmark/include/openssl/txt_db.h +rename to uadk_tool/include/openssl/txt_db.h +diff --git a/uadk_benchmark/include/openssl/ui.h b/uadk_tool/include/openssl/ui.h +similarity index 100% +rename from uadk_benchmark/include/openssl/ui.h +rename to uadk_tool/include/openssl/ui.h +diff --git a/uadk_benchmark/include/openssl/uierr.h b/uadk_tool/include/openssl/uierr.h +similarity index 100% +rename from uadk_benchmark/include/openssl/uierr.h +rename to uadk_tool/include/openssl/uierr.h +diff --git a/uadk_benchmark/include/openssl/whrlpool.h b/uadk_tool/include/openssl/whrlpool.h +similarity index 100% +rename from uadk_benchmark/include/openssl/whrlpool.h +rename to uadk_tool/include/openssl/whrlpool.h +diff --git a/uadk_benchmark/include/openssl/x509.h b/uadk_tool/include/openssl/x509.h +similarity index 100% +rename from uadk_benchmark/include/openssl/x509.h +rename to uadk_tool/include/openssl/x509.h +diff --git a/uadk_benchmark/include/openssl/x509_vfy.h b/uadk_tool/include/openssl/x509_vfy.h +similarity index 100% +rename from uadk_benchmark/include/openssl/x509_vfy.h +rename to uadk_tool/include/openssl/x509_vfy.h +diff --git a/uadk_benchmark/include/openssl/x509err.h b/uadk_tool/include/openssl/x509err.h +similarity index 100% +rename from uadk_benchmark/include/openssl/x509err.h +rename to uadk_tool/include/openssl/x509err.h +diff --git a/uadk_benchmark/include/openssl/x509v3.h b/uadk_tool/include/openssl/x509v3.h +similarity index 100% +rename from uadk_benchmark/include/openssl/x509v3.h +rename to uadk_tool/include/openssl/x509v3.h +diff --git a/uadk_benchmark/include/openssl/x509v3err.h b/uadk_tool/include/openssl/x509v3err.h +similarity index 100% +rename from uadk_benchmark/include/openssl/x509v3err.h +rename to uadk_tool/include/openssl/x509v3err.h +diff --git a/uadk_benchmark/sec_soft_benchmark.c b/uadk_tool/sec_soft_benchmark.c +similarity index 100% +rename from uadk_benchmark/sec_soft_benchmark.c +rename to uadk_tool/sec_soft_benchmark.c +diff --git a/uadk_benchmark/sec_soft_benchmark.h b/uadk_tool/sec_soft_benchmark.h +similarity index 100% +rename from uadk_benchmark/sec_soft_benchmark.h +rename to uadk_tool/sec_soft_benchmark.h +diff --git a/uadk_benchmark/sec_uadk_benchmark.c b/uadk_tool/sec_uadk_benchmark.c +similarity index 100% +rename from uadk_benchmark/sec_uadk_benchmark.c +rename to uadk_tool/sec_uadk_benchmark.c +diff --git a/uadk_benchmark/sec_uadk_benchmark.h b/uadk_tool/sec_uadk_benchmark.h +similarity index 100% +rename from uadk_benchmark/sec_uadk_benchmark.h +rename to uadk_tool/sec_uadk_benchmark.h +diff --git a/uadk_benchmark/sec_wd_benchmark.c b/uadk_tool/sec_wd_benchmark.c +similarity index 100% +rename from uadk_benchmark/sec_wd_benchmark.c +rename to uadk_tool/sec_wd_benchmark.c +diff --git a/uadk_benchmark/sec_wd_benchmark.h b/uadk_tool/sec_wd_benchmark.h +similarity index 100% +rename from uadk_benchmark/sec_wd_benchmark.h +rename to uadk_tool/sec_wd_benchmark.h +diff --git a/uadk_benchmark/uadk_benchmark.c b/uadk_tool/uadk_benchmark.c +similarity index 91% +rename from uadk_benchmark/uadk_benchmark.c +rename to uadk_tool/uadk_benchmark.c +index cc63c26..5773b2c 100644 +--- a/uadk_benchmark/uadk_benchmark.c ++++ b/uadk_tool/uadk_benchmark.c +@@ -448,7 +448,7 @@ static void dump_param(struct acc_option *option) + ACC_TST_PRT(" [--engine]: %s\n", option->engine); + } + +-static int acc_benchmark_run(struct acc_option *option) ++int acc_benchmark_run(struct acc_option *option) + { + int nr_children = 0; + pid_t *pids, pid; +@@ -510,7 +510,7 @@ static int acc_benchmark_run(struct acc_option *option) + return ret; + } + +-static int acc_default_case(struct acc_option *option) ++int acc_default_case(struct acc_option *option) + { + ACC_TST_PRT("Test sec Cipher parameter default, alg: aes-128-cbc, set_times:3," + "set_pktlen:1024 bytes, sync mode, one process, one thread.\n"); +@@ -532,12 +532,12 @@ static int acc_default_case(struct acc_option *option) + static void print_help(void) + { + ACC_TST_PRT("NAME\n"); +- ACC_TST_PRT(" uadk_benchmark: test UADK acc performance,etc\n"); ++ ACC_TST_PRT(" uadk_tool benchmark: test UADK acc performance,etc\n"); + ACC_TST_PRT("USAGE\n"); +- ACC_TST_PRT(" uadk_benchmark [--alg aes-128-cbc] [--alg rsa-2048]\n"); +- ACC_TST_PRT(" uadk_benchmark [--mode] [--pktlen] [--keylen] [--seconds]\n"); +- ACC_TST_PRT(" uadk_benchmark [--multi] [--sync] [--async] [--help]\n"); +- ACC_TST_PRT(" numactl --cpubind=0 --membind=0,1 ./uadk_benchmark xxxx\n"); ++ ACC_TST_PRT(" uadk_tool benchmark [--alg aes-128-cbc] [--alg rsa-2048]\n"); ++ ACC_TST_PRT(" uadk_tool benchmark [--mode] [--pktlen] [--keylen] [--seconds]\n"); ++ ACC_TST_PRT(" uadk_tool benchmark [--multi] [--sync] [--async] [--help]\n"); ++ ACC_TST_PRT(" numactl --cpubind=0 --membind=0,1 ./uadk_tool benchmark xxxx\n"); + ACC_TST_PRT(" specify numa nodes for cpu and memory\n"); + ACC_TST_PRT("DESCRIPTION\n"); + ACC_TST_PRT(" [--alg aes-128-cbc ]:\n"); +@@ -560,29 +560,29 @@ static void print_help(void) + ACC_TST_PRT(" set the test openssl engine\n"); + ACC_TST_PRT(" [--help] = usage\n"); + ACC_TST_PRT("Example\n"); +- ACC_TST_PRT(" ./uadk_benchmark --alg aes-128-cbc --mode sva --optype 0 --sync\n"); ++ ACC_TST_PRT(" ./uadk_tool benchmark --alg aes-128-cbc --mode sva --opt 0 --sync\n"); + ACC_TST_PRT(" --pktlen 1024 --seconds 1 --multi 1 --thread 1 --ctxnum 4\n"); + ACC_TST_PRT("UPDATE:2021-7-28\n"); + } + +-static void acc_cmd_parse(int argc, char *argv[], struct acc_option *option) ++void benchmark_cmd_parse(int argc, char *argv[], struct acc_option *option) + { + int option_index = 0; + int c; + + static struct option long_options[] = { +- {"alg", required_argument, 0, 1}, +- {"mode", required_argument, 0, 2}, +- {"opt", required_argument, 0, 3}, +- {"sync", no_argument, 0,4}, +- {"async", no_argument, 0,5}, +- {"pktlen", required_argument, 0, 6}, +- {"seconds", required_argument, 0, 7}, +- {"thread", required_argument, 0, 8}, +- {"multi", required_argument, 0, 9}, +- {"ctxnum", required_argument, 0, 10}, +- {"engine", required_argument, 0,11}, +- {"help", no_argument, 0, 12}, ++ {"alg", required_argument, 0, 2}, ++ {"mode", required_argument, 0, 3}, ++ {"opt", required_argument, 0, 4}, ++ {"sync", no_argument, 0, 5}, ++ {"async", no_argument, 0, 6}, ++ {"pktlen", required_argument, 0, 7}, ++ {"seconds", required_argument, 0, 8}, ++ {"thread", required_argument, 0, 9}, ++ {"multi", required_argument, 0, 10}, ++ {"ctxnum", required_argument, 0, 11}, ++ {"engine", required_argument, 0, 12}, ++ {"help", no_argument, 0, 13}, + {0, 0, 0, 0} + }; + +@@ -593,41 +593,41 @@ static void acc_cmd_parse(int argc, char *argv[], struct acc_option *option) + + // ACC_TST_PRT("index:%d , optarg name:%s\n", c, optarg); + switch (c) { +- case 1: ++ case 2: + option->algtype = get_alg_type(optarg); + strcpy(option->algname, optarg); + break; +- case 2: ++ case 3: + option->modetype = get_mode_type(optarg); + break; +- case 3: ++ case 4: + option->optype = strtol(optarg, NULL, 0); + break; +- case 4: ++ case 5: + option->syncmode = SYNC_MODE; + break; +- case 5: ++ case 6: + option->syncmode = ASYNC_MODE; + break; +- case 6: ++ case 7: + option->pktlen = strtol(optarg, NULL, 0); + break; +- case 7: ++ case 8: + option->times = strtol(optarg, NULL, 0); + break; +- case 8: ++ case 9: + option->threads = strtol(optarg, NULL, 0); + break; +- case 9: ++ case 10: + option->multis = strtol(optarg, NULL, 0); + break; +- case 10: ++ case 11: + option->ctxnums = strtol(optarg, NULL, 0); + break; +- case 11: ++ case 12: + strcpy(option->engine, optarg); + break; +- case 12: ++ case 13: + print_help(); + break; + default: +@@ -638,7 +638,7 @@ static void acc_cmd_parse(int argc, char *argv[], struct acc_option *option) + } + } + +-static int acc_option_convert(struct acc_option *option) ++int acc_option_convert(struct acc_option *option) + { + if (option->algtype >= ALG_MAX) + goto param_err; +@@ -697,21 +697,3 @@ param_err: + ACC_TST_PRT("input parameter error, please input --help\n"); + return -EINVAL; + } +- +-int main(int argc, char *argv[]) +-{ +- struct acc_option option = {0}; +- int ret = 0; +- +- ACC_TST_PRT("start UADK benchmark test.\n"); +- +- if (!argv[1]) +- return acc_default_case(&option); +- +- acc_cmd_parse(argc, argv, &option); +- ret = acc_option_convert(&option); +- if (ret) +- return ret; +- +- return acc_benchmark_run(&option); +-} +diff --git a/uadk_benchmark/uadk_benchmark.h b/uadk_tool/uadk_benchmark.h +similarity index 93% +rename from uadk_benchmark/uadk_benchmark.h +rename to uadk_tool/uadk_benchmark.h +index 9049e50..7ce0426 100644 +--- a/uadk_benchmark/uadk_benchmark.h ++++ b/uadk_tool/uadk_benchmark.h +@@ -170,4 +170,9 @@ extern void add_recv_data(u32 cnt); + extern void add_send_complete(void); + extern u32 get_recv_time(void); + ++void benchmark_cmd_parse(int argc, char *argv[], struct acc_option *option); ++int acc_default_case(struct acc_option *option); ++int acc_option_convert(struct acc_option *option); ++int acc_benchmark_run(struct acc_option *option); ++ + #endif /* UADK_BENCHMARK_H */ +diff --git a/uadk_tool/uadk_dfx.c b/uadk_tool/uadk_dfx.c +new file mode 100644 +index 0000000..96c4919 +--- /dev/null ++++ b/uadk_tool/uadk_dfx.c +@@ -0,0 +1,79 @@ ++/* SPDX-License-Identifier: Apache-2.0 */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "uadk_dfx.h" ++ ++#define print_date() printf("built on: %s %s\n", __DATE__, __TIME__) ++ ++static void print_version(void) ++{ ++ printf("%s\n", UADK_VERSION_TEXT); ++ printf("%s\n", UADK_VERSION_TAG); ++} ++ ++static void print_exe_path(void) ++{ ++ char dir[PATH_MAX] = {0}; ++ int n; ++ ++ n = readlink("/proc/self/exe", dir, PATH_MAX); ++ if (n < 0 || n >= PATH_MAX) ++ printf("uadk tool failed to get the exe path.\n"); ++ ++ printf("exe path: %s\n", dir); ++} ++ ++void print_dfx_help(void) ++{ ++ printf("NAME\n"); ++ printf(" uadk_tool --dfx : uadk library dfx function, etc\n"); ++ printf("USAGE\n"); ++ printf(" uadk_tool --dfx [--version] = Show library version\n"); ++ printf(" uadk_tool --dfx [--date] = Show build date\n"); ++ printf(" uadk_tool --dfx [--dir] = Show library dir\n"); ++ printf(" uadk_tool --dfx [--help] = usage\n"); ++} ++ ++void dfx_cmd_parse(int argc, char *argv[]) ++{ ++ int option_index = 0; ++ int c; ++ ++ static struct option long_options[] = { ++ {"version", no_argument, 0, 2}, ++ {"date", no_argument, 0, 3}, ++ {"dir", no_argument, 0, 4}, ++ {"help", no_argument, 0, 5}, ++ {0, 0, 0, 0} ++ }; ++ ++ while (1) { ++ c = getopt_long(argc, argv, "", long_options, &option_index); ++ if (c == -1) ++ break; ++ ++ switch (c) { ++ case 2: ++ print_version(); ++ break; ++ case 3: ++ print_date(); ++ break; ++ case 4: ++ print_exe_path(); ++ break; ++ case 5: ++ print_dfx_help(); ++ break; ++ default: ++ printf("bad input parameter, exit\n"); ++ exit(-1); ++ } ++ } ++} +diff --git a/uadk_tool/uadk_dfx.h b/uadk_tool/uadk_dfx.h +new file mode 100644 +index 0000000..5f5d9e7 +--- /dev/null ++++ b/uadk_tool/uadk_dfx.h +@@ -0,0 +1,10 @@ ++/* SPDX-License-Identifier: Apache-2.0 */ ++#ifndef UADK_DFX_H ++#define UADK_DFX_H ++ ++#define UADK_VERSION_TEXT "UADK 2.3.22, Released Dec 20th, 2021" ++#define UADK_VERSION_TAG "4b9c69d" ++ ++void print_dfx_help(void); ++void dfx_cmd_parse(int argc, char *argv[]); ++#endif +diff --git a/uadk_tool/uadk_tool.c b/uadk_tool/uadk_tool.c +new file mode 100644 +index 0000000..88beeba +--- /dev/null ++++ b/uadk_tool/uadk_tool.c +@@ -0,0 +1,44 @@ ++/* SPDX-License-Identifier: Apache-2.0 */ ++ ++#include ++#include ++#include ++#include ++#include ++#include "uadk_dfx.h" ++#include "uadk_benchmark.h" ++ ++static void print_tool_help(void) ++{ ++ printf("NAME\n"); ++ printf("uadk_tool dfx : Show some information for library.\n"); ++ printf("uadk_tool benchmark : Test UADK acc performance.\n"); ++} ++ ++int main(int argc, char **argv) ++{ ++ struct acc_option option = {0}; ++ int ret; ++ ++ if (argc > 1) { ++ if (!strcmp("dfx", argv[1])) { ++ dfx_cmd_parse(argc, argv); ++ } else if (!strcmp("benchmark", argv[1])) { ++ printf("start UADK benchmark test.\n"); ++ if (!argv[2]) ++ acc_default_case(&option); ++ ++ benchmark_cmd_parse(argc, argv, &option); ++ ret = acc_option_convert(&option); ++ if (ret) ++ return ret; ++ (void)acc_benchmark_run(&option); ++ } else { ++ print_tool_help(); ++ } ++ } else { ++ print_tool_help(); ++ } ++ ++ return 0; ++} +-- +2.31.1 + diff --git a/0009-digest-some-optimizations-for-digest-stream-mode.patch b/0009-digest-some-optimizations-for-digest-stream-mode.patch new file mode 100644 index 0000000..56e82b5 --- /dev/null +++ b/0009-digest-some-optimizations-for-digest-stream-mode.patch @@ -0,0 +1,63 @@ +From 0d65963667c4795a28701e5a212422ebcff27c74 Mon Sep 17 00:00:00 2001 +From: Kai Ye +Date: Thu, 23 Dec 2021 15:40:15 +0800 +Subject: [PATCH 10/28] digest: some optimizations for digest stream mode + +1. add some comments for session state. +2. The stream status is set only when the last msg message is + successfully received. + +Signed-off-by: Kai Ye +--- + wd_digest.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/wd_digest.c b/wd_digest.c +index 1962f09..bbb258f 100644 +--- a/wd_digest.c ++++ b/wd_digest.c +@@ -21,6 +21,7 @@ + + #define POLL_SIZE 100000 + #define POLL_TIME 1000 ++#define STREAM_MODE_STATE 1 + + static int g_digest_mac_len[WD_DIGEST_TYPE_MAX] = { + WD_DIGEST_SM3_LEN, WD_DIGEST_MD5_LEN, WD_DIGEST_SHA1_LEN, +@@ -46,8 +47,11 @@ struct wd_digest_sess { + unsigned char key[MAX_HMAC_KEY_SIZE]; + __u32 key_bytes; + void *sched_key; +- /* Notify the BD state */ +- int state; ++ /* ++ * Notify the BD state, 1 is final BD or middle BD, ++ * 0 is normal mode or first BD, one session only supports one stream. ++ */ ++ int state; + /* Total of data for stream mode */ + __u64 long_data_len; + }; +@@ -294,7 +298,7 @@ static void fill_request_msg(struct wd_digest_msg *msg, + msg->has_next = req->has_next; + sess->long_data_len += req->in_bytes; + msg->long_data_len = sess->long_data_len; +- /* To store the stream bd state */ ++ /* To store the stream bd state, iv_bytes also means bd state */ + msg->iv_bytes = sess->state; + if (req->has_next == 0) { + sess->long_data_len = 0; +@@ -332,8 +336,8 @@ static int send_recv_sync(struct wd_ctx_internal *ctx, struct wd_digest_sess *ds + goto out; + } + } +- if (msg->has_next) +- dsess->state = msg->out_bytes; ++ if (msg->has_next && msg->result == WD_SUCCESS) ++ dsess->state = STREAM_MODE_STATE; + } while (ret < 0); + + out: +-- +2.31.1 + diff --git a/0010-uadk-fix-error-of-wd_get_avail_ctx-return-value.patch b/0010-uadk-fix-error-of-wd_get_avail_ctx-return-value.patch new file mode 100644 index 0000000..8f45a6e --- /dev/null +++ b/0010-uadk-fix-error-of-wd_get_avail_ctx-return-value.patch @@ -0,0 +1,44 @@ +From 17bc4f46411541e725d30ec76693982765a96114 Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Mon, 27 Dec 2021 09:52:00 +0800 +Subject: [PATCH 12/28] uadk: fix error of wd_get_avail_ctx return value + +When wd_get_avail_ctx return negative value, +wd should not use this device. + +Signed-off-by: Wenkai Lin +--- + wd.c | 3 ++- + wd_util.c | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/wd.c b/wd.c +index 838efa7..2bb2fdd 100644 +--- a/wd.c ++++ b/wd.c +@@ -675,7 +675,8 @@ struct uacce_dev *wd_get_accel_dev(const char *alg_name) + while (list) { + tmp = numa_distance(node, list->dev->numa_id); + ctx_num = wd_get_avail_ctx(list->dev); +- if ((dis > tmp && ctx_num) || (dis == tmp && ctx_num > max)) { ++ if ((dis > tmp && ctx_num > 0) || ++ (dis == tmp && ctx_num > max)) { + dev = list->dev; + dis = tmp; + max = ctx_num; +diff --git a/wd_util.c b/wd_util.c +index c973eff..3c1fd26 100644 +--- a/wd_util.c ++++ b/wd_util.c +@@ -846,7 +846,7 @@ static handle_t request_ctx_on_numa(struct wd_env_config_per_numa *config) + for (i = 0; i < config->dev_num; i++) { + dev = config->dev + i; + ctx_num = wd_get_avail_ctx(dev); +- if (!ctx_num) ++ if (ctx_num <= 0) + continue; + + h_ctx = wd_request_ctx(dev); +-- +2.31.1 + diff --git a/0011-uadk-fix-comment-content.patch b/0011-uadk-fix-comment-content.patch new file mode 100644 index 0000000..460f431 --- /dev/null +++ b/0011-uadk-fix-comment-content.patch @@ -0,0 +1,85 @@ +From 6a83adca797b8917907d56097f72b3755acf74fa Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Mon, 27 Dec 2021 09:51:59 +0800 +Subject: [PATCH 13/28] uadk: fix comment content + +There must be 1 space between the block comment character +and the comment content. + +Signed-off-by: Wenkai Lin +--- + v1/drv/hisi_qm_udrv.c | 2 +- + v1/wd_cipher.h | 2 +- + v1/wd_dh.h | 2 +- + wd_comp.c | 2 +- + wd_util.c | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/v1/drv/hisi_qm_udrv.c b/v1/drv/hisi_qm_udrv.c +index 02aaf81..63f346b 100644 +--- a/v1/drv/hisi_qm_udrv.c ++++ b/v1/drv/hisi_qm_udrv.c +@@ -77,7 +77,7 @@ static int qm_hw_sgl_sge_init(struct wd_sgl *sgl, struct hisi_sgl *hisi_sgl, + return WD_SUCCESS; + } + +-/* 'num' starts from 1*/ ++/* 'num' starts from 1 */ + void qm_hw_sgl_sge_uninit(struct wd_sgl *sgl, struct hisi_sgl *hisi_sgl, + int num, struct wd_mm_br *br, __u32 buf_sz) + { +diff --git a/v1/wd_cipher.h b/v1/wd_cipher.h +index 2ab0e1d..7059f53 100644 +--- a/v1/wd_cipher.h ++++ b/v1/wd_cipher.h +@@ -92,7 +92,7 @@ struct wcrypto_cipher_op_data { + /* Cipher message format of Warpdrive */ + struct wcrypto_cipher_msg { + __u8 alg_type:4; /* Denoted by enum wcrypto_type */ +- __u8 alg:4; /* Denoted by enum wcrypto_cipher_alg*/ ++ __u8 alg:4; /* Denoted by enum wcrypto_cipher_alg */ + __u8 op_type:4; /* Denoted by enum wcrypto_cipher_op_type */ + __u8 mode:4; /* Denoted by enum wcrypto_cipher_mode */ + __u8 data_fmt; /* Data format, denoted by enum wcrypto_buff_type */ +diff --git a/v1/wd_dh.h b/v1/wd_dh.h +index 6364966..e411830 100644 +--- a/v1/wd_dh.h ++++ b/v1/wd_dh.h +@@ -64,7 +64,7 @@ struct wcrypto_dh_msg { + __u8 result; /* Data format, denoted by WD error code */ + __u16 key_bytes; /* Key size */ + __u8 *x_p; /* This is Xa and p data in order. Should be DMA buffer */ +- __u8 *g; /* This is PV also at phase 2. Should be DMA buffer*/ ++ __u8 *g; /* This is PV also at phase 2. Should be DMA buffer */ + __u8 *out; /* Result address, should be DMA buffer */ + __u16 xbytes; /* parameter Xa size */ + __u16 pbytes; /* parameter p size */ +diff --git a/wd_comp.c b/wd_comp.c +index 6f0cf9d..e34d590 100644 +--- a/wd_comp.c ++++ b/wd_comp.c +@@ -584,7 +584,7 @@ static int append_store_block(struct wd_comp_sess *sess, + memcpy(req->dst, store_block, blocksize); + req->dst_len = blocksize; + checksum = (__u32) cpu_to_be32(checksum); +- /*if zlib, ADLER32*/ ++ /* if zlib, ADLER32 */ + memcpy(req->dst + blocksize, &checksum, sizeof(checksum)); + req->dst_len += sizeof(checksum); + } else if (sess->alg_type == WD_GZIP) { +diff --git a/wd_util.c b/wd_util.c +index 3c1fd26..3170f3c 100644 +--- a/wd_util.c ++++ b/wd_util.c +@@ -34,7 +34,7 @@ static const char *comp_ctx_type[2][2] = { + {"async-comp:", "async-decomp:"} + }; + +-/* define two ctx mode here for cipher and other alg*/ ++/* define two ctx mode here for cipher and other alg */ + static const char *ctx_type[2][1] = { {"sync:"}, {"async:"} }; + + struct async_task { +-- +2.31.1 + diff --git a/0012-uadk-max-numa-number-should-not-be-fixed.patch b/0012-uadk-max-numa-number-should-not-be-fixed.patch new file mode 100644 index 0000000..bea5b12 --- /dev/null +++ b/0012-uadk-max-numa-number-should-not-be-fixed.patch @@ -0,0 +1,424 @@ +From ca3131392a8cb3209599dc6ca4c377460346b36a Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Mon, 27 Dec 2021 09:52:01 +0800 +Subject: [PATCH 14/28] uadk: max numa number should not be fixed + +numa_num_configured_nodes() returns the number +of memory nodes in the system, so use it as max +numa number is good. +when function is called in io path, use static array +as much as possible, so use a numa number macro. + +Signed-off-by: Wenkai Lin +--- + include/wd_sched.h | 5 +- + include/wd_util.h | 6 +- + test/hisi_sec_test/test_hisi_sec.c | 5 +- + uadk_tool/sec_uadk_benchmark.c | 13 ++-- + wd_sched.c | 39 +++++++---- + wd_util.c | 106 ++++++++++++++++++----------- + 6 files changed, 109 insertions(+), 65 deletions(-) + +diff --git a/include/wd_sched.h b/include/wd_sched.h +index a008d57..78125f4 100644 +--- a/include/wd_sched.h ++++ b/include/wd_sched.h +@@ -8,7 +8,6 @@ + #define SCHED_SAMPLE_h + #include "wd_alg_common.h" + +-#define MAX_NUMA_NUM 4 + #define INVALID_POS 0xFFFFFFFF + + /* The global policy type */ +@@ -48,8 +47,8 @@ int wd_sched_rr_instance(const struct wd_sched *sched, + * @func: The ctx poll function of user underlying operating. + * + */ +-struct wd_sched *wd_sched_rr_alloc(__u8 sched_type, __u8 type_num, __u8 numa_num, +- user_poll_func func); ++struct wd_sched *wd_sched_rr_alloc(__u8 sched_type, __u8 type_num, ++ __u16 numa_num, user_poll_func func); + + /** + * wd_sched_rr_release - Release schedule memory. +diff --git a/include/wd_util.h b/include/wd_util.h +index 643309c..81f4ba8 100644 +--- a/include/wd_util.h ++++ b/include/wd_util.h +@@ -59,12 +59,9 @@ struct wd_env_config_per_numa { + }; + + struct wd_env_config { +- unsigned long numa_num; + struct wd_env_config_per_numa *config_per_numa; + /* Let's make it as a gobal config, not per numa */ + bool enable_internal_poll; +- __u8 disable_env; +- __u8 op_type_num; + int (*alg_poll_ctx)(__u32, __u32, __u32 *); + void (*alg_uninit)(void); + +@@ -74,6 +71,9 @@ struct wd_env_config { + struct wd_ctx_config *ctx_config; + const struct wd_config_variable *table; + __u32 table_size; ++ __u16 numa_num; ++ __u8 disable_env; ++ __u8 op_type_num; + }; + + struct wd_config_variable { +diff --git a/test/hisi_sec_test/test_hisi_sec.c b/test/hisi_sec_test/test_hisi_sec.c +index e1521f6..dda291d 100644 +--- a/test/hisi_sec_test/test_hisi_sec.c ++++ b/test/hisi_sec_test/test_hisi_sec.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + + #include "test_hisi_sec.h" + #include "wd_cipher.h" +@@ -493,7 +494,9 @@ static int init_ctx_config(int type, int mode) + if (list->dev->numa_id < 0) + list->dev->numa_id = 0; + +- g_sched = wd_sched_rr_alloc(SCHED_POLICY_RR, 1, MAX_NUMA_NUM, wd_cipher_poll_ctx); ++ g_sched = wd_sched_rr_alloc(SCHED_POLICY_RR, 1, ++ numa_max_node() + 1, ++ wd_cipher_poll_ctx); + if (!g_sched) { + printf("Fail to alloc sched!\n"); + goto out; +diff --git a/uadk_tool/sec_uadk_benchmark.c b/uadk_tool/sec_uadk_benchmark.c +index 21738ed..40ba227 100644 +--- a/uadk_tool/sec_uadk_benchmark.c ++++ b/uadk_tool/sec_uadk_benchmark.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: Apache-2.0 */ + ++#include + #include "uadk_benchmark.h" + + #include "sec_uadk_benchmark.h" +@@ -347,8 +348,12 @@ static int sec_uadk_param_parse(thread_data *tddata, struct acc_option *options) + static int init_ctx_config(char *alg, int subtype, int mode) + { + struct uacce_dev_list *list; ++ int i, max_node; + int ret = 0; +- int i; ++ ++ max_node = numa_max_node() + 1; ++ if (max_node <= 0) ++ return -EINVAL; + + list = wd_get_accel_list(alg); + if (!list) { +@@ -369,13 +374,13 @@ static int init_ctx_config(char *alg, int subtype, int mode) + + switch(subtype) { + case CIPHER_TYPE: +- g_sched = wd_sched_rr_alloc(SCHED_POLICY_RR, 1, MAX_NUMA_NUM, wd_cipher_poll_ctx); ++ g_sched = wd_sched_rr_alloc(SCHED_POLICY_RR, 1, max_node, wd_cipher_poll_ctx); + break; + case AEAD_TYPE: +- g_sched = wd_sched_rr_alloc(SCHED_POLICY_RR, 1, MAX_NUMA_NUM, wd_aead_poll_ctx); ++ g_sched = wd_sched_rr_alloc(SCHED_POLICY_RR, 1, max_node, wd_aead_poll_ctx); + break; + case DIGEST_TYPE: +- g_sched = wd_sched_rr_alloc(SCHED_POLICY_RR, 1, MAX_NUMA_NUM, wd_digest_poll_ctx); ++ g_sched = wd_sched_rr_alloc(SCHED_POLICY_RR, 1, max_node, wd_digest_poll_ctx); + break; + default: + SEC_TST_PRT("Fail to parse alg subtype!\n"); +diff --git a/wd_sched.c b/wd_sched.c +index 8ca309c..b310077 100644 +--- a/wd_sched.c ++++ b/wd_sched.c +@@ -6,6 +6,7 @@ + + #include + #include ++#include + #include "wd_sched.h" + + #define MAX_POLL_TIMES 1000 +@@ -37,6 +38,8 @@ struct sched_key { + * @begin: the start pos in ctxs of config. + * @end: the end pos in ctxx of config. + * @last: the last one which be distributed. ++ * @valid: the region used flag. ++ * @lock: lock the currentscheduling region. + */ + struct sched_ctx_region { + __u32 begin; +@@ -64,14 +67,13 @@ struct wd_sched_info { + * @policy: define the policy of the scheduler. + * @numa_num: the max numa numbers of the scheduler. + * @type_num: the max operation types of the scheduler. +- * @numa_id: current task's numa id + * @poll_func: the task's poll operation function. + * @sched_info: the context of the scheduler + */ + struct wd_sched_ctx { + __u32 policy; + __u32 type_num; +- __u8 numa_num; ++ __u16 numa_num; + user_poll_func poll_func; + struct wd_sched_info sched_info[0]; + }; +@@ -200,11 +202,11 @@ static int session_sched_poll_policy(handle_t sched_ctx, + { + struct wd_sched_ctx *ctx = (struct wd_sched_ctx *)sched_ctx; + struct wd_sched_info *sched_info; +- int numa[MAX_NUMA_NUM]; ++ __u16 numa[NUMA_NUM_NODES]; + __u32 loop_time = 0; + __u32 last_count = 0; +- __u8 tail = 0; +- __u8 i; ++ __u16 tail = 0; ++ __u16 i; + int ret; + + if (!sched_ctx || !count || !ctx) { +@@ -212,6 +214,11 @@ static int session_sched_poll_policy(handle_t sched_ctx, + return -EINVAL; + } + ++ if (ctx->numa_num > NUMA_NUM_NODES) { ++ WD_ERR("ERROR: %s ctx numa num is invalid!\n", __FUNCTION__); ++ return -EINVAL; ++ } ++ + sched_info = ctx->sched_info; + for (i = 0; i < ctx->numa_num; i++) + if (sched_info[i].valid) +@@ -412,13 +419,23 @@ out: + return; + } + +-struct wd_sched *wd_sched_rr_alloc(__u8 sched_type, __u8 type_num, __u8 numa_num, +- user_poll_func func) ++struct wd_sched *wd_sched_rr_alloc(__u8 sched_type, __u8 type_num, ++ __u16 numa_num, user_poll_func func) + { + struct wd_sched_info *sched_info; + struct wd_sched_ctx *sched_ctx; + struct wd_sched *sched; +- int i, j; ++ int i, j, max_node; ++ ++ max_node = numa_max_node() + 1; ++ if (max_node <= 0) ++ return NULL; ++ ++ if (!numa_num || numa_num > max_node) { ++ WD_ERR("Error: %s numa number = %u!\n", __FUNCTION__, ++ numa_num); ++ return NULL; ++ } + + if (sched_type >= SCHED_POLICY_BUTT || !type_num) { + WD_ERR("Error: %s sched_type = %u or type_num = %u is invalid!\n", +@@ -426,12 +443,6 @@ struct wd_sched *wd_sched_rr_alloc(__u8 sched_type, __u8 type_num, __u8 numa_num + return NULL; + } + +- if (!numa_num) { +- WD_ERR("Warning: %s set numa number as %d!\n", __FUNCTION__, +- MAX_NUMA_NUM); +- numa_num = MAX_NUMA_NUM; +- } +- + sched = calloc(1, sizeof(struct wd_sched)); + if (!sched) { + WD_ERR("Error: %s wd_sched alloc error!\n", __FUNCTION__); +diff --git a/wd_util.c b/wd_util.c +index 3170f3c..3a1def5 100644 +--- a/wd_util.c ++++ b/wd_util.c +@@ -357,26 +357,28 @@ static void wd_free_numa(struct wd_env_config *config) + * @numa_dev_num: number of devices of the same type (like sec2) on each numa. + * @numa_num: number of numa node that has this type of device. + */ +-static void wd_get_dev_numa(struct uacce_dev_list *head, +- int *numa_dev_num, __u8 *numa_num, __u8 size) ++static __u16 wd_get_dev_numa(struct uacce_dev_list *head, ++ int *numa_dev_num, __u16 size) + { + struct uacce_dev_list *list = head; ++ __u16 numa_num = 0; + + while (list) { + if (list->dev->numa_id < 0) { + list->dev->numa_id = 0; + } else if (list->dev->numa_id >= size) { + WD_ERR("numa id is wrong(%d)\n", list->dev->numa_id); +- *numa_num = 0; +- return; ++ return 0; + } + + if (!numa_dev_num[list->dev->numa_id]) +- (*numa_num)++; ++ numa_num++; + + numa_dev_num[list->dev->numa_id]++; + list = list->next; + } ++ ++ return numa_num; + } + + static void wd_set_numa_dev(struct uacce_dev_list *head, +@@ -400,39 +402,18 @@ static void wd_set_numa_dev(struct uacce_dev_list *head, + } + } + +-static int wd_alloc_numa(struct wd_env_config *config, +- const struct wd_alg_ops *ops) ++static int wd_set_config_numa(struct wd_env_config *config, ++ int *numa_dev_num, int max_node) + { + struct wd_env_config_per_numa *config_numa; +- struct uacce_dev_list *head; +- int numa_dev_num[MAX_NUMA_NUM] = {0}; +- __u8 numa_num = 0; +- int i, ret; +- +- /* get uacce_dev */ +- head = wd_get_accel_list(ops->alg_name); +- if (!head) { +- WD_ERR("no device to support %s\n", ops->alg_name); +- return -WD_ENODEV; +- } +- +- /* get numa num and device num of each numa from uacce_dev list */ +- wd_get_dev_numa(head, numa_dev_num, &numa_num, MAX_NUMA_NUM); +- if (numa_num == 0 || numa_num > MAX_NUMA_NUM) { +- WD_ERR("numa num err(%u)!\n", numa_num); +- wd_free_list_accels(head); +- return -WD_ENODEV; +- } ++ int i; + +- config->numa_num = numa_num; +- config->config_per_numa = calloc(numa_num, sizeof(*config_numa)); +- if (!config->config_per_numa) { +- ret = -WD_ENOMEM; +- goto free_list; +- } ++ config->config_per_numa = calloc(config->numa_num, sizeof(*config_numa)); ++ if (!config->config_per_numa) ++ return -WD_ENOMEM; + + config_numa = config->config_per_numa; +- for (i = 0; i < MAX_NUMA_NUM; i++) { ++ for (i = 0; i < max_node; i++) { + if (!numa_dev_num[i]) + continue; + +@@ -440,24 +421,65 @@ static int wd_alloc_numa(struct wd_env_config *config, + config_numa->dev = calloc(numa_dev_num[i], + sizeof(struct uacce_dev)); + if (!config_numa->dev) { +- ret = -WD_ENOMEM; +- goto free_mem; ++ /* free config_per_numa and all uacce dev */ ++ wd_free_numa(config); ++ return -WD_ENOMEM; + } + + config_numa->dev_num = 0; + config_numa++; + } + ++ return 0; ++} ++ ++static int wd_alloc_numa(struct wd_env_config *config, ++ const struct wd_alg_ops *ops) ++{ ++ struct uacce_dev_list *head; ++ int *numa_dev_num; ++ int ret, max_node; ++ ++ max_node = numa_max_node() + 1; ++ if (max_node <= 0) ++ return -WD_EINVAL; ++ ++ numa_dev_num = calloc(max_node, sizeof(int)); ++ if (!numa_dev_num) ++ return -WD_ENOMEM; ++ ++ /* get uacce_dev */ ++ head = wd_get_accel_list(ops->alg_name); ++ if (!head) { ++ WD_ERR("no device to support %s\n", ops->alg_name); ++ ret = -WD_ENODEV; ++ goto free_numa_dev_num; ++ } ++ ++ /* get numa num and device num of each numa from uacce_dev list */ ++ config->numa_num = wd_get_dev_numa(head, numa_dev_num, max_node); ++ if (config->numa_num == 0 || config->numa_num > max_node) { ++ WD_ERR("numa num err(%u)!\n", config->numa_num); ++ ret = -WD_ENODEV; ++ goto free_list; ++ } ++ ++ /* alloc and init config_per_numa and all uacce dev */ ++ ret = wd_set_config_numa(config, numa_dev_num, max_node); ++ if (ret) ++ goto free_list; ++ + /* set device and device num for config numa from uacce_dev list */ + wd_set_numa_dev(head, config); + wd_free_list_accels(head); ++ free(numa_dev_num); + + return 0; + +-free_mem: +- wd_free_numa(config); + free_list: + wd_free_list_accels(head); ++free_numa_dev_num: ++ free(numa_dev_num); + return ret; + } + +@@ -981,18 +1003,22 @@ static int wd_sched_fill_table(struct wd_env_config_per_numa *config_numa, + static int wd_init_sched_config(struct wd_env_config *config) + { + struct wd_env_config_per_numa *config_numa; ++ int i, j, ret, max_node, type_num; + struct wd_sched *sched; +- int type_num = config->op_type_num; +- int i, j, ret; + void *func = NULL; + ++ max_node = numa_max_node() + 1; ++ if (max_node <= 0) ++ return -WD_EINVAL; ++ + if (!config->enable_internal_poll) + func = config->alg_poll_ctx; + + config->internal_sched = false; ++ type_num = config->op_type_num; + if (!config->sched) { + config->sched = wd_sched_rr_alloc(SCHED_POLICY_RR, type_num, +- MAX_NUMA_NUM, func); ++ max_node, func); + if (!config->sched) + return -WD_ENOMEM; + +-- +2.31.1 + diff --git a/0013-uadk-mempool-remove-MISC_DVE_UACCE_CTRL.patch b/0013-uadk-mempool-remove-MISC_DVE_UACCE_CTRL.patch new file mode 100644 index 0000000..5cf6aab --- /dev/null +++ b/0013-uadk-mempool-remove-MISC_DVE_UACCE_CTRL.patch @@ -0,0 +1,27 @@ +From cf1b23feddeba22869d35d5f1fa4b4675f9b8984 Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Thu, 30 Dec 2021 12:07:26 +0800 +Subject: [PATCH 15/28] uadk: mempool: remove MISC_DVE_UACCE_CTRL + +MISC_DVE_UACCE_CTRL is no longer used, clean it. + +Signed-off-by: Wenkai Lin +--- + wd_mempool.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/wd_mempool.c b/wd_mempool.c +index 2462560..bbf5edb 100644 +--- a/wd_mempool.c ++++ b/wd_mempool.c +@@ -18,7 +18,6 @@ + + #define SYSFS_NODE_PATH "/sys/devices/system/node/node" + #define MAX_HP_STR_SIZE 64 +-#define MISC_DVE_UACCE_CTRL "/dev/uacce_ctrl" + #define HUGETLB_FLAG_ENCODE_SHIFT 26 + + #define BITS_PER_LONG ((unsigned int)sizeof(unsigned long) * 8) +-- +2.31.1 + diff --git a/0014-uadk-mempool-check-stats-null-pointer.patch b/0014-uadk-mempool-check-stats-null-pointer.patch new file mode 100644 index 0000000..a35ac30 --- /dev/null +++ b/0014-uadk-mempool-check-stats-null-pointer.patch @@ -0,0 +1,32 @@ +From 80fd67d79a66c45171890460ed8a8cc8bc83bb7a Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Thu, 30 Dec 2021 12:07:28 +0800 +Subject: [PATCH 16/28] uadk: mempool: check stats null pointer + +If user input's stats is null pointer, it will cause +a segment fault, fix it. + +Signed-off-by: Wenkai Lin +--- + wd_mempool.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/wd_mempool.c b/wd_mempool.c +index bbf5edb..b6e1088 100644 +--- a/wd_mempool.c ++++ b/wd_mempool.c +@@ -958,6 +958,11 @@ void wd_mempool_stats(handle_t mempool, struct wd_mempool_stats *stats) + return; + } + ++ if (!stats) { ++ WD_ERR("wd_mempool: mempool stats is NULL\n"); ++ return; ++ } ++ + wd_spinlock(&mp->lock); + + stats->page_type = mp->page_type; +-- +2.31.1 + diff --git a/0015-uadk-fix-wd_get_config_numa-info.patch b/0015-uadk-fix-wd_get_config_numa-info.patch new file mode 100644 index 0000000..3111bba --- /dev/null +++ b/0015-uadk-fix-wd_get_config_numa-info.patch @@ -0,0 +1,29 @@ +From 19add2ea6da8525bafb8fb2747965cbb55dbea75 Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Thu, 30 Dec 2021 12:07:29 +0800 +Subject: [PATCH 17/28] uadk: fix wd_get_config_numa info + +wd_get_config_numa is used to get config numa +by node id, not set a numa dev. + +Signed-off-by: Wenkai Lin +--- + wd_util.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/wd_util.c b/wd_util.c +index 3a1def5..faaf821 100644 +--- a/wd_util.c ++++ b/wd_util.c +@@ -391,7 +391,7 @@ static void wd_set_numa_dev(struct uacce_dev_list *head, + while (list) { + config_numa = wd_get_config_numa(config, list->dev->numa_id); + if (!config_numa) { +- WD_ERR("set numa dev err!\n"); ++ WD_ERR("%s got wrong numa node!\n", __func__); + break; + } + +-- +2.31.1 + diff --git a/0016-uadk-fix-static-check-warning.patch b/0016-uadk-fix-static-check-warning.patch new file mode 100644 index 0000000..d0b71de --- /dev/null +++ b/0016-uadk-fix-static-check-warning.patch @@ -0,0 +1,46 @@ +From 0feee4ccc2b3d0f60d84d39310fc1f85a3d28d63 Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Thu, 30 Dec 2021 12:07:30 +0800 +Subject: [PATCH 18/28] uadk: fix static check warning + +1.set null pointer after free. +2.define const pointer. + +Signed-off-by: Wenkai Lin +--- + wd_sched.c | 4 +++- + wd_util.c | 2 +- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/wd_sched.c b/wd_sched.c +index b310077..3330a4d 100644 +--- a/wd_sched.c ++++ b/wd_sched.c +@@ -406,8 +406,10 @@ void wd_sched_rr_release(struct wd_sched *sched) + sched_info = sched_ctx->sched_info; + for (i = 0; i < sched_ctx->numa_num; i++) { + for (j = 0; j < SCHED_MODE_BUTT; j++) { +- if (sched_info[i].ctx_region[j]) ++ if (sched_info[i].ctx_region[j]) { + free(sched_info[i].ctx_region[j]); ++ sched_info[i].ctx_region[j] = NULL; ++ } + } + } + +diff --git a/wd_util.c b/wd_util.c +index faaf821..62f9359 100644 +--- a/wd_util.c ++++ b/wd_util.c +@@ -403,7 +403,7 @@ static void wd_set_numa_dev(struct uacce_dev_list *head, + } + + static int wd_set_config_numa(struct wd_env_config *config, +- int *numa_dev_num, int max_node) ++ const int *numa_dev_num, int max_node) + { + struct wd_env_config_per_numa *config_numa; + int i; +-- +2.31.1 + diff --git a/0017-uadk-fix-numa-array-use-too-much-stack-space.patch b/0017-uadk-fix-numa-array-use-too-much-stack-space.patch new file mode 100644 index 0000000..9694970 --- /dev/null +++ b/0017-uadk-fix-numa-array-use-too-much-stack-space.patch @@ -0,0 +1,69 @@ +From 4a15745d3544eae2c41419d5fb64802e2a16a9f5 Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Thu, 30 Dec 2021 12:07:31 +0800 +Subject: [PATCH 19/28] uadk: fix numa array use too much stack space + +numa array will take 32768 bytes, too big for +a process, replace it by check numa invalid status. + +Signed-off-by: Wenkai Lin +--- + wd_sched.c | 19 ++++++++++++------- + 1 file changed, 12 insertions(+), 7 deletions(-) + +diff --git a/wd_sched.c b/wd_sched.c +index 3330a4d..f97c15f 100644 +--- a/wd_sched.c ++++ b/wd_sched.c +@@ -202,10 +202,8 @@ static int session_sched_poll_policy(handle_t sched_ctx, + { + struct wd_sched_ctx *ctx = (struct wd_sched_ctx *)sched_ctx; + struct wd_sched_info *sched_info; +- __u16 numa[NUMA_NUM_NODES]; + __u32 loop_time = 0; + __u32 last_count = 0; +- __u16 tail = 0; + __u16 i; + int ret; + +@@ -220,9 +218,6 @@ static int session_sched_poll_policy(handle_t sched_ctx, + } + + sched_info = ctx->sched_info; +- for (i = 0; i < ctx->numa_num; i++) +- if (sched_info[i].valid) +- numa[tail++]= i; + + /* + * Try different numa's ctx if we can't receive any +@@ -231,15 +226,25 @@ static int session_sched_poll_policy(handle_t sched_ctx, + */ + while (loop_time < MAX_POLL_TIMES) { + loop_time++; +- for (i = 0; i < tail;) { ++ for (i = 0; i < ctx->numa_num;) { ++ /* If current numa is not valid, find next. */ ++ if (!sched_info[i].valid) { ++ i++; ++ continue; ++ } ++ + last_count = *count; +- ret = session_poll_policy_rr(ctx, numa[i], expect, count); ++ ret = session_poll_policy_rr(ctx, i, expect, count); + if (ret) + return ret; + + if (expect == *count) + return 0; + ++ /* ++ * If no package is received, find next numa, ++ * otherwise, keep receiving packets at this node. ++ */ + if (last_count == *count) + i++; + } +-- +2.31.1 + diff --git a/0018-uadk-fix-get_dev_info.patch b/0018-uadk-fix-get_dev_info.patch new file mode 100644 index 0000000..2492230 --- /dev/null +++ b/0018-uadk-fix-get_dev_info.patch @@ -0,0 +1,86 @@ +From 34b4dcc70a808c286378a9b6aeb72d5ba88493ef Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Thu, 30 Dec 2021 12:07:32 +0800 +Subject: [PATCH 20/28] uadk: fix get_dev_info + +Fix for get_int_attr and get_str_attr +return value is not checked in get_dev_info. + +Signed-off-by: Wenkai Lin +--- + wd.c | 43 +++++++++++++++++++++++++++++++++---------- + 1 file changed, 33 insertions(+), 10 deletions(-) + +diff --git a/wd.c b/wd.c +index 2bb2fdd..25386d7 100644 +--- a/wd.c ++++ b/wd.c +@@ -137,23 +137,43 @@ static int get_dev_info(struct uacce_dev *dev) + int value = 0; + int ret; + +- get_int_attr(dev, "flags", &dev->flags); +- get_str_attr(dev, "api", dev->api, WD_NAME_SIZE); +- + /* hardware err isolate flag */ + ret = access_attr(dev->dev_root, "isolate", F_OK); + if (!ret) { +- get_int_attr(dev, "isolate", &value); +- if (value == 1) ++ ret = get_int_attr(dev, "isolate", &value); ++ if (ret < 0) ++ return ret; ++ else if (value == 1) + return -ENODEV; + } + +- get_str_attr(dev, "algorithms", dev->algs, MAX_ATTR_STR_SIZE); +- get_int_attr(dev, "region_mmio_size", &value); ++ ret = get_int_attr(dev, "flags", &dev->flags); ++ if (ret < 0) ++ return ret; ++ ++ ret = get_int_attr(dev, "region_mmio_size", &value); ++ if (ret < 0) ++ return ret; ++ + dev->qfrs_offs[UACCE_QFRT_MMIO] = value; +- get_int_attr(dev, "region_dus_size", &value); ++ ++ ret = get_int_attr(dev, "region_dus_size", &value); ++ if (ret < 0) ++ return ret; ++ + dev->qfrs_offs[UACCE_QFRT_DUS] = value; +- get_int_attr(dev, "device/numa_node", &dev->numa_id); ++ ++ ret = get_int_attr(dev, "device/numa_node", &dev->numa_id); ++ if (ret < 0) ++ return ret; ++ ++ ret = get_str_attr(dev, "api", dev->api, WD_NAME_SIZE); ++ if (ret < 0) ++ return ret; ++ ++ ret = get_str_attr(dev, "algorithms", dev->algs, MAX_ATTR_STR_SIZE); ++ if (ret < 0) ++ return ret; + + return 0; + } +@@ -195,8 +215,11 @@ static struct uacce_dev *read_uacce_sysfs(const char *dev_name) + goto out_dir; + + ret = get_dev_info(dev); +- if (ret) ++ if (ret) { ++ WD_ERR("failed to get dev info: ret = %d!\n", ret); + goto out_dir; ++ } ++ + break; + } + if (!dev_dir) +-- +2.31.1 + diff --git a/0019-uadk-fix-pthread_spin_init.patch b/0019-uadk-fix-pthread_spin_init.patch new file mode 100644 index 0000000..423d541 --- /dev/null +++ b/0019-uadk-fix-pthread_spin_init.patch @@ -0,0 +1,92 @@ +From 913a84cbdce651aea50a6e12117ee93ccbbdbf1c Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Thu, 30 Dec 2021 12:07:33 +0800 +Subject: [PATCH 21/28] uadk: fix pthread_spin_init + +pthread_spin_init() may fail with errors, +check return value for it. + +Signed-off-by: Wenkai Lin +--- + drv/hisi_qm_udrv.c | 16 ++++++++++++---- + wd_util.c | 9 +++++++-- + 2 files changed, 19 insertions(+), 6 deletions(-) + +diff --git a/drv/hisi_qm_udrv.c b/drv/hisi_qm_udrv.c +index 8282c51..845fa46 100644 +--- a/drv/hisi_qm_udrv.c ++++ b/drv/hisi_qm_udrv.c +@@ -298,7 +298,7 @@ static int hisi_qm_setup_info(struct hisi_qp *qp, struct hisi_qm_priv *config) + ret = hisi_qm_get_qfrs_offs(qp->h_ctx, q_info); + if (ret) { + WD_ERR("get dev qfrs offset fail.\n"); +- return ret; ++ goto err_out; + } + + ret = hisi_qm_setup_db(qp->h_ctx, q_info); +@@ -323,7 +323,11 @@ static int hisi_qm_setup_info(struct hisi_qp *qp, struct hisi_qm_priv *config) + q_info->region_size[UACCE_QFRT_DUS] - sizeof(uint32_t); + q_info->ds_rx_base = q_info->ds_tx_base - sizeof(uint32_t); + +- pthread_spin_init(&q_info->lock, PTHREAD_PROCESS_SHARED); ++ ret = pthread_spin_init(&q_info->lock, PTHREAD_PROCESS_SHARED); ++ if (ret) { ++ WD_ERR("init qinfo lock fail\n"); ++ goto err_out; ++ } + + return 0; + +@@ -560,7 +564,7 @@ static struct hisi_sgl *hisi_qm_align_sgl(const void *sgl, __u32 sge_num) + handle_t hisi_qm_create_sglpool(__u32 sgl_num, __u32 sge_num) + { + struct hisi_sgl_pool *sgl_pool; +- int i; ++ int i, ret; + + if (!sgl_num || !sge_num || sge_num > HISI_SGE_NUM_IN_SGL) { + WD_ERR("create sgl_pool failed, sgl_num=%u, sge_num=%u\n", +@@ -601,7 +605,11 @@ handle_t hisi_qm_create_sglpool(__u32 sgl_num, __u32 sge_num) + sgl_pool->sge_num = sge_num; + sgl_pool->depth = sgl_num; + sgl_pool->top = sgl_num; +- pthread_spin_init(&sgl_pool->lock, PTHREAD_PROCESS_SHARED); ++ ret = pthread_spin_init(&sgl_pool->lock, PTHREAD_PROCESS_SHARED); ++ if (ret) { ++ WD_ERR("init sgl pool lock failed.\n"); ++ goto err_out; ++ } + + return (handle_t)sgl_pool; + +diff --git a/wd_util.c b/wd_util.c +index 62f9359..83c77c4 100644 +--- a/wd_util.c ++++ b/wd_util.c +@@ -68,7 +68,7 @@ int wd_init_ctx_config(struct wd_ctx_config_internal *in, + struct wd_ctx_config *cfg) + { + struct wd_ctx_internal *ctxs; +- int i; ++ int i, ret; + + if (!cfg->ctx_num) { + WD_ERR("invalid parameters, ctx_num is 0!\n"); +@@ -93,7 +93,12 @@ int wd_init_ctx_config(struct wd_ctx_config_internal *in, + } + + clone_ctx_to_internal(cfg->ctxs + i, ctxs + i); +- pthread_spin_init(&ctxs[i].lock, PTHREAD_PROCESS_SHARED); ++ ret = pthread_spin_init(&ctxs[i].lock, PTHREAD_PROCESS_SHARED); ++ if (ret) { ++ WD_ERR("init ctxs lock failed!\n"); ++ free(ctxs); ++ return ret; ++ } + } + + in->ctxs = ctxs; +-- +2.31.1 + diff --git a/0020-uadk-env-optimize-find_async_queue.patch b/0020-uadk-env-optimize-find_async_queue.patch new file mode 100644 index 0000000..86b1f07 --- /dev/null +++ b/0020-uadk-env-optimize-find_async_queue.patch @@ -0,0 +1,69 @@ +From 1c037d1a257714802890f83aaa970fc140786915 Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Thu, 30 Dec 2021 12:07:34 +0800 +Subject: [PATCH 22/28] uadk: env: optimize find_async_queue + +No need to find ctx idx from begin to end, +if it is in ctx range, calculate its offset +from begin ctx. +If offset not set, find_async_queue should +return NULL. + +Signed-off-by: Wenkai Lin +--- + wd_util.c | 29 ++++++++++++++--------------- + 1 file changed, 14 insertions(+), 15 deletions(-) + +diff --git a/wd_util.c b/wd_util.c +index 83c77c4..ee1c084 100644 +--- a/wd_util.c ++++ b/wd_util.c +@@ -1061,7 +1061,9 @@ static struct async_task_queue *find_async_queue(struct wd_env_config *config, + struct wd_env_config_per_numa *config_numa; + struct wd_ctx_range **ctx_table; + struct async_task_queue *head; +- int i, j, n = -1, num = 0; ++ int offset = -1; ++ int num = 0; ++ int i; + + FOREACH_NUMA(i, config, config_numa) { + num += config_numa->sync_ctx_num + config_numa->async_ctx_num; +@@ -1074,23 +1076,20 @@ static struct async_task_queue *find_async_queue(struct wd_env_config *config, + + ctx_table = config_numa->ctx_table; + for (i = 0; i < config_numa->op_type_num; i++) { +- for (j = ctx_table[CTX_MODE_ASYNC][i].begin; +- j <= ctx_table[CTX_MODE_ASYNC][i].end; +- j++) { +- if (j == idx) { +- n = j - ctx_table[CTX_MODE_ASYNC][i].begin; +- if (n >= config_numa->async_poll_num) +- n = n % config_numa->async_poll_num; +- break; +- } ++ if (idx <= ctx_table[CTX_MODE_ASYNC][i].end && ++ idx >= ctx_table[CTX_MODE_ASYNC][i].begin) { ++ offset = idx - ctx_table[CTX_MODE_ASYNC][i].begin; ++ if (offset >= config_numa->async_poll_num) ++ offset = offset % config_numa->async_poll_num; + } + } ++ ++ if (offset < 0) ++ return NULL; ++ + head = (struct async_task_queue *)config_numa->async_task_queue_array; +- if (n >= 0) { +- head += n; +- return head; +- } +- return head; ++ ++ return head + offset; + } + + /* fix me: all return value here, and no config input */ +-- +2.31.1 + diff --git a/0021-uadk-env-optimize-some-function.patch b/0021-uadk-env-optimize-some-function.patch new file mode 100644 index 0000000..b419512 --- /dev/null +++ b/0021-uadk-env-optimize-some-function.patch @@ -0,0 +1,175 @@ +From a98e9a6092ae5af499353a739f30506bee7db73f Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Thu, 30 Dec 2021 12:15:29 +0800 +Subject: [PATCH 23/28] uadk: env: optimize some function + +1.find_async_queue add some abnormal branch judgment +2.wd_init_async_polling_thread_per_numa use queue_head + to save a task queue head. + +Signed-off-by: Wenkai Lin +--- + wd_util.c | 71 ++++++++++++++++++++++++++++++++----------------------- + 1 file changed, 41 insertions(+), 30 deletions(-) + +diff --git a/wd_util.c b/wd_util.c +index ee1c084..49e1d66 100644 +--- a/wd_util.c ++++ b/wd_util.c +@@ -1061,7 +1061,7 @@ static struct async_task_queue *find_async_queue(struct wd_env_config *config, + struct wd_env_config_per_numa *config_numa; + struct wd_ctx_range **ctx_table; + struct async_task_queue *head; +- int offset = -1; ++ unsigned long offset; + int num = 0; + int i; + +@@ -1071,8 +1071,15 @@ static struct async_task_queue *find_async_queue(struct wd_env_config *config, + break; + } + +- if (i == config->numa_num) ++ if (i == config->numa_num) { ++ WD_ERR("failed to find a proper numa node!\n"); ++ return NULL; ++ } ++ ++ if (!config_numa->async_poll_num) { ++ WD_ERR("invalid parameter, async_poll_num of numa is zero!\n"); + return NULL; ++ } + + ctx_table = config_numa->ctx_table; + for (i = 0; i < config_numa->op_type_num; i++) { +@@ -1081,11 +1088,15 @@ static struct async_task_queue *find_async_queue(struct wd_env_config *config, + offset = idx - ctx_table[CTX_MODE_ASYNC][i].begin; + if (offset >= config_numa->async_poll_num) + offset = offset % config_numa->async_poll_num; ++ ++ break; + } + } + +- if (offset < 0) ++ if (i == config_numa->op_type_num) { ++ WD_ERR("failed to find async queue for ctx: idx %u!\n", idx); + return NULL; ++ } + + head = (struct async_task_queue *)config_numa->async_task_queue_array; + +@@ -1193,18 +1204,18 @@ static int wd_init_one_task_queue(struct async_task_queue *task_queue, + void *alg_poll_ctx) + + { +- struct async_task *head; ++ struct async_task *task_head; + pthread_t thread_id; + pthread_attr_t attr; + int depth, ret; + + task_queue->depth = depth = WD_ASYNC_DEF_QUEUE_DEPTH; + +- head = calloc(task_queue->depth, sizeof(*head)); +- if (!head) ++ task_head = calloc(task_queue->depth, sizeof(struct async_task)); ++ if (!task_head) + return -WD_ENOMEM; + +- task_queue->head = head; ++ task_queue->head = task_head; + task_queue->left_task = depth; + task_queue->alg_poll_ctx = alg_poll_ctx; + +@@ -1245,7 +1256,7 @@ err_uninit_full_sem: + err_uninit_empty_sem: + sem_destroy(&task_queue->empty_sem); + err_free_head: +- free(head); ++ free(task_head); + ret = -errno; + return ret; + } +@@ -1272,45 +1283,45 @@ static void wd_uninit_one_task_queue(struct async_task_queue *task_queue) + static int wd_init_async_polling_thread_per_numa(struct wd_env_config *config, + struct wd_env_config_per_numa *config_numa) + { +- struct async_task_queue *task_queue, *head; +- int i, j, n, ret; ++ struct async_task_queue *task_queue, *queue_head; ++ int i, j, poll_thread_num, ret; + + if (!config_numa->async_ctx_num) + return 0; + +- if (config_numa->async_poll_num <= 0) { +- WD_ERR("Invalid async poll number (%ld) is set.\n", ++ if (!config_numa->async_poll_num) { ++ WD_ERR("invalid async poll num (%lu) is set.\n", + config_numa->async_poll_num); +- WD_ERR("Change to default value: %d\n", WD_ASYNC_DEF_POLL_NUM); ++ WD_ERR("change to default value: %d\n", WD_ASYNC_DEF_POLL_NUM); + config_numa->async_poll_num = WD_ASYNC_DEF_POLL_NUM; + } + ++ poll_thread_num = config_numa->async_poll_num; ++ if (poll_thread_num > config_numa->async_ctx_num) { ++ poll_thread_num = config_numa->async_ctx_num; ++ WD_ERR("downgrade poll thread num from %lu to %lu.\n", ++ config_numa->async_poll_num, ++ config_numa->async_ctx_num); ++ } ++ + /* make max task queues as the number of async ctxs */ +- task_queue = calloc(config_numa->async_ctx_num, sizeof(*head)); +- if (!task_queue) ++ queue_head = calloc(config_numa->async_ctx_num, sizeof(*queue_head)); ++ if (!queue_head) + return -WD_ENOMEM; +- head = task_queue; +- config_numa->async_task_queue_array = (void *)head; + +- if (config_numa->async_poll_num > config_numa->async_ctx_num) { +- n = config_numa->async_ctx_num; +- WD_ERR("Can't create more async polling threads than the " +- "number of ctx number. Downgrade it from %ld to %ld.\n", +- config_numa->async_poll_num, +- config_numa->async_ctx_num); +- } else +- n = config_numa->async_poll_num; +- for (i = 0; i < n; task_queue++, i++) { ++ task_queue = queue_head; ++ for (i = 0; i < poll_thread_num; task_queue++, i++) { + ret = wd_init_one_task_queue(task_queue, config->alg_poll_ctx); + if (ret) { +- task_queue = head; + for (j = 0; j < i; task_queue++, j++) + wd_uninit_one_task_queue(task_queue); +- free(head); ++ free(queue_head); + return ret; + } + } + ++ config_numa->async_task_queue_array = (void *)queue_head; ++ + return 0; + } + +@@ -1322,10 +1333,10 @@ static void wd_uninit_async_polling_thread_per_numa(struct wd_env_config *cfg, + + head = config_numa->async_task_queue_array; + task_queue = head; ++ n = config_numa->async_poll_num; + if (config_numa->async_poll_num > config_numa->async_ctx_num) + n = config_numa->async_ctx_num; +- else +- n = config_numa->async_poll_num; ++ + for (i = 0; i < n; task_queue++, i++) + wd_uninit_one_task_queue(task_queue); + free(head); +-- +2.31.1 + diff --git a/0022-uadk-v1-delete-unused-parameter.patch b/0022-uadk-v1-delete-unused-parameter.patch new file mode 100644 index 0000000..bc2ad5a --- /dev/null +++ b/0022-uadk-v1-delete-unused-parameter.patch @@ -0,0 +1,37 @@ +From 09db34533df0920fe0102e85ab573038ad69bf2d Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Thu, 30 Dec 2021 20:34:50 +0800 +Subject: [PATCH 24/28] uadk: v1: delete unused parameter + +capa is not used in copy_if_better. + +Signed-off-by: Wenkai Lin +--- + v1/wd.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/v1/wd.c b/v1/wd.c +index 6568243..26f6692 100644 +--- a/v1/wd.c ++++ b/v1/wd.c +@@ -349,7 +349,7 @@ static int get_dev_info(struct dev_info *dinfo, const char *alg) + } + + static bool copy_if_better(struct dev_info *old, struct dev_info *new, +- struct wd_capa *capa, unsigned int node_mask) ++ unsigned int node_mask) + { + bool find_node = false; + +@@ -437,7 +437,7 @@ static int find_available_dev(struct dev_info *dinfop, + ret = get_dev_info(&dinfo, capa->alg); + if (!ret) { + cnt++; +- if (copy_if_better(dinfop, &dinfo, capa, node_mask)) { ++ if (copy_if_better(dinfop, &dinfo, node_mask)) { + find_node = true; + break; + } +-- +2.31.1 + diff --git a/0023-uadk-env-fix-wd_add_task_to_async_queue-return-value.patch b/0023-uadk-env-fix-wd_add_task_to_async_queue-return-value.patch new file mode 100644 index 0000000..e20ea7d --- /dev/null +++ b/0023-uadk-env-fix-wd_add_task_to_async_queue-return-value.patch @@ -0,0 +1,212 @@ +From d827ac994867b2dd06d5723d62c6c618f0c5c77b Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Thu, 30 Dec 2021 20:34:51 +0800 +Subject: [PATCH 25/28] uadk: env: fix wd_add_task_to_async_queue return value + +wd_add_task_to_async_queue may fail with error code, +add return value check after call it. + +Signed-off-by: Wenkai Lin +--- + wd_aead.c | 10 ++++++++-- + wd_cipher.c | 10 ++++++++-- + wd_comp.c | 4 +++- + wd_dh.c | 6 ++++-- + wd_digest.c | 11 ++++++++--- + wd_ecc.c | 6 ++++-- + wd_rsa.c | 6 ++++-- + wd_util.c | 20 +++++++++++++------- + 8 files changed, 52 insertions(+), 21 deletions(-) + +diff --git a/wd_aead.c b/wd_aead.c +index f93f791..ebad440 100644 +--- a/wd_aead.c ++++ b/wd_aead.c +@@ -596,11 +596,17 @@ int wd_do_aead_async(handle_t h_sess, struct wd_aead_req *req) + if (ret != -WD_EBUSY) + WD_ERR("failed to send BD, hw is err!\n"); + +- wd_put_msg_to_pool(&wd_aead_setting.pool, idx, msg->tag); ++ goto fail_with_msg; + } + +- wd_add_task_to_async_queue(&wd_aead_env_config, idx); ++ ret = wd_add_task_to_async_queue(&wd_aead_env_config, idx); ++ if (ret) ++ goto fail_with_msg; ++ ++ return 0; + ++fail_with_msg: ++ wd_put_msg_to_pool(&wd_aead_setting.pool, idx, msg->tag); + return ret; + } + +diff --git a/wd_cipher.c b/wd_cipher.c +index 9977765..9c1f98c 100644 +--- a/wd_cipher.c ++++ b/wd_cipher.c +@@ -515,11 +515,17 @@ int wd_do_cipher_async(handle_t h_sess, struct wd_cipher_req *req) + if (ret != -WD_EBUSY) + WD_ERR("wd cipher async send err!\n"); + +- wd_put_msg_to_pool(&wd_cipher_setting.pool, idx, msg->tag); ++ goto fail_with_msg; + } + +- wd_add_task_to_async_queue(&wd_cipher_env_config, idx); ++ ret = wd_add_task_to_async_queue(&wd_cipher_env_config, idx); ++ if (ret) ++ goto fail_with_msg; ++ ++ return 0; + ++fail_with_msg: ++ wd_put_msg_to_pool(&wd_cipher_setting.pool, idx, msg->tag); + return ret; + } + +diff --git a/wd_comp.c b/wd_comp.c +index e34d590..fc355a9 100644 +--- a/wd_comp.c ++++ b/wd_comp.c +@@ -724,7 +724,9 @@ int wd_do_comp_async(handle_t h_sess, struct wd_comp_req *req) + + pthread_spin_unlock(&ctx->lock); + +- wd_add_task_to_async_queue(&wd_comp_env_config, idx); ++ ret = wd_add_task_to_async_queue(&wd_comp_env_config, idx); ++ if (ret) ++ wd_put_msg_to_pool(&wd_comp_setting.pool, idx, msg->tag); + + return ret; + } +diff --git a/wd_dh.c b/wd_dh.c +index 177ffad..7b849ac 100644 +--- a/wd_dh.c ++++ b/wd_dh.c +@@ -341,9 +341,11 @@ int wd_do_dh_async(handle_t sess, struct wd_dh_req *req) + } + pthread_spin_unlock(&ctx->lock); + +- wd_add_task_to_async_queue(&wd_dh_env_config, idx); ++ ret = wd_add_task_to_async_queue(&wd_dh_env_config, idx); ++ if (ret) ++ goto fail_with_msg; + +- return ret; ++ return 0; + + fail_with_msg: + wd_put_msg_to_pool(&wd_dh_setting.pool, idx, mid); +diff --git a/wd_digest.c b/wd_digest.c +index bbb258f..2b3661d 100644 +--- a/wd_digest.c ++++ b/wd_digest.c +@@ -420,13 +420,18 @@ int wd_do_digest_async(handle_t h_sess, struct wd_digest_req *req) + if (ret != -WD_EBUSY) + WD_ERR("failed to send BD, hw is err!\n"); + +- wd_put_msg_to_pool(&wd_digest_setting.pool, idx, msg->tag); +- return ret; ++ goto fail_with_msg; + } + +- wd_add_task_to_async_queue(&wd_digest_env_config, idx); ++ ret = wd_add_task_to_async_queue(&wd_digest_env_config, idx); ++ if (ret) ++ goto fail_with_msg; + + return 0; ++ ++fail_with_msg: ++ wd_put_msg_to_pool(&wd_digest_setting.pool, idx, msg->tag); ++ return ret; + } + + int wd_digest_poll_ctx(__u32 idx, __u32 expt, __u32 *count) +diff --git a/wd_ecc.c b/wd_ecc.c +index 8b625e4..e37fb39 100644 +--- a/wd_ecc.c ++++ b/wd_ecc.c +@@ -2187,9 +2187,11 @@ int wd_do_ecc_async(handle_t sess, struct wd_ecc_req *req) + } + pthread_spin_unlock(&ctx->lock); + +- wd_add_task_to_async_queue(&wd_ecc_env_config, idx); ++ ret = wd_add_task_to_async_queue(&wd_ecc_env_config, idx); ++ if (ret) ++ goto fail_with_msg; + +- return ret; ++ return 0; + + fail_with_msg: + wd_put_msg_to_pool(&wd_ecc_setting.pool, idx, mid); +diff --git a/wd_rsa.c b/wd_rsa.c +index 2831111..b6cc0d1 100644 +--- a/wd_rsa.c ++++ b/wd_rsa.c +@@ -397,9 +397,11 @@ int wd_do_rsa_async(handle_t sess, struct wd_rsa_req *req) + if (ret) + goto fail_with_msg; + +- wd_add_task_to_async_queue(&wd_rsa_env_config, idx); ++ ret = wd_add_task_to_async_queue(&wd_rsa_env_config, idx); ++ if (ret) ++ goto fail_with_msg; + +- return ret; ++ return 0; + + fail_with_msg: + wd_put_msg_to_pool(&wd_rsa_setting.pool, idx, mid); +diff --git a/wd_util.c b/wd_util.c +index 49e1d66..e04747b 100644 +--- a/wd_util.c ++++ b/wd_util.c +@@ -1108,17 +1108,20 @@ int wd_add_task_to_async_queue(struct wd_env_config *config, __u32 idx) + { + struct async_task_queue *task_queue; + struct async_task *head, *task; +- int prod; ++ int prod, ret; + + if (!config->enable_internal_poll) + return 0; + + task_queue = find_async_queue(config, idx); + if (!task_queue) +- return 0; ++ return -WD_EINVAL; + +- if (sem_wait(&task_queue->empty_sem)) +- return 0; ++ ret = sem_wait(&task_queue->empty_sem); ++ if (ret) { ++ WD_ERR("failed to wait empty_sem!\n"); ++ return ret; ++ } + + pthread_mutex_lock(&task_queue->lock); + +@@ -1135,10 +1138,13 @@ int wd_add_task_to_async_queue(struct wd_env_config *config, __u32 idx) + + pthread_mutex_unlock(&task_queue->lock); + +- if (sem_post(&task_queue->full_sem)) +- return 0; ++ ret = sem_post(&task_queue->full_sem); ++ if (ret) { ++ WD_ERR("failed to post full_sem!\n"); ++ return ret; ++ } + +- return 1; ++ return 0; + } + + static void *async_poll_process_func(void *args) +-- +2.31.1 + diff --git a/0024-uadk-sched-fix-memory-leak.patch b/0024-uadk-sched-fix-memory-leak.patch new file mode 100644 index 0000000..4e714a1 --- /dev/null +++ b/0024-uadk-sched-fix-memory-leak.patch @@ -0,0 +1,36 @@ +From 3ccff1938ec43efa1a4bb3f367d1985e35b91c0e Mon Sep 17 00:00:00 2001 +From: Wenkai Lin +Date: Thu, 30 Dec 2021 20:34:52 +0800 +Subject: [PATCH 26/28] uadk: sched: fix memory leak + +sched_ctx and sched must be associated to +release the memory of sched_ctx + +Signed-off-by: Wenkai Lin +--- + wd_sched.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/wd_sched.c b/wd_sched.c +index f97c15f..a85fd95 100644 +--- a/wd_sched.c ++++ b/wd_sched.c +@@ -463,6 +463,7 @@ struct wd_sched *wd_sched_rr_alloc(__u8 sched_type, __u8 type_num, + goto err_out; + } + ++ sched->h_sched_ctx = (handle_t)sched_ctx; + sched_info = sched_ctx->sched_info; + + for (i = 0; i < numa_num; i++) { +@@ -482,7 +483,6 @@ struct wd_sched *wd_sched_rr_alloc(__u8 sched_type, __u8 type_num, + sched->sched_init = sched_table[sched_type].sched_init; + sched->pick_next_ctx = sched_table[sched_type].pick_next_ctx; + sched->poll_policy = sched_table[sched_type].poll_policy; +- sched->h_sched_ctx = (handle_t)sched_ctx; + + return sched; + +-- +2.31.1 + diff --git a/0025-hisi-sec-bugfix-for-out_bytes-checking.patch b/0025-hisi-sec-bugfix-for-out_bytes-checking.patch new file mode 100644 index 0000000..2543279 --- /dev/null +++ b/0025-hisi-sec-bugfix-for-out_bytes-checking.patch @@ -0,0 +1,47 @@ +From 5927f19669247d738dfd4a687b5f134a2d289784 Mon Sep 17 00:00:00 2001 +From: Kai Ye +Date: Wed, 29 Dec 2021 17:14:11 +0800 +Subject: [PATCH 27/28] hisi-sec: bugfix for out_bytes checking + +1. Add out_bytes checking for digest alg. and modify some log +information. +2. Optimize the in_bytes length checking. + +Signed-off-by: Kai Ye +--- + drv/hisi_sec.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/drv/hisi_sec.c b/drv/hisi_sec.c +index 603bdda..d31a1b9 100644 +--- a/drv/hisi_sec.c ++++ b/drv/hisi_sec.c +@@ -1279,9 +1279,9 @@ static void parse_digest_bd2(struct hisi_sec_sqe *sqe, struct wd_digest_msg *rec + + static int digest_long_bd_check(struct wd_digest_msg *msg) + { +- if (msg->alg >= WD_DIGEST_SHA512 && msg->in_bytes % SHA512_ALIGN_SZ) ++ if (msg->alg >= WD_DIGEST_SHA512 && msg->in_bytes & (SHA512_ALIGN_SZ - 1)) + return -WD_EINVAL; +- else if (msg->in_bytes % SHA1_ALIGN_SZ) ++ else if (msg->in_bytes & (SHA1_ALIGN_SZ - 1)) + return -WD_EINVAL; + + return 0; +@@ -1298,7 +1298,12 @@ static int digest_len_check(struct wd_digest_msg *msg, enum sec_bd_type type) + } + + if (unlikely(msg->in_bytes > MAX_INPUT_DATA_LEN)) { +- WD_ERR("input data length is too long, size:%u!\n", msg->in_bytes); ++ WD_ERR("digest input length is too long, size:%u!\n", msg->in_bytes); ++ return -WD_EINVAL; ++ } ++ ++ if (unlikely(msg->out_bytes & WORD_ALIGNMENT_MASK)) { ++ WD_ERR("digest out length is error, size:%u!\n", msg->out_bytes); + return -WD_EINVAL; + } + +-- +2.31.1 + diff --git a/libwd-2.3.21.tar.gz b/libwd-2.3.21.tar.gz index 8551d41..83b861e 100644 Binary files a/libwd-2.3.21.tar.gz and b/libwd-2.3.21.tar.gz differ diff --git a/warpdrive.spec b/warpdrive.spec index 5ba36d0..fac12d3 100644 --- a/warpdrive.spec +++ b/warpdrive.spec @@ -1,7 +1,7 @@ Name: libwd Summary: User Space Accelerator Development Kit Version: 2.3.21 -Release: 1 +Release: 2 License: Apache-2.0 Source: %{name}-%{version}.tar.gz Vendor: Huawei Corporation @@ -14,6 +14,31 @@ BuildRequires: numactl-devel, openssl-devel BuildRequires: automake, autoconf, libtool BuildRequires: gcc, make ExclusiveArch: aarch64 +Patch0001: 0001-uadk-digest-add-stream-mode-for-digest-sync.patch +Patch0002: 0002-test-digest-support-the-digest-stream-mode.patch +Patch0003: 0003-aead-cipher-digest-fix-some-code-issues.patch +Patch0004: 0004-digest-v1-fixed-hmac-key-0-length-checking.patch +Patch0005: 0005-digest-v1-check-the-length-of-the-key-need-to-be-cha.patch +Patch0006: 0006-qm-v1-fixup-the-incorrect-configuration-of-the-type.patch +Patch0007: 0007-qm-fixup-the-incorrect-configuration-of-the-type.patch +Patch0008: 0008-uadk_benchmark-use-the-uadk_tool-instead-of-uadk_ben.patch +Patch0009: 0009-digest-some-optimizations-for-digest-stream-mode.patch +Patch0010: 0010-uadk-fix-error-of-wd_get_avail_ctx-return-value.patch +Patch0011: 0011-uadk-fix-comment-content.patch +Patch0012: 0012-uadk-max-numa-number-should-not-be-fixed.patch +Patch0013: 0013-uadk-mempool-remove-MISC_DVE_UACCE_CTRL.patch +Patch0014: 0014-uadk-mempool-check-stats-null-pointer.patch +Patch0015: 0015-uadk-fix-wd_get_config_numa-info.patch +Patch0016: 0016-uadk-fix-static-check-warning.patch +Patch0017: 0017-uadk-fix-numa-array-use-too-much-stack-space.patch +Patch0018: 0018-uadk-fix-get_dev_info.patch +Patch0019: 0019-uadk-fix-pthread_spin_init.patch +Patch0020: 0020-uadk-env-optimize-find_async_queue.patch +Patch0021: 0021-uadk-env-optimize-some-function.patch +Patch0022: 0022-uadk-v1-delete-unused-parameter.patch +Patch0023: 0023-uadk-env-fix-wd_add_task_to_async_queue-return-value.patch +Patch0024: 0024-uadk-sched-fix-memory-leak.patch +Patch0025: 0025-hisi-sec-bugfix-for-out_bytes-checking.patch %description This package contains the User Space Accelerator Library @@ -22,54 +47,52 @@ and decryption, asymmetric encryption and decryption. %prep %global debug_package %{nil} -%autosetup -c -n %{name}-%{version} -p1 +%autosetup -n %{name}-%{version} -p1 %build -cd uadk sh autogen.sh ./configure make %install mkdir -p ${RPM_BUILD_ROOT}/usr/lib64 -install -b -m755 uadk/.libs/libwd.so.%{version} ${RPM_BUILD_ROOT}/usr/lib64 -install -b -m755 uadk/.libs/libwd_crypto.so.%{version} ${RPM_BUILD_ROOT}/usr/lib64 -install -b -m755 uadk/.libs/libwd_comp.so.%{version} ${RPM_BUILD_ROOT}/usr/lib64 -install -b -m755 uadk/.libs/libhisi_sec.so.%{version} ${RPM_BUILD_ROOT}/usr/lib64 -install -b -m755 uadk/.libs/libhisi_hpre.so.%{version} ${RPM_BUILD_ROOT}/usr/lib64 -install -b -m755 uadk/.libs/libhisi_zip.so.%{version} ${RPM_BUILD_ROOT}/usr/lib64 +install -b -m755 .libs/libwd.so.%{version} ${RPM_BUILD_ROOT}/usr/lib64 +install -b -m755 .libs/libwd_crypto.so.%{version} ${RPM_BUILD_ROOT}/usr/lib64 +install -b -m755 .libs/libwd_comp.so.%{version} ${RPM_BUILD_ROOT}/usr/lib64 +install -b -m755 .libs/libhisi_sec.so.%{version} ${RPM_BUILD_ROOT}/usr/lib64 +install -b -m755 .libs/libhisi_hpre.so.%{version} ${RPM_BUILD_ROOT}/usr/lib64 +install -b -m755 .libs/libhisi_zip.so.%{version} ${RPM_BUILD_ROOT}/usr/lib64 mkdir -p ${RPM_BUILD_ROOT}/usr/include/warpdrive/include -cp uadk/v1/uacce.h ${RPM_BUILD_ROOT}/usr/include/warpdrive/include -cp uadk/v1/wd.h ${RPM_BUILD_ROOT}/usr/include/warpdrive -cp uadk/v1/wd_cipher.h ${RPM_BUILD_ROOT}/usr/include/warpdrive -cp uadk/v1/wd_comp.h ${RPM_BUILD_ROOT}/usr/include/warpdrive -cp uadk/v1/wd_dh.h ${RPM_BUILD_ROOT}/usr/include/warpdrive -cp uadk/v1/wd_digest.h ${RPM_BUILD_ROOT}/usr/include/warpdrive -cp uadk/v1/wd_rsa.h ${RPM_BUILD_ROOT}/usr/include/warpdrive -cp uadk/v1/wd_bmm.h ${RPM_BUILD_ROOT}/usr/include/warpdrive +cp v1/uacce.h ${RPM_BUILD_ROOT}/usr/include/warpdrive/include +cp v1/wd.h ${RPM_BUILD_ROOT}/usr/include/warpdrive +cp v1/wd_cipher.h ${RPM_BUILD_ROOT}/usr/include/warpdrive +cp v1/wd_comp.h ${RPM_BUILD_ROOT}/usr/include/warpdrive +cp v1/wd_dh.h ${RPM_BUILD_ROOT}/usr/include/warpdrive +cp v1/wd_digest.h ${RPM_BUILD_ROOT}/usr/include/warpdrive +cp v1/wd_rsa.h ${RPM_BUILD_ROOT}/usr/include/warpdrive +cp v1/wd_bmm.h ${RPM_BUILD_ROOT}/usr/include/warpdrive mkdir -p ${RPM_BUILD_ROOT}/usr/include/uadk/v1 -cp uadk/include/uacce.h ${RPM_BUILD_ROOT}/usr/include/uadk -cp uadk/include/wd.h ${RPM_BUILD_ROOT}/usr/include/uadk -cp uadk/include/wd_cipher.h ${RPM_BUILD_ROOT}/usr/include/uadk -cp uadk/include/wd_comp.h ${RPM_BUILD_ROOT}/usr/include/uadk -cp uadk/include/wd_dh.h ${RPM_BUILD_ROOT}/usr/include/uadk -cp uadk/include/wd_digest.h ${RPM_BUILD_ROOT}/usr/include/uadk -cp uadk/include/wd_rsa.h ${RPM_BUILD_ROOT}/usr/include/uadk -cp uadk/include/wd_aead.h ${RPM_BUILD_ROOT}/usr/include/uadk -cp uadk/include/wd_ecc.h ${RPM_BUILD_ROOT}/usr/include/uadk -cp uadk/include/wd_ecc_curve.h ${RPM_BUILD_ROOT}/usr/include/uadk -cp uadk/include/wd_alg_common.h ${RPM_BUILD_ROOT}/usr/include/uadk -cp uadk/include/wd_common.h ${RPM_BUILD_ROOT}/usr/include/uadk -cp uadk/include/wd_sched.h ${RPM_BUILD_ROOT}/usr/include/uadk -cp uadk/v1/uacce.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 -cp uadk/v1/wd.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 -cp uadk/v1/wd_cipher.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 -cp uadk/v1/wd_comp.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 -cp uadk/v1/wd_dh.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 -cp uadk/v1/wd_digest.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 -cp uadk/v1/wd_rsa.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 -cp uadk/v1/wd_bmm.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 - +cp include/uacce.h ${RPM_BUILD_ROOT}/usr/include/uadk +cp include/wd.h ${RPM_BUILD_ROOT}/usr/include/uadk +cp include/wd_cipher.h ${RPM_BUILD_ROOT}/usr/include/uadk +cp include/wd_comp.h ${RPM_BUILD_ROOT}/usr/include/uadk +cp include/wd_dh.h ${RPM_BUILD_ROOT}/usr/include/uadk +cp include/wd_digest.h ${RPM_BUILD_ROOT}/usr/include/uadk +cp include/wd_rsa.h ${RPM_BUILD_ROOT}/usr/include/uadk +cp include/wd_aead.h ${RPM_BUILD_ROOT}/usr/include/uadk +cp include/wd_ecc.h ${RPM_BUILD_ROOT}/usr/include/uadk +cp include/wd_ecc_curve.h ${RPM_BUILD_ROOT}/usr/include/uadk +cp include/wd_alg_common.h ${RPM_BUILD_ROOT}/usr/include/uadk +cp include/wd_common.h ${RPM_BUILD_ROOT}/usr/include/uadk +cp include/wd_sched.h ${RPM_BUILD_ROOT}/usr/include/uadk +cp v1/uacce.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 +cp v1/wd.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 +cp v1/wd_cipher.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 +cp v1/wd_comp.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 +cp v1/wd_dh.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 +cp v1/wd_digest.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 +cp v1/wd_rsa.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 +cp v1/wd_bmm.h ${RPM_BUILD_ROOT}/usr/include/uadk/v1 %clean rm -rf ${RPM_BUILD_ROOT} @@ -119,7 +142,6 @@ rm -rf ${RPM_BUILD_ROOT} %exclude /usr/lib64/libhisi_hpre.so.2 %exclude /usr/lib64/libhisi_zip.so.2 - %pre if [ "$1" = "2" ] ; then #2: update rm -rf /usr/lib64/libwd.so > /dev/null 2>&1 || true @@ -174,10 +196,13 @@ fi /sbin/ldconfig %changelog +* Tue Jan 04 2022 Yang Shen 2.3.21-2 +- libwd: backport the patch of uadk from 2.3.21 to 2.3.24 + * Mon Dec 06 2021 linwenkai 2.3.21-1 - libwd: update uadk from 2.3.20 to 2.3.21 -* Mon Nov 24 2021 linwenkai 2.3.20-2 +* Wed Nov 24 2021 linwenkai 2.3.20-2 - libwd: add missing head files and fix install path * Mon Nov 22 2021 Yang Shen 2.3.20-1