Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jun 2014 15:46:11 +0000 (UTC)
From:      Luigi Rizzo <luigi@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267284 - head/sys/dev/netmap
Message-ID:  <201406091546.s59FkBAt078819@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: luigi
Date: Mon Jun  9 15:46:11 2014
New Revision: 267284
URL: http://svnweb.freebsd.org/changeset/base/267284

Log:
  Fixes from Fanco Ficthner on transparent mode
  
  * The way rings are updated changed with the last API bump.
    Also sync ->head when moving slots in netmap_sw_to_nic().
  
  * Remove a crashing selrecord() call.
  
  * Unclog the logic surrounding netmap_rxsync_from_host().
  
  * Add timestamping to RX host ring.
  
  * Remove a couple of obsolete comments.
  
  Submitted by:	Franco Fichtner
  MFC after:	3 days
  Sponsored by:	Packetwerk

Modified:
  head/sys/dev/netmap/netmap.c

Modified: head/sys/dev/netmap/netmap.c
==============================================================================
--- head/sys/dev/netmap/netmap.c	Mon Jun  9 15:44:31 2014	(r267283)
+++ head/sys/dev/netmap/netmap.c	Mon Jun  9 15:46:11 2014	(r267284)
@@ -981,7 +981,7 @@ netmap_sw_to_nic(struct netmap_adapter *
 			dst->len = tmp.len;
 			dst->flags = NS_BUF_CHANGED;
 
-			rdst->cur = nm_next(dst_cur, dst_lim);
+			rdst->head = rdst->cur = nm_next(dst_cur, dst_lim);
 		}
 		/* if (sent) XXX txsync ? */
 	}
@@ -1028,11 +1028,6 @@ netmap_txsync_to_host(struct netmap_adap
  * They have been put in kring->rx_queue by netmap_transmit().
  * We protect access to the kring using kring->rx_queue.lock
  *
- * This routine also does the selrecord if called from the poll handler
- * (we know because td != NULL).
- *
- * NOTE: on linux, selrecord() is defined as a macro and uses pwait
- *     as an additional hidden argument.
  * returns the number of packets delivered to tx queues in
  * transparent mode, or a negative value if error
  */
@@ -1088,10 +1083,6 @@ netmap_rxsync_from_host(struct netmap_ad
 
 	nm_rxsync_finalize(kring);
 
-	/* access copies of cur,tail in the kring */
-	if (kring->rcur == kring->rtail && td) /* no bufs available */
-		selrecord(td, &kring->si);
-
 	mbq_unlock(q);
 	return ret;
 }
@@ -2124,8 +2115,6 @@ do_retry_rx:
 			/*
 			 * transparent mode support: collect packets
 			 * from the rxring(s).
-			 * XXX NR_FORWARD should only be read on
-			 * physical or NIC ports
 			 */
 			if (netmap_fwd ||kring->ring->flags & NR_FORWARD) {
 				ND(10, "forwarding some buffers up %d to %d",
@@ -2152,13 +2141,12 @@ do_retry_rx:
 		/* transparent mode XXX only during first pass ? */
 		if (na->na_flags & NAF_HOST_RINGS) {
 			kring = &na->rx_rings[na->num_rx_rings];
-			if (check_all_rx
-			    && (netmap_fwd || kring->ring->flags & NR_FORWARD)) {
-				/* XXX fix to use kring fields */
-				if (nm_ring_empty(kring->ring))
-					send_down = netmap_rxsync_from_host(na, td, dev);
-				if (!nm_ring_empty(kring->ring))
-					revents |= want_rx;
+			if (netmap_fwd || kring->ring->flags & NR_FORWARD) {
+				send_down = netmap_rxsync_from_host(na, td, dev);
+				if (send_down && (netmap_no_timestamp == 0 ||
+				    kring->ring->flags & NR_TIMESTAMP)) {
+					microtime(&kring->ring->ts);
+				}
 			}
 		}
 



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