net/mlx5e: Add post_parse() op to tc action infrastructure
authorRoi Dayan <roid@nvidia.com>
Wed, 11 Aug 2021 11:19:56 +0000 (14:19 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 15 Dec 2021 05:29:45 +0000 (21:29 -0800)
The post_parse() op should be called after the parse op was called
for all actions. It could be an action state is dependent on other
actions. In the new op an action can fail the parse if the state
is not valid anymore.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Oz Shlomo <ozsh@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

index 0aa995a..26efa33 100644 (file)
@@ -36,6 +36,10 @@ struct mlx5e_tc_act {
                            const struct flow_action_entry *act,
                            struct mlx5e_priv *priv,
                            struct mlx5_flow_attr *attr);
+
+       int (*post_parse)(struct mlx5e_tc_act_parse_state *parse_state,
+                         struct mlx5e_priv *priv,
+                         struct mlx5_flow_attr *attr);
 };
 
 extern struct mlx5e_tc_act mlx5e_tc_act_drop;
index c6c6d20..2ece349 100644 (file)
@@ -3168,6 +3168,17 @@ parse_tc_actions(struct mlx5e_tc_act_parse_state *parse_state,
                        return err;
        }
 
+       flow_action_for_each(i, act, flow_action) {
+               tc_act = mlx5e_tc_act_get(act->id, ns_type);
+               if (!tc_act || !tc_act->post_parse ||
+                   !tc_act->can_offload(parse_state, act, i))
+                       continue;
+
+               err = tc_act->post_parse(parse_state, priv, attr);
+               if (err)
+                       return err;
+       }
+
        return 0;
 }