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 D2E42A0A0C for ; Tue, 3 Aug 2021 14:22:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC8EF40E3C; Tue, 3 Aug 2021 14:22:37 +0200 (CEST) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mails.dpdk.org (Postfix) with ESMTP id E9EF5411D5 for ; Tue, 3 Aug 2021 14:22:36 +0200 (CEST) Received: by mail-wm1-f50.google.com with SMTP id f9-20020a05600c1549b029025b0f5d8c6cso1596017wmg.4 for ; Tue, 03 Aug 2021 05:22:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JgE37TDF2WCJC/jrtxzGYpO3/mbXiPh+DuvWojubrqs=; b=CHZOAncbWgepQutRPJZ+1MsyjvvNLRf9ocZdZZSHbUBh0gmuc5WaVPbisLmT4oUMGJ BjocDajcI5vF3Ggb2NjGLMVqTbbDyqWHwyNtZWFMXz3XEmhMFvJz+y6u4Fy86fIMei2F 9tS/k31X6jxucqZFuORwtq0YHP1t85qakskmrNqc3Jzyj9U49oRjuRIUAM6mHSmn995/ ABfu3c/CcKWtWPHdt44r/rBjGMpkMQtDl1YP909SBfZRJJHUZ4wiTf3g2x7du6sYaXJb wK8o23r3XfdckJ8ecjnQHi1nAKVC2MJ96ooZf5gMrfbykFhrRsb3B4DIAJPVis395DlF 1pfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JgE37TDF2WCJC/jrtxzGYpO3/mbXiPh+DuvWojubrqs=; b=L0Gi5w32vCJ3AmfwEQUwyyeOA1dFNA7HfL4WSMtv0o+P9VsgYGvORdaDdx4zM4Xa0E VVcPGsnzf4DHBCS8ULTYsqJIOxfx0DJTy28piLaC8S9q6BHKiQuao+IRxPeynzVB5iDT wB8YBzhwZBG4YwQ7nT0Jvo9vIKnbFaYcUBW88FOEbo6XP4RTVtXe9IX84KK8CwIq3APa sNefxBo+lNvbe2HEVciyypOJ6F90ijs1bxBlk22CjH9FTEBKK9+v3lIQT5ClWEIooS1j qhZ1ydYDCMVz+dUloO0ia6bSw55lHR4MdmlboHnDNuGH91QljxU2J2/kjybUhbvg79RV gLow== X-Gm-Message-State: AOAM530ZOCFpfUAp/7XhdnUU9vIn+6s8f+niNt2iHlkDU5esDu77P+aq 3o3s7ehuKzcZMb7ecv+KkXs= X-Google-Smtp-Source: ABdhPJwOoa5Thplv1A10PXjcL2yJe8S2/lrXIAYMPor87pACcQW4YWz57j2EfGYGRPzJSTXWMvJP2g== X-Received: by 2002:a1c:4602:: with SMTP id t2mr21622798wma.87.1627993356727; Tue, 03 Aug 2021 05:22:36 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id p4sm13852995wre.83.2021.08.03.05.22.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 05:22:36 -0700 (PDT) From: luca.boccassi@gmail.com To: Lior Margalit Cc: Matan Azrad , dpdk stable Date: Tue, 3 Aug 2021 13:21:57 +0100 Message-Id: <20210803122214.1094992-8-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210803122214.1094992-1-luca.boccassi@gmail.com> References: <20210726135322.149850-59-luca.boccassi@gmail.com> <20210803122214.1094992-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx5: fix RSS flow rule with L4 mismatch' has been queued to stable release 20.11.3 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/05/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/38779aa845b795564285908359db7e7318fffa98 Thanks. Luca Boccassi --- >From 38779aa845b795564285908359db7e7318fffa98 Mon Sep 17 00:00:00 2001 From: Lior Margalit Date: Tue, 27 Jul 2021 09:46:19 +0300 Subject: [PATCH] net/mlx5: fix RSS flow rule with L4 mismatch [ upstream commit 5e1db76dd8c740629ef0e9569099bf67a3cbbf9d ] The RSS hash types defined in the API do not support setting the L4 proto type (TCP or UDP) without setting the L3 proto. For example, ETH_RSS_TCP is defined as (ETH_RSS_NONFRAG_IPV4_TCP | \ ETH_RSS_NONFRAG_IPV6_TCP | \ ETH_RSS_IPV6_TCP_EX). The L3 proto of the RSS hash type may be different than the one defined in the pattern, for example: testpmd> flow create .../ ipv4 / tcp / end actions rss types ipv6-tcp-ex end / end If the RSS hash type also includes L4 proto type as in the above example, the selection flags for the RX hash are currently set with SPORT/DPORT without setting SRC/DST IP. As this combination is not supported, it does not match any of the pre-created TIRs of the indirect RSS action and the flow creation fails. The fix is to prevent setting the selection flags for the RX hash with SPORT/DPORT without setting SRC/DST IP. It applies non-RSS processing of the received packets. In case of indirect RSS action, it will match the MLX5_RSS_HASH_NONE pre-created TIR. Fixes: b1d63d829378 ("net/mlx5: support RSS on src or dst fields only") Fixes: 4a78c88e3bae ("net/mlx5: fix Verbs flow tunnel") Signed-off-by: Lior Margalit Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_dv.c | 12 +++++++++--- drivers/net/mlx5/mlx5_flow_verbs.c | 10 ++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 3e5c8d3af9..2a86b03bf9 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -8616,10 +8616,8 @@ flow_dv_hashfields_set(struct mlx5_flow *dev_flow, dev_flow->hash_fields = 0; #ifdef HAVE_IBV_DEVICE_TUNNEL_SUPPORT - if (rss_desc->level >= 2) { - dev_flow->hash_fields |= IBV_RX_HASH_INNER; + if (rss_desc->level >= 2) rss_inner = 1; - } #endif if ((rss_inner && (items & MLX5_FLOW_LAYER_INNER_L3_IPV4)) || (!rss_inner && (items & MLX5_FLOW_LAYER_OUTER_L3_IPV4))) { @@ -8642,6 +8640,12 @@ flow_dv_hashfields_set(struct mlx5_flow *dev_flow, dev_flow->hash_fields |= MLX5_IPV6_IBV_RX_HASH; } } + if (dev_flow->hash_fields == 0) + /* + * There is no match between the RSS types and the + * L3 protocol (IPv4/IPv6) defined in the flow rule. + */ + return; if ((rss_inner && (items & MLX5_FLOW_LAYER_INNER_L4_UDP)) || (!rss_inner && (items & MLX5_FLOW_LAYER_OUTER_L4_UDP))) { if (rss_types & ETH_RSS_UDP) { @@ -8667,6 +8671,8 @@ flow_dv_hashfields_set(struct mlx5_flow *dev_flow, dev_flow->hash_fields |= MLX5_TCP_IBV_RX_HASH; } } + if (rss_inner) + dev_flow->hash_fields |= IBV_RX_HASH_INNER; } /** diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index bd060e9d44..afe973019b 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -1811,8 +1811,9 @@ flow_verbs_translate(struct rte_eth_dev *dev, flow_verbs_translate_item_tcp(dev_flow, items, item_flags); subpriority = MLX5_PRIORITY_MAP_L4; - dev_flow->hash_fields |= - mlx5_flow_hashfields_adjust + if (dev_flow->hash_fields != 0) + dev_flow->hash_fields |= + mlx5_flow_hashfields_adjust (rss_desc, tunnel, ETH_RSS_TCP, (IBV_RX_HASH_SRC_PORT_TCP | IBV_RX_HASH_DST_PORT_TCP)); @@ -1823,8 +1824,9 @@ flow_verbs_translate(struct rte_eth_dev *dev, flow_verbs_translate_item_udp(dev_flow, items, item_flags); subpriority = MLX5_PRIORITY_MAP_L4; - dev_flow->hash_fields |= - mlx5_flow_hashfields_adjust + if (dev_flow->hash_fields != 0) + dev_flow->hash_fields |= + mlx5_flow_hashfields_adjust (rss_desc, tunnel, ETH_RSS_UDP, (IBV_RX_HASH_SRC_PORT_UDP | IBV_RX_HASH_DST_PORT_UDP)); -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-08-03 12:35:08.551663693 +0100 +++ 0008-net-mlx5-fix-RSS-flow-rule-with-L4-mismatch.patch 2021-08-03 12:35:08.202818489 +0100 @@ -1 +1 @@ -From 5e1db76dd8c740629ef0e9569099bf67a3cbbf9d Mon Sep 17 00:00:00 2001 +From 38779aa845b795564285908359db7e7318fffa98 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 5e1db76dd8c740629ef0e9569099bf67a3cbbf9d ] + @@ -31 +32,0 @@ -Cc: stable@dpdk.org @@ -41 +42 @@ -index 736227bc0c..0538c8565c 100644 +index 3e5c8d3af9..2a86b03bf9 100644 @@ -44 +45 @@ -@@ -10896,10 +10896,8 @@ flow_dv_hashfields_set(struct mlx5_flow *dev_flow, +@@ -8616,10 +8616,8 @@ flow_dv_hashfields_set(struct mlx5_flow *dev_flow, @@ -56 +57 @@ -@@ -10922,6 +10920,12 @@ flow_dv_hashfields_set(struct mlx5_flow *dev_flow, +@@ -8642,6 +8640,12 @@ flow_dv_hashfields_set(struct mlx5_flow *dev_flow, @@ -69 +70 @@ -@@ -10947,6 +10951,8 @@ flow_dv_hashfields_set(struct mlx5_flow *dev_flow, +@@ -8667,6 +8671,8 @@ flow_dv_hashfields_set(struct mlx5_flow *dev_flow, @@ -79 +80 @@ -index 7b3d0b320d..a36b8adf6b 100644 +index bd060e9d44..afe973019b 100644 @@ -82 +83 @@ -@@ -1821,8 +1821,9 @@ flow_verbs_translate(struct rte_eth_dev *dev, +@@ -1811,8 +1811,9 @@ flow_verbs_translate(struct rte_eth_dev *dev, @@ -94 +95 @@ -@@ -1833,8 +1834,9 @@ flow_verbs_translate(struct rte_eth_dev *dev, +@@ -1823,8 +1824,9 @@ flow_verbs_translate(struct rte_eth_dev *dev,