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-21-2010, 02:12 AM
Bryan Wu
 
Default netdev/fec: fix ifconfig eth0 down hang issue (v2)

This patch is also for both Karmic and Lucid and was tested again.
Please kindly review.

Thanks
-Bryan


Bryan Wu wrote:
> BugLink: http://bugs.launchpad.net/bugs/559065
>
> 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, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/fec.c b/drivers/net/fec.c
> index 2280373..6a13594 100644
> --- a/drivers/net/fec.c
> +++ b/drivers/net/fec.c
> @@ -929,7 +929,9 @@ fec_enet_open(struct net_device *dev)
> return ret;
>
> /* schedule a link state check */
> - phy_start(fep->phy_dev);
> + if (fec_enet_mii_probe(dev) != 0)
> + phy_start(fep->phy_dev);
> +
> netif_start_queue(dev);
> fep->opened = 1;
> return 0;
> @@ -942,10 +944,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);
>
> @@ -1396,6 +1401,8 @@ fec_suspend(struct platform_device *dev, pm_message_t state)
> fep = netdev_priv(ndev);
> if (netif_running(ndev)) {
> netif_device_detach(ndev);
> + if (fep->phy_dev)
> + phy_disconnect(fep->phy_dev);
> fec_stop(ndev);
> clk_disable(fep->clk);
> }
> @@ -1415,6 +1422,8 @@ fec_resume(struct platform_device *dev)
> if (netif_running(ndev)) {
> clk_enable(fep->clk);
> fec_restart(ndev, 1);
> + if (fec_enet_mii_probe(dev) != 0)
> + phy_start(fep->phy_dev);
> netif_device_attach(ndev);
> }
> }
>


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 04-21-2010, 01:39 PM
Tim Gardner
 
Default netdev/fec: fix ifconfig eth0 down hang issue (v2)

On 04/20/2010 07:54 PM, Bryan Wu wrote:
> BugLink: http://bugs.launchpad.net/bugs/559065
>
> 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, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/fec.c b/drivers/net/fec.c
> index 2280373..6a13594 100644
> --- a/drivers/net/fec.c
> +++ b/drivers/net/fec.c
> @@ -929,7 +929,9 @@ fec_enet_open(struct net_device *dev)
> return ret;
>
> /* schedule a link state check */
> - phy_start(fep->phy_dev);
> + if (fec_enet_mii_probe(dev) != 0)
> + phy_start(fep->phy_dev);
> +
> netif_start_queue(dev);
> fep->opened = 1;
> return 0;
> @@ -942,10 +944,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);
>
> @@ -1396,6 +1401,8 @@ fec_suspend(struct platform_device *dev, pm_message_t state)
> fep = netdev_priv(ndev);
> if (netif_running(ndev)) {
> netif_device_detach(ndev);
> + if (fep->phy_dev)
> + phy_disconnect(fep->phy_dev);
> fec_stop(ndev);
> clk_disable(fep->clk);
> }
> @@ -1415,6 +1422,8 @@ fec_resume(struct platform_device *dev)
> if (netif_running(ndev)) {
> clk_enable(fep->clk);
> fec_restart(ndev, 1);
> + if (fec_enet_mii_probe(dev) != 0)
> + phy_start(fep->phy_dev);
> netif_device_attach(ndev);
> }
> }

This patch doesn't address my original question which was why would you
continue the open if you can't find an MII physical interface? If
fec_enet_mii_probe(dev) fails, then exit with an error. Of what use is
an open ethernet interface if its not attached to a phy?

rtg
--
Tim Gardner tim.gardner@canonical.com

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

On 04/21/2010 09:39 PM, Tim Gardner wrote:
> On 04/20/2010 07:54 PM, Bryan Wu wrote:
>> BugLink: http://bugs.launchpad.net/bugs/559065
>>
>> 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, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/fec.c b/drivers/net/fec.c
>> index 2280373..6a13594 100644
>> --- a/drivers/net/fec.c
>> +++ b/drivers/net/fec.c
>> @@ -929,7 +929,9 @@ fec_enet_open(struct net_device *dev)
>> return ret;
>>
>> /* schedule a link state check */
>> - phy_start(fep->phy_dev);
>> + if (fec_enet_mii_probe(dev) != 0)
>> + phy_start(fep->phy_dev);
>> +
>> netif_start_queue(dev);
>> fep->opened = 1;
>> return 0;
>> @@ -942,10 +944,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);
>>
>> @@ -1396,6 +1401,8 @@ fec_suspend(struct platform_device *dev,
>> pm_message_t state)
>> fep = netdev_priv(ndev);
>> if (netif_running(ndev)) {
>> netif_device_detach(ndev);
>> + if (fep->phy_dev)
>> + phy_disconnect(fep->phy_dev);
>> fec_stop(ndev);
>> clk_disable(fep->clk);
>> }
>> @@ -1415,6 +1422,8 @@ fec_resume(struct platform_device *dev)
>> if (netif_running(ndev)) {
>> clk_enable(fep->clk);
>> fec_restart(ndev, 1);
>> + if (fec_enet_mii_probe(dev) != 0)
>> + phy_start(fep->phy_dev);
>> netif_device_attach(ndev);
>> }
>> }
>
> This patch doesn't address my original question which was why would you
> continue the open if you can't find an MII physical interface? If
> fec_enet_mii_probe(dev) fails, then exit with an error. Of what use is
> an open ethernet interface if its not attached to a phy?
>

Yeah, you are right. I missed that point and will post a new patch soon.

Thanks
--
Bryan Wu <bryan.wu@canonical.com>
Kernel Developer +86.138-1617-6545 Mobile
Ubuntu Kernel Team | Hardware Enablement Team
Canonical Ltd. www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com

--
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 01:35 PM.

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