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 02E8B4415D; Wed, 5 Jun 2024 12:22:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 30EF940E7C; Wed, 5 Jun 2024 12:22:19 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2065.outbound.protection.outlook.com [40.107.94.65]) by mails.dpdk.org (Postfix) with ESMTP id 67A18402DC for ; Wed, 5 Jun 2024 12:22:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k0382rsbFFr3LOM8Iw5kodMArzb6sKRYnayDO4M/QXF9CcBuw7R2+vcc2+XeiLqRmVmyEdjukUoWLMKMxfTAoUT8xQ4R4RDV3HBx9JxfqRJYcJij4FGPaDrTU08lq8wrhYjxfMsWAIfHuvp9e1EaLvq4FeeWwqzRJvpTrs8GRvIKL3lUmRm3GfI68zbB9ZvtlAI7rgeZNfMikiaXgskekHRupbnRXY/EonsLi+QYz2gQDCbA4P93zxGX1XI51yMh/VYPINYta/zGbQmUPZ3SJKAWg2ryFshQJmanLkyR3jrzTQZyO9rEL8G9bxnlnnAShol2LGAhjgZ8UvDXZjbutQ== 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=hy16SpbZq7qf6J8hq2lAs2/pYQDlNOFgus1jvAUjMTk=; b=bT9ot75nTVG15YC0NmgLI+ELBWnJuNHVzi6ghf1SMn78NKZy+nYBLrhf2yyOVQXq5bI3w86i6t9mm8Oq6OjvYDrhJfZ5BzvqxzzyOjCZnHzhAUIRrqPdxWh+a0riYBcQF6uu2sNy7w7aJ2f0zskRQpaxYU9jIJRGNlqPhVRIcEk/pBHXt8zKNyV9nqL5zRHdFmLf+dc8pVvqotL25xL9vF3PktBjTNm8I1nm5FjqS1bwy7T1e2rKWiiJcY8XSsDHMeT9EwGFiJqZDSySxJda/dWIdxhZ7ywhxKGW44GqFpkFNlrCYnTT7B8wcZ1xPs8Tkfi2JwSTnOZNnTVbVI1QSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=hy16SpbZq7qf6J8hq2lAs2/pYQDlNOFgus1jvAUjMTk=; b=SKDlkAPeGTIhuNrkUh1rAgjguUlV5f2r/wHPNn96wFPs6a0tkevNA7pTIMeRBgZZeMZESP0k7LJh59psKytTBxaInmNR06zsqi1pO1yHf9iApGHWf0k/c/upnpX5ODm8NhKPEtbP/EyPO86dv0c+3WrSkNzCbVFwOl0CmHValN4QoGwJyXBWOvgdgz8+GxTHig+XUYx25X7cRp/y2ITs9KNL8WJWAjeuDFYDO+Y0a0xQyEZWOCO8/InK+4LzCnMWIA91pmBgrL38L9nVylrrnPjqDjZ26E+Sq9tWNQ+/wqVD9QacEZZbyeXJTP9Eal6qwc4JM5oRACycyS4WxG/3AQ== Received: from BY5PR03CA0030.namprd03.prod.outlook.com (2603:10b6:a03:1e0::40) by MN0PR12MB6030.namprd12.prod.outlook.com (2603:10b6:208:3ce::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21; Wed, 5 Jun 2024 10:22:13 +0000 Received: from SJ5PEPF000001EF.namprd05.prod.outlook.com (2603:10b6:a03:1e0:cafe::d5) by BY5PR03CA0030.outlook.office365.com (2603:10b6:a03:1e0::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.18 via Frontend Transport; Wed, 5 Jun 2024 10:22:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SJ5PEPF000001EF.mail.protection.outlook.com (10.167.242.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.15 via Frontend Transport; Wed, 5 Jun 2024 10:22:13 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 5 Jun 2024 03:22:03 -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; Wed, 5 Jun 2024 03:22:01 -0700 From: Rongwei Liu To: , , , , , CC: Dariusz Sosnowski Subject: [PATCH v6 4/4] net/mlx5: implement VXLAN last reserved modification Date: Wed, 5 Jun 2024 13:21:36 +0300 Message-ID: <20240605102136.117614-5-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240605102136.117614-1-rongweil@nvidia.com> References: <6203165.YiXZdWvhHV@thomas> <20240605102136.117614-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: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001EF:EE_|MN0PR12MB6030:EE_ X-MS-Office365-Filtering-Correlation-Id: 18c3b6a7-efa9-412e-2b4b-08dc85495dbf 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|82310400017|1800799015|36860700004|376005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?NBeH9DRHCQNLKP7R09k/ks1W8NKS3Q6ryZSDkwLu1txkuSfs9s0cKRGF6oMu?= =?us-ascii?Q?HqGJov23JMGiW2G7kYqRpx/tsujGzD5XUbCz80Bitlv0KAc3yGPRpgVAv8rv?= =?us-ascii?Q?GFfbT130xGQpBXjy1ITy2PY3R+3nrqvikoojchlMxgdo+pjmN9l878itVl4B?= =?us-ascii?Q?mjcu9XqruZBLCRS/Q1P6bxQSQcPbgtmOryKVyNBU3FQ3roeBInpM3KpuXKd4?= =?us-ascii?Q?2GuXmiRay9PicYKXrmBV3cjg9CMNzA0WGdKu1FVHM1O1WpKlWDF/FK3YbY8a?= =?us-ascii?Q?ZzX33qWcCcK5uEMvOIqrWE7bdclNniq/D1p6srtEFCZOFFWMijEv5YUKCA+o?= =?us-ascii?Q?cHBlCIGI/tw8IzDKyxfceiM9jpW0h1RylYpLISgCDKjrbz1Y5XKJzKohq/Ka?= =?us-ascii?Q?m1XIiXuwEJI/50VHmV2f0ASvnv8FUSGySwDqf4482RJXYRDQUwJX+XHdBkjq?= =?us-ascii?Q?KZCQ6s0mRzhxbXV7BnTPosr0mbdKGH2+w5S8gyvbNlS7t1UacOciJ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AgPtb+mP1hzI216zSs2w=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(82310400017)(1800799015)(36860700004)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2024 10:22:13.0590 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 18c3b6a7-efa9-412e-2b4b-08dc85495dbf 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001EF.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6030 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 06f5427abf..99abb2f2fb 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_LAST_RSVD: + 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_LAST_RSVD: + 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 63194935a3..01362ae121 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -1385,6 +1385,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_LAST_RSVD) { + 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 ? @@ -5580,6 +5584,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_LAST_RSVD: case RTE_FLOW_FIELD_GENEVE_VNI: case RTE_FLOW_FIELD_GENEVE_OPT_TYPE: case RTE_FLOW_FIELD_GENEVE_OPT_CLASS: -- 2.27.0