• Serhiy Boiko's avatar
    prestera: matchall: do not rollback if rule exists · fb4a5dfc
    Serhiy Boiko authored
    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: 13defa27 ("net: marvell: prestera: Add matchall support")
    Signed-off-by: default avatarSerhiy Boiko <serhiy.boiko@plvision.eu>
    Signed-off-by: default avatarMaksym Glubokiy <maksym.glubokiy@plvision.eu>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    fb4a5dfc
prestera_matchall.c 3.23 KB