From owner-freebsd-current@FreeBSD.ORG  Mon Mar  3 10:41:48 2008
Return-Path: <owner-freebsd-current@FreeBSD.ORG>
Delivered-To: freebsd-current@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AE61A1065679
	for <freebsd-current@freebsd.org>; Mon,  3 Mar 2008 10:41:48 +0000 (UTC)
	(envelope-from pyunyh@gmail.com)
Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.174])
	by mx1.freebsd.org (Postfix) with ESMTP id 7E9CD8FC24
	for <freebsd-current@freebsd.org>; Mon,  3 Mar 2008 10:41:48 +0000 (UTC)
	(envelope-from pyunyh@gmail.com)
Received: by wf-out-1314.google.com with SMTP id 25so6493086wfa.7
	for <freebsd-current@freebsd.org>; Mon, 03 Mar 2008 02:41:47 -0800 (PST)
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=dSUmDp4883OsiDSp9zIlx+vGEgqqEf9RsjrBtRAOuTk=;
	b=ZWC2NydTnkwlIX9w20a1tRE3uA+sjnfOdw3F+3D/r3oRCOY+tBnWAkVhqeWhR8ihftwxzMRVUFl5p/L5G4teM8G4V0thjuIaZle75pZ37bByzOYp0beQfUHS12hRAzD+fm2D1UVcSeFqxfAcBOahN/DZCk2BhDnUyUG+bqq5low=
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=j3cp4pDzM2vzORzTWI95cODNWvAMV3PITeSDcQ9Iv4GokHZoyOJpc2yY+rsu8AFXVR3xTV9NJj9DQCWccSCyyvh2vRDIZNyQksj4zBF8YjI+85cNULW5czplUhJMN0hEDGUJ5gV34w2/UdWbaegrmG8WKVrO4nyW0YcP5qFAetg=
Received: by 10.142.49.4 with SMTP id w4mr8925766wfw.185.1204540907727;
	Mon, 03 Mar 2008 02:41:47 -0800 (PST)
Received: from michelle.cdnetworks.co.kr ( [211.53.35.84])
	by mx.google.com with ESMTPS id 28sm26375145wfg.17.2008.03.03.02.41.45
	(version=TLSv1/SSLv3 cipher=OTHER);
	Mon, 03 Mar 2008 02:41:46 -0800 (PST)
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
	m23AffS7075419
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Mon, 3 Mar 2008 19:41:41 +0900 (KST) (envelope-from pyunyh@gmail.com)
Received: (from yongari@localhost)
	by michelle.cdnetworks.co.kr (8.13.5/8.13.5/Submit) id m23AfeNJ075418; 
	Mon, 3 Mar 2008 19:41:40 +0900 (KST) (envelope-from pyunyh@gmail.com)
Date: Mon, 3 Mar 2008 19:41:40 +0900
From: Pyun YongHyeon <pyunyh@gmail.com>
To: Milan Obuch <freebsd-current@dino.sk>
Message-ID: <20080303104140.GA74947@cdnetworks.co.kr>
References: <20080217112104.X80805@fledge.watson.org>
	<200803011655.m21GtcMU078673@lava.sentex.ca>
	<20080303013142.GE72895@cdnetworks.co.kr>
	<200803031010.28087.freebsd-current@dino.sk>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="BOKacYhQ+x31HxR3"
Content-Disposition: inline
In-Reply-To: <200803031010.28087.freebsd-current@dino.sk>
User-Agent: Mutt/1.4.2.1i
Cc: freebsd-current@freebsd.org
Subject: Re: CFT: vr(4)
X-BeenThere: freebsd-current@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: pyunyh@gmail.com
List-Id: Discussions about the use of FreeBSD-current
	<freebsd-current.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>, 
	<mailto:freebsd-current-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-current>
List-Post: <mailto:freebsd-current@freebsd.org>
List-Help: <mailto:freebsd-current-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>,
	<mailto:freebsd-current-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 03 Mar 2008 10:41:48 -0000


