From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10063.outbound.protection.outlook.com [40.107.1.63]) by dpdk.org (Postfix) with ESMTP id C4BCC1DF8F for ; Mon, 11 Jun 2018 12:47:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dj38otFXdowjqWtBv/MiIzQBmXWpyAgph5/ItuWm1VI=; b=INfqoI/8P88cC3N/eLPLsIGfO0a54hchQDKXPz7IKfd0cR+9AbCJL15Seku5/JSOUnqAAIjM3lFShHRoz9wkQTqc/tMLyFBaI4fbzdmSoySFn03W/dl38JOYWllahQMVQcxmDL0eAhFvNzTbT1P2oLgnvb5k3UUo46qP93rkZ3U= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; Received: from localhost.localdomain (141.226.120.58) by VI1PR05MB3438.eurprd05.prod.outlook.com (2603:10a6:802:1e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.19; Mon, 11 Jun 2018 10:47:01 +0000 From: Ori Kam To: ferruh.yigit@intel.com, declan.doherty@intel.com, dev@dpdk.org, adrien.mazarguil@6wind.com, nelio.laranjeiro@6wind.com, orika@mellanox.com, shahafsh@mellanox.com, matan@mellanox.com Cc: thomas@monjalon.net Date: Mon, 11 Jun 2018 13:46:39 +0300 Message-Id: <1528713999-25914-1-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1528213708-5247-1-git-send-email-orika@mellanox.com> References: <1528213708-5247-1-git-send-email-orika@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [141.226.120.58] X-ClientProxiedBy: AM5PR0102CA0007.eurprd01.prod.exchangelabs.com (2603:10a6:206::20) To VI1PR05MB3438.eurprd05.prod.outlook.com (2603:10a6:802:1e::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB3438; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3438; 3:H2l/4VWv7J/fHbmQhLEanmW4TZ8xq1EyGKVdsKNY5iYDp68c1DeEM4woDtIF5AZkp3lTiwmQMZhB3uLljEmGV20TgJ3MLBeGsQuOWUMI3XWuqs+faJHC2oQxFkIKhN/EUfEsV9EA6DKVLrFb7H2KDxy7Lkg2bzgwFstCEkKwEytbeN+O7K8tImtZ85x/cmCQhG2TM4/1jE3wK44HBDisYRQ1k3Tvb9hkg3c4lLb/f4ZopVVTT/xDxOwbnZCVZTuF; 25:84M5Ur5svmrcuIx0ElvrpuAVcr381kXvUQzcXzki1qVYHKhRGqHvjprO24agudgnDJTJrXGBNUEbN5XPI11e58JWr8z65u9nBKhVt8qO14HPNXI/4PFZhGO5G3JpBaeQt96wnSouiY34ZD2j/haLU1Op92hfiC1XMUU7fyb9vO+9yrEJvem/hC/9fuwuJ4lx1ukIYqP5WclRpV9zuqrXImDuj7/f1y73O+IVNb1IkC4skI6PtqawcrPf73mrju+IlRDZrsTQtLQ63i9WiooNLVIFqQJlSlYCSTR6In2yC8Cxjl4DE/Wf2PhDdLBmLsYykJEhRxChzIf60IGndraTwA==; 31:YahXwo6mUyyO+Q2jSBB2dX0CiSj2AiyKnF58ClG9eQB7p15aWXtdkSjSXKwV3fyMx3cfbKOiEktjLpvbrWnvOqrspxMTbnCQmM5vjJ4ptcKqiiA521JJn6BMXcDSOofhiGuFlNL1hSMHcFQLrhsEItWmT8rJRf6ONT6fO/NS4DzY/ENlUe0ir5kxtX1BAd+v7nBrU3gKqJ+3QtVFRyfM2Ea6In/nEjt58adohZCDp/U= X-MS-TrafficTypeDiagnostic: VI1PR05MB3438: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3438; 20:OIx2KWkhQALGcRPmzTGpBJraVC2nah7knFJ2jo4pZhe2zNXwpC+A1YTpIkHBzENFrMbgmOs+7MTq270Xankq06GKGUYKXUQOhn+y+tX+HF1KgvzsjPY62qmjdWNpkQF+0SG6QlC2wLY/InOMSY4umyoqWnCf4T77UpG4cT3RhWVJeOKMEdukLDsI/6PUWWBtMA20V+nfV86a6QSBdtbjtJ5ZYOUNZW89EFkjdpbDzrx0sBE2lo6GQqfZrIH+mKdAbdAhsXqSmASqbceS9OnZyM+/FC4K7ipr/6efs0mlkZICGWuzlpU/xeiTGibnouBxBS5mnkz1RkeEiaD8jzpgNiOzv0t1Yujsbb7/InEnjm2eqWIej8iIuKWmttVzyxnYEZ6mbHxh75fnZWARbxml4BjsmuFRvQmM8++FmnJ1WJXynoRBfWQrPFCuE3nSCY2d+ehv5b3XOYoZYkxRkyhyPZgTmo7fUKWDCe1eU3mjdMmoBxClK/u4TMwGgKEzaK/3; 4:ED3Swlo2fQxfsbt9jvB5oM4T/Dct5OX1Kj8VlOTisiZ+ZEb0i9bEm7iD314S/6/TVCN3dAv9OPtZuIqS5FgakQI5QjEBy12uSXViHlJU4kIscjJEEAS3U7bK6NYIKu27TWb2anJSkDV2ZsHRF8FAvD4GeVNOKkxggw+dt9gWYUx03xig0d6jekdttL8mqwI6C4ZVSjUxpL0DttGmRFTMnD/R9NCUkC2WF9Arl8QlB0tEHG2eIMvw9CrvfKT/wmLDBmZknTttHtnFegeU1N0Fhw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231254)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:VI1PR05MB3438; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB3438; X-Forefront-PRVS: 070092A9D3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(376002)(346002)(366004)(396003)(39860400002)(39380400002)(199004)(189003)(966005)(478600001)(956004)(106356001)(446003)(50466002)(6636002)(316002)(4326008)(6512007)(6306002)(486006)(6666003)(5660300001)(16526019)(186003)(11346002)(476003)(36756003)(26005)(105586002)(6486002)(68736007)(2906002)(2616005)(76176011)(59450400001)(53376002)(47776003)(66066001)(51416003)(6506007)(86362001)(52116002)(50226002)(25786009)(7736002)(97736004)(16586007)(386003)(48376002)(305945005)(81156014)(81166006)(8936002)(8676002)(53936002)(6116002)(3846002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB3438; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB3438; 23:j3w/Jg0k6CCJGu7bAkEaSv98w0WJSyHr5f/6n3Ozh?= =?us-ascii?Q?VURIn48Zj8QN2WJTL6dJezaOwOL4mH4M8Dsz4z9d7QHB9aJkeZyjhPteguAL?= =?us-ascii?Q?+RPZp6CSDeBTqNQvsWbH6EHPQy0/o0W9RgSgd6rvykCRilOxQe9LJKjLooam?= =?us-ascii?Q?WFxx8hbjOxhwFwUPFaUdFuIRWp6s2ErHhxFR7Fb27wDQfD6opue4lW9r3tf4?= =?us-ascii?Q?CWtMfH9aLgKAPKGZdnM8UtMQzw6bR0NZgCWwxnwUH9l6l7pYlDVHf6lGBt/r?= =?us-ascii?Q?7xUxBsUY6z1Yf1Xp5ysM8I/piAmc/huHp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z/Jao+7U2AEpzdZssilmkqcD2jVUJ5w7JKgnnbaLuRe1WE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3438; 7:Osb8vcyj9tuq+g5slylAQT4Rb740VJfYWyt1MulZzU8LjIZsmX6LVCT/obuFF9hBitC9L8+mnITt6E8RgBRBGCmkonnm0Pg/MiobLi0xxhlOsowv6J+qwdf5mtOyEdqNNfTQyeR/BsQ5aWDCdlLTYl4Y2jota92N0uC8alw5F8DrULIJKiUdm+XAqZiGZBrz2ODtmeerZpXzmNG4V5q2OS+hZB/zGS5dYKVg6qRwIUyIoJmlySQnOF3C7ymz2umL X-MS-Office365-Filtering-Correlation-Id: 102d2c8e-a308-45d3-1a56-08d5cf88aa91 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2018 10:47:01.2868 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 102d2c8e-a308-45d3-1a56-08d5cf88aa91 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB3438 Subject: [dpdk-dev] [RFC v2] ethdev: support MPLS tunnel encapsulation action 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: Mon, 11 Jun 2018 10:47:08 -0000 Until now MPLS tunnel is supported only for checksum and TSO offloading. IN DPDK 18.05 some encapsulation API has been added for VXLAN and NVGRE. This patch adds the encapsulation offload for the MPLS tunnel type. Signed-off-by: Ori Kam --- v2: Specific MPLS encapsulation RFC v1: generic tunnel encapsulation RFC [1]. The generic approach must be discussed some more so it will not be ready for the 18.08 DPDK release. This MPLS-specific API targets 18.08 and is based on the current encapsulation API. [1] http://dpdk.org/ml/archives/dev/2018-June/103485.html --- --- doc/guides/prog_guide/rte_flow.rst | 54 ++++++++++++++++++++++++++++++++++++ lib/librte_ethdev/rte_flow.h | 54 ++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 0 deletions(-) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index b305a72..e40f9fe 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2076,6 +2076,60 @@ RTE_FLOW_ERROR_TYPE_ACTION error should be returned. This action modifies the payload of matched flows. +Action: ``MPLS_L2_ENCAP`` +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Performs MPLS encapsulation action over L2 inner packet by encapsulating +the matched flow with the requested MPLS tunnel as defined in +the``rte_flow_action_mpls_l2_encap`` flow item +definition. + +This action modifies the payload of matched flows. The flow definition specified +in the ``rte_flow_action_mpls_l2_encap`` action structure must defined a valid +MPLS network overlay. The pattern must be +terminated with the RTE_FLOW_ITEM_TYPE_END item type. + +.. _table_rte_flow_action_mpls_l2_encap: + +.. table:: MPLS_ENCAP + + +----------------+-------------------------------------+ + | Field | Value | + +================+=====================================+ + | ``definition`` | MPLS end-point overlay definition | + +----------------+-------------------------------------+ + +.. _table_rte_flow_action_mpls_l2_encap_example: + +.. table:: IPv4 GRE MPLS flow pattern example. + + +-------+----------+ + | Index | Item | + +=======+==========+ + | 0 | Ethernet | + +-------+----------+ + | 1 | IPv4 | + +-------+----------+ + | 2 | GRE | + +-------+----------+ + | 3 | MPLS | + +-------+----------+ + | 4 | END | + +-------+----------+ + +Action: ``MPLS_l2_DECAP`` +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Performs a decapsulation action by stripping all headers of the MPLS tunnel +network overlay from the matched flow. + +The flow items pattern defined for the flow rule with which a ``MPLS_DECAP`` +action is specified, must define a valid MPLS tunnel. If the +flow pattern does not specify a valid MPLS tunnel then a +RTE_FLOW_ERROR_TYPE_ACTION error should be returned. + +This action modifies the payload of matched flows. + Negative types ~~~~~~~~~~~~~~ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index f8ba71c..6edce68 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -1505,6 +1505,23 @@ enum rte_flow_action_type { * error. */ RTE_FLOW_ACTION_TYPE_NVGRE_DECAP, + + /** + * Encapsulate flow in MPLS L2 tunnel defined in the + * rte_flow_action_mpls_l2_encap action structure. + * + * See struct rte_flow_action_mpls_l2_encap. + */ + RTE_FLOW_ACTION_TYPE_MPLS_L2_ENCAP, + + /** + * Decapsulate outer most MPLS L2 tunnel from matched flow. + * + * If flow pattern does not define a valid MPLS L2 tunnel + * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION + * error. + */ + RTE_FLOW_ACTION_TYPE_MPLS_L2_DECAP, }; /** @@ -1868,6 +1885,43 @@ struct rte_flow_action_nvgre_encap { struct rte_flow_item *definition; }; +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_MPLS_L2_ENCAP + * + * MPLS l2 tunnel end-point encapsulation data definition + * + * The tunnel definition is provided through the flow item pattern. + * This action includes both MPLSoGRE and MPLSoUDP. + * The flow definition must be provided in order from the + * RTE_FLOW_ITEM_TYPE_ETH definition up the end item, + * which is specified by RTE_FLOW_ITEM_TYPE_END. + * + * The mask field allows user to specify which fields in the flow item + * definitions can be ignored and which have valid data and can be used + * verbatim. + * + * Note: the last field is not used in the definition of a tunnel and can be + * ignored. + * + * Example of valid flow definition for RTE_FLOW_ACTION_TYPE_MPLS_L2_ENCAP: + * + * - ETH / IPV4 / GRE / MPLS / END + * - ETH / VLAN / IPV4 / GRE / MPLS / END + * - ETH / IPV4 / UDP / MPLS / END + * - ETH / VLAN / IPV4 / UDP / MPLS / END + * + */ +struct rte_flow_action_mpls_l2_encap { + /** + * Encapsulating mpls tunnel definition + * (terminated by the END pattern item). + */ + struct rte_flow_item *definition; +}; + /* * Definition of a single action. * -- 1.7.1