summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Boiko <serhiy.boiko@plvision.eu>2022-10-06 21:04:09 +0200
committerDavid S. Miller <davem@davemloft.net>2022-10-07 09:48:34 +0200
commitfb4a5dfca0f0a027e2d89be00e53adb2827943f6 (patch)
tree0aa4e8c18a11044490b11c1aabfe00284858a1a2
parentipv4: Handle attempt to delete multipath route when fib_info contains an nh r... (diff)
downloadlinux-fb4a5dfca0f0a027e2d89be00e53adb2827943f6.tar.xz
linux-fb4a5dfca0f0a027e2d89be00e53adb2827943f6.zip
prestera: matchall: do not rollback if rule exists
If you try to create a 'mirror' ACL rule on a port that already has a mirror rule, prestera_span_rule_add() will fail with EEXIST error. This forces rollback procedure which destroys existing mirror rule on hardware leaving it visible in linux. Add an explicit check for EEXIST to prevent the deletion of the existing rule but keep user seeing error message: $ tc filter add dev sw1p1 ... skip_sw action mirred egress mirror dev sw1p2 $ tc filter add dev sw1p1 ... skip_sw action mirred egress mirror dev sw1p3 RTNETLINK answers: File exists We have an error talking to the kernel Fixes: 13defa275eef ("net: marvell: prestera: Add matchall support") Signed-off-by: Serhiy Boiko <serhiy.boiko@plvision.eu> Signed-off-by: Maksym Glubokiy <maksym.glubokiy@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/marvell/prestera/prestera_matchall.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_matchall.c b/drivers/net/ethernet/marvell/prestera/prestera_matchall.c
index 6f2b95a5263e..1da9c1bc1ee9 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_matchall.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_matchall.c
@@ -96,6 +96,8 @@ int prestera_mall_replace(struct prestera_flow_block *block,
list_for_each_entry(binding, &block->binding_list, list) {
err = prestera_span_rule_add(binding, port, block->ingress);
+ if (err == -EEXIST)
+ return err;
if (err)
goto rollback;
}