mbox series

[v5,0/4] Introducing QMP query-netdev command

Message ID 20201108235952.107961-1-lekiravi@yandex-team.ru
Headers show
Series Introducing QMP query-netdev command | expand

Message

Alexey Kirillov Nov. 8, 2020, 11:59 p.m. UTC
This patch series introduces a new QMP command "query-netdev" to get
information about currently attached backend network devices (netdevs).
Also, since the "info_str" field of "NetClientState" is now deprecated,
we no longer use it for netdevs, only for NIC/hubports.
The HMP command "info network" now also uses the new QMP command inside.

Usage example:

-> { "execute": "query-netdev" }
<- { "return": [
         {
             "listen": "127.0.0.1:90",
             "type": "socket",
             "peer-id": "hub0port1",
             "id": "__org.qemu.net1"
         },
         {
             "script": "/etc/qemu-ifup",
             "downscript": "/etc/qemu-ifdown",
             "ifname": "tap0",
             "type": "tap",
             "peer-id": "net5",
             "vnet_hdr": true,
             "id": "tap0"
         },
         {
             "ipv6": true,
             "ipv4": true,
             "host": "10.0.2.2",
             "ipv6-dns": "fec0::3",
             "ipv6-prefix": "fec0::",
             "net": "10.0.2.0/255.255.255.0",
             "ipv6-host": "fec0::2",
             "type": "user",
             "peer-id": "net0",
             "dns": "10.0.2.3",
             "hostfwd": [
                 {
                     "str": "tcp::20004-:22"
                 }
             ],
             "ipv6-prefixlen": 64,
             "id": "netdev0",
             "restrict": false
         }
     ]
   }

v4->v5:
- Enable qtest of query-netdevs for AVR and RX archs.
- Bump "Since" version in QAPI to 6.0.

v3->v4:
- Rename "query-netdevs" to "query-netdev".
- Copy netdev drivers to new QAPI enum "NetBackend".

v2->v3:
- Remove NIC and hubports from query-netdevs.
- Remove several fields from NetdevInfo since they are unnecessary.
- Rename field @peer to @peer-id.
- Add support of vhost-vdpa.
- Keep "info_str" for NIC/hubports, but remove it for netdevs.

v1->v2:
- Rewrite HMP "info network" to get information from results of QMP command.
- Remove obsolete field "info_str" from "NetClientState".

Alexey Kirillov (4):
  qapi: net: Add query-netdev command
  tests: Add tests for query-netdev command
  hmp: Use QMP query-netdev in hmp_info_network
  net: Do not use legacy info_str for backends

 include/net/net.h               |   4 +-
 net/clients.h                   |   1 +
 net/hub.c                       |   4 +-
 net/hub.h                       |   2 +-
 net/l2tpv3.c                    |  21 +++-
 net/net.c                       | 213 +++++++++++++++++++++++++++++++-
 net/netmap.c                    |  13 ++
 net/slirp.c                     | 128 ++++++++++++++++++-
 net/socket.c                    |  91 ++++++++++----
 net/tap-win32.c                 |  10 +-
 net/tap.c                       | 107 ++++++++++++++--
 net/vde.c                       |  39 +++++-
 net/vhost-user.c                |  20 ++-
 net/vhost-vdpa.c                |  15 ++-
 qapi/net.json                   |  80 ++++++++++++
 tests/qtest/meson.build         |   3 +
 tests/qtest/test-query-netdev.c | 120 ++++++++++++++++++
 17 files changed, 812 insertions(+), 59 deletions(-)
 create mode 100644 tests/qtest/test-query-netdev.c

Comments

Alexey Kirillov Nov. 23, 2020, 3:19 p.m. UTC | #1
ping

Patchwork page: http://patchwork.ozlabs.org/project/qemu-devel/list/?series=212983

09.11.2020, 03:02, "Alexey Kirillov" <lekiravi@yandex-team.ru>:
> This patch series introduces a new QMP command "query-netdev" to get

> information about currently attached backend network devices (netdevs).

