* [PATCH 2/2] forcedeth: mac address corrected
@ 2006-07-31 16:05 Ayaz Abdulla
2006-08-01 12:27 ` Andy Gospodarek
0 siblings, 1 reply; 3+ messages in thread
From: Ayaz Abdulla @ 2006-07-31 16:05 UTC (permalink / raw)
To: Jeff Garzik, Manfred Spraul, Andrew Morton, netdev,
Stephen Hemminger
[-- Attachment #1: Type: text/plain, Size: 239 bytes --]
This patch will correct the mac address and set a flag to indicate that
it is already corrected in case nv_probe is called again. For example,
when you use kexec to restart the kernel.
Signed-Off-By: Ayaz Abdulla <aabdulla@nvidia.com>
[-- Attachment #2: patch-forcedeth-057-macaddress-corrected --]
[-- Type: text/plain, Size: 3754 bytes --]
--- orig-2.6/drivers/net/forcedeth.c 2006-07-06 15:06:27.000000000 -0400
+++ new-2.6/drivers/net/forcedeth.c 2006-07-06 15:06:58.000000000 -0400
@@ -109,6 +109,7 @@
* 0.54: 21 Mar 2006: Fix spin locks for multi irqs and cleanup.
* 0.55: 22 Mar 2006: Add flow control (pause frame).
* 0.56: 22 Mar 2006: Additional ethtool config and moduleparam support.
+ * 0.57: 14 May 2006: Mac address set in probe/remove and order corrections.
*
* Known bugs:
* We suspect that on some hardware no TX done interrupts are generated.
@@ -120,7 +121,7 @@
* DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few
* superfluous timer interrupts from the nic.
*/
-#define FORCEDETH_VERSION "0.56"
+#define FORCEDETH_VERSION "0.57"
#define DRV_NAME "forcedeth"
#include <linux/module.h>
@@ -262,7 +263,8 @@
NvRegRingSizes = 0x108,
#define NVREG_RINGSZ_TXSHIFT 0
#define NVREG_RINGSZ_RXSHIFT 16
- NvRegUnknownTransmitterReg = 0x10c,
+ NvRegTransmitPoll = 0x10c,
+#define NVREG_TRANSMITPOLL_MAC_ADDR_REV 0x00008000
NvRegLinkSpeed = 0x110,
#define NVREG_LINKSPEED_FORCE 0x10000
#define NVREG_LINKSPEED_10 1000
@@ -1178,7 +1180,7 @@
KERN_INFO "nv_stop_tx: TransmitterStatus remained busy");
udelay(NV_TXSTOP_DELAY2);
- writel(0, base + NvRegUnknownTransmitterReg);
+ writel(readl(base + NvRegTransmitPoll) & NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll);
}
static void nv_txrx_reset(struct net_device *dev)
@@ -3917,7 +3919,7 @@
oom = nv_init_ring(dev);
writel(0, base + NvRegLinkSpeed);
- writel(0, base + NvRegUnknownTransmitterReg);
+ writel(readl(base + NvRegTransmitPoll) & NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll);
nv_txrx_reset(dev);
writel(0, base + NvRegUnknownSetupReg6);
@@ -4082,7 +4084,7 @@
unsigned long addr;
u8 __iomem *base;
int err, i;
- u32 powerstate;
+ u32 powerstate, txreg;
dev = alloc_etherdev(sizeof(struct fe_priv));
err = -ENOMEM;
@@ -4269,12 +4271,30 @@
np->orig_mac[0] = readl(base + NvRegMacAddrA);
np->orig_mac[1] = readl(base + NvRegMacAddrB);
- dev->dev_addr[0] = (np->orig_mac[1] >> 8) & 0xff;
- dev->dev_addr[1] = (np->orig_mac[1] >> 0) & 0xff;
- dev->dev_addr[2] = (np->orig_mac[0] >> 24) & 0xff;
- dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff;
- dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff;
- dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff;
+ /* check the workaround bit for correct mac address order */
+ txreg = readl(base + NvRegTransmitPoll);
+ if (txreg & NVREG_TRANSMITPOLL_MAC_ADDR_REV) {
+ /* 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;
+ dev->dev_addr[2] = (np->orig_mac[0] >> 16) & 0xff;
+ dev->dev_addr[3] = (np->orig_mac[0] >> 24) & 0xff;
+ dev->dev_addr[4] = (np->orig_mac[1] >> 0) & 0xff;
+ dev->dev_addr[5] = (np->orig_mac[1] >> 8) & 0xff;
+ } else {
+ /* need to reverse mac address to correct order */
+ dev->dev_addr[0] = (np->orig_mac[1] >> 8) & 0xff;
+ dev->dev_addr[1] = (np->orig_mac[1] >> 0) & 0xff;
+ dev->dev_addr[2] = (np->orig_mac[0] >> 24) & 0xff;
+ dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff;
+ dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff;
+ dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff;
+ /* set permanent address to be correct aswell */
+ np->orig_mac[0] = (dev->dev_addr[0] << 0) + (dev->dev_addr[1] << 8) +
+ (dev->dev_addr[2] << 16) + (dev->dev_addr[3] << 24);
+ np->orig_mac[1] = (dev->dev_addr[4] << 0) + (dev->dev_addr[5] << 8);
+ writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll);
+ }
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
if (!is_valid_ether_addr(dev->perm_addr)) {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] forcedeth: mac address corrected
2006-07-31 16:05 [PATCH 2/2] forcedeth: mac address corrected Ayaz Abdulla
@ 2006-08-01 12:27 ` Andy Gospodarek
2006-08-01 13:17 ` Andy Gospodarek
0 siblings, 1 reply; 3+ messages in thread
From: Andy Gospodarek @ 2006-08-01 12:27 UTC (permalink / raw)
To: Ayaz Abdulla
Cc: Jeff Garzik, Manfred Spraul, Andrew Morton, netdev,
Stephen Hemminger
On Mon, Jul 31, 2006 at 12:05:01PM -0400, Ayaz Abdulla wrote:
> This patch will correct the mac address and set a flag to indicate that
> it is already corrected in case nv_probe is called again. For example,
> when you use kexec to restart the kernel.
>
> Signed-Off-By: Ayaz Abdulla <aabdulla@nvidia.com>
>
Have you found other situations where this patch is critical other than
when kevec is used to restart the kernel?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] forcedeth: mac address corrected
2006-08-01 12:27 ` Andy Gospodarek
@ 2006-08-01 13:17 ` Andy Gospodarek
0 siblings, 0 replies; 3+ messages in thread
From: Andy Gospodarek @ 2006-08-01 13:17 UTC (permalink / raw)
To: Andy Gospodarek
Cc: Ayaz Abdulla, Jeff Garzik, Manfred Spraul, Andrew Morton, netdev,
Stephen Hemminger
On Tue, Aug 01, 2006 at 08:27:27AM -0400, Andy Gospodarek wrote:
> On Mon, Jul 31, 2006 at 12:05:01PM -0400, Ayaz Abdulla wrote:
> > This patch will correct the mac address and set a flag to indicate that
> > it is already corrected in case nv_probe is called again. For example,
> > when you use kexec to restart the kernel.
> >
> > Signed-Off-By: Ayaz Abdulla <aabdulla@nvidia.com>
> >
>
> Have you found other situations where this patch is critical other than
> when kevec is used to restart the kernel?
>
s/kevec/kexec/g
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-08-01 13:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31 16:05 [PATCH 2/2] forcedeth: mac address corrected Ayaz Abdulla
2006-08-01 12:27 ` Andy Gospodarek
2006-08-01 13:17 ` Andy Gospodarek
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).