From Arjan.deVet@adv.iae.nl  Sat Jan  8 05:01:32 2000
Return-Path: <Arjan.deVet@adv.iae.nl>
Received: from news.IAEhv.nl (news.IAE.nl [194.151.64.4])
	by hub.freebsd.org (Postfix) with ESMTP id 5853E14BEE
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  8 Jan 2000 05:01:31 -0800 (PST)
	(envelope-from Arjan.deVet@adv.iae.nl)
Received: (from uucp@localhost)
	by news.IAEhv.nl (8.9.1/8.9.1) with IAEhv.nl id OAA24068
	for FreeBSD-gnats-submit@freebsd.org; Sat, 8 Jan 2000 14:01:30 +0100 (MET)
Received: by adv.iae.nl (Postfix, from userid 100)
	id A321E22CD; Sat,  8 Jan 2000 14:01:09 +0100 (CET)
Message-Id: <20000108130109.A321E22CD@adv.iae.nl>
Date: Sat,  8 Jan 2000 14:01:09 +0100 (CET)
From: Arjan.deVet@adv.iae.nl (Arjan de Vet)
Reply-To: Arjan.deVet@adv.iae.nl (Arjan de Vet)
To: FreeBSD-gnats-submit@freebsd.org
Subject: xl ethernet interface hanging
X-Send-Pr-Version: 3.2

>Number:         15986
>Category:       kern
>Synopsis:       xl ethernet interface hanging
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan  8 05:10:00 PST 2000
>Closed-Date:    Sun Jan 9 13:17:17 PST 2000
>Last-Modified:  Sun Jan  9 13:19:02 PST 2000
>Originator:     Arjan de Vet
>Release:        FreeBSD 4.0-CURRENT
>Organization:
>Environment:

FreeBSD 4.0-CURRENT

>Description:

I noticed that my xl0 ethernet interface didn't work anymore (or with
enormous delays) and I traced it back to revision 1.69 in if_xl.c:

Index: if_xl.c
===================================================================
RCS file: /home/freebsd/CVS/src/sys/pci/if_xl.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -u -5 -w -r1.68 -r1.69
--- if_xl.c	1999/10/14 21:49:17	1.68
+++ if_xl.c	1999/10/25 20:52:32	1.69
@@ -2389,13 +2389,13 @@
 	/*
 	 * Cancel pending I/O and free all RX/TX buffers.
 	 */
 	xl_stop(sc);
 
-	xl_reset(sc);
+	CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_TX_RESET);
 	xl_wait(sc);
-	DELAY(1000);
+	DELAY(10000);
 
 	if (sc->xl_miibus != NULL)
 		mii = device_get_softc(sc->xl_miibus);
 
 	/* Init our MAC address */

dmesg output:

xl0: <3Com 3c900B-TPO Etherlink XL> irq 12 at device 11.0 on pci0
xl0: Ethernet address: 00:50:04:ea:f9:c0
xl0: media options word: 8
xl0: guessing 10BaseT transceiver
xl0: found 10baseT
xl0: selecting 10baseT transceiver, half duplex
bpf: xl0 attached

>How-To-Repeat:


>Fix:
	
Because the comment talks about RX/TX buffers I tried this fix:

Index: if_xl.c
===================================================================
RCS file: /home/freebsd/CVS/src/sys/pci/if_xl.c,v
retrieving revision 1.71
diff -u -r1.71 if_xl.c
--- if_xl.c	2000/01/03 15:28:47	1.71
+++ if_xl.c	2000/01/08 12:30:48
@@ -2426,6 +2426,8 @@
 	 */
 	xl_stop(sc);
 
+	CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_RESET);
+	xl_wait(sc);
 	CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_TX_RESET);
 	xl_wait(sc);
 	DELAY(10000);

and then my xl0 interface worked again. Is this a correct solution?


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: wpaul 
State-Changed-When: Sun Jan 9 13:17:17 PST 2000 
State-Changed-Why:  

Fix applied, though with a test to insure that the RX reset is only done 
on cards that don't use miibus support, since doing an RX reset on them 
can retrigger NWAY autonegotiation, which is what I was trying to avoid 
in the first place. 

-Bill 
>Unformatted:
