From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 064E6374 for ; Tue, 24 Apr 2018 11:56:10 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2018 02:56:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,322,1520924400"; d="scan'208";a="45613573" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by orsmga003.jf.intel.com with ESMTP; 24 Apr 2018 02:56:09 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.155]) by IRSMSX106.ger.corp.intel.com ([169.254.8.37]) with mapi id 14.03.0319.002; Tue, 24 Apr 2018 10:56:08 +0100 From: "De Lara Guarch, Pablo" To: "Daly, Lee" , "dev@dpdk.org" CC: "Tucker, Greg B" , "Jain, Deepak K" , "Trahe, Fiona" Thread-Topic: [PATCH v3 05/11] compress/isal: add queue pair related ops Thread-Index: AQHT1lEKHOQjC3ImB0WgiOpSmkHVsaQPtxOA Date: Tue, 24 Apr 2018 09:56:07 +0000 Message-ID: References: <1523038388-29964-1-git-send-email-lee.daly@intel.com> <1523972132-6894-1-git-send-email-lee.daly@intel.com> <1523972132-6894-6-git-send-email-lee.daly@intel.com> In-Reply-To: <1523972132-6894-6-git-send-email-lee.daly@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZWEyMmE4MjgtODE3Yy00ZTFiLThkNWMtYWRiZGQ2ZThkOGViIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6InJ2cTBQc3lyTWlZRWdSR0VzZ0tSNkZHVFFWTW1sSXQ4ZDdkU1RuRzNpVzA9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 05/11] compress/isal: add queue pair related ops 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: Tue, 24 Apr 2018 09:56:11 -0000 > -----Original Message----- > From: Daly, Lee > Sent: Tuesday, April 17, 2018 2:35 PM > To: dev@dpdk.org > Cc: De Lara Guarch, Pablo ; Tucker, Greg = B > ; Jain, Deepak K ; Trah= e, > Fiona ; Daly, Lee > Subject: [PATCH v3 05/11] compress/isal: add queue pair related ops >=20 > Signed-off-by: Lee Daly > --- > drivers/compress/isal/isal_compress_pmd_ops.c | 110 > +++++++++++++++++++++- > drivers/compress/isal/isal_compress_pmd_private.h | 2 + > 2 files changed, 110 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/compress/isal/isal_compress_pmd_ops.c > b/drivers/compress/isal/isal_compress_pmd_ops.c > index 2e9381d..73e4c84 100644 > --- a/drivers/compress/isal/isal_compress_pmd_ops.c > +++ b/drivers/compress/isal/isal_compress_pmd_ops.c > @@ -4,6 +4,7 @@ >=20 > #include > #include > +#include >=20 > #include "isal_compress_pmd_private.h" >=20 > @@ -102,6 +103,111 @@ isal_comp_pmd_info_get(struct rte_compressdev > *dev __rte_unused, > } > } >=20 > + > +/** Release queue pair */ > +static int > +isal_comp_pmd_qp_release(struct rte_compressdev *dev, uint16_t qp_id) { > +struct isal_comp_qp *qp =3D dev->data->queue_pairs[qp_id]; > + > + if (qp =3D=3D NULL) > + return -EINVAL; > + > + if (dev->data->queue_pairs[qp_id] !=3D NULL) > + rte_free(dev->data->queue_pairs[qp_id]); > + > + return 0; > +} > + > +/** Create a ring to place process packets on */ static struct rte_ring > +* isal_comp_pmd_qp_create_processed_pkts_ring(struct isal_comp_qp *qp, > + unsigned int ring_size, int socket_id) { > + struct rte_ring *r; > + > + r =3D rte_ring_lookup(qp->name); > + if (r) { > + if (rte_ring_get_size(r) >=3D ring_size) { > + ISAL_PMD_LOG(DEBUG, > + "Reusing existing ring %s for processed > packets", > + qp->name); > + return r; > + } > + > + ISAL_PMD_LOG(ERR, > + "Unable to reuse existing ring %s for > processed packets", Remove one tab here, as the line is too long. > + qp->name); > + return NULL; > + } > + > + return rte_ring_create(qp->name, ring_size, socket_id, > + RING_F_SP_ENQ | RING_F_SC_DEQ); > +} > + > +/** set a unique name for the queue pair based on it's name, dev_id and "its" > +qp_id */ static int isal_comp_pmd_qp_set_unique_name(struct > +rte_compressdev *dev, struct isal_comp_qp *qp) { > + unsigned int n =3D snprintf(qp->name, sizeof(qp->name), > + "isal_compression_pmd_%u_qp_%u", > + dev->data->dev_id, qp->id); Better to use strlcpy. > + > + if (n >=3D sizeof(qp->name)) > + return -1; > + > + return 0; > +}