dc0 not working at all on a few FreeBSD/SPARC64 machines

Pyun YongHyeon pyunyh at gmail.com
Sat Jun 7 03:49:57 UTC 2008


On Thu, Jun 05, 2008 at 10:42:39AM -0700, Mr. Robert Murillo wrote:
 > Hi - I have a Linksys ethernet PCI card I'm trying to use with my SPARC64 machines (an Ultra 10 and a SunBlade 150) running FreeBSD 7.0-Release.  Here is the easiest test I can perform with it -
 > 
 > 1) Plug network cable into built-in ethernet port (hme0 or gem0), run "dhclient hme0" (or gem0), and confirm that it gets an address through DHCP
 > 2) run "ifconfig hme0 down", unplug cable from hme0, plug very same cable into dc0, and run "dhclient dc0".  At this point, on both machines, I end up with "No DHCPOFFERS received."
 > 
 > Of note - when I take DHCP out of the equation and do manual configuration on both machines, I also get no indication that any data whatsoever is being received on dc0 (or for that matter, leaving dc0).  I'm using DHCP as an example since it's more concise to show.
 > 
 > When I remove the dc0 card and put it into my FreeBSD-i386 machine, it works as expected with both DHCP and manual configuration.
 > 
 > No errors appear on the console, in dmesg, or in /var/log/messages.
 > 
 > Has anybody had any similar problems?  I've searched both the -SPARC64 and -net archives and nothing looks quite like what I'm seeing.  I've also googled endlessly.  I see some discussion that appears to be related to the dc interface built in on some Sun machines (?), but little about a PCI card.  I saw one discussion of a potential code problem in FreeBSD 5 that might cause problems for non-built-in dc interfaces on SPARC64, but looked at the FreeBSD 7 source and that problem has been fixed.
 > 
 >   Here is the dmesg snippet for the card -
 >    
 >   dc0: <ADMtek AN985 10/100BaseTX> port 0x1000-0x10ff mem 0x3000000-0x30003ff at device 2.0 on pci1
 > miibus1: <MII bus> on dc0
 > ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus1
 > ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 > dc0: Ethernet address: 05:25:06:00:ff:ff
                          ^^^^^^^^^^^^^^^^^

There is no such OUI entry in IEEE OUI database.
Did you ever compare the ethernet hardware address between sparc64
and i386? Can you see incoming traffics in promiscuous mode?
If so, I guess it's a dc(4) bug not performing endianess conversion
in ethernet hardware address handling.
Would you try attached patch? I don't have this hardware so the
patch was just compile tested.

 > dc0: [ITHREAD]
 > 
 > I am fine to keep digging at it, but don't want to pour a bunch of time into it if somebody else might know exactly what's wrong.
 > 
 > Thanks,
 > Bob

-- 
Regards,
Pyun YongHyeon
-------------- next part --------------
--- sys/dev/dc/if_dc.c.orig	2008-03-27 13:43:48.000000000 +0900
+++ sys/dev/dc/if_dc.c	2008-06-07 12:08:04.000000000 +0900
@@ -1141,7 +1141,7 @@
 static void
 dc_setfilt_admtek(struct dc_softc *sc)
 {
-	uint32_t eaddr[(ETHER_ADDR_LEN+3)/4];
+	uint8_t eaddr[ETHER_ADDR_LEN];
 	struct ifnet *ifp;
 	struct ifmultiaddr *ifma;
 	int h = 0;
@@ -1151,8 +1151,9 @@
 
 	/* Init our MAC address. */
 	bcopy(IF_LLADDR(sc->dc_ifp), eaddr, ETHER_ADDR_LEN);
-	CSR_WRITE_4(sc, DC_AL_PAR0, eaddr[0]);
-	CSR_WRITE_4(sc, DC_AL_PAR1, eaddr[1]);
+	CSR_WRITE_4(sc, DC_AL_PAR0, eaddr[3] << 24 | eaddr[2] << 16 |
+	    eaddr[1] << 8 | eaddr[0]);
+	CSR_WRITE_4(sc, DC_AL_PAR1, eaddr[5] << 8 | eaddr[4]);
 
 	/* If we want promiscuous mode, set the allframes bit. */
 	if (ifp->if_flags & IFF_PROMISC)
@@ -1812,7 +1813,7 @@
 	u_int32_t command;
 	struct dc_softc *sc;
 	struct ifnet *ifp;
-	u_int32_t revision;
+	u_int32_t reg, revision;
 	int error = 0, rid, mac_offset;
 	int i;
 	u_int8_t *mac;
@@ -2052,8 +2053,15 @@
 		break;
 	case DC_TYPE_AL981:
 	case DC_TYPE_AN985:
-		eaddr[0] = CSR_READ_4(sc, DC_AL_PAR0);
-		eaddr[1] = CSR_READ_4(sc, DC_AL_PAR1);
+		reg = CSR_READ_4(sc, DC_AL_PAR0);
+		mac = (uint8_t *)&eaddr[0];
+		mac[0] = (reg >> 0) & 0xff;
+		mac[1] = (reg >> 8) & 0xff;
+		mac[2] = (reg >> 16) & 0xff;
+		mac[3] = (reg >> 24) & 0xff;
+		reg = CSR_READ_4(sc, DC_AL_PAR1);
+		mac[4] = (reg >> 0) & 0xff;
+		mac[5] = (reg >> 8) & 0xff;
 		break;
 	case DC_TYPE_CONEXANT:
 		bcopy(sc->dc_srom + DC_CONEXANT_EE_NODEADDR, &eaddr,


More information about the freebsd-sparc64 mailing list