Subject: Re: implementation: NetBSD on AS1200s
To: Stephen M Jones <smj@cirr.com>
From: Michael L. Hitch <mhitch@lightning.msu.montana.edu>
List: port-alpha
Date: 03/06/2002 15:50:58
On Wed, 6 Mar 2002, Stephen M Jones wrote:

> Looks good right?  no overruns or errors, just this stray interrupt occuring.
> now if that device stops working after say 8 stray interrupts, that could
> explain my mysterious hangs.  
> 
> Does anyone have any solutions?  I wouldn't even mind buy 4 new ethernet
> cards if its a problem that can't be corrected within the software 
> driver.

  If you can build a new kernel, here's a fix I've been using.  The first
part of the patch is a workaround for the stray interrupt.  The rest of
the patch keeps the interface packet and bytes counts from getting counted
twice.


--- /usr/NetBSD-1.5/src/sys/dev/ic/elinkxl.c	Wed Feb 13 19:01:54 2002
+++ ./elinkxl.c	Mon Feb 11 00:52:08 2002
@@ -1109,6 +1109,9 @@
 	    (sc->sc_dev.dv_flags & DVF_ACTIVE) == 0)
 		return (0);
 
+	/* Set ret if INTR_LATCH is set - sometimes that's the only bit set */
+	ret = bus_space_read_2(iot, ioh, ELINK_STATUS) & S_INTR_LATCH;
+
 	for (;;) {
 		bus_space_write_2(iot, ioh, ELINK_COMMAND, C_INTR_LATCH);
 
@@ -1410,10 +1413,15 @@
 
 	GO_WINDOW(6);
 	upperok = bus_space_read_1(iot, ioh, UPPER_FRAMES_OK);
+#if 0  /* clear frame counters, but don't add them */
 	ifp->if_ipackets += bus_space_read_1(iot, ioh, RX_FRAMES_OK);
 	ifp->if_ipackets += (upperok & 0x03) << 8;
 	ifp->if_opackets += bus_space_read_1(iot, ioh, TX_FRAMES_OK);
 	ifp->if_opackets += (upperok & 0x30) << 4;
+#else
+	bus_space_read_1(iot, ioh, RX_FRAMES_OK);
+	bus_space_read_1(iot, ioh, TX_FRAMES_OK);
+#endif
 	ifp->if_ierrors += bus_space_read_1(iot, ioh, RX_OVERRUNS);
 	ifp->if_collisions += bus_space_read_1(iot, ioh, TX_COLLISIONS);
 	/*
@@ -1422,9 +1430,13 @@
 	 */
 	ifp->if_collisions += 2 * bus_space_read_1(iot, ioh,
 	    TX_AFTER_X_COLLISIONS);
+#if 0 /* clear byte counters, but don't add them */
 	ifp->if_ibytes += bus_space_read_2(iot, ioh, RX_TOTAL_OK);
 	ifp->if_obytes += bus_space_read_2(iot, ioh, TX_TOTAL_OK);
-
+#else
+	bus_space_read_2(iot, ioh, RX_TOTAL_OK);
+	bus_space_read_2(iot, ioh, TX_TOTAL_OK);
+#endif
 	/*
 	 * Clear the following to avoid stats overflow interrupts
 	 */
@@ -1434,9 +1446,11 @@
 	bus_space_read_1(iot, ioh, TX_CD_LOST);
 	GO_WINDOW(4);
 	bus_space_read_1(iot, ioh, ELINK_W4_BADSSD);
+#if 0
 	upperok = bus_space_read_1(iot, ioh, ELINK_W4_UBYTESOK);
 	ifp->if_ibytes += (upperok & 0x0f) << 16;
 	ifp->if_obytes += (upperok & 0xf0) << 12;
+#endif
 	GO_WINDOW(1);
 }
 

--
Michael L. Hitch			mhitch@montana.edu
Computer Consultant
Information Technology Center
Montana State University	Bozeman, MT	USA