🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Antonio Quartulli Tue, 24 Nov 2026 23:57
[PATCH net v5 6/6] igb: only allow runtime PM if the device can wake up
#22189
Author: Antonio Quartulli
Date: Tue, 24 Nov 2026 23:57
71 lines
11568 bytes
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
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
---
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 80ae03d..853bdf4 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -5625,6 +5625,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,
@@ -5777,8 +5786,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) &&
@@ -9741,7 +9749,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
Re: [PATCH net v5 6/6] igb: only allow runtime PM if the device can wake up
#23881
Author: Janis Edvarts Lacis
Date: Sat, 28 Nov 2026 13:40
74 lines
13928 bytes
On 25 Nov 00:57, Antonio Quartulli wrote:
>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
>Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
>---
>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 80ae03d..853bdf4 100644
>--- a/drivers/net/ethernet/intel/igb/igb_main.c
>+++ b/drivers/net/ethernet/intel/igb/igb_main.c
>@@ -5625,6 +5625,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,
>@@ -5777,8 +5786,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) &&
>@@ -9741,7 +9749,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
>
Reviewed-by: Janis Edvarts Lacis <janislacis06@gmail.com>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads