netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BNX2]: Fix suspend/resume problem.
@ 2007-08-03 22:32 Michael Chan
  2007-08-04  3:57 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Chan @ 2007-08-03 22:32 UTC (permalink / raw)
  To: davem; +Cc: netdev

[BNX2]: Fix suspend/resume problem.

The device would not resume properly if it was shutdown before the system
was suspended.  In such scenario where the netif_running state is 0,
bnx2_suspend() would not save the PCI state and so the memory enable bit
and bus master enable bit would be lost.

We fix this by always saving and restoring the PCI state in
bnx2_suspend() and bnx2_resume() regardless of netif_running() state.

Update version to 1.6.4.

Signed-off-by: Michael Chan <mchan@broadcom.com>

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index d53dfc5..24e7f9a 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -54,8 +54,8 @@
 
 #define DRV_MODULE_NAME		"bnx2"
 #define PFX DRV_MODULE_NAME	": "
-#define DRV_MODULE_VERSION	"1.6.3"
-#define DRV_MODULE_RELDATE	"July 16, 2007"
+#define DRV_MODULE_VERSION	"1.6.4"
+#define DRV_MODULE_RELDATE	"August 3, 2007"
 
 #define RUN_AT(x) (jiffies + (x))
 
@@ -6937,6 +6937,11 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
 	struct bnx2 *bp = netdev_priv(dev);
 	u32 reset_code;
 
+	/* PCI register 4 needs to be saved whether netif_running() or not.
+	 * MSI address and data need to be saved if using MSI and
+	 * netif_running().
+	 */
+	pci_save_state(pdev);
 	if (!netif_running(dev))
 		return 0;
 
@@ -6952,7 +6957,6 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
 		reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
 	bnx2_reset_chip(bp, reset_code);
 	bnx2_free_skbs(bp);
-	pci_save_state(pdev);
 	bnx2_set_power_state(bp, pci_choose_state(pdev, state));
 	return 0;
 }
@@ -6963,10 +6967,10 @@ bnx2_resume(struct pci_dev *pdev)
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct bnx2 *bp = netdev_priv(dev);
 
+	pci_restore_state(pdev);
 	if (!netif_running(dev))
 		return 0;
 
-	pci_restore_state(pdev);
 	bnx2_set_power_state(bp, PCI_D0);
 	netif_device_attach(dev);
 	bnx2_init_nic(bp);



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [BNX2]: Fix suspend/resume problem.
  2007-08-03 22:32 [BNX2]: Fix suspend/resume problem Michael Chan
@ 2007-08-04  3:57 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2007-08-04  3:57 UTC (permalink / raw)
  To: mchan; +Cc: netdev

From: "Michael Chan" <mchan@broadcom.com>
Date: Fri, 03 Aug 2007 15:32:34 -0700

> [BNX2]: Fix suspend/resume problem.
> 
> The device would not resume properly if it was shutdown before the system
> was suspended.  In such scenario where the netif_running state is 0,
> bnx2_suspend() would not save the PCI state and so the memory enable bit
> and bus master enable bit would be lost.
> 
> We fix this by always saving and restoring the PCI state in
> bnx2_suspend() and bnx2_resume() regardless of netif_running() state.
> 
> Update version to 1.6.4.
> 
> Signed-off-by: Michael Chan <mchan@broadcom.com>

Also applied, thanks Michael.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-04  3:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-03 22:32 [BNX2]: Fix suspend/resume problem Michael Chan
2007-08-04  3:57 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).