From nobody Mon Apr 6 22:51:28 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 641ECC433F5 for ; Thu, 6 Oct 2022 19:26:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231671AbiJFT0Y (ORCPT ); Thu, 6 Oct 2022 15:26:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231631AbiJFT0U (ORCPT ); Thu, 6 Oct 2022 15:26:20 -0400 X-Greylist: delayed 1186 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 06 Oct 2022 12:26:12 PDT Received: from syslogsrv (unknown [217.20.186.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEE029E6AD; Thu, 6 Oct 2022 12:26:12 -0700 (PDT) Received: from fg200.ow.s ([172.20.254.44] helo=localhost.localdomain) by syslogsrv with esmtp (Exim 4.90_1) (envelope-from ) id 1ogWAN-0004O0-OZ; Thu, 06 Oct 2022 22:04:19 +0300 From: Maksym Glubokiy To: Taras Chornyi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Volodymyr Mytnyk , Serhiy Boiko , Vadym Kochan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Maksym Glubokiy Subject: [PATCH net] prestera: matchall: do not rollback if rule exists Date: Thu, 6 Oct 2022 22:04:09 +0300 Message-Id: <20221006190409.881219-1-maksym.glubokiy@plvision.eu> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serhiy Boiko 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 sw1= p2 $ tc filter add dev sw1p1 ... skip_sw action mirred egress mirror dev sw1= p3 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 Signed-off-by: Maksym Glubokiy --- drivers/net/ethernet/marvell/prestera/prestera_matchall.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_matchall.c b/dr= ivers/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 *blo= ck, =20 list_for_each_entry(binding, &block->binding_list, list) { err =3D prestera_span_rule_add(binding, port, block->ingress); + if (err =3D=3D -EEXIST) + return err; if (err) goto rollback; } --=20 2.25.1