From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wtzrl-0003hv-Jl for qemu-devel@nongnu.org; Mon, 09 Jun 2014 09:44:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wtzrf-00037w-N8 for qemu-devel@nongnu.org; Mon, 09 Jun 2014 09:44:01 -0400 Received: from mail-qa0-f43.google.com ([209.85.216.43]:39237) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wtzrf-00037o-8A for qemu-devel@nongnu.org; Mon, 09 Jun 2014 09:43:55 -0400 Received: by mail-qa0-f43.google.com with SMTP id m5so7809539qaj.2 for ; Mon, 09 Jun 2014 06:43:54 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20140609133159.GB6239@redhat.com> References: <20140527120050.15172.94908.stgit@3820> <20140527120638.15172.80806.stgit@3820> <20140605103710.1246d6c3@redhat.com> <20140609133159.GB6239@redhat.com> From: Nikolay Nikolaev Date: Mon, 9 Jun 2014 16:43:33 +0300 Message-ID: Content-Type: multipart/alternative; boundary=047d7beb9fd8f223ba04fb676698 Subject: Re: [Qemu-devel] [snabb-devel] Re: [PATCH v10 15/18] Add the vhost-user netdev backend to the command line List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "snabb-devel@googlegroups.com" Cc: Antonios Motakis , Luke Gorrie , VirtualOpenSystems Technical Team , qemu-devel --047d7beb9fd8f223ba04fb676698 Content-Type: text/plain; charset=UTF-8 On Mon, Jun 9, 2014 at 4:31 PM, Michael S. Tsirkin wrote: > On Mon, Jun 09, 2014 at 04:28:23PM +0300, Nikolay Nikolaev wrote: > > Hello, > > > > > > On Thu, Jun 5, 2014 at 5:37 PM, Luiz Capitulino > wrote: > > > > On Tue, 27 May 2014 15:06:43 +0300 > > Nikolay Nikolaev wrote: > > > > > The supplied chardev id will be inspected for supported options. > Only > > > a socket backend, with a set path (i.e. a Unix socket) and > optionally > > > the server parameter set, will be allowed. Other options (nowait, > telnet) > > > will make the chardev unusable and the netdev will not be > initialised. > > > > > > Additional checks for validity: > > > - requires `-numa node,memdev=..` > > > - requires `-device virtio-net-*` > > > > > > The `vhostforce` option is used to force vhost-net when we deal > with > > > non-MSIX guests. > > > > > > Signed-off-by: Antonios Motakis > > > Signed-off-by: Nikolay Nikolaev > > > > > I gave a quick review and apart from some minor comments below it > seems > > good to me, but I think it would be good to have Eric's review too: > > > > Acked-by: Luiz Capitulino > > > > Thanks! > > > > > > > --- > > > hmp-commands.hx | 4 +- > > > hw/net/vhost_net.c | 4 ++ > > > net/hub.c | 1 > > > net/net.c | 25 ++++++----- > > > net/vhost-user.c | 114 > > +++++++++++++++++++++++++++++++++++++++++++++++++++- > > > qapi-schema.json | 19 ++++++++- > > > qemu-options.hx | 18 ++++++++ > > > 7 files changed, 169 insertions(+), 16 deletions(-) > > > > > > diff --git a/hmp-commands.hx b/hmp-commands.hx > > > index 8971f1b..ef3782c 100644 > > > --- a/hmp-commands.hx > > > +++ b/hmp-commands.hx > > > @@ -1205,7 +1205,7 @@ ETEXI > > > { > > > .name = "host_net_add", > > > .args_type = "device:s,opts:s?", > > > - .params = "tap|user|socket|vde|netmap|dump [options]", > > > + .params = "tap|user|socket|vde|netmap|vhost-user|dump > > [options]", > > > .help = "add host VLAN client", > > > .mhandler.cmd = net_host_device_add, > > > }, > > > @@ -1233,7 +1233,7 @@ ETEXI > > > { > > > .name = "netdev_add", > > > .args_type = "netdev:O", > > > - .params = > "[user|tap|socket|hubport|netmap],id=str[,prop= > > value][,...]", > > > + .params = > "[user|tap|socket|hubport|netmap|vhost-user],id= > > str[,prop=value][,...]", > > > .help = "add host network device", > > > .mhandler.cmd = hmp_netdev_add, > > > }, > > > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c > > > index 5f06736..7ac7c21 100644 > > > --- a/hw/net/vhost_net.c > > > +++ b/hw/net/vhost_net.c > > > @@ -15,6 +15,7 @@ > > > > > > #include "net/net.h" > > > #include "net/tap.h" > > > +#include "net/vhost-user.h" > > > > > > #include "hw/virtio/virtio-net.h" > > > #include "net/vhost_net.h" > > > @@ -360,6 +361,9 @@ VHostNetState *get_vhost_net(NetClientState > *nc) > > > case NET_CLIENT_OPTIONS_KIND_TAP: > > > vhost_net = tap_get_vhost_net(nc); > > > break; > > > + case NET_CLIENT_OPTIONS_KIND_VHOST_USER: > > > + vhost_net = vhost_user_get_vhost_net(nc); > > > + break; > > > default: > > > break; > > > } > > > diff --git a/net/hub.c b/net/hub.c > > > index 33a99c9..7e0f2d6 100644 > > > --- a/net/hub.c > > > +++ b/net/hub.c > > > @@ -322,6 +322,7 @@ void net_hub_check_clients(void) > > > case NET_CLIENT_OPTIONS_KIND_TAP: > > > case NET_CLIENT_OPTIONS_KIND_SOCKET: > > > case NET_CLIENT_OPTIONS_KIND_VDE: > > > + case NET_CLIENT_OPTIONS_KIND_VHOST_USER: > > > has_host_dev = 1; > > > break; > > > default: > > > diff --git a/net/net.c b/net/net.c > > > index 9db4dba..907f679 100644 > > > --- a/net/net.c > > > +++ b/net/net.c > > > @@ -769,23 +769,24 @@ static int (* const net_client_init_fun > > [NET_CLIENT_OPTIONS_KIND_MAX])( > > > const NetClientOptions *opts, > > > const char *name, > > > NetClientState *peer) = { > > > - [NET_CLIENT_OPTIONS_KIND_NIC] = net_init_nic, > > > + [NET_CLIENT_OPTIONS_KIND_NIC] = net_init_nic, > > > #ifdef CONFIG_SLIRP > > > - [NET_CLIENT_OPTIONS_KIND_USER] = net_init_slirp, > > > + [NET_CLIENT_OPTIONS_KIND_USER] = net_init_slirp, > > > #endif > > > - [NET_CLIENT_OPTIONS_KIND_TAP] = net_init_tap, > > > - [NET_CLIENT_OPTIONS_KIND_SOCKET] = net_init_socket, > > > + [NET_CLIENT_OPTIONS_KIND_TAP] = net_init_tap, > > > + [NET_CLIENT_OPTIONS_KIND_SOCKET] = net_init_socket, > > > #ifdef CONFIG_VDE > > > - [NET_CLIENT_OPTIONS_KIND_VDE] = net_init_vde, > > > + [NET_CLIENT_OPTIONS_KIND_VDE] = net_init_vde, > > > #endif > > > #ifdef CONFIG_NETMAP > > > - [NET_CLIENT_OPTIONS_KIND_NETMAP] = net_init_netmap, > > > + [NET_CLIENT_OPTIONS_KIND_NETMAP] = net_init_netmap, > > > #endif > > > - [NET_CLIENT_OPTIONS_KIND_DUMP] = net_init_dump, > > > + [NET_CLIENT_OPTIONS_KIND_DUMP] = net_init_dump, > > > #ifdef CONFIG_NET_BRIDGE > > > - [NET_CLIENT_OPTIONS_KIND_BRIDGE] = net_init_bridge, > > > + [NET_CLIENT_OPTIONS_KIND_BRIDGE] = net_init_bridge, > > > > These changes are unrelated. > > > > OK. Removing them. > > > > > > > #endif > > > - [NET_CLIENT_OPTIONS_KIND_HUBPORT] = net_init_hubport, > > > + [NET_CLIENT_OPTIONS_KIND_HUBPORT] = > net_init_hubport, > > > + [NET_CLIENT_OPTIONS_KIND_VHOST_USER] = > net_init_vhost_user, > > > }; > > > > > > > > > @@ -819,6 +820,7 @@ static int net_client_init1(const void > *object, int > > is_netdev, Error **errp) > > > case NET_CLIENT_OPTIONS_KIND_BRIDGE: > > > #endif > > > case NET_CLIENT_OPTIONS_KIND_HUBPORT: > > > + case NET_CLIENT_OPTIONS_KIND_VHOST_USER: > > > break; > > > > > > default: > > > @@ -902,11 +904,12 @@ static int net_host_check_device(const char > > *device) > > > , "bridge" > > > #endif > > > #ifdef CONFIG_SLIRP > > > - ,"user" > > > + , "user" > > > #endif > > > #ifdef CONFIG_VDE > > > - ,"vde" > > > + , "vde" > > > #endif > > > + , "vhost-user" > > > }; > > > for (i = 0; i < ARRAY_SIZE(valid_param_list); i++) { > > > if (!strncmp(valid_param_list[i], device, > > > diff --git a/net/vhost-user.c b/net/vhost-user.c > > > index 4bdd19d..69a5eb4 100644 > > > --- a/net/vhost-user.c > > > +++ b/net/vhost-user.c > > > @@ -12,6 +12,7 @@ > > > #include "net/vhost_net.h" > > > #include "net/vhost-user.h" > > > #include "sysemu/char.h" > > > +#include "qemu/config-file.h" > > > #include "qemu/error-report.h" > > > > > > typedef struct VhostUserState { > > > @@ -21,9 +22,17 @@ typedef struct VhostUserState { > > > VHostNetState *vhost_net; > > > } VhostUserState; > > > > > > +typedef struct VhostUserChardevProps { > > > + bool is_socket; > > > + bool is_unix; > > > + bool is_server; > > > + bool has_unsupported; > > > +} VhostUserChardevProps; > > > + > > > VHostNetState *vhost_user_get_vhost_net(NetClientState *nc) > > > { > > > VhostUserState *s = DO_UPCAST(VhostUserState, nc, nc); > > > + assert(nc->info->type == NET_CLIENT_OPTIONS_KIND_VHOST_USER); > > > return s->vhost_net; > > > } > > > > > > @@ -82,7 +91,7 @@ static bool vhost_user_has_ufo(NetClientState > *nc) > > > } > > > > > > static NetClientInfo net_vhost_user_info = { > > > - .type = 0, > > > + .type = NET_CLIENT_OPTIONS_KIND_VHOST_USER, > > > .size = sizeof(VhostUserState), > > > .cleanup = vhost_user_cleanup, > > > .has_vnet_hdr = vhost_user_has_vnet_hdr, > > > @@ -148,8 +157,109 @@ static int net_vhost_user_init(NetClientState > > *peer, const char *device, > > > return 0; > > > } > > > > > > +static int net_vhost_chardev_opts(const char *name, const char > *value, > > > + void *opaque) > > > +{ > > > + VhostUserChardevProps *props = opaque; > > > + > > > + if (strcmp(name, "backend") == 0 && strcmp(value, "socket") > == 0) { > > > + props->is_socket = 1; > > > + } else if (strcmp(name, "path") == 0) { > > > + props->is_unix = 1; > > > + } else if (strcmp(name, "server") == 0) { > > > + props->is_server = 1; > > > + } else { > > > + error_report("vhost-user does not support a chardev" > > > + " with the following option:\n %s = %s", > > > + name, value); > > > + props->has_unsupported = 1; > > > + return -1; > > > + } > > > + return 0; > > > +} > > > + > > > +static CharDriverState *net_vhost_parse_chardev( > > > + const NetdevVhostUserOptions *opts) > > > +{ > > > + CharDriverState *chr = qemu_chr_find(opts->chardev); > > > + VhostUserChardevProps props; > > > + > > > + if (chr == NULL) { > > > + error_report("chardev \"%s\" not found\n", opts->chardev); > > > + return 0; > > > + } > > > + > > > + /* inspect chardev opts */ > > > + memset(&props, 0, sizeof(props)); > > > + qemu_opt_foreach(chr->opts, net_vhost_chardev_opts, &props, > false); > > > + > > > + if (!props.is_socket || !props.is_unix) { > > > + error_report("chardev \"%s\" is not a unix socket\n", > > > + opts->chardev); > > > + return 0; > > > + } > > > + > > > + if (props.has_unsupported) { > > > + error_report("chardev \"%s\" has an unsupported option\n", > > > + opts->chardev); > > > + return 0; > > > + } > > > + > > > + qemu_chr_fe_claim_no_fail(chr); > > > + > > > + return chr; > > > +} > > > + > > > +static int net_vhost_check_net(QemuOpts *opts, void *opaque) > > > +{ > > > + const char *name = opaque; > > > + const char *driver, *netdev; > > > + const char virtio_name[] = "virtio-net-"; > > > + > > > + driver = qemu_opt_get(opts, "driver"); > > > + netdev = qemu_opt_get(opts, "netdev"); > > > + > > > + if (!driver || !netdev) { > > > + return 0; > > > + } > > > + > > > + if ((strcmp(netdev, name) == 0) > > > + && (strncmp(driver, virtio_name, strlen(virtio_name)) > != 0)) > > { > > > + error_report("vhost-user requires frontend driver > > virtio-net-*"); > > > + return -1; > > > + } > > > + > > > + return 0; > > > +} > > > + > > > int net_init_vhost_user(const NetClientOptions *opts, const char > *name, > > > NetClientState *peer) > > > { > > > - return net_vhost_user_init(peer, "vhost_user", 0, 0, 0); > > > + const NetdevVhostUserOptions *vhost_user_opts; > > > + CharDriverState *chr; > > > + bool vhostforce; > > > + > > > + assert(opts->kind == NET_CLIENT_OPTIONS_KIND_VHOST_USER); > > > + vhost_user_opts = opts->vhost_user; > > > + > > > + chr = net_vhost_parse_chardev(vhost_user_opts); > > > + if (!chr) { > > > + error_report("No suitable chardev found\n"); > > > + return -1; > > > + } > > > + > > > + /* verify net frontend */ > > > + if (qemu_opts_foreach(qemu_find_opts("device"), > net_vhost_check_net, > > > + (void *)name, true) == -1) { > > > + return -1; > > > + } > > > + > > > + /* vhostforce for non-MSIX */ > > > + if (vhost_user_opts->has_vhostforce) { > > > + vhostforce = vhost_user_opts->vhostforce; > > > + } else { > > > + vhostforce = false; > > > + } > > > + > > > + return net_vhost_user_init(peer, "vhost_user", name, chr, > > vhostforce); > > > } > > > diff --git a/qapi-schema.json b/qapi-schema.json > > > index 1f28177..f458dd8 100644 > > > --- a/qapi-schema.json > > > +++ b/qapi-schema.json > > > @@ -3264,6 +3264,22 @@ > > > '*devname': 'str' } } > > > > > > ## > > > +# @NetdevVhostUserOptions > > > +# > > > +# Vhost-user network backend > > > +# > > > +# @path: control socket path > > > +# > > > +# @vhostforce: #optional vhost on for non-MSIX virtio guests > (default: > > false). > > > +# > > > +# Since 2.1 > > > +## > > > +{ 'type': 'NetdevVhostUserOptions', > > > + 'data': { > > > + 'chardev': 'str', > > > > chardev or path? > > > > Right, it's chardev. > > > > > > > + '*vhostforce': 'bool' } } > > > + > > > +## > > > # @NetClientOptions > > > # > > > # A discriminated record of network device traits. > > > @@ -3281,7 +3297,8 @@ > > > 'dump': 'NetdevDumpOptions', > > > 'bridge': 'NetdevBridgeOptions', > > > 'hubport': 'NetdevHubPortOptions', > > > - 'netmap': 'NetdevNetmapOptions' } } > > > + 'netmap': 'NetdevNetmapOptions', > > > + 'vhost-user': 'NetdevVhostUserOptions' } } > > > > > > ## > > > # @NetLegacy > > > diff --git a/qemu-options.hx b/qemu-options.hx > > > index 7f4ab83..2514264 100644 > > > --- a/qemu-options.hx > > > +++ b/qemu-options.hx > > > @@ -1459,6 +1459,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, > > > #ifdef CONFIG_NETMAP > > > "netmap|" > > > #endif > > > + "vhost-user|" > > > "socket|" > > > "hubport],id=str[,option][,option][,...]\n", QEMU_ARCH_ALL) > > > STEXI > > > @@ -1790,6 +1791,23 @@ The hubport netdev lets you connect a NIC > to a > > QEMU "vlan" instead of a single > > > netdev. @code{-net} and @code{-device} with parameter > @option{vlan} > > create the > > > required hub automatically. > > > > > > +@item -netdev vhost-user,chardev=@var{id}[,vhostforce=on|off] > > > + > > > +Establish a vhost-user netdev, backed by a chardev @var{id}. The > chardev > > should > > > +be a unix domain socket backed one. The vhost-user uses a > specifically > > defined > > > +protocol to pass vhost ioctl replacement messages to an > application on > > the other > > > +end of the socket. On non-MSIX guests, the feature can be forced > with > > > +@var{vhostforce}. > > > + > > > +Example: > > > +@example > > > +qemu -m 512 -object memory-file,id=mem,size=512M,mem-path=/ > > hugetlbfs,share=on \ > > > + -numa node,memdev=mem \ > > > + -chardev socket,path=/path/to/socket \ > > > + -netdev type=vhost-user,id=net0,chardev=chr0 \ > > > + -device virtio-net-pci,netdev=net0 > > > +@end example > > > + > > > @item -net dump[,vlan=@var{n}][,file=@var{file}][,len=@var{len}] > > > Dump network traffic on VLAN @var{n} to file @var{file} (@file > > {qemu-vlan0.pcap} by default). > > > At most @var{len} bytes (64k by default) per packet are stored. > The file > > format is > > > > > > > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "Snabb Switch development" group. > > To unsubscribe from this group and stop receiving emails from it, > send an > > email to snabb-devel+unsubscribe@googlegroups.com. > > To post to this group, send an email to snabb-devel@googlegroups.com > . > > Visit this group at http://groups.google.com/group/snabb-devel. > > > > > > regards, > > Nikolay Nikolaev > > > Pls remember to base on top of vhost branch in my tree, > this way you will not need to re-post merged patches. > OK - that's what we're doing. There are two questions though: - should we post with separate numbering - 15,16,18 will become 1/3, 2/3, 3/3? Or do you prefer to preserve the original numbering? - We can not test it. Probably we get something wrong, but vhost-user-v10 was rebased on Hu Tao's NUMA v3.2 series. And it uses this on the command line to enalbe mmaped memory share flag (on HUGETLBFS): -object memory-file,id=mem,size=512M,mem-path=/hugetlbfs,share=on \ -numa node,memdev=mem \ Now, this does not work, which will break the qtest (patch 18). Maybe we misled you by saying it is rebased on memdev instead of naming it NUMA patchseries. > > If you want me to drop some merged patch from my tree, > include a revert and I'll figure it out. > > Will have this in mind - thanks. > -- > MST > > -- > You received this message because you are subscribed to the Google Groups > "Snabb Switch development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to snabb-devel+unsubscribe@googlegroups.com. > To post to this group, send an email to snabb-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/snabb-devel. > regards, Nikolay Nikolaev --047d7beb9fd8f223ba04fb676698 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



