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 4F93743E57 for ; Sat, 13 Apr 2024 14:59:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4953440294; Sat, 13 Apr 2024 14:59:16 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2049.outbound.protection.outlook.com [40.107.96.49]) by mails.dpdk.org (Postfix) with ESMTP id BD5D940294 for ; Sat, 13 Apr 2024 14:59:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W2ml/hMTxDsmf32chSuRpvkLTMygiJxo0ngz1uGqX1GzCWQt/xRaK3Pl2Q7Gey7XqYHzb8rp+vjRbzldBRS2zpQG+2pAbdG0FCdDCIf/2X2nWGOpmm1CZS7KHuD60q9vN61w+Lfa4c/2owJHbg+7v3IyF3839Uy2ylbow6tO2FT1klTBGG6tsayfDBgoocE9x1W6tgrRKNnNoSnIDolf638rTA3nk3YrHInVqpG1c3VIPSLXxbFkZsHogVTtG0LSIdbPEWiADAPtsTrIDW3uqfMoBnSW7L0pulqAudQDhCsp6tkAS4eCwkXJ3h2E+e4BoL0T38cXVpo9adT1zkcgDw== 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=jGMJAZlTQYhnv51yOUr7j1PZjK9rQkYWNPZ7Hqi6sDg=; b=mZvfVOnzhkJT4d3IndETGSMbZfClBIv3aaD4cRJuKLCdW71nVa7qQxpIJUwaFlWWvUwEP3d2hWJeJmLPu3b+MvP7gPne4rNBrEjEqDpTVyBwyF2ovCNKvtIxc+LXUJ5bcBhzws5Vmo1pdB3/5+rTpy9y4yl8vbo8x0w+q0CNibV+43dqp86O5FxNVFhrz/KCXAXu3uATc+0olWNnovUvmCdURiSi3AouWFPUCwcenan76cLdscu43/HJMof7vRyJGDkdrZcMLuzYWGYd+QrEosjtmh2b/uOOLKfT6CyBHjbPyy2wemkUhpy0+zQ3u6anJLhkLTQ2479t06r6hy/UbA== 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=jGMJAZlTQYhnv51yOUr7j1PZjK9rQkYWNPZ7Hqi6sDg=; b=c2yVnMw5GI6lCQtuZ/hoP3ixEKrzvBsf5GKHmpv9sU3WczbcsF+fdyGIYkNWGfEgGuEAzCzPlFJAmOVPBfTsv4HkZg7QlJgiCYhtnwIX4PWYugEWErcAzJ6SZ2mYnr+RDJ3lVfjA5CNGB3Ua5EJDbZtHRMbd5k8bj3mqYKBNg32ch9vusoxUll2uaGiGAXN2kL/D50EWCMYPmncPoKj9zXy+72JKXWWes+SnyPOEIBZPAk+EdqKhkJ0dh9P+MMR1KO4gYqS9Gtuu8xDL1crR/88n1JWQGjqi7N+bwQpOoixu20rse13rrPsOEUC66AFiDZqnK/aK+sbqU043QKMLqg== Received: from MW4PR04CA0161.namprd04.prod.outlook.com (2603:10b6:303:85::16) by DS0PR12MB8563.namprd12.prod.outlook.com (2603:10b6:8:165::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Sat, 13 Apr 2024 12:59:09 +0000 Received: from MWH0EPF000989E6.namprd02.prod.outlook.com (2603:10b6:303:85:cafe::c9) by MW4PR04CA0161.outlook.office365.com (2603:10b6:303:85::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.27 via Frontend Transport; Sat, 13 Apr 2024 12:59:09 +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 MWH0EPF000989E6.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Sat, 13 Apr 2024 12:59:09 +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.986.41; Sat, 13 Apr 2024 05:59:01 -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.1258.12; Sat, 13 Apr 2024 05:58:59 -0700 From: Xueming Li To: Gregory Etelson CC: Ori Kam , dpdk stable Subject: patch 'net/mlx5: fix IP-in-IP tunnels recognition' has been queued to stable release 23.11.1 Date: Sat, 13 Apr 2024 20:49:40 +0800 Message-ID: <20240413125005.725659-100-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240413125005.725659-1-xuemingl@nvidia.com> References: <20240305094757.439387-1-xuemingl@nvidia.com> <20240413125005.725659-1-xuemingl@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: MWH0EPF000989E6:EE_|DS0PR12MB8563:EE_ X-MS-Office365-Filtering-Correlation-Id: aabef39f-613b-4229-323a-08dc5bb98233 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zER1w6nc3bE5sv0GCDW4jcb4uIkCaaZX2F40T0/iH3/lUyQ6LvOFgs/JBb0wLZZqPMJ+xQ/5UV8R1aUvMkXVheBnETMzx7pRxc2DbOiX/Lp5UENujlRsHTdoRKG3+FpBFhuMNYA/X6STFJep2zAojJbZlpkOTngX6f2+/MsGRGTAMuq9IOXVDWypjdxcN7MMgrpq+zgECyd4sTr2KcGRYLHNicr8IL0e7PMH7d2oSnydDgFYab2dMwNWeq9YxgSemTY7sZZmSjjtgS1IjBgOX5gZwCy1JjaU5f8oiulh4O3SmUicODGfeAVir8tLy6Up4oxX7brKx4RKLz25U8kyKe+UXvR2YGVB5w26zh+V91wXpfwIY7szgjT94X5fbuBFizpCwO+tg6F86yJPnUt0lmrICuyDEK6Y+1t/NHlH/8kjPYMRqAntTnUuefmBBoRvlFUzaSyllZo4/aoGR2nn48SStAHG2im5kBP/QDr73jb1vlpkw+jWpMTMIb6nfzBj7kcKhvdFSmgS1olgtKY+gXFq1c6O2mtdchVjd9kkpnskkVXE5joiHUsjPuAYAfrzH7ZPa84rE3eC73ObcV1JjxrE6ndOT5CyImAzacfQrLEl3sWIBG4NUn/fPiadjNN8PcqwsiSmWqOZPoij5myzP+kZjJ5K0VFMQohJAYIs7e4Ga/pYMxlTkzhgknd4Yu8ISHFWLvqZn3K9cNhuqiwtQQZu5Da0JWlOTJcuhxTSQ3iZZvtIkVIsslH96932i+YR 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)(36860700004)(82310400014)(376005)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2024 12:59:09.0457 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aabef39f-613b-4229-323a-08dc5bb98233 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: MWH0EPF000989E6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8563 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 23.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/15/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=9a9f0acac6ac246cbfe95734901fb5b4599bebfd Thanks. Xueming Li --- >From 9a9f0acac6ac246cbfe95734901fb5b4599bebfd Mon Sep 17 00:00:00 2001 From: Gregory Etelson Date: Thu, 29 Feb 2024 18:05:04 +0200 Subject: [PATCH] net/mlx5: fix IP-in-IP tunnels recognition Cc: Xueming Li [ upstream commit 2db234e769e121446b7b6d8e97e00212bebf7a3c ] The patch fixes IP-in-IP tunnel recognition for the following patterns / [ipv4|ipv6] proto is [ipv4|ipv6] / end / [ipv4|ipv6] / [ipv4|ipv6] / Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function") Signed-off-by: Gregory Etelson Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow_dv.c | 104 ++++++++++++++++++++++++-------- 1 file changed, 80 insertions(+), 24 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index eaadbf577f..e36443436e 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -267,21 +267,41 @@ struct field_modify_info modify_tcp[] = { {0, 0, 0}, }; -static void +enum mlx5_l3_tunnel_detection { + l3_tunnel_none, + l3_tunnel_outer, + l3_tunnel_inner +}; + +static enum mlx5_l3_tunnel_detection mlx5_flow_tunnel_ip_check(const struct rte_flow_item *item __rte_unused, - uint8_t next_protocol, uint64_t *item_flags, - int *tunnel) + uint8_t next_protocol, uint64_t item_flags, + uint64_t *l3_tunnel_flag) { + enum mlx5_l3_tunnel_detection td = l3_tunnel_none; + MLX5_ASSERT(item->type == RTE_FLOW_ITEM_TYPE_IPV4 || item->type == RTE_FLOW_ITEM_TYPE_IPV6); - if (next_protocol == IPPROTO_IPIP) { - *item_flags |= MLX5_FLOW_LAYER_IPIP; - *tunnel = 1; - } - if (next_protocol == IPPROTO_IPV6) { - *item_flags |= MLX5_FLOW_LAYER_IPV6_ENCAP; - *tunnel = 1; + if ((item_flags & MLX5_FLOW_LAYER_OUTER_L3) == 0) { + switch (next_protocol) { + case IPPROTO_IPIP: + td = l3_tunnel_outer; + *l3_tunnel_flag = MLX5_FLOW_LAYER_IPIP; + break; + case IPPROTO_IPV6: + td = l3_tunnel_outer; + *l3_tunnel_flag = MLX5_FLOW_LAYER_IPV6_ENCAP; + break; + default: + break; + } + } else { + td = l3_tunnel_inner; + *l3_tunnel_flag = item->type == RTE_FLOW_ITEM_TYPE_IPV4 ? + MLX5_FLOW_LAYER_IPIP : + MLX5_FLOW_LAYER_IPV6_ENCAP; } + return td; } static inline struct mlx5_hlist * @@ -7478,6 +7498,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return ret; is_root = (uint64_t)ret; for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) { + enum mlx5_l3_tunnel_detection l3_tunnel_detection; + uint64_t l3_tunnel_flag; int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL); int type = items->type; @@ -7555,8 +7577,16 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, vlan_m = items->mask; break; case RTE_FLOW_ITEM_TYPE_IPV4: - mlx5_flow_tunnel_ip_check(items, next_protocol, - &item_flags, &tunnel); + next_protocol = mlx5_flow_l3_next_protocol + (items, (enum MLX5_SET_MATCHER)-1); + l3_tunnel_detection = + mlx5_flow_tunnel_ip_check(items, next_protocol, + item_flags, + &l3_tunnel_flag); + if (l3_tunnel_detection == l3_tunnel_inner) { + item_flags |= l3_tunnel_flag; + tunnel = 1; + } ret = flow_dv_validate_item_ipv4(dev, items, item_flags, last_item, ether_type, error); @@ -7564,12 +7594,20 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return ret; last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 : MLX5_FLOW_LAYER_OUTER_L3_IPV4; - next_protocol = mlx5_flow_l3_next_protocol - (items, (enum MLX5_SET_MATCHER)-1); + if (l3_tunnel_detection == l3_tunnel_outer) + item_flags |= l3_tunnel_flag; break; case RTE_FLOW_ITEM_TYPE_IPV6: - mlx5_flow_tunnel_ip_check(items, next_protocol, - &item_flags, &tunnel); + next_protocol = mlx5_flow_l3_next_protocol + (items, (enum MLX5_SET_MATCHER)-1); + l3_tunnel_detection = + mlx5_flow_tunnel_ip_check(items, next_protocol, + item_flags, + &l3_tunnel_flag); + if (l3_tunnel_detection == l3_tunnel_inner) { + item_flags |= l3_tunnel_flag; + tunnel = 1; + } ret = mlx5_flow_validate_item_ipv6(items, item_flags, last_item, ether_type, @@ -7579,8 +7617,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return ret; last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV6 : MLX5_FLOW_LAYER_OUTER_L3_IPV6; - next_protocol = mlx5_flow_l3_next_protocol - (items, (enum MLX5_SET_MATCHER)-1); + if (l3_tunnel_detection == l3_tunnel_outer) + item_flags |= l3_tunnel_flag; break; case RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT: ret = flow_dv_validate_item_ipv6_frag_ext(items, @@ -13683,6 +13721,8 @@ flow_dv_translate_items(struct rte_eth_dev *dev, int tunnel = !!(wks->item_flags & MLX5_FLOW_LAYER_TUNNEL); int item_type = items->type; uint64_t last_item = wks->last_item; + enum mlx5_l3_tunnel_detection l3_tunnel_detection; + uint64_t l3_tunnel_flag; int ret; switch (item_type) { @@ -13726,24 +13766,40 @@ flow_dv_translate_items(struct rte_eth_dev *dev, MLX5_FLOW_LAYER_OUTER_VLAN); break; case RTE_FLOW_ITEM_TYPE_IPV4: - mlx5_flow_tunnel_ip_check(items, next_protocol, - &wks->item_flags, &tunnel); + next_protocol = mlx5_flow_l3_next_protocol(items, key_type); + l3_tunnel_detection = + mlx5_flow_tunnel_ip_check(items, next_protocol, + wks->item_flags, + &l3_tunnel_flag); + if (l3_tunnel_detection == l3_tunnel_inner) { + wks->item_flags |= l3_tunnel_flag; + tunnel = 1; + } flow_dv_translate_item_ipv4(key, items, tunnel, wks->group, key_type); wks->priority = MLX5_PRIORITY_MAP_L3; last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 : MLX5_FLOW_LAYER_OUTER_L3_IPV4; - next_protocol = mlx5_flow_l3_next_protocol(items, key_type); + if (l3_tunnel_detection == l3_tunnel_outer) + wks->item_flags |= l3_tunnel_flag; break; case RTE_FLOW_ITEM_TYPE_IPV6: - mlx5_flow_tunnel_ip_check(items, next_protocol, - &wks->item_flags, &tunnel); + next_protocol = mlx5_flow_l3_next_protocol(items, key_type); + l3_tunnel_detection = + mlx5_flow_tunnel_ip_check(items, next_protocol, + wks->item_flags, + &l3_tunnel_flag); + if (l3_tunnel_detection == l3_tunnel_inner) { + wks->item_flags |= l3_tunnel_flag; + tunnel = 1; + } flow_dv_translate_item_ipv6(key, items, tunnel, wks->group, key_type); wks->priority = MLX5_PRIORITY_MAP_L3; last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV6 : MLX5_FLOW_LAYER_OUTER_L3_IPV6; - next_protocol = mlx5_flow_l3_next_protocol(items, key_type); + if (l3_tunnel_detection == l3_tunnel_outer) + wks->item_flags |= l3_tunnel_flag; break; case RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT: flow_dv_translate_item_ipv6_frag_ext -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-04-13 20:43:08.074448313 +0800 +++ 0100-net-mlx5-fix-IP-in-IP-tunnels-recognition.patch 2024-04-13 20:43:05.087753814 +0800 @@ -1 +1 @@ -From 2db234e769e121446b7b6d8e97e00212bebf7a3c Mon Sep 17 00:00:00 2001 +From 9a9f0acac6ac246cbfe95734901fb5b4599bebfd Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 2db234e769e121446b7b6d8e97e00212bebf7a3c ] @@ -13 +15,0 @@ -Cc: stable@dpdk.org @@ -22 +24 @@ -index 9e444c8a1c..80239bebee 100644 +index eaadbf577f..e36443436e 100644 @@ -25 +27 @@ -@@ -275,21 +275,41 @@ struct field_modify_info modify_tcp[] = { +@@ -267,21 +267,41 @@ struct field_modify_info modify_tcp[] = { @@ -77 +79 @@ -@@ -7718,6 +7738,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -7478,6 +7498,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -86 +88 @@ -@@ -7795,8 +7817,16 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -7555,8 +7577,16 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -105 +107 @@ -@@ -7804,12 +7834,20 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -7564,12 +7594,20 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -130 +132 @@ -@@ -7819,8 +7857,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -7579,8 +7617,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -141 +143 @@ -@@ -13945,6 +13983,8 @@ flow_dv_translate_items(struct rte_eth_dev *dev, +@@ -13683,6 +13721,8 @@ flow_dv_translate_items(struct rte_eth_dev *dev, @@ -150 +152 @@ -@@ -13988,24 +14028,40 @@ flow_dv_translate_items(struct rte_eth_dev *dev, +@@ -13726,24 +13766,40 @@ flow_dv_translate_items(struct rte_eth_dev *dev,