Re: [patch 2/4] forcedeth: fix MAC address detection on network card(regression in 2.6.23)
From: Jeff Garzik
Date: Tue Feb 05 2008 - 14:09:10 EST
Andrew Morton wrote:
On Tue, 05 Feb 2008 13:20:59 -0500 Jeff Garzik <jeff@xxxxxxxxxx> wrote:
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
NAK - this fixes one set of users, and breaks a working set of users.
Need to add DMI check for the specific motherboard (dmi_check_system),
and flip flag according to success/failure of that check.
OK :) I added the above to the changelog for next time.
You guys can hide, but this patch isn't going away!
In the original thread, I even posted a
fill-in-the-blanks-with-the-motherboard-name patch. I'll attach it again...
Jeff
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 3634223..eab85fa 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -147,6 +147,7 @@
#include <linux/init.h>
#include <linux/if_vlan.h>
#include <linux/dma-mapping.h>
+#include <linux/dmi.h>
#include <asm/irq.h>
#include <asm/io.h>
@@ -4992,6 +4993,26 @@ static int nv_close(struct net_device *dev)
return 0;
}
+static int nv_reversed_macaddr(void)
+{
+ static const struct dmi_system_id sysids[] = {
+ {
+ .ident = "",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, ""),
+ DMI_MATCH(DMI_PRODUCT_NAME, ""),
+ },
+ },
+
+ { } /* terminate list */
+ };
+
+ if (dmi_check_system(sysids))
+ return 1;
+
+ return 0;
+}
+
static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
{
struct net_device *dev;
@@ -5187,8 +5208,9 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
/* check the workaround bit for correct mac address order */
txreg = readl(base + NvRegTransmitPoll);
- if ((txreg & NVREG_TRANSMITPOLL_MAC_ADDR_REV) ||
- (id->driver_data & DEV_HAS_CORRECT_MACADDR)) {
+ if (((txreg & NVREG_TRANSMITPOLL_MAC_ADDR_REV) ||
+ (id->driver_data & DEV_HAS_CORRECT_MACADDR))) &&
+ (!nv_reversed_macaddr())) {
/* mac address is already in correct order */
dev->dev_addr[0] = (np->orig_mac[0] >> 0) & 0xff;
dev->dev_addr[1] = (np->orig_mac[0] >> 8) & 0xff;