All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qapi/net: gate user/vde/netmap netdev backends behind their CONFIG symbols
@ 2026-07-28 14:43 Rohitashv Kumar
  2026-08-20 10:47 ` Markus Armbruster
  0 siblings, 1 reply; 2+ messages in thread
From: Rohitashv Kumar @ 2026-07-28 14:43 UTC (permalink / raw)
  To: Jason Wang, qemu-devel
  Cc: qemu-trivial, Eric Blake, Markus Armbruster, Rohitashv Kumar

From: Rohitashv Kumar <roohiit@amazon.de>

Their NetClientDriver enum members and Netdev union branches were
unconditional, so query-qmp-schema advertised them even when built without
CONFIG_SLIRP/CONFIG_VDE/CONFIG_NETMAP. Gate them, and guard the matching
NET_CLIENT_DRIVER_USER/_VDE case labels in net/hub.c.

Signed-off-by: Rohitashv Kumar <roohiit@amazon.de>
---
 net/hub.c     |  4 ++++
 qapi/net.json | 19 +++++++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/net/hub.c b/net/hub.c
index ee5881f6d5..2a7c2bc6d7 100644
--- a/net/hub.c
+++ b/net/hub.c
@@ -294,12 +294,16 @@ void net_hub_check_clients(void)
 #ifdef CONFIG_PASST
             case NET_CLIENT_DRIVER_PASST:
 #endif
+#ifdef CONFIG_SLIRP
             case NET_CLIENT_DRIVER_USER:
+#endif
             case NET_CLIENT_DRIVER_TAP:
             case NET_CLIENT_DRIVER_SOCKET:
             case NET_CLIENT_DRIVER_STREAM:
             case NET_CLIENT_DRIVER_DGRAM:
+#ifdef CONFIG_VDE
             case NET_CLIENT_DRIVER_VDE:
+#endif
             case NET_CLIENT_DRIVER_VHOST_USER:
                 has_host_dev = 1;
                 break;
diff --git a/qapi/net.json b/qapi/net.json
index 1a6382825c..e9f1300629 100644
--- a/qapi/net.json
+++ b/qapi/net.json
@@ -922,9 +922,13 @@
 # Since: 2.7
 ##
 { 'enum': 'NetClientDriver',
-  'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'stream',
-            'dgram', 'vde', 'bridge', 'hubport', 'netmap', 'vhost-user',
-            'vhost-vdpa',
+  'data': [ 'none', 'nic',
+            { 'name': 'user', 'if': 'CONFIG_SLIRP' },
+            'tap', 'l2tpv3', 'socket', 'stream', 'dgram',
+            { 'name': 'vde', 'if': 'CONFIG_VDE' },
+            'bridge', 'hubport',
+            { 'name': 'netmap', 'if': 'CONFIG_NETMAP' },
+            'vhost-user', 'vhost-vdpa',
             { 'name': 'passt', 'if': 'CONFIG_PASST' },
             { 'name': 'af-xdp', 'if': 'CONFIG_AF_XDP' },
             { 'name': 'vmnet-host', 'if': 'CONFIG_VMNET' },
@@ -949,16 +953,19 @@
     'nic':      'NetLegacyNicOptions',
     'passt':    { 'type': 'NetdevPasstOptions',
                   'if': 'CONFIG_PASST' },
-    'user':     'NetdevUserOptions',
+    'user':     { 'type': 'NetdevUserOptions',
+                  'if': 'CONFIG_SLIRP' },
     'tap':      'NetdevTapOptions',
     'l2tpv3':   'NetdevL2TPv3Options',
     'socket':   'NetdevSocketOptions',
     'stream':   'NetdevStreamOptions',
     'dgram':    'NetdevDgramOptions',
-    'vde':      'NetdevVdeOptions',
+    'vde':      { 'type': 'NetdevVdeOptions',
+                  'if': 'CONFIG_VDE' },
     'bridge':   'NetdevBridgeOptions',
     'hubport':  'NetdevHubPortOptions',
-    'netmap':   'NetdevNetmapOptions',
+    'netmap':   { 'type': 'NetdevNetmapOptions',
+                  'if': 'CONFIG_NETMAP' },
     'af-xdp':   { 'type': 'NetdevAFXDPOptions',
                   'if': 'CONFIG_AF_XDP' },
     'vhost-user': 'NetdevVhostUserOptions',
-- 
2.50.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] qapi/net: gate user/vde/netmap netdev backends behind their CONFIG symbols
  2026-07-28 14:43 [PATCH] qapi/net: gate user/vde/netmap netdev backends behind their CONFIG symbols Rohitashv Kumar
@ 2026-08-20 10:47 ` Markus Armbruster
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Armbruster @ 2026-08-20 10:47 UTC (permalink / raw)
  To: Rohitashv Kumar
  Cc: Jason Wang, qemu-devel, qemu-trivial, Eric Blake, Rohitashv Kumar

Rohitashv Kumar <rohit.kuma1313@gmail.com> writes:

