AF:
NF:0
PS:10
SRH:1
SFN:
DSR:
MID:
CFG:
PT:0
S:andy.sharp@lsi.com
RQ:
SSV:mhbs.lsil.com
NSV:
SSH:
R:<bfisher@lsi.com>
MAID:2
X-Sylpheed-Privacy-System:
X-Sylpheed-Sign:0
SCF:#mh/Mailbox/sent
FMID:#mh/Mailbox/sent	0	20090331132524.43d8f895@ripper.onstor.net
X-Sylpheed-End-Special-Headers: 1
Date: Tue, 18 Aug 2009 15:05:35 -0700
From: Andrew Sharp <andy.sharp@lsi.com>
To: Bill Fisher <bfisher@lsi.com>
Subject: Fw: mac addr fix for tuxrx
Message-ID: <20090818150535.685fb288@ripper.onstor.net>
Organization: LSI
X-Mailer: Sylpheed-Claws 2.6.0 (GTK+ 2.8.20; x86_64-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="MP_fD+p8yk5_9N/Y42nZecW._+"

--MP_fD+p8yk5_9N/Y42nZecW._+
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Resend of patch I sent out in march, apparently.

Begin forwarded message:

Date: Tue, 31 Mar 2009 13:25:24 -0700
From: Andrew Sharp <andy.sharp@onstor.com>
To: Rendell Fong <rendell.fong@onstor.com>, Bill Fisher
<bfisher@onstor.com> Subject: mac addr fix for tuxrx


Howdy folksez,

Apply the attached patch at the top level of your kernel tree to fix
the mac address problem on tuxrx.  This should put an end to the
"NFS server not reponding" messages/problem.

To apply patch, save attachment to a file.

at the top level of the kernel tree, run this command

patch -p 1 < patch-file

It should say "patching file sb1250-mac.c" and that's all.

Let me know if you have any problems.

Cheers,

a
--MP_fD+p8yk5_9N/Y42nZecW._+
Content-Type: text/plain; name=sb1250-mac-addr-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=sb1250-mac-addr-patch

diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index 15e8605..2ce4c19 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -35,6 +35,9 @@
 #include <asm/processor.h>		/* Processor type for cache alignment. */
 #include <asm/io.h>
 #include <asm/cache.h>
+#ifdef CONFIG_ONSTOR_TUXRX
+#include <asm/mach-tuxrx/tuxrx.h>
+#endif
 
 /* This is only here until the firmware is ready.  In that case,
    the firmware leaves the ethernet address in the register for us. */
@@ -1746,10 +1749,10 @@ static void sbmac_channel_start(struct sbmac_softc *s)
  *  Stop packet processing on this MAC.
  *
  *  Input parameters:
- *  	   s - sbmac structure
+ *	   s - sbmac structure
  *
  *  Return value:
- *  	   nothing
+ *	   nothing
  ********************************************************************* */
 
 static void sbmac_channel_stop(struct sbmac_softc *s)
@@ -1796,10 +1799,10 @@ static void sbmac_channel_stop(struct sbmac_softc *s)
  *  Set the channel's state ON or OFF
  *
  *  Input parameters:
- *  	   state - new state
+ *	   state - new state
  *
  *  Return value:
- *  	   old state
+ *	   old state
  ********************************************************************* */
 static sbmac_state_t sbmac_set_channel_state(struct sbmac_softc *sc,
 					     sbmac_state_t state)
@@ -1839,11 +1842,11 @@ static sbmac_state_t sbmac_set_channel_state(struct sbmac_softc *sc,
  *  Turn on or off promiscuous mode
  *
  *  Input parameters:
- *  	   sc - softc
+ *	   sc - softc
  *      onoff - 1 to turn on, 0 to turn off
  *
  *  Return value:
- *  	   nothing
+ *	   nothing
  ********************************************************************* */
 
 static void sbmac_promiscuous_mode(struct sbmac_softc *sc,int onoff)
@@ -1871,10 +1874,10 @@ static void sbmac_promiscuous_mode(struct sbmac_softc *sc,int onoff)
  *  Set the iphdr offset as 15 assuming ethernet encapsulation
  *
  *  Input parameters:
- *  	   sc - softc
+ *	   sc - softc
  *
  *  Return value:
- *  	   nothing
+ *	   nothing
  ********************************************************************* */
 
 static void sbmac_set_iphdr_offset(struct sbmac_softc *sc)
@@ -1903,10 +1906,10 @@ static void sbmac_set_iphdr_offset(struct sbmac_softc *sc)
  *  we typically write into the SBMAC's address/mcast registers
  *
  *  Input parameters:
- *  	   ptr - pointer to 6 bytes
+ *	   ptr - pointer to 6 bytes
  *
  *  Return value:
- *  	   register value
+ *	   register value
  ********************************************************************* */
 
 static uint64_t sbmac_addr2reg(unsigned char *ptr)
@@ -1938,11 +1941,11 @@ static uint64_t sbmac_addr2reg(unsigned char *ptr)
  *  Warning: must be called when MAC is off!
  *
  *  Input parameters:
- *  	   s - sbmac structure
- *  	   speed - speed to set MAC to (see sbmac_speed_t enum)
+ *	   s - sbmac structure
+ *	   speed - speed to set MAC to (see sbmac_speed_t enum)
  *
  *  Return value:
- *  	   1 if successful
+ *	   1 if successful
  *      0 indicates invalid parameters
  ********************************************************************* */
 
@@ -2308,17 +2311,17 @@ static void sbmac_setmulti(struct sbmac_softc *sc)
 	}
 }
 
