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 A3598A0548 for ; Sun, 28 Nov 2021 16:00:09 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9869442735; Sun, 28 Nov 2021 16:00:09 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2058.outbound.protection.outlook.com [40.107.100.58]) by mails.dpdk.org (Postfix) with ESMTP id 6982E4068E for ; Sun, 28 Nov 2021 16:00:06 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I13oBqBhjC1j/+ezDk4Q3YhIJxPyiy55ZfHv7fLhkNUDsvPnyMDMoQpAuc+k3DRhWUJGFrO7eKibj8MsyN2nodyvvOpU8cGI6Z0Sai3cIP58a3Kqt2qaFTjyn3yRRVgkbTBMvER1IHbUs9raW6YvemIE+zpWNHmwTmKy9J1RTD/BzmPDwOumDCxEYa73ugCXi7VtzQCmanXJGYZ20duF1jGKh4WQc2EwaOVNwfYR1MhgjM9DRhjDqpyl/8oVC4lxVV6ZbHQL0nEqwW/7RmRmbmZpECzXZfFlch+kHFvs0lfIyVTDXxx2Rm2v/mggZn06IHLD+T9Sb4ZHiBcTOCYrMg== 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=DdEPRxoc4wWwHQCaKNPCqdgA8dCH5a2hatc6JTKqJb0=; b=JC0W/hmd0Z6fUcwoER6VTImTPWVhGLBMwMFqWPvkCBEOYbqxu8G6TmL/806T56GcC6CS5V+spRAKp/zLGNu99SF5TqN5hId6uOPzyHQY564ba3KaHS4sFPOKi5RDGkM6nsPKq8g35LiuUM5qSQFFdNwlgB6v4qbYMcCz4VCeJht2AygDTX6T/k9WCxwWdZyiVimRBbK1iQzByRhKt/WwZqOizPnRkDfOXrwvG2YYRuI944R37ePLLL0Z/ThSqBqGMBJfe3Lo6buzNyURg2DVOMRLufGS0bJadY9YixtBkp7lbBDc3zcllJ260rII9hA+PDlHYtg2FPokZk9vc98QaQ== 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=DdEPRxoc4wWwHQCaKNPCqdgA8dCH5a2hatc6JTKqJb0=; b=X5s3Z+Xa7vwX8K0tKC65n3hIa2+PZSoN2vyZ7X9fzl0D9ZkqpENXjPm6NJoM9FN+dif1XSUM89tU6onMhWRYFL4jxrtcFLVtCkOgoBwem98H4lOw3pikcJxZ06gSHVf5gi/l/3wncokaj+XuLM3plcl1V9pIrMgzGqHaXd3bnIhSFHYdTOWDtgplB3uGE0rFQ/rkARMx7peIGfFf59m2VkFHCcLTz55T557W8GZ0rAUBR+9kvS1frIf2N073jMh4JG/9QgLwhBDtPySe3mM/gSrUJ1YJxiQS7OblrelqNSgOa7PqncHc2c6jpMFXWCIJPRsfJfYmu3YAHWeHAxuT0g== Received: from BN9PR03CA0525.namprd03.prod.outlook.com (2603:10b6:408:131::20) by BN8PR12MB3073.namprd12.prod.outlook.com (2603:10b6:408:66::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Sun, 28 Nov 2021 15:00:04 +0000 Received: from BN8NAM11FT040.eop-nam11.prod.protection.outlook.com (2603:10b6:408:131:cafe::3e) by BN9PR03CA0525.outlook.office365.com (2603:10b6:408:131::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23 via Frontend Transport; Sun, 28 Nov 2021 15:00:04 +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 BN8NAM11FT040.mail.protection.outlook.com (10.13.177.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4734.22 via Frontend Transport; Sun, 28 Nov 2021 15:00:04 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 28 Nov 2021 15:00:02 +0000 From: Xueming Li To: Gregory Etelson CC: Luca Boccassi , Viacheslav Ovsiienko , dpdk stable Subject: patch 'net/mlx5: fix GRE protocol type translation' has been queued to stable release 20.11.4 Date: Sun, 28 Nov 2021 22:53:52 +0800 Message-ID: <20211128145423.3974892-49-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211128145423.3974892-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> <20211128145423.3974892-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8e1cb002-79b0-4daf-9d26-08d9b27fc2ce X-MS-TrafficTypeDiagnostic: BN8PR12MB3073: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Cniifu0apBljKh1Dc9/1CiF9vBpHTvSVfvxjfQyYeRTj+VNMs+TSf9W+X3OMlAyksIBCvKfP9HTKocFAWqh3WbbZQ/lGhBHkl6/GAC0VGbaVKEvlvx2hMVIiaDG7USJgXQmhu/s9lvIX68x4XDt8B/GmrfxQR9K1FYPNu9oV54lznPvWdlOsqhMXEpM3IfSrJ211YfvAlgdqOqYW3oc/oWUUi8pTnxEPT18MAyQUT86XO4O4cNz8PK2hIAY+nQGCYMQh272z/uzDQc2gz0aUCfVZwVsdBwxhIQml9eCG5rKZaJ3hKWrroHO1KCFXgKC6oiVPC5vtwwxddBwJD4FQobpYE5fXKw5IJ3fQzYLBTrYBtIAkTSh5v631dQQzzKzQtEWeuFxGALitU1RMIQdkIHzJMWPJHUk5yLaWr5K8BeW/PcYGc+usbOjc21t7v63SsJMssivkyePsQAPQV5fJoLah+VomS8S+VXdJ3MC+vMvZ0KdjujJ1oOoD0NQNrmZds8z4ZdPJieQs9q1Stn36O7s1X+8BitqbXfppIK4zcTVnEjZ2/n8CWyEZfVUv23LK1Rla8F6jk6fGtVOhCE6X2x2kylBbpOEu/sKVCkzFHzodJcjsuP2rtIa3Rrj6DbPwmqtE7Dqj2J1CVbMEi2lBNnYTJ5YrZmnmyRsIOksIFW/hM2byIHTLTufF3Eh5LyfCqhJcxtl4OihhoEMorp4gnkEXb2UizTJtoD6qzu7BuoxS6z1uASFydL2PvcJRGr72m0u1BG5BqpRVcHlDemGnZbgGUtRfctBnsjNxamVsFskjmftnPtDMXz/uOc4ZqZ/AWcsvTm37tMAQz527vcwvzw== 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)(7696005)(508600001)(5660300002)(356005)(70586007)(1076003)(6862004)(7636003)(70206006)(83380400001)(426003)(4326008)(86362001)(40140700001)(966005)(47076005)(55016003)(8676002)(53546011)(2616005)(26005)(36756003)(4001150100001)(36860700001)(6666004)(37006003)(186003)(2906002)(54906003)(82310400004)(16526019)(336012)(316002)(8936002)(6286002)(6636002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2021 15:00:04.6868 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e1cb002-79b0-4daf-9d26-08d9b27fc2ce 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: BN8NAM11FT040.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3073 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 20.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/30/21. 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://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/a12dd597cdabdacf66df697ac60546ad0cbeb401 Thanks. Xueming Li --- >From a12dd597cdabdacf66df697ac60546ad0cbeb401 Mon Sep 17 00:00:00 2001 From: Gregory Etelson Date: Sun, 14 Nov 2021 17:36:16 +0200 Subject: [PATCH] net/mlx5: fix GRE protocol type translation Cc: Xueming Li [ upstream commit be26e81bfc1cb681d3ee0764aa6733000869984a ] When application creates several flows to match on GRE tunnel without explicitly specifying GRE protocol type value in flow rules, PMD will translate that to zero mask. RDMA-CORE cannot distinguish between different inner flow types and produces identical matchers for each zero mask. The patch extracts inner header type from flow rule and forces it in GRE protocol type, if application did not specify any without explicitly specifying GRE protocol type value in flow rules, protocol type value. Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items") Signed-off-by: Gregory Etelson Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_dv.c | 70 +++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index b80bdc78ba..498b2137f7 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -7001,18 +7001,19 @@ flow_dv_translate_item_gre_key(void *matcher, void *key, * Flow matcher value. * @param[in] item * Flow pattern to translate. - * @param[in] inner - * Item is inner pattern. + * @param[in] pattern_flags + * Accumulated pattern flags. */ static void flow_dv_translate_item_gre(void *matcher, void *key, const struct rte_flow_item *item, - int inner) + uint64_t pattern_flags) { + static const struct rte_flow_item_gre empty_gre = {0,}; const struct rte_flow_item_gre *gre_m = item->mask; const struct rte_flow_item_gre *gre_v = item->spec; - void *headers_m; - void *headers_v; + void *headers_m = MLX5_ADDR_OF(fte_match_param, matcher, outer_headers); + void *headers_v = MLX5_ADDR_OF(fte_match_param, key, outer_headers); void *misc_m = MLX5_ADDR_OF(fte_match_param, matcher, misc_parameters); void *misc_v = MLX5_ADDR_OF(fte_match_param, key, misc_parameters); struct { @@ -7029,26 +7030,17 @@ flow_dv_translate_item_gre(void *matcher, void *key, uint16_t value; }; } gre_crks_rsvd0_ver_m, gre_crks_rsvd0_ver_v; + uint16_t protocol_m, protocol_v; - if (inner) { - headers_m = MLX5_ADDR_OF(fte_match_param, matcher, - inner_headers); - headers_v = MLX5_ADDR_OF(fte_match_param, key, inner_headers); - } else { - headers_m = MLX5_ADDR_OF(fte_match_param, matcher, - outer_headers); - headers_v = MLX5_ADDR_OF(fte_match_param, key, outer_headers); - } MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_protocol, 0xff); MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol, IPPROTO_GRE); - if (!gre_v) - return; - if (!gre_m) - gre_m = &rte_flow_item_gre_mask; - MLX5_SET(fte_match_set_misc, misc_m, gre_protocol, - rte_be_to_cpu_16(gre_m->protocol)); - MLX5_SET(fte_match_set_misc, misc_v, gre_protocol, - rte_be_to_cpu_16(gre_v->protocol & gre_m->protocol)); + if (!gre_v) { + gre_v = &empty_gre; + gre_m = &empty_gre; + } else { + if (!gre_m) + gre_m = &rte_flow_item_gre_mask; + } gre_crks_rsvd0_ver_m.value = rte_be_to_cpu_16(gre_m->c_rsvd0_ver); gre_crks_rsvd0_ver_v.value = rte_be_to_cpu_16(gre_v->c_rsvd0_ver); MLX5_SET(fte_match_set_misc, misc_m, gre_c_present, @@ -7066,6 +7058,16 @@ flow_dv_translate_item_gre(void *matcher, void *key, MLX5_SET(fte_match_set_misc, misc_v, gre_s_present, gre_crks_rsvd0_ver_v.s_present & gre_crks_rsvd0_ver_m.s_present); + protocol_m = rte_be_to_cpu_16(gre_m->protocol); + protocol_v = rte_be_to_cpu_16(gre_v->protocol); + if (!protocol_m) { + /* Force next protocol to prevent matchers duplication */ + protocol_m = 0xFFFF; + protocol_v = mlx5_translate_tunnel_etypes(pattern_flags); + } + MLX5_SET(fte_match_set_misc, misc_m, gre_protocol, protocol_m); + MLX5_SET(fte_match_set_misc, misc_v, gre_protocol, + protocol_m & protocol_v); } /** @@ -7077,13 +7079,13 @@ flow_dv_translate_item_gre(void *matcher, void *key, * Flow matcher value. * @param[in] item * Flow pattern to translate. - * @param[in] inner - * Item is inner pattern. + * @param[in] pattern_flags + * Accumulated pattern flags. */ static void flow_dv_translate_item_nvgre(void *matcher, void *key, const struct rte_flow_item *item, - int inner) + unsigned long pattern_flags) { const struct rte_flow_item_nvgre *nvgre_m = item->mask; const struct rte_flow_item_nvgre *nvgre_v = item->spec; @@ -7110,7 +7112,7 @@ flow_dv_translate_item_nvgre(void *matcher, void *key, .mask = &gre_mask, .last = NULL, }; - flow_dv_translate_item_gre(matcher, key, &gre_item, inner); + flow_dv_translate_item_gre(matcher, key, &gre_item, pattern_flags); if (!nvgre_v) return; if (!nvgre_m) @@ -10547,10 +10549,9 @@ flow_dv_translate(struct rte_eth_dev *dev, MLX5_FLOW_LAYER_OUTER_L4_UDP; break; case RTE_FLOW_ITEM_TYPE_GRE: - flow_dv_translate_item_gre(match_mask, match_value, - items, tunnel); matcher.priority = MLX5_TUNNEL_PRIO_GET(rss_desc); last_item = MLX5_FLOW_LAYER_GRE; + tunnel_item = items; break; case RTE_FLOW_ITEM_TYPE_GRE_KEY: flow_dv_translate_item_gre_key(match_mask, @@ -10558,10 +10559,9 @@ flow_dv_translate(struct rte_eth_dev *dev, last_item = MLX5_FLOW_LAYER_GRE_KEY; break; case RTE_FLOW_ITEM_TYPE_NVGRE: - flow_dv_translate_item_nvgre(match_mask, match_value, - items, tunnel); matcher.priority = MLX5_TUNNEL_PRIO_GET(rss_desc); last_item = MLX5_FLOW_LAYER_GRE; + tunnel_item = items; break; case RTE_FLOW_ITEM_TYPE_VXLAN: flow_dv_translate_item_vxlan(match_mask, match_value, @@ -10672,6 +10672,16 @@ flow_dv_translate(struct rte_eth_dev *dev, else if (item_flags & MLX5_FLOW_LAYER_GENEVE) flow_dv_translate_item_geneve(match_mask, match_value, tunnel_item, item_flags); + else if (item_flags & MLX5_FLOW_LAYER_GRE) { + if (tunnel_item->type == RTE_FLOW_ITEM_TYPE_GRE) + flow_dv_translate_item_gre(match_mask, match_value, + tunnel_item, item_flags); + else if (tunnel_item->type == RTE_FLOW_ITEM_TYPE_NVGRE) + flow_dv_translate_item_nvgre(match_mask, match_value, + tunnel_item, item_flags); + else + MLX5_ASSERT(false); + } #ifdef RTE_LIBRTE_MLX5_DEBUG MLX5_ASSERT(!flow_dv_check_valid_spec(matcher.mask.buf, dev_flow->dv.value.buf)); -- 2.34.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-28 22:41:05.810489890 +0800 +++ 0048-net-mlx5-fix-GRE-protocol-type-translation.patch 2021-11-28 22:41:03.366873469 +0800 @@ -1 +1 @@ -From be26e81bfc1cb681d3ee0764aa6733000869984a Mon Sep 17 00:00:00 2001 +From a12dd597cdabdacf66df697ac60546ad0cbeb401 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit be26e81bfc1cb681d3ee0764aa6733000869984a ] @@ -18 +20,0 @@ -Cc: stable@dpdk.org @@ -27 +29 @@ -index bce504391d..287a17d956 100644 +index b80bdc78ba..498b2137f7 100644 @@ -30 +32 @@ -@@ -8730,18 +8730,19 @@ flow_dv_translate_item_gre_key(void *matcher, void *key, +@@ -7001,18 +7001,19 @@ flow_dv_translate_item_gre_key(void *matcher, void *key, @@ -55 +57 @@ -@@ -8758,26 +8759,17 @@ flow_dv_translate_item_gre(void *matcher, void *key, +@@ -7029,26 +7030,17 @@ flow_dv_translate_item_gre(void *matcher, void *key, @@ -90 +92 @@ -@@ -8795,6 +8787,16 @@ flow_dv_translate_item_gre(void *matcher, void *key, +@@ -7066,6 +7058,16 @@ flow_dv_translate_item_gre(void *matcher, void *key, @@ -107 +109 @@ -@@ -8806,13 +8808,13 @@ flow_dv_translate_item_gre(void *matcher, void *key, +@@ -7077,13 +7079,13 @@ flow_dv_translate_item_gre(void *matcher, void *key, @@ -124 +126 @@ -@@ -8839,7 +8841,7 @@ flow_dv_translate_item_nvgre(void *matcher, void *key, +@@ -7110,7 +7112,7 @@ flow_dv_translate_item_nvgre(void *matcher, void *key, @@ -133 +135 @@ -@@ -13434,10 +13436,9 @@ flow_dv_translate(struct rte_eth_dev *dev, +@@ -10547,10 +10549,9 @@ flow_dv_translate(struct rte_eth_dev *dev, @@ -145 +147 @@ -@@ -13445,10 +13446,9 @@ flow_dv_translate(struct rte_eth_dev *dev, +@@ -10558,10 +10559,9 @@ flow_dv_translate(struct rte_eth_dev *dev, @@ -156,2 +158,2 @@ - flow_dv_translate_item_vxlan(dev, attr, -@@ -13597,6 +13597,16 @@ flow_dv_translate(struct rte_eth_dev *dev, + flow_dv_translate_item_vxlan(match_mask, match_value, +@@ -10672,6 +10672,16 @@ flow_dv_translate(struct rte_eth_dev *dev,