Skip to contentSkip to conversation

atl1: save mac address on remove

PATCH Applied Chris Snook 2 participants 3 messages Mar 29, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atl1: save mac address on remove

From: Chris Snook <[email protected]>

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.

drivers/net/atl1/atl1_main.c +10 -0
@@ -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);
Applied
#1 lore raw
Quoted 10 lines · Chris Snook

From: Chris Snook <[email protected]>

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.

applied, even though its a hack

#2 lore raw
Quoted 10 lines · Jeff Garzik
Quoted 9 lines · Chris Snook

From: Chris Snook <[email protected]>

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.

Quoted 3 lines
Quoted 1 line

applied, even though its a hack

Oh, it's definitely a hack, but the hardware it's supporting is a hack, so we have to work with it.

Thanks.

-- Chris