From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG96j-0008AX-Pr for qemu-devel@nongnu.org; Wed, 19 Feb 2014 10:30:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WG96b-0000tp-22 for qemu-devel@nongnu.org; Wed, 19 Feb 2014 10:30:45 -0500 Received: from mail-wg0-x236.google.com ([2a00:1450:400c:c00::236]:49388) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG96a-0000tj-RX for qemu-devel@nongnu.org; Wed, 19 Feb 2014 10:30:36 -0500 Received: by mail-wg0-f54.google.com with SMTP id l18so467458wgh.9 for ; Wed, 19 Feb 2014 07:30:31 -0800 (PST) Date: Wed, 19 Feb 2014 16:30:28 +0100 From: Stefan Hajnoczi Message-ID: <20140219153028.GA6495@stefanha-thinkpad.muc.redhat.com> References: <1392396024-32420-1-git-send-email-v.maffione@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1392396024-32420-1-git-send-email-v.maffione@gmail.com> Subject: Re: [Qemu-devel] [PATCH] net: Disable netmap backend when not supported List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vincenzo Maffione Cc: peter.maydell@linaro.org, aliguori@amazon.com, qemu-devel@nongnu.org, stefanha@redhat.com, pbonzini@redhat.com, g.lettieri@iet.unipi.it, rizzo@iet.unipi.it, rth@twiddle.net On Fri, Feb 14, 2014 at 05:40:24PM +0100, Vincenzo Maffione wrote: > This patch fixes configure so that netmap is not compiled in if the > host doesn't support an API version >= 11. > > Moreover, some modifications have been done to net/netmap.c in > order to reflect the current netmap API (11). > > Signed-off-by: Vincenzo Maffione > --- > configure | 3 +++ > net/netmap.c | 57 ++++++++++++++------------------------------------------- > 2 files changed, 17 insertions(+), 43 deletions(-) > > diff --git a/configure b/configure > index 88133a1..61eb932 100755 > --- a/configure > +++ b/configure > @@ -2118,6 +2118,9 @@ if test "$netmap" != "no" ; then > #include > #include > #include > +#if (NETMAP_API < 11) || (NETMAP_API > 15) > +#error > +#endif Why error when NETMAP_API > 15? > @@ -56,31 +58,6 @@ typedef struct NetmapState { > struct iovec iov[IOV_MAX]; > } NetmapState; > > -#define D(format, ...) \ > - do { \ > - struct timeval __xxts; \ > - gettimeofday(&__xxts, NULL); \ > - printf("%03d.%06d %s [%d] " format "\n", \ > - (int)__xxts.tv_sec % 1000, (int)__xxts.tv_usec, \ > - __func__, __LINE__, ##__VA_ARGS__); \ > - } while (0) > - > -/* Rate limited version of "D", lps indicates how many per second */ > -#define RD(lps, format, ...) \ > - do { \ > - static int t0, __cnt; \ > - struct timeval __xxts; \ > - gettimeofday(&__xxts, NULL); \ > - if (t0 != __xxts.tv_sec) { \ > - t0 = __xxts.tv_sec; \ > - __cnt = 0; \ > - } \ > - if (__cnt++ < lps) { \ > - D(format, ##__VA_ARGS__); \ > - } \ > - } while (0) > - > - > #ifndef __FreeBSD__ > #define pkt_copy bcopy > #else Why are you deleting this? > @@ -237,7 +214,7 @@ static ssize_t netmap_receive(NetClientState *nc, > return size; > } > > - if (ring->avail == 0) { > + if (nm_ring_empty(ring)) { > /* No available slots in the netmap TX ring. */ > netmap_write_poll(s, true); > return 0; > @@ -250,8 +227,7 @@ static ssize_t netmap_receive(NetClientState *nc, > ring->slot[i].len = size; > ring->slot[i].flags = 0; > pkt_copy(buf, dst, size); > - ring->cur = NETMAP_RING_NEXT(ring, i); > - ring->avail--; > + ring->cur = ring->head = nm_ring_next(ring, i); > ioctl(s->me.fd, NIOCTXSYNC, NULL); > > return size; Are these changes related to the NETMAP_WITH_LIBS macro? Please do that in a separate patch so we keep the version checking change separate from the NETMAP_WITH_LIBS change.