> From: Rohitashv Kumar <roohiit@amazon.de>
>
> Their NetClientDriver enum members and Netdev union branches were
> unconditional, so query-qmp-schema advertised them even when built without
> CONFIG_SLIRP/CONFIG_VDE/CONFIG_NETMAP. Gate them, and guard the matching
> NET_CLIENT_DRIVER_USER/_VDE case labels in net/hub.c.
>
> Signed-off-by: Rohitashv Kumar <roohiit@amazon.de>
> ---
>  net/hub.c     |  4 ++++
>  qapi/net.json | 19 +++++++++++++------
>  2 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/net/hub.c b/net/hub.c
> index ee5881f6d5..2a7c2bc6d7 100644
> --- a/net/hub.c
> +++ b/net/hub.c
> @@ -294,12 +294,16 @@ void net_hub_check_clients(void)
>  #ifdef CONFIG_PASST
>              case NET_CLIENT_DRIVER_PASST:
>  #endif
> +#ifdef CONFIG_SLIRP
>              case NET_CLIENT_DRIVER_USER:
> +#endif
>              case NET_CLIENT_DRIVER_TAP:
>              case NET_CLIENT_DRIVER_SOCKET:
>              case NET_CLIENT_DRIVER_STREAM:
>              case NET_CLIENT_DRIVER_DGRAM:
> +#ifdef CONFIG_VDE
>              case NET_CLIENT_DRIVER_VDE:
> +#endif
>              case NET_CLIENT_DRIVER_VHOST_USER:
>                  has_host_dev = 1;
>                  break;
> diff --git a/qapi/net.json b/qapi/net.json
> index 1a6382825c..e9f1300629 100644
> --- a/qapi/net.json
> +++ b/qapi/net.json
> @@ -922,9 +922,13 @@
>  # Since: 2.7
>  ##
>  { 'enum': 'NetClientDriver',
> -  'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'stream',
> -            'dgram', 'vde', 'bridge', 'hubport', 'netmap', 'vhost-user',
> -            'vhost-vdpa',
> +  'data': [ 'none', 'nic',
> +            { 'name': 'user', 'if': 'CONFIG_SLIRP' },
> +            'tap', 'l2tpv3', 'socket', 'stream', 'dgram',
> +            { 'name': 'vde', 'if': 'CONFIG_VDE' },
> +            'bridge', 'hubport',
> +            { 'name': 'netmap', 'if': 'CONFIG_NETMAP' },
> +            'vhost-user', 'vhost-vdpa',
>              { 'name': 'passt', 'if': 'CONFIG_PASST' },
>              { 'name': 'af-xdp', 'if': 'CONFIG_AF_XDP' },
>              { 'name': 'vmnet-host', 'if': 'CONFIG_VMNET' },
> @@ -949,16 +953,19 @@
>      'nic':      'NetLegacyNicOptions',
>      'passt':    { 'type': 'NetdevPasstOptions',
>                    'if': 'CONFIG_PASST' },
> -    'user':     'NetdevUserOptions',
> +    'user':     { 'type': 'NetdevUserOptions',
> +                  'if': 'CONFIG_SLIRP' },
>      'tap':      'NetdevTapOptions',
>      'l2tpv3':   'NetdevL2TPv3Options',
>      'socket':   'NetdevSocketOptions',
>      'stream':   'NetdevStreamOptions',
>      'dgram':    'NetdevDgramOptions',
> -    'vde':      'NetdevVdeOptions',
> +    'vde':      { 'type': 'NetdevVdeOptions',
> +                  'if': 'CONFIG_VDE' },
>      'bridge':   'NetdevBridgeOptions',
>      'hubport':  'NetdevHubPortOptions',
> -    'netmap':   'NetdevNetmapOptions',
> +    'netmap':   { 'type': 'NetdevNetmapOptions',
> +                  'if': 'CONFIG_NETMAP' },
>      'af-xdp':   { 'type': 'NetdevAFXDPOptions',
>                    'if': 'CONFIG_AF_XDP' },
>      'vhost-user': 'NetdevVhostUserOptions',

Any occurence of NET_CLIENT_DRIVER_USER, NET_CLIENT_DRIVER_VDE,
NET_CLIENT_DRIVER_NETMAP must now be properly guarded the same way.

The patch fixes up the ones in net/hub.c.

Checking the other ones:

* all three in net/net.c: already guarded by the same #ifdef

* _USER in net/slirp.c: net/meson.build compiles it only when: slirp

* _VDE in net/vde.c: net/meson.build compiles it only when: vde

* _NETMAP in net/netmap.c: net/meson.build compiles it only
  if have_netmap

Good.

Reviewed-by: Markus Armbruster <armbru@redhat.com>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-20 10:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28 14:43 [PATCH] qapi/net: gate user/vde/netmap netdev backends behind their CONFIG symbols Rohitashv Kumar
2026-08-20 10:47 ` Markus Armbruster

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.