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. *