DPDK patches and discussions
 help / color / mirror / Atom feed
From: Lior Margalit <lmargalit@nvidia.com>
To: Matan Azrad <matan@nvidia.com>
Cc: Lior Margalit <lmargalit@nvidia.com>, <dev@dpdk.org>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH v2 1/2] net/mlx5: fix RSS L4 proto selection flags settings
Date: Tue, 27 Jul 2021 09:46:19 +0300	[thread overview]
Message-ID: <20210727064620.880417-2-lmargalit@nvidia.com> (raw)
In-Reply-To: <20210727064620.880417-1-lmargalit@nvidia.com>

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")
Cc: stable@dpdk.org

Signed-off-by: Lior Margalit <lmargalit@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 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 736227bc0c..fe922b6fbe 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -10896,10 +10896,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))) {
@@ -10922,6 +10920,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.
+		 */
+		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) {
@@ -10947,6 +10951,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 7b3d0b320d..a36b8adf6b 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -1821,8 +1821,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));
@@ -1833,8 +1834,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.25.1


  reply	other threads:[~2021-07-27  6:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13 12:54 [dpdk-dev] [PATCH v1] net/mlx5: fix RSS " Lior Margalit
2021-07-15  8:28 ` Raslan Darawsheh
2021-07-27  6:46 ` [dpdk-dev] [PATCH v2 0/2] net/mlx5: prevent RSS distribution by L4 proto alone Lior Margalit
2021-07-27  6:46   ` Lior Margalit [this message]
2021-07-27  6:46   ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: fix queue num in RSS desc Lior Margalit
2021-07-28 13:08   ` [dpdk-dev] [PATCH v2 0/2] net/mlx5: prevent RSS distribution by L4 proto alone Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210727064620.880417-2-lmargalit@nvidia.com \
    --to=lmargalit@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).