git: b762b199afc6 - main - mlx5: Eliminate the use of mlx5_rule_fwd_action

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Thu, 19 Dec 2024 00:12:25 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=b762b199afc6ed56ac95ca19c7fc29c2927fa85c

commit b762b199afc6ed56ac95ca19c7fc29c2927fa85c
Author:     Slava Shwartsman <slavash@nvidia.com>
AuthorDate: 2024-12-12 15:57:58 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-12-18 23:59:42 +0000

    mlx5: Eliminate the use of mlx5_rule_fwd_action
    
    Driver defined all flow context actions in MLX5_FLOW_CONTEXT_ACTION_*,
    no need to duplicate them with mlx5_rule_fwd_action.
    
    Sponsored by:   NVidia networking
    MFC after:      1 week
---
 sys/dev/mlx5/fs.h                         |  6 ------
 sys/dev/mlx5/mlx5_accel/mlx5_ipsec_fs.c   |  4 ++--
 sys/dev/mlx5/mlx5_core/mlx5_eswitch.c     |  6 +++---
 sys/dev/mlx5/mlx5_core/mlx5_fs_tcp.c      |  4 ++--
 sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 10 +++++-----
 sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c       |  2 +-
 6 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/sys/dev/mlx5/fs.h b/sys/dev/mlx5/fs.h
index ee0d28b6758a..6bb05e004479 100644
--- a/sys/dev/mlx5/fs.h
+++ b/sys/dev/mlx5/fs.h
@@ -69,12 +69,6 @@ enum {
 	MLX5_FS_SNIFFER_FLOW_TAG  = 0xFFFFFD,
 };
 
-enum mlx5_rule_fwd_action {
-	MLX5_FLOW_RULE_FWD_ACTION_ALLOW = 0x1,
-	MLX5_FLOW_RULE_FWD_ACTION_DROP = 0x2,
-	MLX5_FLOW_RULE_FWD_ACTION_DEST = 0x4,
-};
-
 enum {
 	MLX5_FS_FLOW_TAG_MASK = 0xFFFFFF,
 };
diff --git a/sys/dev/mlx5/mlx5_accel/mlx5_ipsec_fs.c b/sys/dev/mlx5/mlx5_accel/mlx5_ipsec_fs.c
index 9523dc8d5e95..f7950bf61269 100644
--- a/sys/dev/mlx5/mlx5_accel/mlx5_ipsec_fs.c
+++ b/sys/dev/mlx5/mlx5_accel/mlx5_ipsec_fs.c
@@ -321,9 +321,9 @@ static int ipsec_miss_create(struct mlx5_core_dev *mdev,
 	}
 
 	if (dest)
-		flow_act.action = MLX5_FLOW_RULE_FWD_ACTION_DEST;
+		flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
 	else
