From patchwork Thu Jul 27 15:59:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13330327 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD36818034 for ; Thu, 27 Jul 2023 16:00:14 +0000 (UTC) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2079.outbound.protection.outlook.com [40.107.102.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D460DBC for ; Thu, 27 Jul 2023 09:00:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N95DC55vitIvbfHgPxKawLpxRu/hfI0mZK2VnBt7jDN2WCsu47NRC93RnkTjJvxcLeRE4Pbcm7StFylHEBzM/CMnc8inpayCkpQ922vIj9qg+5G14uGPVDT+E8lUabqqoO0S7GSogl8sF8BvJ0smgRrvVsqkUqs8Q8+0yAo1GyPr/YkdLIp0JFDR5jJzwypPTmGzgr1RWlhvgmk9Tji2hvHfjZy07KfBXiIPUd9d0uwVOnPP4VZKKpLg7iTqx8c1L7iqVPKsdPv/KbNOKeN0Hc4BDN7bdYAXOS0eYlI4BvvgS+LgmVU41zA8W3FAxPnPSX1dAHrlxJlGZG+HY/AQ5A== 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=iS7bqzzktasQFNzaqU14tfwUjM1TQJPGr4t1kbKEiE8=; b=PyRalcV+aDGv/P3gs8sZQaAdy6mL3NUIqlrfcMWRagh1zIJLusXR2qJ6eIwKh6NNdzOIFW+7YzA0twW9ATY3Z7fM6d0t6ANF42LpBTRqYAdN7BFoRxRWyVvS4hgRfUXYfmGrss7QaxeUG/6Un5ZCFbPjItgZVhuJ9WnALJNOTrKLs4KrF3cyV5LXpOfT0ndDYcjSXjSBvn/vTI336QajL434p3uEk1BTB8Dddv8HwUMa1CoD+MJeVx26D9YvtS2sxiAqNr9H1B5XCTPpT8XVmD5gMrTlJl1jnWH+j/lc5laBfMUzypVh2gdAwqMk5I4A2sEg2f3Xfqx9T0oqWcTp8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=iS7bqzzktasQFNzaqU14tfwUjM1TQJPGr4t1kbKEiE8=; b=cDq/ID7DPTzaZYBFbK6ZvXMENabIPitmH/CbtRVDNgKpheTUBvOmpEuq0vBeDFpDY+FjOg3GKxVS5y3ApA99oFeZk7K1PQ5GoDaqYqOgXfTbu8cPEA5rP4y0PLvx8c4xU0/niGKdPgqUi63rupNhkg6QoUKUQoyYSM8g81tR4BRrHRfNf9hahxJGFQvISDFT8yCG/aTszf+X49f3K/qvvmuSp9lClKhF9p7hsbRk496+BHWKhlT9ae32yFlR933WQ1/IKwHz0sLcnAlPp1JM5QCC1CTTHRQkTazXlWSsKdqXASxGZ567oKMDOiOaKbb3WJMxolDaLjHn9BcpguV5+w== Received: from BN0PR04CA0196.namprd04.prod.outlook.com (2603:10b6:408:e9::21) by SA3PR12MB8764.namprd12.prod.outlook.com (2603:10b6:806:31f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Thu, 27 Jul 2023 16:00:11 +0000 Received: from BN8NAM11FT107.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e9:cafe::ff) by BN0PR04CA0196.outlook.office365.com (2603:10b6:408:e9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Thu, 27 Jul 2023 16:00:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT107.mail.protection.outlook.com (10.13.176.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Thu, 27 Jul 2023 16:00:10 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 27 Jul 2023 09:00:02 -0700 Received: from yaviefel.vdiclient.nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 27 Jul 2023 08:59:59 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Ido Schimmel , Petr Machata , Subject: [PATCH net-next 1/7] mlxsw: spectrum: Drop unused functions mlxsw_sp_port_lower_dev_hold/_put() Date: Thu, 27 Jul 2023 17:59:19 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT107:EE_|SA3PR12MB8764:EE_ X-MS-Office365-Filtering-Correlation-Id: c4e8d35c-e9fc-407b-1beb-08db8eba8ea3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: do6fjpjyUsCPXhyrWfYS4aaGH30OOAVB8WlA2RTQ7XH1mkKA9AKl8Qg2XQ7d8DXx8FdwDVCjSVNyemg74BrMW3+3iQsLXT1HCprnXAoWy03WbP7W0Ob0b3N4jGH2BJMWe7n3nIXs2pXbm9YKoJf7q4wStaE5j8NRvdJO/GANFXqIaM8EtItWbXyx5v6ZtK2Fd4ErOLVWLIolPKhf88BAxdicXMPWO1Ev0w3R2tiwSfx2nU/eAfet5+0SaoQ7fh+HDyL3aGR1eZ7jx5xa3g5PoJLT5zgq2bHtMv72tJv+jw1n3WjsDLvIqS+8AHZDsAqMufcWm29kXgcmzVRfBwqOWmuJed4Tbj4vLrHSDxfg866EZVaQuB1rExxM13NF5uV9ccjWxMzYpEqjVIaklFHrrEdCPD1vHVS1vJoB20A1hmJQqDNrODIpicExTybZd04y2qROlMTeVY5xhmr/zMdfOVW2Kk80/ScphVwWpbfYheCxc6Nht2pBO72ki0tOqtfH5GpMBd81X5voUXuXgEA8V652s3Z0VmmoiuszY+Mu4voKFpIgiBEZaUITHpomVQuTnsYDy69v7ddQeNWds7wmSPSgNYAM42Ke9iuL9aEGiOuVoOtIiN41GIqKxr9BhcV0e4eREtNxKMvYv4LVIO2FNQsAQ11NnGiQJJTiIsT4VpBfmtrjKPtXJU2ZsiVc/nOvgZWjZbXLXd1dr7HrkrJ7C6HOC6ZRaVw3iUofktHQpb4XlqziMfwz8aONSgGuRROw X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(376002)(136003)(39860400002)(346002)(396003)(82310400008)(451199021)(46966006)(36840700001)(40470700004)(6666004)(7696005)(478600001)(356005)(82740400003)(83380400001)(47076005)(26005)(107886003)(70586007)(70206006)(110136005)(7636003)(54906003)(4326008)(426003)(186003)(336012)(16526019)(36860700001)(66574015)(2616005)(5660300002)(40460700003)(41300700001)(316002)(2906002)(8936002)(8676002)(86362001)(40480700001)(36756003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2023 16:00:10.9141 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c4e8d35c-e9fc-407b-1beb-08db8eba8ea3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT107.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8764 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org As of commit 151b89f6025a ("mlxsw: spectrum_router: Reuse work neighbor initialization in work scheduler"), the functions mlxsw_sp_port_lower_dev_hold() and mlxsw_sp_port_dev_put() have no users. Drop them. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 17 ----------------- drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 -- 2 files changed, 19 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index f0f6af3ec7c5..9dbd5edff0b0 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -4112,23 +4112,6 @@ struct mlxsw_sp_port *mlxsw_sp_port_dev_lower_find_rcu(struct net_device *dev) return (struct mlxsw_sp_port *)priv.data; } -struct mlxsw_sp_port *mlxsw_sp_port_lower_dev_hold(struct net_device *dev) -{ - struct mlxsw_sp_port *mlxsw_sp_port; - - rcu_read_lock(); - mlxsw_sp_port = mlxsw_sp_port_dev_lower_find_rcu(dev); - if (mlxsw_sp_port) - dev_hold(mlxsw_sp_port->dev); - rcu_read_unlock(); - return mlxsw_sp_port; -} - -void mlxsw_sp_port_dev_put(struct mlxsw_sp_port *mlxsw_sp_port) -{ - dev_put(mlxsw_sp_port->dev); -} - int mlxsw_sp_parsing_depth_inc(struct mlxsw_sp *mlxsw_sp) { char mprs_pl[MLXSW_REG_MPRS_LEN]; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index 65eaa181e0aa..62151f0531ae 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -720,8 +720,6 @@ int mlxsw_sp_txhdr_ptp_data_construct(struct mlxsw_core *mlxsw_core, bool mlxsw_sp_port_dev_check(const struct net_device *dev); struct mlxsw_sp *mlxsw_sp_lower_get(struct net_device *dev); struct mlxsw_sp_port *mlxsw_sp_port_dev_lower_find(struct net_device *dev); -struct mlxsw_sp_port *mlxsw_sp_port_lower_dev_hold(struct net_device *dev); -void mlxsw_sp_port_dev_put(struct mlxsw_sp_port *mlxsw_sp_port); struct mlxsw_sp_port *mlxsw_sp_port_dev_lower_find_rcu(struct net_device *dev); int mlxsw_sp_parsing_depth_inc(struct mlxsw_sp *mlxsw_sp); void mlxsw_sp_parsing_depth_dec(struct mlxsw_sp *mlxsw_sp); From patchwork Thu Jul 27 15:59:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13330328 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D5AA19881 for ; Thu, 27 Jul 2023 16:00:18 +0000 (UTC) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2048.outbound.protection.outlook.com [40.107.212.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A36ABC for ; Thu, 27 Jul 2023 09:00:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XxgW2YR4mVTF9EdLisNSLv+K/HwinaHvnqeDzd2TTg1NYQ0eCYAPvwuccH2MFd1lTMQtnlxJg5emptT7Fg8uLCLfEsB5d2YM+9EhBeXCSdCYaOGu7viG1/E+nRTVVRnWvvSgrX4wPhqioY9BQJXvluuGNVu+AHHLyTDILWb4Gom0NJzplLvjWT2OHIBag/wZD8TAC7OLilYVl6hYEBGHFBLzmc4ToqSL8zm6NJ8eX85jcpVshggWI/KHkbuyz0QP1H/5OQY94PV47A6YeO0faw7DigY2mdFL/qjek79VJdZazv7hdYLBovH75g7UFYq0gNjMFxhahxy/eH9PR0IQ1A== 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=xI/1D6h8az6sW/WZ4ko+e2xjaNWNlHfN6HEIUHFxccM=; b=B9GS2dRKQbyMshh909x+PJWW8p8IevgGESSxdKWdQz1R5cg4ZJmE0SXUUz4tES1FbgcJHMrFZzVR9772vZv+ts9p4F7eoSauw+yoq35x/hmg6xTacNEX3MPk83ri4yZn9/unSSmLhPzCbCvqcwx2Esb25U/nP/Xmy2PcKmi/FRhCIL0OWjX/igAdK+j43hl710pf+YcHKRuePz7N9IFfJlY4nEGRGwONi/20/mm9+Skhu4aj6fEWK2XkFiy97Y2LTg7Srw1fvz1SBKxRBNnYCnhqL848Mg5n9eTqhd8UPGKdq3oMOGhdq3lZDX29TUsdHsFLUiOWtPb8lnNCCllKAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=xI/1D6h8az6sW/WZ4ko+e2xjaNWNlHfN6HEIUHFxccM=; b=q9qDLb1RWdLItmRLMVMfZ+VDAxmxt+Y3cc+bLhgwiU3XZATBmqo3fna7UvVF3hgJxdVD1FhoLHCtjBbg4qwCBwCPVT2/cbDp14yBHYYxpj2zy/zQYdoSEwvckXK2/y7B6FVvjV4MO3LGRTrfc2QMsNkWaOHqZ6o8auQiXL6DFwiPzJVOta3vcZSNve/9QJ8ohQTIKep9tSt62qLnFFhYHT8wIeSwTtgVFZvaGVARd3qkLjc8hBXa0XfrLmwcsflAfsATYjtFz8XlzLu2MsDUk+PB7EPnLIxqBvLzazR3xrzagYZC4qogNjmClkeyOmr0EQ5ir3phxMQXzYgNrJDX2w== Received: from BN0PR04CA0181.namprd04.prod.outlook.com (2603:10b6:408:e9::6) by CH0PR12MB5266.namprd12.prod.outlook.com (2603:10b6:610:d1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Thu, 27 Jul 2023 16:00:15 +0000 Received: from BN8NAM11FT107.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e9:cafe::9b) by BN0PR04CA0181.outlook.office365.com (2603:10b6:408:e9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Thu, 27 Jul 2023 16:00:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT107.mail.protection.outlook.com (10.13.176.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Thu, 27 Jul 2023 16:00:15 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 27 Jul 2023 09:00:04 -0700 Received: from yaviefel.vdiclient.nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 27 Jul 2023 09:00:02 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Ido Schimmel , Petr Machata , Subject: [PATCH net-next 2/7] mlxsw: spectrum_nve: Do not take reference when looking up netdevice Date: Thu, 27 Jul 2023 17:59:20 +0200 Message-ID: <341d1046f89d8d839d9d00e4a3d58cdc351e9397.1690471774.git.petrm@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT107:EE_|CH0PR12MB5266:EE_ X-MS-Office365-Filtering-Correlation-Id: 3acdf1c7-6a40-4ed0-dd11-08db8eba9139 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5ns891eDbbCEamWWx2b5we78tn97WIziT2Q02Ugo7xZg+sNVrupphkenvobGU6nIxUN0rjSnzQEBpZ08MlRFDO1YxoZ94mRNgBv9+Taw4E4XOCm76pZCtzZ8pUNPzf5lDUUcFPlIFEmB9EjDvXeSWGi6VgOPYXfqsvSz7x88nFzKsGFEI8lVGxxc2C73rZzttlFJLDFDc/zFZKTA6p2s+kipwKV4/328+W/RpASdrPpyQYzfqfJ0liLZcikmht4+VSGylja7dya+K2F38rx54woc8ZPrxVFmGIh64GvCMuxnTrlmWjGqplOGOEKWl/oFXxSWUug/wNn11DZqO9WhBIL05vakc7QbFO5Wvcmfc+jmccqjOcEYSp2PdSjWY4rVKkuXvhly3fKZfYK17lWyv4Cy6G71AxKMYz3ejeQijeFCsT0nA3QsoCeqy0EaYc0UDlHE2gqkBj9eaasxgI1JOYl4jGHG7//i8QHv2KAPNCQ6QO8R1GVx5HC+a5yA0IxSOeaiUsKx1hx+vidp3szXjVFkufO5cQJnWML8u08sW5z3y01Q3ORce4H1xpLimPBJCyfNsSzAykhxLTOyXFzg9NOrBuoJcRbUG4opy+9t8AQGOQqkIpF00uhRf7X1pGfgRw6K0d2YNDvQeuIk3BIMJCnLYwWAOrFSDy4+sdvotyUsO2AoGGzsnt9b4aj1AaPmxSnrIM/X58fc6AqkCshR0pCmtwYkiz1EUghLkmAr2v4aEzBpDmSXAex75sXrUpSl X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(376002)(346002)(39860400002)(82310400008)(451199021)(46966006)(36840700001)(40470700004)(110136005)(54906003)(7696005)(6666004)(478600001)(36860700001)(83380400001)(36756003)(40460700003)(86362001)(40480700001)(2906002)(2616005)(47076005)(107886003)(16526019)(426003)(336012)(186003)(26005)(82740400003)(7636003)(70206006)(70586007)(4326008)(316002)(41300700001)(5660300002)(356005)(8936002)(8676002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2023 16:00:15.2575 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3acdf1c7-6a40-4ed0-dd11-08db8eba9139 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT107.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5266 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org mlxsw_sp_nve_fid_disable() is always called under RTNL. It is therefore safe to call __dev_get_by_index() to get the netdevice pointer without bumping the reference count, because we can be sure the netdevice is not going away. That then obviates the need to put the netdevice later in the function. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c index d2b57a045aa4..5479a1c19d2e 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c @@ -989,6 +989,9 @@ void mlxsw_sp_nve_fid_disable(struct mlxsw_sp *mlxsw_sp, int nve_ifindex; __be32 vni; + /* Necessary for __dev_get_by_index() below. */ + ASSERT_RTNL(); + mlxsw_sp_nve_flood_ip_flush(mlxsw_sp, fid); mlxsw_sp_nve_fdb_flush_by_fid(mlxsw_sp, fid_index); mlxsw_sp_nve_ipv6_addr_flush_by_fid(mlxsw_sp, fid_index); @@ -997,15 +1000,13 @@ void mlxsw_sp_nve_fid_disable(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_fid_vni(fid, &vni))) goto out; - nve_dev = dev_get_by_index(mlxsw_sp_net(mlxsw_sp), nve_ifindex); + nve_dev = __dev_get_by_index(mlxsw_sp_net(mlxsw_sp), nve_ifindex); if (!nve_dev) goto out; mlxsw_sp_nve_fdb_clear_offload(mlxsw_sp, fid, nve_dev, vni); mlxsw_sp_fid_fdb_clear_offload(fid, nve_dev); - dev_put(nve_dev); - out: mlxsw_sp_fid_vni_clear(fid); mlxsw_sp_nve_tunnel_fini(mlxsw_sp); From patchwork Thu Jul 27 15:59:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13330329 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45D5D19881 for ; Thu, 27 Jul 2023 16:00:24 +0000 (UTC) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2055.outbound.protection.outlook.com [40.107.212.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85FED271D for ; Thu, 27 Jul 2023 09:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ok8WL1ps5MEySt8iR/YPYNFRPV8ATk0RLssSKaj+q0yhtcHnh/H1Y0oID167tbDGDXIvy0aH53npg5Qbr/GYFlrzdoXo/mioAko74k3yUIoHp9+xKLJw1qgmbWzYbAdFotqVIwLr/0z4LMNPa2LXkg4EmFT5P5aRdRSZyekN5tyxcqF1r5i3d1kHbWRgMKuTHdrLzRLhhza42BXnDp2fwXKJfGtY9IOAjwZ21bA3A0Xv57aEr0nlRw/MIzy6cvpqptLTmqMiZTiXVOmor5yeLV/SLwd5l5X080P0H8oORGK8CvBGfegPTCJUTds29z6cG6g/XI0IEw5zCr2CJamtYA== 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=eqBQ89P9s9Aq/ubxUExOk6COg4HDxE+LKoVqQ36ky58=; b=KFUPkhyipybWXA6lYuerlFEP2v0vc1ov0sWaMfiD7YsbsskjclsmT22ReMrGqqcUFQI3P16w8vnYuqPjb3Glpip/jkNwxiys3wxr5nR71YBJ5X8TV8NoUV9lr9T+/elS1iSAsmN+iWuY7Ffb7xu1LdytPpfSSGKVdsH+nASH3ExjXx6ATOzsIxh/kSfZE0F7AQLPdhoOu9IQAJ1PNSJp71BoX2/qtMHaPU7lMKrptBs4L8TT8B5N2uvSqmDkeMplS7T37pf+kbl0UZ/0jnH04fcpVNj4WNiQvFu1cnobIcYh4NBabLUCGU/wLImg37UCOPm1SudGgZSbJGHnDN0rEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=eqBQ89P9s9Aq/ubxUExOk6COg4HDxE+LKoVqQ36ky58=; b=PWl2q5a/BeUfSWSUlECbCj4pDDzrqlaCH5zFHk77PRESiI0hAyyfvCN0FhuTLh3BWGnKgsGS6IKRIX5qdkHd4omRMwglq6GCfylmw9xTc5OmnvpCjwBSg23LEV9g3IGBDDD5YbIHVa4syu5ZKoIxaYyRt5U+oGQKEvQP8j0i92VSEvqrvljk8N7ujPXbVirMZ1+pdmE5rjMQ6vxf5ex0o9I+fFftguvjxhewWXuNlEopQ4hDh5jVvacx46QwGXGd+kW/Cbm2aLuvCjEGzhpvu/bxttUfdQjXteeQrG42OZsOQdkpvjz/gDBbJ15Mgdn31QmnwLcRXplexcy2ZYdHWw== Received: from BN9PR03CA0914.namprd03.prod.outlook.com (2603:10b6:408:107::19) by SA0PR12MB7463.namprd12.prod.outlook.com (2603:10b6:806:24b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Thu, 27 Jul 2023 16:00:19 +0000 Received: from BN8NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:408:107:cafe::34) by BN9PR03CA0914.outlook.office365.com (2603:10b6:408:107::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Thu, 27 Jul 2023 16:00:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT054.mail.protection.outlook.com (10.13.177.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Thu, 27 Jul 2023 16:00:18 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 27 Jul 2023 09:00:06 -0700 Received: from yaviefel.vdiclient.nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 27 Jul 2023 09:00:04 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Ido Schimmel , Petr Machata , Subject: [PATCH net-next 3/7] mlxsw: spectrum_switchdev: Use tracker helpers to hold & put netdevices Date: Thu, 27 Jul 2023 17:59:21 +0200 Message-ID: <774c3d7b5b0231f1435df2ec9dd660192e382756.1690471774.git.petrm@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT054:EE_|SA0PR12MB7463:EE_ X-MS-Office365-Filtering-Correlation-Id: abf6e998-1299-45f0-f60e-08db8eba936a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i32f7quyI3sEnmmWqS8RB5V7c3ZVw6V/Ivz9dARGVnLYVCu1X6BCQbDnNAAEJNnSSCEZCQ4rkyQUe81WYczJngGQ9XLu4LQnZyG1qYjeWbfQTILXaOat2rSUwLLuVAXst0AZTG3DrvmUoFmLisXLvVmh65TqR7ixu5BZSXq9FoFVorQkXbBFENy8A4NSCeuIdrGYOmWX3LKFkO1UFGFHUXHGTCg+gjHMiXzc/HfaiJYRix9+4U+7QkLnG76nTtq3BjP9mwKrL7ZHhWWBEwyZKjC7vRQZCdiljfoLh8W7AiSPRkR7WdbXz2B74LtXGcqtp9Rs557FF6Eb6SPviAiQSzRcmbULpLZL9x4MaRh3iUIg61X1r6V+ZBYIEeYxnJ1J5sC2cKpGUCyXjiKFGcdKFHGMsQQUBbDDxEqhjY7LesLu0jrn2rDjoVzjZc9Fiocda5Dy51F79B7kKm/TEc+GeezLGaXAQPeZyUYP4607+jiGP3JtgRCbCpHtKVLld1WiSlsn0KHBgvxbnofAl/Kp8XiyeKgGhhIGiPNIbXOL74nmzEkBJIyQ9HqpcWu3RLaAUeI2+kzrn1QScqR4JAtpe7BV1JxkOvb8suAmBaZ/Ya8FYfhDM0mnuSPa1jY7PIC7XvQ5GvLsvbSy6n/WF5goSN0jL1CEdhzw/iMukA9aXTWB4NB46jisGrIPPCKJB0K2vt+BpaQOjiC90SL+e5OGkj79EOEK6X5BQZRrViPSl6I/OHyBVTShJITud5aNUmRA X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(136003)(396003)(376002)(346002)(82310400008)(451199021)(40470700004)(46966006)(36840700001)(40460700003)(426003)(186003)(2616005)(26005)(336012)(16526019)(47076005)(36860700001)(83380400001)(4326008)(316002)(8676002)(70586007)(70206006)(8936002)(5660300002)(41300700001)(6666004)(7696005)(2906002)(478600001)(54906003)(110136005)(40480700001)(82740400003)(356005)(7636003)(36756003)(86362001)(107886003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2023 16:00:18.9504 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: abf6e998-1299-45f0-f60e-08db8eba936a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7463 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Using the tracking helpers makes it easier to debug netdevice refcount imbalances when CONFIG_NET_DEV_REFCNT_TRACKER is enabled. Convert dev_hold() / dev_put() to netdev_hold() / netdev_put() in the switchdev module. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index dffb67c1038e..5376d4af5f91 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -3380,6 +3380,7 @@ static void mlxsw_sp_fdb_notify_work(struct work_struct *work) struct mlxsw_sp_switchdev_event_work { struct work_struct work; + netdevice_tracker dev_tracker; union { struct switchdev_notifier_fdb_info fdb_info; struct switchdev_notifier_vxlan_fdb_info vxlan_fdb_info; @@ -3536,8 +3537,8 @@ static void mlxsw_sp_switchdev_bridge_fdb_event_work(struct work_struct *work) out: rtnl_unlock(); kfree(switchdev_work->fdb_info.addr); + netdev_put(dev, &switchdev_work->dev_tracker); kfree(switchdev_work); - dev_put(dev); } static void @@ -3692,8 +3693,8 @@ static void mlxsw_sp_switchdev_vxlan_fdb_event_work(struct work_struct *work) out: rtnl_unlock(); + netdev_put(dev, &switchdev_work->dev_tracker); kfree(switchdev_work); - dev_put(dev); } static int @@ -3793,7 +3794,7 @@ static int mlxsw_sp_switchdev_event(struct notifier_block *unused, * upper device containig mlxsw_sp_port or just a * mlxsw_sp_port */ - dev_hold(dev); + netdev_hold(dev, &switchdev_work->dev_tracker, GFP_ATOMIC); break; case SWITCHDEV_VXLAN_FDB_ADD_TO_DEVICE: case SWITCHDEV_VXLAN_FDB_DEL_TO_DEVICE: @@ -3803,7 +3804,7 @@ static int mlxsw_sp_switchdev_event(struct notifier_block *unused, info); if (err) goto err_vxlan_work_prepare; - dev_hold(dev); + netdev_hold(dev, &switchdev_work->dev_tracker, GFP_ATOMIC); break; default: kfree(switchdev_work); From patchwork Thu Jul 27 15:59:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13330330 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5C1719881 for ; Thu, 27 Jul 2023 16:00:25 +0000 (UTC) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2085.outbound.protection.outlook.com [40.107.212.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D48E8BC for ; Thu, 27 Jul 2023 09:00:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XzQMjymh4pj53xb7bz4Zar1AAnM0alvj8QY/zylL7EOMI11GZFLfTLOizhGBYeqPMpYwMw18mmNFx0By4FQxdpDKJ3gOWd1pyELDlerj3VHB0CTNNnK1s+C8reLhTMJDF2Bq56OlNiH8gAOm8ecnxgcI6wSl+Z/hI6zw/aHCRt5KjG7eVILSEmcI9iRjhIRU7qoiTful8vmSiePvgA4TQb3HLWCBvxyJMbyRqcEfm+7ULX2f1/aGmXuHfhmI9qWmGwiMML5mtM/LYIFxZeBKSKOdETfyoIT8JXPkeoBrfBkoSjET64VRnwlYu5wiiBQb6Ly5UOmG3ngwNs0OgCjGKw== 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=+u+uiaO2raHRtovAQACz9cieL/02lP0+qxQH4MgUi38=; b=UP4G3iyKx/NAx22q+rPxUR8ry4ynjlGjRfzslVpLl1BslqTnsqg0QSl2H9IPBlQQ1ft22rzc5KFPcNMbzbRuRjxsc31jAoaNgkuZi3aw3EqeJvYU3n6X7YsLWrEh3SLFdnRpob9EoN+qZqaMdRovuzCY+JSTk9EOONw1InojP9URoWmfF+DyB/vZMnC8dN+/WLB2ULkv4waEcxBY6bwhc4CRij6MFuckxWJrMTMHHBnc5t2fASluyDlmLr4qfk43/57xh9N+g7udoGyFG89K/jBu1diUDEt5eGQB4KroRnEFoje9cBLgiVn3Njfk0PhPsxnH8+CwkHWZxq5VFGaFKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=+u+uiaO2raHRtovAQACz9cieL/02lP0+qxQH4MgUi38=; b=ufRL4NbVPYu7QrpHneVGSsrDxDkvJd/xB4T1NJGpFy4xrYSQyqE3Z/bjHphdplMSgWVM5+78VlEuWbCkoNiHopRt7PqN/JcAJcNBPOTbth4GCzQh1B6/I77jV0Eu+5wvzL9Vi1FgvawSRLYdfn9oBDeiO7Syid4rGhUGbtJGjgMdzNRpwC8Gd9m+5zcErp9AZUAN6Ztux2FYjQVqtETK0SdaZEy/nLIpgRo3nQCMyIwyiGolIdIduTBTK9Pz1kIcmnCmZmgJEGnVPo7P4Y2sPuuVafZnovvQ+iVuBFX/0X0JqUllu23mTlaBabZEuKdik6PcZILpWxmb7AVJYI2ZBA== Received: from BN9PR03CA0416.namprd03.prod.outlook.com (2603:10b6:408:111::31) by DM4PR12MB6496.namprd12.prod.outlook.com (2603:10b6:8:bd::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Thu, 27 Jul 2023 16:00:23 +0000 Received: from BN8NAM11FT083.eop-nam11.prod.protection.outlook.com (2603:10b6:408:111:cafe::f6) by BN9PR03CA0416.outlook.office365.com (2603:10b6:408:111::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Thu, 27 Jul 2023 16:00:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT083.mail.protection.outlook.com (10.13.177.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Thu, 27 Jul 2023 16:00:22 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 27 Jul 2023 09:00:09 -0700 Received: from yaviefel.vdiclient.nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 27 Jul 2023 09:00:06 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Ido Schimmel , Petr Machata , Subject: [PATCH net-next 4/7] mlxsw: spectrum_router: FIB: Use tracker helpers to hold & put netdevices Date: Thu, 27 Jul 2023 17:59:22 +0200 Message-ID: <5221a92e751c40447c55959f622267ccc999ed04.1690471774.git.petrm@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT083:EE_|DM4PR12MB6496:EE_ X-MS-Office365-Filtering-Correlation-Id: d1ca6fc8-cde0-4bd4-d0ae-08db8eba9571 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: atxhk6DTflCHMBMfOds6Jz4xZ5YjC2hn0zOD5bdlQbZZLY6Hl2FLH8K/J1B7bMvz6HJuowSU4BQJb70OHGu3pn6aRZRthIsXJ9g3j23MdJSryUxc5VmlYMcjfuIbroK99CRCUVb3K4dIEd+udGpfSDVDeb7tnD89O8Bryq0A8KoI2t2kawyZBXONQw5f9ZzgJW0pZ2ZkR16XU+TkBrUQPOXK+hryjPZwq+K/1nn6c4BjxcKCima8KUDB13+g07dbBrVLjmOkTFeVKPiUGcMUS+BUI6oxubwa4GMPE9LOJtLk/yVoJEdEP2Q6BeEcGrveaV5wPmmTHL5Ez9gbAkdIPpEMyEku+mpJTN9JYSgJLCVhbAscU50JqbCgMh4q8fArnHFJH3GAOL2qs8feStRsXeLqs+wuEJYSDX5EEqRyEjoIf14K8Sf+aQtjBbrpraTs4DP8XLgmV1ncqGzYZr52nTjtPMsSZ68+pU7JbgV0dPnRMFOdeAbBR+upByWbOKFz5MsdWoCJT5aJPX9HeIvRiaBwNbqyE7KvDKpONvwSPy4rGTwDTi6/IvYkuqrkwm2lQKVQ5z/vH+KVH7PGferranlLkHIGEVp34W8G2M1hcVZr1VPKfhyU8hTR0G0DgsXl7TmJAxOyCZRDh6D1tWGAVELsuiUgguVULUSb7pXVH/tN4yxH1pkTJ7Y8BsHUewpt2mWhvrXtF7XMvp5oipQ7yiZ48dN0t9trWSCSyz2faOdcV3iykLp6+eWOEvVW6d6s X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(136003)(39860400002)(396003)(451199021)(82310400008)(46966006)(40470700004)(36840700001)(83380400001)(36860700001)(66899021)(478600001)(54906003)(110136005)(66574015)(356005)(47076005)(5660300002)(8676002)(8936002)(36756003)(2906002)(2616005)(426003)(41300700001)(16526019)(40480700001)(7636003)(70206006)(70586007)(86362001)(4326008)(316002)(107886003)(40460700003)(26005)(82740400003)(6666004)(7696005)(186003)(336012);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2023 16:00:22.3351 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d1ca6fc8-cde0-4bd4-d0ae-08db8eba9571 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT083.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6496 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Using the tracking helpers makes it easier to debug netdevice refcount imbalances when CONFIG_NET_DEV_REFCNT_TRACKER is enabled. Convert dev_hold() / dev_put() to netdev_hold() / netdev_put() in the router code that deals with FIB events. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 57f0faac836c..0744497f2762 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -7547,6 +7547,7 @@ struct mlxsw_sp_fib6_event_work { struct mlxsw_sp_fib_event_work { struct work_struct work; + netdevice_tracker dev_tracker; union { struct mlxsw_sp_fib6_event_work fib6_work; struct fib_entry_notifier_info fen_info; @@ -7720,12 +7721,12 @@ static void mlxsw_sp_router_fibmr_event_work(struct work_struct *work) &fib_work->ven_info); if (err) dev_warn(mlxsw_sp->bus_info->dev, "MR VIF add failed.\n"); - dev_put(fib_work->ven_info.dev); + netdev_put(fib_work->ven_info.dev, &fib_work->dev_tracker); break; case FIB_EVENT_VIF_DEL: mlxsw_sp_router_fibmr_vif_del(mlxsw_sp, &fib_work->ven_info); - dev_put(fib_work->ven_info.dev); + netdev_put(fib_work->ven_info.dev, &fib_work->dev_tracker); break; } mutex_unlock(&mlxsw_sp->router->lock); @@ -7796,7 +7797,8 @@ mlxsw_sp_router_fibmr_event(struct mlxsw_sp_fib_event_work *fib_work, case FIB_EVENT_VIF_ADD: case FIB_EVENT_VIF_DEL: memcpy(&fib_work->ven_info, info, sizeof(fib_work->ven_info)); - dev_hold(fib_work->ven_info.dev); + netdev_hold(fib_work->ven_info.dev, &fib_work->dev_tracker, + GFP_ATOMIC); break; } } From patchwork Thu Jul 27 15:59:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13330331 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E58319881 for ; Thu, 27 Jul 2023 16:00:31 +0000 (UTC) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2043.outbound.protection.outlook.com [40.107.92.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E054271E for ; Thu, 27 Jul 2023 09:00:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UdCk9uaUAgFEvfgmGggrYEx8BVc7JtGDhwImleNDMaYSgcZ3z6r57/Jz9vNiFsgvK1JTJjy8pBsQpvYEEzU52P4TFrHGaHnuryXrheNfEPnjZX1JSu6JguelHDrWMae5GBWAxw43quA7Insm+rpR9MFJCXTAnIf9+WSeeqLPLxASnYnr4J+VH/blOOIcYA/zw6yNnQ8wHIFxNeT/ImCgC4yhiwJytF6Q5lveL9zNbXhmXyDo7Jcg/I47UJfKeyr4q8mUdgkKgvuX3i8amsTwCLKl7LrAD0FeGasL5AaS/xPvOT1eFWD+FDe7Icb3TK2p+fu8yak678WC+g7DEX6rOw== 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=/E6RcOPzxOzk6wCd/b+ZOmfBf96ioDHUzLUGqriFMOU=; b=MV8c2WEmxJE1+b9NFUDCtBZOOIKCzmJsKXTcNRV3RUbwUZ53z0h2laE18UNzwF51Ghvl9uOedJbXxa9C09JwbYehhyj1r/En87Fj89h5wM77rrDMJQVPvRaHFEXJyg3vlx26uJ2f+L3h3juyxhFKSu1bftezeqhAPfJrqz+soR1132JdTIV3+RoQt/C23zQc/SSzSiK+CYNtvnncbZybMt87aVp1q05FCGyrO3nOf9gJBssZky008hkHbRwhZRj1uYPojBVM276a2PSKOsPCOptz7z6cAOaIvMIp/FIT4g2TG1pVYRbgHV+O+qwSxb96fmlNvwYaYqHY/h/ZN0IM3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=/E6RcOPzxOzk6wCd/b+ZOmfBf96ioDHUzLUGqriFMOU=; b=mqiGKa6sdkidfGuorx5FkzogG1Y/+8K64LUqtu7HcEZCv5SLtFHf2hPmEO5PCHOGQTKR5DxjZaenT6JADTajM0ZbMkawPwzY5dKgUGe7pOXZ5RW3xPsxtpfCW+ilLnPfjPe/HawfC4iPEhcY3OFC14/Bk3iyi27m7crHkEnaxjPbD7s/ZRVZFrW0H/1WucH7P8m60T2HIeMvdOy0AFJHvESw26/kSlfckOpt0qrFs5Liub845kcT4nwCg5FCNanc4VrcOoINn5RaUlY6nqswWkBKD7H8Jevlmf0SY1Vf9Y0i+q3g17TV1xquMt0bAu6ksos8R7oD2goMNaSw2ww1lQ== Received: from BN9PR03CA0929.namprd03.prod.outlook.com (2603:10b6:408:107::34) by SA1PR12MB7102.namprd12.prod.outlook.com (2603:10b6:806:29f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Thu, 27 Jul 2023 16:00:27 +0000 Received: from BN8NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:408:107:cafe::6e) by BN9PR03CA0929.outlook.office365.com (2603:10b6:408:107::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Thu, 27 Jul 2023 16:00:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN8NAM11FT054.mail.protection.outlook.com (10.13.177.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Thu, 27 Jul 2023 16:00:25 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 27 Jul 2023 09:00:11 -0700 Received: from yaviefel.vdiclient.nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 27 Jul 2023 09:00:09 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Ido Schimmel , Petr Machata , Subject: [PATCH net-next 5/7] mlxsw: spectrum_router: hw_stats: Use tracker helpers to hold & put netdevices Date: Thu, 27 Jul 2023 17:59:23 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT054:EE_|SA1PR12MB7102:EE_ X-MS-Office365-Filtering-Correlation-Id: 702a9ca1-161d-495e-b456-08db8eba9769 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +UY4Rvp09p9Ide9ZTf2RtxoYX0Q++wSbzouhZ9uFwjaAhto7H7oTTTCD48x/m6ZjbHiMqbc6dwPEbLllImwsVreVF+2Q9ISHypujUVM8xH9gDZOHHKnHllDtfiK9dM5llZPT31oJ4TcVUGfKT6CLuokWlJpoy2R3OR8KEyEwZGacgkVInocJD4JJgHOlI4ZEd549u0V6kAbD45dAd0qfkR8vJ7nAQ+6nqbHoMYnGI12Ahkd5/yvb7CALz4g05ug1Zyd0TEEt+zqQFK3OxWTdEjfRChlOI5Hr3kuA9UwNKOAqqv+dx1MjDFYqa9357kIcCTHIW2RXhCCwwrv8j09n3qva7+Ifi+7ePjqaW5ssKFkzj2pkgWbyvPfxdRlB8ePnxWxDEWp68Uac5dMKkk32msvQGUsePjoYDEJ7AwTQ1RpM3cwhQfCVF1+o1hihKnLgR/KdFIYZh4v68EkPwlmamEjd32nYHqMWZbtGX+Z3OdkzSu2BbHunastgahOmVtKj+LyO9cdlqQjayO2K6X25WBu3t8QLqCeu5DpY4o2EtyUPddVGT9smcv82xgBoUNpAYyve6jj/Vs5PpbOGbe60mSrY5xSulUk/Pf3tJIEDMxOxGiRWQSSn9ySIo8H5qNTQDlCsse0bJLoruUYpf09uDN99sd8BBpWRZ/rcPMyB7m7aWepSakO9oRICRVVuYbJ13YIOkRz46/v91vU3JX2CVPRM5vSlwLTdFHzp8DZdkca3EsTS6C5uFB/OgzRkv+2+ X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(396003)(346002)(376002)(39860400002)(136003)(451199021)(82310400008)(46966006)(40470700004)(36840700001)(356005)(7636003)(26005)(54906003)(110136005)(478600001)(66574015)(82740400003)(107886003)(186003)(336012)(16526019)(426003)(7696005)(6666004)(47076005)(4326008)(2616005)(83380400001)(36860700001)(70206006)(70586007)(5660300002)(41300700001)(40460700003)(66899021)(316002)(2906002)(8676002)(8936002)(40480700001)(86362001)(36756003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2023 16:00:25.6530 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 702a9ca1-161d-495e-b456-08db8eba9769 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7102 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Using the tracking helpers makes it easier to debug netdevice refcount imbalances when CONFIG_NET_DEV_REFCNT_TRACKER is enabled. Convert dev_hold() / dev_put() to netdev_hold() / netdev_put() in the router code that deals with hw_stats events. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 0744497f2762..3ecd34ad0743 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -8308,6 +8308,7 @@ mlxsw_sp_router_port_l3_stats_report_delta(struct mlxsw_sp_rif *rif, struct mlxsw_sp_router_hwstats_notify_work { struct work_struct work; struct net_device *dev; + netdevice_tracker dev_tracker; }; static void mlxsw_sp_router_hwstats_notify_work(struct work_struct *work) @@ -8319,7 +8320,7 @@ static void mlxsw_sp_router_hwstats_notify_work(struct work_struct *work) rtnl_lock(); rtnl_offload_xstats_notify(hws_work->dev); rtnl_unlock(); - dev_put(hws_work->dev); + netdev_put(hws_work->dev, &hws_work->dev_tracker); kfree(hws_work); } @@ -8339,7 +8340,7 @@ mlxsw_sp_router_hwstats_notify_schedule(struct net_device *dev) return; INIT_WORK(&hws_work->work, mlxsw_sp_router_hwstats_notify_work); - dev_hold(dev); + netdev_hold(dev, &hws_work->dev_tracker, GFP_KERNEL); hws_work->dev = dev; mlxsw_core_schedule_work(&hws_work->work); } From patchwork Thu Jul 27 15:59:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13330332 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B46D1AA84 for ; Thu, 27 Jul 2023 16:00:32 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E03BB271D for ; Thu, 27 Jul 2023 09:00:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MNYilFvvBP0pwcLHGvokdQl8OrQ+9Wl55Hhp6K/AY4ROwLGzwM9y7DTKPaZme6jgna5vSup/cp+YXihzhrsBz/5qN51sgFHAUkSHa0Qu00Ktltq8sY6iZifPRlYJE0C/cGBFZrQ1jcw6uyMVkItfHCpM4EBstHSXccKsZKE0fv8uZcG38ZSF2KvMYI8qVl9pNBB01QWxTt3OpQRWErGRgAGgA7wodAYHZWrvE9J55Rd9sIfQIxVWTFCrBt5yz/wGDDSs2io2+nlH4S7UTm0n3NwPK+dzHRTFkOx6Q3+OOheHNzONPPJwS2AEQhOmtlTKsgiJY7WJBVA4wPZyVty0lQ== 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=priOAlBsqsZrCHZVXbQ/MdYGoWM6/K6ryEon3UZekqQ=; b=B8MSEJ+trmCTxYs0axuGAPDBPl+MO029iPPuf5mnAICUF5LOpCYyL7LFFnEcp3HttSb9/qYzq/vUvzvM1wZDUgxxdgANzGMVbVvLxZbDbslFqnauelel3v14H5s/2Qc6h22ME0MDEvxueAbkMNjq6/FZkJa5y59GCWzVyezEawHJXCmbSmUS3J1MYDV8yg4/yjDkpgdaP9UiD3wmeY78JIbrDqWNN58/u69SFbU9gxbxsSbdr8q6q4d++ajr0CYbhZk7wS8NhGK+HjYGKns189Vmzd/osj0vJ8e5MeAbJ2hSFcpi8RNwo0zxUBFwQr0fW3M5VKz1kuPquHYFZcTSLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=priOAlBsqsZrCHZVXbQ/MdYGoWM6/K6ryEon3UZekqQ=; b=q5i3UB/IZrxaoRusJGucv3/tyMcM4llp5NsuM0MJkdVnQzuhgvhEithMTk3Sx+tjWmhkp9mJo8YsrIX6fh2ksoyZIQrw74eZXm/FEmHMtT8Q/nzqyiJv1IATDQ4ChyqlrXTdU6bTdCnXjQrij6AdsMvEJ/GMZa7PPYdCGord3nb5WWYl6Zn9KVnAZ9rVUzAprBpAM/wx6e/SEzm0YLE6Kb/PDjpH25tMwt75GGtNUqKtM5ydW0vZBi2plLCgn60IRKPEDMYlJqaMfOHTbJIGggGUnhiUkm7K3l3SkZXZVPGMZlELXA8QGCXuGa8sfuj4SH8h7bdYezACVTRoiSspOg== Received: from BN8PR03CA0025.namprd03.prod.outlook.com (2603:10b6:408:94::38) by CY5PR12MB6153.namprd12.prod.outlook.com (2603:10b6:930:27::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Thu, 27 Jul 2023 16:00:29 +0000 Received: from BN8NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:408:94:cafe::22) by BN8PR03CA0025.outlook.office365.com (2603:10b6:408:94::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Thu, 27 Jul 2023 16:00:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT015.mail.protection.outlook.com (10.13.176.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Thu, 27 Jul 2023 16:00:28 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 27 Jul 2023 09:00:13 -0700 Received: from yaviefel.vdiclient.nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 27 Jul 2023 09:00:11 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Ido Schimmel , Petr Machata , Subject: [PATCH net-next 6/7] mlxsw: spectrum_router: RIF: Use tracker helpers to hold & put netdevices Date: Thu, 27 Jul 2023 17:59:24 +0200 Message-ID: <8b7701a7b439ac268e4be4040eff99d01e27ae47.1690471775.git.petrm@nvidia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT015:EE_|CY5PR12MB6153:EE_ X-MS-Office365-Filtering-Correlation-Id: aa64c653-08e6-40ae-462c-08db8eba9905 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DiloOF116czxKcYaRasplODMj2SqUjhyhDJXyl6+DOLOOtX/VMXr4iB99Y7JCj+q/p1SGXNd4GMUXZtIne5mCT3I13gpqZDY4QHBmPCsz2Nn5QX19xeMt1+fhCt341vO4CI+5RgLB1mAXlUe3ta7blGBL3JY6BhIVjNxSQq5kZxnygKrjallw5hOiZxHoPF68UkQB/UGodWQ9t7DLHtVuHUk3D3SBAMlLSLKREFTWjFo7sqbaaLriom7zdKPFN24q51erk2NYlh+XIn1W6y054DqrjGcLUNdZuAU085oolRJcgN0UDdGyHuYUy9rp5nj/bEarTsWonL555auLGTHpll/qRSbHAAw7tliGWwPvrLfXfI4gCQQeF1SeeAyb1Y1+mBwcn3HXQ/3RMbJFbZUosoXh1OuIIL/CaO/C71Z9szvrzvei8O784nrSqSfoKTL9vkTbeXPfXpH4QdlIY9kl+Tfx61tFqgGPvtg1ZCqkba4QrBgKMBTJ+y33ZJxl4Uouvtk3epEGsy6YSSK4UQKy7NaF3urrzAqqgoPYKp9T6Ixwe4Rs06xaOJ8mYs7LEE4CwTZyXRcy8E6eA2SPFuQeoYnoN/qJ3tI0D1szC+8mI3vLJzUM0vYIgxf1ObngvliGdyEkH7exGFRuoC+TIrvj1pPc4/cjXTFi3wkvzQqkQiBm/Yj+SvLJdJOilpNmwtrKrpF9H2hhEAK9XwNWOypU2acqAlrcQo6v57qsKWm65gQBliHt/5vb2jePkGKritm X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(136003)(39860400002)(396003)(346002)(376002)(451199021)(82310400008)(36840700001)(46966006)(40470700004)(40480700001)(7696005)(6666004)(478600001)(2616005)(426003)(86362001)(110136005)(8676002)(16526019)(54906003)(5660300002)(8936002)(41300700001)(26005)(336012)(186003)(2906002)(7636003)(107886003)(82740400003)(356005)(36756003)(4326008)(70586007)(70206006)(47076005)(40460700003)(316002)(36860700001)(83380400001)(66899021)(66574015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2023 16:00:28.3346 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa64c653-08e6-40ae-462c-08db8eba9905 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6153 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Using the tracking helpers makes it easier to debug netdevice refcount imbalances when CONFIG_NET_DEV_REFCNT_TRACKER is enabled. Convert dev_hold() / dev_put() to netdev_hold() / netdev_put() in the router code that deals with RIF allocation. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 3ecd34ad0743..59d12cf45939 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -71,6 +71,7 @@ static const struct rhashtable_params mlxsw_sp_crif_ht_params = { struct mlxsw_sp_rif { struct mlxsw_sp_crif *crif; /* NULL for underlay RIF */ + netdevice_tracker dev_tracker; struct list_head neigh_list; struct mlxsw_sp_fid *fid; unsigned char addr[ETH_ALEN]; @@ -8412,7 +8413,7 @@ mlxsw_sp_rif_create(struct mlxsw_sp *mlxsw_sp, err = -ENOMEM; goto err_rif_alloc; } - dev_hold(params->dev); + netdev_hold(params->dev, &rif->dev_tracker, GFP_KERNEL); mlxsw_sp->router->rifs[rif_index] = rif; rif->mlxsw_sp = mlxsw_sp; rif->ops = ops; @@ -8469,7 +8470,7 @@ mlxsw_sp_rif_create(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_fid_put(fid); err_fid_get: mlxsw_sp->router->rifs[rif_index] = NULL; - dev_put(params->dev); + netdev_put(params->dev, &rif->dev_tracker); mlxsw_sp_rif_free(rif); err_rif_alloc: err_crif_lookup: @@ -8511,7 +8512,7 @@ static void mlxsw_sp_rif_destroy(struct mlxsw_sp_rif *rif) /* Loopback RIFs are not associated with a FID. */ mlxsw_sp_fid_put(fid); mlxsw_sp->router->rifs[rif->rif_index] = NULL; - dev_put(dev); + netdev_put(dev, &rif->dev_tracker); mlxsw_sp_rif_free(rif); mlxsw_sp_rif_index_free(mlxsw_sp, rif_index, rif_entries); vr->rif_count--; From patchwork Thu Jul 27 15:59:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13330333 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA020C8EA for ; Thu, 27 Jul 2023 16:00:37 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAE18BC for ; Thu, 27 Jul 2023 09:00:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JBdOaOncCU+FYQ6xN2c200p3rSJ6mJuyBViIJ10GcqMekXJGplGvjpr4j1mF+cQuvgKMdIgVYAa7BkaKrvYR287U8XK592CnajBcWkRsMChlfZ/PYBnLGXkFnxkbmiOQpZVRd7/ukuTqb1MqMVN7+E1MBxV4OAY1Q4YW6KrMl/zhiq04360r6rRw5wPAl3DgBegGquvvH7zaEp0IJS/9d1LalSLTRkvINQfs0mPvLYpRswGtlCME0GpBti7m0Xb2iak0EXY74fjGBEhscI/Wg7WKO4DlK7/ZhgNHTD1djsfhGKhWn13OryGfMmodadhTlFIa/bks812COPS6iMZNMw== 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=7xLzT66g2F2J1TT++Uy87psvxahsrMt3JD6vfvZuW7c=; b=D2EhBmag20J2mn+t/xIFAEqezMbt+0QyMzy/wh7LI9Y4Bf6kkTVaACSsdqBdCZ7zd4no7Ugk35LNnW4vZpAynyUyDy/bKjcwQQuFLITJziEY7tCsujHsTbRwcrjz0Wano/xD2skNu0bqRBW1V1gx1J0AX4sxCzCbJE79q5D1KA7qs/qjSaBKXl+lwnzXLCmNvtErPbUqJJ1ltQ6dU9F+TmXlHvAVMBSGz+7PD10/NhpbSopMuA7o6T6LsCUgwO3fyTWjugx9sMwQCVX1DULgWm/BVZJ+VTfALxsK3apOWPNNNH/Z2+VZkSzdnj1EEirDqKAbfbwbzFKS6VFJpiYGTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); 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=7xLzT66g2F2J1TT++Uy87psvxahsrMt3JD6vfvZuW7c=; b=hd7FgjOx+AKIOob6Kwdcdz3Z7kndNyY3mxZw19dCEeJjObWDuDkxE3JDo28+hNm0D2VHUGDzyy97VlIx7pbL1MVzTGnX/Oo6KOE3eXwCd/ML7zpdSISAC0g8H05D6AJBPDvaP+CSXPYyVFQKzRRqXmkbXCPsXw/bc/Z7jdTmu22xjA2Aq186X4fC4cH2jiTF//r2fExm4FaqL2zdHNrMXlgOhux/Y1Mmkw+BM3oURjOU3GpygGosp4hy0wUdsaWsZpM7IhK+fp6Wyf+oaakDLPI3w3KdozR7NQxTF1M9gMo8/jZj4rvt6oxwS7p3Hr4kJjvucMagKgmDA62i64s/7Q== Received: from BN9PR03CA0806.namprd03.prod.outlook.com (2603:10b6:408:13f::31) by PH7PR12MB6979.namprd12.prod.outlook.com (2603:10b6:510:1b9::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Thu, 27 Jul 2023 16:00:35 +0000 Received: from BN8NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13f:cafe::ad) by BN9PR03CA0806.outlook.office365.com (2603:10b6:408:13f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Thu, 27 Jul 2023 16:00:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN8NAM11FT018.mail.protection.outlook.com (10.13.176.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29 via Frontend Transport; Thu, 27 Jul 2023 16:00:34 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 27 Jul 2023 09:00:15 -0700 Received: from yaviefel.vdiclient.nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 27 Jul 2023 09:00:13 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Ido Schimmel , Petr Machata , Subject: [PATCH net-next 7/7] mlxsw: spectrum_router: IPv6 events: Use tracker helpers to hold & put netdevices Date: Thu, 27 Jul 2023 17:59:25 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT018:EE_|PH7PR12MB6979:EE_ X-MS-Office365-Filtering-Correlation-Id: 4360fda3-708b-4845-b6a2-08db8eba9ca3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kO4UF67ujv4JVa4hYoSd0AZYx+ydPhLGd/C/Eq6XVKdGK074VmmQ64+N0xhS4+4vKPBTrp6kZcQXLNlXVdPZY6mTodYao3g5dOuHLnKvN+ZZG9ljZIQNyXy/VwFDPJ2d7zggNeFTdw+9TPeZeBTVkO4ZrGTEWwDGRhH2zVELtbmM2HZpCFZNl4uq7rKYSde1RgtANgSiBn0RHHDiYTPdxWRVDLZdtPh5VVuRRGCUJvmYmsXEg4TtCFmZrmvsM7OUAHnKlL61EcQBb/Zkq9MEbXslsADohBqU0y2tj9e5z6KF6DALJCaKPOyMG/Y/l41zRuqudBE5yKKQL/htOyeznsZNk7hjgamu7/pT91WKPK1mOjh4lKNIPSEjWcNgRtSGS+CUXNNdLZ+5vmbXJfkMV7lvAXt5wB8IwwrYCOWCvguvjkQ3siZJN18+vvbzSAuoFv5ung12xJaG7u3u6S78khleT+CnYo1CskrLuDeb0WBwAtitTkHQkOrUZ+Vkpb9OjBZiYte7ASFvREt1uPrx0P39TmiWuIq/8SmphGgoKB+JYPke8Wi1zkbgB/35epPkUtkClRLYyP+tlXH3Ng7g41agGmJt62K8wnsfE5fMjei7OTsayOoQZvUYZKk/e45lq8h7UPE2yMC1XbQwtPl83IWtAZpypdOVy2VaXdr/81RLCpcJeuAkiLML/dM1Vo2K9QjIjgiW6U24YJRh99zXAE/xF0EyuZ1GcM9i7SO5HhOs9EfLmD4g9Y9JrkCcUeCj X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(396003)(39860400002)(346002)(376002)(136003)(82310400008)(451199021)(40470700004)(46966006)(36840700001)(40480700001)(40460700003)(54906003)(2616005)(110136005)(7636003)(7696005)(478600001)(6666004)(356005)(70586007)(41300700001)(8676002)(5660300002)(70206006)(8936002)(82740400003)(4326008)(316002)(66574015)(16526019)(336012)(36860700001)(186003)(47076005)(426003)(83380400001)(26005)(107886003)(86362001)(2906002)(36756003)(66899021);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2023 16:00:34.4062 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4360fda3-708b-4845-b6a2-08db8eba9ca3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6979 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Using the tracking helpers makes it easier to debug netdevice refcount imbalances when CONFIG_NET_DEV_REFCNT_TRACKER is enabled. Convert dev_hold() / dev_put() to netdev_hold() / netdev_put() in the router code that deals with IPv6 address events. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 59d12cf45939..debd2c466f11 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -9333,6 +9333,7 @@ struct mlxsw_sp_inet6addr_event_work { struct work_struct work; struct mlxsw_sp *mlxsw_sp; struct net_device *dev; + netdevice_tracker dev_tracker; unsigned long event; }; @@ -9356,7 +9357,7 @@ static void mlxsw_sp_inet6addr_event_work(struct work_struct *work) out: mutex_unlock(&mlxsw_sp->router->lock); rtnl_unlock(); - dev_put(dev); + netdev_put(dev, &inet6addr_work->dev_tracker); kfree(inet6addr_work); } @@ -9382,7 +9383,7 @@ static int mlxsw_sp_inet6addr_event(struct notifier_block *nb, inet6addr_work->mlxsw_sp = router->mlxsw_sp; inet6addr_work->dev = dev; inet6addr_work->event = event; - dev_hold(dev); + netdev_hold(dev, &inet6addr_work->dev_tracker, GFP_ATOMIC); mlxsw_core_schedule_work(&inet6addr_work->work); return NOTIFY_DONE;