
From: Junchong Pan <panjunchong@h-partners.com> Queue is malloc but not init, is_poll is set but poll interface is not invoked, may case eq overflow. Signed-off-by: Junchong Pan <panjunchong@h-partners.com> Signed-off-by: Qi Tao <taoqi10@huawei.com> --- uadk_tool/benchmark/hpre_wd_benchmark.c | 2 +- uadk_tool/benchmark/sec_wd_benchmark.c | 2 +- uadk_tool/benchmark/zip_wd_benchmark.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/uadk_tool/benchmark/hpre_wd_benchmark.c b/uadk_tool/benchmark/hpre_wd_benchmark.c index 40f7f0b..60ed3bd 100644 --- a/uadk_tool/benchmark/hpre_wd_benchmark.c +++ b/uadk_tool/benchmark/hpre_wd_benchmark.c @@ -447,7 +447,7 @@ static int init_hpre_wd_queue(struct acc_option *options) } for (i = 0; i < g_thread_num; i++) { - g_thread_queue.bd_res[i].queue = malloc(sizeof(struct wd_queue)); + g_thread_queue.bd_res[i].queue = calloc(1, sizeof(struct wd_queue)); g_thread_queue.bd_res[i].queue->capa.alg = options->algclass; // 0 is ENC, 1 is DEC g_thread_queue.bd_res[i].queue->capa.priv.direction = options->optype; diff --git a/uadk_tool/benchmark/sec_wd_benchmark.c b/uadk_tool/benchmark/sec_wd_benchmark.c index e022dcb..f066a5b 100644 --- a/uadk_tool/benchmark/sec_wd_benchmark.c +++ b/uadk_tool/benchmark/sec_wd_benchmark.c @@ -610,7 +610,7 @@ static int init_wd_queue(struct acc_option *options) } for (i = 0; i < g_thread_num; i++) { - g_thread_queue.bd_res[i].queue = malloc(sizeof(struct wd_queue)); + g_thread_queue.bd_res[i].queue = calloc(1, sizeof(struct wd_queue)); memset(g_thread_queue.bd_res[i].queue, 0, sizeof(struct wd_queue)); g_thread_queue.bd_res[i].queue->capa.alg = options->algclass; // 0 is ENC, 1 is DEC diff --git a/uadk_tool/benchmark/zip_wd_benchmark.c b/uadk_tool/benchmark/zip_wd_benchmark.c index 8ad3e96..ab9a894 100644 --- a/uadk_tool/benchmark/zip_wd_benchmark.c +++ b/uadk_tool/benchmark/zip_wd_benchmark.c @@ -311,7 +311,7 @@ static int init_zip_wd_queue(struct acc_option *options) } for (i = 0; i < g_thread_num; i++) { - g_thread_queue.bd_res[i].queue = malloc(sizeof(struct wd_queue)); + g_thread_queue.bd_res[i].queue = calloc(1, sizeof(struct wd_queue)); g_thread_queue.bd_res[i].queue->capa.alg = options->algclass; // 0 is compress, 1 is decompress g_thread_queue.bd_res[i].queue->capa.priv.direction = op_type; -- 2.33.0

From: Chenghai Huang <huangchenghai2@huawei.com> 1.The values of the overflow count and overflow position are incorrect. 2.Fix the calculation of freq address offset. Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com> Signed-off-by: Qi Tao <taoqi10@huawei.com> --- drv/hisi_comp.c | 6 ++++-- v1/drv/hisi_zip_udrv.c | 14 ++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drv/hisi_comp.c b/drv/hisi_comp.c index 0e9cd65..6b855fc 100644 --- a/drv/hisi_comp.c +++ b/drv/hisi_comp.c @@ -79,7 +79,8 @@ #define CTX_REPCODE1_OFFSET 12 #define CTX_REPCODE2_OFFSET 24 #define CTX_HW_REPCODE_OFFSET 784 -#define OVERFLOW_DATA_SIZE 2 +#define OVERFLOW_DATA_SIZE 8 +#define SEQ_DATA_SIZE_SHIFT 3 #define ZSTD_FREQ_DATA_SIZE 784 #define ZSTD_LIT_RESV_SIZE 16 #define REPCODE_SIZE 12 @@ -926,7 +927,8 @@ static void get_data_size_lz77_zstd(struct hisi_zip_sqe *sqe, enum wd_comp_op_ty data->seq_num = sqe->produced; data->lit_length_overflow_cnt = sqe->dw31 >> LITLEN_OVERFLOW_CNT_SHIFT; data->lit_length_overflow_pos = sqe->dw31 & LITLEN_OVERFLOW_POS_MASK; - data->freq = data->sequences_start + data->seq_num + OVERFLOW_DATA_SIZE; + data->freq = data->sequences_start + (data->seq_num << SEQ_DATA_SIZE_SHIFT) + + OVERFLOW_DATA_SIZE; if (ctx_buf) { memcpy(ctx_buf + CTX_REPCODE2_OFFSET, diff --git a/v1/drv/hisi_zip_udrv.c b/v1/drv/hisi_zip_udrv.c index 9ab2812..56da29a 100644 --- a/v1/drv/hisi_zip_udrv.c +++ b/v1/drv/hisi_zip_udrv.c @@ -40,7 +40,7 @@ #define STREAM_POS_SHIFT 2 #define STREAM_MODE_SHIFT 1 #define WINDOWS_SIZE_SHIFT 12 -#define SEQUENCE_SZIE 8 +#define SEQ_DATA_SIZE_SHIFT 3 #define HW_NEGACOMPRESS 0x0d #define HW_CRC_ERR 0x10 @@ -58,6 +58,7 @@ #define ZSTD_LIT_RSV_SIZE 16 #define ZSTD_FREQ_DATA_SIZE 784 #define REPCODE_SIZE 12 +#define OVERFLOW_DATA_SIZE 8 /* Error status 0xe indicates that dest_avail_out insufficient */ #define ERR_DSTLEN_OUT 0xe @@ -806,8 +807,8 @@ int qm_fill_zip_sqe_v3(void *smsg, struct qm_queue_info *info, __u16 i) } /* - * Checksum[31:24] equals LitLength_Overflow_Pos; - * Checksum[23:0] equals Freq_Literal_Overflow_cnt; + * Checksum[31:24] equals Freq_Literal_Overflow_cnt; + * Checksum[23:0] equals LitLength_Overflow_Pos; */ #define LILL_OVERFLOW_POS 0x00ffffff #define LILL_OVERFLOW_CNT_OFFSET 24 @@ -822,8 +823,8 @@ static void fill_priv_lz77_zstd(void *ssqe, struct wcrypto_comp_msg *recv_msg) format->lit_num = sqe->comp_data_length; format->seq_num = sqe->produced; - format->lit_length_overflow_cnt = sqe->checksum & LILL_OVERFLOW_POS; - format->lit_length_overflow_pos = (sqe->checksum & ~LILL_OVERFLOW_POS) >> + format->lit_length_overflow_pos = sqe->checksum & LILL_OVERFLOW_POS; + format->lit_length_overflow_cnt = (sqe->checksum & ~LILL_OVERFLOW_POS) >> LILL_OVERFLOW_CNT_OFFSET; if (recv_msg->data_fmt == WD_SGL_BUF) { @@ -833,7 +834,8 @@ static void fill_priv_lz77_zstd(void *ssqe, struct wcrypto_comp_msg *recv_msg) } else { format->literals_start = recv_msg->dst; format->sequences_start = recv_msg->dst + recv_msg->in_size + ZSTD_LIT_RSV_SIZE; - format->freq = (void *)(&format->lit_length_overflow_pos + 1); + format->freq = format->sequences_start + (format->seq_num << SEQ_DATA_SIZE_SHIFT) + + OVERFLOW_DATA_SIZE; } if (ctx_buf) { -- 2.33.0
participants (1)
-
Qi Tao