svn commit: r188399 - user/thompsa/usb/sys/dev/usb2/wlan

Andrew Thompson thompsa at FreeBSD.org
Mon Feb 9 09:38:18 PST 2009


Author: thompsa
Date: Mon Feb  9 17:38:16 2009
New Revision: 188399
URL: http://svn.freebsd.org/changeset/base/188399

Log:
  Be sure to drain the transfers so the tx resources are returned before they get
  freed.

Modified:
  user/thompsa/usb/sys/dev/usb2/wlan/if_rum2.c
  user/thompsa/usb/sys/dev/usb2/wlan/if_ural2.c
  user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c

Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_rum2.c
==============================================================================
--- user/thompsa/usb/sys/dev/usb2/wlan/if_rum2.c	Mon Feb  9 17:37:17 2009	(r188398)
+++ user/thompsa/usb/sys/dev/usb2/wlan/if_rum2.c	Mon Feb  9 17:38:16 2009	(r188399)
@@ -654,6 +654,8 @@ rum_free_tx_list(struct rum_softc *sc)
 	if (sc->tx_data == NULL)
 		return;
 
+	KASSERT(sc->tx_nfree == RUM_TX_LIST_COUNT, ("lost a txd"));
+
 	for (i = 0; i < RUM_TX_LIST_COUNT; i++) {
 		data = &sc->tx_data[i];
 
@@ -2042,8 +2044,10 @@ rum_stop(void *priv)
 	/*
 	 * stop all the transfers, if not already stopped:
 	 */
-	usb2_transfer_stop(sc->sc_xfer[RUM_BULK_WR]);
-	usb2_transfer_stop(sc->sc_xfer[RUM_BULK_RD]);
+	RUM_UNLOCK(sc);
+	usb2_transfer_drain(sc->sc_xfer[RUM_BULK_WR]);
+	usb2_transfer_drain(sc->sc_xfer[RUM_BULK_RD]);
+	RUM_LOCK(sc);
 
 	rum_free_tx_list(sc);
 

Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_ural2.c
==============================================================================
--- user/thompsa/usb/sys/dev/usb2/wlan/if_ural2.c	Mon Feb  9 17:37:17 2009	(r188398)
+++ user/thompsa/usb/sys/dev/usb2/wlan/if_ural2.c	Mon Feb  9 17:38:16 2009	(r188399)
@@ -639,6 +639,8 @@ ural_free_tx_list(struct ural_softc *sc)
 	if (sc->tx_data == NULL)
 		return;
 
+	KASSERT(sc->tx_nfree == RAL_TX_LIST_COUNT, ("lost a txd"));
+
 	for (i = 0; i < RAL_TX_LIST_COUNT; i++) {
 		data = &sc->tx_data[i];
 
@@ -2181,8 +2183,10 @@ ural_stop(void *priv)
 	/*
 	 * stop all the transfers, if not already stopped:
 	 */
-	usb2_transfer_stop(sc->sc_xfer[URAL_BULK_WR]);
-	usb2_transfer_stop(sc->sc_xfer[URAL_BULK_RD]);
+	RAL_UNLOCK(sc);
+	usb2_transfer_drain(sc->sc_xfer[URAL_BULK_WR]);
+	usb2_transfer_drain(sc->sc_xfer[URAL_BULK_RD]);
+	RAL_LOCK(sc);
 
 	ural_free_tx_list(sc);
 

Modified: user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c
==============================================================================
--- user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c	Mon Feb  9 17:37:17 2009	(r188398)
+++ user/thompsa/usb/sys/dev/usb2/wlan/if_zyd2.c	Mon Feb  9 17:38:16 2009	(r188399)
@@ -542,6 +542,8 @@ zyd_free_tx_list(struct zyd_softc *sc)
 	if (sc->tx_data == NULL)
 		return;
 
+	KASSERT(sc->tx_nfree == ZYD_TX_LIST_CNT, ("lost a txd"));
+
 	for (i = 0; i < ZYD_TX_LIST_CNT; i++) {
 		data = &sc->tx_data[i];
 
@@ -2523,9 +2525,10 @@ zyd_bulk_write_callback(struct usb2_xfer
 
 		ifp->if_oerrors++;
 		data = xfer->priv_fifo;
-		xfer->priv_fifo = NULL;
-		if (data != NULL && ifp->if_drv_flags & IFF_DRV_RUNNING)
+		if (data != NULL) {
 			zyd_tx_free(data, xfer->error);
+			xfer->priv_fifo = NULL;
+		}
 		break;
 	}
 }
@@ -2887,8 +2890,10 @@ zyd_stop(struct zyd_softc *sc)
 	/*
 	 * stop all the transfers, if not already stopped:
 	 */
-	usb2_transfer_stop(sc->sc_xfer[ZYD_BULK_WR]);
-	usb2_transfer_stop(sc->sc_xfer[ZYD_BULK_RD]);
+	ZYD_UNLOCK(sc);
+	usb2_transfer_drain(sc->sc_xfer[ZYD_BULK_WR]);
+	usb2_transfer_drain(sc->sc_xfer[ZYD_BULK_RD]);
+	ZYD_LOCK(sc);
 
 	zyd_free_tx_list(sc);
 


More information about the svn-src-user mailing list