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 A8783A04B1; Sat, 10 Oct 2020 21:38:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D3E461D502; Sat, 10 Oct 2020 21:38:44 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2078.outbound.protection.outlook.com [40.107.20.78]) by dpdk.org (Postfix) with ESMTP id C04311D451 for ; Sat, 10 Oct 2020 21:38:42 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BvKuXavtXF19ljQJIX8q3GVqaQou9JmBM9hHf0ce+6mn1L4hvsUjTi81vaL2iXOFWf9M/aEpY7Df1GanvX9VKoMR0Is+BumIIuIq7TAik+WsCOpZL5fx5E1mfjr34c1cpUShbrFIgBfXn7+xhVaWNs/XiFAv6etT+zXqThns5WYvq9V9lD49jF+hVTbAhmgrN+HP15VurcCngDB4X1l9pw6Me7uDmmpWbQnOkBowsu2qA06IjZZoHjmsTC7SeUgcXowRLZ5mKgnrkUOD9gBQRj7oZg/z5E90IAiknXn+bLrF5icCNiR+5HtrzMQFruG2qBvSs3tPeyPQZS3LQBzFZw== 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=3AHN5zzJrP7IRYody/27sojuHecKBkDdkmAFKRkDbvI=; b=Bmignedrp7vIi6krGNx2LM7SK2S97RpZgOwap1ayFO3KJM1h70lT+jz2NhJukdIHvG+8B1+Psd2XIPTg14UUlWakRAYrj8DsssTYVavZn3yc6wdnY/LGWyL66e5Nf4ryTOTCv4raf4Vr7set553tGXBSEVYA36PUqIelDKaNi8a8JClhvgf/mmbmRBf/iBfGO29/iC+7R+vxOAB8zG4x+bDOGUhUGWkN52kl8bxlFda+cXVp+mZN3ZJrJEcJIieVsxv59JpeXq8A7oRR1zgq4vt31dnVbq/4HcPHvgVTI3Bfe5aJczwD8eFkLbpVgzY6ZYdo524502IEF+hCje+tqQ== 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=3AHN5zzJrP7IRYody/27sojuHecKBkDdkmAFKRkDbvI=; b=M1+Zq8kgW616YfyPGCL2r2Tj/SIW/xr5/USdqqYTGAVG8qcutJM8Lp7E3fktfw+A6gf9VwIZUIBhwcbBhpk9hBg+PlMg4vEFAeZS7HTzzfRZSO6CHasixUWrn3jrCOIVwoVZcszTkQCmS+1sl0LYz83idn6NBhZYksJs56vw+PI= Received: from AM5PR04MB3153.eurprd04.prod.outlook.com (2603:10a6:206:e::26) by AM7PR04MB6871.eurprd04.prod.outlook.com (2603:10a6:20b:109::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.22; Sat, 10 Oct 2020 19:38:39 +0000 Received: from AM5PR04MB3153.eurprd04.prod.outlook.com ([fe80::91e5:1731:c6e:b79c]) by AM5PR04MB3153.eurprd04.prod.outlook.com ([fe80::91e5:1731:c6e:b79c%2]) with mapi id 15.20.3455.028; Sat, 10 Oct 2020 19:38:39 +0000 From: Akhil Goyal To: Fan Zhang , "dev@dpdk.org" CC: Piotr Bronowski , Adam Dybkowski , "Ananyev, Konstantin" Thread-Topic: [dpdk-dev v11 2/4] cryptodev: add raw crypto data-path APIs Thread-Index: AQHWnoDQcFTR2rwjXEaeGM+KVQuxaKmROwTQ Date: Sat, 10 Oct 2020 19:38:39 +0000 Message-ID: References: <20200924163417.49983-1-roy.fan.zhang@intel.com> <20201009211141.14435-1-roy.fan.zhang@intel.com> <20201009211141.14435-3-roy.fan.zhang@intel.com> In-Reply-To: <20201009211141.14435-3-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.180.231.103] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 84f4bc55-42d3-4829-5b3b-08d86d541691 x-ms-traffictypediagnostic: AM7PR04MB6871: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: D8+tOK5dFeAGPKH2yf63niMxstD5vYS6DgferkzimpoUtxk57DvFzhX+RjnisIurNAy6R3aZJZP/GgAIsuGX8NyDXnidloXFzsHU12vfZHe2SocNW/3vuTEq8qOm6f7xYwQehNPbTlGue+CfiU7JsnEoUmt2Ijt4D6tqOfwagOj5s7mPqP/uyUc1MITPArwZaXY6Ls8zPPzhx6kZpIANSR6cqDf9D4fyVqf43KZADXyuYppfhnvPjOPb2MwSFzYKjoJiin7/rvunw8T/HRTdrbykbiyqOwLpUWNiXPuLNTdRa4zlvVQQZlN/W6otrzjnBdIIel5Z+0AK/hMTglVEpQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM5PR04MB3153.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(366004)(346002)(396003)(136003)(39860400002)(8676002)(76116006)(86362001)(66946007)(26005)(44832011)(186003)(5660300002)(64756008)(66556008)(66476007)(8936002)(316002)(6506007)(83380400001)(2906002)(478600001)(9686003)(7696005)(55016002)(71200400001)(54906003)(110136005)(66446008)(33656002)(52536014)(4326008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: fWUhz0XmWdvy52i749EOLl6TroVuAoc4L/z6fDa4KL/FTwefDcgnaEHwi7HjO3pSOf3tHZ2IUZETkOcOUwnGrhLFYrkxXQ7Yv8cg+gWD5OIBB9exom226AWDCxaofqqFE/m/l8aLFOgQeh6EO6xXBVvlvEgKqb8A6iRtZ/QSuQQfG/nYziNT3DlaoT5VCouNobPkM7l2dPV0VrFZ5vJDRB44MkX6RdfaJllN/3I3HvH3aY0I28wilFEb1zPCd6hyTLRbO6XVM8AEtF9JU0NZQ8tSJY6GJafoOixShLHLwAlvvCnjmqzSiA29QtT/un7QB4IU8AJk3tLw6S18s4tU1/dBkmGGv/3lnR8Kcxg51+79KLoXIcw4jPGHMEfYYTJt8EA0xSgCyVP70W8QI9G0OAZQ+ezGVV3fFCmzLOXx3vbfX4LSZyS/z+Gq7pfVISUd+pzmoY1fTj5ojx8eAiUvM3z5IZcqFdub8Qxpum2wGqha52JfxWlaoarwihE0Nc57CeTGyHzkos1ggAZKPuAxl4Stxrja5Q2pv3dccnRjLVaIRE2bfAhPCfoBOy313REujV2uv19ea9YRnELRePZIwZlfh7PTjABuLM0XD6wYb4G1EaC8hbmayrMOxZ7naiy3DRRChfkK+p4noTr47QF9SQ== 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: AM5PR04MB3153.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84f4bc55-42d3-4829-5b3b-08d86d541691 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Oct 2020 19:38:39.4791 (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: r3kfusrGFEQTh1OXBjK3H2AAG5F3iRCzkge6z05sDhhkJs9dulK/SXV582AQ0wgKxMZGsvBqIkt90nWgBa7vng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6871 Subject: Re: [dpdk-dev] [dpdk-dev v11 2/4] cryptodev: add raw crypto data-path 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, >=20 > This patch adds raw data-path APIs for enqueue and dequeue > operations to cryptodev. The APIs support flexible user-define > enqueue and dequeue behaviors. >=20 > Signed-off-by: Fan Zhang > Signed-off-by: Piotr Bronowski > Acked-by: Adam Dybkowski > --- > doc/guides/cryptodevs/features/default.ini | 1 + > doc/guides/cryptodevs/features/qat.ini | 1 + > doc/guides/prog_guide/cryptodev_lib.rst | 97 +++++ > doc/guides/rel_notes/release_20_11.rst | 7 + > lib/librte_cryptodev/rte_cryptodev.c | 80 ++++ > lib/librte_cryptodev/rte_cryptodev.h | 367 +++++++++++++++++- > lib/librte_cryptodev/rte_cryptodev_pmd.h | 51 ++- > .../rte_cryptodev_version.map | 10 + > 8 files changed, 611 insertions(+), 3 deletions(-) >=20 The release notes should be updated just above aesni_mb crypto PMD updates +* **Added raw data-path APIs for cryptodev library.** + + Cryptodev is added with raw data-path APIs to accelerate external + libraries or applications which need to avail fast cryptodev + enqueue/dequeue operations but does not necessarily depends on + mbufs and cryptodev operation mempools. + I have following diff which should be incorporated in this patch. Qat.ini file should be updated in the 3/4 patch. Release notes update is also missing for QAT. diff --git a/doc/guides/cryptodevs/features/qat.ini b/doc/guides/cryptodevs= /features/qat.ini index 9e82f2886..6cc09cde7 100644 --- a/doc/guides/cryptodevs/features/qat.ini +++ b/doc/guides/cryptodevs/features/qat.ini @@ -17,6 +17,7 @@ Digest encrypted =3D Y Asymmetric sessionless =3D Y RSA PRIV OP KEY EXP =3D Y RSA PRIV OP KEY QT =3D Y -Sym raw data path API =3D Y ; ; Supported crypto algorithms of the 'qat' crypto driver. diff --git a/doc/guides/prog_guide/cryptodev_lib.rst b/doc/guides/prog_guid= e/cryptodev_lib.rst index 8ba800122..7fb3022bd 100644 --- a/doc/guides/prog_guide/cryptodev_lib.rst +++ b/doc/guides/prog_guide/cryptodev_lib.rst @@ -696,9 +696,9 @@ the status buffer provided by the user): are stored. The crypto device will then start enqueuing all of them at once. -Calling ``rte_cryptodev_configure_raw_dp_context`` with the parameter +Calling ``rte_cryptodev_configure_raw_dp_ctx`` with the parameter ``is_update`` set as 0 twice without the enqueue function returning status= 1 or -``rte_cryptodev_dp_enqueue_done`` function call in between will invalidate= any +``rte_cryptodev_raw_enqueue_done`` function call in between will invalidat= e any descriptors stored in the device queue but not enqueued. This feature is u= seful when the user wants to abandon partially enqueued data for a failed enqueu= e burst operation and try enqueuing in a whole later. diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rt= e_cryptodev.c index 7a143c4b9..3d95ac6ea 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -1833,13 +1833,6 @@ rte_cryptodev_raw_enqueue_done(struct rte_crypto_raw= _dp_ctx *ctx, return (*ctx->enqueue_done)(ctx->qp_data, ctx->drv_ctx_data, n); } -int -rte_cryptodev_raw_dequeue_done(struct rte_crypto_raw_dp_ctx *ctx, - uint32_t n) -{ - return (*ctx->dequeue_done)(ctx->qp_data, ctx->drv_ctx_data, n); -} - uint32_t rte_cryptodev_raw_dequeue_burst(struct rte_crypto_raw_dp_ctx *ctx, rte_cryptodev_raw_get_dequeue_count_t get_dequeue_count, @@ -1852,6 +1845,13 @@ rte_cryptodev_raw_dequeue_burst(struct rte_crypto_ra= w_dp_ctx *ctx, is_user_data_array, n_success_jobs, status); } +int +rte_cryptodev_raw_dequeue_done(struct rte_crypto_raw_dp_ctx *ctx, + uint32_t n) +{ + return (*ctx->dequeue_done)(ctx->qp_data, ctx->drv_ctx_data, n); +} + /** 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/rt= e_cryptodev.h index 840a1c54c..79cfa46c8 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -459,7 +459,7 @@ rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_= xform_type *xform_enum, #define RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA (1ULL << 23) /**< Support operations on data which is not byte aligned */ #define RTE_CRYPTODEV_FF_SYM_RAW_DP (1ULL << 24) -/**< Support accelerated specific raw data-path APIs */ +/**< Support accelerator specific symmetric raw data-path APIs */ /** * Get the name of a crypto device feature flag @@ -1344,7 +1344,7 @@ union rte_cryptodev_session_ctx { }; /** - * Enqueue a data vector into device queue but the driver will not start + * Enqueue a data vector into device queue but the driver may or may not s= tart * processing until rte_cryptodev_raw_enqueue_done() is called. * * @param qp Driver specific queue pair data. @@ -1357,7 +1357,7 @@ union rte_cryptodev_session_ctx { * @return * - The number of descriptors successfully enqueued. * - Possible enqueue status written by the driver: - * - 1: The descriptors are enqueued successfully. + * - positive integer: number of descriptors enqueued successfully. * - 0: The descriptors are stored into device queue but are not proce= ssed * until rte_cryptodev_raw_enqueue_done() is called. * - negative integer: failure. @@ -1451,7 +1451,7 @@ typedef void (*rte_cryptodev_raw_post_dequeue_t)(void= *user_data, * @return * - The number of descriptors successfully dequeued. * - Possible dequeue status written by the driver: - * - 1: The descriptors are dequeued successfully. + * - positive integer: Number of descriptors dequeued successfully. * - 0: The descriptors are fetched from queue pair but are not freed * until rte_cryptodev_raw_dequeue_done() is called. * - negative integer: Error occurred when dequeuing. @@ -1475,8 +1475,8 @@ typedef uint32_t (*cryptodev_sym_raw_dequeue_burst_t)= (void *qp, * - The user data pointer retrieved from device queue or NULL if no * descriptor is ready for dequeue. * - Possible dequeue status written by the driver: - * - 1: The descriptors are dequeued successfully. - * - 0: The descriptors are fetched from queue pair but are not freed + * - 1: The descriptor is dequeued successfully. + * - 0: The descriptor is fetched from queue pair but is not freed * until rte_cryptodev_raw_dequeue_done() is called. * - negative integer: Error occurred when dequeuing. */ @@ -1487,7 +1487,7 @@ typedef void * (*cryptodev_sym_raw_dequeue_t)( /** * Context data for raw data-path API crypto process. The buffer of this * structure is to be allocated by the user application with the size equa= l - * or bigger than rte_cryptodev_raw_get_dp_context_size() returned value. + * or bigger than rte_cryptodev_get_raw_dp_ctx_size() returned value. * * NOTE: the buffer is to be used and maintained by the cryptodev driver, = the * user should NOT alter the buffer content to avoid application or system @@ -1510,11 +1510,6 @@ struct rte_crypto_raw_dp_ctx { /** * Configure raw data-path context data. * - * NOTE: - * After the context data is configured, the user should call - * rte_cryptodev_raw_attach_session() before using it in - * rte_cryptodev_raw_enqueue/dequeue function call. - * * @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 @@ -1596,7 +1591,7 @@ rte_cryptodev_raw_enqueue_burst(struct rte_crypto_raw= _dp_ctx *ctx, /** * Start processing all enqueued descriptors from last - * rte_cryptodev_raw_configure_dp_context() call. + * rte_cryptodev_configure_raw_dp_ctx() call. * * @param ctx The initialized raw data-path context data. * @param n The total number of submitted descriptors. @@ -1656,8 +1651,8 @@ rte_cryptodev_raw_dequeue_burst(struct rte_crypto_raw= _dp_ctx *ctx, * - The user data pointer retrieved from device queue or NULL if no * descriptor is ready for dequeue. * - Possible dequeue status written by the driver: - * - 1: The descriptors are dequeued successfully. - * - 0: The descriptors are fetched from queue pair but are not freed + * - 1: The descriptor is dequeued successfully. + * - 0: The descriptor is fetched from queue pair but is not freed * until rte_cryptodev_raw_dequeue_done() is called. * - negative integer: Error occurred when dequeuing. */ diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptode= v/rte_cryptodev_pmd.h index d6be69903..ea8694ca5 100644 --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h @@ -329,7 +329,7 @@ typedef uint32_t (*cryptodev_sym_cpu_crypto_process_t) typedef int (*cryptodev_sym_get_raw_dp_ctx_size_t)(struct rte_cryptodev *d= ev); /** - * Typedef that the driver provided to configure data-path context. + * Typedef that the driver provided to configure raw data-path context. * * @param dev Crypto device pointer. * @param qp_id Crypto device queue pair index. @@ -392,10 +392,10 @@ struct rte_cryptodev_ops { struct { cryptodev_sym_get_raw_dp_ctx_size_t sym_get_raw_dp_ctx_size; - /**< Get data path service context data size. */ + /**< Get raw data path context data size. */ cryptodev_sym_configure_raw_dp_ctx_t sym_configure_raw_dp_ctx; - /**< Initialize crypto service ctx data. */ + /**< Configure raw data path ctx data. */ }; }; };