2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

netdev-dpdk: Add support for vHost dequeue zero copy (experimental)

Zero copy is disabled by default. To enable it, set the 'dq-zero-copy'
option to 'true' when configuring the Interface:

ovs-vsctl set Interface dpdkvhostuserclient0
options:vhost-server-path=/tmp/dpdkvhostuserclient0
options:dq-zero-copy=true

When packets from a vHost device with zero copy enabled are destined for
a single 'dpdk' port, the number of tx descriptors on that 'dpdk' port
must be set to a smaller value. 128 is recommended. This can be achieved
like so:

ovs-vsctl set Interface dpdkport options:n_txq_desc=128

Note: The sum of the tx descriptors of all 'dpdk' ports the VM will send
to should not exceed 128. Due to this requirement, the feature is
considered 'experimental'.

Testing of the patch showed a ~8% improvement when switching 512B
packets between vHost devices on different VMs on the same host when
zero copy was enabled on the transmitting device.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
This commit is contained in:
Ciara Loftus
2018-01-31 10:44:54 +00:00
committed by Ian Stokes
parent 186667a83c
commit 10087cba9d
5 changed files with 105 additions and 0 deletions

View File

@@ -1564,6 +1564,12 @@ netdev_dpdk_vhost_client_set_config(struct netdev *netdev,
path = smap_get(args, "vhost-server-path");
if (path && strcmp(path, dev->vhost_id)) {
strcpy(dev->vhost_id, path);
/* check zero copy configuration */
if (smap_get_bool(args, "dq-zero-copy", false)) {
dev->vhost_driver_flags |= RTE_VHOST_USER_DEQUEUE_ZERO_COPY;
} else {
dev->vhost_driver_flags &= ~RTE_VHOST_USER_DEQUEUE_ZERO_COPY;
}
netdev_request_reconfigure(netdev);
}
}
@@ -3627,6 +3633,7 @@ netdev_dpdk_vhost_client_reconfigure(struct netdev *netdev)
struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
int err;
uint64_t vhost_flags = 0;
bool zc_enabled;
ovs_mutex_lock(&dev->mutex);
@@ -3644,6 +3651,14 @@ netdev_dpdk_vhost_client_reconfigure(struct netdev *netdev)
if (dpdk_vhost_iommu_enabled()) {
vhost_flags |= RTE_VHOST_USER_IOMMU_SUPPORT;
}
zc_enabled = dev->vhost_driver_flags
& RTE_VHOST_USER_DEQUEUE_ZERO_COPY;
/* Enable zero copy flag, if requested */
if (zc_enabled) {
vhost_flags |= RTE_VHOST_USER_DEQUEUE_ZERO_COPY;
}
err = rte_vhost_driver_register(dev->vhost_id, vhost_flags);
if (err) {
VLOG_ERR("vhost-user device setup failure for device %s\n",
@@ -3655,6 +3670,9 @@ netdev_dpdk_vhost_client_reconfigure(struct netdev *netdev)
VLOG_INFO("vHost User device '%s' created in 'client' mode, "
"using client socket '%s'",
dev->up.name, dev->vhost_id);
if (zc_enabled) {
VLOG_INFO("Zero copy enabled for vHost port %s", dev->up.name);
}
}
err = rte_vhost_driver_callback_register(dev->vhost_id,