diff options
author | Ciara Loftus <ciara.loftus@intel.com> | 2018-01-31 10:44:54 +0000 |
---|---|---|
committer | Ian Stokes <ian.stokes@intel.com> | 2018-01-31 14:04:35 +0000 |
commit | 10087cba9deec95aaea080c49f2cbe648ebe92c8 (patch) | |
tree | f66649d61abc1d830c399c250b8fd0bcdfb33d69 /lib | |
parent | 186667a83c2b09ed9ae08b35c596987cf7d33cfb (diff) | |
download | openvswitch-10087cba9deec95aaea080c49f2cbe648ebe92c8.tar.gz |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/netdev-dpdk.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index d41f5aa51..94fb16370 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -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, |