From patchwork Wed Sep 26 21:00:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ori Kam X-Patchwork-Id: 45456 X-Patchwork-Delegate: ferruh.yigit@amd.com 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 6ACF31B44F; Wed, 26 Sep 2018 23:01:39 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20081.outbound.protection.outlook.com [40.107.2.81]) by dpdk.org (Postfix) with ESMTP id 3F3B51B469 for ; Wed, 26 Sep 2018 23:01:37 +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=in4q2VVOvd/Cbc+HmKU5jMzS+yt9e+GR0hQt6E5dU7Q=; b=u6fZJcMnSiOp6PL1ycbRU00mDAcWJBncjMsTbQttdNR1i1gBZb1jrp6hi0QHbXZ+VODFYvb6HvmLp3ADn4w/AZwiXkeD7q5hjmCjPDyUdyKhx8MD+Q4+ygsBBolRuXh3eYVXUW/3qEzWWmXav9wzOQDfVN4iz8e2PG9XJg1V1tI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; Received: from mellanox.com (37.142.13.130) by DB6PR05MB3432.eurprd05.prod.outlook.com (2603:10a6:6:1e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.25; Wed, 26 Sep 2018 21:01:34 +0000 From: Ori Kam To: arybchenko@solarflare.com, ferruh.yigit@intel.com, stephen@networkplumber.org, adrien.mazarguil@6wind.com Cc: dev@dpdk.org, dekelp@mellanox.com, thomas@monjalon.net, nelio.laranjeiro@6wind.com, yskoh@mellanox.com, orika@mellanox.com, shahafs@mellanox.com Date: Wed, 26 Sep 2018 21:00:44 +0000 Message-Id: <1537995646-95260-2-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1537995646-95260-1-git-send-email-orika@mellanox.com> References: <1537116824-191205-1-git-send-email-orika@mellanox.com> <1537995646-95260-1-git-send-email-orika@mellanox.com> MIME-Version: 1.0 X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: AM0PR02CA0018.eurprd02.prod.outlook.com (2603:10a6:208:3e::31) To DB6PR05MB3432.eurprd05.prod.outlook.com (2603:10a6:6:1e::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 08341c22-ef5e-4325-ab37-08d623f33eb8 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR05MB3432; X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3432; 3:zdd8CvnnIcXLQo+x6b/Fvi60C4I1nmWXEF4VXOt0MNB0qcKN498LtrOyuXxrxwt8nKqSDnl1OoaTd4OjrbBUo70hW2WDUDCo9AOWdPAvlFda3lhpd6MNjYyVlzIyne1yQvepfevpSwuCLPaTNF9wIzWcFWcrnNbfy9fXXJNcIW9Tne37e9SyvpcSNTJaXJb+y1tXc/QsfPn3zL+tKi9Hqf17DYCBEXa7baAjHXiPS2yK1q8SU7X5372UMKtAibJB; 25:6+nGFxruKIid+spxCSW305F5imHVxe73L5gZrU2HBaxphyOoO7tGLlVoSXInx5DIh3h8xmZdLLMmLO5xwMrPIbK2IIVDCw59TszzYdTij8jvqoLa/qE6KbuPkY2FbVhwpJ934kehsvlf5dRUsQsdR+IGzMlDuikxgdipqFedWtM1D9H4lEbTtauOQ155ewzgmWguDfu9O7pH+wZsTaqLCO+nSBhAwW4GFOU4XHspKju0gLf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UE0F02SHXsKMfnEBssB5StcXBTXWc74HzcJmYweFrtckVmeEP86V/+8i+DMg1BYDwHvenZSFibmNeNZGpaBhxmwC5vl2lp9V7hh1GLGHQU1Dr1/Z7UQF43w8oVQl5iwamoBiKGYRAAnTN0b57+jJQREXacA5AVnKvLI96bJyaPTIuw== 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)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201708071742011)(7699051); SRVR:DB6PR05MB3432; BCL:0; PCL:0; RULEID:; SRVR:DB6PR05MB3432; X-Forefront-PRVS: 08076ABC99 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(39860400002)(136003)(346002)(366004)(199004)(189003)(305945005)(50226002)(478600001)(2906002)(16586007)(48376002)(386003)(4720700003)(55016002)(6666003)(8936002)(486006)(7696005)(51416003)(53936002)(81156014)(5660300001)(7736002)(8676002)(81166006)(50466002)(52116002)(76176011)(69596002)(8886007)(97736004)(186003)(16526019)(446003)(105586002)(36756003)(14444005)(34290500001)(107886003)(316002)(25786009)(106356001)(68736007)(66066001)(6116002)(11346002)(956004)(3846002)(86362001)(33026002)(47776003)(26005)(4326008)(476003)(2616005)(21086003)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR05MB3432; H:mellanox.com; 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; DB6PR05MB3432; 23:o+/avPrJvHjBEKLj9DE9DTKwxqJTRYk2GBc4ffBGE?= /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QtHqsr7JXfPEw4tATZ0MAoX2Y20ouOUvUpnCGiNk8jwg1EH6Fh+Vg==; 5:FeWyoLb6pATE9KJyDGBwyxTPA1NqL2+hZZbMjHJ7/kCrDGWAng4A8ZBVz/m8yWrf3si2oI/cltAgWyvLwRpBg6TrIwAYjNvmY7u7SRjSUWFm3mNbL/iVTPOjX1DxArJtRpL/qI73pepZQ4hlMkgqcoKWTmrUsz3mSYVIYU2Dk24=; 7:gxEnSwwvD5e383b4Js1+FCgBR2L85OW/UeK9Y7HT7/Ix68AO+JM84UkXC5DglpZRgg1jxM7ob6z++ld5dU4xXBOqxADyYtWT1kZhSksYA6KrSzrVJO1dGMQHDESlrs3gx1nkDvHkPoxUgK5XHVnRJiGBJ/n/M2tAhUKUCIjd7bT+5wVama9+Wh/44HmxWGmKJdVQPa5M/xAuVD2qG9FfhILfqlJoOUPPOJkzjVsqplOdR5S20CdVGtpxK7PgPGQX SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2018 21:01:34.0207 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 08341c22-ef5e-4325-ab37-08d623f33eb8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR05MB3432 Subject: [dpdk-dev] [PATCH v2 1/3] ethdev: add generic L2/L3 tunnel encapsulation actions 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" Currenlty the encap/decap actions only support encapsulation of VXLAN and NVGRE L2 packets (L2 encapsulation is where the inner packet has a valid Ethernet header, while L3 encapsulation is where the inner packet doesn't have the Ethernet header). In addtion the parameter to to the encap action is a list of rte items, this results in 2 extra translation, between the application to the action and from the action to the NIC. This results in negetive impact on the insertion performance. Looking forward there are going to be a need to support many more tunnel encapsulations. For example MPLSoGRE, MPLSoUDP. Adding the new encapsulation will result in duplication of code. For example the code for handling NVGRE and VXLAN are exactly the same, and each new tunnel will have the same exact structure. This patch introduce a generic encapsulation for L2 tunnel types, and generic encapsulation for L3 tunnel types. In addtion the new encapsulations commands are using raw buffer inorder to save the converstion time, both for the application and the PMD. Signed-off-by: Ori Kam --- doc/guides/prog_guide/rte_flow.rst | 82 ++++++++++++++++++++++++++++++++++++++ lib/librte_ethdev/rte_flow.h | 79 ++++++++++++++++++++++++++++++++++++ 2 files changed, 161 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index b305a72..3ba8018 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2076,6 +2076,88 @@ RTE_FLOW_ERROR_TYPE_ACTION error should be returned. This action modifies the payload of matched flows. +Action: ``TUNNEL_ENCAP`` +^^^^^^^^^^^^^^^^^^^^^^^^ + +Performs a tunnel encapsulation action by encapsulating the matched flow with +a tunnel header as defined in the``rte_flow_action_tunnel_encap``. + +This action modifies the payload of matched flows. The flow definition specified +in the ``rte_flow_action_tunnel_encap`` action structure must define a valid +tunnel packet overlay. + +.. _table_rte_flow_action_tunnel_encap: + +.. table:: TUNNEL_ENCAP + + +----------------+-------------------------------------+ + | Field | Value | + +================+=====================================+ + | ``buf`` | Tunnel end-point overlay definition | + +----------------+-------------------------------------+ + | ``size`` | The size of the buffer in bytes | + +----------------+-------------------------------------+ + +Action: ``TUNNEL_DECAP`` +^^^^^^^^^^^^^^^^^^^^^^^^ + +Performs a decapsulation action by stripping all headers of the tunnel +network overlay from the matched flow. + +The flow items pattern defined for the flow rule with which a ``TUNNEL_DECAP`` +action is specified, must define a valid tunnel. If the +flow pattern does not specify a valid tunnel then a +RTE_FLOW_ERROR_TYPE_ACTION error should be returned. + +This action modifies the payload of matched flows. + +Action: ``TUNNEL_ENCAP_L3`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Replace the packet layer 2 header with the encapsulation tunnel header +as defined in the ``rte_flow_action_tunnel_encap_l3``. + +This action modifies the payload of matched flows. The flow definition specified +in the ``rte_flow_action_tunnel_encap_l3`` action structure must define a valid +tunnel packet overlay. + +.. _table_rte_flow_action_tunnel_encap_l3: + +.. table:: TUNNEL_ENCAP_L3 + + +----------------+-------------------------------------+ + | Field | Value | + +================+=====================================+ + | ``buf`` | Tunnel end-point overlay definition | + +----------------+-------------------------------------+ + | ``size`` | The size of the buffer in bytes | + +----------------+-------------------------------------+ + +Action: ``TUNNEL_DECAP_L3`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Replace the packet tunnel network overlay from the matched flow with +layer 2 header as defined by ``rte_flow_action_tunnel_decap_l3``. + +The flow items pattern defined for the flow rule with which a ``TUNNEL_DECAP_L3`` +action is specified, must define a valid tunnel. If the +flow pattern does not specify a valid tunnel then a +RTE_FLOW_ERROR_TYPE_ACTION error should be returned. + +This action modifies the payload of matched flows. + +.. _table_rte_flow_action_tunnel_decap_l3: + +.. table:: TUNNEL_DECAP_L3 + + +----------------+-------------------------------------+ + | Field | Value | + +================+=====================================+ + | ``buf`` | Layer 2 definition | + +----------------+-------------------------------------+ + | ``size`` | The size of the buffer in bytes | + +----------------+-------------------------------------+ + Negative types ~~~~~~~~~~~~~~ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index f8ba71c..e29c561 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -1505,6 +1505,40 @@ enum rte_flow_action_type { * error. */ RTE_FLOW_ACTION_TYPE_NVGRE_DECAP, + + /** + * Encapsulate the packet with tunnel header as defined in + * rte_flow_action_tunnel_encap action structure. + * + * See struct rte_flow_action_tunnel_encap. + */ + RTE_FLOW_ACTION_TYPE_TUNNEL_ENCAP, + + /** + * Decapsulate outer most tunnel from matched flow. + * + * The flow pattern must have a valid tunnel header + */ + RTE_FLOW_ACTION_TYPE_TUNNEL_DECAP, + + /** + * Remove the packet L2 header and encapsulate the + * packet with tunnel header as defined in + * rte_flow_action_tunnel_encap_l3 action structure. + * + * See struct rte_flow_action_tunnel_encap. + */ + RTE_FLOW_ACTION_TYPE_TUNNEL_ENCAP_L3, + + /** + * Decapsulate outer most tunnel from matched flow, + * and add L2 layer. + * + * The flow pattern must have a valid tunnel header. + * + * See struct rte_flow_action_tunnel_decap_l3 + */ + RTE_FLOW_ACTION_TYPE_TUNNEL_DECAP_L3, }; /** @@ -1868,6 +1902,51 @@ 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_TUNNEL_ENCAP + * + * Tunnel end-point encapsulation data definition + * + * The encapsulation header is provided through raw buffer. + */ +struct rte_flow_action_tunnel_encap { + uint8_t *buf; /**< Encapsulation data. */ + uint16_t size; /**< Buffer size. */ +}; + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_TUNNEL_ENCAP_L3 + * + * Tunnel end-point encapsulation data definition + * + * The encapsulation header is provided through raw buffer. + */ +struct rte_flow_action_tunnel_encap_l3 { + uint8_t *buf; /**< Encapsulation data. */ + uint16_t size; /**< Buffer size. */ +}; + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_TUNNEL_DECAP_L3 + * + * Layer 2 definition to encapsulte the packet after decapsulating the packet. + * + * The layer 2 definition header is provided through raw buffer. + */ +struct rte_flow_action_tunnel_decap_l3 { + uint8_t *buf; /**< L2 data. */ + uint16_t size; /**< Buffer size. */ +}; + /* * Definition of a single action. * From patchwork Wed Sep 26 21:00:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ori Kam X-Patchwork-Id: 45457 X-Patchwork-Delegate: ferruh.yigit@amd.com 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 E92041B485; Wed, 26 Sep 2018 23:01:43 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20055.outbound.protection.outlook.com [40.107.2.55]) by dpdk.org (Postfix) with ESMTP id A70C91B47A for ; Wed, 26 Sep 2018 23:01:41 +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=S9k0rjjCFkBqnI28/RzdmL71DJIU026JBhukfg/p9Ik=; b=B87qXmfCJzg/5iyvJZJN9nq6dr+7r/OFyUx/nKqw8UNlzdRIcfzb81TC0pz7O2RPZxgQViyM5V4PgU5GGUhZX/r0vpjMctkcTnl1+WSaZyZLD0ajXK4uz64Nkl7RWzZjU+ZAAnPZ/2FKH7Pcdz5867oQFB40PhIMXUEsOsEYbp0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; Received: from mellanox.com (37.142.13.130) by DB6PR05MB3432.eurprd05.prod.outlook.com (2603:10a6:6:1e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.25; Wed, 26 Sep 2018 21:01:38 +0000 From: Ori Kam To: arybchenko@solarflare.com, ferruh.yigit@intel.com, stephen@networkplumber.org, adrien.mazarguil@6wind.com Cc: dev@dpdk.org, dekelp@mellanox.com, thomas@monjalon.net, nelio.laranjeiro@6wind.com, yskoh@mellanox.com, orika@mellanox.com, shahafs@mellanox.com Date: Wed, 26 Sep 2018 21:00:45 +0000 Message-Id: <1537995646-95260-3-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1537995646-95260-1-git-send-email-orika@mellanox.com> References: <1537116824-191205-1-git-send-email-orika@mellanox.com> <1537995646-95260-1-git-send-email-orika@mellanox.com> MIME-Version: 1.0 X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: AM0PR02CA0018.eurprd02.prod.outlook.com (2603:10a6:208:3e::31) To DB6PR05MB3432.eurprd05.prod.outlook.com (2603:10a6:6:1e::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 33138b15-3119-47a3-0e8b-08d623f3415a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR05MB3432; X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3432; 3:Cp89oMVibBWePgUthCcuzKyl0Abt8LAWs3cgQuGx3YIim6YSr7jK21Y9Erdoy6cc/PfQxIstc1dY2sdUQ2cQkOie1dm1JitC5iha3Q3cJQCpllRdlUiXsPXJI+nADaOMysgIfU1e559xoWvyaEPUQOXFlEJNjH5ASCndl7XkXufMDDdIY1/Fb57UVNdJXBOWZruZlMB3Mb3Lz8N8c7zIeQk9hsYFGVgDp/iSaI/2KFpMz3ML7P1vQr+byQDs9mqT; 25:t9lu7hwx4e8l1SgmSR6LmgyM6L1CS+0O9QIg4TZcJvvWE5sBHia9uO2elfkDsUsWqwhgwvbIa/YnWTOwYbTRcvXksL54ex0oQsMMs9zJhSWCVMTVacX7/ZfUBkRkuKNGda5Ji1waHGH/0a1lvtDt0XSrLYeWCsssQQsVD8WgnW9evOmN4FoW+1GY3/Vj60TTDECUgZ/hplM0wmrSkIXlZeVeKPEul3rsdBCX3xpDHPOA5sMTV8dOp7R8d03EKPmITP3UP76h/BS8nEW1RIOj5KVdvDlSB6Qa6jSx0Y9BVnYb6JxmW5E0tnNyBRp+BCOJc1wUgb6cJdjqVrQH9jBGZg==; 31:oT5MO7FRo+2NHYXQIqCfan7E1t79juoepeTrCo2zBqh9Jth2bKR3xcCbn/cm7lUqsBO4OA31mxorTU/wT4jOaZZYefLAUofgc6YzlM1CuQkxbuq7utQhBdnUeOywK9HAt9wfdMJZOA0vAuYbp6U8JKFzWfS71Y8pN7+mevpYFC0RaIk3P185OhtGMxmZNL/AgQoVCrGowCYqNUhUGsqVfKMEmMJyMe9+XEDNaxKRGqY= X-MS-TrafficTypeDiagnostic: DB6PR05MB3432: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3432; 20:HSxGIe42l7TsxViYxczY+5dx8vZdST+89DLs08pGAsRrfJdcRCdn1uSD2J1f/yKQz7C2ncodWVkPSReM10JHclRAOTvHosWRInxLF5lgzaeYPc2RKAjuaXdZEnxhd9DXd5uG51neemCmwEhOSRQYfYcrtH5v8gh11mVUSPmb93nupFRZze/bD3+SuYgHNPWJDfFeEw4xLPCMMWJHsa2HWyW72Patc+nbIQBfD5gQh9JKsRNHnk3KR+e3xM94UEvPotCw8kFrmUff5Z7SoDuHo7vGVKo2dqW+U+cmxI4eD4n7U83ypQcgNGRN5T6vlgNdyF+KAYR2c1F6AWMHex+PvN0LBMgO8TBO5rzP7rpJG4eqdMcerbpHveRf7S5nd8zu5d/UJYL44yHGEQfUQSo/j6JRXHiY3NJKQmJqc6KsgKw380M1wUhGfTWjF6fca9TeMaLgpDMOqQWEVVAG4EnxalVT/aKYnofuKaTeQejWOEoQqFxr+6F/MZfa51J2+Xtl; 4:DhTh1qC+KcvudE2uciFhy1vxLc/DdwPIV94nb5zN9bgA7X4XrF8WPSxqO0sfNXhwf+Rd4xPA/1aW8lgv/YeqLPp8gLD0EfHrYFWLjspyXIDFS4IYGSMaWfVJwumRzzFe+db2fEQxe+T07yJ7QQyWB7XdL2HT09Iv+pcaZLbOYisVi14Q9m2nV6iLnZP19XoYoOfar7lxxVWI/aeZTvTQryjWS/jhbwKjSXTay6Y1BsI4vgnhiqXpszPhsbwgbqvJHumbsrY6JjWePBj+dvhV1A== 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)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201708071742011)(7699051); SRVR:DB6PR05MB3432; BCL:0; PCL:0; RULEID:; SRVR:DB6PR05MB3432; X-Forefront-PRVS: 08076ABC99 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(39860400002)(136003)(346002)(366004)(199004)(189003)(305945005)(50226002)(478600001)(2906002)(16586007)(48376002)(386003)(4720700003)(55016002)(6666003)(8936002)(486006)(7696005)(51416003)(53936002)(81156014)(5660300001)(7736002)(8676002)(81166006)(50466002)(52116002)(76176011)(69596002)(8886007)(97736004)(186003)(16526019)(446003)(105586002)(36756003)(14444005)(34290500001)(107886003)(316002)(25786009)(106356001)(68736007)(66066001)(6116002)(11346002)(956004)(3846002)(86362001)(33026002)(47776003)(26005)(4326008)(476003)(2616005)(21086003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR05MB3432; H:mellanox.com; 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; DB6PR05MB3432; 23:Rk4K1+TsQ28MxTJC6eR/jJezy6JUdY9EcklXKJUvM?= oSSBp45SIz+Wff2bVrb4K58kKTGrR8ZhSjHy01Neaynfk9kZ4ugzVen/LKeoFmBC+yvxeK0Vpn+jk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a/SblhEB+88w1tsbBJkFsAyJCC0VscEPklXBWG8ON7gL4oG5CvscY+pYv9/ah52J9rAcDcENUldZvM2UPTA/rUdwNlJhSr6h91E=; 7:SoapKOpJnibBkTxCzQj+4ekXvUWpUvHQjpdetNRKaCuaF/9T7lkRVUZHhXp2uz5h/JEY5ixmQdUvcaLmYR0GK3CC1TVoqxx9Y0i9zPpz8kH4kBeP9AeMWPvn1G5IavoNUv43R/pFk0ruOWpSYRApksAFIGfvHZ8PPbPClicmfMHoJWVjnmiCZqaW4xwufZsK4xxNQmlX0aOkv8zYrqWAvx80UfxlS6E9Pd80Cax6JcKqwj61hAw3ahh0eRC0sH+Y SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2018 21:01:38.3298 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 33138b15-3119-47a3-0e8b-08d623f3415a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR05MB3432 Subject: [dpdk-dev] [PATCH v2 2/3] app/testpmd: convert testpmd encap commands to new API 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" Currently there are 2 encapsulation commands in testpmd one for VXLAN and one for NVGRE, both of those commands are using the old rte encap command. This commit update the commands to work with the new tunnel encap actions. The reason that we have different encapsulation commands, one for VXLAN and one for NVGRE is the ease of use in testpmd, both commands are using the same rte flow action for tunnel encap. Signed-off-by: Ori Kam --- app/test-pmd/cmdline_flow.c | 294 +++++++++++++++++++++----------------------- app/test-pmd/config.c | 3 + 2 files changed, 140 insertions(+), 157 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index f926060..349e822 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -262,37 +262,13 @@ struct action_rss_data { uint16_t queue[ACTION_RSS_QUEUE_NUM]; }; -/** Maximum number of items in struct rte_flow_action_vxlan_encap. */ -#define ACTION_VXLAN_ENCAP_ITEMS_NUM 6 - -/** Storage for struct rte_flow_action_vxlan_encap including external data. */ -struct action_vxlan_encap_data { - struct rte_flow_action_vxlan_encap conf; - struct rte_flow_item items[ACTION_VXLAN_ENCAP_ITEMS_NUM]; - struct rte_flow_item_eth item_eth; - struct rte_flow_item_vlan item_vlan; - union { - struct rte_flow_item_ipv4 item_ipv4; - struct rte_flow_item_ipv6 item_ipv6; - }; - struct rte_flow_item_udp item_udp; - struct rte_flow_item_vxlan item_vxlan; -}; +/** Maximum buffer size for the encap data. */ +#define ACTION_TUNNEL_ENCAP_MAX_BUFFER_SIZE 64 -/** Maximum number of items in struct rte_flow_action_nvgre_encap. */ -#define ACTION_NVGRE_ENCAP_ITEMS_NUM 5 - -/** Storage for struct rte_flow_action_nvgre_encap including external data. */ -struct action_nvgre_encap_data { - struct rte_flow_action_nvgre_encap conf; - struct rte_flow_item items[ACTION_NVGRE_ENCAP_ITEMS_NUM]; - struct rte_flow_item_eth item_eth; - struct rte_flow_item_vlan item_vlan; - union { - struct rte_flow_item_ipv4 item_ipv4; - struct rte_flow_item_ipv6 item_ipv6; - }; - struct rte_flow_item_nvgre item_nvgre; +/** Storage for struct rte_flow_action_tunnel_encap including external data. */ +struct action_tunnel_encap_data { + struct rte_flow_action_tunnel_encap conf; + uint8_t buf[ACTION_TUNNEL_ENCAP_MAX_BUFFER_SIZE]; }; /** Maximum number of subsequent tokens and arguments on the stack. */ @@ -2438,8 +2414,8 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, .name = "vxlan_encap", .help = "VXLAN encapsulation, uses configuration set by \"set" " vxlan\"", - .priv = PRIV_ACTION(VXLAN_ENCAP, - sizeof(struct action_vxlan_encap_data)), + .priv = PRIV_ACTION(TUNNEL_ENCAP, + sizeof(struct action_tunnel_encap_data)), .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), .call = parse_vc_action_vxlan_encap, }, @@ -2448,7 +2424,7 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, .help = "Performs a decapsulation action by stripping all" " headers of the VXLAN tunnel network overlay from the" " matched flow.", - .priv = PRIV_ACTION(VXLAN_DECAP, 0), + .priv = PRIV_ACTION(TUNNEL_DECAP, 0), .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), .call = parse_vc, }, @@ -2456,8 +2432,8 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, .name = "nvgre_encap", .help = "NVGRE encapsulation, uses configuration set by \"set" " nvgre\"", - .priv = PRIV_ACTION(NVGRE_ENCAP, - sizeof(struct action_nvgre_encap_data)), + .priv = PRIV_ACTION(TUNNEL_ENCAP, + sizeof(struct action_tunnel_encap_data)), .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), .call = parse_vc_action_nvgre_encap, }, @@ -2466,7 +2442,7 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, .help = "Performs a decapsulation action by stripping all" " headers of the NVGRE tunnel network overlay from the" " matched flow.", - .priv = PRIV_ACTION(NVGRE_DECAP, 0), + .priv = PRIV_ACTION(TUNNEL_DECAP, 0), .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), .call = parse_vc, }, @@ -3034,6 +3010,9 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, return len; } +/** IP next protocol UDP. */ +#define IP_PROTO_UDP 0x11 + /** Parse VXLAN encap action. */ static int parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token, @@ -3042,7 +3021,32 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, { struct buffer *out = buf; struct rte_flow_action *action; - struct action_vxlan_encap_data *action_vxlan_encap_data; + struct action_tunnel_encap_data *action_vxlan_encap_data; + struct rte_flow_item_eth eth = { .type = 0, }; + struct rte_flow_item_vlan vlan = { + .tci = vxlan_encap_conf.vlan_tci, + .inner_type = 0, + }; + struct rte_flow_item_ipv4 ipv4 = { + .hdr = { + .src_addr = vxlan_encap_conf.ipv4_src, + .dst_addr = vxlan_encap_conf.ipv4_dst, + .next_proto_id = IP_PROTO_UDP, + }, + }; + struct rte_flow_item_ipv6 ipv6 = { + .hdr = { + .proto = IP_PROTO_UDP, + }, + }; + struct rte_flow_item_udp udp = { + .hdr = { + .src_port = vxlan_encap_conf.udp_src, + .dst_port = vxlan_encap_conf.udp_dst, + }, + }; + struct rte_flow_item_vxlan vxlan = { .flags = 0, }; + uint8_t *header; int ret; ret = parse_vc(ctx, token, str, len, buf, size); @@ -3057,83 +3061,58 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, /* Point to selected object. */ ctx->object = out->args.vc.data; ctx->objmask = NULL; - /* Set up default configuration. */ + /* Copy the headers to the buffer. */ action_vxlan_encap_data = ctx->object; - *action_vxlan_encap_data = (struct action_vxlan_encap_data){ - .conf = (struct rte_flow_action_vxlan_encap){ - .definition = action_vxlan_encap_data->items, - }, - .items = { - { - .type = RTE_FLOW_ITEM_TYPE_ETH, - .spec = &action_vxlan_encap_data->item_eth, - .mask = &rte_flow_item_eth_mask, - }, - { - .type = RTE_FLOW_ITEM_TYPE_VLAN, - .spec = &action_vxlan_encap_data->item_vlan, - .mask = &rte_flow_item_vlan_mask, - }, - { - .type = RTE_FLOW_ITEM_TYPE_IPV4, - .spec = &action_vxlan_encap_data->item_ipv4, - .mask = &rte_flow_item_ipv4_mask, - }, - { - .type = RTE_FLOW_ITEM_TYPE_UDP, - .spec = &action_vxlan_encap_data->item_udp, - .mask = &rte_flow_item_udp_mask, - }, - { - .type = RTE_FLOW_ITEM_TYPE_VXLAN, - .spec = &action_vxlan_encap_data->item_vxlan, - .mask = &rte_flow_item_vxlan_mask, - }, - { - .type = RTE_FLOW_ITEM_TYPE_END, - }, - }, - .item_eth.type = 0, - .item_vlan = { - .tci = vxlan_encap_conf.vlan_tci, - .inner_type = 0, - }, - .item_ipv4.hdr = { - .src_addr = vxlan_encap_conf.ipv4_src, - .dst_addr = vxlan_encap_conf.ipv4_dst, + *action_vxlan_encap_data = (struct action_tunnel_encap_data) { + .conf = (struct rte_flow_action_tunnel_encap){ + .buf = action_vxlan_encap_data->buf, }, - .item_udp.hdr = { - .src_port = vxlan_encap_conf.udp_src, - .dst_port = vxlan_encap_conf.udp_dst, - }, - .item_vxlan.flags = 0, + .buf = {}, }; - memcpy(action_vxlan_encap_data->item_eth.dst.addr_bytes, + header = action_vxlan_encap_data->buf; + if (vxlan_encap_conf.select_vlan) + eth.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + else if (vxlan_encap_conf.select_ipv4) + eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + else + eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + memcpy(eth.dst.addr_bytes, vxlan_encap_conf.eth_dst, ETHER_ADDR_LEN); - memcpy(action_vxlan_encap_data->item_eth.src.addr_bytes, + memcpy(eth.src.addr_bytes, vxlan_encap_conf.eth_src, ETHER_ADDR_LEN); - if (!vxlan_encap_conf.select_ipv4) { - memcpy(&action_vxlan_encap_data->item_ipv6.hdr.src_addr, + memcpy(header, ð, sizeof(eth)); + header += sizeof(eth); + if (vxlan_encap_conf.select_vlan) { + if (vxlan_encap_conf.select_ipv4) + vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + else + vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + memcpy(header, &vlan, sizeof(vlan)); + header += sizeof(vlan); + } + if (vxlan_encap_conf.select_ipv4) { + memcpy(header, &ipv4, sizeof(ipv4)); + header += sizeof(ipv4); + } else { + memcpy(&ipv6.hdr.src_addr, &vxlan_encap_conf.ipv6_src, sizeof(vxlan_encap_conf.ipv6_src)); - memcpy(&action_vxlan_encap_data->item_ipv6.hdr.dst_addr, + memcpy(&ipv6.hdr.dst_addr, &vxlan_encap_conf.ipv6_dst, sizeof(vxlan_encap_conf.ipv6_dst)); - action_vxlan_encap_data->items[2] = (struct rte_flow_item){ - .type = RTE_FLOW_ITEM_TYPE_IPV6, - .spec = &action_vxlan_encap_data->item_ipv6, - .mask = &rte_flow_item_ipv6_mask, - }; + memcpy(header, &ipv6, sizeof(ipv6)); + header += sizeof(ipv6); } - if (!vxlan_encap_conf.select_vlan) - action_vxlan_encap_data->items[1].type = - RTE_FLOW_ITEM_TYPE_VOID; - memcpy(action_vxlan_encap_data->item_vxlan.vni, vxlan_encap_conf.vni, - RTE_DIM(vxlan_encap_conf.vni)); + memcpy(header, &udp, sizeof(udp)); + header += sizeof(udp); + memcpy(vxlan.vni, vxlan_encap_conf.vni, RTE_DIM(vxlan_encap_conf.vni)); + memcpy(header, &vxlan, sizeof(vxlan)); + header += sizeof(vxlan); + action_vxlan_encap_data->conf.size = header - + action_vxlan_encap_data->buf; action->conf = &action_vxlan_encap_data->conf; return ret; } - /** Parse NVGRE encap action. */ static int parse_vc_action_nvgre_encap(struct context *ctx, const struct token *token, @@ -3142,7 +3121,26 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, { struct buffer *out = buf; struct rte_flow_action *action; - struct action_nvgre_encap_data *action_nvgre_encap_data; + struct action_tunnel_encap_data *action_nvgre_encap_data; + struct rte_flow_item_eth eth = { .type = 0, }; + struct rte_flow_item_vlan vlan = { + .tci = nvgre_encap_conf.vlan_tci, + .inner_type = 0, + }; + struct rte_flow_item_ipv4 ipv4 = { + .hdr = { + .src_addr = nvgre_encap_conf.ipv4_src, + .dst_addr = nvgre_encap_conf.ipv4_dst, + .next_proto_id = IP_PROTO_UDP, + }, + }; + struct rte_flow_item_ipv6 ipv6 = { + .hdr = { + .proto = IP_PROTO_UDP, + }, + }; + struct rte_flow_item_nvgre nvgre = { .flow_id = 0, }; + uint8_t *header; int ret; ret = parse_vc(ctx, token, str, len, buf, size); @@ -3157,74 +3155,56 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, /* Point to selected object. */ ctx->object = out->args.vc.data; ctx->objmask = NULL; - /* Set up default configuration. */ + /* Copy the headers to the buffer. */ action_nvgre_encap_data = ctx->object; - *action_nvgre_encap_data = (struct action_nvgre_encap_data){ - .conf = (struct rte_flow_action_nvgre_encap){ - .definition = action_nvgre_encap_data->items, - }, - .items = { - { - .type = RTE_FLOW_ITEM_TYPE_ETH, - .spec = &action_nvgre_encap_data->item_eth, - .mask = &rte_flow_item_eth_mask, - }, - { - .type = RTE_FLOW_ITEM_TYPE_VLAN, - .spec = &action_nvgre_encap_data->item_vlan, - .mask = &rte_flow_item_vlan_mask, - }, - { - .type = RTE_FLOW_ITEM_TYPE_IPV4, - .spec = &action_nvgre_encap_data->item_ipv4, - .mask = &rte_flow_item_ipv4_mask, - }, - { - .type = RTE_FLOW_ITEM_TYPE_NVGRE, - .spec = &action_nvgre_encap_data->item_nvgre, - .mask = &rte_flow_item_nvgre_mask, - }, - { - .type = RTE_FLOW_ITEM_TYPE_END, - }, - }, - .item_eth.type = 0, - .item_vlan = { - .tci = nvgre_encap_conf.vlan_tci, - .inner_type = 0, - }, - .item_ipv4.hdr = { - .src_addr = nvgre_encap_conf.ipv4_src, - .dst_addr = nvgre_encap_conf.ipv4_dst, + *action_nvgre_encap_data = (struct action_tunnel_encap_data) { + .conf = (struct rte_flow_action_tunnel_encap){ + .buf = action_nvgre_encap_data->buf, }, - .item_nvgre.flow_id = 0, + .buf = {}, }; - memcpy(action_nvgre_encap_data->item_eth.dst.addr_bytes, + header = action_nvgre_encap_data->buf; + if (nvgre_encap_conf.select_vlan) + eth.type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); + else if (nvgre_encap_conf.select_ipv4) + eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + else + eth.type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + memcpy(eth.dst.addr_bytes, nvgre_encap_conf.eth_dst, ETHER_ADDR_LEN); - memcpy(action_nvgre_encap_data->item_eth.src.addr_bytes, + memcpy(eth.src.addr_bytes, nvgre_encap_conf.eth_src, ETHER_ADDR_LEN); - if (!nvgre_encap_conf.select_ipv4) { - memcpy(&action_nvgre_encap_data->item_ipv6.hdr.src_addr, + memcpy(header, ð, sizeof(eth)); + header += sizeof(eth); + if (nvgre_encap_conf.select_vlan) { + if (nvgre_encap_conf.select_ipv4) + vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); + else + vlan.inner_type = rte_cpu_to_be_16(ETHER_TYPE_IPv6); + memcpy(header, &vlan, sizeof(vlan)); + header += sizeof(vlan); + } + if (nvgre_encap_conf.select_ipv4) { + memcpy(header, &ipv4, sizeof(ipv4)); + header += sizeof(ipv4); + } else { + memcpy(&ipv6.hdr.src_addr, &nvgre_encap_conf.ipv6_src, sizeof(nvgre_encap_conf.ipv6_src)); - memcpy(&action_nvgre_encap_data->item_ipv6.hdr.dst_addr, + memcpy(&ipv6.hdr.dst_addr, &nvgre_encap_conf.ipv6_dst, sizeof(nvgre_encap_conf.ipv6_dst)); - action_nvgre_encap_data->items[2] = (struct rte_flow_item){ - .type = RTE_FLOW_ITEM_TYPE_IPV6, - .spec = &action_nvgre_encap_data->item_ipv6, - .mask = &rte_flow_item_ipv6_mask, - }; + memcpy(header, &ipv6, sizeof(ipv6)); + header += sizeof(ipv6); } - if (!nvgre_encap_conf.select_vlan) - action_nvgre_encap_data->items[1].type = - RTE_FLOW_ITEM_TYPE_VOID; - memcpy(action_nvgre_encap_data->item_nvgre.tni, nvgre_encap_conf.tni, - RTE_DIM(nvgre_encap_conf.tni)); + memcpy(nvgre.tni, nvgre_encap_conf.tni, RTE_DIM(nvgre_encap_conf.tni)); + memcpy(header, &nvgre, sizeof(nvgre)); + header += sizeof(nvgre); + action_nvgre_encap_data->conf.size = header - + action_nvgre_encap_data->buf; action->conf = &action_nvgre_encap_data->conf; return ret; } - /** Parse tokens for destroy command. */ static int parse_destroy(struct context *ctx, const struct token *token, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 14ccd68..99a82de 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1153,6 +1153,9 @@ enum item_spec_type { sizeof(struct rte_flow_action_of_pop_mpls)), MK_FLOW_ACTION(OF_PUSH_MPLS, sizeof(struct rte_flow_action_of_push_mpls)), + MK_FLOW_ACTION(TUNNEL_ENCAP, + sizeof(struct rte_flow_action_tunnel_encap)), + MK_FLOW_ACTION(TUNNEL_DECAP, 0), }; /** Compute storage space needed by action configuration and copy it. */ From patchwork Wed Sep 26 21:00:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ori Kam X-Patchwork-Id: 45458 X-Patchwork-Delegate: ferruh.yigit@amd.com 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 D41B71B48F; Wed, 26 Sep 2018 23:01:46 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0081.outbound.protection.outlook.com [104.47.0.81]) by dpdk.org (Postfix) with ESMTP id 6199C1B48D for ; Wed, 26 Sep 2018 23:01:45 +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=D5gtyCvVga0ueC7mcW87PcdDhWzboHuud7+E64mh/wo=; b=H8/05JdF+o+0xE6t7n5ycUB4aRoOfoI8d7V/bLuwOA/SsDVeWhzPd6EtrrYbOpDbUlnkiXIObZcK94sJ5Xf8TlbUse7wRVqDIKZCYuJ1IxEZdCuCCb5TYFL/Ewcxjg4obpmXG7LNCZA5FZc4S30adfIkHp2ysuBcf8ysoQ+1I24= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; Received: from mellanox.com (37.142.13.130) by DB6PR05MB3432.eurprd05.prod.outlook.com (2603:10a6:6:1e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.25; Wed, 26 Sep 2018 21:01:41 +0000 From: Ori Kam To: arybchenko@solarflare.com, ferruh.yigit@intel.com, stephen@networkplumber.org, adrien.mazarguil@6wind.com Cc: dev@dpdk.org, dekelp@mellanox.com, thomas@monjalon.net, nelio.laranjeiro@6wind.com, yskoh@mellanox.com, orika@mellanox.com, shahafs@mellanox.com Date: Wed, 26 Sep 2018 21:00:46 +0000 Message-Id: <1537995646-95260-4-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1537995646-95260-1-git-send-email-orika@mellanox.com> References: <1537116824-191205-1-git-send-email-orika@mellanox.com> <1537995646-95260-1-git-send-email-orika@mellanox.com> MIME-Version: 1.0 X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: AM0PR02CA0018.eurprd02.prod.outlook.com (2603:10a6:208:3e::31) To DB6PR05MB3432.eurprd05.prod.outlook.com (2603:10a6:6:1e::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f4d262c-e02e-487d-064c-08d623f34334 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR05MB3432; X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3432; 3:J5Ir/9e4aDvABiON6zvtbvn+O/3SXhBn1eAwITUm8Q4GPmfUQivihjxrX6sz0WmgHrtzczR7KuUpHyHFT6BJ2u4K21rrkd2kIIEy/Hlr6bGBvMDs/EvBx5EC3ANp323cXyOWH1eezJ7rMrWGDc4f3I0KPFfcTgFfpSPy04q3Xl240Gayz9ukm3YX6wrrWOOgYarUyyhxy/NmVj++ZJcIukzbBvtA+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McbzwI0F0lxJ2KPAtNlCvTF9XztOQclNyvjdD3r6Dmxtf4iNpAkkf1lZiNRc0jfbnfGYjlf1UrrGEtByQhJ90mWC0NDzbIHbqIaWLLAuMJsBTn1wj4GObGuvTErKjSm+KL8NlNbhyic/25AtXafznZPYih2aOH19MoGcbSZXrTTE; 4:IJQAc9uq+jvxsUZYln2y68OR1rquU24UOQ9tSaTfS2zRwxAqetyTgKHvDFoReOQXk2w55ZpXpC/ndDJ4Huiq+SqrDbhQFMAPjJsDXENyqlTomQo2aihP5MieNNJxnjdJzca9mKapfv3lhtKFbzq6/SpLK/Jfi6tmYHlBvfFGqrf4O5vrtvDWv2wBuYTVJRjyHwRaiteKTz3J4CaIc721xb3y6XiOJI8UJ0AnUQCJHXNCN9Sc8g2IgE0yugSbtAw2HRvGlVnKhYKpDVTRw3rfuA== 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)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201708071742011)(7699051); SRVR:DB6PR05MB3432; BCL:0; PCL:0; RULEID:; SRVR:DB6PR05MB3432; X-Forefront-PRVS: 08076ABC99 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(39860400002)(136003)(346002)(366004)(199004)(189003)(305945005)(50226002)(478600001)(2906002)(16586007)(48376002)(386003)(4720700003)(55016002)(8936002)(486006)(7696005)(51416003)(53936002)(81156014)(5660300001)(7736002)(8676002)(81166006)(50466002)(52116002)(76176011)(69596002)(8886007)(97736004)(186003)(16526019)(446003)(105586002)(36756003)(14444005)(34290500001)(107886003)(316002)(25786009)(106356001)(68736007)(66066001)(6116002)(11346002)(956004)(3846002)(86362001)(33026002)(47776003)(26005)(4326008)(476003)(2616005)(21086003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR05MB3432; H:mellanox.com; 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; DB6PR05MB3432; 23:ENxvB6gH0b5lv1LpdME8EcWCj39rIIRMaooXnirX6?= kHBnVpFSHKEJovz52wB5XqvhO7H/7Vb+EnDD2/7HTlSguo6qW/A+EZV3keqPJqTiPNHHCjtUeb3v1jwNHHbj5SFIMTx3XG/ofgktVkG9qlf0SjcnKvoq2sA/o9iEYm/fAyUHQn84jX6ujF6lad2INYWefPZIGBjVdXx8t9l6mYthOVVBD4eBbvdfGvXQ7TTTrTmLCJC5pa30kFCp2gU/yfy0OP4SLz8aONuj0CmjfIYZbDimg5Cd7oLFwLXRcBTLgfhcDraC9OJewzB2Ecbvid2sEwfpF4u9vHC66zmCm6Pt+OpCzheab7FLv2bF4p25oXvAMz7X7HI2iqVe23XxHfCngtIq1zzTXSF+aFzMPa7qUPnWCGjj+2XC77OWgmmgDAJOQFRFAPkQicWrIbq0EWCRgivuhIpgolS6/z7YZES0TW7p+8jrEGBhC1gleMgmohTsa3n+E7vNKifdbQBTYbYamv2rcf11DtAGMBC9hGTQIW/jplzeWvLale5d4zJhMrUADOrwwJuDoLwiitkzUH1Z2es0MCcr3q5NTd0en50Cc3eEBqv6MX4Fz2v6EA2VNB4lp4FQkkKyqCxAOB/kFkEMjo43rhVoXX/IU14mgg1vWIWs+bTQ+sMWv10opy/xswbga1r+wcJtAsRZnohW7Li9QJ+HPqMxJlSRELThV+Jq74tM9eNmjhuky5BbTP0/8WZ6ZOfWVd6mCrlJaXQIKfCI1pg6gajI0jAFT7E8obxeWrHZnOax7MR8zKbyvWoolbKERMrm2XjxVZa8I1hHvOERuEkvcSuZmV09OQq0exU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tLSJ0PZGFCiNWMzh9ATiGq1j8FGKQT/TXFk6OnFWe+1xrKlNfzP1z4FpQQ42FlSTHYu8e0JvLW3AeNz4oaxFB53WB4NmI3PKKkjo/UfM2HvO2cH5ZTaPYD9lC0Mh7bCe9tqT9kOWuEvTHtpJrFq84U2zJDGrzim5egqCWTzq9B9IH6GHuySCGymkbOIPgYuNJyi7yB3aUJ3hvq4omj3aYgRs99qcQuH1dyOe6j7y1dNrbGTp9frUyghhP+qVTwHGQ3GW8TQ==; 5:8y+pk5+IOcy1XCcJ9XdHWPE6mXYFlUoBf2l0c9mVqjZBt7RaS2F3C2dIuk+yBFLpHp5uluQH+nVGDksFvqhZO2qQq9qJWMCyzKc+FtvXsTGWjXVyOIwAvDiXUpi0NIbqGIfVOIRFGDa1boaPPdRObIwxQkgcHsjgVocwK9QFQJ8=; 7:PKSJcQQgov/xiO+BcRU2mTNorgS1AfTFi+KUw6Ano2Cp+I9aIrvUMw88yjX09vLgxK3zlk6B/8QJPoDdI4sXbI7r7hpzD7LvWfHbE2hnwkF00hcOCIPWVT1T/DbOxIZNKloNgDac3/nhEaxYGLkIs7K07SeSh2d/40alkttJaekxHu8FEiaryunAbvQ2YGAKPncYVIZg5LNTex7j4ou0hkInTEoyYXOb5tpRzadR8dFlGgkBZTO57oYFSFBd+tuj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2018 21:01:41.5390 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f4d262c-e02e-487d-064c-08d623f34334 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR05MB3432 Subject: [dpdk-dev] [PATCH v2 3/3] ethdev: remove vxlan and nvgre encapsulation commands 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" This patch removes the VXLAN and NVGRE encapsulation commands. Those commands are subset of the TUNNEL_ENCAP command so there is no need to keep both versions. Signed-off-by: Ori Kam Acked-by: Mohammad Abdul Awal --- doc/guides/prog_guide/rte_flow.rst | 107 ------------------------------------- lib/librte_ethdev/rte_flow.h | 103 ----------------------------------- 2 files changed, 210 deletions(-) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 3ba8018..9e739f3 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1969,113 +1969,6 @@ Implements ``OFPAT_PUSH_MPLS`` ("push a new MPLS tag") as defined by the | ``ethertype`` | EtherType | +---------------+-----------+ -Action: ``VXLAN_ENCAP`` -^^^^^^^^^^^^^^^^^^^^^^^ - -Performs a VXLAN encapsulation action by encapsulating the matched flow in the -VXLAN tunnel as defined in the``rte_flow_action_vxlan_encap`` flow items -definition. - -This action modifies the payload of matched flows. The flow definition specified -in the ``rte_flow_action_tunnel_encap`` action structure must define a valid -VLXAN network overlay which conforms with RFC 7348 (Virtual eXtensible Local -Area Network (VXLAN): A Framework for Overlaying Virtualized Layer 2 Networks -over Layer 3 Networks). The pattern must be terminated with the -RTE_FLOW_ITEM_TYPE_END item type. - -.. _table_rte_flow_action_vxlan_encap: - -.. table:: VXLAN_ENCAP - - +----------------+-------------------------------------+ - | Field | Value | - +================+=====================================+ - | ``definition`` | Tunnel end-point overlay definition | - +----------------+-------------------------------------+ - -.. _table_rte_flow_action_vxlan_encap_example: - -.. table:: IPv4 VxLAN flow pattern example. - - +-------+----------+ - | Index | Item | - +=======+==========+ - | 0 | Ethernet | - +-------+----------+ - | 1 | IPv4 | - +-------+----------+ - | 2 | UDP | - +-------+----------+ - | 3 | VXLAN | - +-------+----------+ - | 4 | END | - +-------+----------+ - -Action: ``VXLAN_DECAP`` -^^^^^^^^^^^^^^^^^^^^^^^ - -Performs a decapsulation action by stripping all headers of the VXLAN tunnel -network overlay from the matched flow. - -The flow items pattern defined for the flow rule with which a ``VXLAN_DECAP`` -action is specified, must define a valid VXLAN tunnel as per RFC7348. If the -flow pattern does not specify a valid VXLAN tunnel then a -RTE_FLOW_ERROR_TYPE_ACTION error should be returned. - -This action modifies the payload of matched flows. - -Action: ``NVGRE_ENCAP`` -^^^^^^^^^^^^^^^^^^^^^^^ - -Performs a NVGRE encapsulation action by encapsulating the matched flow in the -NVGRE tunnel as defined in the``rte_flow_action_tunnel_encap`` flow item -definition. - -This action modifies the payload of matched flows. The flow definition specified -in the ``rte_flow_action_tunnel_encap`` action structure must defined a valid -NVGRE network overlay which conforms with RFC 7637 (NVGRE: Network -Virtualization Using Generic Routing Encapsulation). The pattern must be -terminated with the RTE_FLOW_ITEM_TYPE_END item type. - -.. _table_rte_flow_action_nvgre_encap: - -.. table:: NVGRE_ENCAP - - +----------------+-------------------------------------+ - | Field | Value | - +================+=====================================+ - | ``definition`` | NVGRE end-point overlay definition | - +----------------+-------------------------------------+ - -.. _table_rte_flow_action_nvgre_encap_example: - -.. table:: IPv4 NVGRE flow pattern example. - - +-------+----------+ - | Index | Item | - +=======+==========+ - | 0 | Ethernet | - +-------+----------+ - | 1 | IPv4 | - +-------+----------+ - | 2 | NVGRE | - +-------+----------+ - | 3 | END | - +-------+----------+ - -Action: ``NVGRE_DECAP`` -^^^^^^^^^^^^^^^^^^^^^^^ - -Performs a decapsulation action by stripping all headers of the NVGRE tunnel -network overlay from the matched flow. - -The flow items pattern defined for the flow rule with which a ``NVGRE_DECAP`` -action is specified, must define a valid NVGRE tunnel as per RFC7637. If the -flow pattern does not specify a valid NVGRE tunnel then a -RTE_FLOW_ERROR_TYPE_ACTION error should be returned. - -This action modifies the payload of matched flows. - Action: ``TUNNEL_ENCAP`` ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index e29c561..55521e3 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -1473,40 +1473,6 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS, /** - * Encapsulate flow in VXLAN tunnel as defined in - * rte_flow_action_vxlan_encap action structure. - * - * See struct rte_flow_action_vxlan_encap. - */ - RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP, - - /** - * Decapsulate outer most VXLAN tunnel from matched flow. - * - * If flow pattern does not define a valid VXLAN tunnel (as specified by - * RFC7348) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION - * error. - */ - RTE_FLOW_ACTION_TYPE_VXLAN_DECAP, - - /** - * Encapsulate flow in NVGRE tunnel defined in the - * rte_flow_action_nvgre_encap action structure. - * - * See struct rte_flow_action_nvgre_encap. - */ - RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP, - - /** - * Decapsulate outer most NVGRE tunnel from matched flow. - * - * If flow pattern does not define a valid NVGRE tunnel (as specified by - * RFC7637) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION - * error. - */ - RTE_FLOW_ACTION_TYPE_NVGRE_DECAP, - - /** * Encapsulate the packet with tunnel header as defined in * rte_flow_action_tunnel_encap action structure. * @@ -1837,75 +1803,6 @@ struct rte_flow_action_of_push_mpls { * @warning * @b EXPERIMENTAL: this structure may change without prior notice * - * RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP - * - * VXLAN tunnel end-point encapsulation data definition - * - * The tunnel definition is provided through the flow item pattern, the - * provided pattern must conform to RFC7348 for the tunnel specified. 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. - * - * Valid flow definition for RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP include: - * - * - ETH / IPV4 / UDP / VXLAN / END - * - ETH / IPV6 / UDP / VXLAN / END - * - ETH / VLAN / IPV4 / UDP / VXLAN / END - * - */ -struct rte_flow_action_vxlan_encap { - /** - * Encapsulating vxlan tunnel definition - * (terminated by the END pattern item). - */ - struct rte_flow_item *definition; -}; - -/** - * @warning - * @b EXPERIMENTAL: this structure may change without prior notice - * - * RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP - * - * NVGRE tunnel end-point encapsulation data definition - * - * The tunnel definition is provided through the flow item pattern the - * provided pattern must conform with RFC7637. 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. - * - * Valid flow definition for RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP include: - * - * - ETH / IPV4 / NVGRE / END - * - ETH / VLAN / IPV6 / NVGRE / END - * - */ -struct rte_flow_action_nvgre_encap { - /** - * Encapsulating vxlan tunnel definition - * (terminated by the END pattern item). - */ - struct rte_flow_item *definition; -}; - -/** - * @warning - * @b EXPERIMENTAL: this structure may change without prior notice - * * RTE_FLOW_ACTION_TYPE_TUNNEL_ENCAP * * Tunnel end-point encapsulation data definition