From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 506181B449 for ; Tue, 26 Jun 2018 11:20:33 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jun 2018 02:20:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,274,1526367600"; d="scan'208";a="67784693" Received: from irsmsx110.ger.corp.intel.com ([163.33.3.25]) by orsmga001.jf.intel.com with ESMTP; 26 Jun 2018 02:20:13 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.139]) by irsmsx110.ger.corp.intel.com ([169.254.15.152]) with mapi id 14.03.0319.002; Tue, 26 Jun 2018 10:20:12 +0100 From: "De Lara Guarch, Pablo" To: Shally Verma CC: "Trahe, Fiona" , "akhil.goyal@nxp.com" , "dev@dpdk.org" , "pathreya@caviumnetworks.com" , Sunila Sahu , Ashish Gupta Thread-Topic: [PATCH v3 2/6] lib/cryptodev: add asym op support in cryptodev Thread-Index: AQHT7Nv/6wi8085iwkqygU+t7M2ANqRygwAg Date: Tue, 26 Jun 2018 09:20:11 +0000 Message-ID: References: <1526450713-17299-1-git-send-email-shally.verma@caviumnetworks.com> <1526450713-17299-3-git-send-email-shally.verma@caviumnetworks.com> In-Reply-To: <1526450713-17299-3-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMGQ3NGE2Y2ItMDhiNi00ODY1LThmNTAtZjRhYTBjOGY5MzIzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoic2llRHZhUzNjaUd4Zzd3SEZLbDRCclwvemE5c21iMVFheHo2SW5TR1ZVWmRwUXVyM3JsWDFrUkRsT3ZxRFl0dzIifQ== 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 2/6] lib/cryptodev: add asym op support in cryptodev 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, 26 Jun 2018 09:20:33 -0000 Hi Shally, > -----Original Message----- > From: Shally Verma [mailto:shally.verma@caviumnetworks.com] > Sent: Wednesday, May 16, 2018 7:05 AM > To: De Lara Guarch, Pablo > Cc: Trahe, Fiona ; akhil.goyal@nxp.com; > dev@dpdk.org; pathreya@caviumnetworks.com; Sunila Sahu > ; Ashish Gupta > > Subject: [PATCH v3 2/6] lib/cryptodev: add asym op support in cryptodev >=20 > Extend DPDK librte_cryptodev to: > - define asym op type in rte_crypto_op_type and associated > op pool create/alloc APIs > - define asym session and associated session APIs >=20 > If PMD shows in its feature flag that it supports both sym and asym then = it must > support those on all its qps. >=20 > Changes from v2: > - added rte_cryptodev_asym_session_set/get_private_data for app to setup > private data in a session as per latest dpdk-next-crypto spec > - rename rte_cryptodev_get_asym_session_private_size to be consistent wit= h > other API names > - correct rte_cryptodev_asym_session_create to pass void** to > rte_mempool_get() and add for private_data_size flag >=20 > Changes from v1 > - resolve new line error in librte_cryptodev/rte_cryptodev_version.ma= p >=20 > Signed-off-by: Shally Verma > Signed-off-by: Sunila Sahu > Signed-off-by: Ashish Gupta ... > +int __rte_experimental > +rte_cryptodev_asym_session_init(uint8_t dev_id, > + struct rte_cryptodev_asym_session *sess, > + struct rte_crypto_asym_xform *xforms, > + struct rte_mempool *mp) > +{ > + struct rte_cryptodev *dev; > + uint8_t index; > + int ret; > + > + dev =3D rte_cryptodev_pmd_get_dev(dev_id); > + > + if (sess =3D=3D NULL || xforms =3D=3D NULL || dev =3D=3D NULL) > + return -EINVAL; > + > + index =3D dev->driver_id; > + Check if asym_session_configure is implemented in the device, like this: RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->asym_session_configure, -ENOTSUP); This way, there won't be a segmentation fault when using a device that does not support asymmetric operations. > + if (sess->sess_private_data[index] =3D=3D NULL) { > + ret =3D dev->dev_ops->asym_session_configure(dev, > + xforms, > + sess, mp); > + if (ret < 0) { > + CDEV_LOG_ERR( > + "dev_id %d failed to configure session details", > + dev_id); > + return ret; ... > +int __rte_experimental > +rte_cryptodev_asym_session_clear(uint8_t dev_id, > + struct rte_cryptodev_asym_session *sess) { > + struct rte_cryptodev *dev; > + > + dev =3D rte_cryptodev_pmd_get_dev(dev_id); > + > + if (dev =3D=3D NULL || sess =3D=3D NULL) > + return -EINVAL; > + Same as above, add the following. RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->asym_session_clear, -ENOTSUP); > + dev->dev_ops->asym_session_clear(dev, sess); > + > + return 0; > +} I will send a patch doing the same for symmetric. Pablo