From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <akhil.goyal@nxp.com>
Received: from NAM03-DM3-obe.outbound.protection.outlook.com
 (mail-dm3nam03on0050.outbound.protection.outlook.com [104.47.41.50])
 by dpdk.org (Postfix) with ESMTP id 041601B1A9
 for <dev@dpdk.org>; Thu, 14 Sep 2017 10:29:27 +0200 (CEST)
Received: from DM5PR03CA0025.namprd03.prod.outlook.com (10.174.189.142) by
 MWHPR03MB2704.namprd03.prod.outlook.com (10.168.207.138) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id
 15.20.56.11; Thu, 14 Sep 2017 08:29:25 +0000
Received: from BN1AFFO11FD032.protection.gbl (2a01:111:f400:7c10::164) by
 DM5PR03CA0025.outlook.office365.com (2603:10b6:4:3b::14) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id
 15.20.56.8 via Frontend Transport; Thu, 14 Sep 2017 08:29:25 +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
 BN1AFFO11FD032.mail.protection.outlook.com (10.58.52.186) with Microsoft SMTP
 Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.13.11
 via Frontend Transport; Thu, 14 Sep 2017 08:29:25 +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 v8E8T36I025953;
 Thu, 14 Sep 2017 01:29:21 -0700
From: Akhil Goyal <akhil.goyal@nxp.com>
To: <dev@dpdk.org>
CC: <declan.doherty@intel.com>, <pablo.de.lara.guarch@intel.com>,
 <hemant.agrawal@nxp.com>, <radu.nicolau@intel.com>, <borisp@mellanox.com>,
 <aviadye@mellanox.com>, <thomas@monjalon.net>, <sandeep.malik@nxp.com>,
 <jerin.jacob@caviumnetworks.com>
Date: Thu, 14 Sep 2017 13:56:44 +0530
Message-ID: <20170914082651.26232-5-akhil.goyal@nxp.com>
X-Mailer: git-send-email 2.9.3
In-Reply-To: <20170914082651.26232-1-akhil.goyal@nxp.com>
References: <20170914082651.26232-1-akhil.goyal@nxp.com>
X-EOPAttributedMessage: 0
X-Matching-Connectors: 131498513653418398;
 (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)(336005)(376002)(39380400002)(346002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(104016004)(356003)(106466001)(6916009)(36756003)(105606002)(2906002)(305945005)(8936002)(47776003)(48376002)(76176999)(50986999)(7416002)(16586007)(110136004)(5660300001)(6666003)(50466002)(85426001)(53936002)(33646002)(97736004)(316002)(2351001)(1076002)(68736007)(54906002)(77096006)(50226002)(8656003)(4326008)(2950100002)(189998001)(8676002)(81156014)(81166006)(5003940100001)(498600001)(86362001)(41533002);
 DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2704; H:tx30smr01.am.freescale.net;
 FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; 
X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD032;
 1:ctXf5A0FAQ2XeEYyV8Mgz+FpGzO+tfEdBG/SuQFAjAmOOAPSWJYFIZUx8k2AeMLRauPL7pPGuSORLrIK4W25w+xi549cReMJAZJec+uHQG4pHFVWc4QCtX3H7LYDMeUU
MIME-Version: 1.0
Content-Type: text/plain
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: 60c2f164-232c-4b38-c99e-08d4fb4ab544
X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0;
 RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603199)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);
 SRVR:MWHPR03MB2704; 
X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2704;
 3:YIRcaFrz3Bzt+OnbPoo0jQ1aMGGhnyZ1RvWx3+4FO53HhhbrJWVgO3wCj97jz3QZ0kjO2uhhVbt65wHZMeF6y5uHK0su+NnxmZ0Fgxwqy5FLxo9v0NTwr9JztiivxQYIgyAtOgjuWYkCmUMb4fG+3Z4DMm8J419m0Juw6BlqyxysyH1uoCxJIbre6DcaqzO8ocYf9rwzLB7EtVshJS9aUoGkXbVsNhAz7eDkb1NcHrXk75nLg4Zn1U2wFUdUreXGCicd4XyWoQ362n7MBf8F3PS70u98rGcIECg5bNJvjMSZrHnPR8t6g8Kk//OMATrjHFCPJOo2wFdPswC9ST/NEjO0w1BCn8sYbCzpcy1DamA=;
 25:6g+q6KBX4d0JFdtqWYlqCDE3hcuYybbi4ZwcSL3Kpt7nGlmxkejvELrk+BpybbSOnUuagPdmXS5sf+R+6UCXLEkY0E64Zv8kj+nA8qqiG7z1xe0Hj453SDDna+2NY6w8dLKbhSbKRharspT6DGY+fkK71eMl9S0MM+hGDca8xhtl2E+2jtjRpOW9q7/rGNyrmegoRcWOXHw/fvQZ/Fk5DH+1tvN070u1h+Yv+2Bz6eOQjBUE6sDzx+wCVS5skx1aV/T7+Pfb1TdoT3I1wad5q76ceIanPjCQYKyYmrzo5bJNjQBvi8+P2UihknHoiWpVXF5+aqdHXnic3Yra1mV9vQ==
