All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sh_eth: Fix lost MAC address on kexec
@ 2015-02-27 16:16 ` Geert Uytterhoeven
  0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2015-02-27 16:16 UTC (permalink / raw)
  To: David S. Miller, Ben Hutchings
  Cc: Nobuhiro Iwamatsu, Simon Horman, Magnus Damm, Kevin Hilman,
	netdev, linux-sh, linux-kernel, Geert Uytterhoeven

Commit 740c7f31c094703c ("sh_eth: Ensure DMA engines are stopped before
freeing buffers") added a call to sh_eth_reset() to the
sh_eth_set_ringparam() and sh_eth_close() paths.

However, setting the software reset bit(s) in the EDMR register resets
the MAC Address Registers to zero. Hence after kexec, the new kernel
doesn't detect a valid MAC address and assigns a random MAC address,
breaking DHCP.

Set the MAC address again after the reset in sh_eth_dev_exit() to fix
this.

Tested on r8a7740/armadillo (GETHER) and r8a7791/koelsch (FAST_RCAR).

Fixes: 740c7f31c094703c ("sh_eth: Ensure DMA engines are stopped before freeing buffers")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/net/ethernet/renesas/sh_eth.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 4da8bd263997a17b..654b48d1e61a3124 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1392,6 +1392,9 @@ static void sh_eth_dev_exit(struct net_device *ndev)
 	msleep(2); /* max frame time at 10 Mbps < 1250 us */
 	sh_eth_get_stats(ndev);
 	sh_eth_reset(ndev);
+
+	/* Set MAC address again */
+	update_mac_address(ndev);
 }
 
 /* free Tx skb function */
-- 
1.9.1


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

* [PATCH] sh_eth: Fix lost MAC address on kexec
@ 2015-02-27 16:16 ` Geert Uytterhoeven
  0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2015-02-27 16:16 UTC (permalink / raw)
  To: David S. Miller, Ben Hutchings
  Cc: Nobuhiro Iwamatsu, Simon Horman, Magnus Damm, Kevin Hilman,
	netdev, linux-sh, linux-kernel, Geert Uytterhoeven

Commit 740c7f31c094703c ("sh_eth: Ensure DMA engines are stopped before
freeing buffers") added a call to sh_eth_reset() to the
sh_eth_set_ringparam() and sh_eth_close() paths.

However, setting the software reset bit(s) in the EDMR register resets
the MAC Address Registers to zero. Hence after kexec, the new kernel
doesn't detect a valid MAC address and assigns a random MAC address,
breaking DHCP.

Set the MAC address again after the reset in sh_eth_dev_exit() to fix
this.

Tested on r8a7740/armadillo (GETHER) and r8a7791/koelsch (FAST_RCAR).

Fixes: 740c7f31c094703c ("sh_eth: Ensure DMA engines are stopped before freeing buffers")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/net/ethernet/renesas/sh_eth.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 4da8bd263997a17b..654b48d1e61a3124 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1392,6 +1392,9 @@ static void sh_eth_dev_exit(struct net_device *ndev)
 	msleep(2); /* max frame time at 10 Mbps < 1250 us */
 	sh_eth_get_stats(ndev);
 	sh_eth_reset(ndev);
+
+	/* Set MAC address again */
+	update_mac_address(ndev);
 }
 
 /* free Tx skb function */
-- 
1.9.1


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

* Re: [PATCH] sh_eth: Fix lost MAC address on kexec
  2015-02-27 16:16 ` Geert Uytterhoeven
  (?)
@ 2015-02-28  2:48 ` Ben Hutchings
  -1 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2015-02-28  2:48 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: David S. Miller, Nobuhiro Iwamatsu, Simon Horman, Magnus Damm,
	Kevin Hilman, netdev, linux-sh, linux-kernel

On Fri, 2015-02-27 at 17:16 +0100, Geert Uytterhoeven wrote:
> Commit 740c7f31c094703c ("sh_eth: Ensure DMA engines are stopped before
> freeing buffers") added a call to sh_eth_reset() to the
> sh_eth_set_ringparam() and sh_eth_close() paths.
> 
> However, setting the software reset bit(s) in the EDMR register resets
> the MAC Address Registers to zero. Hence after kexec, the new kernel
> doesn't detect a valid MAC address and assigns a random MAC address,
> breaking DHCP.
[...]

Sorry about that.  This would also affect removing and reloading the
driver as a module, but currently I always have it built in and don't
use kexec.

Ben.



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

* Re: [PATCH] sh_eth: Fix lost MAC address on kexec
  2015-02-27 16:16 ` Geert Uytterhoeven
@ 2015-03-01  5:28   ` David Miller
  -1 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-03-01  5:28 UTC (permalink / raw)
  To: geert+renesas
  Cc: ben.hutchings, nobuhiro.iwamatsu.yj, horms, magnus.damm, khilman,
	netdev, linux-sh, linux-kernel

From: Geert Uytterhoeven <geert+renesas@glider.be>
Date: Fri, 27 Feb 2015 17:16:26 +0100

> Commit 740c7f31c094703c ("sh_eth: Ensure DMA engines are stopped before
> freeing buffers") added a call to sh_eth_reset() to the
> sh_eth_set_ringparam() and sh_eth_close() paths.
> 
> However, setting the software reset bit(s) in the EDMR register resets
> the MAC Address Registers to zero. Hence after kexec, the new kernel
> doesn't detect a valid MAC address and assigns a random MAC address,
> breaking DHCP.
> 
> Set the MAC address again after the reset in sh_eth_dev_exit() to fix
> this.
> 
> Tested on r8a7740/armadillo (GETHER) and r8a7791/koelsch (FAST_RCAR).
> 
> Fixes: 740c7f31c094703c ("sh_eth: Ensure DMA engines are stopped before freeing buffers")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Applied.

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

* Re: [PATCH] sh_eth: Fix lost MAC address on kexec
@ 2015-03-01  5:28   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-03-01  5:28 UTC (permalink / raw)
  To: geert+renesas
  Cc: ben.hutchings, nobuhiro.iwamatsu.yj, horms, magnus.damm, khilman,
	netdev, linux-sh, linux-kernel

From: Geert Uytterhoeven <geert+renesas@glider.be>
Date: Fri, 27 Feb 2015 17:16:26 +0100

> Commit 740c7f31c094703c ("sh_eth: Ensure DMA engines are stopped before
> freeing buffers") added a call to sh_eth_reset() to the
> sh_eth_set_ringparam() and sh_eth_close() paths.
> 
> However, setting the software reset bit(s) in the EDMR register resets
> the MAC Address Registers to zero. Hence after kexec, the new kernel
> doesn't detect a valid MAC address and assigns a random MAC address,
> breaking DHCP.
> 
> Set the MAC address again after the reset in sh_eth_dev_exit() to fix
> this.
> 
> Tested on r8a7740/armadillo (GETHER) and r8a7791/koelsch (FAST_RCAR).
> 
> Fixes: 740c7f31c094703c ("sh_eth: Ensure DMA engines are stopped before freeing buffers")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Applied.

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

end of thread, other threads:[~2015-03-01  5:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-27 16:16 [PATCH] sh_eth: Fix lost MAC address on kexec Geert Uytterhoeven
2015-02-27 16:16 ` Geert Uytterhoeven
2015-02-28  2:48 ` Ben Hutchings
2015-03-01  5:28 ` David Miller
2015-03-01  5:28   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.