Re: [PATCH 2/4] setup wake-on-lan before shutting down

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Tobias Diedrich
Date: Sunday, May 18, 2008 - 6:02 am

From: Tobias Diedrich <ranma+kernel@tdiedrich.de>

When hibernating in 'shutdown' mode, after saving the image the suspend hook
is not called again.
However, if the device is in promiscous mode, wake-on-lan will not work.
This adds a shutdown hook to setup wake-on-lan before the final shutdown.

Signed-off-by: Tobias Diedrich <ranma+kernel@tdiedrich.de>

Index: linux-2.6.26-rc2.forcedwol/drivers/net/forcedeth.c
===================================================================
--- linux-2.6.26-rc2.forcedwol.orig/drivers/net/forcedeth.c	2008-05-18 13:53:02.000000000 +0200
+++ linux-2.6.26-rc2.forcedwol/drivers/net/forcedeth.c	2008-05-18 13:53:06.000000000 +0200
@@ -5827,8 +5827,23 @@
 out:
 	return rc;
 }
+
+static void nv_shutdown(struct pci_dev *pdev)
+{
+	struct net_device *dev = pci_get_drvdata(pdev);
+	struct fe_priv *np = netdev_priv(dev);
+
+	if (netif_running(dev))
+		nv_close(dev);
+
+	pci_enable_wake(pdev, PCI_D3hot, np->wolenabled);
+	pci_enable_wake(pdev, PCI_D3cold, np->wolenabled);
+	pci_disable_device(pdev);
+	pci_set_power_state(pdev, PCI_D3hot);
+}
 #else
 #define nv_suspend NULL
+#define nv_shutdown NULL
 #define nv_resume NULL
 #endif /* CONFIG_PM */
 
@@ -5999,6 +6014,7 @@
 	.remove		= __devexit_p(nv_remove),
 	.suspend	= nv_suspend,
 	.resume		= nv_resume,
+	.shutdown	= nv_shutdown,
 };
 
 static int __init init_nic(void)
--
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
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/4] Fix forcedeth hibernate/wake-on-lan problems, Tobias Diedrich, (Sun May 18, 5:57 am)
Re: [PATCH 1/4] Restore multicast settings on resume, Tobias Diedrich, (Sun May 18, 6:00 am)
Re: [PATCH 2/4] setup wake-on-lan before shutting down, Tobias Diedrich, (Sun May 18, 6:02 am)
Re: [PATCH 3/4] save/restore device configuration space, Tobias Diedrich, (Sun May 18, 6:03 am)
Re: [PATCH 4/4] reorder suspend/resume code, Tobias Diedrich, (Sun May 18, 6:04 am)
Re: [PATCH 0/4] Fix forcedeth hibernate/wake-on-lan problems, Tobias Diedrich, (Sun May 18, 8:09 am)
Re: [PATCH 0/4] Fix forcedeth hibernate/wake-on-lan problems, Rafael J. Wysocki, (Tue May 20, 3:39 pm)
Re: [PATCH 1/4] Restore multicast settings on resume, Jeff Garzik, (Thu May 22, 3:21 am)
Re: [PATCH 0/4] Fix forcedeth hibernate/wake-on-lan problems, Tobias Diedrich, (Sun May 25, 8:04 am)
Re: [PATCH 0/4] Fix forcedeth hibernate/wake-on-lan problems, Tobias Diedrich, (Sun May 25, 11:13 am)
Re: [PATCH 0/4] Fix forcedeth hibernate/wake-on-lan problems, Tobias Diedrich, (Mon May 26, 11:21 pm)
Re: [PATCH 2/4] setup wake-on-lan before shutting down, Jeff Garzik, (Fri May 30, 7:20 pm)
Re: [PATCH 0/4] Fix forcedeth hibernate/wake-on-lan problems, Tobias Diedrich, (Sat May 31, 3:12 pm)
Re: [PATCH 5/4] Fix forcedeth hibernate/wake-on-lan problems, Tobias Diedrich, (Sat May 31, 3:54 pm)
Re: [PATCH 6/4] Fix forcedeth hibernate/wake-on-lan problems, Tobias Diedrich, (Sat May 31, 4:20 pm)