patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 19.11 0/4] fix MPLS & GRE key RSS expansion
@ 2021-08-14  7:19 Xiaoyu Min
  2021-08-14  7:19 ` [dpdk-stable] [PATCH 19.11 1/4] net/mlx5: fix RSS flow item expansion for GRE key Xiaoyu Min
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Xiaoyu Min @ 2021-08-14  7:19 UTC (permalink / raw)
  To: stable; +Cc: christian.ehrhardt

This patch set backport RSS expansion fixs of MPLS and GRE key
as well as two other related patchs.

Jiawei Wang (1):
  net/mlx5: fix RSS flow item expansion for GRE key

Suanming Mou (1):
  net/mlx5: limit implicit MPLS RSS expansion over GRE

Xiaoyu Min (2):
  net/mlx5: fix MPLS RSS expansion
  net/mlx5: limit inner RSS expansion for MPLS

 drivers/net/mlx5/mlx5_flow.c        | 32 +++++++++++++++++++++++------
 lib/librte_ethdev/rte_flow.c        |  4 ++--
 lib/librte_ethdev/rte_flow_driver.h |  2 ++
 3 files changed, 30 insertions(+), 8 deletions(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-stable] [PATCH 19.11 1/4] net/mlx5: fix RSS flow item expansion for GRE key
  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
  2021-08-14  7:19 ` [dpdk-stable] [PATCH 19.11 2/4] net/mlx5: fix MPLS RSS expansion Xiaoyu Min
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Xiaoyu Min @ 2021-08-14  7:19 UTC (permalink / raw)
  To: stable; +Cc: christian.ehrhardt, Jiawei Wang, Viacheslav Ovsiienko

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-stable] [PATCH 19.11 2/4] net/mlx5: fix MPLS RSS expansion
  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 ` [dpdk-stable] [PATCH 19.11 1/4] net/mlx5: fix RSS flow item expansion for GRE key Xiaoyu Min
@ 2021-08-14  7:19 ` Xiaoyu Min
  2021-08-14  7:19 ` [dpdk-stable] [PATCH 19.11 3/4] net/mlx5: limit inner RSS expansion for MPLS Xiaoyu Min
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Xiaoyu Min @ 2021-08-14  7:19 UTC (permalink / raw)
  To: stable; +Cc: christian.ehrhardt, Matan Azrad

[ upstream commit 84f4764c22a32b319cb6fa7c8935b0d7977298cc ]

MPLSoUDP and MPLSoGRE are supported by PMD from
rte flow point of view.

RSS expansion doesn't support above but, instead, supports
normal MPLS over L2, which actually will be rejected by PMD.

This patch removes RSS expansion support of the MPLS over L2
and adds support of MPLSoUDP and MPLSoGRE.

In addition to above, support for eth over MPLS expansion is
added too.

Fixes: a4a5cd21d20a ("net/mlx5: add flow MPLS item")

Signed-off-by: Xiaoyu Min <jackmin@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index f29438ad6..0f0c779ca 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -109,8 +109,7 @@ static const struct rte_flow_expand_node mlx5_support_expansion[] = {
 	},
 	[MLX5_EXPANSION_OUTER_ETH] = {
 		.next = RTE_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_OUTER_IPV4,
-						 MLX5_EXPANSION_OUTER_IPV6,
-						 MLX5_EXPANSION_MPLS),
+						 MLX5_EXPANSION_OUTER_IPV6),
 		.type = RTE_FLOW_ITEM_TYPE_ETH,
 		.rss_types = 0,
 	},
@@ -137,7 +136,8 @@ static const struct rte_flow_expand_node mlx5_support_expansion[] = {
 	},
 	[MLX5_EXPANSION_OUTER_IPV4_UDP] = {
 		.next = RTE_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_VXLAN,
-						 MLX5_EXPANSION_VXLAN_GPE),
+						 MLX5_EXPANSION_VXLAN_GPE,
+						 MLX5_EXPANSION_MPLS),
 		.type = RTE_FLOW_ITEM_TYPE_UDP,
 		.rss_types = ETH_RSS_NONFRAG_IPV4_UDP,
 	},
@@ -158,7 +158,8 @@ static const struct rte_flow_expand_node mlx5_support_expansion[] = {
 	},
 	[MLX5_EXPANSION_OUTER_IPV6_UDP] = {
 		.next = RTE_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_VXLAN,
-						 MLX5_EXPANSION_VXLAN_GPE),
+						 MLX5_EXPANSION_VXLAN_GPE,
+						 MLX5_EXPANSION_MPLS),
 		.type = RTE_FLOW_ITEM_TYPE_UDP,
 		.rss_types = ETH_RSS_NONFRAG_IPV6_UDP,
 	},
@@ -181,18 +182,21 @@ 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_GRE_KEY),
+						 MLX5_EXPANSION_GRE_KEY,
+						 MLX5_EXPANSION_MPLS),
 		.type = RTE_FLOW_ITEM_TYPE_GRE,
 	},
 	[MLX5_EXPANSION_GRE_KEY] = {
 		.next = RTE_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_IPV4,
-						  MLX5_EXPANSION_IPV6),
+						  MLX5_EXPANSION_IPV6,
+						  MLX5_EXPANSION_MPLS),
 		.type = RTE_FLOW_ITEM_TYPE_GRE_KEY,
 		.optional = 1,
 	},
 	[MLX5_EXPANSION_MPLS] = {
 		.next = RTE_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_IPV4,
-						 MLX5_EXPANSION_IPV6),
+						 MLX5_EXPANSION_IPV6,
+						 MLX5_EXPANSION_ETH),
 		.type = RTE_FLOW_ITEM_TYPE_MPLS,
 	},
 	[MLX5_EXPANSION_ETH] = {
-- 
2.32.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-stable] [PATCH 19.11 3/4] net/mlx5: limit inner RSS expansion for MPLS
  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 ` [dpdk-stable] [PATCH 19.11 1/4] net/mlx5: fix RSS flow item expansion for GRE key Xiaoyu Min
  2021-08-14  7:19 ` [dpdk-stable] [PATCH 19.11 2/4] net/mlx5: fix MPLS RSS expansion Xiaoyu Min
@ 2021-08-14  7:19 ` 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
  4 siblings, 0 replies; 6+ messages in thread
