From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <G.Singh@nxp.com>
Received: from EUR02-VE1-obe.outbound.protection.outlook.com
 (mail-eopbgr20070.outbound.protection.outlook.com [40.107.2.70])
 by dpdk.org (Postfix) with ESMTP id E66D51B3EA
 for <dev@dpdk.org>; Mon, 22 Oct 2018 16:57:43 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; 
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=GCNMZY8v4aXXRRLBM+keLSFsZEfmMZm5Yr0qy0Srxgk=;
 b=IHg0gHcxg/DIhufp1VsrgeJ/Am7C0Ue2yVZ39JMlt1XUZR+rh9RVh8+yniAUFBXNZE3IoZoOEU/B4dQ7HA4JQB7wSWKll1RYLtFSMvKRDyPpX+kARjRDmQgs6ewmwB98D0x8FmvaWuaXFf0tauEK5+VCTzLMVKHc5GKJtLf05rQ=
Received: from HE1PR04MB1530.eurprd04.prod.outlook.com (10.164.48.20) by
 HE1PR04MB1305.eurprd04.prod.outlook.com (10.162.249.27) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.1250.30; Mon, 22 Oct 2018 14:57:41 +0000
Received: from HE1PR04MB1530.eurprd04.prod.outlook.com
 ([fe80::95cd:198:d5c5:59a4]) by HE1PR04MB1530.eurprd04.prod.outlook.com
 ([fe80::95cd:198:d5c5:59a4%5]) with mapi id 15.20.1250.028; Mon, 22 Oct 2018
 14:57:41 +0000
From: Gagandeep Singh <G.Singh@nxp.com>
To: "dev@dpdk.org" <dev@dpdk.org>, Akhil Goyal <akhil.goyal@nxp.com>
CC: Gagandeep Singh <G.Singh@nxp.com>, Hemant Agrawal <hemant.agrawal@nxp.com>
Thread-Topic: [PATCH v5 09/15] crypto/caam_jr: add device cababilities
Thread-Index: AQHUaheU0XqLHtHOFUy5FBuCHtz/2w==
Date: Mon, 22 Oct 2018 14:57:41 +0000
Message-ID: <20181022145644.29277-10-g.singh@nxp.com>
References: <20181022141657.4727-1-g.singh@nxp.com>
 <20181022145644.29277-1-g.singh@nxp.com>
In-Reply-To: <20181022145644.29277-1-g.singh@nxp.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-clientproxiedby: BM1PR0101CA0067.INDPRD01.PROD.OUTLOOK.COM
 (2603:1096:b00:19::29) To HE1PR04MB1530.eurprd04.prod.outlook.com
 (2a01:111:e400:59a8::20)
authentication-results: spf=none (sender IP is )
 smtp.mailfrom=G.Singh@nxp.com; 
x-ms-exchange-messagesentrepresentingtype: 1
x-originating-ip: [14.142.187.166]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; HE1PR04MB1305;
 6:n9mKyABlf2SHOOAWAmpnZGQL4x+pVVjwwwXj1lyBwlaWIeDFzUcvJY+Y8GPIUZxeGHzl/ZS17b49g9YBbQsXId67MVtrYfTAGmJWwJrpYNP7GOGl4JJlN1SLOipZlSPBEmUhtY1wAYO5XIEvjOsnqM9AixvO8P+MfNsTi1Be/jWc1kc+wj47zPtgvBHsrwSFpe4nBo6XRu0B0BL9urnLdCVYaVqEzI6H24zDslPwJ5i0bBhftgfg8jgMEI/ekqZx+q6bkx3Vs5j3qAhxnt7UMG6faFiheFDwjb9zVVraA1VbzBCkWzva1qa9I2kATJheTwrbXTM4+236BGJ6VdhaMb+gcKZVJ42rOX8yn2HnXInZLVU0lUJ9ZDrzISsjyC1oi1AKlQKfV4YvZpuI5y02W3RD+cynfNcOU7j+3HNb2ResriBxf0ZhodP3HOUcqVkJ5Qq8qpOz7Qc8owLgTrkHrA==;
 5:eyrxwsepcrNnH4pOnD3nTo7LEpQ7efpefkAbIo37DaNm9w877NnxHuhUv0k5yOSGInYj/GlOhM/hWO9ZHlazLgRhsdQmhdfW8E2Y+toqBPkL2DNEvGAkzuDi6ixlP3hoAFAN/W3W3cE51BXK+l7KSg6SIutSFSIqdwFo1nCS/yI=;
 7:sy84zRYYURgTwF/gK1AZMCmayGLbkUcZoLZsmWJYMRpMVYQMcZIam1L4aCTrBn1L16AE2f90jDAxFmOaN8S47dYTUJCP0hoq4UC58C70Lc+1PW69LYORVUPyDzkpFC0zrDrXqtoZdHRmBGlgbkZjn9nD0cUB/XqnUV49aUKFlA0v1Gk4Ode8GuJdKqotH/W+ihkFS2Y7sDQQ9BhNlfhj/Wfthr2iYZ2sgCmz/Qgi72Ptkzj8/OXQn0BZaRFUDt+x
