From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10052.outbound.protection.outlook.com [40.107.1.52]) by dpdk.org (Postfix) with ESMTP id CD4BC5B34 for ; Mon, 22 Oct 2018 15:31:21 +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=glrSWITCqE7HfLJcVkFIOnRQvDDW5XTHvnc0gP4fjZA=; b=b+u3Tu0hkM9LTjubsVQ+4YQeYT5+q69fQsEtNrcBaZqHm9OAe9GFPt3cI03QGhe6eqNKv0RYVSZ3AvKwgt9h7yTghlfpTeMkYbVr/JDF7e0yQjuPiQ90hyKzL69zdWV8D1bcOqB4IErJhRe0JzCfEZlA/wheBK0p5JeFakwzwHU= Received: from HE1PR04MB1530.eurprd04.prod.outlook.com (10.164.48.20) by HE1PR04MB3131.eurprd04.prod.outlook.com (10.171.196.142) 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 13:31:20 +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 13:31:20 +0000 From: Gagandeep Singh To: "dev@dpdk.org" , Akhil Goyal CC: Gagandeep Singh , Hemant Agrawal Thread-Topic: [PATCH v3 09/15] crypto/caam_jr: add device cababilities Thread-Index: AQHUaguEPkIuNLi04EuhdFUxtZDL+Q== Date: Mon, 22 Oct 2018 13:31:20 +0000 Message-ID: <20181022133021.11264-10-g.singh@nxp.com> References: <20181012144055.9461-1-g.singh@nxp.com> <20181022133021.11264-1-g.singh@nxp.com> In-Reply-To: <20181022133021.11264-1-g.singh@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0016.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:18::26) 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; HE1PR04MB3131; 6:JtQRJznWDSlG8GaStq6GCF9laVvI0nf9YCoBdPhZXfBlCKJ48pxTLXo8LESvG9X5XNBQUq887kLIo9oA4yEH+327+jpXibc/ZSDcy9W4lG6xafI+1EhG2EQekhGsuPm+jfFfNW1NnX3n+P13SxpDW6iq8KzMlBRHseB+zksYwRpWeN0yiBGo6aNGAD+HyRqXest2j0Q5G3DpZthsTLja2z5PRmgqZtHJRLinGgGUlSBpUvbGjjXcH3BWLf5EreSElLpH6tV6Kr72ozSVU+dUypeNl+K58NIYt8CrkWPChQXj/D56iK97Ffc2zmZfZC6bG2OtQGUA1GD9BqFzqoHvrdxYE0eToNX9ww2cb0IYrJdXvoDSkbwQDP+VVAyaqX31RhSyWEGRyv5GAhWLQgn62r0WUwH/77X5wuzHFjwAIj++mfk6/oc3Y7IIoqhCQlDxaX0ETvt+VntexOyfQoGPUA==; 5:1MeYQ89g8k+D1LfKsO1DJF1FHUfSF/iELcOap5P2yk6SOUpVhNFyiiCfuxXad+uuIkmSmdxOBhMQvFmnN8E+mmBzUFR/jsZ7Dymh0mafIfciav179qEsDSaicDkWURTgKab+BMzAt5raFhP74AsO0/zXzUZcUjaRBG8FExXk+uw=; 7:68nKB2QNDZjSo1Bwt3ogoxRcalZ/lfHDgji0ZQeRHj8z+Ue08ApkrBH9XH0am4fkpkNcd5r0kJOpkOqiwce1eqg+6Pz8y7sy+da2AtuOpaHWk6f7WtSDuzFYI30XWc5qS0oSzaobZtY+4KnG8V1gTLe4T3wnEwr6eniL+AOc8MvvUzh1SlWc7tKMk9N7cutvvBBWz+R7TySBXUtwifh9tFHThiT1S69FmuPpDPqT+OFCnhmT1sEFuzedLdbtsYG2 x-ms-office365-filtering-correlation-id: a3de7510-f483-4711-5192-08d63822a6bb x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:HE1PR04MB3131; x-ms-traffictypediagnostic: HE1PR04MB3131: x-microsoft-antispam-prvs: 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:HE1PR04MB3131; BCL:0; PCL:0; RULEID:; SRVR:HE1PR04MB3131; x-forefront-prvs: 08331F819E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(39860400002)(136003)(346002)(396003)(189003)(199004)(110136005)(99286004)(316002)(54906003)(81156014)(14454004)(25786009)(72206003)(81166006)(2900100001)(8936002)(106356001)(8676002)(6116002)(3846002)(86362001)(2616005)(476003)(6506007)(386003)(102836004)(1076002)(11346002)(446003)(26005)(186003)(305945005)(478600001)(4326008)(2906002)(76176011)(68736007)(7736002)(6636002)(97736004)(486006)(52116002)(36756003)(55236004)(105586002)(71190400001)(5660300001)(6436002)(6486002)(78486010)(53936002)(14444005)(2501003)(256004)(66066001)(71200400001)(5250100002)(6512007); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR04MB3131; H:HE1PR04MB1530.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: CcNX8Hvbuh7pO7lKe9tCs1PDT9TkRuO7Nx7yvZEBnORWs+brR7WOTYVVVC4p873ZDQ94ssUbW4cXfE0e6jQquIXlAnECufxeehaDKOZYvHRTDOq6hz16L86JxEIRFSsoCkOCq0eaXgRApJ0mElZjw+A7J00KCmBFMjX1cDMkPvcPC7di5/Esz14SdYh8wcf6j2aZaALErK02fL0+V2zFBZWpX40VmhRCxiHiJXlydEqmIJe713PU3MumiWs2XM/lflRRLVMZrGQr6GiiT9Cp4TCCCrygHn2be1vnNjT5BwlySHyNTZ7GUZhPpe/iaJheBYEJ/JWSkIP2rC+jhJt7zm1+OksWCD37cPAWxaLxdM4= 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: a3de7510-f483-4711-5192-08d63822a6bb X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Oct 2018 13:31:20.2886 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB3131 Subject: [dpdk-dev] [PATCH v3 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Oct 2018 13:31:22 -0000 add device capabilities for supported algorithms, key length etc. Signed-off-by: Gagandeep Singh Signed-off-by: Hemant Agrawal Acked-by: Akhil Goyal --- drivers/crypto/caam_jr/Makefile | 1 + drivers/crypto/caam_jr/caam_jr.c | 2 + drivers/crypto/caam_jr/caam_jr_capabilities.c | 266 ++++++++++++++++++ drivers/crypto/caam_jr/caam_jr_capabilities.h | 18 ++ drivers/crypto/caam_jr/meson.build | 5 +- 5 files changed, 291 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 eedbeb731..311da1686 100644 --- a/drivers/crypto/caam_jr/caam_jr.c +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -17,6 +17,7 @@ #include #include =20 +#include #include #include #include @@ -439,6 +440,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..c51593c4b --- /dev/null +++ b/drivers/crypto/caam_jr/caam_jr_capabilities.c @@ -0,0 +1,266 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2017-2018 NXP + */ + +#include + +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() +}; + +static const struct rte_security_capability caam_jr_security_cap[] =3D { + { /* IPsec Lookaside Protocol offload ESP Transport Egress */ + .action =3D RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol =3D RTE_SECURITY_PROTOCOL_IPSEC, + .ipsec =3D { + .proto =3D RTE_SECURITY_IPSEC_SA_PROTO_ESP, + .mode =3D RTE_SECURITY_IPSEC_SA_MODE_TUNNEL, + .direction =3D RTE_SECURITY_IPSEC_SA_DIR_EGRESS, + .options =3D { 0 } + }, + .crypto_capabilities =3D caam_jr_capabilities + }, + { /* IPsec Lookaside Protocol offload ESP Tunnel Ingress */ + .action =3D RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL, + .protocol =3D RTE_SECURITY_PROTOCOL_IPSEC, + .ipsec =3D { + .proto =3D RTE_SECURITY_IPSEC_SA_PROTO_ESP, + .mode =3D RTE_SECURITY_IPSEC_SA_MODE_TUNNEL, + .direction =3D RTE_SECURITY_IPSEC_SA_DIR_INGRESS, + .options =3D { 0 } + }, + .crypto_capabilities =3D caam_jr_capabilities + }, + { + .action =3D RTE_SECURITY_ACTION_TYPE_NONE + } +}; + +const struct rte_cryptodev_capabilities * +caam_jr_get_cryptodev_capabilities(void) +{ + return caam_jr_capabilities; +} + +const struct rte_security_capability * +caam_jr_get_security_capabilities(void *device __rte_unused) +{ + return caam_jr_security_cap; +} 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..c1e3f305a --- /dev/null +++ b/drivers/crypto/caam_jr/caam_jr_capabilities.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2017-2018 NXP + */ + +#ifndef CAAM_JR_CAPABILITIES_H +#define CAAM_JR_CAPABILITIES_H + +#include +#include + +/* Get cryptodev capabilities */ +const struct rte_cryptodev_capabilities * +caam_jr_get_cryptodev_capabilities(void); +/* Get security capabilities */ +const struct rte_security_capability * +caam_jr_get_security_capabilities(void *device); + +#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