From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AB7C744153; Tue, 4 Jun 2024 14:39:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB23A43740; Tue, 4 Jun 2024 14:39:26 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2055.outbound.protection.outlook.com [40.107.244.55]) by mails.dpdk.org (Postfix) with ESMTP id 972B24373F for ; Tue, 4 Jun 2024 14:39:25 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E+5OTfNMNioYElss+yuwhiuesiEdtqJ+RoWENhjzKrABKycgZLaWK+5l+AMpuYOYlDmmfBD6T3UqgYf6ueO/YfBPX1Uh+VQRla2GUGNk0Iy0S6VRuQ0yiZyT0P7HZL9ElLQRIZY/tX0y15uz943ugB689+ncY7iYBrmnEo/jEoLd82vK3nxUMLp6Yw90w5VDl0J5WwHSkQdJ3V47WH+gnuEJU5LEYv8qeNhWZbHlOpgaVK68beGb/s1vJIGHfPLuP7VsA26tu0oRNsVLwGeBQZJmmVPujh35bPI+ycj1AsyrEIG2jp3wgd68e+mP0Y0r2wDm8FLO8vdjUR9RKGXd8A== 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=ThQ8d/KUY5eMDziWn17AvWh0mEE+zAUMCgE1DX98+3w=; b=T3mVZODOTEVFFgrxpLKXZKxXcdXYX8UrgqEmuu07gW1Oy79mKIRFvBm7XRK5AEWoiEV+s1s692T4o1bkeshALyzATumI8CFbo8NwBmZOq2ATTrGLsUFdjRlEG1M/qDRqzKMTFr62F5YvYru+5S3pmaBQFjKQ9oYwXeSfev77NZ3cMOi4tCNX3Vvma4yz5aqbziYDG/MjZDvbpeYVyyI6QnPUkOFTVf49w8LB5MK2/S+IXHwwFtLJ6Bl0GzKRTLmbDOuGpOdUbprvcl43YkMARPm1tXbG4vJOaJdvS/RNhUPnY9bxji5bTiM72nv52lADLHnR5tofVfiESiA1pEec+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org 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=ThQ8d/KUY5eMDziWn17AvWh0mEE+zAUMCgE1DX98+3w=; b=EnNe9JjicjbGPpynRHkZXgWQGfRm1402UOnGnTeACvD5Spz1Y1e6ZEDMgXr+DjGvBRhbPVuzOIKrW3XjWGtiEyWAF+gnpDyt8UmBe9ZuiCm3qjOhvi0yhFuK6gdWiaugSSV8ahGE25OPNql6jmRG6mfBrhsE2IzGk7v/uqHjqSWnIr77Y9jG7mas77mZuBFmNjz6D91rBW/YCGimastG5qKvzsBqTYzZGKJt+tZWFKl9Q4nqbTzoYRAStfFIYmju431NYWfYE06f2ntddsBTXiBo0UVBLu9dSYevjIHtKYrw/7OHO/9OpUpFAP5SWdPCED0oMNMVeGp3OaoAOW5k+w== Received: from BN8PR04CA0038.namprd04.prod.outlook.com (2603:10b6:408:d4::12) by IA0PR12MB8982.namprd12.prod.outlook.com (2603:10b6:208:481::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21; Tue, 4 Jun 2024 12:39:22 +0000 Received: from BN3PEPF0000B070.namprd21.prod.outlook.com (2603:10b6:408:d4:cafe::9e) by BN8PR04CA0038.outlook.office365.com (2603:10b6:408:d4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.31 via Frontend Transport; Tue, 4 Jun 2024 12:39:22 +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 BN3PEPF0000B070.mail.protection.outlook.com (10.167.243.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.0 via Frontend Transport; Tue, 4 Jun 2024 12:39:22 +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.1544.4; Tue, 4 Jun 2024 05:39:05 -0700 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.1544.4; Tue, 4 Jun 2024 05:39:03 -0700 From: Rongwei Liu To: , , , , , CC: Dariusz Sosnowski Subject: [PATCH v4 3/3] net/mlx5: implement VXLAN last reserved modification Date: Tue, 4 Jun 2024 15:38:39 +0300 Message-ID: <20240604123840.432044-4-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240604123840.432044-1-rongweil@nvidia.com> References: <14937324.O6BkTfRZtg@thomas> <20240604123840.432044-1-rongweil@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B070:EE_|IA0PR12MB8982:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ee993ce-b397-483d-94b0-08dc84935c6f 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; ARA:13230031|376005|1800799015|36860700004|82310400017; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?kwZbKl1DJf+ltHse4GnlRuC23GpWCQj9gpXNnpXCt3U2UMKDrWfwOLD3LtFV?= =?us-ascii?Q?cqI+DVIqjj8wNKzywAXORM10SWIDEc/rap4oC91bBSEVNfXaSbijZYd+/MtY?= =?us-ascii?Q?BtJXcJZnwAK/eGdECEFpivLW8WMz+dlYU+wyskqt3gRmVUtXBHvM5Vnimek6?= =?us-ascii?Q?qJyCimpEcLnAGN7KjVR4mW5rnWsfk/YydqHCvTPh1OIi/1x/GiyCB9bX++aq?= =?us-ascii?Q?ujYl8HFCnhRKwwEFLU6kbDpkVIZI9HBe0e96oxgtD8H29uBS/LHzBAIRgYrU?= =?us-ascii?Q?awWSyZVI28eeci+zuE8vj5HPjh6pKMVI1DN7lh/03D3qjXYrxw3jMhsunrrh?= =?us-ascii?Q?fPs1s5RfpPFo6KHhkcg2MkNuNHNK3MJ2mi3cNOO0/uC/cpUbV4LE1mMYLkU4?= =?us-ascii?Q?zeGpILwzWTTvaGl4sniWN7Yr//LYMJfhIXtcIbdm0B5Pc7hSuneZwRcCrf1y?= =?us-ascii?Q?n1AwC/VWX5DvE9TvB1DMbTvPFN4gg7U9t6GRdaaZF6/NW/QyB7UgNbwX6FBR?= =?us-ascii?Q?Zi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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)(376005)(1800799015)(36860700004)(82310400017); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2024 12:39:22.3768 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ee993ce-b397-483d-94b0-08dc84935c6f 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: BN3PEPF0000B070.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8982 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 Implementing the VxLAN last reserved byte modification. Following the RFC, the field is only 1 byte and needs to use the field_length as 8 instead of the real dst_field->size. Signed-off-by: Rongwei Liu Acked-by: Dariusz Sosnowski --- doc/guides/nics/mlx5.rst | 5 +++++ drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++++++++ drivers/net/mlx5/mlx5_flow_hw.c | 5 +++++ 3 files changed, 22 insertions(+) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index b5928d40b2..8b3aaf5aac 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -637,6 +637,11 @@ Limitations - Modify field action using ``RTE_FLOW_FIELD_RANDOM`` is not supported. - Modification of the 802.1Q tag is not supported. - Modification of VXLAN network or GENEVE network ID is supported only for HW steering. + - Modification of the VXLAN header is supported with below limitations: + + - Only for HW steering (``dv_flow_en=2``). + - Support VNI and the last reserved byte modifications for traffic with default + UDP destination port. 4789 for VXLAN and VXLAN-GBP, 4790 for VXLAN-GPE. - Modification of GENEVE network ID is not supported when configured ``FLEX_PARSER_PROFILE_ENABLE`` supports Geneve TLV options. See :ref:`mlx5_firmware_config` for more flex parser information. diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 6f72185916..48554ab8d1 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1439,6 +1439,8 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev, case RTE_FLOW_FIELD_VXLAN_VNI: case RTE_FLOW_FIELD_GENEVE_VNI: return 24; + case RTE_FLOW_FIELD_VXLAN_RSVD1: + return 8; case RTE_FLOW_FIELD_GTP_TEID: case RTE_FLOW_FIELD_MPLS: case RTE_FLOW_FIELD_TAG: @@ -2038,6 +2040,16 @@ mlx5_flow_field_id_to_modify_info else info[idx].offset = off_be; break; + case RTE_FLOW_FIELD_VXLAN_RSVD1: + MLX5_ASSERT(data->offset + width <= 8); + /* Last_rsvd is on bits 7-0 of TUNNEL_HDR_DW_1. */ + off_be = 8 - (data->offset + width); + info[idx] = (struct field_modify_info){1, 0, MLX5_MODI_TUNNEL_HDR_DW_1}; + if (mask) + mask[idx] = flow_modify_info_mask_8(width, off_be); + else + info[idx].offset = off_be; + break; case RTE_FLOW_FIELD_GENEVE_OPT_TYPE: MLX5_ASSERT(data->offset + width <= 8); modi_id = flow_geneve_opt_modi_field_get(priv, data); diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 27e3ec550e..2feff05c24 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -1371,6 +1371,10 @@ flow_hw_modify_field_compile(struct rte_eth_dev *dev, value = *(const uint8_t *)item.spec; value = rte_cpu_to_be_32(value << 8); item.spec = &value; + } else if (conf->dst.field == RTE_FLOW_FIELD_VXLAN_RSVD1) { + value = *(const uint8_t *)item.spec << 24; + value = rte_cpu_to_be_32(value); + item.spec = &value; } } else { type = conf->operation == RTE_FLOW_MODIFY_SET ? @@ -5515,6 +5519,7 @@ flow_hw_validate_modify_field_level(const struct rte_flow_field_data *data, case RTE_FLOW_FIELD_ESP_SPI: case RTE_FLOW_FIELD_ESP_SEQ_NUM: case RTE_FLOW_FIELD_VXLAN_VNI: + case RTE_FLOW_FIELD_VXLAN_RSVD1: case RTE_FLOW_FIELD_GENEVE_VNI: case RTE_FLOW_FIELD_GENEVE_OPT_TYPE: case RTE_FLOW_FIELD_GENEVE_OPT_CLASS: -- 2.27.0