From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 66EADA04C8; Fri, 18 Sep 2020 23:50:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 01E621DB2E; Fri, 18 Sep 2020 23:50:06 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20063.outbound.protection.outlook.com [40.107.2.63]) by dpdk.org (Postfix) with ESMTP id 80B021DB2B for ; Fri, 18 Sep 2020 23:50:04 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LvG+kuVgSGbip9YOOblTvtIxF2rFllr63gXSVSf6cq5GS7140raCCy4zoeZgif8+UCbpmyh2YUa0qO5eneHvK4ZzFdAq6mdqASuXeIplHzHVmVyK5nGDuzkWAimDHge3B72lYdTRYZ6RcGWwmG26FU4VrkY34IvqZ8fQYwbrbvOc2P7Q9pezoNNf6MI0jvhKt5QPR0x80vbUhIhRhD7PFAy4O61LsJFk+Y3HFZEPc/buEeeXPozB9tyfwmHJoTTXviJkM4hoarmCch3z8oO/1oFJV2k8PATQi2BRiQl2McAjd8tqPO4jbMZ0D9Ak8QltGGboMbAIlcSNwr1OyjMq0g== 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=nF+MIqLhTQ8GsO6mo22+P1SW244nqZZAh9CX1hXu03I=; b=Wmqbgh/O8hXwqwO0WwQp3PtbHiEIJ9ebDnHffo1QoPmCEi7/2JMnFdwNHwJMhiZV+t57ri5svdchtQNelSinypXQMOFOKpAZUqqWQrt6LE2Wt7JAqhWyNGThnB4hbq4DLp22nVbnLy6hZ35kKAoIu7Jm9zPPPcOKEKXpYwTNG7dzF3RCYtM9mrcE/1t5MTREdBz1GVHaxYbxF+K9Pu29jhjTWawkuUirY1wmRL1Q49AXzH5bOiORGOWiIV8lqvcst3JAo/Vdqs0Ize2QM+SHL+3LgmS3jYUrSdEdKFRw06GN3ecxaN7dsma5UrbYlEFJCjz8ANPs8Nv4A0PuLXSqEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nF+MIqLhTQ8GsO6mo22+P1SW244nqZZAh9CX1hXu03I=; b=GZd6L+DDYqWOXrC+XH7FOeeRGBrZYgha5w1okAS6kcmFKpSxE+2BqlL+gQCkcd95DgR6Fum3wPpJTJcjNIlrLMAV6gMv4qB8s7nzJ1p3zfjDwYobrFW8Ni5/MlC6WBUHckJxQ2bX781k510eAdqbPGI5eMKTkwIhRmv43wZrU7E= Received: from VI1PR04MB3168.eurprd04.prod.outlook.com (2603:10a6:802:6::10) by VI1PR04MB4415.eurprd04.prod.outlook.com (2603:10a6:803:74::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.13; Fri, 18 Sep 2020 21:50:02 +0000 Received: from VI1PR04MB3168.eurprd04.prod.outlook.com ([fe80::9513:3b55:931f:216e]) by VI1PR04MB3168.eurprd04.prod.outlook.com ([fe80::9513:3b55:931f:216e%4]) with mapi id 15.20.3391.013; Fri, 18 Sep 2020 21:50:02 +0000 From: Akhil Goyal To: Fan Zhang , "dev@dpdk.org" CC: "fiona.trahe@intel.com" , "arkadiuszx.kusztal@intel.com" , "adamx.dybkowski@intel.com" , Piotr Bronowski , Anoob Joseph Thread-Topic: [dpdk-dev v9 1/4] cryptodev: add crypto data-path service APIs Thread-Index: AQHWhbwSwlDH+pOJNkGpff/lHViImKlu7BjQ Date: Fri, 18 Sep 2020 21:50:02 +0000 Message-ID: References: <20200904152539.20608-1-roy.fan.zhang@intel.com> <20200908084253.81022-1-roy.fan.zhang@intel.com> <20200908084253.81022-2-roy.fan.zhang@intel.com> In-Reply-To: <20200908084253.81022-2-roy.fan.zhang@intel.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nxp.com; x-originating-ip: [122.162.67.38] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: f0966736-3b54-4eb5-356e-08d85c1ccc1d x-ms-traffictypediagnostic: VI1PR04MB4415: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: AM/s6wjMPwCUzEKZlyAPEde3gp471T7Mu67M1/AImrPmb+9k0m+bBkGsa4ApFPBGoQE+4nOO3fPgLWhHbBD70Yz1aE4RH7otz8GelUxjIVxMchcjFh/iY0yB76FIslbT6YG8fI9sUJqg9xTwLTCmt93slSgnDzdgil3zWrJ3jmdhVd4HvSYhn4FB7ghKcE7BZTym7Apyy4FaM5+J8EHs2Ljzv8K+tCVDRw4G7CM2tbzmH1lH+JpFtKpMmxxfMalsCVWxre0oU+Fx+C0C8ksriJAPPVKHyXHmaxZ7sd85faUethw7WwPjVvfwmCscxMLLrwWTPTlbY1s6LCh1mLkfpA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB3168.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(376002)(396003)(39860400002)(136003)(71200400001)(52536014)(86362001)(5660300002)(64756008)(66946007)(76116006)(9686003)(66556008)(66476007)(30864003)(66446008)(110136005)(4326008)(55016002)(8936002)(316002)(33656002)(7696005)(8676002)(2906002)(44832011)(478600001)(186003)(6506007)(83380400001)(54906003)(26005)(579004)(559001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: SuL37TuPvJA+JfdvZ/qPuMGa1kVPk21VWBkH671DbywdBrM5Mbu4dOSXGkib3gDXlZm6Z1fEEIfJPH/qDe4x5azxVHmtjnLAjvwvt6j4vfGkLPBxdOmYlD7/CLErhW4QKunuPdWCwoaeNhoCJMdNj9qWBkfXBVLDyG6lVvy2TinYR743BLTykTqk9D3egU8KxYjuI//+4yg2QL/tQwE8+QPfV1ASTDUPDAaXQBWJEk2j7Z03xuUTwcEylKvEBA4i4CtPPVma2xt92dfptrgxUhXgGGHYgxeW8MuCPzNtdyKCNlUc6op0hbAXPYqxeeaJPghbjnxCev9zgvx+rCq98lJyJ4eccpz4n/DXkIKXXY3A+6blAcBsArv2O3O9A+IYEKCHsX0QGMv1wQsdaWSpypWjiwAC6zN/7Lz00/aEDIcaX8a+4Zwet918IrWfIgSrcRD3Aj1HnXND8FLDrVRmuum4V7KW43lxnZA9KHPgMLAgDePgl4n033gYP1PZvYKjw6c9hYRg8giG54cgeoaFep2DBc4qb2DqtM5LnUt6vG/YkumWbKlIheJSo4HBTHHil1P1OforLTkf0MhWHkYxmnKVjB8W8MxD8CrK/IwRgt5Adn7CPekomRE/+wtstrLe0pFWE01g8nQOIfNSY/EeWw== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB3168.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0966736-3b54-4eb5-356e-08d85c1ccc1d X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Sep 2020 21:50:02.4771 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: U4M3lbWAXsabvC49BOXhX4/DWPOBc4m2Qm3EZgMOk8R/0tx2Nzs7WbAFOMgH7EmoneSyMagOftQmFT0ELbLF8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4415 Subject: Re: [dpdk-dev] [dpdk-dev v9 1/4] cryptodev: add crypto data-path service APIs 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Fan, > Subject: [dpdk-dev v9 1/4] cryptodev: add crypto data-path service APIs >=20 > This patch adds data-path service APIs for enqueue and dequeue > operations to cryptodev. The APIs support flexible user-define > enqueue and dequeue behaviors and operation mode. >=20 > Signed-off-by: Fan Zhang > Signed-off-by: Piotr Bronowski > --- > lib/librte_cryptodev/rte_crypto.h | 9 + > lib/librte_cryptodev/rte_crypto_sym.h | 49 ++- > lib/librte_cryptodev/rte_cryptodev.c | 98 +++++ > lib/librte_cryptodev/rte_cryptodev.h | 335 +++++++++++++++++- > lib/librte_cryptodev/rte_cryptodev_pmd.h | 48 ++- > .../rte_cryptodev_version.map | 10 + > 6 files changed, 540 insertions(+), 9 deletions(-) >=20 > diff --git a/lib/librte_cryptodev/rte_crypto.h b/lib/librte_cryptodev/rte= _crypto.h > index fd5ef3a87..f009be9af 100644 > --- a/lib/librte_cryptodev/rte_crypto.h > +++ b/lib/librte_cryptodev/rte_crypto.h > @@ -438,6 +438,15 @@ rte_crypto_op_attach_asym_session(struct > rte_crypto_op *op, > return 0; > } >=20 > +/** Crypto data-path service types */ > +enum rte_crypto_dp_service { > + RTE_CRYPTO_DP_SYM_CIPHER_ONLY =3D 0, > + RTE_CRYPTO_DP_SYM_AUTH_ONLY, > + RTE_CRYPTO_DP_SYM_CHAIN, > + RTE_CRYPTO_DP_SYM_AEAD, > + RTE_CRYPTO_DP_N_SERVICE > +}; Comments missing for this enum. Do we really need this enum? Can we not have this info in the driver from the xform list? And if we really want to add this, why to have it specific to raw data path= APIs? > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/librte_cryptodev/rte_crypto_sym.h > b/lib/librte_cryptodev/rte_crypto_sym.h > index f29c98051..376412e94 100644 > --- a/lib/librte_cryptodev/rte_crypto_sym.h > +++ b/lib/librte_cryptodev/rte_crypto_sym.h > @@ -50,6 +50,30 @@ struct rte_crypto_sgl { > uint32_t num; > }; >=20 > +/** > + * Symmetri Crypto Addtional Data other than src and destination data. > + * Supposed to be used to pass IV/digest/aad data buffers with lengths > + * defined when creating crypto session. > + */ Fix typo > +union rte_crypto_sym_additional_data { > + struct { > + void *cipher_iv_ptr; > + rte_iova_t cipher_iv_iova; > + void *auth_iv_ptr; > + rte_iova_t auth_iv_iova; > + void *digest_ptr; > + rte_iova_t digest_iova; > + } cipher_auth; Should be chain instead of cipher_auth > + struct { > + void *iv_ptr; > + rte_iova_t iv_iova; > + void *digest_ptr; > + rte_iova_t digest_iova; > + void *aad_ptr; > + rte_iova_t aad_iova; > + } aead; > +}; > + > /** > * Synchronous operation descriptor. > * Supposed to be used with CPU crypto API call. > @@ -57,12 +81,25 @@ struct rte_crypto_sgl { > struct rte_crypto_sym_vec { > /** array of SGL vectors */ > struct rte_crypto_sgl *sgl; > - /** array of pointers to IV */ > - void **iv; > - /** array of pointers to AAD */ > - void **aad; > - /** array of pointers to digest */ > - void **digest; > + > + union { > + > + /* Supposed to be used with CPU crypto API call. */ > + struct { > + /** array of pointers to IV */ > + void **iv; > + /** array of pointers to AAD */ > + void **aad; > + /** array of pointers to digest */ > + void **digest; > + }; Can we also name this struct? Probably we should split this as a separate patch. > + > + /* Supposed to be used with > rte_cryptodev_dp_sym_submit_vec() > + * call. > + */ > + union rte_crypto_sym_additional_data *additional_data; > + }; > + Can we get rid of this unnecessary union rte_crypto_sym_additional_data And place chain and aead directly in the union? At any point, only one of t= he three would be used. > /** > * array of statuses for each operation: > * - 0 on success > diff --git a/lib/librte_cryptodev/rte_cryptodev.c > b/lib/librte_cryptodev/rte_cryptodev.c > index 1dd795bcb..4f59cf800 100644 > --- a/lib/librte_cryptodev/rte_cryptodev.c > +++ b/lib/librte_cryptodev/rte_cryptodev.c > @@ -1914,6 +1914,104 @@ rte_cryptodev_sym_cpu_crypto_process(uint8_t > dev_id, > return dev->dev_ops->sym_cpu_process(dev, sess, ofs, vec); > } >=20 > +int > +rte_cryptodev_dp_get_service_ctx_data_size(uint8_t dev_id) > +{ > + struct rte_cryptodev *dev; > + int32_t size =3D sizeof(struct rte_crypto_dp_service_ctx); > + int32_t priv_size; > + > + if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) > + return -1; > + > + dev =3D rte_cryptodev_pmd_get_dev(dev_id); > + > + if (*dev->dev_ops->get_drv_ctx_size =3D=3D NULL || > + !(dev->feature_flags & > RTE_CRYPTODEV_FF_DATA_PATH_SERVICE)) { > + return -1; > + } I have some suggestions for the naming of the APIs / flags in the doc patch= ,=20 Please check that and make changes in this patch. Also, you have missed adding this feature flag in the doc/guides/cryptodevs/features/default.ini file. And Subsequently in the doc/guides/cryptodevs/features/qat.ini file. > + > + priv_size =3D (*dev->dev_ops->get_drv_ctx_size)(dev); > + if (priv_size < 0) > + return -1; > + > + return RTE_ALIGN_CEIL((size + priv_size), 8); > +} > + > +int > +rte_cryptodev_dp_configure_service(uint8_t dev_id, uint16_t qp_id, > + enum rte_crypto_dp_service service_type, > + enum rte_crypto_op_sess_type sess_type, > + union rte_cryptodev_session_ctx session_ctx, > + struct rte_crypto_dp_service_ctx *ctx, uint8_t is_update) > +{ > + struct rte_cryptodev *dev; > + > + if (!rte_cryptodev_get_qp_status(dev_id, qp_id)) > + return -1; > + > + dev =3D rte_cryptodev_pmd_get_dev(dev_id); > + if (!(dev->feature_flags & RTE_CRYPTODEV_FF_DATA_PATH_SERVICE) > + || dev->dev_ops->configure_service =3D=3D NULL) > + return -1; It would be better to return actual error number like ENOTSUP/EINVAL. It would be helpful in debugging. > + > + return (*dev->dev_ops->configure_service)(dev, qp_id, service_type, > + sess_type, session_ctx, ctx, is_update); > +} > + > +int > +rte_cryptodev_dp_sym_submit_single_job(struct rte_crypto_dp_service_ctx > *ctx, > + struct rte_crypto_vec *data, uint16_t n_data_vecs, > + union rte_crypto_sym_ofs ofs, > + union rte_crypto_sym_additional_data *additional_data, > + void *opaque) > +{ Can we have some debug checks for NULL checking. > + return _cryptodev_dp_submit_single_job(ctx, data, n_data_vecs, ofs, > + additional_data, opaque); Unnecessary function call _cryptodev_dp_submit_single_job. You can directly call return (*ctx->submit_single_job)(ctx->qp_data, ctx->drv_service_data, data, n_data_vecs, ofs, additional_data, opaque); > +} > + > +uint32_t > +rte_cryptodev_dp_sym_submit_vec(struct rte_crypto_dp_service_ctx *ctx, > + struct rte_crypto_sym_vec *vec, union rte_crypto_sym_ofs ofs, > + void **opaque) > +{ > + return (*ctx->submit_vec)(ctx->qp_data, ctx->drv_service_data, vec, > + ofs, opaque); > +} > + > +int > +rte_cryptodev_dp_sym_dequeue_single_job(struct rte_crypto_dp_service_ctx > *ctx, > + void **out_opaque) > +{ > + return _cryptodev_dp_sym_dequeue_single_job(ctx, out_opaque); Same here. > +} > + > +int > +rte_cryptodev_dp_sym_submit_done(struct rte_crypto_dp_service_ctx *ctx, > + uint32_t n) > +{ > + return (*ctx->submit_done)(ctx->qp_data, ctx->drv_service_data, n); > +} > + > +int > +rte_cryptodev_dp_sym_dequeue_done(struct rte_crypto_dp_service_ctx *ctx, > + uint32_t n) > +{ > + return (*ctx->dequeue_done)(ctx->qp_data, ctx->drv_service_data, n); > +} > + > +uint32_t > +rte_cryptodev_dp_sym_dequeue(struct rte_crypto_dp_service_ctx *ctx, > + rte_cryptodev_get_dequeue_count_t get_dequeue_count, > + rte_cryptodev_post_dequeue_t post_dequeue, > + void **out_opaque, uint8_t is_opaque_array, > + uint32_t *n_success_jobs) > +{ > + return (*ctx->dequeue_opaque)(ctx->qp_data, ctx->drv_service_data, > + get_dequeue_count, post_dequeue, out_opaque, > is_opaque_array, > + n_success_jobs); > +} > + > /** Initialise rte_crypto_op mempool element */ > static void > rte_crypto_op_init(struct rte_mempool *mempool, > diff --git a/lib/librte_cryptodev/rte_cryptodev.h > b/lib/librte_cryptodev/rte_cryptodev.h > index 7b3ebc20f..4da0389d1 100644 > --- a/lib/librte_cryptodev/rte_cryptodev.h > +++ b/lib/librte_cryptodev/rte_cryptodev.h > @@ -466,7 +466,8 @@ rte_cryptodev_asym_get_xform_enum(enum > rte_crypto_asym_xform_type *xform_enum, > /**< Support symmetric session-less operations */ > #define RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA (1ULL > << 23) > /**< Support operations on data which is not byte aligned */ > - > +#define RTE_CRYPTODEV_FF_DATA_PATH_SERVICE (1ULL << 24) > +/**< Support accelerated specific raw data as input */ Support data path APIs for raw data as input. >=20 > /** > * Get the name of a crypto device feature flag > @@ -1351,6 +1352,338 @@ rte_cryptodev_sym_cpu_crypto_process(uint8_t > dev_id, > struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs ofs, > struct rte_crypto_sym_vec *vec); >=20 > +/** > + * Get the size of the data-path service context for all registered driv= ers. For all drivers ? or for a device? > + * > + * @param dev_id The device identifier. > + * > + * @return > + * - If the device supports data-path service, return the context size= . > + * - If the device does not support the data-dath service, return -1. > + */ > +__rte_experimental > +int > +rte_cryptodev_dp_get_service_ctx_data_size(uint8_t dev_id); > + > +/** > + * Union of different crypto session types, including session-less xform > + * pointer. Union of different symmetric crypto session types .. > + */ > +union rte_cryptodev_session_ctx { > + struct rte_cryptodev_sym_session *crypto_sess; > + struct rte_crypto_sym_xform *xform; > + struct rte_security_session *sec_sess; > +}; > + > +/** > + * Submit a data vector into device queue but the driver will not start > + * processing until rte_cryptodev_dp_sym_submit_vec() is called. > + * > + * @param qp Driver specific queue pair data. > + * @param service_data Driver specific service data. > + * @param vec The array of job vectors. > + * @param ofs Start and stop offsets for auth and cipher > + * operations. > + * @param opaque The array of opaque data for dequeue. Can you elaborate the usage of opaque here? > + * @return > + * - The number of jobs successfully submitted. > + */ > +typedef uint32_t (*cryptodev_dp_sym_submit_vec_t)( > + void *qp, uint8_t *service_data, struct rte_crypto_sym_vec *vec, > + union rte_crypto_sym_ofs ofs, void **opaque); > + > +/** > + * Submit single job into device queue but the driver will not start > + * processing until rte_cryptodev_dp_sym_submit_vec() is called. > + * > + * @param qp Driver specific queue pair data. > + * @param service_data Driver specific service data. > + * @param data The buffer vector. > + * @param n_data_vecs Number of buffer vectors. > + * @param ofs Start and stop offsets for auth and cipher > + * operations. > + * @param additional_data IV, digest, and aad data. > + * @param opaque The opaque data for dequeue. > + * @return > + * - On success return 0. > + * - On failure return negative integer. > + */ > +typedef int (*cryptodev_dp_submit_single_job_t)( > + void *qp, uint8_t *service_data, struct rte_crypto_vec *data, > + uint16_t n_data_vecs, union rte_crypto_sym_ofs ofs, > + union rte_crypto_sym_additional_data *additional_data, > + void *opaque); > + > +/** > + * Inform the queue pair to start processing or finish dequeuing all > + * submitted/dequeued jobs. > + * > + * @param qp Driver specific queue pair data. > + * @param service_data Driver specific service data. > + * @param n The total number of submitted jobs. > + * @return > + * - On success return 0. > + * - On failure return negative integer. > + */ > +typedef int (*cryptodev_dp_sym_operation_done_t)(void *qp, > + uint8_t *service_data, uint32_t n); > + > +/** > + * Typedef that the user provided for the driver to get the dequeue coun= t. > + * The function may return a fixed number or the number parsed from the > opaque > + * data stored in the first processed job. > + * > + * @param opaque Dequeued opaque data. > + **/ > +typedef uint32_t (*rte_cryptodev_get_dequeue_count_t)(void *opaque); > + > +/** > + * Typedef that the user provided to deal with post dequeue operation, s= uch > + * as filling status. > + * > + * @param opaque Dequeued opaque data. In case > + * > RTE_CRYPTO_HW_DP_FF_GET_OPAQUE_ARRAY bit is > + * set, this value will be the opaque data stored > + * in the specific processed jobs referenced by > + * index, otherwise it will be the opaque data > + * stored in the first processed job in the burst. What is RTE_CRYPTO_HW_DP_FF_GET_OPAQUE_ARRAY, I did not find this in the se= ries. > + * @param index Index number of the processed job. > + * @param is_op_success Driver filled operation status. > + **/ > +typedef void (*rte_cryptodev_post_dequeue_t)(void *opaque, uint32_t inde= x, > + uint8_t is_op_success); > + > +/** > + * Dequeue symmetric crypto processing of user provided data. > + * > + * @param qp Driver specific queue pair data. > + * @param service_data Driver specific service data. > + * @param get_dequeue_count User provided callback function to > + * obtain dequeue count. > + * @param post_dequeue User provided callback function to > + * post-process a dequeued operation. > + * @param out_opaque Opaque pointer array to be retrieve > from > + * device queue. In case of > + * *is_opaque_array* is set there should > + * be enough room to store all opaque > data. > + * @param is_opaque_array Set 1 if every dequeued job will > be > + * written the opaque data into > + * *out_opaque* array. > + * @param n_success_jobs Driver written value to specific the > + * total successful operations count. > + * > + * @return > + * - Returns number of dequeued packets. > + */ > +typedef uint32_t (*cryptodev_dp_sym_dequeue_t)(void *qp, uint8_t > *service_data, > + rte_cryptodev_get_dequeue_count_t get_dequeue_count, > + rte_cryptodev_post_dequeue_t post_dequeue, > + void **out_opaque, uint8_t is_opaque_array, > + uint32_t *n_success_jobs); > + > +/** > + * Dequeue symmetric crypto processing of user provided data. > + * > + * @param qp Driver specific queue pair data. > + * @param service_data Driver specific service data. > + * @param out_opaque Opaque pointer to be retrieve from > + * device queue. > + * > + * @return > + * - 1 if the job is dequeued and the operation is a success. > + * - 0 if the job is dequeued but the operation is failed. > + * - -1 if no job is dequeued. > + */ > +typedef int (*cryptodev_dp_sym_dequeue_single_job_t)( > + void *qp, uint8_t *service_data, void **out_opaque); > + > +/** > + * Context data for asynchronous crypto process. > + */ > +struct rte_crypto_dp_service_ctx { > + void *qp_data; > + > + struct { > + cryptodev_dp_submit_single_job_t submit_single_job; > + cryptodev_dp_sym_submit_vec_t submit_vec; > + cryptodev_dp_sym_operation_done_t submit_done; > + cryptodev_dp_sym_dequeue_t dequeue_opaque; > + cryptodev_dp_sym_dequeue_single_job_t dequeue_single; > + cryptodev_dp_sym_operation_done_t dequeue_done; > + }; > + > + /* Driver specific service data */ > + __extension__ uint8_t drv_service_data[]; > +}; Comments missing for structure params. Struct name can be rte_crypto_raw_dp_ctx. Who allocate and free this structure? > + > +/** > + * Configure one DP service context data. Calling this function for the = first > + * time the user should unset the *is_update* parameter and the driver w= ill > + * fill necessary operation data into ctx buffer. Only when > + * rte_cryptodev_dp_submit_done() is called the data stored in the ctx b= uffer > + * will not be effective. > + * > + * @param dev_id The device identifier. > + * @param qp_id The index of the queue pair from which to > + * retrieve processed packets. The value must be > + * in the range [0, nb_queue_pair - 1] previously > + * supplied to rte_cryptodev_configure(). > + * @param service_type Type of the service requested. > + * @param sess_type session type. > + * @param session_ctx Session context data. > + * @param ctx The data-path service context data. > + * @param is_update Set 1 if ctx is pre-initialized but need > + * update to different service type or session, > + * but the rest driver data remains the same. > + * Since service context data buffer is provided > + * by user, the driver will not check the > + * validity of the buffer nor its content. It is > + * the user's obligation to initialize and > + * uses the buffer properly by setting this field. > + * @return > + * - On success return 0. > + * - On failure return negative integer. > + */ > +__rte_experimental > +int > +rte_cryptodev_dp_configure_service(uint8_t dev_id, uint16_t qp_id, > + enum rte_crypto_dp_service service_type, > + enum rte_crypto_op_sess_type sess_type, > + union rte_cryptodev_session_ctx session_ctx, > + struct rte_crypto_dp_service_ctx *ctx, uint8_t is_update); > + > +static __rte_always_inline int > +_cryptodev_dp_submit_single_job(struct rte_crypto_dp_service_ctx *ctx, > + struct rte_crypto_vec *data, uint16_t n_data_vecs, > + union rte_crypto_sym_ofs ofs, > + union rte_crypto_sym_additional_data *additional_data, > + void *opaque) > +{ > + return (*ctx->submit_single_job)(ctx->qp_data, ctx->drv_service_data, > + data, n_data_vecs, ofs, additional_data, opaque); > +} > + > +static __rte_always_inline int > +_cryptodev_dp_sym_dequeue_single_job(struct rte_crypto_dp_service_ctx > *ctx, > + void **out_opaque) > +{ > + return (*ctx->dequeue_single)(ctx->qp_data, ctx->drv_service_data, > + out_opaque); > +} > + > +/** > + * Submit single job into device queue but the driver will not start > + * processing until rte_cryptodev_dp_submit_done() is called. This is a > + * simplified > + * > + * @param ctx The initialized data-path service context data. > + * @param data The buffer vector. > + * @param n_data_vecs Number of buffer vectors. > + * @param ofs Start and stop offsets for auth and cipher > + * operations. > + * @param additional_data IV, digest, and aad > + * @param opaque The array of opaque data for dequeue. > + * @return > + * - On success return 0. > + * - On failure return negative integer. > + */ > +__rte_experimental > +int > +rte_cryptodev_dp_sym_submit_single_job(struct rte_crypto_dp_service_ctx > *ctx, > + struct rte_crypto_vec *data, uint16_t n_data_vecs, > + union rte_crypto_sym_ofs ofs, > + union rte_crypto_sym_additional_data *additional_data, > + void *opaque); > + > +/** > + * Submit a data vector into device queue but the driver will not start > + * processing until rte_cryptodev_dp_submit_done() is called. > + * > + * @param ctx The initialized data-path service context data. > + * @param vec The array of job vectors. > + * @param ofs Start and stop offsets for auth and cipher operations. > + * @param opaque The array of opaque data for dequeue. > + * @return > + * - The number of jobs successfully submitted. > + */ > +__rte_experimental > +uint32_t > +rte_cryptodev_dp_sym_submit_vec(struct rte_crypto_dp_service_ctx *ctx, > + struct rte_crypto_sym_vec *vec, union rte_crypto_sym_ofs ofs, > + void **opaque); > + > +/** > + * Command the queue pair to start processing all submitted jobs from la= st > + * rte_cryptodev_init_dp_service() call. > + * > + * @param ctx The initialized data-path service context data. > + * @param n The total number of submitted jobs. > + */ > +__rte_experimental > +int > +rte_cryptodev_dp_sym_submit_done(struct rte_crypto_dp_service_ctx *ctx, > + uint32_t n); > + > +/** > + * Dequeue symmetric crypto processing of user provided data. > + * > + * @param ctx The initialized data-path service > + * context data. > + * @param get_dequeue_count User provided callback function to > + * obtain dequeue count. > + * @param post_dequeue User provided callback function to > + * post-process a dequeued operation. > + * @param out_opaque Opaque pointer array to be retrieve > from > + * device queue. In case of > + * *is_opaque_array* is set there should > + * be enough room to store all opaque > data. > + * @param is_opaque_array Set 1 if every dequeued job will > be > + * written the opaque data into > + * *out_opaque* array. > + * @param n_success_jobs Driver written value to specific the > + * total successful operations count. > + * > + * @return > + * - Returns number of dequeued packets. > + */ > +__rte_experimental > +uint32_t > +rte_cryptodev_dp_sym_dequeue(struct rte_crypto_dp_service_ctx *ctx, > + rte_cryptodev_get_dequeue_count_t get_dequeue_count, > + rte_cryptodev_post_dequeue_t post_dequeue, > + void **out_opaque, uint8_t is_opaque_array, > + uint32_t *n_success_jobs); > + > +/** > + * Dequeue Single symmetric crypto processing of user provided data. > + * > + * @param ctx The initialized data-path service > + * context data. > + * @param out_opaque Opaque pointer to be retrieve from > + * device queue. The driver shall support > + * NULL input of this parameter. > + * > + * @return > + * - 1 if the job is dequeued and the operation is a success. > + * - 0 if the job is dequeued but the operation is failed. > + * - -1 if no job is dequeued. > + */ > +__rte_experimental > +int > +rte_cryptodev_dp_sym_dequeue_single_job(struct rte_crypto_dp_service_ctx > *ctx, > + void **out_opaque); > + > +/** > + * Inform the queue pair dequeue jobs finished. > + * > + * @param ctx The initialized data-path service context data. > + * @param n The total number of jobs already dequeued. > + */ > +__rte_experimental > +int > +rte_cryptodev_dp_sym_dequeue_done(struct rte_crypto_dp_service_ctx *ctx, > + uint32_t n); > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h > b/lib/librte_cryptodev/rte_cryptodev_pmd.h > index 81975d72b..e19de458c 100644 > --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h > +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h > @@ -316,6 +316,42 @@ typedef uint32_t > (*cryptodev_sym_cpu_crypto_process_t) > (struct rte_cryptodev *dev, struct rte_cryptodev_sym_session *sess, > union rte_crypto_sym_ofs ofs, struct rte_crypto_sym_vec *vec); >=20 > +/** > + * Typedef that the driver provided to get service context private date = size. > + * > + * @param dev Crypto device pointer. > + * > + * @return > + * - On success return the size of the device's service context privat= e data. > + * - On failure return negative integer. > + */ > +typedef int (*cryptodev_dp_get_service_ctx_size_t)( > + struct rte_cryptodev *dev); > + > +/** > + * Typedef that the driver provided to configure data-path service. > + * > + * @param dev Crypto device pointer. > + * @param qp_id Crypto device queue pair index. > + * @param service_type Type of the service requested. > + * @param sess_type session type. > + * @param session_ctx Session context data. > + * @param ctx The data-path service context data. > + * @param is_update Set 1 if ctx is pre-initialized but need > + * update to different service type or session, > + * but the rest driver data remains the same. > + * buffer will always be one. > + * @return > + * - On success return 0. > + * - On failure return negative integer. > + */ > +typedef int (*cryptodev_dp_configure_service_t)( > + struct rte_cryptodev *dev, uint16_t qp_id, > + enum rte_crypto_dp_service service_type, > + enum rte_crypto_op_sess_type sess_type, > + union rte_cryptodev_session_ctx session_ctx, > + struct rte_crypto_dp_service_ctx *ctx, > + uint8_t is_update); >=20 > /** Crypto device operations function pointer table */ > struct rte_cryptodev_ops { > @@ -348,8 +384,16 @@ struct rte_cryptodev_ops { > /**< Clear a Crypto sessions private data. */ > cryptodev_asym_free_session_t asym_session_clear; > /**< Clear a Crypto sessions private data. */ > - cryptodev_sym_cpu_crypto_process_t sym_cpu_process; > - /**< process input data synchronously (cpu-crypto). */ > + union { > + cryptodev_sym_cpu_crypto_process_t sym_cpu_process; > + /**< process input data synchronously (cpu-crypto). */ > + struct { > + cryptodev_dp_get_service_ctx_size_t get_drv_ctx_size; > + /**< Get data path service context data size. */ > + cryptodev_dp_configure_service_t configure_service; > + /**< Initialize crypto service ctx data. */ > + }; > + }; > }; >=20 >=20 > diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map > b/lib/librte_cryptodev/rte_cryptodev_version.map > index 02f6dcf72..10388ae90 100644 > --- a/lib/librte_cryptodev/rte_cryptodev_version.map > +++ b/lib/librte_cryptodev/rte_cryptodev_version.map > @@ -105,4 +105,14 @@ EXPERIMENTAL { >=20 > # added in 20.08 > rte_cryptodev_get_qp_status; > + > + # added in 20.11 > + rte_cryptodev_dp_configure_service; Rte_cryptodev_configure_raw_dp > + rte_cryptodev_dp_get_service_ctx_data_size; Rte_cryptodev_get_raw_dp_ctx_size > + rte_cryptodev_dp_sym_dequeue; rte_cryptodev_raw_dequeue_burst > + rte_cryptodev_dp_sym_dequeue_done; rte_cryptodev_raw_dequeue_done > + rte_cryptodev_dp_sym_dequeue_single_job; rte_cryptodev_raw_dequeue > + rte_cryptodev_dp_sym_submit_done; rte_cryptodev_raw_enqueue_done > + rte_cryptodev_dp_sym_submit_single_job; rte_cryptodev_raw_enqueue > + rte_cryptodev_dp_sym_submit_vec; rte_cryptodev_raw_enqueue_burst > }; Please use above names for the APIs. No need for keyword dp in enq/deq APIs as it is implicit that enq/deq APIs = are data path APIs. I could not complete the review of this patch specifically as I see a lot o= f issues in the current version Please send reply to my queries so that review can be completed. Regards, Akhil