> Also, since the "info_str" field of "NetClientState" is now deprecated,

> we no longer use it for netdevs, only for NIC/hubports.

> The HMP command "info network" now also uses the new QMP command inside.

>

> Usage example:

>

> -> { "execute": "query-netdev" }

> <- { "return": [

>          {

>              "listen": "127.0.0.1:90",

>              "type": "socket",

>              "peer-id": "hub0port1",

>              "id": "__org.qemu.net1"

>          },

>          {

>              "script": "/etc/qemu-ifup",

>              "downscript": "/etc/qemu-ifdown",

>              "ifname": "tap0",

>              "type": "tap",

>              "peer-id": "net5",

>              "vnet_hdr": true,

>              "id": "tap0"

>          },

>          {

>              "ipv6": true,

>              "ipv4": true,

>              "host": "10.0.2.2",

>              "ipv6-dns": "fec0::3",

>              "ipv6-prefix": "fec0::",

>              "net": "10.0.2.0/255.255.255.0",

>              "ipv6-host": "fec0::2",

>              "type": "user",

>              "peer-id": "net0",

>              "dns": "10.0.2.3",

>              "hostfwd": [

>                  {

>                      "str": "tcp::20004-:22"

>                  }

>              ],

>              "ipv6-prefixlen": 64,

>              "id": "netdev0",

>              "restrict": false

>          }

>      ]

>    }

>

> v4->v5:

> - Enable qtest of query-netdevs for AVR and RX archs.

> - Bump "Since" version in QAPI to 6.0.

>

> v3->v4:

> - Rename "query-netdevs" to "query-netdev".

> - Copy netdev drivers to new QAPI enum "NetBackend".

>

> v2->v3:

> - Remove NIC and hubports from query-netdevs.

> - Remove several fields from NetdevInfo since they are unnecessary.

> - Rename field @peer to @peer-id.

> - Add support of vhost-vdpa.

> - Keep "info_str" for NIC/hubports, but remove it for netdevs.

>

> v1->v2:

> - Rewrite HMP "info network" to get information from results of QMP command.

> - Remove obsolete field "info_str" from "NetClientState".

>

> Alexey Kirillov (4):

>   qapi: net: Add query-netdev command

>   tests: Add tests for query-netdev command

>   hmp: Use QMP query-netdev in hmp_info_network

>   net: Do not use legacy info_str for backends

>

>  include/net/net.h | 4 +-

>  net/clients.h | 1 +

>  net/hub.c | 4 +-

>  net/hub.h | 2 +-

>  net/l2tpv3.c | 21 +++-

>  net/net.c | 213 +++++++++++++++++++++++++++++++-

>  net/netmap.c | 13 ++

>  net/slirp.c | 128 ++++++++++++++++++-

>  net/socket.c | 91 ++++++++++----

>  net/tap-win32.c | 10 +-

>  net/tap.c | 107 ++++++++++++++--

>  net/vde.c | 39 +++++-

>  net/vhost-user.c | 20 ++-

>  net/vhost-vdpa.c | 15 ++-

>  qapi/net.json | 80 ++++++++++++

>  tests/qtest/meson.build | 3 +

>  tests/qtest/test-query-netdev.c | 120 ++++++++++++++++++

>  17 files changed, 812 insertions(+), 59 deletions(-)

>  create mode 100644 tests/qtest/test-query-netdev.c

>

> --

> 2.25.1



