From: Chenghai Huang <huangchenghai2@huawei.com> Add a condition to check if the tail packet is not fully processed. When the bfinal end flag of the tail packet is in the second-to-last segment of data, it may cause the driver to incorrectly assume that the current data is the tail packet. In fact, there is still one more segment of data to be transmitted. Therefore, it is necessary to add a check for the data buffer status to notify the user to continue sending the packet. Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com> Signed-off-by: Zongyu Wu <wuzongyu1@huawei.com> --- drv/hisi_comp.c | 3 ++- v1/drv/hisi_zip_udrv.c | 4 ++-- v1/drv/hisi_zip_udrv.h | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drv/hisi_comp.c b/drv/hisi_comp.c index bcc4f17..3607ea2 100644 --- a/drv/hisi_comp.c +++ b/drv/hisi_comp.c @@ -57,6 +57,7 @@ #define HZ_CTX_ST_MASK 0x000f #define HZ_CTX_BFINAL_MASK 0x80 +#define HZ_CTX_STORE_MASK 0x7ffff #define HZ_LSTBLK_MASK 0x0100 #define HZ_STATUS_MASK 0xff #define HZ_REQ_TYPE_MASK 0xff @@ -1595,7 +1596,7 @@ static int parse_zip_sqe(struct hisi_qp *qp, struct hisi_zip_sqe *sqe, /* last block no space when decomping, need resend null size req */ if (ctx_st == HZ_DECOMPING_NO_SPACE && recv_msg->req.src_len == recv_msg->in_cons && - (sqe->ctx_dw0 & HZ_CTX_BFINAL_MASK)) + (sqe->ctx_dw0 & HZ_CTX_BFINAL_MASK) && (sqe->ctx_dw1 & HZ_CTX_STORE_MASK)) recv_msg->req.status = WD_EAGAIN; /* diff --git a/v1/drv/hisi_zip_udrv.c b/v1/drv/hisi_zip_udrv.c index 4e5ed80..44e1545 100644 --- a/v1/drv/hisi_zip_udrv.c +++ b/v1/drv/hisi_zip_udrv.c @@ -440,7 +440,7 @@ int qm_parse_zip_sqe(void *hw_msg, const struct qm_queue_info *info, qm_parse_zip_sqe_set_status(recv_msg, status, lstblk, ctx_st); if (ctx_st == HW_DECOMPING_NO_SPACE && recv_msg->in_size == recv_msg->in_cons && - ctx_bfinal) + ctx_bfinal && (sqe->ctx_dw1 & HZ_CTX_STORE_MASK)) recv_msg->status = WCRYPTO_DECOMP_END_NOSPACE; return 1; @@ -907,7 +907,7 @@ int qm_parse_zip_sqe_v3(void *hw_msg, const struct qm_queue_info *info, qm_parse_zip_sqe_set_status(recv_msg, status, lstblk, ctx_st); if (ctx_st == HW_DECOMPING_NO_SPACE && recv_msg->in_size == recv_msg->in_cons && - ctx_bfinal) + ctx_bfinal && (sqe->ctx_dw1 & HZ_CTX_STORE_MASK)) recv_msg->status = WCRYPTO_DECOMP_END_NOSPACE; /* diff --git a/v1/drv/hisi_zip_udrv.h b/v1/drv/hisi_zip_udrv.h index 28a9c0f..1037f43 100644 --- a/v1/drv/hisi_zip_udrv.h +++ b/v1/drv/hisi_zip_udrv.h @@ -121,6 +121,7 @@ struct hisi_zip_sqe_v3 { #define HZ_BLK_SIZE_SHIFT 16 #define HZ_CTX_ST_MASK 0x000f #define HZ_CTX_BFINAL_MASK 0x80 +#define HZ_CTX_STORE_MASK 0x7ffff #define HZ_LSTBLK_MASK 0x0100 #define HZ_STATUS_MASK 0xff #define HZ_REQ_TYPE_MASK 0xff -- 2.33.0