From patchwork Sat Aug 25 03:22:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Decotigny X-Patchwork-Id: 179945 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3A9542C010F for ; Sat, 25 Aug 2012 13:23:49 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758305Ab2HYDX2 (ORCPT ); Fri, 24 Aug 2012 23:23:28 -0400 Received: from mail-ee0-f74.google.com ([74.125.83.74]:35387 "EHLO mail-ee0-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755962Ab2HYDXS (ORCPT ); Fri, 24 Aug 2012 23:23:18 -0400 Received: by mail-ee0-f74.google.com with SMTP id d4so120353eek.1 for ; Fri, 24 Aug 2012 20:23:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references:organization:x-gm-message-state; bh=ul9gpDoRTfn4ZOfn2diHGUMbwRkuQ0pHLJ1Kci7I7Bk=; b=SYtoA08yNYMO0ePngHIpPjtgRDbK8nb5vneqkyUVl866JeCsvlLQ4iizfui5SxS/sh Mt2h3/xnIkCxh73jAFn50l/j8a93iSgg6TkJopAQlJ74pMrQA+GRV6VbHZURnNmA3Ud2 EACxc3V5A6z6eF3yLi11cb2rlFjd7c3mQlENqHeWAtZdrSfM1nP+uqrjCfTUMZLPl3EL eGGw2QYNXR5J0xEW3Gfwgf0FS5W0SuH3T+WVAGN4BqcUdHY+jiOKgMWErK7bJ+dB3AME vsjcD0u5q8r6n+HZLrBxiD/6djSR3xD5IqksUQ+BvsREAiUeP+WoakpIaynoHN38EUmV wa7Q== Received: by 10.216.84.129 with SMTP id s1mr403235wee.2.1345864997312; Fri, 24 Aug 2012 20:23:17 -0700 (PDT) Received: by 10.216.84.129 with SMTP id s1mr403226wee.2.1345864997199; Fri, 24 Aug 2012 20:23:17 -0700 (PDT) Received: from hpza9.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id cd1si77533wib.1.2012.08.24.20.23.17 (version=TLSv1/SSLv3 cipher=AES128-SHA); Fri, 24 Aug 2012 20:23:17 -0700 (PDT) Received: from decotigny.mtv.corp.google.com (decotigny.mtv.corp.google.com [172.18.64.159]) by hpza9.eem.corp.google.com (Postfix) with ESMTP id C89E85C0050; Fri, 24 Aug 2012 20:23:16 -0700 (PDT) Received: by decotigny.mtv.corp.google.com (Postfix, from userid 128857) id 3355EE0FF9; Fri, 24 Aug 2012 20:23:16 -0700 (PDT) From: David Decotigny To: Ayaz Abdulla , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Joe Perches , David Decotigny Subject: [PATCH net-next v1 2/3] forcedeth: fix TX timeout caused by TX pause on down link Date: Fri, 24 Aug 2012 20:22:52 -0700 Message-Id: X-Mailer: git-send-email 1.7.10.2.5.g20d7bc9 In-Reply-To: References: In-Reply-To: References: Organization: Google, Inc. X-Gm-Message-State: ALoCoQkkbszqfvB5mTJQ0Q8VYeB1OOKrFauy8a4vrc1ogJGi5cWRKLKZMGUXPoO6F2qBuMVY1cu0i92MGVwOhLBg3EwfHDTlrMjk1E05ppStjHq5GUKbxRkmWF0UQoS50X3vRNONhiu59mivqkXRyCusc4zODQEriz6tDyAuTpEtLpp9gx5YorON8y0BbQvUL+YfMfswZXzs Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On some dual-port forcedeth devices such as MCP55 10de:0373 (rev a3), when autoneg & TX pause are enabled while port is connected but interface is down, the NIC will eventually freeze (TX timeouts, network unreachable). This patch ensures that TX pause is not configured in hardware when interface is down. The TX pause request will be honored when interface is later configured. Tested: - hardware is MCP55 device id 10de:0373 (rev a3), dual-port - eth0 connected and UP, eth1 connected but DOWN - without this patch, following sequence would brick NIC: ifconfig eth0 down ifconfig eth1 up ifconfig eth1 down ethtool -A eth1 autoneg off rx on tx off ifconfig eth1 up ifconfig eth1 down ethtool -A eth1 autoneg on rx on tx on ifconfig eth1 up ifconfig eth1 down ifup eth0 sleep 120 # or longer ethtool eth1 Just in case, sequence to un-brick: ifconfig eth0 down ethtool -A eth1 autoneg off rx on tx off ifconfig eth1 up ifconfig eth1 down ifup eth0 - with this patch: no TX timeout after "bricking" sequence above Details: - The following register accesses have been identified as the ones causing the NIC to freeze in "bricking" sequence above: - write NVREG_TX_PAUSEFRAME_ENABLE_V1 to eth1's register NvRegTxPauseFrame - write NVREG_MISC1_PAUSE_TX | NVREG_MISC1_FORCE to eth1's register NvRegMisc1 - write 0 to eth1's register NvRegTransmitterControl This is what this patch avoids. Signed-off-by: David Decotigny --- drivers/net/ethernet/nvidia/forcedeth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index 51d19d8..8b82457 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c @@ -3409,7 +3409,7 @@ set_speed: pause_flags = 0; /* setup pause frame */ - if (np->duplex != 0) { + if (netif_running(dev) && (np->duplex != 0)) { if (np->autoneg && np->pause_flags & NV_PAUSEFRAME_AUTONEG) { adv_pause = adv & (ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM); lpa_pause = lpa & (LPA_PAUSE_CAP | LPA_PAUSE_ASYM); @@ -5455,6 +5455,7 @@ static int nv_close(struct net_device *dev) netif_stop_queue(dev); spin_lock_irq(&np->lock); + nv_update_pause(dev, 0); /* otherwise stop_tx bricks NIC */ nv_stop_rxtx(dev); nv_txrx_reset(dev);