vHost User Interfaces¶
vHost User interfaces are a type of virtual interface for communicating with virtual machines. These virtual interfaces are backed by a socket and shared memory, through which TNSR and a virtual machine running on the same host can communicate as if it were a network connection. These interfaces allow TNSR to act in a role similar to a virtual switch or host OS bond interface.
Configuring an environment where TNSR and a virtualization platform are both installed and running on the same host is outside the scope of this documentation.
Typically these interfaces are joined in a bridge domain (Bridge Interfaces) so that virtual machines can communicate with hosts connected to other TNSR interfaces as if they were part of the same layer 2 network.
vHost user interfaces are implemented using Virtio. Virtualization platforms which support Virtio vHost user interfaces include QEMU and solutions based on QEMU, such as KVM or Proxmox® VE. This could be QEMU or KVM running on a TNSR installation, TNSR running on a Proxmox VE host, or some other combination. Check the virtualization platform documentation for specifics on support and configuration.
vHost User Interface Configuration¶
See vHost User Interface Startup Configuration for information on configuring dataplane startup options for vHost User interfaces.
A new vHost user interface is defined by the
interface vhost-user <instance>
command, which enters
config-vhost-user mode. The
is an integer which is also the resulting interface ID.
In most cases, the settings here should match the settings for the corresponding interface on the VM.
tnsr(config)# interface vhost-user <instance> tnsr(config-vhost-user)#
config-vhost-user mode, the following commands are available:
- sock-filename <sock-filename-val>
Defines the full path to the socket file through which this interface will communicate with another endpoint.
Naming the socket file after the VM ID and/or name, along with the instance ID, makes it easier to locate the correct file later if necessary. For example,
/var/run/vpp/vm-100-0.sockwould be for a VM ID of
100and vHost user interface instance
When present, the vHost interface acts in server mode. When not present, it acts in client mode.
The mode influences which side can be disrupted. The client side can reset without needing to reset the server side. Since TNSR will generally not be restarted as often as guest VMs, TNSR typically acts as the server.
- disable (merge-rx-buffers|indirect-descriptors)
Disables certain options which are enabled by default:
Disable the use of merge receive buffers.
Disable the use of indirect descriptors.
- enable (gso|packed-ring|event-index)
Enables certain options which are disabled by default:
Enable the use of Generic Segmentation Offload (GSO).
Enable the use of packed ring to increase efficiency by combining multiple separate ring buffers. This is experimental and support varies by virtualization platform and version. This feature must be supported and enabled by both ends.
Enable the use of event index.
After creating the interface it will be available for configuration in TNSR. The
name of this interface is
<n> is the
instance ID. For example, if a vHost user interface was created with an instance
5, the resulting interface is
vHost User Interface Example¶
First define and configure the vHost User interface:
tnsr(config)# interface vhost-user 0 tnsr(config-vhost-user)# server-mode tnsr(config-vhost-user)# enable gso tnsr(config-vhost-user)# enable packed tnsr(config-vhost-user)# enable event-index tnsr(config-vhost-user)# sock-filename /var/run/vpp/vm-100-0.sock tnsr(config-vhost-user)# exit
Now there will be a new
VirtualEthernet0/0/0 interface which can be
configured as needed:
tnsr(config)# interface VirtualEthernet0/0/0 tnsr(config-interface)# mac 3c:ec:ef:d0:10:00 tnsr(config-interface)# bridge domain 2 tnsr(config-interface)# enable tnsr(config-interface)# exit
Manually configuring a MAC address allows it to use a consistent or known value. If the MAC address is not set, the MAC address will be randomized each time the interface is configured after the dataplane restarts.
When configuring the corresponding interface on a virtual machine as a part of a bridge domain, ensure it uses a different MAC address.
vHost User Interface Status¶
To view the status of vHost User interfaces, use the
tnsr(config)# show interface vhost-user Interface: VirtualEthernet0/0/0 Instance: 0 Socket filename: /var/run/vpp/vm-100-0.sock Socket type: server Socket errno: Success Virtio net header size: 0 Features (0x0): Memory regions: 0