DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix non-template RSS expansion
@ 2025-08-12 10:07 Gregory Etelson
  0 siblings, 0 replies; only message in thread
From: Gregory Etelson @ 2025-08-12 10:07 UTC (permalink / raw)
  To: dev
  Cc: getelson,  ,
	rasland, stable, Dariusz Sosnowski, Viacheslav Ovsiienko,
	Bing Zhao, Ori Kam, Suanming Mou, Matan Azrad

The PMD checked flow pointer for NULL value after a call to
flow_hw_create_flow(). The function API does not define flow pointer
value if the function call has failed.

The patch fixes error verification after flow_hw_create_flow()
returned - a calling function must check flow_hw_create_flow() return
value.

Fixes: f74914c9956e ("net/mlx5: fix non-template IPv6 flow RSS hash")
Cc: stable@dpdk.org

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
 drivers/net/mlx5/mlx5_nta_rss.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_nta_rss.c b/drivers/net/mlx5/mlx5_nta_rss.c
index 8f00510445..b7738f910d 100644
--- a/drivers/net/mlx5/mlx5_nta_rss.c
+++ b/drivers/net/mlx5/mlx5_nta_rss.c
@@ -67,7 +67,7 @@ mlx5_nta_ptype_rss_flow_create(struct mlx5_nta_rss_ctx *ctx,
 				  ctx->pattern, ctx->actions,
 				  MLX5_FLOW_ITEM_PTYPE, MLX5_FLOW_ACTION_RSS,
 				  ctx->external, &flow, ctx->error);
-	if (flow) {
+	if (ret == 0) {
 		SLIST_INSERT_HEAD(ctx->head, flow, nt2hws->next);
 		if (dbg_log) {
 			DRV_LOG(NOTICE,
@@ -276,6 +276,7 @@ mlx5_hw_rss_ptype_create_miss_flow(struct rte_eth_dev *dev,
 				   uint32_t ptype_group, bool external,
 				   struct rte_flow_error *error)
 {
+	int ret;
 	struct rte_flow_hw *flow = NULL;
 	const struct rte_flow_attr miss_attr = {
 		.ingress = 1,
@@ -300,10 +301,10 @@ mlx5_hw_rss_ptype_create_miss_flow(struct rte_eth_dev *dev,
 		[MLX5_RSS_PTYPE_ACTION_INDEX + 1] = { .type = RTE_FLOW_ACTION_TYPE_END }
 	};
 
-	flow_hw_create_flow(dev, MLX5_FLOW_TYPE_GEN, &miss_attr,
-			    miss_pattern, miss_actions, 0, MLX5_FLOW_ACTION_RSS,
-			    external, &flow, error);
-	return flow;
+	ret = flow_hw_create_flow(dev, MLX5_FLOW_TYPE_GEN, &miss_attr,
+				  miss_pattern, miss_actions, 0,
+				  MLX5_FLOW_ACTION_RSS, external, &flow, error);
+	return ret == 0 ? flow : NULL;
 }
 
 static struct rte_flow_hw *
@@ -316,7 +317,7 @@ mlx5_hw_rss_ptype_create_base_flow(struct rte_eth_dev *dev,
 				   enum mlx5_flow_type flow_type,
 				   struct rte_flow_error *error)
 {
-	int i = 0;
+	int ret, i = 0;
 	struct rte_flow_hw *flow = NULL;
 	struct rte_flow_action actions[MLX5_HW_MAX_ACTS];
 	enum mlx5_indirect_type indirect_type;
@@ -345,9 +346,9 @@ mlx5_hw_rss_ptype_create_base_flow(struct rte_eth_dev *dev,
 	} while (actions[i++].type != RTE_FLOW_ACTION_TYPE_END);
 	action_flags &= ~MLX5_FLOW_ACTION_RSS;
 	action_flags |= MLX5_FLOW_ACTION_JUMP;
-	flow_hw_create_flow(dev, flow_type, attr, pattern, actions,
-			    item_flags, action_flags, external, &flow, error);
-	return flow;
+	ret = flow_hw_create_flow(dev, flow_type, attr, pattern, actions,
+				  item_flags, action_flags, external, &flow, error);
+	return ret == 0 ? flow : NULL;
 }
 
 const struct rte_flow_action_rss *
@@ -425,6 +426,7 @@ flow_nta_create_single(struct rte_eth_dev *dev,
 		       enum mlx5_flow_type flow_type,
 		       struct rte_flow_error *error)
 {
+	int ret;
 	struct rte_flow_hw *flow = NULL;
 	struct rte_flow_action copy[MLX5_HW_MAX_ACTS];
 	const struct rte_flow_action *_actions;
@@ -456,10 +458,9 @@ flow_nta_create_single(struct rte_eth_dev *dev,
 		_actions = actions;
 	}
 end:
-	flow_hw_create_flow(dev, flow_type, attr, items,
-			    _actions, item_flags, action_flags,
-			    external, &flow, error);
-	return flow;
+	ret = flow_hw_create_flow(dev, flow_type, attr, items, _actions,
+				  item_flags, action_flags, external, &flow, error);
+	return ret == 0 ? flow : NULL;
 }
 
 /*
-- 
2.48.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-12 10:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-12 10:07 [PATCH] net/mlx5: fix non-template RSS expansion Gregory Etelson

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