DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gregory Etelson <getelson@nvidia.com>
To: <dev@dpdk.org>
Cc: getelson@nvidia.com,   <mkashani@nvidia.com>,
	rasland@nvidia.com, "Dariusz Sosnowski" <dsosnowski@nvidia.com>,
	"Viacheslav Ovsiienko" <viacheslavo@nvidia.com>,
	"Ori Kam" <orika@nvidia.com>,
	"Suanming Mou" <suanmingm@nvidia.com>,
	"Matan Azrad" <matan@nvidia.com>
Subject: [PATCH 1/2] net/mlx5: refactor non-template RSS expansion
Date: Mon, 17 Jun 2024 17:07:46 +0300	[thread overview]
Message-ID: <20240617140747.169197-2-getelson@nvidia.com> (raw)
In-Reply-To: <20240617140747.169197-1-getelson@nvidia.com>

The current PMD handled non-template RSS expansion in the
`flow_nta_handle_rss()` function.
The function returned flow handle for expanded RSS flow rule or
NULL if there was no RSS expansion.
The NULL result with non-zero rte_errno value pointed to an error
during RSS expansion.
If rte_errno value was 0, PMD resumed normal flow creation for the
RSS rule without expansion.

The patch changes `flow_nta_handle_rss()` behavior.
On success, the function always creates a flow handle.
The flow handle references multiple flows if RSS expansion was
required and single flow if no RSS expansion was not required.
The function returns NULL if it failed to create RSS flow.

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c |  6 +-----
 drivers/net/mlx5/mlx5_nta_rss.c | 24 ++++++++++++++----------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index eb89dcf454..78b7014b73 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -13766,11 +13766,7 @@ static uintptr_t flow_hw_list_create(struct rte_eth_dev *dev,
 		flow = flow_nta_handle_rss(dev, attr, items, actions, rss_conf,
 					   item_flags, action_flags, external,
 					   type, error);
-		if (flow)
-			return (uintptr_t)flow;
-		if (error->type != RTE_FLOW_ERROR_TYPE_NONE)
-			return 0;
-		/* Fall Through to non-expanded RSS flow */
+		return (uintptr_t)flow;
 	}
 	/*TODO: Handle split/expand to num_flows. */
 
diff --git a/drivers/net/mlx5/mlx5_nta_rss.c b/drivers/net/mlx5/mlx5_nta_rss.c
index 1f0085ff06..bcba2f98ed 100644
--- a/drivers/net/mlx5/mlx5_nta_rss.c
+++ b/drivers/net/mlx5/mlx5_nta_rss.c
@@ -439,6 +439,7 @@ flow_nta_handle_rss(struct rte_eth_dev *dev,
 	struct rte_flow_action_rss ptype_rss_conf;
 	struct mlx5_nta_rss_ctx rss_ctx;
 	uint64_t rss_types = rte_eth_rss_hf_refine(rss_conf->types);
+	bool expand = true;
 	bool inner_rss = rss_conf->level > 1;
 	bool outer_rss = !inner_rss;
 	bool l3_item = (outer_rss && (item_flags & MLX5_FLOW_LAYER_OUTER_L3)) ||
@@ -484,28 +485,31 @@ flow_nta_handle_rss(struct rte_eth_dev *dev,
 		 * L4 is the maximal expansion level.
 		 * Original pattern does not need expansion.
 		 */
-		rte_flow_error_set(error, 0, RTE_FLOW_ERROR_TYPE_NONE, NULL, NULL);
-		return NULL;
-	}
-	if (!l4_hash) {
+		expand = false;
+	} else if (!l4_hash) {
 		if (!l3_hash) {
 			/*
 			 * RSS action was not configured to hash L3 or L4.
 			 * No expansion needed.
 			 */
-			rte_flow_error_set(error, 0, RTE_FLOW_ERROR_TYPE_NONE, NULL, NULL);
-			return NULL;
-		}
-		if (l3_item) {
+			expand = false;
+		} else if (l3_item) {
 			/*
 			 * Original flow pattern extended up to L3 level.
 			 * RSS action was not set for L4 hash.
 			 * Original pattern does not need expansion.
 			 */
-			rte_flow_error_set(error, 0, RTE_FLOW_ERROR_TYPE_NONE, NULL, NULL);
-			return NULL;
+			expand = false;
 		}
 	}
+	if (!expand) {
+		struct rte_flow_hw *flow = NULL;
+
+		flow_hw_create_flow(dev, flow_type, attr, items,
+				    actions, item_flags, action_flags,
+				    external, &flow, error);
+		return flow;
+	}
 	/* Create RSS expansions in dedicated PTYPE flow group */
 	ptype_attr.group = mlx5_hw_get_rss_ptype_group(dev);
 	if (!ptype_attr.group) {
-- 
2.43.0


  reply	other threads:[~2024-06-17 14:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-17 14:07 [PATCH 0/2] fix non-template IPv6 RSS hash Gregory Etelson
2024-06-17 14:07 ` Gregory Etelson [this message]
2024-06-17 14:07 ` [PATCH 2/2] net/mlx5: " Gregory Etelson
2024-07-01  7:33 ` [PATCH 0/2] " 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=20240617140747.169197-2-getelson@nvidia.com \
    --to=getelson@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=mkashani@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=suanmingm@nvidia.com \
    --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).