Skip to content

Commit b7558a7

Browse files
Jianbo Liudavem330
authored andcommitted
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: 554fe75 ("net/mlx5e: Avoid duplicating rule destinations") Signed-off-by: Jianbo Liu <jianbol@nvidia.com> Reviewed-by: Vlad Buslov <vladbu@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9b271eb commit b7558a7

File tree

7 files changed

+13
-3
lines changed

7 files changed

+13
-3
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/ct.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ tc_act_parse_ct(struct mlx5e_tc_act_parse_state *parse_state,
1717
if (err)
1818
return err;
1919

20-
if (mlx5e_is_eswitch_flow(parse_state->flow))
20+
if (mlx5e_is_eswitch_flow(parse_state->flow)) {
2121
attr->esw_attr->split_count = attr->esw_attr->out_count;
22+
parse_state->if_count = 0;
23+
}
2224

2325
attr->flags |= MLX5_ATTR_FLAG_CT;
2426

drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ parse_mirred_ovs_master(struct mlx5e_tc_act_parse_state *parse_state,
294294
if (err)
295295
return err;
296296

297+
parse_state->if_count = 0;
297298
esw_attr->out_count++;
298299
return 0;
299300
}

drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/pedit.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ tc_act_parse_pedit(struct mlx5e_tc_act_parse_state *parse_state,
9898

9999
attr->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
100100

101-
if (ns_type == MLX5_FLOW_NAMESPACE_FDB)
101+
if (ns_type == MLX5_FLOW_NAMESPACE_FDB) {
102102
esw_attr->split_count = esw_attr->out_count;
103+
parse_state->if_count = 0;
104+
}
103105

104106
return 0;
105107
}

drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/redirect_ingress.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ tc_act_parse_redirect_ingress(struct mlx5e_tc_act_parse_state *parse_state,
6666
if (err)
6767
return err;
6868

69+
parse_state->if_count = 0;
6970
esw_attr->out_count++;
7071

7172
return 0;

drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ tc_act_parse_vlan(struct mlx5e_tc_act_parse_state *parse_state,
166166
return err;
167167

168168
esw_attr->split_count = esw_attr->out_count;
169+
parse_state->if_count = 0;
169170

170171
return 0;
171172
}

drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/vlan_mangle.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ tc_act_parse_vlan_mangle(struct mlx5e_tc_act_parse_state *parse_state,
6565
if (err)
6666
return err;
6767

68-
if (ns_type == MLX5_FLOW_NAMESPACE_FDB)
68+
if (ns_type == MLX5_FLOW_NAMESPACE_FDB) {
6969
attr->esw_attr->split_count = attr->esw_attr->out_count;
70+
parse_state->if_count = 0;
71+
}
7072

7173
return 0;
7274
}

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3936,6 +3936,7 @@ parse_tc_actions(struct mlx5e_tc_act_parse_state *parse_state,
39363936
}
39373937

39383938
i_split = i + 1;
3939+
parse_state->if_count = 0;
39393940
list_add(&attr->list, &flow->attrs);
39403941
}
39413942

0 commit comments

Comments
 (0)