NetBSD Problem Report #34109

From jmmv@netbsd.org  Sat Jul 29 08:10:59 2006
Return-Path: <jmmv@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id D72B263B850
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 29 Jul 2006 08:10:58 +0000 (UTC)
Message-Id: <20060729081058.C84DF63B10C@mail.netbsd.org>
Date: Sat, 29 Jul 2006 08:10:58 +0000 (UTC)
From: jmmv@netbsd.org
Reply-To: jmmv@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: vr(4) is painfully slow with the new rlphy(4)
X-Send-Pr-Version: 3.95

>Number:         34109
>Category:       kern
>Synopsis:       vr(4) is painfully slow with the new rlphy(4)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    tsutsui
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 29 08:15:00 +0000 2006
>Closed-Date:    Mon Mar 19 12:27:10 +0000 2007
>Last-Modified:  Sun Mar 09 11:10:02 +0000 2008
>Originator:     Julio M. Merino Vidal
>Release:        NetBSD 3.99.23
>Organization:

>Environment:


System: NetBSD dawn.home.network 3.99.23 NetBSD 3.99.23 (GENERIC) #22: Fri Jul 28 14:56:33 CEST 2006 root@max.home.network:/var/obj/usr/src-current/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
	I have an Asus A7V8X-x motherboard, which includes the VIA KT400
	chipset.  The integrated network card is a VIA VT6102 (Rhine II)
	10/100 Ethernet that generally works fine with the vr(4) driver.

	With a current kernel (3.99.23, as shown above), the new rlphy(4)
	driver is used with this card:

	vr0 at pci0 dev 18 function 0: VIA VT6102 (Rhine II) 10/100 Ethernet
	vr0: interrupting at irq 3
	vr0: Ethernet address: 00:0c:6e:27:57:bd
	rlphy0 at vr0 phy 1: RTL8201L 10/100 media interface, rev. 1
	rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto

	This produces extremely slow throughput.  For example, a scp of a
	file between a 3.0_STABLE host in my home network and this current
	machine delivers a maximum transfer rate of 150 KB/s; this "speed"
	is not sustained as it fluctuates between 70 KB/s and 120 KB/s.
	As you can imagine, the local network is unusable at those rates.

	If I disable rlphy(4) from userconf, the kernel falls back to
	ukphy(4) as it always did before rlphy(4) was added:

	vr0 at pci0 dev 18 function 0: VIA VT6102 (Rhine II) 10/100 Ethernet
	vr0: interrupting at irq 3
	vr0: Ethernet address: 00:0c:6e:27:57:bd
	ukphy0 at vr0 phy 1: Generic IEEE 802.3u media interface
	ukphy0: RTL8201L 10/100 media interface (OUI 0x000004, model 0x0020), rev. 1
	ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto

	With this configuration I get decent transfer speeds of the order
	of 6-8 MB/s.

	I'm afraid other network cards may be affected as well.

>How-To-Repeat:
	Use a VIA Rhine II card with vr(4) and rlphy(4) and try to transfer
	files to a machine in a local network.  See how slow it is.

>Fix:
	Don't know.  As a workaround, use ukphy(4).

>Release-Note:

>Audit-Trail:
From: David Laight <david@l8s.co.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/34109: vr(4) is painfully slow with the new rlphy(4)
Date: Mon, 31 Jul 2006 07:17:49 +0100

 On Sat, Jul 29, 2006 at 08:15:01AM +0000, jmmv@netbsd.org wrote:
 > >Number:         34109
 > >Category:       kern
 > >Synopsis:       vr(4) is painfully slow with the new rlphy(4)
 > 
 > 	This produces extremely slow throughput.  For example, a scp of a
 > 	file between a 3.0_STABLE host in my home network and this current
 > 	machine delivers a maximum transfer rate of 150 KB/s; this "speed"
 > 	is not sustained as it fluctuates between 70 KB/s and 120 KB/s.
 > 	As you can imagine, the local network is unusable at those rates.
 > 
 > 	If I disable rlphy(4) from userconf, the kernel falls back to
 > 	ukphy(4) as it always did before rlphy(4) was added:

 At a guess full/half duplex is being incorrectly detected.

 	David

 -- 
 David Laight: david@l8s.co.uk

From: Juan RP <juan@xtrarom.org>
To: gnats-bugs@netbsd.org
Cc: jmmv@netbsd.org
Subject: Re: kern/34109  vr(4) is painfully slow with the new rlphy(4)
Date: Fri, 9 Feb 2007 08:59:41 +0100

 Hi, I have applied two revisions: one from FreeBSD (rev 1.29) and
 another one from OpenBSD (rev 1.26) which should fix the problems you
 experienced, could you please confirm?

 http://www.xtrarom.org/patches/rlphy.diff

 -- 
 http://plog.xtrarom.org/
 Juan RP's blog - NetBSD/pkgsrc news in Spanish

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: jmmv@NetBSD.org, gnats-bugs@NetBSD.org
Cc: kern-bug-people@NetBSD.org, gnats-admin@NetBSD.org,
	netbsd-bugs@NetBSD.org, tsutsui@ceres.dti.ne.jp
