From patchwork Tue Oct 3 13:14:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 29539 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 0998B1B38A; Tue, 3 Oct 2017 15:17:13 +0200 (CEST) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0056.outbound.protection.outlook.com [104.47.34.56]) by dpdk.org (Postfix) with ESMTP id 8B62E1B38A for ; Tue, 3 Oct 2017 15:17:11 +0200 (CEST) Received: from BN6PR03CA0058.namprd03.prod.outlook.com (10.173.137.20) by CY4PR03MB2694.namprd03.prod.outlook.com (10.173.43.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Tue, 3 Oct 2017 13:17:08 +0000 Received: from BN1AFFO11FD022.protection.gbl (2a01:111:f400:7c10::109) by BN6PR03CA0058.outlook.office365.com (2603:10b6:404:4c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.9 via Frontend Transport; Tue, 3 Oct 2017 13:17:08 +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 BN1AFFO11FD022.mail.protection.outlook.com (10.58.52.82) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.77.10 via Frontend Transport; Tue, 3 Oct 2017 13:17:08 +0000 Received: from netperf2.ap.freescale.net ([10.232.133.164]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v93DGfTF030592; Tue, 3 Oct 2017 06:17:03 -0700 From: Akhil Goyal To: CC: , , , , , , , , , , Date: Tue, 3 Oct 2017 18:44:05 +0530 Message-ID: <20171003131413.23846-5-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171003131413.23846-1-akhil.goyal@nxp.com> References: <20170914082651.26232-1-akhil.goyal@nxp.com> <20171003131413.23846-1-akhil.goyal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131515102286549793; (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)(346002)(376002)(39860400002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(189998001)(5003940100001)(2950100002)(33646002)(6916009)(68736007)(50226002)(8656003)(86362001)(69596002)(4326008)(36756003)(7416002)(97736004)(50986999)(47776003)(5660300001)(8936002)(105606002)(8676002)(305945005)(316002)(76176999)(81166006)(81156014)(50466002)(356003)(48376002)(106466001)(1076002)(54906003)(53936002)(16586007)(2906002)(85426001)(77096006)(498600001)(104016004)(2351001)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2694; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD022; 1:FrTj2ZUydCOBZKpmcMFvK0zaYvoqWRVS5VCwSMLRPlFon6WgMURzTWc4pdqP5iHZO68+45fXSp8wyKu0tNzyiZuL782ZfKBNmBpBSDOMS17a9b456EHsSRPUon8KFFid MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 98020490-9567-4e0e-31c7-08d50a610cd8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:CY4PR03MB2694; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2694; 3:5j+GMPDal7IG1zM01HemLes0Ahs8jHuFuPxT7HRiG+KSHy8CHZK40d7e1eoUliqD0lrAL/zR+4PMw+DSPSHIYdciM+IXNHkHTJ+snXyR8RTnBeTaxy3k8wfW3KzqKeQ9znWmU97wM+GN9y9wojp1Vdc9n/BzJtVxub+09OaZFoB0SFY5IdES4iQyMu1zZhwgdDfO+YtDoSJ2uKCbQYiYfUGHy8pIaVUS137sKPKKOUgzSDe1vYRcuqYv672UqKaD2TF2dGhttedWLBLcBQT9aGpHuZlUYePgwsCUxAPdEABdbYkG/ZqHO3ByH5LiHq5TnNfXdGpjLuh27B2BEP2T0w==; 25:pW+GI6Uqy4s2eNONbxubmySNmayRTUCC/WyPEUUykZGmh2NKqtWxdLkvXtAIFzbxwoST9bVAuHbdDw5SRkD/KlnKuYahb8wMYzd7ItoC5ZoZR70tVqNQZEFtDQRX86jOO908r3zUMD9PXtwvREvrpPPLgtLpYdqC/fNG6H/kE8fClPT6t03MaRXp1WePlQupHyyu/hwVDaw4z1EzWNN1oP9rgB2aB7x+A75Z2/Dzrd1SoGN0WugyhkYO0Jq5/iWv/mVurmHpwoabfMzEMKejqqgzPokFudoYYeaaeDR27/JfPkmNYMAEKD0LaIMRkb2EqzQ0nqTuNYTpOrbx7k5fMA==; 31:l/bdqyf9bgPXWkO7InrbfcLGSOUuzN3UIonEdm1xogw3MWQIgJZ7axqnpzQ3XpcwWUZynlGO5fjjpPb14gQnBPG3ATSdlxML/nrqC413wM6pfaP82AjpWOybxRrn9h/XPl62XrndXIwPeZORIZ0zrTZ9bfow1t1hwnYouFU9QQuOuuTRzlP2hdOW+dwwaT9oGpa6L/Qw6EH0XwDw36s8n/cWoob0MH/UC5/7HWUaDQ8= X-MS-TrafficTypeDiagnostic: CY4PR03MB2694: 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)(5005006)(8121501046)(3002001)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(6055026)(6096035)(20161123565025)(20161123556025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123563025)(20161123561025)(20161123559100)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR03MB2694; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR03MB2694; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2694; 4:GApv0ElWTTRlAPWuw9n9lX4UsyAhDFxhGRXWDTcdWsTTiHbqULlySesFXpjdDA8x01c6XCM99PUj/sSdhD2T2F4gKmNrix/pHsaRsGrBRtPoSMafBPw5X1OOjDFQ/CNKSgIeUYQgeAzVPjxwaxlDQOO53KAM2RWlHB7UJlvTrRHsZvfJGTMmAHcjsy7PZgyecOj3CL29ue5meQsB+BMi4tJKcA1ZWK496Q/vI4m5guonGVEk1Gbp7cqoJZcrUWuH7GUz0eDS2tvRbetMYZCHe5lUfZkJQCHLb4RAfM1lRaU= X-Forefront-PRVS: 044968D9E1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB2694; 23:om1tBsgQXs+8e1PJ9uZJPeAqcOtOC/e3o1KjRPXAV?= jw/uXvbll4KjvRRvf2n6F2dVFwMu2+ff3+o2FYHa66r68cxwuSGvAmun7fsllpZBoLTQV7zxYo5r6RU2M4n/LNHFHkh1Xn0nnyIAaeqeNH9YcKbjYNX6Nqu0g8uTnGqttqH9AQINjbiz9xg4HX1jplyitIZ/qOHuEsFPv705PHlNFP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iRE5N6NNxdIi+icyWsdJEHYnZCh5k8uwqqUncnLXYrJnlw8/TCK0fOtSc+uFjOKYzp4fhUasbuvK7stW7me94old/62n9gsbcX5I4XQfi5gFWei2Uw0PCKh98OEHGA+2w3WCPbHS/g0+9TIJFtowXd8uQigjDpXYgkVWB2KOciQEKNcFnlLyacrPxxUnNSUHFM+X5iiwz5EDQnIt2TVhyM2v9DkKqMYL+oVf7VSSsbWTRgSB1lflpgiAWKFRtaSlGIlkfuSPiyQI63nIx+mu1DP2nk7aQT02hlqIClQILYaeTHzyWDQXoV3lMSodTTGpA==; 5:88x3cUkKaqJSjisdgoCFUWfqoAtFsYa/p6121RLWWFKs5foH0xangYQDjK1i6AEomxUHsfErvfQ1CYSX9ZihW2b8tFoM+MTPyb1Hwrx1Auw6fJE4GBFzeKQCIomu2jghtQpq6HmKqJi043vstaOlkQ==; 24:ZutJOLNAhJNAM9JovkNU1lJh9PD9GCp3NRuJKzM7NUk+cmfu1buvNj2KJeUzBVLvvnwSr+7yFadCg1r/UsQwJExcrlDUJZjdwHQoj0WqDoY=; 7:3LH7H3yHVDFkYo7YmNxTMZvj4/r2QW4RfnqiXFCxF59ZFhetXH08ciLMNmFzHDxpqBXoH/bBhl4Nf34va6QclyxxWhVYv0bgLchTOtBKAoAi1i0hWt5TAGG+dHqW2s3mkmnHBwqAJ/zQaU/w0Wols8d4WMaShhziYEAQP1U/RLiCWyojWADGdX6+mlKxRatcS64wWDf9qpfztJkX+VmJ4qrjtVJHPD62eTG+T220/74= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2017 13:17:08.4209 (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: CY4PR03MB2694 Subject: [dpdk-dev] [PATCH v2 04/12] lib/librte_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_ */