* [PATCH] powerpc/gianfar: fix ethernet cannot work after restoring from hibernation
@ 2012-11-06 6:04 Wang Dongsheng
2012-11-09 14:43 ` [PATCH] gianfar: ethernet vanishes " Paul Gortmaker
0 siblings, 1 reply; 4+ messages in thread
From: Wang Dongsheng @ 2012-11-06 6:04 UTC (permalink / raw)
To: davem; +Cc: netdev, Wang Dongsheng
we should make sure a ethernet has been taken down when system into hibernation
status. when the system restoring form hibernation, the ethernet cannot be
taken up.
eg:
~# ifconfig eth0 down
~# echo disk > /sys/power/state
hibernation restore
~# ifconfig eth0 up
SIOCSIFFLAGS: No such device
Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
---
drivers/net/ethernet/freescale/gianfar.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 4605f72..487b944 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -1345,8 +1345,11 @@ static int gfar_restore(struct device *dev)
struct gfar_private *priv = dev_get_drvdata(dev);
struct net_device *ndev = priv->ndev;
- if (!netif_running(ndev))
+ if (!netif_running(ndev)) {
+ netif_device_attach(ndev);
+
return 0;
+ }
gfar_init_bds(ndev);
init_registers(ndev);
--
1.7.5.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] gianfar: ethernet vanishes after restoring from hibernation
2012-11-06 6:04 [PATCH] powerpc/gianfar: fix ethernet cannot work after restoring from hibernation Wang Dongsheng
@ 2012-11-09 14:43 ` Paul Gortmaker
2012-11-09 16:02 ` Claudiu Manoil
2012-11-09 22:08 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Paul Gortmaker @ 2012-11-09 14:43 UTC (permalink / raw)
To: netdev; +Cc: Wang Dongsheng, Claudiu Manoil, Paul Gortmaker
From: Wang Dongsheng <dongsheng.wang@freescale.com>
If a gianfar ethernet device is down prior to hibernating a
system, it will no longer be present upon system restore.
For example:
~# ifconfig eth0 down
~# echo disk > /sys/power/state
<trigger a restore from hibernation>
~# ifconfig eth0 up
SIOCSIFFLAGS: No such device
This happens because the restore function bails out early upon
finding devices that were not up at hibernation. In doing so,
it never gets to the netif_device_attach call at the end of
the restore function. Adding the netif_device_attach as done
here also makes the gfar_restore code consistent with what is
done in the gfar_resume code.
Cc: Claudiu Manoil <claudiu.manoil@freescale.com>
Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
[v2: expand on details in commit log a bit more, to superceed
v1 at http://patchwork.ozlabs.org/patch/197412/ ]
drivers/net/ethernet/freescale/gianfar.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 1d03dcd..19ac096 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -1353,8 +1353,11 @@ static int gfar_restore(struct device *dev)
struct gfar_private *priv = dev_get_drvdata(dev);
struct net_device *ndev = priv->ndev;
- if (!netif_running(ndev))
+ if (!netif_running(ndev)) {
+ netif_device_attach(ndev);
+
return 0;
+ }
gfar_init_bds(ndev);
init_registers(ndev);
--
1.8.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gianfar: ethernet vanishes after restoring from hibernation
2012-11-09 14:43 ` [PATCH] gianfar: ethernet vanishes " Paul Gortmaker
@ 2012-11-09 16:02 ` Claudiu Manoil
2012-11-09 22:08 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: Claudiu Manoil @ 2012-11-09 16:02 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: netdev, Wang Dongsheng
On 11/9/2012 4:43 PM, Paul Gortmaker wrote:
> From: Wang Dongsheng <dongsheng.wang@freescale.com>
>
> If a gianfar ethernet device is down prior to hibernating a
> system, it will no longer be present upon system restore.
>
> For example:
>
> ~# ifconfig eth0 down
> ~# echo disk > /sys/power/state
>
> <trigger a restore from hibernation>
>
> ~# ifconfig eth0 up
> SIOCSIFFLAGS: No such device
>
> This happens because the restore function bails out early upon
> finding devices that were not up at hibernation. In doing so,
> it never gets to the netif_device_attach call at the end of
> the restore function. Adding the netif_device_attach as done
> here also makes the gfar_restore code consistent with what is
> done in the gfar_resume code.
>
> Cc: Claudiu Manoil <claudiu.manoil@freescale.com>
Hello Paul,
Thought I don't have the proper setup to test the hibernation feature,
I agree with this patch especially now that the description is much
clearer. I fully agree on the consistency argument b/w gfar_restore and
gfar_resume. (good observation)
Acked-by: Claudiu Manoil <claudiu.manoil@freescale.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gianfar: ethernet vanishes after restoring from hibernation
2012-11-09 14:43 ` [PATCH] gianfar: ethernet vanishes " Paul Gortmaker
2012-11-09 16:02 ` Claudiu Manoil
@ 2012-11-09 22:08 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2012-11-09 22:08 UTC (permalink / raw)
To: paul.gortmaker; +Cc: netdev, dongsheng.wang, claudiu.manoil
From: Paul Gortmaker <paul.gortmaker@windriver.com>
Date: Fri, 9 Nov 2012 09:43:51 -0500
> From: Wang Dongsheng <dongsheng.wang@freescale.com>
>
> If a gianfar ethernet device is down prior to hibernating a
> system, it will no longer be present upon system restore.
>
> For example:
>
> ~# ifconfig eth0 down
> ~# echo disk > /sys/power/state
>
> <trigger a restore from hibernation>
>
> ~# ifconfig eth0 up
> SIOCSIFFLAGS: No such device
>
> This happens because the restore function bails out early upon
> finding devices that were not up at hibernation. In doing so,
> it never gets to the netif_device_attach call at the end of
> the restore function. Adding the netif_device_attach as done
> here also makes the gfar_restore code consistent with what is
> done in the gfar_resume code.
>
> Cc: Claudiu Manoil <claudiu.manoil@freescale.com>
> Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-11-09 22:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-06 6:04 [PATCH] powerpc/gianfar: fix ethernet cannot work after restoring from hibernation Wang Dongsheng
2012-11-09 14:43 ` [PATCH] gianfar: ethernet vanishes " Paul Gortmaker
2012-11-09 16:02 ` Claudiu Manoil
2012-11-09 22:08 ` David Miller
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).