From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0051.outbound.protection.outlook.com [104.47.37.51]) by dpdk.org (Postfix) with ESMTP id AEE462C02 for ; Wed, 5 Sep 2018 16:38:27 +0200 (CEST) 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:X-MS-Exchange-SenderADCheck; bh=o6gX0GmIEm5L7jaAEOHAbMjLUAsa+E+BiLXvq2RPulI=; b=kkvzL3tBAse5LCFc9U9ku+7zVS0x2/M/tKsatX3TaoKH2Y9wlWotRMMjL9Wq8mdkDMa4hcgB1urjKsjh6xHQnGQNoGm4pnBsLKP0/WbwMETkOmtOc8Llvd5BOSN0tWjLI3IB58YLQec8Xw6ZO2kPLGZ1FiOHqwHWnWZ+TL07yvk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from [192.168.1.4] (110.224.130.142) by SN6PR07MB4910.namprd07.prod.outlook.com (2603:10b6:805:39::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Wed, 5 Sep 2018 14:38:22 +0000 To: "Ananyev, Konstantin" , "dev@dpdk.org" Cc: "Awal, Mohammad Abdul" , "Doherty, Declan" , Jerin Jacob , Narayana Prasad References: <1535129598-27301-1-git-send-email-konstantin.ananyev@intel.com> <358d1b6c-26f2-b125-07a4-cfb1c0e2a57b@caviumnetworks.com> <2601191342CEEE43887BDE71AB977258EA95089D@irsmsx105.ger.corp.intel.com> From: "Joseph, Anoob" Message-ID: <475cf471-b46a-671a-5485-0042c652430c@caviumnetworks.com> Date: Wed, 5 Sep 2018 20:09:04 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <2601191342CEEE43887BDE71AB977258EA95089D@irsmsx105.ger.corp.intel.com> Content-Language: en-US X-Originating-IP: [110.224.130.142] X-ClientProxiedBy: PN1PR01CA0087.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::27) To SN6PR07MB4910.namprd07.prod.outlook.com (2603:10b6:805:39::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4fee2f18-dfb9-441b-87af-08d6133d3c99 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:SN6PR07MB4910; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4910; 3:ncIQpuw2tVhO8+YTdieoARMGPFgXkYK3nu5XgosvTlhedMxHEZkAmlRqH8sJQlUFnnuL/10MflQ2raMXM6KDZeXtPVECKh1JDcn+V3RoIhv/4iDCmGekORAwm9YUQZ3WJGe3tsMfDO0YLAjGINJLdmevYtE1AqD9ROLPh+PiUnEwpQ0M8Djw8/zr0Q+jyornMlfgnpQVjZQeH8rBnFjp8Rp/HwS6UjyCqifq1pK5fCsq7OnO3YDuR5/XuT38zoAB; 25:NDF4RVAFuVq6S7N3iJqcReA0b2g0GnExzz/mMIsKsEmepMozG5669lQhKHirTlLkvZj3+x+fxAh9CXVCdOW2RDVfiaSWA4YKbQzGVBFX+aCCRS0qJYUQKrp2mb7jhjNXsRL3GpkBooUI9fQb+RiXkkt0XTpo6CZMSZJHmOFwyblCPXazZFnqTN9Pvj7PAN+OnXuoBBbOwp52eg3DQ+ej2By3Vehk5pJDpuRnnOqI+UIzlq8ueOEWg0MP5dgj7JL1UOwCQ4/T8RSML8uJz4y8ZQ+RSaZArz9RJdEeGHuwuS5QVLbWBzOD8MabyTI8qertYbewIjMb1V6rUue1W357KQ==; 31:ua3T8uSiw79wfinItyDgeuQWtDZ17bFlY5W7+FjBd1GvzkDRB/hZ7ck+G8MvtFLlKz2uR0xtkdJl3osj6SMXSZDt81rz6eAaGS2JCm4jrOjszumO4jGpiBEbUMpPI96jjIP+7jPKhU2Oz7okucoevVI2LqMN2nJPMJN9aQPhtu6xjLyLLGrP8LfNXkgMDq2B7wyukRjTjelFYJgbrGq6zTI4L9GixCzpceIoBwjZei0= X-MS-TrafficTypeDiagnostic: SN6PR07MB4910: X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4910; 20:5UgMa1yz5mirEJx52PKtMIKAtlIh5Gn4jrbW3uW2k0F6CQuCP1h/Od2swMGPytwMbllyaga6jw+BPgNxbKZCxNb53ILTdH2MI4VRWouireFzPSptrTRd2lWsA89UeLwUUlpCUkstCTErBC4Kr6hxa/4VvrFhfXZlya0Eud65X1Ixc68D6OTXCFKCiaqXsNe3jefOVj0+jSWbrH+b4/trfA4qI5Pxlj1bZN4X+u+qBXxQWCRcT8eK/X7OK66QvSqz5FpmSY1gP0JV3I9dg7ylW7RIFkp1nfpQ3TtW6TzzTZVksXm3+Syxzy4lldFxCp6tlmHV/jHWBDz6u1oidUOUshPQx80dbs1mPxbYdiCmm5zlgYfCreVSdXUiNllefkVPeBLWkAnTZeF7RY9PhgqydEn7rBHXUNzKKcLLBHKmPwsjbPtH4BLbFv6rF1oIlzUbRBfWpEoq1yd3aYB61/Hi7eYgcua0OMkX2Nm7jENOyQo0++SLi5IxfWJtuJ6g10+GcSbqMO9OOBcoK9ipPLVtuI15BDHrvAi8fcuPrMfcoO7KYRBb8lel1XRb2QbZU00n5zBEnrBzYQ9oDhXfhNQJDxys0nBfr9kCi5gG15IdAAo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(3002001)(3231311)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699016); SRVR:SN6PR07MB4910; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4910; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4910; 4:01RMJIMkMJm7b9SP8WG/aXYX4Oc4YWNzZGzq4oRGzGQWBE+mJ4Ju8TMvp3sYVuKjlozkxmJyt8+dLDr0xxW4q6cHi6vGmm7zMHHdesFvE9bqCICEYLWUjJKC3a2lgfJcyqTrioiRjwpX1e/QMNv2+SFnnp+R/pYeHzS0nTW234CvGKNYa4W9fBb//qe+WF4RHLr3bEUc36rGbR5nM7ut1DTMIxZKblsYHVbEevqeWN7mt0jje/2tHdbZZ/4YrPAxZu26SejaXuayztEq2tC/KW9GlT62oZbU1XdIyXwOWe5+WeXgXARniCeoMr40AY2PnGKAT+Uehb042nT1sEBFf7DZlTvFOVuQ4raKJqE65xA= X-Forefront-PRVS: 078693968A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(346002)(39850400004)(376002)(396003)(366004)(136003)(15404003)(199004)(189003)(52164004)(57704003)(53546011)(3846002)(37036004)(54906003)(6116002)(386003)(81166006)(33964004)(77096007)(52116002)(5009440100003)(105586002)(106356001)(26005)(6246003)(68736007)(7736002)(76176011)(4326008)(42882007)(65956001)(270700001)(65806001)(66066001)(72206003)(25786009)(107886003)(3260700006)(16526019)(117156002)(2906002)(54896002)(65826007)(236005)(31696002)(97736004)(81156014)(8936002)(476003)(2616005)(58126008)(16586007)(478600001)(5024004)(84326002)(2501003)(486006)(8676002)(229853002)(36756003)(64126003)(53936002)(6666003)(446003)(110136005)(16576012)(14444005)(5660300001)(316002)(11346002)(6486002)(956004)(31686004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4910; H:[192.168.1.4]; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts)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QUlMXBPSe7BssXPN+yb9+V6IEsPl6Vo+4qKawg1GMH99oiyVTMH8qFxgkyP4kru/smup4NxOD7evEbL9FTtja72CqpnW8h8DkmNgaxoQJO0sC8L6XatygixAn9ckmQcQZqXEtRiwjDgemR7DJG9jIfIOMumj7YJ5EPKmFHoy9C2EbCE6xNmSdEfTV+EZMIQn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2018 14:38:22.6043 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4fee2f18-dfb9-441b-87af-08d6133d3c99 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4910 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [RFC] ipsec: new library for IPsec data-path processing 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, 05 Sep 2018 14:38:28 -0000 Hi Konstantin, Please see inline. On 03-09-2018 23:51, Ananyev, Konstantin wrote: > External Email > > Hi Anoob, > >> Hi Konstantin, >> >> Few comments. Please see inline. >> >> Thanks, >> >> Anoob >> >> On 24-08-2018 22:23, Konstantin Ananyev wrote: >>> External Email >>> >>> This RFC introduces a new library within DPDK: librte_ipsec. >>> The aim is to provide DPDK native high performance library for IPsec >>> data-path processing. >>> The library is supposed to utilize existing DPDK crypto-dev and >>> security API to provide application with transparent IPsec processing API. >>> The library is concentrated on data-path protocols processing (ESP and AH), >>> IKE protocol(s) implementation is out of scope for that library. >>> Though hook/callback mechanisms will be defined to allow integrate it >>> with existing IKE implementations. >>> Due to quite complex nature of IPsec protocol suite and variety of user >>> requirements and usage scenarios a few API levels will be provided: >>> 1) Security Association (SA-level) API >>> Operates at SA level, provides functions to: >>> - initialize/teardown SA object >>> - process inbound/outbound ESP/AH packets associated with the given SA >>> (decrypt/encrypt, authenticate, check integrity, >>> add/remove ESP/AH related headers and data, etc.). >>> 2) Security Association Database (SAD) API >>> API to create/manage/destroy IPsec SAD. >>> While DPDK IPsec library plans to have its own implementation, >>> the intention is to keep it as independent from the other parts >>> of IPsec library as possible. >>> That is supposed to give users the ability to provide their own >>> implementation of the SAD compatible with the other parts of the >>> IPsec library. >>> 3) IPsec Context (CTX) API >>> This is supposed to be a high-level API, where each IPsec CTX is an >>> abstraction of 'independent copy of the IPsec stack'. >>> CTX owns set of SAs, SADs and assigned to it crypto-dev queues, etc. >>> and provides: >>> - de-multiplexing stream of inbound packets to particular SAs and >>> further IPsec related processing. >>> - IPsec related processing for the outbound packets. >>> - SA add/delete/update functionality >> [Anoob]: Security Policy is an important aspect of IPsec. An IPsec >> library without Security Policy API would be incomplete. For inline >> protocol offload, the final SP-SA check(selector check) is the only >> IPsec part being done by ipsec-secgw now. Would make sense to add that >> also in the library. > You mean here, that we need some sort of SPD implementation, correct? [Anoob] Yes. > >>> Current RFC concentrates on SA-level API only (1), >>> detailed discussion for 2) and 3) will be subjects for separate RFC(s). >>> >>> SA (low) level API >>> ================== >>> >>> API described below operates on SA level. >>> It provides functionality that allows user for given SA to process >>> inbound and outbound IPsec packets. >>> To be more specific: >>> - for inbound ESP/AH packets perform decryption, authentication, >>> integrity checking, remove ESP/AH related headers >> [Anoob] Anti-replay check would also be required. > Yep, anti-replay and ESN support is implied as part of "integrity checking". > Probably I have to be more specific here. [Anoob] This is fine. > >>> - for outbound packets perform payload encryption, attach ICV, >>> update/add IP headers, add ESP/AH headers/trailers, >>> setup related mbuf felids (ol_flags, tx_offloads, etc.). >> [Anoob] Do we have any plans to handle ESN expiry? Some means to >> initiate an IKE renegotiation? I'm assuming application won't be aware >> of the sequence numbers, in this case. [Anoob] What is your plan with events like ESN expiry? IPsec spec talks about byte and time expiry as well. >>> - initialize/un-initialize given SA based on user provided parameters. >>> >>> Processed inbound/outbound packets could be grouped by user provided >>> flow id (opaque 64-bit number associated by user with given SA). >>> >>> SA-level API is based on top of crypto-dev/security API and relies on them >>> to perform actual cipher and integrity checking. >>> Due to the nature of crypto-dev API (enqueue/deque model) we use >>> asynchronous API for IPsec packets destined to be processed >>> by crypto-device: >>> rte_ipsec_crypto_prepare()->rte_cryptodev_enqueue_burst()-> >>> rte_cryptodev_dequeue_burst()->rte_ipsec_crypto_process(). >>> Though for packets destined for inline processing no extra overhead >>> is required and simple and synchronous API: rte_ipsec_inline_process() >>> is introduced for that case. >> [Anoob] The API should include event-delivery as a crypto-op completion >> mechanism as well. The application could configure the event crypto >> adapter and then enqueue and dequeue to crypto device using events (via >> event dev). > Not sure what particular extra API you think is required here? > As I understand in both cases (with or without event crypto-adapter) we still have to: > 1) fill crypto-op properly > 2) enqueue it to crypto-dev (via eventdev or directly) > 3) receive processed by crypto-dev crypto-op (either via eventdev or directly) > 4) check crypto-op status, do further post-processing if any > > So #1 and #4 (SA-level API respnibility) remain the same for both cases. [Anoob] rte_ipsec_inline_process works on packets not events. We might need a similar API which processes events. > >>> The following functionality: >>> - match inbound/outbound packets to particular SA >>> - manage crypto/security devices >>> - provide SAD/SPD related functionality >>> - determine what crypto/security device has to be used >>> for given packet(s) >>> is out of scope for SA-level API. >>> >>> Below is the brief (and simplified) overview of expected SA-level >>> API usage. >>> >>> /* allocate and initialize SA */ >>> size_t sz = rte_ipsec_sa_size(); >>> struct rte_ipsec_sa *sa = rte_malloc(sz); >>> struct rte_ipsec_sa_prm prm; >>> /* fill prm */ >>> rc = rte_ipsec_sa_init(sa, &prm); >>> if (rc != 0) { /*handle error */} >>> ..... >>> >>> /* process inbound/outbound IPsec packets that belongs to given SA */ >>> >>> /* inline IPsec processing was done for these packets */ >>> if (use_inline_ipsec) >>> n = rte_ipsec_inline_process(sa, pkts, nb_pkts); >>> /* use crypto-device to process the packets */ >>> else { >>> struct rte_crypto_op *cop[nb_pkts]; >>> struct rte_ipsec_group grp[nb_pkts]; >>> >>> .... >>> /* prepare crypto ops */ >>> n = rte_ipsec_crypto_prepare(sa, pkts, cops, nb_pkts); >>> /* enqueue crypto ops to related crypto-dev */ >>> n = rte_cryptodev_enqueue_burst(..., cops, n); >>> if (n != nb_pkts) { /*handle failed packets */} >>> /* dequeue finished crypto ops from related crypto-dev */ >>> n = rte_cryptodev_dequeue_burst(..., cops, nb_pkts); >>> /* finish IPsec processing for associated packets */ >>> n = rte_ipsec_crypto_process(cop, pkts, grp, n); >> [Anoob] Does the SA based grouping apply to both inbound and outbound? > Yes, the plan is to have it available for both cases. [Anoob] On the inbound, shouldn't the packets be grouped+ordered based on inner L3+inner L4? > >>> /* now we have group of packets grouped by SA flow id */ >>> .... >>> } >>> ... >>> >>> /* uninit given SA */ >>> rte_ipsec_sa_fini(sa); >>> >>> Planned scope for 18.11: >>> ======================== >>> >>> - SA-level API definition >>> - ESP tunnel mode support (both IPv4/IPv6) >>> - Supported algorithms: AES-CBC, AES-GCM, HMAC-SHA1, NULL. >>> - UT >> [Anoob] What is UT? > Unit-Test > > >>> Note: Still WIP, so not all planned for 18.11 functionality is in place. >>> >>> Post 18.11: >>> =========== >>> - ESP transport mode support (both IPv4/IPv6) >>> - update examples/ipsec-secgw to use librte_ipsec >>> - SAD and high-level API definition and implementation >>> >>> >>> Signed-off-by: Mohammad Abdul Awal >>> Signed-off-by: Declan Doherty >>> Signed-off-by: Konstantin Ananyev >>> --- >>> config/common_base | 5 + >>> lib/Makefile | 2 + >>> lib/librte_ipsec/Makefile | 24 + >>> lib/librte_ipsec/meson.build | 10 + >>> lib/librte_ipsec/pad.h | 45 ++ >>> lib/librte_ipsec/rte_ipsec.h | 245 +++++++++ >>> lib/librte_ipsec/rte_ipsec_version.map | 13 + >>> lib/librte_ipsec/sa.c | 921 +++++++++++++++++++++++++++++++++ >>> lib/librte_net/rte_esp.h | 10 +- >>> lib/meson.build | 2 + >>> mk/rte.app.mk | 2 + >>> 11 files changed, 1278 insertions(+), 1 deletion(-) >>> create mode 100644 lib/librte_ipsec/Makefile >>> create mode 100644 lib/librte_ipsec/meson.build >>> create mode 100644 lib/librte_ipsec/pad.h >>> create mode 100644 lib/librte_ipsec/rte_ipsec.h >>> create mode 100644 lib/librte_ipsec/rte_ipsec_version.map >>> create mode 100644 lib/librte_ipsec/sa.c >> >>> +static inline uint16_t >>> +esp_outb_tun_prepare(struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], >>> + struct rte_crypto_op *cop[], uint16_t num) >>> +{ >>> + int32_t rc; >>> + uint32_t i, n; >>> + union sym_op_data icv; >>> + >>> + n = esn_outb_check_sqn(sa, num); >>> + >>> + for (i = 0; i != n; i++) { >>> + >>> + sa->sqn++; >> [Anoob] Shouldn't this be done atomically? > If we want to have MT-safe API for SA-datapath API, then yes. > Though it would make things more complicated here, especially for inbound with anti-replay support. > I think it is doable (spin-lock?), but would cause extra overhead and complexity. > Right now I am not sure it really worth it - comments/suggestions are welcome. > What probably could be a good compromise - runtime decision per SA basis (at sa_init()), > do we need an ST or MT behavior for given SA. [Anoob] Going with single thread approach would significantly limit the scope of this library. Single thread approach would mean one SA on one core. This would not work on practical cases. Suppose we have two flows which are supposed to use the same SA. With RSS, these flows could end up on different cores. Now only one core would be able to process, as SA will not be shared. We have the same problem in ipsec-secgw too. In case of ingress also, the same problem exists. We will not be able to use RSS and spread the traffic to multiple cores. Considering IPsec being CPU intensive, this would limit the net output of the chip. Thanks, Anoob