|
@@ -1749,13 +1749,21 @@ static u32 __rtl8169_get_wol(struct rtl8169_private *tp)
|
|
|
static void rtl8169_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
|
|
{
|
|
|
struct rtl8169_private *tp = netdev_priv(dev);
|
|
|
+ struct device *d = &tp->pci_dev->dev;
|
|
|
+
|
|
|
+ pm_runtime_get_noresume(d);
|
|
|
|
|
|
rtl_lock_work(tp);
|
|
|
|
|
|
wol->supported = WAKE_ANY;
|
|
|
- wol->wolopts = __rtl8169_get_wol(tp);
|
|
|
+ if (pm_runtime_active(d))
|
|
|
+ wol->wolopts = __rtl8169_get_wol(tp);
|
|
|
+ else
|
|
|
+ wol->wolopts = tp->saved_wolopts;
|
|
|
|
|
|
rtl_unlock_work(tp);
|
|
|
+
|
|
|
+ pm_runtime_put_noidle(d);
|
|
|
}
|
|
|
|
|
|
static void __rtl8169_set_wol(struct rtl8169_private *tp, u32 wolopts)
|
|
@@ -1845,6 +1853,9 @@ static void __rtl8169_set_wol(struct rtl8169_private *tp, u32 wolopts)
|
|
|
static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
|
|
{
|
|
|
struct rtl8169_private *tp = netdev_priv(dev);
|
|
|
+ struct device *d = &tp->pci_dev->dev;
|
|
|
+
|
|
|
+ pm_runtime_get_noresume(d);
|
|
|
|
|
|
rtl_lock_work(tp);
|
|
|
|
|
@@ -1852,12 +1863,17 @@ static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
|
|
tp->features |= RTL_FEATURE_WOL;
|
|
|
else
|
|
|
tp->features &= ~RTL_FEATURE_WOL;
|
|
|
- __rtl8169_set_wol(tp, wol->wolopts);
|
|
|
+ if (pm_runtime_active(d))
|
|
|
+ __rtl8169_set_wol(tp, wol->wolopts);
|
|
|
+ else
|
|
|
+ tp->saved_wolopts = wol->wolopts;
|
|
|
|
|
|
rtl_unlock_work(tp);
|
|
|
|
|
|
device_set_wakeup_enable(&tp->pci_dev->dev, wol->wolopts);
|
|
|
|
|
|
+ pm_runtime_put_noidle(d);
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -2292,11 +2308,17 @@ static void rtl8169_get_ethtool_stats(struct net_device *dev,
|
|
|
struct ethtool_stats *stats, u64 *data)
|
|
|
{
|
|
|
struct rtl8169_private *tp = netdev_priv(dev);
|
|
|
+ struct device *d = &tp->pci_dev->dev;
|
|
|
struct rtl8169_counters *counters = tp->counters;
|
|
|
|
|
|
ASSERT_RTNL();
|
|
|
|
|
|
- rtl8169_update_counters(dev);
|
|
|
+ pm_runtime_get_noresume(d);
|
|
|
+
|
|
|
+ if (pm_runtime_active(d))
|
|
|
+ rtl8169_update_counters(dev);
|
|
|
+
|
|
|
+ pm_runtime_put_noidle(d);
|
|
|
|
|
|
data[0] = le64_to_cpu(counters->tx_packets);
|
|
|
data[1] = le64_to_cpu(counters->rx_packets);
|
|
@@ -4458,6 +4480,7 @@ static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
|
|
|
static int rtl_set_mac_address(struct net_device *dev, void *p)
|
|
|
{
|
|
|
struct rtl8169_private *tp = netdev_priv(dev);
|
|
|
+ struct device *d = &tp->pci_dev->dev;
|
|
|
struct sockaddr *addr = p;
|
|
|
|
|
|
if (!is_valid_ether_addr(addr->sa_data))
|
|
@@ -4465,7 +4488,12 @@ static int rtl_set_mac_address(struct net_device *dev, void *p)
|
|
|
|
|
|
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
|
|
|
|
|
- rtl_rar_set(tp, dev->dev_addr);
|
|
|
+ pm_runtime_get_noresume(d);
|
|
|
+
|
|
|
+ if (pm_runtime_active(d))
|
|
|
+ rtl_rar_set(tp, dev->dev_addr);
|
|
|
+
|
|
|
+ pm_runtime_put_noidle(d);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
@@ -7868,6 +7896,7 @@ static int rtl8169_runtime_resume(struct device *device)
|
|
|
struct pci_dev *pdev = to_pci_dev(device);
|
|
|
struct net_device *dev = pci_get_drvdata(pdev);
|
|
|
struct rtl8169_private *tp = netdev_priv(dev);
|
|
|
+ rtl_rar_set(tp, dev->dev_addr);
|
|
|
|
|
|
if (!tp->TxDescArray)
|
|
|
return 0;
|