From patchwork Wed Mar 9 18:56:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fujinaka, Todd" X-Patchwork-Id: 595195 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 323FE14032B for ; Thu, 10 Mar 2016 05:56:17 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B4BD1A5A23; Wed, 9 Mar 2016 18:56:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NlqZ6v0x6P9L; Wed, 9 Mar 2016 18:56:15 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2E88BA5962; Wed, 9 Mar 2016 18:56:15 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id D27D91CED3A for ; Wed, 9 Mar 2016 18:56:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id C382495B26 for ; Wed, 9 Mar 2016 18:56:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uh2M8+yuFR2Z for ; Wed, 9 Mar 2016 18:56:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by hemlock.osuosl.org (Postfix) with ESMTP id B2F9895A74 for ; Wed, 9 Mar 2016 18:56:11 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP; 09 Mar 2016 10:56:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,312,1455004800"; d="scan'208";a="62996228" Received: from orsmsx108.amr.corp.intel.com ([10.22.240.6]) by fmsmga004.fm.intel.com with ESMTP; 09 Mar 2016 10:56:12 -0800 Received: from orsmsx152.amr.corp.intel.com (10.22.226.39) by ORSMSX108.amr.corp.intel.com (10.22.240.6) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 9 Mar 2016 10:56:10 -0800 Received: from orsmsx114.amr.corp.intel.com ([169.254.8.18]) by ORSMSX152.amr.corp.intel.com ([169.254.8.191]) with mapi id 14.03.0248.002; Wed, 9 Mar 2016 10:56:10 -0800 From: "Fujinaka, Todd" To: "Fujinaka, Todd" , "intel-wired-lan@lists.osuosl.org" Thread-Topic: [Intel-wired-lan] [PATCH] igb: simplify check for all F for surprise removal Thread-Index: AQHRcODC9FUtlmkM60uR7RHTfyDBp59RiNDQ Date: Wed, 9 Mar 2016 18:56:10 +0000 Message-ID: <9B4A1B1917080E46B64F07F2989DADD65AB570A9@ORSMSX114.amr.corp.intel.com> References: <20160226215708.15005.5114.stgit@htfujina-fc.jf.intel.com> In-Reply-To: <20160226215708.15005.5114.stgit@htfujina-fc.jf.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOWE1NmRlMTAtZDQ5OC00ODU4LWE0MzktNzQ1OTVlZWU4N2RmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InZjV0RCaXlwU0N0VUlFNzVvZ0s2ZFU3VUVnVzRvRklYTHJmRWJ0aWJTdk09In0= x-ctpclassification: CTP_IC x-originating-ip: [10.22.254.140] MIME-Version: 1.0 Subject: Re: [Intel-wired-lan] [PATCH] igb: simplify check for all F for surprise removal X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" I've confirmed this is broken for some parts. Please drop this patch. Todd Fujinaka Software Application Engineer Networking Division (ND) Intel Corporation todd.fujinaka@intel.com (503) 712-4565 -----Original Message----- From: Intel-wired-lan [mailto:intel-wired-lan-bounces@lists.osuosl.org] On Behalf Of Todd Fujinaka Sent: Friday, February 26, 2016 1:57 PM To: intel-wired-lan@lists.osuosl.org Subject: [Intel-wired-lan] [PATCH] igb: simplify check for all F for surprise removal The previous check appears to be delaying problems by doing multiple reads. Also, we've found that having igbvf in the host and vm and using direct-assign returns all F's on the STATUS register and we can't use that as an error condition. Since the VLAN Ether Type register (E1000_VET) has a hard-coded return value of 0x8100, check that register for all Fs instead. Signed-off-by: Todd Fujinaka --- drivers/net/ethernet/intel/igb/igb_main.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index a1d9b05..e932763 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -763,9 +763,22 @@ static void igb_cache_ring_register(struct igb_adapter *adapter) } } -u32 igb_rd32(struct e1000_hw *hw, u32 reg) +static void igb_check_remove(struct e1000_hw *hw, u32 reg, u8 __iomem +*hw_addr) { struct igb_adapter *igb = container_of(hw, struct igb_adapter, hw); + + /* E1000_VET is always 0x8100 and can't be all F's */ + if ((reg == E1000_VET) || (!(~readl(&hw_addr[E1000_VET])))) { + struct net_device *netdev = igb->netdev; + + hw->hw_addr = NULL; + netif_device_detach(netdev); + netdev_err(netdev, "PCIe link lost, device now detached\n"); + } +} + +u32 igb_rd32(struct e1000_hw *hw, u32 reg) { u8 __iomem *hw_addr = ACCESS_ONCE(hw->hw_addr); u32 value = 0; @@ -775,12 +788,8 @@ u32 igb_rd32(struct e1000_hw *hw, u32 reg) value = readl(&hw_addr[reg]); /* reads should not return all F's */ - if (!(~value) && (!reg || !(~readl(hw_addr)))) { - struct net_device *netdev = igb->netdev; - hw->hw_addr = NULL; - netif_device_detach(netdev); - netdev_err(netdev, "PCIe link lost, device now detached\n"); - } + if (unlikely(!(~value))) + igb_check_remove(hw, reg, hw_addr); return value; }