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 18C24A0471 for ; Wed, 17 Jul 2019 07:29:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DD9471B9AA; Wed, 17 Jul 2019 07:29:14 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id C026158C6 for ; Wed, 17 Jul 2019 07:29:07 +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 x6H5PFeP020277 for ; Tue, 16 Jul 2019 22:29:06 -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=UzX/xIJonBBtn96a9asmSgGDPkceP8WSLEcn4lqjtkaeBk/9lVXRudQ+Yqz+Mang+MAu Tq6rujXE+TQmy8X6YCyOzhuu8d+YRWBfHRempavaMuZUiE3YHXk5yIqPWE2Ed5l6qNV0 jpm6IouEtp+jGCuptgK+tWjOi4JgEl3TXjFhqbAxuadqUN1RO8XLBeqVDak/aFmPs4Zn pRXVJQmP6XMw+yUh5/EWZJQHrH7kI5WkbUYq3Wl1BZdQQVFD8rMu3S7qgVC9yFG1Szni LKIGmxZPx7deO4+P0Ls1DGDAjwyA1HD5S1MLXtjteCrMCCM9BneH+48Zv8mwC8eLtk20 6Q== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2ts07vet1n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 16 Jul 2019 22:29:06 -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; Tue, 16 Jul 2019 22:29:05 -0700 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (104.47.34.55) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Tue, 16 Jul 2019 22:29:05 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T9Sp+06FJ89FyJcu/vYawx2PSVTy7h/bbFUDgzhpyzlu8IsbckgoHb8GIIR7qRyypOfnhnut7RdNPnsS13poKil8WDkDU7GC7U1HsATsRkLJXNcsbEQJDznkCLVnBbIPksRE0cmXQSb7wWHnsIWNqSZgL35mlLMKx6P/l8v79kjbfbhJsUJjfahykS7M2ljvnqX1A3fOw6bJ5pvn7cS3VDOGMwtCu47L6L6A0PBIP4f0QLh35wujguWX9ndXoTUq02FvzmNhvQ84wruXlFc8181xst46i0l0zHlkshQcb/QmP3nOlenq3cfjZPjh2E+NQ6AYPCl4VdMkmMxJnH+3gg== 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=jfEc8lP5WKAadqZveuttnFUoOMh28fwCTEcVx1BbB/S0Z/lM23cQ1+bTgzEYsMZ8fcNxeWsStZ+RdFQ0sSWz7L2NiPrUUfP38egnYwwvKs/jjeDEJISGl1q2bPMYtoOOOu2tu+6xogc1KRwJz1q+JF93iWNh0AV9SPfkppeQs4Bupp5+nH/+Kzv4CICUIyGttvi74jF9dElAnEXQqP5GN7OahR1AmrKJg1mS6bZFqTIqY4fQ6jN8R4nPnUNBjreqMZEOX7PCKNm/kSP3SBmFV3W6SQgdlBS+/dCTW0oSyBclsf00RlBvQm7vbjjiUNZYF4gnnCJ1/pQ38066IxgiBw== 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=aWGSubXmfwXubOlVngAiuagBAnBMJrs8lRhC0XSLrQTwhHRfhoBwgJPApRc96pQKIIqgkOuRbu62pQHnej6AlxQpUH48AJs1/4D8NX9OC/sWz4fzKeeS/qVmxVFQ1qVGn6NxOn5EX/9fkwz9zTARG8bB7QT/3cuAntK+REouo1M= Received: from MN2PR18MB2797.namprd18.prod.outlook.com (20.179.22.16) by MN2PR18MB2767.namprd18.prod.outlook.com (20.179.20.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.11; Wed, 17 Jul 2019 05:29:04 +0000 Received: from MN2PR18MB2797.namprd18.prod.outlook.com ([fe80::5d53:ac2e:80ec:cd8f]) by MN2PR18MB2797.namprd18.prod.outlook.com ([fe80::5d53:ac2e:80ec:cd8f%6]) with mapi id 15.20.2073.012; Wed, 17 Jul 2019 05:29:04 +0000 From: Nagadheeraj Rottela To: "dev@dpdk.org" CC: Srikanth Jampala , Nagadheeraj Rottela Thread-Topic: [PATCH 03/10] crypto/nitrox: create Nitrox symmetric cryptodev Thread-Index: AQHVPGCMGZuKWEwgs0qUhllG6A2C0g== Date: Wed, 17 Jul 2019 05:29:04 +0000 Message-ID: <20190717052837.647-4-rnagadheeraj@marvell.com> References: <20190717052837.647-1-rnagadheeraj@marvell.com> In-Reply-To: <20190717052837.647-1-rnagadheeraj@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BMXPR01CA0001.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:d::11) 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: a350ca2f-0092-4875-bcae-08d70a77aeb4 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:MN2PR18MB2767; x-ms-traffictypediagnostic: MN2PR18MB2767: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5; x-forefront-prvs: 01018CB5B3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(346002)(366004)(396003)(39860400002)(136003)(199004)(189003)(55236004)(6512007)(66066001)(66946007)(66476007)(66446008)(86362001)(64756008)(66556008)(107886003)(14444005)(71190400001)(99286004)(256004)(71200400001)(7736002)(305945005)(54906003)(5660300002)(1730700003)(486006)(53936002)(26005)(81166006)(316002)(50226002)(6486002)(81156014)(8676002)(1076003)(6506007)(4326008)(25786009)(386003)(6116002)(11346002)(2616005)(3846002)(2351001)(6916009)(478600001)(14454004)(476003)(446003)(8936002)(68736007)(76176011)(102836004)(36756003)(186003)(52116002)(5640700003)(2906002)(6436002)(2501003); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2767; H:MN2PR18MB2797.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: PrL3ke1eCPrdszWFgrGqRy6JycHgAGIf8BvcYaGOsfawiAqn+v+wVE7f/N2xyCKHXbnxcSQ/BsQqPoN2mtWi80t+zwBn6r7MUc/KZa6VbnryEsgnS1NRkpCGvhcsmyHNaddw5Y4vRs5MlAvCa3J30RaLEUrNZYQYZUTaz93WLCwRUEo1KO9+6yd2zSLAHe2krF8lpa9qOHz0rXvWsuEFMBgTZHgkDknVa8enWVLuzAxfFEvzBbogAQrGNPvIudiQFURWmqnZD/zct7sMUal04zj7qbBF9nGjfngjvGqaVYM8yAldRxw6icZyTK8JdSEqzHxz3ToB9UtYvJQxQKTRRiJEBQWsSIJMEvdEz8R1NK8tUNh94qwjbgjIakZmDYsaDvFSPjg9VzGU7RVpz74Gw/TYszc+ANCp9WyquXttlJg= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a350ca2f-0092-4875-bcae-08d70a77aeb4 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Jul 2019 05:29:04.6409 (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: rnagadheeraj@marvell.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2767 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-07-17_02:2019-07-16,2019-07-17 signatures=0 Subject: [dpdk-dev] [PATCH 03/10] 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