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 3FD7EA046B for ; Fri, 23 Aug 2019 12:42:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9336A1BFC5; Fri, 23 Aug 2019 12:42:24 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 891651BFAC for ; Fri, 23 Aug 2019 12:42:14 +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 x7NAePB7003996; Fri, 23 Aug 2019 03:42:13 -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=wKsbE3aRktnwo8U3tiUUGUKxm0ktMTbjICKDpjjms4U=; b=pXOZXq6LU//Jb6E1o7dvFMTiOPWPDRD8qeWGyrZ2QyRghFYk+Rzj7tosks6wyvIYQJ3t wicMiCVW3um2aVCdPPashyPO5CQewA6/k+DQq58q+U/6iAeN3O4efu9NzKcexILEOm8Q 6R4eD55pLci0r/Oz0mAtSizrSe2Cb8TysMYQc1X8l57hH/9rYO5E4zPxyLcQ83k+mehZ PzNb2NgZ5vMnAf487CZSB9bsBo9DvRuljPvbKk1Dy9931C7vAzJto14EuY8lT/hoeYSc 8wNOHcrt9Hv1HmeXGyWze2+KPXfTMsYydUh6gLVrgFRELlIKeneWV5IjAb8vYIGfnr1E 5A== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2uhad40cf9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 23 Aug 2019 03:42:13 -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; Fri, 23 Aug 2019 03:42:12 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.36.51) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Fri, 23 Aug 2019 03:42:12 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BSICpsWBWX6KELWDKH1TjBtBPk3WASKYE6R97BDq+urrV7brw0umtbzsRhoHcfOVTD1D7AH7f44+zREj/mbxWI2ju+N4OQK8uN1EMvfF8keV448Hmxj6DOKnZMF3KyVeR28FfJw7fjylqEPEmGj5EZ95kldgpGvJdmn0VUXFBw2/pag0H7iwpkNjSI9CGQMm0a7TiKxjDg7XGRZu2GKLVAg6ndHQ8/n+7p31cOLdYaLHW5ZnZNWLFVTKpK8LfPsjsQZ3e9Wa+MwOp+ktmnL+0O+U3FhtMka38woXHS7qGQ2cZvqXFcazC/KtSzz/u8B34E9D5PB5ROcBnIDlm+YvCQ== 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=wKsbE3aRktnwo8U3tiUUGUKxm0ktMTbjICKDpjjms4U=; b=bsrHJVvJfHGIlg/pzuso+bt00rtLSvDd6PV8ttgjVOPiEcAKVdPBlaMNg2KhNX6i7O0UqTBVxCq0DohXs0vG4cbz5iBwciQ0TNDrvBeir4HD7JUDY8BFGonlxKdhnn6LpBXIRWJ3lbM2NLcgXSQBV+f8tTcKUy2XkhDT9SgWh3aMbOOUAEi83dI5c2FHba3WiHmKIaiSveqP/f9+WGexDNsuC8c2hLKwMqUsNInhnxJKRzdA3aWdnYmQdM/LWfWpo4Z5NZF8ukaTJC9tFtBknOm/L/j5PN2cK/hKt7uj3lttydp32O/fZ0NUjLIMJAOtuyqYVeO0qO8ldBtjiwqzeA== 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=wKsbE3aRktnwo8U3tiUUGUKxm0ktMTbjICKDpjjms4U=; b=iLfcv+1LW5GtEhl1ft86ZUbCRMtzCfy1C+xQ4He9uHV4Gqmx0JJNgnmQe4F5nBbgB/Abj8NdswBKXvSYdjDEYKD1nyxgG3e9Ufk6ORKcPtXne71QoXLM2XPkzpUnJJZAMqQdDn+Ut3zQTKagLfiCUuk7Ug0qTX9D0KlZ25xPJYM= Received: from MN2PR18MB2797.namprd18.prod.outlook.com (20.179.22.16) by MN2PR18MB2830.namprd18.prod.outlook.com (20.179.23.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.18; Fri, 23 Aug 2019 10:42:11 +0000 Received: from MN2PR18MB2797.namprd18.prod.outlook.com ([fe80::28ff:b1d2:ef69:5e84]) by MN2PR18MB2797.namprd18.prod.outlook.com ([fe80::28ff:b1d2:ef69:5e84%5]) with mapi id 15.20.2178.018; Fri, 23 Aug 2019 10:42:11 +0000 From: Nagadheeraj Rottela To: "akhil.goyal@nxp.com" , "pablo.de.lara.guarch@intel.com" CC: "dev@dpdk.org" , Srikanth Jampala , Nagadheeraj Rottela Thread-Topic: [PATCH v3 03/11] crypto/nitrox: create Nitrox symmetric cryptodev Thread-Index: AQHVWZ9rLQxTm2wl5EmwFmvuhb+uJA== Date: Fri, 23 Aug 2019 10:42:11 +0000 Message-ID: <20190823104144.19300-4-rnagadheeraj@marvell.com> References: <20190717052837.647-1-rnagadheeraj@marvell.com> <20190823104144.19300-1-rnagadheeraj@marvell.com> In-Reply-To: <20190823104144.19300-1-rnagadheeraj@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PN1PR01CA0110.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00::26) To MN2PR18MB2797.namprd18.prod.outlook.com (2603:10b6:208:a0::16) 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: eb86adef-6724-4ed8-dd7e-08d727b68dd5 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:MN2PR18MB2830; x-ms-traffictypediagnostic: MN2PR18MB2830: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5; x-forefront-prvs: 0138CD935C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(366004)(396003)(376002)(136003)(346002)(189003)(199004)(26005)(81166006)(14454004)(2616005)(476003)(5660300002)(86362001)(71190400001)(71200400001)(316002)(486006)(36756003)(25786009)(66066001)(53936002)(11346002)(446003)(305945005)(7736002)(54906003)(110136005)(256004)(14444005)(6486002)(99286004)(3846002)(6436002)(6116002)(478600001)(2906002)(186003)(8936002)(6512007)(50226002)(81156014)(55236004)(102836004)(1076003)(107886003)(4326008)(64756008)(66946007)(66446008)(8676002)(66556008)(66476007)(2501003)(6506007)(386003)(52116002)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2830; H:MN2PR18MB2797.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: R0CnqUSNk4KbxDhwMtlMgEvu4iqyrecuAIg72UgbgbNwFwRwcV9DzLZRzph9rstHDKWj2gcyiwR40TXQVkNku2msYWz0DG+aiEAoKZ0tIGrdg+4vZ8gad20Cxijem8BQFeegS7yGt2IdSA+U7WzDdQueiHb0a6TylqBACAtbn5E7j2ZHHiOkP8P5olTJ5S4SFzRmUOq+N4SKjmOqRb+E6CERhM8xMcsgOCG3TNliiWM8Bw4Q5xseJSZB6vgrQH+sUUcQZpOXVuUHURcP+zH3tBALAQ9c/pz7ECF7OFzi+xQ3EZnCZyunEDVak/vl5kjrNR18h+sK6soISMdpwSR/oiPaLbkv2fOwkQAsZGNFZ+K1PqU6JnuPMVhrKy+dvqpsovqYJ630jx5KoKXoPVqg3XtBVn9OPPJGrZ5Zo18tWuQ= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: eb86adef-6724-4ed8-dd7e-08d727b68dd5 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Aug 2019 10:42:11.5567 (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: v5FUj/BwP33o5D9Hw915P4+AkVnzooZvugDJcNB184cUcMwSzRim2adgf/tSk1l1VPid3AVWoqYL4r1uVZku6tmAn6Iqr40PvRyuq692fIU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2830 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-08-23_04:2019-08-21,2019-08-23 signatures=0 Subject: [dpdk-dev] [PATCH v3 03/11] 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 no operations. Cryptodev operations will be added in the next set of patches. Also, registered nitrox log type. Signed-off-by: Nagadheeraj Rottela --- drivers/crypto/nitrox/Makefile | 2 + drivers/crypto/nitrox/meson.build | 2 + drivers/crypto/nitrox/nitrox_device.c | 9 ++++ drivers/crypto/nitrox/nitrox_device.h | 6 +++ drivers/crypto/nitrox/nitrox_logs.c | 14 ++++++ drivers/crypto/nitrox/nitrox_logs.h | 16 +++++++ drivers/crypto/nitrox/nitrox_sym.c | 83 +++++++++++++++++++++++++++++++= ++++ drivers/crypto/nitrox/nitrox_sym.h | 13 ++++++ 8 files changed, 145 insertions(+) create mode 100644 drivers/crypto/nitrox/nitrox_logs.c create mode 100644 drivers/crypto/nitrox/nitrox_logs.h 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 bc0220964..06c96ccd7 100644 --- a/drivers/crypto/nitrox/Makefile +++ b/drivers/crypto/nitrox/Makefile @@ -25,5 +25,7 @@ LDLIBS +=3D -lrte_cryptodev # library source files 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 f1c96b84d..1277cf58e 100644 --- a/drivers/crypto/nitrox/meson.build +++ b/drivers/crypto/nitrox/meson.build @@ -11,4 +11,6 @@ allow_experimental_apis =3D true 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 5628c6d8b..ec2aae588 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 TAILQ_HEAD(ndev_list, nitrox_device); static struct ndev_list ndev_list =3D TAILQ_HEAD_INITIALIZER(ndev_list); @@ -63,6 +64,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) @@ -73,6 +75,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 @@ -85,6 +93,7 @@ nitrox_pci_remove(struct rte_pci_device *pdev) if (!ndev) return -ENODEV; =20 + nitrox_sym_pmd_destroy(ndev); ndev_release(ndev); return 0; } diff --git a/drivers/crypto/nitrox/nitrox_device.h b/drivers/crypto/nitrox/= nitrox_device.h index 0d0167de2..82ba8b4e4 100644 --- a/drivers/crypto/nitrox/nitrox_device.h +++ b/drivers/crypto/nitrox/nitrox_device.h @@ -8,10 +8,16 @@ #include #include =20 +#define NITROX_DEV_NAME_MAX_LEN RTE_CRYPTODEV_NAME_MAX_LEN + +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_logs.c b/drivers/crypto/nitrox/ni= trox_logs.c new file mode 100644 index 000000000..007056cb4 --- /dev/null +++ b/drivers/crypto/nitrox/nitrox_logs.c @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include + +int nitrox_logtype; + +RTE_INIT(nitrox_init_log) +{ + nitrox_logtype =3D rte_log_register("pmd.crypto.nitrox"); + if (nitrox_logtype >=3D 0) + rte_log_set_level(nitrox_logtype, RTE_LOG_NOTICE); +} diff --git a/drivers/crypto/nitrox/nitrox_logs.h b/drivers/crypto/nitrox/ni= trox_logs.h new file mode 100644 index 000000000..06fd21a95 --- /dev/null +++ b/drivers/crypto/nitrox/nitrox_logs.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#ifndef _NITROX_LOGS_H_ +#define _NITROX_LOGS_H_ + +#define LOG_PREFIX "NITROX: " + +extern int nitrox_logtype; + +#define NITROX_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, nitrox_logtype, \ + LOG_PREFIX "%s:%d " fmt, __func__, __LINE__, ## args) + +#endif /* _NITROX_LOGS_H_ */ diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nit= rox_sym.c new file mode 100644 index 000000000..c72016dd0 --- /dev/null +++ b/drivers/crypto/nitrox/nitrox_sym.c @@ -0,0 +1,83 @@ +/* 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 + +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 +}; + +int +nitrox_sym_pmd_create(struct nitrox_device *ndev) +{ + char name[NITROX_DEV_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), NITROX_DEV_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 NULL; + cdev->enqueue_burst =3D NULL; + cdev->dequeue_burst =3D NULL; + cdev->feature_flags =3D RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | + RTE_CRYPTODEV_FF_HW_ACCELERATED | + RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | + RTE_CRYPTODEV_FF_IN_PLACE_SGL | + RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT | + RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT | + RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT | + RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT; + + 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) +{ + rte_cryptodev_pmd_destroy(ndev->sym_dev->cdev); + return 0; +} + +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