From patchwork Wed Oct 25 15:07:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 30879 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 2F33E1B288; Wed, 25 Oct 2017 17:10:40 +0200 (CEST) Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0075.outbound.protection.outlook.com [104.47.32.75]) by dpdk.org (Postfix) with ESMTP id 553711B1EE for ; Wed, 25 Oct 2017 17:10:33 +0200 (CEST) Received: from BN3PR03CA0102.namprd03.prod.outlook.com (10.174.66.20) by DM5PR03MB2699.namprd03.prod.outlook.com (10.168.197.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.156.4; Wed, 25 Oct 2017 15:10:31 +0000 Received: from BN1BFFO11FD020.protection.gbl (2a01:111:f400:7c10::1:125) by BN3PR03CA0102.outlook.office365.com (2603:10b6:400:4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.156.4 via Frontend Transport; Wed, 25 Oct 2017 15:10:31 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) 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.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD020.mail.protection.outlook.com (10.58.144.83) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.156.4 via Frontend Transport; Wed, 25 Oct 2017 15:10:31 +0000 Received: from netperf2.ap.freescale.net ([10.232.133.164]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v9PFAECW009577; Wed, 25 Oct 2017 08:10:26 -0700 From: Akhil Goyal To: CC: , , , , , , , , , , , , Date: Wed, 25 Oct 2017 20:37:19 +0530 Message-ID: <20171025150727.30364-3-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171025150727.30364-1-akhil.goyal@nxp.com> References: <20171024141545.30837-1-akhil.goyal@nxp.com> <20171025150727.30364-1-akhil.goyal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131534178315181602; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7966004)(336005)(376002)(39860400002)(346002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(86362001)(575784001)(6666003)(189998001)(2351001)(50226002)(16586007)(106466001)(48376002)(50466002)(68736007)(77096006)(2950100002)(5660300001)(8656006)(85426001)(54906003)(47776003)(33646002)(97736004)(498600001)(316002)(105606002)(6916009)(305945005)(356003)(1076002)(81156014)(81166006)(8936002)(7416002)(76176999)(8676002)(50986999)(53936002)(4326008)(104016004)(5003940100001)(2906002)(36756003)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2699; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD020; 1:945wsv7mBKqlxvD9aFP7LYxovYTDXI9heRLONzULLZ1QrBT/eSE9hbLIInPD+tR9Myutz8jFndLX7GmyO5sinN6lQKf0uPoFT5alXkHS5Mhamb1Zbnw2A8aLTMAQCSG/ MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 49bd9458-67dc-4f16-9e22-08d51bba88c3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603199); SRVR:DM5PR03MB2699; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2699; 3:GIkAi1SksUmqZ2LukM8MLr3G+HCPBXpO5Zp7fgouYyBv3shWK+51/NSl1YdJwW4Fq/uG78OaLQTZhyqpeEjlWC7E9eHBF9vaWldWPOjUEw7RfG0WF6PllWJgAPvQtN4Wu/1Yfx5SIh/41s0wO4w0VcZvu2OPpFXhJX7ms3YFfz81qnPjcbqguP4/VDHFD2ynT7ktwNTKFfUI7VHT3tvM5R5P/hPmnWnlA9aw+NFuK6vTPsf+pGSL1Lc2WaRl1AkkmDQ/W7OZW7MqtdgIsNBJdzUQqOjeex5Lx+CgBtFHdjChX1VqTSFXei3XQQUsBf0rpLFCkY2Az6UeRQDABxNovw2+ImK9hhiMrbFIjdYaadw=; 25:uQ8uoPeVtGY5a6c7qZWZEkXjobhthBH71LzAmihPk4Bp2vmEFcTxXUCQ1G2Sn0yo5Mp9Ebf+z/veuhczkZQF1xIUwL+C5A+4qRNUItV/WIEHX/lYJeozQ07jJTw6gRMwSc7qDQh/mTsYpfY2Hce61lSBWB79l+sohgTlzrp1jVK12KMnY938HPEoJMV5XNTmsC6OyrFu8oMbRQnecec9o7elgMWQBYKbPvf8jl6UxBs4RHvVs8aBqpQLoMrYVHXsdKHYej/08ApamlzWZN7iTZ0CupDvR9nPRzym8aXceLZz1zWnt/3LHrFykX0hCOwS+bxYTPf3yyQp/ZujGjN/LQ== X-MS-TrafficTypeDiagnostic: DM5PR03MB2699: X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2699; 31:S/gCADOSz3XZ585RriNJpmqmbkWboadz2sR9PPxfy+5jQbOTLvCYqw5Y92x8N+tQCdUY3AYBn54K/b4UlcVQzuYvx2HqOZglsU5zT7USHvQ8W2S7knBFQ2S6LdyjDDpuxSZFRia4uh6EBZlzHtfEA67lhiby4G62gad/7YXPi4UY0QNRAgsH5j5Wr8quTiqfR1tKtKbm1YL0ijxCeWMIQKCvE5GHpH1mI/CRa3xm3NY=; 4:zTEqoEQle2Sn3NRhS+ooWnOf8nJAIE2Eh7ZBwASOun1ox47Y7ie8kub80Keaf9d5/LqiehIqdX8TsVwLhpJPG2xNdUZeT4WM+Hm2eOOw5I/V5bnT5p6UQchSvGKuCR2jx2haqi6Ro0bV3IEqfQNctzc4CBIaTll+lAj+vnUu/f7w/Hf9gazSlQFBTEeGZJ39mr03JQOv6vn3EjME8HG5O6ng/7WJYKIruOogdU8+5eJJTKTawefPSmnVDhcto5C7EkCku0O3prXs3MJH9Q7IROW/wTRx3pVo48WyzIV54aQ= 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)(3002001)(100000703101)(100105400095)(3231020)(93006095)(93001095)(10201501046)(6055026)(6096035)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123559100)(20161123563025)(20161123565025)(20161123561025)(20161123556025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR03MB2699; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR03MB2699; X-Forefront-PRVS: 0471B73328 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2699; 23:cHUthB3FXH8KcjQbC3yxiM5mGYcX+/Pu7hdlRB8j1?= hdABrKmQ9/IgIyauXhymbzIoGPSy4bD9yjP23zwWaNHpRdIxh/R8Xv+xuXuuNHKyMloZ0vaat0f5B4HCWuHnC2k7tiSE+hPkr9V0E+rjP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xpYrSDAjc/ymy4Bih7LSIAorkkrTIwlXGq4SkEo5uaowGDxyKx5AXpmvRELH X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2699; 6:rXE2IryosyHdfyDEz+LYCjaUsY3WtBG43EeNmJo5U++IPPjyH0Vv+1f5L1qVFhmON+hbBw4ZaO2WTeBBjKIL2bi6k/Vf2cl7K6RZUCaPauWzMIT1ntChooGlAyZg9D+j8lUaB6TdXbUP4jgY+2vcZOFS7rcKV1je5+HpmAIPK6lxcz1+5H7PVD1EWoRYNWzpPUOCYVTP5g7GV24zAtSTI7VNoyFoxFvxxY/ndl0vhXTitznPM7arfUjpNh+FEglRENtwENzxjB7FodQO2VDYATZ0G8SF6g3UQyQvn3/J1ZKjGk3xCaxHr1/0Kqi+1CeulLCPCNCgEZVYKx1uqlfZ5w==; 5:eoF62gFI8/TB/g1+NGWVifqDdaz4s5YPFiDVPGwEOTtlkrMrTd1zxxI/icXl6sdK5MBesuQ6zekS4r8/PB81t2txOUYGtkZzpd4t9efgJGpmge7MPS4pq6TgRnY8J732xamNnEgnCePMJ9pOUDa4uA==; 24:GdomT3rCiCgRaWjhpB+bxAr/iauJkRmrLnfZqbjWYVH8MBuvhQhA10p9J0HLid8MrGw4GVLuEK49pUPHSCrGh1BlX+tDJ37GE3Y7P6R9Amo=; 7:KVFyuNyhqT/o37VgPm2KG0a0yfjIh/Hp7D2hNgqzK0g17VPygughMgxhv/OKOj0STi1bWCt1oeEOge6MpTlm7+ANRaCBNxtiCbsA0EwNCOFQGTmd6xWlpWnBM8eVDJt2fc+7A6DuqxWqLeyht6K1WzU0tEjJHLftHevojw3xQp7MLf1KuzFh/5oNJYObqbjaZuRUqsRIfGoaBTrsRp4KOiNbeWblv3NSz84lYk6Wa3U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2017 15:10:31.2685 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 49bd9458-67dc-4f16-9e22-08d51bba88c3 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2699 Subject: [dpdk-dev] [PATCH v6 02/10] 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 5aef5b2..6ac9593 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -100,6 +100,7 @@ The public API headers are grouped by topics: [ethernet] (@ref rte_ether.h), [ARP] (@ref rte_arp.h), [ICMP] (@ref rte_icmp.h), + [ESP] (@ref rte_esp.h), [IP] (@ref rte_ip.h), [SCTP] (@ref rte_sctp.h), [TCP] (@ref rte_tcp.h), diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h index 062e3ac..bd8274d 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" { @@ -336,6 +337,13 @@ enum rte_flow_item_type { * See struct rte_flow_item_gtp. */ RTE_FLOW_ITEM_TYPE_GTPU, + + /** + * Matches a ESP header. + * + * See struct rte_flow_item_esp. + */ + RTE_FLOW_ITEM_TYPE_ESP, }; /** @@ -787,6 +795,24 @@ static const struct rte_flow_item_gtp rte_flow_item_gtp_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 cdaf0c7..50c358e 100644 --- a/lib/librte_net/Makefile +++ b/lib/librte_net/Makefile @@ -43,7 +43,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_ */