Subject: Re: kern/34109  vr(4) is painfully slow with the new rlphy(4)
Date: Sun, 18 Mar 2007 14:31:25 +0900

 - Could you please show "ifconfig vr0" output during slowness?
 - Does it work if you set "ifconfig vr0 media 10baseT" manually?
 - If it works, what happens once after "ifconfig vr0 media auto" again?

 With some quick tests on my 8139 cards, rlphy on RTK8139
 doesn't set BMCR_AUTOEN after reset but some of them set BMCR_FDX.
 If that is the problem, could you try the attached patch?
 ---
 Izumi Tsutsui


 Index: rlphy.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/mii/rlphy.c,v
 retrieving revision 1.12
 diff -u -r1.12 rlphy.c
 --- rlphy.c	16 Nov 2006 01:33:06 -0000	1.12
 +++ rlphy.c	18 Mar 2007 05:15:57 -0000
 @@ -65,8 +65,10 @@
  int	rlphy_service(struct mii_softc *, struct mii_data *, int);
  void	rlphy_status(struct mii_softc *);

 +static void rlphy_reset(struct mii_softc *);
 +
  const struct mii_phy_funcs rlphy_funcs = {
 -	rlphy_service, rlphy_status, mii_phy_reset,
 +	rlphy_service, rlphy_status, rlphy_reset,
  };

  static const struct mii_phydesc rlphys[] = {
 @@ -331,3 +333,16 @@
  	} else
  		mii->mii_media_active = ife->ifm_media;
  }
 +
 +static void
 +rlphy_reset(struct mii_softc *sc)
 +{
 +
 +	mii_phy_reset(sc);
 +
 +	/*
 +	 * XXX RealTek PHY doesn't set the BMCR properly after
 +	 * XXX reset, which breaks autonegotiation.
 +	 */
 +	PHY_WRITE(sc, MII_BMCR, BMCR_AUTOEN);
 +}

Responsible-Changed-From-To: kern-bug-people->tsutsui
Responsible-Changed-By: tsutsui@netbsd.org
Responsible-Changed-When: Sun, 18 Mar 2007 15:48:55 +0900
Responsible-Changed-Why:
I'll handle this.


State-Changed-From-To: open->feedback
State-Changed-By: tsutsui@netbsd.org
State-Changed-When: Sun, 18 Mar 2007 15:48:55 +0900
State-Changed-Why:
Could you please try my patch?


From: "Julio M. Merino Vidal" <jmmv84@gmail.com>
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Cc: gnats-bugs@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: kern/34109  vr(4) is painfully slow with the new rlphy(4)
Date: Sun, 18 Mar 2007 09:21:09 +0100

 On 18/03/2007, at 6:31, Izumi Tsutsui wrote:

 > - Could you please show "ifconfig vr0" output during slowness?
 > - Does it work if you set "ifconfig vr0 media 10baseT" manually?
 > - If it works, what happens once after "ifconfig vr0 media auto"  
 > again?
 >
 > With some quick tests on my 8139 cards, rlphy on RTK8139
 > doesn't set BMCR_AUTOEN after reset but some of them set BMCR_FDX.
 > If that is the problem, could you try the attached patch?

 No, sorry, I cannot test it.  That motherboard died a couple of  
 months ago and I don't have any other hardware supporting the vr  
 driver :-(

 -- 
 Julio M. Merino Vidal <jmmv84@gmail.com>


From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: jmmv84@gmail.com
Cc: gnats-bugs@NetBSD.org, netbsd-bugs@NetBSD.org,
	tsutsui@ceres.dti.ne.jp
Subject: Re: kern/34109  vr(4) is painfully slow with the new rlphy(4)
Date: Sun, 18 Mar 2007 17:47:12 +0900

 jmmv84@gmail.com wrote:

 > No, sorry, I cannot test it.  That motherboard died a couple of  
 > months ago and I don't have any other hardware supporting the vr  
 > driver :-(

 Okay, anyway my patch fixes a problem that autoselect doesn't
 choose 100baseTX but 10baseT after reboot until media is set
 manually on my landisk (8139C+), so I'll commit it and
 close this PR.
 ---
 Izumi Tsutsui

From: Izumi Tsutsui <tsutsui@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/34109 CVS commit: src/sys/dev/mii
Date: Mon, 19 Mar 2007 12:23:30 +0000 (UTC)

 Module Name:	src
 Committed By:	tsutsui
 Date:		Mon Mar 19 12:23:30 UTC 2007

 Modified Files:
 	src/sys/dev/mii: rlphy.c

 Log Message:
 Prepare rlphy_reset() and set BMCR_AUTOEN in it.
 This makes autonegotiation on rlphy(4) at re(4)
 on landisk (8139C+) select 100baseTX full-duplex
 at boot time (before first ifconfig) properly,
 and there is no bad side effect on rlphy(4) at nfe(4).

 This may also fix PR kern/34109.


 To generate a diff of this commit:
 cvs rdiff -r1.12 -r1.13 src/sys/dev/mii/rlphy.c

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

State-Changed-From-To: feedback->closed
State-Changed-By: tsutsui@netbsd.org
State-Changed-When: Mon, 19 Mar 2007 21:27:10 +0900
State-Changed-Why:
Possible fix committed, and submitter no longer has a hardware.


From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/34109 CVS commit: [netbsd-4] src/sys/dev/mii
Date: Sun,  9 Mar 2008 11:06:54 +0000 (UTC)

 Module Name:	src
 Committed By:	bouyer
 Date:		Sun Mar  9 11:06:54 UTC 2008

 Modified Files:
 	src/sys/dev/mii [netbsd-4]: rlphy.c

 Log Message:
 Pull up following revision(s) (requested by tsutsui in ticket #1098):
 	sys/dev/mii/rlphy.c: revision 1.13
 Prepare rlphy_reset() and set BMCR_AUTOEN in it.
 This makes autonegotiation on rlphy(4) at re(4)
 on landisk (8139C+) select 100baseTX full-duplex
 at boot time (before first ifconfig) properly,
 and there is no bad side effect on rlphy(4) at nfe(4).
 This may also fix PR kern/34109.


 To generate a diff of this commit:
 cvs rdiff -r1.12 -r1.12.2.1 src/sys/dev/mii/rlphy.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.