Patchwork [PATCHv2,1/2] virtio-net: remove mq feature

login
register
mail settings
Submitter Michael S. Tsirkin
Date Feb. 7, 2013, 9:46 a.m.
Message ID <49e440fb98587efecd6ca96cbe459231fc922b9e.1360229117.git.mst@redhat.com>
Download mbox | patch
Permalink /patch/218872/
State New
Headers show

Comments

Michael S. Tsirkin - Feb. 7, 2013, 9:46 a.m.
mq feature is not needed: we can look at the number of queues and set
the flag accordingly.
Removing this feature removes ambiguity (what does it mean to have
queues=2 with mq=off?).

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

These are just the bits that remove the feature.
The windows bug workaround can be applied separately,
once we decide what it is.

 hw/pc_piix.c    | 4 ----
 hw/virtio-net.c | 4 ++++
 hw/virtio-net.h | 4 +---
 3 files changed, 5 insertions(+), 7 deletions(-)

Patch

diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 0af436c..ba09714 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -313,10 +313,6 @@  static QEMUMachine pc_i440fx_machine_v1_4 = {
             .driver   = "virtio-net-pci",\
             .property = "ctrl_mac_addr",\
             .value    = "off",      \
-        },{ \
-            .driver   = "virtio-net-pci", \
-            .property = "mq", \
-            .value    = "off", \
         }
 
 static QEMUMachine pc_machine_v1_3 = {
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index e37358a..510a0f6 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -346,6 +346,10 @@  static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features)
 
     features |= (1 << VIRTIO_NET_F_MAC);
 
+    if (n->max_queues > 1) {
+        features |= (0x1 << VIRTIO_NET_F_MQ);
+    }
+
     if (!peer_has_vnet_hdr(n)) {
         features &= ~(0x1 << VIRTIO_NET_F_CSUM);
         features &= ~(0x1 << VIRTIO_NET_F_HOST_TSO4);
diff --git a/hw/virtio-net.h b/hw/virtio-net.h
index f5fea6e..414365d 100644
--- a/hw/virtio-net.h
+++ b/hw/virtio-net.h
@@ -190,7 +190,5 @@  struct virtio_net_ctrl_mq {
         DEFINE_PROP_BIT("ctrl_rx", _state, _field, VIRTIO_NET_F_CTRL_RX, true), \
         DEFINE_PROP_BIT("ctrl_vlan", _state, _field, VIRTIO_NET_F_CTRL_VLAN, true), \
         DEFINE_PROP_BIT("ctrl_rx_extra", _state, _field, VIRTIO_NET_F_CTRL_RX_EXTRA, true), \
-        DEFINE_PROP_BIT("ctrl_mac_addr", _state, _field, VIRTIO_NET_F_CTRL_MAC_ADDR, true), \
-        DEFINE_PROP_BIT("mq", _state, _field, VIRTIO_NET_F_MQ, true)
-
+        DEFINE_PROP_BIT("ctrl_mac_addr", _state, _field, VIRTIO_NET_F_CTRL_MAC_ADDR, true)
 #endif