patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Lior Margalit <lmargalit@nvidia.com>
To: Matan Azrad <matan@nvidia.com>
Cc: Lior Margalit <lmargalit@nvidia.com>, <stable@dpdk.org>
Subject: [PATCH 20.11 3/5] net/mlx5: fix RSS expansion traversal over next nodes
Date: Tue, 30 Nov 2021 14:17:12 +0200	[thread overview]
Message-ID: <20211130121714.4170879-3-lmargalit@nvidia.com> (raw)
In-Reply-To: <20211130121714.4170879-1-lmargalit@nvidia.com>

[ upstream commit aa52e5f0f9e6fe4acf3cd54ce7e392944f68d6c4 ]

The RSS expansion is based on DFS algorithm to traverse over the possible
expansion paths.

The current implementation breaks out, if it reaches the terminator of
the "next nodes" array, instead of going backwards to try the next path.
For example:
testpmd> flow create 0 ingress pattern eth / ipv6 / udp / vxlan / end
actions rss level 2 types tcp end / end
The paths found are:
ETH IPV6 UDP VXLAN END
ETH IPV6 UDP VXLAN ETH IPV4 TCP END
ETH IPV6 UDP VXLAN ETH IPV6 TCP END
The traversal stopped after getting to the terminator of the next nodes
of the ETH node. It missed the rest of the nodes in the next nodes array
of the VXLAN node.

The fix is to go backwards when reaching the terminator of the current
level and find if there is a "next node" to start traversing a new path.
Using the above example, the flows will be:
ETH IPV6 UDP VXLAN END
ETH IPV6 UDP VXLAN ETH IPV4 TCP END
ETH IPV6 UDP VXLAN ETH IPV6 TCP END
ETH IPV6 UDP VXLAN IPV4 TCP END
ETH IPV6 UDP VXLAN IPV6 TCP END
The traversal will find additional paths, because it traverses through
all the next nodes array of the VXLAN node.

Fixes: 4ed05fcd441b ("ethdev: add flow API to expand RSS flows")
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 | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index cacccd6cc8..5cebd5ed6f 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -483,12 +483,22 @@ mlx5_flow_expand_rss(struct mlx5_flow_expand_rss *buf, size_t size,
 			/* Follow up with the next possibility. */
 			next_node = mlx5_flow_expand_rss_skip_explicit(graph,
 					++next_node);
+		} else if (!stack_pos) {
+			/*
+			 * Completing the traverse over the different paths.
+			 * The next_node is advanced to the terminator.
+			 */
+			++next_node;
 		} else {
 			/* Move to the next path. */
-			if (stack_pos)
+			while (stack_pos) {
 				next_node = stack[--stack_pos];
+				next_node++;
+				if (*next_node)
+					break;
+			}
 			next_node = mlx5_flow_expand_rss_skip_explicit(graph,
-					++next_node);
+					next_node);
 			stack[stack_pos] = next_node;
 		}
 		node = next_node && *next_node ? &graph[*next_node] : NULL;
-- 
2.25.1


  parent reply	other threads:[~2021-11-30 12:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 12:17 [PATCH 20.11 1/5] net/mlx5: fix RSS expansion for inner tunnel VLAN Lior Margalit
2021-11-30 12:17 ` [PATCH 20.11 2/5] net/mlx5: fix RSS expansion for explicit graph node Lior Margalit
2021-11-30 12:17 ` Lior Margalit [this message]
2021-11-30 12:17 ` [PATCH 20.11 4/5] net/mlx5: fix RSS expansion for L2/L3 VXLAN Lior Margalit
2021-11-30 12:17 ` [PATCH 20.11 5/5] net/mlx5: fix RSS expansion with EtherType Lior Margalit
2021-11-30 13:55 ` [PATCH 20.11 1/5] net/mlx5: fix RSS expansion for inner tunnel VLAN Xueming(Steven) Li

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=20211130121714.4170879-3-lmargalit@nvidia.com \
    --to=lmargalit@nvidia.com \
    --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).