diff options
author | Alexey Kirillov <lekiravi@yandex-team.ru> | 2021-03-03 12:59:06 +0300 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2021-03-15 16:41:22 +0800 |
commit | d32ad10a14d46dfe9304e3ed5858a11dcd5c71a0 (patch) | |
tree | e56aaddf5e86dd29209ce958e94c0d91ad950778 /net/netmap.c | |
parent | 3aa1b7af0f5fbfdf1b4759658e1445bda680b40d (diff) |
qapi: net: Add query-netdev command
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>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'net/netmap.c')
-rw-r--r-- | net/netmap.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/netmap.c b/net/netmap.c index 350f097f91..ad59d4ade4 100644 --- a/net/netmap.c +++ b/net/netmap.c @@ -427,6 +427,13 @@ int net_init_netmap(const Netdev *netdev, pstrcpy(s->ifname, sizeof(s->ifname), netmap_opts->ifname); netmap_read_poll(s, true); /* Initially only poll for reads. */ + /* Store startup parameters */ + nc->stored_config = g_new0(NetdevInfo, 1); + nc->stored_config->type = NET_BACKEND_NETMAP; + + QAPI_CLONE_MEMBERS(NetdevNetmapOptions, + &nc->stored_config->u.netmap, netmap_opts); + return 0; } |