@@ -1587,6 +1587,12 @@ static void rtl8169_check_link_status(struct net_device *dev,
1587
1587
1588
1588
#define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST)
1589
1589
1590
+ /* Currently we only enable WoL if explicitly told by userspace to circumvent
1591
+ * issues on certain platforms, see commit bde135a672bf ("r8169: only enable
1592
+ * PCI wakeups when WOL is active"). Let's keep __rtl8169_get_wol() for the
1593
+ * case that we want to respect BIOS settings again.
1594
+ */
1595
+ #if 0
1590
1596
static u32 __rtl8169_get_wol (struct rtl8169_private * tp )
1591
1597
{
1592
1598
u8 options ;
@@ -1621,25 +1627,16 @@ static u32 __rtl8169_get_wol(struct rtl8169_private *tp)
1621
1627
1622
1628
return wolopts ;
1623
1629
}
1630
+ #endif
1624
1631
1625
1632
static void rtl8169_get_wol (struct net_device * dev , struct ethtool_wolinfo * wol )
1626
1633
{
1627
1634
struct rtl8169_private * tp = netdev_priv (dev );
1628
- struct device * d = tp_to_dev (tp );
1629
-
1630
- pm_runtime_get_noresume (d );
1631
1635
1632
1636
rtl_lock_work (tp );
1633
-
1634
1637
wol -> supported = WAKE_ANY ;
1635
- if (pm_runtime_active (d ))
1636
- wol -> wolopts = __rtl8169_get_wol (tp );
1637
- else
1638
- wol -> wolopts = tp -> saved_wolopts ;
1639
-
1638
+ wol -> wolopts = tp -> saved_wolopts ;
1640
1639
rtl_unlock_work (tp );
1641
-
1642
- pm_runtime_put_noidle (d );
1643
1640
}
1644
1641
1645
1642
static void __rtl8169_set_wol (struct rtl8169_private * tp , u32 wolopts )
@@ -1719,14 +1716,14 @@ static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
1719
1716
1720
1717
rtl_lock_work (tp );
1721
1718
1719
+ tp -> saved_wolopts = wol -> wolopts & WAKE_ANY ;
1720
+
1722
1721
if (pm_runtime_active (d ))
1723
- __rtl8169_set_wol (tp , wol -> wolopts );
1724
- else
1725
- tp -> saved_wolopts = wol -> wolopts ;
1722
+ __rtl8169_set_wol (tp , tp -> saved_wolopts );
1726
1723
1727
1724
rtl_unlock_work (tp );
1728
1725
1729
- device_set_wakeup_enable (d , wol -> wolopts );
1726
+ device_set_wakeup_enable (d , tp -> saved_wolopts );
1730
1727
1731
1728
pm_runtime_put_noidle (d );
1732
1729
@@ -4638,7 +4635,7 @@ static void rtl_wol_suspend_quirk(struct rtl8169_private *tp)
4638
4635
4639
4636
static bool rtl_wol_pll_power_down (struct rtl8169_private * tp )
4640
4637
{
4641
- if (!( __rtl8169_get_wol ( tp ) & WAKE_ANY ) )
4638
+ if (!netif_running ( tp -> dev ) || ! tp -> saved_wolopts )
4642
4639
return false;
4643
4640
4644
4641
rtl_speed_down (tp );
@@ -7219,7 +7216,6 @@ static int rtl_open(struct net_device *dev)
7219
7216
7220
7217
rtl_unlock_work (tp );
7221
7218
7222
- tp -> saved_wolopts = 0 ;
7223
7219
pm_runtime_put_sync (& pdev -> dev );
7224
7220
7225
7221
rtl8169_check_link_status (dev , tp );
@@ -7334,6 +7330,7 @@ static void __rtl8169_resume(struct net_device *dev)
7334
7330
netif_device_attach (dev );
7335
7331
7336
7332
rtl_pll_power_up (tp );
7333
+ rtl8169_init_phy (dev , tp );
7337
7334
7338
7335
rtl_lock_work (tp );
7339
7336
napi_enable (& tp -> napi );
@@ -7347,9 +7344,6 @@ static int rtl8169_resume(struct device *device)
7347
7344
{
7348
7345
struct pci_dev * pdev = to_pci_dev (device );
7349
7346
struct net_device * dev = pci_get_drvdata (pdev );
7350
- struct rtl8169_private * tp = netdev_priv (dev );
7351
-
7352
- rtl8169_init_phy (dev , tp );
7353
7347
7354
7348
if (netif_running (dev ))
7355
7349
__rtl8169_resume (dev );
@@ -7369,7 +7363,6 @@ static int rtl8169_runtime_suspend(struct device *device)
7369
7363
}
7370
7364
7371
7365
rtl_lock_work (tp );
7372
- tp -> saved_wolopts = __rtl8169_get_wol (tp );
7373
7366
__rtl8169_set_wol (tp , WAKE_ANY );
7374
7367
rtl_unlock_work (tp );
7375
7368
@@ -7394,11 +7387,8 @@ static int rtl8169_runtime_resume(struct device *device)
7394
7387
7395
7388
rtl_lock_work (tp );
7396
7389
__rtl8169_set_wol (tp , tp -> saved_wolopts );
7397
- tp -> saved_wolopts = 0 ;
7398
7390
rtl_unlock_work (tp );
7399
7391
7400
- rtl8169_init_phy (dev , tp );
7401
-
7402
7392
__rtl8169_resume (dev );
7403
7393
7404
7394
return 0 ;
@@ -7466,7 +7456,7 @@ static void rtl_shutdown(struct pci_dev *pdev)
7466
7456
rtl8169_hw_reset (tp );
7467
7457
7468
7458
if (system_state == SYSTEM_POWER_OFF ) {
7469
- if (__rtl8169_get_wol ( tp ) & WAKE_ANY ) {
7459
+ if (tp -> saved_wolopts ) {
7470
7460
rtl_wol_suspend_quirk (tp );
7471
7461
rtl_wol_shutdown_quirk (tp );
7472
7462
}
0 commit comments