Re: [PATCH] qapi/net: gate user/vde/netmap netdev backends behind their CONFIG symbols
Markus Armbruster <[email protected]>
| Newsgroups | org.nongnu.qemu-trivial,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
Rohitashv Kumar <[email protected]> writes: > From: Rohitashv Kumar <[email protected]> > > 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 <[email protected]> > --- > 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 <[email protected]>