From patchwork Fri Oct 6 18:11:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 29837 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F2C9E1B262; Fri, 6 Oct 2017 20:14:59 +0200 (CEST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0078.outbound.protection.outlook.com [104.47.37.78]) by dpdk.org (Postfix) with ESMTP id 3F8B81B262 for ; Fri, 6 Oct 2017 20:14:58 +0200 (CEST) Received: from BN6PR03CA0024.namprd03.prod.outlook.com (10.168.230.162) by CY4PR03MB2696.namprd03.prod.outlook.com (10.173.43.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Fri, 6 Oct 2017 18:14:56 +0000 Received: from BY2FFO11FD034.protection.gbl (2a01:111:f400:7c0c::136) by BN6PR03CA0024.outlook.office365.com (2603:10b6:404:23::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11 via Frontend Transport; Fri, 6 Oct 2017 18:14:56 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; NXP1.onmicrosoft.com; dkim=none (message not signed) header.d=none;NXP1.onmicrosoft.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 BY2FFO11FD034.mail.protection.outlook.com (10.1.14.219) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.77.10 via Frontend Transport; Fri, 6 Oct 2017 18:14:55 +0000 Received: from netperf2.ap.freescale.net ([10.232.133.164]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v96IERoc027297; Fri, 6 Oct 2017 11:14:50 -0700 From: Akhil Goyal To: CC: , , , , , , , , , , , , Date: Fri, 6 Oct 2017 23:41:43 +0530 Message-ID: <20171006181151.4758-5-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171006181151.4758-1-akhil.goyal@nxp.com> References: <20171003131413.23846-1-akhil.goyal@nxp.com> <20171006181151.4758-1-akhil.goyal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131517872961001530; (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)(7966004)(39380400002)(376002)(39860400002)(346002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(8656003)(2950100002)(6916009)(8936002)(33646002)(316002)(498600001)(50466002)(85426001)(16586007)(69596002)(36756003)(7416002)(4326008)(5660300001)(86362001)(54906003)(48376002)(50226002)(189998001)(76176999)(2906002)(68736007)(356003)(5003940100001)(50986999)(104016004)(105606002)(53936002)(97736004)(1076002)(77096006)(81166006)(81156014)(47776003)(8676002)(6666003)(2351001)(106466001)(305945005)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2696; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD034; 1:g7T8oVz2HdgeLiw/BciDsrLrQ8VtIzSzHYjq+rYa/Iral4uYAFi+VIjKxRWl3N2NYNNl+K1GELEPww3aJjs+tFqcq6cRhWI+67uBSDQreRuTPHm/rXSrJMffFLlaZ9ls MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc9b2c35-df87-411b-983a-08d50ce625eb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:CY4PR03MB2696; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2696; 3:+FYkJKtgwREtPjx96NOJ1LtIA2ODjmOzQTt0/ApJeHvjJTQ4WOxdjC3hSQE+8yId6KRajEZ0tL2wVDNh7G9suxvtlgOf2787x9TGTLuc+TbInwlQ3kXdhe1QoSQHTsH48skcQ37F6QuQUup6uf4P/4iaXmgIf1hkqihtEVfz2MblyZCo3lofRI8y7upjODSk69huK29mOFdcFu2aX12U2VbMTVAyU+6gvTGNorgI6pQaaC0gOhvIfxF4u85HiNwtJxhnoIQSsY19rw1kHMx2/iJO6NrD4SUdccgXoJK+3DadfsD7Z/bcKfznB3p0Ql47nq4luHpaablUZu51EZPxI0ox/Ne93izJj2V+ernahbU=; 25:rCNsBmQ2/75H2oTiAE+ptbDdqjK3E47qrJ1zph+5/svx5Ui4Ebl50BWMb4z28BGSP7oKwQ1+QKMDjqbCPA/dbvmye2LI0JvsGwmyMng22HdjDpcGKYD71/1k++3NWe4oVggKE+V3oLWAJjgLMETc/0+5amUP5pr7Rv9b/J/FziD8A1c0APyTORjnBfqDJRiqNLc6DWiLAaBIpp7uL7bTJ7HsTqfbngPYI1SXE/FT2U3oQbTql6xNIIDxySyoPSl5CT3lkJDIx6zH2PyWzBjcW4tSznwqWmd0R9WzPjV889fo9H3de9ms7P9xgu4gGYufauMYWU5u52jZcyW04MjxdQ== X-MS-TrafficTypeDiagnostic: CY4PR03MB2696: X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2696; 31:ssDIN1vr9aDaNtjtXUojcIyswNnAEy2u1VvJtpgBuk6GJhOT8lXJtTYQxiv789WJpbClyRx9Tk4mTqbJt79L57+j00KzB8qGvZEZsnucQ0xZ8UiPyXABl4vPhAmduG7hElZYwAz2OQciNEJbT+U5WNVJcbNWLIvaa82irb3NuU8clGLXcQ25unKBsGGuEL/j6Eu1Pp/f90LYlTR043Uy9C3QLmNu7jmSYzknVAzXUHY=; 4:sVl6urtwUCSDwyKfS2eQzUix8AW27B8WazK1A5v3zFjxRaemGyHnENWPczn+6nm3phWIAQLVSFUqQiLzycgxxkh0PibYr85viazyYdR+7cePBMRfStP4Zf/U7nhtIC64RPmajRSuLyQM/lqOaP1E4/6xR1bJc9swlRc9wf9L7g6dhNEsz+GIofbSIKh8JXG/IsbDgBAUjsTHzVy1ulXJw4BuLtqj0Pw7s5n6QcZWCFhlT6j6zH9WmC0EVpKPyHpgKRIeDZED/z5nENbcd6V0mLU5R+iyNauTcvaaFk+aHmk= X-Exchange-Antispam-Report-Test: UriScan:(192374486261705); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(8121501046)(5005006)(93006095)(93001095)(100000703101)(100105400095)(3002001)(10201501046)(6055026)(6096035)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123565025)(20161123559100)(20161123556025)(20161123561025)(20161123563025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR03MB2696; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR03MB2696; X-Forefront-PRVS: 0452022BE1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB2696; 23:e3zWWXGc8G8Wsnzqkf3Id+aiLcJCiUIfPBokTkneB?= C7Us8KUXQMr7U923EI/CH1qXsDlKv0h/ZayTqAMdDZ0XKBGKVTlrkxhanElg8087lu37ZONPYy5BjEMTyByY3PnVqI8tYSmGwImwoO/2A/9oEG4sPCtReHsVJin04UwoctVEq4HAWh22UE+D3eQDbX48K7VzGyYgshEB0oj6uRis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1; CY4PR03MB2696; 6:NuacbaPEQwQ7dDccV3xvzNVQtiqyIWrZ2/cqyrxP8oQ5DhVCldgI1xJ5K1OqIEEFjjX5AMm0OdWA9ApPJqrJSACgAqA29t4T4TepkdPlzVUugEplgw0r0bpIDK7UtLcRj91gFL7YBoz0uRCM5MZ4pI6qmuwFcsO6eTpsAUDvWi/lrg/RhRdT7DRYmStnGBZw4n4x64VaoevoETA3IPybj5tgTGljRu3pnWIQWWugJ/MXQUXMY83IjddpWW2UVQZS+nVhDx5c+qfkYLG5L6uYZYdUBOiypx7ZoqJZh64A0vhvPR/JwrZQp62WJRM4yZEkZiR7IczQhYxvafyg80OHeg==; 5:ApcM3GY7uA99dsAGk6ez87YwRPZnkdVSC4wO3PBv47tVQOwGW8oRSyYs/X2BYVyLXKgBhyCb4P1vPgz8X4H8NyGt8PYTmuNrK6fEb599ip8J3Oc4Hm5W9qDvhpf2OcoAnCb+4b/ohnfjaND8q/JqXA==; 24:eEFMDaB4kx9I2GApLZxx1Y6SzEhTDdbM1Pfttmd4pX3VTzgFJPCVKcscJ7X+Nx2C9wC9jAY90tNmul9K/5MGsl43Cwsn3V5AuYS3UBnXYJ8=; 7:oduq5dy1+5Mwa/2TG4K7M8ok0DAiIzieztla2kd10Gf7j5ExR0m++RNANlzVz6nCRriN0pOWcPHfoc5nb5j1df3g1F6NmslcPkonuXyRYEfzb5PrIQuMKYepxwF1sAigQjDcJRySZVrfzMl/eboxqhEq7mDAFXoi8VmCmZYaOdbGIr+jeq8UknR3UxtfXJg7w5gQYs325FxuRNF2jQGGz54rbXGj2ywFBSrHPhQgQbI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2017 18:14:55.9909 (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: CY4PR03MB2696 Subject: [dpdk-dev] [PATCH v3 04/12] net: add ESP header to generic flow steering 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Boris Pismenny The ESP header is required for IPsec crypto actions. Signed-off-by: Boris Pismenny Signed-off-by: Aviad Yehezkel --- doc/api/doxy-api-index.md | 1 + lib/librte_ether/rte_flow.h | 26 ++++++++++++++++++++ lib/librte_net/Makefile | 2 +- lib/librte_net/rte_esp.h | 60 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 lib/librte_net/rte_esp.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index a3d39fc..23bafbc 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -107,6 +107,7 @@ The public API headers are grouped by topics: [LPM IPv6 route] (@ref rte_lpm6.h), [ACL] (@ref rte_acl.h), [EFD] (@ref rte_efd.h) + [ESP] (@ref rte_esp.h) - **QoS**: [metering] (@ref rte_meter.h), diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h index bba6169..ea08af6 100644 --- a/lib/librte_ether/rte_flow.h +++ b/lib/librte_ether/rte_flow.h @@ -50,6 +50,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -309,6 +310,13 @@ enum rte_flow_item_type { * See struct rte_flow_item_fuzzy. */ RTE_FLOW_ITEM_TYPE_FUZZY, + + /** + * Matches a ESP header. + * + * See struct rte_flow_item_esp. + */ + RTE_FLOW_ITEM_TYPE_ESP, }; /** @@ -735,6 +743,24 @@ static const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask = { #endif /** + * RTE_FLOW_ITEM_TYPE_ESP + * + * Matches an ESP header. + */ +struct rte_flow_item_esp { + struct esp_hdr hdr; /**< ESP header definition. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_ESP. */ +#ifndef __cplusplus +static const struct rte_flow_item_esp rte_flow_item_esp_mask = { + .hdr = { + .spi = 0xffffffff, + }, +}; +#endif + +/** * Matching pattern item definition. * * A pattern is formed by stacking items starting from the lowest protocol diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile index 56727c4..0f87b23 100644 --- a/lib/librte_net/Makefile +++ b/lib/librte_net/Makefile @@ -42,7 +42,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) := rte_net.c SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_net_crc.c # install includes -SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h +SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h diff --git a/lib/librte_net/rte_esp.h b/lib/librte_net/rte_esp.h new file mode 100644 index 0000000..e228af0 --- /dev/null +++ b/lib/librte_net/rte_esp.h @@ -0,0 +1,60 @@ +/*- + * BSD LICENSE + * + * Copyright (c) 2016-2017, Mellanox Technologies. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _RTE_ESP_H_ +#define _RTE_ESP_H_ + +/** + * @file + * + * ESP-related defines + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * ESP Header + */ +struct esp_hdr { + uint32_t spi; /**< Security Parameters Index */ + uint32_t seq; /**< packet sequence number */ +} __attribute__((__packed__)); + +#ifdef __cplusplus +} +#endif + +#endif /* RTE_ESP_H_ */