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 4285FA2EDB for ; Tue, 1 Oct 2019 08:41:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4309C1B952; Tue, 1 Oct 2019 08:41:29 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id E17EE5B32 for ; Tue, 1 Oct 2019 08:41:26 +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 x916eKWW006649; Mon, 30 Sep 2019 23:41:26 -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=eyPF8yrKE0+Ri/v+U9ZzZOWPCGslneJEp989JiVVhoA4Z0dcUe6J9mjy493jd9hfW6pE 7RI2Ekox3EoUaayUsag0dt199P7L1rYlwAdVFA30cUzI4zkCmpNmNFin8VPwO03+n1km BJfkKFRUO/ZitzqzytAUm3yiQO93a/hjYNaoPMUgYn08Up0wSfx8mcfDEwGhaE/MhOA6 pIWJwhJL2VQ7ccnC3kuis7vLGtPrctmah9zCthWEeVoLhuducs7cMVutoaLMDKotg5z/ 0g95mfauodyELbjfCBECK1bZ+DR0+CeK74382Z03oe0JI9bZnviEF+4BvJ9sUYWf1a55 fA== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2vbur190w4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 30 Sep 2019 23:41:25 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 30 Sep 2019 23:41:24 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (104.47.44.52) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 30 Sep 2019 23:41:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f4JAFQK3gNX3dyDSNnxpsz6HKRCEB5dLLspmOqqWM+Viauv09NGbFf0EvYA5d4Sr6SrZapbEsnKVBMVYT58perYMOWxRl2SCtYtdUFFHSBTgBade6WQhgOSimp/zHV/FgBHG8khlJZ7YqOLNzN/uywk/RSbVAzvpAd9yJAwrKffU9npeLtDXEq4t4opLPXrlq6Rvh6WJcRolhgg9hdhNEUP55ePnEy0OF2wHBJRmPYuud3p9cAxA1tL5b3mtGcMFYYM+bVt3x/CSAAN9XEoeMA3YLbTLT2cSGj0Ky1HGyV6JYPZREiSF09gfGa1GVZ+b8ySkjjA0TOqbAXojfRRYfw== 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=aCaXDnl+lRmetTpzZmwodQIa7B2R2pjNlTfclZlcwrXSShziE1FUGhdWvelqHNnHYdIAAujqQVcAb1DFdDqe8q33Kp+6eumNNSh0AojjA6ZEgPz8m7TL2WvQ5dgFJR6Uqat09K79ILYssrvjOY7h7wwSZswrw8YMVoJ9+Q5YuGI8yQhpPsJH/AXIGPVgk2ti8KQ3BVn67Z57msRYzTWBjP55D8CmfjeQAX5Q9EBo/j8WwRofS5is31CLQAjZUrZulDnuSubHVCp6I695Z3V//REzswYPe7k2wD4LCgOX/4q6leSWOKT2FpVx0EkL7BJ3vRsSQyMeQkiOlSvb+GmFcA== 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=A4Vcw32TrSPl0vvxcuyqFl6rLn1PdhsLpn9+SZBO+kIrJRFo4jSj5nxeffaFSZy+8TtOzcqRwR2qcKVx2n2Gy+RBCAL6NbTqB2Qh7hJMZdMdfv4WodsTl8U4X9SOP4YX9YqwLMjDulqwIwYwRCkpqUVjgrAyH1YV67CSMqcP8SE= Received: from MN2PR18MB2797.namprd18.prod.outlook.com (20.179.22.16) by MN2PR18MB3375.namprd18.prod.outlook.com (10.255.238.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.15; Tue, 1 Oct 2019 06:41:23 +0000 Received: from MN2PR18MB2797.namprd18.prod.outlook.com ([fe80::259c:a73e:a83:ccfe]) by MN2PR18MB2797.namprd18.prod.outlook.com ([fe80::259c:a73e:a83:ccfe%4]) with mapi id 15.20.2305.017; Tue, 1 Oct 2019 06:41:23 +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 v7 2/8] crypto/nitrox: create Nitrox symmetric cryptodev Thread-Index: AQHVeCM9l7P/OIQbAEG0x8mZbFOgkw== Date: Tue, 1 Oct 2019 06:41:23 +0000 Message-ID: <20191001064048.5624-3-rnagadheeraj@marvell.com> References: <20190716091016.4788-1-rnagadheeraj@marvell.com> <20191001064048.5624-1-rnagadheeraj@marvell.com> In-Reply-To: <20191001064048.5624-1-rnagadheeraj@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PN1PR0101CA0050.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:d::12) 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: c237de93-0c0f-4bb8-4127-08d7463a5ff9 x-ms-traffictypediagnostic: MN2PR18MB3375: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:13; x-forefront-prvs: 0177904E6B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(396003)(39850400004)(346002)(136003)(376002)(199004)(189003)(66946007)(76176011)(6512007)(66556008)(476003)(81166006)(66476007)(478600001)(446003)(14444005)(52116002)(256004)(99286004)(486006)(81156014)(8936002)(305945005)(2616005)(64756008)(5660300002)(4326008)(66066001)(316002)(11346002)(6436002)(25786009)(2906002)(386003)(71200400001)(71190400001)(14454004)(107886003)(6486002)(55236004)(102836004)(110136005)(54906003)(8676002)(2501003)(186003)(66446008)(6116002)(3846002)(50226002)(86362001)(26005)(36756003)(1076003)(7736002)(6506007); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB3375; 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: BCL:0; x-microsoft-antispam-message-info: f3f579hQBf5LO20bGK3NwV9CllTNRMSiPHvskQxJabF/RRWetzFNclefxgO5BEf9eKbQ1FUu0YeIts0NGm5cksCgYuhHSgtIxgJu6jPhtubmSr7DcvZX7ZCmUes/LssBCagzSulc9mNImM55R/a5pBzBo5Swm/NePJEvbAcRr2By+dMzTNY32pf0jnXbtqH7426OywspspvCtK8x9ylCSTfKXi58/IlEdRfMlMoYVb07zWo4JRADb0EMnB4+JknLq2RUAqM6f4ueNVd7Fn/LJTiaT6NIy6OEmWGWVr6kWptP8dugDTgXZMZCzSgjMmUCyeYCdKhG0NlEq0YQGqVKE1wxQ99xeXwMsJGLp/gWkq/7vrV9KXOj7KRpVdoFjZI+lSij5mOY9omNXFuqcuMxi3bFj/mGpfvVl7/11KViwJA= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: c237de93-0c0f-4bb8-4127-08d7463a5ff9 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Oct 2019 06:41:23.0141 (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: dFAXHFtAdbH/ugBwl+kUywMkWNvyDO9dYMEm5K7LGP4pWLRUZeD8h46BCP52Q8pg/DRnvUDmgBO8KMia8u5SMyFeMDwiZj3YpZMJUgfI5MA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3375 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-01_03:2019-09-30,2019-10-01 signatures=0 Subject: [dpdk-dev] [PATCH v7 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