[PATCH v2 2/6] net/mlx5/hws: fix potential wrong errno value

Rongwei Liu rongweil at nvidia.com
Tue Oct 31 10:42:40 CET 2023


A valid rte_errno is desired when DR layer api returns error
and it can't over-write the value set by under-layer.

Fixes: 890db3e2b90 ("net/mlx5/hws: support insert header action")
Cc: hamdani at nvidia.com

Signed-off-by: Rongwei Liu <rongweil at nvidia.com>
Reviewed-by: Alex Vesker <valex at nvidia.com>
Acked-by: Ori Kam <orika at nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_action.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 59be8ae2c5..76ca57d302 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -2262,6 +2262,7 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx,
 
 	if (!num_of_hdrs) {
 		DR_LOG(ERR, "Reformat num_of_hdrs cannot be zero");
+		rte_errno = EINVAL;
 		return NULL;
 	}
 
@@ -2309,7 +2310,6 @@ mlx5dr_action_create_insert_header(struct mlx5dr_context *ctx,
 						   reformat_hdrs, log_bulk_size);
 	if (ret) {
 		DR_LOG(ERR, "Failed to create HWS reformat action");
-		rte_errno = EINVAL;
 		goto free_reformat_hdrs;
 	}
 
-- 
2.27.0



More information about the dev mailing list