-- 
Alexey Kirillov
Yandex.Cloud
Alexey Kirillov Dec. 4, 2020, 5:34 p.m. UTC | #2
<div><div>ping again<br /><br />Patchwork page: <a href="http://patchwork.ozlabs.org/project/qemu-devel/list/?series=212983" rel="noopener noreferrer" target="_blank">http://patchwork.ozlabs.org/project/qemu-devel/list/?series=212983</a></div></div><div> </div><div>09.11.2020, 03:02, "Alexey Kirillov" &lt;lekiravi@yandex-team.ru&gt;:</div><blockquote><p>This patch series introduces a new QMP command "query-netdev" to get<br />information about currently attached backend network devices (netdevs).<br />Also, since the "info_str" field of "NetClientState" is now deprecated,<br />we no longer use it for netdevs, only for NIC/hubports.<br />The HMP command "info network" now also uses the new QMP command inside.<br /><br />Usage example:<br /><br />-&gt; { "execute": "query-netdev" }<br />&lt;- { "return": [<br />         {<!-- --><br />             "listen": "127.0.0.1:90",<br />             "type": "socket",<br />             "peer-id": "hub0port1",<br />             "id": "__org.qemu.net1"<br />         },<br />         {<!-- --><br />             "script": "/etc/qemu-ifup",<br />             "downscript": "/etc/qemu-ifdown",<br />             "ifname": "tap0",<br />             "type": "tap",<br />             "peer-id": "net5",<br />             "vnet_hdr": true,<br />             "id": "tap0"<br />         },<br />         {<!-- --><br />             "ipv6": true,<br />             "ipv4": true,<br />             "host": "10.0.2.2",<br />             "ipv6-dns": "fec0::3",<br />             "ipv6-prefix": "fec0::",<br />             "net": "10.0.2.0/255.255.255.0",<br />             "ipv6-host": "fec0::2",<br />             "type": "user",<br />             "peer-id": "net0",<br />             "dns": "10.0.2.3",<br />             "hostfwd": [<br />                 {<!-- --><br />                     "str": "tcp::20004-:22"<br />                 }<br />             ],<br />             "ipv6-prefixlen": 64,<br />             "id": "netdev0",<br />             "restrict": false<br />         }<br />     ]<br />   }<br /><br />v4-&gt;v5:<br />- Enable qtest of query-netdevs for AVR and RX archs.<br />- Bump "Since" version in QAPI to 6.0.<br /><br />v3-&gt;v4:<br />- Rename "query-netdevs" to "query-netdev".<br />- Copy netdev drivers to new QAPI enum "NetBackend".<br /><br />v2-&gt;v3:<br />- Remove NIC and hubports from query-netdevs.<br />- Remove several fields from NetdevInfo since they are unnecessary.<br />- Rename field @peer to @peer-id.<br />- Add support of vhost-vdpa.<br />- Keep "info_str" for NIC/hubports, but remove it for netdevs.<br /><br />v1-&gt;v2:<br />- Rewrite HMP "info network" to get information from results of QMP command.<br />- Remove obsolete field "info_str" from "NetClientState".<br /><br />Alexey Kirillov (4):<br />  qapi: net: Add query-netdev command<br />  tests: Add tests for query-netdev command<br />  hmp: Use QMP query-netdev in hmp_info_network<br />  net: Do not use legacy info_str for backends<br /><br /> include/net/net.h | 4 +-<br /> net/clients.h | 1 +<br /> net/hub.c | 4 +-<br /> net/hub.h | 2 +-<br /> net/l2tpv3.c | 21 +++-<br /> net/net.c | 213 +++++++++++++++++++++++++++++++-<br /> net/netmap.c | 13 ++<br /> net/slirp.c | 128 ++++++++++++++++++-<br /> net/socket.c | 91 ++++++++++----<br /> net/tap-win32.c | 10 +-<br /> net/tap.c | 107 ++++++++++++++--<br /> net/vde.c | 39 +++++-<br /> net/vhost-user.c | 20 ++-<br /> net/vhost-vdpa.c | 15 ++-<br /> qapi/net.json | 80 ++++++++++++<br /> tests/qtest/meson.build | 3 +<br /> tests/qtest/test-query-netdev.c | 120 ++++++++++++++++++<br /> 17 files changed, 812 insertions(+), 59 deletions(-)<br /> create mode 100644 tests/qtest/test-query-netdev.c<br /> </p>--<br />2.25.1<br /><br /> </blockquote><div> </div><div> </div><div>-- </div><div>Alexey Kirillov</div><div>Yandex.Cloud</div><div> </div>