From: Chenghai Huang <huangchenghai2@huawei.com> When the hardware configures the lit_length register, the stream mode LZ77_ZSTD algorithm needs to clear the lit_length in the context of each block input. Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com> Signed-off-by: Zongyu Wu <wuzongyu1@huawei.com> --- drv/hisi_comp.c | 5 +++++ v1/drv/hisi_zip_udrv.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/drv/hisi_comp.c b/drv/hisi_comp.c index ab2b5e7..4dc0c6a 100644 --- a/drv/hisi_comp.c +++ b/drv/hisi_comp.c @@ -89,6 +89,7 @@ #define PRICE_MIN_OUT_SIZE 4096 #define ZSTD_LIT_RESV_SIZE 16 #define REPCODE_SIZE 12 +#define SEQ_LIT_LEN_SIZE 4 #define BUF_TYPE 2 @@ -829,6 +830,10 @@ static int fill_buf_lz77_zstd(handle_t h_qp, struct hisi_zip_sqe *sqe, else memcpy(msg->ctx_buf + CTX_REPCODE2_OFFSET, msg->ctx_buf + CTX_REPCODE1_OFFSET, REPCODE_SIZE); + + /* The literal length info of each bd needs to be cleared. */ + memset(ctx_buf + CTX_HW_REPCODE_OFFSET + REPCODE_SIZE, 0, + SEQ_LIT_LEN_SIZE); } } diff --git a/v1/drv/hisi_zip_udrv.c b/v1/drv/hisi_zip_udrv.c index 8908e27..3045e48 100644 --- a/v1/drv/hisi_zip_udrv.c +++ b/v1/drv/hisi_zip_udrv.c @@ -58,6 +58,7 @@ #define ZSTD_LIT_RSV_SIZE 16 #define ZSTD_FREQ_DATA_SIZE 784 #define REPCODE_SIZE 12 +#define SEQ_LIT_LEN_SIZE 4 #define OVERFLOW_DATA_SIZE 8 /* Error status 0xe indicates that dest_avail_out insufficient */ @@ -694,6 +695,10 @@ static void fill_zip_sqe_hw_info_lz77_zstd(void *ssqe, struct wcrypto_comp_msg * else memcpy(msg->ctx_buf + CTX_REPCODE2_OFFSET, msg->ctx_buf + CTX_REPCODE1_OFFSET, REPCODE_SIZE); + + /* The literal length info of each bd needs to be cleared. */ + memset(msg->ctx_buf + CTX_HW_REPCODE_OFFSET + CTX_BUFFER_OFFSET + + REPCODE_SIZE, 0, SEQ_LIT_LEN_SIZE); } } -- 2.33.0