--BOKacYhQ+x31HxR3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, Mar 03, 2008 at 10:10:25AM +0100, Milan Obuch wrote:
 > On Monday 03 March 2008, Pyun YongHyeon wrote:
 > > On Sat, Mar 01, 2008 at 11:53:41AM -0500, Mike Tancsa wrote:
 > >
 > > Sorry for late handling. I wanted to solve Milan Obuch's issue first
 > > before committing vr(4). But it seems that it's not easy to fix
 > > Milan's issue. :-(
 > >
 > 
 > Well, I see some progress there... Today I was able to do some tests again, 
 > and I was able to ping -f another box on the same network for some time. I 
 > tried then csup sources and I got hard hang, again, this time with following 
 > lines on console:
 > 
 > vr0: PCI bus error -- resetting
 > vr0: restarting
 > 

Hmm, this is interesting. 6105M datasheet said nothing what can be
done for this case. I guess this kind of error can come from
improperly seated NICs or broken hardware. Would you re-seat the NIC
or change PCI slot and try again with attached patch?

 > And no ability to enter kdb, either.
 > Just for record, I am getting following when kldload'ing if_vr:
 > 
 > vr0: <VIA VT6105M Rhine III 10/100BaseTX> port 0x9c00-0x9cff mem 
 > 0xfceff000-0xfceff0ff irq 18 at device 8.0 on pci3
 > vr0: Quirks: 0x6
 > vr0: Revision: 0x96
 > miibus1: <MII bus> on vr0
 > ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus1
 > ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 > 
 > (one out of four devices shown)
 > 
 > >  > At 07:30 PM 2/27/2008, Pyun YongHyeon wrote:
 > >  > >I never thought this kind of testing. It's good to hear vr(4)
 > >  > >recovers from the abrupt link change events. I guess this also
 > >  > >indicates the overhauled vr(4) can close lots of PR for vr(4).
 > >  >
 > >  > BTW, any chance of these fixes being backported to RELENG_7 and
 > >  > RELENG_6 ? Its not just media speed changes that causes the nic to
 > >
 > > I'm sure I'll MFC the change to RELENG_7 but not sure it could be
 > > done on RELENG_6 due to lack of spare time.
 > >
 > 
 > In my eyes, if new vr works for others and no regression was found, it should 
 > go in. I did not encountered a regression - it did not work with old driver, 
 > it does not work (yet) with the new... but I hope we can get this one 
 > working, too...
 > 

Yes, I really like to fix it too.

 > Milan

-- 
Regards,
Pyun YongHyeon

--BOKacYhQ+x31HxR3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="vr.patch2"

--- if_vr.c.orig	2008-02-18 10:46:10.000000000 +0900
+++ if_vr.c	2008-03-03 19:27:15.000000000 +0900
@@ -1733,8 +1733,10 @@
 		CSR_WRITE_2(sc, VR_ISR, status);
 		if ((status & (VR_ISR_BUSERR | VR_ISR_LINKSTAT2 |
 		    VR_ISR_STATSOFLOW)) != 0) {
-			if (vr_error(sc, status) != 0)
-				goto done_locked;
+			if (vr_error(sc, status) != 0) {
+				VR_UNLOCK(sc);
+				return;
+			}
 		}
 		vr_rxeof(sc);
 		if ((status & (VR_ISR_RX_NOBUF | VR_ISR_RX_OFLOW)) != 0) {
@@ -1762,12 +1764,18 @@
 static int
 vr_error(struct vr_softc *sc, uint16_t status)
 {
+	uint16_t pcis;
 
 	status &= VR_ISR_BUSERR | VR_ISR_LINKSTAT2 | VR_ISR_STATSOFLOW;
 	if ((status & VR_ISR_BUSERR) != 0) {
 		status &= ~VR_ISR_BUSERR;
 		sc->vr_stat.bus_errors++;
-		device_printf(sc->vr_dev, "PCI bus error -- resetting\n");
+		/* Disable further interrupts. */
+		CSR_WRITE_2(sc, VR_IMR, 0);
+		pcis = pci_read_config(sc->vr_dev, PCIR_STATUS, 2);
+		device_printf(sc->vr_dev, "PCI bus error(0x%04x) -- "
+		    "resetting\n", pcis);
+		pci_write_config(sc->vr_dev, PCIR_STATUS, pcis, 2);
 		sc->vr_flags |= VR_F_RESTART;
 		return (EAGAIN);
 	}

--BOKacYhQ+x31HxR3--