socsvn commit: r305577 - soc2016/vincenzo/head/sys/dev/netmap

vincenzo at FreeBSD.org vincenzo at FreeBSD.org
Mon Jun 27 09:34:13 UTC 2016


Author: vincenzo
Date: Mon Jun 27 09:34:12 2016
New Revision: 305577
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305577

Log:
   freebsd: ptnet_detach: drain taskqueue before detaching the interface

Modified:
  soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c

Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c
==============================================================================
--- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c	Mon Jun 27 09:34:03 2016	(r305576)
+++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c	Mon Jun 27 09:34:12 2016	(r305577)
@@ -417,6 +417,18 @@
 ptnet_detach(device_t dev)
 {
 	struct ptnet_softc *sc = device_get_softc(dev);
+	int i;
+
+	if (sc->queues) {
+		/* Drain taskqueues before calling if_detach. */
+		for (i = 0; i < sc->num_rings; i++) {
+			struct ptnet_queue *pq = sc->queues + i;
+
+			if (pq->taskq) {
+				taskqueue_drain(pq->taskq, &pq->task);
+			}
+		}
+	}
 
 	if (sc->ifp) {
 		ether_ifdetach(sc->ifp);
@@ -441,8 +453,6 @@
 	}
 
 	if (sc->queues) {
-		int i;
-
 		for (i = 0; i < sc->num_rings; i++) {
 			struct ptnet_queue *pq = sc->queues + i;
 
@@ -943,7 +953,7 @@
                 /* Double check. */
 		ptnet_sync_tail(ptring, kring);
 		if (unlikely(head != ring->tail)) {
-			RD(1, "Doublecheck finds more slots");
+			RD(1, "Found more slots by doublecheck");
 			/* More slots were freed before reactivating
 			 * the interrupts. */
 			ptring->guest_need_kick = 0;


More information about the svn-soc-all mailing list