kern/62889: Panic in vr(4): interrupt related
Bruce M Simpson
bms at spc.org
Fri Jul 2 23:40:25 PDT 2004
Please try the attached patches (broadly inspired by fxp(4)) and let me
know if they solve the problem.
I am inclined to commit as-is as they are quite trivial, but I'm not sure
how the VIA Rhine chips act if we try to detach them as devices without
necessarily reading the ISR register to consume an unwanted interrupt.
Regards,
BMS
-------------- next part --------------
Index: if_vrreg.h
===================================================================
RCS file: /home/ncvs/src/sys/pci/if_vrreg.h,v
retrieving revision 1.19
diff -u -p -r1.19 if_vrreg.h
--- if_vrreg.h 5 Apr 2004 17:39:57 -0000 1.19
+++ if_vrreg.h 3 Jul 2004 06:39:46 -0000
@@ -468,6 +468,7 @@ struct vr_softc {
struct vr_chain_data vr_cdata;
struct callout_handle vr_stat_ch;
struct mtx vr_mtx;
+ int suspended; /* if 1, sleeping/detaching */
#ifdef DEVICE_POLLING
int rxcycles;
#endif
-------------- next part --------------
Index: if_vr.c
===================================================================
RCS file: /home/ncvs/src/sys/pci/if_vr.c,v
retrieving revision 1.89
diff -u -p -r1.89 if_vr.c
--- if_vr.c 3 Jul 2004 02:59:02 -0000 1.89
+++ if_vr.c 3 Jul 2004 06:36:48 -0000
@@ -755,6 +755,8 @@ vr_attach(dev)
/* Call MI attach routine. */
ether_ifattach(ifp, eaddr);
+ sc->suspended = 0;
+
/* Hook interrupt last to avoid having to lock softc */
error = bus_setup_intr(dev, sc->vr_irq, INTR_TYPE_NET | INTR_MPSAFE,
vr_intr, sc, &sc->vr_intrhand);
@@ -789,6 +791,8 @@ vr_detach(device_t dev)
VR_LOCK(sc);
+ sc->suspended = 1;
+
/* These should only be active if attach succeeded */
if (device_is_attached(dev)) {
vr_stop(sc);
@@ -1219,6 +1223,10 @@ vr_intr(void *arg)
uint16_t status;
VR_LOCK(sc);
+ if (sc->suspended) {
+ VR_UNLOCK(sc);
+ return;
+ }
#ifdef DEVICE_POLLING
if (ifp->if_flags & IFF_POLLING) {
VR_UNLOCK(sc);
More information about the freebsd-net
mailing list