X-MS-TrafficTypeDiagnostic: MWHPR03MB2704:
X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2704;
 31:zG9mMZjrRB1hRoWTv8zARuICwrYZcmHx+7uNH8Bx2wAklNOV+dEuzh/iH2nQyeSKtILf/QBDBP9BYdhChdYg3xHCw+9O8ZHapEeJcSYf8JMSppvjg+18Hlm5YXo3kRxAFzyYpRYAL7QyGfVNLwAHQpeF6p/TeBz5A6XaDidt2fLetJ7q98YkM+ZKL7CigI1pyy2LI1Z59wQ9PRIXyGkD09amoi9rIN9Ayv5e0JOxgGw=;
 4:yJQVLq5ZmpLHUANPH0wSGzHq/GIG8dJcGXXXiKW2IcGy+64ZCL8OTUsPSvz4AhNymkSxfEJsk8/RjoduB7ShSejD5Ty9x9VvLQN6WfhvcNpRERv75OtUeChFrrwR3f/0rPMp2Dma3vLjl9rGLN/i1XBRo1np27UZWOQDzUlr0iyOuobJqdxOWrFZKtpDdzTMAfi1Wo1gZHkcvrGh0CbA/Bz6/eIGzcS5m5aEvCKrZBUIdYlLb+FMAoUzdSuDfInWPVgPTEoSG1evQsrnAwdVB1NtUMQec1hYCs8bf69d6I8=
X-Exchange-Antispam-Report-Test: UriScan:(192374486261705);
X-Microsoft-Antispam-PRVS: <MWHPR03MB27046A9C58399B6A27F43BDBE66F0@MWHPR03MB2704.namprd03.prod.outlook.com>
X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0;
 RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6096035)(20161123559100)(20161123556025)(20161123565025)(20161123561025)(20161123563025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);
 SRVR:MWHPR03MB2704; BCL:0; PCL:0;
 RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095);
 SRVR:MWHPR03MB2704; 
X-Forefront-PRVS: 0430FA5CB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tqwD1rG3ZvUEBHPQ==;
 24:pzj/fAvDEHTS/xKCnfweH4bAeHvZ+nJt6UfMZo+0MbbR7gEzkjK1A6uf8oHWOK+4FQpttp6QsDDIDEYz2s/PecUAuNo9w4WJf07yp3NK+vs=;
 7:P00mTaAp3U/MCO4nvPbJ8jNX2s8erz4jnIIN+15FrecUr+2s4XWMrrQEYnQHj1YurfkYbJY23rhEjVx+Bdnz3pD+SJ86ZEfSBTsU717f7lFapxQlbmbPBBD5smSR9UJysQ4JHW6J0/y74w5wRspGTK4W0HH7WgEFageA5IK71oqu/bMjDV+w0jEt+yMV5siMY7BpOVfZkkqKNcvtD6997QO5MjWORYU+VZ1zaQXdeQI=
SpamDiagnosticOutput: 1:99
SpamDiagnosticMetadata: NSPM
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2017 08:29:25.1702 (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.168.50];
 Helo=[tx30smr01.am.freescale.net]
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2704
Subject: [dpdk-dev] [PATCH 04/11] 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 <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 14 Sep 2017 08:29:27 -0000

From: Boris Pismenny <borisp@mellanox.com>

The ESP header is required for IPsec crypto actions.

Signed-off-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: Aviad Yehezkel <aviadye@mellanox.com>
---
 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 <rte_tcp.h>
 #include <rte_udp.h>
 #include <rte_byteorder.h>
+#include <rte_esp.h>
 
 #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 <stdint.h>
+
+#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_ */
-- 
2.9.3