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 464F6A0548; Mon, 30 Aug 2021 22:07:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 02149410F7; Mon, 30 Aug 2021 22:07:44 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 9B695410ED for ; Mon, 30 Aug 2021 22:07:42 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10092"; a="240584487" X-IronPort-AV: E=Sophos;i="5.84,364,1620716400"; d="scan'208";a="240584487" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2021 13:07:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,364,1620716400"; d="scan'208";a="445841918" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga002.jf.intel.com with ESMTP; 30 Aug 2021 13:07:41 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Mon, 30 Aug 2021 13:07:40 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Mon, 30 Aug 2021 13:07:40 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Mon, 30 Aug 2021 13:07:40 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.49) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Mon, 30 Aug 2021 13:07:40 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mOsw8pshpyyeU3F6Ikuz5kXUjsjGknmiW/nIIEfv8TlM5B7upy4nd5ea8o1HcgbHSUoF3dqErMZHxj9ZZYrZPptD3ccX48tW/SKjTSh+nKK3LVgM+ycsDu/4ZdirUA++YXC4KIoNsiBg8tZc9iYMUP/Ir7nAxZ+3ehW3QHFz2W1iR5J40OkwwUdB8cdc4MPbxQgrNkDO++zbmkScZhjEJVedvaoTkYfzHiiarkV8xBz5Fz2a7Bl4EM8QfQzKhLYCViM7BdSfYGL0rvk5D3hqAsGt5YgSNn6Rtan/MDa6bfngOAX4OLFvmlPhqYhgYnSbdt8PoNM1vPZ7IrABtYwVpg== 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-SenderADCheck; bh=jCr8qPtxjO2tGdhiOqrEMkMcPWLbbu0NARlOH14MuUY=; b=NbCEoZHZ4ppJNBfftX8xGgQ9UG2BKZSe5g0PV2PZYCsYMX4qek7q2KpIBsBVwnRnHTtTOl72KvYIKZOrEmdZwd0Z/kri58K6Np4ltvkxq0sHXd8wpMr5OJ44kTTU6UyScNAw8JI043aq8MNat7xN++uzD9uxVOEjW1CrV8SKCFSx98oV125H4hYwyFqgbchJir2Rb9SZx9LeumT0FtzfWzqWdCXTdpHzvLHJ7lrdzkHvxFjkIuX5LlffnaiI79xdSh08Zj8o9XvZ58oO58XChQSZfRec0oV+JcjB2U7FPR1/HBkWWk5TcmeKKeBeH3ColWV/YKxrlYE49iBk8q4u4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jCr8qPtxjO2tGdhiOqrEMkMcPWLbbu0NARlOH14MuUY=; b=Xa575/Rv5HoRNXa8VTrHm0NkWiiVYYaxQtlG1MrDnkhPQprgPgZfuYbEQ6dDZ0zSb4b+N99Z5vce1QsQ3yMJo7v8pLb6i9HS1h7IodsALwPD71bTgMiiAk8aSpYCZej5jMxxe1LDJ3smazaAoC3nHataoEOGIBu5LE6/IHu6ErA= Received: from BL0PR11MB3043.namprd11.prod.outlook.com (2603:10b6:208:33::19) by BL1PR11MB5304.namprd11.prod.outlook.com (2603:10b6:208:316::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.19; Mon, 30 Aug 2021 20:07:38 +0000 Received: from BL0PR11MB3043.namprd11.prod.outlook.com ([fe80::3ca9:5da5:8b6e:ad0e]) by BL0PR11MB3043.namprd11.prod.outlook.com ([fe80::3ca9:5da5:8b6e:ad0e%5]) with mapi id 15.20.4457.024; Mon, 30 Aug 2021 20:07:38 +0000 From: "Zhang, Roy Fan" To: Akhil Goyal , "dev@dpdk.org" CC: "anoobj@marvell.com" , "Nicolau, Radu" , "Doherty, Declan" , "hemant.agrawal@nxp.com" , "matan@nvidia.com" , "Ananyev, Konstantin" , "thomas@monjalon.net" , "asomalap@amd.com" , "ruifeng.wang@arm.com" , "ajit.khaparde@broadcom.com" , "De Lara Guarch, Pablo" , "Trahe, Fiona" , "adwivedi@marvell.com" , "michaelsh@marvell.com" , "rnagadheeraj@marvell.com" , "jianjay.zhou@huawei.com" , "jerinj@marvell.com" Thread-Topic: [PATCH 3/8] cryptodev: add helper functions for new datapath interface Thread-Index: AQHXnNS3jbiciyghn0+8Hme1qQCzVKuMdEoA Date: Mon, 30 Aug 2021 20:07:38 +0000 Message-ID: References: <20210829125139.2173235-1-gakhil@marvell.com> <20210829125139.2173235-4-gakhil@marvell.com> In-Reply-To: <20210829125139.2173235-4-gakhil@marvell.com> Accept-Language: zh-Hans-HK, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.0.76 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: marvell.com; dkim=none (message not signed) header.d=none;marvell.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: dbe11efe-fc40-43aa-7bd5-08d96bf1d118 x-ms-traffictypediagnostic: BL1PR11MB5304: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WhKVz7qRXdcYJ6cspmTG7aWn08qRZv3+Nnt18076hIB4f34i3b4b2J1cgYqQ+AgaenFQGr9RqcQFBCxyTdk7aA8CJu7OLAOdrgsI1MzszDGX/tM/mh0bOG5mZskm+Ddud2HmgxmX+NP9pn5RIsn6CdLr4bsB5GrVhTt0IO9xFRDg9DxsDhX96XNXQH7aeNs0tS3UxFM59bTukhKcBMeqaa8DTI4P3XNgXYUhm38i4lDmFgxfd9OsnLSzA3lrGbu/Kloky+VLU3rad7lLzf5pU32q5RpTtPZ2kJn03pcOLx6z8AD6OweAVOs4/1Qb4jDR0XFQPdzcOp7aIKlVrTHgkMPSsgFa8ZGCWmS1fX96SFdPSo0mjgfCjaUTAfKgB3YY87gE0NwJ8HPCvkTF0ZKH+D7lXkicuzIoJqG/RCIk2F34zQWTgOrJRLhOqBIQ0JatqfwV/+Iet0R5YSn704bJP5kS3uqRdYYVpEC1AZ22B9CpBYMbNEQWgPxnMt9dYq/xDg43+JfefZN8RDNMBT7EOU78BTvmS/XSbmb0ETBENtwrthUuK2QAq4hcA+7zgeKZc7zu3Mz/iUPfNGuj1dXIiRb4FL7uBsyc57kXgTzBZ9QmocDPUkzIIxoIoOKYglSR9wvZZfX2PoF5z01cJenmtFmqJJGM8Dwd8vm4H8DvhDY3+nAbFE8dKXjq8w1wfx66H0wLGb9UTSKY1vOZ0MXFAA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BL0PR11MB3043.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(376002)(366004)(396003)(39860400002)(38070700005)(86362001)(8936002)(8676002)(316002)(478600001)(7416002)(122000001)(38100700002)(71200400001)(53546011)(7696005)(2906002)(6506007)(33656002)(5660300002)(4326008)(9686003)(54906003)(110136005)(30864003)(55016002)(83380400001)(52536014)(76116006)(66556008)(186003)(66946007)(64756008)(66446008)(66476007); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?hsFJngzbzFrCNyOCHBJYr6tKlKPVv0IZjmjy/0JGXNuscud5NLjo4024?= =?Windows-1252?Q?Yci38JBk73BAAYrBRA6L3jUe2VATLA4aHhEPdaT+2nAlHmWtvpTZ7iQI?= =?Windows-1252?Q?VHCMI+Mg+UXcVoZeajFBLzo6k0HBjakcu6EHuiSYX8yzO+MMQJCTdN5Y?= =?Windows-1252?Q?8YPOto4E10E6zQ6Uzp66+fezhmzbi3MfbseeB8wAaQRmgBE1ag8rqJKO?= =?Windows-1252?Q?mVp6Bsjt6/S4+nRljZ/kDkNXlEJoPCmwMAvYurE+l/7tdfjDP81TcCRw?= =?Windows-1252?Q?GEY0qkmri50u1AGBz5SVzodABb3lrP0w6oII9A46+gLyHP9ZiMiBvnkP?= =?Windows-1252?Q?o8VEOV6O/ZlcXni6DMtuwZRwI3B4O4FjlVH5Z3yiYX8YFxrpfArsJpMp?= =?Windows-1252?Q?BSJ/Bgurkbtx+EpyiaqR8L/StGW8zIzCytOiBhzlfys9D+5Qpy9tr1eT?= =?Windows-1252?Q?3KRxSWaot+LbtiTFQh5PGhWadiB8etuEnoLZy4bN6MPozx0zx3GRKOE2?= =?Windows-1252?Q?I7sGLS0DXI+gzTHM0dV7GlEX7X2ynUV07QjUb1BXtr0e3Iadsxdoylbh?= =?Windows-1252?Q?PjqLvxciyqUEIxp/G6kfaB55bm7rDDx0h72Zlft0mfk+D4WkIOvYbml5?= =?Windows-1252?Q?oOdOwZEyORVVlXHeYqtCrrb6At2nkyePN/fLZCFH4pcJ/KPcq5Uld7q6?= =?Windows-1252?Q?W6bzyEEU8k6LN11ECQT1vvSJyE6aP61VXt3usb8+xDEaL+oe/fvY+x2U?= =?Windows-1252?Q?Q2A3XRv2w4IzD0BNzqb+aTz++N6zUxRZRzv8UJHmUC9ibZ5HB7mjBfDx?= =?Windows-1252?Q?eRjCkpAAXZ9Fd+Ch47y4s7Pa3E9RufY5WS8qytMV4Y3TG5g+wWANuwdN?= =?Windows-1252?Q?PkGzwICWEmoVfgibK8QMmpJBE+byJNKOeGaG+hlDphoc4Quwxui5b3m6?= =?Windows-1252?Q?ssgSx56uPmktD2Ze2URMTHWYdBGjiErlbWpEVz7xmuEz4SehNpy8Qy44?= =?Windows-1252?Q?1J2fuEyVPOgudhZDd9DAHFwGVLOcQ1XBORXxBOuAwRiKf99qsJ9AmSqy?= =?Windows-1252?Q?KvJ3Oz/QZCnq3m3JVLADPZzQblvseqRfSf+D1k780lQDl5+ND17pGAYY?= =?Windows-1252?Q?U+NT2oU3LF2dlcp/2uv8GupJ+J6+i2Qct18pywYE6hQhO3hb08sfYVt1?= =?Windows-1252?Q?ARC5f85uecDC7amBIFh+VwXbLkMqTk4yN+64KoAwyG9JMxNto3x9hy52?= =?Windows-1252?Q?lXTEZnrfAIX2oRP7Y6+nvV3IKolhYe/xhmn3WQQXSkITrK94TgiG6y0U?= =?Windows-1252?Q?bdRKLsMte1hHvwApYvceGd1npFWBwk0vblgz3fzHXMadYEXtIXox8Pf3?= =?Windows-1252?Q?2IAvMzV1/V0nTab2HjwmQKrMHL1zcq0RUw0iuzGi58TOzRaG24wWyYeO?= =?Windows-1252?Q?mpprYlMFX7FL3Qn5LGZ0VrEre0H19xKjmkFZDBIR5sE1wiz65nqKXPWF?= =?Windows-1252?Q?QBpPQF+l?= Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BL0PR11MB3043.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbe11efe-fc40-43aa-7bd5-08d96bf1d118 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Aug 2021 20:07:38.7010 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 57CIBdaTdEN2XOcS6M0/qJ6OTzBke1Q8ZL4q9ds6DJ5uhtnWELLwGQqffj6F7sszEyHbKGxbLPoSngDOdfFtTA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR11MB5304 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 3/8] cryptodev: add helper functions for new datapath interface 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 Sender: "dev" Hi Akhil, > -----Original Message----- > From: Akhil Goyal > Sent: Sunday, August 29, 2021 1:52 PM > To: dev@dpdk.org > Cc: anoobj@marvell.com; Nicolau, Radu ; Doherty, > Declan ; hemant.agrawal@nxp.com; > matan@nvidia.com; Ananyev, Konstantin ; > thomas@monjalon.net; Zhang, Roy Fan ; > asomalap@amd.com; ruifeng.wang@arm.com; > ajit.khaparde@broadcom.com; De Lara Guarch, Pablo > ; Trahe, Fiona ; > adwivedi@marvell.com; michaelsh@marvell.com; > rnagadheeraj@marvell.com; jianjay.zhou@huawei.com; jerinj@marvell.com; > Akhil Goyal > Subject: [PATCH 3/8] cryptodev: add helper functions for new datapath > interface >=20 > Add helper functions and macros to help drivers to > transition to new datapath interface. >=20 > Signed-off-by: Akhil Goyal > --- > lib/cryptodev/cryptodev_pmd.h | 246 > ++++++++++++++++++++++++++++++++++ > lib/cryptodev/rte_cryptodev.c | 40 +++++- > lib/cryptodev/version.map | 4 + > 3 files changed, 289 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/cryptodev/cryptodev_pmd.h > b/lib/cryptodev/cryptodev_pmd.h > index eeaea13a23..d40e5cee94 100644 > --- a/lib/cryptodev/cryptodev_pmd.h > +++ b/lib/cryptodev/cryptodev_pmd.h > @@ -70,6 +70,13 @@ struct cryptodev_driver { > const struct rte_driver *driver; > uint8_t id; > }; > +/** > + * @internal > + * The pool of *rte_cryptodev* structures. The size of the pool > + * is configured at compile-time in the file. > + */ > +extern struct rte_cryptodev rte_crypto_devices[]; > + >=20 > /** > * Get the rte_cryptodev structure device pointer for the device. Assume= s a > @@ -529,6 +536,245 @@ __rte_internal > void > rte_cryptodev_api_reset(struct rte_cryptodev_api *api); >=20 > +/** > + * @internal > + * Helper routine for cryptodev_dequeue_burst. > + * Should be called as first thing on entrance to the PMD's > + * rte_cryptodev_dequeue_burst implementation. > + * Does necessary checks and returns pointer to cryptodev identifier. > + * > + * @param dev_id > + * The device identifier of the crypto device. > + * @param qp_id > + * The index of the queue pair from which processed crypto ops will > + * be dequeued. > + * > + * @return > + * Pointer to device queue pair on success or NULL otherwise. > + */ > +__rte_internal > +static inline void * > +_rte_cryptodev_dequeue_prolog(uint8_t dev_id, uint8_t qp_id) > +{ > + struct rte_cryptodev *dev =3D &rte_cryptodevs[dev_id]; > + > + return dev->data->queue_pairs[qp_id]; > +} =20 [Fan: the function name looks unclear to me - maybe=20 rte_cryptodev_dequeue_prepare? Also the function didn't do any check as the description suggested - the=20 qp is later checked in _RTE_CRYPTO_DEQ_DEF, maybe remove the description?] > + > +/** > + * @internal > + * Helper routine for crypto driver dequeue API. > + * Should be called at exit from PMD's rte_cryptodev_dequeue_burst > + * implementation. > + * Does necessary post-processing - invokes RX callbacks if any, tracing= , etc. > + * > + * @param dev_id > + * The device identifier of the Crypto device. > + * @param qp_id > + * The index of the queue pair from which to retrieve input crypto_ops. > + * @param ops > + * The address of an array of pointers to *rte_crypto_op* structures t= hat > + * have been retrieved from the device. > + * @param nb_ops > + * The number of ops that were retrieved from the device. > + * > + * @return > + * The number of crypto ops effectively supplied to the *ops* array. > + */ > +__rte_internal > +static inline uint16_t > +_rte_cryptodev_dequeue_epilog(uint16_t dev_id, uint16_t qp_id, > + struct rte_crypto_op **ops, uint16_t nb_ops) > +{ > +#ifdef RTE_CRYPTO_CALLBACKS > + struct rte_cryptodev *dev =3D &rte_cryptodevs[dev_id]; > + > + if (unlikely(dev->deq_cbs !=3D NULL)) { > + struct rte_cryptodev_cb_rcu *list; > + struct rte_cryptodev_cb *cb; > + > + /* __ATOMIC_RELEASE memory order was used when the > + * call back was inserted into the list. > + * Since there is a clear dependency between loading > + * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory > order is > + * not required. > + */ > + list =3D &dev->deq_cbs[qp_id]; > + rte_rcu_qsbr_thread_online(list->qsbr, 0); > + cb =3D __atomic_load_n(&list->next, __ATOMIC_RELAXED); > + > + while (cb !=3D NULL) { > + nb_ops =3D cb->fn(dev_id, qp_id, ops, nb_ops, > + cb->arg); > + cb =3D cb->next; > + }; > + > + rte_rcu_qsbr_thread_offline(list->qsbr, 0); > + } > +#endif > + > + return nb_ops; > +} [Fan: same naming issue - maybe rte_cryptodev_dequeue_post, so as the enqueue part] > +#define _RTE_CRYPTO_DEQ_FUNC(fn) _rte_crypto_deq_##fn > + > +/** > + * @internal > + * Helper macro to create new API wrappers for existing PMD dequeue > functions. > + */ > +#define _RTE_CRYPTO_DEQ_PROTO(fn) \ > + uint16_t _RTE_CRYPTO_DEQ_FUNC(fn)(uint8_t dev_id, uint8_t > qp_id, \ > + struct rte_crypto_op **ops, uint16_t nb_ops) > + > +/** > + * @internal > + * Helper macro to create new API wrappers for existing PMD dequeue > functions. > + */ > +#define _RTE_CRYPTO_DEQ_DEF(fn) \ > +_RTE_CRYPTO_DEQ_PROTO(fn) \ > +{ \ > + void *qp =3D _rte_cryptodev_dequeue_prolog(dev_id, qp_id); \ > + if (qp =3D=3D NULL) \ [Fan: suggest to add "unlikely" above]=20 > + return 0; \ > + nb_ops =3D fn(qp, ops, nb_ops); \ > + return _rte_cryptodev_dequeue_epilog(dev_id, qp_id, ops, > nb_ops); \ > +} > + > +/** > + * @internal > + * Helper routine for cryptodev_enqueue_burst. > + * Should be called as first thing on entrance to the PMD's > + * rte_cryptodev_enqueue_burst implementation. > + * Does necessary checks and returns pointer to cryptodev queue pair. > + * > + * @param dev_id > + * The device identifier of the crypto device. > + * @param qp_id > + * The index of the queue pair in which packets will be enqueued. > + * @param ops > + * The address of an array of pointers to *rte_crypto_op* structures t= hat > + * will be enqueued to the device. > + * @param nb_ops > + * The number of ops that will be sent to the device. > + * > + * @return > + * Pointer to device queue pair on success or NULL otherwise. > + */ > +__rte_internal > +static inline void * > +_rte_cryptodev_enqueue_prolog(uint8_t dev_id, uint8_t qp_id, > + struct rte_crypto_op **ops, uint16_t nb_ops) > +{ > + struct rte_cryptodev *dev =3D &rte_cryptodevs[dev_id]; > + > +#ifdef RTE_CRYPTO_CALLBACKS > + if (unlikely(dev->enq_cbs !=3D NULL)) { > + struct rte_cryptodev_cb_rcu *list; > + struct rte_cryptodev_cb *cb; > + > + /* __ATOMIC_RELEASE memory order was used when the > + * call back was inserted into the list. > + * Since there is a clear dependency between loading > + * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory > order is > + * not required. > + */ > + list =3D &dev->enq_cbs[qp_id]; > + rte_rcu_qsbr_thread_online(list->qsbr, 0); > + cb =3D __atomic_load_n(&list->next, __ATOMIC_RELAXED); > + > + while (cb !=3D NULL) { > + nb_ops =3D cb->fn(dev_id, qp_id, ops, nb_ops, > + cb->arg); > + cb =3D cb->next; > + }; > + > + rte_rcu_qsbr_thread_offline(list->qsbr, 0); > + } > +#endif > + return dev->data->queue_pairs[qp_id]; > +} > + > +#define _RTE_CRYPTO_ENQ_FUNC(fn) _rte_crypto_enq_##fn > + > +/** > + * @internal > + * Helper macro to create new API wrappers for existing PMD enqueue > functions. > + */ > +#define _RTE_CRYPTO_ENQ_PROTO(fn) \ > + uint16_t _RTE_CRYPTO_ENQ_FUNC(fn)(uint8_t dev_id, uint8_t > qp_id, \ > + struct rte_crypto_op **ops, uint16_t nb_ops) > + > +/** > + * @internal > + * Helper macro to create new API wrappers for existing PMD enqueue > functions. > + */ > +#define _RTE_CRYPTO_ENQ_DEF(fn) \ > +_RTE_CRYPTO_ENQ_PROTO(fn) \ > +{ \ > + void *qp =3D _rte_cryptodev_enqueue_prolog(dev_id, qp_id, ops, > nb_ops); \ > + if (qp =3D=3D NULL) \ > + return 0; \ > + return fn(qp, ops, nb_ops); \ > +} > + > +/** > + * @internal > + * Helper routine to get enqueue burst function of a given device. > + * > + * @param dev_id > + * The device identifier of the Crypto device. > + * > + * @return > + * The function if valid else NULL > + */ > +__rte_internal > +rte_crypto_enqueue_burst_t > +rte_crypto_get_enq_burst_fn(uint8_t dev_id); > + > +/** > + * @internal > + * Helper routine to get dequeue burst function of a given device. > + * > + * @param dev_id > + * The device identifier of the Crypto device. > + * > + * @return > + * The function if valid else NULL > + */ > +__rte_internal > +rte_crypto_dequeue_burst_t > +rte_crypto_get_deq_burst_fn(uint8_t dev_id); > + > +/** > + * @internal > + * Helper routine to set enqueue burst function of a given device. > + * > + * @param dev_id > + * The device identifier of the Crypto device. > + * > + * @return > + * 0 Success. > + * -EINVAL Failure if dev_id or fn are in-valid. > + */ > +__rte_internal > +int > +rte_crypto_set_enq_burst_fn(uint8_t dev_id, > rte_crypto_enqueue_burst_t fn); > + > +/** > + * @internal > + * Helper routine to set dequeue burst function of a given device. > + * > + * @param dev_id > + * The device identifier of the Crypto device. > + * > + * @return > + * 0 Success. > + * -EINVAL Failure if dev_id or fn are in-valid. > + */ > +__rte_internal > +int > +rte_crypto_set_deq_burst_fn(uint8_t dev_id, > rte_crypto_dequeue_burst_t fn); > + > + > static inline void * > get_sym_session_private_data(const struct rte_cryptodev_sym_session > *sess, > uint8_t driver_id) { > diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.= c > index 26f8390668..4ab82d21d0 100644 > --- a/lib/cryptodev/rte_cryptodev.c > +++ b/lib/cryptodev/rte_cryptodev.c > @@ -44,7 +44,7 @@ >=20 > static uint8_t nb_drivers; >=20 > -static struct rte_cryptodev rte_crypto_devices[RTE_CRYPTO_MAX_DEVS]; > +struct rte_cryptodev rte_crypto_devices[RTE_CRYPTO_MAX_DEVS]; >=20 > struct rte_cryptodev *rte_cryptodevs =3D rte_crypto_devices; >=20 > @@ -1270,6 +1270,44 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, > uint16_t queue_pair_id, > socket_id); > } >=20 > +rte_crypto_enqueue_burst_t > +rte_crypto_get_enq_burst_fn(uint8_t dev_id) > +{ > + if (dev_id >=3D RTE_CRYPTO_MAX_DEVS) { > + rte_errno =3D EINVAL; > + return NULL; > + } > + return rte_cryptodev_api[dev_id].enqueue_burst; > +} > + > +rte_crypto_dequeue_burst_t > +rte_crypto_get_deq_burst_fn(uint8_t dev_id) > +{ > + if (dev_id >=3D RTE_CRYPTO_MAX_DEVS) { > + rte_errno =3D EINVAL; > + return NULL; > + } > + return rte_cryptodev_api[dev_id].dequeue_burst; > +} > + > +int > +rte_crypto_set_enq_burst_fn(uint8_t dev_id, > rte_crypto_enqueue_burst_t fn) > +{ > + if (dev_id >=3D RTE_CRYPTO_MAX_DEVS || fn =3D=3D NULL) > + return -EINVAL; > + rte_cryptodev_api[dev_id].enqueue_burst =3D fn; > + return 0; > +} > + > +int > +rte_crypto_set_deq_burst_fn(uint8_t dev_id, > rte_crypto_dequeue_burst_t fn) > +{ > + if (dev_id >=3D RTE_CRYPTO_MAX_DEVS || fn =3D=3D NULL) > + return -EINVAL; > + rte_cryptodev_api[dev_id].dequeue_burst =3D fn; > + return 0; > +} > + > struct rte_cryptodev_cb * > rte_cryptodev_add_enq_callback(uint8_t dev_id, > uint16_t qp_id, > diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map > index 050089ae55..b64384cc05 100644 > --- a/lib/cryptodev/version.map > +++ b/lib/cryptodev/version.map > @@ -116,6 +116,10 @@ EXPERIMENTAL { > INTERNAL { > global: >=20 > + rte_crypto_get_deq_burst_fn; > + rte_crypto_get_enq_burst_fn; > + rte_crypto_set_deq_burst_fn; > + rte_crypto_set_enq_burst_fn; > rte_cryptodev_allocate_driver; > rte_cryptodev_api_reset; > rte_cryptodev_pmd_allocate; > -- > 2.25.1 Regards, Fan