Skip to content

Commit 52feb8b

Browse files
daniellertsdavem330
authored andcommitted
mlxsw: spectrum_flower: Fail in case user specifies multiple mirror actions
The ASIC can only mirror a packet to one port, but when user is trying to set more than one mirror action, it doesn't fail. Add a check if more than one mirror action was specified per rule and if so, fail for not being supported. Fixes: d0d13c1 ("mlxsw: spectrum_acl: Add support for mirror action") Signed-off-by: Danielle Ratson <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 44bde51 commit 52feb8b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
2121
struct netlink_ext_ack *extack)
2222
{
2323
const struct flow_action_entry *act;
24+
int mirror_act_count = 0;
2425
int err, i;
2526

2627
if (!flow_action_has_entries(flow_action))
@@ -105,6 +106,11 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
105106
case FLOW_ACTION_MIRRED: {
106107
struct net_device *out_dev = act->dev;
107108

109+
if (mirror_act_count++) {
110+
NL_SET_ERR_MSG_MOD(extack, "Multiple mirror actions per rule are not supported");
111+
return -EOPNOTSUPP;
112+
}
113+
108114
err = mlxsw_sp_acl_rulei_act_mirror(mlxsw_sp, rulei,
109115
block, out_dev,
110116
extack);

0 commit comments

Comments
 (0)