592 lines
19 KiB
Diff
592 lines
19 KiB
Diff
From a5e9a9cfaadfe594358efde05e14f8c8d095bf16 Mon Sep 17 00:00:00 2001
|
|
From: Yang Shen <shenyang39@huawei.com>
|
|
Date: Fri, 10 Nov 2023 11:52:28 +0800
|
|
Subject: [PATCH 59/85] uadk/tools - misc fixes for uadk compress performance
|
|
|
|
1.The decompression performance is depends on the compression ratio,
|
|
usually based on 50%. So adjust the compression source data to make
|
|
the compression ratio near 50%.
|
|
2.The per-thread data pool depth determines the size of memory. 4096
|
|
is too big for EVB environment. So limit to 512 for compression.
|
|
3.The req.src_len will be override after do compression. So need to
|
|
use 'g_pktlen' to calculate length.
|
|
|
|
Signed-off-by: Yang Shen <shenyang39@huawei.com>
|
|
---
|
|
uadk_tool/benchmark/uadk_benchmark.c | 2 +-
|
|
uadk_tool/benchmark/zip_uadk_benchmark.c | 75 +++++++++++------------
|
|
uadk_tool/benchmark/zip_wd_benchmark.c | 76 +++++++++++-------------
|
|
3 files changed, 71 insertions(+), 82 deletions(-)
|
|
|
|
diff --git a/uadk_tool/benchmark/uadk_benchmark.c b/uadk_tool/benchmark/uadk_benchmark.c
|
|
index d869688..aa884bc 100644
|
|
--- a/uadk_tool/benchmark/uadk_benchmark.c
|
|
+++ b/uadk_tool/benchmark/uadk_benchmark.c
|
|
@@ -429,7 +429,7 @@ void cal_perfermance_data(struct acc_option *option, u32 sttime)
|
|
ops = perfops / option->times;
|
|
cpu_rate = (double)ptime / option->times;
|
|
ACC_TST_PRT("algname: length: perf: iops: CPU_rate:\n"
|
|
- "%s %-2uBytes %.1fKB/s %.1fKops %.2f%%\n",
|
|
+ "%s %-2uBytes %.1fKB/s %.1fKops %.2f%%\n",
|
|
palgname, option->pktlen, perfermance, ops, cpu_rate);
|
|
}
|
|
|
|
diff --git a/uadk_tool/benchmark/zip_uadk_benchmark.c b/uadk_tool/benchmark/zip_uadk_benchmark.c
|
|
index 747172a..44746f6 100644
|
|
--- a/uadk_tool/benchmark/zip_uadk_benchmark.c
|
|
+++ b/uadk_tool/benchmark/zip_uadk_benchmark.c
|
|
@@ -13,6 +13,8 @@
|
|
#define ZIP_FILE "./zip"
|
|
#define COMP_LEN_RATE 2
|
|
#define DECOMP_LEN_RATE 2
|
|
+#define MAX_POOL_LENTH_COMP 512
|
|
+#define COMPRESSION_RATIO_FACTOR 0.7
|
|
|
|
struct uadk_bd {
|
|
u8 *src;
|
|
@@ -54,7 +56,7 @@ typedef struct uadk_thread_res {
|
|
struct zip_file_head {
|
|
u32 file_size;
|
|
u32 block_num;
|
|
- u32 blk_sz[MAX_POOL_LENTH];
|
|
+ u32 blk_sz[MAX_POOL_LENTH_COMP];
|
|
};
|
|
|
|
static struct wd_ctx_config g_ctx_cfg;
|
|
@@ -115,11 +117,11 @@ static int save_file_data(const char *alg, u32 pkg_len, u32 optype)
|
|
}
|
|
|
|
// init file head informations
|
|
- for (j = 0; j < MAX_POOL_LENTH; j++) {
|
|
+ for (j = 0; j < MAX_POOL_LENTH_COMP; j++) {
|
|
fhead->blk_sz[j] = g_zip_pool.pool[0].bds[j].dst_len;
|
|
total_file_size += fhead->blk_sz[j];
|
|
}
|
|
- fhead->block_num = MAX_POOL_LENTH;
|
|
+ fhead->block_num = MAX_POOL_LENTH_COMP;
|
|
fhead->file_size = total_file_size;
|
|
size = write(fd, fhead, sizeof(*fhead));
|
|
if (size < 0) {
|
|
@@ -129,7 +131,7 @@ static int save_file_data(const char *alg, u32 pkg_len, u32 optype)
|
|
}
|
|
|
|
// write data for one buffer one buffer to file line.
|
|
- for (j = 0; j < MAX_POOL_LENTH; j++) {
|
|
+ for (j = 0; j < MAX_POOL_LENTH_COMP; j++) {
|
|
size = write(fd, g_zip_pool.pool[0].bds[j].dst,
|
|
fhead->blk_sz[j]);
|
|
if (size < 0) {
|
|
@@ -144,7 +146,7 @@ write_error:
|
|
fd_error:
|
|
close(fd);
|
|
|
|
- full_size = g_pktlen * MAX_POOL_LENTH;
|
|
+ full_size = g_pktlen * MAX_POOL_LENTH_COMP;
|
|
comp_rate = (double) total_file_size / full_size;
|
|
ZIP_TST_PRT("compress data rate: %.1f%%!\n", comp_rate * 100);
|
|
|
|
@@ -187,14 +189,14 @@ static int load_file_data(const char *alg, u32 pkg_len, u32 optype)
|
|
goto fd_err;
|
|
}
|
|
size = read(fd, fhead, sizeof(*fhead));
|
|
- if (size < 0 || fhead->block_num != MAX_POOL_LENTH) {
|
|
+ if (size < 0 || fhead->block_num != MAX_POOL_LENTH_COMP) {
|
|
ZIP_TST_PRT("failed to read file head\n");
|
|
ret = -EINVAL;
|
|
goto read_err;
|
|
}
|
|
|
|
// read data for one buffer one buffer from file line
|
|
- for (j = 0; j < MAX_POOL_LENTH; j++) {
|
|
+ for (j = 0; j < MAX_POOL_LENTH_COMP; j++) {
|
|
memset(g_zip_pool.pool[0].bds[j].src, 0x0,
|
|
g_zip_pool.pool[0].bds[j].src_len);
|
|
if (size != 0) { // zero size buffer no need to read;
|
|
@@ -212,7 +214,7 @@ static int load_file_data(const char *alg, u32 pkg_len, u32 optype)
|
|
}
|
|
|
|
for (i = 1; i < g_thread_num; i++) {
|
|
- for (j = 0; j < MAX_POOL_LENTH; j++) {
|
|
+ for (j = 0; j < MAX_POOL_LENTH_COMP; j++) {
|
|
if (g_zip_pool.pool[0].bds[j].src_len)
|
|
memcpy(g_zip_pool.pool[i].bds[j].src,
|
|
g_zip_pool.pool[0].bds[j].src,
|
|
@@ -383,14 +385,14 @@ static int init_uadk_bd_pool(u32 optype)
|
|
return -ENOMEM;
|
|
} else {
|
|
for (i = 0; i < g_thread_num; i++) {
|
|
- g_zip_pool.pool[i].bds = malloc(MAX_POOL_LENTH *
|
|
+ g_zip_pool.pool[i].bds = malloc(MAX_POOL_LENTH_COMP *
|
|
sizeof(struct uadk_bd));
|
|
if (!g_zip_pool.pool[i].bds) {
|
|
ZIP_TST_PRT("init uadk bds alloc failed!\n");
|
|
goto malloc_error1;
|
|
}
|
|
- for (j = 0; j < MAX_POOL_LENTH; j++) {
|
|
- g_zip_pool.pool[i].bds[j].src = malloc(insize);
|
|
+ for (j = 0; j < MAX_POOL_LENTH_COMP; j++) {
|
|
+ g_zip_pool.pool[i].bds[j].src = calloc(1, insize);
|
|
if (!g_zip_pool.pool[i].bds[j].src)
|
|
goto malloc_error2;
|
|
g_zip_pool.pool[i].bds[j].src_len = insize;
|
|
@@ -400,7 +402,7 @@ static int init_uadk_bd_pool(u32 optype)
|
|
goto malloc_error3;
|
|
g_zip_pool.pool[i].bds[j].dst_len = outsize;
|
|
|
|
- get_rand_data(g_zip_pool.pool[i].bds[j].src, insize);
|
|
+ get_rand_data(g_zip_pool.pool[i].bds[j].src, insize * COMPRESSION_RATIO_FACTOR);
|
|
if (g_prefetch)
|
|
get_rand_data(g_zip_pool.pool[i].bds[j].dst, outsize);
|
|
}
|
|
@@ -418,7 +420,7 @@ malloc_error2:
|
|
}
|
|
malloc_error1:
|
|
for (i--; i >= 0; i--) {
|
|
- for (j = 0; j < MAX_POOL_LENTH; j++) {
|
|
+ for (j = 0; j < MAX_POOL_LENTH_COMP; j++) {
|
|
free(g_zip_pool.pool[i].bds[j].src);
|
|
free(g_zip_pool.pool[i].bds[j].dst);
|
|
}
|
|
@@ -438,7 +440,7 @@ static void free_uadk_bd_pool(void)
|
|
|
|
for (i = 0; i < g_thread_num; i++) {
|
|
if (g_zip_pool.pool[i].bds) {
|
|
- for (j = 0; j < MAX_POOL_LENTH; j++) {
|
|
+ for (j = 0; j < MAX_POOL_LENTH_COMP; j++) {
|
|
free(g_zip_pool.pool[i].bds[j].src);
|
|
free(g_zip_pool.pool[i].bds[j].dst);
|
|
}
|
|
@@ -565,17 +567,17 @@ static void *zip_uadk_blk_lz77_sync_run(void *arg)
|
|
creq.data_fmt = 0;
|
|
creq.status = 0;
|
|
|
|
- ftuple = malloc(sizeof(COMP_TUPLE_TAG) * MAX_POOL_LENTH);
|
|
+ ftuple = malloc(sizeof(COMP_TUPLE_TAG) * MAX_POOL_LENTH_COMP);
|
|
if (!ftuple)
|
|
goto fse_err;
|
|
|
|
- hw_buff_out = malloc(out_len * MAX_POOL_LENTH);
|
|
+ hw_buff_out = malloc(out_len * MAX_POOL_LENTH_COMP);
|
|
if (!hw_buff_out)
|
|
goto hw_buff_err;
|
|
- memset(hw_buff_out, 0x0, out_len * MAX_POOL_LENTH);
|
|
+ memset(hw_buff_out, 0x0, out_len * MAX_POOL_LENTH_COMP);
|
|
|
|
while(1) {
|
|
- i = count % MAX_POOL_LENTH;
|
|
+ i = count % MAX_POOL_LENTH_COMP;
|
|
creq.src = uadk_pool->bds[i].src;
|
|
creq.dst = &hw_buff_out[i]; //temp out
|
|
creq.src_len = uadk_pool->bds[i].src_len;
|
|
@@ -610,7 +612,7 @@ fse_err:
|
|
|
|
cal_avg_latency(count);
|
|
if (pdata->optype == WD_DIR_COMPRESS)
|
|
- add_recv_data(count, creq.src_len);
|
|
+ add_recv_data(count, g_pktlen);
|
|
else
|
|
add_recv_data(count, first_len);
|
|
|
|
@@ -659,17 +661,17 @@ static void *zip_uadk_stm_lz77_sync_run(void *arg)
|
|
creq.data_fmt = 0;
|
|
creq.status = 0;
|
|
|
|
- ftuple = malloc(sizeof(COMP_TUPLE_TAG) * MAX_POOL_LENTH);
|
|
+ ftuple = malloc(sizeof(COMP_TUPLE_TAG) * MAX_POOL_LENTH_COMP);
|
|
if (!ftuple)
|
|
goto fse_err;
|
|
|
|
- hw_buff_out = malloc(out_len * MAX_POOL_LENTH);
|
|
+ hw_buff_out = malloc(out_len * MAX_POOL_LENTH_COMP);
|
|
if (!hw_buff_out)
|
|
goto hw_buff_err;
|
|
- memset(hw_buff_out, 0x0, out_len * MAX_POOL_LENTH);
|
|
+ memset(hw_buff_out, 0x0, out_len * MAX_POOL_LENTH_COMP);
|
|
|
|
while(1) {
|
|
- i = count % MAX_POOL_LENTH;
|
|
+ i = count % MAX_POOL_LENTH_COMP;
|
|
creq.src = uadk_pool->bds[i].src;
|
|
creq.dst = &hw_buff_out[i]; //temp out
|
|
creq.src_len = uadk_pool->bds[i].src_len;
|
|
@@ -707,7 +709,7 @@ fse_err:
|
|
|
|
cal_avg_latency(count);
|
|
if (pdata->optype == WD_DIR_COMPRESS)
|
|
- add_recv_data(count, creq.src_len);
|
|
+ add_recv_data(count, g_pktlen);
|
|
else
|
|
add_recv_data(count, first_len);
|
|
|
|
@@ -754,16 +756,16 @@ static void *zip_uadk_blk_lz77_async_run(void *arg)
|
|
creq.data_fmt = 0;
|
|
creq.status = 0;
|
|
|
|
- ftuple = malloc(sizeof(COMP_TUPLE_TAG) * MAX_POOL_LENTH);
|
|
+ ftuple = malloc(sizeof(COMP_TUPLE_TAG) * MAX_POOL_LENTH_COMP);
|
|
if (!ftuple)
|
|
goto fse_err;
|
|
|
|
- hw_buff_out = malloc(out_len * MAX_POOL_LENTH);
|
|
+ hw_buff_out = malloc(out_len * MAX_POOL_LENTH_COMP);
|
|
if (!hw_buff_out)
|
|
goto hw_buff_err;
|
|
- memset(hw_buff_out, 0x0, out_len * MAX_POOL_LENTH);
|
|
+ memset(hw_buff_out, 0x0, out_len * MAX_POOL_LENTH_COMP);
|
|
|
|
- tag = malloc(sizeof(*tag) * MAX_POOL_LENTH);
|
|
+ tag = malloc(sizeof(*tag) * MAX_POOL_LENTH_COMP);
|
|
if (!tag) {
|
|
ZIP_TST_PRT("failed to malloc zip tag!\n");
|
|
goto tag_err;
|
|
@@ -774,7 +776,7 @@ static void *zip_uadk_blk_lz77_async_run(void *arg)
|
|
break;
|
|
|
|
try_cnt = 0;
|
|
- i = count % MAX_POOL_LENTH;
|
|
+ i = count % MAX_POOL_LENTH_COMP;
|
|
creq.src = uadk_pool->bds[i].src;
|
|
creq.dst = &hw_buff_out[i]; //temp out
|
|
creq.src_len = uadk_pool->bds[i].src_len;
|
|
@@ -815,10 +817,6 @@ hw_buff_err:
|
|
fse_err:
|
|
free(ftuple);
|
|
wd_comp_free_sess(h_sess);
|
|
-
|
|
- // ZIP_TST_PRT("LZ77 valid pool len: %u, send count BD: %u, output len: %u!\n",
|
|
- // MAX_POOL_LENTH, count, creq.dst_len);
|
|
-
|
|
add_send_complete();
|
|
|
|
return NULL;
|
|
@@ -861,7 +859,7 @@ static void *zip_uadk_blk_sync_run(void *arg)
|
|
creq.status = 0;
|
|
|
|
while(1) {
|
|
- i = count % MAX_POOL_LENTH;
|
|
+ i = count % MAX_POOL_LENTH_COMP;
|
|
creq.src = uadk_pool->bds[i].src;
|
|
creq.dst = uadk_pool->bds[i].dst;
|
|
creq.src_len = uadk_pool->bds[i].src_len;
|
|
@@ -921,7 +919,7 @@ static void *zip_uadk_stm_sync_run(void *arg)
|
|
creq.status = 0;
|
|
|
|
while(1) {
|
|
- i = count % MAX_POOL_LENTH;
|
|
+ i = count % MAX_POOL_LENTH_COMP;
|
|
creq.src = uadk_pool->bds[i].src;
|
|
creq.dst = uadk_pool->bds[i].dst;
|
|
creq.src_len = uadk_pool->bds[i].src_len;
|
|
@@ -986,7 +984,7 @@ static void *zip_uadk_blk_async_run(void *arg)
|
|
creq.priv = 0;
|
|
creq.status = 0;
|
|
|
|
- tag = malloc(sizeof(*tag) * MAX_POOL_LENTH);
|
|
+ tag = malloc(sizeof(*tag) * MAX_POOL_LENTH_COMP);
|
|
if (!tag) {
|
|
ZIP_TST_PRT("failed to malloc zip tag!\n");
|
|
wd_comp_free_sess(h_sess);
|
|
@@ -998,7 +996,7 @@ static void *zip_uadk_blk_async_run(void *arg)
|
|
break;
|
|
|
|
try_cnt = 0;
|
|
- i = count % MAX_POOL_LENTH;
|
|
+ i = count % MAX_POOL_LENTH_COMP;
|
|
creq.src = uadk_pool->bds[i].src;
|
|
creq.dst = uadk_pool->bds[i].dst;
|
|
creq.src_len = uadk_pool->bds[i].src_len;
|
|
@@ -1032,9 +1030,6 @@ static void *zip_uadk_blk_async_run(void *arg)
|
|
free(tag);
|
|
wd_comp_free_sess(h_sess);
|
|
|
|
- // ZIP_TST_PRT("valid pool len: %u, send count BD: %u, output len: %u!\n",
|
|
- // MAX_POOL_LENTH, count, creq.dst_len);
|
|
-
|
|
add_send_complete();
|
|
|
|
return NULL;
|
|
diff --git a/uadk_tool/benchmark/zip_wd_benchmark.c b/uadk_tool/benchmark/zip_wd_benchmark.c
|
|
index dc00631..61f6c69 100644
|
|
--- a/uadk_tool/benchmark/zip_wd_benchmark.c
|
|
+++ b/uadk_tool/benchmark/zip_wd_benchmark.c
|
|
@@ -18,6 +18,8 @@
|
|
|
|
#define COMP_LEN_RATE 2
|
|
#define DECOMP_LEN_RATE 2
|
|
+#define COMPRESSION_RATIO_FACTOR 0.7
|
|
+#define MAX_POOL_LENTH_COMP 512
|
|
|
|
#define __ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))
|
|
#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1)
|
|
@@ -67,7 +69,7 @@ typedef struct uadk_thread_res {
|
|
struct zip_file_head {
|
|
u32 file_size;
|
|
u32 block_num;
|
|
- u32 blk_sz[MAX_POOL_LENTH];
|
|
+ u32 blk_sz[MAX_POOL_LENTH_COMP];
|
|
};
|
|
|
|
static unsigned int g_thread_num;
|
|
@@ -124,11 +126,11 @@ static int save_file_data(const char *alg, u32 pkg_len, u32 optype)
|
|
}
|
|
|
|
// init file head informations
|
|
- for (j = 0; j < MAX_POOL_LENTH; j++) {
|
|
+ for (j = 0; j < MAX_POOL_LENTH_COMP; j++) {
|
|
fhead->blk_sz[j] = g_thread_queue.bd_res[0].bds[j].dst_len;
|
|
total_file_size += fhead->blk_sz[j];
|
|
}
|
|
- fhead->block_num = MAX_POOL_LENTH;
|
|
+ fhead->block_num = MAX_POOL_LENTH_COMP;
|
|
fhead->file_size = total_file_size;
|
|
size = write(fd, fhead, sizeof(*fhead));
|
|
if (size < 0) {
|
|
@@ -138,7 +140,7 @@ static int save_file_data(const char *alg, u32 pkg_len, u32 optype)
|
|
}
|
|
|
|
// write data for one buffer one buffer to file line.
|
|
- for (j = 0; j < MAX_POOL_LENTH; j++) {
|
|
+ for (j = 0; j < MAX_POOL_LENTH_COMP; j++) {
|
|
size = write(fd, g_thread_queue.bd_res[0].bds[j].dst,
|
|
fhead->blk_sz[j]);
|
|
if (size < 0) {
|
|
@@ -153,7 +155,7 @@ write_error:
|
|
fd_error:
|
|
close(fd);
|
|
|
|
- full_size = g_pktlen * MAX_POOL_LENTH;
|
|
+ full_size = g_pktlen * MAX_POOL_LENTH_COMP;
|
|
comp_rate = (double) total_file_size / full_size;
|
|
ZIP_TST_PRT("compress data rate: %.1f%%!\n", comp_rate * 100);
|
|
|
|
@@ -196,14 +198,14 @@ static int load_file_data(const char *alg, u32 pkg_len, u32 optype)
|
|
goto fd_err;
|
|
}
|
|
size = read(fd, fhead, sizeof(*fhead));
|
|
- if (size < 0 || fhead->block_num != MAX_POOL_LENTH) {
|
|
+ if (size < 0 || fhead->block_num != MAX_POOL_LENTH_COMP) {
|
|
ZIP_TST_PRT("failed to read file head\n");
|
|
ret = -EINVAL;
|
|
goto read_err;
|
|
}
|
|
|
|
// read data for one buffer one buffer from file line
|
|
- for (j = 0; j < MAX_POOL_LENTH; j++) {
|
|
+ for (j = 0; j < MAX_POOL_LENTH_COMP; j++) {
|
|
memset(g_thread_queue.bd_res[0].bds[j].src, 0x0,
|
|
g_thread_queue.bd_res[0].bds[j].src_len);
|
|
if (size != 0) { // zero size buffer no need to read;
|
|
@@ -221,7 +223,7 @@ static int load_file_data(const char *alg, u32 pkg_len, u32 optype)
|
|
}
|
|
|
|
for (i = 1; i < g_thread_num; i++) {
|
|
- for (j = 0; j < MAX_POOL_LENTH; j++) {
|
|
+ for (j = 0; j < MAX_POOL_LENTH_COMP; j++) {
|
|
if (g_thread_queue.bd_res[0].bds[j].src_len)
|
|
memcpy(g_thread_queue.bd_res[i].bds[j].src,
|
|
g_thread_queue.bd_res[0].bds[j].src,
|
|
@@ -328,7 +330,7 @@ static int init_zip_wd_queue(struct acc_option *options)
|
|
}
|
|
}
|
|
|
|
- // use no-sva pbuffer, MAX_BLOCK_NM at least 4 times of MAX_POOL_LENTH
|
|
+ // use no-sva pbuffer, MAX_BLOCK_NM at least 4 times of MAX_POOL_LENTH_COMP
|
|
memset(&blksetup, 0, sizeof(blksetup));
|
|
outsize = ALIGN(outsize, ALIGN_SIZE);
|
|
blksetup.block_size = outsize;
|
|
@@ -345,12 +347,12 @@ static int init_zip_wd_queue(struct acc_option *options)
|
|
}
|
|
pool = g_thread_queue.bd_res[j].pool;
|
|
|
|
- g_thread_queue.bd_res[j].bds = malloc(sizeof(struct wd_bd) * MAX_POOL_LENTH);
|
|
+ g_thread_queue.bd_res[j].bds = malloc(sizeof(struct wd_bd) * MAX_POOL_LENTH_COMP);
|
|
if (!g_thread_queue.bd_res[j].bds)
|
|
goto bds_error;
|
|
bds = g_thread_queue.bd_res[j].bds;
|
|
|
|
- for (i = 0; i < MAX_POOL_LENTH; i++) {
|
|
+ for (i = 0; i < MAX_POOL_LENTH_COMP; i++) {
|
|
bds[i].src = wd_alloc_blk(pool);
|
|
if (!bds[i].src) {
|
|
ret = -ENOMEM;
|
|
@@ -365,7 +367,7 @@ static int init_zip_wd_queue(struct acc_option *options)
|
|
}
|
|
bds[i].dst_len = outsize;
|
|
|
|
- get_rand_data(bds[i].src, insize);
|
|
+ get_rand_data(bds[i].src, insize * COMPRESSION_RATIO_FACTOR);
|
|
}
|
|
|
|
}
|
|
@@ -385,7 +387,7 @@ pool_err:
|
|
for (j--; j >= 0; j--) {
|
|
pool = g_thread_queue.bd_res[j].pool;
|
|
bds = g_thread_queue.bd_res[j].bds;
|
|
- for (i = 0; i < MAX_POOL_LENTH; i++) {
|
|
+ for (i = 0; i < MAX_POOL_LENTH_COMP; i++) {
|
|
wd_free_blk(pool, bds[i].src);
|
|
wd_free_blk(pool, bds[i].dst);
|
|
}
|
|
@@ -410,7 +412,7 @@ static void uninit_zip_wd_queue(void)
|
|
for (j = 0; j < g_thread_num; j++) {
|
|
pool = g_thread_queue.bd_res[j].pool;
|
|
bds = g_thread_queue.bd_res[j].bds;
|
|
- for (i = 0; i < MAX_POOL_LENTH; i++) {
|
|
+ for (i = 0; i < MAX_POOL_LENTH_COMP; i++) {
|
|
wd_free_blk(pool, bds[i].src);
|
|
wd_free_blk(pool, bds[i].dst);
|
|
}
|
|
@@ -551,17 +553,17 @@ static void *zip_wd_blk_lz77_sync_run(void *arg)
|
|
|
|
out_len = bd_pool[0].dst_len;
|
|
|
|
- ftuple = malloc(sizeof(COMP_TUPLE_TAG) * MAX_POOL_LENTH);
|
|
+ ftuple = malloc(sizeof(COMP_TUPLE_TAG) * MAX_POOL_LENTH_COMP);
|
|
if (!ftuple)
|
|
goto fse_err;
|
|
|
|
- hw_buff_out = malloc(out_len * MAX_POOL_LENTH);
|
|
+ hw_buff_out = malloc(out_len * MAX_POOL_LENTH_COMP);
|
|
if (!hw_buff_out)
|
|
goto hw_buff_err;
|
|
- memset(hw_buff_out, 0x0, out_len * MAX_POOL_LENTH);
|
|
+ memset(hw_buff_out, 0x0, out_len * MAX_POOL_LENTH_COMP);
|
|
|
|
while(1) {
|
|
- i = count % MAX_POOL_LENTH;
|
|
+ i = count % MAX_POOL_LENTH_COMP;
|
|
opdata.in = bd_pool[i].src;
|
|
opdata.out = &hw_buff_out[i]; //temp out
|
|
opdata.in_len = bd_pool[i].src_len;
|
|
@@ -597,7 +599,7 @@ fse_err:
|
|
|
|
cal_avg_latency(count);
|
|
if (pdata->optype == WCRYPTO_DEFLATE)
|
|
- add_recv_data(count, opdata.in_len);
|
|
+ add_recv_data(count, g_pktlen);
|
|
else
|
|
add_recv_data(count, first_len);
|
|
|
|
@@ -659,17 +661,17 @@ static void *zip_wd_stm_lz77_sync_run(void *arg)
|
|
|
|
out_len = bd_pool[0].dst_len;
|
|
|
|
- ftuple = malloc(sizeof(COMP_TUPLE_TAG) * MAX_POOL_LENTH);
|
|
+ ftuple = malloc(sizeof(COMP_TUPLE_TAG) * MAX_POOL_LENTH_COMP);
|
|
if (!ftuple)
|
|
goto fse_err;
|
|
|
|
- hw_buff_out = malloc(out_len * MAX_POOL_LENTH);
|
|
+ hw_buff_out = malloc(out_len * MAX_POOL_LENTH_COMP);
|
|
if (!hw_buff_out)
|
|
goto hw_buff_err;
|
|
- memset(hw_buff_out, 0x0, out_len * MAX_POOL_LENTH);
|
|
+ memset(hw_buff_out, 0x0, out_len * MAX_POOL_LENTH_COMP);
|
|
|
|
while(1) {
|
|
- i = count % MAX_POOL_LENTH;
|
|
+ i = count % MAX_POOL_LENTH_COMP;
|
|
opdata.in = bd_pool[i].src;
|
|
opdata.out = &hw_buff_out[i]; //temp out
|
|
opdata.in_len = bd_pool[i].src_len;
|
|
@@ -708,7 +710,7 @@ fse_err:
|
|
|
|
cal_avg_latency(count);
|
|
if (pdata->optype == WCRYPTO_DEFLATE)
|
|
- add_recv_data(count, opdata.in_len);
|
|
+ add_recv_data(count, g_pktlen);
|
|
else
|
|
add_recv_data(count, first_len);
|
|
|
|
@@ -769,16 +771,16 @@ static void *zip_wd_blk_lz77_async_run(void *arg)
|
|
|
|
out_len = bd_pool[0].dst_len;
|
|
|
|
- ftuple = malloc(sizeof(COMP_TUPLE_TAG) * MAX_POOL_LENTH);
|
|
+ ftuple = malloc(sizeof(COMP_TUPLE_TAG) * MAX_POOL_LENTH_COMP);
|
|
if (!ftuple)
|
|
goto fse_err;
|
|
|
|
- hw_buff_out = malloc(out_len * MAX_POOL_LENTH);
|
|
+ hw_buff_out = malloc(out_len * MAX_POOL_LENTH_COMP);
|
|
if (!hw_buff_out)
|
|
goto hw_buff_err;
|
|
- memset(hw_buff_out, 0x0, out_len * MAX_POOL_LENTH);
|
|
+ memset(hw_buff_out, 0x0, out_len * MAX_POOL_LENTH_COMP);
|
|
|
|
- tag = malloc(sizeof(*tag) * MAX_POOL_LENTH);
|
|
+ tag = malloc(sizeof(*tag) * MAX_POOL_LENTH_COMP);
|
|
if (!tag) {
|
|
ZIP_TST_PRT("failed to malloc zip tag!\n");
|
|
goto tag_err;
|
|
@@ -789,7 +791,7 @@ static void *zip_wd_blk_lz77_async_run(void *arg)
|
|
break;
|
|
|
|
try_cnt = 0;
|
|
- i = count % MAX_POOL_LENTH;
|
|
+ i = count % MAX_POOL_LENTH_COMP;
|
|
opdata.in = bd_pool[i].src;
|
|
opdata.out = &hw_buff_out[i]; //temp out
|
|
opdata.in_len = bd_pool[i].src_len;
|
|
@@ -832,10 +834,6 @@ hw_buff_err:
|
|
fse_err:
|
|
free(ftuple);
|
|
wcrypto_del_comp_ctx(ctx);
|
|
-
|
|
- // ZIP_TST_PRT("LZ77 valid pool len: %u, send count BD: %u, output len: %u!\n",
|
|
- // MAX_POOL_LENTH, count, opdata.produced);
|
|
-
|
|
add_send_complete();
|
|
|
|
return NULL;
|
|
@@ -890,7 +888,7 @@ static void *zip_wd_blk_sync_run(void *arg)
|
|
out_len = bd_pool[0].dst_len;
|
|
|
|
while(1) {
|
|
- i = count % MAX_POOL_LENTH;
|
|
+ i = count % MAX_POOL_LENTH_COMP;
|
|
opdata.in = bd_pool[i].src;
|
|
opdata.out = bd_pool[i].dst;
|
|
opdata.in_len = bd_pool[i].src_len;
|
|
@@ -963,7 +961,7 @@ static void *zip_wd_stm_sync_run(void *arg)
|
|
out_len = bd_pool[0].dst_len;
|
|
|
|
while(1) {
|
|
- i = count % MAX_POOL_LENTH;
|
|
+ i = count % MAX_POOL_LENTH_COMP;
|
|
opdata.in = bd_pool[i].src;
|
|
opdata.out = bd_pool[i].dst;
|
|
opdata.in_len = bd_pool[i].src_len;
|
|
@@ -1041,7 +1039,7 @@ static void *zip_wd_blk_async_run(void *arg)
|
|
opdata.flush = WCRYPTO_FINISH;
|
|
|
|
out_len = bd_pool[0].dst_len;
|
|
- tag = malloc(sizeof(*tag) * MAX_POOL_LENTH);
|
|
+ tag = malloc(sizeof(*tag) * MAX_POOL_LENTH_COMP);
|
|
if (!tag) {
|
|
ZIP_TST_PRT("failed to malloc zip tag!\n");
|
|
goto tag_release;
|
|
@@ -1051,7 +1049,7 @@ static void *zip_wd_blk_async_run(void *arg)
|
|
if (get_run_state() == 0)
|
|
break;
|
|
|
|
- i = count % MAX_POOL_LENTH;
|
|
+ i = count % MAX_POOL_LENTH_COMP;
|
|
opdata.in = bd_pool[i].src;
|
|
opdata.out = bd_pool[i].dst;
|
|
opdata.in_len = bd_pool[i].src_len;
|
|
@@ -1088,10 +1086,6 @@ static void *zip_wd_blk_async_run(void *arg)
|
|
tag_release:
|
|
free(tag);
|
|
wcrypto_del_comp_ctx(ctx);
|
|
-
|
|
- // ZIP_TST_PRT("valid pool len: %u, send count BD: %u, output len: %u!\n",
|
|
- // MAX_POOL_LENTH, count, opdata.produced);
|
|
-
|
|
add_send_complete();
|
|
|
|
return NULL;
|
|
--
|
|
2.25.1
|
|
|