DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] net/mlx5: fix RSS expansion of ETH item with EtherType
@ 2021-11-01  6:38 Lior Margalit
  2021-11-02  8:10 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Lior Margalit @ 2021-11-01  6:38 UTC (permalink / raw)
  To: Matan Azrad; +Cc: Lior Margalit, dev, stable

The RSS expansion algorithm is using a graph to find the possible
expansion paths. A graph node with the 'explicit' flag will be skipped,
if it is not found in the flow pattern.
The current implementation misses a check for the explicit flag when
expanding the pattern according to ETH item with EtherType.
For example:
testpmd> flow create 0 ingress pattern eth / ipv6 / udp / vxlan / eth type
is 2048 / end actions rss level 2 types udp end / end
The "eth type is 2048" item in the pattern may be expanded to "ETH IPv4".
The ETH node in the expansion graph is followed by VLAN node marked as
explicit. The fix is to skip the VLAN node and continue the expansion
with its next nodes, IPv4 and IPv6.
The expansion paths for the above example will be:
ETH IPV6 UDP VXLAN ETH END
ETH IPV6 UDP VXLAN ETH IPV4 UDP END

Fixes: 69d268b4fff3 ("net/mlx5: fix RSS expansion for explicit graph node")
Cc: stable@dpdk.org

Signed-off-by: Lior Margalit <lmargalit@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 5d19ef1e82..6f32c08b5f 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -391,13 +391,20 @@ mlx5_flow_expand_rss(struct mlx5_flow_expand_rss *buf, size_t size,
 	if (missed_item.type != RTE_FLOW_ITEM_TYPE_VOID) {
 		next = NULL;
 		missed = 1;
-		for (i = 0; node->next && node->next[i]; ++i) {
+		i = 0;
+		while (node->next && node->next[i]) {
 			next = &graph[node->next[i]];
 			if (next->type == missed_item.type) {
 				flow_items[0].type = missed_item.type;
 				flow_items[1].type = RTE_FLOW_ITEM_TYPE_END;
 				break;
 			}
+			if (next->node_flags & MLX5_EXPANSION_NODE_EXPLICIT) {
+				node = next;
+				i = 0;
+			} else {
+				++i;
+			}
 			next = NULL;
 		}
 	}
@@ -9556,17 +9563,21 @@ mlx5_flow_expand_rss_adjust_node(const struct rte_flow_item *pattern,
 		const struct mlx5_flow_expand_node *node)
 {
 	const struct rte_flow_item *item = pattern + item_idx, *prev_item;
-	switch (item->type) {
-	case RTE_FLOW_ITEM_TYPE_VXLAN:
+
+	if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN &&
+			node != NULL &&
+			node->type == RTE_FLOW_ITEM_TYPE_VXLAN) {
+		/*
+		 * The expansion node is VXLAN and it is also the last
+		 * expandable item in the pattern, so need to continue
+		 * expansion of the inner tunnel.
+		 */
 		MLX5_ASSERT(item_idx > 0);
 		prev_item = pattern + item_idx - 1;
 		MLX5_ASSERT(prev_item->type == RTE_FLOW_ITEM_TYPE_UDP);
 		if (mlx5_flow_is_std_vxlan_port(prev_item))
 			return &graph[MLX5_EXPANSION_STD_VXLAN];
-		else
-			return &graph[MLX5_EXPANSION_L3_VXLAN];
-		break;
-	default:
-		return node;
+		return &graph[MLX5_EXPANSION_L3_VXLAN];
 	}
+	return node;
 }
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH v1] net/mlx5: fix RSS expansion of ETH item with EtherType
  2021-11-01  6:38 [dpdk-dev] [PATCH v1] net/mlx5: fix RSS expansion of ETH item with EtherType Lior Margalit
@ 2021-11-02  8:10 ` Raslan Darawsheh
  0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2021-11-02  8:10 UTC (permalink / raw)
  To: Lior Margalit, Matan Azrad; +Cc: Lior Margalit, dev, stable

Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Lior Margalit
> Sent: Monday, November 1, 2021 8:39 AM
> To: Matan Azrad <matan@nvidia.com>
> Cc: Lior Margalit <lmargalit@nvidia.com>; dev@dpdk.org; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v1] net/mlx5: fix RSS expansion of ETH item with
> EtherType
> 
> The RSS expansion algorithm is using a graph to find the possible
> expansion paths. A graph node with the 'explicit' flag will be skipped,
> if it is not found in the flow pattern.
> The current implementation misses a check for the explicit flag when
> expanding the pattern according to ETH item with EtherType.
> For example:
> testpmd> flow create 0 ingress pattern eth / ipv6 / udp / vxlan / eth type
> is 2048 / end actions rss level 2 types udp end / end
> The "eth type is 2048" item in the pattern may be expanded to "ETH IPv4".
> The ETH node in the expansion graph is followed by VLAN node marked as
> explicit. The fix is to skip the VLAN node and continue the expansion
> with its next nodes, IPv4 and IPv6.
> The expansion paths for the above example will be:
> ETH IPV6 UDP VXLAN ETH END
> ETH IPV6 UDP VXLAN ETH IPV4 UDP END
> 
> Fixes: 69d268b4fff3 ("net/mlx5: fix RSS expansion for explicit graph node")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Lior Margalit <lmargalit@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

end of thread, other threads:[~2021-11-02  8:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-01  6:38 [dpdk-dev] [PATCH v1] net/mlx5: fix RSS expansion of ETH item with EtherType Lior Margalit
2021-11-02  8:10 ` Raslan Darawsheh

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