Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Jun 2016 09:34:12 GMT
From:      vincenzo@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r305577 - soc2016/vincenzo/head/sys/dev/netmap
Message-ID:  <201606270934.u5R9YCTn027612@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606270934.u5R9YCTn027612>