]> git.baikalelectronics.ru Git - kernel.git/commit
prestera: matchall: do not rollback if rule exists
authorSerhiy Boiko <serhiy.boiko@plvision.eu>
Thu, 6 Oct 2022 19:04:09 +0000 (22:04 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 7 Oct 2022 07:48:34 +0000 (08:48 +0100)
commit4939ac223d2630ab45e6614b1035a6555efd3b71
tree0aa4e8c18a11044490b11c1aabfe00284858a1a2
parent223dc0c7c77e349a3e24a5d39b49647fdb12cc2b
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: 6f80ce629036 ("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>
drivers/net/ethernet/marvell/prestera/prestera_matchall.c