From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0053.outbound.protection.outlook.com [104.47.37.53]) by dpdk.org (Postfix) with ESMTP id 0C3D42661 for ; Wed, 22 Nov 2017 07:56:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=z3qlUCSJgKR3cDg4/jle8B390w88MvAJQ4UX1c6nRfQ=; b=i5bZhPwFYkXoOUTQL4btqKphIY5BfFfOeHnDUA5VlBN1ZIs2eUTi6seKQdot2s9AkbY6KwFX9kWEerxz5hCf5hzV6510XR+5XmYfGuRSsBQOJFGbmY2fl2XXU2jmVDsEJqb3NssG7no9GMNrNXDC5AdxbhEQZye+fWniklypqJE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com (14.140.2.178) by MWHPR0701MB3643.namprd07.prod.outlook.com (2603:10b6:301:7d::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Wed, 22 Nov 2017 06:56:06 +0000 From: Anoob Joseph To: Akhil Goyal , Declan Doherty , Radu Nicolau , Sergio Gonzalez Monroy Cc: Jerin Jacob , Narayana Prasad , dev@dpdk.org Date: Wed, 22 Nov 2017 06:55:15 +0000 Message-Id: <1511333716-11955-2-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511333716-11955-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1511173905-22117-1-git-send-email-anoob.joseph@caviumnetworks.com> <1511333716-11955-1-git-send-email-anoob.joseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: DM5PR20CA0018.namprd20.prod.outlook.com (2603:10b6:3:93::28) To MWHPR0701MB3643.namprd07.prod.outlook.com (2603:10b6:301:7d::36) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9362af89-d37e-431c-0b5b-08d531761c42 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600022)(4604075)(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(2017052603258); SRVR:MWHPR0701MB3643; X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3643; 3:bMavTiF+Gtxg5xH9ep7UmQrpBIWrPcrGzrQ4J7+bbp8nNsFoYUjFpMFPnbRB+PXODP3qYn4gFrdUMyIVy1O/huCgv4TzyYIdS0rT3whuQMBqZJ9KSvfMWIZ36Fg4sCa+osZtLOVZcR4siasldTYkwwteXXE4BR5h22WTIYqAOyetTAG7wLoO6vrsJ4/SOwdsI+Eoy3n7DsPLPG095kP67HdN4Zy+iMzn/7HJkSHWWdzKBhZa940Z+QTmkQIM/I3B; 25:LjcaIg7iBRHFeZyqUEKpIP/uEWDGp1sAoF3u8uAh/edkJQkbx06gqkcar5TNdWwW5k+8H0a6V74OQQbSL1q4Y+nlz0LE8Crw3WjWZG3dq+B3PH/ld/Z0KMdr6o0LKChb1YXCebnO8RupScBm+Lw6lNWzbz0FwZvwbJWDGq10lX1tHKojB0q9ZpjsLTiG03F127qgP3k6BHzC6ROkbcAGXwZVSo+qHZp3A2VzBFbpab9rPzI64pLLp0GAnPhoxabwG/SycNFFID0dCPgdsk7PCX3bopBYXhZG1VB7uohXU8KZvsxyMczusykNzurv6PAJud7Zq/VnPYNjhNpvzIX1Ng==; 31:6k26DQv4HFW5cMbBkbAomBQQhjl8zpuaBDRXTPbqRjLNI54ST0HFeVz9m1hF4y8pfUd0KvxoDuZvtcFTs5hNeeN6PndBUXMbXTXQKAE3f2bG6/34RKlkhri87do/pq+h3uCZ0pVIkQF3o1f6D/4VbxKLnUDGSVw8UOBuxCDx+r7FPumwzAbs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ft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(3231022)(10201501046)(3002001)(93006095)(6041248)(20161123558100)(20161123560025)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR0701MB3643; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR0701MB3643; X-Forefront-PRVS: 0499DAF22A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(189002)(199003)(69596002)(5890100001)(8676002)(68736007)(48376002)(53936002)(575784001)(6512007)(5660300001)(6666003)(42882006)(15650500001)(3846002)(2950100002)(8936002)(97736004)(81166006)(5009440100003)(76176999)(81156014)(50986999)(189998001)(2906002)(7736002)(50226002)(305945005)(101416001)(6116002)(16526018)(55236003)(53416004)(106356001)(105586002)(33646002)(47776003)(16586007)(316002)(5003940100001)(110136005)(54906003)(8656006)(72206003)(50466002)(25786009)(36756003)(66066001)(478600001)(4326008)(6486002)(6506006)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR0701MB3643; H:ajoseph83.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR0701MB3643; 23:OgZq19N71orLap1c/LEjKLdmCWm9Vg3/Ei2LmZU?= =?us-ascii?Q?2rLfEQQVqXy/ULAkbg+MeZxOCjU3Xf3G5GyPldZKbCNqZ8WiDlAtfb9+1eQ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chEuJNTZ1NJS9xiSBHOQ+P/9PDPsK+IlHMryX03dCzQTtsXbD2Kuam9Xp6hBJ6ZWzc=; 7:JDgnI04QSQYTwV/kA+BfZ64Me5+gi+yDqX8zVh/neUIfJvKCC4HGhCFNeNT67smn5X+slRfKiHrp+Q7AukwzStyYYi+6xBMlWbN2s9EvejBclqN+StQOIJgfg8w7Gg+k6OdN+nmWmC5hlmT14u6Jjp2By1yGTriVBPYUhl0squrZkdwV2DtYr3azAsVxPVt5mFPdoqTrCRPnMxF6PfIXHfQ3yM1N01yZqgicTKdNeA78VKFlcwbRd3F/aHVeMUj+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2017 06:56:06.5128 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9362af89-d37e-431c-0b5b-08d531761c42 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0701MB3643 Subject: [dpdk-dev] [PATCH v2 1/2] lib/security: add support for get metadata 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: Wed, 22 Nov 2017 06:56:11 -0000 In case of inline protocol processed ingress traffic, the packet may not have enough information to determine the security parameters with which the packet was processed. For such cases, application could register a 64 bit metadata in security session, which could be retrieved from the packet using "rte_security_get_pkt_metadata" API. Application can use this metadata to identify the parameters it need. Application can choose what it should register as the metadata. It can register SPI or a pointer to SA. Signed-off-by: Anoob Joseph --- v2: * Replaced get_session and get_cookie APIs with get_pkt_metadata API lib/librte_security/rte_security.c | 13 +++++++++++++ lib/librte_security/rte_security.h | 19 +++++++++++++++++++ lib/librte_security/rte_security_driver.h | 16 ++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c index 1227fca..804f11f 100644 --- a/lib/librte_security/rte_security.c +++ b/lib/librte_security/rte_security.c @@ -108,6 +108,19 @@ rte_security_set_pkt_metadata(struct rte_security_ctx *instance, sess, m, params); } +uint64_t +rte_security_get_pkt_metadata(struct rte_security_ctx *instance, + struct rte_mbuf *pkt) +{ + uint64_t mdata = 0; + + RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->get_pkt_metadata, 0); + if (instance->ops->get_pkt_metadata(instance->device, pkt, &mdata)) + return 0; + + return mdata; +} + const struct rte_security_capability * rte_security_capabilities_get(struct rte_security_ctx *instance) { diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h index 653929b..aa3a471 100644 --- a/lib/librte_security/rte_security.h +++ b/lib/librte_security/rte_security.h @@ -274,6 +274,8 @@ struct rte_security_session_conf { /**< Configuration parameters for security session */ struct rte_crypto_sym_xform *crypto_xform; /**< Security Session Crypto Transformations */ + uint64_t metadata; + /**< Metadata registered by application */ }; struct rte_security_session { @@ -346,6 +348,23 @@ rte_security_set_pkt_metadata(struct rte_security_ctx *instance, struct rte_mbuf *mb, void *params); /** + * Get metadata from the packet. This is an application registered 64 bit + * value, associated with the security session which processed the packet. + * + * This is valid only for inline processed ingress packets. + * + * @param instance security instance + * @param pkt packet mbuf + * + * @return + * - On success, metadata + * - On failure, 0 + */ +uint64_t +rte_security_get_pkt_metadata(struct rte_security_ctx *instance, + struct rte_mbuf *pkt); + +/** * Attach a session to a symmetric crypto operation * * @param sym_op crypto operation diff --git a/lib/librte_security/rte_security_driver.h b/lib/librte_security/rte_security_driver.h index 997fbe7..da0ebf4 100644 --- a/lib/librte_security/rte_security_driver.h +++ b/lib/librte_security/rte_security_driver.h @@ -122,6 +122,20 @@ typedef int (*security_set_pkt_metadata_t)(void *device, void *params); /** + * Get application interpretable metadata from the packet. + * + * @param device Crypto/eth device pointer + * @param pkt Packet mbuf + * @param mt Pointer to receive metadata + * + * @return + * - Returns 0 if metadata is retrieved successfully. + * - Returns -ve value for errors. + */ +typedef int (*security_get_pkt_metadata_t)(void *device, + struct rte_mbuf *pkt, uint64_t *mt); + +/** * Get security capabilities of the device. * * @param device crypto/eth device pointer @@ -145,6 +159,8 @@ struct rte_security_ops { /**< Clear a security sessions private data. */ security_set_pkt_metadata_t set_pkt_metadata; /**< Update mbuf metadata. */ + security_get_pkt_metadata_t get_pkt_metadata; + /**< Get metadata from packet. */ security_capabilities_get_t capabilities_get; /**< Get security capabilities. */ }; -- 2.7.4