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 1B446A0C41; Wed, 17 Nov 2021 11:01:19 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 092F14111C; Wed, 17 Nov 2021 11:01:19 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2048.outbound.protection.outlook.com [40.107.212.48]) by mails.dpdk.org (Postfix) with ESMTP id 8B6E340040; Wed, 17 Nov 2021 11:01:17 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dtJoWZoFrmzCRjzY0lG+kzGwvYZm2o9aIqc0/E8himD6GTOCEwF6TMeC7Hp2Uygrz5rONPmk4BKa3HccUCF6u4eMLklHSaX7evi0rmYmvYmLaD6935CjNDMVOwqY9uAK331mlJV6v8e4sBDs95ycbydkccnVB8u1KrfwvTvh6rfiYXaAHKbVMalknDZjrYorfBBWyZxQqt3UAUl0JPn2TUc7Aux+a9VWwA/T3j9TP/vLi0PgS+2UFf1+tBE0CuI3qO5yRF3eSzrsLKoJDfjsucSwQtKcwMXAO2L3OMhB33GY2DqP1i53YSDIIFtR7zxE2++wgPVxeNVbD40l+pcSkQ== 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=JIIceCz2WaYN5D/28GLZXTnw5nKuJ4vFKDwOpmn7M8g=; b=jSUdO5ALCxuA5GLtMYGVda7BfsuNWHd1V+euw9Co4S9IR626SCHuNrSaGZZl1U3g+BQF87zXCHCbGwgYduC3U955NdF6OpJydLUSWOJ2erb3/8BZQNGuj1aEvLbGdeh7W/Q2/BbdUHu08eJTT3ZK/z4XCT5ok6FZ243eBEma+0V643FqFNRgS9BnTLd9iD9syxahm03OitEBoZkaV//7aax0UurrhdRMIIKz/NKjkBhyWE3hVsEU3PEICUGUNW9e+xH185jBjCtVmyRLrGr92/abZNUbnMdVuDNfruJ4vlbC8SA2g7QK7r+A256YcD2O9/wrh7sBzsUsmv29alaC+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none 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=JIIceCz2WaYN5D/28GLZXTnw5nKuJ4vFKDwOpmn7M8g=; b=Fj+XgPTMDcStsKfO8cOaCJ5THHUABYQs0RiVKOfii7Y/DnYVWAyGvm5qQtA0/HWhr/6eU6fmnu0gEIV+mc8JN9/3kMCH5VFRkrIlpyFTccRCWzdh2JFNMZWuD/2fFXqq/djlfKDJIbmma0wksOqJDuSzNXwXW7RYMgNNGKNdqvcUj56UbvjgCyuBD7APhnpYxXnbF8wfP9slws1XlgEPrNNfSyC+mKfN72bPP69UMztiQ7/BDiM0Uh1B6O3Y/UGZuHRQp3ArvQOg+6UbXSpO67tuwHGXFPeSS2VU6ijqjBjtQGU4sAy3IFYROsVOaryqhat5MQpIttvsuM0qEK8w8Q== Received: from BN9PR03CA0724.namprd03.prod.outlook.com (2603:10b6:408:110::9) by MN2PR12MB3326.namprd12.prod.outlook.com (2603:10b6:208:cb::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.15; Wed, 17 Nov 2021 10:01:15 +0000 Received: from BN8NAM11FT059.eop-nam11.prod.protection.outlook.com (2603:10b6:408:110:cafe::7a) by BN9PR03CA0724.outlook.office365.com (2603:10b6:408:110::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Wed, 17 Nov 2021 10:01:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT059.mail.protection.outlook.com (10.13.177.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Wed, 17 Nov 2021 10:01:15 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 17 Nov 2021 10:00:11 +0000 From: Dariusz Sosnowski To: , CC: , Subject: [PATCH] net/mlx5: fix MPLS tunnel outer layer overwrite Date: Wed, 17 Nov 2021 11:59:33 +0200 Message-ID: <20211117095933.75440-1-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fea91f33-fd05-4e93-402c-08d9a9b13164 X-MS-TrafficTypeDiagnostic: MN2PR12MB3326: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WKyW2F+JPuXJV70hb2dAznHYWjtBilD/frSnnU7b3SUa3+6u5+jVwelpclIygNoVKe3ypc0l0l9hvbPSeHUcyMXEsPS6J6F5wmeZuvjsaqC1FjXYPjG5wcZfEeSQeeKaBxqZCop9aGRKXHrKvXHIENRtC8uo6jeId37oo7Tahx1afOR1JwUZvFMGx/1m5ElSftnpSYuHzuE6PdhiSaZcGgMPDLjBVxuk0vTb1pKbdxWWPSfO0f//StfS1q3sn6+lmdrK500qb6e+Pj+HIGF/snFTV9qjqF2mrGg0S/KghAHEwxgMYPtdmqywRrtOJ9wX57t6oJ1MqomkqI+5wgDFbiI2oFfKHwC5MFCMTOWSBb02umiRcSRu5uN7YU0/uXekBpGv965aPccUh1vtrA/seJROm/0L4BKPpZ0N3sr8NfZTuE1/MN2wgfHSrulEHab32Y+V4NPouiOu/IHV+p79RIRZqDlfywYL2T3KoU+9lqASUUtvYDpEC5hCKgJLiVSTKonnl8t6PcrYOmTqi21QbvMzwFJ2UzENo/ILec7HGjRMkG16JsiLWMKt9+GHnq9yye3CuidcGy3JVZ0rV2ciMcOg3lUaEUGML+GuKSteb7tt5iHvVwns7jf3GYhahMHjq5V1MK34jMHfoXuBAr2ZOgAJt7FrHAIQ/7jP+M9HIDsAxwAaewtaVDhzz/dGRGYScwVmiDGfCQw72Cg5wnZ1Pw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(2616005)(55016002)(36756003)(26005)(316002)(508600001)(426003)(2906002)(82310400003)(336012)(6666004)(6286002)(1076003)(70206006)(186003)(36906005)(16526019)(6636002)(70586007)(47076005)(7636003)(8676002)(450100002)(86362001)(356005)(110136005)(4326008)(36860700001)(83380400001)(7696005)(54906003)(5660300002)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 10:01:15.0995 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fea91f33-fd05-4e93-402c-08d9a9b13164 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT059.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3326 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 mlx5 PMD incorrectly overwrote outer layer fields in MPLS tunnel rte_flow patterns using defaults for MPLS tunnels. This included overwriting UDP destination port in MPLSoUDP and GRE protocol field in MPLSoGRE. This patch fixes this behavior. If application provides the values in flow pattern items preceding the MPLS flow item the provided values will be used, otherwise the defaults will be applied. Fixes: d1abe664ddde ("net/mlx5: add MPLS to Direct Verbs flow engine") Cc: stable@dpdk.org Signed-off-by: Dariusz Sosnowski Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_dv.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 1b4e15dff1..0ff495ed8d 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -9282,16 +9282,22 @@ flow_dv_translate_item_mpls(void *matcher, void *key, switch (prev_layer) { case MLX5_FLOW_LAYER_OUTER_L4_UDP: - MLX5_SET(fte_match_set_lyr_2_4, headers_m, udp_dport, 0xffff); - MLX5_SET(fte_match_set_lyr_2_4, headers_v, udp_dport, - MLX5_UDP_PORT_MPLS); + if (!MLX5_GET16(fte_match_set_lyr_2_4, headers_v, udp_dport)) { + MLX5_SET(fte_match_set_lyr_2_4, headers_m, udp_dport, + 0xffff); + MLX5_SET(fte_match_set_lyr_2_4, headers_v, udp_dport, + MLX5_UDP_PORT_MPLS); + } break; case MLX5_FLOW_LAYER_GRE: /* Fall-through. */ case MLX5_FLOW_LAYER_GRE_KEY: - MLX5_SET(fte_match_set_misc, misc_m, gre_protocol, 0xffff); - MLX5_SET(fte_match_set_misc, misc_v, gre_protocol, - RTE_ETHER_TYPE_MPLS); + if (!MLX5_GET16(fte_match_set_misc, misc_v, gre_protocol)) { + MLX5_SET(fte_match_set_misc, misc_m, gre_protocol, + 0xffff); + MLX5_SET(fte_match_set_misc, misc_v, gre_protocol, + RTE_ETHER_TYPE_MPLS); + } break; default: break; -- 2.25.1