Skip to contentSkip to conversation

igb: add basic runtime PM support

PATCH Applied Yan, Zheng 2 participants 2 messages Dec 21, 2011 – Dec 22, 2011

Subsystems (3)
lore
Share & tools
lore

Yan, Zheng

author
#0 lore raw

PATCH v2 1/1 igb: add basic runtime PM support

Use the runtime power management framework to add basic runtime PM support to the igb driver. Namely, make the driver suspend the device when the link is off and set it up for generating a wakeup event after the link has been detected again. This feature is disabled by default.

Based on e1000e's runtime PM code.

---
Changes since v1:
Don't suspend the device when shutting down the interface. Avoid race between runtime suspending and ethtool operations.

 drivers/net/ethernet/intel/igb/igb_ethtool.c |   16 +++
 drivers/net/ethernet/intel/igb/igb_main.c    |  136 ++++++++++++++++++++++----
 2 files changed, 133 insertions(+), 19 deletions(-)
drivers/net/ethernet/intel/igb/igb_ethtool.c +16 -0
index e9335ef..3411073 100644
@@ -36,6 +36,7 @@
 #include <linux/ethtool.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/pm_runtime.h>
 
 #include "igb.h"
 
@@ -2159,6 +2160,19 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
 	}
 }
 
+static int igb_ethtool_begin(struct net_device *netdev)
+{
+	struct igb_adapter *adapter = netdev_priv(netdev);
+	pm_runtime_get_sync(&adapter->pdev->dev);
+	return 0;
+}
+
+static void igb_ethtool_complete(struct net_device *netdev)
+{
+	struct igb_adapter *adapter = netdev_priv(netdev);
+	pm_runtime_put(&adapter->pdev->dev);
+}
+
 static const struct ethtool_ops igb_ethtool_ops = {
 	.get_settings           = igb_get_settings,
 	.set_settings           = igb_set_settings,
@@ -2185,6 +2199,8 @@ static const struct ethtool_ops igb_ethtool_ops = {
 	.get_ethtool_stats      = igb_get_ethtool_stats,
 	.get_coalesce           = igb_get_coalesce,
 	.set_coalesce           = igb_set_coalesce,
+	.begin			= igb_ethtool_begin,
+	.complete		= igb_ethtool_complete,
 };
 
 void igb_set_ethtool_ops(struct net_device *netdev)
drivers/net/ethernet/intel/igb/igb_main.c +117 -19

287 lines not on this page · raw message

Signature · 1 line
1.7.7.4
Applied
#1 lore raw
Quoted 16 lines · Zheng

Use the runtime power management framework to add basic runtime PM support
to the igb driver. Namely, make the driver suspend the device when the link
is off and set it up for generating a wakeup event after the link has been
detected again. This feature is disabled by default.

Based on e1000e's runtime PM code.

---
Changes since v1:
Don't suspend the device when shutting down the interface. Avoid race between runtime suspending and ethtool operations.

Quoted 4 lines
 drivers/net/ethernet/intel/igb/igb_ethtool.c |   16 +++
 drivers/net/ethernet/intel/igb/igb_main.c    |  136
++++++++++++++++++++++----
 2 files changed, 133 insertions(+), 19 deletions(-) 

I have applied this to my queue of patches. Thanks Zheng!