FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 04-23-2010, 03:43 AM
Bryan Wu
 
Default netdev/fec: fix ifconfig eth0 down hang issue (v4)

BugLink: http://bugs.launchpad.net/bugs/559065

v4:
- don't touch suspend/resume functions in this patch
- set fep->phy_dev = NULL in the fec_enet_mii_probe() entry

v3:
if fec_enet_mii_probe() fails, we should exit the open and resume functions
properly and give up further operations without a proper PHY connected.

v2:
Check fec_enet_mii_probe() return value directly, instead of fep->phy_dev

v1:
In ethernet connection open/close function, we need to use phy_connect
and phy_disconnect operation before we start/stop phy. Otherwise it will
cause system hang. Also suspend/resume needs the same fix.

Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
---
drivers/net/fec.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 2280373..8f0237b 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -691,6 +691,8 @@ static int fec_enet_mii_probe(struct net_device *dev)
struct phy_device *phy_dev = NULL;
int phy_addr;

+ fep->phy_dev = NULL;
+
/* find the first phy */
for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
if (fep->mii_bus->phy_map[phy_addr]) {
@@ -929,7 +931,13 @@ fec_enet_open(struct net_device *dev)
return ret;

/* schedule a link state check */
+ ret = fec_enet_mii_probe(dev);
+ if (!ret) {
+ fec_enet_free_buffers(dev);
+ return ret;
+ }
phy_start(fep->phy_dev);
+
netif_start_queue(dev);
fep->opened = 1;
return 0;
@@ -942,10 +950,13 @@ fec_enet_close(struct net_device *dev)

/* Don't know what to do yet. */
fep->opened = 0;
- phy_stop(fep->phy_dev);
netif_stop_queue(dev);
+
fec_stop(dev);

+ if (fep->phy_dev)
+ phy_disconnect(fep->phy_dev);
+
fec_enet_free_buffers(dev);
clk_disable(fep->clk);

@@ -1409,6 +1420,7 @@ fec_resume(struct platform_device *dev)
{
struct net_device *ndev = platform_get_drvdata(dev);
struct fec_enet_private *fep;
+ int ret;

if (ndev) {
fep = netdev_priv(ndev);
--
1.7.0.1


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 04-23-2010, 03:48 AM
Bryan Wu
 
Default netdev/fec: fix ifconfig eth0 down hang issue (v4)

BugLink: http://bugs.launchpad.net/bugs/559065

v4:
- don't touch suspend/resume functions in this patch
- set fep->phy_dev = NULL in the fec_enet_mii_probe() entry

v3:
if fec_enet_mii_probe() fails, we should exit the open and resume functions
properly and give up further operations without a proper PHY connected.

v2:
Check fec_enet_mii_probe() return value directly, instead of fep->phy_dev

v1:
In ethernet connection open/close function, we need to use phy_connect
and phy_disconnect operation before we start/stop phy. Otherwise it will
cause system hang. Also suspend/resume needs the same fix.

Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
---
drivers/net/fec.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 2280373..dff9d96 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -691,6 +691,8 @@ static int fec_enet_mii_probe(struct net_device *dev)
struct phy_device *phy_dev = NULL;
int phy_addr;

+ fep->phy_dev = NULL;
+
/* find the first phy */
for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
if (fep->mii_bus->phy_map[phy_addr]) {
@@ -929,7 +931,13 @@ fec_enet_open(struct net_device *dev)
return ret;

/* schedule a link state check */
+ ret = fec_enet_mii_probe(dev);
+ if (!ret) {
+ fec_enet_free_buffers(dev);
+ return ret;
+ }
phy_start(fep->phy_dev);
+
netif_start_queue(dev);
fep->opened = 1;
return 0;
@@ -942,10 +950,13 @@ fec_enet_close(struct net_device *dev)

/* Don't know what to do yet. */
fep->opened = 0;
- phy_stop(fep->phy_dev);
netif_stop_queue(dev);
+
fec_stop(dev);

+ if (fep->phy_dev)
+ phy_disconnect(fep->phy_dev);
+
fec_enet_free_buffers(dev);
clk_disable(fep->clk);

--
1.7.0.1


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 04-23-2010, 03:49 AM
Bryan Wu
 
Default netdev/fec: fix ifconfig eth0 down hang issue (v4)

Bryan Wu wrote:
> BugLink: http://bugs.launchpad.net/bugs/559065
>
> v4:
> - don't touch suspend/resume functions in this patch
> - set fep->phy_dev = NULL in the fec_enet_mii_probe() entry
>
> v3:
> if fec_enet_mii_probe() fails, we should exit the open and resume functions
> properly and give up further operations without a proper PHY connected.
>
> v2:
> Check fec_enet_mii_probe() return value directly, instead of fep->phy_dev
>
> v1:
> In ethernet connection open/close function, we need to use phy_connect
> and phy_disconnect operation before we start/stop phy. Otherwise it will
> cause system hang. Also suspend/resume needs the same fix.
>
> Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
> ---
> drivers/net/fec.c | 14 +++++++++++++-
> 1 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/fec.c b/drivers/net/fec.c
> index 2280373..8f0237b 100644
> --- a/drivers/net/fec.c
> +++ b/drivers/net/fec.c
> @@ -691,6 +691,8 @@ static int fec_enet_mii_probe(struct net_device *dev)
> struct phy_device *phy_dev = NULL;
> int phy_addr;
>
> + fep->phy_dev = NULL;
> +
> /* find the first phy */
> for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
> if (fep->mii_bus->phy_map[phy_addr]) {
> @@ -929,7 +931,13 @@ fec_enet_open(struct net_device *dev)
> return ret;
>
> /* schedule a link state check */
> + ret = fec_enet_mii_probe(dev);
> + if (!ret) {
> + fec_enet_free_buffers(dev);
> + return ret;
> + }
> phy_start(fep->phy_dev);
> +
> netif_start_queue(dev);
> fep->opened = 1;
> return 0;
> @@ -942,10 +950,13 @@ fec_enet_close(struct net_device *dev)
>
> /* Don't know what to do yet. */
> fep->opened = 0;
> - phy_stop(fep->phy_dev);
> netif_stop_queue(dev);
> +
> fec_stop(dev);
>
> + if (fep->phy_dev)
> + phy_disconnect(fep->phy_dev);
> +
> fec_enet_free_buffers(dev);
> clk_disable(fep->clk);
>
> @@ -1409,6 +1420,7 @@ fec_resume(struct platform_device *dev)
> {
> struct net_device *ndev = platform_get_drvdata(dev);
> struct fec_enet_private *fep;
> + int ret;
>
>

What'a a mess. Sorry, please ignore this one. I will send out a new one
soon.

-Bryan

> if (ndev) {
> fep = netdev_priv(ndev);
>


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 04-23-2010, 08:02 AM
Bryan Wu
 
Default netdev/fec: fix ifconfig eth0 down hang issue (v4)

This change will cause kernel oops. Will rework a patch and send it out after
testing.

Sorry,
-Bryan

On 04/23/2010 11:48 AM, Bryan Wu wrote:
> BugLink: http://bugs.launchpad.net/bugs/559065
>
> v4:
> - don't touch suspend/resume functions in this patch
> - set fep->phy_dev = NULL in the fec_enet_mii_probe() entry
>
> v3:
> if fec_enet_mii_probe() fails, we should exit the open and resume functions
> properly and give up further operations without a proper PHY connected.
>
> v2:
> Check fec_enet_mii_probe() return value directly, instead of fep->phy_dev
>
> v1:
> In ethernet connection open/close function, we need to use phy_connect
> and phy_disconnect operation before we start/stop phy. Otherwise it will
> cause system hang. Also suspend/resume needs the same fix.
>
> Signed-off-by: Bryan Wu<bryan.wu@canonical.com>
> ---
> drivers/net/fec.c | 13 ++++++++++++-
> 1 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/fec.c b/drivers/net/fec.c
> index 2280373..dff9d96 100644
> --- a/drivers/net/fec.c
> +++ b/drivers/net/fec.c
> @@ -691,6 +691,8 @@ static int fec_enet_mii_probe(struct net_device *dev)
> struct phy_device *phy_dev = NULL;
> int phy_addr;
>
> + fep->phy_dev = NULL;
> +
> /* find the first phy */
> for (phy_addr = 0; phy_addr< PHY_MAX_ADDR; phy_addr++) {
> if (fep->mii_bus->phy_map[phy_addr]) {
> @@ -929,7 +931,13 @@ fec_enet_open(struct net_device *dev)
> return ret;
>
> /* schedule a link state check */
> + ret = fec_enet_mii_probe(dev);
> + if (!ret) {
> + fec_enet_free_buffers(dev);
> + return ret;
> + }
> phy_start(fep->phy_dev);
> +
> netif_start_queue(dev);
> fep->opened = 1;
> return 0;
> @@ -942,10 +950,13 @@ fec_enet_close(struct net_device *dev)
>
> /* Don't know what to do yet. */
> fep->opened = 0;
> - phy_stop(fep->phy_dev);
> netif_stop_queue(dev);
> +
> fec_stop(dev);
>
> + if (fep->phy_dev)
> + phy_disconnect(fep->phy_dev);
> +
> fec_enet_free_buffers(dev);
> clk_disable(fep->clk);
>


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 

Thread Tools




All times are GMT. The time now is 10:21 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org