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 C1FE2A0613 for ; Fri, 27 Sep 2019 08:26:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AED412C6A; Fri, 27 Sep 2019 08:26:36 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 377482C08 for ; Fri, 27 Sep 2019 08:26:32 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8R5nUWO007657; Thu, 26 Sep 2019 23:26:31 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=bDdQifW42IT8Gt+W2paWYnVHTJHK+RnAnY+jiOyYfOU=; b=R/iQiTOupB4dcDW2BEJPlFH6hJa5QL5CreHUoqoFVU3LXNFK2zYIAO3inLhtEQXQiKFT BcVqBDjJukMjvjEo5K5xN0h9TdV7iB5mkBa0GAfzbvM19hePRZ8etAqHZOznv729bE2c jz0cYj2YBQ4BSCCVD7jfbvPl82BWFnmljLz0PaW5ri3OGj1vhGvUFhqzmx9YZAxyasrx 1ChK+52aDdnBEI/y3BpUGEndZUE6osqSf7Q0koSZjtn1l3DWWFpbls1rL+N3EDdqFZnq 87PS3a13q8A8vcrrHpJo9znTOa3o4WbRWfnZa9Yrh8cgQQINwDmkIel9jSuzOoQEBPpH mA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2v8vdwmepf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 26 Sep 2019 23:26:31 -0700 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 26 Sep 2019 23:26:30 -0700 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (104.47.49.55) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 26 Sep 2019 23:26:29 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NSmeUro768qcT4OVtAFgUSxTgVpFK4+5S3S+PTfULL76SNvEaR9aOz9fzpIo3PJhIajQfJE2+rhzs4AwnqAdsP8tYFRc28oUufjxwOgYU5mC1CdefeOYlPT6Di8LPln3HVtDsZ7GbobubjIpZdZoI0QaSAz75UVijJCG3JVcsahnR1LXeN7OTE1BOzkgV3v3fNkupazEYqHh+309k92whhsGFWtJxG+mnHLVj3uub+VZuYUZSVTtlAPSZ1K9kntBQgB8S27i+/MiuLCkCkt+qLhB/IZpCy4/5Ou1yOksx7XP4HkPFV4UcmpDltUdvv12cSgkgTp7gC8xorXxW4aFgw== 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=bDdQifW42IT8Gt+W2paWYnVHTJHK+RnAnY+jiOyYfOU=; b=WmO63rhSIL8Mfb8OCMJzpmU1fMR/jbA7NGZlrGnXjAw+cu2Eb/QO6uZt3CzqRwVBx0tVKUX2NSoYDuCEd/vaa+oMizJoa8Y+a2a/hwwlRsc09W8miOH1c8Qsd2ZfyNg7X0qHSdrAMvvhDHsXQoKuAI7Mx91eNTeDE22sDa05scdZog+oXvyQJKfJiw0Sepz417C2juH0g6920mT4NWoq/sfPKOjkCooey2fVKzLhFMfvu2fWV+awlUxy/ao9p3cfg5cehCCio88lX9131VUqI2EPYKsPf6qC20Upx9quw0PS6BPqB65SPuHm47iyyUIyX913YFn8++AMcw+tGr1gzA== 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=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bDdQifW42IT8Gt+W2paWYnVHTJHK+RnAnY+jiOyYfOU=; b=MyGYmX1HzQxs7qv8ofCzirsUcuQiukhV5B7EOUl2iCtZgAER/ghscYAtgzFW1MdOW3SLlplK6PV7TrzUsSq1BpD07X7yqKrcwfJ8YBFsTfaVH3b5QCSIKaIXJ2ZAw7FwTfnnvGGuYQUUuVGgsfVQC4VCM5PUoGEb3LU81th7jDE= Received: from BYAPR18MB2792.namprd18.prod.outlook.com (20.179.56.216) by BYAPR18MB2984.namprd18.prod.outlook.com (20.179.59.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.19; Fri, 27 Sep 2019 06:26:28 +0000 Received: from BYAPR18MB2792.namprd18.prod.outlook.com ([fe80::7112:68c6:eb44:e9aa]) by BYAPR18MB2792.namprd18.prod.outlook.com ([fe80::7112:68c6:eb44:e9aa%3]) with mapi id 15.20.2284.028; Fri, 27 Sep 2019 06:26:28 +0000 From: Nagadheeraj Rottela To: "akhil.goyal@nxp.com" , "pablo.de.lara.guarch@intel.com" CC: Srikanth Jampala , "dev@dpdk.org" , Nagadheeraj Rottela Thread-Topic: [PATCH v6 2/8] crypto/nitrox: create Nitrox symmetric cryptodev Thread-Index: AQHVdPx+YpCq1JAEIky7F1+GKdkscQ== Date: Fri, 27 Sep 2019 06:26:28 +0000 Message-ID: <20190927062533.19005-3-rnagadheeraj@marvell.com> References: <20190716091016.4788-1-rnagadheeraj@marvell.com> <20190927062533.19005-1-rnagadheeraj@marvell.com> In-Reply-To: <20190927062533.19005-1-rnagadheeraj@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PN1PR0101CA0025.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::11) To BYAPR18MB2792.namprd18.prod.outlook.com (2603:10b6:a03:105::24) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.13.6 x-originating-ip: [115.113.156.2] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1911e16b-6c5b-4894-14ab-08d74313a0f3 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:BYAPR18MB2984; x-ms-traffictypediagnostic: BYAPR18MB2984: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:13; x-forefront-prvs: 0173C6D4D5 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(376002)(136003)(366004)(39860400002)(346002)(189003)(199004)(6436002)(26005)(2906002)(107886003)(14444005)(102836004)(3846002)(1076003)(66066001)(14454004)(6486002)(55236004)(36756003)(305945005)(256004)(478600001)(186003)(6506007)(66946007)(110136005)(76176011)(8936002)(8676002)(54906003)(6116002)(71190400001)(5660300002)(71200400001)(52116002)(386003)(66556008)(66446008)(446003)(11346002)(2501003)(86362001)(81166006)(64756008)(316002)(4326008)(66476007)(25786009)(50226002)(99286004)(2616005)(476003)(7736002)(486006)(81156014)(6512007); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR18MB2984; H:BYAPR18MB2792.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: YNq3eh9eN8Kq6ehlhd+sL8HV32i2A2Lao65J9XVRPbN94DfPZVT6wx9WREBTDVkEvqDZM1lPDhTFPy/Xxav45nrVTAbKCJp2tVJnNq3/F1V6nEb1aZ5K0sA+GXxP+QnpuoCOjnN3SIoSLmIydfziS0X2xqpwG4xWY7tzK5voAmrj2ddOehj2a3DPHB2Z97o0QvkHbOAPTv0aZnwu6FCZYexCso5OdsQiGrjzpDLfvm7njPiEm3+NbRIODWtz3JFQvoBgEb1MiB1ZniolOhYpSN39rLSND9Xj9MKE9K8AmEB+e3Wb+0hPdGkpJSHCJgBwnNLOvWWvoqWTM3oWIleJbzXcDd4upnbCHRG2HZe9SMlCrW8bExJkH2kUVyQdAMeFTaaoyCkQOMVvDLbNXZHZMgME3S61tStQVZ3GNaOKXq4= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 1911e16b-6c5b-4894-14ab-08d74313a0f3 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Sep 2019 06:26:28.3547 (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: /NsyvhkJb79SRh1EUvqMYEn/8mCrz9wUv4aS6Er9vBUC+pDbereEXsMVqtVmVp03FkE9BJQTdau17U2ESJGilp/zEom3oiIsbMfRQZjYDZA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR18MB2984 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-09-27_04:2019-09-25,2019-09-27 signatures=0 Subject: [dpdk-dev] [PATCH v6 2/8] crypto/nitrox: create Nitrox symmetric cryptodev 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" Add Nitrox symmetric cryptodev with following operations, - dev_configure - dev_start - dev_stop - dev_close - dev_infos_get Signed-off-by: Nagadheeraj Rottela --- drivers/crypto/nitrox/Makefile | 1 + drivers/crypto/nitrox/meson.build | 1 + drivers/crypto/nitrox/nitrox_device.c | 13 +++ drivers/crypto/nitrox/nitrox_device.h | 4 + drivers/crypto/nitrox/nitrox_sym.c | 163 ++++++++++++++++++++++++++++++= ++++ drivers/crypto/nitrox/nitrox_sym.h | 13 +++ 6 files changed, 195 insertions(+) create mode 100644 drivers/crypto/nitrox/nitrox_sym.c create mode 100644 drivers/crypto/nitrox/nitrox_sym.h diff --git a/drivers/crypto/nitrox/Makefile b/drivers/crypto/nitrox/Makefil= e index 7681a6603..06c96ccd7 100644 --- a/drivers/crypto/nitrox/Makefile +++ b/drivers/crypto/nitrox/Makefile @@ -26,5 +26,6 @@ LDLIBS +=3D -lrte_cryptodev SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) +=3D nitrox_device.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) +=3D nitrox_hal.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) +=3D nitrox_logs.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) +=3D nitrox_sym.c =20 include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/crypto/nitrox/meson.build b/drivers/crypto/nitrox/meso= n.build index ad81f8cd8..1277cf58e 100644 --- a/drivers/crypto/nitrox/meson.build +++ b/drivers/crypto/nitrox/meson.build @@ -12,4 +12,5 @@ sources =3D files( 'nitrox_device.c', 'nitrox_hal.c', 'nitrox_logs.c', + 'nitrox_sym.c', ) diff --git a/drivers/crypto/nitrox/nitrox_device.c b/drivers/crypto/nitrox/= nitrox_device.c index a73528211..5b319dd68 100644 --- a/drivers/crypto/nitrox/nitrox_device.c +++ b/drivers/crypto/nitrox/nitrox_device.c @@ -6,6 +6,7 @@ =20 #include "nitrox_device.h" #include "nitrox_hal.h" +#include "nitrox_sym.h" =20 #define PCI_VENDOR_ID_CAVIUM 0x177d #define NITROX_V_PCI_VF_DEV_ID 0x13 @@ -66,6 +67,7 @@ nitrox_pci_probe(struct rte_pci_driver *pci_drv __rte_unu= sed, struct rte_pci_device *pdev) { struct nitrox_device *ndev; + int err; =20 /* Nitrox CSR space */ if (!pdev->mem_resource[0].addr) @@ -76,6 +78,12 @@ nitrox_pci_probe(struct rte_pci_driver *pci_drv __rte_un= used, return -ENOMEM; =20 ndev_init(ndev, pdev); + err =3D nitrox_sym_pmd_create(ndev); + if (err) { + ndev_release(ndev); + return err; + } + return 0; } =20 @@ -83,11 +91,16 @@ static int nitrox_pci_remove(struct rte_pci_device *pdev) { struct nitrox_device *ndev; + int err; =20 ndev =3D find_ndev(pdev); if (!ndev) return -ENODEV; =20 + err =3D nitrox_sym_pmd_destroy(ndev); + if (err) + return err; + ndev_release(ndev); return 0; } diff --git a/drivers/crypto/nitrox/nitrox_device.h b/drivers/crypto/nitrox/= nitrox_device.h index 0d0167de2..6b8095f42 100644 --- a/drivers/crypto/nitrox/nitrox_device.h +++ b/drivers/crypto/nitrox/nitrox_device.h @@ -8,10 +8,14 @@ #include #include =20 +struct nitrox_sym_device; + struct nitrox_device { TAILQ_ENTRY(nitrox_device) next; struct rte_pci_device *pdev; uint8_t *bar_addr; + struct nitrox_sym_device *sym_dev; + struct rte_device rte_sym_dev; uint16_t nr_queues; }; =20 diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nit= rox_sym.c new file mode 100644 index 000000000..12817c6c7 --- /dev/null +++ b/drivers/crypto/nitrox/nitrox_sym.c @@ -0,0 +1,163 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include + +#include +#include + +#include "nitrox_sym.h" +#include "nitrox_device.h" +#include "nitrox_logs.h" + +#define CRYPTODEV_NAME_NITROX_PMD crypto_nitrox_sym + +struct nitrox_sym_device { + struct rte_cryptodev *cdev; + struct nitrox_device *ndev; +}; + +uint8_t nitrox_sym_drv_id; +static const char nitrox_sym_drv_name[] =3D RTE_STR(CRYPTODEV_NAME_NITROX_= PMD); +static const struct rte_driver nitrox_rte_sym_drv =3D { + .name =3D nitrox_sym_drv_name, + .alias =3D nitrox_sym_drv_name +}; + +static int nitrox_sym_dev_qp_release(struct rte_cryptodev *cdev, + uint16_t qp_id); + +static int +nitrox_sym_dev_config(struct rte_cryptodev *cdev, + struct rte_cryptodev_config *config) +{ + struct nitrox_sym_device *sym_dev =3D cdev->data->dev_private; + struct nitrox_device *ndev =3D sym_dev->ndev; + + if (config->nb_queue_pairs > ndev->nr_queues) { + NITROX_LOG(ERR, "Invalid queue pairs, max supported %d\n", + ndev->nr_queues); + return -EINVAL; + } + + return 0; +} + +static int +nitrox_sym_dev_start(struct rte_cryptodev *cdev) +{ + /* SE cores initialization is done in PF */ + RTE_SET_USED(cdev); + return 0; +} + +static void +nitrox_sym_dev_stop(struct rte_cryptodev *cdev) +{ + /* SE cores cleanup is done in PF */ + RTE_SET_USED(cdev); +} + +static int +nitrox_sym_dev_close(struct rte_cryptodev *cdev) +{ + int i, ret; + + for (i =3D 0; i < cdev->data->nb_queue_pairs; i++) { + ret =3D nitrox_sym_dev_qp_release(cdev, i); + if (ret) + return ret; + } + + return 0; +} + +static void +nitrox_sym_dev_info_get(struct rte_cryptodev *cdev, + struct rte_cryptodev_info *info) +{ + struct nitrox_sym_device *sym_dev =3D cdev->data->dev_private; + struct nitrox_device *ndev =3D sym_dev->ndev; + + if (!info) + return; + + info->max_nb_queue_pairs =3D ndev->nr_queues; + info->feature_flags =3D cdev->feature_flags; + info->driver_id =3D nitrox_sym_drv_id; + info->sym.max_nb_sessions =3D 0; +} + +static int +nitrox_sym_dev_qp_release(struct rte_cryptodev *cdev, uint16_t qp_id) +{ + RTE_SET_USED(cdev); + RTE_SET_USED(qp_id); + return 0; +} + +static struct rte_cryptodev_ops nitrox_cryptodev_ops =3D { + .dev_configure =3D nitrox_sym_dev_config, + .dev_start =3D nitrox_sym_dev_start, + .dev_stop =3D nitrox_sym_dev_stop, + .dev_close =3D nitrox_sym_dev_close, + .dev_infos_get =3D nitrox_sym_dev_info_get, + .stats_get =3D NULL, + .stats_reset =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 +}; + +int +nitrox_sym_pmd_create(struct nitrox_device *ndev) +{ + char name[RTE_CRYPTODEV_NAME_MAX_LEN]; + struct rte_cryptodev_pmd_init_params init_params =3D { + .name =3D "", + .socket_id =3D ndev->pdev->device.numa_node, + .private_data_size =3D sizeof(struct nitrox_sym_device) + }; + struct rte_cryptodev *cdev; + + rte_pci_device_name(&ndev->pdev->addr, name, sizeof(name)); + snprintf(name + strlen(name), RTE_CRYPTODEV_NAME_MAX_LEN, "_n5sym"); + ndev->rte_sym_dev.driver =3D &nitrox_rte_sym_drv; + ndev->rte_sym_dev.numa_node =3D ndev->pdev->device.numa_node; + ndev->rte_sym_dev.devargs =3D NULL; + cdev =3D rte_cryptodev_pmd_create(name, &ndev->rte_sym_dev, + &init_params); + if (!cdev) { + NITROX_LOG(ERR, "Cryptodev '%s' creation failed\n", name); + return -ENODEV; + } + + ndev->rte_sym_dev.name =3D cdev->data->name; + cdev->driver_id =3D nitrox_sym_drv_id; + cdev->dev_ops =3D &nitrox_cryptodev_ops; + cdev->enqueue_burst =3D NULL; + cdev->dequeue_burst =3D NULL; + cdev->feature_flags =3D RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | + RTE_CRYPTODEV_FF_HW_ACCELERATED; + + ndev->sym_dev =3D cdev->data->dev_private; + ndev->sym_dev->cdev =3D cdev; + ndev->sym_dev->ndev =3D ndev; + NITROX_LOG(DEBUG, "Created cryptodev '%s', dev_id %d, drv_id %d\n", + cdev->data->name, cdev->data->dev_id, nitrox_sym_drv_id); + return 0; +} + +int +nitrox_sym_pmd_destroy(struct nitrox_device *ndev) +{ + return rte_cryptodev_pmd_destroy(ndev->sym_dev->cdev); +} + +static struct cryptodev_driver nitrox_crypto_drv; +RTE_PMD_REGISTER_CRYPTO_DRIVER(nitrox_crypto_drv, + nitrox_rte_sym_drv, + nitrox_sym_drv_id); diff --git a/drivers/crypto/nitrox/nitrox_sym.h b/drivers/crypto/nitrox/nit= rox_sym.h new file mode 100644 index 000000000..f30847e8a --- /dev/null +++ b/drivers/crypto/nitrox/nitrox_sym.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#ifndef _NITROX_SYM_H_ +#define _NITROX_SYM_H_ + +struct nitrox_device; + +int nitrox_sym_pmd_create(struct nitrox_device *ndev); +int nitrox_sym_pmd_destroy(struct nitrox_device *ndev); + +#endif /* _NITROX_SYM_H_ */ --=20 2.13.6