patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix indirect action template error handling
@ 2024-05-26 13:22 Maayan Kashani
  2024-05-27 11:39 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Maayan Kashani @ 2024-05-26 13:22 UTC (permalink / raw)
  To: dev
  Cc: mkashani, suanmingm, rasland, stable, Dariusz Sosnowski,
	Viacheslav Ovsiienko, Ori Kam, Matan Azrad

For indirect action type, on  error case the function jumped to err
but returned zero cause rte_errno was not initialized before the jump.
It caused no error in table creation.

In case reaching an error, if rte_errno is not initialized,
it will be set to EINVAL.
Now table creation should fail if the translate of the action fails.
Added driver log warnings so it can be easy to track failure on shared
actions translate.

Fixes: 7ab3962d2d2b ("net/mlx5: add indirect HW steering action")
Cc: stable@dpdk.org
Signed-off-by: Maayan Kashani <mkashani@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 80efcf44fa..d0a1ec85ec 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -1106,15 +1106,19 @@ flow_hw_shared_action_translate(struct rte_eth_dev *dev,
 		if (!shared_rss || __flow_hw_act_data_shared_rss_append
 		    (priv, acts,
 		    (enum rte_flow_action_type)MLX5_RTE_FLOW_ACTION_TYPE_RSS,
-		    action_src, action_dst, idx, shared_rss))
+		    action_src, action_dst, idx, shared_rss)) {
+			DRV_LOG(WARNING, "Indirect RSS action index %d translate failed", act_idx);
 			return -1;
+		}
 		break;
 	case MLX5_INDIRECT_ACTION_TYPE_COUNT:
 		if (__flow_hw_act_data_shared_cnt_append(priv, acts,
 			(enum rte_flow_action_type)
 			MLX5_RTE_FLOW_ACTION_TYPE_COUNT,
-			action_src, action_dst, act_idx))
+			action_src, action_dst, act_idx)) {
+			DRV_LOG(WARNING, "Indirect count action translate failed");
 			return -1;
+		}
 		break;
 	case MLX5_INDIRECT_ACTION_TYPE_AGE:
 		/* Not supported, prevent by validate function. */
@@ -1122,15 +1126,19 @@ flow_hw_shared_action_translate(struct rte_eth_dev *dev,
 		break;
 	case MLX5_INDIRECT_ACTION_TYPE_CT:
 		if (flow_hw_ct_compile(dev, MLX5_HW_INV_QUEUE,
-				       idx, &acts->rule_acts[action_dst]))
+				       idx, &acts->rule_acts[action_dst])) {
+			DRV_LOG(WARNING, "Indirect CT action translate failed");
 			return -1;
+		}
 		break;
 	case MLX5_INDIRECT_ACTION_TYPE_METER_MARK:
 		if (__flow_hw_act_data_shared_mtr_append(priv, acts,
 			(enum rte_flow_action_type)
 			MLX5_RTE_FLOW_ACTION_TYPE_METER_MARK,
-			action_src, action_dst, idx))
+			action_src, action_dst, idx)) {
+			DRV_LOG(WARNING, "Indirect meter mark action translate failed");
 			return -1;
+		}
 		break;
 	case MLX5_INDIRECT_ACTION_TYPE_QUOTA:
 		flow_hw_construct_quota(priv, &acts->rule_acts[action_dst], idx);
@@ -2641,6 +2649,9 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 	}
 	return 0;
 err:
+	/*If rte_errno was not initialized and reached error state. */
+	if (!rte_errno)
+		rte_errno = EINVAL;
 	err = rte_errno;
 	__flow_hw_action_template_destroy(dev, acts);
 	return rte_flow_error_set(error, err,
-- 
2.34.1


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

* Re: [PATCH] net/mlx5: fix indirect action template error handling
  2024-05-26 13:22 [PATCH] net/mlx5: fix indirect action template error handling Maayan Kashani
@ 2024-05-27 11:39 ` Raslan Darawsheh
  0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2024-05-27 11:39 UTC (permalink / raw)
  To: Maayan Kashani, dev
  Cc: Suanming Mou, stable, Dariusz Sosnowski, Slava Ovsiienko,
	Ori Kam, Matan Azrad

Hi,

From: Maayan Kashani <mkashani@nvidia.com>
Sent: Sunday, May 26, 2024 4:22 PM
To: dev@dpdk.org
Cc: Maayan Kashani; Suanming Mou; Raslan Darawsheh; stable@dpdk.org; Dariusz Sosnowski; Slava Ovsiienko; Ori Kam; Matan Azrad
Subject: [PATCH] net/mlx5: fix indirect action template error handling

For indirect action type, on  error case the function jumped to err
but returned zero cause rte_errno was not initialized before the jump.
It caused no error in table creation.

In case reaching an error, if rte_errno is not initialized,
it will be set to EINVAL.
Now table creation should fail if the translate of the action fails.
Added driver log warnings so it can be easy to track failure on shared
actions translate.

Fixes: 7ab3962d2d2b ("net/mlx5: add indirect HW steering action")
Cc: stable@dpdk.org
Signed-off-by: Maayan Kashani <mkashani@nvidia.com>
Acked-by: Suanming Mou <suanmingm@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:[~2024-05-27 11:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-26 13:22 [PATCH] net/mlx5: fix indirect action template error handling Maayan Kashani
2024-05-27 11:39 ` 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).