svn commit: r207623 - head/sys/dev/msk

Pyun YongHyeon yongari at FreeBSD.org
Tue May 4 17:12:37 UTC 2010


Author: yongari
Date: Tue May  4 17:12:36 2010
New Revision: 207623
URL: http://svn.freebsd.org/changeset/base/207623

Log:
  Make sure to check whether driver is running before processing
  received frames. Also check driver has valid ifp pointer before
  calling msk_stop() in device_shutdown handler. While I'm here
  remove unnecessary accesses to interrupt mask registers in
  device_shutdown handler because driver puts the controller into
  reset state.
  With these changes, msk(4) now survive from heavy RX traffic(1byte
  UDP frame) while reboot is in progress.
  
  Reported by:	Mark Atkinson < atkin901 <> gmail dot com >

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==============================================================================
--- head/sys/dev/msk/if_msk.c	Tue May  4 17:02:34 2010	(r207622)
+++ head/sys/dev/msk/if_msk.c	Tue May  4 17:12:36 2010	(r207623)
@@ -2904,20 +2904,15 @@ mskc_shutdown(device_t dev)
 	sc = device_get_softc(dev);
 	MSK_LOCK(sc);
 	for (i = 0; i < sc->msk_num_port; i++) {
-		if (sc->msk_if[i] != NULL)
+		if (sc->msk_if[i] != NULL && sc->msk_if[i]->msk_ifp != NULL &&
+		    ((sc->msk_if[i]->msk_ifp->if_drv_flags &
+		    IFF_DRV_RUNNING) != 0))
 			msk_stop(sc->msk_if[i]);
 	}
-
-	/* Disable all interrupts. */
-	CSR_WRITE_4(sc, B0_IMSK, 0);
-	CSR_READ_4(sc, B0_IMSK);
-	CSR_WRITE_4(sc, B0_HWE_IMSK, 0);
-	CSR_READ_4(sc, B0_HWE_IMSK);
+	MSK_UNLOCK(sc);
 
 	/* Put hardware reset. */
 	CSR_WRITE_2(sc, B0_CTST, CS_RST_SET);
-
-	MSK_UNLOCK(sc);
 	return (0);
 }
 
@@ -3525,6 +3520,8 @@ msk_handle_events(struct msk_softc *sc)
 			sc_if->msk_csum = status;
 			break;
 		case OP_RXSTAT:
+			if (!(sc_if->msk_ifp->if_drv_flags & IFF_DRV_RUNNING))
+				break;
 			if (sc_if->msk_framesize >
 			    (MCLBYTES - MSK_RX_BUF_ALIGN))
 				msk_jumbo_rxeof(sc_if, status, control, len);


More information about the svn-src-head mailing list