
From: Chenghai Huang <huangchenghai2@huawei.com> WD_EAGAIN is returned in v2 or WCRYPTO_DECOMP_END_NOSPACE is returned in v2 when the user memory for the data copy output is insufficient. Indicates that the user needs to provide an extra memory space to complete the data output. Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com> Signed-off-by: Qi Tao <taoqi10@huawei.com> --- drv/hisi_comp.c | 21 +-------------------- v1/drv/hisi_zip_udrv.c | 19 +------------------ 2 files changed, 2 insertions(+), 38 deletions(-) diff --git a/drv/hisi_comp.c b/drv/hisi_comp.c index 6b855fc3..64b9c62c 100644 --- a/drv/hisi_comp.c +++ b/drv/hisi_comp.c @@ -132,8 +132,6 @@ struct hisi_comp_buf { __u32 pending_out; /* Size that have been copied */ __u32 output_offset; - /* Input data consumption when all data copies are complete */ - __u32 fallback_size; /* Store end flag return by HW */ __u32 status; /* Denoted internal store sgl */ @@ -285,11 +283,6 @@ static int check_store_buf(struct wd_comp_msg *msg) if (!buf->pending_out) return 0; - if (!req->src_len && buf->fallback_size) { - WD_ERR("Couldn't handle, input size is 0!\n"); - return -WD_EINVAL; - } - copy_len = copy_to_out(msg, buf, buf->pending_out); buf->pending_out -= copy_len; msg->produced = copy_len; @@ -297,8 +290,6 @@ static int check_store_buf(struct wd_comp_msg *msg) if (!buf->pending_out) { /* All data copied to output */ - msg->in_cons = buf->fallback_size; - buf->fallback_size = 0; buf->output_offset = 0; memset(buf->dst, 0, STORE_BUF_SIZE); req->status = buf->status == WD_STREAM_END ? WD_STREAM_END : WD_SUCCESS; @@ -322,29 +313,19 @@ static void copy_from_hw(struct wd_comp_msg *msg, struct hisi_comp_buf *buf) if (!buf->pending_out) { /* All data copied to output */ - buf->fallback_size = 0; buf->output_offset = 0; memset(buf->dst, 0, STORE_BUF_SIZE); } else { /* Still data need to be copied */ buf->output_offset += copy_len; - /* Feedback to users that a maximum of 1 byte of data is not consumed */ - if (msg->in_cons > 1) { - buf->fallback_size = 1; - msg->in_cons--; - } else { - buf->fallback_size = msg->in_cons; - msg->in_cons = 0; - } - /* * The end flag is cached. It can be output only * after the data is completely copied to the output. */ if (req->status == WD_STREAM_END) { buf->status = WD_STREAM_END; - req->status = WD_SUCCESS; + req->status = WD_EAGAIN; } } } diff --git a/v1/drv/hisi_zip_udrv.c b/v1/drv/hisi_zip_udrv.c index 4161536d..481d8352 100644 --- a/v1/drv/hisi_zip_udrv.c +++ b/v1/drv/hisi_zip_udrv.c @@ -103,8 +103,6 @@ struct hisi_zip_buf { __u32 pending_out; /* Size that have been copied */ __u32 output_offset; - /* Input data consumption when all data copies are complete */ - __u32 fallback_size; /* Store end flag return by HW */ __u32 status; }; @@ -174,11 +172,6 @@ static void copy_from_buf(struct wcrypto_comp_msg *msg, struct hisi_zip_buf *buf { __u32 copy_len; - if (!msg->in_size && buf->fallback_size) { - WD_ERR("Couldn't handle, input size is 0!\n"); - return; - } - /* * After hw processing, pending_out is the length of the hardware output. * After hw is skipped, pending_out is the remaining length in the buf. @@ -194,33 +187,23 @@ static void copy_from_buf(struct wcrypto_comp_msg *msg, struct hisi_zip_buf *buf /* All data copied to output, reset the buf status */ if (buf->skip_hw) { buf->skip_hw = 0; - msg->in_cons = buf->fallback_size; msg->status = buf->status == WCRYPTO_DECOMP_END ? WCRYPTO_DECOMP_END : WD_SUCCESS; } - buf->fallback_size = 0; buf->output_offset = 0; } else { /* Still data need to be copied */ buf->output_offset += copy_len; buf->skip_hw = 0; - /* Feedback to users that a maximum of 1 byte of data is not consumed */ - if (msg->in_cons > 1) { - buf->fallback_size = 1; - msg->in_cons--; - } else { - msg->in_cons = 0; - } - /* * The end flag is cached. It can be output only * after the data is completely copied to the output. */ if (msg->status == WCRYPTO_DECOMP_END) { buf->status = WCRYPTO_DECOMP_END; - msg->status = WD_SUCCESS; + msg->status = WCRYPTO_DECOMP_END_NOSPACE; } } } -- 2.33.0