Commit 03ce5744 authored by Nikolay Nikolaev's avatar Nikolay Nikolaev Committed by Michael S. Tsirkin
Browse files

Add the vhost-user netdev backend to the command line



The supplied chardev id will be inspected for supported options. Only
a socket backend, with a set path (i.e. a Unix socket) and optionally
the server parameter set, will be allowed. Other options (nowait, telnet)
will make the chardev unusable and the netdev will not be initialised.

Additional checks for validity:
  - requires `-numa node,memdev=..`
  - requires `-device virtio-net-*`

The `vhostforce` option is used to force vhost-net when we deal with
non-MSIX guests.

Signed-off-by: default avatarAntonios Motakis <a.motakis@virtualopensystems.com>
Signed-off-by: default avatarNikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
parent d314f586
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4515,6 +4515,9 @@ fi
if test "$vhost_scsi" = "yes" ; then
  echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
fi
if test "$vhost_net" = "yes" ; then
  echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
fi
if test "$blobs" = "yes" ; then
  echo "INSTALL_BLOBS=yes" >> $config_host_mak
fi
+2 −2
Original line number Diff line number Diff line
@@ -1211,7 +1211,7 @@ ETEXI
    {
        .name       = "host_net_add",
        .args_type  = "device:s,opts:s?",
        .params     = "tap|user|socket|vde|netmap|bridge|dump [options]",
        .params     = "tap|user|socket|vde|netmap|bridge|vhost-user|dump [options]",
        .help       = "add host VLAN client",
        .mhandler.cmd = net_host_device_add,
        .command_completion = host_net_add_completion,
@@ -1241,7 +1241,7 @@ ETEXI
    {
        .name       = "netdev_add",
        .args_type  = "netdev:O",
        .params     = "[user|tap|socket|vde|bridge|hubport|netmap],id=str[,prop=value][,...]",
        .params     = "[user|tap|socket|vde|bridge|hubport|netmap|vhost-user],id=str[,prop=value][,...]",
        .help       = "add host network device",
        .mhandler.cmd = hmp_netdev_add,
        .command_completion = netdev_add_completion,
+4 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@

#include "net/net.h"
#include "net/tap.h"
#include "net/vhost-user.h"

#include "hw/virtio/virtio-net.h"
#include "net/vhost_net.h"
@@ -360,6 +361,9 @@ VHostNetState *get_vhost_net(NetClientState *nc)
    case NET_CLIENT_OPTIONS_KIND_TAP:
        vhost_net = tap_get_vhost_net(nc);
        break;
    case NET_CLIENT_OPTIONS_KIND_VHOST_USER:
        vhost_net = vhost_user_get_vhost_net(nc);
        break;
    default:
        break;
    }
+1 −0
Original line number Diff line number Diff line
@@ -322,6 +322,7 @@ void net_hub_check_clients(void)
            case NET_CLIENT_OPTIONS_KIND_TAP:
            case NET_CLIENT_OPTIONS_KIND_SOCKET:
            case NET_CLIENT_OPTIONS_KIND_VDE:
            case NET_CLIENT_OPTIONS_KIND_VHOST_USER:
                has_host_dev = 1;
                break;
            default:
+7 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ const char *host_net_devices[] = {
#ifdef CONFIG_VDE
    "vde",
#endif
    "vhost-user",
    NULL,
};

@@ -802,6 +803,9 @@ static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(
        [NET_CLIENT_OPTIONS_KIND_BRIDGE]    = net_init_bridge,
#endif
        [NET_CLIENT_OPTIONS_KIND_HUBPORT]   = net_init_hubport,
#ifdef CONFIG_VHOST_NET_USED
        [NET_CLIENT_OPTIONS_KIND_VHOST_USER] = net_init_vhost_user,
#endif
};


@@ -835,6 +839,9 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)
        case NET_CLIENT_OPTIONS_KIND_BRIDGE:
#endif
        case NET_CLIENT_OPTIONS_KIND_HUBPORT:
#ifdef CONFIG_VHOST_NET_USED
        case NET_CLIENT_OPTIONS_KIND_VHOST_USER:
#endif
            break;

        default:
Loading