[v2,1/7] common/mlx5: remove enum value duplication

Message ID 20240207155533.1582031-2-michaelba@nvidia.com (mailing list archive)
State New
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: support copy from inner fields |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation warning apply patch failure
ci/iol-testing warning apply patch failure

Commit Message

Michael Baum Feb. 7, 2024, 3:55 p.m. UTC
  The "mlx5_modification_field" enumeration has 2 different fields
representing the same value 0x4A.
 1. "MLX5_MODI_OUT_IPV6_NEXT_HDR" - specific for IPv6.
 2. "MLX5_MODI_OUT_IP_PROTOCOL" - for both IPv4 and IPv6.

This patch removes "MLX5_MODI_OUT_IPV6_NEXT_HDR" and replaces all its
usages with "MLX5_MODI_OUT_IP_PROTOCOL".

Signed-off-by: Michael Baum <michaelba@nvidia.com>
---
 drivers/common/mlx5/mlx5_prm.h        | 1 -
 drivers/net/mlx5/hws/mlx5dr_action.c  | 4 ++--
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)
  

Patch

diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 0035a1e616..af16bf4cf6 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -840,7 +840,6 @@  enum mlx5_modification_field {
 	MLX5_MODI_IN_MPLS_LABEL_3,
 	MLX5_MODI_IN_MPLS_LABEL_4,
 	MLX5_MODI_OUT_IP_PROTOCOL = 0x4A,
-	MLX5_MODI_OUT_IPV6_NEXT_HDR = 0x4A,
 	MLX5_MODI_META_REG_C_8 = 0x8F,
 	MLX5_MODI_META_REG_C_9 = 0x90,
 	MLX5_MODI_META_REG_C_10 = 0x91,
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 862ee3e332..2828a82d5b 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -2287,7 +2287,7 @@  mlx5dr_action_create_pop_ipv6_route_ext_mhdr3(struct mlx5dr_action *action)
 	MLX5_SET(copy_action_in, cmd, length, 8);
 	MLX5_SET(copy_action_in, cmd, src_offset, 24);
 	MLX5_SET(copy_action_in, cmd, src_field, mod_id);
-	MLX5_SET(copy_action_in, cmd, dst_field, MLX5_MODI_OUT_IPV6_NEXT_HDR);
+	MLX5_SET(copy_action_in, cmd, dst_field, MLX5_MODI_OUT_IP_PROTOCOL);
 
 	pattern.data = (__be64 *)cmd;
 	pattern.sz = sizeof(cmd);
@@ -2348,7 +2348,7 @@  mlx5dr_action_create_push_ipv6_route_ext_mhdr1(struct mlx5dr_action *action)
 	/* Set ipv6.protocol to IPPROTO_ROUTING */
 	MLX5_SET(set_action_in, cmd, action_type, MLX5_MODIFICATION_TYPE_SET);
 	MLX5_SET(set_action_in, cmd, length, 8);
-	MLX5_SET(set_action_in, cmd, field, MLX5_MODI_OUT_IPV6_NEXT_HDR);
+	MLX5_SET(set_action_in, cmd, field, MLX5_MODI_OUT_IP_PROTOCOL);
 	MLX5_SET(set_action_in, cmd, data, IPPROTO_ROUTING);
 
 	pattern.data = (__be64 *)cmd;
diff --git a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
index a949844d24..513549ff3c 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
+++ b/drivers/net/mlx5/hws/mlx5dr_pat_arg.c
@@ -67,7 +67,7 @@  bool mlx5dr_pat_require_reparse(__be64 *actions, uint16_t num_of_actions)
 
 		/* Below fields can change packet structure require a reparse */
 		if (field == MLX5_MODI_OUT_ETHERTYPE ||
-		    field == MLX5_MODI_OUT_IPV6_NEXT_HDR)
+		    field == MLX5_MODI_OUT_IP_PROTOCOL)
 			return true;
 	}