From patchwork Mon Aug 26 12:49:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nagadheeraj Rottela X-Patchwork-Id: 57967 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 930EA1C1EA; Mon, 26 Aug 2019 14:49:45 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 68C421C1E0 for ; Mon, 26 Aug 2019 14:49:38 +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 x7QCk2qX006984; Mon, 26 Aug 2019 05:49:37 -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=jzJMOee+TIsuJ823bH9VloAWj5gMVj/qsscD7405YyzxlGnHCSFgrn83GpUXFnxvjRgE fqVyyzQtcct/Q3A/tuRWOokr8Aax+Lohwf52EJdAKGBYP2YTFi3fvX3EozsS/k58woSs aya/KI6063/Qzf17phaT86vBDlROd+XGizPsLxwf/q192vAk+qmd6BgIpC4foqYqZ6oC 0iNJiUjpomIibNzbGMwN8rYhWM2aOKCxmSuDTXn5B9Ol23MKzYvvnBPnSRFSXmTMBhBd mA5efUwNEIYnXbaH7ir3q5GXI2svxMY8e+X+Tgcf4LY+uEnRV+de6gbRcBimg22BsHfV Ag== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2uk2kpy1fk-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 05:49:37 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 26 Aug 2019 05:49:36 -0700 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (104.47.42.54) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Mon, 26 Aug 2019 05:49:35 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BJbmxPsmMU9fe/dG46OHLMTn612W42xFuabwnibxIhYdXly14ew65TLClc3GqIvE+7tMeAJv2d4kpV/FQuwUjKdTipjZSTRFliM3Fg1lQ0wTzfjlA5Dakd/tDJFyyBmF8+DaDZgadElscQjR0XTDmqHQFXpnyFRIB6KifgQKOXNQxHodBmP94OuzllcyZn9jkpWb/nKhhFwUSlwX24L7qwoAgf0KUPFJbDcPt543u3fS8VCC+ZPrU8BPXfNKGTp5gXUO/EZeUGVEIEzG5m1ta69t+dc1+livJzYs1TL94j9D52JnF7sNFPNtcVWszqQlB09XDcmp//soGAiwhMYYbg== 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=YeTMaGFU2yytCQriV6x1oPmEFD2ePdnmx9fLYNkxjndhJQuRuOuw2bu9wAMdAcVpJIAW6Tn5tKH9oMW5HtyPBnxXoddyUomiL79mQlE9EaAArBTB/snZGQyMifykxwu+B+ypantJkPUZpLRi7C51a28xKhaE/bkmEjh97zs11gHWnpgU7HiB9K/OkH66w1Gqsgcd1nBHcpdIoQ6Scunpep6fm3c3iadaD+a4umQpaTN/BAKUy4IkRyd6K1EDw+HFHy45f1M7aJWbS2vC6gMYBDDE0ejwW4pFuueTIr4C2JawXoI4rbGEzmBzO3+naPW5bEL8BVgPRXu5FZ++WcwwZA== 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=qq5NKtEl0vNbyRBNi4649x7p72eEmpXv6V/vkPrqyzbyDJOqMcAeHoE9p0Mbbe0GIctbWMT2P0CgoIReeZ+BZpnbPMRCggL/CcS/QEGC/9z/7IE7c/m0hJd5pLx3Uxhznb4ajwOhUwrMh2CfOQXxWTkmrhVGjoA9whOLZyztQTE= Received: from MN2PR18MB2797.namprd18.prod.outlook.com (20.179.22.16) by MN2PR18MB2512.namprd18.prod.outlook.com (20.179.82.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.18; Mon, 26 Aug 2019 12:49:30 +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.2199.021; Mon, 26 Aug 2019 12:49:30 +0000 From: Nagadheeraj Rottela To: "akhil.goyal@nxp.com" , "pablo.de.lara.guarch@intel.com" , "mattias.ronnblom@ericsson.com" CC: "dev@dpdk.org" , Srikanth Jampala , Nagadheeraj Rottela Thread-Topic: [PATCH v4 04/11] crypto/nitrox: add basic symmetric cryptodev operations Thread-Index: AQHVXAyzz4Xtc1U2hkmtgj21yIYBtw== Date: Mon, 26 Aug 2019 12:49:30 +0000 Message-ID: <20190826124836.21187-5-rnagadheeraj@marvell.com> References: <4b0fc70c-768a-a474-ace4-b69513412cae@ericsson.com> <20190826124836.21187-1-rnagadheeraj@marvell.com> In-Reply-To: <20190826124836.21187-1-rnagadheeraj@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PN1PR01CA0088.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::28) 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: 0c10ca15-8a4b-4b1b-1cd4-08d72a23d61c x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600166)(711020)(4605104)(1401327)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:MN2PR18MB2512; x-ms-traffictypediagnostic: MN2PR18MB2512: x-ms-exchange-purlcount: 2 x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 01415BB535 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(136003)(376002)(396003)(39850400004)(346002)(366004)(189003)(199004)(5660300002)(81166006)(7736002)(52116002)(486006)(256004)(11346002)(14454004)(446003)(2616005)(76176011)(966005)(71200400001)(99286004)(476003)(14444005)(26005)(316002)(66476007)(53936002)(71190400001)(107886003)(2501003)(2906002)(55236004)(25786009)(102836004)(6306002)(3846002)(6116002)(4326008)(36756003)(1076003)(86362001)(50226002)(81156014)(305945005)(8936002)(66066001)(64756008)(66446008)(8676002)(6436002)(66556008)(66946007)(386003)(6486002)(6506007)(54906003)(110136005)(2201001)(186003)(478600001)(6512007); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2512; 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: Zak+L/d9PImTBg2CLiVRgGQBBpT5uqBxMVCWU/dWJZQfD4m2dj8ZmBoixLngaGfghF5OmB/c/6P6BzpXw8uF9oTjFHI4GG1vzaBnlBjYbKRGrIkWyNVk2JcuwUTEPjXnp2/jfCgBbszGVGROaUFqnPeGRdO1nIRpVWznFszNqBpApFSCtKl9bcwU5KcyFkp01JhSliZRfxmh8ePfmKj22V1Tjl/Tw977xGBkCUYyXyWZnrDi/VWR1nCnTxGI6loVFHhc61Nofv/ta/l0Tenp7NSH67VIkq0jPCgaDTeRyjV1d8B37/vk8/+sWhn1z8uOVJOgoJiP+OQVnrAlsmhjG+8NahjiLoaKGBAIcXF4jU4czdtH08pNIZujjRem5Q3R3ud0rpYrkQTIiAZzvh4ZyRuSc44485BiSylfQMHAVBU= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 0c10ca15-8a4b-4b1b-1cd4-08d72a23d61c X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Aug 2019 12:49:30.3331 (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: r0gYhdyKPTpeFGjGOslSJIAqC6UbBWEBAF97byGJvvVjXXDnFkgMnn6m2QbTh90d/1rwkIY9/zW3u/wWeaeDbK0POG7kkaxIq2ePwSC6rKQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2512 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-08-26_07:2019-08-26,2019-08-26 signatures=0 Subject: [dpdk-dev] [PATCH v4 04/11] 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_ */