From: Hao Fang fanghao11@huawei.com
The devil numbers in function name is hard to read.
Signed-off-by: Hao Fang fanghao11@huawei.com Signed-off-by: Qi Tao taoqi10@huawei.com --- uadk_tool/test/comp_lib.c | 30 +++++++++++++++++++----------- uadk_tool/test/comp_lib.h | 14 ++++++++------ uadk_tool/test/comp_main.c | 28 ++++++++++++++-------------- 3 files changed, 41 insertions(+), 31 deletions(-)
diff --git a/uadk_tool/test/comp_lib.c b/uadk_tool/test/comp_lib.c index f4711ac..9a8a39d 100644 --- a/uadk_tool/test/comp_lib.c +++ b/uadk_tool/test/comp_lib.c @@ -454,7 +454,7 @@ void free_chunk_list(chunk_list_t *list) /* * Deflate a data block with compressed header. */ -static int chunk_deflate2(void *in, size_t in_sz, void *out, size_t *out_sz, +static int chunk_deflate(void *in, size_t in_sz, void *out, size_t *out_sz, struct test_options *opts) { int alg_type = opts->alg_type; @@ -516,7 +516,7 @@ static int chunk_deflate2(void *in, size_t in_sz, void *out, size_t *out_sz, * This function is used in BLOCK mode. Each compressing in BLOCK mode * produces compression header. */ -static int chunk_inflate2(void *in, size_t in_sz, void *out, size_t *out_sz, +static int chunk_inflate(void *in, size_t in_sz, void *out, size_t *out_sz, struct test_options *opts) { z_stream strm; @@ -560,7 +560,7 @@ out: * Compress a list of chunk data and produce a list of chunk data by software. * in_list & out_list should be formated first. */ -int sw_deflate2(chunk_list_t *in_list, +int sw_deflate(chunk_list_t *in_list, chunk_list_t *out_list, struct test_options *opts) { @@ -568,7 +568,7 @@ int sw_deflate2(chunk_list_t *in_list, int ret = -EINVAL;
for (p = in_list, q = out_list; p && q; p = p->next, q = q->next) { - ret = chunk_deflate2(p->addr, p->size, q->addr, &q->size, + ret = chunk_deflate(p->addr, p->size, q->addr, &q->size, opts); if (ret) return ret; @@ -577,17 +577,17 @@ int sw_deflate2(chunk_list_t *in_list, }
/* - * Compress a list of chunk data and produce a list of chunk data by software. + * Deompress a list of chunk data and produce a list of chunk data by software. * in_list & out_list should be formated first. */ -int sw_inflate2(chunk_list_t *in_list, chunk_list_t *out_list, +int sw_inflate(chunk_list_t *in_list, chunk_list_t *out_list, struct test_options *opts) { chunk_list_t *p, *q; int ret = -EINVAL;
for (p = in_list, q = out_list; p && q; p = p->next, q = q->next) { - ret = chunk_inflate2(p->addr, p->size, q->addr, &q->size, + ret = chunk_inflate(p->addr, p->size, q->addr, &q->size, opts); if (ret) return ret; @@ -595,7 +595,11 @@ int sw_inflate2(chunk_list_t *in_list, chunk_list_t *out_list, return ret; }
-int hw_deflate4(handle_t h_dfl, +/* + * Compress a list of chunk data and produce a list of chunk data by hardware. + * in_list & out_list should be formated first. + */ +int hw_deflate(handle_t h_dfl, chunk_list_t *in_list, chunk_list_t *out_list, struct test_options *opts, @@ -649,7 +653,11 @@ out: return ret; }
-int hw_inflate4(handle_t h_ifl, +/* + * Decompress a list of chunk data and produce a list of chunk data by hardware. + * in_list & out_list should be formated first. + */ +int hw_inflate(handle_t h_ifl, chunk_list_t *in_list, chunk_list_t *out_list, struct test_options *opts, @@ -966,7 +974,7 @@ out: * Free source and destination buffer contained in sending threads. * Free sending threads and polling threads. */ -void free2_threads(struct hizip_test_info *info) +void free_threads_tdata(struct hizip_test_info *info) { thread_data_t *tdatas = info->tdatas; int i; @@ -989,7 +997,7 @@ void free2_threads(struct hizip_test_info *info) mmap_free(info->in_buf, info->in_size); }
-int attach2_threads(struct test_options *opts, +int attach_threads(struct test_options *opts, struct hizip_test_info *info, void *(*send_thread_func)(void *arg), void *(*poll_thread_func)(void *arg)) diff --git a/uadk_tool/test/comp_lib.h b/uadk_tool/test/comp_lib.h index 67e9079..cd16b1d 100644 --- a/uadk_tool/test/comp_lib.h +++ b/uadk_tool/test/comp_lib.h @@ -197,26 +197,28 @@ void *poll_thread_func(void *arg); void gen_random_data(void *buf, size_t len); int calculate_md5(comp_md5_t *md5, const void *buf, size_t len); int cmp_md5(comp_md5_t *orig, comp_md5_t *final); + void init_chunk_list(chunk_list_t *list, void *buf, size_t buf_sz, size_t chunk_sz); chunk_list_t *create_chunk_list(void *buf, size_t buf_sz, size_t chunk_sz); void free_chunk_list(chunk_list_t *list); -int sw_deflate2(chunk_list_t *in_list, +int sw_deflate(chunk_list_t *in_list, chunk_list_t *out_list, struct test_options *opts); -int sw_inflate2(chunk_list_t *in_list, +int sw_inflate(chunk_list_t *in_list, chunk_list_t *out_list, struct test_options *opts); -int hw_deflate4(handle_t h_dfl, +int hw_deflate(handle_t h_dfl, chunk_list_t *in_list, chunk_list_t *out_list, struct test_options *opts, sem_t *sem); -int hw_inflate4(handle_t h_ifl, +int hw_inflate(handle_t h_ifl, chunk_list_t *in_list, chunk_list_t *out_list, struct test_options *opts, sem_t *sem); + int hw_deflate5(handle_t h_dfl, chunk_list_t *in_list, chunk_list_t *out_list, @@ -230,8 +232,8 @@ int create_send_tdata(struct test_options *opts, int create_poll_tdata(struct test_options *opts, struct hizip_test_info *info, int poll_num); -void free2_threads(struct hizip_test_info *info); -int attach2_threads(struct test_options *opts, +void free_threads_tdata(struct hizip_test_info *info); +int attach_threads(struct test_options *opts, struct hizip_test_info *info, void *(*send_thread_func)(void *arg), void *(*poll_thread_func)(void *arg)); diff --git a/uadk_tool/test/comp_main.c b/uadk_tool/test/comp_main.c index 02a5d5e..21fb920 100644 --- a/uadk_tool/test/comp_main.c +++ b/uadk_tool/test/comp_main.c @@ -118,7 +118,7 @@ static void *sw_dfl_hw_ifl(void *arg) init_chunk_list(tlist, tbuf, tbuf_sz, tbuf_sz); init_chunk_list(tdata->out_list, tdata->dst, tdata->dst_sz, tdata->dst_sz); - ret = sw_deflate2(tdata->in_list, tlist, opts); + ret = sw_deflate(tdata->in_list, tlist, opts); if (ret) { COMP_TST_PRT("Fail to deflate by zlib: %d\n", ret); goto out_strm; @@ -177,12 +177,12 @@ static void *sw_dfl_hw_ifl(void *arg) info->in_chunk_sz * EXPANSION_RATIO); init_chunk_list(tdata->out_list, tdata->dst, tdata->dst_sz, info->out_chunk_sz); - ret = sw_deflate2(tdata->in_list, tlist, opts); + ret = sw_deflate(tdata->in_list, tlist, opts); if (ret) { COMP_TST_PRT("Fail to deflate by zlib: %d\n", ret); goto out_run; } - ret = hw_inflate4(h_ifl, tlist, tdata->out_list, opts, + ret = hw_inflate(h_ifl, tlist, tdata->out_list, opts, &tdata->sem); if (ret) { COMP_TST_PRT("Fail to inflate by HW: %d\n", ret); @@ -273,7 +273,7 @@ static void *hw_dfl_sw_ifl(void *arg) goto out_strm; } tlist->size = tmp_sz; // write back - ret = sw_inflate2(tlist, tdata->out_list, opts); + ret = sw_inflate(tlist, tdata->out_list, opts); if (ret) { COMP_TST_PRT("Fail to inflate by zlib: %d\n", ret); goto out_strm; @@ -321,13 +321,13 @@ static void *hw_dfl_sw_ifl(void *arg) opts->block_size * EXPANSION_RATIO); init_chunk_list(tdata->out_list, tdata->dst, tdata->dst_sz, info->out_chunk_sz); - ret = hw_deflate4(h_dfl, tdata->in_list, tlist, opts, + ret = hw_deflate(h_dfl, tdata->in_list, tlist, opts, &tdata->sem); if (ret) { COMP_TST_PRT("Fail to deflate by HW: %d\n", ret); goto out_run; } - ret = sw_inflate2(tlist, tdata->out_list, opts); + ret = sw_inflate(tlist, tdata->out_list, opts); if (ret) { COMP_TST_PRT("Fail to inflate by zlib: %d\n", ret); goto out_run; @@ -470,13 +470,13 @@ static void *hw_dfl_hw_ifl(void *arg) init_chunk_list(tdata->out_list, tdata->dst, tdata->dst_sz, info->out_chunk_sz); - ret = hw_deflate4(h_dfl, tdata->in_list, tlist, opts, + ret = hw_deflate(h_dfl, tdata->in_list, tlist, opts, &tdata->sem); if (ret) { COMP_TST_PRT("Fail to deflate by HW: %d\n", ret); goto out_run; } - ret = hw_inflate4(h_ifl, tlist, tdata->out_list, opts, + ret = hw_inflate(h_ifl, tlist, tdata->out_list, opts, &tdata->sem); if (ret) { COMP_TST_PRT("Fail to inflate by HW: %d\n", ret); @@ -560,7 +560,7 @@ static void *hw_dfl_perf(void *arg) init_chunk_list(tdata->out_list, tdata->dst, tdata->dst_sz, info->out_chunk_sz); - ret = hw_deflate4(h_dfl, tdata->in_list, tdata->out_list, opts, + ret = hw_deflate(h_dfl, tdata->in_list, tdata->out_list, opts, &tdata->sem); if (ret) { COMP_TST_PRT("Fail to deflate by HW(blk): %d\n", ret); @@ -619,7 +619,7 @@ static void *hw_ifl_perf(void *arg) init_chunk_list(tdata->out_list, tdata->dst, tdata->dst_sz, info->out_chunk_sz); - ret = hw_inflate4(h_ifl, tdata->in_list, tdata->out_list, opts, + ret = hw_inflate(h_ifl, tdata->in_list, tdata->out_list, opts, &tdata->sem); if (ret) { COMP_TST_PRT("Fail to inflate by HW: %d\n", ret); @@ -996,7 +996,7 @@ int test_hw(struct test_options *opts, char *model) init_chunk_list(tlist, tbuf, tbuf_sz, opts->block_size / EXPANSION_RATIO); gen_random_data(tbuf, tbuf_sz); - ret = sw_deflate2(tlist, tdata[0].in_list, opts); + ret = sw_deflate(tlist, tdata[0].in_list, opts); if (ret) { free_chunk_list(tlist); mmap_free(tbuf, tbuf_sz); @@ -1026,7 +1026,7 @@ int test_hw(struct test_options *opts, char *model) COMP_TST_PRT( "NOTE: test might trash the TLB\n"); } stat_start(&info); - ret = attach2_threads(opts, &info, func, poll_thread_func); + ret = attach_threads(opts, &info, func, poll_thread_func); if (ret) goto out_buf; stat_end(&info); @@ -1059,7 +1059,7 @@ int test_hw(struct test_options *opts, char *model) COMP_TST_PRT("%s in %f usec (BLK:%d, Bnum:%d).\n", zbuf, usec, opts->block_size, opts->batch_num); } - free2_threads(&info); + free_threads_tdata(&info); if (opts->use_env) wd_comp_env_uninit(); else @@ -1068,7 +1068,7 @@ int test_hw(struct test_options *opts, char *model) return 0; out_buf: out_poll: - free2_threads(&info); + free_threads_tdata(&info); if (opts->use_env) wd_comp_env_uninit(); else