Thread (11 messages) 11 messages, 5 authors, 2008-09-25

Re: [PATCH] r8169: read MAC address from EEPROM on init

From: Ilpo Järvinen <hidden>
Date: 2008-09-18 19:53:22

On Thu, 18 Sep 2008, Ivan Vecera wrote:
quoted hunk ↗ jump to hunk
This fixes the problem when MAC address is set by ifconfig or by
ip link commands and this address is stored in the device after
reboot. The power-off is needed to get right MAC address.
This is problem when Xen daemon is running because it renames the device
name from ethX to pethX and sets its MAC address to FE:FF:FF:FF:FF:FF.
After reboot the device is still using FE:FF:FF:FF:FF:FF.

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
 drivers/net/r8169.c |   80 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 79 insertions(+), 1 deletions(-)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index befc927..b09a4ec 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
...
+	 * is always consecutive 4-byte data starting from the VPD address
+	 * specified."
+	 */
+	if (rtl_eeprom_read(tp->pci_dev, vpd_cap, 0x000e, &low) < 0 ||
+	    rtl_eeprom_read(tp->pci_dev, vpd_cap, 0x0012, &high) < 0) {
+		dprintk("Reading MAC address from EEPROM failed\n");
+		return;
+	}
+
+	/* Mask hi-word */
+	high &= 0xffff;
...Hmm, and besides fixing sparse printouts, this looks like a real 
endianness bug.


-- 
 i.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help