[PATCH 2/5] net/mlx5/hws: allow destroying rule resources on error

Itamar Gozlan igozlan at nvidia.com
Thu Jun 29 09:21:22 CEST 2023


From: Alex Vesker <valex at nvidia.com>

In case the send engine is in error state API should provide
a way to free rule resources and provide a fake completion.
Otherwise there is no way to release these resources.

Signed-off-by: Alex Vesker <valex at nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_rule.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index 071e1ad769..931c68b160 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -521,6 +521,11 @@ static int mlx5dr_rule_destroy_hws(struct mlx5dr_rule *rule,
 
 	queue = &ctx->send_queue[attr->queue_id];
 
+	if (unlikely(mlx5dr_send_engine_err(queue))) {
+		mlx5dr_rule_destroy_failed_hws(rule, attr);
+		return 0;
+	}
+
 	/* Rule is not completed yet */
 	if (rule->status == MLX5DR_RULE_STATUS_CREATING) {
 		rte_errno = EBUSY;
@@ -533,11 +538,6 @@ static int mlx5dr_rule_destroy_hws(struct mlx5dr_rule *rule,
 		return 0;
 	}
 
-	if (unlikely(mlx5dr_send_engine_err(queue))) {
-		mlx5dr_rule_destroy_failed_hws(rule, attr);
-		return 0;
-	}
-
 	mlx5dr_send_engine_inc_rule(queue);
 
 	/* Send dependent WQE */
-- 
2.18.1



More information about the dev mailing list