netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] gianfar: Restore link state settings after MAC reset
@ 2015-08-13 13:50 Claudiu Manoil
  2015-08-14  4:26 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Claudiu Manoil @ 2015-08-13 13:50 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller

There are some MAC registers that need to be kept in sync
with the link state parameters, see adjust_link().
However, after a MAC soft reset default values for
these registers are assumed.  In some cases (excepting
if down/ if up for example) adjust_link() does not see
that these values were reset to default because the
priv->old* link parameters were left unchanged.
So, reset the priv->old* link params as well during a
MAC reset to let adjust_link() restore the MAC link
settings to the actual link state values.

Fixes following case, for example:
Setting link to 100M, changing MTU (implies MAC reset),
link state remains unchanged to 100M but MAC registers
were reset to default (1G) breaking the connectivity w/
the PHY.  Closing and re-opening the interface would
restore the MAC link parameters to the correct values.

Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>
---
 drivers/net/ethernet/freescale/gianfar.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 2b7610f..10b3bbbb 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -2102,6 +2102,11 @@ int startup_gfar(struct net_device *ndev)
 	/* Start Rx/Tx DMA and enable the interrupts */
 	gfar_start(priv);
 
+	/* force link state update after mac reset */
+	priv->oldlink = 0;
+	priv->oldspeed = 0;
+	priv->oldduplex = -1;
+
 	phy_start(priv->phydev);
 
 	enable_napi(priv);
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] gianfar: Restore link state settings after MAC reset
  2015-08-13 13:50 [PATCH net] gianfar: Restore link state settings after MAC reset Claudiu Manoil
@ 2015-08-14  4:26 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-08-14  4:26 UTC (permalink / raw)
  To: claudiu.manoil; +Cc: netdev

From: Claudiu Manoil <claudiu.manoil@freescale.com>
Date: Thu, 13 Aug 2015 16:50:37 +0300

> There are some MAC registers that need to be kept in sync
> with the link state parameters, see adjust_link().
> However, after a MAC soft reset default values for
> these registers are assumed.  In some cases (excepting
> if down/ if up for example) adjust_link() does not see
> that these values were reset to default because the
> priv->old* link parameters were left unchanged.
> So, reset the priv->old* link params as well during a
> MAC reset to let adjust_link() restore the MAC link
> settings to the actual link state values.
> 
> Fixes following case, for example:
> Setting link to 100M, changing MTU (implies MAC reset),
> link state remains unchanged to 100M but MAC registers
> were reset to default (1G) breaking the connectivity w/
> the PHY.  Closing and re-opening the interface would
> restore the MAC link parameters to the correct values.
> 
> Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-14  4:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-13 13:50 [PATCH net] gianfar: Restore link state settings after MAC reset Claudiu Manoil
2015-08-14  4:26 ` 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).