Subject: Re: tg3: link is permanently down after ifdown and ifup

From: Felix Radensky <[email-masked]>
Date: Sun, 20 Dec 2009 18:44:46 +0200

Hi, Matt

Matt Carlson wrote:
> I understand the problem now.  The problem is that tg3_set_power_state()
> puts the phy into a low-power mode when it releases the device.  When
> the phy is reacquired, a phy reset is missing to take the device back
> out of the low-power mode.
>
> The patch at the bottom of this email is the fix I'm currently testing.
> If you wish, you can try it out.
>
>
> [PATCH] tg3: Fix 57780 connectivity problems
>
> When management firmware is not present, and WOL is disabled, the driver
> will put the phy into a low-power mode when shutting down.  To get out
> of low-power mode, the operation must be reversed or the phy must be
> reset.
>
> In the past, the phylib reset the phy from either phy_start() or
> phy_start_aneg().  This phy reset has been removed from more recent
> kernels.  The tg3 driver already has phy reset code in place which is
> called when it assumes control of the device.  It is bypassed if phylib
> is enabled though.
>
> This patch removes the phylib exception.
> ---
>  drivers/net/tg3.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
> index 3a74d21..c0a3080 100644
> --- a/drivers/net/tg3.c
> +++ b/drivers/net/tg3.c
> @@ -7523,8 +7523,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
>  		tg3_abort_hw(tp, 1);
>  	}
>  
> -	if (reset_phy &&
> -	    !(tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB))
> +	if (reset_phy)
>  		tg3_phy_reset(tp);
>  
>  	err = tg3_chip_reset(tp);
>   
I can confirm that this patch fixes the problem I had. Thanks a lot for 
the fix.

There was another problem in 2.6.32 that I reported, namely kernel soft 
lockup
when link is synchronized at 100Mbit/sec and tg3 with 57780 goes down . Were
you able to reproduce it ?

Thanks a lot for your help.

Felix.