From: Xiaoyu Min @ 2021-08-14  7:19 UTC (permalink / raw)
  To: stable; +Cc: christian.ehrhardt, Matan Azrad

[ upstream commit a26cc30fa0463fb6707b0caea1a288dc54c09b0f ]

If user wants to do MPLS inner RSS and only provides pattern
till MPLS without inner items [1], RSS expansion will expand flows
into 13 sub-flows[2] which is too many and it impacts flow insert
rate, stack usage becomes large as well.

This expansion into 13 sub-flows seems not worthy of and it can
be significantly reduced (i.e, 7 sub-flows [3]) by user providing
at least one inner L2/L3 item [4].

[1]:
pattern eth / ipv4 / udp / mpls / end actions rss type tcp udp ip
end level 2 / end

[2]:
eth / ipv4 / udp / mpls
eth / ipv4 / udp / mpls / ipv4
eth / ipv4 / udp / mpls / ipv4 / udp
eth / ipv4 / udp / mpls / ipv4 / tcp
eth / ipv4 / udp / mpls / ipv6
eth / ipv4 / udp / mpls / ipv6 / udp
eth / ipv4 / udp / mpls / ipv6 / tcp
eth / ipv4 / udp / mpls / eth / ipv4
eth / ipv4 / udp / mpls / eth / ipv4 / udp
eth / ipv4 / udp / mpls / eth / ipv4 / tcp
eth / ipv4 / udp / mpls / eth / ipv6
eth / ipv4 / udp / mpls / eth / ipv6 / udp
eth / ipv4 / udp / mpls / eth / ipv6 / tcp

[3]:
eth / ipv4 / udp / mpls / eth
eth / ipv4 / udp / mpls / eth / ipv4 / udp
eth / ipv4 / udp / mpls / eth / ipv4 / tcp
eth / ipv4 / udp / mpls / eth / ipv6
eth / ipv4 / udp / mpls / eth / ipv6 / udp
eth / ipv4 / udp / mpls / eth / ipv6 / tcp

[4]:
pattern eth / ipv4 / udp / mpls / eth / end actions rss type tcp udp ip
level 2 / end

Signed-off-by: Xiaoyu Min <jackmin@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 0f0c779ca..494555b16 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1229,6 +1229,13 @@ mlx5_flow_validate_action_rss(const struct rte_flow_action *action,
 					  RTE_FLOW_ERROR_TYPE_ACTION_CONF, NULL,
 					  "inner RSS is not supported for "
 					  "non-tunnel flows");
