net/mlx5e: Add post_parse() op to tc action infrastructure

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>
This commit is contained in:
Roi Dayan 2021-08-11 14:19:56 +03:00 committed by Saeed Mahameed
parent 6bcba1bded
commit dd5ab6d115
2 changed files with 15 additions and 0 deletions

View 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;

View 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;
}