Subject: Re: kern/22493 (still there, me too, -current, critical?)
To: None <gnats-bugs@netbsd.org>
From: Steve Woodford <scw@netbsd.org>
List: netbsd-bugs
Date: 02/04/2005 11:00:41
--Boundary-00=_ZX1ACsodAv1z3S+
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Friday 04 February 2005 10:09, Arto Selonen wrote:

>  Just upgraded a -current to 2.99.15 with whatever sources anoncvs-us2
>  mirror gave on 20050203. Observed a panic quite like in this PR.
>  We have several NetBSD-current systems with wm(4) cards, and this is
>  the first time this PR bites us.

Can you try the attached patch and let me know the outcome?

Cheers, Steve

--Boundary-00=_ZX1ACsodAv1z3S+
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="if_wm.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="if_wm.c.patch"

Index: if_wm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_wm.c,v
retrieving revision 1.90
diff -u -r1.90 if_wm.c
--- if_wm.c	30 Jan 2005 17:33:48 -0000	1.90
+++ if_wm.c	4 Feb 2005 10:32:34 -0000
@@ -233,6 +233,7 @@
 	int sc_bus_speed;		/* PCI/PCIX bus speed */
 	int sc_pcix_offset;		/* PCIX capability register offset */
 	int sc_flowflags;		/* 802.3x flow control flags */
+	int sc_disabled;		/* Interface is disabled */
 
 	void *sc_ih;			/* interrupt cookie */
 
@@ -840,6 +841,7 @@
 	/*
 	 * Map and establish our interrupt.
 	 */
+	sc->sc_disabled = 1;
 	if (pci_intr_map(pa, &ih)) {
 		aprint_error("%s: unable to map interrupt\n",
 		    sc->sc_dev.dv_xname);
@@ -1954,6 +1956,8 @@
 #endif
 
 		handled = 1;
+		if (sc->sc_disabled)
+			break;
 
 #if defined(WM_DEBUG) || defined(WM_EVENT_COUNTERS)
 		if (icr & (ICR_RXDMT0|ICR_RXT0)) {
@@ -1993,7 +1997,8 @@
 			wm_init(ifp);
 
 		/* Try to get more packets going. */
-		wm_start(ifp);
+		if (sc->sc_disabled == 0)
+			wm_start(ifp);
 	}
 
 	return (handled);
@@ -2588,6 +2593,7 @@
 				 * XXX buffers instead of just failing.
 				 */
 				wm_rxdrain(sc);
+				sc->sc_disabled = 1;
 				goto out;
 			}
 		} else
@@ -2727,6 +2733,7 @@
 	/* ...all done! */
 	ifp->if_flags |= IFF_RUNNING; 
 	ifp->if_flags &= ~IFF_OACTIVE;
+	sc->sc_disabled = 0;
 
  out:
 	if (error)
@@ -2794,8 +2801,10 @@
 		}
 	}
 
-	if (disable)
+	if (disable) {
 		wm_rxdrain(sc);
+		sc->sc_disabled = 1;
+	}
 
 	/* Mark the interface as down and cancel the watchdog timer. */
 	ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);

--Boundary-00=_ZX1ACsodAv1z3S+--