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 73C67A034E for ; Mon, 21 Feb 2022 16:38:21 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D336410E0; Mon, 21 Feb 2022 16:38:21 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id C1E8C4013F for ; Mon, 21 Feb 2022 16:38:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645457899; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z87QpeopIjsccIJzPn9XwUyLdcADPOlPB6rM5KTV5XQ=; b=PGcKQ0Nmg8fNwwWhbCk1FIBeupHwPcASydSs6gJ7uj455ksSPZl+P0T/WuPRmHnuSOEb2C Is/Kw+2+GBayqIcn78AXqN+ESf+0hAW4dEpMblmqpHvXari2ZXplnybn/Xes1b2AL6GoEn P9MOe01DNlzK+ImiirxD86ZQyoUkUHY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-115-6nKAeZpcNESN-Z7E4MLhRw-1; Mon, 21 Feb 2022 10:38:13 -0500 X-MC-Unique: 6nKAeZpcNESN-Z7E4MLhRw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 912761091DA2; Mon, 21 Feb 2022 15:38:12 +0000 (UTC) Received: from rh.Home (unknown [10.39.195.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8BD587E2FA; Mon, 21 Feb 2022 15:38:11 +0000 (UTC) From: Kevin Traynor To: Gregory Etelson Cc: Matan Azrad , dpdk stable Subject: patch 'net/mlx5: fix GRE protocol type translation for Verbs' has been queued to stable release 21.11.1 Date: Mon, 21 Feb 2022 15:33:55 +0000 Message-Id: <20220221153625.152324-46-ktraynor@redhat.com> In-Reply-To: <20220221153625.152324-1-ktraynor@redhat.com> References: <20220221153625.152324-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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 21.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 02/26/22. 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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/379079d6ccf05d372f55e711ef194e4cb85fa4a6 Thanks. Kevin --- >From 379079d6ccf05d372f55e711ef194e4cb85fa4a6 Mon Sep 17 00:00:00 2001 From: Gregory Etelson Date: Thu, 23 Dec 2021 15:16:38 +0200 Subject: [PATCH] net/mlx5: fix GRE protocol type translation for Verbs [ upstream commit 985b479267aa90394f1c219de120d23e96761789 ] 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. Fixes: 84c406e74524 ("net/mlx5: add flow translate function") Signed-off-by: Gregory Etelson Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow.h | 14 +++++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 14 ----------- drivers/net/mlx5/mlx5_flow_verbs.c | 37 ++++++++++++++++++++---------- 3 files changed, 39 insertions(+), 26 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 8c131d61ae..125d85899c 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1451,4 +1451,18 @@ flow_aso_ct_get_by_idx(struct rte_eth_dev *dev, uint32_t own_idx) } +static inline uint16_t +mlx5_translate_tunnel_etypes(uint64_t pattern_flags) +{ + if (pattern_flags & MLX5_FLOW_LAYER_INNER_L2) + return RTE_ETHER_TYPE_TEB; + else if (pattern_flags & MLX5_FLOW_LAYER_INNER_L3_IPV4) + return RTE_ETHER_TYPE_IPV4; + else if (pattern_flags & MLX5_FLOW_LAYER_INNER_L3_IPV6) + return RTE_ETHER_TYPE_IPV6; + else if (pattern_flags & MLX5_FLOW_LAYER_MPLS) + return RTE_ETHER_TYPE_MPLS; + return 0; +} + int mlx5_flow_group_to_table(struct rte_eth_dev *dev, const struct mlx5_flow_tunnel *tunnel, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 5d9fbffd0e..0383976883 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -94,18 +94,4 @@ flow_dv_jump_tbl_resource_release(struct rte_eth_dev *dev, uint32_t rix_jump); -static inline uint16_t -mlx5_translate_tunnel_etypes(uint64_t pattern_flags) -{ - if (pattern_flags & MLX5_FLOW_LAYER_INNER_L2) - return RTE_ETHER_TYPE_TEB; - else if (pattern_flags & MLX5_FLOW_LAYER_INNER_L3_IPV4) - return RTE_ETHER_TYPE_IPV4; - else if (pattern_flags & MLX5_FLOW_LAYER_INNER_L3_IPV6) - return RTE_ETHER_TYPE_IPV6; - else if (pattern_flags & MLX5_FLOW_LAYER_MPLS) - return RTE_ETHER_TYPE_MPLS; - return 0; -} - static int16_t flow_dv_get_esw_manager_vport_id(struct rte_eth_dev *dev) diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 29cd694752..192a00d4fd 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -908,4 +908,5 @@ flow_verbs_translate_item_gre(struct mlx5_flow *dev_flow, }; #else + static const struct rte_flow_item_gre empty_gre = {0,}; const struct rte_flow_item_gre *spec = item->spec; const struct rte_flow_item_gre *mask = item->mask; @@ -916,15 +917,27 @@ flow_verbs_translate_item_gre(struct mlx5_flow *dev_flow, }; - if (!mask) - mask = &rte_flow_item_gre_mask; - if (spec) { - tunnel.val.c_ks_res0_ver = spec->c_rsvd0_ver; - tunnel.val.protocol = spec->protocol; - tunnel.mask.c_ks_res0_ver = mask->c_rsvd0_ver; - tunnel.mask.protocol = mask->protocol; - /* Remove unwanted bits from values. */ - tunnel.val.c_ks_res0_ver &= tunnel.mask.c_ks_res0_ver; + if (!spec) { + spec = &empty_gre; + mask = &empty_gre; + } else { + if (!mask) + mask = &rte_flow_item_gre_mask; + } + tunnel.val.c_ks_res0_ver = spec->c_rsvd0_ver; + tunnel.val.protocol = spec->protocol; + tunnel.mask.c_ks_res0_ver = mask->c_rsvd0_ver; + tunnel.mask.protocol = mask->protocol; + /* Remove unwanted bits from values. */ + tunnel.val.c_ks_res0_ver &= tunnel.mask.c_ks_res0_ver; + tunnel.val.key &= tunnel.mask.key; + if (tunnel.mask.protocol) { tunnel.val.protocol &= tunnel.mask.protocol; - tunnel.val.key &= tunnel.mask.key; + } else { + tunnel.val.protocol = mlx5_translate_tunnel_etypes(item_flags); + if (tunnel.val.protocol) { + tunnel.mask.protocol = 0xFFFF; + tunnel.val.protocol = + rte_cpu_to_be_16(tunnel.val.protocol); + } } #endif @@ -1804,6 +1817,4 @@ flow_verbs_translate(struct rte_eth_dev *dev, break; case RTE_FLOW_ITEM_TYPE_GRE: - flow_verbs_translate_item_gre(dev_flow, items, - item_flags); subpriority = MLX5_TUNNEL_PRIO_GET(rss_desc); item_flags |= MLX5_FLOW_LAYER_GRE; @@ -1821,4 +1832,6 @@ flow_verbs_translate(struct rte_eth_dev *dev, } } + if (item_flags & MLX5_FLOW_LAYER_GRE) + flow_verbs_translate_item_gre(dev_flow, items, item_flags); dev_flow->handle->layers = item_flags; /* Other members of attr will be ignored. */ -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-21 15:22:45.642095794 +0000 +++ 0046-net-mlx5-fix-GRE-protocol-type-translation-for-Verbs.patch 2022-02-21 15:22:44.104704155 +0000 @@ -1 +1 @@ -From 985b479267aa90394f1c219de120d23e96761789 Mon Sep 17 00:00:00 2001 +From 379079d6ccf05d372f55e711ef194e4cb85fa4a6 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 985b479267aa90394f1c219de120d23e96761789 ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org