* [PATCH] r8169: Enable suspend when device is idle from boot.
@ 2011-12-29 18:33 Todd Broch
2011-12-30 22:22 ` David Miller
0 siblings, 1 reply; 8+ messages in thread
From: Todd Broch @ 2011-12-29 18:33 UTC (permalink / raw)
To: nic_swsd; +Cc: Francois Romieu, netdev, Todd Broch
The r8169 driver supports power management and correctly transitions
from active to suspend when link transitions from connected to
disconnected. However, if link is not connected at boot the device
remains active after the initial probe.
This change adds a check of the link status to the idle pm_op that
will schedule a suspend if inactive.
Signed-off-by: Todd Broch <tbroch@chromium.org>
---
drivers/net/ethernet/realtek/r8169.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 67bf078..3dbb5fd 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -6137,6 +6137,7 @@ static int rtl8169_runtime_idle(struct device *device)
struct net_device *dev = pci_get_drvdata(pdev);
struct rtl8169_private *tp = netdev_priv(dev);
+ __rtl8169_check_link_status(dev, tp, tp->mmio_addr, true);
return tp->TxDescArray ? -EBUSY : 0;
}
--
1.7.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] r8169: Enable suspend when device is idle from boot.
2011-12-29 18:33 [PATCH] r8169: Enable suspend when device is idle from boot Todd Broch
@ 2011-12-30 22:22 ` David Miller
2011-12-31 12:17 ` Francois Romieu
0 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2011-12-30 22:22 UTC (permalink / raw)
To: tbroch; +Cc: nic_swsd, romieu, netdev
From: Todd Broch <tbroch@chromium.org>
Date: Thu, 29 Dec 2011 10:33:14 -0800
> The r8169 driver supports power management and correctly transitions
> from active to suspend when link transitions from connected to
> disconnected. However, if link is not connected at boot the device
> remains active after the initial probe.
>
> This change adds a check of the link status to the idle pm_op that
> will schedule a suspend if inactive.
>
> Signed-off-by: Todd Broch <tbroch@chromium.org>
Francois, what would you like me to do with this patch?
Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] r8169: Enable suspend when device is idle from boot.
2011-12-30 22:22 ` David Miller
@ 2011-12-31 12:17 ` Francois Romieu
2011-12-31 17:46 ` David Miller
2012-01-03 23:30 ` Francois Romieu
0 siblings, 2 replies; 8+ messages in thread
From: Francois Romieu @ 2011-12-31 12:17 UTC (permalink / raw)
To: David Miller; +Cc: tbroch, nic_swsd, netdev, Hayes Wang
David Miller <davem@davemloft.net> :
[...]
> Francois, what would you like me to do with this patch?
I have not tested it yet. I have no objection if a fix must go in now.
There is a slot for some sanity testing this evening.
The description of the patch implies that the initial power management
state is not right. I would be more inclined to set it correctly when
the device goes up instead of checking repeatedly for a loss of sync
through rtl8169_runtime_idle. Todd, any comment ?
--
Ueimor
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] r8169: Enable suspend when device is idle from boot.
2011-12-31 12:17 ` Francois Romieu
@ 2011-12-31 17:46 ` David Miller
2012-01-03 23:30 ` Francois Romieu
1 sibling, 0 replies; 8+ messages in thread
From: David Miller @ 2011-12-31 17:46 UTC (permalink / raw)
To: romieu; +Cc: tbroch, nic_swsd, netdev, hayeswang
From: Francois Romieu <romieu@fr.zoreil.com>
Date: Sat, 31 Dec 2011 13:17:04 +0100
> David Miller <davem@davemloft.net> :
> [...]
>> Francois, what would you like me to do with this patch?
>
> I have not tested it yet. I have no objection if a fix must go in now.
There is no rush with this, I just was seeking your opinion :-)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] r8169: Enable suspend when device is idle from boot.
2011-12-31 12:17 ` Francois Romieu
2011-12-31 17:46 ` David Miller
@ 2012-01-03 23:30 ` Francois Romieu
2012-01-04 18:01 ` Olof Johansson
[not found] ` <CA+iF6RocEBdXZh6LGW_Xak0Vxnzx6=AROvQJbF7sQzc7vYEb6A@mail.gmail.com>
1 sibling, 2 replies; 8+ messages in thread
From: Francois Romieu @ 2012-01-03 23:30 UTC (permalink / raw)
To: tbroch; +Cc: David Miller, nic_swsd, netdev, Hayes Wang
Francois Romieu <romieu@fr.zoreil.com> :
[...]
> The description of the patch implies that the initial power management
> state is not right. I would be more inclined to set it correctly when
> the device goes up instead of checking repeatedly for a loss of sync
> through rtl8169_runtime_idle. Todd, any comment ?
... which could be as simple as (completely untested) :
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index c8f47f1..e9fbd41 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -4309,7 +4309,7 @@ static int rtl8169_open(struct net_device *dev)
tp->saved_wolopts = 0;
pm_runtime_put_noidle(&pdev->dev);
- rtl8169_check_link_status(dev, tp, ioaddr);
+ __rtl8169_check_link_status(dev, tp, ioaddr, true);
out:
return retval;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] r8169: Enable suspend when device is idle from boot.
2012-01-03 23:30 ` Francois Romieu
@ 2012-01-04 18:01 ` Olof Johansson
2012-01-04 22:07 ` Francois Romieu
[not found] ` <CA+iF6RocEBdXZh6LGW_Xak0Vxnzx6=AROvQJbF7sQzc7vYEb6A@mail.gmail.com>
1 sibling, 1 reply; 8+ messages in thread
From: Olof Johansson @ 2012-01-04 18:01 UTC (permalink / raw)
To: Francois Romieu; +Cc: tbroch, David Miller, nic_swsd, netdev, Hayes Wang
On Tue, Jan 3, 2012 at 3:30 PM, Francois Romieu <romieu@fr.zoreil.com> wrote:
> Francois Romieu <romieu@fr.zoreil.com> :
> [...]
>> The description of the patch implies that the initial power management
>> state is not right. I would be more inclined to set it correctly when
>> the device goes up instead of checking repeatedly for a loss of sync
>> through rtl8169_runtime_idle. Todd, any comment ?
>
> ... which could be as simple as (completely untested) :
That change is just to the code path of open(), which means that for
the power savings to kick in, you have to bring the interface up. The
point of the original patch is to check even if the interface has
never been touched.
Perhaps call check_link_status at the end if init_one instead to
activate pm then?
-Olof
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] r8169: Enable suspend when device is idle from boot.
2012-01-04 18:01 ` Olof Johansson
@ 2012-01-04 22:07 ` Francois Romieu
0 siblings, 0 replies; 8+ messages in thread
From: Francois Romieu @ 2012-01-04 22:07 UTC (permalink / raw)
To: Olof Johansson
Cc: tbroch, David Miller, nic_swsd, netdev, Hayes Wang,
Rafael J. Wysocki
Olof Johansson <olof@lixom.net> :
> On Tue, Jan 3, 2012 at 3:30 PM, Francois Romieu <romieu@fr.zoreil.com> wrote:
> > Francois Romieu <romieu@fr.zoreil.com> :
> > [...]
> >> The description of the patch implies that the initial power management
> >> state is not right. I would be more inclined to set it correctly when
> >> the device goes up instead of checking repeatedly for a loss of sync
> >> through rtl8169_runtime_idle. Todd, any comment ?
> >
> > ... which could be as simple as (completely untested) :
>
> That change is just to the code path of open(), which means that for
> the power savings to kick in, you have to bring the interface up. The
> point of the original patch is to check even if the interface has
> never been touched.
Fair enough.
If so the original patch should not be needed as the driver core is
supposed to invoke the idle callback after probe (aka rtl8169_init_one).
After probe the device is in TxDescArray == 0 state and rtl8169_runtime_idle
returns 0. pm_runtime_suspend should thus be called [*]... I must have
missed something. :o/
[*] Not sure if it always imply a transition to D3 though.
> Perhaps call check_link_status at the end if init_one instead to
> activate pm then ?
It should not be needed, see above.
Moreover one should not care for the link status until the device is
brought up. It may seem a bit counterintuitive but the device and its
PHY are tightly coupled here. You do not manage them separately.
You should forget it anyway: PHY init happens late in the r8169 driver
and it can not be done sooner as it sometimes depends on firmware loading.
--
Ueimor
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <CA+iF6RocEBdXZh6LGW_Xak0Vxnzx6=AROvQJbF7sQzc7vYEb6A@mail.gmail.com>]
end of thread, other threads:[~2012-03-01 19:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-29 18:33 [PATCH] r8169: Enable suspend when device is idle from boot Todd Broch
2011-12-30 22:22 ` David Miller
2011-12-31 12:17 ` Francois Romieu
2011-12-31 17:46 ` David Miller
2012-01-03 23:30 ` Francois Romieu
2012-01-04 18:01 ` Olof Johansson
2012-01-04 22:07 ` Francois Romieu
[not found] ` <CA+iF6RocEBdXZh6LGW_Xak0Vxnzx6=AROvQJbF7sQzc7vYEb6A@mail.gmail.com>
2012-03-01 19:05 ` Francois Romieu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).