From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0058.outbound.protection.outlook.com [104.47.38.58]) by dpdk.org (Postfix) with ESMTP id 7B08A7D77 for ; Tue, 15 Aug 2017 08:37:18 +0200 (CEST) Received: from MWHPR03CA0010.namprd03.prod.outlook.com (10.175.133.148) by CY4PR03MB3319.namprd03.prod.outlook.com (10.171.247.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Tue, 15 Aug 2017 06:37:16 +0000 Received: from BN1AFFO11FD014.protection.gbl (2a01:111:f400:7c10::134) by MWHPR03CA0010.outlook.office365.com (2603:10b6:300:117::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21 via Frontend Transport; Tue, 15 Aug 2017 06:37:16 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD014.mail.protection.outlook.com (10.58.52.74) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1304.16 via Frontend Transport; Tue, 15 Aug 2017 06:37:15 +0000 Received: from netperf2.ap.freescale.net ([10.232.133.164]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v7F6atQF015692; Mon, 14 Aug 2017 23:37:11 -0700 From: Akhil Goyal To: , , , , , , , CC: , , Akhil Goyal Date: Tue, 15 Aug 2017 12:05:03 +0530 Message-ID: <20170815063505.22032-3-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170815063505.22032-1-akhil.goyal@nxp.com> References: <20170725112153.29699-1-akhil.goyal@nxp.com> <20170815063505.22032-1-akhil.goyal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131472526357395602; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39860400002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(4326008)(50466002)(97736004)(626005)(48376002)(498600001)(36756003)(68736007)(69596002)(305945005)(189998001)(86362001)(104016004)(8656003)(1076002)(2906002)(85426001)(2201001)(53936002)(6666003)(50986999)(76176999)(5660300001)(356003)(2950100002)(106466001)(5003940100001)(33646002)(54906002)(47776003)(77096006)(8676002)(15650500001)(8936002)(81156014)(81166006)(50226002)(7416002)(105606002)(217873001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB3319; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1AFFO11FD014; 1:cOVum02BcTuU3uIjEcdgHFpi8jb3GuQj8uheSA28H?= =?us-ascii?Q?KiXGauHVzmR8CtzJpf2ivfZPe9Rt+JsFYthNI6eGb9osb+tirO1kYulujOJi?= =?us-ascii?Q?tKGVRI6PsGpqD7Hav6gIBXPpTSr7H6uq7S9X3XbUpWAx++iVmuk4k9KXinGF?= =?us-ascii?Q?bI0UDE/FFidSJPJOUkk/G9dKu9+dgOWwKiIIgWugGLwHsRShvzjfndkJ7jJF?= =?us-ascii?Q?zfMCaDNtpnxcHDiXtmZWla8VjPyIQPCL2VtZRtcZYK548n42MpCpJrV/pu0z?= =?us-ascii?Q?fVA7vmuqkx9rro7Ff7SKSX3XrO07POxK9u6sbsmb88oBwNyHBnO9XBtpyUz5?= =?us-ascii?Q?YP6njVQJyE2kXDtdRRvIR0ej/ON8/vCA1xmPLXPcWBzqLgzRhMqqGZXoEEp5?= =?us-ascii?Q?LEnqKFToI2ecZLDtPWJ7cw/VHZqmNgH9iLgcwwCZNwakIGOVsRCr//R+Se1d?= =?us-ascii?Q?vkRBCz/wSS85WPJbGD3SbLrajFqm7TSh6rmj4puLzj1DuY6ux6nWIyRXP5JD?= =?us-ascii?Q?pCbN6tchAG482L5Srvl2EwGyv/eMpsUywh3Qog5YloTG7pbMavUVitUza8SN?= =?us-ascii?Q?Wi+p3JSq114TjCfaz9XdCWf4SR1Fu7bd8ia8cHfX7ncl7IlhRGz6tfRE1m8k?= =?us-ascii?Q?b+8C2XUobJlxIpuXOEJovLpspZ8QmHz2ubZQps5bne8plLygbaTGXgmMhRXO?= =?us-ascii?Q?ZhYBNgXxCNu3TXleyjtiNTH8sHNG4pvuNELSh+M9106eJRGq8M1qGz2sQutr?= =?us-ascii?Q?fFzWSwxThOE4jEUq3F0+ghvUhkwEYid2Fvg/uCn3hX6I7ZjWE/Fbx44pD/lG?= =?us-ascii?Q?WV7zkSSGcWS35szM9sXGJ6NAKvj+ODXCf0s41YjGROWhxdwRgQQG/VxE6MT2?= =?us-ascii?Q?NU4qftAJaQz+L6oeWW/Au+mzA/9g8lxqVBnAJkk3aTqNLgb2xFNOQevamakH?= =?us-ascii?Q?uHUrbcrfCHnmWIhyYWJKTfzfbck1c88TXlQf/GvsjYIli67WoOqkDwiwQnOU?= =?us-ascii?Q?Q9prv/2s0D2moPLF2S//187?= MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4bb50092-07ec-4d1c-1733-08d4e3a811b6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603031)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY4PR03MB3319; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB3319; 3:LGtXwQFUZia0GntafWq/Mggg98t/69uAjtd7IX3D4E1NEWmPU4dUTrJiSK/XmUOHXYXnvrF+Wfgc7x+Mr3pqloZ2TbPICWrjIqU3qsMUyTa4PBj+ARas/K+VrYkekC69fCdB8acaPzhOBjLRqPoAe/+TBNkR6ixw5Rlp1JT2YZeHMJSaExCrvv+AiNoze+sFV0RZuCS5gj4DnCTOx8FLBZUQQpk7dESFYobjZIpI6cF4HjaxKg2OvTXXAnYIK4HQFD7zcD84QBv8GwDkPS+D1+dO44Kz/tbtsziSqsQlNMEwt/kpAnjERgAHKU5UhZKJZZ8DWh1+kV9hmGqDu31Kmw==; 25:Q5jSj7xFiGXDTYhguUHHIFYtNIp5090lNqxW0DZLXLEIyEf/gURapVu+yBoekY4nEVsVZKrqKEcHub04w3ZzPoa1kV3ij6Tz0T2c28ULphk/kzNKcpGtj6srsVxM6VIzoyiMIt5JVdBr/6tJs0HqDW7oBa85ttfRTCcEiI2w0NMWEfodeVXKv4Iqf9wKoXofH2lRuPi3d5F0MlExYeWAxNPuaP2O79/+kt9izhripxDhzALmSn51yEWD+pdRj4oGv4L2UFlQf66ksm8eRRM+/zEl5Xd9rdEa507VaUdq4CIIRi6dHtzOMKOiHaC1+a51mS9xKh9LQb5K5Sv00oBIDg==; 31:tZ1qUrXy3vwDWc1vgTfCQutkBSR4cVE28bJhy6ET+uoCSuUSPSPzRuRej/tHnNWu/mM6XF5Pbe/oLfvinAUhUemWCmRMj7i1ZDiYPfx/jI2UhW6STByJqmWmgXnvoc4HGgC8CW/tNBX+tzjGTZRMEvds3XHw3pASZc7TNzI0Y8JrpmTAe88VLV7zw6pn22QCXm7n7sSg2typ4DXGTSrm+lrfxoeSbjBnSYCktcfKDMo= X-MS-TrafficTypeDiagnostic: CY4PR03MB3319: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705)(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(5005006)(13018025)(13016025)(8121501046)(3002001)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(6055026)(6096035)(20161123556025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123565025)(20161123563025)(20161123561025)(20161123559100)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR03MB3319; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR03MB3319; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB3319; 4:kCRZbz9cL+MtQukzHp0LSz3C54XBPgvdDu5rHUmycRWo4e23UrAKBAKvUzoODYuUm/exvjd5evaVv21L1pViptNkGI/CCs2ZVBXzzxamc0MEe+bEfRnBrhmoA1DhYJKIWdnOMe384nVRkj8m3AJXCyedrwKnMzvA7cJw/uJUHTlCK4l+vD3CWE24hGrZAcdP1rdTZqIcOJQL9e8fZl7d1E85VgoqNx9R46woFKGtSh853B6E/RHJ2jBhljZutJocnpszbrUm49TEmIH8L7B8sFPjXzGoenKAROqKdIU2mBBUYv7Mz8zoJHmrC6erajousMtKfziPvk2c5w97lt6MWQ== X-Forefront-PRVS: 04004D94E2 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB3319; 23:6wMdfucjK2X0J+A0lwLYauTCAMykCrsfvh1GSjTYE?= =?us-ascii?Q?LPtXoBEMn78bh4yJjb/c1AnXn/YOU1nh3WW0D7XRqrMaQBFgYnBLFbYiXe1t?= =?us-ascii?Q?jkNV9Nju0qfqxf5hYIElrXzp04bDXOhvzTt7o5zqfWCe5Fpt+rgjy2fhQFPA?= =?us-ascii?Q?XlQproADOAERuA7At/cyu03oWwQ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sRtm/75EUl+WVEbsbz2Vh3o4/7fAOYMSk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2017 06:37:15.4899 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB3319 Subject: [dpdk-dev] [RFC PATCH 2/4] cryptodev: entend cryptodev to support security APIs 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: Tue, 15 Aug 2017 06:37:19 -0000 cryptodev library is extended to support security APIs Similar changes needs to be done for ether devices also to support security APIs Signed-off-by: Akhil Goyal --- lib/librte_cryptodev/Makefile | 3 ++- lib/librte_cryptodev/rte_crypto_sym.h | 15 ++++++++++++++ lib/librte_cryptodev/rte_cryptodev.h | 20 ++++++------------ lib/librte_cryptodev/rte_cryptodev_pmd.h | 35 ++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 15 deletions(-) diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile index 6ac331b..376a275 100644 --- a/lib/librte_cryptodev/Makefile +++ b/lib/librte_cryptodev/Makefile @@ -41,7 +41,7 @@ CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) # library source files -SRCS-y += rte_cryptodev.c rte_cryptodev_pmd.c +SRCS-y += rte_cryptodev.c rte_cryptodev_pmd.c rte_security.c # export include files SYMLINK-y-include += rte_crypto.h @@ -50,6 +50,7 @@ SYMLINK-y-include += rte_cryptodev.h SYMLINK-y-include += rte_cryptodev_pmd.h SYMLINK-y-include += rte_cryptodev_vdev.h SYMLINK-y-include += rte_cryptodev_pci.h +SYMLINK-y-include += rte_security.h # versioning export map EXPORT_MAP := rte_cryptodev_version.map diff --git a/lib/librte_cryptodev/rte_crypto_sym.h b/lib/librte_cryptodev/rte_crypto_sym.h index 0ceaa91..d804e70 100644 --- a/lib/librte_cryptodev/rte_crypto_sym.h +++ b/lib/librte_cryptodev/rte_crypto_sym.h @@ -53,6 +53,19 @@ extern "C" { #include #include +/** + * Crypto parameters range description + */ +struct rte_crypto_param_range { + uint16_t min; /**< minimum size */ + uint16_t max; /**< maximum size */ + uint16_t increment; + /**< if a range of sizes are supported, + * this parameter is used to indicate + * increments in byte size that are supported + * between the minimum and maximum + */ +}; /** Symmetric Cipher Algorithms */ enum rte_crypto_cipher_algorithm { @@ -505,6 +518,8 @@ struct rte_crypto_sym_op { /**< Handle for the initialised session context */ struct rte_crypto_sym_xform *xform; /**< Session-less API crypto operation parameters */ + struct rte_security_session *sec_session; + /**< Handle for the initialised security session context */ }; RTE_STD_C11 diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 7ec9c4b..2a544e9 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -47,6 +47,7 @@ extern "C" { #include "rte_kvargs.h" #include "rte_crypto.h" +#include "rte_security.h" #include "rte_dev.h" #include #include @@ -114,20 +115,6 @@ extern const char **rte_cyptodev_names; (phys_addr_t)((c)->phys_addr + (o)) /** - * Crypto parameters range description - */ -struct rte_crypto_param_range { - uint16_t min; /**< minimum size */ - uint16_t max; /**< maximum size */ - uint16_t increment; - /**< if a range of sizes are supported, - * this parameter is used to indicate - * increments in byte size that are supported - * between the minimum and maximum - */ -}; - -/** * Symmetric Crypto Capability */ struct rte_cryptodev_symmetric_capability { @@ -376,6 +363,9 @@ struct rte_cryptodev_info { const struct rte_cryptodev_capabilities *capabilities; /**< Array of devices supported capabilities */ + const struct rte_security_capabilities *sec_capabilities; + /**< Array of devices supported security capabilities */ + unsigned max_nb_queue_pairs; /**< Maximum number of queues pairs supported by device. */ @@ -745,6 +735,8 @@ struct rte_cryptodev { /**< Pointer to device data */ struct rte_cryptodev_ops *dev_ops; /**< Functions exported by PMD */ + struct rte_security_ops *sec_ops; + /**< Security functions exported by PMD */ uint64_t feature_flags; /**< Supported features */ struct rte_device *device; diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h index c983eb2..219fba6 100644 --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h @@ -357,6 +357,41 @@ struct rte_cryptodev_ops { /**< Detach session from queue pair. */ }; +/** + * Configure a security session on a device. + * + * @param dev Crypto device pointer + * @param conf Security session configuration + * @param sess Pointer to Security private session structure + * @param mp Mempool where the private session is allocated + * + * @return + * - Returns 0 if private session structure have been created successfully. + * - Returns -EINVAL if input parameters are invalid. + * - Returns -ENOTSUP if crypto device does not support the crypto transform. + * - Returns -ENOMEM if the private session could not be allocated. + */ +typedef int (*security_configure_session_t)(struct rte_cryptodev *dev, + struct rte_security_sess_conf *conf, + struct rte_security_session *sess, + struct rte_mempool *mp); + +/** + * Free driver private session data. + * + * @param dev Crypto device pointer + * @param sess Security session structure + */ +typedef void (*security_free_session_t)(struct rte_cryptodev *dev, + struct rte_security_session *sess); + +/** Security operations function pointer table */ +struct rte_security_ops { + security_configure_session_t session_configure; + /**< Configure a Security session. */ + security_free_session_t session_clear; + /**< Clear a security sessions private data. */ +}; /** * Function for internal use by dummy drivers primarily, e.g. ring-based -- 2.9.3