patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Xiaoyu Min <jackmin@nvidia.com>
To: <stable@dpdk.org>
Cc: <christian.ehrhardt@canonical.com>,
	Jiawei Wang <jiaweiw@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Subject: [dpdk-stable] [PATCH 19.11 1/4] net/mlx5: fix RSS flow item expansion for GRE key
Date: Sat, 14 Aug 2021 15:19:33 +0800	[thread overview]
Message-ID: <92dd0fdda732f11ac710f011086cd5ae9c05fa2d.1628923046.git.jackmin@nvidia.com> (raw)
In-Reply-To: <cover.1628923046.git.jackmin@nvidia.com>

From: Jiawei Wang <jiaweiw@nvidia.com>

[ upstream commit 09546d7b01927b5e31fdb51eea1f4ccc3abac5d2 ]

The support of RSS expansion for the flows with IPv6 GRE item was added
to mlx5 PMD. And the GRE KEY item support in expansion was missed
and the flows with GRE and GRE KEY items were expanded in the wrong
way causing the flow creation failure.

This patch adds the RSS expansion support for GRE KEY and mlx5 PMD
performs RSS expansion correctly.

Fixes: e0632c72b5a6 ("net/mlx5: support RSS expansion for IPv6 GRE")

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Xiaoyu Min <jackmin@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c        | 10 +++++++++-
 lib/librte_ethdev/rte_flow.c        |  4 ++--
 lib/librte_ethdev/rte_flow_driver.h |  2 ++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 005171d09..f29438ad6 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -72,6 +72,7 @@ enum mlx5_expansion {
 	MLX5_EXPANSION_VXLAN,
 	MLX5_EXPANSION_VXLAN_GPE,
 	MLX5_EXPANSION_GRE,
+	MLX5_EXPANSION_GRE_KEY,
 	MLX5_EXPANSION_MPLS,
 	MLX5_EXPANSION_ETH,
 	MLX5_EXPANSION_ETH_VLAN,
@@ -179,9 +180,16 @@ static const struct rte_flow_expand_node mlx5_support_expansion[] = {
 	},
 	[MLX5_EXPANSION_GRE] = {
 		.next = RTE_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_IPV4,
-						  MLX5_EXPANSION_IPV6),
+						 MLX5_EXPANSION_IPV6,
+						 MLX5_EXPANSION_GRE_KEY),
 		.type = RTE_FLOW_ITEM_TYPE_GRE,
 	},
+	[MLX5_EXPANSION_GRE_KEY] = {
+		.next = RTE_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_IPV4,
+						  MLX5_EXPANSION_IPV6),
+		.type = RTE_FLOW_ITEM_TYPE_GRE_KEY,
+		.optional = 1,
+	},
 	[MLX5_EXPANSION_MPLS] = {
 		.next = RTE_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_IPV4,
 						 MLX5_EXPANSION_IPV6),
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index cf0b46780..32b676ca0 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -1062,7 +1062,7 @@ rte_flow_expand_rss(struct rte_flow_expand_rss *buf, size_t size,
 		    const struct rte_flow_expand_node graph[],
 		    int graph_root_index)
 {
-	const int elt_n = 8;
+	const int elt_n = 16;
 	const struct rte_flow_item *item;
 	const struct rte_flow_expand_node *node = &graph[graph_root_index];
 	const int *next_node;
@@ -1185,7 +1185,7 @@ rte_flow_expand_rss(struct rte_flow_expand_rss *buf, size_t size,
 			}
 		}
 		/* Go deeper. */
-		if (node->next) {
+		if (!node->optional && node->next) {
 			next_node = node->next;
 			if (stack_pos++ == elt_n) {
 				rte_errno = E2BIG;
diff --git a/lib/librte_ethdev/rte_flow_driver.h b/lib/librte_ethdev/rte_flow_driver.h
index a0359853e..d608d25d3 100644
--- a/lib/librte_ethdev/rte_flow_driver.h
+++ b/lib/librte_ethdev/rte_flow_driver.h
@@ -133,6 +133,8 @@ struct rte_flow_expand_node {
 	 * RSS types bit-field associated with this node
 	 * (see ETH_RSS_* definitions).
 	 */
+	uint8_t optional;
+	/**< optional expand field. Default 0 to expand, 1 not go deeper. */
 };
 
 /** Object returned by rte_flow_expand_rss(). */
-- 
2.32.0


  reply	other threads:[~2021-08-14  7:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-14  7:19 [dpdk-stable] [PATCH 19.11 0/4] fix MPLS & GRE key RSS expansion Xiaoyu Min
2021-08-14  7:19 ` Xiaoyu Min [this message]
2021-08-14  7:19 ` [dpdk-stable] [PATCH 19.11 2/4] net/mlx5: fix MPLS " Xiaoyu Min
2021-08-14  7:19 ` [dpdk-stable] [PATCH 19.11 3/4] net/mlx5: limit inner RSS expansion for MPLS Xiaoyu Min
2021-08-14  7:19 ` [dpdk-stable] [PATCH 19.11 4/4] net/mlx5: limit implicit MPLS RSS expansion over GRE Xiaoyu Min
2021-08-16  9:01 ` [dpdk-stable] [PATCH 19.11 0/4] fix MPLS & GRE key RSS expansion Christian Ehrhardt

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=92dd0fdda732f11ac710f011086cd5ae9c05fa2d.1628923046.git.jackmin@nvidia.com \
    --to=jackmin@nvidia.com \
    --cc=christian.ehrhardt@canonical.com \
    --cc=jiaweiw@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@nvidia.com \
    /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).