Commit b7558a77 authored by Jianbo Liu's avatar Jianbo Liu Committed by David S. Miller

net/mlx5e: Clear mirred devices array if the rule is split

In the cited commit, the mirred devices are recorded and checked while
parsing the actions. In order to avoid system crash, the duplicate
action in a single rule is not allowed.

But the rule is actually break down into several FTEs in different
tables, for either mirroring, or the specified types of actions which
use post action infrastructure.

It will reject certain action list by mistake, for example:
    actions:enp8s0f0_1,set(ipv4(ttl=63)),enp8s0f0_0,enp8s0f0_1.
Here the rule is split to two FTEs because of pedit action.

To fix this issue, when parsing the rule actions, reset if_count to
clear the mirred devices array if the rule is split to multiple
FTEs, and then the duplicate checking is restarted.

Fixes: 554fe75c ("net/mlx5e: Avoid duplicating rule destinations")
Signed-off-by: default avatarJianbo Liu <jianbol@nvidia.com>
Reviewed-by: default avatarVlad Buslov <vladbu@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9b271eba
...@@ -17,8 +17,10 @@ tc_act_parse_ct(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -17,8 +17,10 @@ tc_act_parse_ct(struct mlx5e_tc_act_parse_state *parse_state,
if (err) if (err)
return err; return err;
if (mlx5e_is_eswitch_flow(parse_state->flow)) if (mlx5e_is_eswitch_flow(parse_state->flow)) {
attr->esw_attr->split_count = attr->esw_attr->out_count; attr->esw_attr->split_count = attr->esw_attr->out_count;
parse_state->if_count = 0;
}
attr->flags |= MLX5_ATTR_FLAG_CT; attr->flags |= MLX5_ATTR_FLAG_CT;
......
...@@ -294,6 +294,7 @@ parse_mirred_ovs_master(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -294,6 +294,7 @@ parse_mirred_ovs_master(struct mlx5e_tc_act_parse_state *parse_state,
if (err) if (err)
return err; return err;
parse_state->if_count = 0;
esw_attr->out_count++; esw_attr->out_count++;
return 0; return 0;
} }
......
...@@ -98,8 +98,10 @@ tc_act_parse_pedit(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -98,8 +98,10 @@ tc_act_parse_pedit(struct mlx5e_tc_act_parse_state *parse_state,
attr->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR; attr->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
if (ns_type == MLX5_FLOW_NAMESPACE_FDB) if (ns_type == MLX5_FLOW_NAMESPACE_FDB) {
esw_attr->split_count = esw_attr->out_count; esw_attr->split_count = esw_attr->out_count;
parse_state->if_count = 0;
}
return 0; return 0;
} }
......
...@@ -66,6 +66,7 @@ tc_act_parse_redirect_ingress(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -66,6 +66,7 @@ tc_act_parse_redirect_ingress(struct mlx5e_tc_act_parse_state *parse_state,
if (err) if (err)
return err; return err;
parse_state->if_count = 0;
esw_attr->out_count++; esw_attr->out_count++;
return 0; return 0;
......
...@@ -166,6 +166,7 @@ tc_act_parse_vlan(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -166,6 +166,7 @@ tc_act_parse_vlan(struct mlx5e_tc_act_parse_state *parse_state,
return err; return err;
esw_attr->split_count = esw_attr->out_count; esw_attr->split_count = esw_attr->out_count;
parse_state->if_count = 0;
return 0; return 0;
} }
......
...@@ -65,8 +65,10 @@ tc_act_parse_vlan_mangle(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -65,8 +65,10 @@ tc_act_parse_vlan_mangle(struct mlx5e_tc_act_parse_state *parse_state,
if (err) if (err)
return err; return err;
if (ns_type == MLX5_FLOW_NAMESPACE_FDB) if (ns_type == MLX5_FLOW_NAMESPACE_FDB) {
attr->esw_attr->split_count = attr->esw_attr->out_count; attr->esw_attr->split_count = attr->esw_attr->out_count;
parse_state->if_count = 0;
}
return 0; return 0;
} }
......
...@@ -3936,6 +3936,7 @@ parse_tc_actions(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -3936,6 +3936,7 @@ parse_tc_actions(struct mlx5e_tc_act_parse_state *parse_state,
} }
i_split = i + 1; i_split = i + 1;
parse_state->if_count = 0;
list_add(&attr->list, &flow->attrs); list_add(&attr->list, &flow->attrs);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment