All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Alexey Kirillov <lekiravi@yandex-team.ru>,
	Jason Wang <jasowang@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Thomas Huth <thuth@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Stefan Weil <sw@weilnetz.de>,
	xen-devel@lists.xenproject.org,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Michael Roth <michael.roth@amd.com>, Paul Durrant <paul@xen.org>,
	qemu-devel@nongnu.org, Vincenzo Maffione <v.maffione@gmail.com>,
	yc-core@yandex-team.ru, Paolo Bonzini <pbonzini@redhat.com>,
	Anthony Perard <anthony.perard@citrix.com>,
	Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Giuseppe Lettieri <g.lettieri@iet.unipi.it>,
	Luigi Rizzo <rizzo@iet.unipi.it>
Subject: Re: [PATCH v6 1/5] qapi: net: Add query-netdev command
Date: Tue, 2 Mar 2021 13:10:47 -0600	[thread overview]
Message-ID: <79930db1-80fa-c810-7f72-131ec4671a71@redhat.com> (raw)
In-Reply-To: <20210302180205.5009-2-lekiravi@yandex-team.ru>

On 3/2/21 12:02 PM, Alexey Kirillov wrote:
> The query-netdev command is used to get the configuration of the current
> network device backends (netdevs).
> This is the QMP analog of the HMP command "info network" but only for netdevs
> (i.e. excluding NIC and hubports).
> 
> The query-netdev command returns an array of objects of the NetdevInfo type,
> which are an extension of Netdev type. It means that response can be used for
> netdev-add after small modification. This can be useful for recreate the same
> netdev configuration.
> 
> Information about the network device is filled in when it is created or
> modified and is available through the NetClientState->stored_config.
> 
> Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru>
> Acked-by: Markus Armbruster <armbru@redhat.com>
> ---

> +++ b/net/net.c

>  
> +NetdevInfoList *qmp_query_netdev(Error **errp)
> +{
> +    NetdevInfoList *list = NULL;
> +    NetClientState *nc;
> +
> +    QTAILQ_FOREACH(nc, &net_clients, next) {
> +        /*
> +         * Only look at netdevs (backend network devices), not for each queue
> +         * or NIC / hubport
> +         */
> +        if (nc->stored_config) {
> +            NetdevInfoList *node = g_new0(NetdevInfoList, 1);

Please use QAPI_LIST_PREPEND instead of open-coding it.

> +
> +            node->value = QAPI_CLONE(NetdevInfo, nc->stored_config);
> +            g_free(node->value->id); /* Need to dealloc default empty id */
> +            node->value->id = g_strdup(nc->name);
> +
> +            node->value->has_peer_id = nc->peer != NULL;
> +            if (node->value->has_peer_id) {
> +                node->value->peer_id = g_strdup(nc->peer->name);
> +            }
> +
> +            node->next = list;
> +            list = node;
> +        }
> +    }
> +

> +++ b/net/slirp.c
> @@ -345,6 +345,14 @@ static SaveVMHandlers savevm_slirp_state = {
>      .load_state = net_slirp_state_load,
>  };
>  
> +#define APPEND_STRINGLIST(tail, new_val) \
> +    do { \
> +        *(tail) = g_new0(StringList, 1); \
> +        (*(tail))->value = g_new0(String, 1); \
> +        (*(tail))->value->str = g_strdup((new_val)); \
> +        (tail) = &((*(tail))->next); \
> +    } while (0)

Please use QAPI_LIST_APPEND instead of re-coding it.

> +++ b/qapi/net.json
> @@ -714,3 +714,83 @@
>  ##
>  { 'event': 'FAILOVER_NEGOTIATED',
>    'data': {'device-id': 'str'} }
> +
> +##
> +# @NetBackend:
> +#
> +# Available netdev backend drivers.
> +#
> +# Since: 6.0
> +##
> +{ 'enum': 'NetBackend',
> +  'data': [ 'user', 'tap', 'l2tpv3', 'socket', 'vde', 'bridge', 'netmap',
> +            'vhost-user', 'vhost-vdpa' ] }

Is it worth alphabetizing this list?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



WARNING: multiple messages have this Message-ID (diff)
From: Eric Blake <eblake@redhat.com>
To: Alexey Kirillov <lekiravi@yandex-team.ru>,
	Jason Wang <jasowang@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Thomas Huth <thuth@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	Samuel Thibault <samuel.thibault@ens-lyon.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Michael Roth <michael.roth@amd.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Luigi Rizzo <rizzo@iet.unipi.it>,
	Giuseppe Lettieri <g.lettieri@iet.unipi.it>,
	Vincenzo Maffione <v.maffione@gmail.com>,
	Stefan Weil <sw@weilnetz.de>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Anthony Perard <anthony.perard@citrix.com>,
	Paul Durrant <paul@xen.org>,
	xen-devel@lists.xenproject.org, qemu-devel@nongnu.org,
	yc-core@yandex-team.ru
Subject: Re: [PATCH v6 1/5] qapi: net: Add query-netdev command
Date: Tue, 2 Mar 2021 13:10:47 -0600	[thread overview]
Message-ID: <79930db1-80fa-c810-7f72-131ec4671a71@redhat.com> (raw)
In-Reply-To: <20210302180205.5009-2-lekiravi@yandex-team.ru>

On 3/2/21 12:02 PM, Alexey Kirillov wrote:
> The query-netdev command is used to get the configuration of the current
> network device backends (netdevs).
> This is the QMP analog of the HMP command "info network" but only for netdevs
> (i.e. excluding NIC and hubports).
> 
> The query-netdev command returns an array of objects of the NetdevInfo type,
> which are an extension of Netdev type. It means that response can be used for
> netdev-add after small modification. This can be useful for recreate the same
> netdev configuration.
> 
> Information about the network device is filled in when it is created or
> modified and is available through the NetClientState->stored_config.
> 
> Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru>
> Acked-by: Markus Armbruster <armbru@redhat.com>
> ---

> +++ b/net/net.c

>  
> +NetdevInfoList *qmp_query_netdev(Error **errp)
> +{
> +    NetdevInfoList *list = NULL;
> +    NetClientState *nc;
> +
> +    QTAILQ_FOREACH(nc, &net_clients, next) {
> +        /*
> +         * Only look at netdevs (backend network devices), not for each queue
> +         * or NIC / hubport
> +         */
> +        if (nc->stored_config) {
> +            NetdevInfoList *node = g_new0(NetdevInfoList, 1);

Please use QAPI_LIST_PREPEND instead of open-coding it.

> +
> +            node->value = QAPI_CLONE(NetdevInfo, nc->stored_config);
> +            g_free(node->value->id); /* Need to dealloc default empty id */
> +            node->value->id = g_strdup(nc->name);
> +
> +            node->value->has_peer_id = nc->peer != NULL;
> +            if (node->value->has_peer_id) {
> +                node->value->peer_id = g_strdup(nc->peer->name);
> +            }
> +
> +            node->next = list;
> +            list = node;
> +        }
> +    }
> +

> +++ b/net/slirp.c
> @@ -345,6 +345,14 @@ static SaveVMHandlers savevm_slirp_state = {
>      .load_state = net_slirp_state_load,
>  };
>  
> +#define APPEND_STRINGLIST(tail, new_val) \
> +    do { \
> +        *(tail) = g_new0(StringList, 1); \
> +        (*(tail))->value = g_new0(String, 1); \
> +        (*(tail))->value->str = g_strdup((new_val)); \
> +        (tail) = &((*(tail))->next); \
> +    } while (0)

Please use QAPI_LIST_APPEND instead of re-coding it.

> +++ b/qapi/net.json
> @@ -714,3 +714,83 @@
>  ##
>  { 'event': 'FAILOVER_NEGOTIATED',
>    'data': {'device-id': 'str'} }
> +
> +##
> +# @NetBackend:
> +#
> +# Available netdev backend drivers.
> +#
> +# Since: 6.0
> +##
> +{ 'enum': 'NetBackend',
> +  'data': [ 'user', 'tap', 'l2tpv3', 'socket', 'vde', 'bridge', 'netmap',
> +            'vhost-user', 'vhost-vdpa' ] }

Is it worth alphabetizing this list?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



  reply	other threads:[~2021-03-02 19:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 18:02 [PATCH v6 0/5] Introducing QMP query-netdev command Alexey Kirillov
2021-03-02 18:02 ` Alexey Kirillov
2021-03-02 18:02 ` [PATCH v6 1/5] qapi: net: Add " Alexey Kirillov
2021-03-02 18:02   ` Alexey Kirillov
2021-03-02 19:10   ` Eric Blake [this message]
2021-03-02 19:10     ` Eric Blake
2021-03-02 18:02 ` [PATCH v6 2/5] tests: Add tests for " Alexey Kirillov
2021-03-02 18:02   ` Alexey Kirillov
2021-03-02 18:02 ` [PATCH v6 3/5] net: Move NetClientState.info_str to dynamic allocations Alexey Kirillov
2021-03-02 18:02   ` Alexey Kirillov
2021-03-02 18:02 ` [PATCH v6 4/5] hmp: Use QAPI NetdevInfo in hmp_info_network Alexey Kirillov
2021-03-02 18:02   ` Alexey Kirillov
2021-03-02 18:02 ` [PATCH v6 5/5] net: Do not fill legacy info_str for backends Alexey Kirillov
2021-03-02 18:02   ` Alexey Kirillov

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=79930db1-80fa-c810-7f72-131ec4671a71@redhat.com \
    --to=eblake@redhat.com \
    --cc=anthony.perard@citrix.com \
    --cc=armbru@redhat.com \
    --cc=g.lettieri@iet.unipi.it \
    --cc=jasowang@redhat.com \
    --cc=lekiravi@yandex-team.ru \
    --cc=lvivier@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=mst@redhat.com \
    --cc=paul@xen.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rizzo@iet.unipi.it \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=sstabellini@kernel.org \
    --cc=sw@weilnetz.de \
    --cc=thuth@redhat.com \
    --cc=v.maffione@gmail.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=yc-core@yandex-team.ru \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.