From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuKti-00080n-5w for qemu-devel@nongnu.org; Tue, 10 Jun 2014 08:11:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WuKtd-0005Kf-0u for qemu-devel@nongnu.org; Tue, 10 Jun 2014 08:11:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuKtc-0005KZ-NZ for qemu-devel@nongnu.org; Tue, 10 Jun 2014 08:11:20 -0400 Message-ID: <5396F5E4.6010900@redhat.com> Date: Tue, 10 Jun 2014 06:11:16 -0600 From: Eric Blake MIME-Version: 1.0 References: <20140610100157.11064.61717.stgit@3820> In-Reply-To: <20140610100157.11064.61717.stgit@3820> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="JvCLxa0DpiqelFdiRPGqVrdh6NOl8fj3V" Subject: Re: [Qemu-devel] [PATCH v10-fix 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: Nikolay Nikolaev , snabb-devel@googlegroups.com, qemu-devel@nongnu.org Cc: a.motakis@virtualopensystems.com, luke@snabb.co, tech@virtualopensystems.com, mst@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --JvCLxa0DpiqelFdiRPGqVrdh6NOl8fj3V Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/10/2014 04:02 AM, 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, telne= t) > will make the chardev unusable and the netdev will not be initialised. >=20 > Additional checks for validity: > - requires `-numa node,memdev=3D..` > - requires `-device virtio-net-*` >=20 > The `vhostforce` option is used to force vhost-net when we deal with > non-MSIX guests. Here you call it vhostforce...[1] > =20 > +static int net_vhost_chardev_opts(const char *name, const char *value,= > + void *opaque) > +{ > + VhostUserChardevProps *props =3D opaque; > + > + if (strcmp(name, "backend") =3D=3D 0 && strcmp(value, "socket") =3D= =3D 0) { > + props->is_socket =3D true; > + } else if (strcmp(name, "path") =3D=3D 0) { > + props->is_unix =3D true; > + } else if (strcmp(name, "server") =3D=3D 0) { > + props->is_server =3D true; > + } else { > + error_report("vhost-user does not support a chardev" > + " with the following option:\n %s =3D %s", > + name, value); > + props->has_unsupported =3D true; > + return -1; Here you reported an error...[2] > + } > + return 0; > +} > + > +static CharDriverState *net_vhost_parse_chardev(const NetdevVhostUserO= ptions *opts) > +{ > + CharDriverState *chr =3D qemu_chr_find(opts->chardev); > + VhostUserChardevProps props; > + > + if (chr =3D=3D NULL) { > + error_report("chardev \"%s\" not found", opts->chardev); > + return NULL; > + } > + > + /* 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", > + opts->chardev); > + return NULL; > + } > + > + if (props.has_unsupported) { > + error_report("chardev \"%s\" has an unsupported option", > + opts->chardev); > + return NULL; [2]...and again another error. One report is sufficient. For that matter, I highly doubt you even need a has_unsupported member - since you always error out early before allowing the device to be created, it is just redundant information and will always be false for any device that gets past creation without reporting an error. > +## > +{ 'type': 'NetdevVhostUserOptions', > + 'data': { > + 'chardev': 'str', > + '*vhost-force': 'bool' } } [1]...and here you call it vhost-force... > +Establish a vhost-user netdev, backed by a chardev @var{id}. The chard= ev 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}. [1]...yet document it as vhostforce. If this has already been applied, then you need to submit a followup patc= h. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --JvCLxa0DpiqelFdiRPGqVrdh6NOl8fj3V Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTlvXkAAoJEKeha0olJ0NquloIAJMR4HHhjAL4VbejqTLXMmvQ ir6Q6nkuFk4fPKpwlGR0k9LHH+sF1OltWTwafnawTe3aO0WqRdexrGnjcl9FUV61 xI6hrP/pLMl28qWY16KrIMjyxSC7En5Y1e1c0y0nwPsbWkafHOk/EJw8S2yIgNDx /JOjC8VIhfC6p4JiSbTFscS+1r3YRIAvMBoowVUvgjnsg4ljVW1jIwYyovAFqStO mY3kipS7l9YI9gB8wjMo93+5pVL86NkdG6yN5s4c5ktmxMiUo3BbQZe9mUhuyFGg j1chQLVdnHpk8Kph+0lH3IohhM3/co3OUUToSMvCId72zwfno2bIxRrnhbAqb/Q= =c7gL -----END PGP SIGNATURE----- --JvCLxa0DpiqelFdiRPGqVrdh6NOl8fj3V--