From patchwork Tue Jun 5 10:39:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 10448011 X-Patchwork-Delegate: jiri@resnulli.us Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B272F60284 for ; Tue, 5 Jun 2018 10:40:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A00B22903D for ; Tue, 5 Jun 2018 10:40:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94F2029041; Tue, 5 Jun 2018 10:40:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E95EB2903D for ; Tue, 5 Jun 2018 10:40:39 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 410Sxy1jRbzF1wB for ; Tue, 5 Jun 2018 20:40:38 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="RZEOJXhW"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=40.107.0.58; helo=eur02-am5-obe.outbound.protection.outlook.com; envelope-from=idosch@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="RZEOJXhW"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00058.outbound.protection.outlook.com [40.107.0.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 410Sxk14qgzF1l4 for ; Tue, 5 Jun 2018 20:40:26 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2babkrVRIzVkL/m2KSEMnPrdJevCzO65BU+OTiTQh+8=; b=RZEOJXhWWjNkQvPS2J2rXnoWE7UuN4k72JYnHdmGJ7nMUIHn7c8VN6MfLfc08ELbYGwOzPFs7uDOqiNHU+DZAbJ+s9aoK4EU0BQFfSPeC0fgmCjIbzeJwEQi/WCsR357TB8s1Y4FlZ1YC/XGW6DDQqqL5PoCjg01o3hytGORw4E= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=idosch@mellanox.com; Received: from splinter.mtl.com (193.47.165.251) by VI1PR0501MB2334.eurprd05.prod.outlook.com (2603:10a6:800:2c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.820.15; Tue, 5 Jun 2018 10:40:11 +0000 From: Ido Schimmel To: linux-internal@mellanox.com Subject: [PATCH net-next mlxsw 3/3] mlxsw: spectrum_router: Align with new route replace logic Date: Tue, 5 Jun 2018 13:39:40 +0300 Message-Id: <20180605103940.5248-4-idosch@mellanox.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180605103940.5248-1-idosch@mellanox.com> References: <20180605103940.5248-1-idosch@mellanox.com> MIME-Version: 1.0 X-Originating-IP: [193.47.165.251] X-ClientProxiedBy: CWLP265CA0005.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:10::17) To VI1PR0501MB2334.eurprd05.prod.outlook.com (2603:10a6:800:2c::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2334; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2334; 3:dDuCPxEyXonbVPnoX1uMe3QIFl/YUoxLXk1AfBnkwO3Dggmzqdy79Yc39fsEJEr8Oy//+12NgxrjBS5sYZCnfdJSy4JB5/P+Cp2VKOj1iV7D+N6jUZ12i/0h6RKPVEtfCMgCZR75KFkHLJFo0T1H9NH6QMcvXP3v/3wXCeYm96DaptOsfP5aSBCgBjTKHydjVgsoH6Oa8yJRqhS218/kNq/88mKgz/IYvaKxjYlbu6uPhrogH6yBBAdHUds86hwM; 25:PKRZwPeLY3g3Fgmtd5Fv5aTI+SNx+KxgQKKfwOFaIZaOH2SpYx2LmToAB31hGx7aqSEhL3IGKK+1Ei78hdGjcUclvo9QTWKKRtpAEBW4q2drqtnfO1i+f1qgeF6X+MOhIY5c4kVEQt0k/KUX2XO81j3fsh0EaBw+riovxSGJ9FcKmyEb8F6Rc306KwGHoauLEVq2ueapZpIB5u1HSEm6HX9lqQmyi2A6Q1ai5qQbdJ084S7iKLSZ3vJLRgoEKqv36KYuedA5LEGh/ByjUO8uCQMtsQGZdj9qihRk/KPH0Zr2WdsaQHRy392pkscoF+T+ytSNC+c+qP3TKTt5QVYBdQ==; 31:RVNk6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yI/c7P9GZOfa0PKmFMXiTPUjJNZPef6ZEb9G0Gdz4cWyyiB8NpltVXnalKvNh3XokvPAM6gh+g X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:VI1PR0501MB2334; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2334; X-Forefront-PRVS: 0694C54398 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(396003)(39860400002)(366004)(376002)(346002)(199004)(189003)(81166006)(66066001)(4326008)(81156014)(97736004)(8676002)(476003)(76176011)(6486002)(6506007)(7736002)(52116002)(386003)(37006003)(86362001)(106356001)(47776003)(16586007)(51416003)(305945005)(316002)(50226002)(486006)(8936002)(2906002)(956004)(5660300001)(6636002)(6666003)(68736007)(3846002)(6116002)(446003)(6512007)(2616005)(48376002)(50466002)(16526019)(26005)(2361001)(478600001)(2351001)(53416004)(53936002)(105586002)(34206002)(11346002)(25786009)(36756003)(107886003)(1076002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2334; H:splinter.mtl.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0501MB2334; 23:xkwydKr8qN0We7o6EVCSOBY+XvFEsP5kFwlUcHP?= =?us-ascii?Q?EyrYynAHeyVvPXjPJC7IPFUArAiQDtSQVwIaY7Rnf7J+ZEXPWesA3jYt4WCe?= =?us-ascii?Q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P8L/rFRkuh92U4mL67H6tpANYVUIkVCrpW7aVXC3J3r?= =?us-ascii?Q?x4DrhecOPOOxTpKn6WqmA+35q+IKAudoIf9DAn1n0hkUIXREnGZ8ZFaGdFDf?= =?us-ascii?Q?bARxcrKSSaJLHVexbZEN5TRRrUXhj24cdsf2DzJ1RVOH7P+H068QWW8q1Vnf?= =?us-ascii?Q?vlyS2aWbJzXXI3h73L/ZAXtywcAp0nNXSmuetzg/plwCnfkteNYq8FyNOQ8L?= =?us-ascii?Q?E2Zoc1byWuS06zSRhXpPyNRLzkvg1A1zYcuMeSo6JEeSJy04huikX8binUdh?= =?us-ascii?Q?+dl+PmmfAhTP5sPCfpONYQPPKXfcIi36JiyaD/YthysAcx7d98cTuF1YmXzx?= =?us-ascii?Q?WlOKGV4USdoZIy5ytEw6xLrc=3D?= X-Microsoft-Antispam-Message-Info: eiGk9m8evuox0nuyTrZmvv3zSJqL+PHcu7reiSc/SkO9S0S7s45U+tXYkhaU+Vnz6a+a81XixoLHAtN2njeMX28jRGFDYv8RRG/NbycJmqPcs9Fxjh9XnTRRrTxVeWNFHbfwgzLLINrBY/8pn3vf33tB6T8QHunYUqSSxvJNCFtXa7d9ah4A/A9V6IsiNmSq X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2334; 6:fa0EG96nYu6Vl2tZNOLhOeIdCkYcNzmRWDHDGNx3Xd1BeBwkOZDNy9XoOW7W9/6ZSPLw9b9XvId/tWNZknFvAM7I2R19LL7O2k+xFJYxbKOvG7e6J4LEOEm13JtIkry596GpIpVsCiu8V78u8gS12g//lCnBKCejodBy1m33ityLtoxmiyINnskAUpeFE3U68DPu4/4w6ouCW2tR+TFXS05qZBLIhPic785Z9phzMG9XN0Uhgzs43wa18+ie6Hnawjygc9HsInSuUZFzxra9GZSRidc5LiU+UH7ezPb7nHZXHtSzyYfQG9vLCQnzfF/Oaqj4P4P3abpEnhc35sZ/eH0l4FUhVPfkQLzzM/DM9GVWLPXqBwv3ouKisiVrFe5sGAos4nq/A9wWbnDWNk42W7BewufeypsDijeTeZSRyYqBxHD4U4cGjIi8FiBqgEANUQzn4owOGT/aIExf3yVLig==; 5:xK7evertVc6kiUfBWfRtgF7zgesONT7x5URSTKmhHg3r8OajOTrdKP2YLG+hkywco1ywi0ScvcLtnu8gneIaz4E5Ij0aTFJKglKIDPXobvCAoUd7zY0MODs5Hnpi9C7l3qgyeCJ81l2li9/BlAhJ/HJOOsfkI9s3SYlPhCUM1Vk=; 24:fkt0xLEylho4CrZlo7WfyjSgaONR28x/6Jc6U9eZHWm7FQQVk2SShIpyv1XfRrWRYKobJAtl6PoEwfjcPPqQtNNrlPi6+m4Rfgf8Sp3f080= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2334; 7:ZhtC5S6e2yIsjr/jsW4xejE3GcgJB+rtOXH773XJCAfNQsjvjszJ8ZHoswck6ggourAj5HgCOfUQafsk+k/d4xIs+JAP9tRj2icO5OeEPamZXFmJLfie+y44AGBiz17t9cQm+pqoEdARvXkCRV5m6sVlEa4yRMQ8V4J43Jqa1yOnuN8zjisgAgPSnTLTJRs38ULkUTCBeOSnor1bXQ424bqxgcXbppxYcNP6Iz194/LIufuGvyG1MBm+kl0y+wI3 X-MS-Office365-Filtering-Correlation-Id: bdef7ac1-3f93-414c-1d27-08d5cad0b718 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2018 10:40:11.2081 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bdef7ac1-3f93-414c-1d27-08d5cad0b718 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2334 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP Commit f34436a43092 ("net/ipv6: Simplify route replace and appending into multipath route") changed the IPv6 route replace logic so that the first matching route (i.e., same metric) is replaced. Have mlxsw replace the first matching route as well. Fixes: f34436a43092 ("net/ipv6: Simplify route replace and appending into multipath route") Signed-off-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 6ddb1a4e23fa..6aaaf3d9ba31 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -5163,7 +5163,7 @@ static struct mlxsw_sp_fib6_entry * mlxsw_sp_fib6_node_entry_find(const struct mlxsw_sp_fib_node *fib_node, const struct fib6_info *nrt, bool replace) { - struct mlxsw_sp_fib6_entry *fib6_entry, *fallback = NULL; + struct mlxsw_sp_fib6_entry *fib6_entry; list_for_each_entry(fib6_entry, &fib_node->entry_list, common.list) { struct fib6_info *rt = mlxsw_sp_fib6_entry_rt(fib6_entry); @@ -5172,18 +5172,13 @@ mlxsw_sp_fib6_node_entry_find(const struct mlxsw_sp_fib_node *fib_node, continue; if (rt->fib6_table->tb6_id != nrt->fib6_table->tb6_id) break; - if (replace && rt->fib6_metric == nrt->fib6_metric) { - if (mlxsw_sp_fib6_rt_can_mp(rt) == - mlxsw_sp_fib6_rt_can_mp(nrt)) - return fib6_entry; - if (mlxsw_sp_fib6_rt_can_mp(nrt)) - fallback = fallback ?: fib6_entry; - } + if (replace && rt->fib6_metric == nrt->fib6_metric) + return fib6_entry; if (rt->fib6_metric > nrt->fib6_metric) - return fallback ?: fib6_entry; + return fib6_entry; } - return fallback; + return NULL; } static int