x-ms-office365-filtering-correlation-id: 9e32afbc-6043-4fef-43fa-08d6382eb6c4
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);
 SRVR:HE1PR04MB1305; 
x-ms-traffictypediagnostic: HE1PR04MB1305:
x-microsoft-antispam-prvs: <HE1PR04MB1305B7868A4E0E05CE11FD40E1F40@HE1PR04MB1305.eurprd04.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(192374486261705)(185117386973197);
x-ms-exchange-senderadcheck: 1
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0;
 RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095);
 SRVR:HE1PR04MB1305; BCL:0; PCL:0; RULEID:; SRVR:HE1PR04MB1305; 
x-forefront-prvs: 08331F819E
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(376002)(39860400002)(396003)(136003)(366004)(346002)(199004)(189003)(8676002)(256004)(81156014)(81166006)(11346002)(476003)(99286004)(446003)(316002)(52116002)(2616005)(486006)(106356001)(8936002)(105586002)(186003)(71200400001)(5250100002)(78486010)(3846002)(2501003)(71190400001)(25786009)(2900100001)(305945005)(7736002)(97736004)(478600001)(4326008)(2906002)(72206003)(6636002)(53936002)(14454004)(66066001)(6512007)(5660300001)(6116002)(1076002)(6436002)(6486002)(36756003)(14444005)(54906003)(6506007)(76176011)(55236004)(386003)(68736007)(26005)(86362001)(102836004)(110136005);
 DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR04MB1305;
 H:HE1PR04MB1530.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; A:1; MX:1; 
received-spf: None (protection.outlook.com: nxp.com does not designate
 permitted sender hosts)
x-microsoft-antispam-message-info: SzTbIBAvGmzR3nTbxy3GiYQ524dw+mnZRPkvPJB1BZ03tpFFv7ntJuzj9ZE0r7mMzfkoLzRhjDEfKPPAkfqN3Z1zOLXGTD8qNGN5/mwi3GHgUYvSVRdy2nSsQjCCDDZcWaiH6jxHVUPIex5ZP6+Zu4mqs8LnGSgojoRK+hhZH0bG39jb1UG6X3w4T2HwWchIaypT1N3Q8tduG5+S4QPumKs+F4nqD/w1TlAA6yGZQtgmZKs+KZFA3PXiN/v7/SCuQmUyxeRN2eHIRqF1grRyxBo+CqCnNqcfAPkHDwL5+emAgFrSvvKT3+2qConcb96Ar4J4HeQCmP7N8PdQPpzkhWqzY3Xb7t/dH2PcPaZGpwI=
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 9e32afbc-6043-4fef-43fa-08d6382eb6c4
X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Oct 2018 14:57:41.0835 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB1305
Subject: [dpdk-dev] [PATCH v5 09/15] crypto/caam_jr: add device cababilities
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Oct 2018 14:57:44 -0000

add device capabilities for supported algorithms,
key length etc.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 drivers/crypto/caam_jr/Makefile               |   1 +
 drivers/crypto/caam_jr/caam_jr.c              |   2 +
 drivers/crypto/caam_jr/caam_jr_capabilities.c | 232 ++++++++++++++++++
 drivers/crypto/caam_jr/caam_jr_capabilities.h |  13 +
 drivers/crypto/caam_jr/meson.build            |   5 +-
 5 files changed, 252 insertions(+), 1 deletion(-)
 create mode 100644 drivers/crypto/caam_jr/caam_jr_capabilities.c
 create mode 100644 drivers/crypto/caam_jr/caam_jr_capabilities.h

diff --git a/drivers/crypto/caam_jr/Makefile b/drivers/crypto/caam_jr/Makef=
ile
index cfd093a5f..88cdf7410 100644
--- a/drivers/crypto/caam_jr/Makefile
+++ b/drivers/crypto/caam_jr/Makefile
@@ -31,6 +31,7 @@ LIBABIVER :=3D 1
=20
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_CAAM_JR) +=3D caam_jr.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_CAAM_JR) +=3D caam_jr_capabilities.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_CAAM_JR) +=3D caam_jr_hw.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_CAAM_JR) +=3D caam_jr_uio.c
 # library dependencies
diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam=
_jr.c
index aec033649..96b18be12 100644
--- a/drivers/crypto/caam_jr/caam_jr.c
+++ b/drivers/crypto/caam_jr/caam_jr.c
@@ -16,6 +16,7 @@
 #include <rte_malloc.h>
 #include <rte_hexdump.h>
=20
+#include <caam_jr_capabilities.h>
 #include <caam_jr_config.h>
 #include <caam_jr_hw_specific.h>
 #include <caam_jr_pvt.h>
@@ -438,6 +439,7 @@ caam_jr_dev_infos_get(struct rte_cryptodev *dev,
 	if (info !=3D NULL) {
 		info->max_nb_queue_pairs =3D internals->max_nb_queue_pairs;
 		info->feature_flags =3D dev->feature_flags;
+		info->capabilities =3D caam_jr_get_cryptodev_capabilities();
 		info->sym.max_nb_sessions =3D internals->max_nb_sessions;
 		info->driver_id =3D cryptodev_driver_id;
 	}
diff --git a/drivers/crypto/caam_jr/caam_jr_capabilities.c b/drivers/crypto=
/caam_jr/caam_jr_capabilities.c
new file mode 100644
index 000000000..92aa429cc
--- /dev/null
+++ b/drivers/crypto/caam_jr/caam_jr_capabilities.c
@@ -0,0 +1,232 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2017-2018 NXP
+ */
+
+#include <caam_jr_capabilities.h>
+
+static const struct rte_cryptodev_capabilities caam_jr_capabilities[] =3D =
{
+	{	/* MD5 HMAC */
+		.op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym =3D {
+			.xform_type =3D RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth =3D {
+				.algo =3D RTE_CRYPTO_AUTH_MD5_HMAC,
+				.block_size =3D 64,
+				.key_size =3D {
+					.min =3D 1,
+					.max =3D 64,
+					.increment =3D 1
+				},
+				.digest_size =3D {
+					.min =3D 1,
+					.max =3D 16,
+					.increment =3D 1
+				},
+				.iv_size =3D { 0 }
+			}, }
+		}, }
+	},
+	{	/* SHA1 HMAC */
+		.op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym =3D {
+			.xform_type =3D RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth =3D {
+				.algo =3D RTE_CRYPTO_AUTH_SHA1_HMAC,
+				.block_size =3D 64,
+				.key_size =3D {
+					.min =3D 1,
+					.max =3D 64,
+					.increment =3D 1
+				},
+				.digest_size =3D {
+					.min =3D 1,
+					.max =3D 20,
+					.increment =3D 1
+				},
+				.iv_size =3D { 0 }
+			}, }
+		}, }
+	},
+	{	/* SHA224 HMAC */
+		.op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym =3D {
+			.xform_type =3D RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth =3D {
+				.algo =3D RTE_CRYPTO_AUTH_SHA224_HMAC,
+				.block_size =3D 64,
+				.key_size =3D {
+					.min =3D 1,
+					.max =3D 64,
+					.increment =3D 1
+				},
+				.digest_size =3D {
+					.min =3D 1,
+					.max =3D 28,
+					.increment =3D 1
+				},
+				.iv_size =3D { 0 }
+			}, }
+		}, }
+	},
+	{	/* SHA256 HMAC */
+		.op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym =3D {
+			.xform_type =3D RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth =3D {
+				.algo =3D RTE_CRYPTO_AUTH_SHA256_HMAC,
+				.block_size =3D 64,
+				.key_size =3D {
+					.min =3D 1,
+					.max =3D 64,
+					.increment =3D 1
+				},
+				.digest_size =3D {
+					.min =3D 1,
+					.max =3D 32,
+					.increment =3D 1
+				},
+				.iv_size =3D { 0 }
+			}, }
+		}, }
+	},
+	{	/* SHA384 HMAC */
+		.op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym =3D {
+			.xform_type =3D RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth =3D {
+				.algo =3D RTE_CRYPTO_AUTH_SHA384_HMAC,
+				.block_size =3D 128,
+				.key_size =3D {
+					.min =3D 1,
+					.max =3D 128,
+					.increment =3D 1
+				},
+				.digest_size =3D {
+					.min =3D 1,
+					.max =3D 48,
+					.increment =3D 1
+				},
+				.iv_size =3D { 0 }
+			}, }
+		}, }
+	},
+	{	/* SHA512 HMAC */
+		.op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym =3D {
+			.xform_type =3D RTE_CRYPTO_SYM_XFORM_AUTH,
+			{.auth =3D {
+				.algo =3D RTE_CRYPTO_AUTH_SHA512_HMAC,
+				.block_size =3D 128,
+				.key_size =3D {
+					.min =3D 1,
+					.max =3D 128,
+					.increment =3D 1
+				},
+				.digest_size =3D {
+					.min =3D 1,
+					.max =3D 64,
+					.increment =3D 1
+				},
+				.iv_size =3D { 0 }
+			}, }
+		}, }
+	},
+	{	/* AES GCM */
+		.op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym =3D {
+			.xform_type =3D RTE_CRYPTO_SYM_XFORM_AEAD,
+			{.aead =3D {
+				.algo =3D RTE_CRYPTO_AEAD_AES_GCM,
+				.block_size =3D 16,
+				.key_size =3D {
+					.min =3D 16,
+					.max =3D 32,
+					.increment =3D 8
+				},
+				.digest_size =3D {
+					.min =3D 8,
+					.max =3D 16,
+					.increment =3D 4
+				},
+				.aad_size =3D {
+					.min =3D 0,
+					.max =3D 240,
+					.increment =3D 1
+				},
+				.iv_size =3D {
+					.min =3D 12,
+					.max =3D 12,
+					.increment =3D 0
+				},
+			}, }
+		}, }
+	},
+	{	/* AES CBC */
+		.op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym =3D {
+			.xform_type =3D RTE_CRYPTO_SYM_XFORM_CIPHER,
+			{.cipher =3D {
+				.algo =3D RTE_CRYPTO_CIPHER_AES_CBC,
+				.block_size =3D 16,
+				.key_size =3D {
+					.min =3D 16,
+					.max =3D 32,
+					.increment =3D 8
+				},
+				.iv_size =3D {
+					.min =3D 16,
+					.max =3D 16,
+					.increment =3D 0
+				}
+			}, }
+		}, }
+	},
+	{	/* AES CTR */
+		.op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym =3D {
+			.xform_type =3D RTE_CRYPTO_SYM_XFORM_CIPHER,
+			{.cipher =3D {
+				.algo =3D RTE_CRYPTO_CIPHER_AES_CTR,
+				.block_size =3D 16,
+				.key_size =3D {
+					.min =3D 16,
+					.max =3D 32,
+					.increment =3D 8
+				},
+				.iv_size =3D {
+					.min =3D 16,
+					.max =3D 16,
+					.increment =3D 0
+				}
+			}, }
+		}, }
+	},
+	{	/* 3DES CBC */
+		.op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+		{.sym =3D {
+			.xform_type =3D RTE_CRYPTO_SYM_XFORM_CIPHER,
+			{.cipher =3D {
+				.algo =3D RTE_CRYPTO_CIPHER_3DES_CBC,
+				.block_size =3D 8,
+				.key_size =3D {
+					.min =3D 16,
+					.max =3D 24,
+					.increment =3D 8
+				},
+				.iv_size =3D {
+					.min =3D 8,
+					.max =3D 8,
+					.increment =3D 0
+				}
+			}, }
+		}, }
+	},
+
+	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
+};
+
+const struct rte_cryptodev_capabilities *
+caam_jr_get_cryptodev_capabilities(void)
+{
+	return caam_jr_capabilities;
+}
diff --git a/drivers/crypto/caam_jr/caam_jr_capabilities.h b/drivers/crypto=
/caam_jr/caam_jr_capabilities.h
new file mode 100644
index 000000000..7a94013e5
--- /dev/null
+++ b/drivers/crypto/caam_jr/caam_jr_capabilities.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2017-2018 NXP
+ */
+
+#ifndef CAAM_JR_CAPABILITIES_H
+#define CAAM_JR_CAPABILITIES_H
+
+#include <rte_cryptodev.h>
+
+/* Get cryptodev capabilities */
+const struct rte_cryptodev_capabilities *
+caam_jr_get_cryptodev_capabilities(void);
+#endif
diff --git a/drivers/crypto/caam_jr/meson.build b/drivers/crypto/caam_jr/me=
son.build
index 7b024e886..99b71aef1 100644
--- a/drivers/crypto/caam_jr/meson.build
+++ b/drivers/crypto/caam_jr/meson.build
@@ -6,7 +6,10 @@ if host_machine.system() !=3D 'linux'
 endif
=20
 deps +=3D ['bus_vdev', 'bus_dpaa', 'security']
-sources =3D files('caam_jr_hw.c', 'caam_jr_uio.c', 'caam_jr.c')
+sources =3D files('caam_jr_capabilities.c',
+		'caam_jr_hw.c',
+		'caam_jr_uio.c',
+		'caam_jr.c')
=20
 allow_experimental_apis =3D true
=20
--=20
2.17.1