netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] atl1: save mac address on remove
@ 2007-03-29  0:51 Chris Snook
  2007-03-29 12:26 ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Snook @ 2007-03-29  0:51 UTC (permalink / raw)
  To: jeff; +Cc: jacliburn, netdev

From: Chris Snook <csnook@redhat.com>

Some atl1 boards get their MAC address written directly to the register
by the BIOS during POST, rather than storing it in EEPROM that's
accessible to the driver.  If the MAC register on one of these boards
is changed and then the module is unloaded, the permanent MAC address
will be forgotten until the box is rebooted.  We should save the
permanent address during removal if we've been messing with it.

Signed-off-by: Chris Snook <csnook@redhat.com>

--- a/drivers/net/atl1/atl1_main.c	2007-03-01 14:14:48.000000000 -0500
+++ b/drivers/net/atl1/atl1_main.c	2007-03-01 16:59:59.000000000 -0500
@@ -2321,6 +2321,16 @@ static void __devexit atl1_remove(struct
 		return;
 
 	adapter = netdev_priv(netdev);
+
+	/* Some atl1 boards lack persistent storage for their MAC, and get it
+	 * from the BIOS during POST.  If we've been messing with the MAC
+	 * address, we need to save the permanent one.
+	 */
+	if (memcmp(adapter->hw.mac_addr, adapter->hw.perm_mac_addr, ETH_ALEN)) {
+		memcpy(adapter->hw.mac_addr, adapter->hw.perm_mac_addr, ETH_ALEN);
+		atl1_set_mac_addr(&adapter->hw);
+	}
+
 	iowrite16(0, adapter->hw.hw_addr + REG_GPHY_ENABLE);
 	unregister_netdev(netdev);
 	pci_iounmap(pdev, adapter->hw.hw_addr);

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

end of thread, other threads:[~2007-03-29 13:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-29  0:51 [PATCH] atl1: save mac address on remove Chris Snook
2007-03-29 12:26 ` Jeff Garzik
2007-03-29 13:45   ` Chris Snook

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).