igb: add basic runtime PM support
Subsystems (3)
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
@@ -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
Jeff Kirsher
AppliedQuoted 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.
Signed-off-by Zheng Yan <[email protected]>---
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!