On Mon, Jun 9, 2014 at 4:31 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
On Mon, Jun 09, 2014 at 04:28:23PM +0300, Nikolay Nikolaev wrote:<= br> > Hello,
>
>
> On Thu, Jun 5, 2014 at 5:37 PM, Luiz Capitulino <
lcapitulino@redhat.com> wrote:
>
> =C2=A0 =C2=A0 On Tue, 27 May 2014 15:06:43 +0300
> =C2=A0 =C2=A0 Nikolay Nikolaev <n.nikolaev@virtualopensystems.com> wrote:
>
> =C2=A0 =C2=A0 > The supplied chardev id will be inspected for suppo= rted options. Only
> =C2=A0 =C2=A0 > a socket backend, with a set path (i.e. a Unix sock= et) and optionally
> =C2=A0 =C2=A0 > the server parameter set, will be allowed. Other op= tions (nowait, telnet)
> =C2=A0 =C2=A0 > will make the chardev unusable and the netdev will = not be initialised.
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > Additional checks for validity:
> =C2=A0 =C2=A0 > =C2=A0 - requires `-numa node,memdev=3D..`
> =C2=A0 =C2=A0 > =C2=A0 - requires `-device virtio-net-*`
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > The `vhostforce` option is used to force vhost-net = when we deal with
> =C2=A0 =C2=A0 > non-MSIX guests.
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com&g= t;
> =C2=A0 =C2=A0 > Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com= >
>
> =C2=A0 =C2=A0 I gave a quick review and apart from some minor comments= below it seems
> =C2=A0 =C2=A0 good to me, but I think it would be good to have Eric= 9;s review too:
>
> =C2=A0 =C2=A0 Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
>
> Thanks!
>
>
> =C2=A0 =C2=A0 > ---
> =C2=A0 =C2=A0 > =C2=A0hmp-commands.hx =C2=A0 =C2=A0| =C2=A0 =C2=A04= +-
> =C2=A0 =C2=A0 > =C2=A0hw/net/vhost_net.c | =C2=A0 =C2=A04 ++
> =C2=A0 =C2=A0 > =C2=A0net/hub.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|= =C2=A0 =C2=A01
> =C2=A0 =C2=A0 > =C2=A0net/net.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|= =C2=A0 25 ++++++-----
> =C2=A0 =C2=A0 > =C2=A0net/vhost-user.c =C2=A0 | =C2=A0114
> =C2=A0 =C2=A0 +++++++++++++++++++++++++++++++++++++++++++++++++++-
> =C2=A0 =C2=A0 > =C2=A0qapi-schema.json =C2=A0 | =C2=A0 19 ++++++++-=
> =C2=A0 =C2=A0 > =C2=A0qemu-options.hx =C2=A0 =C2=A0| =C2=A0 18 ++++= ++++
> =C2=A0 =C2=A0 > =C2=A07 files changed, 169 insertions(+), 16 deleti= ons(-)
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > diff --git a/hmp-commands.hx b/hmp-commands.hx
> =C2=A0 =C2=A0 > index 8971f1b..ef3782c 100644
> =C2=A0 =C2=A0 > --- a/hmp-commands.hx
> =C2=A0 =C2=A0 > +++ b/hmp-commands.hx
> =C2=A0 =C2=A0 > @@ -1205,7 +1205,7 @@ ETEXI
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0{
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.name =C2=A0 =C2= =A0 =C2=A0 =3D "host_net_add",
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.args_type =C2=A0= =3D "device:s,opts:s?",
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0.params =C2=A0 =C2=A0 = =3D "tap|user|socket|vde|netmap|dump [options]",
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0.params =C2=A0 =C2=A0 = =3D "tap|user|socket|vde|netmap|vhost-user|dump
> =C2=A0 =C2=A0 [options]",
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.help =C2=A0 =C2= =A0 =C2=A0 =3D "add host VLAN client",
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.mhandler.cmd =3D= net_host_device_add,
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0},
> =C2=A0 =C2=A0 > @@ -1233,7 +1233,7 @@ ETEXI
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0{
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.name =C2=A0 =C2= =A0 =C2=A0 =3D "netdev_add",
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.args_type =C2=A0= =3D "netdev:O",
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0.params =C2=A0 =C2=A0 = =3D "[user|tap|socket|hubport|netmap],id=3Dstr[,prop=3D
> =C2=A0 =C2=A0 value][,...]",
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0.params =C2=A0 =C2=A0 = =3D "[user|tap|socket|hubport|netmap|vhost-user],id=3D
> =C2=A0 =C2=A0 str[,prop=3Dvalue][,...]",
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.help =C2=A0 =C2= =A0 =C2=A0 =3D "add host network device",
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.mhandler.cmd =3D= hmp_netdev_add,
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0},
> =C2=A0 =C2=A0 > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.= c
> =C2=A0 =C2=A0 > index 5f06736..7ac7c21 100644
> =C2=A0 =C2=A0 > --- a/hw/net/vhost_net.c
> =C2=A0 =C2=A0 > +++ b/hw/net/vhost_net.c
> =C2=A0 =C2=A0 > @@ -15,6 +15,7 @@
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > =C2=A0#include "net/net.h"
> =C2=A0 =C2=A0 > =C2=A0#include "net/tap.h"
> =C2=A0 =C2=A0 > +#include "net/vhost-user.h"
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > =C2=A0#include "hw/virtio/virtio-net.h" > =C2=A0 =C2=A0 > =C2=A0#include "net/vhost_net.h"
> =C2=A0 =C2=A0 > @@ -360,6 +361,9 @@ VHostNetState *get_vhost_net(Ne= tClientState *nc)
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0case NET_CLIENT_OPTIONS_KIND_TA= P:
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0vhost_net =3D tap= _get_vhost_net(nc);
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0case NET_CLIENT_OPTIONS_KIND_VHOST_U= SER:
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0vhost_net =3D vhost_us= er_get_vhost_net(nc);
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0break;
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0default:
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break;
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 > diff --git a/net/hub.c b/net/hub.c
> =C2=A0 =C2=A0 > index 33a99c9..7e0f2d6 100644
> =C2=A0 =C2=A0 > --- a/net/hub.c
> =C2=A0 =C2=A0 > +++ b/net/hub.c
> =C2=A0 =C2=A0 > @@ -322,6 +322,7 @@ void net_hub_check_clients(void= )
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cas= e NET_CLIENT_OPTIONS_KIND_TAP:
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cas= e NET_CLIENT_OPTIONS_KIND_SOCKET:
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cas= e NET_CLIENT_OPTIONS_KIND_VDE:
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case NET= _CLIENT_OPTIONS_KIND_VHOST_USER:
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0has_host_dev =3D 1;
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0break;
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0def= ault:
> =C2=A0 =C2=A0 > diff --git a/net/net.c b/net/net.c
> =C2=A0 =C2=A0 > index 9db4dba..907f679 100644
> =C2=A0 =C2=A0 > --- a/net/net.c
> =C2=A0 =C2=A0 > +++ b/net/net.c
> =C2=A0 =C2=A0 > @@ -769,23 +769,24 @@ static int (* const net_clien= t_init_fun
> =C2=A0 =C2=A0 [NET_CLIENT_OPTIONS_KIND_MAX])(
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0const NetClientOptions *opts, > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0const char *name,
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0NetClientState *peer) =3D {
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_NIC] =C2=A0 =C2=A0 =C2=A0 =3D net_init_nic,
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_NIC] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D net_init_nic,
> =C2=A0 =C2=A0 > =C2=A0#ifdef CONFIG_SLIRP
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_USER] =C2=A0 =C2=A0 =C2=A0=3D net_init_slirp,
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_USER] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D net_init_slirp,
> =C2=A0 =C2=A0 > =C2=A0#endif
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_TAP] =C2=A0 =C2=A0 =C2=A0 =3D net_init_tap,
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_SOCKET] =C2=A0 =C2=A0=3D net_init_socket,
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_TAP] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D net_init_tap,
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_SOCKET] =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D net_init_socket,
> =C2=A0 =C2=A0 > =C2=A0#ifdef CONFIG_VDE
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_VDE] =C2=A0 =C2=A0 =C2=A0 =3D net_init_vde,
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_VDE] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D net_init_vde,
> =C2=A0 =C2=A0 > =C2=A0#endif
> =C2=A0 =C2=A0 > =C2=A0#ifdef CONFIG_NETMAP
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_NETMAP] =C2=A0 =C2=A0=3D net_init_netmap,
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_NETMAP] =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D net_init_netmap,
> =C2=A0 =C2=A0 > =C2=A0#endif
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_DUMP] =C2=A0 =C2=A0 =C2=A0=3D net_init_dump,
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_DUMP] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D net_init_dump,
> =C2=A0 =C2=A0 > =C2=A0#ifdef CONFIG_NET_BRIDGE
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_BRIDGE] =C2=A0 =C2=A0=3D net_init_bridge,
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_BRIDGE] =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D net_init_bridge,
>
> =C2=A0 =C2=A0 These changes are unrelated.
>
> OK. Removing them.
>
>
> =C2=A0 =C2=A0 > =C2=A0#endif
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_HUBPORT] =C2=A0 =3D net_init_hubport,
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_HUBPORT] =C2=A0 =C2=A0 =C2=A0 =3D net_init_hubport,
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0[NET_CLIENT_OPTIONS_KI= ND_VHOST_USER] =C2=A0 =C2=A0=3D net_init_vhost_user,
> =C2=A0 =C2=A0 > =C2=A0};
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > @@ -819,6 +820,7 @@ static int net_client_init1(con= st void *object, int
> =C2=A0 =C2=A0 is_netdev, Error **errp)
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case NET_CLIENT_O= PTIONS_KIND_BRIDGE:
> =C2=A0 =C2=A0 > =C2=A0#endif
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case NET_CLIENT_O= PTIONS_KIND_HUBPORT:
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0case NET_CLIENT_OPTION= S_KIND_VHOST_USER:
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0bre= ak;
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0default:
> =C2=A0 =C2=A0 > @@ -902,11 +904,12 @@ static int net_host_check_dev= ice(const char
> =C2=A0 =C2=A0 *device)
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 , "bridge"
> =C2=A0 =C2=A0 > =C2=A0#endif
> =C2=A0 =C2=A0 > =C2=A0#ifdef CONFIG_SLIRP
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 ,"user"
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 , "user"
> =C2=A0 =C2=A0 > =C2=A0#endif
> =C2=A0 =C2=A0 > =C2=A0#ifdef CONFIG_VDE
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 ,"vde"
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 , "vde"
> =C2=A0 =C2=A0 > =C2=A0#endif
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 , "vhost-user"
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0};
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0for (i =3D 0; i < ARRAY_SIZE= (valid_param_list); i++) {
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!strncmp(vali= d_param_list[i], device,
> =C2=A0 =C2=A0 > diff --git a/net/vhost-user.c b/net/vhost-user.c > =C2=A0 =C2=A0 > index 4bdd19d..69a5eb4 100644
> =C2=A0 =C2=A0 > --- a/net/vhost-user.c
> =C2=A0 =C2=A0 > +++ b/net/vhost-user.c
> =C2=A0 =C2=A0 > @@ -12,6 +12,7 @@
> =C2=A0 =C2=A0 > =C2=A0#include "net/vhost_net.h"
> =C2=A0 =C2=A0 > =C2=A0#include "net/vhost-user.h"
> =C2=A0 =C2=A0 > =C2=A0#include "sysemu/char.h"
> =C2=A0 =C2=A0 > +#include "qemu/config-file.h"
> =C2=A0 =C2=A0 > =C2=A0#include "qemu/error-report.h"
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > =C2=A0typedef struct VhostUserState {
> =C2=A0 =C2=A0 > @@ -21,9 +22,17 @@ typedef struct VhostUserState {<= br> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0VHostNetState *vhost_net;
> =C2=A0 =C2=A0 > =C2=A0} VhostUserState;
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > +typedef struct VhostUserChardevProps {
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0bool is_socket;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0bool is_unix;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0bool is_server;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0bool has_unsupported;
> =C2=A0 =C2=A0 > +} VhostUserChardevProps;
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > =C2=A0VHostNetState *vhost_user_get_vhost_net(NetCl= ientState *nc)
> =C2=A0 =C2=A0 > =C2=A0{
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0VhostUserState *s =3D DO_UPCAST= (VhostUserState, nc, nc);
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0assert(nc->info->type =3D=3D N= ET_CLIENT_OPTIONS_KIND_VHOST_USER);
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0return s->vhost_net;
> =C2=A0 =C2=A0 > =C2=A0}
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > @@ -82,7 +91,7 @@ static bool vhost_user_has_ufo(Ne= tClientState *nc)
> =C2=A0 =C2=A0 > =C2=A0}
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > =C2=A0static NetClientInfo net_vhost_user_info =3D = {
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0 =C2=A0 =C2=A0.type =3D 0,
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0.type =3D NET_CLIENT_O= PTIONS_KIND_VHOST_USER,
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.size =3D sizeof(= VhostUserState),
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.cleanup =3D vhos= t_user_cleanup,
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.has_vnet_hdr =3D= vhost_user_has_vnet_hdr,
> =C2=A0 =C2=A0 > @@ -148,8 +157,109 @@ static int net_vhost_user_ini= t(NetClientState
> =C2=A0 =C2=A0 *peer, const char *device,
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0return 0;
> =C2=A0 =C2=A0 > =C2=A0}
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > +static int net_vhost_chardev_opts(const char *name= , const char *value,
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0void *opaque)
> =C2=A0 =C2=A0 > +{
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0VhostUserChardevProps *props =3D opa= que;
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0if (strcmp(name, "backend"= ) =3D=3D 0 && strcmp(value, "socket") =3D=3D 0) {
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0props->is_socket = =3D 1;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0} else if (strcmp(name, "path&q= uot;) =3D=3D 0) {
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0props->is_unix =3D = 1;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0} else if (strcmp(name, "server= ") =3D=3D 0) {
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0props->is_server = =3D 1;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0} else {
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0error_report("vho= st-user does not support a chardev"
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 " with the following option:\n %s =3D %s", > =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 name, value);
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0props->has_unsuppor= ted =3D 1;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0return 0;
> =C2=A0 =C2=A0 > +}
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > +static CharDriverState *net_vhost_parse_chardev( > =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0const NetdevVhostUserO= ptions *opts)
> =C2=A0 =C2=A0 > +{
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0CharDriverState *chr =3D qemu_chr_fi= nd(opts->chardev);
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0VhostUserChardevProps props;
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0if (chr =3D=3D NULL) {
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0error_report("cha= rdev \"%s\" not found\n", opts->chardev);
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0/* inspect chardev opts */
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0memset(&props, 0, sizeof(props))= ;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0qemu_opt_foreach(chr->opts, net_v= host_chardev_opts, &props, false);
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0if (!props.is_socket || !props.is_un= ix) {
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0error_report("cha= rdev \"%s\" is not a unix socket\n",
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 opts->chardev);
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0if (props.has_unsupported) {
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0error_report("cha= rdev \"%s\" has an unsupported option\n",
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0opts->chardev);
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0qemu_chr_fe_claim_no_fail(chr);
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0return chr;
> =C2=A0 =C2=A0 > +}
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > +static int net_vhost_check_net(QemuOpts *opts, voi= d *opaque)
> =C2=A0 =C2=A0 > +{
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0const char *name =3D opaque;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0const char *driver, *netdev;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0const char virtio_name[] =3D "v= irtio-net-";
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0driver =3D qemu_opt_get(opts, "= driver");
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0netdev =3D qemu_opt_get(opts, "= netdev");
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0if (!driver || !netdev) {
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0if ((strcmp(netdev, name) =3D=3D 0)<= br> > =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&&am= p; (strncmp(driver, virtio_name, strlen(virtio_name)) !=3D 0))
> =C2=A0 =C2=A0 {
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0error_report("vho= st-user requires frontend driver
> =C2=A0 =C2=A0 virtio-net-*");
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0return 0;
> =C2=A0 =C2=A0 > +}
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > =C2=A0int net_init_vhost_user(const NetClientOption= s *opts, const char *name,
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 NetClientState *peer)
> =C2=A0 =C2=A0 > =C2=A0{
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0return net_vhost_user_init(peer, &qu= ot;vhost_user", 0, 0, 0);
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0const NetdevVhostUserOptions *vhost_= user_opts;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0CharDriverState *chr;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0bool vhostforce;
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0assert(opts->kind =3D=3D NET_CLIE= NT_OPTIONS_KIND_VHOST_USER);
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0vhost_user_opts =3D opts->vhost_u= ser;
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0chr =3D net_vhost_parse_chardev(vhos= t_user_opts);
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0if (!chr) {
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0error_report("No = suitable chardev found\n");
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0/* verify net frontend */
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0if (qemu_opts_foreach(qemu_find_opts= ("device"), net_vhost_check_net,
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(void *)name, true) =3D=3D -1) { > =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0/* vhostforce for non-MSIX */
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0if (vhost_user_opts->has_vhostfor= ce) {
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0vhostforce =3D vhost_u= ser_opts->vhostforce;
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0} else {
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 =C2=A0 =C2=A0vhostforce =3D false;<= br> > =C2=A0 =C2=A0 > + =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0return net_vhost_user_init(peer, &qu= ot;vhost_user", name, chr,
> =C2=A0 =C2=A0 vhostforce);
> =C2=A0 =C2=A0 > =C2=A0}
> =C2=A0 =C2=A0 > diff --git a/qapi-schema.json b/qapi-schema.json > =C2=A0 =C2=A0 > index 1f28177..f458dd8 100644
> =C2=A0 =C2=A0 > --- a/qapi-schema.json
> =C2=A0 =C2=A0 > +++ b/qapi-schema.json
> =C2=A0 =C2=A0 > @@ -3264,6 +3264,22 @@
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0'*devname': =C2=A0 =C2= =A0'str' } }
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > =C2=A0##
> =C2=A0 =C2=A0 > +# @NetdevVhostUserOptions
> =C2=A0 =C2=A0 > +#
> =C2=A0 =C2=A0 > +# Vhost-user network backend
> =C2=A0 =C2=A0 > +#
> =C2=A0 =C2=A0 > +# @path: control socket path
> =C2=A0 =C2=A0 > +#
> =C2=A0 =C2=A0 > +# @vhostforce: #optional vhost on for non-MSIX vir= tio guests (default:
> =C2=A0 =C2=A0 false).
> =C2=A0 =C2=A0 > +#
> =C2=A0 =C2=A0 > +# Since 2.1
> =C2=A0 =C2=A0 > +##
> =C2=A0 =C2=A0 > +{ 'type': 'NetdevVhostUserOptions'= ,
> =C2=A0 =C2=A0 > + =C2=A0'data': {
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0'chardev': =C2=A0 =C2=A0 =C2= =A0 =C2=A0'str',
>
> =C2=A0 =C2=A0 chardev or path?
>
> Right, it's chardev.
>
>
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0'*vhostforce': =C2=A0 =C2=A0= 'bool' } }
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > +##
> =C2=A0 =C2=A0 > =C2=A0# @NetClientOptions
> =C2=A0 =C2=A0 > =C2=A0#
> =C2=A0 =C2=A0 > =C2=A0# A discriminated record of network device tr= aits.
> =C2=A0 =C2=A0 > @@ -3281,7 +3297,8 @@
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0'dump': =C2=A0 =C2=A0 &= #39;NetdevDumpOptions',
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0'bridge': =C2=A0 'N= etdevBridgeOptions',
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0'hubport': =C2=A0'N= etdevHubPortOptions',
> =C2=A0 =C2=A0 > - =C2=A0 =C2=A0'netmap': =C2=A0 'Netdev= NetmapOptions' } }
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0'netmap': =C2=A0 'Netdev= NetmapOptions',
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0'vhost-user': 'NetdevVho= stUserOptions' } }
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > =C2=A0##
> =C2=A0 =C2=A0 > =C2=A0# @NetLegacy
> =C2=A0 =C2=A0 > diff --git a/qemu-options.hx b/qemu-options.hx
> =C2=A0 =C2=A0 > index 7f4ab83..2514264 100644
> =C2=A0 =C2=A0 > --- a/qemu-options.hx
> =C2=A0 =C2=A0 > +++ b/qemu-options.hx
> =C2=A0 =C2=A0 > @@ -1459,6 +1459,7 @@ DEF("netdev", HAS_A= RG, QEMU_OPTION_netdev,
> =C2=A0 =C2=A0 > =C2=A0#ifdef CONFIG_NETMAP
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0"netmap|"
> =C2=A0 =C2=A0 > =C2=A0#endif
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0"vhost-user|"
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0"socket|"
> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0"hubport],id=3Dstr[,option= ][,option][,...]\n", QEMU_ARCH_ALL)
> =C2=A0 =C2=A0 > =C2=A0STEXI
> =C2=A0 =C2=A0 > @@ -1790,6 +1791,23 @@ The hubport netdev lets you = connect a NIC to a
> =C2=A0 =C2=A0 QEMU "vlan" instead of a single
> =C2=A0 =C2=A0 > =C2=A0netdev. =C2=A0@code{-net} and @code{-device} = with parameter @option{vlan}
> =C2=A0 =C2=A0 create the
> =C2=A0 =C2=A0 > =C2=A0required hub automatically.
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > +@item -netdev vhost-user,chardev=3D@var{id}[,vhost= force=3Don|off]
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > +Establish a vhost-user netdev, backed by a chardev= @var{id}. The chardev
> =C2=A0 =C2=A0 should
> =C2=A0 =C2=A0 > +be a unix domain socket backed one. The vhost-user= uses a specifically
> =C2=A0 =C2=A0 defined
> =C2=A0 =C2=A0 > +protocol to pass vhost ioctl replacement messages = to an application on
> =C2=A0 =C2=A0 the other
> =C2=A0 =C2=A0 > +end of the socket. On non-MSIX guests, the feature= can be forced with
> =C2=A0 =C2=A0 > +@var{vhostforce}.
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > +Example:
> =C2=A0 =C2=A0 > +@example
> =C2=A0 =C2=A0 > +qemu -m 512 -object memory-file,id=3Dmem,size=3D51= 2M,mem-path=3D/
> =C2=A0 =C2=A0 hugetlbfs,share=3Don \
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 -numa node,memdev=3Dmem \
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 -chardev socket,path=3D/path/to/soc= ket \
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 -netdev type=3Dvhost-user,id=3Dnet0= ,chardev=3Dchr0 \
> =C2=A0 =C2=A0 > + =C2=A0 =C2=A0 -device virtio-net-pci,netdev=3Dnet= 0
> =C2=A0 =C2=A0 > +@end example
> =C2=A0 =C2=A0 > +
> =C2=A0 =C2=A0 > =C2=A0@item -net dump[,vlan=3D@var{n}][,file=3D@var= {file}][,len=3D@var{len}]
> =C2=A0 =C2=A0 > =C2=A0Dump network traffic on VLAN @var{n} to file = @var{file} (@file
> =C2=A0 =C2=A0 {qemu-vlan0.pcap} by default).
> =C2=A0 =C2=A0 > =C2=A0At most @var{len} bytes (64k by default) per = packet are stored. The file
> =C2=A0 =C2=A0 format is
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 >
>
> =C2=A0 =C2=A0 --
> =C2=A0 =C2=A0 You received this message because you are subscribed to = the Google Groups
> =C2=A0 =C2=A0 "Snabb Switch development" group.
> =C2=A0 =C2=A0 To unsubscribe from this group and stop receiving emails= from it, send an
> =C2=A0 =C2=A0 email to snabb-devel+unsubscribe@googlegroups.com.
> =C2=A0 =C2=A0 To post to this group, send an email to snabb-devel@googlegroups.com.
> =C2=A0 =C2=A0 Visit this group at http://groups.google.com/group/snabb-d= evel.
>
>
> regards,
> Nikolay Nikolaev


Pls remember to base on top of vhost branch in my tree,
this way you will not need to re-post merged patches.
= =C2=A0
OK - that's what we're doing. There are two questi= ons though:

=C2=A0- should we post with separate numberin= g - 15,16,18 will become 1/3, 2/3, 3/3? Or do you prefer to preserve the or= iginal numbering?

=C2=A0- We can not test it. Probably we get something wrong,= but vhost-user-v10 was rebased on Hu Tao's NUMA v3.2 series. And it us= es
this on the command line to enalbe mmaped memory share fla= g (on HUGETLBFS):

=C2=A0 =C2=A0=C2=A0 -object memory-file,id=3Dmem,size=3D512M,mem-path= =3D/hugetlbfs,share=3Don \
=C2=A0 =C2=A0=C2=A0 -numa node,memdev=3Dmem \

Now= , this does not work, which will break the qtest (patch 18). Maybe we misle= d you by saying it is rebased on memdev instead of naming it NUMA patchseri= es.
=C2=A0

If you want me to drop some merged patch from my tree,
include a revert and I'll figure it out.

Will have this in mind - thanks.
--
MST

--
You received this message because you are subscribed to the Google Groups &= quot;Snabb Switch development" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to snabb= -devel+unsubscribe@googlegroups.com.
To post to this group, send an email to snabb-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/snabb-devel.

regards= ,
Nikolay Nikolaev
--047d7beb9fd8f223ba04fb676698--