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 4E0F9A054A; Tue, 25 Oct 2022 16:10:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0AFC642BF6; Tue, 25 Oct 2022 16:10:28 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 3E8CB42847 for ; Tue, 25 Oct 2022 16:10:25 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29P9Mshx032000; Tue, 25 Oct 2022 07:08:08 -0700 Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3kcg1muc4h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Oct 2022 07:08:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FmvvWHH6/lgPaxopGxNbBQWKKQbX8FzHKyUFTj9TG3MuwCWTu0GOmoyf6+6QtZfTrZsc/RNbxOIdWS8gHOsF1tiBGGEkG5xaq8KbiZPwO5VCUr3zLVNCLJUCWUxtWwX+tWTaWF5otlHL0dsZduttngWjiW2XCGnAYURaZpah1Li2/RPMsCzpCyJDzZpJ6mikX3xckogaEa4HbfEKjPob/LnXoaP0rf5A7ruAcOMdyL4WYCJLI4SJdXpa/8yHeFSvK6dktpJAFI7GFxH8TKCNCONmOU4BK7ENfbwH5t5XcNJ5rSvAr3GOCO7VeC5WoCIhDOdDdVfK6ecYfXZANPjwRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FH7CSOuiI/OwfecOZw0aNBgA4jzPxYJeIs9vEz8oUbA=; b=A/1CDMdWyCGfCIKGlz4vdxW/j67z4WD9rc5P9V0zyJ0Jl9O8lgg9UyCQg/FwdUhG0CEXxy61E/P8NQKXQ4vuX7D6+L1XVGN942HAeKlvAcxxjncf+AjcpBDX7+hUWgTU7jw6b4jakPJnqbISq834u4T8nBRs91P+3GtAJLFVH3LZAvhArGhvu2UqZ+uvlgf4XvLIkAp8zlMeiaor4EQnhPLEb7TaBN49vCLUWUe6p1RsevNLsIkKP4qlzAv4x6zikOzQLnZF57WmBv/wFtg67efYS5tiK+HG6g+PimPbbrP6g3ekbQKtlc4R2fYP0sENUVKZbdlgvRvim9F8AaNLCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FH7CSOuiI/OwfecOZw0aNBgA4jzPxYJeIs9vEz8oUbA=; b=iUpjfjbWk6FQY+YfTnX4hgwF/TZLpNFfqEsQYZ6itVVqBw8FOjUdIVtzqeFpmNxSCKX6XDXlpUxRmGU+mNB42ITqVDsiCiBT+aH3XszS28mqbZJGG9bUZOV/mryyDW3CQVWi2dc96gXTvjdy/3KFCqCRSo0YPqd5w5eMVMhmGD4= Received: from CO6PR18MB4484.namprd18.prod.outlook.com (2603:10b6:5:359::9) by SA1PR18MB4613.namprd18.prod.outlook.com (2603:10b6:806:1d0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.23; Tue, 25 Oct 2022 14:08:05 +0000 Received: from CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::8c4f:e24e:332d:dc6d]) by CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::8c4f:e24e:332d:dc6d%3]) with mapi id 15.20.5746.021; Tue, 25 Oct 2022 14:08:05 +0000 From: Akhil Goyal To: Zhangfei Gao , Declan Doherty , Fan Zhang , Ashish Gupta , Ray Kinsella , "thomas@monjalon.net" CC: "dev@dpdk.org" , "acc@openeuler.org" Subject: RE: [EXT] [PATCH resend v5 1/6] crypto/uadk: introduce uadk crypto driver Thread-Topic: [EXT] [PATCH resend v5 1/6] crypto/uadk: introduce uadk crypto driver Thread-Index: AQHY56/pdUs+D/WxuU2hLfjvhA0cJK4fIOhA Date: Tue, 25 Oct 2022 14:08:05 +0000 Message-ID: References: <20221024134409.1896776-1-zhangfei.gao@linaro.org> <20221024134409.1896776-2-zhangfei.gao@linaro.org> In-Reply-To: <20221024134409.1896776-2-zhangfei.gao@linaro.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CO6PR18MB4484:EE_|SA1PR18MB4613:EE_ x-ms-office365-filtering-correlation-id: c7756755-3183-462f-429d-08dab6925629 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: zHZdU8ADToZhRNrOgpJ3hEzOHQz7zdg8or78eKgKktJoAIoPRo/SVmLu+atqcTLZV7yYdhZX/xGoUV9ImBS16k6n6JMyTHqHjoNahfw3sMDLzqyAazr56tJHPm4KzmwEQNIGkdXwCA2FVwUl/rdeW7VdvnkCLvBiEBmVCF/Bp6K5tux5SnGlusWylTVxGkoe0naYgtFuLUFKUr0OPfBSMRWlD+rNFbL4UI3mlJzXHnjFZvIDtT18akLwwJ5Vd9ndynJo8FLR/M2aMTlx2+5ubPf+eVavLrYp+hQFUHbr8TeS0W+rPL2QKRS3je8K5o5Gm1yIf3NMbiNZFMXCYHQQqfjtIvHJlCByT78kSL7PxI2Ooc0K8a9cgwuA+CkbJSh4zQXhXQuaBrnEPftQyEy4Zbg1ndQl5a/zO46coCLuTSRpJ0a5QHUhXzZpCUfD7rd+77MgqnK4wSu1vmSxhRP8lJV+VbfnEOqJeo0POgQi3Lwklb8wgn1rdEZ+1SobBD5usB2AIypCL08gYMzDjwOmiNkqiSsyF9P07w3UF4d9i0noeA7GdFUpHyTRuSrqGmOz9DsonlYC6xIpcDli5Xmc+G0vV1Ycqv9IHYKeA/3O1cH62Qe/OZf9Gpwf4YuoPuX7rwdS53wVd4omdRCbgvO9qkH3trMJulhxq7E8B6QALENDtkI76ynkfpT9QkgTJIMAwrXB0yWW41UL2micy3eg1WAg0yANq9jWrBldFCcN/TV6+bC020jRJAMV+zDdcWUw5+o/STVeMdE6yPPvO3W+eEk3o23D0k+JOm6HLkGRbJk= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR18MB4484.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(396003)(136003)(366004)(376002)(346002)(39860400002)(451199015)(478600001)(966005)(7696005)(9686003)(71200400001)(6506007)(26005)(55236004)(8676002)(38070700005)(76116006)(4326008)(38100700002)(66556008)(52536014)(66446008)(64756008)(5660300002)(66476007)(66946007)(41300700001)(8936002)(122000001)(83380400001)(186003)(33656002)(54906003)(86362001)(316002)(110136005)(2906002)(55016003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?6b6ijA49Zubj3rs5JubZ5qO/2+XI1pwI4Jsk+Y2lkQfaFhJdM3Fp5PXsRwPJ?= =?us-ascii?Q?J5BC3piIwz78NNko5CK50HO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uE38YRLEkGhbHXUoFDh38UxosVYPHBndpZ7bFZvSjQhGjw/5xeHpqy9abFP?= =?us-ascii?Q?Vm6obFITbD7cfXaf0iRcf1X/gm78ejO6+OSOCVtiOgP8HMKkpTcZmNdJ7SMz?= =?us-ascii?Q?z9sA5ATf3jC0z9Or9zArGXFMaND+eonnYTu6PN/Pe1ha2ARzkxa1T4wh0t3+?= =?us-ascii?Q?ItNoJ2EtP3Pb1tH+xsrTprtHneSyQ99AELrbGz7EXna/MG2b8J3dr42ZBCFD?= =?us-ascii?Q?6MI2tNLyaFxgWrBs65Aa902+RfubGPDWgJ1vnzabZEq1huzevRfUE76dtbof?= =?us-ascii?Q?EhwU/rjZ/WlGdowbnkL83DqJlsihjVDDGtPfVt2xMvsgvFigqrazuAHNTO9b?= =?us-ascii?Q?oNf6atXIIO2tOyD/ro1DD3qkXQYl4F2p9lnsuSY5cf0gcHx+5fFEY8PsR6QM?= =?us-ascii?Q?GIwq/qyn3OCWZXUkg4VUyk3om1Uf21dxQ36J0al3OOqDDR4hNuU4dnextmSz?= =?us-ascii?Q?8wwGgKQ/k1BRbkcM0uyRobUiAX/V+kQCmGjY4nqqEOEkxU3O+50BwD6jUZK1?= =?us-ascii?Q?mWZvgTHURBWlgeFe7JVYmC9pJ77+13p/h6VUA8Sg/6ACOa0WtIg7mi5XmF9Q?= =?us-ascii?Q?f43S8QShgkiCOOux7sdoIAP1JTwT8GmWzdKyjvej?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR18MB4484.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7756755-3183-462f-429d-08dab6925629 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Oct 2022 14:08:05.2902 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: WwPtjDmtO2cikhCsg+7s2QsWoJ5SHDTltpvZbPOXGMw9/sXXGhOlckIQ+v/UEXlaSNNh5fvPgL1+z3CkuMlU8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR18MB4613 X-Proofpoint-ORIG-GUID: 6bd-060PQCY9lG3vQ6YxbCuIBA8adswy X-Proofpoint-GUID: 6bd-060PQCY9lG3vQ6YxbCuIBA8adswy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-25_06,2022-10-25_01,2022-06-22_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > diff --git a/doc/guides/cryptodevs/uadk.rst b/doc/guides/cryptodevs/uadk.= rst > new file mode 100644 > index 0000000000..1dfaab73c8 > --- /dev/null > +++ b/doc/guides/cryptodevs/uadk.rst > @@ -0,0 +1,73 @@ > +.. SPDX-License-Identifier: BSD-3-Clause > + Copyright 2022-2023 Huawei Technologies Co.,Ltd. All rights reserved= . > + Copyright 2022-2023 Linaro ltd. > + > +UADK Crypto Poll Mode Driver > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D The number of '=3D' are more than the above heading. > + > +UADK crypto PMD provides poll mode driver > +All cryptographic operations are using UADK crypto API. > +Hardware accelerators using UADK are supposed to be supported. The above description does not make sense. Please rewrite and add more information if possible. > + > + > +Features > +-------- > + > +UADK crypto PMD has support for: > + > + > +Test steps > +---------- > + > + .. code-block:: console > + > + 1. Build UADK > + $ git clone https://github.com/Linaro/uadk > + $ cd uadk > + $ mkdir build > + $ ./autogen.sh > + $ ./configure --prefix=3D$PWD/build > + $ make > + $ make install > + > + * Without --prefix, UADK will be installed to /usr/local/lib by default > + * If get error:"cannot find -lnuma", please install the libnuma-dev > + > + 2. Run pkg-config libwd to ensure env is setup correctly > + $ export PKG_CONFIG_PATH=3D$PWD/build/lib/pkgconfig > + $ pkg-config libwd --cflags --libs > + -I/usr/local/include -L/usr/local/lib -lwd > + > + * export PKG_CONFIG_PATH is required on demand, > + not needed if UADK is installed to /usr/local/lib > + > + 3. Build DPDK > + $ cd dpdk > + $ mkdir build > + $ meson build (--reconfigure) > + $ cd build > + $ ninja > + $ sudo ninja install > + > + 4. Prepare hugepage for dpdk > + $ echo 1024 > > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages > + $ echo 1024 > > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages > + $ echo 1024 > > /sys/devices/system/node/node2/hugepages/hugepages-2048kB/nr_hugepages > + $ echo 1024 > > /sys/devices/system/node/node3/hugepages/hugepages-2048kB/nr_hugepages > + $ mkdir -p /mnt/huge_2mb > + $ mount -t hugetlbfs none /mnt/huge_2mb -o pagesize=3D2MB > + > + 5. Run test app > + > +Dependency > +---------- > + > +UADK crypto PMD relies on UADK library [1] > + > +UADK is a framework for user applications to access hardware accelerator= s. > +UADK relies on IOMMU SVA (Shared Virtual Address) feature, which share > +the same page table between IOMMU and MMU. > +As a result, user application can directly use virtual address for devic= e dma, > +which enhances the performance as well as easy usability. s/dma/DMA > diff --git a/drivers/crypto/uadk/uadk_crypto_pmd.c > b/drivers/crypto/uadk/uadk_crypto_pmd.c > new file mode 100644 > index 0000000000..2ae2b33bd7 > --- /dev/null > +++ b/drivers/crypto/uadk/uadk_crypto_pmd.c > @@ -0,0 +1,121 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2022-2023 Huawei Technologies Co.,Ltd. All rights reserved. > + * Copyright 2022-2023 Linaro ltd. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include Separate out different type of headers with a blank line. #include #include #include #include #include #include #include > + > +enum uadk_crypto_version { > + UADK_CRYPTO_V2, > + UADK_CRYPTO_V3, > +}; > + > +struct uadk_crypto_priv { > + enum uadk_crypto_version version; > +} __rte_cache_aligned; > + > +static uint8_t uadk_cryptodev_driver_id; > + > +RTE_LOG_REGISTER_DEFAULT(uadk_crypto_logtype, INFO); > + > +#define UADK_LOG(level, fmt, ...) \ > + rte_log(RTE_LOG_ ## level, uadk_crypto_logtype, \ > + "%s() line %u: " fmt "\n", __func__, __LINE__, \ > + ## __VA_ARGS__) > + Is it not good to define the above macros and structs in header file? > +static struct rte_cryptodev_ops uadk_crypto_pmd_ops =3D { > + .dev_configure =3D NULL, > + .dev_start =3D NULL, > + .dev_stop =3D NULL, > + .dev_close =3D NULL, > + .stats_get =3D NULL, > + .stats_reset =3D NULL, > + .dev_infos_get =3D NULL, > + .queue_pair_setup =3D NULL, > + .queue_pair_release =3D NULL, > + .sym_session_get_size =3D NULL, > + .sym_session_configure =3D NULL, > + .sym_session_clear =3D NULL, > +}; > + > +static int > +uadk_cryptodev_probe(struct rte_vdev_device *vdev) > +{ > + struct rte_cryptodev_pmd_init_params init_params =3D { > + .name =3D "", > + .private_data_size =3D sizeof(struct uadk_crypto_priv), > + .max_nb_queue_pairs =3D > + > RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS, > + }; > + enum uadk_crypto_version version =3D UADK_CRYPTO_V2; > + struct uadk_crypto_priv *priv; > + struct rte_cryptodev *dev; > + struct uacce_dev *udev; > + const char *name; > + > + udev =3D wd_get_accel_dev("cipher"); > + if (!udev) > + return -ENODEV; > + > + if (!strcmp(udev->api, "hisi_qm_v2")) > + version =3D UADK_CRYPTO_V2; > + > + free(udev); > + > + name =3D rte_vdev_device_name(vdev); > + if (name =3D=3D NULL) > + return -EINVAL; > + > + dev =3D rte_cryptodev_pmd_create(name, &vdev->device, &init_params); > + if (dev =3D=3D NULL) { > + UADK_LOG(ERR, "driver %s: create failed", init_params.name); > + return -ENODEV; > + } > + > + dev->dev_ops =3D &uadk_crypto_pmd_ops; > + dev->driver_id =3D uadk_cryptodev_driver_id; > + dev->dequeue_burst =3D NULL; > + dev->enqueue_burst =3D NULL; > + dev->feature_flags =3D RTE_CRYPTODEV_FF_HW_ACCELERATED; > + priv =3D dev->data->dev_private; > + priv->version =3D version; > + > + rte_cryptodev_pmd_probing_finish(dev); > + > + return 0; > +} > + > +static int > +uadk_cryptodev_remove(struct rte_vdev_device *vdev) > +{ > + struct rte_cryptodev *cryptodev; > + const char *name; > + > + name =3D rte_vdev_device_name(vdev); > + if (name =3D=3D NULL) > + return -EINVAL; > + > + cryptodev =3D rte_cryptodev_pmd_get_named_dev(name); > + if (cryptodev =3D=3D NULL) > + return -ENODEV; > + > + return rte_cryptodev_pmd_destroy(cryptodev); > +} > + > +static struct rte_vdev_driver uadk_crypto_pmd =3D { > + .probe =3D uadk_cryptodev_probe, > + .remove =3D uadk_cryptodev_remove, > +}; > + > +static struct cryptodev_driver uadk_crypto_drv; > + > +#define UADK_CRYPTO_DRIVER_NAME crypto_uadk > +RTE_PMD_REGISTER_VDEV(UADK_CRYPTO_DRIVER_NAME, > uadk_crypto_pmd); > +RTE_PMD_REGISTER_CRYPTO_DRIVER(uadk_crypto_drv, > uadk_crypto_pmd.driver, > + uadk_cryptodev_driver_id); > diff --git a/drivers/crypto/uadk/version.map b/drivers/crypto/uadk/versio= n.map > new file mode 100644 > index 0000000000..c2e0723b4c > --- /dev/null > +++ b/drivers/crypto/uadk/version.map > @@ -0,0 +1,3 @@ > +DPDK_22 { > + local: *; > +}; This should be DPDK_23 > -- > 2.38.1