yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-virtio-net-add-feature-bit-for-any-header-s-g.patch

0a122b
From 01ebac2f7d54e80a690c855680d35574d118b072 Mon Sep 17 00:00:00 2001
0a122b
From: Michael S. Tsirkin <mst@redhat.com>
0a122b
Date: Wed, 12 Mar 2014 06:52:43 +0100
0a122b
Subject: [PATCH 06/16] virtio-net: add feature bit for any header s/g
0a122b
0a122b
Message-id: <1394169006-8402-1-git-send-email-mst@redhat.com>
0a122b
Patchwork-id: 58046
0a122b
O-Subject: [PATCH qemu-kvm RHEL7.0] virtio-net: add feature bit for any header s/g
0a122b
Bugzilla: 990989
0a122b
RH-Acked-by: Xiao Wang <jasowang@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
0a122b
Old qemu versions required that 1st s/g entry is the header.
0a122b
0a122b
Since QEMU 1.5, patchset titled "virtio-net: iovec handling cleanup"
0a122b
removed this limitation but a feature bit is needed so guests know it's
0a122b
safe to lay out header differently.
0a122b
0a122b
This patch applies on top and adds such a feature bit to QEMU.
0a122b
It is set by default for virtio-net.
0a122b
virtio net header inline with the data is beneficial
0a122b
for latency and small packet bandwidth - guest driver
0a122b
code utilizing this feature has been acked but missed 3.11
0a122b
by a narrow margin, it's pending for 3.12.
0a122b
0a122b
This feature bit is cleared by default when compatibility with old
0a122b
machine types is requested.
0a122b
0a122b
Other performance-sensitive devices (blk and scsi)
0a122b
don't yet support arbitrary s/g layouts, so
0a122b
we only set this bit for virtio-net for now.
0a122b
There are plans to allow arbitrary layouts there, but
0a122b
no code has been posted yet.
0a122b
0a122b
Cc: Rusty Russell <rusty@rustcorp.com.au>
0a122b
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
0a122b
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
0a122b
(cherry picked from commit 488f069bd1f3aeb6ee748acb02b7581831bcb3f8)
0a122b
0a122b
Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7155286
0a122b
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=990989
0a122b
Tested: on developer's box
0a122b
0a122b
Conflicts:
0a122b
	include/hw/i386/pc.h
0a122b
---
0a122b
0a122b
Oops, the patch got lost somehow.
0a122b
I was sure our last rebase included it but no ...
0a122b
Pls review ASAP and we'll discuss setting blocker for this one
0a122b
separately.
0a122b
0a122b
Impossible to fix in zstream since it would affect
0a122b
migration.
0a122b
0a122b
 include/hw/i386/pc.h           | 4 ++++
0a122b
 include/hw/virtio/virtio-net.h | 1 +
0a122b
 include/hw/virtio/virtio.h     | 2 ++
0a122b
 hw/i386/pc_piix.c              | 4 ++++
0a122b
 4 files changed, 11 insertions(+)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/i386/pc_piix.c              |    4 ++++
0a122b
 include/hw/i386/pc.h           |    4 ++++
0a122b
 include/hw/virtio/virtio-net.h |    1 +
0a122b
 include/hw/virtio/virtio.h     |    2 ++
0a122b
 4 files changed, 11 insertions(+), 0 deletions(-)
0a122b
0a122b
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
0a122b
index 697f12f..98a5253 100644
0a122b
--- a/hw/i386/pc_piix.c
0a122b
+++ b/hw/i386/pc_piix.c
0a122b
@@ -904,6 +904,10 @@ static QEMUMachine pc_machine_rhel700 = {
0a122b
         .driver   = TYPE_USB_DEVICE,\
0a122b
         .property = "msos-desc",\
0a122b
         .value    = "no",\
0a122b
+    },{\
0a122b
+        .driver   = "virtio-net-pci",\
0a122b
+        .property = "any_layout",\
0a122b
+        .value    = "off",\
0a122b
     }
0a122b
 
0a122b
 static void pc_compat_rhel650(QEMUMachineInitArgs *args)
0a122b
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
0a122b
index f56e9ea..8a69347 100644
0a122b
--- a/include/hw/i386/pc.h
0a122b
+++ b/include/hw/i386/pc.h
0a122b
@@ -274,6 +274,10 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t);
0a122b
             .driver = TYPE_X86_CPU,\
0a122b
             .property = "pmu",\
0a122b
             .value = "on",\
0a122b
+        },{\
0a122b
+            .driver   = "virtio-net-pci",\
0a122b
+            .property = "any_layout",\
0a122b
+            .value    = "off",\
0a122b
         }
0a122b
 
0a122b
 #define PC_COMPAT_1_4 \
0a122b
diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h
0a122b
index beeead7..75723a8 100644
0a122b
--- a/include/hw/virtio/virtio-net.h
0a122b
+++ b/include/hw/virtio/virtio-net.h
0a122b
@@ -231,6 +231,7 @@ struct virtio_net_ctrl_mq {
0a122b
 
0a122b
 #define DEFINE_VIRTIO_NET_FEATURES(_state, _field) \
0a122b
         DEFINE_VIRTIO_COMMON_FEATURES(_state, _field), \
0a122b
+        DEFINE_PROP_BIT("any_layout", _state, _field, VIRTIO_F_ANY_LAYOUT, true), \
0a122b
         DEFINE_PROP_BIT("csum", _state, _field, VIRTIO_NET_F_CSUM, true), \
0a122b
         DEFINE_PROP_BIT("guest_csum", _state, _field, VIRTIO_NET_F_GUEST_CSUM, true), \
0a122b
         DEFINE_PROP_BIT("gso", _state, _field, VIRTIO_NET_F_GSO, true), \
0a122b
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
0a122b
index cd886c3..9e22865 100644
0a122b
--- a/include/hw/virtio/virtio.h
0a122b
+++ b/include/hw/virtio/virtio.h
0a122b
@@ -43,6 +43,8 @@
0a122b
 /* We notify when the ring is completely used, even if the guest is suppressing
0a122b
  * callbacks */
0a122b
 #define VIRTIO_F_NOTIFY_ON_EMPTY        24
0a122b
+/* Can the device handle any descriptor layout? */
0a122b
+#define VIRTIO_F_ANY_LAYOUT             27
0a122b
 /* We support indirect buffer descriptors */
0a122b
 #define VIRTIO_RING_F_INDIRECT_DESC     28
0a122b
 /* The Guest publishes the used index for which it expects an interrupt
0a122b
-- 
0a122b
1.7.1
0a122b