From patchwork Sun Oct 7 12:57:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ori Kam X-Patchwork-Id: 46207 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 37ACE375B; Sun, 7 Oct 2018 14:58:51 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0056.outbound.protection.outlook.com [104.47.0.56]) by dpdk.org (Postfix) with ESMTP id 7FCB9239 for ; Sun, 7 Oct 2018 14:58:49 +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=0uWjNV1V3E8JOcgPeFNNlF8EZyEkkQqLhDQQQll94nM=; b=vk4UtVrwrCbyU7djSkIbuDlrL/88ozboDdePvs1cad7J4bWHGFedm2hdeE0zFVOGN6tz9OIa7XbqmNLua5DPwUNOAbnZ6jQc5nnKtI7+mdtSwpNWmKlhZFmxvB3oRyi1G9b05pTkPhcMKUyPtDZ6bJcB+NxX1s2BeapEyhQ3hbQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR05MB3436.eurprd05.prod.outlook.com (2603:10a6:7:33::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.18; Sun, 7 Oct 2018 12:58:45 +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: Sun, 7 Oct 2018 12:57:32 +0000 Message-Id: <1538917054-68283-2-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538917054-68283-1-git-send-email-orika@mellanox.com> References: <1537995646-95260-1-git-send-email-orika@mellanox.com> <1538917054-68283-1-git-send-email-orika@mellanox.com> MIME-Version: 1.0 X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: LO2P265CA0119.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:c::35) To HE1PR05MB3436.eurprd05.prod.outlook.com (2603:10a6:7:33::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0931d852-55a2-4311-dd38-08d62c549ee6 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:HE1PR05MB3436; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3436; 3:PXQrTydkzsBDE3FTUSetWgCce/W/TV++GeHRSKw8E2ijoNpqjmBPfQDU486owKQkDZima53Me7UwiwuVZMrjtIKGHJOLp3FaHEBdDYMnSBp1wShqlgzkMSUqsDaNqCGJuO82GRFypqDhBus3bzEHtF30R2BRSoTc+C9Caf9VNXGHZet4k/PT6BuZLEOQPQ7+7OUphd8oLpUBH50LQGAenn9nsTUT2pAaA4YdsLYO5NRvRFcbfOL3TVTW3/3/cV06; 25:MNqDwgXyZcUuMCiijvr2lxd2wz1C3SGovgTZsd3v+IhCWqK/nbUjyZVn7XPHmjXiTABUtzZb5rOgK4EEl4g/nhXSFXkAP/UrGZ8zzDi1awDjSco1e4zFn7mk1gT4Vd/c9UZsw1OV6jI22FQnGqeRVCeX/47oaMXg49D5W5XepfIBAvqCNPab0Avr1mQIPByM+8aVg1mlphAoy+rZ6hLUBM/Eofut8gvGFE16FbGYadoydLznc97m6U/VDQg/6VWeMabwLJjGiZGD4TV5rjAK16/4DEk9od562gg4dmpuJonO4rOtz0aE46IOac1btQVcgbOYXj6YscalUSzNqLjSRQ==; 31:JwFnUX1kplGwll7kvBDOqbgWfSsfu89H+2APUzYeYZ81ufK6RU11EJibYeJ/EIRC2bKAVHCqFicjj6zoi9hLUUx9KFXl+exHRUHpyqAY4/YnfHanZszaobFq9FrXkNaDEEeCEyyVGk8mWJNQiRnPJz7nBa3XmuoCR/BpopDokZGuY1KuFGRW8tigMgDykvIPKXzyhSRfDprDrGLDNn0nMR9iMHb+V/zsctCYeze63Xg= X-MS-TrafficTypeDiagnostic: HE1PR05MB3436: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3436; 20:OIYEuELtJKbN52GdLW5epV1zosuOeeQFqhZuN7bE4JvHAE5IJXlXdrFlqj7NBDyBNLvBG591ODga9Qm5g97Cjh2IJEw7tEAEyW/7vRMzjFxygtMgRTe4ko/3MwU5pKxmC1uNRb0BLqAUBC0X548Am1x1OBlVbpzb6WHnugwi7N/om6at9vF4fJUeGtZsVih31uO81dwdxHvKFBZYRM6bq9ZCXsFRUq2D48PxzbrgoPCMTn31GW6jsapKcaqM9fR+EukXYcrzDl8/S+n3IiWH/BRnw8yEFebCNft6cCdGFFt9plmIZvja13w6O7kpfVF6kaSKRT/QQpYAkTvGKr6B0vSsruUTXBpXsr+pbo5wXYofsL4cCx9s2ZgiLUrw3SWbzaOMoCW15gRF9Q6779uW9KDEpEN1u5XQwX3vrFjrUYNJNyTt5161my8Qf7j5XxEcqGkBoKbUWtHkZTLlJAg2qWdfwXFkdPqePwMCtlZvkYX6lxTO4caiUD98jlcEKvlo; 4:yn5sDzZRc8Pkj71cxUYaYerljyRM4QIKYMaNBzvrG6bu/8yYugepXHlKKZ5Nqa6HczzIVyUJT2f1hsWsw0Hg0pII+HkKTAB3Ww8rBNznRApkm0ByN4ucqXq109N5PApUsPdJZUC1xz9jSLjue/lrHw2A89QZb12GOGaFD6HA3ZNJ2QfTXN28IgOaL4u56mgsqtCd+vaIbwKhwwECupsC+V92RGVQH9GxGlZ/TdihTQx4l+/sSJYUvPGBYYnCWrDkqXKWxqrHxFglbLbsyZyAng== 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)(10201501046)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(201708071742011)(7699051)(76991055); SRVR:HE1PR05MB3436; BCL:0; PCL:0; RULEID:; SRVR:HE1PR05MB3436; X-Forefront-PRVS: 0818724663 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(136003)(346002)(366004)(39860400002)(199004)(189003)(105586002)(76176011)(2616005)(3846002)(51416003)(7696005)(106356001)(52116002)(6116002)(386003)(55016002)(486006)(476003)(11346002)(446003)(956004)(26005)(86362001)(305945005)(21086003)(53936002)(316002)(36756003)(69596002)(16586007)(14444005)(16526019)(186003)(8936002)(81156014)(50226002)(4326008)(478600001)(2906002)(66066001)(8676002)(4720700003)(81166006)(7736002)(6666003)(25786009)(8886007)(50466002)(68736007)(48376002)(107886003)(97736004)(47776003)(33026002)(5660300001)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB3436; 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; HE1PR05MB3436; 23:82GxKiioI7TI9VIGQINti86TiMCHalS9cokX+2ztm?= OsXJr+n3ZHnmW11aeqPzJNnLrw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geihIwqqCv0vjzMfBN16TIJJ9mweUtsrh/X1yC9jqfhaNh8Yo5n3pXxr5s9hvjT3STlTai3dm+Y8AilZD+Bj9owZyWRM4QI82CRPGqDZnxjpQ910PZhNdPlSSBOwiwf5RwxZtE1GdHLsGCiEloAUPv8kYApXqZLFXeY0WGSPvBI=; 7:Hl/DRoXnc/6loEHlJK6heMbNW0K3Bmztwt+LQqT5xa+6VnUOp0/VJRhSOWOww+K+55Zndt1Moswwf4Lu651u7X3yRCKrKeQvkwd47weeFxsosaddUS+/Nkh989BnL+7+lVrXCQSI7Pe5A6ILloEtNB5tVdj4Fo5fJMT3lTQhc1CenR75jkETo94RGF8hLaSzvMeb07FFPBisE8gBOz0bwmjIGJYJV9oRwF5BAkyyhnT8iZr2LaRm9BKIm+0ns/Q0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2018 12:58:45.9934 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0931d852-55a2-4311-dd38-08d62c549ee6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB3436 Subject: [dpdk-dev] [PATCH v3 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.c | 7 ++++ lib/librte_ethdev/rte_flow.h | 79 ++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 1b17f6e..497afc2 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.c b/lib/librte_ethdev/rte_flow.c index 9c56a97..4b548b8 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -123,6 +123,13 @@ struct rte_flow_desc_data { MK_FLOW_ACTION(VXLAN_DECAP, 0), MK_FLOW_ACTION(NVGRE_ENCAP, sizeof(struct rte_flow_action_vxlan_encap)), MK_FLOW_ACTION(NVGRE_DECAP, 0), + MK_FLOW_ACTION(TUNNEL_ENCAP, + sizeof(struct rte_flow_action_tunnel_encap)), + MK_FLOW_ACTION(TUNNEL_DECAP, 0), + MK_FLOW_ACTION(TUNNEL_ENCAP_L3, + sizeof(struct rte_flow_action_tunnel_encap_l3)), + MK_FLOW_ACTION(TUNNEL_DECAP_L3, + sizeof(struct rte_flow_action_tunnel_decap_l3)), }; static int diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index f062ffe..76b4759 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -1506,6 +1506,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, }; /** @@ -1869,6 +1903,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 Sun Oct 7 12:57:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ori Kam X-Patchwork-Id: 46208 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 1BB46493D; Sun, 7 Oct 2018 14:58:53 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0082.outbound.protection.outlook.com [104.47.0.82]) by dpdk.org (Postfix) with ESMTP id A29353798 for ; Sun, 7 Oct 2018 14:58:51 +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=joln3aaXsMEqVoAOrF8thAmh7KCoC4RkWTPnqdDvirE=; b=P3VMjt8dHIKhxn2D93Zo8lnfRcDReDwafURqzWVUG9mmu+Kr5jPt+SM1JyNrgV7I6x6BdRod3LjhrDOUME0Fe8t0hwp5pRxpx1Hz9kRAB08jGlUksXQAuV5P+9XwkEQt5q0CzGGhHj6nwOliWKaIInsw+c73NxPICEp4OWyctTU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR05MB3436.eurprd05.prod.outlook.com (2603:10a6:7:33::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.18; Sun, 7 Oct 2018 12:58:47 +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: Sun, 7 Oct 2018 12:57:33 +0000 Message-Id: <1538917054-68283-3-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538917054-68283-1-git-send-email-orika@mellanox.com> References: <1537995646-95260-1-git-send-email-orika@mellanox.com> <1538917054-68283-1-git-send-email-orika@mellanox.com> MIME-Version: 1.0 X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: LO2P265CA0119.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:c::35) To HE1PR05MB3436.eurprd05.prod.outlook.com (2603:10a6:7:33::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3be96a1f-b60c-4c7d-bbc2-08d62c54a009 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:HE1PR05MB3436; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3436; 3:hxEv7WE6AEKKzUMJD//JOqbtsEyoF46hleMuDRCWRlAjYQxmnjEsmkB0qaWg0wEDC4w0hOgp1CSsecRUMgWv3WoaPhiCo+MFj6hiFOkzT8DiY3AKCAbEqBlz8fYwVzLyXacbIuo2FX2Cw2s4M5RtIZrvkOpY371yDBMZiSsKGHtGYCsE3auuqcezPmeypcUTn6PhfBM6DyKfW+I2rbD7Asg9MCfZfYbT5bdKdB47Gd5LBQEh6eCdwiYQJNlrN73+; 25:cLx6T2svJTYFmcDi7XELg9R6mdDbBg2ssuAZfa9/tHD/f36FwwO/GsTKGMgePLz//y/J5Fq6Y2IIrZGVZmpmfUpbmxksKZAyQy1bvimDu96zVDmVvv1rTKmB1X5B3n0Fc76DKJWlhKhp0Bne0fYOR61ocvEIyDpSrQS/zsJPY2QoZXUm/1jXe+RUOaOsjy7LHU4mzAc0j9oAS1O/0Gw7ojfeEQRSSf8aCiOtR9fRZXPu35WcI0gWAJusy6UFR66WoRnK2ttbjI4vDpOji8A+TstyuWfmTdjBceSEXShNGlpHXYNrxvLwROgJQu/obYSAioHYSRMViKZLoNciIrHY6w==; 31:wDH4xJS3FwCkpVa0OxlDyY4hcY1fHtIESukCdDCycTzdyplF+3tYhTX3lasxDoAserjNAKiG3JhITVoelv8OpBsp8E50p+MQLATNbyVDTBfjEF28Ame4wgQJy9Hn3ZHOsHjEuKyrLJkh678lcuNkpcEHI/7B1iI4gNvzaDDPFCNjSJ9zdFWvwNdRDfvJBuTI8sg5PdKRZ+/VhbwqCVFZhX6s2MbsSMXq1/OX6fsQgtk= X-MS-TrafficTypeDiagnostic: HE1PR05MB3436: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3436; 20:k121CDj9rO/VsHM1MS+hoUbnDfWR592LsuTMaesQ1Kd+z9V+SH2PecNwPDdBXNtVKVWrPUy3HiprJ9qCrJs2LXV0VGvQs4nspg4+9hN7LUcAjcUGmeb4gqxnnNHaXIy2ud18mLny2MqL7v9OxeDhLno83sZydEuz6KCq2pofyN9XcldQaaflM4it1kRC01kk0KabpRCUqnOXWxPim6xt1qAYNZYacNsdp42YZ7kUk45VrHOhSK5z/mlkTgXkWAXFJR8pf3/hvze+0EBgJCkbThEKCeIGVhJYQo7/e2hglCjLlZBM3cDifloJ64fRp8mBmu7+gKOUTYWmeBWk8cSCJMu0kHvkY8ubQynUAoftlW03jz+Ur7ifoRqi8J4X94uSIRI2ZHoZ96t+0k+wE7ljrAUeRqQ++MXD9pzymbgGzcsIhGppgPoz1ZJ7r0XvnAfqScYEDRcyPKHKapJt3zEagZz9Z/TMSoVleYKQDDA23VFtdbZM0GjSRgI1M9iojmUw; 4:1iXEMnIpZBmJfOLoF+tv4KjFj0IoAhj/Cu/JnCy4Ji02zedOl5Q4NcQr9qJlLVhb2RaULAXzWsdiRowaaYWNA8rWT82ylM5zdv8xefeNuJSD76Nx96yEKddnb1+0KOyjXvbINTPTLKkpB4jn3qcUuJtYfvrNcJGQrkgWFvZFekajh9JYIox8/9ewQghXMcan2gwRboFDArrdKndZ4H7LD0yGuX0DqluSwEjG0K3qhVV3ZQPXhHIdMZSVprDVurF1JA0c/oTOcnY9wH4cDumzOA== 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)(10201501046)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(201708071742011)(7699051)(76991055); SRVR:HE1PR05MB3436; BCL:0; PCL:0; RULEID:; SRVR:HE1PR05MB3436; X-Forefront-PRVS: 0818724663 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(136003)(346002)(366004)(39860400002)(199004)(189003)(105586002)(76176011)(2616005)(3846002)(51416003)(7696005)(106356001)(52116002)(6116002)(386003)(55016002)(486006)(476003)(11346002)(446003)(956004)(26005)(86362001)(305945005)(21086003)(53936002)(316002)(36756003)(69596002)(16586007)(14444005)(16526019)(186003)(8936002)(81156014)(50226002)(4326008)(478600001)(2906002)(66066001)(8676002)(4720700003)(81166006)(7736002)(6666003)(25786009)(8886007)(50466002)(68736007)(48376002)(4744004)(107886003)(97736004)(47776003)(33026002)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB3436; 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; HE1PR05MB3436; 23:UZ2Nww6I7wzRB4XGd3iRh0wsAS7KQBzic/cwZLeX0?= 5v5bKgfQQ3u8FXPW7LyOeuX9w0jyJGTvWlbh2awHz8sfB+3NYvDSk2/XkUS7R7ZmPleGzEQFtkxR8N6YpV5ZzEEeluRnBZxlSaml2utC1zRBgIGiR/zNbjdvZEQXI29X8Sbx+9jKLTSbTkVVOuP6MePY9tsZ2vr8Yxhm+pvFMyh8SDkqub8hcaazE9++D39AbUfsg6FisIMdfsdKuLkVclcj/RqE3BYmWh3yMrSSDuWAYunxtbCjAQiCRqJuQX4SSLSbwYhQRZYZNJdbLncKI9ob+OFI7LaHjP2+ZC1EPADiLxanKluEs7kgkxqLiAy4hTGdaKsFFfjZuVZhLh1LzCHbLYxz3wJrYZfQNfEkyh18I0zm1thbyEwYEC/gFPXE7nB8PyVY/W2t1vshctAm2jJF/avE9aYbzzTBwaJVxSiDFw0RDqJZ45/rIXYbr3Uywd4CBb+uLljEXAhsDqogbKO2YIrh6qXxy1eMlrTyEWO3HSiB4qtkBH9XeBuYyFfLgzLat3uOeNhYK34h8PvdUeSc0MiFKu6ewaf4gTfQtxqGiO93rbgX7+hP2QiAAhCTbNCW2Xfvq2amrkBugwqa7g5BuKsdLjDXdE5GDT1GijKG06MPG6T4on20qT6cvvmVirzH+uB18HB2UVMljDmTEzGEOvgjm75WlZpQvUvSOIXID1AeG7saO0iqvlhEiUtFEenCKdoEvOweiMyeDBS3lTCnA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tTD5/h1/zMYg3vHTQeCwp9OSwspg8pU2ahgUi4dRWqiLO5HiglH2HU1NH19UuqUt1cqAQVK97y9v9vwtGISIm38QCw0+Zw2eU02j9dxoe/xbpP51ezdrEshW8K/qBfi6sDzlN+lfUy2lzWJizVM//musHFyotm6VdM6CY4o/vO10qjdS/LUsv4qGh6a6y/KkXmavbigvrkT1+pRkK/ydH61olHn+QeLLSMPIzspt7d4qVnaGsdHu0M93mBLW8GiG07JAHtnHvP/rbqRV+VOBemZepeUawxaSLnbsEiEKUFVP/CvdiAAQVmVE2qw3yOS5AnqvL3dVZvXzz5iWdFQ==; 5:GYN2DzozqMoaXgjG49Ir547wfACcNO99tjDXQ+Iobzn86EAQJeTpmmIkn7Q914YA6IHXXKfqutrKbUdZMVOnSVVhkTgPwa848sTyoYoRGt8oAJrRawgDfUdW0DUbOX54N6pevvzKKy4oknigLL6q8cSYzSYqJfO3JFH+Px51hag=; 7:jLp9PumgmOxeCds+Q2TXa13Wd5yjbMJPv5z0SPXEFQEicOCRv6VtwORddcQFjFaDYX6P/00wPizOReVVALa5Vc5xfM5y+FmQDfLa/ZqrvWg8DdbASiH4sUtAXg+1W/lNgQvas3Dxxw8gLxSFC2IYINeGQ7bg1l+22qYmrKOC7WkZA/aG5zfDxAiu70u90gfoo/UcL7+pjVZOnJFvUD1AC1rrTJN7V6qzJRmRVVkwwDQK3lmJC+OdOUHvcJoj7Ta5 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2018 12:58:47.9152 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3be96a1f-b60c-4c7d-bbc2-08d62c54a009 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB3436 Subject: [dpdk-dev] [PATCH v3 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 | 292 +++++++++++++++++++++----------------------- app/test-pmd/config.c | 2 - 2 files changed, 137 insertions(+), 157 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index f926060..c9dba79 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,79 +3061,55 @@ 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, - }, - .item_udp.hdr = { - .src_port = vxlan_encap_conf.udp_src, - .dst_port = vxlan_encap_conf.udp_dst, + *action_vxlan_encap_data = (struct action_tunnel_encap_data) { + .conf = (struct rte_flow_action_tunnel_encap){ + .buf = action_vxlan_encap_data->buf, }, - .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; } @@ -3142,7 +3122,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,70 +3156,53 @@ 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; } diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 009c92c..ccd9a18 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1009,8 +1009,6 @@ void print_valid_ports(void) printf("Set MTU failed. diag=%d\n", diag); } -/* Generic flow management functions. */ - /** Generate a port_flow entry from attributes/pattern/actions. */ static struct port_flow * port_flow_new(const struct rte_flow_attr *attr, From patchwork Sun Oct 7 12:57:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ori Kam X-Patchwork-Id: 46209 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 BC66137B4; Sun, 7 Oct 2018 14:58:55 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0061.outbound.protection.outlook.com [104.47.0.61]) by dpdk.org (Postfix) with ESMTP id 701414C77 for ; Sun, 7 Oct 2018 14:58:53 +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=oX/mG6qhZDvqKQpO/7+lhAY7WpJUBSzHakpA0c8bdQg=; b=OF+Yzy7GMWJkOTuLTNFLB2m16O8JDQ5+f3R79Uz0SJdJYAH2WN7szpYoRi8QHmqD3CCCalcV1J5e7acell4CHOXuiy1Nl17HHiRfbl2Tfqzlcl5i7+pUA8Cxz0YuCX+hyxIL2etHiKtTx30LONho3qBeOcMZYl8uN3XUf1qhZQA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR05MB3436.eurprd05.prod.outlook.com (2603:10a6:7:33::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.18; Sun, 7 Oct 2018 12:58:49 +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: Sun, 7 Oct 2018 12:57:34 +0000 Message-Id: <1538917054-68283-4-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538917054-68283-1-git-send-email-orika@mellanox.com> References: <1537995646-95260-1-git-send-email-orika@mellanox.com> <1538917054-68283-1-git-send-email-orika@mellanox.com> MIME-Version: 1.0 X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: LO2P265CA0119.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:c::35) To HE1PR05MB3436.eurprd05.prod.outlook.com (2603:10a6:7:33::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 29ee79a9-22b5-49ff-860e-08d62c54a138 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:HE1PR05MB3436; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3436; 3:SOPGm6ncyU27s4m+3qAsFI52ItnCdZ9NsFusQys6FpXgDimxiYvPjLh8ObqqG/SICz+FCyrWbmBLgLdP6D6/LuSP+NnsXmV7udKXGbqSQYJDIIs0YQPV90UhCB1jjbX15gQrmpu7KamSOBPjp373CAKqOECdoFC3C2PMnq0nlAQkUERHZEXsHSu0qSxfNVRjEcQr8O7CKRotU+5/5PgoNzFIXwKUGS426apoWcOyCkTFqSEp+aE3AwxXi7CL2OcD; 25:RqIS/7nazxX1LqQOUe8DMLPHIfQ5Qn4yHEoJ8CfCNYpPErv6aM0r//r1B60TwimaPfWAT66xLa3aFoDQgDb/mfxF897SMSJeNglj5SJUR3cHzf1S55dIyI6BpMSV5URYBzaRjhh01Jsmm+TKDLKtRibZw45oOktOrluUZJCGjjOwFqpRij9mMIUkevKM0/nIWj9qbkftS31jyUyoy79/uCBymbPyq1D+c51+VTYBl9X9oPO9K05LDLfX5lYK1R5lzaPn4CX8Yc9fbYSe/seBEXKAwNmQftTzriTm4VVT9yhhweWLN8olpun0kWDrWIU1qAKvDxj1OxAysNtG/Xg9fw==; 31:nskxLL86ZcG2Ty1j71QU8gHg4IELmMd9MUQlMjeFTbo2vD3DRnm4ImjWosrc89F6HfZB1+IJ2/oHT/xRTWQx18c+kB3+VOvGnlkA76t91Z41jRSLEMvNqJ7hFaYk4t23tufa51Cm4v8uXMuO8GtzkRT5Oxal3tpZ7M7xezXQvV/NvaaCShFDBuCByo6gqLNTup1iypVXwcCMbuxBJDmNOHeARm0Xg7rrhlfEN3X+/FM= X-MS-TrafficTypeDiagnostic: HE1PR05MB3436: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB3436; 20:9pjayNDcW4GQ4Njt/NKfqdkFVgKY8XCgPbpKaq3akHUzUYagEtbJrnAaqeAeQeU/8pc0/jQbbQoFc+gClF9uMRqisMUbP5m7j45m5DobHX4VE9zMDDPJrqsP3MS5YrvOgt/+BMn45eEvXjPMb4uksT6gRuOHzA17fGJdFrJtTqSx3Jtw4OyvhxC9nBbDN9LyHUJb/xPF6vF4CU8WHr3+K4TBHVJ60Q2HXHIAsluzyXXUmWGpJ1l9h1JmhTfC7xU/fzWbqXcS/ZOeGw7GbyjFsL8B+ox8iMZKgB4b9/YbwzOeFInwan9OTI5lxUjEHtxPiQbVsnLfSyA3aGhG549Vxe3mD1DzyeDZogtMEA9XaOMbH1NZR2W0tDrLd+46ocKtMbulWFqnpBbjehG7XByQQI/aojut2SykfoZm3W86Y4k75F6lrUkas7O/mQk0VNMpEqNdtTHEw+bVqwuoUrlzBVNDVJqxN/wf1oLK9uS+qZ3ms47CThuVzgnaXs1dY4Kb; 4:7rZB5n09pttqDpVQiZyr8mGNj4AH8fkc1zG4BPAOquoN9n0C9aT/Kvlkb23N15RSxk5r/LGQ/A/dn2n6oH8Y/TIL/xFw52lyqTMGOXBNUsNdcMG0bpWW9bB+EG+tHowj2Q9iAM0NR1CbyoCrRxxtVaq0YS49YkOJO0h/9O9QcVG4mqA68HjHU1nIhsltkfk4Uv1aV5e+LfUwWncPWzGia0uC65wucSH5GZA03ZrQROqkrdakx5dc/0U1chpsmoTuu8BXWx0EfcOPjhUcvSAmn6xJhUq1Zb0/AiiGdz+wtl2HF0z2TnFNmNZdB+qYZpRz X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(201708071742011)(7699051)(76991055); SRVR:HE1PR05MB3436; BCL:0; PCL:0; RULEID:; SRVR:HE1PR05MB3436; X-Forefront-PRVS: 0818724663 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(136003)(346002)(366004)(39860400002)(199004)(189003)(105586002)(76176011)(2616005)(3846002)(51416003)(7696005)(106356001)(52116002)(6116002)(386003)(55016002)(486006)(476003)(11346002)(446003)(956004)(26005)(86362001)(575784001)(305945005)(21086003)(53936002)(316002)(36756003)(69596002)(16586007)(14444005)(16526019)(186003)(8936002)(81156014)(50226002)(4326008)(478600001)(2906002)(66066001)(8676002)(4720700003)(81166006)(7736002)(6666003)(25786009)(8886007)(50466002)(68736007)(48376002)(4744004)(107886003)(97736004)(47776003)(33026002)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB3436; 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; HE1PR05MB3436; 23:wJVqax/bkimDhxvUuP4yf498dsZsHwaTtkWmUKp6D?= OOgrqp4uZdhJTDFloW4VsC3CTsIWcKYf46kruOKZPf7PcEU3Wml99Uoo8Q52BI7WUdP41CKNfT+S7QGQbdqHmUSBx6nyV0bV72IfaeDJT7ZtZeWrW5l9h43xkh9i25pSqoStHO+MQvpdyvjdknCC94aEGrpalJCSG3OGSntYI7ZsRbk/9VvoNMVs/Ik3/Thih7nN1fLa7X7uihintVQRfiUSKQIJabuzTY/dvD1ETtCI1Rml1m/GHmt+zWumbow4Jf0OfiNFbruovpxiJD5RxP02upOpcQyc3rvi2zoWVi1fhJz1QubiYs7bklJ2/Exd+knRjwIDQHgGYv+26jLlYpzdvWGtuDIpW+g4b2RfAl7FvK3nGpFbt4aMKloYefXwQSZWxfwcmzG87OqTXBJ6lQLr4Gpq/VuSymfXnrLIBIqqJOkwFu/9baI69LvjcKgjkoTpamYBqwo7aHbHQmGE4E6fWmCDMg14yN6wM/+imWA67j4f0m3QZwJAbbDaUhPL2zN14bHJnU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NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2018 12:58:49.9777 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 29ee79a9-22b5-49ff-860e-08d62c54a138 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB3436 Subject: [dpdk-dev] [PATCH v3 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.c | 37 ------------- lib/librte_ethdev/rte_flow.h | 103 ----------------------------------- 3 files changed, 247 deletions(-) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 497afc2..126e5d3 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.c b/lib/librte_ethdev/rte_flow.c index 4b548b8..8a2e074 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -119,10 +119,6 @@ struct rte_flow_desc_data { 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(VXLAN_ENCAP, sizeof(struct rte_flow_action_vxlan_encap)), - MK_FLOW_ACTION(VXLAN_DECAP, 0), - MK_FLOW_ACTION(NVGRE_ENCAP, sizeof(struct rte_flow_action_vxlan_encap)), - MK_FLOW_ACTION(NVGRE_DECAP, 0), MK_FLOW_ACTION(TUNNEL_ENCAP, sizeof(struct rte_flow_action_tunnel_encap)), MK_FLOW_ACTION(TUNNEL_DECAP, 0), @@ -427,16 +423,11 @@ enum rte_flow_conv_item_spec_type { switch (action->type) { union { const struct rte_flow_action_rss *rss; - const struct rte_flow_action_vxlan_encap *vxlan_encap; - const struct rte_flow_action_nvgre_encap *nvgre_encap; } src; union { struct rte_flow_action_rss *rss; - struct rte_flow_action_vxlan_encap *vxlan_encap; - struct rte_flow_action_nvgre_encap *nvgre_encap; } dst; size_t tmp; - int ret; case RTE_FLOW_ACTION_TYPE_RSS: src.rss = action->conf; @@ -470,34 +461,6 @@ enum rte_flow_conv_item_spec_type { off += tmp; } break; - case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: - case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: - src.vxlan_encap = action->conf; - dst.vxlan_encap = buf; - RTE_BUILD_BUG_ON(sizeof(*src.vxlan_encap) != - sizeof(*src.nvgre_encap) || - offsetof(struct rte_flow_action_vxlan_encap, - definition) != - offsetof(struct rte_flow_action_nvgre_encap, - definition)); - off = sizeof(*dst.vxlan_encap); - if (src.vxlan_encap->definition) { - off = RTE_ALIGN_CEIL - (off, sizeof(*dst.vxlan_encap->definition)); - ret = rte_flow_conv - (RTE_FLOW_CONV_OP_PATTERN, - (void *)((uintptr_t)dst.vxlan_encap + off), - size > off ? size - off : 0, - src.vxlan_encap->definition, NULL); - if (ret < 0) - return 0; - if (size >= off + ret) - dst.vxlan_encap->definition = - (void *)((uintptr_t)dst.vxlan_encap + - off); - off += ret; - } - break; default: off = rte_flow_desc_action[action->type].size; rte_memcpy(buf, action->conf, (size > off ? off : size)); diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 76b4759..0e7e0a2 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -1474,40 +1474,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. * @@ -1838,75 +1804,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