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 <v.maffi...@gmail.com> > --- > 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 <net/if.h> > #include <net/netmap.h> > #include <net/netmap_user.h> > +#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.