From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 99DE0A00BE; Mon, 13 Dec 2021 17:33:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 59FAA406A2; Mon, 13 Dec 2021 17:33:55 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id EFBF840042 for ; Mon, 13 Dec 2021 17:33:52 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1BD7iF2c026887; Mon, 13 Dec 2021 08:33:50 -0800 Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2173.outbound.protection.outlook.com [104.47.59.173]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3cx21khvcn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Dec 2021 08:33:49 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uj+EvJl8w/oXKy3veRgdM0n1GT3IHO6FEJlZUyz/mD4Z4Hbrk2IOUhthiiMcROgsz81cRlleyK6L57BzDPmUb9iTrzA0K5P0qdH9JuxrRVCs8bhnF8wAnYaNYsoYqXi2NAlruYzPuSqcGXjQU+o3VYyLAwTHjcD/qUV8wgNvo6OqVnBjK2TfFdCFtDLaJ6Pdd46Z6pJocFlC1ijG+kBaMlx+ZlhFMI5Ys55ejAy/P4jbeP0J8q0OYIEINHeutInYdxinXZmdeGi9Ru4mBVY5oAyVVZURQHsUsZC6o9WbiyGveTOxCYnHlKPx1qQlL+/LxBjJz0IArd6ptRfvKPwmqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XGJgbqshiwRJahgbVgRb/C9pswbMwCiz0tP3HLgB6tY=; b=kVdju+Ff0CrIyeygTk/PioDQi3818yL91gQ1CpV4v3Ta9M7YIjNzMS2nZgd4k7PlIYhneG834Swey00Wykjz3WKtWsb2P037vzGuUzNhqOGTTwLxLhkgiCLm2an0TH68rbrf7fKZpX6QOQMPpaUiBH8r2l1HmOPaSRbtkxB7Xg3iQ1X4xtYBtjMYT1BkNGBMruOcaBH9bRzmImQgH9JYn3gP00OThoT4qKDdA0N+FqUkUsEPBW3mS9HRSSGQwelrplFlkpte7lWyzp+uO3UtSeOsMzJ/ngtx6tx1+ncbNdOzn/9+U8IxzEneHUkU3RvMtag/jYp6EqGWpyJknV7GZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XGJgbqshiwRJahgbVgRb/C9pswbMwCiz0tP3HLgB6tY=; b=n3wk//o1+3k5gutu7mA0YWLJE1OhCFLOSKZP5AbaZtdgMhPTlN1I9vFASabllSHd0MGmCvQNRRjOKXUU8KgBiEWj/0Zih+pAF/vDQRRfXcogUOgRGcPlnrAeodflCmFl2SRoQZqwTPGSLVpwsaSsrLE4gP8Fv/UMUNq2mLAb9ys= Received: from PH0PR18MB4672.namprd18.prod.outlook.com (2603:10b6:510:c9::16) by PH0PR18MB4521.namprd18.prod.outlook.com (2603:10b6:510:e2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Mon, 13 Dec 2021 16:33:45 +0000 Received: from PH0PR18MB4672.namprd18.prod.outlook.com ([fe80::9490:685c:8235:9b93]) by PH0PR18MB4672.namprd18.prod.outlook.com ([fe80::9490:685c:8235:9b93%4]) with mapi id 15.20.4778.018; Mon, 13 Dec 2021 16:33:45 +0000 From: Anoob Joseph To: Ciara Power , "dev@dpdk.org" CC: "roy.fan.zhang@intel.com" , Akhil Goyal , Declan Doherty , Ankur Dwivedi , Tejasree Kondoj , John Griffin , Fiona Trahe , Deepak Kumar Jain , Ray Kinsella Subject: RE: [EXT] [PATCH] crypto: use single buffer for asymmetric session Thread-Topic: [EXT] [PATCH] crypto: use single buffer for asymmetric session Thread-Index: AQHX8DLBWojPVQzf0kSjSKVRmOoMYKwwl7tg Date: Mon, 13 Dec 2021 16:33:45 +0000 Message-ID: References: <20211213150402.3351032-1-ciara.power@intel.com> In-Reply-To: <20211213150402.3351032-1-ciara.power@intel.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e56e535a-b3be-4204-dad4-08d9be565523 x-ms-traffictypediagnostic: PH0PR18MB4521:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: gQ9+acBxyFzZLTk6tAUfslDXxWMpaJ+0kH5c4SOzvwgM4rxmZ7/LNU/1iS1+ZrQeWG9aWDtvjedVaL1DN2GIp9frfgP+C3F00RCLPjXFZJ2BO3xTSJgaMECKGLbx6aGtIeBbPK9QWY3N6cugQ5S5uN2N8tLRyPEmK3u19arGCSy3KVZWdLx0+2UDdImpUfUU9lRwHvswu5RXadIWfk8U1GKBgHKaRUsnvdx1lyvSWgLaX6qTmcd0srqxUAF4+1mHJWSBw0FqMm8z9scArvsSWqhct9sl6xYM64lO6RKMb3vp6PwCnlrbUBgStF/Kee7n9WbYdUmLG0jt2Io8/WzHVZP1dEMYyCaB3erW/Gsow8GIG5dAbyRTWrRjCMoi+sj/OZvrvNtsOZsvbIc2sSqKC/Py3RpBUvhI6Z4ssLFNQzyWH4+bdWcLbSDQ+TRuMXbNWC2Wtk59NnIB/9avvmDTikR26bhm7uqZkqxp58LdgKM4EeyQKkWer8/xARB+9/P+4jaTeae6p1d5JRG4SKsg1YM2SEBwBf4zEz3Ew69yaPUomwtSdrlzYA9gUo8GDRLU1vZiS2JIaUQD67CJB/Uh0rApDdWcqTEZHfh7pIAMp6YGDKBvCdjPAl1WF6VAjoAfKlN0PAjG2QUnlupbFe6tMPKn0ShjE7OEo/WLhvdo1E1eDXX/CvdYsmca5fw+SO2O+gCp5V9eArZjGn5q2GnlAQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR18MB4672.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(53546011)(6506007)(110136005)(71200400001)(54906003)(316002)(8936002)(66946007)(8676002)(33656002)(66476007)(508600001)(66556008)(66446008)(64756008)(26005)(186003)(76116006)(52536014)(4326008)(83380400001)(7696005)(38070700005)(5660300002)(38100700002)(2906002)(122000001)(9686003)(55016003)(86362001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?oZyNOQOvLemItBvbzSuah4XrEgdGyK9/bojmDqk1N/qoHmuhHUXgxanxbCIn?= =?us-ascii?Q?2EXrMCTwuVSEq1t354Zt5I5TZ4F3KHrE/qJ8OGI7DISb+unK4yIMlkkSqJVM?= =?us-ascii?Q?cIknofatk0b+OiKW+H/jdEpsJRW/zlVfpIfVIRUZT23hwjPi+u7DCGqp1dQA?= =?us-ascii?Q?fJLmlzvzIk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euAWfaPot?= =?us-ascii?Q?8U09ePSFcFh8qYU1M50r0/Kz4DKEcK6SKkNkRoHiTlqVW8kTk619Mh7Zoe8u?= =?us-ascii?Q?dDAi59++T5BJpDkhSi124u7kf7zkwe1nvfCGhzFa/laltMSvZpzpcxyBMpnR?= =?us-ascii?Q?dvAc3PijsxqgDn9VilL1MTgppLjPaXrpsMpBqMrL2MED/gFzQRh5ayEPRrGB?= =?us-ascii?Q?PlaUsPIipJJGSbxbPxKAZZsu0bmUhv2ndvnrj/m5mQyYZ3PcVEt46r3cbpZI?= =?us-ascii?Q?uwM0cUzLhwA6dZFM2OIJ3vxg4W7766E/C0tZIvH3nDmCts4VICC3sXmpg0N5?= =?us-ascii?Q?ZTvbX6I6MBuKbYZiADuLzNA++HOvgxrj92c+OsiJenZl6FleJ6SVSPYf4RMa?= =?us-ascii?Q?XyQVq+4XwOpwBkdTch916NNEN5JFA43TrzHdqCfhMpUlE4E5MX51iUe9RDy0?= =?us-ascii?Q?BtkjjO3rPme85ZIW1RVa/qAZpIpXspDv+An6qF6/o1iNojRcZLPoeu1Sv2r0?= =?us-ascii?Q?hwRxcEpbua5VaaiyhNRVIQcb4eghjgXQxhJkyFRJsh+usTiGZCk66sIB2gg8?= =?us-ascii?Q?p6Mvq4E/brqyYQglhwdxwow=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR18MB4672.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e56e535a-b3be-4204-dad4-08d9be565523 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Dec 2021 16:33:45.2794 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: XVICBIsIe1woYKM7xQTMZCnpY5vruC1GBa1l6E4vzNmghGEbISNoSAAptU2Gx0N/kNmPHIwZWe+FcJNgI8L7bQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR18MB4521 X-Proofpoint-GUID: cH9NCT-fVRSBSKpSMGwfk_0TsQWoV6rM X-Proofpoint-ORIG-GUID: cH9NCT-fVRSBSKpSMGwfk_0TsQWoV6rM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-13_08,2021-12-13_01,2021-12-02_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi Ciara, +1 to the overall approach. Few comments inline. Thanks, Anoob > -----Original Message----- > From: Ciara Power > Sent: Monday, December 13, 2021 8:34 PM > To: dev@dpdk.org > Cc: roy.fan.zhang@intel.com; Akhil Goyal ; Ciara > Power ; Declan Doherty > ; Ankur Dwivedi ; > Anoob Joseph ; Tejasree Kondoj > ; John Griffin ; Fiona > Trahe ; Deepak Kumar Jain > ; Ray Kinsella > Subject: [EXT] [PATCH] crypto: use single buffer for asymmetric session >=20 > External Email >=20 > ---------------------------------------------------------------------- > Rather than using a session buffer that contains pointers to private sess= ion > data elsewhere, have a single session buffer. > This session is created for a driver ID, and the mempool element contains > space for the max session private data needed for any driver. >=20 > Signed-off-by: Ciara Power >=20 > --- > Hiding the asym session structure by moving it to an internal header will= be > implemented in a later version of this patch. > --- > app/test-crypto-perf/cperf_ops.c | 14 +- > app/test/test_cryptodev_asym.c | 204 ++++-------------- > drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 6 +- > drivers/crypto/cnxk/cn9k_cryptodev_ops.c | 6 +- > drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 11 +- > drivers/crypto/octeontx/otx_cryptodev_ops.c | 29 +-- > drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 25 +-- > drivers/crypto/openssl/rte_openssl_pmd.c | 5 +- > drivers/crypto/openssl/rte_openssl_pmd_ops.c | 23 +- > drivers/crypto/qat/qat_asym.c | 35 +-- > lib/cryptodev/cryptodev_pmd.h | 11 +- > lib/cryptodev/cryptodev_trace_points.c | 3 + > lib/cryptodev/rte_cryptodev.c | 199 +++++++++++------ > lib/cryptodev/rte_cryptodev.h | 107 ++++++--- > lib/cryptodev/rte_cryptodev_trace.h | 12 ++ > lib/cryptodev/version.map | 6 +- > 16 files changed, 302 insertions(+), 394 deletions(-) >=20 [snip] > diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.= h > index 59ea5a54df..11a62bb555 100644 > --- a/lib/cryptodev/rte_cryptodev.h > +++ b/lib/cryptodev/rte_cryptodev.h > @@ -919,9 +919,15 @@ struct rte_cryptodev_sym_session { }; >=20 > /** Cryptodev asymmetric crypto session */ -struct > rte_cryptodev_asym_session { > - __extension__ void *sess_private_data[0]; > - /**< Private asymmetric session material */ > +__extension__ struct rte_cryptodev_asym_session { > + uint8_t driver_id; > + /**< Session driver ID. */ > + uint8_t max_priv_session_sz; > + /**< size of private session data used when creating mempool */ > + uint16_t user_data_sz; > + /**< session user data will be placed after sess_data */ > + uint8_t padding[4]; > + uint8_t sess_private_data[0]; > }; [Anoob] Should we add a uint64_t member to hold IOVA address of, may be, rt= e_cryptodev_asym_session()? IOVA address could be required for hardware PMD= s. And typically rte_mempool_virt2iova() used to help in that. Also, did yo= u consider whether this layout of crypto session can be kept uniform across= sym, asym & security? There is no asym specific field in this struct, righ= t? >=20 > /** > @@ -956,6 +962,31 @@ rte_cryptodev_sym_session_pool_create(const > char *name, uint32_t nb_elts, > uint32_t elt_size, uint32_t cache_size, uint16_t priv_size, > int socket_id); >=20 > +/** > + * Create an asymmetric session mempool. > + * > + * @param name > + * The unique mempool name. > + * @param nb_elts > + * The number of elements in the mempool. > + * @param cache_size > + * The number of per-lcore cache elements > + * @param user_data_size > + * The size of user data to be placed after session private data. > + * @param socket_id > + * The *socket_id* argument is the socket identifier in the case of > + * NUMA. The value can be *SOCKET_ID_ANY* if there is no NUMA > + * constraint for the reserved zone. > + * > + * @return > + * - On success return size of the session > + * - On failure returns 0 > + */ > +__rte_experimental > +struct rte_mempool * > +rte_cryptodev_asym_session_pool_create(const char *name, uint32_t > nb_elts, > + uint32_t cache_size, uint16_t user_data_size, int socket_id); > + > /** > * Create symmetric crypto session header (generic with no private data) > * > @@ -973,13 +1004,17 @@ rte_cryptodev_sym_session_create(struct > rte_mempool *mempool); > * > * @param mempool mempool to allocate asymmetric session > * objects from > + * @param dev_id ID of device that we want the session to be used on > + * @param xforms Asymmetric crypto transform operations to apply on > flow > + * processed with this session > * @return > * - On success return pointer to asym-session > * - On failure returns NULL > */ > __rte_experimental > struct rte_cryptodev_asym_session * > -rte_cryptodev_asym_session_create(struct rte_mempool *mempool); > +rte_cryptodev_asym_session_create(struct rte_mempool *mempool, > + uint8_t dev_id, struct rte_crypto_asym_xform *xforms); >=20 > /** > * Frees symmetric crypto session header, after checking that all @@ - > 1034,28 +1069,6 @@ rte_cryptodev_sym_session_init(uint8_t dev_id, > struct rte_crypto_sym_xform *xforms, > struct rte_mempool *mempool); >=20 > -/** > - * Initialize asymmetric session on a device with specific asymmetric xf= orm > - * > - * @param dev_id ID of device that we want the session to be used on > - * @param sess Session to be set up on a device > - * @param xforms Asymmetric crypto transform operations to apply on > flow > - * processed with this session > - * @param mempool Mempool to be used for internal allocation. > - * > - * @return > - * - On success, zero. > - * - -EINVAL if input parameters are invalid. > - * - -ENOTSUP if crypto device does not support the crypto transform. [Anoob] API rte_cryptodev_asym_session_create() returning NULL is treated a= s an error. But error can be either due to -EINVAL/-ENOMEM/-ENOTSUP, in whi= ch -ENOTSUP is typically used by PMD to declare unsupported combinations of= xforms. Should we clarify this in the API description?=20 Also, none of rte_cryptodev_asym_session_create() calls in validation tests= consider the API returning NULL due to -ENOTSUP. For sym crypto test cases= , API returning -ENOTSUP was used to skip the test. Can you update the test= s such that returning NULL would mean test is skipped? Agreed that current = code also doesn't handle -ENOTSUP case returned by init API. =20 > - * - -ENOMEM if the private session could not be allocated. > - */ > -__rte_experimental > -int > -rte_cryptodev_asym_session_init(uint8_t dev_id, > - struct rte_cryptodev_asym_session *sess, > - struct rte_crypto_asym_xform *xforms, > - struct rte_mempool *mempool); > - > /** > * Frees private data for the device id, based on its device type, > * returning it to its mempool. It is the application's responsibility @= @ - > 1075,14 +1088,13 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id, > struct rte_cryptodev_sym_session *sess); >=20 [snip] > diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map index > c50745fa8c..00b1c9ae35 100644 > --- a/lib/cryptodev/version.map > +++ b/lib/cryptodev/version.map > @@ -58,7 +58,6 @@ EXPERIMENTAL { > rte_cryptodev_asym_session_clear; > rte_cryptodev_asym_session_create; > rte_cryptodev_asym_session_free; > - rte_cryptodev_asym_session_init; > rte_cryptodev_asym_xform_capability_check_modlen; > rte_cryptodev_asym_xform_capability_check_optype; > rte_cryptodev_sym_cpu_crypto_process; > @@ -104,6 +103,11 @@ EXPERIMENTAL { > rte_cryptodev_remove_deq_callback; > rte_cryptodev_remove_enq_callback; >=20 > + # added 22.03 +1 for get & set user_data API. Ideally it should have been a separate seri= es but I agree that it's better getting addressed along with the session re= work. > + rte_cryptodev_asym_session_pool_create; > + rte_cryptodev_asym_session_get_user_data; > + rte_cryptodev_asym_session_set_user_data; > + __rte_cryptodev_trace_asym_session_pool_create; > }; >=20 > INTERNAL { > -- > 2.25.1