NetBSD Problem Report #32032

From www@netbsd.org  Wed Nov  9 22:25:33 2005
Return-Path: <www@netbsd.org>
Received: by narn.netbsd.org (Postfix, from userid 31301)
	id 8B77563BA17; Wed,  9 Nov 2005 22:25:33 +0000 (UTC)
Message-Id: <20051109222533.8B77563BA17@narn.netbsd.org>
Date: Wed,  9 Nov 2005 22:25:33 +0000 (UTC)
From: garrett_damore@tadpole.com
Reply-To: garrett_damore@tadpole.com
To: gnats-bugs@netbsd.org
Subject: axe/ukphy combo does not work on big-endian machines
X-Send-Pr-Version: www-1.0

>Number:         32032
>Category:       kern
>Synopsis:       axe/ukphy combo does not work on big-endian machines
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    tron
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 09 22:26:00 +0000 2005
>Closed-Date:    Thu Nov 10 18:51:55 +0000 2005
>Last-Modified:  Thu Nov 10 23:57:00 +0000 2005
>Originator:     Garrett D'Amore
>Release:        3.99.11
>Organization:
Tadpole Computer, Inc.
>Environment:
NetBSD zinfandel 3.99.11 NetBSD 3.99.11 (PB1000) #3: Wed Nov  9 13:11:19 PST 2005  garrett@zippy:/home/garrett/work/meteor/ohci-endian/src/sys/arch/evbmips/compile/obj/PB1000 evbmips

And also on a sparc64 machines running an earlier 3.0BETA build.
>Description:
I'm trying to prove that my changes to support big-endian OHCI work.  I'm finding that AXE and UKPHY combined do not seem to work properly on any big-endian machine -- the phy doesn't seem to pick up link (or at least it isn't reporting it to the axe driver).

On evbmips-el the device works fine.

On x86 it works fine.

On SPARC64 with an EHCI/OHCI PCI add-in card, it has the same problem.

On evbmips-eb with my fixes to support OHCI running big-endian (another PR filed for that), it has the same failure mode.  (Interestingly enough, most of the other bits about the device seem to work.  E.g. I get the same valid ethernet address on all platforms, regardless of endianness.)

The specific device in question is a linksys USB200M (no version number known.)  usbdevs -v reports it as device id 0x2226, rev 0.01.


>How-To-Repeat:
boot a big-endian kernel (sparc64 is good for this) with USB (I used a PCI USB 2.0 add-in card on an Ultra 10).

ifconfig axe0

Note that it shows no carrier.  This shows up even though the link light on the hub is fine.  Moving the adapter without unplugging the cable from it into an x86 netbsd box, and it works fine there.

>Fix:

>Release-Note:

