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 A3D1FA04CC; Mon, 21 Sep 2020 12:40:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 348131D905; Mon, 21 Sep 2020 12:40:52 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 83E6D1D8D3 for ; Mon, 21 Sep 2020 12:40:50 +0200 (CEST) IronPort-SDR: SlL2mDPpt8qCuxOAfixFs2rJA1Q5+kGIqfNp5bkQVSIAdYeGJGPV7oqVglQ7oPet0cO37I3v7A 9zXEDBvfLmCw== X-IronPort-AV: E=McAfee;i="6000,8403,9750"; a="140360289" X-IronPort-AV: E=Sophos;i="5.77,286,1596524400"; d="scan'208";a="140360289" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2020 03:40:47 -0700 IronPort-SDR: Nn1Qbea1x6zywblMSN1/dE1qOqDWnGP5Q52+VIDntQVG918k71r6VeKVxK2qCYIpwXxtqJiszZ qZOAwApzox9g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,286,1596524400"; d="scan'208";a="321713065" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga002.jf.intel.com with ESMTP; 21 Sep 2020 03:40:47 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 21 Sep 2020 03:40:46 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 21 Sep 2020 03:40:46 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.169) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Mon, 21 Sep 2020 03:40:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j96tMtMJqIirlZyuSDegQ5/p8+1MfpZ03tflVB2J0qTXo6WRilhOBB6bl0F7srrl6C1TxfbyvYLduAbBDxjIYKgKZwPt2pG27yiILnfJiDpMuTt/eyfztGuyKW0nIzXOPidEIaeWOtW43qpN0rtdQSfUAiX+RhZMY7ktPEqecEsZJ6+M4+Jx9nf3jqIPPZcs5UBNFN3hFLMTEwzRml5VpG5iRrTShWNr/PtYM+MHZxUGLzcCc7gG4wVE1CCwEvXtSE3E+X+Ru7wKSBD8CA0q79rb9i7++4HJI7Igwk7AlTSUTCHl4m0iVY9Ixh0zFjXzvKy5ij/oEohMHNPUJAf/kA== 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=567p6CUd7zu3Ld5T9KjPqLcVamPL9BydQ0d8ez03Qb0=; b=h8v+ZOLxDWOwp/QrzQbe2jdCuQVAK7olmpVzC8GASdKxTRREcco20OBqc/D3/TEw529YRZOZ9CwHUGm2uTWwKQVqCjKX8hh7Z47Wd64j8uWa8UxmZEcdpvCYbyn7XyywpZ2+xDBj47NerWIX9VniZS+7I5oppk/JHp1jPTMmHH/sfuBhKkxJAU8xRMixV18ca7ypB+nmuHe/7/kU4uVErLpy5F/8N5L7uStdEpHKCieLdBXiUi6Mne5nRbLTtXl5qk2O2Tbg3AzkDpqkhzM5Hc+pBlwgvzax6Wmk4KLl88VDmjNKirAg26ox5lNfSUjbNbv7gMz4MEsEcOWYUBZYVw== 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=567p6CUd7zu3Ld5T9KjPqLcVamPL9BydQ0d8ez03Qb0=; b=UKMp6YahZGSy7vlTarHTbGyn8aiwpHJOn2LePggCzgARWXJxipIm7xzjz0l9uuNynvtOYgG1U6qEWNYS3+9ryMBEViIOTk5c6qQVOU8hHPe+fwZSU83ffbxOdD3Y7UVaRq+ztF+XnW5d2iC5uGSGSZsKa8QikxgBE537GtDjLg4= Received: from BL0PR11MB3043.namprd11.prod.outlook.com (2603:10b6:208:33::19) by BL0PR11MB3220.namprd11.prod.outlook.com (2603:10b6:208:2f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.15; Mon, 21 Sep 2020 10:40:42 +0000 Received: from BL0PR11MB3043.namprd11.prod.outlook.com ([fe80::11fa:a7fe:329d:9239]) by BL0PR11MB3043.namprd11.prod.outlook.com ([fe80::11fa:a7fe:329d:9239%5]) with mapi id 15.20.3391.024; Mon, 21 Sep 2020 10:40:42 +0000 From: "Zhang, Roy Fan" To: Akhil Goyal , "dev@dpdk.org" CC: "Trahe, Fiona" , "Kusztal, ArkadiuszX" , "Dybkowski, AdamX" , "Bronowski, PiotrX" , Anoob Joseph Thread-Topic: [dpdk-dev v9 1/4] cryptodev: add crypto data-path service APIs Thread-Index: AQHWhbwaRQXVNw2ngE+5SqoPhUuyBqlu/9oAgAP1tgA= Date: Mon, 21 Sep 2020 10:40:41 +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: Accept-Language: zh-Hans-HK, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [95.44.220.85] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: eefd771d-78ab-4b4f-1eb0-08d85e1ac9d5 x-ms-traffictypediagnostic: BL0PR11MB3220: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: qjTnZg/zq6obCo4Eh42jr/XcKWw1VF10LXg7Jqp2mGt9J2aBOH4TZRF736NjjaGvt9pH6QiuhPudrQ5oHkFEgJXZxsPSqZdneWgTA4KumHfs8axTf9VjI1mVEnChdXtGsfC81R84kc+Qt3vvY5uE0Bs9vTGJsyObPuLiJjAknJU14vwkJINp1G+u6dIA1MtVIs8rOqaxAF1ebepExCaOgcEyOxe711k3ZKbG2wPdR9X8QXJEYyXsIxf9QN6EI+bg9ZVKkteqllXkc665P/iNpc6fozzQUNzAuqX5ojsnAAo3/VuXF4AIanU9Xg/8JIvkZrc+91kg+oL41LxhZY/LBw== 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)(366004)(136003)(39860400002)(376002)(396003)(76116006)(316002)(52536014)(66476007)(4326008)(64756008)(66556008)(8676002)(83380400001)(66446008)(8936002)(2906002)(71200400001)(66946007)(9686003)(5660300002)(86362001)(30864003)(33656002)(6506007)(55016002)(7696005)(478600001)(26005)(186003)(53546011)(110136005)(54906003)(559001)(579004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: r855lX3kkXSFySDFMoNx0HB+yFvqcUMJaDr9NcjrcWa2LsbZMeKzgoOBJeJcfOBrvfeXueHJshyK7Hs/SZKw677m+Bsq4NP8z6Hj/mQf2jpHjoMIJFft0C5BQ3ixrT8+UvPrjfs03vABbtg7+hXCY9wFFXbqUlnBx2J+sQoYNplB0lK4/Mggqdk9ZRwcfdueeKbyKa3aLq1Vpky/ByZM/Z3v4ugr55NA4DSfFx8yMB/IiOkSWsqf1rpeH5GXP6PwZrYLw6AfOpCTFEAruHBH2QZAhatH+fyZqcFPYJWpV03pR4naDoCxQrMkCcEAa/NOotHDSKrAGe4r5xAeES1tds0rlM0b/zuxGnO/SftpqZsVeyiH82cFj5VzvjDrCxEjZydI4gzcEu/9kRjpXxac4GNqtNn0DXC6bWlTifi4arfAbrJ78QKzPb0P0Hvckvd+n5M7+GDX4e67W3BeNQnPKD7yQxXI4HpcC8kuJ7cFjO5G/jgnnoRtJv9B7lZCSqv5R9WvBXVBIDbefEV3bBcFDVHSX6K+cgdJ4rC8ZGiEN1Jepc4eC5dK+Vq1IbTedv3Cw2dkQJysFn6xNuj+uN7WYi8WLxHXLBQC06cSRMVUi4lZNdHFzCppXBxWeWwMlDDsVPEuP3bWULpImhxsu4EvGg== 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: eefd771d-78ab-4b4f-1eb0-08d85e1ac9d5 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Sep 2020 10:40:41.7905 (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: mAlci7mrNv+cgjl2fiH629QexUN5mA18zFLBhiMKlc1nXzhJHLs4Zli0811MMz8nPYt62eN9SReuYSqMitPmDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR11MB3220 X-OriginatorOrg: intel.com 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 Akhil, Thanks for the review! > -----Original Message----- > From: Akhil Goyal > Sent: Friday, September 18, 2020 10:50 PM > To: Zhang, Roy Fan ; dev@dpdk.org > Cc: Trahe, Fiona ; Kusztal, ArkadiuszX > ; Dybkowski, AdamX > ; Bronowski, PiotrX > ; Anoob Joseph > Subject: RE: [dpdk-dev v9 1/4] cryptodev: add crypto data-path service AP= Is >=20 > Hi Fan, >=20 > > Subject: [dpdk-dev v9 1/4] cryptodev: add crypto data-path service APIs > > > > 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. > > > > 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(-) > > > > 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; > > } > > > > +/** 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 > > +}; >=20 > 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 pa= th APIs? >=20 Will add comments to this enum. Unless the driver will store xform data in certain way (in fact QAT has it)= the driver may not know which data-path to choose from. The purpose of having this enum is that the driver knows to attach the corr= ect handler into the service data structure fast. > > + > > #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; > > }; > > > > +/** > > + * 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. > > + */ >=20 > Fix typo Thanks will change. >=20 > > +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; >=20 > Should be chain instead of cipher_auth This field is used for cipher only, auth only, or chain use-cases so I beli= eve this is a better name for it. >=20 > > + 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; > > + }; >=20 > Can we also name this struct? > Probably we should split this as a separate patch. [Then this is an API break right?]=20 >=20 > > + > > + /* Supposed to be used with > > rte_cryptodev_dp_sym_submit_vec() > > + * call. > > + */ > > + union rte_crypto_sym_additional_data *additional_data; > > + }; > > + >=20 > 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= the > three > would be used. We have 2 main different uses cases, 1 for cpu crypto and 1 for data path A= PIs. Within each main uses case there are 4 types of algo (cipher only/auth= only/aead/chain), one requiring HW address and virtual address, the other = doesn't. It seems to causing too much confusion to include these many union into the= structure that initially was designed for cpu crypto only.=20 I suggest better to use different structure than squeeze all into a big uni= on. >=20 > > /** > > * 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); > > } > > > > +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; > > + } >=20 > I have some suggestions for the naming of the APIs / flags in the doc pat= ch, > 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. >=20 Will update. Thanks a lot! > > + > > + 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. Will change. >=20 > > + > > + 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) > > +{ >=20 > Can we have some debug checks for NULL checking. Will do. >=20 > > + return _cryptodev_dp_submit_single_job(ctx, data, n_data_vecs, > ofs, > > + additional_data, opaque); >=20 > 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); >=20 Will change. >=20 > > +} > > + > > +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); >=20 > 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 */ >=20 > Support data path APIs for raw data as input. Will update. >=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); > > > > +/** > > + * Get the size of the data-path service context for all registered dr= ivers. >=20 > For all drivers ? or for a device? For a device - sorry for the typo. >=20 > > + * > > + * @param dev_id The device identifier. > > + * > > + * @return > > + * - If the device supports data-path service, return the context si= ze. > > + * - 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 xfo= rm > > + * pointer. >=20 > Union of different symmetric crypto session types .. Sorry, will change. >=20 > > + */ > > +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 star= t > > + * 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. >=20 > Can you elaborate the usage of opaque here? User provided data that wants to retrieve when dequeue. Will do. >=20 > > + * @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 co= unt. > > + * 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, > such > > + * 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. >=20 > What is RTE_CRYPTO_HW_DP_FF_GET_OPAQUE_ARRAY, I did not find this in > the series. Will remove.=20 >=20 > > + * @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 > index, > > + 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[]; > > +}; >=20 > Comments missing for structure params. > Struct name can be rte_crypto_raw_dp_ctx. >=20 > Who allocate and free this structure? Same as crypto session, the user need to query the driver specific service = data Size and allocate the buffer accordingly. The difference is it does not hav= e to Be from mempool as it can be reused. >=20 > > + > > +/** > > + * Configure one DP service context data. Calling this function for th= e first > > + * time the user should unset the *is_update* parameter and the driver > will > > + * fill necessary operation data into ctx buffer. Only when > > + * rte_cryptodev_dp_submit_done() is called the data stored in the ctx > buffer > > + * 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 star= t > > + * 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 > last > > + * 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); > > > > +/** > > + * Typedef that the driver provided to get service context private dat= e > size. > > + * > > + * @param dev Crypto device pointer. > > + * > > + * @return > > + * - On success return the size of the device's service context priv= ate 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); > > > > /** 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. */ > > + }; > > + }; > > }; > > > > > > 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 { > > > > # added in 20.08 > > rte_cryptodev_get_qp_status; > > + > > + # added in 20.11 > > + rte_cryptodev_dp_configure_service; >=20 > Rte_cryptodev_configure_raw_dp >=20 > > + rte_cryptodev_dp_get_service_ctx_data_size; >=20 > Rte_cryptodev_get_raw_dp_ctx_size >=20 > > + rte_cryptodev_dp_sym_dequeue; >=20 > rte_cryptodev_raw_dequeue_burst >=20 > > + rte_cryptodev_dp_sym_dequeue_done; > rte_cryptodev_raw_dequeue_done >=20 > > + rte_cryptodev_dp_sym_dequeue_single_job; > rte_cryptodev_raw_dequeue >=20 > > + rte_cryptodev_dp_sym_submit_done; >=20 > rte_cryptodev_raw_enqueue_done >=20 > > + rte_cryptodev_dp_sym_submit_single_job; >=20 > rte_cryptodev_raw_enqueue >=20 > > + rte_cryptodev_dp_sym_submit_vec; >=20 > rte_cryptodev_raw_enqueue_burst >=20 > > }; >=20 > Please use above names for the APIs. > No need for keyword dp in enq/deq APIs as it is implicit that enq/deq API= s > are data path APIs. >=20 Will do. > I could not complete the review of this patch specifically as I see a lot= of > issues in the current version > Please send reply to my queries so that review can be completed. >=20 > Regards, > Akhil >=20