diff options
author | Roi Dayan <roid@nvidia.com> | 2021-08-11 14:19:56 +0300 |
---|---|---|
committer | Saeed Mahameed <saeedm@nvidia.com> | 2021-12-14 21:29:45 -0800 |
commit | dd5ab6d115657a7f312893fdd40b3d187022b11d (patch) | |
tree | 2b19a7e874477771b4f0b08e0f9f7f8e03cccac9 /drivers | |
parent | 6bcba1bdeda57cd36317f616253e387fb14e70ee (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h index 0aa995a9f674..26efa33de56f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h @@ -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; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index c6c6d20ecd09..2ece349592cd 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -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; } |