From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NUpRX-0007iA-B7 for qemu-devel@nongnu.org; Tue, 12 Jan 2010 17:42:31 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NUpRS-0007eH-Kq for qemu-devel@nongnu.org; Tue, 12 Jan 2010 17:42:31 -0500 Received: from [199.232.76.173] (port=41151 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NUpRS-0007e7-Fq for qemu-devel@nongnu.org; Tue, 12 Jan 2010 17:42:26 -0500 Received: from qw-out-1920.google.com ([74.125.92.145]:47794) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NUpRS-0006JJ-4t for qemu-devel@nongnu.org; Tue, 12 Jan 2010 17:42:26 -0500 Received: by qw-out-1920.google.com with SMTP id 14so150488qwa.4 for ; Tue, 12 Jan 2010 14:42:25 -0800 (PST) Message-ID: <4B4CFACE.9010207@codemonkey.ws> Date: Tue, 12 Jan 2010 16:42:22 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <20100111172217.GJ11936@redhat.com> In-Reply-To: <20100111172217.GJ11936@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH-RFC 09/13] tap: add vhost/vhostfd options List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org On 01/11/2010 11:22 AM, Michael S. Tsirkin wrote: > Looks like order got mixed up: vhost_net header > is added by a follow-up patch. Will be fixed > in the next revision. > > Signed-off-by: Michael S. Tsirkin > --- > net.c | 8 ++++++++ > net/tap.c | 29 +++++++++++++++++++++++++++++ > qemu-options.hx | 4 +++- > 3 files changed, 40 insertions(+), 1 deletions(-) > > diff --git a/net.c b/net.c > index 6ef93e6..b942d03 100644 > --- a/net.c > +++ b/net.c > @@ -976,6 +976,14 @@ static struct { > .name = "vnet_hdr", > .type = QEMU_OPT_BOOL, > .help = "enable the IFF_VNET_HDR flag on the tap interface" > + }, { > + .name = "vhost", > + .type = QEMU_OPT_BOOL, > + .help = "enable vhost-net network accelerator", > + }, { > + .name = "vhostfd", > + .type = QEMU_OPT_STRING, > + .help = "file descriptor of an already opened vhost net device", > }, > #endif /* _WIN32 */ > { /* end of list */ } > diff --git a/net/tap.c b/net/tap.c > index 7e9ca79..d9f2e41 100644 > --- a/net/tap.c > +++ b/net/tap.c > @@ -41,6 +41,8 @@ > > #include "net/tap-linux.h" > > +#include "hw/vhost_net.h" > + > /* Maximum GSO packet size (64k) plus plenty of room for > * the ethernet and virtio_net headers > */ > @@ -57,6 +59,7 @@ typedef struct TAPState { > unsigned int has_vnet_hdr : 1; > unsigned int using_vnet_hdr : 1; > unsigned int has_ufo: 1; > + struct vhost_net *vhost_net; > } TAPState; > > static int launch_script(const char *setup_script, const char *ifname, int fd); > @@ -252,6 +255,10 @@ static void tap_cleanup(VLANClientState *nc) > { > TAPState *s = DO_UPCAST(TAPState, nc, nc); > > + if (s->vhost_net) { > + vhost_net_cleanup(s->vhost_net); > + } > + > qemu_purge_queued_packets(nc); > > if (s->down_script[0]) > @@ -307,6 +314,7 @@ static TAPState *net_tap_fd_init(VLANState *vlan, > s->has_ufo = tap_probe_has_ufo(s->fd); > tap_set_offload(&s->nc, 0, 0, 0, 0, 0); > tap_read_poll(s, 1); > + s->vhost_net = NULL; > return s; > } > > @@ -456,6 +464,27 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan > } > } > > + if (qemu_opt_get_bool(opts, "vhost", 0)) { > + int vhostfd, r; > + if (qemu_opt_get(opts, "vhostfd")) { > + r = net_handle_fd_param(mon, qemu_opt_get(opts, "vhostfd")); > + if (r == -1) { > + return -1; > + } > + vhostfd = r; > + } else { > + vhostfd = -1; > + } > + s->vhost_net = vhost_net_init(&s->nc, vhostfd); > Hrm, I don't see a patch that introduces this function? Am I missing something obvious? Regards, Anthony Liguori