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

next in thread | raw e-mail | index | archive | help
Author: vincenzo
Date: Mon Jun 27 12:48:55 2016
New Revision: 305588
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305588

Log:
   freebsd: ptnet_transmit: ptnet_sync_tail when running out of slots

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 12:48:45 2016	(r305587)
+++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c	Mon Jun 27 12:48:55 2016	(r305588)
@@ -1219,16 +1219,26 @@
 	ring = kring->ring;
 	lim = kring->nkr_num_slots - 1;
 
-	/* Update hwcur and hwtail (completed TX slots) as known by the host,
-	 * by reading from CSB. */
-	ptnet_sync_tail(ptring, kring);
-
+	/* Initialize transmission state variables. */
 	head = ring->head;
 	slot = ring->slot + head;
 	nmbuf = NMB(na, slot);
 	nmbuf_bytes = 0;
 
-	while (head != ring->tail) {
+	for (;;) {
+		if (head == ring->tail) {
+			/* We ran out of slot, let's see if the host has
+			 * freed up some, by reading hwcur and hwtail from
+			 * the CSB. */
+			ptnet_sync_tail(ptring, kring);
+		}
+
+		if (head == ring->tail) {
+			/* Still no slots available, let's stop and wait
+			 * for interrupts. */
+			break;
+		}
+
 		m = drbr_peek(ifp, pq->bufring);
 		if (!m) {
 			break;



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