+	if ((item_flags & MLX5_FLOW_LAYER_MPLS) &&
+	    !(item_flags &
+	      (MLX5_FLOW_LAYER_INNER_L2 | MLX5_FLOW_LAYER_INNER_L3)) &&
+	    rss->level > 1)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, NULL,
+					  "MPLS inner RSS needs to specify inner L2/L3 items after MPLS in pattern");
 	return 0;
 }
 
-- 
2.32.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-stable] [PATCH 19.11 4/4] net/mlx5: limit implicit MPLS RSS expansion over GRE
  2021-08-14  7:19 [dpdk-stable] [PATCH 19.11 0/4] fix MPLS & GRE key RSS expansion Xiaoyu Min
                   ` (2 preceding siblings ...)
  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 ` Xiaoyu Min
  2021-08-16  9:01 ` [dpdk-stable] [PATCH 19.11 0/4] fix MPLS & GRE key RSS expansion Christian Ehrhardt
  4 siblings, 0 replies; 6+ messages in thread
From: Xiaoyu Min @ 2021-08-14  7:19 UTC (permalink / raw)
  To: stable; +Cc: christian.ehrhardt, Suanming Mou, Matan Azrad

From: Suanming Mou <suanmingm@nvidia.com>

[ upstream commit 6821a57a9b83075abe02031299f1430013dd4602 ]

As [1] optimized the MPLS RSS expansion before, this commit limits
the implicitly MPLS RSS expansion for MPLSoGRE as well. For the
RSS flow matcher to GRE level only, it will not expand the MPLS
match item for the sub flows due to performance consideration.

The original RSS flow match item:
ETH VLAN IPV6 GRE GRE_KEY END

The previous RSS expansion:
ETH VLAN IPV6 GRE GRE_KEY END
ETH VLAN IPV6 GRE GRE_KEY IPV4 END
ETH VLAN IPV6 GRE GRE_KEY MPLS IPV4 END
ETH VLAN IPV6 GRE GRE_KEY MPLS ETH IPV4 END

New RSS expansion:
ETH VLAN IPV6 GRE GRE_KEY END
ETH VLAN IPV6 GRE GRE_KEY IPV4 END

[1]
commit a26cc30fa046 ("net/mlx5: limit inner RSS expansion for MPLS")

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Xiaoyu Min <jackmin@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 494555b16..0805bdb8c 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -198,6 +198,7 @@ static const struct rte_flow_expand_node mlx5_support_expansion[] = {
 						 MLX5_EXPANSION_IPV6,
 						 MLX5_EXPANSION_ETH),
 		.type = RTE_FLOW_ITEM_TYPE_MPLS,
+		.optional = 1,
 	},
 	[MLX5_EXPANSION_ETH] = {
 		.next = RTE_FLOW_EXPAND_RSS_NEXT(MLX5_EXPANSION_IPV4,
-- 
2.32.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-stable] [PATCH 19.11 0/4] fix MPLS & GRE key RSS expansion
  2021-08-14  7:19 [dpdk-stable] [PATCH 19.11 0/4] fix MPLS & GRE key RSS expansion Xiaoyu Min
                   ` (3 preceding siblings ...)
  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 ` Christian Ehrhardt
  4 siblings, 0 replies; 6+ messages in thread
From: Christian Ehrhardt @ 2021-08-16  9:01 UTC (permalink / raw)
  To: Xiaoyu Min; +Cc: dpdk stable

On Sat, Aug 14, 2021 at 9:19 AM Xiaoyu Min <jackmin@nvidia.com> wrote:
>
> This patch set backport RSS expansion fixs of MPLS and GRE key
> as well as two other related patchs.

Thank you a lot, added all four!

> Jiawei Wang (1):
>   net/mlx5: fix RSS flow item expansion for GRE key
>
> Suanming Mou (1):
>   net/mlx5: limit implicit MPLS RSS expansion over GRE
>
> Xiaoyu Min (2):
>   net/mlx5: fix MPLS RSS expansion
>   net/mlx5: limit inner RSS expansion for MPLS
>
>  drivers/net/mlx5/mlx5_flow.c        | 32 +++++++++++++++++++++++------
>  lib/librte_ethdev/rte_flow.c        |  4 ++--
>  lib/librte_ethdev/rte_flow_driver.h |  2 ++
>  3 files changed, 30 insertions(+), 8 deletions(-)
>
> --
> 2.32.0
>


-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-16  9:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [dpdk-stable] [PATCH 19.11 1/4] net/mlx5: fix RSS flow item expansion for GRE key Xiaoyu Min
2021-08-14  7:19 ` [dpdk-stable] [PATCH 19.11 2/4] net/mlx5: fix MPLS RSS expansion 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

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).