From patchwork Sat Apr 4 21:41:57 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 25601 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.176.167]) by ozlabs.org (Postfix) with ESMTP id CF1A0DDDA9 for ; Sun, 5 Apr 2009 07:42:01 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754140AbZDDVlk (ORCPT ); Sat, 4 Apr 2009 17:41:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756740AbZDDVlj (ORCPT ); Sat, 4 Apr 2009 17:41:39 -0400 Received: from ogre.sisk.pl ([217.79.144.158]:38440 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756946AbZDDVlh (ORCPT ); Sat, 4 Apr 2009 17:41:37 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id B5072130640; Sat, 4 Apr 2009 20:58:07 +0200 (CEST) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 22067-10; Sat, 4 Apr 2009 20:58:01 +0200 (CEST) Received: from tosh.localnet (220-bem-13.acn.waw.pl [82.210.184.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id 013F81305AF; Sat, 4 Apr 2009 20:58:01 +0200 (CEST) From: "Rafael J. Wysocki" To: NetDev Subject: [RFT][PATCH 3/3] NET/ixgbe: Fix powering off during shutdown Date: Sat, 4 Apr 2009 23:41:57 +0200 User-Agent: KMail/1.11.2 (Linux/2.6.29-rjw; KDE/4.2.2; x86_64; ; ) Cc: Jesse Brandeburg , Jeff Kirsher , Yinghai Lu , pm list , LKML References: <200904042337.31706.rjw@sisk.pl> In-Reply-To: <200904042337.31706.rjw@sisk.pl> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200904042341.57942.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Rafael J. Wysocki Impact: Fix Prevent ixgbe from putting the adapter into D3 during shutdown except when we're going to power off the system, since doing that may generally cause problems with kexec to happen (such problems were observed for igb and forcedeth). For this purpose seperate ixgbe_shutdown() from ixgbe_suspend() and use the appropriate PCI PM callbacks in both of them. Signed-off-by: Rafael J. Wysocki --- drivers/net/ixgbe/ixgbe_main.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-2.6/drivers/net/ixgbe/ixgbe_main.c =================================================================== --- linux-2.6.orig/drivers/net/ixgbe/ixgbe_main.c +++ linux-2.6/drivers/net/ixgbe/ixgbe_main.c @@ -3611,9 +3611,9 @@ static int ixgbe_resume(struct pci_dev * return 0; } - #endif /* CONFIG_PM */ -static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state) + +static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) { struct net_device *netdev = pci_get_drvdata(pdev); struct ixgbe_adapter *adapter = netdev_priv(netdev); @@ -3672,18 +3672,46 @@ static int ixgbe_suspend(struct pci_dev pci_enable_wake(pdev, PCI_D3cold, 0); } + *enable_wake = !!wufc; + ixgbe_release_hw_control(adapter); pci_disable_device(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); + return 0; +} + +#ifdef CONFIG_PM +static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state) +{ + int retval; + bool wake; + + retval = __ixgbe_shutdown(pdev, &wake); + if (retval) + return retval; + + if (wake) { + pci_prepare_to_sleep(pdev); + } else { + pci_wake_from_d3(pdev, false); + pci_set_power_state(pdev, PCI_D3hot); + } return 0; } +#endif /* CONFIG_PM */ static void ixgbe_shutdown(struct pci_dev *pdev) { - ixgbe_suspend(pdev, PMSG_SUSPEND); + bool wake; + + __ixgbe_shutdown(pdev, &wake); + + if (system_state == SYSTEM_POWER_OFF) { + pci_wake_from_d3(pdev, wake); + pci_set_power_state(pdev, PCI_D3hot); + } } /**