From patchwork Fri Jun 19 14:33:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224119 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED4CCC433E0 for ; Fri, 19 Jun 2020 15:14:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A7E532158C for ; Fri, 19 Jun 2020 15:14:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592579641; bh=n13eyRRomMJps8ls0nwvReLF+/XPiXI8h6Y4M9+PegI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CTpQj8X4pp4bissJLzwOaqrkxvnge92rUzluHxmqDTUusQI4mKmhTgjPQu4RNXxEm YCh9B2b1t52f42E4N10fWDkgiFGpJMU1sy1tlInWfm8LsNU9JrARI1Xacn7UmhT+1D aAc/BhNEhVptKO/NPhw1c11bvZrpvHV5rGUszjwY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392290AbgFSPN5 (ORCPT ); Fri, 19 Jun 2020 11:13:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:44420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392283AbgFSPNy (ORCPT ); Fri, 19 Jun 2020 11:13:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A37A62158C; Fri, 19 Jun 2020 15:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592579633; bh=n13eyRRomMJps8ls0nwvReLF+/XPiXI8h6Y4M9+PegI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hZ2vV3Rwq9P9RIzTqLWVPnIPf+AscuT94d1bDp7MSq5AMCykRQqifNZhfCRy8hlG2 SC89aiTf62DTxpxK8A/eFuxkntVQcolw6b79dZ2pBp8fDWcI+xmMj1FR1XWtUSXH80 ZSG3+Oh7LgfoKGxHvdaS2GHhBPChqaDP3aJXrCT0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Duyck , Kai-Heng Feng , Aaron Brown , Jeff Kirsher Subject: [PATCH 5.4 208/261] igb: Report speed and duplex as unknown when device is runtime suspended Date: Fri, 19 Jun 2020 16:33:39 +0200 Message-Id: <20200619141659.867970637@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141649.878808811@linuxfoundation.org> References: <20200619141649.878808811@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kai-Heng Feng commit 165ae7a8feb53dc47fb041357e4b253bfc927cf9 upstream. igb device gets runtime suspended when there's no link partner. We can't get correct speed under that state: $ cat /sys/class/net/enp3s0/speed 1000 In addition to that, an error can also be spotted in dmesg: [ 385.991957] igb 0000:03:00.0 enp3s0: PCIe link lost Since device can only be runtime suspended when there's no link partner, we can skip reading register and let the following logic set speed and duplex with correct status. The more generic approach will be wrap get_link_ksettings() with begin() and complete() callbacks. However, for this particular issue, begin() calls igb_runtime_resume() , which tries to rtnl_lock() while the lock is already hold by upper ethtool layer. So let's take this approach until the igb_runtime_resume() no longer needs to hold rtnl_lock. CC: stable Suggested-by: Alexander Duyck Signed-off-by: Kai-Heng Feng Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/igb/igb_ethtool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -143,7 +143,8 @@ static int igb_get_link_ksettings(struct u32 speed; u32 supported, advertising; - status = rd32(E1000_STATUS); + status = pm_runtime_suspended(&adapter->pdev->dev) ? + 0 : rd32(E1000_STATUS); if (hw->phy.media_type == e1000_media_type_copper) { supported = (SUPPORTED_10baseT_Half |