From: Eric Blake <eblake@redhat.com>
To: "Kővágó, Zoltán" <dirty.ice.hu@gmail.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Vincenzo Maffione <v.maffione@gmail.com>,
Markus Armbruster <armbru@redhat.com>,
Max Filippov <jcmvbkbc@gmail.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Dmitry Fleytman <dmitry@daynix.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
Rob Herring <robh@kernel.org>, Alexander Graf <agraf@suse.de>,
Scott Feldman <sfeldma@gmail.com>, Jiri Pirko <jiri@resnulli.us>,
Jan Kiszka <jan.kiszka@web.de>,
Stefan Hajnoczi <stefanha@redhat.com>,
Giuseppe Lettieri <g.lettieri@iet.unipi.it>,
Luiz Capitulino <lcapitulino@redhat.com>,
Luigi Rizzo <rizzo@iet.unipi.it>,
David Gibson <david@gibson.dropbear.id.au>,
Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
Michael Walle <michael@walle.cc>,
"open list:sPAPR (pseries)" <qemu-ppc@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2 06/49] qapi: change Netdev into a flat union
Date: Fri, 4 Sep 2015 17:13:55 -0600 [thread overview]
Message-ID: <55EA25B3.2050204@redhat.com> (raw)
In-Reply-To: <e57724e93425f0c5fbda4755396c246b1ab6a1d2.1440171025.git.DirtY.iCE.hu@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4930 bytes --]
On 08/21/2015 09:37 AM, Kővágó, Zoltán wrote:
> Except qapi-schema.json, this patch was generated by:
>
> find . -name .git -prune -o -type f \! -name '*~' -print0 | \
> xargs -0 sed -i \
> -e 's/NetClientOptionsKind/NetClientDriver/g' \
> -e 's/NET_CLIENT_OPTIONS_KIND_/NET_CLIENT_DRIVER_/g' \
Same question as in 3 about whether 'driver' is the right name for the
new enum.
> -e 's/netdev->opts/netdev/g'
>
> Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
> ---
> qapi-schema.json | 36 +++++++++++------
> 45 files changed, 166 insertions(+), 154 deletions(-)
So the bulk is mechanical 1:1 replacement, and the qapi change adds a
net of 12 lines.
>
> diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
> index 42f66b3..94bdf5f 100644
> --- a/hw/arm/musicpal.c
> +++ b/hw/arm/musicpal.c
> @@ -374,7 +374,7 @@ static void eth_cleanup(NetClientState *nc)
> }
>
> static NetClientInfo net_mv88w8618_info = {
> - .type = NET_CLIENT_OPTIONS_KIND_NIC,
> + .type = NET_CLIENT_DRIVER_NIC,
You know, if we could teach qapi to allow a user-named type with 'Kind'
as the suffix, we wouldn't have quite as much churn :)
> +++ b/qapi-schema.json
> @@ -2474,16 +2474,31 @@
> '*vhostforce': 'bool' } }
>
> ##
> -# @NetClientOptions
> +# @NetClientDriver
> #
> -# A discriminated record of network device traits.
> +# Available netdev drivers.
> +#
> +# Since 2.5
> +##
> +{ 'enum': 'NetClientDriver',
> + 'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde', 'dump',
> + 'bridge', 'hubport', 'netmap', 'vhost-user' ] }
Hmm; maybe 'Driver' really is the right name for this enum.
> +
> +##
> +# @Netdev
> +#
> +# Captures the configuration of a network device.
> #
> # Since 1.2
> #
> # 'l2tpv3' - since 2.1
> +# @id #optional - since 2.5
> +# @vlan, @name - since 2.5
I'd document id and vlan prior to the initial 'Since 1.2', then leave
the only thing after that line to be just the list of when later drivers
were added to the union. Actually, depending on what I decide about
4/49, we may not even be adding vlan and name, and id might not be
optional, since that was just NetdevLegacy. And if we do merge
NetdevLegacy, then it's better to have separate lines for @vlan and
@name, as well as the documentation of when they can be set.
> #
> ##
> -{ 'union': 'NetClientOptions',
> +{ 'union': 'Netdev',
> + 'base': 'NetdevBase',
> + 'discriminator': 'type',
> 'data': {
> 'none': 'NetdevNoneOptions',
> 'nic': 'NetLegacyNicOptions',
> @@ -2499,9 +2514,9 @@
> 'vhost-user': 'NetdevVhostUserOptions' } }
QMP wise (if we were to use Netdev in QMP), this is changing:
{ "command":"foo", "arguments": {
"id":"abc", "opts" { "type":"dump", "data": {
"len":1024, "file":"/path/to/foo" } } } }
into
{ "command":"foo", "arguments": {
"id":"abc", "type":"dump",
"len":1024, "file":"/path/to/foo" } }
Wow - removing two levels of nesting in one patch. Even cooler, this
LOOKS a lot like what QMP 'netdev_add' already parses :)
The corresponding C code loses one layer of boxing (because, as I
already pointed out on 3, converting from simple to flat union without
creating data wrappers loses one layer of nesting in QMP with no change
to the nesting in the matching generated C structure).
So, if we can _avoid_ merging in NetdevLegacy stuff here (but that has
knock-on effects, because my hack to use 5/49 without 4/49 doesn't quite
work with the sed statement you used here), then you have just created
the solution for netdev_add. I'll use your patch as a starting point,
coupled with my pending work to allow a boxed flat union as the direct
argument to a QMP command.
>
> ##
> -# @Netdev
> +# @NetdevBase
> #
> -# Captures the configuration of a network device.
> +# Captures the common configuration of a network device.
> #
> # @vlan: #optional vlan number (legacy, forbidden with -netdev)
> #
> @@ -2510,19 +2525,16 @@
> # @name: #optional identifier for monitor commands, ignored if @id is present
> # (legacy, forbidden with -netdev)
> #
> -# @opts: device type specific properties (legacy)
> +# @type: the netdev driver to use
> #
> -# Since 1.2
> -#
> -# @id #optional - since 2.5
> -# @vlan, @name - since 2.5
> +# Since 2.5
> ##
> -{ 'struct': 'Netdev',
> +{ 'struct': 'NetdevBase',
> 'data': {
> '*vlan': 'int32',
> '*id': 'str',
> '*name': 'str',
> - 'opts': 'NetClientOptions' } }
> + 'type': 'NetClientDriver' } }
This is where I'm not completely sold that the merge from NetdevLegacy
makes sense. Like I said, I'm playing with it some on my tree.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2015-09-04 23:14 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-21 15:36 [Qemu-devel] [PATCH v2 00/49] audio: -audiodev option, multiple options Kővágó, Zoltán
2015-08-21 15:36 ` [Qemu-devel] [PATCH v2 01/49] opts: produce valid command line in qemu_opts_print Kővágó, Zoltán
2015-09-04 20:20 ` Eric Blake
2015-08-21 15:36 ` [Qemu-devel] [PATCH v2 02/49] qapi: support implicit structs in OptsVisitor Kővágó, Zoltán
2015-09-04 20:26 ` Eric Blake
2015-08-21 15:36 ` [Qemu-devel] [PATCH v2 03/49] qapi: convert NumaOptions into a flat union Kővágó, Zoltán
2015-08-21 23:13 ` Eduardo Habkost
2015-08-22 15:56 ` Kővágó Zoltán
2015-08-26 15:31 ` Eduardo Habkost
2015-09-04 21:11 ` Eric Blake
2015-09-04 21:02 ` Eric Blake
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 04/49] net: remove NetLegacy struct Kővágó, Zoltán
2015-09-04 21:25 ` Eric Blake
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 05/49] net: use Netdev instead of NetClientOptions in client init Kővágó, Zoltán
2015-09-04 21:36 ` Eric Blake
2015-09-04 21:49 ` Eric Blake
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 06/49] qapi: change Netdev into a flat union Kővágó, Zoltán
2015-09-04 23:13 ` Eric Blake [this message]
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 07/49] qapi: reorder NetdevBase and Netdev Kővágó, Zoltán
2015-09-04 23:18 ` Eric Blake
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 08/49] qapi: qapi for audio backends Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 09/49] qapi: support nested structs in OptsVisitor Kővágó, Zoltán
2015-09-04 23:21 ` Eric Blake
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 10/49] audio: use qapi AudioFormat instead of audfmt_e Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 11/49] audio: -audiodev command line option: documentation Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 12/49] audio: -audiodev command line option basic implementation Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 13/49] alsaaudio: port to -audiodev config Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 14/49] coreaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 15/49] dsoundaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 16/49] noaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 17/49] ossaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 18/49] paaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 19/49] sdlaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 20/49] spiceaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 21/49] wavaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 22/49] audio: -audiodev command line option: cleanup Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 23/49] audio: reduce glob_audio_state usage Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 24/49] audio: basic support for multi backend audio Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 25/49] audio: add audiodev properties to frontends Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 26/49] audio: audiodev= parameters no longer optional when -audiodev present Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 27/49] paaudio: do not create multiple connections to the same server Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 28/49] paaudio: do not move stream when sink/source name is specified Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 29/49] paaudio: properly disconnect streams in fini_* Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 30/49] audio: remove audio_MIN, audio_MAX Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 31/49] audio: do not run each backend in audio_run Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 32/49] paaudio: fix playback glitches Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 33/49] audio: remove read and write pcm_ops Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 34/49] audio: use size_t where makes sense Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 35/49] audio: api for mixeng code free backends Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 36/49] alsaaudio: port to the new audio backend api Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 37/49] coreaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 38/49] dsoundaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 39/49] noaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 40/49] ossaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 41/49] paaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 42/49] sdlaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 44/49] wavaudio: " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 45/49] audio: remove remains of the old " Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 46/49] audio: unify input and output mixeng buffer management Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 47/49] audio: remove hw->samples, buffer_size_in/out pcm_ops Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 48/49] audio: common rate control code for timer based outputs Kővágó, Zoltán
2015-08-21 15:37 ` [Qemu-devel] [PATCH v2 49/49] audio: split ctl_* functions into enable_* and volume_* Kővágó, Zoltán
2015-09-03 10:15 ` [Qemu-devel] [PATCH v2 00/49] audio: -audiodev option, multiple options Gerd Hoffmann
2015-09-03 12:52 ` Kővágó Zoltán
2015-09-03 15:07 ` Eric Blake
2015-09-06 16:38 ` Kővágó Zoltán
2015-09-07 6:49 ` Markus Armbruster
2015-09-03 10:42 ` Gerd Hoffmann
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=55EA25B3.2050204@redhat.com \
--to=eblake@redhat.com \
--cc=agraf@suse.de \
--cc=armbru@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=dirty.ice.hu@gmail.com \
--cc=dmitry@daynix.com \
--cc=edgar.iglesias@gmail.com \
--cc=g.lettieri@iet.unipi.it \
--cc=jan.kiszka@web.de \
--cc=jasowang@redhat.com \
--cc=jcmvbkbc@gmail.com \
--cc=jiri@resnulli.us \
--cc=kraxel@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=michael@walle.cc \
--cc=mst@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rizzo@iet.unipi.it \
--cc=robh@kernel.org \
--cc=sfeldma@gmail.com \
--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).