From owner-freebsd-sparc64@FreeBSD.ORG Sat Jun 7 03:49:57 2008 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEAC4106564A for ; Sat, 7 Jun 2008 03:49:57 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.233]) by mx1.freebsd.org (Postfix) with ESMTP id 7DB9F8FC0C for ; Sat, 7 Jun 2008 03:49:57 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so1754060rvf.43 for ; Fri, 06 Jun 2008 20:49:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:received:date:from :to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=ziFr3zrwpxhex4s/t+1jU8ra7b5B3SD1wGabaos8koY=; b=HnqsdayvF87r5F87c/71/NlEKswaUAi7yIWiiQf8U6Eq4t4fHS76N72CCuG0iFY8Kq WG8lLminXuyCSbvdaiA3Zqlf+mVwKF8hLGI18+jBqi99CY/i3NoteE77N66gTcNDsqWk vFrTuQpgWhyyH4ShPq8wIxUHFpsNIYdVAu7Ms= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=jsONxHC3nXbVH1f6Av8EfWV1CmeXKfxZm2hPVEnasvaHNZ5LFDDLoWjsaRurT0dcNo YBRs+4G++TtSTC+LhkjI8N0RgQHHVSHDxcVYKK3NIC7O253o1GApTr4yjp1PD/MLA0Or VMNKgqsUKQu3WelMMBX0tBypV6g4VBve5B4ik= Received: by 10.141.123.4 with SMTP id a4mr530974rvn.172.1212808959095; Fri, 06 Jun 2008 20:22:39 -0700 (PDT) Received: from michelle.cdnetworks.co.kr ( [211.53.35.84]) by mx.google.com with ESMTPS id k2sm8752397rvb.4.2008.06.06.20.22.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 06 Jun 2008 20:22:37 -0700 (PDT) Received: from michelle.cdnetworks.co.kr (localhost.cdnetworks.co.kr [127.0.0.1]) by michelle.cdnetworks.co.kr (8.13.5/8.13.5) with ESMTP id m573MX9E005088 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 7 Jun 2008 12:22:33 +0900 (KST) (envelope-from pyunyh@gmail.com) Received: (from yongari@localhost) by michelle.cdnetworks.co.kr (8.13.5/8.13.5/Submit) id m573MWFn005087; Sat, 7 Jun 2008 12:22:32 +0900 (KST) (envelope-from pyunyh@gmail.com) Date: Sat, 7 Jun 2008 12:22:32 +0900 From: Pyun YongHyeon To: "Mr. Robert Murillo" Message-ID: <20080607032232.GC4565@cdnetworks.co.kr> References: <796800.35289.qm@web82404.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ikeVEW9yuYc//A+q" Content-Disposition: inline In-Reply-To: <796800.35289.qm@web82404.mail.mud.yahoo.com> User-Agent: Mutt/1.4.2.1i Cc: freebsd-sparc64@freebsd.org Subject: Re: dc0 not working at all on a few FreeBSD/SPARC64 machines X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jun 2008 03:49:57 -0000 --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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: port 0x1000-0x10ff mem 0x3000000-0x30003ff at device 2.0 on pci1 > miibus1: on dc0 > ukphy0: 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 --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="dc.patch" --- 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, --ikeVEW9yuYc//A+q--