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 82BFDA0032 for ; Fri, 18 Feb 2022 13:40:33 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E4E14113F; Fri, 18 Feb 2022 13:40:33 +0100 (CET) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by mails.dpdk.org (Postfix) with ESMTP id D667D40395 for ; Fri, 18 Feb 2022 13:40:31 +0100 (CET) Received: by mail-wr1-f42.google.com with SMTP id o24so14395509wro.3 for ; Fri, 18 Feb 2022 04:40:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x8vR5Seyo7wYQO3RO1HwXfNcilsnR6CTLchPM9oRbUU=; b=TTaN1C0U3XTWYLeDOuPhift2UVR9+tIpCSNTmVpIfeTPMU4/OtLzeTC+/GS/Lmj7cw CjJFoi6JyP30udoy4aYn61lnpVOvw9EQqDZv/Rr6trNo4F+iihg72L7ltL40SSUydiaX vKxVb7YEiuInrKW5h2uVVsfXWSxNKesM5jT2FV5UxISQIwar0OC+yMPPZxPguL6VHi3l /AWcjXQf/DBKwYAgmGJu7gSqsviisdbnTXuclKfzjv2RpunKyQf+F9bd6rZbyT+CZn9z 4/Az1fZEfgyOiwJ40v7RKmmGXkahORMSkgV0j6thgxhckmcD5zet2y0XPv9H8SyWOfpI VMOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x8vR5Seyo7wYQO3RO1HwXfNcilsnR6CTLchPM9oRbUU=; b=OZp2HOTwkKlR31EgYYyuqc2bagtYbIoTiCU5smozXXt23EcOxK/efrXILpaAS2hKwz UGg8mdiup+yndo4AUr7L6UeuP2OSjbmNSnN5qObo0QzoBSYVOZGzUfMHDaS10xnq4WZE n5Wrpl6Tb7kANRf98LcRWD29bnn+PTSZzQ90+KWUo257WlwXlGK4k/AY7hEmw4FJwtVR Q74qyfEOEdIThfA1eLtIe56tVwcQKWv2+jCZ/UcruZXNqJBenJnRxiHJXuWzrwk34FX5 LApKtmAt1clEU9St7oWSM0FjwfMurq3Ax6IR8gmbpjO3vDXlcp8KL/cULJtaQ0GtBu05 sEjQ== X-Gm-Message-State: AOAM53315XeXwsAoDGB2fS3E82MXhHjWi4LDcKjyGRpcNh4F82nFVUyA qNcyaElvh2m1iavCeyusvy46hLUJOVPchtuM X-Google-Smtp-Source: ABdhPJxnbHPIo8oj+dQCor9jvrirrGf+7Hy9ibBhoapfQW3fwKukFY8sBVW2wp21VoIFCmg9yE1ROg== X-Received: by 2002:a05:6000:1882:b0:1d6:1d94:271e with SMTP id a2-20020a056000188200b001d61d94271emr6011103wri.555.1645188031524; Fri, 18 Feb 2022 04:40:31 -0800 (PST) Received: from localhost ([2a01:4b00:f41a:3600:360b:9754:2e3a:c344]) by smtp.gmail.com with ESMTPSA id az21sm4025999wmb.11.2022.02.18.04.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 04:40:31 -0800 (PST) From: luca.boccassi@gmail.com 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 20.11.5 Date: Fri, 18 Feb 2022 12:37:49 +0000 Message-Id: <20220218123931.1749595-20-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220218123931.1749595-1-luca.boccassi@gmail.com> References: <20220218123931.1749595-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.5 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/20/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/0374774e882a3a724cb39aac839adf2f483ab478 Thanks. Luca Boccassi --- >From 0374774e882a3a724cb39aac839adf2f483ab478 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 7d42edaacc..ed5f94a9a0 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1287,6 +1287,20 @@ tunnel_use_standard_attr_group_translate return verdict; } +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, uint32_t group, uint32_t *table, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 57d8d79286..c134e24c0e 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -84,20 +84,6 @@ flow_dv_port_id_action_resource_release(struct rte_eth_dev *dev, static void flow_dv_shared_rss_action_release(struct rte_eth_dev *dev, uint32_t srss); -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; -} - /** * Initialize flow attributes structure according to flow items' types. * diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index afe973019b..9c2fc1b25e 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -960,6 +960,7 @@ flow_verbs_translate_item_gre(struct mlx5_flow *dev_flow, .size = size, }; #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; unsigned int size = sizeof(struct ibv_flow_spec_gre); @@ -968,17 +969,29 @@ flow_verbs_translate_item_gre(struct mlx5_flow *dev_flow, .size = size, }; - 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 if (item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV4) @@ -1846,8 +1859,6 @@ flow_verbs_translate(struct rte_eth_dev *dev, item_flags |= MLX5_FLOW_LAYER_VXLAN_GPE; 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; break; @@ -1863,6 +1874,8 @@ flow_verbs_translate(struct rte_eth_dev *dev, NULL, "item not supported"); } } + 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. */ dev_flow->verbs.attr.priority = -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-18 12:37:38.923842047 +0000 +++ 0020-net-mlx5-fix-GRE-protocol-type-translation-for-Verbs.patch 2022-02-18 12:37:37.554788882 +0000 @@ -1 +1 @@ -From 985b479267aa90394f1c219de120d23e96761789 Mon Sep 17 00:00:00 2001 +From 0374774e882a3a724cb39aac839adf2f483ab478 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 985b479267aa90394f1c219de120d23e96761789 ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -27 +28 @@ -index 8c131d61ae..125d85899c 100644 +index 7d42edaacc..ed5f94a9a0 100644 @@ -30,2 +31,2 @@ -@@ -1450,6 +1450,20 @@ flow_aso_ct_get_by_idx(struct rte_eth_dev *dev, uint32_t own_idx) - return ct; +@@ -1287,6 +1287,20 @@ tunnel_use_standard_attr_group_translate + return verdict; @@ -52 +53 @@ -index 5d9fbffd0e..0383976883 100644 +index 57d8d79286..c134e24c0e 100644 @@ -55,3 +56,3 @@ -@@ -93,20 +93,6 @@ static int - flow_dv_jump_tbl_resource_release(struct rte_eth_dev *dev, - uint32_t rix_jump); +@@ -84,20 +84,6 @@ flow_dv_port_id_action_resource_release(struct rte_eth_dev *dev, + static void + flow_dv_shared_rss_action_release(struct rte_eth_dev *dev, uint32_t srss); @@ -73,3 +74,3 @@ - static int16_t - flow_dv_get_esw_manager_vport_id(struct rte_eth_dev *dev) - { + /** + * Initialize flow attributes structure according to flow items' types. + * @@ -77 +78 @@ -index 29cd694752..192a00d4fd 100644 +index afe973019b..9c2fc1b25e 100644 @@ -80 +81 @@ -@@ -907,6 +907,7 @@ flow_verbs_translate_item_gre(struct mlx5_flow *dev_flow, +@@ -960,6 +960,7 @@ flow_verbs_translate_item_gre(struct mlx5_flow *dev_flow, @@ -88 +89 @@ -@@ -915,17 +916,29 @@ flow_verbs_translate_item_gre(struct mlx5_flow *dev_flow, +@@ -968,17 +969,29 @@ flow_verbs_translate_item_gre(struct mlx5_flow *dev_flow, @@ -128 +129 @@ -@@ -1803,8 +1816,6 @@ flow_verbs_translate(struct rte_eth_dev *dev, +@@ -1846,8 +1859,6 @@ flow_verbs_translate(struct rte_eth_dev *dev, @@ -137 +138 @@ -@@ -1820,6 +1831,8 @@ flow_verbs_translate(struct rte_eth_dev *dev, +@@ -1863,6 +1874,8 @@ flow_verbs_translate(struct rte_eth_dev *dev,