-		flow_act.action = MLX5_FLOW_RULE_FWD_ACTION_DROP;
+		flow_act.action = MLX5_FLOW_CONTEXT_ACTION_DROP;
 	/* Create miss rule */
 	miss->rule = mlx5_add_flow_rules(ft, NULL, &flow_act, dest, 1);
 	if (IS_ERR(miss->rule)) {
diff --git a/sys/dev/mlx5/mlx5_core/mlx5_eswitch.c b/sys/dev/mlx5/mlx5_core/mlx5_eswitch.c
index 8c96beeb509f..30f04144502b 100644
--- a/sys/dev/mlx5/mlx5_core/mlx5_eswitch.c
+++ b/sys/dev/mlx5/mlx5_core/mlx5_eswitch.c
@@ -815,7 +815,7 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw,
 	MLX5_SET_TO_ONES(fte_match_param, spec->match_criteria, outer_headers.cvlan_tag);
 	MLX5_SET_TO_ONES(fte_match_param, spec->match_value, outer_headers.cvlan_tag);
 
-	flow_act.action = MLX5_FLOW_RULE_FWD_ACTION_DROP;
+	flow_act.action = MLX5_FLOW_CONTEXT_ACTION_DROP;
 	spec->match_criteria_enable = MLX5_MATCH_OUTER_HEADERS;
 	vport->ingress.drop_rule =
 		mlx5_add_flow_rules(vport->ingress.acl, spec,
@@ -867,7 +867,7 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw,
 	MLX5_SET(fte_match_param, spec->match_value, outer_headers.first_vid, vport->vlan);
 
 	spec->match_criteria_enable = MLX5_MATCH_OUTER_HEADERS;
-	flow_act.action = MLX5_FLOW_RULE_FWD_ACTION_ALLOW;
+	flow_act.action = MLX5_FLOW_CONTEXT_ACTION_ALLOW;
 
 	vport->egress.allowed_vlan =
 		mlx5_add_flow_rules(vport->egress.acl, spec,
@@ -879,7 +879,7 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw,
 		goto out;
 	}
 
-	flow_act.action = MLX5_FLOW_RULE_FWD_ACTION_DROP;
+	flow_act.action = MLX5_FLOW_CONTEXT_ACTION_DROP;
 	vport->egress.drop_rule =
 		mlx5_add_flow_rules(vport->egress.acl, NULL,
 				   &flow_act, NULL, 0);
diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fs_tcp.c b/sys/dev/mlx5/mlx5_core/mlx5_fs_tcp.c
index f7ec5af81773..f69c36aa72de 100644
--- a/sys/dev/mlx5/mlx5_core/mlx5_fs_tcp.c
+++ b/sys/dev/mlx5/mlx5_core/mlx5_fs_tcp.c
@@ -159,7 +159,7 @@ mlx5e_accel_fs_add_inpcb(struct mlx5e_priv *priv,
 
 	dest.type = MLX5_FLOW_DESTINATION_TYPE_TIR;
 	dest.tir_num = tirn;
-	flow_act.action = MLX5_FLOW_RULE_FWD_ACTION_DEST;
+	flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
 
 	flow = mlx5_add_flow_rules(ft->t, spec, &flow_act, &dest, 1);
 out:
@@ -175,7 +175,7 @@ accel_fs_tcp_add_default_rule(struct mlx5e_priv *priv, int type)
 	struct mlx5e_accel_fs_tcp *fs_tcp;
 	struct mlx5_flow_handle *rule;
 	struct mlx5_flow_act flow_act = {
-		.action = MLX5_FLOW_RULE_FWD_ACTION_DEST,
+		.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,
 	};
 
 	fs_tcp = &priv->fts.accel_tcp;
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
index ac275b5b145c..f8be5b9e881c 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
@@ -263,7 +263,7 @@ mlx5e_add_eth_addr_rule_sub(struct mlx5e_priv *priv,
 	u32 tt_vec;
 	int err = 0;
 	struct mlx5_flow_act flow_act = {
-		.action = MLX5_FLOW_RULE_FWD_ACTION_DEST,
+		.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,
 	};
 	u8 *mc;
 	u8 *mv;
@@ -474,7 +474,7 @@ mlx5e_add_main_vxlan_rules_sub(struct mlx5e_priv *priv,
 	struct mlx5_flow_table *ft = priv->fts.main_vxlan.t;
 	u32 *tirn = priv->tirn_inner_vxlan;
 	struct mlx5_flow_act flow_act = {
-		.action = MLX5_FLOW_RULE_FWD_ACTION_DEST,
+		.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,
 	};
 	int err = 0;
 	u8 *mc;
@@ -670,7 +670,7 @@ mlx5e_add_vlan_rule_sub(struct mlx5e_priv *priv,
 	struct mlx5_flow_handle **rule_p;
 	int err = 0;
 	struct mlx5_flow_act flow_act = {
-		.action = MLX5_FLOW_RULE_FWD_ACTION_DEST,
+		.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,
 	};
 	u8 *mv;
 	u8 *mc;
@@ -1671,7 +1671,7 @@ mlx5e_add_vxlan_rule_sub(struct mlx5e_priv *priv, struct mlx5_flow_spec *spec,
 	struct mlx5_flow_handle **rule_p;
 	int err = 0;
 	struct mlx5_flow_act flow_act = {
-		.action = MLX5_FLOW_RULE_FWD_ACTION_DEST,
+		.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,
 	};
 	u8 *mc;
 	u8 *mv;
@@ -1808,7 +1808,7 @@ mlx5e_add_vxlan_catchall_rule_sub(struct mlx5e_priv *priv,
 	struct mlx5_flow_handle **rule_p;
 	int err = 0;
 	struct mlx5_flow_act flow_act = {
-		.action = MLX5_FLOW_RULE_FWD_ACTION_DEST,
+		.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,
 	};
 
 	spec->flow_context.flow_tag = MLX5_FS_ETH_FLOW_TAG;
diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
index 1b688b70f3dd..5825cee87d9b 100644
--- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
+++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
@@ -2213,7 +2213,7 @@ static struct mlx5_ib_flow_handler *create_flow_rule(struct mlx5_ib_dev *dev,
 	}
 
 	spec->match_criteria_enable = get_match_criteria_enable(spec->match_criteria);
-	action = dst ? MLX5_FLOW_RULE_FWD_ACTION_DEST : 0;
+	action = dst ? MLX5_FLOW_CONTEXT_ACTION_FWD_DEST : 0;
 	flow_act.action = action;
 	handler->rule = mlx5_add_flow_rules(ft, spec, &flow_act, dst, 1);