From patchwork Wed Jul 19 13:57:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Poirier X-Patchwork-Id: 13319025 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 08D2EC001B0 for ; Wed, 19 Jul 2023 13:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229492AbjGSN5M (ORCPT ); Wed, 19 Jul 2023 09:57:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229782AbjGSN5K (ORCPT ); Wed, 19 Jul 2023 09:57:10 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2057.outbound.protection.outlook.com [40.107.92.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AB4C1A6; Wed, 19 Jul 2023 06:57:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gnUlXwuxVS0BfATw9o2pvUNbmYczuWaBVCVnN1A5DGqxep/go+xyLREf7tbVAYgI/liYEuwcgEx5Mi4xbYjT0EN4YjOe8W3Qh4MHuuLX2OGumVAeM11ULHTlXu8T55glNGFOae8ylsDp7jCNDR0E9kaAXjLmyqz/T3iCszfLEWa0TZBaNnxbcXaa1xWc80PY7GKADk5oThKnwhGLzm7wsr+AgLzXqk6D8QVK2Z4YGa6H4erxTKPOZhc+8mzyGTQpCwM0EvsscdgPNai7v3CtUoC1iqol8QPvoLOPrZgzFbHS9ldNVokxq2f+CTgoLVqGKv7CiUvPSnO2Z5Vmid7Exw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=F8qym46ezgNLckAquWwjj52z0sAT/TNeBm2ZDzAWXwA=; b=QkxXmsSD4Jh59QEOPdBg5oEXxx3nmyO9IRWNw77XKwvXzmJFMFSC6eLiy9t/PDE/QPoxLgihhc7dWQzN4LC8u3eCoxPyPDBzRMK2YHhI+rhprRAhWjEaYs4lZ6NIQNcyT/xvbKYadMHPLFoggTLvb2pUkC0fR3wBGr5juoSAP6F4Pgw3fxdW9R7K/jUnnizqyr82FGOzZiCJURsXBB9v0ql3WG38PsphPxt/GQ0xCnZYnVfhZ2+27ivnfzDCjG8DDLB/2sikmwGWX9zdKaUUxKmv01ZIopF5Ae7XUiJqJgaYJiKPAsfW6EtjGAnMOhzkGnp6fePxm4GkHiE08MfNqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F8qym46ezgNLckAquWwjj52z0sAT/TNeBm2ZDzAWXwA=; b=AEFDbI2lVGto4iHG+vNu0qGvTf/Dzfy1j15yq1oQj/KR3vM8sFJTc48S2WBe+HurS1mvkl8jhFNAKM9nMHABpsjhJa6BIeTC0UCx5FnEDqabh4+ts2uNo3LthA3D4OB4psnBxlHWcL7UPq23K1vYSxqTZQnGZ0YfcKy04pJRRJLlJsO6tig2u/cku9J27GdO3by7fX2tG+8uXC1J2B0NnJjCn1gKnz8H9YnBofj0SmGymMa8avcjqkHjMu8nY/7ZBQUmXBRL8AR2o9+14JpNU6TqY4qED3VCrzzLjWpMQS+7GTmCdakpfa1zaFVzWTdOirfkagk0a0988eq/RLpPkA== Received: from MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) by SA1PR12MB6994.namprd12.prod.outlook.com (2603:10b6:806:24d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.23; Wed, 19 Jul 2023 13:57:06 +0000 Received: from MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::982f:232b:f4af:29ec]) by MN2PR12MB4373.namprd12.prod.outlook.com ([fe80::982f:232b:f4af:29ec%5]) with mapi id 15.20.6609.022; Wed, 19 Jul 2023 13:57:06 +0000 From: Benjamin Poirier To: David Ahern , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan CC: "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , Ido Schimmel Subject: [PATCH net-next v2 0/4] nexthop: Refactor and fix nexthop selection for multipath routes Thread-Topic: [PATCH net-next v2 0/4] nexthop: Refactor and fix nexthop selection for multipath routes Thread-Index: Adm6SOcQ1ibIthrqHEOswUMI1khpHA== Date: Wed, 19 Jul 2023 13:57:06 +0000 Message-ID: <20230719-nh_select-v2-0-04383e89f868@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: YQBPR01CA0115.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:1::15) To MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) x-mailer: b4 0.12.2 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB4373:EE_|SA1PR12MB6994:EE_ x-ms-office365-filtering-correlation-id: 1fea5227-692a-40d9-0004-08db88600989 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: sKAJbf0fUoZVHbqO2hk3a/IN/I3RhpJI210Ms06RumzMZf+tNaHWkocQrCLz2VzcdpJuMT2DYCEzf9A/ZAvUd4eRk5ydLCBbPXjUXu8UxbJRZum+HNv1vJfn2D1+/1bVAKny4LH2/bq33RTjCjjE8hPCbhAAhVWXRNAO8zbExRf3BI+1lXpQXhJARSvj6amdrUf2dmPrz6Au32NPhe+1Vivevo/h97PdSU0SX/TVJ3vPfO7TJ/8KLLgNWe9XWG86ldB4pxEcHMqhfzosfSir17879oYKnu90IodogOyfqyj2wuybMHwSocW6HaFNnHR9jdef0FbB52DM1HW3LMnQPAgLxg40/U8Nt+kt3bi/irb6ZDpVbCcezL9MbQO1VQOcUTwHc4qjYDZy/D99ZMUsXeeQdUsucm2NYFr1R9U7D8kPfFxmlgt+R8XlPp+NrVS+kGx1A2is1pqCCLD05/zIrR/xAQ2WhTqVr0tfXe7kcDWI8BkrF+QDUDpFUAnrq4bwLGdtz3y9qQIT+AQc4P11ZVymHPtY1u6WxYYdqlyCz031MOqwbmzIhGiR193g1JhivDeWhB8iwYR6EWAP09ouJdhvL8+zKRxqjv5jckDb9kE= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4373.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(366004)(136003)(39860400002)(376002)(396003)(451199021)(316002)(41300700001)(66476007)(64756008)(4326008)(66946007)(66446008)(66556008)(5660300002)(8676002)(8936002)(2616005)(83380400001)(86362001)(38100700002)(122000001)(186003)(26005)(966005)(6486002)(36756003)(6512007)(6506007)(107886003)(110136005)(54906003)(478600001)(71200400001)(2906002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?NWOIMxk76PX65VF40rlfDtScbItL?= =?utf-8?q?92JZ+H/8Ph1dA4A0rXuyA9b8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u640ElcEIVBKtgBsJU5Vw5ZxNZwL?= =?utf-8?q?3Gfu9ZXKSRpWJDtpHYhrcyv9OFqBUuylbXG8OgkuP0UnAmdDX4Pr6fjwyJjh6RbI+?= =?utf-8?q?a15yRN7jVNG6wPpFMqNnnDL2riwwE81JE6Vkj2Ub7tzb5a4K7SMBi6sl83PHH2pVB?= =?utf-8?q?yxRMkRhzjoSsCFrBvgICFZRAOk5zOdywCp4LHXtmmteQXsu0V2d9aGOytK87yAHIh?= =?utf-8?q?SzX/IVX59caYQB4V/XDX6XfPqnclnLOFxlkzAdnRgFQcEqI99eS0bjxDCGWrdc3BB?= =?utf-8?q?pA0v/SHJV/ixG/awIXM7y0+1X5jLj+Ux7dOK6bU/smNwIY0SUnUPfbO7LbRbUmZUy?= =?utf-8?q?gcUo45We5a6KyK7UOm/QFsoJyIbuZmVKngR9IKyyL9/EpUbD5cZkzfAUtv5Rzo2D5?= =?utf-8?q?q1V3c3IsbmgcAq9+mw7jEsN4N5nH82GychaMvAgaBnwRWYj/u+JvCk6Jg4Rrucrc9?= =?utf-8?q?DnLAWqGMc/a/How7KAOyk8IMQyux6rcAC50MEQz7LvLjcJ8kPniZvcSfmt3oCUhtA?= =?utf-8?q?3vvuYrn+OBbVjSCzH9OPgigeTML8t4ohUcYC+o2o29PnjwSG4wSkNrZ/ZhLCEKHZ/?= =?utf-8?q?AfQccR/4bv6a?= Content-ID: <8E9D4BB7EE706245B6BA73BAA5750378@namprd12.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1fea5227-692a-40d9-0004-08db88600989 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jul 2023 13:57:06.1225 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 2fEl6yldKqbnGaKyqmAHdj+K3iDJ4gSGsfr7EdlhgaL1mF1dJro4S+qnmZ4FtScMND6DB8c7dxtND9dNGK6yLg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6994 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org In order to select a nexthop for multipath routes, fib_select_multipath() is used with legacy nexthops and nexthop_select_path_hthr() is used with nexthop objects. Those two functions perform a validity test on the neighbor related to each nexthop but their logic is structured differently. This causes a divergence in behavior and nexthop_select_path_hthr() may return a nexthop that failed the neighbor validity test even if there was one that passed. Refactor nexthop_select_path_hthr() to make it more similar to fib_select_multipath() and fix the problem mentioned above. v2: Removed unnecessary "first" variable in "nexthop: Do not return invalid nexthop object during multipath selection". v1: https://lore.kernel.org/netdev/20230529201914.69828-1-bpoirier@nvidia.com/ --- Benjamin Poirier (4): nexthop: Factor out hash threshold fdb nexthop selection nexthop: Factor out neighbor validity check nexthop: Do not return invalid nexthop object during multipath selection selftests: net: Add test cases for nexthop groups with invalid neighbors net/ipv4/nexthop.c | 61 +++++++++---- tools/testing/selftests/net/fib_nexthops.sh | 129 ++++++++++++++++++++++++++++ 2 files changed, 171 insertions(+), 19 deletions(-) --- base-commit: 36395b2efe905650cd179d67411ffee3b770268b change-id: 20230719-nh_select-0303d55a1fb0 Best regards,