From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00056.outbound.protection.outlook.com [40.107.0.56]) by dpdk.org (Postfix) with ESMTP id 279895A44 for ; Sun, 16 Sep 2018 18:56:28 +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=wnRYNtNZbYuWSG4wxILPJuH7aYzlvpfTEO7JOeZBOyE=; b=N5+qL6BG9FSj8in/8o15VnXSRn8z3pDTJPgmMOiN/FYbHWYjzgo8J2p4sK/1E6Fx9IA5WcjWc3G4smD9INo0VJiAUubWGYFycu8Ig33mu8NzmskyXMZ4FvdacszJYUqkvbyo5mSLo533YG3RalKbaBnIrfBSOdYbjfq7B2XcZ24= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR05MB3434.eurprd05.prod.outlook.com (2603:10a6:7:33::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Sun, 16 Sep 2018 16:56:24 +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 Date: Sun, 16 Sep 2018 16:53:42 +0000 Message-Id: <1537116824-191205-2-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1537116824-191205-1-git-send-email-orika@mellanox.com> References: <1537116824-191205-1-git-send-email-orika@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: DB6P193CA0021.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::31) To HE1PR05MB3434.eurprd05.prod.outlook.com (2603:10a6:7:33::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c2ff7e1-70a8-4c98-da1c-08d61bf556f2 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:HE1PR05MB3434; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3434; 3:iP2XCksQWnvddXSrjTBB8n7NHye8ceOch3M25vpidOWUgYseBrQeiTgt2w5Z8kXID3gE9ASafj40bb1tAyS59Hy+PBcKDADYp2UXwdAf+HWevtqnfsqRvcHcxOc1Nn4z0WXOQG3Lp2Ur9mudk/yPugcIAXGnTz7JppkCEQYVF8fYNoon3zEgzAEnf4sRgb7PelROYMWi3gejU0A7n3Ea5YdNU10D6A05wmfMybyaj6Ew6iUPV4+X2jOSjLS6orG2; 25:JaIiLgPpZli35GyFd4KTX1bpFuOEESUfuQNY35jqEPdVNzlJZP2JthzQ6QdUJhRr0VyvCFo3gOx15h144BnuZyaE5AS+I5jQsMvOxFC2MT6+scogmD0QcqbJXhg5tlA1Ml2YDIybvAtskfUPp1WeXeMBAxXTxsUhuVP5NCJ4uPNsRgDXug4sQssjf4terWQfK+RrfjQnmXK44DkLD8JRfWXBQywliUT9R67v5ACpPZceIaTU9u8I/dXb4zYZg2VyojpUl96eGQctFalH3Ng6CUCIC7jfHIzmpwM1uBC4avFbXgV33TEP1Yn/ESE6HbQlLxqoQ5EDC3KXxFyy8bEOQw==; 31:b4KkLSx8md6V7cvMG2s3QiiVaPrEmZ4NWu8HWVD97l+H18+T07QH1LvO5BE9YfibTNy0fccofBxSA6CWgeHoNXkuq8Bv4q9BWAAJxwWOHJ0lro9LOaFKTVkc/yxSFCxvrBIHXrWu1TyKrEQd4yNxbJ3/g6wVXydnsAQBnMb8jwgI0Is9QbS2/qv/Uid+M2pJhFiSwvrU5Uf0icit68+T6VwRt6CU+wcBCDRxrnuypzw= X-MS-TrafficTypeDiagnostic: HE1PR05MB3434: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3434; 20:muf/Ko/yB1svgWXcIDHSG8bVYgsJl5gXTqLo3g/EmSrsMdsrkYCHbJT2xSQ/4P/1my2zM5pLvnuILxHoa9+Zcv4sCG7+VcKXypENd2WLv509faPrVU4QJ4e4jm2MGnm06LYKA5zlijMJQnoPZQTKVmthI09JWGNGMopK8q9Z7rt7m/nUbMZYDktWXzccHf3z8tsS7NMpRyJ16I36lALUDTXTuuD+U6bcnLtAH3HndLjBSEd876ytYYGeez95W8XG4d1JKrgGGZUaSGzsrE5eCJW0cwYn4TcT2qpi7qdkcwT5U1wpg9dagHXvI3kA0G/FnN0BPocK4+Mecqg7Mj3p+txhjDz/gwb3yDjBBH9loCuFPBorgUvlG/Ddkev7aR62p4di2S6Ba0f/L2zfT2dJ98OPxc+l7ppdG865RMl6aPT4tf6VOwNw/tqL5QdlqVvQoh3irlq0V8S2UDxWxLhUqyj+UT2eSRhv8+3WsoW5Qu0cOeDeZm//GQplc+vbUdmw; 4:cDDse+UcACTWqxa4FdPOPFsmglT1YnEJQCzqWWL9nTKCPOTSzI76NCBFxyNOKc2ELIZXJj44mfub/tL9afQLrBHCifN1gbf9W+RAYG30Saj0mqjZEbsGdJ9KrhaVa+LO7c6miPU0ouaiK3n1dMPTOx1fgjvke607dZtE2N5H93DSUJVz/Byw3YtMl65aux5WNcoMKXzgoKoDQZfxAgA0xup/zuB0Xs75Sgi5roaZLIy8ms4FTwWcy0zbZIxTUDDRDfM0UrnJ2c+9AP9TrVU2aw== 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)(3231355)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201708071742011)(7699050); SRVR:HE1PR05MB3434; BCL:0; PCL:0; RULEID:; SRVR:HE1PR05MB3434; X-Forefront-PRVS: 079756C6B9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(346002)(366004)(396003)(39860400002)(376002)(189003)(199004)(16586007)(47776003)(81156014)(6666003)(50226002)(8936002)(25786009)(5660300001)(68736007)(81166006)(8676002)(4326008)(106356001)(105586002)(2906002)(4720700003)(69596002)(316002)(21086003)(305945005)(8886007)(7736002)(66066001)(33026002)(107886003)(956004)(3846002)(476003)(48376002)(51416003)(478600001)(97736004)(7696005)(52116002)(55016002)(53936002)(14444005)(26005)(36756003)(186003)(16526019)(386003)(50466002)(76176011)(2616005)(86362001)(6116002)(11346002)(446003)(486006)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB3434; H:mellanox.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR05MB3434; 23:S9uRAYIxNVjxXodR5stIAIS0qHan1YeYJnJTglRTE?= =?us-ascii?Q?UGfjntn5pd3wDKjf12n5dWNoVwfRuP+SP0Qp3/fLvT32ddDQAEM+PV5hNAve?= =?us-ascii?Q?dd3hmWyOfVv8hyTClNZQNj9N1ErXZOw9VeWMuFt16g3zdpSIb8Q1h4UAn2Ob?= =?us-ascii?Q?XnqdJGveu4mFVOiNATiS6zcYbIU+t3bIZzc/hr5H48UAOTNHZNCcoXzQjywG?= =?us-ascii?Q?XtqSp9LmcCQrQlPDaacR9NiZPZvFy39BCMNm634r8aFh77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3eezN7XUa1AOCC8LGR78zT5S+P55j826+1+iIoSRbg==; 5:NoP04LN8FgzHb/IUryfnrIb5mqSTk4nWIXJcpCrxCs0eOwu28nGv946b3pRkRWldpH0AZKh74LoSuQTRlxSKypnbpm5gcmuKp4DGuSM2QW5Ol5WPobsNMxybIU5+WrQDqiNtKDV5QfSegQ4uOaOOe/qJzj8DbX6HNOK2V/mkXzA=; 7:zm+huPeVc8IKLbb4khaYOIb80TOoyCkSjpfB7UKUQ5iOQcYscbmfZIUofwz0AMS798QiREsdzLuzvIfIGxZ81X6nURIOzavooODg1FDJ/MzgiwMWwY3N/o2ajTkE+4Za/c2taSIh1BgqH0d3zd3O425fzHMthcm+E907iITdVy72XBtZiRhyKcOoNBgipXrS7OpLXmfxHdD+rTW6Ulkryns1a7kRLrvPFSVyi6ZXoV1QtPnyoMfLeglp22hX+GQW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2018 16:56:24.0760 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c2ff7e1-70a8-4c98-da1c-08d61bf556f2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB3434 Subject: [dpdk-dev] [PATCH 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: , X-List-Received-Date: Sun, 16 Sep 2018 16:56:28 -0000 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 | 70 ++++++++++++++++++++++++++++++++++++++ lib/librte_ethdev/rte_flow.h | 64 ++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index b305a72..0f29435 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2076,6 +2076,76 @@ 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. + Negative types ~~~~~~~~~~~~~~ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index f8ba71c..d1f7ebf 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 ret_flow_action_tunnel_decap_l3 + */ + RTE_FLOW_ACTION_TYPE_TUNNEL_DECAP_L3, }; /** @@ -1868,6 +1902,36 @@ 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. */ +}; + /* * Definition of a single action. * -- 1.8.3.1