On Wed, Jan 23, 2019 at 03:10:32AM +0100, Andrew Lunn wrote:
> > Hi Andrew,
> > 
> > I tested the patch and it has an issue that prevents the carrier from 
> > turning
> > on. I think it's caused by the change from using link_state to 
> > phy->phy_state,
> > as later in the same function the link_state attributes are read when
> > deciding if the carrier needs to be turned on.
>  
> Hi Samu
> 
> This version has had better testing. So i'm a bit more confident about
> it.
> 
>       Andrew
> 
> From d093492f9aba75cb4844d15148e0efd014f193bb Mon Sep 17 00:00:00 2001
> From: Andrew Lunn <and...@lunn.ch>
> Date: Wed, 16 Jan 2019 20:22:04 -0600
> Subject: [PATCH] net: phy: phylink: Only change mac when fixed link changes
>  state
> 
> phylink polls the fixed-link once per second to see if the GPIO has
> changed state, or if the callback indicates if there has been a change
> in state. It then calls the MAC to reconfigure itself to the current
> state.
> 
> For some MACs, reconfiguration can result in packets being dropped.
> Hence only reconfigure the MAC if the link state differs from the
> netdev carrier state.
> 
> Reported-by: Samu Nuutamo <samu.nuut...@vincit.fi>
> Fixes: 9cd00a8aa42e ("net: phy: phylink: Poll link GPIOs")
> Signed-off-by: Andrew Lunn <and...@lunn.ch>
> ---
>  drivers/net/phy/phylink.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index e7becc7379d7..394b1eb5b55a 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -409,7 +409,8 @@ static void phylink_resolve(struct work_struct *w)
>  
>               case MLO_AN_FIXED:
>                       phylink_get_fixed_state(pl, &link_state);
> -                     phylink_mac_config(pl, &link_state);
> +                     if (link_state.link != netif_carrier_ok(ndev))
> +                             phylink_mac_config(pl, &link_state);
>                       break;
>  
>               case MLO_AN_INBAND:
> -- 
> 2.20.1
> 
Hi Andrew,

I did a quick test and this latest patch seems to work. Thank you.


- Samu

Reply via email to