igb lets the device be runtime suspended even if it can't signal a wake-up from D3. Such a device doesn't notice the link coming back, so the port stays down until it is resumed from user space. Only schedule a runtime suspend if pci_dev_run_wake() is true. Devices that can't wake up no longer runtime suspend, even with power/control set to auto. Checking it when scheduling the suspend, rather than at probe and remove as e1000e and r8169 do, keeps the runtime PM usage count balanced if the result changes while the driver is bound. Tested with the 82576 emulated by QEMU. Fixes: 749ab2cd1270 ("igb: add basic runtime PM support") Cc: stable@vger.kernel.org Closes: https://bugzilla.ipfire.org/show_bug.cgi?id=13562 Reviewed-by: Janis Edvarts Lacis Signed-off-by: Antonio Quartulli --- v6: no changes v5: check pci_dev_run_wake() when scheduling the suspend rather than at probe and remove, which keeps the usage count balanced (Sashiko) v4: no changes v3: no changes v2: no code changes; mention the tested hardware Note: igc has the same issue: igc_probe() also allows runtime PM regardless of pci_dev_run_wake(). drivers/net/ethernet/intel/igb/igb_main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index e5a2870..d8f8df8 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -5643,6 +5643,15 @@ static void igb_watchdog(struct timer_list *t) schedule_work(&adapter->watchdog_task); } +/* A device that can't wake up wouldn't notice the link coming back while + * runtime suspended + */ +static void igb_schedule_runtime_suspend(struct igb_adapter *adapter) +{ + if (pci_dev_run_wake(adapter->pdev)) + pm_schedule_suspend(&adapter->pdev->dev, MSEC_PER_SEC * 5); +} + static void igb_watchdog_task(struct work_struct *work) { struct igb_adapter *adapter = container_of(work, @@ -5795,8 +5804,7 @@ no_wait: return; } } - pm_schedule_suspend(netdev->dev.parent, - MSEC_PER_SEC * 5); + igb_schedule_runtime_suspend(adapter); /* also check for alternate media here */ } else if (!netif_carrier_ok(netdev) && @@ -9765,7 +9773,7 @@ static int igb_runtime_idle(struct device *dev) struct igb_adapter *adapter = netdev_priv(netdev); if (!igb_has_link(adapter)) - pm_schedule_suspend(dev, MSEC_PER_SEC * 5); + igb_schedule_runtime_suspend(adapter); return -EBUSY; } -- 2.56.1