[v4,08/13] net/mlx5/hws: fix potential wrong rte_errno value

Message ID 20231101044419.732726-9-rongweil@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series support IPv6 push remove action |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Rongwei Liu Nov. 1, 2023, 4:44 a.m. UTC
  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: 0a2657c4ff4d ("net/mlx5/hws: support insert header action")
Cc: hamdani@nvidia.com

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

Patch

diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 98bb556b7b..e66a8135dc 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -2015,6 +2015,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;
 	}
 
@@ -2062,7 +2063,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;
 	}