From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Tucker, Greg B" Subject: Re: [PATCH v6 08/10] compress/isal: add ISA-L compression functionality Date: Wed, 9 May 2018 17:39:42 +0000 Message-ID: References: <1525782775-138647-2-git-send-email-lee.daly@intel.com> <1525882475-183214-1-git-send-email-lee.daly@intel.com> <1525882475-183214-9-git-send-email-lee.daly@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "De Lara Guarch, Pablo" , "Jain, Deepak K" , "Trahe, Fiona" To: "Daly, Lee" , "dev@dpdk.org" Return-path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id F354A1B757 for ; Wed, 9 May 2018 19:39:44 +0200 (CEST) In-Reply-To: <1525882475-183214-9-git-send-email-lee.daly@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > > Adds compression functionality, this sets internal ISA-L structures, prov= ides > input & output mbuf addresses, executes compression, which ISA-L calls de= flate, > and finally error checks. >=20 > Signed-off-by: Lee Daly Acked-by: Greg Tucker > --- > drivers/compress/isal/isal_compress_pmd.c | 83 +++++++++++++++++= +++++- > drivers/compress/isal/isal_compress_pmd_ops.c | 26 +++++++ > drivers/compress/isal/isal_compress_pmd_private.h | 2 + > 3 files changed, 109 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/compress/isal/isal_compress_pmd.c b/drivers/compress= /isal/isal_compress_pmd.c > index aaa0593..dbdee39 100644 > --- a/drivers/compress/isal/isal_compress_pmd.c > +++ b/drivers/compress/isal/isal_compress_pmd.c > @@ -6,6 +6,7 @@ > #include > #include > #include > +#include > #include >=20 > #include "isal_compress_pmd_private.h" > @@ -187,14 +188,92 @@ isal_comp_set_priv_xform_parameters(struct isal_pri= v_xform *priv_xform, > return 0; > } >=20 > +/* Stateless Compression Function */ > +static int > +process_isal_deflate(struct rte_comp_op *op, struct isal_comp_qp *qp, > + struct isal_priv_xform *priv_xform) > +{ > + int ret =3D 0; > + op->status =3D RTE_COMP_OP_STATUS_SUCCESS; > + > + /* Required due to init clearing level_buf */ > + uint8_t *temp_level_buf =3D qp->stream->level_buf; > + > + /* Initialize compression stream */ > + isal_deflate_stateless_init(qp->stream); > + > + qp->stream->level_buf =3D temp_level_buf; > + > + /* Stateless operation, input will be consumed in one go */ > + qp->stream->flush =3D NO_FLUSH; > + > + /* set op level & intermediate level buffer */ > + qp->stream->level =3D priv_xform->compress.level; > + qp->stream->level_buf_size =3D priv_xform->level_buffer_size; > + > + /* Point compression stream structure to input/output buffers */ > + qp->stream->avail_in =3D op->src.length; > + qp->stream->next_in =3D rte_pktmbuf_mtod(op->m_src, uint8_t *); > + qp->stream->avail_out =3D op->m_dst->data_len; > + qp->stream->next_out =3D rte_pktmbuf_mtod(op->m_dst, uint8_t *); > + qp->stream->end_of_stream =3D 1; /* All input consumed in one go */ > + > + if (unlikely(!qp->stream->next_in || !qp->stream->next_out)) { > + ISAL_PMD_LOG(ERR, "Invalid source or destination buffers\n"); > + op->status =3D RTE_COMP_OP_STATUS_INVALID_ARGS; > + return -1; > + } > + > + /* Set op huffman code */ > + if (priv_xform->compress.deflate.huffman =3D=3D RTE_COMP_HUFFMAN_FIXED) > + isal_deflate_set_hufftables(qp->stream, NULL, > + IGZIP_HUFFTABLE_STATIC); > + else if (priv_xform->compress.deflate.huffman =3D=3D > + RTE_COMP_HUFFMAN_DEFAULT) > + isal_deflate_set_hufftables(qp->stream, NULL, > + IGZIP_HUFFTABLE_DEFAULT); > + /* Dynamically change the huffman code to suit the input data */ > + else if (priv_xform->compress.deflate.huffman =3D=3D > + RTE_COMP_HUFFMAN_DYNAMIC) > + isal_deflate_set_hufftables(qp->stream, NULL, > + IGZIP_HUFFTABLE_DEFAULT); > + > + /* Execute compression operation */ > + ret =3D isal_deflate_stateless(qp->stream); > + > + /* Check that output buffer did not run out of space */ > + if (ret =3D=3D STATELESS_OVERFLOW) { > + ISAL_PMD_LOG(ERR, "Output buffer not big enough\n"); > + op->status =3D RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED; > + return ret; > + } > + > + /* Check that input buffer has been fully consumed */ > + if (qp->stream->avail_in !=3D (uint32_t)0) { > + ISAL_PMD_LOG(ERR, "Input buffer could not be read entirely\n"); > + op->status =3D RTE_COMP_OP_STATUS_ERROR; > + return -1; > + } > + > + if (ret !=3D COMP_OK) { > + op->status =3D RTE_COMP_OP_STATUS_ERROR; > + return ret; > + } > + > + op->consumed =3D qp->stream->total_in; > + op->produced =3D qp->stream->total_out; > + > + return ret; > +} > + --snip--