From: Junchong Pan <panjunchong@h-partners.com> Add --sgl operations for sec and zip. Signed-off-by: Junchong Pan <panjunchong@h-partners.com> Signed-off-by: Zongyu Wu <wuzongyu1@huawei.com> --- uadk_tool/benchmark/sec_uadk_benchmark.c | 205 +++++++++++++++++++---- uadk_tool/benchmark/uadk_benchmark.c | 13 ++ uadk_tool/benchmark/uadk_benchmark.h | 3 + uadk_tool/benchmark/zip_uadk_benchmark.c | 204 ++++++++++++++++++---- 4 files changed, 359 insertions(+), 66 deletions(-) diff --git a/uadk_tool/benchmark/sec_uadk_benchmark.c b/uadk_tool/benchmark/sec_uadk_benchmark.c index 141b161..4a64c94 100644 --- a/uadk_tool/benchmark/sec_uadk_benchmark.c +++ b/uadk_tool/benchmark/sec_uadk_benchmark.c @@ -72,6 +72,7 @@ static unsigned int g_algtype; static unsigned int g_optype; static unsigned int g_maclen; static unsigned int g_dev_id; +static unsigned int g_data_fmt; struct aead_alg_info { int index; @@ -970,6 +971,9 @@ static void save_aead_dst_data(u8 *addr, u32 size) static void read_aead_dst_data(u8 *addr, u32 len) { char file_name[SEC_SAVE_FILE_LEN] = {0}; + struct wd_datalist *current; + size_t bytes_to_read = 0; + size_t bytes_read = 0; char *alg_name; FILE *fp; int size; @@ -992,10 +996,29 @@ static void read_aead_dst_data(u8 *addr, u32 len) size = ftell(fp); rewind(fp); - size = fread(addr, 1, size, fp); - addr[size] = '\0'; - memcpy(g_save_mac, (char *)addr + len, SEC_MAX_MAC_LEN); + if (!g_data_fmt) { + size = fread(addr, 1, size, fp); + addr[size] = '\0'; + + memcpy(g_save_mac, (char *)addr + len, SEC_MAX_MAC_LEN); + } else { + current = (struct wd_datalist *)addr; + while (current && size > 0) { + bytes_to_read = current->len; + if (bytes_to_read > size) + bytes_to_read = size; + bytes_read = fread(current->data, 1, bytes_to_read, fp); + + if (bytes_read != bytes_to_read) { + SEC_TST_PRT("partial read: expected %zu, got %zu\n", bytes_to_read, bytes_read); + fclose(fp); + return; + } + size -= bytes_read; + current = current->next; + } + } fclose(fp); } @@ -1068,14 +1091,114 @@ static void free_ivkey_source(void) free(g_uadk_pool.iv); } +/* + * Calculate SGL unit size. + */ +static inline size_t cal_unit_sz(size_t sz) +{ + return (sz + SGL_ALIGNED_BYTES - 1) & ~(SGL_ALIGNED_BYTES - 1); +} + +/* + * Create SGL or common memory buffer. + */ +static void *create_buf(int sgl, size_t sz, size_t unit_sz) +{ + struct wd_datalist *head, *p, *q; + int i, tail_sz, sgl_num; + void *buf; + + buf = malloc(sz); + if (!buf) { + SEC_TST_PRT("Fail to allocate buffer %ld size!\n", sz); + return NULL; + } + + memset_buf(buf, sz); + + if (sgl == WD_FLAT_BUF) + return buf; + + if (g_alg != AEAD_TYPE) { + get_rand_data(buf, g_pktlen); + } else { + if (!g_optype) + get_aead_data(buf, g_pktlen + SEC_AEAD_LEN); + } + + tail_sz = sz % unit_sz; + sgl_num = sz / unit_sz; /* the number with unit_sz bytes */ + + /* the additional slot is for tail_sz */ + head = calloc(sgl_num + (tail_sz ? 1 : 0), sizeof(struct wd_datalist)); + if (!head) { + SEC_TST_PRT("Fail to allocate memory for SGL head!\n"); + goto out; + } + + q = NULL; + for (i = 0; i < sgl_num; i++) { + p = &head[i]; + p->data = buf + i * unit_sz; + p->len = unit_sz; + if (q) + q->next = p; + q = p; + } + + if (tail_sz) { + p = &head[i]; + p->data = buf + i * unit_sz; + p->len = tail_sz; + if (q) + q->next = p; + q = p; + } + + if (q) + q->next = NULL; + + return head; +out: + free(buf); + return NULL; +} + +static void free_buf(int sgl, void *buf) +{ + struct wd_datalist *head = buf; + struct wd_datalist *p = head; + void *data_buf = NULL; + + if (!buf) + return; + + if (sgl == WD_FLAT_BUF) { + free(buf); + return; + } + + if (head) + data_buf = head->data; + + /* free the whole data buffer of SGL */ + if (data_buf) + free(p->data); + + /* free SGL headers */ + free(buf); +} + static int init_uadk_bd_pool(void) { unsigned long step; + int unit_sz; int i, j; int ret; // make the block not align to 4K step = sizeof(char) * g_pktlen * 2; + unit_sz = cal_unit_sz(step); ret = init_ivkey_source(); if (ret) { @@ -1097,12 +1220,13 @@ static int init_uadk_bd_pool(void) goto malloc_error1; } for (j = 0; j < MAX_POOL_LENTH; j++) { - g_uadk_pool.pool[i].bds[j].src = malloc(step); - memset(g_uadk_pool.pool[i].bds[j].src, 0, step); + g_uadk_pool.pool[i].bds[j].src = create_buf(g_data_fmt, step, unit_sz); if (!g_uadk_pool.pool[i].bds[j].src) goto malloc_error2; - g_uadk_pool.pool[i].bds[j].dst = malloc(step); - memset(g_uadk_pool.pool[i].bds[j].dst, 0, step); + if (g_alg == DIGEST_TYPE) + g_uadk_pool.pool[i].bds[j].dst = malloc(step); + else + g_uadk_pool.pool[i].bds[j].dst = create_buf(g_data_fmt, step, unit_sz); if (!g_uadk_pool.pool[i].bds[j].dst) goto malloc_error3; g_uadk_pool.pool[i].bds[j].mac = malloc(SEC_MAX_MAC_LEN); @@ -1110,19 +1234,29 @@ static int init_uadk_bd_pool(void) if (!g_uadk_pool.pool[i].bds[j].mac) goto malloc_error4; - if (g_alg != AEAD_TYPE) { - get_rand_data(g_uadk_pool.pool[i].bds[j].src, g_pktlen); - if (g_prefetch) - get_rand_data(g_uadk_pool.pool[i].bds[j].dst, - g_pktlen); - } else { - if (!g_optype) - get_aead_data(g_uadk_pool.pool[i].bds[j].src, - g_pktlen + SEC_AEAD_LEN); - else { + if (g_data_fmt == WD_FLAT_BUF) { + if (g_alg != AEAD_TYPE) { + get_rand_data(g_uadk_pool.pool[i].bds[j].src, g_pktlen); + if (g_prefetch) + get_rand_data(g_uadk_pool.pool[i].bds[j].dst, + g_pktlen); + } else { + if (!g_optype) + get_aead_data(g_uadk_pool.pool[i].bds[j].src, + g_pktlen + SEC_AEAD_LEN); + else { + read_aead_dst_data(g_uadk_pool.pool[i].bds[j].src, + g_pktlen + SEC_AEAD_LEN); + memcpy(g_uadk_pool.pool[i].bds[j].mac, g_save_mac, SEC_MAX_MAC_LEN); + } + } + } else if (g_data_fmt == WD_SGL_BUF) { + if (g_optype && g_alg == AEAD_TYPE) { read_aead_dst_data(g_uadk_pool.pool[i].bds[j].src, - g_pktlen + SEC_AEAD_LEN); + g_pktlen + SEC_AEAD_LEN); memcpy(g_uadk_pool.pool[i].bds[j].mac, g_save_mac, SEC_MAX_MAC_LEN); + } else if (g_prefetch && g_alg == DIGEST_TYPE) { + get_rand_data(g_uadk_pool.pool[i].bds[j].dst, g_pktlen); } } } @@ -1132,20 +1266,23 @@ static int init_uadk_bd_pool(void) return 0; malloc_error4: - free(g_uadk_pool.pool[i].bds[j].dst); + if (g_alg == DIGEST_TYPE) + free(g_uadk_pool.pool[i].bds[j].dst); + else + free_buf(g_data_fmt, g_uadk_pool.pool[i].bds[j].dst); malloc_error3: - free(g_uadk_pool.pool[i].bds[j].src); + free_buf(g_data_fmt, g_uadk_pool.pool[i].bds[j].src); malloc_error2: for (j--; j >= 0; j--) { - free(g_uadk_pool.pool[i].bds[j].src); - free(g_uadk_pool.pool[i].bds[j].dst); + free_buf(g_data_fmt, g_uadk_pool.pool[i].bds[j].src); + free_buf(g_data_fmt, g_uadk_pool.pool[i].bds[j].dst); free(g_uadk_pool.pool[i].bds[j].mac); } malloc_error1: for (i--; i >= 0; i--) { for (j = 0; j < MAX_POOL_LENTH; j++) { - free(g_uadk_pool.pool[i].bds[j].src); - free(g_uadk_pool.pool[i].bds[j].dst); + free_buf(g_data_fmt, g_uadk_pool.pool[i].bds[j].src); + free_buf(g_data_fmt, g_uadk_pool.pool[i].bds[j].dst); free(g_uadk_pool.pool[i].bds[j].mac); } free(g_uadk_pool.pool[i].bds); @@ -1173,8 +1310,11 @@ static void free_uadk_bd_pool(void) for (i = 0; i < g_thread_num; i++) { if (g_uadk_pool.pool[i].bds) { for (j = 0; j < MAX_POOL_LENTH; j++) { - free(g_uadk_pool.pool[i].bds[j].src); - free(g_uadk_pool.pool[i].bds[j].dst); + free_buf(g_data_fmt, g_uadk_pool.pool[i].bds[j].src); + if (g_alg == DIGEST_TYPE) + free(g_uadk_pool.pool[i].bds[j].dst); + else + free_buf(g_data_fmt, g_uadk_pool.pool[i].bds[j].dst); free(g_uadk_pool.pool[i].bds[j].mac); } } @@ -1655,7 +1795,7 @@ static void *sec_uadk_cipher_async(void *arg) creq.in_bytes = g_pktlen; creq.out_bytes = g_pktlen; creq.out_buf_bytes = g_pktlen; - creq.data_fmt = 0; + creq.data_fmt = g_data_fmt; creq.state = 0; creq.cb = cipher_async_cb; @@ -1787,7 +1927,7 @@ static void *sec_uadk_aead_async(void *arg) else areq.out_bytes = g_pktlen + 32; // aadsize + authsize = 32; - areq.data_fmt = 0; + areq.data_fmt = g_data_fmt; areq.state = 0; areq.cb = aead_async_cb; @@ -1895,7 +2035,7 @@ static void *sec_uadk_digest_async(void *arg) dreq.in_bytes = g_pktlen; dreq.out_bytes = pdata->d_outbytes; dreq.out_buf_bytes = pdata->d_outbytes; - dreq.data_fmt = 0; + dreq.data_fmt = g_data_fmt; dreq.state = 0; dreq.has_next = 0; dreq.cb = digest_async_cb; @@ -1997,7 +2137,7 @@ static void *sec_uadk_cipher_sync(void *arg) creq.in_bytes = g_pktlen; creq.out_bytes = g_pktlen; creq.out_buf_bytes = g_pktlen; - creq.data_fmt = 0; + creq.data_fmt = g_data_fmt; creq.state = 0; while(1) { @@ -2101,7 +2241,7 @@ static void *sec_uadk_aead_sync(void *arg) else areq.out_bytes = g_pktlen + 32; // aadsize + authsize = 32; - areq.data_fmt = 0; + areq.data_fmt = g_data_fmt; areq.state = 0; while(1) { @@ -2176,7 +2316,7 @@ static void *sec_uadk_digest_sync(void *arg) dreq.in_bytes = g_pktlen; dreq.out_bytes = pdata->d_outbytes; dreq.out_buf_bytes = pdata->d_outbytes; - dreq.data_fmt = 0; + dreq.data_fmt = g_data_fmt; dreq.state = 0; dreq.has_next = 0; @@ -2355,6 +2495,7 @@ int sec_uadk_benchmark(struct acc_option *options) g_alg = options->subtype; g_optype = options->optype; g_algtype = options->algtype; + g_data_fmt = options->data_fmt; if (g_alg == AEAD_TYPE) { g_maclen = get_aead_mac_len(g_algtype); diff --git a/uadk_tool/benchmark/uadk_benchmark.c b/uadk_tool/benchmark/uadk_benchmark.c index 24737c5..f57c4f9 100644 --- a/uadk_tool/benchmark/uadk_benchmark.c +++ b/uadk_tool/benchmark/uadk_benchmark.c @@ -370,6 +370,15 @@ void segmentfault_handler(int sig) exit(1); } +void memset_buf(void *buf, size_t sz) +{ + char *ch = (char *)buf; + size_t i; + + for (i = 0; i < sz; i++) + ch[i] = 0; +} + /*-------------------------------------main code------------------------------------------------------*/ static void parse_alg_param(struct acc_option *option) { @@ -741,6 +750,7 @@ int acc_cmd_parse(int argc, char *argv[], struct acc_option *option) {"init2", no_argument, 0, 17}, {"device", required_argument, 0, 18}, {"memory", required_argument, 0, 19}, + {"sgl", no_argument, 0, 20}, {0, 0, 0, 0} }; @@ -815,6 +825,9 @@ int acc_cmd_parse(int argc, char *argv[], struct acc_option *option) case 19: option->mem_type = strtol(optarg, NULL, 0); break; + case 20: + option->data_fmt = WD_SGL_BUF; + break; default: ACC_TST_PRT("invalid: bad input parameter!\n"); print_benchmark_help(); diff --git a/uadk_tool/benchmark/uadk_benchmark.h b/uadk_tool/benchmark/uadk_benchmark.h index 81ace1b..83fd7fa 100644 --- a/uadk_tool/benchmark/uadk_benchmark.h +++ b/uadk_tool/benchmark/uadk_benchmark.h @@ -37,6 +37,7 @@ #define SEND_USLEEP 100 #define SEC_2_USEC 1000000 #define HASH_ZISE 16 +#define SGL_ALIGNED_BYTES 64 #define SCHED_SINGLE "sched_single" #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) @@ -82,6 +83,7 @@ struct acc_option { u32 sched_type; int task_type; int mem_type; + u32 data_fmt; }; enum uadk_mem_mode { @@ -230,6 +232,7 @@ extern u32 get_recv_time(void); extern void cal_avg_latency(u32 count); extern int get_alg_name(int alg, char *alg_name); extern void segmentfault_handler(int sig); +extern void memset_buf(void *buf, size_t sz); int uadk_parse_dev_id(char *dev_name); int acc_cmd_parse(int argc, char *argv[], struct acc_option *option); diff --git a/uadk_tool/benchmark/zip_uadk_benchmark.c b/uadk_tool/benchmark/zip_uadk_benchmark.c index fc81c2b..092f710 100644 --- a/uadk_tool/benchmark/zip_uadk_benchmark.c +++ b/uadk_tool/benchmark/zip_uadk_benchmark.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: Apache-2.0 */ #include <numa.h> +#include <math.h> #include "uadk_benchmark.h" #include "zip_uadk_benchmark.h" @@ -84,6 +85,7 @@ static unsigned int g_pktlen; static unsigned int g_prefetch; static unsigned int g_state; static unsigned int g_dev_id; +static unsigned int g_data_fmt; #ifndef ZLIB_FSE static ZSTD_CCtx* zstd_soft_fse_init(unsigned int level) @@ -175,8 +177,15 @@ fd_error: static int load_file_data(const char *alg, u32 pkg_len, u32 optype) { struct zip_file_head *fhead = NULL; + struct wd_datalist *src_curr = NULL; + struct wd_datalist *dst_curr = NULL; char file_path[PATH_SIZE]; + size_t total_read = 0; + size_t total_len = 0; + size_t remaining = 0; ssize_t size = 0xff; + size_t copied = 0; + size_t len = 0; int i, j, fd; int ret; @@ -216,30 +225,63 @@ static int load_file_data(const char *alg, u32 pkg_len, u32 optype) // read data for one buffer one buffer from file line 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; - size = read(fd, g_zip_pool.pool[0].bds[j].src, - fhead->blk_sz[j]); - if (size < 0) { - ZIP_TST_PRT("Decompress read data error size: %lu!\n", size); - ret = -EINVAL; - goto read_err; - } else if (size == 0) { - ZIP_TST_PRT("Read file to the end!"); + if (g_data_fmt == 0) { + if (fhead->blk_sz[j] != 0) { + size = read(fd, g_zip_pool.pool[0].bds[j].src, fhead->blk_sz[j]); + if (size < 0) { + ZIP_TST_PRT("Decompress read data error size: %ld!\n", size); + ret = -EINVAL; + goto read_err; + } + g_zip_pool.pool[0].bds[j].src_len = size; + } else { + g_zip_pool.pool[0].bds[j].src_len = 0; } + } else { + src_curr = (struct wd_datalist *)g_zip_pool.pool[0].bds[j].src; + remaining = fhead->blk_sz[j]; + total_read = 0; + while (src_curr && remaining > 0) { + len = fmin(remaining, src_curr->len); + size = read(fd, src_curr->data, len); + if (size < 0) { + ZIP_TST_PRT("Decompress read data error at block %d!\n", j); + ret = -EINVAL; + goto read_err; + } + total_read += size; + remaining -= size; + src_curr = src_curr->next; + } + g_zip_pool.pool[0].bds[j].src_len = total_read; } - g_zip_pool.pool[0].bds[j].src_len = size; } for (i = 1; i < g_thread_num; i++) { for (j = 0; j < MAX_POOL_LENTH_COMP; j++) { - if (g_zip_pool.pool[0].bds[j].src_len) + if (g_zip_pool.pool[0].bds[j].src_len == 0) + continue; + + if (g_data_fmt == 0) { memcpy(g_zip_pool.pool[i].bds[j].src, g_zip_pool.pool[0].bds[j].src, g_zip_pool.pool[0].bds[j].src_len); - g_zip_pool.pool[i].bds[j].src_len = - g_zip_pool.pool[0].bds[j].src_len; + g_zip_pool.pool[i].bds[j].src_len = g_zip_pool.pool[0].bds[j].src_len; + } else { + src_curr = (struct wd_datalist *)g_zip_pool.pool[0].bds[j].src; + dst_curr = (struct wd_datalist *)g_zip_pool.pool[i].bds[j].src; + total_len = g_zip_pool.pool[0].bds[j].src_len; + copied = 0; + while (src_curr && dst_curr && copied < total_len) { + len = fmin(src_curr->len, dst_curr->len); + len = fmin(len, total_len - copied); + memcpy(dst_curr->data, src_curr->data, len); + copied += len; + src_curr = src_curr->next; + dst_curr = dst_curr->next; + } + g_zip_pool.pool[i].bds[j].src_len = total_len; + } } } @@ -575,8 +617,98 @@ static void uninit_ctx_config(void) wd_sched_rr_release(g_sched); } +/* + * Calculate SGL unit size. + */ +static inline size_t cal_unit_sz(size_t sz) +{ + return (sz + SGL_ALIGNED_BYTES - 1) & ~(SGL_ALIGNED_BYTES - 1); +} + +/* + * Create SGL or common memory buffer. + */ +static void *create_buf(int sgl, size_t sz, size_t unit_sz) +{ + struct wd_datalist *head, *p, *q; + int i, tail_sz, sgl_num; + void *buf; + + buf = malloc(sz); + if (!buf) { + ZIP_TST_PRT("Fail to allocate buffer %ld size!\n", sz); + return NULL; + } + + memset_buf(buf, sz); + + if (sgl == WD_FLAT_BUF) + return buf; + + if (sz == g_pktlen) { + get_rand_data(buf, sz * COMPRESSION_RATIO_FACTOR); + } else { + if (g_prefetch) + get_rand_data(buf, sz); + } + tail_sz = sz % unit_sz; + sgl_num = sz / unit_sz; /* the number with unit_sz bytes */ + + /* the additional slot is for tail_sz */ + head = calloc(sgl_num + 1, sizeof(struct wd_datalist)); + if (!head) { + ZIP_TST_PRT("Fail to allocate memory for SGL head!\n"); + goto out; + } + + q = NULL; + for (i = 0; i < sgl_num; i++) { + p = &head[i]; + p->data = buf + i * unit_sz; + p->len = unit_sz; + if (q) + q->next = p; + q = p; + } + + if (tail_sz) { + p = &head[i]; + p->data = buf + i * unit_sz; + p->len = tail_sz; + if (q) + q->next = p; + q = p; + } + + if (q) + q->next = NULL; + + return head; +out: + free(buf); + return NULL; +} + +static void free_buf(int sgl, void *buf) +{ + struct wd_datalist *p; + + if (!buf) + return; + if (sgl == WD_FLAT_BUF) { + free(buf); + return; + } + p = (struct wd_datalist *)buf; + /* free the whole data buffer of SGL */ + free(p->data); + /* free SGL headers */ + free(buf); +} + static int init_uadk_bd_pool(u32 optype) { + int unit_sz; u32 outsize; u32 insize; int i, j; @@ -605,37 +737,40 @@ static int init_uadk_bd_pool(u32 optype) goto malloc_error1; } for (j = 0; j < MAX_POOL_LENTH_COMP; j++) { - g_zip_pool.pool[i].bds[j].src = calloc(1, insize); + unit_sz = cal_unit_sz(insize); + g_zip_pool.pool[i].bds[j].src = create_buf(g_data_fmt, insize, unit_sz); if (!g_zip_pool.pool[i].bds[j].src) goto malloc_error2; g_zip_pool.pool[i].bds[j].src_len = insize; - g_zip_pool.pool[i].bds[j].dst = malloc(outsize); + unit_sz = cal_unit_sz(outsize); + g_zip_pool.pool[i].bds[j].dst = create_buf(g_data_fmt, outsize, unit_sz); if (!g_zip_pool.pool[i].bds[j].dst) 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 * COMPRESSION_RATIO_FACTOR); - if (g_prefetch) - get_rand_data(g_zip_pool.pool[i].bds[j].dst, outsize); + if (g_data_fmt == WD_FLAT_BUF) { + 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); + } } } return 0; malloc_error3: - free(g_zip_pool.pool[i].bds[j].src); + free_buf(g_data_fmt, g_zip_pool.pool[i].bds[j].src); malloc_error2: for (j--; j >= 0; j--) { - free(g_zip_pool.pool[i].bds[j].src); - free(g_zip_pool.pool[i].bds[j].dst); + free_buf(g_data_fmt, g_zip_pool.pool[i].bds[j].src); + free_buf(g_data_fmt, g_zip_pool.pool[i].bds[j].dst); } malloc_error1: for (i--; i >= 0; i--) { 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); + free_buf(g_data_fmt, g_zip_pool.pool[i].bds[j].src); + free_buf(g_data_fmt, g_zip_pool.pool[i].bds[j].dst); } free(g_zip_pool.pool[i].bds); g_zip_pool.pool[i].bds = NULL; @@ -654,8 +789,8 @@ 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_COMP; j++) { - free(g_zip_pool.pool[i].bds[j].src); - free(g_zip_pool.pool[i].bds[j].dst); + free_buf(g_data_fmt, g_zip_pool.pool[i].bds[j].src); + free_buf(g_data_fmt, g_zip_pool.pool[i].bds[j].dst); } } free(g_zip_pool.pool[i].bds); @@ -938,7 +1073,7 @@ static void *zip_uadk_blk_lz77_sync_run(void *arg) out_len = uadk_pool->bds[0].dst_len; creq.cb = NULL; - creq.data_fmt = 0; + creq.data_fmt = g_data_fmt; creq.status = 0; ftuple = malloc(sizeof(COMP_TUPLE_TAG) * MAX_POOL_LENTH_COMP); @@ -1048,7 +1183,7 @@ static void *zip_uadk_stm_lz77_sync_run(void *arg) out_len = uadk_pool->bds[0].dst_len; creq.cb = NULL; - creq.data_fmt = 0; + creq.data_fmt = g_data_fmt; creq.status = 0; ftuple = malloc(sizeof(COMP_TUPLE_TAG) * MAX_POOL_LENTH_COMP); @@ -1153,7 +1288,7 @@ static void *zip_uadk_blk_lz77_async_run(void *arg) out_len = uadk_pool->bds[0].dst_len; creq.cb = zip_lz77_async_cb; - creq.data_fmt = 0; + creq.data_fmt = g_data_fmt; creq.status = 0; while(1) { @@ -1242,7 +1377,7 @@ static void *zip_uadk_blk_sync_run(void *arg) out_len = uadk_pool->bds[0].dst_len; creq.cb = NULL; - creq.data_fmt = 0; + creq.data_fmt = g_data_fmt; creq.priv = 0; creq.status = 0; @@ -1317,7 +1452,7 @@ static void *zip_uadk_stm_sync_run(void *arg) out_len = uadk_pool->bds[0].dst_len; creq.cb = NULL; - creq.data_fmt = 0; + creq.data_fmt = g_data_fmt; creq.priv = 0; creq.status = 0; @@ -1397,7 +1532,7 @@ static void *zip_uadk_blk_async_run(void *arg) out_len = uadk_pool->bds[0].dst_len; creq.cb = zip_async_cb; - creq.data_fmt = 0; + creq.data_fmt = g_data_fmt; creq.priv = 0; creq.status = 0; @@ -1634,6 +1769,7 @@ int zip_uadk_benchmark(struct acc_option *options) g_pktlen = options->pktlen; g_ctxnum = options->ctxnums; g_prefetch = options->prefetch; + g_data_fmt = options->data_fmt; if (options->optype >= WD_DIR_MAX * 2) { ZIP_TST_PRT("ZIP optype error: %u\n", options->optype); -- 2.33.0