qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Vincenzo Maffione <v.maffione@gmail.com>
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
Subject: Re: [Qemu-devel] [PATCH] net: Disable netmap backend when not supported
Date: Wed, 19 Feb 2014 16:30:28 +0100	[thread overview]
Message-ID: <20140219153028.GA6495@stefanha-thinkpad.muc.redhat.com> (raw)
In-Reply-To: <1392396024-32420-1-git-send-email-v.maffione@gmail.com>

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.maffione@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.

  reply	other threads:[~2014-02-19 15:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 16:40 [Qemu-devel] [PATCH] net: Disable netmap backend when not supported Vincenzo Maffione
2014-02-19 15:30 ` Stefan Hajnoczi [this message]
2014-02-19 15:57   ` Vincenzo Maffione
2014-02-20  9:49     ` Stefan Hajnoczi
2014-02-21 19:44       ` Luigi Rizzo
2014-02-19 18:30   ` Luigi Rizzo
2014-02-20  9:46     ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140219153028.GA6495@stefanha-thinkpad.muc.redhat.com \
    --to=stefanha@gmail.com \
    --cc=aliguori@amazon.com \
    --cc=g.lettieri@iet.unipi.it \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rizzo@iet.unipi.it \
    --cc=rth@twiddle.net \
    --cc=stefanha@redhat.com \
    --cc=v.maffione@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).