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 8B9204414C; Wed, 5 Jun 2024 15:05:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D79E40ED3; Wed, 5 Jun 2024 15:05:19 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2088.outbound.protection.outlook.com [40.107.212.88]) by mails.dpdk.org (Postfix) with ESMTP id 537A140ED2 for ; Wed, 5 Jun 2024 15:05:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WBHb1XqH5RPcK5xxnuDwHcQI3re3GnoiVbFUILBIuPtV/dlK0SxQCp9mcL7gC6BmtqasDvtRPOnUwj0eCUGpKZyTdQXXSaz7CGixHQ3gntBo9Wt8DWdXjLmYSeXAOpFGCyQ/F9nGcBqff8+u6pVs9FQPi7q80rEeoIxHEqejsEn+Y4GmBNq2FEvl4tZXWOM7hvflyP/n9ZHdG3VUrDraGYJXjpYP2pHippHr3Kv72/Hj80tTxV1rrILFjgQ0+NRqowH7cNN0jMZ8h8qpZPk1nW5/ccITVM3Q6SkKCaRi4uyEQ+QiQjTNYSc+NDAAZhW8OEqC82574ipxgodii8vrLQ== 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=ldkY/g2q0RSvlAgy6V5rgDc5RmoiIsZG9pq8YelbyBFC8juRW5l5M0zaywQkdwSrKtmmh8cWhoFozWKXwtXesB39RhYRZ/ot/Nrau7bzaquqeM7b2w8JtkNRnKomZKJsStrm4doaf5R6t1rwPYLOG2gRdGHyMWjeW2LxiJBGIUcvQS2keY8x+u9CLt6szLHayukn27hapg4kSMEl9t/b2zuTeKUYZwH+OXRuHb9bSRoQTCCOkAofDmYLGswaWYusrmnOQ58zR4dnsGC1Plv7F9GBSqtuEbghEq+PDA+n8ln6iBwjgYBQnK6SMI1w1MgIzLVWR20j+5f4Sudd6uZ5DQ== 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=hy16SpbZq7qf6J8hq2lAs2/pYQDlNOFgus1jvAUjMTk=; b=eD0AKG1dtZRYu/RbqhDERtANgN0RBrE+GAcxYPiEuCH16mZCqA0FETij6Q4nmU+3hKn09AOEyLK/qzAqsnKKZzB0P4zzrwqtvQdJnzoYXGr4Xaey5hox4h0zbGD2TwGfWFaCYAP9rSbY1qcrN3b03eDaWBOR9Mtelo+D3iivfq2oGyFFQwgbo1AVl1qscbF+dHKDSzlLPe13m7+f6JX6am+umIfraK+gIZZDJ5x8T0EIOwV5tunFZqAkeBKbUT/zM2e6Ci1BVa8pvLUv0290qtSRaP/CMlr/fOoSo+B7EBUCNtrE2n/gwZT3ACQttHNvZVKnsZue+5YGoitgY2sApQ== Received: from CH5P220CA0001.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:1ef::7) by MN6PR12MB8566.namprd12.prod.outlook.com (2603:10b6:208:47c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.22; Wed, 5 Jun 2024 13:05:13 +0000 Received: from CH3PEPF0000000C.namprd04.prod.outlook.com (2603:10b6:610:1ef:cafe::90) by CH5P220CA0001.outlook.office365.com (2603:10b6:610:1ef::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.31 via Frontend Transport; Wed, 5 Jun 2024 13:05:13 +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 CH3PEPF0000000C.mail.protection.outlook.com (10.167.244.39) 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 13:05:13 +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; Wed, 5 Jun 2024 06:04:48 -0700 Received: from nvidia.com (10.126.230.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 06:04:45 -0700 From: Rongwei Liu To: , , , , , CC: Dariusz Sosnowski Subject: [PATCH v7 3/3] net/mlx5: implement VXLAN last reserved modification Date: Wed, 5 Jun 2024 16:04:19 +0300 Message-ID: <20240605130419.145311-4-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240605130419.145311-1-rongweil@nvidia.com> References: <1771398.K4a6FZZPjd@thomas> <20240605130419.145311-1-rongweil@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.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: CH3PEPF0000000C:EE_|MN6PR12MB8566:EE_ X-MS-Office365-Filtering-Correlation-Id: 68c9b71d-ce64-4f61-e4cb-08dc85602367 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|36860700004|376005|1800799015; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?WjY7gNwQ0FAeNyuddkZCmrkqfoN+uUcgfA8Is2zQnTy4vVS8u2Tt+0rQlTRG?= =?us-ascii?Q?CavbmyCwDMju3ng6RRIuKEgxynh9vlSm1KaGAojLLW4okcGOus6Zt8H3oySt?= =?us-ascii?Q?1GfwjYgYd3S1u4FbbuojuaNN+4e5I8yg5i5NJJJlJ9kaFVMgdzZIKKZ+DX4T?= =?us-ascii?Q?k3km0W38sqMv7XL+5fa1z0hJag7dKV7vjR1zIpptrACzs5ps5fZLqmMy+ck3?= =?us-ascii?Q?KPf4mPzm2S4gWSx/gvz3TXbftQ/eg2V3XeNWIjaEGd3iuCZTN5JZei0ZFE4I?= =?us-ascii?Q?Emo7UWtjbJNdqFIgXyuNi5cRMBuBIzqcAfkKmkNapgTEITkpLv16uI/45rvc?= =?us-ascii?Q?p1S+GsC+QBVWRnQtoVxZxtK9kyrkcCZQ9uU9TZogY611wBnvx4VB+NrR2PjI?= =?us-ascii?Q?oh4/IevpllOmxEiJ77kdITNyJbK/CGUPXujsE/oTHZBuoWmhLSlo6gqnAkgD?= =?us-ascii?Q?QIfIPakdZ981cvWIYT5nYeGdeaMx2xk9mbrHzEb+KNLIseYYFmWw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SnkCbv?= 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)(82310400017)(36860700004)(376005)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2024 13:05:13.5415 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68c9b71d-ce64-4f61-e4cb-08dc85602367 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: CH3PEPF0000000C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR12MB8566 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