From owner-svn-src-all@FreeBSD.ORG Mon Jun 9 15:46:12 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2EEA5854; Mon, 9 Jun 2014 15:46:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10FF02460; Mon, 9 Jun 2014 15:46:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s59FkBJs078820; Mon, 9 Jun 2014 15:46:11 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s59FkBAt078819; Mon, 9 Jun 2014 15:46:11 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201406091546.s59FkBAt078819@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 9 Jun 2014 15:46:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267284 - head/sys/dev/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jun 2014 15:46:12 -0000 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); + } } }