vhost: enable virtio MTU feature
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Sun, 12 Mar 2017 16:33:58 +0000 (17:33 +0100)
committerYuanhan Liu <yuanhan.liu@linux.intel.com>
Sat, 1 Apr 2017 08:36:17 +0000 (10:36 +0200)
This patch enables the new VIRTIO_NET_F_MTU feature,
which makes possible for the host to advise the guest
with its maximum supported MTU.

MTU value is set via QEMU parameters, either via Libvirt XML, or
directly in virtio-net device command line arguments.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
lib/librte_vhost/vhost.c
lib/librte_vhost/vhost.h

index 3c3f6a4..3e87ecc 100644 (file)
@@ -66,7 +66,8 @@
                                (1ULL << VIRTIO_NET_F_GUEST_CSUM) | \
                                (1ULL << VIRTIO_NET_F_GUEST_TSO4) | \
                                (1ULL << VIRTIO_NET_F_GUEST_TSO6) | \
-                               (1ULL << VIRTIO_RING_F_INDIRECT_DESC))
+                               (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | \
+                               (1ULL << VIRTIO_NET_F_MTU))
 
 uint64_t VHOST_FEATURES = VHOST_SUPPORTED_FEATURES;
 
index d97df1d..5c94322 100644 (file)
@@ -120,6 +120,10 @@ struct vhost_virtqueue {
 #endif
 #define VHOST_MAX_QUEUE_PAIRS          0x80
 
+#ifndef VIRTIO_NET_F_MTU
+ #define VIRTIO_NET_F_MTU 3
+#endif
+
 /*
  * Define virtio 1.0 for older kernels
  */