From patchwork Tue Jan 30 11:25:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gavin Li X-Patchwork-Id: 136220 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0B3BB43A0B; Tue, 30 Jan 2024 12:26:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 27A6240F1A; Tue, 30 Jan 2024 12:25:59 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2058.outbound.protection.outlook.com [40.107.94.58]) by mails.dpdk.org (Postfix) with ESMTP id 296EF40F1A for ; Tue, 30 Jan 2024 12:25:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FXI1j0ABig3f8tWaYwFRy+lPWDDyvrH1KaESb8CWmazQKvnGfuyg/9gOCVrK4JrpTrsSsFZsBK7X4EnKC3Rkq4t4OXIa56vmCRuO6wDsaJ1SDaFVH1kNm4ctArzRKnuv0oGCjpTfypBTgLf8z6iCCWsHzXtK/5BaToIR/nN/yg4S3CNvj2nfY1oWTPLTpXlTk9FhdumVcJh1cxVmN8DObICb8TQVaMdm/LD3rWXHPdnYEtIq97YJgYemLx4GV/yRgNnGIVcCcP5YYrzh+uu1iO7dMzoAHS0BQxpHFNC56gDpp/FKkbCrcZJ4obu4gowp0FBGg00oa/4z2LVM5VCp4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7yTAVjCwX0sQNOv5eV3xP8cVXLB9Hy6CUAHhXR8kq4Q=; b=WTS6fRopK2tIavrZwq+VphvsLrybHIzC2KoIMNG4LLmLnq8I7y8l0WZf5/u8+zsarUq1uUkDLkdT6iResX/pO6mxq9ACoC9myaF9VOwIpqK7GkC7cDw1qxM/s6iokZk8f/x7vu0dBvAZNhT21WpipmL/vVqYI7VXWF4kaU2rwau/sUPhD/KGnieVqFg+T96h3JL29IOQh3xKuCVKGFgPYR48Bz/ctPHv1m7zWUWBDRdYnrQatCu5vCoJqZIgvso9LWBfs4cTMlctDFlX0scz5DT2A+vxb3h/qp42jy0Ix/3fu6gg+Vx4coq1ORWtpIu9nyJ5L7cpCCVD6UrpzgQUcQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7yTAVjCwX0sQNOv5eV3xP8cVXLB9Hy6CUAHhXR8kq4Q=; b=fycWxlmHFgnFrBay68F4WO7CqabbaAWi9QoKU/+wVzwneBn51QpJnvl+D6WtgLnFFEKhF++kk2sVA+DPC9sF3y5cB0uEC50crrvxDcIKOp+AZfF5Nkbb3SBEiaBhSS1ZyAmT6/IpfZQMH30S0Vz9BD9c2yw//tqVMCVcm7VJoxtICSpnjjT1KhkyhESUN8fK/FaGVqPbZrV8A8DMjGJFlOdjhUH86GrxrzxuE1K/TTOqXWPW5VCuaqFMZuP2m10iTLCS7+Hp4lU8IYTK4jbqil87ym7MiVhhI9dJwvtbQy64MxEOO7BVX5qFA+ewlCQosya4FU90Hbgl97DR8jpt7A== Received: from DM6PR03CA0002.namprd03.prod.outlook.com (2603:10b6:5:40::15) by DS0PR12MB7581.namprd12.prod.outlook.com (2603:10b6:8:13d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.24; Tue, 30 Jan 2024 11:25:53 +0000 Received: from DS3PEPF000099DF.namprd04.prod.outlook.com (2603:10b6:5:40:cafe::cb) by DM6PR03CA0002.outlook.office365.com (2603:10b6:5:40::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.22 via Frontend Transport; Tue, 30 Jan 2024 11:25:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS3PEPF000099DF.mail.protection.outlook.com (10.167.17.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.19 via Frontend Transport; Tue, 30 Jan 2024 11:25:53 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 30 Jan 2024 03:25:41 -0800 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 30 Jan 2024 03:25:39 -0800 From: Gavin Li To: , , , CC: , Subject: [RFC V1 1/1] net: extend VXLAN header to support more extensions Date: Tue, 30 Jan 2024 13:25:20 +0200 Message-ID: <20240130112520.1971315-2-gavinl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240130112520.1971315-1-gavinl@nvidia.com> References: <20240130112520.1971315-1-gavinl@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DF:EE_|DS0PR12MB7581:EE_ X-MS-Office365-Filtering-Correlation-Id: 22d7acdf-b0de-4646-52c5-08dc2186383d X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qvXvVBj2l1zyK0WmuAQFFoo+jAsIZguEqx82IMAioaIfWwifLFGfcPRFbhsv9I74jajwZGkYOnXVAsRq5XhWmBBnMBaUOUWwdSrPxBuDuZD1oorBuALlsQ5fRjSQkKfO+iStTNQQ7AKkweMisSA5pJ1okOwdSHGdxdmRKWk86F5sy1mOykDbFO3cKGHFu3WyD1nsUZ8Nx9g/tyU8mQ9YUcSr0EtkkhEtc8CyDRTe9LjfcjGWkKFJyRhp0KCQmS0cbpv7kPM9TPLkfwxD51qbI3G8C5smXaTplbc9XXWmyesivz2sI5HnyDkrtXZtCnehxV20Yx+Q/IBd0dPLZk/28o5SgCI/CHjbvn6/jNMOAXsJcF5jHCiWVaQ22tciINSyfke2zehHWJIYy6PFEzqcjGvAJMa9YmqeIl94KuMZzdkCR1G3SFxaSpHX749LXYJPrh3F0Kci+uHYMv+hVJmyUQtlegBxQnE9esphMCtiqEeZ6BEYYXdMyndjwoV5pWcio20zMWtt1DPtA0G1v8Mj3UA/1t5hdbcEQYN2t4Wg/ezrfVowIrRD49cFG3nkDAz2o3M4a50o+MI2o3+kst+dbQzYuLA0pVJ4ACXbuAS/4oVs+9rINYun5CmEQS4wARTaN+CrDZKPju21w7+Uajw4mdjT1OYJlMpq0nw8sj8UDQEQq7QMEEnqjyLy9B5O5hm2kUuG8C37GlkmrRT/D+EmwODh/rA/2xgU08jI+oPlbXLqIgfniahnTwBjJ+5iuBxc X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(376002)(39860400002)(396003)(136003)(346002)(230922051799003)(82310400011)(186009)(451199024)(1800799012)(64100799003)(46966006)(36840700001)(40470700004)(36860700001)(47076005)(110136005)(316002)(83380400001)(36756003)(70586007)(54906003)(7696005)(70206006)(86362001)(8936002)(8676002)(6286002)(26005)(107886003)(478600001)(16526019)(1076003)(2906002)(6666004)(4326008)(336012)(426003)(5660300002)(2616005)(41300700001)(40480700001)(40460700003)(55016003)(82740400003)(7636003)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2024 11:25:53.1082 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22d7acdf-b0de-4646-52c5-08dc2186383d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DF.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7581 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Currently, DPDK supports VXLAN and VXLAN-GPE with similar header structures and we are working on adding support for VXLAN-GBP which is another extension to VXLAN. More extension of VXLAN may be added in the future. VXLAN and VXLAN-GBP use the same UDP port(4789) while VXLAN-GPE uses a different one, 4790. The three protocols have the same header length and overall similar header structure as below. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |R|R|R|R|I|R|R|R| Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | VXLAN Network Identifier (VNI) | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 1: VXLAN Header 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |R|R|Ver|I|P|B|O| Reserved |Next Protocol | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | VXLAN Network Identifier (VNI) | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 2: VXLAN-GPE Header 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |G|R|R|R|I|R|R|R|R|D|R|R|A|R|R|R| Group Policy ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | VXLAN Network Identifier (VNI) | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 3: VXLAN-GBP Extension Both VXLAN-GPE and VXLAN-GBP extended VXLAN by redefining its reserved bits, which means the packets can be processed with same pattern and most of the code can be reused. Instead of adding more new items by copying/pasting code for the VXLAN extensions in the future, it’s better to use existing VXLAN infrastructure and add support code in it. In this patch, all the VXLAN extension header will be merged with VXLAN as union if the overlapped field has different format among protocols. The existing VXLAN-GPE will be marked as deprecated and new extensions of VXLAN should be added to VXLAN instead of a new RTE item. Signed-off-by: Gavin Li --- doc/guides/rel_notes/deprecation.rst | 5 +++ lib/ethdev/rte_flow.h | 13 +++++- lib/net/rte_vxlan.h | 67 ++++++++++++++++++++++++++-- 3 files changed, 80 insertions(+), 5 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 81b93515cb..f9cf931b77 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -95,6 +95,11 @@ Deprecation Notices - ``rte_flow_item_pppoe`` - ``rte_flow_item_pppoe_proto_id`` +* ethdev: The flow item ``RTE_FLOW_ITEM_TYPE_VXLAN_GPE`` is replaced with ``RTE_FLOW_ITEM_TYPE_VXLAN``. + The item ``RTE_FLOW_ITEM_TYPE_VXLAN_GPE``, the struct ``rte_flow_item_vxlan_gpe``, its mask ``rte_flow_item_vxlan_gpe_mask``, + and the header struct ``rte_vxlan_gpe_hdr`` with the macro ``RTE_ETHER_VXLAN_GPE_HLEN`` + will be removed in DPDK 25.11. + * ethdev: Queue specific stats fields will be removed from ``struct rte_eth_stats``. Mentioned fields are: ``q_ipackets``, ``q_opackets``, ``q_ibytes``, ``q_obytes``, ``q_errors``. diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 1267c146e5..a9943106d9 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -355,6 +355,7 @@ enum rte_flow_item_type { RTE_FLOW_ITEM_TYPE_GENEVE, /** + * @deprecated Replaced with ``RTE_FLOW_ITEM_TYPE_VXLAN``. * Matches a VXLAN-GPE header. * * See struct rte_flow_item_vxlan_gpe. @@ -1096,7 +1097,11 @@ static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = { /** * RTE_FLOW_ITEM_TYPE_VXLAN. * - * Matches a VXLAN header (RFC 7348). + * Matches a VXLAN header (RFC 7348), including GPE (draft-ietf-nvo3-vxlan-gpe-13.txt) + * and GBP (draft-smith-vxlan-group-policy-05.txt). + * + * GPE is distinguished with its UDP port. + * UDP port may be specified with ``rte_eth_dev_udp_tunnel_port_add()``. */ struct rte_flow_item_vxlan { union { @@ -1339,6 +1344,7 @@ static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = { #endif /** + * @deprecated Replaced with ``rte_flow_item_vxlan``. * RTE_FLOW_ITEM_TYPE_VXLAN_GPE (draft-ietf-nvo3-vxlan-gpe-05). * * Matches a VXLAN-GPE header. @@ -1360,7 +1366,10 @@ struct rte_flow_item_vxlan_gpe { }; }; -/** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE. */ +/** + * @deprecated Replaced with ``rte_flow_item_vxlan_mask``. + * Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE. + */ #ifndef __cplusplus static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask = { .hdr.vni = "\xff\xff\xff", diff --git a/lib/net/rte_vxlan.h b/lib/net/rte_vxlan.h index 997fc784fc..255c30f71d 100644 --- a/lib/net/rte_vxlan.h +++ b/lib/net/rte_vxlan.h @@ -38,8 +38,65 @@ struct rte_vxlan_hdr { rte_be32_t vx_vni; /**< VNI (24) + Reserved (8). */ }; struct { - uint8_t flags; /**< Should be 8 (I flag). */ - uint8_t rsvd0[3]; /**< Reserved. */ + union { + uint8_t flags; /**< Should be 8 (I flag). */ + /* Flag bits defined by GPE */ + struct { +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN + uint8_t flag_o:1, + flag_b:1, + flag_p:1, + flag_i_gpe:1, + flag_ver:2, + rsvd_gpe:2; +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN + uint8_t rsvd_gpe:2, + flag_ver:2, + flag_i_gpe:1, + flag_p:1, + flag_b:1, + flag_o:1; +#endif + }; + /* Flag bits defined by GBP */ + struct { +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN + uint8_t rsvd_gbp1:3, + flag_i_gbp:1, + rsvd_gbp2:3, + flag_g:1; +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN + uint8_t flag_g:1, + rsvd_gbp1:3, + flag_i_gbp:1, + rsvd_gbp2:3; +#endif + }; + }; + union { + uint8_t rsvd0[3]; /**< Reserved. */ + /* Overlap with rte_vxlan_gpe_hdr which is deprecated.*/ + struct { + uint8_t rsvd0_gpe[2]; /**< Reserved. */ + uint8_t proto; /**< Next protocol. */ + }; + struct { +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN + uint8_t rsvd0_gbp1:3, + policy_applied:1, + rsvd0_gbp2:2, + dont_learn:1, + rsvd0_gbp3:1; +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN + uint8_t rsvd0_gbp1:1, + dont_learn:1, + rsvd0_gbp2:2, + policy_applied:1, + rsvd0_gbp3:3; +#endif + uint16_t policy_id; + }; + }; uint8_t vni[3]; /**< VXLAN identifier. */ uint8_t rsvd1; /**< Reserved. */ }; @@ -52,6 +109,7 @@ struct rte_vxlan_hdr { /** + * @deprecated Replaced with ``rte_vxlan_hdr``. * VXLAN-GPE protocol header (draft-ietf-nvo3-vxlan-gpe-05). * Contains the 8-bit flag, 8-bit next-protocol, 24-bit VXLAN Network * Identifier and Reserved fields (16 bits and 8 bits). @@ -75,7 +133,10 @@ struct rte_vxlan_gpe_hdr { }; } __rte_packed; -/** VXLAN-GPE tunnel header length. */ +/** + * @deprecated Replaced with ``RTE_ETHER_VXLAN_HLEN``. + * VXLAN-GPE tunnel header length. + */ #define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct rte_udp_hdr) + \ sizeof(struct rte_vxlan_gpe_hdr))