>Audit-Trail:
From: "Garrett D'Amore" <garrett_damore@tadpole.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/32032: axe/ukphy combo does not work on big-endian machines
Date: Wed, 09 Nov 2005 15:02:21 -0800

 gnats-admin@netbsd.org wrote:

 >Thank you very much for your problem report.
 >It has the internal identification `kern/32032'.
 >The individual assigned to look at your
 >report is: kern-bug-people. 
 >
 >  
 >
 >>Category:       kern
 >>Responsible:    kern-bug-people
 >>Synopsis:       axe/ukphy combo does not work on big-endian machines
 >>Arrival-Date:   Wed Nov 09 22:26:00 +0000 2005
 >>    
 >>
 Changing the code to do appropriate le16toh() in the mii logic fixed the 
 phy link detection problem.  However the device still doesn't work, and 
 I think it is probably due to the rxmode not also be handled in an 
 endian proper manner.  I'm testing that now.  Once I have it working, 
 I'll send diffs.

From: "Garrett D'Amore" <garrett_damore@tadpole.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/32032: axe/ukphy combo does not work on big-endian machines
Date: Wed, 09 Nov 2005 15:10:50 -0800

 This is a multi-part message in MIME format.
 --------------010003080803010108000200
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit

 The attached patch fixes it:


 --------------010003080803010108000200
 Content-Type: text/plain;
  name="diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="diff"

 Index: sys/dev/usb/if_axe.c
 ===================================================================
 RCS file: /net/projects/meteor/cvs/netbsd/src/sys/dev/usb/if_axe.c,v
 retrieving revision 1.1.1.1
 diff -u -r1.1.1.1 if_axe.c
 --- sys/dev/usb/if_axe.c	9 Nov 2005 14:17:30 -0000	1.1.1.1
 +++ sys/dev/usb/if_axe.c	9 Nov 2005 23:10:26 -0000
 @@ -286,7 +286,7 @@
  	if (val)
  		sc->axe_phyaddrs[0] = phy;

 -	return (val);
 +	return (le16toh(val));
  }

  Static void
 @@ -298,6 +298,7 @@
  	if (sc->axe_dying)
  		return;

 +	val = htole32(val);
  	axe_lock_mii(sc);
  	axe_cmd(sc, AXE_CMD_MII_OPMODE_SW, 0, 0, NULL);
  	err = axe_cmd(sc, AXE_CMD_MII_WRITE_REG, reg, phy, (void *)&val);
 @@ -379,6 +380,7 @@
  	ifp = GET_IFP(sc);

  	axe_cmd(sc, AXE_CMD_RXCTL_READ, 0, 0, (void *)&rxmode);
 +	rxmode = le16toh(rxmode);

  	if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
  	allmulti:
 @@ -1231,6 +1233,7 @@

  				axe_cmd(sc, AXE_CMD_RXCTL_READ,
  					0, 0, (void *)&rxmode);
 +				rxmode = le16toh(rxmode);
  				rxmode |= AXE_RXCMD_PROMISC;
  				axe_cmd(sc, AXE_CMD_RXCTL_WRITE,
  					0, rxmode, NULL);
 @@ -1241,6 +1244,7 @@
  			    sc->axe_if_flags & IFF_PROMISC) {
  				axe_cmd(sc, AXE_CMD_RXCTL_READ,
  					0, 0, (void *)&rxmode);
 +				rxmode = le16toh(rxmode);
  				rxmode &= ~AXE_RXCMD_PROMISC;
  				axe_cmd(sc, AXE_CMD_RXCTL_WRITE,
  					0, rxmode, NULL);

 --------------010003080803010108000200--

From: Lennart Augustsson <lennart@augustsson.net>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: kern/32032: axe/ukphy combo does not work on big-endian machines
Date: Thu, 10 Nov 2005 00:11:01 +0100

 I think you are absolutly right.  If you look at axe_mii_readreg()
 and axe_mii_writereg() you can see that the value val is
 totally mishandled.  It is not byte swapped, and in the case
 of writing the address of a 32 bit variable is used where you
 need the address to two bytes.

 You could try fixing that.

 	-- Lennart


 garrett_damore@tadpole.com wrote:
 >>Number:         32032
 >>Category:       kern
 >>Synopsis:       axe/ukphy combo does not work on big-endian machines

Responsible-Changed-From-To: kern-bug-people->tron
Responsible-Changed-By: tron@netbsd.org
Responsible-Changed-When: Thu, 10 Nov 2005 09:11:59 +0000
Responsible-Changed-Why:
I'll handle this PR.


From: Matthias Scheler <tron@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/32032 CVS commit: src/sys/dev/usb
Date: Thu, 10 Nov 2005 10:00:19 +0000 (UTC)

 Module Name:	src
 Committed By:	tron
 Date:		Thu Nov 10 10:00:19 UTC 2005

 Modified Files:
 	src/sys/dev/usb: if_axe.c

 Log Message:
 Apply big endian fixes submitted by Garrett D'Amore in PR kern/32032.


 To generate a diff of this commit:
 cvs rdiff -r1.9 -r1.10 src/sys/dev/usb/if_axe.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->analyzed
State-Changed-By: tron@netbsd.org
State-Changed-When: Thu, 10 Nov 2005 10:10:28 +0000
State-Changed-Why:
I've committed your fixes. I'll test them later today and close the PR
after verifying that the driver still works on a little endian system.


State-Changed-From-To: analyzed->closed
State-Changed-By: tron@netbsd.org
State-Changed-When: Thu, 10 Nov 2005 18:51:55 +0000
State-Changed-Why:
The driver still works fine with NetBSD-i386:

axe0 at uhub4 port 4 configuration 1 interface 0
axe0: Linksys USB 2.0 10/100 ethernet controller, rev 2.00/0.01, addr 2
axe0: Ethernet address 00:10:60:85:3b:84
ukphy0 at axe0 phy 3: Generic IEEE 802.3u media interface
ukphy0: OUI 0x000004, model 0x0020, rev. 1
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto

tron@lyssa:~>ifconfig axe0
axe0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        address: 00:10:60:85:3b:84
        media: Ethernet autoselect (100baseTX full-duplex)
        status: active
        inet 81.187.181.115 netmask 0xfffffff0 broadcast 81.187.181.127
        inet6 fe80::210:60ff:fe85:3b84%axe0 prefixlen 64 scopeid 0x6
        inet6 2001:8b0:114:1::3 prefixlen 64

I'll request a pullup into the "netbsd-3" branch.


From: Soren Jacobsen <snj@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/32032 CVS commit: [netbsd-3] src/sys/dev/usb
Date: Thu, 10 Nov 2005 23:56:13 +0000 (UTC)

 Module Name:	src
 Committed By:	snj
 Date:		Thu Nov 10 23:56:13 UTC 2005

 Modified Files:
 	src/sys/dev/usb [netbsd-3]: if_axe.c

 Log Message:
 Pull up following revision(s) (requested by tron in ticket #950):
 	sys/dev/usb/if_axe.c: revision 1.10
 Apply big endian fixes submitted by Garrett D'Amore in PR kern/32032.


 To generate a diff of this commit:
 cvs rdiff -r1.7 -r1.7.2.1 src/sys/dev/usb/if_axe.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.