From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 4D514160 for ; Tue, 24 Jul 2018 00:25:25 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jul 2018 15:25:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,394,1526367600"; d="scan'208";a="73860257" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by fmsmga004.fm.intel.com with ESMTP; 23 Jul 2018 15:25:15 -0700 Received: from irsmsx107.ger.corp.intel.com ([169.254.10.193]) by IRSMSX154.ger.corp.intel.com ([169.254.12.32]) with mapi id 14.03.0319.002; Mon, 23 Jul 2018 23:25:14 +0100 From: "De Lara Guarch, Pablo" To: Shally Verma CC: "dev@dpdk.org" , "pathreya@caviumnetworks.com" , "mchalla@caviumnetworks.com" , Sunila Sahu , "Sunila Sahu" , Ashish Gupta Thread-Topic: [PATCH v4 4/5] compress/zlib: support burst enqueue/dequeue Thread-Index: AQHUIpS3lxPH6aATzkyBcmdBAApGpqSdXR6A Date: Mon, 23 Jul 2018 22:25:14 +0000 Message-ID: References: <1532357474-9544-1-git-send-email-shally.verma@caviumnetworks.com> <1532357474-9544-5-git-send-email-shally.verma@caviumnetworks.com> In-Reply-To: <1532357474-9544-5-git-send-email-shally.verma@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODFmNzZmZGItY2VhNS00MzRiLWFkM2EtNzIxNjE3N2EwOTc4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZUtRS1BBZXdDQjBCaDJWYVF4RXR3V1VIQVNCQ3BcL1pLRnlUZDdqRFlSalJoTlltUFBlYXNcL3pOVWJsZUpGY2N3In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v4 4/5] compress/zlib: support burst enqueue/dequeue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jul 2018 22:25:26 -0000 > -----Original Message----- > From: Shally Verma [mailto:shally.verma@caviumnetworks.com] > Sent: Monday, July 23, 2018 3:51 PM > To: De Lara Guarch, Pablo > Cc: dev@dpdk.org; pathreya@caviumnetworks.com; > mchalla@caviumnetworks.com; Sunila Sahu ; > Sunila Sahu ; Ashish Gupta > > Subject: [PATCH v4 4/5] compress/zlib: support burst enqueue/dequeue >=20 > From: Sunila Sahu >=20 > Signed-off-by: Sunila Sahu > Signed-off-by: Shally Verma > Signed-off-by: Ashish Gupta > --- > drivers/compress/zlib/zlib_pmd.c | 255 > ++++++++++++++++++++++++++++++++++++++- > 1 file changed, 254 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/compress/zlib/zlib_pmd.c b/drivers/compress/zlib/zli= b_pmd.c > index 47bc73d..dc1e230 100644 > --- a/drivers/compress/zlib/zlib_pmd.c > +++ b/drivers/compress/zlib/zlib_pmd.c > @@ -7,7 +7,214 @@ >=20 > #include "zlib_pmd_private.h" >=20 > -/** Parse comp xform and set private xform/stream parameters */ > +/** Compute next mbuf in the list, assign data buffer and length, > + * returns 0 if mbuf is NULL > + */ > +#define COMPUTE_BUF(mbuf, data, len) \ > + ((mbuf =3D mbuf->next) ? \ > + (data =3D rte_pktmbuf_mtod(mbuf, uint8_t *)), \ > + (len =3D rte_pktmbuf_data_len(mbuf)) : 0) > + > +static void > +process_zlib_deflate(struct rte_comp_op *op, z_stream *strm) { ... > + /* Update z_stream with the inputs provided by application */ > + strm->next_in =3D rte_pktmbuf_mtod_offset(mbuf_src, uint8_t *, > + op->src.offset); This is assuming that src buffer is a linear buffer or that offset won't be= large enough to cross boundaries between segments. If an SGL is passed and offset is bigger than the first segment, next_in sh= ould point at a different segment, with the remaining part of the offset in= that segment (look at ISA-L SGL patch: http://patches.dpdk.org/patch/43283/). Same appli= es to avail_in, next_out and avail_out. > + > + strm->avail_in =3D rte_pktmbuf_data_len(mbuf_src) - op->src.offset; > + > + strm->next_out =3D rte_pktmbuf_mtod_offset(mbuf_dst, uint8_t *, > + op->dst.offset); > + > + strm->avail_out =3D rte_pktmbuf_data_len(mbuf_dst) - op->dst.offset; > + ... > + strm->next_in =3D rte_pktmbuf_mtod_offset(mbuf_src, uint8_t *, > + op->src.offset); > + > + strm->avail_in =3D rte_pktmbuf_data_len(mbuf_src) - op->src.offset; > + > + strm->next_out =3D rte_pktmbuf_mtod_offset(mbuf_dst, uint8_t *, > + op->dst.offset); > + > + strm->avail_out =3D rte_pktmbuf_data_len(mbuf_dst) - op->dst.offset; Same comments as above (compression). ... > +static inline int > +process_zlib_op(struct zlib_qp *qp, struct rte_comp_op *op) { > + struct zlib_stream *stream; > + struct zlib_priv_xform *private_xform; > + > + if ((op->op_type =3D=3D RTE_COMP_OP_STATEFUL) || > + (op->src.offset > rte_pktmbuf_data_len(op->m_src)) || > + (op->dst.offset > rte_pktmbuf_data_len(op->m_dst))) { Since m_src and m_dst could be SGLs, pkt_len should be checked, instead of = data_len (which would be only for single segment). Also, you should check the length too, in case of source buffers (src.offse= t + src.length > m_src->pkt_len). Lastly, the two lines after the first if line should have double indentatio= n to distinguish clearly against the body of the if. If line is too long, consider storing the length of the buffers in variable= s. > + op->status =3D RTE_COMP_OP_STATUS_INVALID_ARGS; > + ZLIB_PMD_ERR("Invalid source or destination buffers or " > + "invalid Operation requested\n");