From patchwork Tue Sep 19 22:13:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asmaa Mnebhi X-Patchwork-Id: 13391968 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 505E2374DD for ; Tue, 19 Sep 2023 22:14:39 +0000 (UTC) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2058.outbound.protection.outlook.com [40.107.243.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6F79E70 for ; Tue, 19 Sep 2023 15:13:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MtkMc8q7/mYbY0LxuOOzLC3M5oJVdD0oRngbgfSzVHy74Zb+i1LTT3nxBpi59t9GbBjJFmWtqNdG4WjGw8/A/+7JRCbMlgxZqJebZXvIIFvfF5QXcjTOzLmKBlSK/fMTxViz0j64gbV3UtlDrhB+TJsjbHsG5Q1QoJ60dFvaC0C96IT7Pc5xWaNvJFmua8I6AswJ9Si9cGiMYeOV+PcHtfCNUA1SFiHztOCfsX4nMx3NNU9nteH5oiaGKoGzh1FGM/HiC4KC92Uzsh1P7+XMeBKqjnCu4ROtgtpObs1JfBXKAijmRdJRYMCTvAnD+OCmJLLAScO9F6gDRTg8XbZvPw== 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=AOJ5EXwmU0+Y6WLDVWSpacxIB/zH5jjk8q2yZBP9GOU=; b=jNynbxR2Ef2GgU1KzYY4DEw4CRUlyj05Ay6tw88AGnK9ak0J2t9O1LSmQI5CrJZcNvZfCHmDcFiI0lXCIP/IgslZK00lDpR1+LUdwMfSkTbPBaqHsoz7xnlo+NQvP1UpU5Z9mo+lAJ6zMyGovTCX7Z2PstEIjJLcHkkADOBzzW46Gk+XoW/Hzfhl4hghn5MCz/9KK2i4g4UVrDmpjg5y3OPdiaBCGT6aiZjUEVBsfA+Fr1TYfa/VKIyL9uluLkj+oDoMqyitGEWMjyfyC80qHRfiuXh+tf2oOy/rzwimbPUTeQ6XdS4KnYfcFBNQmPYUaD7RMOobo5c9cNgXRDv9Sg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=AOJ5EXwmU0+Y6WLDVWSpacxIB/zH5jjk8q2yZBP9GOU=; b=hwbvRZN3Y1SdItElImqR0LUtW6ODQa5h+P5PaJE2RI+fCDSYjN5ILAyGYDHm5410Ameru3i8sEMij/3EXblpsRQqsQhKz4UEvlYvSs3Tpo3/nXJiKJcb+eXX5GdgrUYuYE+hpr3bQctLa4yPVpsLrOuRI2bfWm2825EzW4Xe3y5WIXGpafzjYAwOm/YM+O+mWj1yFMVeyCQQI4NPQI8lG9sT5kc5WKZvD6rV4Efzcu9KVVra395cgDZzcAyIjub/ay6NBCjcsu7MYafZ/ulmZdXDWG6ObH8LrjrwEK3MTW6sCjfSZYJBSNWjuZ9lrcM4MP6j2O25r1Q2EJ4P06Wbbw== Received: from SA1P222CA0042.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:2d0::16) by DS7PR12MB6046.namprd12.prod.outlook.com (2603:10b6:8:85::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27; Tue, 19 Sep 2023 22:13:24 +0000 Received: from SN1PEPF00026367.namprd02.prod.outlook.com (2603:10b6:806:2d0:cafe::84) by SA1P222CA0042.outlook.office365.com (2603:10b6:806:2d0::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.28 via Frontend Transport; Tue, 19 Sep 2023 22:13:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SN1PEPF00026367.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20 via Frontend Transport; Tue, 19 Sep 2023 22:13:23 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 19 Sep 2023 15:13:14 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 19 Sep 2023 15:13:14 -0700 Received: from vdi.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Tue, 19 Sep 2023 15:13:13 -0700 From: Asmaa Mnebhi To: , , , , CC: Asmaa Mnebhi , , Subject: [PATCH v1 1/3] mlxbf_gige: Fix kernel panic at shutdown Date: Tue, 19 Sep 2023 18:13:06 -0400 Message-ID: <20230919221308.30735-2-asmaa@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20230919221308.30735-1-asmaa@nvidia.com> References: <20230919221308.30735-1-asmaa@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00026367:EE_|DS7PR12MB6046:EE_ X-MS-Office365-Filtering-Correlation-Id: e475f842-3b47-4d2a-31d0-08dbb95da3f5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P/ZmxZhYFwPAM/OEMGx5Ubo3jkAaKQO4PpeoCiQ53HfJ/9TQqW4imSJdR9cqyEFllQcb9F9hTBRtRurPEHjdpXZaqVUqJu2+26UNs5Q3PRHKVunzCKM8PhEYGjXFt7L06KdUTOHB4fNtL7H9mQMbcUBFZjZB//EzB4kDKUk0qM3B1cag5ewlk9HPyQSXKR62XkZGbUJiWh4Wa9zQRc1VJMupjj3rX/yZBv4SbM9mST5ndeSr//J6Ozg49SIWL16T+tvjy5BHcWVeL2/zZZdXw7mZOd1sQnFVSdf7VXdNilgyYiuz9zY4otmCQKoe/iIlGUjLcJMzymEwSiIZXMPlf/Ij0R9hrMrlJ/aO+mNz55ApLMFIS79NLskRulYisJGEdK0Lm+xWIhIkbtWnwK5XzhWvIqR/aKk8IaiCFo8Gux0g/QuSGkkSnQ6mh8WdIKLO4UvYKLDWqMwukfVGXCY+J5kHCeKTN58pu5UFVD0sLhWJRW8reUyDKtz1o+CdhPLGhYM7uoe+pLflyaGgWGbjf/cQjfwvmtckQA93jyeunmPhFTPlMnvfIzaso2DlXLkG93JCCqRFgTeBm1YlNTrl3OrePZ9hzIeWN0LKVP0XMnEHDpqdpqcqiXXMyS5sYq0+9Fr/lUBz3vzMNygcMA+SqNZOYl6xXYDBhi1y/dgaSbdMNA4879+geNiE0E8pMSXugL+Dl8zdEIH9fNKnNWGUpbWHQR78PTeI5FwOjbJlGpIyl5JBS5ktGZ9aVKZ30Rrw X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(396003)(376002)(39860400002)(346002)(136003)(451199024)(186009)(82310400011)(1800799009)(36840700001)(46966006)(40470700004)(110136005)(41300700001)(83380400001)(5660300002)(478600001)(40480700001)(6666004)(2906002)(70206006)(70586007)(54906003)(8936002)(8676002)(4326008)(316002)(7696005)(1076003)(2616005)(26005)(107886003)(40460700003)(426003)(336012)(47076005)(36860700001)(36756003)(86362001)(356005)(7636003)(82740400003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 22:13:23.5659 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e475f842-3b47-4d2a-31d0-08dbb95da3f5 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF00026367.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6046 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_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE 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 There is a race condition happening during shutdown due to pending napi transactions. Since mlxbf_gige_poll is still running, it tries to access a NULL pointer and as a result causes a kernel panic: [ 284.074822] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000070 ... [ 284.322326] Call trace: [ 284.324757] mlxbf_gige_handle_tx_complete+0xc8/0x170 [mlxbf_gige] [ 284.330924] mlxbf_gige_poll+0x54/0x160 [mlxbf_gige] [ 284.335876] __napi_poll+0x40/0x1c8 [ 284.339353] net_rx_action+0x314/0x3a0 [ 284.343086] __do_softirq+0x128/0x334 [ 284.346734] run_ksoftirqd+0x54/0x6c [ 284.350294] smpboot_thread_fn+0x14c/0x190 [ 284.354375] kthread+0x10c/0x110 [ 284.357588] ret_from_fork+0x10/0x20 [ 284.361150] Code: 8b070000 f9000ea0 f95056c0 f86178a1 (b9407002) [ 284.367227] ---[ end trace a18340bbb9ea2fa7 ]--- To fix this, return in the case where "priv" is NULL. Fixes: f92e1869d74e ("Add Mellanox BlueField Gigabit Ethernet driver") Signed-off-by: Asmaa Mnebhi Reviewed-by: David Thompson --- drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c index 0d5a41a2ae01..cfb8fb957f0c 100644 --- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c +++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c @@ -298,6 +298,9 @@ int mlxbf_gige_poll(struct napi_struct *napi, int budget) priv = container_of(napi, struct mlxbf_gige, napi); + if (!priv) + return 0; + mlxbf_gige_handle_tx_complete(priv); do { From patchwork Tue Sep 19 22:13:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asmaa Mnebhi X-Patchwork-Id: 13391966 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 E1F6E3AC2C for ; Tue, 19 Sep 2023 22:14:19 +0000 (UTC) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2062.outbound.protection.outlook.com [40.107.102.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC74BCFC for ; Tue, 19 Sep 2023 15:13:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bOzqcwKzc38UKfUIAMKgczxf/+kM46j6Bm1UmnuZc6W5HD33lb2ChCMQTVFTWDt3RWTci+U5jAE3GaAZ3OeThT2ktLwb9IP9+RCJqy/nGBgU42/i5npkyjT7ehJ2WdLcz/UQ7s00t20UyAG8qQ9U2DN8Wx282Rn8TX3d3KegTIQv31m4oy08FB4l+R4OOBqDPm2fsVLqqpITQtthfRtn3UNHayBNAGvoR0rCnGra5KW6Wo1CV6lPPwBXplW5MgfUTmMPqBfUX8CLpfPkmw3zfm/aiqTgw+Yt2XUdK12RdoMJS2lc5LsZTDxojagGuw2wibdz9PfQ2WcnlFR4Tewbew== 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=1c09YQe3bv9SCJdaRzX0t17PL0KdilIxLfl/lutbLh8=; b=gC1aUaUVu7YxAJcuHrVZ7d9qqAoOFLLAqXtVfjkNl4i36Eyew2Oq+3QnITgCnP6TlYe4iYSbVOIu6AynSsPqqzbjtscmjtQy/HIzlbhb2kU1gXj328UoZ5UasE7jCVgo0sI4p1ZhKKPlMLgI9gMABWcYPEUtQVPWTmH6POHknSK8WGprbuAI58mzf+YFniUOFydDo3JYItwYuJEzv0ttSQj9wvCMoC5jGOIaG/GHoXKOGk3kpqOEb1fMrH3zzbfIRt7P9T7awc5RMRvQds9tHmkI84A6WNxjzxnl9GTqnmVGV/m1nOFZzJbGiklhZWlzOvuAgZlqzf8pn6obn3zasg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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=1c09YQe3bv9SCJdaRzX0t17PL0KdilIxLfl/lutbLh8=; b=RAgx2sV1s6dEsLK0IbDV77i2y9AiUA3br4HxK8gonoo6z+GS65xNl2TrRgXIkdSrd+mJDLCF06crulEnYXA2XAM6l6i2tk4+yRU6mHJ9GogX4KPAjss542qVg8p5SZHayuMRCluTUwIiq2R07enjK7WKQR8dJ7y9fU/VMNQT7NvHSws6zXL8HJu8KC4GjWrm4pCBz2cLapIP6OuLXR7s6nHeRS5/2MZpM/mnFTZWIT94yJMGZoXvWyXHln7scCF9tddimNQrAj06iRloxl1kO7WjH8bPvP3fpC3slypsXy8BA/Sx9YXJlaHxfe1rpoxXNsR2F+S15nI09vUlQ1XkSg== Received: from CH0PR03CA0029.namprd03.prod.outlook.com (2603:10b6:610:b0::34) by DS0PR12MB7993.namprd12.prod.outlook.com (2603:10b6:8:14b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.28; Tue, 19 Sep 2023 22:13:26 +0000 Received: from DS2PEPF00003441.namprd04.prod.outlook.com (2603:10b6:610:b0:cafe::a8) by CH0PR03CA0029.outlook.office365.com (2603:10b6:610:b0::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.28 via Frontend Transport; Tue, 19 Sep 2023 22:13:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by DS2PEPF00003441.mail.protection.outlook.com (10.167.17.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20 via Frontend Transport; Tue, 19 Sep 2023 22:13:26 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 19 Sep 2023 15:13:16 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 19 Sep 2023 15:13:16 -0700 Received: from vdi.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Tue, 19 Sep 2023 15:13:15 -0700 From: Asmaa Mnebhi To: , , , , CC: Asmaa Mnebhi , , Subject: [PATCH v1 2/3] mlxbf_gige: Fix intermittent no ip issue Date: Tue, 19 Sep 2023 18:13:07 -0400 Message-ID: <20230919221308.30735-3-asmaa@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20230919221308.30735-1-asmaa@nvidia.com> References: <20230919221308.30735-1-asmaa@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF00003441:EE_|DS0PR12MB7993:EE_ X-MS-Office365-Filtering-Correlation-Id: b89d9af2-3118-484d-9288-08dbb95da591 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7v1Z3E+tXwKrW9YXYMKxUF75HSVN8VIa+A3e3g+D8Mt8BO0LBixQ19Tb6G44AB4nuy2yiRgWEokbYnx5KG1AIfPig8jy4V+4F8MOrMrtCD+BUh/XQ3Zpdrwj2ViRZgTGLWkAD26g9vK/oZ+mjXAhf6OoxPOp1uNCRxJ/dz/bLCYZuYPFwgcOXIx6quxzGVBqOoZF9J05gA/+LItl9MmphnzLQHzBSboddPofOE9c2+rbBvljrh/ad/ISvlpnLpf7fg93+tmjrspZFRkTZRH2VBndw/tr8zcq+51P6Hw6dSBor8Rx63dZbZa+6IEedAN7BcVqQjnj2slquhHkVvSQYzYBMnGp/3EZ9Ll9wJO/KePEMg+FRVA80e3SkAvFRjY7tzoj7NeP4R977M+v0vy+sqIuo8mABC9vZJVbHrc5zsmm3s98mcY91AAZiY8E0O6ye3BOFTGW94HhGIR49py6Hxp/LFvWlh+u7kGJCkq6umpoLb38HbsYzC11cDD+VOm00DcccD6J6Fwh2evzthkcfXKCh99lqcTq+SvQ0nBPtoNW/ddwUFTfE0Lhik9+PTGAcWpadel2vNwQHYR3e7+Q5j9hgQ2U8Se2Unttl0c1SyO3k5LFiRxBdctdfbXgKf9XLrgXI/5RFXSuOCU8yxV7Gme8nA6zaKLoLfeTO1+jPo5ENiZzl6db1zr/n/ZqggqZp+8MZ4TDSzx85W6VuMJtfCWZR0/mENSJnsg+65UxBIbR4i9Tz8eALRp8RBRa4BdZ X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(376002)(136003)(396003)(346002)(186009)(1800799009)(451199024)(82310400011)(46966006)(36840700001)(40470700004)(478600001)(7696005)(6666004)(86362001)(40460700003)(36756003)(356005)(82740400003)(40480700001)(7636003)(36860700001)(107886003)(1076003)(336012)(26005)(2906002)(8676002)(426003)(47076005)(83380400001)(8936002)(5660300002)(110136005)(2616005)(4326008)(41300700001)(70586007)(54906003)(70206006)(316002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 22:13:26.2685 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b89d9af2-3118-484d-9288-08dbb95da591 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF00003441.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7993 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_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE 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 Although the link is up, there is no ip assigned on a setup with high background traffic. Nothing is transmitted nor received. The RX error count keeps on increasing. After several minutes, the RX error count stagnates and the GigE interface finally gets an ip. The issue is in the mlxbf_gige_rx_init function. As soon as the RX DMA is enabled, the RX CI reaches the max of 128, and it becomes equal to RX PI. RX CI doesn't decrease since the code hasn't ran phy_start yet. The solution is to move the rx init after phy_start. Fixes: f92e1869d74e ("Add Mellanox BlueField Gigabit Ethernet driver") Signed-off-by: Asmaa Mnebhi Reviewed-by: David Thompson --- .../ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c | 14 +++++++------- .../ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c index 694de9513b9f..7d132a132a29 100644 --- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c +++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c @@ -147,14 +147,14 @@ static int mlxbf_gige_open(struct net_device *netdev) */ priv->valid_polarity = 0; - err = mlxbf_gige_rx_init(priv); + phy_start(phydev); + + err = mlxbf_gige_tx_init(priv); if (err) goto free_irqs; - err = mlxbf_gige_tx_init(priv); + err = mlxbf_gige_rx_init(priv); if (err) - goto rx_deinit; - - phy_start(phydev); + goto tx_deinit; netif_napi_add(netdev, &priv->napi, mlxbf_gige_poll); napi_enable(&priv->napi); @@ -176,8 +176,8 @@ static int mlxbf_gige_open(struct net_device *netdev) return 0; -rx_deinit: - mlxbf_gige_rx_deinit(priv); +tx_deinit: + mlxbf_gige_tx_deinit(priv); free_irqs: mlxbf_gige_free_irqs(priv); diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c index cfb8fb957f0c..d82feeabb061 100644 --- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c +++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c @@ -142,6 +142,9 @@ int mlxbf_gige_rx_init(struct mlxbf_gige *priv) writeq(MLXBF_GIGE_RX_MAC_FILTER_COUNT_PASS_EN, priv->base + MLXBF_GIGE_RX_MAC_FILTER_COUNT_PASS); + writeq(ilog2(priv->rx_q_entries), + priv->base + MLXBF_GIGE_RX_WQE_SIZE_LOG2); + /* Clear MLXBF_GIGE_INT_MASK 'receive pkt' bit to * indicate readiness to receive interrupts */ @@ -154,9 +157,6 @@ int mlxbf_gige_rx_init(struct mlxbf_gige *priv) data |= MLXBF_GIGE_RX_DMA_EN; writeq(data, priv->base + MLXBF_GIGE_RX_DMA); - writeq(ilog2(priv->rx_q_entries), - priv->base + MLXBF_GIGE_RX_WQE_SIZE_LOG2); - return 0; free_wqe_and_skb: From patchwork Tue Sep 19 22:13:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asmaa Mnebhi X-Patchwork-Id: 13391967 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 BC7593AC1A for ; Tue, 19 Sep 2023 22:14:20 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2068.outbound.protection.outlook.com [40.107.93.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA00F1B4 for ; Tue, 19 Sep 2023 15:13:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UWtCFbTy2v4SI9uwMRPrDSkdOsAzVlw/MDVc5l1bk7n76B9teeQaAPzEvYA9P+oEfeRdWifAC0DIm/E+BO9b7/dpLgnqYIj8+xM2VUuCg4ZinkLgiorWg2gI3F0k9o1Wur9cFkRr10koExcu6FX3Dk6B3FBUdbnQBQ6+dhkjL0ZPqBhfUmODJY7B3Muoxd0SGKEVq1Q2lwb4fw6MNpbYAJN8eFGkjeEpLgdRTLCPywOSXxC9OfpN89VIrAJXNfZqYmTa1SZhPf1sXTDt8wmR3adqKkl8fpM48XX1oYdEbmow8k2jbYHYmbZ7MipcwmsZHkJthV2JTytjQIeb554HLA== 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=a9GQVquevL0TkDm27rT6txSGyNY3SXYr7Y3acPfVwgo=; b=BFmtSf0UGLmn7tnD6oL+sTdRPQcbYfIlBeHl9nBtuLRp6IIc3ke83gH1Q8bEG4QD00e6LDdpnF4y2IE3xqaNzCkKNmh0XocL64MoLfV1WOAt8sS9IFLDpUVeyqiLmDCXnnjoyI8Cc/WwEb7eQuX+g+aNgS+SxzZiYX1lU1+WaYNw3P9NGEOiEl8NxBSEWGypT8+yeCKpPpI43COst2jUDmhyH03EsfJ1xynTpnvVLLUpsqf3whNutYIiflt1QOS+TeDRUV0+Wkrmrn0UEUO5UzKI2EKpC4mI9JFIsiVRXro1B4iJVztourGCOwSYmYeAXkp4dpWeZftQrcVFslYzQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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=a9GQVquevL0TkDm27rT6txSGyNY3SXYr7Y3acPfVwgo=; b=T5lpXMQkjI7K/K0r3gAKGFF2jgYsvJTOZwmJuxGMe3b7XOKSinoZXeGJ8PHgWfXux1qgFR//+qyjRjHJb5FIpzf5Y+W5bYZebt+Soj3bBNbFq8y+eBRX/51BavyCtt1zGfb0VJOUSXrGgN9o/pXItYdF6LJXuabcPa+zJ7lQROE2DejpD61fs75lkJQZq4+5Y7OkGkJfc9qOe1lumcjzFdffUfHFGgLeVnCB5gefjY1+swxvWNxpdGfMCnnpgnod9pu0vh0xkxhGKT2XLW4VRFlfYYSPzNmr9EqC9aSoVSBHapekgs38uY7Ok/wU871Wxpi5cbS2A9t1NYKztP+//g== Received: from CH0PR08CA0006.namprd08.prod.outlook.com (2603:10b6:610:33::11) by DM4PR12MB6590.namprd12.prod.outlook.com (2603:10b6:8:8f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20; Tue, 19 Sep 2023 22:13:29 +0000 Received: from DS2PEPF00003442.namprd04.prod.outlook.com (2603:10b6:610:33:cafe::ab) by CH0PR08CA0006.outlook.office365.com (2603:10b6:610:33::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.28 via Frontend Transport; Tue, 19 Sep 2023 22:13:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by DS2PEPF00003442.mail.protection.outlook.com (10.167.17.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.19 via Frontend Transport; Tue, 19 Sep 2023 22:13:28 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 19 Sep 2023 15:13:18 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 19 Sep 2023 15:13:18 -0700 Received: from vdi.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Tue, 19 Sep 2023 15:13:17 -0700 From: Asmaa Mnebhi To: , , , , CC: Asmaa Mnebhi , , Subject: [PATCH v1 3/3] mlxbf_gige: Enable the GigE port in mlxbf_gige_open Date: Tue, 19 Sep 2023 18:13:08 -0400 Message-ID: <20230919221308.30735-4-asmaa@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20230919221308.30735-1-asmaa@nvidia.com> References: <20230919221308.30735-1-asmaa@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF00003442:EE_|DM4PR12MB6590:EE_ X-MS-Office365-Filtering-Correlation-Id: 7502004d-540c-40dd-478f-08dbb95da6ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1gm8G6NtkNF5uDGMpOEh1/qdr5y0j401iJ1bsgWU8qsMO5NKj3BBd42S6FuFxaQtmsO2a00zc9oJgXWgbokSqbiHNGgxHsobZR+PO1xM5maEsh++FRn/D/Hw6onH2WXX36nKHT03wkeLZjyFvZHdKJ6orzUqw2cVyk5jILTRd80GtEzUAldWsVxvYQkpPMRrYQ/ct9ESbPUCFZkWbTk0rV3zdEJyNVJyVGUqgnD0im+q5IaOHGPLQJHJrezJUPxCLi3bu2Z6+8u3uD7OjeyyAgkGQH4z6S+LNoZ2oj6bC/3otfR5tg46eoXnThSRFhEyLrmZK90FFBGGFhhwqTTAAVbcrOYiVQh6a652IabIqAAfc0QNHsxDhK5YQhgopXe5Kc7qEuDqy8+1kF7cIK5Dp+YB26b21K+g/0x3xqs1FLleRSfsQWLn11qkCtc+w0b9TZDuKbAWg8Jd3qGZ0SQEGg/PmyEQ32v0T6EH5tTqTNyPPX0uYYidqiwWSTiOAYqXrzvgmSOey+kaQ0E9N8FvbkcfWIgE8YHqXac78AyqmDwoKVD52SLnCigLyM4+ICiFQ+2CJK9ePbchp5RUIHUt9/zzlLxGXt3HFn93V5iyTlzk/Jv9SdRctwhIUsXlo1jd5+wN/XLt+pJk/pXVgd9V4ZMVXSUWJmwrkVACiD8du9j+H0dIEi3zsCEFouqDow6onLNTCOqYdUHLeioFP9vNFU5nWA6FyiF0FeapGrdEE+93j9F8GSVAMmGJhR5tHqJV X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(396003)(39860400002)(376002)(346002)(136003)(451199024)(186009)(1800799009)(82310400011)(36840700001)(40470700004)(46966006)(41300700001)(4326008)(8676002)(8936002)(70206006)(110136005)(5660300002)(316002)(54906003)(82740400003)(2906002)(40460700003)(70586007)(1076003)(356005)(36860700001)(40480700001)(83380400001)(7636003)(336012)(6666004)(26005)(2616005)(426003)(107886003)(86362001)(47076005)(36756003)(7696005)(478600001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 22:13:28.6652 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7502004d-540c-40dd-478f-08dbb95da6ff X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF00003442.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6590 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_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE 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 At the moment, the GigE port is enabled in the mlxbf_gige_probe function. If the mlxbf_gige_open is not executed, this could cause pause frames to increase in the case where there is high backgroud traffic. This results in clogging the port. So move enabling the OOB port to mlxbf_gige_open. Fixes: f92e1869d74e ("Add Mellanox BlueField Gigabit Ethernet driver") Signed-off-by: Asmaa Mnebhi Reviewed-by: David Thompson --- .../ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c index 7d132a132a29..b285a9d0a66f 100644 --- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c +++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c @@ -130,9 +130,15 @@ static int mlxbf_gige_open(struct net_device *netdev) { struct mlxbf_gige *priv = netdev_priv(netdev); struct phy_device *phydev = netdev->phydev; + u64 control; u64 int_en; int err; + /* Perform general init of GigE block */ + control = readq(base + MLXBF_GIGE_CONTROL); + control |= MLXBF_GIGE_CONTROL_PORT_EN; + writeq(control, base + MLXBF_GIGE_CONTROL); + err = mlxbf_gige_request_irqs(priv); if (err) return err; @@ -365,7 +371,6 @@ static int mlxbf_gige_probe(struct platform_device *pdev) void __iomem *plu_base; void __iomem *base; int addr, phy_irq; - u64 control; int err; base = devm_platform_ioremap_resource(pdev, MLXBF_GIGE_RES_MAC); @@ -380,11 +385,6 @@ static int mlxbf_gige_probe(struct platform_device *pdev) if (IS_ERR(plu_base)) return PTR_ERR(plu_base); - /* Perform general init of GigE block */ - control = readq(base + MLXBF_GIGE_CONTROL); - control |= MLXBF_GIGE_CONTROL_PORT_EN; - writeq(control, base + MLXBF_GIGE_CONTROL); - netdev = devm_alloc_etherdev(&pdev->dev, sizeof(*priv)); if (!netdev) return -ENOMEM;