From patchwork Wed Jul 17 05:29:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nagadheeraj Rottela X-Patchwork-Id: 56561 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ABD681B9D6; Wed, 17 Jul 2019 07:29:17 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 88D8B1B94E for ; Wed, 17 Jul 2019 07:29:10 +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 x6H5PpuV003043 for ; Tue, 16 Jul 2019 22:29:09 -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=I4eCsUpfWITOuDcOzJWZ4GoYYZM99YBZvVVUVWd7lhE=; b=R88aCXgrRfbGdLfLKOJj6Oz/jMdvKrlON0Br3MN10GvpekZ7MShzcdAGw8qr5HgBQKhB pslSrRXoilno1xmu9uO9gIxMZHRs/5FHXpezMyG+8T3Skde8K3a1XbF3YgB8+S2tKO/g bSnnXnQdqGNe2P90tT2u/1HR5flP/d07hx17C2GtXOXz3qr49NRQgxgRWW6CnZ0CC5Lm 0ODjBk0BRr5cgNQ6AcQfpU/v8OlRlRRbsnV16lUX3pR+HuN4WJ0jRiLRMbIkTPpSnKG/ miDUNYxcsIOo9DvgRJnnA7PDHYRCvom29yi5VQAVahSJJCpol2cqrH3nstkeBwKJQgac oQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2ts07vet1r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 16 Jul 2019 22:29:08 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) 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:07 -0700 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (104.47.34.53) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Tue, 16 Jul 2019 22:29:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WT+QaDoroqIvPorrSRNZIaTlf6gLtH9jgjLMm2LhTEwEmmjBApLGcq9UYQcCx2grlVT63Iei69vzJZGUxL8zpYNg+RpePkRbr6EUp9VC+f7DNK7/2y0dIdVVndb+LpBI9Qg07uGUv8JlThEL9a+zSkLligN3vm6QqE8SYe/lSPVNxGIHSm1xdNdz8Jno7Mr0dLZ13Trn9N9F45BASzS1FXxZQLV+aV00OjjZtZngra9zYFDZY3IiEiUgdQFuEmPBeyoMMIMxZ5tWRMjSTHuZKTnSaryp+l+hzpQh6/+7klBtv1skTO+haDD0yEYlaID466HxpKINMkxYSgimylnD4A== 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=I4eCsUpfWITOuDcOzJWZ4GoYYZM99YBZvVVUVWd7lhE=; b=JbkqkYzuZH7NyA2X11turLV6XVBtPW4UcwMCLfiP3VyZNVlwc6teHm1PhZ+Ek/VG4i8dGxXJSAjpvvNXIdRec0skJb7GU6ASV4FsHfW7mrCVU8M/NsFMJjl2+04Qaa0BE0QXw5lMUNCorT5OTT4BSUbFxzbKVsZRCaLtTlm5ScszIRZJjqlcVVedGylYvBcjY2MC5UBYrMJZTgYZCL9sK2AGr9nYF1GWXjDFPz5E8jat7/KoYdy56+a3lkOu9okbJQmi3LrUV/G8cOfRn4wq62kRbTGSBZcNHscM3h/6oDKS5kRHkt7yweC1r1qUtz8NL5TcDyYWNW49DfB+F1WAng== 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=I4eCsUpfWITOuDcOzJWZ4GoYYZM99YBZvVVUVWd7lhE=; b=ivBmg+lPK2eAFIRfaMn8Y/ab2fAiN0BY9nK7D1nZET48FU92FFk+s58wPaQQv+IxkApzPZy6vrHPT9xSJi+UkAYu2JPbHTCAR9jUgZM622MFdTd7pn+kzCW1QupavEgn6YUmGc+8DNJFyznXdhT8HfiK1/fkKi6EHw9ejOCw1Nk= 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:06 +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:06 +0000 From: Nagadheeraj Rottela To: "dev@dpdk.org" CC: Srikanth Jampala , Nagadheeraj Rottela Thread-Topic: [PATCH 04/10] crypto/nitrox: add basic symmetric cryptodev operations Thread-Index: AQHVPGCNjTe2Puxn90WudojA5JQbxQ== Date: Wed, 17 Jul 2019 05:29:06 +0000 Message-ID: <20190717052837.647-5-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: ce70ec15-73e2-48d7-7b85-08d70a77afa2 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-ms-exchange-purlcount: 2 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; 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)(6306002)(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)(966005)(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: I0a50YVsKxcRCiqX+ZtV0bVOUMjhuEcyXKSn+tOCIhLCMgCpvRKfGJDgrwV4uZ9GOnybI+qguCjajyJjL7mFMdLY5hSlCtz1ZW+Sc1C5TKeM4w438aKkkYDCMh6MLOfUrmuwIJa5v6rLo/+KliE+10a0glQMkCJmslTVaJBZKINyjcvcsNRm216ZIbSLRALxmziGsjF6sY4OWehA2T1JSZl9MSwp1BJrU6R7VZSkVIZbZX+HF8A+mgHP72vhMnQLKOTXKXPCVFpZ0JsqpnKTKhYSQeicgfaZ32hSqe5MvulP+Gq8U6uM37kUxbL023YfGGdeVh4TYJ0h/pJ8s3DICqBjP4Y7XyuX119no0bUt6affVwJBJ2F5Cb0UgMU6Yy5gvU3G7Qe00u074uTfOGcKarWkqIGJfXDH8jzKzt7Vr0= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: ce70ec15-73e2-48d7-7b85-08d70a77afa2 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Jul 2019 05:29:06.2450 (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 04/10] crypto/nitrox: add basic symmetric cryptodev operations 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 the following cryptodev operations, - dev_configure - dev_start - dev_stop - dev_close - dev_infos_get Signed-off-by: Nagadheeraj Rottela --- doc/guides/cryptodevs/features/nitrox.ini | 38 ++++++++++++ doc/guides/cryptodevs/nitrox.rst | 37 +++++++++++ drivers/crypto/nitrox/Makefile | 1 + drivers/crypto/nitrox/meson.build | 1 + drivers/crypto/nitrox/nitrox_sym.c | 81 ++++++++++++++++++++++++- drivers/crypto/nitrox/nitrox_sym_capabilities.c | 57 +++++++++++++++++ drivers/crypto/nitrox/nitrox_sym_capabilities.h | 12 ++++ 7 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 doc/guides/cryptodevs/features/nitrox.ini create mode 100644 drivers/crypto/nitrox/nitrox_sym_capabilities.c create mode 100644 drivers/crypto/nitrox/nitrox_sym_capabilities.h diff --git a/doc/guides/cryptodevs/features/nitrox.ini b/doc/guides/cryptodevs/features/nitrox.ini new file mode 100644 index 000000000..9f9e2619c --- /dev/null +++ b/doc/guides/cryptodevs/features/nitrox.ini @@ -0,0 +1,38 @@ +; +; Supported features of the 'nitrox' crypto driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Symmetric crypto = Y +Sym operation chaining = Y +HW Accelerated = Y +In Place SGL = Y +OOP SGL In SGL Out = Y +OOP SGL In LB Out = Y +OOP LB In SGL Out = Y +OOP LB In LB Out = Y + +; +; Supported crypto algorithms of the 'nitrox' crypto driver. +; +[Cipher] +AES CBC (128) = Y +AES CBC (192) = Y +AES CBC (256) = Y + +; +; Supported authentication algorithms of the 'nitrox' crypto driver. +; +[Auth] +SHA1 HMAC = Y + +; +; Supported AEAD algorithms of the 'nitrox' crypto driver. +; +[AEAD] + +; +; Supported Asymmetric algorithms of the 'nitrox' crypto driver. +; +[Asymmetric] diff --git a/doc/guides/cryptodevs/nitrox.rst b/doc/guides/cryptodevs/nitrox.rst index b6b86dda5..c16a5e393 100644 --- a/doc/guides/cryptodevs/nitrox.rst +++ b/doc/guides/cryptodevs/nitrox.rst @@ -9,3 +9,40 @@ cryptographic operations to the NITROX V security processor. Detailed information about the NITROX V security processor can be obtained here: * https://www.marvell.com/security-solutions/nitrox-security-processors/nitrox-v/ + +Features +-------- + +Nitrox crypto PMD has support for: + +Cipher algorithms: + +* ``RTE_CRYPTO_CIPHER_AES_CBC`` + +Hash algorithms: + +* ``RTE_CRYPTO_AUTH_SHA1_HMAC`` + +Limitations +----------- + +* AES_CBC Cipher Only combination is not supported. + +Installation +------------ + +For compiling the Nitrox crypto PMD, please check if the +CONFIG_RTE_LIBRTE_PMD_NITROX setting is set to `y` in config/common_base file. + +* ``CONFIG_RTE_LIBRTE_PMD_NITROX=y`` + +Initialization +-------------- + +Nitrox crypto PMD depend on Nitrox kernel PF driver being installed on the +platform. Nitrox PF driver is required to create VF devices which will +be used by the PMD. Each VF device can enable one cryptodev PMD. + +Nitrox kernel PF driver is available as part of CNN55XX-Driver SDK. The SDK +and it's installation instructions can be obtained from: +`Marvell Technical Documentation Portal `_. diff --git a/drivers/crypto/nitrox/Makefile b/drivers/crypto/nitrox/Makefile index 06c96ccd7..dedb74a34 100644 --- a/drivers/crypto/nitrox/Makefile +++ b/drivers/crypto/nitrox/Makefile @@ -27,5 +27,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) += nitrox_device.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) += nitrox_hal.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) += nitrox_logs.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) += nitrox_sym.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_NITROX) += nitrox_sym_capabilities.c include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/crypto/nitrox/meson.build b/drivers/crypto/nitrox/meson.build index 1277cf58e..7c565c5a4 100644 --- a/drivers/crypto/nitrox/meson.build +++ b/drivers/crypto/nitrox/meson.build @@ -13,4 +13,5 @@ sources = files( 'nitrox_hal.c', 'nitrox_logs.c', 'nitrox_sym.c', + 'nitrox_sym_capabilities.c', ) diff --git a/drivers/crypto/nitrox/nitrox_sym.c b/drivers/crypto/nitrox/nitrox_sym.c index c72016dd0..c05042e54 100644 --- a/drivers/crypto/nitrox/nitrox_sym.c +++ b/drivers/crypto/nitrox/nitrox_sym.c @@ -9,6 +9,7 @@ #include "nitrox_sym.h" #include "nitrox_device.h" +#include "nitrox_sym_capabilities.h" #include "nitrox_logs.h" #define CRYPTODEV_NAME_NITROX_PMD crypto_nitrox @@ -25,6 +26,84 @@ static const struct rte_driver nitrox_rte_sym_drv = { .alias = 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(__rte_unused struct rte_cryptodev *cdev, + __rte_unused struct rte_cryptodev_config *config) +{ + return 0; +} + +static int +nitrox_sym_dev_start(__rte_unused struct rte_cryptodev *cdev) +{ + return 0; +} + +static void +nitrox_sym_dev_stop(__rte_unused struct rte_cryptodev *cdev) +{ +} + +static int +nitrox_sym_dev_close(struct rte_cryptodev *cdev) +{ + int i, ret; + + for (i = 0; i < cdev->data->nb_queue_pairs; i++) { + ret = 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 = cdev->data->dev_private; + struct nitrox_device *ndev = sym_dev->ndev; + + if (!info) + return; + + info->max_nb_queue_pairs = ndev->nr_queues; + info->feature_flags = cdev->feature_flags; + info->capabilities = nitrox_get_sym_capabilities(); + info->driver_id = nitrox_sym_drv_id; + info->sym.max_nb_sessions = 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 = { + .dev_configure = nitrox_sym_dev_config, + .dev_start = nitrox_sym_dev_start, + .dev_stop = nitrox_sym_dev_stop, + .dev_close = nitrox_sym_dev_close, + .dev_infos_get = nitrox_sym_dev_info_get, + + .stats_get = NULL, + .stats_reset = NULL, + + .queue_pair_setup = NULL, + .queue_pair_release = NULL, + + .sym_session_get_size = NULL, + .sym_session_configure = NULL, + .sym_session_clear = NULL +}; + int nitrox_sym_pmd_create(struct nitrox_device *ndev) { @@ -50,7 +129,7 @@ nitrox_sym_pmd_create(struct nitrox_device *ndev) ndev->rte_sym_dev.name = cdev->data->name; cdev->driver_id = nitrox_sym_drv_id; - cdev->dev_ops = NULL; + cdev->dev_ops = &nitrox_cryptodev_ops; cdev->enqueue_burst = NULL; cdev->dequeue_burst = NULL; cdev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | diff --git a/drivers/crypto/nitrox/nitrox_sym_capabilities.c b/drivers/crypto/nitrox/nitrox_sym_capabilities.c new file mode 100644 index 000000000..aa1ff2638 --- /dev/null +++ b/drivers/crypto/nitrox/nitrox_sym_capabilities.c @@ -0,0 +1,57 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include "nitrox_sym_capabilities.h" + +static const struct rte_cryptodev_capabilities nitrox_capabilities[] = { + { /* SHA1 HMAC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, + {.auth = { + .algo = RTE_CRYPTO_AUTH_SHA1_HMAC, + .block_size = 64, + .key_size = { + .min = 1, + .max = 64, + .increment = 1 + }, + .digest_size = { + .min = 1, + .max = 20, + .increment = 1 + }, + .iv_size = { 0 } + }, } + }, } + }, + { /* AES CBC */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER, + {.cipher = { + .algo = RTE_CRYPTO_CIPHER_AES_CBC, + .block_size = 16, + .key_size = { + .min = 16, + .max = 32, + .increment = 8 + }, + .iv_size = { + .min = 16, + .max = 16, + .increment = 0 + } + }, } + }, } + }, + + RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() +}; + +const struct rte_cryptodev_capabilities * +nitrox_get_sym_capabilities(void) +{ + return nitrox_capabilities; +} diff --git a/drivers/crypto/nitrox/nitrox_sym_capabilities.h b/drivers/crypto/nitrox/nitrox_sym_capabilities.h new file mode 100644 index 000000000..cb2d97572 --- /dev/null +++ b/drivers/crypto/nitrox/nitrox_sym_capabilities.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#ifndef _NITROX_SYM_CAPABILITIES_H_ +#define _NITROX_SYM_CAPABILITIES_H_ + +#include + +const struct rte_cryptodev_capabilities *nitrox_get_sym_capabilities(void); + +#endif /* _NITROX_SYM_CAPABILITIES_H_ */