-#if defined(SBMAC_ETH0_HWADDR) || defined(SBMAC_ETH1_HWADDR) || defined(SBMAC_ETH2_HWADDR) || defined(SBMAC_ETH3_HWADDR)
+#if defined(SBMAC_ETH0_HWADDR) || defined(SBMAC_ETH1_HWADDR) || defined(SBMAC_ETH2_HWADDR) || defined(SBMAC_ETH3_HWADDR) || defined(CONFIG_ONSTOR_TUXRX)
 /**********************************************************************
  *  SBMAC_PARSE_XDIGIT(str)
  *
  *  Parse a hex digit, returning its value
  *
  *  Input parameters:
- *  	   str - character
+ *	   str - character
  *
  *  Return value:
- *  	   hex value, or -1 if invalid
+ *	   hex value, or -1 if invalid
  ********************************************************************* */
 
 static int sbmac_parse_xdigit(char str)
@@ -2344,11 +2347,11 @@ static int sbmac_parse_xdigit(char str)
  *  Ethernet address.
  *
  *  Input parameters:
- *  	   str - string
- *  	   hwaddr - pointer to hardware address
+ *	   str - string
+ *	   hwaddr - pointer to hardware address
  *
  *  Return value:
- *  	   0 if ok, else -1
+ *	   0 if ok, else -1
  ********************************************************************* */
 
 static int sbmac_parse_hwaddr(char *str, unsigned char *hwaddr)
@@ -2514,9 +2517,9 @@ static int sbmac_open(struct net_device *dev)
 {
 	struct sbmac_softc *sc = netdev_priv(dev);
 
-	//if (debug > 1) {
+	if (debug > 1) {
 		printk(KERN_INFO "%s: sbmac_open() irq %d.\n", dev->name, dev->irq);
-	//}
+	}
 
 	/*
 	 * map/route interrupt (clear status first, in case something
@@ -2917,7 +2920,7 @@ static int sbmac_poll(struct net_device *dev, int *budget)
 	return (work_done >= work_to_do);
 }
 
-#if defined(SBMAC_ETH0_HWADDR) || defined(SBMAC_ETH1_HWADDR) || defined(SBMAC_ETH2_HWADDR) || defined(SBMAC_ETH3_HWADDR)
+#if defined(SBMAC_ETH0_HWADDR) || defined(SBMAC_ETH1_HWADDR) || defined(SBMAC_ETH2_HWADDR) || defined(SBMAC_ETH3_HWADDR) || defined(CONFIG_ONSTOR_TUXRX)
 static void
 sbmac_setup_hwaddr(int chan,char *addr)
 {
@@ -2931,6 +2934,12 @@ sbmac_setup_hwaddr(int chan,char *addr)
 	__raw_writeq(val, IOADDR(port+R_MAC_ETHERNET_ADDR));
 	val = __raw_readq(IOADDR(port+R_MAC_ETHERNET_ADDR));
 }
+
+#ifndef CONFIG_MGMT_BUS
+char *magicmanagementbusringconfig;
+#else
+extern char *magicmanagementbusringconfig;
+#endif
 #endif
 
 static struct net_device *dev_sbmac[MAX_UNITS];
@@ -2988,17 +2997,38 @@ sbmac_init_module(void)
 	  sbmac_setup_hwaddr(3,SBMAC_ETH3_HWADDR);
 #endif
 
+#ifdef CONFIG_ONSTOR_TUXRX
+	/*
+	 * on the tuxrx, the upper 3 bytes are onstor device identifier,
+	 * lower 3 bytes are copied from SSC mac addresses, with 0x10 or'd
+	 * into the last byte to indicate that it's a tuxrx port
+	 */
+#ifndef CONFIG_MGMT_BUS
+	magicmanagementbusringconfig = (char *)ioremap(0x1000000000ULL
+			| PCI_SHARED_MEM_OFF, 0x100);
+#endif
+	for (idx = 0; idx < chip_max_units; idx++) {
+		char ons_mac_str[] = "00:07:34:00:00:00";
+
+		sprintf(&ons_mac_str[9], "%02X:%02X:%02X",
+				*(magicmanagementbusringconfig + 198),
+				*(magicmanagementbusringconfig + 197),
+				*(magicmanagementbusringconfig + 196) | (0x10 | idx));
+		sbmac_setup_hwaddr(idx, ons_mac_str);
+	}
+#endif
+
 	/*
 	 * Walk through the Ethernet controllers and find
 	 * those who have their MAC addresses set.
 	 */
 	for (idx = 0; idx < chip_max_units; idx++) {
 
-	        /*
-	         * This is the base address of the MAC.
+		/*
+		 * This is the base address of the MAC.
 		 */
 
-	        port = A_MAC_CHANNEL_BASE(idx);
+		port = A_MAC_CHANNEL_BASE(idx);
 
 		/*
 		 * The R_MAC_ETHERNET_ADDR register will be set to some nonzero

--MP_fD+p8yk5_9N/Y42nZecW._+--
